@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.9fadf2c → 6.4.0-pr.revamp.667.d7cab79

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 (64) hide show
  1. package/README.md +56 -5
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +1 -0
  4. package/dist/3d.js +16 -15
  5. package/dist/CurrentPoseBar/index.cjs +1 -1
  6. package/dist/CurrentPoseBar/index.js +1 -1
  7. package/dist/RobotControlPanel/index.cjs +1 -1
  8. package/dist/RobotControlPanel/index.js +1 -1
  9. package/dist/RobotHeader/index.cjs +1 -1
  10. package/dist/RobotHeader/index.js +1 -1
  11. package/dist/SafetyBar/index.cjs +1 -1
  12. package/dist/SafetyBar/index.js +1 -1
  13. package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-DENCilvf.js} +1 -1
  14. package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-DrXTcV-I.cjs} +1 -1
  15. package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-DTE8-v2j.cjs} +1 -1
  16. package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-E-hUzMIL.js} +1 -1
  17. package/dist/chunks/{RobotHeader-BZci9ahT.js → RobotHeader-BvIzk8Fw.js} +1 -1
  18. package/dist/chunks/{RobotHeader-CqK0700U.cjs → RobotHeader-Daft80jq.cjs} +1 -1
  19. package/dist/chunks/{SafetyBar-Bbg-o8h9.cjs → SafetyBar-BVk-SH_0.cjs} +1 -1
  20. package/dist/chunks/{SafetyBar-Cuak4ffd.js → SafetyBar-eYzCHOFD.js} +1 -1
  21. package/dist/chunks/converters-BsXgcxCW.cjs +1 -0
  22. package/dist/chunks/{converters-DpNB_WNQ.js → converters-D9KpJ2HD.js} +16 -8
  23. package/dist/chunks/loadRobotSession-DlRzFjYE.cjs +3 -0
  24. package/dist/chunks/loadRobotSession-kKQ96rWu.js +4721 -0
  25. package/dist/chunks/robotModelSource-Bv1Z_miZ.cjs +1 -0
  26. package/dist/chunks/robotModelSource-CKuBOeQ-.js +1295 -0
  27. package/dist/chunks/useEveryFrame-B8t_yz-G.js +155 -0
  28. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
  29. package/dist/components/jogging/JoggingStore.d.ts +29 -3
  30. package/dist/components/robotControl/poseText.d.ts +21 -5
  31. package/dist/components/robots/LinearAxis.d.ts +12 -11
  32. package/dist/components/robots/Robot.d.ts +26 -9
  33. package/dist/components/robots/robotModelSource.d.ts +38 -0
  34. package/dist/core.cjs +1 -1
  35. package/dist/core.d.ts +13 -1
  36. package/dist/core.js +64 -42
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +83 -60
  39. package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
  40. package/dist/lib/ControllerStateStream.d.ts +125 -0
  41. package/dist/lib/controllerStateSource.d.ts +37 -0
  42. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  43. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  44. package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
  45. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  46. package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
  47. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  48. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  49. package/dist/lib/robotSession/RobotSession.d.ts +78 -0
  50. package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
  51. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  52. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  53. package/dist/lib/robotSession/robotPose.d.ts +28 -0
  54. package/dist/nats.cjs +1 -0
  55. package/dist/nats.d.ts +4 -0
  56. package/dist/nats.js +131 -0
  57. package/package.json +11 -1
  58. package/dist/chunks/Robot-BeTWgowU.cjs +0 -1
  59. package/dist/chunks/Robot-D4XbngYI.js +0 -1272
  60. package/dist/chunks/TrajectoryExecutionStore-BlmjJeEw.cjs +0 -3
  61. package/dist/chunks/TrajectoryExecutionStore-DG2Ztg9g.js +0 -3371
  62. package/dist/chunks/converters-C8I_A_tA.cjs +0 -1
  63. package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
  64. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
package/README.md CHANGED
@@ -68,6 +68,7 @@ Browse the full icon set at https://wandelbotsgmbh.github.io/nova-design-system/
68
68
  - **`.`** (Main) — All components. Requires the peer dependencies of `/core` and `/3d`.
69
69
  - **`/core`** — The parts without 3D (jogging, `SafetyBar`, `AppHeader`, `LoadingCover`, `NoMotionGroupModal`), the NOVA connections and `JoggingStore`, the motion state helpers and `i18n`.
70
70
  - **`/3d`** — The 3D parts (`Robot`, `MotionGroupVisualizer`, `SafetyZonesRenderer`, …). Requires in addition three, three-stdlib, @react-three/fiber and @react-three/drei.
71
+ - **`/nats`** — A robot's live controller state over NOVA's NATS server (`natsControllerStateSource`, `natsUrlOf`), a source for `ControllerStateStream` of `/core` instead of its websocket (`controllerStateWebsocket`). Requires in addition nats.ws; no other entry point loads it.
71
72
  - **`/SafetyBar`** — Only `SafetyBar` (also as the default export).
72
73
  - **`/JoggingGizmo`** — Only `JoggingGizmo` (also as the default export) and `JoggingGizmoOrientation`. Requires in addition three and @react-three/fiber.
73
74
  - **`/JoggingButtons`** — Only `JoggingButtons` (also as the default export). No 3D packages needed.
@@ -94,6 +95,7 @@ import JoggingJointSlider from "@wandelbots/wandelbots-js-react-components/Joggi
94
95
  | `three-stdlib` (only `/3d`) | >=2 |
95
96
  | `@react-three/fiber` (only `/3d`, `/JoggingGizmo`, `/RobotControlPanel`) | ^9 |
96
97
  | `@react-three/drei` (only `/3d`) | ^10 |
98
+ | `nats.ws` (only `/nats`) | ^1.30.3 |
97
99
 
98
100
  These packages are peer dependencies because the app and the library must use the same copy: React, the MUI theme of the app, the MobX stores that the app reads with its own `observer`, and the `<Canvas>` of React Three Fiber.
99
101
 
@@ -130,6 +132,53 @@ These packages are peer dependencies because the app and the library must use th
130
132
  - **Look:** `AppHeader` and `LoadingCover` use the styles of the design system, so they look a little different.
131
133
  - **Release asset:** `no-draco-models.zip` is gone. The models come from the NOVA API (since 4.0.0).
132
134
 
135
+ ### From ConnectedMotionGroup to RobotSession
136
+
137
+ `ConnectedMotionGroup` is deprecated. `RobotSession` replaces it: one robot of a cell, loaded and connected, with its description, live state, safety, activation, jogging and Move to. `ConnectedMotionGroup` keeps working until a later major version removes it, and `Robot` and `LinearAxis` still take it.
138
+
139
+ ```tsx
140
+ // Before
141
+ const motionGroup = await ConnectedMotionGroup.connect(nova, "0@ur5e", { cellId })
142
+ <Robot connectedMotionGroup={motionGroup} />
143
+ motionGroup.dispose()
144
+
145
+ // After
146
+ const load = loadRobotSession(nova, "0@ur5e", { cellId })
147
+ const session = await load.ready
148
+ <Robot motionGroup={robotModelOf(session)} />
149
+ load.dispose()
150
+ ```
151
+
152
+ What changes besides the names:
153
+
154
+ - **Loading:** `loadRobotSession` returns at once. `load.state` ("loading", "ready", "failed") and `load.progress` tell how far it is, `load.retry()` loads again after a failure, `await load.ready` gives the session. A failed step is retried on its own, after 1 and 2 seconds unless `retryDelaysMs` says otherwise.
155
+ - **Jogging comes with it:** `session.jogging` is the robot's `JoggingStore`. An app no longer opens it with `JoggerConnection.open` and `JoggingStore.loadFor`.
156
+ - **Nothing happens unasked:** without `storage` the jogging settings are not kept (pass `localStorage` to keep them), and a virtual robot is activated only with `autoActivateVirtual: true`.
157
+ - **Errors:** what the app calls rejects (`session.activation.activate()` with a `RobotModeChangeError`); what fails in the background (a jog, a message of the live state) goes to `onError`.
158
+ - **Several robots:** load one session per robot instead of `ConnectedMotionGroup.connectMultiple`.
159
+
160
+ | `ConnectedMotionGroup` | `RobotSession` |
161
+ | --- | --- |
162
+ | `motionGroupId`, `controllerId` | `motionGroupId`, `controllerId` (and `cellId`) |
163
+ | `modelFromController` | `description.motionGroupModel` |
164
+ | `dhParameters` | `description.dhParameters` |
165
+ | `safetyZones` | `description.safetyZones` |
166
+ | `description` | `description.motionGroupDescription` |
167
+ | `isVirtual` | `description.isVirtual` |
168
+ | `tcps` | `description.tcps` (id and name), `description.tcpOffsetsById` (position and orientation) |
169
+ | `joints` | One per joint: `description.dhParameters`, or the joint limits in `description.jointLimits` |
170
+ | `mountingPosition`, `mountingQuaternion` | `robotModelOf(session)` of `/3d` (metres and a quaternion), or `description.mounting` (mm and a rotation vector) |
171
+ | `rapidlyChangingMotionState` | `state.rapidlyChangingMotionState` |
172
+ | `controllerState` | `state.controllerState` |
173
+ | `initialMotionState`, `controller`, `motionGroup`, `motionStateSocket` | No replacement: the session keeps its connections. Read `state` instead. |
174
+ | `activationState` | `activation.state` |
175
+ | `activate()`, `deactivate()`, `toggleActivation()` | `activation.activate()`, `activation.deactivate()`, `activation.toggle()` |
176
+ | `isEstopActive`, `isMoveableSafetyState`, `isMoveableOperationMode`, `canBeMoved` | `safety.isEstopActive`, `safety.isMoveableSafetyState`, `safety.isMoveableOperationMode`, `safety.canBeMoved`; why the robot may not move: `safety.notMoveableReason` |
177
+ | `joggingVelocity`, `joggingVelocityRads`, `setJoggingVelocity()` | The velocities of `jogging`: `rotationVelocityDegPerSec`, `rotationVelocityRadsPerSec`, `translationVelocityMmPerSec`, `setVelocityFromSlider()` |
178
+ | `connectedJoggingSocket`, `planData` | No replacement (unused) |
179
+ | `dispose()` | `load.dispose()`, or `session.dispose()` |
180
+ | `<Robot connectedMotionGroup={…}>`, `<LinearAxis connectedMotionGroup={…}>` | `<Robot motionGroup={robotModelOf(session)}>`, the same for `LinearAxis`. `motionGroup` also takes a `ConnectedMotionGroup`, or the app's own data (see `RobotModelSource`). |
181
+
133
182
  ### 4.x Core Changes
134
183
 
135
184
  Robot data is now fetched from a running nova instance. This eliminates the need of shipping every react application with the robot data attached.
@@ -313,12 +362,13 @@ const orientation = useRef<Quaternion | null>(null)
313
362
 
314
363
  **Robot** - Real-time 3D robot rendering
315
364
 
316
- - Live pose updates from a `ConnectedMotionGroup`
365
+ - Takes the robot as plain data (`RobotModelSource`): `robotModelOf(session)` of a `RobotSession`, a `ConnectedMotionGroup`, or the app's own data
366
+ - Live pose updates from its motion state, at its mounting
317
367
  - The model of the motion group from the NOVA instance (`defaultGetModel`)
318
368
 
319
369
  **LinearAxis** - The same for a linear axis
320
370
 
321
- **SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same without a `ConnectedMotionGroup`: they take a motion state, the model name and the DH parameters. `MotionGroupVisualizer` picks the robot or the linear axis. The `…Exact` variants show the pose without smoothing.
371
+ **SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same with single props: they take a motion state, the model name and the DH parameters. `MotionGroupVisualizer` picks the robot or the linear axis. The `…Exact` variants show the pose without smoothing.
322
372
 
323
373
  **SafetyZonesRenderer** - 3D safety visualization
324
374
 
@@ -353,7 +403,8 @@ Safety components for production environments.
353
403
 
354
404
  ### Logic
355
405
 
356
- - **ConnectedMotionGroup** - A motion group with its live motion state, safety state and operation mode
406
+ - **loadRobotSession** and **RobotSession** - A robot of a cell, loaded and connected: its description, live state, safety, activation, jogging and Move to
407
+ - **ConnectedMotionGroup** (deprecated, see [From ConnectedMotionGroup to RobotSession](#from-connectedmotiongroup-to-robotsession)) - A motion group with its live motion state, safety state and operation mode
357
408
  - **MotionStreamConnection** and **JoggerConnection** - The motion state stream and the jogging connection of a motion group
358
409
  - **jointValuesEqual**, **poseEqual**, **tcpMotionEqual**, **unwrapRotationVector** - Helpers for the motion state
359
410
  - **ValueInterpolator**, **useInterpolation**, **useSmoothedMotionState** - Smooth joint values for the 3D view
@@ -365,9 +416,9 @@ Safety components for production environments.
365
416
 
366
417
  Components integrate with the Wandelbots Nova ecosystem:
367
418
 
368
- - **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
419
+ - **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `loadRobotSession`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
369
420
  - **Real-time Updates** - WebSocket connections for live robot state updates
370
- - **Motion Group Management** - Direct integration with `ConnectedMotionGroup` objects
421
+ - **Motion Group Management** - One `RobotSession` per robot (`ConnectedMotionGroup` in earlier versions)
371
422
  - **State Synchronization** - Automatic state management with MobX reactivity
372
423
 
373
424
  ### Technical Foundation
package/dist/3d.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/Robot-BeTWgowU.cjs"),t=require("./chunks/JoggingGizmo-DGbFLWgT.cjs"),i=require("./chunks/JoggingGizmoOrientation-dzned4f4.cjs"),r=require("./chunks/RobotControlPanel-BXtBHEe9.cjs"),e=require("./chunks/Pose3-DIyg-aZA.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.JoggingGizmo=t.JoggingGizmo;exports.JoggingGizmoOrientation=i.JoggingGizmoOrientation;exports.RobotControlPanel=r.RobotControlPanel;exports.Pose3=e.Pose3;exports.ValueInterpolator=e.ValueInterpolator;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;exports.useSmoothedMotionState=e.useSmoothedMotionState;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-Bv1Z_miZ.cjs"),t=require("./chunks/JoggingGizmo-DGbFLWgT.cjs"),r=require("./chunks/JoggingGizmoOrientation-dzned4f4.cjs"),i=require("./chunks/RobotControlPanel-DTE8-v2j.cjs"),e=require("./chunks/Pose3-DIyg-aZA.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.robotModelOf=o.robotModelOf;exports.JoggingGizmo=t.JoggingGizmo;exports.JoggingGizmoOrientation=r.JoggingGizmoOrientation;exports.RobotControlPanel=i.RobotControlPanel;exports.Pose3=e.Pose3;exports.ValueInterpolator=e.ValueInterpolator;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;exports.useSmoothedMotionState=e.useSmoothedMotionState;
package/dist/3d.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./components/robots/LinearAxis";
12
12
  export * from "./components/robots/MotionGroupVisualizer";
13
13
  export * from "./components/robots/Robot";
14
14
  export { defaultGetModel } from "./components/robots/robotModelLogic";
15
+ export { type RobotModelSource, robotModelOf, } from "./components/robots/robotModelSource";
15
16
  export * from "./components/robots/SupportedLinearAxis";
16
17
  export * from "./components/robots/SupportedRobot";
17
18
  export { ValueInterpolator, type InterpolationOptions, } from "./components/utils/interpolation";
package/dist/3d.js CHANGED
@@ -1,11 +1,11 @@
1
- import { C as a, J as t, L as r, M as s, a as i, P as n, R as p, S as u, b as d, c as m, d as x, e as R, T as l, f as S } from "./chunks/Robot-D4XbngYI.js";
2
- import { J as c } from "./chunks/JoggingGizmo-SuS9MmL7.js";
1
+ import { C as a, J as t, L as r, M as s, a as i, P as n, R as p, S as u, b as d, c as l, d as m, e as x, T as R, f, r as S } from "./chunks/robotModelSource-CKuBOeQ-.js";
2
+ import { J as b } from "./chunks/JoggingGizmo-SuS9MmL7.js";
3
3
  import { J as G } from "./chunks/JoggingGizmoOrientation-x_crT_64.js";
4
- import { R as b } from "./chunks/RobotControlPanel-BiLexAWI.js";
5
- import { P as L, V as M, p as P, q as V, a as E } from "./chunks/Pose3-pocKPrHN.js";
4
+ import { R as M } from "./chunks/RobotControlPanel-E-hUzMIL.js";
5
+ import { P as L, V as P, p as V, q as E, a as T } from "./chunks/Pose3-pocKPrHN.js";
6
6
  export {
7
7
  a as CollisionSceneRenderer,
8
- c as JoggingGizmo,
8
+ b as JoggingGizmo,
9
9
  G as JoggingGizmoOrientation,
10
10
  t as JointLimitGizmo,
11
11
  r as LinearAxis,
@@ -14,16 +14,17 @@ export {
14
14
  L as Pose3,
15
15
  n as PresetEnvironment,
16
16
  p as Robot,
17
- b as RobotControlPanel,
17
+ M as RobotControlPanel,
18
18
  u as SafetyZonesRenderer,
19
19
  d as SupportedLinearAxis,
20
- m as SupportedLinearAxisExact,
21
- x as SupportedRobot,
22
- R as SupportedRobotExact,
23
- l as TrajectoryRenderer,
24
- M as ValueInterpolator,
25
- S as defaultGetModel,
26
- P as parseRotationToQuaternion,
27
- V as quaternionToRotationVector,
28
- E as useSmoothedMotionState
20
+ l as SupportedLinearAxisExact,
21
+ m as SupportedRobot,
22
+ x as SupportedRobotExact,
23
+ R as TrajectoryRenderer,
24
+ P as ValueInterpolator,
25
+ f as defaultGetModel,
26
+ V as parseRotationToQuaternion,
27
+ E as quaternionToRotationVector,
28
+ S as robotModelOf,
29
+ T as useSmoothedMotionState
29
30
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-CyHUWmjM.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-DrXTcV-I.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
@@ -1,4 +1,4 @@
1
- import { C as e, C as o } from "../chunks/CurrentPoseBar-zTZi68tY.js";
1
+ import { C as e, C as o } from "../chunks/CurrentPoseBar-DENCilvf.js";
2
2
  export {
3
3
  e as CurrentPoseBar,
4
4
  o as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-BXtBHEe9.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-DTE8-v2j.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
@@ -1,4 +1,4 @@
1
- import { R as t, R as e } from "../chunks/RobotControlPanel-BiLexAWI.js";
1
+ import { R as t, R as e } from "../chunks/RobotControlPanel-E-hUzMIL.js";
2
2
  export {
3
3
  t as RobotControlPanel,
4
4
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotHeader-CqK0700U.cjs");exports.RobotHeader=e.RobotHeader;exports.default=e.RobotHeader;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotHeader-Daft80jq.cjs");exports.RobotHeader=e.RobotHeader;exports.default=e.RobotHeader;
@@ -1,4 +1,4 @@
1
- import { R as o, R as r } from "../chunks/RobotHeader-BZci9ahT.js";
1
+ import { R as o, R as r } from "../chunks/RobotHeader-BvIzk8Fw.js";
2
2
  export {
3
3
  o as RobotHeader,
4
4
  r as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-Bbg-o8h9.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-BVk-SH_0.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
@@ -1,4 +1,4 @@
1
- import { S as f, S as r } from "../chunks/SafetyBar-Cuak4ffd.js";
1
+ import { S as f, S as r } from "../chunks/SafetyBar-eYzCHOFD.js";
2
2
  export {
3
3
  f as SafetyBar,
4
4
  r as default
@@ -9,7 +9,7 @@ import { Settings as on } from "@wandelbots/icons/Settings";
9
9
  import { memo as rn, useId as K, useRef as $, useState as j, useCallback as T } from "react";
10
10
  import { useTranslation as U } from "react-i18next";
11
11
  import { e as an } from "./externalizeComponent-_w2d1_pz.js";
12
- import { P as B, u as sn, a as ln, p as cn } from "./useEveryFrame-G_-ma1nC.js";
12
+ import { P as B, u as sn, c as ln, b as cn } from "./useEveryFrame-B8t_yz-G.js";
13
13
  import { S as un } from "./SmallSelect-BdD9uLKK.js";
14
14
  import pn from "@mui/material/ListSubheader";
15
15
  import dn from "@mui/material/MenuItem";
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("./useEveryFrame-dmPPTKtT.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(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);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
1
+ "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("./useEveryFrame-CHxg25f4.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(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);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),$=require("@mui/material/IconButton"),v=require("@mui/material/Stack"),z=require("@mui/material/Tab"),W=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),V=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),Q=require("@wandelbots/icons/Jog"),U=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-DGbFLWgT.cjs"),Z=require("./JoggingButtons-CbL-5LMK.cjs"),tt=require("@mui/material/styles"),X=require("@mui/material/ToggleButton"),et=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-dmPPTKtT.cjs"),ot=require("@mui/material/Slider"),nt=require("./JoggingJointSlider-R3_A9Ppj.cjs"),rt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),lt=require("@wandelbots/icons/NorthEastFilled"),st=require("./joggingColors-ZDc_2UCp.cjs"),_=require("@wandelbots/icons/CheckFilled"),at=require("@wandelbots/icons/ContentCopyFilled"),it=require("@wandelbots/icons/EditFilled");function ct({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:l}=w.useTranslation(),r=t==="gizmo"&&a!==void 0,i=l(r?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),x=l(r?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(v,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[a&&e.jsx(P,{title:x,placement:"left",children:e.jsx($,{"aria-label":x,onClick:()=>o(r?"buttons":"gizmo"),size:"small",sx:c=>{var g;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${c.palette.divider}`,background:(g=c.palette.backgroundPaperElevation)==null?void 0:g[11]}},children:r?e.jsx(U.ViewModuleFilled,{}):e.jsx(Q.Jog,{})})}),r?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:i})]})}const ut=tt.styled(et)(({theme:t})=>{var o;return{gap:"4px","& .MuiToggleButton-root":{border:"none",borderRadius:"8px",padding:"6px 16px",textTransform:"none",fontSize:"14px",color:t.palette.text.secondary},"& .MuiToggleButton-root.Mui-selected":{color:t.palette.text.primary,background:(o=t.palette.backgroundPaperElevation)==null?void 0:o[11]}}});function dt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(ut,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(X,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(X,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(v,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function xt(t){return t*180/Math.PI}function pt(t){return t*Math.PI/180}function H(t,o){return t==="rotate"?xt(o):o}function gt(t,o){return t==="rotate"?pt(o):o}function bt(t,o){const n=String(Number(H(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ft(t,o){const n=Math.round(H(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function L({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),l=r=>H(t,r);return e.jsxs(v,{gap:"4px",children:[e.jsxs(v,{direction:"row",sx:{justifyContent:"space-between"},children:[e.jsx(F,{id:d,variant:"body2",color:"text.secondary",children:a("RobotControl.Velocity.lb")}),e.jsx(F,{variant:"body2",color:"text.primary",sx:{fontVariantNumeric:"tabular-nums"},children:ft(t,o.value)})]}),e.jsx(ot,{"aria-labelledby":d,size:"small",value:Math.round(l(o.value)),min:Math.ceil(l(o.min)),max:Math.floor(l(o.max)),disabled:s,onChange:(r,i)=>{typeof i=="number"&&n(gt(t,i))},sx:r=>{var i;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${r.palette.primary.main}`,backgroundColor:(i=r.palette.backgroundPaperElevation)==null?void 0:i[5]}}}})]})}function ht({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:l,onVelocityChange:r,onJogStart:i,onJogStop:x,increments:c,gizmoOrientation:g,gizmoFrameQuaternion:j}){const{t:h}=w.useTranslation(),u=c?o.mode:"continuous",R=(c==null?void 0:c.steps[t])??[],m=Math.min(o.step[t],R.length-1),C=R[m],M=b.useRef(!1);function S(f,y){if(u==="increment"){c&&C!==void 0&&c.onStep(t,f,y,C);return}M.current=!0,i(t,f,y)}function E(){M.current&&(M.current=!1,x())}return e.jsxs(e.Fragment,{children:[(a||d)&&e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsxs(v,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:h("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:h("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(V,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[c&&e.jsx(dt,{value:u,onChange:f=>n({...o,mode:f}),disabled:s}),e.jsx(L,{motion:t,velocity:l[t],onChange:f=>r(t,f),disabled:s}),u==="increment"&&C!==void 0&&e.jsx(T.InlineSelect,{label:h("RobotControl.StepSize.lb"),value:String(m),options:R.map((f,y)=>({id:String(y),label:bt(t,f)})),onChange:f=>n({...o,step:{...o.step,[t]:Number(f)}}),disabled:s})]}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ct,{view:o.view,onViewChange:f=>n({...o,view:f}),mode:u,controls:{motion:t,onJogStart:S,onJogStop:E,activeHandle:u==="increment"?c==null?void 0:c.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:j},u)})]})}function Ct({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(r,i){n.current!==null&&n.current!==r||(n.current=r,a(r),t.onJogStart(r,i))}function l(r){n.current===r&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(v,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((r,i)=>e.jsx(nt.JoggingJointSlider,{label:`J${i+1}`,name:r.name,value:r.value,min:r.min,max:r.max,linear:t.linear,onJogStart:x=>d(i,x),onJogStop:()=>l(i),disabled:o||s!==null&&s!==i},i))})}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(L,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,vt=.01;function Rt(t,o){return t?Math.hypot(t.position[0]-o.position[0],t.position[1]-o.position[1],t.position[2]-o.position[2])<=jt&&mt(t.orientation,o.orientation)<=vt:!1}function G(t){const o=Math.hypot(...t);if(o<1e-12)return[1,0,0,0];const n=Math.sin(o/2)/o;return[Math.cos(o/2),t[0]*n,t[1]*n,t[2]*n]}function mt(t,o){const n=G(t),s=G(o),a=Math.abs(n[0]*s[0]+n[1]*s[1]+n[2]*s[2]+n[3]*s[3]);return 2*Math.acos(Math.min(1,a))}const Tt="move",Mt=200;function St({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:l}){const{t:r}=w.useTranslation(),[i,x]=b.useState(!1),c=b.useRef(void 0),g=b.useRef(!1),j=b.useRef({onMoveStart:a,onMoveStop:d});j.current={onMoveStart:a,onMoveStop:d};const h=t==="planned",u=h||t==="moving",{handlersFor:R,stop:m}=st.useHold({onStart:()=>{x(!0),c.current=setTimeout(()=>{c.current=void 0,g.current=!0,j.current.onMoveStart()},Mt)},onStop:()=>{x(!1),clearTimeout(c.current),c.current=void 0,g.current&&(g.current=!1,j.current.onMoveStop())},disabled:i?s||!o||!u:s||!o||n||!h,isSame:()=>!0});l&&(l.current=m),b.useEffect(()=>()=>clearTimeout(c.current),[]);const C=r(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:r(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...R(Tt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!u,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(lt.NorthEastFilled,{}),"aria-pressed":i,children:C})})})}function yt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:l,error:r,disabled:i}){const{t:x}=w.useTranslation(),c=b.useRef(null),{copied:g,copy:j}=T.useCopyText();b.useEffect(()=>{const u=c.current;u&&(o?(u.focus(),u.setSelectionRange(u.value.length,u.value.length)):document.activeElement===u&&(u.blur(),u.scrollLeft=0))},[o]);function h(){return j(t,()=>{var u;return(u=c.current)==null?void 0:u.select()})}return e.jsxs(v,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:c,onChange:u=>s(u.target.value),onClick:()=>{!o&&!i&&n()},onKeyDown:u=>{o&&(u.key==="Enter"&&l?d():u.key==="Escape"&&a())},error:!!r,helperText:r??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||i?void 0:"text"}}}),e.jsx(v,{direction:"row",sx:{gap:"8px",height:"56px",alignItems:"center"},children:o?e.jsxs(e.Fragment,{children:[e.jsx(I.RoundedIconButton,{icon:e.jsx(D.CloseFilled,{}),ariaLabel:x("RobotControl.MoveTo.Cancel.bt"),onClick:a}),e.jsx(P,{title:x("RobotControl.MoveTo.ConfirmEdit.lb"),placement:"left",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(_.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!l,sx:{color:"primary.main"}})})})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{title:x("RobotControl.MoveTo.Copied.lb"),open:g,disableHoverListener:!0,placement:"left",children:e.jsx(I.RoundedIconButton,{icon:g?e.jsx(_.CheckFilled,{}):e.jsx(at.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void h()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(it.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:i})]})})]})}function wt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var B;const{t:d}=w.useTranslation(),[l,r]=b.useState(null),[i,x]=b.useState(null),c=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},l===null&&i===null),g=(l==null?void 0:l.text)??c,j=i!==null,h=i===null?null:T.parsePoseText(i),u=l!==null&&!t.error&&!j,R=T.useEveryFrame(()=>l!==null&&Rt(t.getCurrentPose(),l.pose),u)&&u,m=b.useRef(!1),C=b.useRef(null);function M(){var p;(p=C.current)==null||p.call(C),m.current=!1,r(null),x(null),t.onTargetChange(null)}function S(){h===null||a||(m.current=!1,r({pose:h,text:T.poseToText(h)}),x(null),t.onTargetChange(h))}b.useEffect(()=>{if(u){if(t.state==="moving"){m.current=!0;return}m.current&&R&&t.state!=="stopping"&&M()}},[u,t.state,R]);const E=[o==null?void 0:o.value,(B=t.frame)==null?void 0:B.value].join("\0");b.useEffect(()=>{l&&M()},[E]);const f=b.useRef({target:l,onTargetChange:t.onTargetChange});f.current={target:l,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=C.current)==null||p.call(C),f.current.target&&f.current.onTargetChange(null)},[]);const y=i!==null?h===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:l?t.error??null:null;return e.jsxs(J,{children:[o&&e.jsx(T.PanelSelect,{label:d("RobotControl.Tcp.lb"),...o,disabled:a}),e.jsx(F,{variant:"body1",color:"text.primary",children:d("RobotControl.MoveTo.TargetPose.lb")}),e.jsxs(v,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(yt,{text:i??g,editing:j,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:h!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(L,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(v,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[l&&!j&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(rt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(St,{state:l?t.state:"idle",ready:u,atPose:R,disabled:a,onMoveStart:()=>{l&&t.onMoveStart(l.pose)},onMoveStop:t.onMoveStop,stopRef:C})]})]})}const Et=K.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:l,onTabChange:r,jogMode:i,onJogModeChange:x,...c})=>{const{t:g}=w.useTranslation(),j=c.disabled??!1,[h,u]=b.useState("translate"),[R,m]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),C=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=l??h,S=C.includes(M)?M:C[0],E=qt(R,i,c.increments),f=g("RobotControl.Title.ti");function y(p){u(p),r==null||r(p)}function B(p){var q,A,N;m(p),p.mode!==E.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(q=c.increments)==null?void 0:q.steps[k][p.step[k]];p.step[k]!==E.step[k]&&O!==void 0&&((N=(A=c.increments)==null?void 0:A.onStepChange)==null||N.call(A,k,O))}}return e.jsxs(v,{"data-testid":"robot-control-panel",sx:[p=>{var q;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(q=p.palette.backgroundPaperElevation)==null?void 0:q[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(v,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",padding:"20px 20px 8px"},children:[e.jsx(F,{component:"h2",color:"text.primary",sx:{fontSize:"20px"},children:f}),t&&e.jsx($,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs(W,{value:S??!1,onChange:(p,q)=>y(q),"aria-label":f,variant:"scrollable",scrollButtons:!1,sx:{marginX:"20px",borderBottom:1,borderColor:"divider",background:"transparent"},children:[d&&e.jsx(z,{value:"translate",label:g("RobotControl.Tab.Translate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),d&&e.jsx(z,{value:"rotate",label:g("RobotControl.Tab.Rotate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),n&&e.jsx(z,{value:"joint",label:g("RobotControl.Tab.Joint.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),s&&e.jsx(z,{value:"moveTo",label:g("RobotControl.Tab.MoveTo.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}})]}),e.jsx(v,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(Ct,{joints:n,disabled:j||a}):S==="moveTo"&&s?e.jsx(wt,{moveTo:s,tcp:c.tcp,velocity:c.velocity.translate,onVelocityChange:p=>c.onVelocityChange("translate",p),disabled:j}):S==="translate"||S==="rotate"?e.jsx(ht,{...c,disabled:j||a,motion:S,settings:E,onSettingsChange:B}):null})]})});function qt(t,o,n){const s=a=>{var r;const d=(r=n==null?void 0:n.step)==null?void 0:r[a];if(d===void 0)return t.step[a];const l=n==null?void 0:n.steps[a].findIndex(i=>Math.abs(i-d)<=1e-9*Math.max(1,Math.abs(i)));return l===void 0||l<0?t.step[a]:l};return{...t,mode:o??t.mode,step:{translate:s("translate"),rotate:s("rotate")}}}exports.RobotControlPanel=Et;
1
+ "use strict";const e=require("react/jsx-runtime"),$=require("@mui/material/IconButton"),v=require("@mui/material/Stack"),z=require("@mui/material/Tab"),W=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),V=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),Q=require("@wandelbots/icons/Jog"),U=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-DGbFLWgT.cjs"),Z=require("./JoggingButtons-CbL-5LMK.cjs"),tt=require("@mui/material/styles"),X=require("@mui/material/ToggleButton"),et=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-CHxg25f4.cjs"),ot=require("@mui/material/Slider"),nt=require("./JoggingJointSlider-R3_A9Ppj.cjs"),rt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),lt=require("@wandelbots/icons/NorthEastFilled"),st=require("./joggingColors-ZDc_2UCp.cjs"),_=require("@wandelbots/icons/CheckFilled"),at=require("@wandelbots/icons/ContentCopyFilled"),it=require("@wandelbots/icons/EditFilled");function ct({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:l}=w.useTranslation(),r=t==="gizmo"&&a!==void 0,i=l(r?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),x=l(r?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(v,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[a&&e.jsx(P,{title:x,placement:"left",children:e.jsx($,{"aria-label":x,onClick:()=>o(r?"buttons":"gizmo"),size:"small",sx:c=>{var g;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${c.palette.divider}`,background:(g=c.palette.backgroundPaperElevation)==null?void 0:g[11]}},children:r?e.jsx(U.ViewModuleFilled,{}):e.jsx(Q.Jog,{})})}),r?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:i})]})}const ut=tt.styled(et)(({theme:t})=>{var o;return{gap:"4px","& .MuiToggleButton-root":{border:"none",borderRadius:"8px",padding:"6px 16px",textTransform:"none",fontSize:"14px",color:t.palette.text.secondary},"& .MuiToggleButton-root.Mui-selected":{color:t.palette.text.primary,background:(o=t.palette.backgroundPaperElevation)==null?void 0:o[11]}}});function dt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(ut,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(X,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(X,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(v,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function xt(t){return t*180/Math.PI}function pt(t){return t*Math.PI/180}function H(t,o){return t==="rotate"?xt(o):o}function gt(t,o){return t==="rotate"?pt(o):o}function bt(t,o){const n=String(Number(H(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ft(t,o){const n=Math.round(H(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function L({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),l=r=>H(t,r);return e.jsxs(v,{gap:"4px",children:[e.jsxs(v,{direction:"row",sx:{justifyContent:"space-between"},children:[e.jsx(F,{id:d,variant:"body2",color:"text.secondary",children:a("RobotControl.Velocity.lb")}),e.jsx(F,{variant:"body2",color:"text.primary",sx:{fontVariantNumeric:"tabular-nums"},children:ft(t,o.value)})]}),e.jsx(ot,{"aria-labelledby":d,size:"small",value:Math.round(l(o.value)),min:Math.ceil(l(o.min)),max:Math.floor(l(o.max)),disabled:s,onChange:(r,i)=>{typeof i=="number"&&n(gt(t,i))},sx:r=>{var i;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${r.palette.primary.main}`,backgroundColor:(i=r.palette.backgroundPaperElevation)==null?void 0:i[5]}}}})]})}function ht({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:l,onVelocityChange:r,onJogStart:i,onJogStop:x,increments:c,gizmoOrientation:g,gizmoFrameQuaternion:j}){const{t:h}=w.useTranslation(),u=c?o.mode:"continuous",R=(c==null?void 0:c.steps[t])??[],m=Math.min(o.step[t],R.length-1),C=R[m],M=b.useRef(!1);function S(f,y){if(u==="increment"){c&&C!==void 0&&c.onStep(t,f,y,C);return}M.current=!0,i(t,f,y)}function E(){M.current&&(M.current=!1,x())}return e.jsxs(e.Fragment,{children:[(a||d)&&e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsxs(v,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:h("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:h("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(V,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[c&&e.jsx(dt,{value:u,onChange:f=>n({...o,mode:f}),disabled:s}),e.jsx(L,{motion:t,velocity:l[t],onChange:f=>r(t,f),disabled:s}),u==="increment"&&C!==void 0&&e.jsx(T.InlineSelect,{label:h("RobotControl.StepSize.lb"),value:String(m),options:R.map((f,y)=>({id:String(y),label:bt(t,f)})),onChange:f=>n({...o,step:{...o.step,[t]:Number(f)}}),disabled:s})]}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ct,{view:o.view,onViewChange:f=>n({...o,view:f}),mode:u,controls:{motion:t,onJogStart:S,onJogStop:E,activeHandle:u==="increment"?c==null?void 0:c.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:j},u)})]})}function Ct({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(r,i){n.current!==null&&n.current!==r||(n.current=r,a(r),t.onJogStart(r,i))}function l(r){n.current===r&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(v,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((r,i)=>e.jsx(nt.JoggingJointSlider,{label:`J${i+1}`,name:r.name,value:r.value,min:r.min,max:r.max,linear:t.linear,onJogStart:x=>d(i,x),onJogStop:()=>l(i),disabled:o||s!==null&&s!==i},i))})}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(L,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,vt=.01;function Rt(t,o){return t?Math.hypot(t.position[0]-o.position[0],t.position[1]-o.position[1],t.position[2]-o.position[2])<=jt&&mt(t.orientation,o.orientation)<=vt:!1}function G(t){const o=Math.hypot(...t);if(o<1e-12)return[1,0,0,0];const n=Math.sin(o/2)/o;return[Math.cos(o/2),t[0]*n,t[1]*n,t[2]*n]}function mt(t,o){const n=G(t),s=G(o),a=Math.abs(n[0]*s[0]+n[1]*s[1]+n[2]*s[2]+n[3]*s[3]);return 2*Math.acos(Math.min(1,a))}const Tt="move",Mt=200;function St({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:l}){const{t:r}=w.useTranslation(),[i,x]=b.useState(!1),c=b.useRef(void 0),g=b.useRef(!1),j=b.useRef({onMoveStart:a,onMoveStop:d});j.current={onMoveStart:a,onMoveStop:d};const h=t==="planned",u=h||t==="moving",{handlersFor:R,stop:m}=st.useHold({onStart:()=>{x(!0),c.current=setTimeout(()=>{c.current=void 0,g.current=!0,j.current.onMoveStart()},Mt)},onStop:()=>{x(!1),clearTimeout(c.current),c.current=void 0,g.current&&(g.current=!1,j.current.onMoveStop())},disabled:i?s||!o||!u:s||!o||n||!h,isSame:()=>!0});l&&(l.current=m),b.useEffect(()=>()=>clearTimeout(c.current),[]);const C=r(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:r(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...R(Tt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!u,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(lt.NorthEastFilled,{}),"aria-pressed":i,children:C})})})}function yt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:l,error:r,disabled:i}){const{t:x}=w.useTranslation(),c=b.useRef(null),{copied:g,copy:j}=T.useCopyText();b.useEffect(()=>{const u=c.current;u&&(o?(u.focus(),u.setSelectionRange(u.value.length,u.value.length)):document.activeElement===u&&(u.blur(),u.scrollLeft=0))},[o]);function h(){return j(t,()=>{var u;return(u=c.current)==null?void 0:u.select()})}return e.jsxs(v,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:c,onChange:u=>s(u.target.value),onClick:()=>{!o&&!i&&n()},onKeyDown:u=>{o&&(u.key==="Enter"&&l?d():u.key==="Escape"&&a())},error:!!r,helperText:r??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||i?void 0:"text"}}}),e.jsx(v,{direction:"row",sx:{gap:"8px",height:"56px",alignItems:"center"},children:o?e.jsxs(e.Fragment,{children:[e.jsx(I.RoundedIconButton,{icon:e.jsx(D.CloseFilled,{}),ariaLabel:x("RobotControl.MoveTo.Cancel.bt"),onClick:a}),e.jsx(P,{title:x("RobotControl.MoveTo.ConfirmEdit.lb"),placement:"left",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(_.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!l,sx:{color:"primary.main"}})})})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{title:x("RobotControl.MoveTo.Copied.lb"),open:g,disableHoverListener:!0,placement:"left",children:e.jsx(I.RoundedIconButton,{icon:g?e.jsx(_.CheckFilled,{}):e.jsx(at.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void h()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(it.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:i})]})})]})}function wt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var B;const{t:d}=w.useTranslation(),[l,r]=b.useState(null),[i,x]=b.useState(null),c=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},l===null&&i===null),g=(l==null?void 0:l.text)??c,j=i!==null,h=i===null?null:T.parsePoseText(i),u=l!==null&&!t.error&&!j,R=T.useEveryFrame(()=>l!==null&&Rt(t.getCurrentPose(),l.pose),u)&&u,m=b.useRef(!1),C=b.useRef(null);function M(){var p;(p=C.current)==null||p.call(C),m.current=!1,r(null),x(null),t.onTargetChange(null)}function S(){h===null||a||(m.current=!1,r({pose:h,text:T.poseToText(h)}),x(null),t.onTargetChange(h))}b.useEffect(()=>{if(u){if(t.state==="moving"){m.current=!0;return}m.current&&R&&t.state!=="stopping"&&M()}},[u,t.state,R]);const E=[o==null?void 0:o.value,(B=t.frame)==null?void 0:B.value].join("\0");b.useEffect(()=>{l&&M()},[E]);const f=b.useRef({target:l,onTargetChange:t.onTargetChange});f.current={target:l,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=C.current)==null||p.call(C),f.current.target&&f.current.onTargetChange(null)},[]);const y=i!==null?h===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:l?t.error??null:null;return e.jsxs(J,{children:[o&&e.jsx(T.PanelSelect,{label:d("RobotControl.Tcp.lb"),...o,disabled:a}),e.jsx(F,{variant:"body1",color:"text.primary",children:d("RobotControl.MoveTo.TargetPose.lb")}),e.jsxs(v,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(yt,{text:i??g,editing:j,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:h!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(L,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(v,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[l&&!j&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(rt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(St,{state:l?t.state:"idle",ready:u,atPose:R,disabled:a,onMoveStart:()=>{l&&t.onMoveStart(l.pose)},onMoveStop:t.onMoveStop,stopRef:C})]})]})}const Et=K.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:l,onTabChange:r,jogMode:i,onJogModeChange:x,...c})=>{const{t:g}=w.useTranslation(),j=c.disabled??!1,[h,u]=b.useState("translate"),[R,m]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),C=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=l??h,S=C.includes(M)?M:C[0],E=qt(R,i,c.increments),f=g("RobotControl.Title.ti");function y(p){u(p),r==null||r(p)}function B(p){var q,A,N;m(p),p.mode!==E.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(q=c.increments)==null?void 0:q.steps[k][p.step[k]];p.step[k]!==E.step[k]&&O!==void 0&&((N=(A=c.increments)==null?void 0:A.onStepChange)==null||N.call(A,k,O))}}return e.jsxs(v,{"data-testid":"robot-control-panel",sx:[p=>{var q;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(q=p.palette.backgroundPaperElevation)==null?void 0:q[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(v,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",padding:"20px 20px 8px"},children:[e.jsx(F,{component:"h2",color:"text.primary",sx:{fontSize:"20px"},children:f}),t&&e.jsx($,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs(W,{value:S??!1,onChange:(p,q)=>y(q),"aria-label":f,variant:"scrollable",scrollButtons:!1,sx:{marginX:"20px",borderBottom:1,borderColor:"divider",background:"transparent"},children:[d&&e.jsx(z,{value:"translate",label:g("RobotControl.Tab.Translate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),d&&e.jsx(z,{value:"rotate",label:g("RobotControl.Tab.Rotate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),n&&e.jsx(z,{value:"joint",label:g("RobotControl.Tab.Joint.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),s&&e.jsx(z,{value:"moveTo",label:g("RobotControl.Tab.MoveTo.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}})]}),e.jsx(v,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(Ct,{joints:n,disabled:j||a}):S==="moveTo"&&s?e.jsx(wt,{moveTo:s,tcp:c.tcp,velocity:c.velocity.translate,onVelocityChange:p=>c.onVelocityChange("translate",p),disabled:j}):S==="translate"||S==="rotate"?e.jsx(ht,{...c,disabled:j||a,motion:S,settings:E,onSettingsChange:B}):null})]})});function qt(t,o,n){const s=a=>{var r;const d=(r=n==null?void 0:n.step)==null?void 0:r[a];if(d===void 0)return t.step[a];const l=n==null?void 0:n.steps[a].findIndex(i=>Math.abs(i-d)<=1e-9*Math.max(1,Math.abs(i)));return l===void 0||l<0?t.step[a]:l};return{...t,mode:o??t.mode,step:{translate:s("translate"),rotate:s("rotate")}}}exports.RobotControlPanel=Et;
@@ -17,7 +17,7 @@ import { J as at } from "./JoggingButtons-CXaozFVz.js";
17
17
  import { styled as it } from "@mui/material/styles";
18
18
  import K from "@mui/material/ToggleButton";
19
19
  import ct from "@mui/material/ToggleButtonGroup";
20
- import { P as X, I as st, u as ut, a as Q, b as pt, p as q } from "./useEveryFrame-G_-ma1nC.js";
20
+ import { P as X, I as st, u as ut, c as Q, a as pt, b as q } from "./useEveryFrame-B8t_yz-G.js";
21
21
  import dt from "@mui/material/Slider";
22
22
  import { J as ft } from "./JoggingJointSlider-CZ-k6XCa.js";
23
23
  import { Undo as bt } from "@wandelbots/icons/Undo";
@@ -4,7 +4,7 @@ import s from "@mui/material/Stack";
4
4
  import { useId as v, useState as A } from "react";
5
5
  import { useTranslation as h } from "react-i18next";
6
6
  import { e as B } from "./externalizeComponent-_w2d1_pz.js";
7
- import { S as C } from "./SafetyBar-Cuak4ffd.js";
7
+ import { S as C } from "./SafetyBar-eYzCHOFD.js";
8
8
  import { S as k } from "./SmallSelect-BdD9uLKK.js";
9
9
  import T from "@mui/material/CircularProgress";
10
10
  import R from "@mui/material/Switch";
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),u=require("@mui/material/Box"),l=require("@mui/material/Stack"),g=require("react"),h=require("react-i18next"),y=require("./externalizeComponent-BdxGBLIv.cjs"),S=require("./SafetyBar-Bbg-o8h9.cjs"),q=require("./SmallSelect-Dcsd7_6_.cjs"),I=require("@mui/material/CircularProgress"),A=require("@mui/material/Switch"),v=require("@mui/material/Typography"),B=require("@mui/icons-material/Apps"),m=require("@mui/material/Button"),C=require("@mui/material/ButtonGroup"),T=require("@mui/material/Menu"),k=require("@mui/material/MenuItem"),R=require("@wandelbots/design-tokens"),H=require("@wandelbots/icons/SearchFilled");function z({state:i,disabled:d=!1,onToggle:s}){const{t:n}=h.useTranslation(),a=g.useId(),r=i==="activating"||i==="deactivating",o={inactive:n("SafetyBar.ActivationToggle.Activate.bt"),activating:n("SafetyBar.ActivationToggle.Activating.bt"),active:n("SafetyBar.ActivationToggle.Activated.bt"),deactivating:n("SafetyBar.ActivationToggle.Deactivating.bt")}[i];return e.jsxs(l,{direction:"row","data-testid":"robot-activation",sx:{gap:"4px",alignItems:"center"},children:[e.jsx(A,{size:"small",checked:i==="active"||i==="deactivating",disabled:r||d,onChange:()=>s(),slotProps:{input:{role:"switch","aria-labelledby":a}}}),e.jsx(v,{id:a,variant:"body2",color:"text.secondary",noWrap:!0,sx:{letterSpacing:"0.17px"},children:o}),r&&e.jsx(I,{size:16})]})}const j={minWidth:0,padding:"4px 10px",color:"text.primary","& svg":{width:"16px",height:"16px"}};function F({appIcon:i,appName:d,apps:s,onAppSelect:n,onSearch:a}){const{t:r}=h.useTranslation(),[o,c]=g.useState(null);function x(t){c(null),t.onClick?t.onClick():t.href&&(window.location.href=t.href),n==null||n(t)}return e.jsxs(l,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[e.jsxs(C,{variant:"outlined",color:"secondary",sx:t=>({borderRadius:"10px",boxShadow:t.shadows[2],"& .MuiButtonGroup-grouped":{borderColor:t.palette.divider}}),children:[e.jsx(m,{"aria-label":r("RobotHeader.Apps.bt"),"aria-haspopup":"menu","aria-expanded":o!==null,disabled:s.length===0,onClick:t=>c(t.currentTarget),sx:j,children:e.jsx(B,{})}),a&&e.jsx(m,{"aria-label":r("RobotHeader.Search.bt"),onClick:a,sx:j,children:e.jsx(H.SearchFilled,{})})]}),e.jsxs(l,{direction:"row",sx:{gap:"4px",alignItems:"center"},children:[i&&e.jsx(u,{sx:{display:"flex","& svg":{width:"25px",height:"25px"}},children:i}),e.jsx(v,{component:"h1",noWrap:!0,sx:{fontFamily:R.FontFamilyBrand,fontWeight:700,fontSize:"16px",letterSpacing:"0.24px"},children:d})]}),e.jsx(T,{anchorEl:o,open:o!==null,onClose:()=>c(null),sx:{"& .MuiPaper-root":{minWidth:200,mt:1}},children:s.map(t=>e.jsxs(k,{onClick:()=>x(t),children:[t.icon&&e.jsx(u,{sx:{display:"flex",alignItems:"center",mr:2},children:t.icon}),t.name]},t.id))})]})}const M={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},P=y.externalizeComponent(({appIcon:i,appName:d,apps:s=[],onAppSelect:n,onSearch:a,motionGroup:r,safety:o,activation:c,actions:x,sx:t})=>{const{t:f}=h.useTranslation(),p=g.useId();return e.jsxs(l,{component:"header",direction:"row","data-testid":"robot-header",sx:[w=>{var b;return{alignItems:"center",justifyContent:"space-between",gap:"24px",padding:"8px 24px",minHeight:"52px",boxSizing:"border-box",background:(b=w.palette.backgroundPaperElevation)==null?void 0:b[1]}},...Array.isArray(t)?t:[t]],children:[e.jsx(F,{appIcon:i,appName:d,apps:s,onAppSelect:n,onSearch:a}),e.jsxs(l,{direction:"row",sx:{gap:"20px",alignItems:"center"},children:[r&&e.jsxs(e.Fragment,{children:[e.jsx(u,{component:"span",id:p,sx:M,children:f("RobotHeader.MotionGroup.lb")}),e.jsx(q.SmallSelect,{labelId:p,width:"240px",...r})]}),o&&e.jsx(S.SafetyBar,{...o}),c&&e.jsx(z,{...c})]}),e.jsx(l,{direction:"row",sx:{gap:"24px",alignItems:"center"},children:x})]})});exports.RobotHeader=P;
1
+ "use strict";const e=require("react/jsx-runtime"),u=require("@mui/material/Box"),l=require("@mui/material/Stack"),g=require("react"),h=require("react-i18next"),y=require("./externalizeComponent-BdxGBLIv.cjs"),S=require("./SafetyBar-BVk-SH_0.cjs"),q=require("./SmallSelect-Dcsd7_6_.cjs"),I=require("@mui/material/CircularProgress"),A=require("@mui/material/Switch"),v=require("@mui/material/Typography"),B=require("@mui/icons-material/Apps"),m=require("@mui/material/Button"),C=require("@mui/material/ButtonGroup"),T=require("@mui/material/Menu"),k=require("@mui/material/MenuItem"),R=require("@wandelbots/design-tokens"),H=require("@wandelbots/icons/SearchFilled");function z({state:i,disabled:d=!1,onToggle:s}){const{t:n}=h.useTranslation(),a=g.useId(),r=i==="activating"||i==="deactivating",o={inactive:n("SafetyBar.ActivationToggle.Activate.bt"),activating:n("SafetyBar.ActivationToggle.Activating.bt"),active:n("SafetyBar.ActivationToggle.Activated.bt"),deactivating:n("SafetyBar.ActivationToggle.Deactivating.bt")}[i];return e.jsxs(l,{direction:"row","data-testid":"robot-activation",sx:{gap:"4px",alignItems:"center"},children:[e.jsx(A,{size:"small",checked:i==="active"||i==="deactivating",disabled:r||d,onChange:()=>s(),slotProps:{input:{role:"switch","aria-labelledby":a}}}),e.jsx(v,{id:a,variant:"body2",color:"text.secondary",noWrap:!0,sx:{letterSpacing:"0.17px"},children:o}),r&&e.jsx(I,{size:16})]})}const j={minWidth:0,padding:"4px 10px",color:"text.primary","& svg":{width:"16px",height:"16px"}};function F({appIcon:i,appName:d,apps:s,onAppSelect:n,onSearch:a}){const{t:r}=h.useTranslation(),[o,c]=g.useState(null);function x(t){c(null),t.onClick?t.onClick():t.href&&(window.location.href=t.href),n==null||n(t)}return e.jsxs(l,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[e.jsxs(C,{variant:"outlined",color:"secondary",sx:t=>({borderRadius:"10px",boxShadow:t.shadows[2],"& .MuiButtonGroup-grouped":{borderColor:t.palette.divider}}),children:[e.jsx(m,{"aria-label":r("RobotHeader.Apps.bt"),"aria-haspopup":"menu","aria-expanded":o!==null,disabled:s.length===0,onClick:t=>c(t.currentTarget),sx:j,children:e.jsx(B,{})}),a&&e.jsx(m,{"aria-label":r("RobotHeader.Search.bt"),onClick:a,sx:j,children:e.jsx(H.SearchFilled,{})})]}),e.jsxs(l,{direction:"row",sx:{gap:"4px",alignItems:"center"},children:[i&&e.jsx(u,{sx:{display:"flex","& svg":{width:"25px",height:"25px"}},children:i}),e.jsx(v,{component:"h1",noWrap:!0,sx:{fontFamily:R.FontFamilyBrand,fontWeight:700,fontSize:"16px",letterSpacing:"0.24px"},children:d})]}),e.jsx(T,{anchorEl:o,open:o!==null,onClose:()=>c(null),sx:{"& .MuiPaper-root":{minWidth:200,mt:1}},children:s.map(t=>e.jsxs(k,{onClick:()=>x(t),children:[t.icon&&e.jsx(u,{sx:{display:"flex",alignItems:"center",mr:2},children:t.icon}),t.name]},t.id))})]})}const M={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},P=y.externalizeComponent(({appIcon:i,appName:d,apps:s=[],onAppSelect:n,onSearch:a,motionGroup:r,safety:o,activation:c,actions:x,sx:t})=>{const{t:f}=h.useTranslation(),p=g.useId();return e.jsxs(l,{component:"header",direction:"row","data-testid":"robot-header",sx:[w=>{var b;return{alignItems:"center",justifyContent:"space-between",gap:"24px",padding:"8px 24px",minHeight:"52px",boxSizing:"border-box",background:(b=w.palette.backgroundPaperElevation)==null?void 0:b[1]}},...Array.isArray(t)?t:[t]],children:[e.jsx(F,{appIcon:i,appName:d,apps:s,onAppSelect:n,onSearch:a}),e.jsxs(l,{direction:"row",sx:{gap:"20px",alignItems:"center"},children:[r&&e.jsxs(e.Fragment,{children:[e.jsx(u,{component:"span",id:p,sx:M,children:f("RobotHeader.MotionGroup.lb")}),e.jsx(q.SmallSelect,{labelId:p,width:"240px",...r})]}),o&&e.jsx(S.SafetyBar,{...o}),c&&e.jsx(z,{...c})]}),e.jsx(l,{direction:"row",sx:{gap:"24px",alignItems:"center"},children:x})]})});exports.RobotHeader=P;
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),m=require("@mui/material/Divider"),E=require("@mui/material/Stack"),f=require("mobx-react-lite"),w=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("@mui/material/styles"),c=require("react"),d=require("react-i18next"),A=require("@mui/material/Popover"),g=require("@mui/material/SvgIcon"),h=require("@mui/material/Typography"),T=require("axios"),M=require("./converters-C8I_A_tA.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=_(c);function R(e,t){throw new Error(`${t} ${JSON.stringify(e)}`)}function O(e){var t,a,n,o;return e instanceof T.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof T.AxiosError&&e.response?`${(t=e.response)==null?void 0:t.status} ${(a=e.response)==null?void 0:a.statusText} from ${(n=e.response)==null?void 0:n.config.url}: ${JSON.stringify((o=e.response)==null?void 0:o.data)}`:e instanceof Error?e.message:`Unexpected error: ${M.tryStringifyJson(e)||e}`}const j=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),B=c.forwardRef(j),F=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),Z=c.forwardRef(F),p=f.observer(({id:e,icon:t,color:a,title:n,name:o,label:s,explanation:i,literalValue:u,anchorOrigin:v,transformOrigin:x})=>{const S=f.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!S.anchorEl},openPopover(b){S.anchorEl=b.currentTarget},closePopover(){S.anchorEl=null}}));return r.jsxs(r.Fragment,{children:[r.jsxs(E,{"aria-owns":S.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:S.openPopover,onMouseLeave:S.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[r.jsx(g,{component:t,sx:{color:a}}),s&&r.jsx("div",{style:{color:a},children:s})]}),r.jsx(A,{id:e,sx:{pointerEvents:"none"},open:S.isPopoverOpen,anchorEl:S.anchorEl,anchorOrigin:v??{vertical:"bottom",horizontal:"left"},transformOrigin:x??{vertical:"top",horizontal:"left"},onClose:S.closePopover,disableRestoreFocus:!0,children:r.jsxs(E,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[r.jsxs("div",{children:[n&&r.jsx(h,{component:"span",fontSize:"14px",children:`${n}: `}),r.jsx(h,{component:"span",color:a,fontWeight:"bold",fontSize:"14px",children:o})]}),r.jsx(h,{fontSize:"14px",children:i}),u&&r.jsx(h,{fontSize:"12px",children:u})]})})]})}),C=f.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:a,transformOrigin:n,compact:o})=>{const s=y.useTheme(),i=c.useId(),{t:u}=d.useTranslation();return e?r.jsx(p,{id:`motion-group-virtual-${i}`,icon:Z,color:s.palette.tertiary.main,name:u("SafetyBar.ControllerType.Virtual.lb"),label:o?null:u("SafetyBar.ControllerType.Virtual.lb"),explanation:r.jsxs(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",r.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:a,transformOrigin:n}):r.jsx(p,{id:`motion-group-physical-${i}`,icon:B,color:s.palette.primary.main,name:u("SafetyBar.ControllerType.Physical.lb"),label:o?null:u("SafetyBar.ControllerType.Physical.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:r.jsx("code",{}),strong:r.jsx("strong",{})}}),anchorOrigin:a,transformOrigin:n})}),P=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),$=c.forwardRef(P),N=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),Y=c.forwardRef(N),V=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),q=c.forwardRef(V),L=f.observer(({operationMode:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"OPERATION_MODE_AUTO":return r.jsx(p,{id:`operation-mode-auto-${i}`,icon:$,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Automatic.ti"),label:n?null:o("SafetyBar.OperationMode.Automatic.ti"),color:s.palette.text.secondary,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Auto.Explanation.lb",children:"The robot controller is in automatic operation mode. Automated movement without manual confirmation is possible in this mode."}),anchorOrigin:t,transformOrigin:a});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return r.jsx(p,{id:`operation-mode-manual-${i}`,icon:q,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Manual.lb"),label:n?null:o("SafetyBar.OperationMode.Manual.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Manual.Explanation.lb",children:"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:return r.jsx(p,{id:`operation-mode-error-${i}`,icon:Y,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Error.lb"),label:n?null:o("SafetyBar.OperationMode.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Error.Explanation.lb",children:"The robot controller has entered an unexpected operation mode. Motion group movement may not be possible."}),literalValue:e,anchorOrigin:t,transformOrigin:a})}}),I=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),K=c.forwardRef(I),D=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),H=c.forwardRef(D),U=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),z=c.forwardRef(U),k=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),W=c.forwardRef(k),G=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),J=c.forwardRef(G),Q=f.observer(({safetyState:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"SAFETY_STATE_NORMAL":return r.jsx(p,{id:`safety-state-normal-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Normal.lb"),label:n?null:o("SafetyBar.SafetyState.Normal.lb"),icon:W,color:s.palette.text.secondary,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Normal.Explanation.lb",children:"The robot controller is in a normal safety state. Movement is not prevented by this state."}),anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return r.jsx(p,{id:`safety-state-estop-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Estop.lb"),label:n?null:o("SafetyBar.SafetyState.Estop.lb"),icon:H,color:s.palette.error.main,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.StopState.Estop.Explanation.lb",children:"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_STOP_0":case"SAFETY_STATE_STOP_1":case"SAFETY_STATE_STOP_2":case"SAFETY_STATE_PROTECTIVE_STOP":case"SAFETY_STATE_STOP":return r.jsx(p,{id:`safety-state-stop-${i}`,icon:J,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Stop.lb"),label:n?null:o("SafetyBar.SafetyState.Stop.lb"),color:s.palette.warning.main,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Stop.Explanation.lb",children:"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_REDUCED":case"SAFETY_STATE_MASTERING":case"SAFETY_STATE_CONFIRM_SAFETY":case"SAFETY_STATE_OPERATOR_SAFETY":case"SAFETY_STATE_RECOVERY":case"SAFETY_STATE_VIOLATION":return r.jsx(p,{id:`safety-state-manual-action-required-${i}`,icon:z,color:s.palette.warning.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.ManualActionRequired.lb"),label:n?null:o("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return r.jsx(p,{id:`safety-state-error-${i}`,icon:K,color:s.palette.error.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Error.lb"),label:n?null:o("SafetyBar.SafetyState.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:R(e,`Unknown safety state ${e}`)}}),X=w.externalizeComponent(f.observer(({isVirtual:e,motionGroupId:t,operationMode:a,safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i=!0})=>{const u=i?1:2;return r.jsxs(E,{direction:"row",gap:u,alignItems:"center",sx:{height:"24px"},children:[r.jsx(Q,{safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(L,{operationMode:a,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(C,{isVirtual:e,motionGroupId:t,anchorOrigin:o,transformOrigin:s,compact:i})]})}));exports.SafetyBar=X;exports.makeErrorMessage=O;
1
+ "use strict";const r=require("react/jsx-runtime"),m=require("@mui/material/Divider"),E=require("@mui/material/Stack"),f=require("mobx-react-lite"),w=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("@mui/material/styles"),c=require("react"),d=require("react-i18next"),A=require("@mui/material/Popover"),g=require("@mui/material/SvgIcon"),h=require("@mui/material/Typography"),T=require("axios"),M=require("./converters-BsXgcxCW.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=_(c);function R(e,t){throw new Error(`${t} ${JSON.stringify(e)}`)}function O(e){var t,a,n,o;return e instanceof T.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof T.AxiosError&&e.response?`${(t=e.response)==null?void 0:t.status} ${(a=e.response)==null?void 0:a.statusText} from ${(n=e.response)==null?void 0:n.config.url}: ${JSON.stringify((o=e.response)==null?void 0:o.data)}`:e instanceof Error?e.message:`Unexpected error: ${M.tryStringifyJson(e)||e}`}const j=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),B=c.forwardRef(j),F=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),Z=c.forwardRef(F),p=f.observer(({id:e,icon:t,color:a,title:n,name:o,label:s,explanation:i,literalValue:u,anchorOrigin:v,transformOrigin:x})=>{const S=f.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!S.anchorEl},openPopover(b){S.anchorEl=b.currentTarget},closePopover(){S.anchorEl=null}}));return r.jsxs(r.Fragment,{children:[r.jsxs(E,{"aria-owns":S.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:S.openPopover,onMouseLeave:S.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[r.jsx(g,{component:t,sx:{color:a}}),s&&r.jsx("div",{style:{color:a},children:s})]}),r.jsx(A,{id:e,sx:{pointerEvents:"none"},open:S.isPopoverOpen,anchorEl:S.anchorEl,anchorOrigin:v??{vertical:"bottom",horizontal:"left"},transformOrigin:x??{vertical:"top",horizontal:"left"},onClose:S.closePopover,disableRestoreFocus:!0,children:r.jsxs(E,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[r.jsxs("div",{children:[n&&r.jsx(h,{component:"span",fontSize:"14px",children:`${n}: `}),r.jsx(h,{component:"span",color:a,fontWeight:"bold",fontSize:"14px",children:o})]}),r.jsx(h,{fontSize:"14px",children:i}),u&&r.jsx(h,{fontSize:"12px",children:u})]})})]})}),C=f.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:a,transformOrigin:n,compact:o})=>{const s=y.useTheme(),i=c.useId(),{t:u}=d.useTranslation();return e?r.jsx(p,{id:`motion-group-virtual-${i}`,icon:Z,color:s.palette.tertiary.main,name:u("SafetyBar.ControllerType.Virtual.lb"),label:o?null:u("SafetyBar.ControllerType.Virtual.lb"),explanation:r.jsxs(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",r.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:a,transformOrigin:n}):r.jsx(p,{id:`motion-group-physical-${i}`,icon:B,color:s.palette.primary.main,name:u("SafetyBar.ControllerType.Physical.lb"),label:o?null:u("SafetyBar.ControllerType.Physical.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:r.jsx("code",{}),strong:r.jsx("strong",{})}}),anchorOrigin:a,transformOrigin:n})}),P=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),$=c.forwardRef(P),N=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),Y=c.forwardRef(N),V=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),q=c.forwardRef(V),L=f.observer(({operationMode:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"OPERATION_MODE_AUTO":return r.jsx(p,{id:`operation-mode-auto-${i}`,icon:$,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Automatic.ti"),label:n?null:o("SafetyBar.OperationMode.Automatic.ti"),color:s.palette.text.secondary,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Auto.Explanation.lb",children:"The robot controller is in automatic operation mode. Automated movement without manual confirmation is possible in this mode."}),anchorOrigin:t,transformOrigin:a});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return r.jsx(p,{id:`operation-mode-manual-${i}`,icon:q,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Manual.lb"),label:n?null:o("SafetyBar.OperationMode.Manual.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Manual.Explanation.lb",children:"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:return r.jsx(p,{id:`operation-mode-error-${i}`,icon:Y,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Error.lb"),label:n?null:o("SafetyBar.OperationMode.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Error.Explanation.lb",children:"The robot controller has entered an unexpected operation mode. Motion group movement may not be possible."}),literalValue:e,anchorOrigin:t,transformOrigin:a})}}),I=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),K=c.forwardRef(I),D=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),H=c.forwardRef(D),U=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),z=c.forwardRef(U),k=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),W=c.forwardRef(k),G=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),J=c.forwardRef(G),Q=f.observer(({safetyState:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"SAFETY_STATE_NORMAL":return r.jsx(p,{id:`safety-state-normal-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Normal.lb"),label:n?null:o("SafetyBar.SafetyState.Normal.lb"),icon:W,color:s.palette.text.secondary,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Normal.Explanation.lb",children:"The robot controller is in a normal safety state. Movement is not prevented by this state."}),anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return r.jsx(p,{id:`safety-state-estop-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Estop.lb"),label:n?null:o("SafetyBar.SafetyState.Estop.lb"),icon:H,color:s.palette.error.main,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.StopState.Estop.Explanation.lb",children:"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_STOP_0":case"SAFETY_STATE_STOP_1":case"SAFETY_STATE_STOP_2":case"SAFETY_STATE_PROTECTIVE_STOP":case"SAFETY_STATE_STOP":return r.jsx(p,{id:`safety-state-stop-${i}`,icon:J,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Stop.lb"),label:n?null:o("SafetyBar.SafetyState.Stop.lb"),color:s.palette.warning.main,explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Stop.Explanation.lb",children:"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_REDUCED":case"SAFETY_STATE_MASTERING":case"SAFETY_STATE_CONFIRM_SAFETY":case"SAFETY_STATE_OPERATOR_SAFETY":case"SAFETY_STATE_RECOVERY":case"SAFETY_STATE_VIOLATION":return r.jsx(p,{id:`safety-state-manual-action-required-${i}`,icon:z,color:s.palette.warning.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.ManualActionRequired.lb"),label:n?null:o("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return r.jsx(p,{id:`safety-state-error-${i}`,icon:K,color:s.palette.error.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Error.lb"),label:n?null:o("SafetyBar.SafetyState.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:R(e,`Unknown safety state ${e}`)}}),X=w.externalizeComponent(f.observer(({isVirtual:e,motionGroupId:t,operationMode:a,safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i=!0})=>{const u=i?1:2;return r.jsxs(E,{direction:"row",gap:u,alignItems:"center",sx:{height:"24px"},children:[r.jsx(Q,{safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(L,{operationMode:a,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(C,{isVirtual:e,motionGroupId:t,anchorOrigin:o,transformOrigin:s,compact:i})]})}));exports.SafetyBar=X;exports.makeErrorMessage=O;
@@ -11,7 +11,7 @@ import O from "@mui/material/Popover";
11
11
  import B from "@mui/material/SvgIcon";
12
12
  import E from "@mui/material/Typography";
13
13
  import { AxiosError as w } from "axios";
14
- import { t as F } from "./converters-DpNB_WNQ.js";
14
+ import { a as F } from "./converters-D9KpJ2HD.js";
15
15
  function Z(e, t) {
16
16
  throw new Error(`${t} ${JSON.stringify(e)}`);
17
17
  }
@@ -0,0 +1 @@
1
+ "use strict";const d=require("three");function y(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const r=y(d);function g(n){try{return JSON.parse(n)}catch{return}}function b(n){try{return JSON.stringify(n)}catch{return}}function h(n){const e=n.length(),t=new r.Quaternion;if(e>1e-6){const o=n.clone().normalize();t.setFromAxisAngle(o,e)}return t}function p(n){if(!n||n.length===0)return 5;const o=n.reduce((s,c)=>s+Math.abs(c.a??0)/1e3+Math.abs(c.d??0)/1e3,0)*2;return!Number.isFinite(o)||o<=0?5:o}function z(n){if(n.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const e=new r.Vector3(n[0].x,n[0].y,n[0].z),t=new r.Vector3(n[1].x,n[1].y,n[1].z),o=new r.Vector3(n[2].x,n[2].y,n[2].z),s=new r.Vector3().subVectors(t,e),c=new r.Vector3().subVectors(o,e),i=new r.Vector3().crossVectors(s,c).normalize();for(let a=3;a<n.length;a++){const u=new r.Vector3(n[a].x,n[a].y,n[a].z),l=new r.Vector3().subVectors(u,e),f=i.dot(l);if(Math.abs(f)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:i}}exports.dhParametersToPlaneSize=p;exports.orientationToQuaternion=h;exports.tryParseJson=g;exports.tryStringifyJson=b;exports.verticesToCoplanarity=z;
@@ -1,4 +1,11 @@
1
1
  import * as o from "three";
2
+ function d(n) {
3
+ try {
4
+ return JSON.parse(n);
5
+ } catch {
6
+ return;
7
+ }
8
+ }
2
9
  function V(n) {
3
10
  try {
4
11
  return JSON.stringify(n);
@@ -6,7 +13,7 @@ function V(n) {
6
13
  return;
7
14
  }
8
15
  }
9
- function d(n) {
16
+ function h(n) {
10
17
  const t = n.length(), r = new o.Quaternion();
11
18
  if (t > 1e-6) {
12
19
  const e = n.clone().normalize();
@@ -20,20 +27,21 @@ function g(n) {
20
27
  const e = n.reduce((c, s) => c + Math.abs(s.a ?? 0) / 1e3 + Math.abs(s.d ?? 0) / 1e3, 0) * 2;
21
28
  return !Number.isFinite(e) || e <= 0 ? 5 : e;
22
29
  }
23
- function h(n) {
30
+ function y(n) {
24
31
  if (n.length < 3)
25
32
  return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
26
- const t = new o.Vector3(n[0].x, n[0].y, n[0].z), r = new o.Vector3(n[1].x, n[1].y, n[1].z), e = new o.Vector3(n[2].x, n[2].y, n[2].z), c = new o.Vector3().subVectors(r, t), s = new o.Vector3().subVectors(e, t), l = new o.Vector3().crossVectors(c, s).normalize();
33
+ const t = new o.Vector3(n[0].x, n[0].y, n[0].z), r = new o.Vector3(n[1].x, n[1].y, n[1].z), e = new o.Vector3(n[2].x, n[2].y, n[2].z), c = new o.Vector3().subVectors(r, t), s = new o.Vector3().subVectors(e, t), u = new o.Vector3().crossVectors(c, s).normalize();
27
34
  for (let a = 3; a < n.length; a++) {
28
- const u = new o.Vector3(n[a].x, n[a].y, n[a].z), i = new o.Vector3().subVectors(u, t), f = l.dot(i);
35
+ const i = new o.Vector3(n[a].x, n[a].y, n[a].z), l = new o.Vector3().subVectors(i, t), f = u.dot(l);
29
36
  if (Math.abs(f) > 1e-6)
30
37
  return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
31
38
  }
32
- return { isCoplanar: !0, normal: l };
39
+ return { isCoplanar: !0, normal: u };
33
40
  }
34
41
  export {
42
+ V as a,
35
43
  g as d,
36
- d as o,
37
- V as t,
38
- h as v
44
+ h as o,
45
+ d as t,
46
+ y as v
39
47
  };