@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0-pr.chore-public-names.673.cb7ee37

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 (196) hide show
  1. package/README.md +255 -122
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +7 -3
  4. package/dist/3d.js +20 -20
  5. package/dist/CurrentPoseBar/index.cjs +1 -0
  6. package/dist/CurrentPoseBar/index.d.ts +2 -0
  7. package/dist/CurrentPoseBar/index.js +5 -0
  8. package/dist/JoggingButtons/index.cjs +1 -0
  9. package/dist/JoggingButtons/index.d.ts +3 -0
  10. package/dist/JoggingButtons/index.js +5 -0
  11. package/dist/JoggingGizmo/index.cjs +1 -0
  12. package/dist/JoggingGizmo/index.d.ts +5 -0
  13. package/dist/JoggingGizmo/index.js +6 -0
  14. package/dist/JoggingJointSlider/index.cjs +1 -0
  15. package/dist/JoggingJointSlider/index.d.ts +2 -0
  16. package/dist/JoggingJointSlider/index.js +5 -0
  17. package/dist/SafetyBar/index.cjs +1 -1
  18. package/dist/SafetyBar/index.js +1 -1
  19. package/dist/chunks/ConnectedMotionGroup-D9JJSyXB.js +1822 -0
  20. package/dist/chunks/ConnectedMotionGroup-ir7Vf690.cjs +3 -0
  21. package/dist/chunks/CurrentPoseBar-Cbz4AO36.cjs +1 -0
  22. package/dist/chunks/CurrentPoseBar-CpwvWpEY.js +619 -0
  23. package/dist/chunks/JoggingButtons-i8FdMpCx.js +108 -0
  24. package/dist/chunks/JoggingButtons-paQCBXf4.cjs +1 -0
  25. package/dist/chunks/JoggingGizmoOrientation-CKZeLcMp.js +893 -0
  26. package/dist/chunks/JoggingGizmoOrientation-EPtBeAun.cjs +1 -0
  27. package/dist/chunks/JoggingJointSlider-DQhJOmcc.js +378 -0
  28. package/dist/chunks/JoggingJointSlider-YcEBMgF1.cjs +1 -0
  29. package/dist/chunks/Pose3-Ci1bxEvz.js +1373 -0
  30. package/dist/chunks/Pose3-DwMOSTKO.cjs +1 -0
  31. package/dist/chunks/SafetyBar-Be1c6Vz9.cjs +1 -0
  32. package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-WXLP3Yi0.js} +34 -32
  33. package/dist/chunks/{externalizeComponent-EDymnaGR.js → externalizeComponent-7OVHUIUh.js} +84 -134
  34. package/dist/chunks/externalizeComponent-B0n_tR3v.cjs +2 -0
  35. package/dist/chunks/holdSafety-Cbej6-Kc.js +62 -0
  36. package/dist/chunks/holdSafety-TeMXlYQe.cjs +1 -0
  37. package/dist/chunks/joggingColors-BKRoSGQu.js +132 -0
  38. package/dist/chunks/joggingColors-BkPm75Hr.cjs +1 -0
  39. package/dist/chunks/json-3cqBD7UQ.js +18 -0
  40. package/dist/chunks/json-Bd6uGfgP.cjs +1 -0
  41. package/dist/chunks/loadRobotSession-Bt1-Brjp.js +3761 -0
  42. package/dist/chunks/loadRobotSession-DHVuK_pj.cjs +1 -0
  43. package/dist/chunks/novaConnection-BTSIgWd1.cjs +1 -0
  44. package/dist/chunks/novaConnection-J6_ohIQ0.js +14 -0
  45. package/dist/chunks/poseText-BXUaQWnK.cjs +1 -0
  46. package/dist/chunks/poseText-CtdXIeT_.js +41 -0
  47. package/dist/chunks/useSmoothedMotionState-C_Vo0py0.js +202 -0
  48. package/dist/chunks/useSmoothedMotionState-Ce9NjwBu.cjs +1 -0
  49. package/dist/components/AppHeader.d.ts +1 -1
  50. package/dist/components/VelocitySlider.d.ts +6 -1
  51. package/dist/components/currentPoseBar/CurrentPoseBar.d.ts +48 -0
  52. package/dist/components/currentPoseBar/OrientationFormatPopover.d.ts +19 -0
  53. package/dist/components/currentPoseBar/StreamStatus.d.ts +10 -0
  54. package/dist/components/currentPoseBar/orientation.d.ts +34 -0
  55. package/dist/components/currentPoseBar/poseValues.d.ts +15 -0
  56. package/dist/components/jogging/JoggingButtons.d.ts +18 -0
  57. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +8 -2
  58. package/dist/components/jogging/JoggingCartesianTab.d.ts +3 -0
  59. package/dist/components/jogging/JoggingJointTab.d.ts +4 -1
  60. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  61. package/dist/components/jogging/JoggingPanel.d.ts +6 -3
  62. package/dist/components/jogging/JoggingRefusedError.d.ts +24 -0
  63. package/dist/components/jogging/JoggingStore.d.ts +382 -40
  64. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +53 -0
  65. package/dist/components/jogging/gizmo/JoggingGizmoOrientation.d.ts +26 -0
  66. package/dist/components/jogging/gizmo/RotationHandles.d.ts +7 -0
  67. package/dist/components/jogging/gizmo/RotationScene.d.ts +6 -0
  68. package/dist/components/jogging/gizmo/TranslationHandles.d.ts +6 -0
  69. package/dist/components/jogging/gizmo/TranslationScene.d.ts +6 -0
  70. package/dist/components/jogging/gizmo/arcGrabAreas.d.ts +58 -0
  71. package/dist/components/jogging/gizmo/arcs.d.ts +54 -0
  72. package/dist/components/jogging/gizmo/arrows.d.ts +63 -0
  73. package/dist/components/jogging/gizmo/gizmoShared.d.ts +135 -0
  74. package/dist/components/jogging/gizmo/gizmoView.d.ts +42 -0
  75. package/dist/components/jogging/gizmo/useGizmoTurn.d.ts +11 -0
  76. package/dist/components/jogging/holdSafety.d.ts +82 -0
  77. package/dist/components/jogging/jogError.d.ts +9 -0
  78. package/dist/components/jogging/jogHandle.d.ts +23 -0
  79. package/dist/components/jogging/joggingColors.d.ts +30 -0
  80. package/dist/components/jogging/joggingVelocity.d.ts +21 -0
  81. package/dist/components/jogging/joint/JoggingJointSlider.d.ts +56 -0
  82. package/dist/components/jogging/joint/JointSliderTrack.d.ts +27 -0
  83. package/dist/components/jogging/joint/jointJog.d.ts +55 -0
  84. package/dist/components/jogging/joint/useJointJogHold.d.ts +43 -0
  85. package/dist/components/jogging/useHold.d.ts +42 -0
  86. package/dist/components/jogging/useJogControls.d.ts +44 -0
  87. package/dist/components/robotControl/PanelSelect.d.ts +13 -0
  88. package/dist/components/robotControl/SmallSelect.d.ts +15 -0
  89. package/dist/components/robotControl/poseText.d.ts +43 -0
  90. package/dist/components/robotControl/robotControlTypes.d.ts +36 -0
  91. package/dist/components/robotControl/useCopyText.d.ts +12 -0
  92. package/dist/components/robotControl/useEveryFrame.d.ts +6 -0
  93. package/dist/components/robots/GenericRobot.d.ts +2 -1
  94. package/dist/components/robots/LinearAxis.d.ts +1 -1
  95. package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
  96. package/dist/components/robots/Robot.d.ts +1 -1
  97. package/dist/components/robots/robotModelLogic.d.ts +11 -9
  98. package/dist/components/utils/converters.d.ts +0 -2
  99. package/dist/components/utils/hooks.d.ts +1 -6
  100. package/dist/components/utils/json.d.ts +4 -0
  101. package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
  102. package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
  103. package/dist/components/utils/webglSupport.d.ts +11 -0
  104. package/dist/core.cjs +1 -1
  105. package/dist/core.d.ts +28 -20
  106. package/dist/core.js +57 -54
  107. package/dist/index.cjs +1 -1
  108. package/dist/index.js +73 -70
  109. package/dist/lib/ConnectedMotionGroup.d.ts +9 -8
  110. package/dist/lib/ControllerStateStream.d.ts +125 -0
  111. package/dist/lib/JoggerConnection.d.ts +172 -27
  112. package/dist/lib/MotionStreamConnection.d.ts +16 -6
  113. package/dist/lib/Pose3.d.ts +22 -0
  114. package/dist/lib/PoseTransformer.d.ts +44 -0
  115. package/dist/lib/TrajectoryExecutionStore.d.ts +260 -0
  116. package/dist/lib/connectionLogger.d.ts +9 -0
  117. package/dist/lib/controllerStateSource.d.ts +38 -0
  118. package/dist/lib/incrementalCartesianMotion.d.ts +40 -0
  119. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  120. package/dist/lib/motionStateUpdate.d.ts +44 -0
  121. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  122. package/dist/lib/novaConnection.d.ts +23 -0
  123. package/dist/lib/planErrorTranslation.d.ts +8 -0
  124. package/dist/lib/poseMath.d.ts +51 -0
  125. package/dist/lib/robotSession/RobotActivation.d.ts +90 -0
  126. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  127. package/dist/lib/robotSession/RobotLiveState.d.ts +65 -0
  128. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  129. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  130. package/dist/lib/robotSession/RobotSession.d.ts +117 -0
  131. package/dist/lib/robotSession/RobotTargetPose.d.ts +116 -0
  132. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  133. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  134. package/dist/lib/robotSession/robotPose.d.ts +27 -0
  135. package/dist/lib/rotation.d.ts +12 -0
  136. package/dist/nats.cjs +1 -0
  137. package/dist/nats.d.ts +4 -0
  138. package/dist/nats.js +131 -0
  139. package/dist/session.cjs +1 -0
  140. package/dist/session.d.ts +22 -0
  141. package/dist/session.js +33 -0
  142. package/package.json +68 -66
  143. package/dist/Setup.d.ts +0 -11
  144. package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
  145. package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
  146. package/dist/chunks/SafetyBar-DPrv_OQA.cjs +0 -1
  147. package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
  148. package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
  149. package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
  150. package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
  151. package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
  152. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
  153. package/dist/components/AdornedTextField.d.ts +0 -7
  154. package/dist/components/CopyableText.d.ts +0 -6
  155. package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
  156. package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
  157. package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
  158. package/dist/components/CycleTimer/index.d.ts +0 -27
  159. package/dist/components/CycleTimer/types.d.ts +0 -49
  160. package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
  161. package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
  162. package/dist/components/CycleTimer/utils.d.ts +0 -21
  163. package/dist/components/CycleTimer.d.ts +0 -3
  164. package/dist/components/DataGrid.d.ts +0 -66
  165. package/dist/components/LogPanel.d.ts +0 -38
  166. package/dist/components/LogStore.d.ts +0 -12
  167. package/dist/components/LogViewer.d.ts +0 -46
  168. package/dist/components/ProgramControl.d.ts +0 -55
  169. package/dist/components/ProgramStateIndicator.d.ts +0 -26
  170. package/dist/components/RobotCard.d.ts +0 -98
  171. package/dist/components/RobotListItem.d.ts +0 -34
  172. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
  173. package/dist/components/SelectableFab.d.ts +0 -7
  174. package/dist/components/TabBar.d.ts +0 -45
  175. package/dist/components/ThemeSelect.d.ts +0 -6
  176. package/dist/components/Timer/Timer.d.ts +0 -3
  177. package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
  178. package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
  179. package/dist/components/Timer/index.d.ts +0 -19
  180. package/dist/components/Timer/types.d.ts +0 -35
  181. package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
  182. package/dist/components/Timer/useTimerLogic.d.ts +0 -19
  183. package/dist/components/Timer/utils.d.ts +0 -17
  184. package/dist/components/Timer.d.ts +0 -3
  185. package/dist/components/TransparentOverlay.d.ts +0 -4
  186. package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
  187. package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
  188. package/dist/components/jogging/PoseJointValues.d.ts +0 -8
  189. package/dist/components/robots/AxisConfig.d.ts +0 -2
  190. package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
  191. package/dist/icons/DropdownArrowIcon.d.ts +0 -2
  192. package/dist/icons/index.d.ts +0 -12
  193. package/dist/lib/novaCompat.d.ts +0 -16
  194. package/dist/themes/createDarkTheme.d.ts +0 -7
  195. package/dist/themes/themeTypes.d.ts +0 -40
  196. package/dist/themes/theming.d.ts +0 -24
@@ -0,0 +1,619 @@
1
+ import { jsx as a, jsxs as d, Fragment as j } from "react/jsx-runtime";
2
+ import ne from "@mui/material/Divider";
3
+ import q from "@mui/material/IconButton";
4
+ import f from "@mui/material/Stack";
5
+ import te from "@mui/material/Tooltip";
6
+ import R from "@mui/material/Typography";
7
+ import { ContentCopyFilled as se } from "@wandelbots/icons/ContentCopyFilled";
8
+ import { Settings as ce } from "@wandelbots/icons/Settings";
9
+ import { memo as re, useState as F, useEffect as oe, useRef as Z, useId as V, useCallback as _ } from "react";
10
+ import { useTranslation as M } from "react-i18next";
11
+ import { e as ue } from "./externalizeComponent-7OVHUIUh.js";
12
+ import { p as pe } from "./poseText-CtdXIeT_.js";
13
+ import ie from "@mui/material/Box";
14
+ import B from "@mui/material/MenuItem";
15
+ import { AdornedSelect as W } from "@wandelbots/mui";
16
+ import de from "@mui/material/ListSubheader";
17
+ import he from "@mui/material/Popover";
18
+ function me(e, n) {
19
+ return e.length === n.length && e.every(
20
+ (t, o) => {
21
+ var l, r;
22
+ return t.id === ((l = n[o]) == null ? void 0 : l.id) && t.label === ((r = n[o]) == null ? void 0 : r.label);
23
+ }
24
+ );
25
+ }
26
+ const ge = re(
27
+ function({
28
+ labelId: n,
29
+ width: t,
30
+ options: o,
31
+ value: l,
32
+ onChange: r
33
+ }) {
34
+ return /* @__PURE__ */ a(ie, { sx: { width: t, flexShrink: 0 }, children: /* @__PURE__ */ a(
35
+ W,
36
+ {
37
+ labelId: n,
38
+ adornedSize: "small",
39
+ sx: {
40
+ // Two classes: the small select sets its padding with two too
41
+ "& .MuiInputBase-input.MuiSelect-select": {
42
+ // 36 px with the 1 px border of the select
43
+ paddingY: "5px",
44
+ fontSize: "14px",
45
+ lineHeight: "24px",
46
+ letterSpacing: "0.15px",
47
+ minHeight: "24px"
48
+ }
49
+ },
50
+ value: l,
51
+ renderValue: (i) => {
52
+ var c;
53
+ return ((c = o.find((s) => s.id === i)) == null ? void 0 : c.label) ?? String(i);
54
+ },
55
+ onChange: (i) => r(String(i.target.value)),
56
+ children: o.map((i) => /* @__PURE__ */ a(B, { value: i.id, children: i.label }, i.id))
57
+ }
58
+ ) });
59
+ },
60
+ (e, n) => e.labelId === n.labelId && e.width === n.width && e.value === n.value && e.onChange === n.onChange && me(e.options, n.options)
61
+ );
62
+ function G() {
63
+ try {
64
+ return document.execCommand("copy");
65
+ } catch {
66
+ return !1;
67
+ }
68
+ }
69
+ function xe() {
70
+ const [e, n] = F(!1);
71
+ oe(() => {
72
+ if (!e) return;
73
+ const o = setTimeout(() => n(!1), 3e3);
74
+ return () => clearTimeout(o);
75
+ }, [e]);
76
+ async function t(o, l) {
77
+ try {
78
+ if (navigator.clipboard) {
79
+ await navigator.clipboard.writeText(o), n(!0);
80
+ return;
81
+ }
82
+ } catch {
83
+ }
84
+ if (l) {
85
+ l(), G() && n(!0);
86
+ return;
87
+ }
88
+ const r = document.createElement("textarea");
89
+ r.value = o, r.readOnly = !0, r.style.position = "fixed", r.style.opacity = "0", document.body.appendChild(r), r.select(), G() && n(!0), r.remove();
90
+ }
91
+ return { copied: e, copy: t };
92
+ }
93
+ function fe(e, n) {
94
+ const t = Z(e);
95
+ t.current = e;
96
+ const [o, l] = F(e);
97
+ return oe(() => {
98
+ let r = 0;
99
+ const i = () => {
100
+ l(t.current()), r = requestAnimationFrame(i);
101
+ };
102
+ return i(), () => cancelAnimationFrame(r);
103
+ }, [n]), o;
104
+ }
105
+ function Ce(e, n) {
106
+ var t;
107
+ return ((t = e.find((o) => o.id === n)) == null ? void 0 : t.label) ?? String(n);
108
+ }
109
+ function be(e) {
110
+ return e.map((n) => /* @__PURE__ */ a(B, { value: n.id, children: n.label }, n.id));
111
+ }
112
+ function Q({
113
+ label: e,
114
+ options: n,
115
+ value: t,
116
+ onChange: o,
117
+ disabled: l
118
+ }) {
119
+ const r = V();
120
+ return /* @__PURE__ */ a(
121
+ W,
122
+ {
123
+ label: e,
124
+ labelId: r,
125
+ value: t,
126
+ disabled: l,
127
+ renderValue: (i) => Ce(n, i),
128
+ onChange: (i) => o(String(i.target.value)),
129
+ children: be(n)
130
+ }
131
+ );
132
+ }
133
+ const H = [
134
+ // Tait–Bryan angles: three different axes
135
+ "XYZ",
136
+ "XZY",
137
+ "YXZ",
138
+ "YZX",
139
+ "ZXY",
140
+ "ZYX",
141
+ // Proper Euler angles: the first axis again at the end
142
+ "XYX",
143
+ "XZX",
144
+ "YXY",
145
+ "YZY",
146
+ "ZXZ",
147
+ "ZYZ"
148
+ ], ve = [
149
+ ...H.map((e) => `EULER_ANGLES_INTRINSIC_${e}`),
150
+ ...H.map((e) => `EULER_ANGLES_EXTRINSIC_${e}`)
151
+ ];
152
+ function P(e) {
153
+ const n = e.slice(e.lastIndexOf("_") + 1);
154
+ return {
155
+ intrinsic: e.includes("_INTRINSIC_"),
156
+ axes: [...n]
157
+ };
158
+ }
159
+ function J([e, n, t]) {
160
+ const o = Math.hypot(e, n, t);
161
+ if (o < 1e-12) return [0, 0, 0, 1];
162
+ const l = Math.sin(o / 2) / o;
163
+ return [e * l, n * l, t * l, Math.cos(o / 2)];
164
+ }
165
+ const Y = { X: 0, Y: 1, Z: 2 };
166
+ function Se(e) {
167
+ return e > Math.PI ? e - 2 * Math.PI : e < -Math.PI ? e + 2 * Math.PI : e;
168
+ }
169
+ function Ie(e, n) {
170
+ const { intrinsic: t, axes: o } = P(n), l = t ? [...o].reverse() : o, r = Y[l[0]], i = Y[l[1]], c = l[0] === l[2], s = c ? 3 - r - i : Y[l[2]], h = (r - i) * (i - s) * (s - r) / 2, U = Math.hypot(...e) || 1, [X, w, v, C] = e.map((le) => le / U), S = [X, w, v], I = S[r] ?? 0, y = S[i] ?? 0, b = (S[s] ?? 0) * h, [A, g, O, T] = c ? [C, I, y, b] : [C - y, I + b, y + C, b - I];
171
+ let x = 2 * Math.atan2(Math.hypot(O, T), Math.hypot(A, g));
172
+ const E = Math.atan2(g, A), N = Math.atan2(T, O);
173
+ let u, p;
174
+ const m = 1e-7;
175
+ return Math.abs(x) <= m ? (u = 2 * E, p = 0) : Math.abs(x - Math.PI) <= m ? (u = -2 * N, p = 0) : (u = E - N, p = E + N), c || (p *= h, x -= Math.PI / 2), (t ? [p, x, u] : [u, x, p]).map(Se);
176
+ }
177
+ function D({ children: e }) {
178
+ return /* @__PURE__ */ a(de, { children: e });
179
+ }
180
+ D.muiSkipListHighlight = !0;
181
+ function ye({
182
+ value: e,
183
+ onChange: n
184
+ }) {
185
+ const { t } = M(), o = V(), l = (i) => {
186
+ const { intrinsic: c, axes: s } = P(i);
187
+ return t(
188
+ c ? "CurrentPose.EulerConvention.Intrinsic.lb" : "CurrentPose.EulerConvention.Extrinsic.lb",
189
+ { axes: s.join("") }
190
+ );
191
+ }, r = (i) => ve.filter(
192
+ (c) => P(c).intrinsic === i
193
+ ).map((c) => /* @__PURE__ */ a(B, { value: c, children: P(c).axes.join("") }, c));
194
+ return /* @__PURE__ */ d(
195
+ W,
196
+ {
197
+ label: t("CurrentPose.EulerConvention.lb"),
198
+ labelId: o,
199
+ value: e,
200
+ renderValue: (i) => l(i),
201
+ onChange: (i) => n(i.target.value),
202
+ children: [
203
+ /* @__PURE__ */ a(D, { children: t("CurrentPose.EulerConvention.Intrinsic.hlb") }),
204
+ r(!0),
205
+ /* @__PURE__ */ a(D, { children: t("CurrentPose.EulerConvention.Extrinsic.hlb") }),
206
+ r(!1)
207
+ ]
208
+ }
209
+ );
210
+ }
211
+ const Ee = re(
212
+ Ne,
213
+ (e, n) => e.anchor === n.anchor && e.open === n.open && e.onClose === n.onClose && e.onChange === n.onChange && e.format.type === n.format.type && e.format.angleUnit === n.format.angleUnit && e.format.eulerConvention === n.format.eulerConvention
214
+ );
215
+ function Ne({
216
+ anchor: e,
217
+ open: n,
218
+ onClose: t,
219
+ format: o,
220
+ onChange: l
221
+ }) {
222
+ const { t: r } = M(), i = r("CurrentPose.OrientationFormat.ti"), c = (s) => l({ ...o, ...s });
223
+ return /* @__PURE__ */ d(
224
+ he,
225
+ {
226
+ open: n,
227
+ anchorEl: e,
228
+ onClose: t,
229
+ anchorOrigin: { vertical: "top", horizontal: "left" },
230
+ transformOrigin: { vertical: "bottom", horizontal: "left" },
231
+ slotProps: {
232
+ paper: {
233
+ role: "dialog",
234
+ "aria-label": i,
235
+ sx: (s) => {
236
+ var h;
237
+ return {
238
+ width: "264px",
239
+ padding: "16px",
240
+ display: "flex",
241
+ flexDirection: "column",
242
+ gap: "16px",
243
+ borderRadius: "10px",
244
+ border: `1px solid ${s.palette.divider}`,
245
+ background: (h = s.palette.backgroundPaperElevation) == null ? void 0 : h[2],
246
+ backgroundImage: "none",
247
+ boxShadow: s.shadows[16]
248
+ };
249
+ }
250
+ }
251
+ },
252
+ children: [
253
+ /* @__PURE__ */ a(R, { variant: "subtitle2", color: "text.primary", children: i }),
254
+ /* @__PURE__ */ a(ne, {}),
255
+ /* @__PURE__ */ d(f, { sx: { gap: "8px" }, children: [
256
+ /* @__PURE__ */ a(
257
+ Q,
258
+ {
259
+ label: r("CurrentPose.Format.lb"),
260
+ options: [
261
+ {
262
+ id: "rotationVector",
263
+ label: r("CurrentPose.Format.RotationVector.lb")
264
+ },
265
+ {
266
+ id: "eulerAngles",
267
+ label: r("CurrentPose.Format.EulerAngles.lb")
268
+ },
269
+ { id: "quaternion", label: r("CurrentPose.Format.Quaternion.lb") }
270
+ ],
271
+ value: o.type,
272
+ onChange: (s) => c({ type: s }),
273
+ disabled: !1
274
+ }
275
+ ),
276
+ o.type !== "quaternion" && /* @__PURE__ */ a(
277
+ Q,
278
+ {
279
+ label: r("CurrentPose.AngleUnit.lb"),
280
+ options: [
281
+ { id: "rad", label: r("CurrentPose.AngleUnit.Radians.lb") },
282
+ { id: "deg", label: r("CurrentPose.AngleUnit.Degrees.lb") }
283
+ ],
284
+ value: o.angleUnit,
285
+ onChange: (s) => c({ angleUnit: s }),
286
+ disabled: !1
287
+ }
288
+ ),
289
+ o.type === "eulerAngles" && /* @__PURE__ */ a(
290
+ ye,
291
+ {
292
+ value: o.eulerConvention,
293
+ onChange: (s) => c({ eulerConvention: s })
294
+ }
295
+ )
296
+ ] })
297
+ ]
298
+ }
299
+ );
300
+ }
301
+ const Pe = {
302
+ type: "rotationVector",
303
+ angleUnit: "rad",
304
+ eulerConvention: "EULER_ANGLES_EXTRINSIC_XYZ"
305
+ };
306
+ function L(e, n) {
307
+ const t = e.toFixed(n);
308
+ return Number(t) === 0 ? 0 .toFixed(n) : t;
309
+ }
310
+ function K(e, n) {
311
+ return n === "deg" ? `${L(e * 180 / Math.PI, 1)}°` : `${L(e, 3)} rad`;
312
+ }
313
+ function Re(e) {
314
+ switch (e.type) {
315
+ case "quaternion":
316
+ return ["Qx", "Qy", "Qz", "Qw"];
317
+ case "eulerAngles":
318
+ return P(e.eulerConvention).axes.map(
319
+ (n) => `R${n.toLowerCase()}`
320
+ );
321
+ default:
322
+ return ["Rx", "Ry", "Rz"];
323
+ }
324
+ }
325
+ function we(e, n) {
326
+ switch (n.type) {
327
+ case "quaternion":
328
+ return J(e).map((t) => L(t, 3));
329
+ case "eulerAngles":
330
+ return Ie(
331
+ J(e),
332
+ n.eulerConvention
333
+ ).map((t) => K(t, n.angleUnit));
334
+ default:
335
+ return e.map((t) => K(t, n.angleUnit));
336
+ }
337
+ }
338
+ function Ae(e, n) {
339
+ const t = ["x", "y", "z"].map((r, i) => ({
340
+ label: r.toUpperCase(),
341
+ value: e ? L(e.position[i] ?? 0, 1) : "–",
342
+ kind: r
343
+ })), o = e ? we(e.orientation, n) : null, l = Re(n).map((r, i) => ({
344
+ label: r,
345
+ value: (o == null ? void 0 : o[i]) ?? "–",
346
+ kind: "orientation"
347
+ }));
348
+ return [...t, ...l];
349
+ }
350
+ const Oe = {
351
+ KIND_UNKNOWN: "success.main",
352
+ RUNNING: "info.main",
353
+ PAUSED_NEAR_COLLISION: "warning.main",
354
+ PAUSED_NEAR_JOINT_LIMIT: "warning.main",
355
+ PAUSED_NEAR_SINGULARITY: "warning.main"
356
+ };
357
+ function Te({
358
+ state: e,
359
+ error: n
360
+ }) {
361
+ const { t } = M(), o = e ?? "KIND_UNKNOWN", l = n || t(`Jogging.StreamStateSection.${o}.lb`), r = n ? "error.main" : Oe[o] ?? "text.secondary";
362
+ return (
363
+ // A long error is cut off: the whole of it on hover
364
+ /* @__PURE__ */ a(te, { title: n ? l : "", placement: "top-end", children: /* @__PURE__ */ d(
365
+ f,
366
+ {
367
+ direction: "row",
368
+ "data-testid": n ? "JOG_ERROR" : o,
369
+ sx: { gap: "5px", alignItems: "center", minWidth: 0 },
370
+ children: [
371
+ /* @__PURE__ */ a(
372
+ ie,
373
+ {
374
+ sx: {
375
+ width: "6px",
376
+ height: "6px",
377
+ borderRadius: "50%",
378
+ flexShrink: 0,
379
+ bgcolor: r
380
+ }
381
+ }
382
+ ),
383
+ /* @__PURE__ */ a(
384
+ R,
385
+ {
386
+ variant: "caption",
387
+ noWrap: !0,
388
+ sx: { color: r, letterSpacing: "0.17px" },
389
+ children: l
390
+ }
391
+ )
392
+ ]
393
+ }
394
+ ) })
395
+ );
396
+ }
397
+ const z = { letterSpacing: "0.17px" }, _e = {
398
+ x: "error.main",
399
+ y: "success.main",
400
+ z: "info.main",
401
+ orientation: "grey.600"
402
+ };
403
+ function ae({ children: e, id: n }) {
404
+ return /* @__PURE__ */ a(
405
+ R,
406
+ {
407
+ id: n,
408
+ variant: "caption",
409
+ color: "text.secondary",
410
+ noWrap: !0,
411
+ sx: z,
412
+ children: e
413
+ }
414
+ );
415
+ }
416
+ function ee({
417
+ label: e,
418
+ ...n
419
+ }) {
420
+ const t = V();
421
+ return /* @__PURE__ */ d(f, { direction: "row", sx: { gap: "8px", alignItems: "center" }, children: [
422
+ /* @__PURE__ */ a(ae, { id: t, children: e }),
423
+ /* @__PURE__ */ a(ge, { labelId: t, width: "172px", ...n })
424
+ ] });
425
+ }
426
+ const k = () => /* @__PURE__ */ a(ne, { orientation: "vertical", flexItem: !1, sx: { height: "16px" } }), Qe = ue(
427
+ ({
428
+ getCurrentPose: e,
429
+ tcp: n,
430
+ frame: t,
431
+ state: o,
432
+ error: l,
433
+ orientationFormat: r,
434
+ onOrientationFormatChange: i,
435
+ sx: c
436
+ }) => {
437
+ const { t: s } = M(), h = Z(null), [U, X] = F(Pe), w = r ?? U, [v, C] = F(null), { copied: S, copy: I } = xe(), y = fe(() => JSON.stringify(e()), !0), b = JSON.parse(y), A = Ae(b, w), g = Z({ tcp: n, frame: t, onOrientationFormatChange: i });
438
+ g.current = { tcp: n, frame: t, onOrientationFormatChange: i };
439
+ const O = _(
440
+ (u) => {
441
+ var p;
442
+ return (p = g.current.tcp) == null ? void 0 : p.onChange(u);
443
+ },
444
+ []
445
+ ), T = _(
446
+ (u) => {
447
+ var p;
448
+ return (p = g.current.frame) == null ? void 0 : p.onChange(u);
449
+ },
450
+ []
451
+ ), x = _((u) => {
452
+ var p, m;
453
+ X(u), (m = (p = g.current).onOrientationFormatChange) == null || m.call(p, u);
454
+ }, []), E = _(() => C(null), []);
455
+ function N() {
456
+ const u = e();
457
+ u && I(pe(u));
458
+ }
459
+ return /* @__PURE__ */ d(
460
+ f,
461
+ {
462
+ ref: h,
463
+ direction: "row",
464
+ "data-testid": "current-pose-bar",
465
+ sx: [
466
+ (u) => {
467
+ var p;
468
+ return {
469
+ alignItems: "center",
470
+ justifyContent: "space-between",
471
+ gap: "12px",
472
+ padding: "8px 16px",
473
+ minHeight: "54px",
474
+ boxSizing: "border-box",
475
+ borderRadius: "10px",
476
+ border: `1px solid ${u.palette.divider}`,
477
+ background: (p = u.palette.backgroundPaperElevation) == null ? void 0 : p[2],
478
+ boxShadow: u.shadows[16]
479
+ };
480
+ },
481
+ ...Array.isArray(c) ? c : [c]
482
+ ],
483
+ children: [
484
+ /* @__PURE__ */ d(
485
+ f,
486
+ {
487
+ direction: "row",
488
+ sx: { gap: "12px", alignItems: "center", minWidth: 0 },
489
+ children: [
490
+ /* @__PURE__ */ a(ae, { children: s("CurrentPose.Title.lb") }),
491
+ /* @__PURE__ */ a(
492
+ q,
493
+ {
494
+ "aria-label": s("CurrentPose.OrientationFormat.ti"),
495
+ "aria-haspopup": "dialog",
496
+ "aria-expanded": v !== null,
497
+ onClick: () => C(h.current),
498
+ sx: { padding: "3px", margin: "-3px", color: "text.secondary" },
499
+ children: /* @__PURE__ */ a(ce, {})
500
+ }
501
+ ),
502
+ n && /* @__PURE__ */ d(j, { children: [
503
+ /* @__PURE__ */ a(k, {}),
504
+ /* @__PURE__ */ a(
505
+ ee,
506
+ {
507
+ label: s("RobotControl.Tcp.lb"),
508
+ options: n.options,
509
+ value: n.value,
510
+ onChange: O
511
+ }
512
+ )
513
+ ] }),
514
+ t && /* @__PURE__ */ d(j, { children: [
515
+ /* @__PURE__ */ a(k, {}),
516
+ /* @__PURE__ */ a(
517
+ ee,
518
+ {
519
+ label: s("CurrentPose.RelativeTo.lb"),
520
+ options: t.options,
521
+ value: t.value,
522
+ onChange: T
523
+ }
524
+ )
525
+ ] }),
526
+ /* @__PURE__ */ a(k, {}),
527
+ /* @__PURE__ */ a(
528
+ f,
529
+ {
530
+ direction: "row",
531
+ "data-testid": "current-pose-values",
532
+ sx: {
533
+ gap: "12px",
534
+ alignItems: "center",
535
+ minWidth: 0,
536
+ overflow: "hidden"
537
+ },
538
+ children: A.map(({ label: u, value: p, kind: m }, $) => /* @__PURE__ */ d(
539
+ f,
540
+ {
541
+ direction: "row",
542
+ sx: { gap: m === "orientation" ? "1px" : "2px" },
543
+ children: [
544
+ /* @__PURE__ */ a(
545
+ R,
546
+ {
547
+ variant: "caption",
548
+ sx: { ...z, color: _e[m] },
549
+ children: u
550
+ }
551
+ ),
552
+ /* @__PURE__ */ a(
553
+ R,
554
+ {
555
+ variant: "caption",
556
+ noWrap: !0,
557
+ sx: {
558
+ ...z,
559
+ color: "text.secondary",
560
+ // Digits of one width: the values don't jump while jogging
561
+ fontVariantNumeric: "tabular-nums"
562
+ },
563
+ children: p
564
+ }
565
+ )
566
+ ]
567
+ },
568
+ $
569
+ ))
570
+ }
571
+ ),
572
+ /* @__PURE__ */ a(
573
+ te,
574
+ {
575
+ title: s("CurrentPose.Copied.lb"),
576
+ open: S,
577
+ disableHoverListener: !0,
578
+ placement: "top",
579
+ children: /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(
580
+ q,
581
+ {
582
+ "aria-label": s("CurrentPose.Copy.bt"),
583
+ onClick: N,
584
+ disabled: !b,
585
+ sx: {
586
+ width: "30px",
587
+ height: "30px",
588
+ padding: "5px",
589
+ borderRadius: "10px",
590
+ color: "text.secondary",
591
+ "& svg": { width: "20px", height: "20px" }
592
+ },
593
+ children: /* @__PURE__ */ a(se, {})
594
+ }
595
+ ) })
596
+ }
597
+ )
598
+ ]
599
+ }
600
+ ),
601
+ /* @__PURE__ */ a(Te, { state: o, error: l }),
602
+ /* @__PURE__ */ a(
603
+ Ee,
604
+ {
605
+ anchor: v,
606
+ open: v !== null,
607
+ onClose: E,
608
+ format: w,
609
+ onChange: x
610
+ }
611
+ )
612
+ ]
613
+ }
614
+ );
615
+ }
616
+ );
617
+ export {
618
+ Qe as C
619
+ };