quantum-component-library 1.4.45-qa.9 → 1.4.46-qa

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 (54) hide show
  1. package/README.md +115 -115
  2. package/dist/components/copy-activity-form/index.d.ts +6 -4
  3. package/dist/components.cjs +1 -13
  4. package/dist/components.js +1292 -1175
  5. package/dist/{dnd-core-vendor-xRlmIagQ.cjs → dnd-core-vendor-2Ve0kqUN.cjs} +1 -1
  6. package/dist/{dnd-core-vendor-ewNS-_6P.js → dnd-core-vendor-CErAmYu_.js} +2 -2
  7. package/dist/emotion-react-vendor-CHdBBD18.cjs +1 -0
  8. package/dist/emotion-react-vendor-CSrsXjBq.js +81 -0
  9. package/dist/emotion-vendor-D6PQH2K8.cjs +1 -0
  10. package/dist/emotion-vendor-DNnoMT20.js +546 -0
  11. package/dist/generated/gql.d.ts +5 -0
  12. package/dist/generated/graphql.d.ts +19 -0
  13. package/dist/{generated-ChsGaiYd.cjs → generated-B5QGMyhw.cjs} +1 -1
  14. package/dist/{generated-GfcSQz21.js → generated-esGwfMXj.js} +21 -20
  15. package/dist/graphql/mutations/actions.d.ts +3 -0
  16. package/dist/{graphql-DiUes2Np.js → graphql-CZIf58Fd.js} +37 -30
  17. package/dist/{graphql-CqPvuCvr.cjs → graphql-KvyVlavd.cjs} +18 -12
  18. package/dist/graphql-vendor-BWnD0b-j.js +1285 -0
  19. package/dist/graphql-vendor-CL0XsjHb.cjs +19 -0
  20. package/dist/hoist-non-react-statics-vendor-C5vG1oEE.cjs +1 -0
  21. package/dist/hoist-non-react-statics-vendor-DJU3S3cV.js +68 -0
  22. package/dist/hooks.cjs +1 -1
  23. package/dist/hooks.js +11 -12
  24. package/dist/lib/services/rom.json.d.ts +223 -223
  25. package/dist/providers.cjs +1 -1
  26. package/dist/providers.js +8 -8
  27. package/dist/quantum-component-library.css +1 -1
  28. package/dist/react-dnd-vendor-BPzSDojS.cjs +2 -0
  29. package/dist/{react-dnd-vendor-D7sre4BN.js → react-dnd-vendor-D4nn9Mqx.js} +3 -3
  30. package/dist/react-is-vendor-CosIbvzW.cjs +15 -0
  31. package/dist/react-is-vendor-DpFLFzFZ.js +174 -0
  32. package/dist/{react-select-vendor-BlikzKjV.cjs → react-select-vendor-BPaBUHFp.cjs} +1 -1
  33. package/dist/{react-select-vendor-D_4gQlHN.js → react-select-vendor-C_DuqfB7.js} +3 -3
  34. package/dist/stylis-vendor-CdCMw5Aa.js +334 -0
  35. package/dist/stylis-vendor-DzcTLVj9.cjs +1 -0
  36. package/dist/{vendor-DC_iiTML.js → tailwind-vendor-B4y94WzT.js} +477 -1349
  37. package/dist/tailwind-vendor-C0M23-WD.cjs +1 -0
  38. package/dist/types.cjs +1 -1
  39. package/dist/types.js +1 -1
  40. package/dist/ufuzzy-vendor-7qHa_k39.cjs +1 -0
  41. package/dist/ufuzzy-vendor-Dl0ZI6Av.js +456 -0
  42. package/dist/utils.cjs +1 -1
  43. package/dist/utils.js +8 -8
  44. package/dist/vendor-BjLvygDR.cjs +1 -0
  45. package/dist/vendor-VALJ9W3p.js +526 -0
  46. package/package.json +123 -128
  47. package/dist/graphql-vendor-BfLpwsFp.cjs +0 -14
  48. package/dist/graphql-vendor-CLcjksUW.js +0 -669
  49. package/dist/react-dnd-vendor-8KALuSw2.cjs +0 -2
  50. package/dist/styled-components-vendor-Bvwhddj9.js +0 -1154
  51. package/dist/styled-components-vendor-D09ATioU.cjs +0 -60
  52. package/dist/vendor-BTmhipxH.cjs +0 -1
  53. /package/dist/{other-react-vendor-Dszzpdy0.cjs → react-jsx-runtime-vendor-Dszzpdy0.cjs} +0 -0
  54. /package/dist/{other-react-vendor-OVHDjVDe.js → react-jsx-runtime-vendor-OVHDjVDe.js} +0 -0
@@ -1,317 +1,326 @@
1
- import { j as e } from "./other-react-vendor-OVHDjVDe.js";
2
- import { Flex as le, InputGroup as Pe, InputLeftElement as ls, Icon as We, Input as ye, FormLabel as $e, Box as B, TableContainer as Qe, Table as qe, Thead as He, Tr as Ce, Th as ie, Tbody as Ye, Td as re, ButtonGroup as ce, Tooltip as Je, Button as $, RangeSlider as as, RangeSliderMark as Ae, Text as M, RangeSliderTrack as cs, RangeSliderFilledTrack as ds, RangeSliderThumb as _e, Select as ze, NumberInput as Ue, NumberInputField as Ge, HStack as K, Tag as de, Checkbox as us, useToast as Ke, VStack as V, FormControl as G, Alert as be, AlertIcon as ve, Spinner as Xe, useDisclosure as hs, Modal as ms, ModalOverlay as gs, ModalContent as ps, ModalHeader as xs, ModalCloseButton as fs, ModalBody as js, ModalFooter as bs, IconButton as vs, Textarea as Ie } from "@chakra-ui/react";
3
- import { useMemo as D, useState as F, useCallback as O, useRef as ys, useEffect as Y, memo as Se } from "react";
4
- import { u as Cs } from "./vendor-DC_iiTML.js";
5
- import { d as Ze } from "./styled-components-vendor-Bvwhddj9.js";
6
- import { s as se, y as Ss } from "./react-select-vendor-D_4gQlHN.js";
7
- import { F as ws, a as Ms } from "./react-icons-vendor-TETORdU9.js";
8
- import { useQuery as ee, useMutation as oe, useClient as As } from "urql";
9
- import { g as W, T as je, S as k, A as ge, a as Te } from "./generated-GfcSQz21.js";
10
- import { G as Ve, a as Is, C as De, A as ae, b as es, c as Ts, d as ss, e as Re, M as ts, f as Le, U as Ns, g as Os, S as Rs, h as Ls, i as Fs, j as Ds, k as ks, l as Es, m as Ps } from "./graphql-DiUes2Np.js";
11
- import { D as _s, H as zs, u as Us, a as Gs } from "./react-dnd-vendor-D7sre4BN.js";
12
- import { getSegmentNameWithPlane as ns, getJointNameWithPlane as is, getJointAngleDirectionName as Bs, getSegmentAngleDirectionName as Ws, getNormativeJointRange as $s } from "./services.js";
13
- import { availablePlanes as Be, getAnalysisPartIdNoSide as pe } from "./types.js";
14
- import { thresholdsToParameters as Qs, parametersToThresholds as Ne, cn as qs } from "./utils.js";
15
- import { usePartOptionsForSensorLocations as Hs } from "./hooks.js";
16
- const Ys = ({
17
- setSearch: t,
1
+ import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
+ import { Flex as he, InputGroup as Pe, InputLeftElement as dt, Icon as Qe, Input as Ie, FormLabel as qe, Box as q, TableContainer as He, Table as Ye, Thead as Je, Tr as Me, Th as ce, Tbody as Ke, Td as ue, ButtonGroup as me, Tooltip as Xe, Button as J, RangeSlider as ut, RangeSliderMark as Re, Text as v, RangeSliderTrack as ht, RangeSliderFilledTrack as mt, RangeSliderThumb as Ue, Select as $e, NumberInput as Ge, NumberInputField as We, HStack as X, Tag as ge, Checkbox as pt, useToast as Ze, VStack as Z, FormControl as W, RadioGroup as Ve, Radio as Ae, Alert as Oe, AlertIcon as Te, Spinner as et, useDisclosure as gt, Modal as xt, ModalOverlay as ft, ModalContent as jt, ModalHeader as vt, ModalCloseButton as bt, ModalBody as yt, ModalFooter as Ct, IconButton as wt, Textarea as Le } from "@chakra-ui/react";
3
+ import { useMemo as _, useState as E, useCallback as N, useRef as St, useEffect as V, memo as Ne } from "react";
4
+ import { u as Mt } from "./ufuzzy-vendor-Dl0ZI6Av.js";
5
+ import { s as ie, y as At } from "./react-select-vendor-C_DuqfB7.js";
6
+ import { F as Ot, a as Tt } from "./react-icons-vendor-TETORdU9.js";
7
+ import { u as oe, a as te, b as It } from "./graphql-vendor-BWnD0b-j.js";
8
+ import { g as B, T as we, S as z, A as ve, a as Fe } from "./generated-esGwfMXj.js";
9
+ import { A as re, G as tt, a as Nt, C as ze, b as st, c as nt, d as Se, M as ot, e as ke, f as Rt, U as rt, g as it, S as Lt, h as Ft, i as Et, j as Dt, k as kt, l as _t, m as zt, n as Pt } from "./graphql-CZIf58Fd.js";
10
+ import { D as Ut, H as $t, u as Gt, a as Wt } from "./react-dnd-vendor-D4nn9Mqx.js";
11
+ import { getSegmentNameWithPlane as lt, getJointNameWithPlane as at, getJointAngleDirectionName as Bt, getSegmentAngleDirectionName as Qt, getNormativeJointRange as qt } from "./services.js";
12
+ import { availablePlanes as Be, getAnalysisPartIdNoSide as be } from "./types.js";
13
+ import { thresholdsToParameters as Ht, parametersToThresholds as Ee, cn as Yt } from "./utils.js";
14
+ import { usePartOptionsForSensorLocations as Jt } from "./hooks.js";
15
+ const Kt = ({
16
+ setSearch: n,
18
17
  actions: s,
19
- updateUseCases: o
18
+ updateUseCases: r
20
19
  }) => {
21
- const u = D(
22
- () => s?.flatMap((l) => l.useCases).filter((l, a, m) => m.findIndex((f) => f.id === l.id) === a).map((l) => ({
23
- label: l.name,
24
- value: l.id
20
+ const d = _(
21
+ () => s?.flatMap((i) => i.useCases).filter((i, l, u) => u.findIndex((g) => g.id === i.id) === l).map((i) => ({
22
+ label: i.name,
23
+ value: i.id
25
24
  })) || [],
26
25
  [s]
27
26
  );
28
- return /* @__PURE__ */ e.jsxs(le, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
27
+ return /* @__PURE__ */ e.jsxs(he, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
29
28
  /* @__PURE__ */ e.jsxs(Pe, { size: "md", children: [
30
- /* @__PURE__ */ e.jsx(ls, { children: /* @__PURE__ */ e.jsx(We, { as: ws, color: "gray.300" }) }),
29
+ /* @__PURE__ */ e.jsx(dt, { children: /* @__PURE__ */ e.jsx(Qe, { as: Ot, color: "gray.300" }) }),
31
30
  /* @__PURE__ */ e.jsx(
32
- ye,
31
+ Ie,
33
32
  {
34
33
  placeholder: "Search by name...",
35
34
  maxW: "30rem",
36
- onChange: (l) => t(l.target.value)
35
+ onChange: (i) => n(i.target.value)
37
36
  }
38
37
  )
39
38
  ] }),
40
39
  /* @__PURE__ */ e.jsx(Pe, { size: "md", children: /* @__PURE__ */ e.jsx(
41
- se,
40
+ ie,
42
41
  {
43
42
  size: "md",
44
43
  chakraStyles: {
45
- container: (l) => ({
46
- ...l,
44
+ container: (i) => ({
45
+ ...i,
47
46
  width: "100%"
48
47
  })
49
48
  },
50
49
  menuPortalTarget: document.body,
51
50
  placeholder: "Filter use case",
52
51
  isMulti: !0,
53
- options: u,
54
- onChange: (l) => o(l.map((a) => a.value))
52
+ options: d,
53
+ onChange: (i) => r(i.map((l) => l.value))
55
54
  }
56
55
  ) })
57
56
  ] });
58
- }, te = ({
59
- children: t
60
- }) => /* @__PURE__ */ e.jsx($e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: t }), Js = ({ value: t, onChange: s }) => {
61
- const o = F(
57
+ }, se = ({
58
+ children: n
59
+ }) => /* @__PURE__ */ e.jsx(qe, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Xt = ({ value: n, onChange: s }) => {
60
+ const r = E(
62
61
  () => Math.random().toString(36).substring(2, 15)
63
- )[0], u = O(
64
- (l, a) => {
65
- s((m) => {
66
- const f = [...m], [j] = f.splice(l, 1);
67
- return f.splice(a, 0, j), f;
62
+ )[0], d = N(
63
+ (i, l) => {
64
+ s((u) => {
65
+ const g = [...u], [a] = g.splice(i, 1);
66
+ return g.splice(l, 0, a), g;
68
67
  });
69
68
  },
70
69
  [s]
71
70
  );
72
- return /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(_s, { backend: zs, children: /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsxs(qe, { variant: "simple", size: "md", children: [
73
- /* @__PURE__ */ e.jsx(He, { children: /* @__PURE__ */ e.jsxs(Ce, { children: [
74
- /* @__PURE__ */ e.jsx(ie, { children: "Order" }),
75
- /* @__PURE__ */ e.jsx(ie, { children: "Name" })
71
+ return /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsx(Ut, { backend: $t, children: /* @__PURE__ */ e.jsx(He, { children: /* @__PURE__ */ e.jsxs(Ye, { variant: "simple", size: "md", children: [
72
+ /* @__PURE__ */ e.jsx(Je, { children: /* @__PURE__ */ e.jsxs(Me, { children: [
73
+ /* @__PURE__ */ e.jsx(ce, { children: "Order" }),
74
+ /* @__PURE__ */ e.jsx(ce, { children: "Name" })
76
75
  ] }) }),
77
- /* @__PURE__ */ e.jsx(Ye, { children: t.map((l, a) => /* @__PURE__ */ e.jsx(
78
- Ks,
76
+ /* @__PURE__ */ e.jsx(Ke, { children: n.map((i, l) => /* @__PURE__ */ e.jsx(
77
+ Zt,
79
78
  {
80
- listKey: o,
81
- index: a,
82
- id: l.id,
83
- name: l.name,
84
- move: u
79
+ listKey: r,
80
+ index: l,
81
+ id: i.id,
82
+ name: i.name,
83
+ move: d
85
84
  },
86
- l.id
85
+ i.id
87
86
  )) })
88
87
  ] }) }) }) });
89
- }, Ks = ({ listKey: t, index: s, id: o, name: u, move: l }) => {
90
- const a = ys(null), [{ handlerId: m }, f] = Us({
91
- accept: t,
88
+ }, Zt = ({ listKey: n, index: s, id: r, name: d, move: i }) => {
89
+ const l = St(null), [{ handlerId: u }, g] = Gt({
90
+ accept: n,
92
91
  collect: (x) => ({
93
92
  handlerId: x.getHandlerId()?.toString() ?? ""
94
93
  }),
95
94
  hover: (x, A) => {
96
- if (!a.current)
95
+ if (!l.current)
97
96
  return;
98
- const d = x.index, r = s;
99
- if (d === r)
97
+ const o = x.index, c = s;
98
+ if (o === c)
100
99
  return;
101
- const S = a.current?.getBoundingClientRect(), b = (S.bottom - S.top) / 2, h = A.getClientOffset().y - S.top;
102
- d < r && h < b || d > r && h > b || (l(d, r), x.index = r);
100
+ const j = l.current?.getBoundingClientRect(), m = (j.bottom - j.top) / 2, w = A.getClientOffset().y - j.top;
101
+ o < c && w < m || o > c && w > m || (i(o, c), x.index = c);
103
102
  }
104
- }), [{ isDragging: j }, C] = Gs({
105
- type: t,
106
- item: () => ({ id: o, index: s }),
103
+ }), [{ isDragging: a }, M] = Wt({
104
+ type: n,
105
+ item: () => ({ id: r, index: s }),
107
106
  collect: (x) => ({
108
107
  isDragging: x.isDragging()
109
108
  })
110
- }), I = j ? 0.6 : 1, p = j ? "grabbing" : "grab";
111
- return C(f(a)), /* @__PURE__ */ e.jsxs(Ce, { ref: a, style: { opacity: I, cursor: p }, "data-handler-id": m, children: [
112
- /* @__PURE__ */ e.jsx(re, { children: s + 1 }),
113
- /* @__PURE__ */ e.jsx(re, { children: u })
109
+ }), T = a ? 0.6 : 1, p = a ? "grabbing" : "grab";
110
+ return M(g(l)), /* @__PURE__ */ e.jsxs(Me, { ref: l, style: { opacity: T, cursor: p }, "data-handler-id": u, children: [
111
+ /* @__PURE__ */ e.jsx(ue, { children: s + 1 }),
112
+ /* @__PURE__ */ e.jsx(ue, { children: d })
114
113
  ] });
115
- }, Fe = ({
116
- items: t,
114
+ }, _e = ({
115
+ items: n,
117
116
  onChange: s,
118
- selectedItem: o,
119
- isDisabled: u,
120
- selectedProps: l,
121
- buttonProps: a
117
+ selectedItem: r,
118
+ isDisabled: d,
119
+ selectedProps: i,
120
+ buttonProps: l
122
121
  }) => {
123
- const m = (j) => j === o || j.value === o, f = (j) => m(j) ? { ...a, ...l } : a;
124
- return /* @__PURE__ */ e.jsx(ce, { isAttached: !0, isDisabled: u, children: t.map((j, C) => /* @__PURE__ */ e.jsx(
125
- Je,
122
+ const u = (a) => a === r || a.value === r, g = (a) => u(a) ? { ...l, ...i } : l;
123
+ return /* @__PURE__ */ e.jsx(me, { isAttached: !0, isDisabled: d, children: n.map((a, M) => /* @__PURE__ */ e.jsx(
124
+ Xe,
126
125
  {
127
- label: j.tooltip,
126
+ label: a.tooltip,
128
127
  openDelay: 50,
129
128
  closeDelay: 200,
130
129
  placement: "top",
131
- visibility: j.tooltip ? "visible" : "hidden",
130
+ visibility: a.tooltip ? "visible" : "hidden",
132
131
  hasArrow: !0,
133
132
  children: /* @__PURE__ */ e.jsx(
134
- $,
133
+ J,
135
134
  {
136
- onClick: () => m(j) ? null : s(j, C),
137
- isDisabled: j.disabled,
138
- ...f(j),
139
- children: j.label
135
+ onClick: () => u(a) ? null : s(a, M),
136
+ isDisabled: a.disabled,
137
+ ...g(a),
138
+ children: a.label
140
139
  }
141
140
  )
142
141
  },
143
- C
142
+ M
144
143
  )) });
145
- }, xe = (t, s) => s < 0 ? -1 * Math.abs(t) : Math.abs(t), Xs = ({
146
- isReversed: t,
144
+ }, ye = (n, s) => s < 0 ? -1 * Math.abs(n) : Math.abs(n), Vt = ({
145
+ isReversed: n,
147
146
  min: s,
148
- max: o,
149
- value: u,
150
- onChange: l,
151
- inputProps: a,
152
- size: m,
153
- zeroMarker: f,
154
- formatValue: j,
155
- valueLabel: C,
156
- positiveNegativeLabels: I,
147
+ max: r,
148
+ value: d,
149
+ onChange: i,
150
+ inputProps: l,
151
+ size: u,
152
+ zeroMarker: g,
153
+ formatValue: a,
154
+ valueLabel: M,
155
+ positiveNegativeLabels: T,
157
156
  isDisabled: p,
158
157
  ...x
159
158
  }) => {
160
- const [A, d] = F([void 0, void 0]), r = A[0], S = A[1], b = f && s < -5 && o > 5, v = Number(u?.[0] ?? S ?? s) > 0 ? 1 : -1, h = Number(u?.[1] ?? S ?? o) < 0 ? -1 : 1, g = I?.[0] === I?.[1], w = u?.[0], P = u?.[1];
161
- Y(() => {
162
- w !== void 0 && P !== void 0 && d([w.toFixed(0), P.toFixed(0)]);
163
- }, [w, P, d]);
164
- const T = O(
165
- ([i, y]) => {
166
- i < y && d([i.toFixed(0), y.toFixed(0)]);
159
+ const [A, o] = E([void 0, void 0]), c = A[0], j = A[1], m = g && s < -5 && r > 5, C = Number(d?.[0] ?? j ?? s) > 0 ? 1 : -1, w = Number(d?.[1] ?? j ?? r) < 0 ? -1 : 1, S = T?.[0] === T?.[1], b = d?.[0], O = d?.[1];
160
+ V(() => {
161
+ b !== void 0 && O !== void 0 && o([b.toFixed(0), O.toFixed(0)]);
162
+ }, [b, O, o]);
163
+ const I = N(
164
+ ([y, L]) => {
165
+ y < L && o([y.toFixed(0), L.toFixed(0)]);
167
166
  },
168
- [d]
169
- ), q = O(
170
- ([i, y]) => {
171
- i < y && l([i, y]);
167
+ [o]
168
+ ), D = N(
169
+ ([y, L]) => {
170
+ y < L && i([y, L]);
172
171
  },
173
- [l]
174
- ), R = O(() => {
175
- d(([i, y]) => {
176
- const L = isNaN(Number(i)) ? s : Number(i), _ = isNaN(Number(y)) ? o : Number(y), H = xe(Number(L), v), E = xe(Number(_), h), J = v < 0 ? Math.max(H, s) : Math.min(H, o), z = h < 0 ? Math.max(E, s) : Math.min(E, o);
177
- return J > z ? (l([z, J]), [z.toFixed(0), J.toFixed(0)]) : (l([J, z]), [J.toFixed(0), z.toFixed(0)]);
172
+ [i]
173
+ ), P = N(() => {
174
+ o(([y, L]) => {
175
+ const K = isNaN(Number(y)) ? s : Number(y), t = isNaN(Number(L)) ? r : Number(L), h = ye(Number(K), C), f = ye(Number(t), w), F = C < 0 ? Math.max(h, s) : Math.min(h, r), U = w < 0 ? Math.max(f, s) : Math.min(f, r);
176
+ return F > U ? (i([U, F]), [U.toFixed(0), F.toFixed(0)]) : (i([F, U]), [F.toFixed(0), U.toFixed(0)]);
178
177
  });
179
- }, [l, d, v, h, s, o]), Q = O(
180
- (i) => {
181
- const y = i === "" || isNaN(Number(i)) ? i : xe(Number(i), v);
182
- d(([L, _]) => [y.toString(), _]);
178
+ }, [i, o, C, w, s, r]), ee = N(
179
+ (y) => {
180
+ const L = y === "" || isNaN(Number(y)) ? y : ye(Number(y), C);
181
+ o(([K, t]) => [L.toString(), t]);
183
182
  },
184
- [d, v]
185
- ), U = O(
186
- (i) => {
187
- const y = i === "" || isNaN(Number(i)) ? i : xe(Number(i), h);
188
- d(([L, _]) => [L, y.toString()]);
183
+ [o, C]
184
+ ), $ = N(
185
+ (y) => {
186
+ const L = y === "" || isNaN(Number(y)) ? y : ye(Number(y), w);
187
+ o(([K, t]) => [K, L.toString()]);
189
188
  },
190
- [d, h]
191
- ), c = D(
192
- () => m === "xs" ? "0.75rem" : void 0,
193
- [m]
194
- ), n = O(
195
- (i, y) => {
196
- const L = Number(y.target.value);
197
- if (!r || !S || ![-1, 1].includes(L))
189
+ [o, w]
190
+ ), k = _(
191
+ () => u === "xs" ? "0.75rem" : void 0,
192
+ [u]
193
+ ), H = N(
194
+ (y, L) => {
195
+ const K = Number(L.target.value);
196
+ if (!c || !j || ![-1, 1].includes(K))
198
197
  return;
199
- const _ = (J) => L < 0 ? -1 * Math.abs(J) : Math.abs(J), H = i ? _(Number(r)) : Number(r), E = i ? Number(S) : _(Number(S));
200
- H > E ? l([E, H]) : l([H, E]);
198
+ const t = (F) => K < 0 ? -1 * Math.abs(F) : Math.abs(F), h = y ? t(Number(c)) : Number(c), f = y ? Number(j) : t(Number(j));
199
+ h > f ? i([f, h]) : i([h, f]);
201
200
  },
202
- [r, S, l]
201
+ [c, j, i]
203
202
  );
204
- return /* @__PURE__ */ e.jsxs(le, { direction: "column", ...x, children: [
205
- /* @__PURE__ */ e.jsx(B, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
206
- as,
203
+ return /* @__PURE__ */ e.jsxs(he, { direction: "column", ...x, children: [
204
+ /* @__PURE__ */ e.jsx(q, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
205
+ ut,
207
206
  {
208
207
  "aria-label": ["min", "max"],
209
- isReversed: t,
210
- value: [Number(r ?? s), Number(S ?? o)],
211
- max: o,
208
+ isReversed: n,
209
+ value: [Number(c ?? s), Number(j ?? r)],
210
+ max: r,
212
211
  min: s,
213
212
  minStepsBetweenThumbs: 3,
214
213
  step: 1,
215
- onChange: T,
216
- onChangeEnd: q,
214
+ onChange: I,
215
+ onChangeEnd: D,
217
216
  isDisabled: p,
218
217
  children: [
219
- /* @__PURE__ */ e.jsx(Ae, { value: s, top: "-1em", children: /* @__PURE__ */ e.jsx(
220
- M,
218
+ /* @__PURE__ */ e.jsx(Re, { value: s, top: "-1em", children: /* @__PURE__ */ e.jsx(
219
+ v,
221
220
  {
222
- fontSize: m ?? "sm",
221
+ fontSize: u ?? "sm",
223
222
  fontWeight: "semibold",
224
223
  whiteSpace: "nowrap",
225
- children: j ? j?.(s) : s
224
+ children: a ? a?.(s) : s
226
225
  }
227
226
  ) }),
228
- /* @__PURE__ */ e.jsx(Ae, { value: o, top: "-1em", children: /* @__PURE__ */ e.jsx(
229
- M,
227
+ /* @__PURE__ */ e.jsx(Re, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
228
+ v,
230
229
  {
231
- fontSize: m ?? "sm",
230
+ fontSize: u ?? "sm",
232
231
  fontWeight: "semibold",
233
232
  style: { transform: "translateX(-100%)" },
234
233
  whiteSpace: "nowrap",
235
- children: j ? j(o) : o
234
+ children: a ? a(r) : r
236
235
  }
237
236
  ) }),
238
- b && /* @__PURE__ */ e.jsxs(Ae, { value: 0, top: "-1em", pos: "relative", children: [
239
- /* @__PURE__ */ e.jsx(M, { fontSize: m, fontWeight: "semibold", children: j?.(0) ?? "0" }),
240
- /* @__PURE__ */ e.jsx(Zs, {})
237
+ m && /* @__PURE__ */ e.jsxs(Re, { value: 0, top: "-1em", pos: "relative", children: [
238
+ /* @__PURE__ */ e.jsx(v, { fontSize: u, fontWeight: "semibold", children: a?.(0) ?? "0" }),
239
+ /* @__PURE__ */ e.jsx(
240
+ q,
241
+ {
242
+ position: "absolute",
243
+ width: "2px",
244
+ height: "1em",
245
+ top: "90%",
246
+ left: "20%",
247
+ backgroundColor: "var(--chakra-colors-gray-300)"
248
+ }
249
+ )
241
250
  ] }),
242
- /* @__PURE__ */ e.jsx(cs, { children: /* @__PURE__ */ e.jsx(ds, {}) }),
243
- /* @__PURE__ */ e.jsx(_e, { index: 0, w: c, h: c }),
244
- /* @__PURE__ */ e.jsx(_e, { index: 1, w: c, h: c })
251
+ /* @__PURE__ */ e.jsx(ht, { children: /* @__PURE__ */ e.jsx(mt, {}) }),
252
+ /* @__PURE__ */ e.jsx(Ue, { index: 0, w: k, h: k }),
253
+ /* @__PURE__ */ e.jsx(Ue, { index: 1, w: k, h: k })
245
254
  ]
246
255
  }
247
256
  ) }),
248
- C && /* @__PURE__ */ e.jsxs(
249
- le,
257
+ M && /* @__PURE__ */ e.jsxs(
258
+ he,
250
259
  {
251
- direction: t ? "row-reverse" : "row",
260
+ direction: n ? "row-reverse" : "row",
252
261
  justifyContent: "space-between",
253
262
  children: [
254
263
  /* @__PURE__ */ e.jsx(
255
- M,
264
+ v,
256
265
  {
257
- fontSize: m ?? "sm",
266
+ fontSize: u ?? "sm",
258
267
  fontWeight: "semibold",
259
268
  whiteSpace: "nowrap",
260
- children: C(s)
269
+ children: M(s)
261
270
  }
262
271
  ),
263
272
  /* @__PURE__ */ e.jsx(
264
- M,
273
+ v,
265
274
  {
266
- fontSize: m ?? "sm",
275
+ fontSize: u ?? "sm",
267
276
  fontWeight: "semibold",
268
277
  whiteSpace: "nowrap",
269
- children: C(o)
278
+ children: M(r)
270
279
  }
271
280
  )
272
281
  ]
273
282
  }
274
283
  ),
275
284
  /* @__PURE__ */ e.jsxs(
276
- le,
285
+ he,
277
286
  {
278
- direction: t ? "row-reverse" : "row",
287
+ direction: n ? "row-reverse" : "row",
279
288
  justifyContent: "center",
280
289
  alignItems: "center",
281
290
  gap: "0.125em",
282
291
  children: [
283
- I && /* @__PURE__ */ e.jsxs(
284
- ze,
292
+ T && /* @__PURE__ */ e.jsxs(
293
+ $e,
285
294
  {
286
295
  width: "auto",
287
- size: m,
296
+ size: u,
288
297
  fontWeight: "bold",
289
- value: v,
290
- onChange: (i) => n(!0, i),
291
- isDisabled: g || p,
298
+ value: C,
299
+ onChange: (y) => H(!0, y),
300
+ isDisabled: S || p,
292
301
  children: [
293
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
294
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
302
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: T[0] }),
303
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: T[1] })
295
304
  ]
296
305
  }
297
306
  ),
298
307
  /* @__PURE__ */ e.jsx(
299
- Ue,
308
+ Ge,
300
309
  {
301
310
  precision: 0,
302
- size: m ?? "sm",
311
+ size: u ?? "sm",
303
312
  min: 0,
304
- max: v < 0 ? Math.abs(s) : P ?? o,
305
- value: r === "" ? "" : Math.abs(Number(r ?? s)),
306
- onChange: Q,
307
- onBlur: R,
313
+ max: C < 0 ? Math.abs(s) : O ?? r,
314
+ value: c === "" ? "" : Math.abs(Number(c ?? s)),
315
+ onChange: ee,
316
+ onBlur: P,
308
317
  borderWidth: 1,
309
318
  borderRadius: 3,
310
319
  borderColor: "#ccc",
311
320
  isDisabled: p,
312
- ...a,
321
+ ...l,
313
322
  children: /* @__PURE__ */ e.jsx(
314
- Ge,
323
+ We,
315
324
  {
316
325
  backgroundColor: "#fff",
317
326
  paddingRight: 0,
@@ -321,22 +330,22 @@ const Ys = ({
321
330
  }
322
331
  ),
323
332
  /* @__PURE__ */ e.jsx(
324
- Ue,
333
+ Ge,
325
334
  {
326
- size: m ?? "sm",
335
+ size: u ?? "sm",
327
336
  min: 0,
328
- max: h < 0 ? Math.abs(w ?? s) : o,
337
+ max: w < 0 ? Math.abs(b ?? s) : r,
329
338
  precision: 0,
330
- value: S === "" ? "" : Math.abs(Number(S ?? o)),
331
- onChange: U,
332
- onBlur: R,
339
+ value: j === "" ? "" : Math.abs(Number(j ?? r)),
340
+ onChange: $,
341
+ onBlur: P,
333
342
  borderWidth: 1,
334
343
  borderRadius: 3,
335
344
  borderColor: "#ccc",
336
345
  isDisabled: p,
337
- ...a,
346
+ ...l,
338
347
  children: /* @__PURE__ */ e.jsx(
339
- Ge,
348
+ We,
340
349
  {
341
350
  backgroundColor: "#fff",
342
351
  paddingRight: 0,
@@ -345,18 +354,18 @@ const Ys = ({
345
354
  )
346
355
  }
347
356
  ),
348
- I && /* @__PURE__ */ e.jsxs(
349
- ze,
357
+ T && /* @__PURE__ */ e.jsxs(
358
+ $e,
350
359
  {
351
360
  width: "auto",
352
- size: m,
361
+ size: u,
353
362
  fontWeight: "bold",
354
- value: h,
355
- onChange: (i) => n(!1, i),
356
- isDisabled: g || p,
363
+ value: w,
364
+ onChange: (y) => H(!1, y),
365
+ isDisabled: S || p,
357
366
  children: [
358
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
359
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
367
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: T[0] }),
368
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: T[1] })
360
369
  ]
361
370
  }
362
371
  )
@@ -364,346 +373,390 @@ const Ys = ({
364
373
  }
365
374
  )
366
375
  ] });
367
- }, Zs = Ze(B)`
368
- position: absolute;
369
- width: 2px;
370
- height: 1em;
371
- top: 90%;
372
- left: 20%;
373
- background-color: var(--chakra-colors-gray-300);
374
- `, Vs = ({ tags: t, containerProps: s, ...o }) => /* @__PURE__ */ e.jsx(K, { ...s, children: t.map((u, l) => /* @__PURE__ */ e.jsx(de, { ...o, children: u }, l)) }), et = new Cs({}), st = (t, s) => {
376
+ }, es = ({ tags: n, containerProps: s, ...r }) => /* @__PURE__ */ e.jsx(X, { ...s, children: n.map((d, i) => /* @__PURE__ */ e.jsx(ge, { ...r, children: d }, i)) }), ts = new Mt({}), ss = (n, s) => {
375
377
  if (!s || !s.trim().length)
376
- return t;
377
- const o = t.map((l) => l.name ?? "");
378
- return et.filter(o, s)?.map((l) => t[l]) ?? [];
379
- }, tt = (t, s) => !s || s.length == 0 ? t : t.filter(
380
- (o) => o.useCases.some((u) => s.includes(u.id))
381
- ), nt = ({
382
- actions: t,
378
+ return n;
379
+ const r = n.map((i) => i.name ?? "");
380
+ return ts.filter(r, s)?.map((i) => n[i]) ?? [];
381
+ }, ns = (n, s) => !s || s.length == 0 ? n : n.filter(
382
+ (r) => r.useCases.some((d) => s.includes(d.id))
383
+ ), os = ({
384
+ actions: n,
383
385
  totalActions: s,
384
- onCreate: o,
385
- onDelete: u,
386
- onEdit: l,
387
- onSelected: a,
388
- onDuplicate: m,
389
- disableMultiSelect: f,
390
- disableDelete: j,
391
- disableEdit: C,
392
- disableCreate: I,
386
+ onCreate: r,
387
+ onDelete: d,
388
+ onEdit: i,
389
+ onSelected: l,
390
+ onDuplicate: u,
391
+ disableMultiSelect: g,
392
+ disableDelete: a,
393
+ disableEdit: M,
394
+ disableCreate: T,
393
395
  tableProps: p,
394
396
  ...x
395
397
  }) => {
396
- const [A, d] = F(""), [r, S] = F(), b = D(() => {
397
- if (!t)
398
+ const [A, o] = E(""), [c, j] = E(), m = _(() => {
399
+ if (!n)
398
400
  return;
399
- const g = st(t, A);
400
- return tt(g, r).sort((P, T) => P.name.localeCompare(T.name));
401
- }, [t, A, r]), v = O(() => {
402
- if (!u)
401
+ const S = ss(n, A);
402
+ return ns(S, c).sort((O, I) => O.name.localeCompare(I.name));
403
+ }, [n, A, c]), C = N(() => {
404
+ if (!d)
403
405
  return;
404
- const g = t.filter((w) => w.selected).map((w) => w.id);
405
- u(g);
406
- }, [t, u]), h = O(() => {
407
- if (!m)
406
+ const S = n.filter((b) => b.selected).map((b) => b.id);
407
+ d(S);
408
+ }, [n, d]), w = N(() => {
409
+ if (!u)
408
410
  return;
409
- const g = t.filter((w) => w.selected);
410
- m(g.map((w) => w.id)), a && g.forEach((w) => a(w, !1));
411
- }, [t, m, a]);
412
- return /* @__PURE__ */ e.jsxs(B, { ...x, children: [
413
- /* @__PURE__ */ e.jsxs(le, { alignContent: "space-between", gap: 4, children: [
414
- (o || u || m) && /* @__PURE__ */ e.jsxs(ce, { mb: "1rem", gap: 4, children: [
415
- o && /* @__PURE__ */ e.jsx(
416
- $,
411
+ const S = n.filter((b) => b.selected);
412
+ u(S.map((b) => b.id)), l && S.forEach((b) => l(b, !1));
413
+ }, [n, u, l]);
414
+ return /* @__PURE__ */ e.jsxs(q, { ...x, children: [
415
+ /* @__PURE__ */ e.jsxs(he, { alignContent: "space-between", gap: 4, children: [
416
+ (r || d || u) && /* @__PURE__ */ e.jsxs(me, { mb: "1rem", gap: 4, children: [
417
+ r && /* @__PURE__ */ e.jsx(
418
+ J,
417
419
  {
418
- isDisabled: !o || I,
420
+ isDisabled: !r || T,
419
421
  colorScheme: "blackAlpha",
420
422
  backgroundColor: "gray.700",
421
- onClick: o,
423
+ onClick: r,
422
424
  children: "Create New Activity"
423
425
  }
424
426
  ),
425
- u && !f && /* @__PURE__ */ e.jsx(
426
- $,
427
+ d && !g && /* @__PURE__ */ e.jsx(
428
+ J,
427
429
  {
428
430
  colorScheme: "gray",
429
- isDisabled: t.length <= 0 || !u || j,
430
- onClick: v,
431
+ isDisabled: n.length <= 0 || !d || a,
432
+ onClick: C,
431
433
  children: "Delete Selected"
432
434
  }
433
435
  ),
434
- m && !f && /* @__PURE__ */ e.jsx(
435
- $,
436
+ u && !g && /* @__PURE__ */ e.jsx(
437
+ J,
436
438
  {
437
439
  colorScheme: "gray",
438
- isDisabled: t.length <= 0,
439
- onClick: h,
440
+ isDisabled: n.length <= 0,
441
+ onClick: w,
440
442
  children: "Duplicate Selected"
441
443
  }
442
444
  )
443
445
  ] }),
444
446
  /* @__PURE__ */ e.jsx(
445
- Ys,
447
+ Kt,
446
448
  {
447
- setSearch: d,
448
- actions: t,
449
- updateUseCases: S
449
+ setSearch: o,
450
+ actions: n,
451
+ updateUseCases: j
450
452
  }
451
453
  )
452
454
  ] }),
453
- /* @__PURE__ */ e.jsx(Qe, { mr: "2rem", overflowX: "hidden", ...p, children: /* @__PURE__ */ e.jsxs(qe, { size: "md", variant: "simple", children: [
454
- /* @__PURE__ */ e.jsx(He, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(Ce, { children: [
455
- /* @__PURE__ */ e.jsxs(ie, { fontWeight: "normal", children: [
455
+ /* @__PURE__ */ e.jsx(He, { mr: "2rem", overflowX: "hidden", ...p, children: /* @__PURE__ */ e.jsxs(Ye, { size: "md", variant: "simple", children: [
456
+ /* @__PURE__ */ e.jsx(Je, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(Me, { children: [
457
+ /* @__PURE__ */ e.jsxs(ce, { fontWeight: "normal", children: [
456
458
  "(showing ",
457
- b?.length ?? 0,
459
+ m?.length ?? 0,
458
460
  " of",
459
461
  " ",
460
- s ?? t.length,
462
+ s ?? n.length,
461
463
  ")"
462
464
  ] }),
463
- /* @__PURE__ */ e.jsx(ie, { children: "Name" }),
464
- /* @__PURE__ */ e.jsx(ie, { children: "Sensor Count" }),
465
- /* @__PURE__ */ e.jsx(ie, { children: "Use Case" }),
466
- /* @__PURE__ */ e.jsx(ie, {})
465
+ /* @__PURE__ */ e.jsx(ce, { children: "Name" }),
466
+ /* @__PURE__ */ e.jsx(ce, { children: "Sensor Count" }),
467
+ /* @__PURE__ */ e.jsx(ce, { children: "Use Case" }),
468
+ /* @__PURE__ */ e.jsx(ce, {})
467
469
  ] }) }),
468
- /* @__PURE__ */ e.jsx(Ye, { children: b?.map((g) => /* @__PURE__ */ e.jsxs(
469
- it,
470
+ /* @__PURE__ */ e.jsx(Ke, { children: m?.map((S) => /* @__PURE__ */ e.jsxs(
471
+ Me,
470
472
  {
471
- disableMultiSelect: f,
472
- selected: g.selected,
473
- title: f && g.selected ? "This activity is selected. Click it again to deselect." : void 0,
474
- bg: f && g.selected ? "gray.200" : void 0,
475
- onClick: () => f ? a?.(g, !g.selected) : void 0,
473
+ title: g && S.selected ? "This activity is selected. Click it again to deselect." : void 0,
474
+ bg: g && S.selected ? "gray.200" : void 0,
475
+ _hover: {
476
+ bg: g && !S.selected ? "#f7f7f7" : void 0
477
+ },
478
+ cursor: g ? "pointer" : "default",
479
+ onClick: () => g ? l?.(S, !S.selected) : void 0,
476
480
  children: [
477
- /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs(le, { children: [
478
- a && !f && /* @__PURE__ */ e.jsx(
479
- us,
481
+ /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(he, { children: [
482
+ l && !g && /* @__PURE__ */ e.jsx(
483
+ pt,
480
484
  {
481
- isChecked: g.selected,
482
- onChange: (w) => a(g, w.target.checked)
485
+ isChecked: S.selected,
486
+ onChange: (b) => l(S, b.target.checked)
483
487
  }
484
488
  ),
485
- l && /* @__PURE__ */ e.jsx(
486
- $,
489
+ i && /* @__PURE__ */ e.jsx(
490
+ J,
487
491
  {
488
- disabled: C,
492
+ disabled: M,
489
493
  ml: "1em",
490
494
  size: "sm",
491
495
  variant: "link",
492
496
  colorScheme: "blue",
493
- onClick: () => l(g.id),
497
+ onClick: () => i(S.id),
494
498
  children: "edit"
495
499
  }
496
500
  )
497
501
  ] }) }),
498
- /* @__PURE__ */ e.jsx(re, { whiteSpace: "break-spaces", children: g.name }),
499
- /* @__PURE__ */ e.jsx(re, { maxW: "20rem", children: g.sensorLocations.length }),
500
- /* @__PURE__ */ e.jsx(re, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
501
- Vs,
502
+ /* @__PURE__ */ e.jsx(ue, { whiteSpace: "break-spaces", children: S.name }),
503
+ /* @__PURE__ */ e.jsx(ue, { maxW: "20rem", children: S.sensorLocations.length }),
504
+ /* @__PURE__ */ e.jsx(ue, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
505
+ es,
502
506
  {
503
507
  containerProps: { flexWrap: "wrap" },
504
- tags: g.useCases?.map((w) => w.name) ?? []
508
+ tags: S.useCases?.map((b) => b.name) ?? []
505
509
  }
506
510
  ) })
507
511
  ]
508
512
  },
509
- g.id
513
+ S.id
510
514
  )) })
511
515
  ] }) })
512
516
  ] });
513
- }, it = Ze(Ce)`
514
- &:hover {
515
- background-color: ${(t) => t.disableMultiSelect && !t.selected ? "#f7f7f7" : void 0};
516
- }
517
- cursor: ${(t) => t.disableMultiSelect ? "pointer" : "default"};
518
- `, Rt = ({
519
- onSave: t,
517
+ }, Ns = ({
518
+ onSave: n,
520
519
  onCancel: s,
521
- onError: o,
522
- hideButtons: u = !1,
523
- setButtonDisabled: l,
524
- setButtonOnClick: a,
525
- quantumOwned: m
520
+ onError: r,
521
+ hideButtons: d = !1,
522
+ setButtonDisabled: i,
523
+ setButtonOnClick: l,
524
+ quantumOwned: u
526
525
  }) => {
527
- const f = Ke(), [j, C] = F(""), [I, p] = F([]), [x, A] = F(!1), [d] = ee({
528
- query: Ve
529
- }), [r] = ee({
530
- query: Is,
531
- variables: { groupId: j },
532
- pause: !j
526
+ const g = Ze(), [a, M] = E("copy"), [T, p] = E(""), [x, A] = E([]), [o, c] = E(!1), [j] = oe({
527
+ query: tt
528
+ }), [m] = oe({
529
+ query: Nt,
530
+ variables: { groupId: T },
531
+ pause: !T
533
532
  // Only run when group is selected
534
- }), [, S] = oe(De), b = D(() => d.data?.groups ? d.data.groups.map(
535
- (c) => W(es, c)
536
- ) : [], [d.data]), v = D(() => r.data ? r.data.actions.map(
537
- (n) => W(ae, n)
538
- ) : [], [r.data]), h = D(() => v.filter(
539
- (c) => I.includes(c.id)
540
- ), [v, I]), g = O(
541
- (c) => {
542
- const n = c?.value || "";
543
- C(n), p([]);
533
+ }), [, C] = te(ze), [, w] = te(
534
+ st
535
+ ), S = _(() => j.data?.groups ? j.data.groups.map(
536
+ (t) => B(nt, t)
537
+ ) : [], [j.data]), b = _(() => m.data ? m.data.actions.map(
538
+ (h) => B(re, h)
539
+ ) : [], [m.data]), O = _(() => b.filter(
540
+ (t) => x.includes(t.id)
541
+ ), [b, x]), I = N(
542
+ (t) => {
543
+ const h = t?.value || "";
544
+ p(h), A([]);
544
545
  },
545
546
  []
546
- ), w = O(
547
- (c) => {
548
- const n = c.map((i) => i.value);
549
- p(n);
547
+ ), D = N(
548
+ (t) => {
549
+ const h = t.map((f) => f.value);
550
+ A(h);
550
551
  },
551
552
  []
552
- ), P = O(async () => {
553
- if (A(!0), !h.length) {
554
- const c = new Error("No activities selected for copying");
555
- o?.(c), A(!1);
553
+ ), P = N(
554
+ async (t) => {
555
+ const h = {
556
+ ...t,
557
+ name: `${t.name} (Copy)`,
558
+ // Add "(Copy)" suffix to distinguish
559
+ description: t.description || void 0,
560
+ instructionsPointOfInterest: t.instructionsPointOfInterest || void 0,
561
+ instructionsMovementReport: t.instructionsMovementReport || void 0,
562
+ laterality: t.laterality,
563
+ activityKind: t.activityKind,
564
+ sensorLocations: t.sensorLocations,
565
+ thresholds: t.thresholds.map((F) => ({
566
+ ...F,
567
+ id: void 0
568
+ })),
569
+ quantumOwned: u,
570
+ id: void 0
571
+ }, f = await C({ fields: h });
572
+ if (f.error)
573
+ throw new Error(f.error.message);
574
+ if (f.data?.createAction)
575
+ return B(re, f.data.createAction);
576
+ throw new Error("No action data returned");
577
+ },
578
+ [C, u]
579
+ ), ee = N(
580
+ async (t) => {
581
+ const h = await w({ id: t.id });
582
+ if (h.error)
583
+ throw new Error(h.error.message);
584
+ if (h.data?.convertActionToQuantumOwned)
585
+ return B(
586
+ re,
587
+ h.data.convertActionToQuantumOwned
588
+ );
589
+ throw new Error("No action data returned");
590
+ },
591
+ [w]
592
+ ), $ = N(async () => {
593
+ if (c(!0), !O.length) {
594
+ const t = new Error(
595
+ `No activities selected for ${a === "copy" ? "copying" : "converting"}`
596
+ );
597
+ r?.(t), c(!1);
556
598
  return;
557
599
  }
558
600
  try {
559
- const c = [];
560
- let n = 0;
561
- for (const i of h)
601
+ const t = [];
602
+ let h = 0;
603
+ const f = a === "copy" ? P : ee, F = a === "copy" ? "copy" : "convert";
604
+ for (const U of O)
562
605
  try {
563
- const y = {
564
- ...i,
565
- name: `${i.name} (Copy)`,
566
- // Add "(Copy)" suffix to distinguish
567
- description: i.description || void 0,
568
- instructionsPointOfInterest: i.instructionsPointOfInterest || void 0,
569
- instructionsMovementReport: i.instructionsMovementReport || void 0,
570
- laterality: i.laterality,
571
- activityKind: i.activityKind,
572
- sensorLocations: i.sensorLocations,
573
- thresholds: i.thresholds.map((_) => ({
574
- ..._,
575
- id: void 0
576
- })),
577
- quantumOwned: m,
578
- id: void 0
579
- }, L = await S({ fields: y });
580
- if (L.error)
581
- throw new Error(L.error.message);
582
- if (L.data?.createAction) {
583
- const _ = W(
584
- ae,
585
- L.data.createAction
586
- );
587
- c.push(_);
588
- }
589
- } catch (y) {
606
+ const G = await f(U);
607
+ t.push(G);
608
+ } catch (G) {
590
609
  console.error(
591
- `Failed to copy activity "${i.name}":`,
592
- y
593
- ), n++;
610
+ `Failed to ${F} activity "${U.name}":`,
611
+ G
612
+ ), h++;
594
613
  }
595
- if (c.length > 0) {
596
- const i = c.length, y = h.length;
597
- f({
598
- title: n > 0 ? "Partial copy completed" : "Activities copied successfully",
599
- description: n > 0 ? `${i} of ${y} activities copied successfully` : `${i} activit${i > 1 ? "ies" : "y"} copied successfully`,
600
- status: n > 0 ? "warning" : "success",
614
+ if (t.length > 0) {
615
+ const U = t.length, G = O.length, Y = a === "copy" ? "copied" : "converted", Q = a === "copy" ? "copy" : "convert";
616
+ g({
617
+ title: h > 0 ? `Partial ${Q} completed` : `Activities ${Y} successfully`,
618
+ description: h > 0 ? `${U} of ${G} activities ${Y} successfully` : `${U} activit${U > 1 ? "ies" : "y"} ${Y} successfully`,
619
+ status: h > 0 ? "warning" : "success",
601
620
  duration: 3e3,
602
621
  isClosable: !0
603
- }), t?.(), C(""), p([]);
622
+ }), n?.(), p(""), A([]);
604
623
  } else
605
- throw new Error("Failed to copy any activities");
606
- } catch (c) {
607
- const n = c instanceof Error ? c.message : "Failed to copy activities";
608
- f({
609
- title: "Copy failed",
610
- description: n,
624
+ throw new Error(`Failed to ${F} any activities`);
625
+ } catch (t) {
626
+ const h = a === "copy" ? "copy" : "convert", f = t instanceof Error ? t.message : `Failed to ${h} activities`;
627
+ g({
628
+ title: `${a === "copy" ? "Copy" : "Convert"} failed`,
629
+ description: f,
611
630
  status: "error",
612
631
  duration: 5e3,
613
632
  isClosable: !0
614
- }), o?.(c instanceof Error ? c : new Error(n));
633
+ }), r?.(t instanceof Error ? t : new Error(f));
615
634
  } finally {
616
- A(!1);
635
+ c(!1);
617
636
  }
618
- }, [h, S, f, t, o, m]), T = O(() => {
619
- C(""), p([]), s?.();
637
+ }, [
638
+ O,
639
+ a,
640
+ P,
641
+ ee,
642
+ g,
643
+ n,
644
+ r
645
+ ]), k = N(() => {
646
+ p(""), A([]), M("copy"), s?.();
620
647
  }, [s]);
621
- Y(() => {
622
- l && l({
648
+ V(() => {
649
+ i && i({
623
650
  cancelButton: !1,
624
- saveButton: h.length === 0 || x
651
+ saveButton: O.length === 0 || o
625
652
  });
626
- }, [h.length, x, l]), Y(() => {
627
- a && a({
628
- cancelButton: T,
629
- saveButton: P
653
+ }, [O.length, o, i]), V(() => {
654
+ l && l({
655
+ cancelButton: k,
656
+ saveButton: $
630
657
  });
631
- }, [a, T, P]);
632
- const q = D(() => b.map((c) => ({
633
- value: c.id,
634
- label: c.name
635
- })), [b]), R = D(() => v.map((c) => ({
636
- value: c.id,
637
- label: c.name,
638
- // Add custom data to identify quantum-owned actions
639
- isQuantumOwned: c.quantumOwned
640
- })), [v]), Q = d.fetching, U = r.fetching;
641
- return /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, align: "stretch", children: [
642
- /* @__PURE__ */ e.jsxs(G, { children: [
643
- /* @__PURE__ */ e.jsx(te, { children: "Select Source Group" }),
658
+ }, [l, k, $]);
659
+ const H = _(() => S.map((t) => ({
660
+ value: t.id,
661
+ label: t.name
662
+ })), [S]), y = _(() => b.filter((t) => a === "copy" ? !0 : !t.quantumOwned).map((t) => ({
663
+ value: t.id,
664
+ label: t.name,
665
+ // Add custom data to identify quantum-owned actions for UI display
666
+ isQuantumOwned: t.quantumOwned
667
+ })), [b, a]), L = j.fetching, K = m.fetching;
668
+ return /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsxs(Z, { spacing: 6, align: "stretch", children: [
669
+ u && /* @__PURE__ */ e.jsxs(W, { children: [
670
+ /* @__PURE__ */ e.jsx(se, { children: "Operation Mode" }),
644
671
  /* @__PURE__ */ e.jsx(
645
- se,
672
+ Ve,
673
+ {
674
+ value: a,
675
+ onChange: (t) => {
676
+ M(t), A([]);
677
+ },
678
+ children: /* @__PURE__ */ e.jsxs(X, { spacing: 6, children: [
679
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 1, children: [
680
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Copy Activities" }),
681
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Create new activities based on selected ones" })
682
+ ] }) }),
683
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 1, children: [
684
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
685
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Convert existing activities to quantum-owned" })
686
+ ] }) })
687
+ ] })
688
+ }
689
+ )
690
+ ] }),
691
+ /* @__PURE__ */ e.jsxs(W, { children: [
692
+ /* @__PURE__ */ e.jsx(se, { children: "Select Source Group" }),
693
+ /* @__PURE__ */ e.jsx(
694
+ ie,
646
695
  {
647
696
  placeholder: "Choose a group...",
648
- options: q,
649
- value: q.find((c) => c.value === j) || null,
650
- onChange: g,
651
- isLoading: Q,
652
- isDisabled: Q,
697
+ options: H,
698
+ value: H.find((t) => t.value === T) || null,
699
+ onChange: I,
700
+ isLoading: L,
701
+ isDisabled: L,
653
702
  isClearable: !0
654
703
  }
655
704
  ),
656
- d.error && /* @__PURE__ */ e.jsxs(be, { status: "error", mt: 2, children: [
657
- /* @__PURE__ */ e.jsx(ve, {}),
658
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
705
+ j.error && /* @__PURE__ */ e.jsxs(Oe, { status: "error", mt: 2, children: [
706
+ /* @__PURE__ */ e.jsx(Te, {}),
707
+ /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", children: [
659
708
  "Failed to load groups: ",
660
- d.error.message
709
+ j.error.message
661
710
  ] })
662
711
  ] })
663
712
  ] }),
664
- j && /* @__PURE__ */ e.jsxs(G, { children: [
665
- /* @__PURE__ */ e.jsx(te, { children: "Select Activities to Copy" }),
666
- U ? /* @__PURE__ */ e.jsxs(K, { children: [
667
- /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
668
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
713
+ T && /* @__PURE__ */ e.jsxs(W, { children: [
714
+ /* @__PURE__ */ e.jsxs(se, { children: [
715
+ "Select Activities to",
716
+ " ",
717
+ a === "copy" ? "Copy" : "Convert"
718
+ ] }),
719
+ K ? /* @__PURE__ */ e.jsxs(X, { children: [
720
+ /* @__PURE__ */ e.jsx(et, { size: "sm" }),
721
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
669
722
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
670
723
  /* @__PURE__ */ e.jsx(
671
- se,
724
+ ie,
672
725
  {
673
- placeholder: "Choose activities to copy...",
674
- options: R,
675
- value: R.filter(
676
- (c) => I.includes(c.value)
726
+ placeholder: `Choose activities to ${a}...`,
727
+ options: y,
728
+ value: y.filter(
729
+ (t) => x.includes(t.value)
677
730
  ),
678
- onChange: w,
679
- isDisabled: R.length === 0,
731
+ onChange: D,
732
+ isDisabled: y.length === 0,
680
733
  isClearable: !0,
681
734
  isMulti: !0,
682
735
  closeMenuOnSelect: !1,
683
- formatOptionLabel: (c, { context: n }) => /* @__PURE__ */ e.jsxs(K, { justify: "space-between", w: "100%", children: [
736
+ formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(X, { justify: "space-between", w: "100%", children: [
684
737
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
685
- /* @__PURE__ */ e.jsx(M, { children: c.label }),
686
- n === "value" && c.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
738
+ /* @__PURE__ */ e.jsx(v, { children: t.label }),
739
+ h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(v, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
687
740
  ] }),
688
- c.isQuantumOwned && n === "menu" && /* @__PURE__ */ e.jsx(de, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
741
+ t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
689
742
  ] })
690
743
  }
691
744
  ),
692
- R.length === 0 && /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
745
+ y.length === 0 && /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
693
746
  ] }),
694
- r.error && /* @__PURE__ */ e.jsxs(be, { status: "error", mt: 2, children: [
695
- /* @__PURE__ */ e.jsx(ve, {}),
696
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
747
+ m.error && /* @__PURE__ */ e.jsxs(Oe, { status: "error", mt: 2, children: [
748
+ /* @__PURE__ */ e.jsx(Te, {}),
749
+ /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", children: [
697
750
  "Failed to load activities: ",
698
- r.error.message
751
+ m.error.message
699
752
  ] })
700
753
  ] })
701
754
  ] }),
702
- h.length > 0 && /* @__PURE__ */ e.jsxs(B, { p: 4, bg: "gray.50", borderRadius: "md", children: [
703
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: h.length === 1 ? "Activity to Copy:" : `${h.length} Activities to Copy:` }),
704
- /* @__PURE__ */ e.jsxs(V, { align: "start", spacing: 3, children: [
705
- h.map((c, n) => /* @__PURE__ */ e.jsxs(
706
- B,
755
+ O.length > 0 && /* @__PURE__ */ e.jsxs(q, { p: 4, bg: "gray.50", borderRadius: "md", children: [
756
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `Activity to ${a === "copy" ? "Copy" : "Convert"}:` : `${O.length} Activities to ${a === "copy" ? "Copy" : "Convert"}:` }),
757
+ /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 3, children: [
758
+ O.map((t, h) => /* @__PURE__ */ e.jsxs(
759
+ q,
707
760
  {
708
761
  w: "100%",
709
762
  p: 3,
@@ -712,61 +765,61 @@ const Ys = ({
712
765
  border: "1px solid",
713
766
  borderColor: "gray.200",
714
767
  children: [
715
- /* @__PURE__ */ e.jsxs(K, { justify: "space-between", align: "start", mb: 2, children: [
716
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
717
- n + 1,
768
+ /* @__PURE__ */ e.jsxs(X, { justify: "space-between", align: "start", mb: 2, children: [
769
+ /* @__PURE__ */ e.jsxs(v, { fontWeight: "medium", fontSize: "sm", children: [
770
+ h + 1,
718
771
  ". ",
719
- c.name
772
+ t.name
720
773
  ] }),
721
- c.quantumOwned && /* @__PURE__ */ e.jsx(de, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
774
+ t.quantumOwned && /* @__PURE__ */ e.jsx(ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
722
775
  ] }),
723
776
  /* @__PURE__ */ e.jsxs(
724
- V,
777
+ Z,
725
778
  {
726
779
  align: "start",
727
780
  spacing: 1,
728
781
  fontSize: "sm",
729
782
  color: "gray.600",
730
783
  children: [
731
- c.description && /* @__PURE__ */ e.jsxs(M, { children: [
784
+ t.description && /* @__PURE__ */ e.jsxs(v, { children: [
732
785
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
733
786
  " ",
734
- c.description
787
+ t.description
735
788
  ] }),
736
- /* @__PURE__ */ e.jsxs(M, { children: [
789
+ /* @__PURE__ */ e.jsxs(v, { children: [
737
790
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
738
791
  " ",
739
- c.activityKind
792
+ t.activityKind
740
793
  ] }),
741
- /* @__PURE__ */ e.jsxs(M, { children: [
794
+ /* @__PURE__ */ e.jsxs(v, { children: [
742
795
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
743
796
  " ",
744
- c.laterality
797
+ t.laterality
745
798
  ] }),
746
- /* @__PURE__ */ e.jsxs(M, { children: [
799
+ /* @__PURE__ */ e.jsxs(v, { children: [
747
800
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
748
801
  " ",
749
- c.sensorLocations.length
802
+ t.sensorLocations.length
750
803
  ] }),
751
- /* @__PURE__ */ e.jsxs(M, { children: [
804
+ /* @__PURE__ */ e.jsxs(v, { children: [
752
805
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
753
806
  " ",
754
- c.thresholds.length
807
+ t.thresholds.length
755
808
  ] }),
756
- /* @__PURE__ */ e.jsxs(M, { children: [
809
+ /* @__PURE__ */ e.jsxs(v, { children: [
757
810
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
758
811
  " ",
759
- c.useCases.map((i) => i.name).join(", ") || "None"
812
+ t.useCases.map((f) => f.name).join(", ") || "None"
760
813
  ] })
761
814
  ]
762
815
  }
763
816
  )
764
817
  ]
765
818
  },
766
- c.id
819
+ t.id
767
820
  )),
768
- h.length > 1 && /* @__PURE__ */ e.jsx(
769
- B,
821
+ O.length > 1 && /* @__PURE__ */ e.jsx(
822
+ q,
770
823
  {
771
824
  w: "100%",
772
825
  p: 2,
@@ -774,270 +827,332 @@ const Ys = ({
774
827
  borderRadius: "md",
775
828
  border: "1px solid",
776
829
  borderColor: "blue.200",
777
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
830
+ children: /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
778
831
  "Total: ",
779
- h.length,
780
- " activities will be copied"
832
+ O.length,
833
+ " activities will be",
834
+ " ",
835
+ a === "copy" ? "copied" : "converted"
781
836
  ] })
782
837
  }
783
838
  )
784
839
  ] })
785
840
  ] }),
786
- !u && /* @__PURE__ */ e.jsxs(ce, { spacing: 4, justifyContent: "flex-end", children: [
841
+ !d && /* @__PURE__ */ e.jsxs(me, { spacing: 4, justifyContent: "flex-end", children: [
787
842
  /* @__PURE__ */ e.jsx(
788
- $,
843
+ J,
789
844
  {
790
845
  variant: "outline",
791
- onClick: T,
792
- isDisabled: x,
846
+ onClick: k,
847
+ isDisabled: o,
793
848
  children: "Cancel"
794
849
  }
795
850
  ),
796
851
  /* @__PURE__ */ e.jsxs(
797
- $,
852
+ J,
798
853
  {
799
- colorScheme: "blue",
800
- onClick: P,
801
- isDisabled: h.length === 0 || x,
802
- isLoading: x,
803
- loadingText: "Copying...",
854
+ colorScheme: a === "copy" ? "blue" : "green",
855
+ onClick: $,
856
+ isDisabled: O.length === 0 || o,
857
+ isLoading: o,
858
+ loadingText: `${a === "copy" ? "Copying" : "Converting"}...`,
804
859
  children: [
805
- "Copy",
860
+ a === "copy" ? "Copy" : "Convert",
806
861
  " ",
807
- h.length === 1 ? "Activity" : `${h.length} Activities`
862
+ O.length === 1 ? "Activity" : `${O.length} Activities`
808
863
  ]
809
864
  }
810
865
  )
811
866
  ] })
812
867
  ] }) });
813
- }, Lt = ({
814
- onSave: t,
868
+ }, Rs = ({
869
+ onSave: n,
815
870
  onCancel: s,
816
- onError: o,
817
- hideButtons: u = !1,
818
- setButtonDisabled: l,
819
- setButtonOnClick: a,
820
- quantumOwned: m
871
+ onError: r,
872
+ hideButtons: d = !1,
873
+ setButtonDisabled: i,
874
+ setButtonOnClick: l,
875
+ quantumOwned: u
821
876
  }) => {
822
- const f = Ke(), [j, C] = F(""), [I, p] = F([]), [x, A] = F(!1), [d] = ee({
823
- query: Ve
824
- }), [r] = ee({
825
- query: Ts,
826
- variables: { groupId: j },
827
- pause: !j
877
+ const g = Ze(), [a, M] = E(""), [T, p] = E([]), [x, A] = E(!1), [o, c] = E("copy"), [j] = oe({
878
+ query: tt
879
+ }), [m] = oe({
880
+ query: Rt,
881
+ variables: { groupId: a },
882
+ pause: !a
828
883
  // Only run when group is selected
829
- }), [, S] = oe(ss), [, b] = oe(De), v = D(() => d.data?.groups ? d.data.groups.map(
830
- (n) => W(es, n)
831
- ) : [], [d.data]), h = D(() => r.data?.modules ? W(
832
- Re,
833
- r.data?.modules
834
- ).map((i) => {
835
- const y = W(
836
- ts,
837
- i.moduleActions
884
+ }), [, C] = te(it), [, w] = te(rt), [, S] = te(ze), [, b] = te(
885
+ st
886
+ ), O = _(() => j.data?.groups ? j.data.groups.map(
887
+ (t) => B(nt, t)
888
+ ) : [], [j.data]), I = _(() => m.data?.modules ? B(
889
+ Se,
890
+ m.data?.modules
891
+ ).map((h) => {
892
+ const f = B(
893
+ ot,
894
+ h.moduleActions
838
895
  );
839
896
  return {
840
- ...i,
841
- moduleActions: y.map((L) => ({
842
- ...L,
843
- action: W(ae, L.action)
897
+ ...h,
898
+ moduleActions: f.map((F) => ({
899
+ ...F,
900
+ action: B(re, F.action)
844
901
  })),
845
- categories: W(
846
- Le,
847
- i.categories
902
+ categories: B(
903
+ ke,
904
+ h.categories
848
905
  )
849
906
  };
850
- }) : [], [r.data]), g = D(() => h.filter(
851
- (n) => I.includes(n.id)
852
- ), [h, I]), w = O(
853
- (n) => {
854
- const i = n?.value || "";
855
- C(i), p([]);
907
+ }) : [], [m.data]), D = _(() => I.filter(
908
+ (t) => T.includes(t.id)
909
+ ), [I, T]), P = N(
910
+ (t) => {
911
+ const h = t?.value || "";
912
+ M(h), p([]);
856
913
  },
857
914
  []
858
- ), P = O(
859
- (n) => {
860
- const i = n.map((y) => y.value);
861
- p(i);
915
+ ), ee = N(
916
+ (t) => {
917
+ const h = t.map((f) => f.value);
918
+ p(h);
862
919
  },
863
920
  []
864
- ), T = O(async () => {
865
- if (A(!0), !g.length) {
921
+ ), $ = N(async () => {
922
+ if (A(!0), !D.length) {
866
923
  A(!1);
867
- const n = new Error("No modules selected for copying");
868
- o?.(n);
924
+ const t = new Error(
925
+ `No modules selected for ${o === "convert" ? "converting" : "copying"}`
926
+ );
927
+ r?.(t);
869
928
  return;
870
929
  }
871
930
  try {
872
- const n = [];
873
- let i = 0;
874
- for (const y of g)
931
+ const t = [];
932
+ let h = 0;
933
+ for (const f of D)
875
934
  try {
876
- let L = y.moduleActions.map((E) => E.actionId);
877
- if (m) {
878
- const E = y.moduleActions.map((z) => z.action);
879
- L = (await Promise.all(
880
- E.map(async (z) => {
881
- if (z.quantumOwned)
882
- return Promise.resolve(z);
883
- const ue = {
884
- ...z,
885
- quantumOwned: m,
886
- thresholds: z.thresholds.map((X) => ({
887
- ...X,
935
+ let F = f.moduleActions.map((U) => U.actionId);
936
+ if (u) {
937
+ const U = f.moduleActions.map((Q) => Q.action), G = async (Q) => {
938
+ if (o === "copy") {
939
+ if (Q.quantumOwned) return Q;
940
+ const xe = {
941
+ ...Q,
942
+ quantumOwned: !0,
943
+ thresholds: Q.thresholds.map((pe) => ({
944
+ ...pe,
888
945
  id: void 0
889
946
  })),
890
947
  id: void 0
891
- };
892
- return await b({ fields: ue }).then(
893
- (X) => X.error || !X.data?.createAction ? null : W(
894
- ae,
895
- X.data.createAction
896
- )
948
+ }, le = await S({ fields: xe });
949
+ return le.error || !le.data?.createAction ? null : B(
950
+ re,
951
+ le.data.createAction
897
952
  );
898
- })
899
- )).filter((z) => !!z).map((z) => z.id);
953
+ }
954
+ if (Q.quantumOwned) return Q;
955
+ const de = await b({
956
+ id: Q.id
957
+ });
958
+ return de.error || !de.data?.convertActionToQuantumOwned ? null : B(
959
+ re,
960
+ de.data.convertActionToQuantumOwned
961
+ );
962
+ };
963
+ F = (await Promise.all(
964
+ U.map(G)
965
+ )).filter((Q) => !!Q).map((Q) => Q.id);
900
966
  }
901
- const _ = {
902
- name: `${y.name} (Copy)`,
903
- // Add "(Copy)" suffix to distinguish
904
- description: y.description || void 0,
905
- actions: L,
906
- categories: y.categories.map((E) => E.id),
907
- quantumOwned: m
908
- }, H = await S({ input: _ });
909
- if (H.error)
910
- throw new Error(H.error.message);
911
- if (H.data?.createModule) {
912
- const E = W(
913
- Re,
914
- H.data.createModule
915
- );
916
- n.push(E);
967
+ if (o === "convert") {
968
+ const U = {
969
+ name: f.name,
970
+ description: f.description || void 0,
971
+ actions: F,
972
+ categories: f.categories.map((Y) => Y.id),
973
+ quantumOwned: !0
974
+ }, G = await w({
975
+ id: f.id,
976
+ input: U
977
+ });
978
+ if (G.error) throw new Error(G.error.message);
979
+ if (G.data?.updateModule) {
980
+ const Y = B(
981
+ Se,
982
+ G.data.updateModule
983
+ );
984
+ t.push(Y);
985
+ }
986
+ } else {
987
+ const U = {
988
+ name: `${f.name} (Copy)`,
989
+ description: f.description || void 0,
990
+ actions: F,
991
+ categories: f.categories.map((Y) => Y.id),
992
+ quantumOwned: u
993
+ }, G = await C({ input: U });
994
+ if (G.error) throw new Error(G.error.message);
995
+ if (G.data?.createModule) {
996
+ const Y = B(
997
+ Se,
998
+ G.data.createModule
999
+ );
1000
+ t.push(Y);
1001
+ }
917
1002
  }
918
- } catch (L) {
919
- console.error(`Failed to copy module "${y.name}":`, L), i++;
1003
+ } catch (F) {
1004
+ console.error(
1005
+ `Failed to ${o === "convert" ? "convert" : "copy"} module "${f.name}":`,
1006
+ F
1007
+ ), h++;
920
1008
  }
921
- if (n.length > 0) {
922
- const y = n.length, L = g.length;
923
- f({
924
- title: i > 0 ? "Partial copy completed" : "Modules copied successfully",
925
- description: i > 0 ? `${y} of ${L} modules copied successfully` : `${y} module${y > 1 ? "s" : ""} copied successfully`,
926
- status: i > 0 ? "warning" : "success",
1009
+ if (t.length > 0) {
1010
+ const f = t.length, F = D.length;
1011
+ g({
1012
+ title: h > 0 ? `Partial ${o === "convert" ? "convert" : "copy"} completed` : `Modules ${o === "convert" ? "converted" : "copied"} successfully`,
1013
+ description: h > 0 ? `${f} of ${F} modules ${o === "convert" ? "converted" : "copied"} successfully` : `${f} module${f > 1 ? "s" : ""} ${o === "convert" ? "converted" : "copied"} successfully`,
1014
+ status: h > 0 ? "warning" : "success",
927
1015
  duration: 3e3,
928
1016
  isClosable: !0
929
- }), n.length > 0 && t?.(), C(""), p([]);
1017
+ }), t.length > 0 && n?.(), M(""), p([]);
930
1018
  } else
931
- throw new Error("Failed to copy any modules");
932
- } catch (n) {
933
- const i = n instanceof Error ? n.message : "Failed to copy modules";
934
- f({
935
- title: "Copy failed",
936
- description: i,
1019
+ throw new Error(
1020
+ `Failed to ${o === "convert" ? "convert" : "copy"} any modules`
1021
+ );
1022
+ } catch (t) {
1023
+ const h = t instanceof Error ? t.message : `Failed to ${o === "convert" ? "convert" : "copy"} modules`;
1024
+ g({
1025
+ title: o === "convert" ? "Convert failed" : "Copy failed",
1026
+ description: h,
937
1027
  status: "error",
938
1028
  duration: 5e3,
939
1029
  isClosable: !0
940
- }), o?.(n instanceof Error ? n : new Error(i));
1030
+ }), r?.(t instanceof Error ? t : new Error(h));
941
1031
  } finally {
942
1032
  A(!1);
943
1033
  }
944
1034
  }, [
1035
+ D,
1036
+ C,
1037
+ w,
945
1038
  g,
1039
+ n,
1040
+ r,
1041
+ u,
946
1042
  S,
947
- f,
948
- t,
949
- o,
950
- m,
951
- b
952
- ]), q = O(() => {
953
- C(""), p([]), s?.();
1043
+ b,
1044
+ o
1045
+ ]), k = N(() => {
1046
+ M(""), p([]), c("copy"), s?.();
954
1047
  }, [s]);
955
- Y(() => {
956
- l && l({
1048
+ V(() => {
1049
+ i && i({
957
1050
  cancelButton: !1,
958
- saveButton: g.length === 0 || x
1051
+ saveButton: D.length === 0 || x
959
1052
  });
960
- }, [g.length, x, l]), Y(() => {
961
- a && a({
962
- cancelButton: q,
963
- saveButton: T
1053
+ }, [D.length, x, i]), V(() => {
1054
+ l && l({
1055
+ cancelButton: k,
1056
+ saveButton: $
964
1057
  });
965
- }, [a, q, T]);
966
- const R = D(() => v.map((n) => ({
967
- value: n.id,
968
- label: n.name
969
- })), [v]), Q = D(() => h.map((n) => ({
970
- value: n.id,
971
- label: n.name,
1058
+ }, [l, k, $]);
1059
+ const H = _(() => O.map((t) => ({
1060
+ value: t.id,
1061
+ label: t.name
1062
+ })), [O]), y = _(() => I.filter((t) => o === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1063
+ value: t.id,
1064
+ label: t.name,
972
1065
  // Add custom data to identify quantum-owned modules
973
- isQuantumOwned: n.quantumOwned
974
- })), [h]), U = d.fetching, c = r.fetching;
975
- return /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, align: "stretch", children: [
976
- /* @__PURE__ */ e.jsxs(G, { children: [
977
- /* @__PURE__ */ e.jsx(te, { children: "Select Source Group" }),
1066
+ isQuantumOwned: t.quantumOwned
1067
+ })), [I, o]), L = j.fetching, K = m.fetching;
1068
+ return /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsxs(Z, { spacing: 6, align: "stretch", children: [
1069
+ u && /* @__PURE__ */ e.jsxs(W, { children: [
1070
+ /* @__PURE__ */ e.jsx(se, { children: "Operation Mode" }),
978
1071
  /* @__PURE__ */ e.jsx(
979
- se,
1072
+ Ve,
1073
+ {
1074
+ value: o,
1075
+ onChange: (t) => {
1076
+ c(t), p([]);
1077
+ },
1078
+ children: /* @__PURE__ */ e.jsxs(X, { spacing: 6, children: [
1079
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 1, children: [
1080
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Copy Modules" }),
1081
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Create new modules based on selected ones" })
1082
+ ] }) }),
1083
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 1, children: [
1084
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1085
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Convert existing modules to quantum-owned" })
1086
+ ] }) })
1087
+ ] })
1088
+ }
1089
+ )
1090
+ ] }),
1091
+ /* @__PURE__ */ e.jsxs(W, { children: [
1092
+ /* @__PURE__ */ e.jsx(se, { children: "Select Source Group" }),
1093
+ /* @__PURE__ */ e.jsx(
1094
+ ie,
980
1095
  {
981
1096
  placeholder: "Choose a group...",
982
- options: R,
983
- value: R.find((n) => n.value === j) || null,
984
- onChange: w,
985
- isLoading: U,
986
- isDisabled: U,
1097
+ options: H,
1098
+ value: H.find((t) => t.value === a) || null,
1099
+ onChange: P,
1100
+ isLoading: L,
1101
+ isDisabled: L,
987
1102
  isClearable: !0
988
1103
  }
989
1104
  ),
990
- d.error && /* @__PURE__ */ e.jsxs(be, { status: "error", mt: 2, children: [
991
- /* @__PURE__ */ e.jsx(ve, {}),
992
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1105
+ j.error && /* @__PURE__ */ e.jsxs(Oe, { status: "error", mt: 2, children: [
1106
+ /* @__PURE__ */ e.jsx(Te, {}),
1107
+ /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", children: [
993
1108
  "Failed to load groups: ",
994
- d.error.message
1109
+ j.error.message
995
1110
  ] })
996
1111
  ] })
997
1112
  ] }),
998
- j && /* @__PURE__ */ e.jsxs(G, { children: [
999
- /* @__PURE__ */ e.jsx(te, { children: "Select Module to Copy" }),
1000
- c ? /* @__PURE__ */ e.jsxs(K, { children: [
1001
- /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
1002
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1113
+ a && /* @__PURE__ */ e.jsxs(W, { children: [
1114
+ /* @__PURE__ */ e.jsx(se, { children: o === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1115
+ K ? /* @__PURE__ */ e.jsxs(X, { children: [
1116
+ /* @__PURE__ */ e.jsx(et, { size: "sm" }),
1117
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1003
1118
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1004
1119
  /* @__PURE__ */ e.jsx(
1005
- se,
1120
+ ie,
1006
1121
  {
1007
- placeholder: "Choose modules to copy...",
1008
- options: Q,
1009
- value: Q.filter(
1010
- (n) => I.includes(n.value)
1122
+ placeholder: o === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1123
+ options: y,
1124
+ value: y.filter(
1125
+ (t) => T.includes(t.value)
1011
1126
  ),
1012
- onChange: P,
1013
- isDisabled: Q.length === 0,
1127
+ onChange: ee,
1128
+ isDisabled: y.length === 0,
1014
1129
  isClearable: !0,
1015
1130
  isMulti: !0,
1016
1131
  closeMenuOnSelect: !1,
1017
- formatOptionLabel: (n, { context: i }) => /* @__PURE__ */ e.jsxs(K, { justify: "space-between", w: "100%", children: [
1132
+ formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(X, { justify: "space-between", w: "100%", children: [
1018
1133
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1019
- /* @__PURE__ */ e.jsx(M, { children: n.label }),
1020
- i === "value" && n.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1134
+ /* @__PURE__ */ e.jsx(v, { children: t.label }),
1135
+ h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(v, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1021
1136
  ] }),
1022
- n.isQuantumOwned && i === "menu" && /* @__PURE__ */ e.jsx(de, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1137
+ t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1023
1138
  ] })
1024
1139
  }
1025
1140
  ),
1026
- Q.length === 0 && /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1141
+ y.length === 0 && /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1027
1142
  ] }),
1028
- r.error && /* @__PURE__ */ e.jsxs(be, { status: "error", mt: 2, children: [
1029
- /* @__PURE__ */ e.jsx(ve, {}),
1030
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1143
+ m.error && /* @__PURE__ */ e.jsxs(Oe, { status: "error", mt: 2, children: [
1144
+ /* @__PURE__ */ e.jsx(Te, {}),
1145
+ /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", children: [
1031
1146
  "Failed to load modules: ",
1032
- r.error.message
1147
+ m.error.message
1033
1148
  ] })
1034
1149
  ] })
1035
1150
  ] }),
1036
- g.length > 0 && /* @__PURE__ */ e.jsxs(B, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1037
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: g.length === 1 ? "Module to Copy:" : `${g.length} Modules to Copy:` }),
1038
- /* @__PURE__ */ e.jsxs(V, { align: "start", spacing: 3, children: [
1039
- g.map((n, i) => /* @__PURE__ */ e.jsxs(
1040
- B,
1151
+ D.length > 0 && /* @__PURE__ */ e.jsxs(q, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1152
+ /* @__PURE__ */ e.jsx(v, { fontWeight: "semibold", mb: 3, children: D.length === 1 ? `Module to ${o === "copy" ? "Copy" : "Convert"}` : `${D.length} Modules to ${o === "copy" ? "Copy" : "Convert"}` }),
1153
+ /* @__PURE__ */ e.jsxs(Z, { align: "start", spacing: 3, children: [
1154
+ D.map((t, h) => /* @__PURE__ */ e.jsxs(
1155
+ q,
1041
1156
  {
1042
1157
  w: "100%",
1043
1158
  p: 3,
@@ -1046,46 +1161,46 @@ const Ys = ({
1046
1161
  border: "1px solid",
1047
1162
  borderColor: "gray.200",
1048
1163
  children: [
1049
- /* @__PURE__ */ e.jsxs(K, { justify: "space-between", align: "start", mb: 2, children: [
1050
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1051
- i + 1,
1164
+ /* @__PURE__ */ e.jsxs(X, { justify: "space-between", align: "start", mb: 2, children: [
1165
+ /* @__PURE__ */ e.jsxs(v, { fontWeight: "medium", fontSize: "sm", children: [
1166
+ h + 1,
1052
1167
  ". ",
1053
- n.name
1168
+ t.name
1054
1169
  ] }),
1055
- n.quantumOwned && /* @__PURE__ */ e.jsx(de, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1170
+ t.quantumOwned && /* @__PURE__ */ e.jsx(ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1056
1171
  ] }),
1057
1172
  /* @__PURE__ */ e.jsxs(
1058
- V,
1173
+ Z,
1059
1174
  {
1060
1175
  align: "start",
1061
1176
  spacing: 1,
1062
1177
  fontSize: "sm",
1063
1178
  color: "gray.600",
1064
1179
  children: [
1065
- n.description && /* @__PURE__ */ e.jsxs(M, { children: [
1180
+ t.description && /* @__PURE__ */ e.jsxs(v, { children: [
1066
1181
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1067
1182
  " ",
1068
- n.description
1183
+ t.description
1069
1184
  ] }),
1070
- /* @__PURE__ */ e.jsxs(M, { children: [
1185
+ /* @__PURE__ */ e.jsxs(v, { children: [
1071
1186
  /* @__PURE__ */ e.jsx("strong", { children: "Actions:" }),
1072
1187
  " ",
1073
- n.moduleActions.length
1188
+ t.moduleActions.length
1074
1189
  ] }),
1075
- /* @__PURE__ */ e.jsxs(M, { children: [
1190
+ /* @__PURE__ */ e.jsxs(v, { children: [
1076
1191
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1077
1192
  " ",
1078
- n.categories.map((y) => y.name).join(", ") || "None"
1193
+ t.categories.map((f) => f.name).join(", ") || "None"
1079
1194
  ] })
1080
1195
  ]
1081
1196
  }
1082
1197
  )
1083
1198
  ]
1084
1199
  },
1085
- n.id
1200
+ t.id
1086
1201
  )),
1087
- g.length > 1 && /* @__PURE__ */ e.jsx(
1088
- B,
1202
+ D.length > 1 && /* @__PURE__ */ e.jsx(
1203
+ q,
1089
1204
  {
1090
1205
  w: "100%",
1091
1206
  p: 2,
@@ -1093,131 +1208,133 @@ const Ys = ({
1093
1208
  borderRadius: "md",
1094
1209
  border: "1px solid",
1095
1210
  borderColor: "blue.200",
1096
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1211
+ children: /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1097
1212
  "Total: ",
1098
- g.length,
1099
- " modules will be copied"
1213
+ D.length,
1214
+ " modules will be",
1215
+ " ",
1216
+ o === "copy" ? "copied" : "converted"
1100
1217
  ] })
1101
1218
  }
1102
1219
  ),
1103
- m && g.filter((n) => n.moduleActions.some((i) => !i.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1104
- B,
1220
+ u && D.filter((t) => t.moduleActions.some((h) => !h.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1221
+ q,
1105
1222
  {
1106
1223
  p: 2,
1107
1224
  bg: "yellow.50",
1108
1225
  borderRadius: "md",
1109
1226
  border: "1px solid",
1110
1227
  borderColor: "yellow.200",
1111
- children: /* @__PURE__ */ e.jsx(M, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1228
+ children: /* @__PURE__ */ e.jsx(v, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: o === "convert" ? "Converting Modules will convert non QM-Owned Actions to QM-Owned" : "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1112
1229
  }
1113
1230
  )
1114
1231
  ] })
1115
1232
  ] }),
1116
- !u && /* @__PURE__ */ e.jsxs(ce, { spacing: 4, justifyContent: "flex-end", children: [
1233
+ !d && /* @__PURE__ */ e.jsxs(me, { spacing: 4, justifyContent: "flex-end", children: [
1117
1234
  /* @__PURE__ */ e.jsx(
1118
- $,
1235
+ J,
1119
1236
  {
1120
1237
  variant: "outline",
1121
- onClick: q,
1238
+ onClick: k,
1122
1239
  isDisabled: x,
1123
1240
  children: "Cancel"
1124
1241
  }
1125
1242
  ),
1126
1243
  /* @__PURE__ */ e.jsxs(
1127
- $,
1244
+ J,
1128
1245
  {
1129
- colorScheme: "blue",
1130
- onClick: T,
1131
- isDisabled: g.length === 0 || x,
1246
+ colorScheme: o === "copy" ? "blue" : "green",
1247
+ onClick: $,
1248
+ isDisabled: D.length === 0 || x,
1132
1249
  isLoading: x,
1133
- loadingText: "Copying...",
1250
+ loadingText: `${o === "copy" ? "Copying" : "Converting"}...`,
1134
1251
  children: [
1135
- "Copy",
1252
+ o === "copy" ? "Copy" : "Convert",
1136
1253
  " ",
1137
- g.length === 1 ? "Module" : `${g.length} Modules`
1254
+ D.length === 1 ? "Module" : `${D.length} Modules`
1138
1255
  ]
1139
1256
  }
1140
1257
  )
1141
1258
  ] })
1142
1259
  ] }) });
1143
- }, ot = ({
1144
- name: t,
1260
+ }, rs = ({
1261
+ name: n,
1145
1262
  setName: s,
1146
- actions: o,
1147
- selectedActionIds: u,
1148
- setSelectedActionIds: l,
1149
- availableCategories: a,
1150
- selectedCategoryIds: m,
1151
- setSelectedCategoryIds: f,
1152
- description: j,
1153
- setDescription: C,
1154
- ...I
1263
+ actions: r,
1264
+ selectedActionIds: d,
1265
+ setSelectedActionIds: i,
1266
+ availableCategories: l,
1267
+ selectedCategoryIds: u,
1268
+ setSelectedCategoryIds: g,
1269
+ description: a,
1270
+ setDescription: M,
1271
+ ...T
1155
1272
  }) => {
1156
- const p = hs(), x = D(() => o.map((v) => ({
1157
- ...v,
1158
- selected: u.includes(v.id)
1159
- })), [o, u]), A = D(() => o.reduce((v, h) => (v[h.id] = h, v), {}), [o]), d = D(
1160
- () => u.map((v) => A[v]),
1161
- [x, u]
1162
- ), r = O(
1163
- (v, h) => {
1164
- l(h ? [...u, v.id] : u.filter((g) => g !== v.id));
1273
+ const p = gt(), x = _(() => r.map((C) => ({
1274
+ ...C,
1275
+ selected: d.includes(C.id)
1276
+ })), [r, d]), A = _(() => r.reduce((C, w) => (C[w.id] = w, C), {}), [r]), o = _(
1277
+ () => d.map((C) => A[C]),
1278
+ [x, d]
1279
+ ), c = N(
1280
+ (C, w) => {
1281
+ i(w ? [...d, C.id] : d.filter((S) => S !== C.id));
1165
1282
  },
1166
- [u, l]
1167
- ), S = O(
1168
- (v) => {
1169
- s(v.target.value);
1283
+ [d, i]
1284
+ ), j = N(
1285
+ (C) => {
1286
+ s(C.target.value);
1170
1287
  },
1171
1288
  [s]
1172
- ), b = O(
1173
- (v) => {
1174
- C?.(v.target.value);
1289
+ ), m = N(
1290
+ (C) => {
1291
+ M?.(C.target.value);
1175
1292
  },
1176
- [C]
1293
+ [M]
1177
1294
  );
1178
- return /* @__PURE__ */ e.jsxs(B, { ...I, children: [
1179
- /* @__PURE__ */ e.jsxs(K, { gap: "2rem", children: [
1180
- /* @__PURE__ */ e.jsx(rt, { name: t ?? "", onInputChange: S }),
1295
+ return /* @__PURE__ */ e.jsxs(q, { ...T, children: [
1296
+ /* @__PURE__ */ e.jsxs(X, { gap: "2rem", children: [
1297
+ /* @__PURE__ */ e.jsx(is, { name: n ?? "", onInputChange: j }),
1181
1298
  /* @__PURE__ */ e.jsx(
1182
- lt,
1299
+ ls,
1183
1300
  {
1184
- availableCategories: a,
1185
- value: m,
1186
- onChange: f
1301
+ availableCategories: l,
1302
+ value: u,
1303
+ onChange: g
1187
1304
  }
1188
1305
  )
1189
1306
  ] }),
1190
1307
  /* @__PURE__ */ e.jsx(
1191
- at,
1308
+ as,
1192
1309
  {
1193
- description: j ?? "",
1194
- onInputChange: b
1310
+ description: a ?? "",
1311
+ onInputChange: m
1195
1312
  }
1196
1313
  ),
1197
1314
  /* @__PURE__ */ e.jsx(
1198
- ct,
1315
+ cs,
1199
1316
  {
1200
- value: d,
1201
- onChange: l,
1317
+ value: o,
1318
+ onChange: i,
1202
1319
  onAdjustActivities: () => p.onOpen()
1203
1320
  }
1204
1321
  ),
1205
1322
  /* @__PURE__ */ e.jsxs(
1206
- ms,
1323
+ xt,
1207
1324
  {
1208
1325
  isOpen: p.isOpen,
1209
1326
  onClose: p.onClose,
1210
1327
  size: "6xl",
1211
1328
  children: [
1212
- /* @__PURE__ */ e.jsx(gs, {}),
1213
- /* @__PURE__ */ e.jsxs(ps, { children: [
1214
- /* @__PURE__ */ e.jsx(xs, { children: "Select Activities" }),
1215
- /* @__PURE__ */ e.jsx(fs, {}),
1216
- /* @__PURE__ */ e.jsx(js, { children: /* @__PURE__ */ e.jsx(
1217
- nt,
1329
+ /* @__PURE__ */ e.jsx(ft, {}),
1330
+ /* @__PURE__ */ e.jsxs(jt, { children: [
1331
+ /* @__PURE__ */ e.jsx(vt, { children: "Select Activities" }),
1332
+ /* @__PURE__ */ e.jsx(bt, {}),
1333
+ /* @__PURE__ */ e.jsx(yt, { children: /* @__PURE__ */ e.jsx(
1334
+ os,
1218
1335
  {
1219
1336
  actions: x,
1220
- onSelected: r,
1337
+ onSelected: c,
1221
1338
  disableCreate: !0,
1222
1339
  disableDelete: !0,
1223
1340
  tableProps: {
@@ -1226,12 +1343,12 @@ const Ys = ({
1226
1343
  }
1227
1344
  }
1228
1345
  ) }),
1229
- /* @__PURE__ */ e.jsx(bs, { children: /* @__PURE__ */ e.jsx(
1230
- $,
1346
+ /* @__PURE__ */ e.jsx(Ct, { children: /* @__PURE__ */ e.jsx(
1347
+ J,
1231
1348
  {
1232
1349
  colorScheme: "blue",
1233
1350
  onClick: p.onClose,
1234
- isDisabled: u.length === 0,
1351
+ isDisabled: d.length === 0,
1235
1352
  children: "Done"
1236
1353
  }
1237
1354
  ) })
@@ -1240,197 +1357,197 @@ const Ys = ({
1240
1357
  }
1241
1358
  )
1242
1359
  ] });
1243
- }, rt = Se(
1360
+ }, is = Ne(
1244
1361
  ({
1245
- name: t,
1362
+ name: n,
1246
1363
  onInputChange: s
1247
- }) => /* @__PURE__ */ e.jsxs(G, { mb: 4, children: [
1248
- /* @__PURE__ */ e.jsx(te, { children: "Module Name" }),
1364
+ }) => /* @__PURE__ */ e.jsxs(W, { mb: 4, children: [
1365
+ /* @__PURE__ */ e.jsx(se, { children: "Module Name" }),
1249
1366
  /* @__PURE__ */ e.jsx(
1250
- ye,
1367
+ Ie,
1251
1368
  {
1252
1369
  placeholder: "i.e. ACL RTP Test Battery",
1253
- value: t,
1370
+ value: n,
1254
1371
  onChange: s,
1255
1372
  isRequired: !0
1256
1373
  }
1257
1374
  )
1258
1375
  ] })
1259
- ), lt = Se(
1376
+ ), ls = Ne(
1260
1377
  ({
1261
- availableCategories: t,
1378
+ availableCategories: n,
1262
1379
  value: s,
1263
- onChange: o
1380
+ onChange: r
1264
1381
  }) => {
1265
- const u = D(() => [
1266
- ...t,
1382
+ const d = _(() => [
1383
+ ...n,
1267
1384
  {
1268
1385
  id: "other",
1269
1386
  name: "Other"
1270
1387
  }
1271
- ], [t]), l = D(() => u.map((a) => ({
1272
- value: a.id,
1273
- label: a.name
1274
- })), [u]);
1275
- return /* @__PURE__ */ e.jsxs(G, { mb: 4, children: [
1276
- /* @__PURE__ */ e.jsx(te, { children: "Module Category" }),
1388
+ ], [n]), i = _(() => d.map((l) => ({
1389
+ value: l.id,
1390
+ label: l.name
1391
+ })), [d]);
1392
+ return /* @__PURE__ */ e.jsxs(W, { mb: 4, children: [
1393
+ /* @__PURE__ */ e.jsx(se, { children: "Module Category" }),
1277
1394
  /* @__PURE__ */ e.jsx(
1278
- se,
1395
+ ie,
1279
1396
  {
1280
- isDisabled: t.length === 0,
1397
+ isDisabled: n.length === 0,
1281
1398
  isClearable: !0,
1282
- options: l,
1283
- value: u.filter((a) => s.includes(a.id)).map((a) => ({
1284
- value: a.id,
1285
- label: a.name
1399
+ options: i,
1400
+ value: d.filter((l) => s.includes(l.id)).map((l) => ({
1401
+ value: l.id,
1402
+ label: l.name
1286
1403
  })),
1287
- onChange: (a) => o(a ? [a.value] : []),
1404
+ onChange: (l) => r(l ? [l.value] : []),
1288
1405
  placeholder: "Select category"
1289
1406
  }
1290
1407
  )
1291
1408
  ] });
1292
1409
  }
1293
- ), at = Se(
1410
+ ), as = Ne(
1294
1411
  ({
1295
- description: t,
1412
+ description: n,
1296
1413
  onInputChange: s
1297
- }) => /* @__PURE__ */ e.jsxs(G, { mb: 4, children: [
1298
- /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1414
+ }) => /* @__PURE__ */ e.jsxs(W, { mb: 4, children: [
1415
+ /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1299
1416
  "Description",
1300
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1417
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1301
1418
  ] }) }),
1302
1419
  /* @__PURE__ */ e.jsx(
1303
- ye,
1420
+ Ie,
1304
1421
  {
1305
1422
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1306
- value: t,
1423
+ value: n,
1307
1424
  onChange: s
1308
1425
  }
1309
1426
  )
1310
1427
  ] })
1311
- ), ct = Se(
1428
+ ), cs = Ne(
1312
1429
  ({
1313
- value: t,
1430
+ value: n,
1314
1431
  onChange: s,
1315
- onAdjustActivities: o
1432
+ onAdjustActivities: r
1316
1433
  }) => {
1317
- const u = D(
1318
- () => t.map((l) => ({
1319
- id: l.id,
1320
- name: l.name
1434
+ const d = _(
1435
+ () => n.map((i) => ({
1436
+ id: i.id,
1437
+ name: i.name
1321
1438
  })),
1322
- [t]
1439
+ [n]
1323
1440
  );
1324
- return /* @__PURE__ */ e.jsxs(G, { mb: 4, children: [
1325
- /* @__PURE__ */ e.jsxs(K, { justifyContent: "space-between", children: [
1326
- /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1441
+ return /* @__PURE__ */ e.jsxs(W, { mb: 4, children: [
1442
+ /* @__PURE__ */ e.jsxs(X, { justifyContent: "space-between", children: [
1443
+ /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1327
1444
  "Activities",
1328
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1445
+ /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1329
1446
  ] }) }),
1330
1447
  /* @__PURE__ */ e.jsx(
1331
- $,
1448
+ J,
1332
1449
  {
1333
1450
  size: "sm",
1334
1451
  variant: "solid",
1335
1452
  colorScheme: "blue",
1336
- onClick: o,
1453
+ onClick: r,
1337
1454
  children: "Add / Remove Activities"
1338
1455
  }
1339
1456
  )
1340
1457
  ] }),
1341
- u.length === 0 ? /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsxs(M, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1458
+ d.length === 0 ? /* @__PURE__ */ e.jsx(Z, { children: /* @__PURE__ */ e.jsxs(v, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1342
1459
  "No activities selected for this module.",
1343
1460
  /* @__PURE__ */ e.jsx(
1344
- $,
1461
+ J,
1345
1462
  {
1346
1463
  ml: "0.5em",
1347
1464
  size: "sm",
1348
1465
  variant: "link",
1349
1466
  colorScheme: "blue",
1350
- onClick: o,
1467
+ onClick: r,
1351
1468
  children: "Add activities."
1352
1469
  }
1353
1470
  )
1354
1471
  ] }) }) : /* @__PURE__ */ e.jsx(
1355
- Js,
1472
+ Xt,
1356
1473
  {
1357
- value: u,
1358
- onChange: (l) => {
1359
- const a = l(u);
1360
- s(a.map((m) => m.id));
1474
+ value: d,
1475
+ onChange: (i) => {
1476
+ const l = i(d);
1477
+ s(l.map((u) => u.id));
1361
1478
  }
1362
1479
  }
1363
1480
  )
1364
1481
  ] });
1365
1482
  }
1366
- ), dt = ({
1367
- value: t,
1483
+ ), ds = ({
1484
+ value: n,
1368
1485
  onChange: s,
1369
- forceKind: o,
1370
- disableRemove: u,
1371
- disableKind: l,
1372
- lockRanges: a,
1373
- ...m
1486
+ forceKind: r,
1487
+ disableRemove: d,
1488
+ disableKind: i,
1489
+ lockRanges: l,
1490
+ ...u
1374
1491
  }) => {
1375
- const f = D(() => [...t].sort((p, x) => {
1376
- const A = Be.indexOf(p.plane), d = Be.indexOf(x.plane);
1377
- return A - d;
1378
- }), [t]), j = O((p) => "segment" in p.id ? ns(p.id.segment, p.plane, !0) ?? "Unknown" : is(p.id.joint, p.plane, !0) ?? "Unknown", []), C = O(
1492
+ const g = _(() => [...n].sort((p, x) => {
1493
+ const A = Be.indexOf(p.plane), o = Be.indexOf(x.plane);
1494
+ return A - o;
1495
+ }), [n]), a = N((p) => "segment" in p.id ? lt(p.id.segment, p.plane, !0) ?? "Unknown" : at(p.id.joint, p.plane, !0) ?? "Unknown", []), M = N(
1379
1496
  (p, x) => {
1380
- const A = f.findIndex(
1381
- (r) => r.id === x.id && r.plane === x.plane
1497
+ const A = g.findIndex(
1498
+ (c) => c.id === x.id && c.plane === x.plane
1382
1499
  );
1383
- let d = [...f];
1384
- o && (x = { ...x, kind: o }), d[A] = x, a && (d = d.map((r) => ({
1385
- ...r,
1500
+ let o = [...g];
1501
+ r && (x = { ...x, kind: r }), o[A] = x, l && (o = o.map((c) => ({
1502
+ ...c,
1386
1503
  min: x.min,
1387
1504
  max: x.max
1388
- }))), s(d);
1505
+ }))), s(o);
1389
1506
  },
1390
- [s, f, o, a]
1391
- ), I = O(
1507
+ [s, g, r, l]
1508
+ ), T = N(
1392
1509
  (p) => {
1393
- const x = f.filter(
1510
+ const x = g.filter(
1394
1511
  (A) => A.id !== p.id || A.plane !== p.plane
1395
1512
  );
1396
1513
  s(x);
1397
1514
  },
1398
- [s, f]
1515
+ [s, g]
1399
1516
  );
1400
- return /* @__PURE__ */ e.jsx(V, { alignItems: "flex-start", overflowY: "auto", ...m, children: f.map((p, x) => /* @__PURE__ */ e.jsx(
1401
- ut,
1517
+ return /* @__PURE__ */ e.jsx(Z, { alignItems: "flex-start", overflowY: "auto", ...u, children: g.map((p, x) => /* @__PURE__ */ e.jsx(
1518
+ us,
1402
1519
  {
1403
- label: j(p),
1520
+ label: a(p),
1404
1521
  parameter: p,
1405
- onChange: (A) => C(x, A),
1406
- onRemove: u ? void 0 : () => I(p),
1407
- forceKind: o,
1408
- disableKind: l
1522
+ onChange: (A) => M(x, A),
1523
+ onRemove: d ? void 0 : () => T(p),
1524
+ forceKind: r,
1525
+ disableKind: i
1409
1526
  },
1410
1527
  `${JSON.stringify(p.id)}-${p.plane}`
1411
1528
  )) });
1412
- }, ut = ({
1413
- label: t,
1529
+ }, us = ({
1530
+ label: n,
1414
1531
  parameter: s,
1415
- onChange: o,
1416
- onRemove: u,
1417
- forceKind: l,
1418
- disableKind: a
1532
+ onChange: r,
1533
+ onRemove: d,
1534
+ forceKind: i,
1535
+ disableKind: l
1419
1536
  }) => {
1420
- const m = O(
1421
- (C) => "joint" in s.id ? Bs(
1537
+ const u = N(
1538
+ (M) => "joint" in s.id ? Bt(
1422
1539
  s.id.joint,
1423
1540
  s.plane,
1424
- C < 0 ? -1 : 1
1425
- ) : Ws(
1541
+ M < 0 ? -1 : 1
1542
+ ) : Qt(
1426
1543
  s.id.segment,
1427
1544
  s.plane,
1428
- C < 0 ? -1 : 1
1545
+ M < 0 ? -1 : 1
1429
1546
  ),
1430
1547
  [s]
1431
- ), { min: f, max: j } = "joint" in s.id ? $s(s.id.joint, s.plane) : { min: -180, max: 180 };
1548
+ ), { min: g, max: a } = "joint" in s.id ? qt(s.id.joint, s.plane) : { min: -180, max: 180 };
1432
1549
  return /* @__PURE__ */ e.jsxs(
1433
- V,
1550
+ Z,
1434
1551
  {
1435
1552
  borderRadius: "md",
1436
1553
  p: 2,
@@ -1440,33 +1557,33 @@ const Ys = ({
1440
1557
  overflow: "hidden",
1441
1558
  flexShrink: "0",
1442
1559
  children: [
1443
- /* @__PURE__ */ e.jsxs(K, { w: "100%", children: [
1560
+ /* @__PURE__ */ e.jsxs(X, { w: "100%", children: [
1444
1561
  /* @__PURE__ */ e.jsx(
1445
- M,
1562
+ v,
1446
1563
  {
1447
1564
  fontSize: "sm",
1448
1565
  flex: 1,
1449
1566
  textTransform: "capitalize",
1450
1567
  fontWeight: "semibold",
1451
- children: t
1568
+ children: n
1452
1569
  }
1453
1570
  ),
1454
- u && /* @__PURE__ */ e.jsx(
1455
- vs,
1571
+ d && /* @__PURE__ */ e.jsx(
1572
+ wt,
1456
1573
  {
1457
1574
  size: "xs",
1458
1575
  variant: "ghost",
1459
1576
  "aria-label": "delete",
1460
- icon: /* @__PURE__ */ e.jsx(We, { as: Ms }),
1461
- onClick: u
1577
+ icon: /* @__PURE__ */ e.jsx(Qe, { as: Tt }),
1578
+ onClick: d
1462
1579
  }
1463
1580
  ),
1464
- !l && /* @__PURE__ */ e.jsx(
1465
- Fe,
1581
+ !i && /* @__PURE__ */ e.jsx(
1582
+ _e,
1466
1583
  {
1467
- selectedItem: s?.kind ?? je.Limit,
1468
- onChange: ({ value: C }) => o({ ...s, kind: C }),
1469
- isDisabled: a,
1584
+ selectedItem: s?.kind ?? we.Limit,
1585
+ onChange: ({ value: M }) => r({ ...s, kind: M }),
1586
+ isDisabled: l,
1470
1587
  buttonProps: {
1471
1588
  size: "sm",
1472
1589
  variant: "outline",
@@ -1477,327 +1594,327 @@ const Ys = ({
1477
1594
  colorScheme: "teal"
1478
1595
  },
1479
1596
  items: [
1480
- { value: je.Limit, label: "limit" },
1481
- { value: je.Target, label: "target" }
1597
+ { value: we.Limit, label: "limit" },
1598
+ { value: we.Target, label: "target" }
1482
1599
  ]
1483
1600
  }
1484
1601
  )
1485
1602
  ] }),
1486
1603
  /* @__PURE__ */ e.jsx(
1487
- Xs,
1604
+ Vt,
1488
1605
  {
1489
1606
  w: "100%",
1490
1607
  size: "xs",
1491
- min: f,
1492
- max: j,
1608
+ min: g,
1609
+ max: a,
1493
1610
  zeroMarker: !0,
1494
1611
  value: [s.min, s.max],
1495
- onChange: (C) => o({ ...s, min: C[0], max: C[1] }),
1496
- formatValue: (C) => `${Math.abs(C)}°`,
1497
- valueLabel: (C) => m(C) ?? "",
1498
- positiveNegativeLabels: m(0) ? [m(-1) ?? "", m(1) ?? ""] : void 0
1612
+ onChange: (M) => r({ ...s, min: M[0], max: M[1] }),
1613
+ formatValue: (M) => `${Math.abs(M)}°`,
1614
+ valueLabel: (M) => u(M) ?? "",
1615
+ positiveNegativeLabels: u(0) ? [u(-1) ?? "", u(1) ?? ""] : void 0
1499
1616
  }
1500
1617
  )
1501
1618
  ]
1502
1619
  }
1503
1620
  );
1504
- }, fe = (t, s) => "segment" in t && "segment" in s && t.segment === s.segment || "joint" in t && "joint" in s && t.joint === s.joint, ht = ({
1505
- options: t,
1621
+ }, Ce = (n, s) => "segment" in n && "segment" in s && n.segment === s.segment || "joint" in n && "joint" in s && n.joint === s.joint, hs = ({
1622
+ options: n,
1506
1623
  value: s,
1507
- onChange: o,
1508
- forceKind: u,
1509
- singleValue: l,
1510
- singleValueSideless: a,
1511
- editOnly: m,
1512
- disableKind: f,
1513
- maxParameters: j,
1514
- ...C
1624
+ onChange: r,
1625
+ forceKind: d,
1626
+ singleValue: i,
1627
+ singleValueSideless: l,
1628
+ editOnly: u,
1629
+ disableKind: g,
1630
+ maxParameters: a,
1631
+ ...M
1515
1632
  }) => {
1516
- const I = a ? 2 : j, p = D(
1517
- () => t.map((r) => ({
1518
- label: "segment" in r.id ? ns(r.id.segment, r.plane, !0) ?? "Unknown" : is(r.id.joint, r.plane, !0) ?? "Unknown",
1519
- value: r.id,
1520
- plane: r.plane
1633
+ const T = l ? 2 : a, p = _(
1634
+ () => n.map((c) => ({
1635
+ label: "segment" in c.id ? lt(c.id.segment, c.plane, !0) ?? "Unknown" : at(c.id.joint, c.plane, !0) ?? "Unknown",
1636
+ value: c.id,
1637
+ plane: c.plane
1521
1638
  })),
1522
- [t]
1523
- ), x = D(() => {
1524
- if (!a || s.length === 0)
1639
+ [n]
1640
+ ), x = _(() => {
1641
+ if (!l || s.length === 0)
1525
1642
  return p;
1526
- const r = s[0];
1643
+ const c = s[0];
1527
1644
  return p.filter(
1528
- (S) => pe(S.value) === pe(r.id) && S.plane === r.plane
1645
+ (j) => be(j.value) === be(c.id) && j.plane === c.plane
1529
1646
  );
1530
- }, [p, s, a]), A = D(
1647
+ }, [p, s, l]), A = _(
1531
1648
  () => p.filter(
1532
- (r) => s.some((S) => fe(S.id, r.value) && S.plane === r.plane)
1649
+ (c) => s.some((j) => Ce(j.id, c.value) && j.plane === c.plane)
1533
1650
  ),
1534
1651
  [p, s]
1535
- ), d = O(
1536
- (r) => {
1537
- const S = r.map((b) => {
1538
- const v = s.find(
1539
- (T) => fe(T.id, b.value) && T.plane === b.plane
1540
- ), h = t.find(
1541
- (T) => fe(T.id, b.value) && T.plane === b.plane
1542
- ), g = a ? s.find(
1543
- (T) => pe(T.id) === pe(b.value) && T.plane === b.plane
1544
- ) : void 0, w = g && !v ? g.min : h && h.min ? h.min : 0, P = g && !v ? g.max : h && h.max ? h.max : 0;
1545
- return v ?? {
1546
- id: b.value,
1547
- plane: b.plane,
1548
- min: w,
1549
- max: P,
1550
- kind: u ?? je.Limit
1652
+ ), o = N(
1653
+ (c) => {
1654
+ const j = c.map((m) => {
1655
+ const C = s.find(
1656
+ (I) => Ce(I.id, m.value) && I.plane === m.plane
1657
+ ), w = n.find(
1658
+ (I) => Ce(I.id, m.value) && I.plane === m.plane
1659
+ ), S = l ? s.find(
1660
+ (I) => be(I.id) === be(m.value) && I.plane === m.plane
1661
+ ) : void 0, b = S && !C ? S.min : w && w.min ? w.min : 0, O = S && !C ? S.max : w && w.max ? w.max : 0;
1662
+ return C ?? {
1663
+ id: m.value,
1664
+ plane: m.plane,
1665
+ min: b,
1666
+ max: O,
1667
+ kind: d ?? we.Limit
1551
1668
  };
1552
1669
  });
1553
- o(S);
1670
+ r(j);
1554
1671
  },
1555
- [o, s, t, u, a]
1672
+ [r, s, n, d, l]
1556
1673
  );
1557
- return Y(() => {
1558
- const r = s.filter(
1559
- (S) => t.some((b) => fe(b.id, S.id) && b.plane === S.plane)
1674
+ return V(() => {
1675
+ const c = s.filter(
1676
+ (j) => n.some((m) => Ce(m.id, j.id) && m.plane === j.plane)
1560
1677
  );
1561
- r.length !== s.length && o(r);
1562
- }, [t, o]), /* @__PURE__ */ e.jsxs(B, { ...C, children: [
1678
+ c.length !== s.length && r(c);
1679
+ }, [n, r]), /* @__PURE__ */ e.jsxs(q, { ...M, children: [
1563
1680
  /* @__PURE__ */ e.jsx(
1564
- se,
1681
+ ie,
1565
1682
  {
1566
- isMulti: !l,
1683
+ isMulti: !i,
1567
1684
  placeholder: s.length ? `${s.length} selected` : "Search...",
1568
1685
  value: A,
1569
- isDisabled: m || A.length >= (I ?? 1 / 0),
1570
- onChange: (r) => Array.isArray(r) ? d([...r]) : d(r !== null ? [r] : []),
1686
+ isDisabled: u || A.length >= (T ?? 1 / 0),
1687
+ onChange: (c) => Array.isArray(c) ? o([...c]) : o(c !== null ? [c] : []),
1571
1688
  options: x,
1572
1689
  controlShouldRenderValue: !1
1573
1690
  }
1574
1691
  ),
1575
1692
  /* @__PURE__ */ e.jsx(
1576
- dt,
1693
+ ds,
1577
1694
  {
1578
1695
  marginTop: 2,
1579
1696
  maxH: "28rem",
1580
1697
  value: s,
1581
- onChange: o,
1582
- forceKind: u,
1583
- disableKind: f,
1584
- lockRanges: a
1698
+ onChange: r,
1699
+ forceKind: d,
1700
+ disableKind: g,
1701
+ lockRanges: l
1585
1702
  }
1586
1703
  )
1587
1704
  ] });
1588
- }, os = (t) => {
1589
- switch (t) {
1590
- case k.Thorax:
1705
+ }, ct = (n) => {
1706
+ switch (n) {
1707
+ case z.Thorax:
1591
1708
  return "Thorax";
1592
- case k.CenterBack:
1709
+ case z.CenterBack:
1593
1710
  return "Center Back";
1594
- case k.Pelvis:
1711
+ case z.Pelvis:
1595
1712
  return "Pelvis";
1596
- case k.LeftThigh:
1713
+ case z.LeftThigh:
1597
1714
  return "Left Thigh";
1598
- case k.RightThigh:
1715
+ case z.RightThigh:
1599
1716
  return "Right Thigh";
1600
- case k.LeftShank:
1717
+ case z.LeftShank:
1601
1718
  return "Left Shank";
1602
- case k.RightShank:
1719
+ case z.RightShank:
1603
1720
  return "Right Shank";
1604
- case k.LeftFoot:
1721
+ case z.LeftFoot:
1605
1722
  return "Left Foot";
1606
- case k.RightFoot:
1723
+ case z.RightFoot:
1607
1724
  return "Right Foot";
1608
- case k.LeftUpperArm:
1725
+ case z.LeftUpperArm:
1609
1726
  return "Left Upper Arm";
1610
- case k.RightUpperArm:
1727
+ case z.RightUpperArm:
1611
1728
  return "Right Upper Arm";
1612
- case k.LeftForearm:
1729
+ case z.LeftForearm:
1613
1730
  return "Left Forearm";
1614
- case k.RightForearm:
1731
+ case z.RightForearm:
1615
1732
  return "Right Forearm";
1616
- case k.Head:
1733
+ case z.Head:
1617
1734
  return "Head";
1618
1735
  }
1619
- return console.warn(`Unknown sensor location: ${t}`), "Unknown";
1620
- }, mt = 6, gt = [
1621
- k.LeftFoot,
1622
- k.LeftShank,
1623
- k.LeftThigh,
1624
- k.Pelvis,
1625
- k.RightFoot,
1626
- k.RightShank,
1627
- k.RightThigh,
1628
- k.Thorax,
1629
- k.CenterBack,
1630
- k.Head
1631
- ], pt = gt.map((t) => ({
1632
- label: os(t),
1633
- value: t
1634
- })), Oe = (t) => t.map(
1736
+ return console.warn(`Unknown sensor location: ${n}`), "Unknown";
1737
+ }, ms = 6, ps = [
1738
+ z.LeftFoot,
1739
+ z.LeftShank,
1740
+ z.LeftThigh,
1741
+ z.Pelvis,
1742
+ z.RightFoot,
1743
+ z.RightShank,
1744
+ z.RightThigh,
1745
+ z.Thorax,
1746
+ z.CenterBack,
1747
+ z.Head
1748
+ ], gs = ps.map((n) => ({
1749
+ label: ct(n),
1750
+ value: n
1751
+ })), De = (n) => n.map(
1635
1752
  (s) => s.__isNew__ ? { name: s.label } : { id: s.value, name: s.label }
1636
- ), Ft = ({
1637
- id: t,
1753
+ ), Ls = ({
1754
+ id: n,
1638
1755
  onError: s,
1639
- onCancel: o,
1640
- onSave: u,
1641
- hideButtons: l,
1642
- setButtonOnClick: a,
1643
- setButtonDisabled: m,
1644
- quantumOwned: f
1756
+ onCancel: r,
1757
+ onSave: d,
1758
+ hideButtons: i,
1759
+ setButtonOnClick: l,
1760
+ setButtonDisabled: u,
1761
+ quantumOwned: g
1645
1762
  }) => {
1646
- const j = As(), [{ fetching: C }, I] = oe(De), [{ fetching: p }, x] = oe(Ns), [{ data: A }] = ee({
1647
- query: Os,
1648
- variables: { id: t ?? "" },
1649
- pause: !t
1650
- }), d = W(
1651
- ae,
1763
+ const a = It(), [{ fetching: M }, T] = te(ze), [{ fetching: p }, x] = te(Et), [{ data: A }] = oe({
1764
+ query: Dt,
1765
+ variables: { id: n ?? "" },
1766
+ pause: !n
1767
+ }), o = B(
1768
+ re,
1652
1769
  A?.getActionById
1653
- ), r = C || p, S = !!d && !!t, [b, v] = F(""), [h, g] = F(""), [w, P] = F(""), [T, q] = F(""), [R, Q] = F(
1654
- ge.Either
1655
- ), [U, c] = F(
1656
- Te.Action
1657
- ), [n, i] = F([]), [y, L] = F([]), _ = D(
1658
- () => n.map((N) => N.value),
1659
- [n]
1660
- ), H = Hs(_), [E, J] = F([]), [z, ue] = F(!1), X = b.length && R;
1661
- Y(() => {
1662
- d && (v(d.name), c(d.activityKind), g(d.description || ""), Q(d.laterality), L(
1663
- d.useCases.map((N) => ({
1664
- id: N.id,
1665
- value: N.id,
1666
- label: N.name,
1770
+ ), c = M || p, j = !!o && !!n, [m, C] = E(""), [w, S] = E(""), [b, O] = E(""), [I, D] = E(""), [P, ee] = E(
1771
+ ve.Either
1772
+ ), [$, k] = E(
1773
+ Fe.Action
1774
+ ), [H, y] = E([]), [L, K] = E([]), t = _(
1775
+ () => H.map((R) => R.value),
1776
+ [H]
1777
+ ), h = Jt(t), [f, F] = E([]), [U, G] = E(!1), Y = m.length && P;
1778
+ V(() => {
1779
+ o && (C(o.name), k(o.activityKind), S(o.description || ""), ee(o.laterality), K(
1780
+ o.useCases.map((R) => ({
1781
+ id: R.id,
1782
+ value: R.id,
1783
+ label: R.name,
1667
1784
  __isNew__: !1
1668
1785
  }))
1669
- ), P(d.instructionsPointOfInterest || ""), q(d.instructionsMovementReport || ""), i(
1670
- d.sensorLocations.map((N) => ({
1671
- label: os(N),
1672
- value: N
1786
+ ), O(o.instructionsPointOfInterest || ""), D(o.instructionsMovementReport || ""), y(
1787
+ o.sensorLocations.map((R) => ({
1788
+ label: ct(R),
1789
+ value: R
1673
1790
  }))
1674
- ), J(Qs(d.thresholds)));
1675
- }, [d]);
1676
- const rs = O(
1677
- async (N) => (await j.query(
1678
- f ? Rs : Ls,
1791
+ ), F(Ht(o.thresholds)));
1792
+ }, [o]);
1793
+ const Q = N(
1794
+ async (R) => (await a.query(
1795
+ g ? Lt : Ft,
1679
1796
  {
1680
- query: N,
1797
+ query: R,
1681
1798
  limit: 10
1682
1799
  }
1683
- ).then((ne) => {
1684
- const me = ne.data;
1685
- return me ? me?.quantumOwnedUseCases ? me.quantumOwnedUseCases : me.useCases : [];
1686
- }) ?? []).map((ne) => ({
1687
- label: ne.name,
1688
- value: ne.id
1800
+ ).then((ae) => {
1801
+ const je = ae.data;
1802
+ return je ? je?.quantumOwnedUseCases ? je.quantumOwnedUseCases : je.useCases : [];
1803
+ }) ?? []).map((ae) => ({
1804
+ label: ae.name,
1805
+ value: ae.id
1689
1806
  })),
1690
- [j, f]
1691
- ), [ke, Ee] = F({});
1692
- Y(() => {
1693
- Ee({
1694
- name: b,
1695
- laterality: R,
1696
- description: h,
1697
- instructionsPointOfInterest: w,
1698
- instructionsMovementReport: T,
1699
- sensorLocations: _,
1700
- thresholds: Ne(E),
1701
- useCases: Oe(y),
1702
- activityKind: U
1807
+ [a, g]
1808
+ ), [de, xe] = E({});
1809
+ V(() => {
1810
+ xe({
1811
+ name: m,
1812
+ laterality: P,
1813
+ description: w,
1814
+ instructionsPointOfInterest: b,
1815
+ instructionsMovementReport: I,
1816
+ sensorLocations: t,
1817
+ thresholds: Ee(f),
1818
+ useCases: De(L),
1819
+ activityKind: $
1703
1820
  });
1704
- }, [Ee, d]);
1705
- const we = D(
1706
- () => JSON.stringify(ke) !== JSON.stringify({
1707
- name: b,
1708
- laterality: R,
1709
- description: h,
1710
- instructionsPointOfInterest: w,
1711
- instructionsMovementReport: T,
1712
- sensorLocations: _,
1713
- thresholds: Ne(E),
1714
- useCases: Oe(y),
1715
- activityKind: U
1821
+ }, [xe, o]);
1822
+ const le = _(
1823
+ () => JSON.stringify(de) !== JSON.stringify({
1824
+ name: m,
1825
+ laterality: P,
1826
+ description: w,
1827
+ instructionsPointOfInterest: b,
1828
+ instructionsMovementReport: I,
1829
+ sensorLocations: t,
1830
+ thresholds: Ee(f),
1831
+ useCases: De(L),
1832
+ activityKind: $
1716
1833
  }),
1717
1834
  [
1718
- ke,
1719
- b,
1720
- R,
1721
- _,
1722
- h,
1723
- T,
1835
+ de,
1836
+ m,
1837
+ P,
1838
+ t,
1724
1839
  w,
1725
- E,
1726
- y,
1727
- U
1840
+ I,
1841
+ b,
1842
+ f,
1843
+ L,
1844
+ $
1728
1845
  ]
1729
- ), Me = O(() => {
1730
- const N = {
1731
- name: b,
1732
- laterality: R,
1733
- description: h,
1734
- instructionsPointOfInterest: w,
1735
- instructionsMovementReport: T,
1736
- sensorLocations: _,
1737
- thresholds: Ne(E),
1738
- useCases: Oe(y),
1739
- activityKind: U,
1740
- quantumOwned: f
1846
+ ), pe = N(() => {
1847
+ const R = {
1848
+ name: m,
1849
+ laterality: P,
1850
+ description: w,
1851
+ instructionsPointOfInterest: b,
1852
+ instructionsMovementReport: I,
1853
+ sensorLocations: t,
1854
+ thresholds: Ee(f),
1855
+ useCases: De(L),
1856
+ activityKind: $,
1857
+ quantumOwned: g
1741
1858
  };
1742
- let he;
1743
- S && t ? he = x({
1744
- id: t,
1745
- fields: N
1746
- }) : he = I({
1747
- fields: N
1748
- }), he.then(({ error: ne }) => {
1749
- ne ? s(ne) : u();
1859
+ let fe;
1860
+ j && n ? fe = x({
1861
+ id: n,
1862
+ fields: R
1863
+ }) : fe = T({
1864
+ fields: R
1865
+ }), fe.then(({ error: ae }) => {
1866
+ ae ? s(ae) : d();
1750
1867
  });
1751
1868
  }, [
1752
- f,
1753
- I,
1869
+ g,
1870
+ T,
1754
1871
  x,
1872
+ n,
1873
+ m,
1874
+ P,
1755
1875
  t,
1756
- b,
1757
- R,
1758
- _,
1759
- u,
1760
- h,
1761
- T,
1876
+ d,
1762
1877
  w,
1763
- S,
1764
- E,
1765
- y,
1766
- U,
1878
+ I,
1879
+ b,
1880
+ j,
1881
+ f,
1882
+ L,
1883
+ $,
1767
1884
  s
1768
1885
  ]);
1769
- return Y(() => {
1770
- m && m({
1771
- cancelButton: r,
1772
- saveButton: r || !X || !we
1886
+ return V(() => {
1887
+ u && u({
1888
+ cancelButton: c,
1889
+ saveButton: c || !Y || !le
1773
1890
  });
1774
- }, [r, m, X, we]), Y(() => {
1775
- a && a({
1776
- cancelButton: o,
1777
- saveButton: Me
1891
+ }, [c, u, Y, le]), V(() => {
1892
+ l && l({
1893
+ cancelButton: r,
1894
+ saveButton: pe
1778
1895
  });
1779
- }, [a, o, Me]), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1896
+ }, [l, r, pe]), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1780
1897
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-8", children: [
1781
- /* @__PURE__ */ e.jsxs(G, { children: [
1782
- /* @__PURE__ */ e.jsx(Z, { children: "Name" }),
1898
+ /* @__PURE__ */ e.jsxs(W, { children: [
1899
+ /* @__PURE__ */ e.jsx(ne, { children: "Name" }),
1783
1900
  /* @__PURE__ */ e.jsx(
1784
- ye,
1901
+ Ie,
1785
1902
  {
1786
- value: b,
1787
- onChange: (N) => v(N.target.value),
1903
+ value: m,
1904
+ onChange: (R) => C(R.target.value),
1788
1905
  type: "text",
1789
1906
  placeholder: "i.e. Lunge & Return"
1790
1907
  }
1791
1908
  )
1792
1909
  ] }),
1793
- /* @__PURE__ */ e.jsxs(K, { m: "0", p: "0", w: "100%", justifyItems: "space-between", children: [
1794
- /* @__PURE__ */ e.jsxs(G, { children: [
1795
- /* @__PURE__ */ e.jsx(Z, { children: "Activity Type" }),
1910
+ /* @__PURE__ */ e.jsxs(X, { m: "0", p: "0", w: "100%", justifyItems: "space-between", children: [
1911
+ /* @__PURE__ */ e.jsxs(W, { children: [
1912
+ /* @__PURE__ */ e.jsx(ne, { children: "Activity Type" }),
1796
1913
  /* @__PURE__ */ e.jsx(
1797
- Fe,
1914
+ _e,
1798
1915
  {
1799
- selectedItem: U,
1800
- onChange: (N) => c(N.value),
1916
+ selectedItem: $,
1917
+ onChange: (R) => k(R.value),
1801
1918
  buttonProps: {
1802
1919
  size: "sm",
1803
1920
  variant: "outline",
@@ -1808,19 +1925,19 @@ const Ys = ({
1808
1925
  colorScheme: "teal"
1809
1926
  },
1810
1927
  items: [
1811
- { value: Te.Action, label: "Action" },
1812
- { value: Te.Movement, label: "Movement" }
1928
+ { value: Fe.Action, label: "Action" },
1929
+ { value: Fe.Movement, label: "Movement" }
1813
1930
  ]
1814
1931
  }
1815
1932
  )
1816
1933
  ] }),
1817
- /* @__PURE__ */ e.jsxs(G, { children: [
1818
- /* @__PURE__ */ e.jsx(Z, { children: "Laterality" }),
1934
+ /* @__PURE__ */ e.jsxs(W, { children: [
1935
+ /* @__PURE__ */ e.jsx(ne, { children: "Laterality" }),
1819
1936
  /* @__PURE__ */ e.jsx(
1820
- Fe,
1937
+ _e,
1821
1938
  {
1822
- selectedItem: R,
1823
- onChange: (N) => Q(N.value),
1939
+ selectedItem: P,
1940
+ onChange: (R) => ee(R.value),
1824
1941
  buttonProps: {
1825
1942
  size: "sm",
1826
1943
  variant: "outline",
@@ -1832,15 +1949,15 @@ const Ys = ({
1832
1949
  },
1833
1950
  items: [
1834
1951
  {
1835
- value: ge.Unilateral,
1952
+ value: ve.Unilateral,
1836
1953
  label: "unilateral"
1837
1954
  },
1838
1955
  {
1839
- value: ge.Bilateral,
1956
+ value: ve.Bilateral,
1840
1957
  label: "bilateral"
1841
1958
  },
1842
1959
  {
1843
- value: ge.Either,
1960
+ value: ve.Either,
1844
1961
  label: "either / or"
1845
1962
  }
1846
1963
  ]
@@ -1848,62 +1965,62 @@ const Ys = ({
1848
1965
  )
1849
1966
  ] })
1850
1967
  ] }),
1851
- /* @__PURE__ */ e.jsxs(G, { children: [
1852
- /* @__PURE__ */ e.jsx(Z, { children: "Use Cases" }),
1968
+ /* @__PURE__ */ e.jsxs(W, { children: [
1969
+ /* @__PURE__ */ e.jsx(ne, { children: "Use Cases" }),
1853
1970
  /* @__PURE__ */ e.jsx(
1854
- Je,
1971
+ Xe,
1855
1972
  {
1856
- isOpen: z,
1973
+ isOpen: U,
1857
1974
  label: "Type to search for existing use cases",
1858
1975
  placement: "top-end",
1859
- children: /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(
1860
- Ss,
1976
+ children: /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsx(
1977
+ At,
1861
1978
  {
1862
- value: y,
1863
- onChange: (N) => L([...N]),
1979
+ value: L,
1980
+ onChange: (R) => K([...R]),
1864
1981
  isMulti: !0,
1865
1982
  cacheOptions: !0,
1866
1983
  defaultOptions: !0,
1867
- onFocus: () => ue(!0),
1868
- onBlur: () => ue(!1),
1869
- loadOptions: rs,
1984
+ onFocus: () => G(!0),
1985
+ onBlur: () => G(!1),
1986
+ loadOptions: Q,
1870
1987
  placeholder: "(optional) Search for & select use cases…"
1871
1988
  }
1872
1989
  ) })
1873
1990
  }
1874
1991
  )
1875
1992
  ] }),
1876
- /* @__PURE__ */ e.jsxs(G, { children: [
1877
- /* @__PURE__ */ e.jsx(Z, { children: "Description" }),
1993
+ /* @__PURE__ */ e.jsxs(W, { children: [
1994
+ /* @__PURE__ */ e.jsx(ne, { children: "Description" }),
1878
1995
  /* @__PURE__ */ e.jsx(
1879
- Ie,
1996
+ Le,
1880
1997
  {
1881
- value: h,
1882
- onChange: (N) => g(N.target.value),
1998
+ value: w,
1999
+ onChange: (R) => S(R.target.value),
1883
2000
  rows: 2,
1884
2001
  placeholder: "(optional) Describe how to perform the test or exercise"
1885
2002
  }
1886
2003
  )
1887
2004
  ] }),
1888
- /* @__PURE__ */ e.jsxs(G, { children: [
1889
- /* @__PURE__ */ e.jsx(Z, { children: "Instructions for General Movement Report" }),
2005
+ /* @__PURE__ */ e.jsxs(W, { children: [
2006
+ /* @__PURE__ */ e.jsx(ne, { children: "Instructions for General Movement Report" }),
1890
2007
  /* @__PURE__ */ e.jsx(
1891
- Ie,
2008
+ Le,
1892
2009
  {
1893
- value: T,
1894
- onChange: (N) => q(N.target.value),
2010
+ value: I,
2011
+ onChange: (R) => D(R.target.value),
1895
2012
  rows: 2,
1896
2013
  placeholder: "(optional) Describe how to setup or generate the movement report"
1897
2014
  }
1898
2015
  )
1899
2016
  ] }),
1900
- /* @__PURE__ */ e.jsxs(G, { children: [
1901
- /* @__PURE__ */ e.jsx(Z, { children: "Instructions for Point of Interest Report" }),
2017
+ /* @__PURE__ */ e.jsxs(W, { children: [
2018
+ /* @__PURE__ */ e.jsx(ne, { children: "Instructions for Point of Interest Report" }),
1902
2019
  /* @__PURE__ */ e.jsx(
1903
- Ie,
2020
+ Le,
1904
2021
  {
1905
- value: w,
1906
- onChange: (N) => P(N.target.value),
2022
+ value: b,
2023
+ onChange: (R) => O(R.target.value),
1907
2024
  rows: 2,
1908
2025
  placeholder: "(optional) Describe how to setup or generate the point of interest report"
1909
2026
  }
@@ -1911,27 +2028,27 @@ const Ys = ({
1911
2028
  ] })
1912
2029
  ] }),
1913
2030
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-8", children: [
1914
- /* @__PURE__ */ e.jsxs(G, { children: [
1915
- /* @__PURE__ */ e.jsx(Z, { children: "Sensor Locations" }),
2031
+ /* @__PURE__ */ e.jsxs(W, { children: [
2032
+ /* @__PURE__ */ e.jsx(ne, { children: "Sensor Locations" }),
1916
2033
  /* @__PURE__ */ e.jsx(
1917
- se,
2034
+ ie,
1918
2035
  {
1919
2036
  isMulti: !0,
1920
- value: n,
1921
- onChange: (N) => i([...N]),
1922
- options: pt,
1923
- isOptionDisabled: () => n.length >= mt
2037
+ value: H,
2038
+ onChange: (R) => y([...R]),
2039
+ options: gs,
2040
+ isOptionDisabled: () => H.length >= ms
1924
2041
  }
1925
2042
  )
1926
2043
  ] }),
1927
- /* @__PURE__ */ e.jsxs(G, { children: [
1928
- /* @__PURE__ */ e.jsx(Z, { children: "Default Parameters" }),
2044
+ /* @__PURE__ */ e.jsxs(W, { children: [
2045
+ /* @__PURE__ */ e.jsx(ne, { children: "Default Parameters" }),
1929
2046
  /* @__PURE__ */ e.jsx(
1930
- ht,
2047
+ hs,
1931
2048
  {
1932
- options: H,
1933
- value: E,
1934
- onChange: J
2049
+ options: h,
2050
+ value: f,
2051
+ onChange: F
1935
2052
  }
1936
2053
  )
1937
2054
  ] })
@@ -1939,16 +2056,16 @@ const Ys = ({
1939
2056
  /* @__PURE__ */ e.jsx(
1940
2057
  "div",
1941
2058
  {
1942
- className: qs("col-span-2 flex justify-end", l && "hidden"),
1943
- children: /* @__PURE__ */ e.jsxs(ce, { mt: 16, gap: 4, children: [
1944
- /* @__PURE__ */ e.jsx($, { colorScheme: "gray", isDisabled: r, onClick: o, children: "Cancel" }),
2059
+ className: Yt("col-span-2 flex justify-end", i && "hidden"),
2060
+ children: /* @__PURE__ */ e.jsxs(me, { mt: 16, gap: 4, children: [
2061
+ /* @__PURE__ */ e.jsx(J, { colorScheme: "gray", isDisabled: c, onClick: r, children: "Cancel" }),
1945
2062
  /* @__PURE__ */ e.jsx(
1946
- $,
2063
+ J,
1947
2064
  {
1948
2065
  colorScheme: "blue",
1949
- isDisabled: r || !X || !we,
1950
- isLoading: r,
1951
- onClick: Me,
2066
+ isDisabled: c || !Y || !le,
2067
+ isLoading: c,
2068
+ onClick: pe,
1952
2069
  children: "Save changes"
1953
2070
  }
1954
2071
  )
@@ -1956,111 +2073,111 @@ const Ys = ({
1956
2073
  }
1957
2074
  )
1958
2075
  ] });
1959
- }, Z = ({ children: t }) => /* @__PURE__ */ e.jsx($e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: t }), Dt = ({
1960
- id: t,
2076
+ }, ne = ({ children: n }) => /* @__PURE__ */ e.jsx(qe, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Fs = ({
2077
+ id: n,
1961
2078
  onCancel: s,
1962
- onSave: o,
1963
- onError: u,
1964
- hideButtons: l,
1965
- quantumOwned: a,
1966
- setButtonOnClick: m,
1967
- setButtonDisabled: f
2079
+ onSave: r,
2080
+ onError: d,
2081
+ hideButtons: i,
2082
+ quantumOwned: l,
2083
+ setButtonOnClick: u,
2084
+ setButtonDisabled: g
1968
2085
  }) => {
1969
- const [{ data: j }] = ee({
1970
- query: a ? Fs : Ds
1971
- }), [{ data: C }] = ee({
1972
- query: ks,
1973
- variables: { id: t },
1974
- pause: !t
1975
- }), [{ data: I }] = ee({
1976
- query: Es
1977
- }), p = W(
1978
- Le,
1979
- I?.moduleCategories
1980
- ), [{ fetching: x }, A] = oe(Ps), [{ fetching: d }, r] = oe(ss), S = W(
1981
- ae,
1982
- a ? j?.quantumOwnedActions : j?.actions
1983
- ) ?? [], b = W(Re, C?.module), v = W(ts, b?.moduleActions) ?? [], [h, g] = F([
1984
- ...v.map((c) => c.actionId) ?? []
1985
- ]), [w, P] = F(b?.name ?? ""), [T, q] = F([]), [R, Q] = F(b?.description ?? "");
1986
- Y(() => {
1987
- b && (g(v.map((c) => c.actionId)), P(b.name), Q(b.description ?? ""), q(
1988
- b.categories.map(
1989
- (c) => W(Le, c).id
2086
+ const [{ data: a }] = oe({
2087
+ query: l ? kt : _t
2088
+ }), [{ data: M }] = oe({
2089
+ query: zt,
2090
+ variables: { id: n },
2091
+ pause: !n
2092
+ }), [{ data: T }] = oe({
2093
+ query: Pt
2094
+ }), p = B(
2095
+ ke,
2096
+ T?.moduleCategories
2097
+ ), [{ fetching: x }, A] = te(rt), [{ fetching: o }, c] = te(it), j = B(
2098
+ re,
2099
+ l ? a?.quantumOwnedActions : a?.actions
2100
+ ) ?? [], m = B(Se, M?.module), C = B(ot, m?.moduleActions) ?? [], [w, S] = E([
2101
+ ...C.map((k) => k.actionId) ?? []
2102
+ ]), [b, O] = E(m?.name ?? ""), [I, D] = E([]), [P, ee] = E(m?.description ?? "");
2103
+ V(() => {
2104
+ m && (S(C.map((k) => k.actionId)), O(m.name), ee(m.description ?? ""), D(
2105
+ m.categories.map(
2106
+ (k) => B(ke, k).id
1990
2107
  ) ?? []
1991
2108
  ));
1992
- }, [b, v]);
1993
- const U = O(() => {
1994
- let c;
1995
- const n = {
1996
- actions: h,
1997
- name: w,
1998
- categories: T.filter((i) => i !== "other"),
1999
- description: R,
2000
- quantumOwned: a
2109
+ }, [m, C]);
2110
+ const $ = N(() => {
2111
+ let k;
2112
+ const H = {
2113
+ actions: w,
2114
+ name: b,
2115
+ categories: I.filter((y) => y !== "other"),
2116
+ description: P,
2117
+ quantumOwned: l
2001
2118
  };
2002
- b ? c = A({
2003
- id: b.id,
2004
- input: n
2005
- }) : c = r({
2006
- input: n
2007
- }), c.then(({ error: i }) => {
2008
- i ? u(i) : o();
2119
+ m ? k = A({
2120
+ id: m.id,
2121
+ input: H
2122
+ }) : k = c({
2123
+ input: H
2124
+ }), k.then(({ error: y }) => {
2125
+ y ? d(y) : r();
2009
2126
  });
2010
2127
  }, [
2011
- r,
2128
+ c,
2012
2129
  A,
2013
- h,
2014
2130
  w,
2015
- R,
2016
- T,
2017
2131
  b,
2018
- o,
2019
- u
2132
+ P,
2133
+ I,
2134
+ m,
2135
+ r,
2136
+ d
2020
2137
  ]);
2021
- return Y(() => {
2022
- f && f({
2023
- cancelButton: x || d,
2024
- saveButton: x || d || !w || R.trim().split(/\s+/).filter(Boolean).length > 40
2138
+ return V(() => {
2139
+ g && g({
2140
+ cancelButton: x || o,
2141
+ saveButton: x || o || !b || P.trim().split(/\s+/).filter(Boolean).length > 40
2025
2142
  });
2026
- }, [f, x, d, h, w, R]), Y(() => {
2027
- m && m({
2143
+ }, [g, x, o, w, b, P]), V(() => {
2144
+ u && u({
2028
2145
  cancelButton: s,
2029
- saveButton: U
2146
+ saveButton: $
2030
2147
  });
2031
- }, [m, s, U]), /* @__PURE__ */ e.jsxs(B, { width: "100%", children: [
2148
+ }, [u, s, $]), /* @__PURE__ */ e.jsxs(q, { width: "100%", children: [
2032
2149
  /* @__PURE__ */ e.jsx(
2033
- ot,
2150
+ rs,
2034
2151
  {
2035
- name: w,
2036
- setName: P,
2037
- actions: S,
2038
- selectedActionIds: h,
2039
- setSelectedActionIds: g,
2152
+ name: b,
2153
+ setName: O,
2154
+ actions: j,
2155
+ selectedActionIds: w,
2156
+ setSelectedActionIds: S,
2040
2157
  availableCategories: p ?? [],
2041
- selectedCategoryIds: T,
2042
- setSelectedCategoryIds: q,
2043
- description: R,
2044
- setDescription: Q
2158
+ selectedCategoryIds: I,
2159
+ setSelectedCategoryIds: D,
2160
+ description: P,
2161
+ setDescription: ee
2045
2162
  }
2046
2163
  ),
2047
- !l && /* @__PURE__ */ e.jsx(K, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(ce, { mt: 16, gap: 4, children: [
2164
+ !i && /* @__PURE__ */ e.jsx(X, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(me, { mt: 16, gap: 4, children: [
2048
2165
  /* @__PURE__ */ e.jsx(
2049
- $,
2166
+ J,
2050
2167
  {
2051
2168
  colorScheme: "gray",
2052
- isDisabled: x || d,
2169
+ isDisabled: x || o,
2053
2170
  onClick: s,
2054
2171
  children: "Cancel"
2055
2172
  }
2056
2173
  ),
2057
2174
  /* @__PURE__ */ e.jsx(
2058
- $,
2175
+ J,
2059
2176
  {
2060
2177
  colorScheme: "blue",
2061
- isDisabled: x || d || !w || R.trim().split(/\s+/).filter(Boolean).length > 40,
2062
- isLoading: x || d,
2063
- onClick: U,
2178
+ isDisabled: x || o || !b || P.trim().split(/\s+/).filter(Boolean).length > 40,
2179
+ isLoading: x || o,
2180
+ onClick: $,
2064
2181
  children: "Save"
2065
2182
  }
2066
2183
  )
@@ -2068,12 +2185,12 @@ const Ys = ({
2068
2185
  ] });
2069
2186
  };
2070
2187
  export {
2071
- nt as ActivityList,
2072
- Rt as CopyActivityForm,
2073
- Lt as CopyModuleForm,
2074
- ot as ModuleForm,
2075
- dt as ParameterEditList,
2076
- ht as ParameterEditSelect,
2077
- Ft as UpsertActivityForm,
2078
- Dt as UpsertModuleForm
2188
+ os as ActivityList,
2189
+ Ns as CopyActivityForm,
2190
+ Rs as CopyModuleForm,
2191
+ rs as ModuleForm,
2192
+ ds as ParameterEditList,
2193
+ hs as ParameterEditSelect,
2194
+ Ls as UpsertActivityForm,
2195
+ Fs as UpsertModuleForm
2079
2196
  };