@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.853b1ff → 6.4.0-pr.revamp.667.8acab07

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 (27) hide show
  1. package/dist/3d.cjs +1 -1
  2. package/dist/3d.js +2 -2
  3. package/dist/CurrentPose/index.cjs +1 -1
  4. package/dist/CurrentPose/index.js +1 -1
  5. package/dist/CurrentPoseBar/index.cjs +1 -1
  6. package/dist/CurrentPoseBar/index.js +1 -1
  7. package/dist/RobotControl/index.cjs +1 -1
  8. package/dist/RobotControl/index.js +1 -1
  9. package/dist/RobotControlPanel/index.cjs +1 -1
  10. package/dist/RobotControlPanel/index.js +1 -1
  11. package/dist/chunks/{CurrentPose-DQ-FaAnr.js → CurrentPose-B-dYw6Qi.js} +1 -1
  12. package/dist/chunks/{CurrentPose-fWc6ySnk.cjs → CurrentPose-d8-aJzMZ.cjs} +1 -1
  13. package/dist/chunks/{CurrentPoseBar-CSHQ26mR.cjs → CurrentPoseBar-CgNJwnxA.cjs} +1 -1
  14. package/dist/chunks/{CurrentPoseBar-B3-XLeu2.js → CurrentPoseBar-DAgEpcgw.js} +1 -1
  15. package/dist/chunks/{RobotControl-C59I0tMh.js → RobotControl-CKv3zrVA.js} +17 -13
  16. package/dist/chunks/{RobotControl-0tL4CY3m.cjs → RobotControl-LBoKDzUK.cjs} +1 -1
  17. package/dist/chunks/{RobotControlPanel-BXUgib6Z.cjs → RobotControlPanel-BsDe4A5F.cjs} +1 -1
  18. package/dist/chunks/{RobotControlPanel-BzqLtecA.js → RobotControlPanel-TZuS0_YA.js} +1 -1
  19. package/dist/chunks/{loadRobotSession-BrXLZLOr.js → loadRobotSession-O5JtFiwv.js} +2 -2
  20. package/dist/chunks/{loadRobotSession-D84myCwy.cjs → loadRobotSession-TAmPu5-5.cjs} +1 -1
  21. package/dist/chunks/{useEveryFrame-CHxg25f4.cjs → useEveryFrame-891OscPu.cjs} +1 -1
  22. package/dist/chunks/{useEveryFrame-DAuNawGP.js → useEveryFrame-D9oux4jW.js} +1 -1
  23. package/dist/core.cjs +1 -1
  24. package/dist/core.js +4 -4
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +6 -6
  27. package/package.json +1 -1
package/dist/3d.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Robot-DEJXhv-D.cjs"),o=require("./chunks/RobotScene-BjctJ5z1.cjs"),a=require("./chunks/JoggingGizmo-BJ3wDpAJ.cjs"),s=require("./chunks/JoggingGizmoOrientation-D9VS6nag.cjs"),u=require("./chunks/RobotControlPanel-BXUgib6Z.cjs"),r=require("./chunks/RobotControl-0tL4CY3m.cjs"),n=require("./chunks/RobotView-BlV3MdCy.cjs"),i=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),t=require("./chunks/Pose3-Ch4xVeXV.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.JointLimitGizmo=e.JointLimitGizmo;exports.LinearAxis=e.LinearAxis;exports.Robot=e.Robot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.FLANGE_NODE_SUFFIX=o.FLANGE_NODE_SUFFIX;exports.JOINT_NODE_NAME=o.JOINT_NODE_NAME;exports.JOINT_REST_SUFFIX=o.JOINT_REST_SUFFIX;exports.JoggingAxes=o.JoggingAxes;exports.MODEL_ROTATION=o.MODEL_ROTATION;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.RobotScene=o.RobotScene;exports.RobotSceneView=o.RobotSceneView;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.defaultGetModel=o.defaultGetModel;exports.jointIndexOf=o.jointIndexOf;exports.revokeAllModelUrls=o.revokeAllModelUrls;exports.robotModelOf=o.robotModelOf;exports.useRobotSceneProps=o.useRobotSceneProps;exports.JoggingGizmo=a.JoggingGizmo;exports.JoggingGizmoOrientation=s.JoggingGizmoOrientation;exports.RobotControlPanel=u.RobotControlPanel;exports.RobotControl=r.RobotControl;exports.useRobotControlProps=r.useRobotControlProps;exports.RobotCanvas=n.RobotCanvas;exports.RobotView=n.RobotView;exports.ValueInterpolator=i.ValueInterpolator;exports.useSmoothedMotionState=i.useSmoothedMotionState;exports.Pose3=t.Pose3;exports.parseRotationToQuaternion=t.parseRotationToQuaternion;exports.quaternionToRotationVector=t.quaternionToRotationVector;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Robot-DEJXhv-D.cjs"),o=require("./chunks/RobotScene-BjctJ5z1.cjs"),a=require("./chunks/JoggingGizmo-BJ3wDpAJ.cjs"),s=require("./chunks/JoggingGizmoOrientation-D9VS6nag.cjs"),u=require("./chunks/RobotControlPanel-BsDe4A5F.cjs"),r=require("./chunks/RobotControl-LBoKDzUK.cjs"),n=require("./chunks/RobotView-BlV3MdCy.cjs"),i=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),t=require("./chunks/Pose3-Ch4xVeXV.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.JointLimitGizmo=e.JointLimitGizmo;exports.LinearAxis=e.LinearAxis;exports.Robot=e.Robot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.FLANGE_NODE_SUFFIX=o.FLANGE_NODE_SUFFIX;exports.JOINT_NODE_NAME=o.JOINT_NODE_NAME;exports.JOINT_REST_SUFFIX=o.JOINT_REST_SUFFIX;exports.JoggingAxes=o.JoggingAxes;exports.MODEL_ROTATION=o.MODEL_ROTATION;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.RobotScene=o.RobotScene;exports.RobotSceneView=o.RobotSceneView;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.defaultGetModel=o.defaultGetModel;exports.jointIndexOf=o.jointIndexOf;exports.revokeAllModelUrls=o.revokeAllModelUrls;exports.robotModelOf=o.robotModelOf;exports.useRobotSceneProps=o.useRobotSceneProps;exports.JoggingGizmo=a.JoggingGizmo;exports.JoggingGizmoOrientation=s.JoggingGizmoOrientation;exports.RobotControlPanel=u.RobotControlPanel;exports.RobotControl=r.RobotControl;exports.useRobotControlProps=r.useRobotControlProps;exports.RobotCanvas=n.RobotCanvas;exports.RobotView=n.RobotView;exports.ValueInterpolator=i.ValueInterpolator;exports.useSmoothedMotionState=i.useSmoothedMotionState;exports.Pose3=t.Pose3;exports.parseRotationToQuaternion=t.parseRotationToQuaternion;exports.quaternionToRotationVector=t.quaternionToRotationVector;
package/dist/3d.js CHANGED
@@ -2,8 +2,8 @@ import { C as a, J as t, L as r, R as s, T as n } from "./chunks/Robot-IG0yo_YD.
2
2
  import { F as p, J as R, a as l, b as u, M as x, c as m, d as S, P as d, R as f, e as b, S as c, f as g, g as E, h as J, i as O, j as M, k as T, r as A, l as G, u as I } from "./chunks/RobotScene-BS77SUtN.js";
3
3
  import { J as N } from "./chunks/JoggingGizmo-9wEBSe1P.js";
4
4
  import { J as V } from "./chunks/JoggingGizmoOrientation-DYeHwowd.js";
5
- import { R as C } from "./chunks/RobotControlPanel-BzqLtecA.js";
6
- import { R as z, u as j } from "./chunks/RobotControl-C59I0tMh.js";
5
+ import { R as C } from "./chunks/RobotControlPanel-TZuS0_YA.js";
6
+ import { R as z, u as j } from "./chunks/RobotControl-CKv3zrVA.js";
7
7
  import { R as D, a as U } from "./chunks/RobotView-CGvHcO7j.js";
8
8
  import { V as k, a as q } from "./chunks/PoseTransformer-tafab65c.js";
9
9
  import { P as y, p as X, q as Q } from "./chunks/Pose3-B_fLR-Wv.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPose-fWc6ySnk.cjs"),o=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.CurrentPose=e.CurrentPose;exports.default=e.CurrentPose;exports.useCurrentPoseProps=e.useCurrentPoseProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPose-d8-aJzMZ.cjs"),o=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.CurrentPose=e.CurrentPose;exports.default=e.CurrentPose;exports.useCurrentPoseProps=e.useCurrentPoseProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
@@ -1,4 +1,4 @@
1
- import { C as e, C as r, u as t } from "../chunks/CurrentPose-DQ-FaAnr.js";
1
+ import { C as e, C as r, u as t } from "../chunks/CurrentPose-B-dYw6Qi.js";
2
2
  import { R as a, u as n } from "../chunks/RobotSessionProvider-TVaKGzqa.js";
3
3
  export {
4
4
  e as CurrentPose,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-CSHQ26mR.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-CgNJwnxA.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
@@ -1,4 +1,4 @@
1
- import { C as e, C as o } from "../chunks/CurrentPoseBar-B3-XLeu2.js";
1
+ import { C as e, C as o } from "../chunks/CurrentPoseBar-DAgEpcgw.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/RobotControl-0tL4CY3m.cjs"),e=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.RobotControl=o.RobotControl;exports.default=o.RobotControl;exports.useRobotControlProps=o.useRobotControlProps;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControl-LBoKDzUK.cjs"),e=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.RobotControl=o.RobotControl;exports.default=o.RobotControl;exports.useRobotControlProps=o.useRobotControlProps;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
@@ -1,4 +1,4 @@
1
- import { R as r, R as t, u as e } from "../chunks/RobotControl-C59I0tMh.js";
1
+ import { R as r, R as t, u as e } from "../chunks/RobotControl-CKv3zrVA.js";
2
2
  import { R as a, u } from "../chunks/RobotSessionProvider-TVaKGzqa.js";
3
3
  export {
4
4
  r as RobotControl,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-BXUgib6Z.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-BsDe4A5F.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
@@ -1,4 +1,4 @@
1
- import { R as t, R as e } from "../chunks/RobotControlPanel-BzqLtecA.js";
1
+ import { R as t, R as e } from "../chunks/RobotControlPanel-TZuS0_YA.js";
2
2
  export {
3
3
  t as RobotControlPanel,
4
4
  e as default
@@ -1,7 +1,7 @@
1
1
  import { jsx as y } from "react/jsx-runtime";
2
2
  import { observer as I } from "mobx-react-lite";
3
3
  import { a as S } from "./RobotSessionProvider-TVaKGzqa.js";
4
- import { C as P } from "./CurrentPoseBar-B3-XLeu2.js";
4
+ import { C as P } from "./CurrentPoseBar-DAgEpcgw.js";
5
5
  import { useState as l } from "react";
6
6
  import { useTranslation as b } from "react-i18next";
7
7
  import { i as T } from "./externalizeComponent-TgclPxwg.js";
@@ -1 +1 @@
1
- "use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider--AekyPqD.cjs"),f=require("./CurrentPoseBar-CSHQ26mR.cjs"),p=require("react"),q=require("react-i18next"),v=require("./externalizeComponent-BW1UV6Gh.cjs"),x=require("./coordSystemLabel-BThpFG9n.cjs");function m(n){var u,d,l;const e=n.jogging,{t:r}=q.useTranslation(void 0,{i18n:v.i18n}),[o,s]=p.useState(e.selectedTcpId),[i,g]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,C=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,y=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function I(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:I,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:s}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:x.coordSystemLabel(e,t)})),value:a,onChange:g},state:C,error:y}}const T=S.observer(function({session:e,...r}){const o=b.useRobotSessionOf(e),s=m(o);return P.jsx(f.CurrentPoseBar,{...s,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=m;
1
+ "use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider--AekyPqD.cjs"),f=require("./CurrentPoseBar-CgNJwnxA.cjs"),p=require("react"),q=require("react-i18next"),v=require("./externalizeComponent-BW1UV6Gh.cjs"),x=require("./coordSystemLabel-BThpFG9n.cjs");function m(n){var u,d,l;const e=n.jogging,{t:r}=q.useTranslation(void 0,{i18n:v.i18n}),[o,s]=p.useState(e.selectedTcpId),[i,g]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,C=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,y=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function I(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:I,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:s}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:x.coordSystemLabel(e,t)})),value:a,onChange:g},state:C,error:y}}const T=S.observer(function({session:e,...r}){const o=b.useRobotSessionOf(e),s=m(o);return P.jsx(f.CurrentPoseBar,{...s,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=m;
@@ -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-BW1UV6Gh.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
+ "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-BW1UV6Gh.cjs"),y=require("./useEveryFrame-891OscPu.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;
@@ -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-TgclPxwg.js";
12
- import { P as B, c as sn, u as ln, b as cn } from "./useEveryFrame-DAuNawGP.js";
12
+ import { P as B, c as sn, u as ln, b as cn } from "./useEveryFrame-D9oux4jW.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,7 +1,7 @@
1
1
  import { jsx as et } from "react/jsx-runtime";
2
2
  import { observer as ot } from "mobx-react-lite";
3
3
  import { a as nt } from "./RobotSessionProvider-TVaKGzqa.js";
4
- import { R as rt } from "./RobotControlPanel-BzqLtecA.js";
4
+ import { R as rt } from "./RobotControlPanel-TZuS0_YA.js";
5
5
  import { degreesToRadians as s, radiansToDegrees as at } from "@wandelbots/nova-js";
6
6
  import { JointTypeEnum as it } from "@wandelbots/nova-js/v2";
7
7
  import { reaction as ct, runInAction as st, when as lt } from "mobx";
@@ -11,7 +11,7 @@ import { Quaternion as dt } from "three";
11
11
  import { i as gt } from "./externalizeComponent-TgclPxwg.js";
12
12
  import { P as pt, p as k } from "./Pose3-B_fLR-Wv.js";
13
13
  import { c as x } from "./coordSystemLabel-Bfy9MUsV.js";
14
- import { u as yt } from "./useEveryFrame-DAuNawGP.js";
14
+ import { u as yt } from "./useEveryFrame-D9oux4jW.js";
15
15
  const A = [
16
16
  "Base",
17
17
  "Shoulder",
@@ -19,8 +19,8 @@ const A = [
19
19
  "Forearm",
20
20
  "Wrist",
21
21
  "Flange"
22
- ], R = "selected-tcp", I = "coordinate-system:", Q = (n) => Math.round(at(n) * 1e6) / 1e6;
23
- function B(n, i) {
22
+ ], R = "selected-tcp", I = "coordinate-system:", B = (n) => Math.round(at(n) * 1e6) / 1e6;
23
+ function Q(n, i) {
24
24
  n.targetPose.setDraft(
25
25
  `(${[...i.position, ...i.orientation].join(", ")})`
26
26
  ), n.targetPose.confirmEdit();
@@ -143,15 +143,19 @@ function vt(n, i = {}) {
143
143
  M.resetToLive();
144
144
  return;
145
145
  }
146
- B(n, e);
146
+ Q(n, e);
147
147
  }
148
148
  F(
149
- () => ct(
150
- () => n.safety.notMoveableReason === null,
151
- (e) => {
152
- const o = J.current, { staged: r, confirming: a } = n.targetPose;
153
- e && o && !r && !a && B(n, o);
154
- }
149
+ () => (
150
+ // Once the robot can move: while it is activating, there is no reason
151
+ // not to, but an app may still lock it, and the session plans nothing
152
+ ct(
153
+ () => n.safety.canBeMoved,
154
+ (e) => {
155
+ const o = J.current, { staged: r, confirming: a } = n.targetPose;
156
+ e && o && !r && !a && Q(n, o);
157
+ }
158
+ )
155
159
  ),
156
160
  [n]
157
161
  );
@@ -216,7 +220,7 @@ function vt(n, i = {}) {
216
220
  max: s(t.maxRotationVelocityDegPerSec)
217
221
  }
218
222
  },
219
- onVelocityChange: (e, o) => e === "rotate" ? t.setVelocityFromSlider(Q(o), !0) : t.setVelocityFromSlider(o, !1),
223
+ onVelocityChange: (e, o) => e === "rotate" ? t.setVelocityFromSlider(B(o), !0) : t.setVelocityFromSlider(o, !1),
220
224
  onJogStart: (e, o, r) => {
221
225
  X(e, o, r).catch(l);
222
226
  },
@@ -266,7 +270,7 @@ function vt(n, i = {}) {
266
270
  min: s(t.minRotationVelocityDegPerSec),
267
271
  max: s(t.maxRotationVelocityDegPerSec)
268
272
  },
269
- onVelocityChange: (e) => m ? t.setVelocityFromSlider(e, !1) : t.setVelocityFromSlider(Q(e), !0),
273
+ onVelocityChange: (e) => m ? t.setVelocityFromSlider(e, !1) : t.setVelocityFromSlider(B(e), !0),
270
274
  onJogStart: (e, o) => {
271
275
  G(e, o).catch(l);
272
276
  },
@@ -1 +1 @@
1
- "use strict";const te=require("react/jsx-runtime"),oe=require("mobx-react-lite"),ne=require("./RobotSessionProvider--AekyPqD.cjs"),re=require("./RobotControlPanel-BXUgib6Z.cjs"),s=require("@wandelbots/nova-js"),ae=require("@wandelbots/nova-js/v2"),h=require("mobx"),l=require("react"),ie=require("react-i18next"),ce=require("three"),se=require("./externalizeComponent-BW1UV6Gh.cjs"),I=require("./Pose3-Ch4xVeXV.cjs"),F=require("./coordSystemLabel-BThpFG9n.cjs"),le=require("./useEveryFrame-CHxg25f4.cjs"),N=["Base","Shoulder","Elbow","Forearm","Wrist","Flange"],V="selected-tcp",w="coordinate-system:",k=n=>Math.round(s.radiansToDegrees(n)*1e6)/1e6;function L(n,i){n.targetPose.setDraft(`(${[...i.position,...i.orientation].join(", ")})`),n.targetPose.confirmEdit()}function ue(n,i){switch(n.code){case"disconnected":return i("RobotControl.MoveTo.NotMoveable.Disconnected.lb");case"safety_state":return i("RobotControl.MoveTo.NotMoveable.SafetyState.lb",{value:n.value});case"operation_mode":return i("RobotControl.MoveTo.NotMoveable.OperationMode.lb",{value:n.value});case"deactivated":return i("RobotControl.MoveTo.NotMoveable.Deactivated.lb")}}function de(n){const i=le.useEveryFrame(()=>n.jogger.motionStream.rapidlyChangingMotionState.joint_position.join(" "),!0);return l.useMemo(()=>i?i.split(" ").map(Number):[],[i])}function A(n,i={}){var x;const{disabled:f=!1,gizmoOrientation:T}=i,{t:S}=ie.useTranslation(void 0,{i18n:se.i18n}),e=n.jogging,{trajectory:c,targetPose:R}=n,_=de(e),d=e.jointType===ae.JointTypeEnum.PrismaticJoint,m=(x=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:x.joints,E=c.trajectoryState==="moving"||c.trajectoryState==="stopping",J=f||E;l.useEffect(()=>{J?e.lock("external"):e.unlock("external")},[e,J]);const[Q,z]=l.useState(!1),B=Q?"moveTo":e.currentTab.id==="joint"?"joint":e.selectedCartesianMotionType;function U(t){z(t==="moveTo"),h.runInAction(()=>{e.selectedTabId=t==="joint"?"joint":"cartesian"}),(t==="translate"||t==="rotate")&&e.setSelectedCartesianMotionType(t)}const K=e.selectedIncrementId==="continuous"?"continuous":"increment",b=l.useRef(e.activeDiscreteIncrement??e.discreteIncrementOptions[0]);e.activeDiscreteIncrement&&(b.current=e.activeDiscreteIncrement);const M=b.current,g=l.useRef(0);async function X(t,o,r){const a=++g.current;e.isLocked||(await e.activate(),a===g.current&&(t==="translate"?await e.jogger.translateTCP({axis:o,direction:r,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:o,direction:r,velocityRadsPerSec:e.rotationVelocityRadsPerSec})))}async function G(t,o){const r=++g.current;await e.activate(),r===g.current&&await e.jogger.rotateJoints({joint:t,direction:o,velocityUnit:d?"mm/s":"rad/s",velocityValue:d?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec})}async function O(){const t=++g.current;await e.jogger.stop(),t===g.current&&await e.deactivate()}async function H(t,o,r,a){const p=e.discreteIncrementOptions.find(y=>t==="translate"?Math.abs(y.mm-a)<1e-9:Math.abs(s.degreesToRadians(y.degrees)-a)<1e-9);!p||e.isLocked||await e.withMotionLock(async()=>{try{const j=(await e.activate()).motionStream.rapidlyChangingMotionState;if(!j.tcp_pose)return;e.setCurrentIncrementJog({axis:o,direction:r}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:j.tcp_pose,currentJoints:j.joint_position,velocityInRelevantUnits:t==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:o,direction:r,motion:t==="translate"?{type:"translate",distanceMm:p.mm}:{type:"rotate",distanceRads:s.degreesToRadians(p.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}function W(){if(e.selectedOrientation==="tool"){const o=n.state.rapidlyChangingMotionState.flange_pose,r=o?I.Pose3.fromPose(o).quaternion.clone():new ce.Quaternion,a=e.selectedTcpId?n.description.tcpOffsetsById[e.selectedTcpId]:void 0;return a!=null&&a.pose.orientation&&r.multiply(I.parseRotationToQuaternion(a.pose.orientation,"ROTATION_VECTOR")),r}const t=e.jogCoordSystem;return I.parseRotationToQuaternion(t.orientation??[1,0,0,0],t.orientation_type??"QUATERNION")}function u(t){n.reportError({kind:"jog",message:t instanceof Error?t.message:String(t),cause:t})}const C=l.useRef(!1),[P,Y]=l.useState(null),q=l.useRef(P);q.current=P;function $(t){if(Y(t),!t){R.resetToLive();return}L(n,t)}l.useEffect(()=>h.reaction(()=>n.safety.notMoveableReason===null,t=>{const o=q.current,{staged:r,confirming:a}=n.targetPose;t&&o&&!r&&!a&&L(n,o)}),[n]);const D=n.safety.notMoveableReason;function Z(){c.trajectoryState==="planned"&&c.plannedTrajectory&&(C.current=!0,c.start())}async function ee(){C.current&&(C.current=!1,await h.when(()=>c.trajectoryState!=="planned",{timeout:2e3}).catch(()=>{}),c.trajectoryState==="moving"&&await c.pause())}const v=R.staged;return{disabled:f,jogDisabled:E||e.blocked,cartesian:e.canJogCartesian,tab:B,onTabChange:U,jogMode:K,onJogModeChange:t=>{var o;return e.setSelectedIncrementId(t==="continuous"?"continuous":((o=b.current)==null?void 0:o.id)??"continuous")},gizmoOrientation:T,gizmoFrameQuaternion:W,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:e.selectedTcpId,onChange:t=>{e.requestTcpChange(t).catch(u)}}:void 0,jogFrame:{options:[{id:V,label:S("Jogging.MoveRelativeTo.SelectedTcp.dd")},...e.coordSystems.map(t=>({id:w+t.coordinate_system,label:F.coordSystemLabel(e,t)}))],value:e.selectedOrientation==="tool"?V:w+e.jogCoordSystemId,onChange:t=>t===V?e.setMoveRelativeToSelectedTcp():e.setMoveRelativeToCoordSystem(t.slice(w.length))},velocity:{translate:{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec},rotate:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)}},onVelocityChange:(t,o)=>t==="rotate"?e.setVelocityFromSlider(k(o),!0):e.setVelocityFromSlider(o,!1),onJogStart:(t,o,r)=>{X(t,o,r).catch(u)},onJogStop:()=>{O().catch(u)},increments:{steps:{translate:e.discreteIncrementOptions.map(t=>t.mm),rotate:e.discreteIncrementOptions.map(t=>s.degreesToRadians(t.degrees))},onStep:(t,o,r,a)=>{H(t,o,r,a).catch(u)},running:e.incrementJogInProgress,step:M&&{translate:M.mm,rotate:s.degreesToRadians(M.degrees)},onStepChange:(t,o)=>{const r=e.discreteIncrementOptions.find(a=>t==="translate"?a.mm===o:Math.abs(s.degreesToRadians(a.degrees)-o)<1e-9);r&&e.setSelectedIncrementId(r.id)}},joints:{joints:_.map((t,o)=>{var r,a,p,y;return{value:t,min:(a=(r=m==null?void 0:m[o])==null?void 0:r.position)==null?void 0:a.lower_limit,max:(y=(p=m==null?void 0:m[o])==null?void 0:p.position)==null?void 0:y.upper_limit,name:_.length===N.length&&!d?N[o]:void 0}}),linear:d,velocity:d?{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec}:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)},onVelocityChange:t=>d?e.setVelocityFromSlider(t,!1):e.setVelocityFromSlider(k(t),!0),onJogStart:(t,o)=>{G(t,o).catch(u)},onJogStop:()=>{O().catch(u)}},moveTo:{getCurrentPose:()=>{const t=n.state.displayedTcpPose;return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}},frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:F.coordSystemLabel(e,t)})),value:e.selectedCoordSystemId,onChange:t=>e.setSelectedCoordSystemId(t)},onTargetChange:$,state:R.confirming?"planning":c.trajectoryState,error:P&&D?ue(D,S):v!=null&&v.errorKey?S(v.errorKey):null,onMoveStart:Z,onMoveStop:()=>{ee().catch(u)}}}}const me=oe.observer(function({session:i,disabled:f,gizmoOrientation:T,...S}){const e=ne.useRobotSessionOf(i),c=A(e,{disabled:f,gizmoOrientation:T});return te.jsx(re.RobotControlPanel,{...c,...S})});exports.RobotControl=me;exports.useRobotControlProps=A;
1
+ "use strict";const te=require("react/jsx-runtime"),oe=require("mobx-react-lite"),ne=require("./RobotSessionProvider--AekyPqD.cjs"),re=require("./RobotControlPanel-BsDe4A5F.cjs"),s=require("@wandelbots/nova-js"),ae=require("@wandelbots/nova-js/v2"),h=require("mobx"),l=require("react"),ie=require("react-i18next"),ce=require("three"),se=require("./externalizeComponent-BW1UV6Gh.cjs"),I=require("./Pose3-Ch4xVeXV.cjs"),F=require("./coordSystemLabel-BThpFG9n.cjs"),le=require("./useEveryFrame-891OscPu.cjs"),N=["Base","Shoulder","Elbow","Forearm","Wrist","Flange"],V="selected-tcp",w="coordinate-system:",k=n=>Math.round(s.radiansToDegrees(n)*1e6)/1e6;function L(n,i){n.targetPose.setDraft(`(${[...i.position,...i.orientation].join(", ")})`),n.targetPose.confirmEdit()}function ue(n,i){switch(n.code){case"disconnected":return i("RobotControl.MoveTo.NotMoveable.Disconnected.lb");case"safety_state":return i("RobotControl.MoveTo.NotMoveable.SafetyState.lb",{value:n.value});case"operation_mode":return i("RobotControl.MoveTo.NotMoveable.OperationMode.lb",{value:n.value});case"deactivated":return i("RobotControl.MoveTo.NotMoveable.Deactivated.lb")}}function de(n){const i=le.useEveryFrame(()=>n.jogger.motionStream.rapidlyChangingMotionState.joint_position.join(" "),!0);return l.useMemo(()=>i?i.split(" ").map(Number):[],[i])}function A(n,i={}){var x;const{disabled:f=!1,gizmoOrientation:T}=i,{t:S}=ie.useTranslation(void 0,{i18n:se.i18n}),e=n.jogging,{trajectory:c,targetPose:R}=n,_=de(e),d=e.jointType===ae.JointTypeEnum.PrismaticJoint,m=(x=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:x.joints,E=c.trajectoryState==="moving"||c.trajectoryState==="stopping",J=f||E;l.useEffect(()=>{J?e.lock("external"):e.unlock("external")},[e,J]);const[Q,B]=l.useState(!1),z=Q?"moveTo":e.currentTab.id==="joint"?"joint":e.selectedCartesianMotionType;function U(t){B(t==="moveTo"),h.runInAction(()=>{e.selectedTabId=t==="joint"?"joint":"cartesian"}),(t==="translate"||t==="rotate")&&e.setSelectedCartesianMotionType(t)}const K=e.selectedIncrementId==="continuous"?"continuous":"increment",b=l.useRef(e.activeDiscreteIncrement??e.discreteIncrementOptions[0]);e.activeDiscreteIncrement&&(b.current=e.activeDiscreteIncrement);const M=b.current,g=l.useRef(0);async function X(t,o,r){const a=++g.current;e.isLocked||(await e.activate(),a===g.current&&(t==="translate"?await e.jogger.translateTCP({axis:o,direction:r,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:o,direction:r,velocityRadsPerSec:e.rotationVelocityRadsPerSec})))}async function G(t,o){const r=++g.current;await e.activate(),r===g.current&&await e.jogger.rotateJoints({joint:t,direction:o,velocityUnit:d?"mm/s":"rad/s",velocityValue:d?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec})}async function O(){const t=++g.current;await e.jogger.stop(),t===g.current&&await e.deactivate()}async function H(t,o,r,a){const p=e.discreteIncrementOptions.find(y=>t==="translate"?Math.abs(y.mm-a)<1e-9:Math.abs(s.degreesToRadians(y.degrees)-a)<1e-9);!p||e.isLocked||await e.withMotionLock(async()=>{try{const j=(await e.activate()).motionStream.rapidlyChangingMotionState;if(!j.tcp_pose)return;e.setCurrentIncrementJog({axis:o,direction:r}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:j.tcp_pose,currentJoints:j.joint_position,velocityInRelevantUnits:t==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:o,direction:r,motion:t==="translate"?{type:"translate",distanceMm:p.mm}:{type:"rotate",distanceRads:s.degreesToRadians(p.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}function W(){if(e.selectedOrientation==="tool"){const o=n.state.rapidlyChangingMotionState.flange_pose,r=o?I.Pose3.fromPose(o).quaternion.clone():new ce.Quaternion,a=e.selectedTcpId?n.description.tcpOffsetsById[e.selectedTcpId]:void 0;return a!=null&&a.pose.orientation&&r.multiply(I.parseRotationToQuaternion(a.pose.orientation,"ROTATION_VECTOR")),r}const t=e.jogCoordSystem;return I.parseRotationToQuaternion(t.orientation??[1,0,0,0],t.orientation_type??"QUATERNION")}function u(t){n.reportError({kind:"jog",message:t instanceof Error?t.message:String(t),cause:t})}const C=l.useRef(!1),[P,Y]=l.useState(null),q=l.useRef(P);q.current=P;function $(t){if(Y(t),!t){R.resetToLive();return}L(n,t)}l.useEffect(()=>h.reaction(()=>n.safety.canBeMoved,t=>{const o=q.current,{staged:r,confirming:a}=n.targetPose;t&&o&&!r&&!a&&L(n,o)}),[n]);const D=n.safety.notMoveableReason;function Z(){c.trajectoryState==="planned"&&c.plannedTrajectory&&(C.current=!0,c.start())}async function ee(){C.current&&(C.current=!1,await h.when(()=>c.trajectoryState!=="planned",{timeout:2e3}).catch(()=>{}),c.trajectoryState==="moving"&&await c.pause())}const v=R.staged;return{disabled:f,jogDisabled:E||e.blocked,cartesian:e.canJogCartesian,tab:z,onTabChange:U,jogMode:K,onJogModeChange:t=>{var o;return e.setSelectedIncrementId(t==="continuous"?"continuous":((o=b.current)==null?void 0:o.id)??"continuous")},gizmoOrientation:T,gizmoFrameQuaternion:W,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:e.selectedTcpId,onChange:t=>{e.requestTcpChange(t).catch(u)}}:void 0,jogFrame:{options:[{id:V,label:S("Jogging.MoveRelativeTo.SelectedTcp.dd")},...e.coordSystems.map(t=>({id:w+t.coordinate_system,label:F.coordSystemLabel(e,t)}))],value:e.selectedOrientation==="tool"?V:w+e.jogCoordSystemId,onChange:t=>t===V?e.setMoveRelativeToSelectedTcp():e.setMoveRelativeToCoordSystem(t.slice(w.length))},velocity:{translate:{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec},rotate:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)}},onVelocityChange:(t,o)=>t==="rotate"?e.setVelocityFromSlider(k(o),!0):e.setVelocityFromSlider(o,!1),onJogStart:(t,o,r)=>{X(t,o,r).catch(u)},onJogStop:()=>{O().catch(u)},increments:{steps:{translate:e.discreteIncrementOptions.map(t=>t.mm),rotate:e.discreteIncrementOptions.map(t=>s.degreesToRadians(t.degrees))},onStep:(t,o,r,a)=>{H(t,o,r,a).catch(u)},running:e.incrementJogInProgress,step:M&&{translate:M.mm,rotate:s.degreesToRadians(M.degrees)},onStepChange:(t,o)=>{const r=e.discreteIncrementOptions.find(a=>t==="translate"?a.mm===o:Math.abs(s.degreesToRadians(a.degrees)-o)<1e-9);r&&e.setSelectedIncrementId(r.id)}},joints:{joints:_.map((t,o)=>{var r,a,p,y;return{value:t,min:(a=(r=m==null?void 0:m[o])==null?void 0:r.position)==null?void 0:a.lower_limit,max:(y=(p=m==null?void 0:m[o])==null?void 0:p.position)==null?void 0:y.upper_limit,name:_.length===N.length&&!d?N[o]:void 0}}),linear:d,velocity:d?{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec}:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)},onVelocityChange:t=>d?e.setVelocityFromSlider(t,!1):e.setVelocityFromSlider(k(t),!0),onJogStart:(t,o)=>{G(t,o).catch(u)},onJogStop:()=>{O().catch(u)}},moveTo:{getCurrentPose:()=>{const t=n.state.displayedTcpPose;return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}},frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:F.coordSystemLabel(e,t)})),value:e.selectedCoordSystemId,onChange:t=>e.setSelectedCoordSystemId(t)},onTargetChange:$,state:R.confirming?"planning":c.trajectoryState,error:P&&D?ue(D,S):v!=null&&v.errorKey?S(v.errorKey):null,onMoveStart:Z,onMoveStop:()=>{ee().catch(u)}}}}const me=oe.observer(function({session:i,disabled:f,gizmoOrientation:T,...S}){const e=ne.useRobotSessionOf(i),c=A(e,{disabled:f,gizmoOrientation:T});return te.jsx(re.RobotControlPanel,{...c,...S})});exports.RobotControl=me;exports.useRobotControlProps=A;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),W=require("@mui/material/IconButton"),j=require("@mui/material/Stack"),z=require("@mui/material/Tab"),$=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),U=require("./externalizeComponent-BW1UV6Gh.cjs"),L=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),K=require("@wandelbots/icons/Jog"),Q=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-BJ3wDpAJ.cjs"),Z=require("./JoggingButtons-nXLqJLIr.cjs"),tt=require("./useWebGLRenderer-CtddVDDb.cjs"),et=require("@mui/material/styles"),N=require("@mui/material/ToggleButton"),ot=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-CHxg25f4.cjs"),nt=require("@mui/material/Slider"),rt=require("./JoggingJointSlider-D7AsxkrT.cjs"),lt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),st=require("@wandelbots/icons/NorthEastFilled"),at=require("./joggingColors-ZDc_2UCp.cjs"),X=require("@wandelbots/icons/CheckFilled"),it=require("@wandelbots/icons/ContentCopyFilled"),ct=require("@wandelbots/icons/EditFilled");function ut({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:r}=w.useTranslation(),[l,u]=b.useState(tt.isWebGLAvailable),x=a!==void 0&&l,i=t==="gizmo"&&x,g=r(i?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),C=r(i?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(j,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[x&&e.jsx(P,{title:C,placement:"left",children:e.jsx(W,{"aria-label":C,onClick:()=>o(i?"buttons":"gizmo"),size:"small",sx:f=>{var c;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${f.palette.divider}`,background:(c=f.palette.backgroundPaperElevation)==null?void 0:c[11]}},children:i?e.jsx(Q.ViewModuleFilled,{}):e.jsx(K.Jog,{})})}),i?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180,onWebGLUnavailable:()=>u(!1)}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:g})]})}const dt=et.styled(ot)(({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 xt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(dt,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(N,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(N,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(j,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function pt(t){return t*180/Math.PI}function bt(t){return t*Math.PI/180}function V(t,o){return t==="rotate"?pt(o):o}function gt(t,o){return t==="rotate"?bt(o):o}function ft(t,o){const n=String(Number(V(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ht(t,o){const n=Math.round(V(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function G({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),r=l=>V(t,l);return e.jsxs(j,{gap:"4px",children:[e.jsxs(j,{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:ht(t,o.value)})]}),e.jsx(nt,{"aria-labelledby":d,size:"small",value:Math.round(r(o.value)),min:Math.ceil(r(o.min)),max:Math.floor(r(o.max)),disabled:s,onChange:(l,u)=>{typeof u=="number"&&n(gt(t,u))},sx:l=>{var u;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${l.palette.primary.main}`,backgroundColor:(u=l.palette.backgroundPaperElevation)==null?void 0:u[5]}}}})]})}function Ct({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:r,onVelocityChange:l,onJogStart:u,onJogStop:x,increments:i,gizmoOrientation:g,gizmoFrameQuaternion:C}){const{t:f}=w.useTranslation(),c=i?o.mode:"continuous",m=(i==null?void 0:i.steps[t])??[],R=Math.min(o.step[t],m.length-1),v=m[R],M=b.useRef(!1);function S(h,y){if(c==="increment"){i&&v!==void 0&&i.onStep(t,h,y,v);return}M.current=!0,u(t,h,y)}function q(){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(j,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:f("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:f("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(L,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[i&&e.jsx(xt,{value:c,onChange:h=>n({...o,mode:h}),disabled:s}),e.jsx(G,{motion:t,velocity:r[t],onChange:h=>l(t,h),disabled:s}),c==="increment"&&v!==void 0&&e.jsx(T.InlineSelect,{label:f("RobotControl.StepSize.lb"),value:String(R),options:m.map((h,y)=>({id:String(y),label:ft(t,h)})),onChange:h=>n({...o,step:{...o.step,[t]:Number(h)}}),disabled:s})]}),e.jsx(L,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ut,{view:o.view,onViewChange:h=>n({...o,view:h}),mode:c,controls:{motion:t,onJogStart:S,onJogStop:q,activeHandle:c==="increment"?i==null?void 0:i.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:C},c)})]})}function vt({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(l,u){n.current!==null&&n.current!==l||(n.current=l,a(l),t.onJogStart(l,u))}function r(l){n.current===l&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(j,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((l,u)=>e.jsx(rt.JoggingJointSlider,{label:`J${u+1}`,name:l.name,value:l.value,min:l.min,max:l.max,linear:t.linear,onJogStart:x=>d(u,x),onJogStop:()=>r(u),disabled:o||s!==null&&s!==u},u))})}),e.jsx(L,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(G,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,mt=.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&&Tt(t.orientation,o.orientation)<=mt:!1}function _(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 Tt(t,o){const n=_(t),s=_(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 Mt="move",St=200;function yt({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:r}){const{t:l}=w.useTranslation(),[u,x]=b.useState(!1),i=b.useRef(void 0),g=b.useRef(!1),C=b.useRef({onMoveStart:a,onMoveStop:d});C.current={onMoveStart:a,onMoveStop:d};const f=t==="planned",c=f||t==="moving",{handlersFor:m,stop:R}=at.useHold({onStart:()=>{x(!0),i.current=setTimeout(()=>{i.current=void 0,g.current=!0,C.current.onMoveStart()},St)},onStop:()=>{x(!1),clearTimeout(i.current),i.current=void 0,g.current&&(g.current=!1,C.current.onMoveStop())},disabled:u?s||!o||!c:s||!o||n||!f,isSame:()=>!0});r&&(r.current=R),b.useEffect(()=>()=>clearTimeout(i.current),[]);const v=l(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:l(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...m(Mt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!c,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(st.NorthEastFilled,{}),"aria-pressed":u,children:v})})})}function wt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:r,error:l,disabled:u}){const{t:x}=w.useTranslation(),i=b.useRef(null),{copied:g,copy:C}=T.useCopyText();b.useEffect(()=>{const c=i.current;c&&(o?(c.focus(),c.setSelectionRange(c.value.length,c.value.length)):document.activeElement===c&&(c.blur(),c.scrollLeft=0))},[o]);function f(){return C(t,()=>{var c;return(c=i.current)==null?void 0:c.select()})}return e.jsxs(j,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:i,onChange:c=>s(c.target.value),onClick:()=>{!o&&!u&&n()},onKeyDown:c=>{o&&(c.key==="Enter"&&r?d():c.key==="Escape"&&a())},error:!!l,helperText:l??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||u?void 0:"text"}}}),e.jsx(j,{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(X.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!r,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(X.CheckFilled,{}):e.jsx(it.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void f()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(ct.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:u})]})})]})}function qt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var A;const{t:d}=w.useTranslation(),[r,l]=b.useState(null),[u,x]=b.useState(null),i=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},r===null&&u===null),g=(r==null?void 0:r.text)??i,C=u!==null,f=u===null?null:T.parsePoseText(u),c=r!==null&&!t.error&&!C,m=T.useEveryFrame(()=>r!==null&&Rt(t.getCurrentPose(),r.pose),c)&&c,R=b.useRef(!1),v=b.useRef(null);function M(){var p;(p=v.current)==null||p.call(v),R.current=!1,l(null),x(null),t.onTargetChange(null)}function S(){f===null||a||(R.current=!1,l({pose:f,text:T.poseToText(f)}),x(null),t.onTargetChange(f))}b.useEffect(()=>{if(c){if(t.state==="moving"){R.current=!0;return}R.current&&m&&t.state!=="stopping"&&M()}},[c,t.state,m]);const q=[o==null?void 0:o.value,(A=t.frame)==null?void 0:A.value].join("\0");b.useEffect(()=>{r&&M()},[q]);const h=b.useRef({target:r,onTargetChange:t.onTargetChange});h.current={target:r,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=v.current)==null||p.call(v),h.current.target&&h.current.onTargetChange(null)},[]);const y=u!==null?f===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:r?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(j,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(wt,{text:u??g,editing:C,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:f!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(G,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(j,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[r&&!C&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(lt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(yt,{state:r?t.state:"idle",ready:c,atPose:m,disabled:a,onMoveStart:()=>{r&&t.onMoveStart(r.pose)},onMoveStop:t.onMoveStop,stopRef:v})]})]})}const Et=U.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:r,onTabChange:l,jogMode:u,onJogModeChange:x,...i})=>{const{t:g}=w.useTranslation(),C=i.disabled??!1,[f,c]=b.useState("translate"),[m,R]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),v=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=r??f,S=v.includes(M)?M:v[0],q=It(m,u,i.increments),h=g("RobotControl.Title.ti");function y(p){c(p),l==null||l(p)}function A(p){var E,B,H;R(p),p.mode!==q.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(E=i.increments)==null?void 0:E.steps[k][p.step[k]];p.step[k]!==q.step[k]&&O!==void 0&&((H=(B=i.increments)==null?void 0:B.onStepChange)==null||H.call(B,k,O))}}return e.jsxs(j,{"data-testid":"robot-control-panel",sx:[p=>{var E;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(E=p.palette.backgroundPaperElevation)==null?void 0:E[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(j,{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:h}),t&&e.jsx(W,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs($,{value:S??!1,onChange:(p,E)=>y(E),"aria-label":h,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(j,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(vt,{joints:n,disabled:C||a}):S==="moveTo"&&s?e.jsx(qt,{moveTo:s,tcp:i.tcp,velocity:i.velocity.translate,onVelocityChange:p=>i.onVelocityChange("translate",p),disabled:C}):S==="translate"||S==="rotate"?e.jsx(Ct,{...i,disabled:C||a,motion:S,settings:q,onSettingsChange:A}):null})]})});function It(t,o,n){const s=a=>{var l;const d=(l=n==null?void 0:n.step)==null?void 0:l[a];if(d===void 0)return t.step[a];const r=n==null?void 0:n.steps[a].findIndex(u=>Math.abs(u-d)<=1e-9*Math.max(1,Math.abs(u)));return r===void 0||r<0?t.step[a]:r};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"),W=require("@mui/material/IconButton"),j=require("@mui/material/Stack"),z=require("@mui/material/Tab"),$=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),U=require("./externalizeComponent-BW1UV6Gh.cjs"),L=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),K=require("@wandelbots/icons/Jog"),Q=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-BJ3wDpAJ.cjs"),Z=require("./JoggingButtons-nXLqJLIr.cjs"),tt=require("./useWebGLRenderer-CtddVDDb.cjs"),et=require("@mui/material/styles"),N=require("@mui/material/ToggleButton"),ot=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-891OscPu.cjs"),nt=require("@mui/material/Slider"),rt=require("./JoggingJointSlider-D7AsxkrT.cjs"),lt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),st=require("@wandelbots/icons/NorthEastFilled"),at=require("./joggingColors-ZDc_2UCp.cjs"),X=require("@wandelbots/icons/CheckFilled"),it=require("@wandelbots/icons/ContentCopyFilled"),ct=require("@wandelbots/icons/EditFilled");function ut({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:r}=w.useTranslation(),[l,u]=b.useState(tt.isWebGLAvailable),x=a!==void 0&&l,i=t==="gizmo"&&x,g=r(i?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),C=r(i?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(j,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[x&&e.jsx(P,{title:C,placement:"left",children:e.jsx(W,{"aria-label":C,onClick:()=>o(i?"buttons":"gizmo"),size:"small",sx:f=>{var c;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${f.palette.divider}`,background:(c=f.palette.backgroundPaperElevation)==null?void 0:c[11]}},children:i?e.jsx(Q.ViewModuleFilled,{}):e.jsx(K.Jog,{})})}),i?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180,onWebGLUnavailable:()=>u(!1)}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:g})]})}const dt=et.styled(ot)(({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 xt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(dt,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(N,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(N,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(j,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function pt(t){return t*180/Math.PI}function bt(t){return t*Math.PI/180}function V(t,o){return t==="rotate"?pt(o):o}function gt(t,o){return t==="rotate"?bt(o):o}function ft(t,o){const n=String(Number(V(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ht(t,o){const n=Math.round(V(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function G({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),r=l=>V(t,l);return e.jsxs(j,{gap:"4px",children:[e.jsxs(j,{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:ht(t,o.value)})]}),e.jsx(nt,{"aria-labelledby":d,size:"small",value:Math.round(r(o.value)),min:Math.ceil(r(o.min)),max:Math.floor(r(o.max)),disabled:s,onChange:(l,u)=>{typeof u=="number"&&n(gt(t,u))},sx:l=>{var u;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${l.palette.primary.main}`,backgroundColor:(u=l.palette.backgroundPaperElevation)==null?void 0:u[5]}}}})]})}function Ct({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:r,onVelocityChange:l,onJogStart:u,onJogStop:x,increments:i,gizmoOrientation:g,gizmoFrameQuaternion:C}){const{t:f}=w.useTranslation(),c=i?o.mode:"continuous",m=(i==null?void 0:i.steps[t])??[],R=Math.min(o.step[t],m.length-1),v=m[R],M=b.useRef(!1);function S(h,y){if(c==="increment"){i&&v!==void 0&&i.onStep(t,h,y,v);return}M.current=!0,u(t,h,y)}function q(){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(j,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:f("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:f("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(L,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[i&&e.jsx(xt,{value:c,onChange:h=>n({...o,mode:h}),disabled:s}),e.jsx(G,{motion:t,velocity:r[t],onChange:h=>l(t,h),disabled:s}),c==="increment"&&v!==void 0&&e.jsx(T.InlineSelect,{label:f("RobotControl.StepSize.lb"),value:String(R),options:m.map((h,y)=>({id:String(y),label:ft(t,h)})),onChange:h=>n({...o,step:{...o.step,[t]:Number(h)}}),disabled:s})]}),e.jsx(L,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ut,{view:o.view,onViewChange:h=>n({...o,view:h}),mode:c,controls:{motion:t,onJogStart:S,onJogStop:q,activeHandle:c==="increment"?i==null?void 0:i.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:C},c)})]})}function vt({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(l,u){n.current!==null&&n.current!==l||(n.current=l,a(l),t.onJogStart(l,u))}function r(l){n.current===l&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(j,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((l,u)=>e.jsx(rt.JoggingJointSlider,{label:`J${u+1}`,name:l.name,value:l.value,min:l.min,max:l.max,linear:t.linear,onJogStart:x=>d(u,x),onJogStop:()=>r(u),disabled:o||s!==null&&s!==u},u))})}),e.jsx(L,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(G,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,mt=.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&&Tt(t.orientation,o.orientation)<=mt:!1}function _(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 Tt(t,o){const n=_(t),s=_(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 Mt="move",St=200;function yt({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:r}){const{t:l}=w.useTranslation(),[u,x]=b.useState(!1),i=b.useRef(void 0),g=b.useRef(!1),C=b.useRef({onMoveStart:a,onMoveStop:d});C.current={onMoveStart:a,onMoveStop:d};const f=t==="planned",c=f||t==="moving",{handlersFor:m,stop:R}=at.useHold({onStart:()=>{x(!0),i.current=setTimeout(()=>{i.current=void 0,g.current=!0,C.current.onMoveStart()},St)},onStop:()=>{x(!1),clearTimeout(i.current),i.current=void 0,g.current&&(g.current=!1,C.current.onMoveStop())},disabled:u?s||!o||!c:s||!o||n||!f,isSame:()=>!0});r&&(r.current=R),b.useEffect(()=>()=>clearTimeout(i.current),[]);const v=l(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:l(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...m(Mt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!c,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(st.NorthEastFilled,{}),"aria-pressed":u,children:v})})})}function wt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:r,error:l,disabled:u}){const{t:x}=w.useTranslation(),i=b.useRef(null),{copied:g,copy:C}=T.useCopyText();b.useEffect(()=>{const c=i.current;c&&(o?(c.focus(),c.setSelectionRange(c.value.length,c.value.length)):document.activeElement===c&&(c.blur(),c.scrollLeft=0))},[o]);function f(){return C(t,()=>{var c;return(c=i.current)==null?void 0:c.select()})}return e.jsxs(j,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:i,onChange:c=>s(c.target.value),onClick:()=>{!o&&!u&&n()},onKeyDown:c=>{o&&(c.key==="Enter"&&r?d():c.key==="Escape"&&a())},error:!!l,helperText:l??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||u?void 0:"text"}}}),e.jsx(j,{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(X.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!r,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(X.CheckFilled,{}):e.jsx(it.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void f()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(ct.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:u})]})})]})}function qt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var A;const{t:d}=w.useTranslation(),[r,l]=b.useState(null),[u,x]=b.useState(null),i=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},r===null&&u===null),g=(r==null?void 0:r.text)??i,C=u!==null,f=u===null?null:T.parsePoseText(u),c=r!==null&&!t.error&&!C,m=T.useEveryFrame(()=>r!==null&&Rt(t.getCurrentPose(),r.pose),c)&&c,R=b.useRef(!1),v=b.useRef(null);function M(){var p;(p=v.current)==null||p.call(v),R.current=!1,l(null),x(null),t.onTargetChange(null)}function S(){f===null||a||(R.current=!1,l({pose:f,text:T.poseToText(f)}),x(null),t.onTargetChange(f))}b.useEffect(()=>{if(c){if(t.state==="moving"){R.current=!0;return}R.current&&m&&t.state!=="stopping"&&M()}},[c,t.state,m]);const q=[o==null?void 0:o.value,(A=t.frame)==null?void 0:A.value].join("\0");b.useEffect(()=>{r&&M()},[q]);const h=b.useRef({target:r,onTargetChange:t.onTargetChange});h.current={target:r,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=v.current)==null||p.call(v),h.current.target&&h.current.onTargetChange(null)},[]);const y=u!==null?f===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:r?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(j,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(wt,{text:u??g,editing:C,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:f!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(G,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(j,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[r&&!C&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(lt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(yt,{state:r?t.state:"idle",ready:c,atPose:m,disabled:a,onMoveStart:()=>{r&&t.onMoveStart(r.pose)},onMoveStop:t.onMoveStop,stopRef:v})]})]})}const Et=U.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:r,onTabChange:l,jogMode:u,onJogModeChange:x,...i})=>{const{t:g}=w.useTranslation(),C=i.disabled??!1,[f,c]=b.useState("translate"),[m,R]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),v=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=r??f,S=v.includes(M)?M:v[0],q=It(m,u,i.increments),h=g("RobotControl.Title.ti");function y(p){c(p),l==null||l(p)}function A(p){var E,B,H;R(p),p.mode!==q.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(E=i.increments)==null?void 0:E.steps[k][p.step[k]];p.step[k]!==q.step[k]&&O!==void 0&&((H=(B=i.increments)==null?void 0:B.onStepChange)==null||H.call(B,k,O))}}return e.jsxs(j,{"data-testid":"robot-control-panel",sx:[p=>{var E;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(E=p.palette.backgroundPaperElevation)==null?void 0:E[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(j,{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:h}),t&&e.jsx(W,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs($,{value:S??!1,onChange:(p,E)=>y(E),"aria-label":h,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(j,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(vt,{joints:n,disabled:C||a}):S==="moveTo"&&s?e.jsx(qt,{moveTo:s,tcp:i.tcp,velocity:i.velocity.translate,onVelocityChange:p=>i.onVelocityChange("translate",p),disabled:C}):S==="translate"||S==="rotate"?e.jsx(Ct,{...i,disabled:C||a,motion:S,settings:q,onSettingsChange:A}):null})]})});function It(t,o,n){const s=a=>{var l;const d=(l=n==null?void 0:n.step)==null?void 0:l[a];if(d===void 0)return t.step[a];const r=n==null?void 0:n.steps[a].findIndex(u=>Math.abs(u-d)<=1e-9*Math.max(1,Math.abs(u)));return r===void 0||r<0?t.step[a]:r};return{...t,mode:o??t.mode,step:{translate:s("translate"),rotate:s("rotate")}}}exports.RobotControlPanel=Et;
@@ -18,7 +18,7 @@ import { i as it } from "./useWebGLRenderer-BozrbZz-.js";
18
18
  import { styled as ct } from "@mui/material/styles";
19
19
  import K from "@mui/material/ToggleButton";
20
20
  import st from "@mui/material/ToggleButtonGroup";
21
- import { P as N, I as ut, c as pt, u as Q, b as U, a as dt } from "./useEveryFrame-DAuNawGP.js";
21
+ import { P as N, I as ut, c as pt, u as Q, b as U, a as dt } from "./useEveryFrame-D9oux4jW.js";
22
22
  import ft from "@mui/material/Slider";
23
23
  import { J as bt } from "./JoggingJointSlider-DQneQhXH.js";
24
24
  import { Undo as gt } from "@wandelbots/icons/Undo";
@@ -57,7 +57,7 @@ import ot from "lodash-es/keyBy.js";
57
57
  import Ue from "lodash-es/uniqueId.js";
58
58
  import { p as wt, q as ze, P as We } from "./Pose3-B_fLR-Wv.js";
59
59
  import { R as He, b as qe } from "./robotActivationOf-DUbbBf7J.js";
60
- import { j as Tt, b as xt, p as Ye, a as Ke } from "./useEveryFrame-DAuNawGP.js";
60
+ import { j as Tt, b as xt, p as Ye, a as Ke } from "./useEveryFrame-D9oux4jW.js";
61
61
  const vn = tt(
62
62
  P((o) => {
63
63
  const {
@@ -2210,7 +2210,7 @@ const oe = P(
2210
2210
  }
2211
2211
  }
2212
2212
  async function g() {
2213
- o.isLocked || o.activeDiscreteIncrement || (n.current++, await o.deactivate());
2213
+ o.activeDiscreteIncrement || (n.current++, await o.deactivate());
2214
2214
  }
2215
2215
  const h = [
2216
2216
  {
@@ -1,3 +1,3 @@
1
- "use strict";const s=require("react/jsx-runtime"),ae=require("@mui/material/AppBar"),Ot=require("@mui/material/Backdrop"),F=require("@mui/material/Box"),le=require("@mui/material/Menu"),z=require("@mui/material/MenuItem"),ce=require("@mui/material/Toolbar"),M=require("@mui/material/Typography"),de=require("@wandelbots/design-tokens"),ge=require("@wandelbots/icons/ExpandMoreFilled"),ue=require("@wandelbots/mui"),w=require("mobx-react-lite"),E=require("react"),Q=require("./externalizeComponent-BW1UV6Gh.cjs"),he=require("@mui/icons-material/OpenWith"),pe=require("@mui/icons-material/Share"),x=require("@mui/material/Stack"),me=require("@mui/material/Tab"),fe=require("@mui/material/Tabs"),m=require("mobx"),$=require("react-i18next"),Rt=require("@mui/material/CircularProgress"),ye=require("@mui/material/utils"),kt=require("lodash-es"),Se=require("./robotSafetyOf-Y4NuRInk.cjs"),je=require("@mui/material/Alert"),be=require("@mui/material/AlertTitle"),ct=require("@mui/material/Button"),B=require("@mui/material/styles"),W=require("@mui/material/Divider"),bt=require("@mui/material/ToggleButton"),I=require("@wandelbots/nova-js"),st=require("@mui/material/IconButton"),b=require("./PoseTransformer-dP4nzrPG.cjs"),H=require("./joggingColors-ZDc_2UCp.cjs"),At=require("lodash-es/isEqual.js"),ve=require("@mui/material/InputAdornment"),xe=require("@mui/material/FormControl"),_e=require("@mui/material/InputLabel"),Ie=require("@mui/material/Select"),Ee=require("@mui/material/ToggleButtonGroup"),Pt=require("@mui/material/Slider"),Ce=require("lodash-es/isNumber.js"),V=require("@wandelbots/nova-js/v2"),Te=require("@mui/icons-material/ChevronLeft"),Me=require("@mui/icons-material/ChevronRight"),we=require("lodash-es/throttle.js"),Oe=require("@mui/material/Dialog"),Re=require("@mui/material/DialogActions"),ke=require("@mui/material/DialogContent"),Ae=require("@mui/material/DialogTitle"),q=require("three"),Jt=require("./converters-BsXgcxCW.cjs"),ot=require("lodash-es/keyBy.js"),Pe=require("lodash-es/uniqueId.js"),nt=require("./Pose3-Ch4xVeXV.cjs"),vt=require("./robotActivationOf-BCKyEgny.cjs"),U=require("./useEveryFrame-CHxg25f4.cjs");function Dt(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const v=Dt(E),xt=Dt(q),Je=Q.externalizeComponent(w.observer(o=>{const{appIcon:t,appName:e,apps:i=[],onAppSelect:n,disabled:r=!1,sx:l}=o,[a,g]=E.useState(null),u=!!a,h=c=>{g(c.currentTarget)},p=()=>{g(null)},d=c=>{p(),c.onClick?c.onClick():c.href&&(window.location.href=c.href),n==null||n(c)};return s.jsxs(s.Fragment,{children:[s.jsx(ae,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...l},children:s.jsxs(ce,{sx:{minHeight:"62px !important"},children:[s.jsx(F,{sx:{mr:1,display:"flex",alignItems:"center"},children:t}),s.jsxs(F,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[s.jsx(M,{component:"h1",variant:"subtitle1",children:e}),i.length>0&&s.jsx(ue.RoundedIconButton,{icon:s.jsx(ge.ExpandMoreFilled,{size:20}),ariaLabel:"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:h,disabled:r,sx:{ml:1}})]})]})}),s.jsx(Ot,{open:u,onClick:p,sx:{backdropFilter:"blur(4px)",backgroundColor:de.ZeroGravityComponentsBackdropFill,zIndex:c=>c.zIndex.modal-1}}),s.jsx(le,{id:"app-menu",anchorEl:a,open:u,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:c=>c.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:i.map(c=>s.jsxs(z,{onClick:()=>d(c),children:[s.jsx(F,{sx:{display:"flex",alignItems:"center"},children:c.icon}),s.jsx(M,{variant:"body1",sx:{ml:2},children:c.name})]},c.id))})]})})),De=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("g",{id:"JogMinus"},v.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),Le=E.forwardRef(De),Ne=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("g",{id:"JogPlus"},v.createElement("g",{id:"Plus"},v.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),v.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),v.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),Ve=E.forwardRef(Ne),dt=Q.externalizeComponent(w.observer(({colors:o,label:t,getDisplayedValue:e,startJogging:i,stopJogging:n,disabled:r,activeJoggingDirection:l,...a})=>{var O,R,k,C,A,N,G;b.useAnimationFrame(()=>{const D=e(),L=d.current;L&&(L.textContent=D)});const g=B.useTheme(),[u,h]=E.useState(null);E.useEffect(()=>{r&&T()},[r]);const p=l||u,d=E.useRef(null);o||(o={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const c=p?(O=o.buttonBackgroundColor)==null?void 0:O.pressed:o.borderColor,f={width:"55px",color:o.color,path:{fill:o.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},y={...f,backgroundColor:(R=o.buttonBackgroundColor)==null?void 0:R.default,":hover":{backgroundColor:(k=o.buttonBackgroundColor)==null?void 0:k.hovered},":active":{backgroundColor:(C=o.buttonBackgroundColor)==null?void 0:C.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor}},":disabled":{backgroundColor:(A=o.buttonBackgroundColor)==null?void 0:A.disabled,"svg path":{fill:g.palette.action.disabled}}},j={...f,backgroundColor:(N=o.buttonBackgroundColor)==null?void 0:N.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor},":disabled":{backgroundColor:(G=o.buttonBackgroundColor)==null?void 0:G.pressed,"svg path":{fill:g.palette.action.disabled}}};function _(D,L){r||D.button===0&&(h(L),i(L))}function T(){h(null),n()}return s.jsxs(x,{height:"64px",direction:"row",justifyContent:"center",...a,children:[s.jsx(st,{disabled:r,disableRipple:!0,onPointerDown:D=>_(D,"-"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="-"?j:y,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${c??"#fff"}`,borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:s.jsx(Le,{})}),s.jsxs(x,{spacing:"6px",sx:{width:"150px",backgroundColor:o.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:[s.jsx(x,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:o.color,".MuiTypography-root":{fontWeight:700,...r?{color:g.palette.action.disabled}:{}},...r?{"svg path":{fill:g.palette.action.disabled}}:{}},children:t}),s.jsx(M,{height:"22px",sx:{fontSize:"15px",color:r?g.palette.action.disabled:o.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:d,children:e()})]}),s.jsx(st,{disableRipple:!0,disabled:r,onPointerDown:D=>_(D,"+"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="+"?j:y,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${c??"#fff"}`,borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:s.jsx(Ve,{})})]})})),Lt=Q.externalizeComponent(w.observer(({startJogging:o,stopJogging:t,lowerLimit:e,upperLimit:i,useDegree:n,getValue:r,disabled:l,...a})=>{var C,A,N,G,D,L,et;const{t:g}=$.useTranslation(),[u,h]=E.useState(),p=B.useTheme(),d={background:(C=p.palette.backgroundPaperElevation)==null?void 0:C[4],color:(A=p.palette.backgroundPaperElevation)==null?void 0:A[11]},c=w.useLocalObservable(()=>({activeJoggingDir:null,startJogging(S){this.activeJoggingDir=S,o(S)},stopJogging(){this.activeJoggingDir=null,t()}})),f=we(()=>{const S=n?y(r()):r();(S===void 0||u===void 0||Math.abs(u-S)>1e-9)&&h(S)},50);b.useAnimationFrame(f);function y(S){if(S!==void 0)return I.radiansToDegrees(S)}function j(S){S.button===0&&c.startJogging("-")}function _(S){S.button===0&&c.startJogging("+")}function T(S){c.stopJogging()}function O(S){c.stopJogging()}function R(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.degree.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}function k(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.mm.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}return s.jsxs(x,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...a,sx:{"& .MuiIconButton-root":{width:"52px",color:p.palette.text.primary,alignContent:"center",backgroundColor:(N=p.palette.backgroundPaperElevation)==null?void 0:N[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(G=p.palette.backgroundPaperElevation)==null?void 0:G[11],color:p.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(D=p.palette.backgroundPaperElevation)==null?void 0:D[9]},"&:active":{...d}}},children:[s.jsx(st,{onPointerDown:j,onPointerUp:T,onPointerOut:O,disabled:l,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...c.activeJoggingDir==="-"?d:{}},children:s.jsx(Te,{sx:{pointerEvents:"none",color:H.jointArrowColor}})}),s.jsxs(x,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(L=p.palette.backgroundPaperElevation)==null?void 0:L[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[s.jsx(M,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:l?p.palette.action.disabled:p.palette.text.primary},children:n?R(u):k(u)}),s.jsx(Pt,{disabled:!0,"aria-label":"Joint position",min:n?y(e):e,max:n?y(i):i,value:u||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:l?p.palette.action.disabled:p.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:l?p.palette.action.disabled:p.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(et=p.palette.backgroundPaperElevation)==null?void 0:et[5],opacity:1}},marks:e!==void 0&&i!==void 0&&[{value:n?y(e):e,label:n?R(y(e),0):k(e)},{value:n?y(i):i,label:n?R(y(i),0):k(i)}]})]}),s.jsx(st,{onPointerDown:_,onPointerUp:T,onPointerOut:O,disabled:l,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...c.activeJoggingDir==="+"?d:{}},children:s.jsx(Me,{sx:{pointerEvents:"none",color:H.jointArrowColor}})})]})}));function $e({currentTcpPose:o,axis:t,direction:e,motion:i,useToolCoordinateSystem:n,coordinateSystemRotation:r}){const l=e==="-"?-1:1;if(i.type==="translate"){if(!o.position)throw new Error("Current pose has no position, cannot perform translation");const p=i.distanceMm*l,d=new q.Vector3;if(d[t]=p,n){if(!o.orientation)throw new Error("Current pose has no orientation, cannot translate relative to tool");d.applyQuaternion(nt.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"))}else r&&d.applyQuaternion(r);const c=[...o.position];return c[0]=(c[0]??0)+d.x,c[1]=(c[1]??0)+d.y,c[2]=(c[2]??0)+d.z,{position:c,orientation:o.orientation}}if(!o.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const a=nt.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"),g=new q.Vector3;g[t]=1,!n&&r&&g.applyQuaternion(r);const u=new q.Quaternion().setFromAxisAngle(g,i.distanceRads*l),h=n?a.multiply(u):u.multiply(a);return{position:o.position,orientation:[...nt.quaternionToRotationVector(h)]}}function Z(o,t,e){return t.length!==o.length?!1:Nt(o,t,e)}function ut(o,t,e){return t.length!==o.length?!0:Nt(o,t,e)}function Nt(o,t,e){for(let i=0;i<t.length;i++)if(Math.abs((t[i]??0)-(o[i]??0))>e)return!1;return!0}function Vt(o,t,e){if(o===void 0&&t||o&&t===void 0||(o==null?void 0:o.orientation)===void 0||(t==null?void 0:t.orientation)===void 0||(o==null?void 0:o.position)===void 0||(t==null?void 0:t.position)===void 0)return!1;if(o===void 0||t===void 0)return!0;let i=0;return i+=Math.abs(o.orientation[0]-t.orientation[0]),i+=Math.abs(o.orientation[1]-t.orientation[1]),i+=Math.abs(o.orientation[2]-t.orientation[2]),i+=Math.abs(o.position[0]-t.position[0]),i+=Math.abs(o.position[1]-t.position[1]),i+=Math.abs(o.position[2]-t.position[2]),i<=e}function ht(o,t,e){return o.coordinate_system===t.coordinate_system&&o.tcp===t.tcp&&Vt(o.tcp_pose,t.tcp_pose,e)}function pt(o,t){const e=new q.Vector3(t[0],t[1],t[2]),i=new q.Vector3(o[0],o[1],o[2]),n=e.length(),r=e.normalize();let l=i.length(),a=i.normalize();a.dot(r)<0&&(l=-l,a=a.multiplyScalar(-1));let g=l-n;return g-=2*Math.PI*Math.floor((g+Math.PI)/(2*Math.PI)),l=n+g,[...a.multiplyScalar(l)]}const Fe=2e-4;function mt(o){const{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}=o;return{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}}function ft(o,t){return o.tcp===t.tcp&&o.coordinate_system===t.coordinate_system&&o.tcp_pose===void 0==(t.tcp_pose===void 0)&&Z(o.joint_position,t.joint_position,Fe)}const _t=1e-4;class X{constructor(t,e,i,n,r,l,a="cell",g={}){this.controller=e,this.motionGroup=i,this.description=n,this.initialMotionState=r,this.motionStateSocket=l,this.cellId=a,this.nova=b.createNovaClient(t),this.logger=g.logger??console,this.rapidlyChangingMotionState=r,l.addEventListener("message",u=>{var c;const h=(c=I.tryParseJson(u.data))==null?void 0:c.result;if(!h)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${u.data}`);ht(this.rapidlyChangingMotionState,h,_t)||m.runInAction(()=>{var f,y,j;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=h.tcp_pose:(f=h.tcp_pose)!=null&&f.orientation&&((y=h.tcp_pose)!=null&&y.position)&&((j=this.rapidlyChangingMotionState.tcp_pose)!=null&&j.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:h.tcp_pose.position,orientation:pt(h.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:this.logger.debug("Received incomplete tcp_pose, ignoring",{tcpPose:h.tcp_pose})}),ut(this.rapidlyChangingMotionState.joint_position,h.joint_position,_t)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=h.joint_position}),h.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==h.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=h.tcp}),this.rapidlyChangingMotionState.standstill!==h.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=h.standstill});const p=this.rapidlyChangingMotionState.joint_limit_reached.limit_reached,d=h.joint_limit_reached.limit_reached;p.some((f,y)=>f!==d[y])&&m.runInAction(()=>{this.rapidlyChangingMotionState.joint_limit_reached=h.joint_limit_reached}),this.rapidlyChangingMotionState.execute!==h.execute&&m.runInAction(()=>{this.rapidlyChangingMotionState.execute=h.execute})}),m.makeAutoObservable(this,{logger:!1,readoutState:m.computed({equals:ft,keepAlive:!0})})}static async open(t,e,i={}){var y;const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t)??"cell",[l,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(j=>j.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const h=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await h.firstMessage(),d=(y=I.tryParseJson(p.data))==null?void 0:y.result;if(!d)throw new Error(`Unable to parse initial motion state message ${p.data}`);const c=i.logger??console;c.info("Connected motion state websocket to motion group",{motionGroup:u.motion_group,initialMotionState:d});const f=await n.api.motionGroup.getMotionGroupDescription(r,a,u.motion_group);return new X(n,g,u,f,d,h,r,{logger:c})}get readoutState(){return mt(this.rapidlyChangingMotionState)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get joints(){return this.initialMotionState.joint_position.map((t,e)=>({index:e}))}dispose(){this.motionStateSocket.close()}}const It="Movement request rejected. Another client is currently executing a 'Jogging' motion!",Be=500,Ge=5e3;function qe(o){var e;return(((e=o.times)==null?void 0:e[o.times.length-1])??0)*2e3+Ge}class tt{constructor(t,e={}){this.motionStream=t,this.options=e,this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",this.NO_TCP=void 0,this.DEFAULT_INIT_TIMEOUT=5e3,this.DEFAULT_ORIENTATION="coordsys",this.mode="off",this.joggingSocket=null,this.trajectorySocket=null,this.timeout=this.DEFAULT_INIT_TIMEOUT,this.incrementalMotionInFlight=!1,this.ownsMotionStream=!1,this.tcp=(e==null?void 0:e.tcp)||t.motionGroup.tcp||this.getDefaultTcp(t),this.coordinateSystem=e==null?void 0:e.coordinateSystem,this.orientation=(e==null?void 0:e.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(e==null?void 0:e.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(e==null?void 0:e.mode)||this.DEFAULT_MODE,this.onError=e==null?void 0:e.onError,this.logger=(e==null?void 0:e.logger)??console}static async open(t,e,i={}){const n=await X.open(t,e,{cellId:i.cellId,logger:i.logger}),r=new tt(n,i);r.ownsMotionStream=!0;try{await r.setJoggingMode(r.mode)}catch(l){throw r.dispose(),l}return r}getDefaultTcp(t){var i,n;const e=(n=(i=t.description.dh_parameters)==null?void 0:i[0])==null?void 0:n.type;return t.joints.length<6&&(e===V.JointTypeEnum.RevoluteJoint||e===V.JointTypeEnum.PrismaticJoint)?this.NO_TCP:this.DEFAULT_TCP}async setOptions(t){return t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),"coordinateSystem"in t&&(this.coordinateSystem=t.coordinateSystem),t.timeout&&(this.timeout=t.timeout),t.mode&&(this.mode=t.mode),t.onError&&(this.onError=t.onError),this.setJoggingMode(this.mode,!1)}get motionGroupId(){return this.motionStream.motionGroupId}get nova(){return this.motionStream.nova}get cellId(){return this.motionStream.cellId}get numJoints(){return this.motionStream.joints.length}async stop(){if(this.joggingSocket){const t=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:t})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const t=this.closeJoggingSockets();return this.ownsMotionStream&&this.motionStream.dispose(),t}closeJoggingSockets(){var e,i;(e=this.endJoggingInit)==null||e.call(this),(i=this.endIncrementalMotion)==null||i.call(this);const t=[this.joggingSocket,this.trajectorySocket].filter(n=>n!==null);return t.forEach(n=>{n.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(t.map(n=>n.closed()))}async setJoggingMode(t,e=!0){if(!(this.mode===t&&e)&&(this.closeJoggingSockets(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,e)=>{const i=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`);this.joggingSocket=i;let n=!1;const r=setTimeout(()=>{l(new Error(`Jogging initialization timeout after ${this.timeout} ms`))},this.timeout),l=u=>{n||(n=!0,clearTimeout(r),i.removeEventListener("close",g),this.endJoggingInit===a&&(this.endJoggingInit=void 0),u?e(u):t())},a=()=>l(),g=()=>{i.disposed&&l()};this.endJoggingInit=a,i.addEventListener("close",g),i.addEventListener("message",u=>{var p,d,c;const h=I.tryParseJson(u.data);if(((p=h==null?void 0:h.result)==null?void 0:p.kind)==="INITIALIZE_RECEIVED"){l();return}if(((d=h==null?void 0:h.result)==null?void 0:d.kind)==="MOTION_ERROR")if(this.onBlocked&&((c=h==null?void 0:h.result)!=null&&c.message.includes(It))){l(),i.dispose(),this.onBlocked();return}else this.onError?(l(),this.onError(u.data)):l(new Error(u.data))}),i.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,...this.tcp?{tcp:this.tcp}:{}})})}async rotateJoints({joint:t,direction:e,velocityValue:i,velocityUnit:n}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const r=new Array(this.numJoints).fill(0);r[t]=e==="-"?-i:i,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:r})}async translateTCP({axis:t,direction:e,velocityMmPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:this.velocityAlongAxis(t,e==="-"?-i:i),rotation:[0,0,0],use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:e,velocityRadsPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:[0,0,0],rotation:this.velocityAlongAxis(t,e==="-"?-i:i),use_tool_coordinate_system:this.orientation==="tool"})}get coordinateSystemRotation(){if(!(this.orientation==="tool"||!this.coordinateSystem))return nt.Pose3.fromCoordinateSystem(this.coordinateSystem).quaternion}velocityAlongAxis(t,e){const i=new q.Vector3;i[t]=e;const n=this.coordinateSystemRotation;return n&&i.applyQuaternion(n),[i.x,i.y,i.z]}async runIncrementalCartesianMotion(t){if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(!this.incrementalMotionInFlight){this.incrementalMotionInFlight=!0;try{const e=await this.planIncrementalCartesianMotion(t);e&&await this.executeTrajectory(e)}finally{this.incrementalMotionInFlight=!1}}}async planIncrementalCartesianMotion({currentTcpPose:t,currentJoints:e,velocityInRelevantUnits:i,axis:n,direction:r,motion:l}){var y,j,_;const a=[],g=$e({currentTcpPose:t,axis:n,direction:r,motion:l,useToolCoordinateSystem:this.orientation==="tool",coordinateSystemRotation:this.coordinateSystemRotation});a.push({limits_override:l.type==="translate"?{tcp_velocity_limit:i}:{tcp_orientation_velocity_limit:i},path:{path_definition_name:"PathLine",target_pose:{position:g.position,orientation:g.orientation}}});const u=this.motionStream.description;if(u.cycle_time===void 0){this.logger.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const h=this.motionStream.rapidlyChangingMotionState.tcp,p=h?(j=(y=u.tcps)==null?void 0:y[h])==null?void 0:j.pose:void 0,d={motion_group_model:((_=this.options)==null?void 0:_.motionGroupModel)??u.motion_group_model,cycle_time:u.cycle_time,mounting:u.mounting,tcp_offset:p,global:u.operation_limits.auto_limits},c=await this.nova.api.trajectoryPlanning.planTrajectory(this.cellId,{motion_group_setup:d,start_joint_position:e,motion_commands:a}),f=c.response;if(!f)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(c)}`);if("error_feedback"in f){if(this.onError){this.onError(f);return}throw new Error(`Failed to plan jogging increment motion: ${JSON.stringify(f.error_feedback)}`)}return f}async executeTrajectory(t){const e=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);this.trajectorySocket=e;const i=new AbortController;let n,r;try{await new Promise((l,a)=>{let g=!1;const u=()=>{g||(g=!0,l())},h=d=>{if(!g){if(g=!0,this.onError){this.onError(d),l();return}a(d instanceof Error?d:new Error(`Failed to execute trajectory: ${JSON.stringify(d)}`))}};r=u,this.endIncrementalMotion=u;const p=qe(t);n=setTimeout(()=>{h(new Error(`Jogging motion did not complete within ${p}ms`))},p),e.addEventListener("message",d=>{var f,y;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;if(!(c!=null&&c.kind)){h(new Error(`Failed to execute trajectory: Received invalid message ${d.data}`));return}if(this.onBlocked&&((y=c.message)!=null&&y.includes(It))){this.onBlocked(),u();return}if(c.kind==="INITIALIZE_RECEIVED"){if(c.add_trajectory_error||c.message){h(c);return}e.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})}else if(c.kind==="START_RECEIVED"){if(c.message){h(c);return}this.waitForMotionToFinish(i.signal).then(u,h)}else c.kind==="PAUSE_RECEIVED"||(c.kind==="MOTION_ERROR"&&c.message?h(c):h(new Error(`Failed to execute trajectory, cannot handle message type "${c.kind}"`)))}),e.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:t,tcp:this.tcp}})})}finally{clearTimeout(n),i.abort(),this.endIncrementalMotion===r&&(this.endIncrementalMotion=void 0),e.dispose(),this.trajectorySocket===e&&(this.trajectorySocket=null)}}async waitForMotionToFinish(t){const e=()=>this.motionStream.rapidlyChangingMotionState.standstill;await m.when(()=>!e(),{timeout:Be,signal:t}).catch(()=>{}),await m.when(e,{signal:t})}}const $t=o=>{const t=o.softTimeout||3e3,[e,i]=E.useState(!1);return E.useEffect(()=>{const n=setTimeout(()=>{i(!0)},t);return()=>clearTimeout(n)}),s.jsx(x,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:"text.primary"},children:o.error?s.jsx(Ft,{loadingMessage:o.message,error:o.error}):s.jsxs(s.Fragment,{children:[s.jsx(Rt,{sx:{mb:3}}),!!o.message&&s.jsx(M,{variant:"body1",children:o.message}),s.jsx(M,{variant:"body2",sx:{visibility:e?"visible":"hidden",mt:2,color:"text.secondary"},children:"This is taking longer than expected..."})]})})},Ft=o=>{const t=Se.makeErrorMessage(o.error),e=o.error instanceof Error?o.error.stack:null;return s.jsxs(x,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",p:2,overflow:"auto",color:"error.main"},children:[s.jsx(M,{variant:"body1",children:(o.loadingMessage?`Error while ${kt.lowerFirst(ye.capitalize(o.loadingMessage))} - `:"")+t}),e&&s.jsx(F,{component:"pre",sx:{typography:"body2",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",mt:2,pb:6},children:e})]})},Ue=w.observer(({store:o})=>{const{t}=$.useTranslation();return s.jsx(Ot,{"data-testid":"jogging-blocked","aria-label":"jogging-blocked",open:!0,sx:{position:"absolute",zIndex:e=>e.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:s.jsxs(x,{sx:{m:2,width:"100%"},children:[s.jsxs(je,{severity:"error",sx:{mb:2},children:[s.jsx(be,{children:t("Jogging.Blocked.ti")}),t("Jogging.Blocked.lb")]}),s.jsx(ct,{variant:"contained",color:"secondary",onClick:()=>o.unblock(),children:t("Jogging.Blocked.Reenable.bt")})]})})}),ze=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),We=E.forwardRef(ze),He=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),Ye=E.forwardRef(He),Ke=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M9.522 14.811A.899.899 0 1 0 8.25 13.54L6.19 15.601V3.16L8.25 5.221A.9.9 0 0 0 9.522 3.95L5.926.354a.9.9 0 0 0-1.272 0L1.058 3.95a.9.9 0 1 0 1.271 1.271L4.391 3.16v12.442L2.329 13.54a.899.899 0 1 0-1.271 1.271l3.596 3.597a.9.9 0 0 0 1.272 0z",clipRule:"evenodd"})),Qe=E.forwardRef(Ke),Ze=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{d:"M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C11.0583 14.1 12.5083 12.1667 11.475 12.9L12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z",fill:"white"})),Xe=E.forwardRef(Ze),Bt=w.observer(({store:o})=>{const{t}=$.useTranslation(),[e,i]=E.useState(o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),n=E.useRef(e);b.useAnimationFrame(()=>{const l=o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;At(n.current,l)||(n.current=l,i(l))});const r=[];for(const[l,a]of e.entries())a&&r.push(l);return s.jsx(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"center"},children:s.jsx(M,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2,visibility:r.length?"visible":"hidden"},children:t("Jogging.JointLimitsReached.lb",{jointNumbers:r.map(l=>l+1).join(", ")})})})}),to=B.styled(xe)(({theme:o})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:o.palette.text.primary}}}}));function it({labelValue:o,...t}){return s.jsxs(to,{fullWidth:!0,variant:"filled",children:[s.jsx(_e,{id:t.labelId,children:o}),s.jsx(Ie,{...t})]})}function Gt(o){var t,e,i,n,r;if(typeof o=="string"){const l=I.tryParseJson(o);return l?Gt(l):o}if(o&&typeof o=="object"){const l=o;return((t=l.error_feedback)==null?void 0:t.error_feedback_name)||((e=l.add_trajectory_error)==null?void 0:e.message)||l.message||((n=(i=l.result)==null?void 0:i.add_trajectory_error)==null?void 0:n.message)||((r=l.result)==null?void 0:r.message)||"Jogging motion failed"}return"Jogging motion failed"}const eo=[{pattern:/^FeedbackSingularity$/,translationKey:"Jogging.StreamStateSection.Error.Singularity.lb"},{pattern:/^FeedbackJointLimitExceeded$/,translationKey:"Jogging.StreamStateSection.Error.JointLimit.lb"},{pattern:/^FeedbackOutOfWorkspace$/,translationKey:"Jogging.StreamStateSection.Error.OutOfWorkspace.lb"},{pattern:/^FeedbackCollision$/,translationKey:"Jogging.StreamStateSection.Error.Collision.lb"},{pattern:/^FeedbackNoSolutionInCurrentConfiguration$/,translationKey:"Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb"},{pattern:/^Feedback\w+$/,translationKey:"Jogging.StreamStateSection.Error.PlanningFailed.lb"}];function oo(o){var t;return((t=eo.find(({pattern:e})=>e.test(o)))==null?void 0:t.translationKey)??null}const io=5,no=250;function ro(o){var i,n,r,l;const t=[(n=(i=o==null?void 0:o.manual_t1_limits)==null?void 0:i.tcp)==null?void 0:n.velocity,(l=(r=o==null?void 0:o.manual_limits)==null?void 0:r.tcp)==null?void 0:l.velocity].filter(a=>typeof a=="number"&&Number.isFinite(a)&&a>0);return Math.min(no,...t)/10}const gt=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],so=[{id:"continuous"},...gt],ao=["coordsys","tool"],Et="joggingToolStore",lo=()=>typeof localStorage>"u"?void 0:localStorage;class Y{constructor(t,e,i,n,r,l={}){var g,u,h;this.jogger=t,this.coordSystems=e,this.motionGroupDescription=i,this.tcps=n,this.inverseSolverValue=r,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.jogCoordSystemId="world",this.selectedTcpId="",this.tcpChangeInProgress=!1,this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.lastJogError=null,this.onBeforeActivate=null,this.rotationVelocityDegPerSec=io,this.minTranslationVelocityMmPerSec=1,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=V.JointTypeEnum.RevoluteJoint,this.storage=l.storage??lo();for(const p of e)if(p.coordinate_system===""){p.coordinate_system="world";break}this.selectedCoordSystemId=((g=e[0])==null?void 0:g.coordinate_system)||"world",this.jogCoordSystemId=this.selectedCoordSystemId,this.selectedTcpId=t.motionStream.rapidlyChangingMotionState.tcp??"",this.tcpChangeInProgress=this.tcps.length>0&&!this.selectedTcpId,this.inverseSolver=r,this.translationVelocityMmPerSec=ro(i==null?void 0:i.operation_limits),this.jointType=((h=(u=i==null?void 0:i.dh_parameters)==null?void 0:u[0])==null?void 0:h.type)??V.JointTypeEnum.RevoluteJoint,m.makeAutoObservable(this,{storage:!1},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()};const a=this.jogger.onError;this.jogger.onError=p=>{this.setLastJogError(Gt(p)),a==null||a(p)},this.loadFromLocalStorage(),this.disposers.push(m.autorun(()=>this.saveToLocalStorage())),this.disposers.push(m.autorun(()=>{const p=this.jogger.motionStream.rapidlyChangingMotionState.tcp;p&&p!==this.selectedTcpId&&m.runInAction(()=>{this.selectedTcpId=p,this.tcpChangeInProgress=!1})}))}static async loadFor(t,e={}){const{nova:i,cellId:n}=t,[r,l]=await Promise.all([i.api.controller.listCoordinateSystems(n,t.motionStream.controllerId,"ROTATION_VECTOR"),i.api.motionGroup.getMotionGroupDescription(n,t.motionStream.controllerId,t.motionGroupId)]),a=await i.api.motionGroupModels.getMotionGroupKinematicModel(l.motion_group_model);return Y.create(t,{coordinateSystems:r||[],description:l,kinematicModel:a},e)}static create(t,e,i={}){const{coordinateSystems:n,description:r,kinematicModel:l}=e,a=Object.entries(r.tcps||{}).map(([g,u])=>({id:g,readable_name:u.name,position:u.pose.position,orientation:u.pose.orientation}));return new Y(t,n,r,a,l.inverse_solver,i)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return kt.countBy(this.coordSystems,t=>t.name)}async deactivate(){this.jogger.mode==="jogging"&&await this.jogger.setJoggingMode("off")}async activate(){var t;return this.lastJogError=null,await((t=this.onBeforeActivate)==null?void 0:t.call(this)),this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&await this.jogger.setOptions({tcp:this.selectedTcpId||void 0,orientation:this.selectedOrientation}),this.jogger.coordinateSystem=this.jogCoordSystem,this.activeDiscreteIncrement?await this.jogger.setJoggingMode("trajectory"):await this.jogger.setJoggingMode("jogging")):await this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){var i;const t=(i=this.storage)==null?void 0:i.getItem(Et),e=t?I.tryParseJson(t):void 0;e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.coordSystemsById[e.jogCoordSystemId]&&(this.jogCoordSystemId=e.jogCoordSystemId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){var t;(t=this.storage)==null||t.setItem(Et,JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get lastJogErrorTranslationKey(){return this.lastJogError?oo(this.lastJogError):null}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,jogCoordSystemId:this.jogCoordSystemId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get canJogCartesian(){return this.inverseSolver!==null}get tabs(){const t=[{id:"joint",label:"Joints"}];return this.canJogCartesian&&t.unshift({id:"cartesian",label:"Cartesian"}),t}get incrementOptions(){return so}get discreteIncrementOptions(){return gt}get incrementOptionsById(){return ot(this.incrementOptions,t=>t.id)}get tabsById(){return ot(this.tabs,t=>t.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return ot(this.coordSystems,t=>t.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get jogCoordSystem(){return b.resolveCoordinateSystemInWorld(this.jogCoordSystemId,this.coordSystems)}get tcpPoseInSelectedCoordSystem(){const{tcp_pose:t,coordinate_system:e}=this.jogger.motionStream.readoutState;return!(t!=null&&t.position)||!t.orientation?t:b.transformPoseToCoordinateSystem({pose:{position:t.position,orientation:t.orientation},coordinateSystemId:e||"world"},this.selectedCoordSystemId,this.coordSystems).pose}get tcpsById(){return ot(this.tcps,t=>t.id)}tcpPoseIn(t,e){const{tcp_pose:i,tcp:n,coordinate_system:r}=this.jogger.motionStream.readoutState,l=this.tcpsById[n||this.selectedTcpId],a=this.tcpsById[t];if(!(!(i!=null&&i.position)||!i.orientation)&&!(!l||!a))try{return b.transformPoseToCoordinateSystem({pose:b.transformPoseToTcp(i,l,a),coordinateSystemId:r||"world"},e,this.coordSystems).pose}catch{return}}get activeDiscreteIncrement(){return gt.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(t){return t?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(t){return t?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(t){return t?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(t,e){const i=this.tabs[e]||this.tabs[0];this.selectedTabId=i.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.requestTcpChange(t).catch(e=>{console.error("Failed to change TCP:",e)})}async requestTcpChange(t){if(t===this.selectedTcpId)return;this.tcpChangeInProgress=!0;const e=this.jogger.tcp,i=this.jogger.mode!=="jogging";try{this.jogger.tcp=t,i?await this.jogger.setJoggingMode("jogging"):await this.jogger.setJoggingMode("jogging",!1);let n=await this.waitForTcpConfirmation(t,1e3);i&&await this.jogger.setJoggingMode("off"),n||(n=await this.waitForTcpConfirmation(t,2e3)),m.runInAction(()=>{n?this.selectedTcpId=t:(this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(n){throw i&&await this.jogger.setJoggingMode("off").catch(()=>{}),m.runInAction(()=>{this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??""}),n}finally{m.runInAction(()=>{this.tcpChangeInProgress=!1})}}waitForTcpConfirmation(t,e){return new Promise(i=>{const n=setTimeout(()=>{r(),i(!1)},e),r=m.when(()=>this.jogger.motionStream.rapidlyChangingMotionState.tcp===t,()=>{clearTimeout(n),i(!0)})})}setSelectedOrientation(t){this.selectedOrientation=t}setMoveRelativeToSelectedTcp(){this.selectedOrientation="tool"}setMoveRelativeToCoordSystem(t){this.selectedOrientation="coordsys",this.jogCoordSystemId=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setLastJogError(t){this.lastJogError=t}setVelocityFromSlider(t,e){!Number.isFinite(t)||t<this.minVelocityInDisplayUnits(e)||t>this.maxVelocityInDisplayUnits(e)||(e?this.rotationVelocityDegPerSec=t:this.translationVelocityMmPerSec=t)}setSelectedCartesianMotionType(t){this.selectedCartesianMotionType=t}lock(t){this.locks.add(t)}unlock(t){this.locks.delete(t)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket().catch(t=>{console.error("Failed to initialize jogging:",t)})}async withMotionLock(t){const e=Pe();this.lock(e);try{return await t()}finally{this.unlock(e)}}}const co=w.observer(({store:o,useDegree:t})=>{var l;const{t:e}=$.useTranslation(),i=E.useId(),n=[];function r(a){switch(a){case"coordsys":return e("Jogging.Orientation.coordsys");case"tool":return e("Jogging.Orientation.tool");default:return a}}return o.showCoordSystemSelect&&n.push(s.jsx(it,{labelId:`jogging-coord-select-${i}`,labelValue:e("Jogging.CoordinateSystem.hlb"),value:o.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:a=>o.setSelectedCoordSystemId(a.target.value),children:o.coordSystems.map(a=>s.jsx(z,{value:a.coordinate_system,children:a.name&&o.coordSystemCountByName[a.name]>1?`${a.name} / ${a.coordinate_system}`:a.name||a.coordinate_system},a.coordinate_system))},"coord")),o.showTcpSelect&&n.push(s.jsx(it,{labelId:`jogging-tcp-select-${i}`,labelValue:"TCP",value:o.selectedTcpId,size:"small",variant:"filled",displayEmpty:o.tcpChangeInProgress,onChange:a=>{o.requestTcpChange(a.target.value).catch(g=>{console.error("Failed to change TCP:",g)})},disabled:o.tcpChangeInProgress,endAdornment:o.tcpChangeInProgress?s.jsx(ve,{position:"end",children:s.jsx(Rt,{size:16})}):void 0,children:o.tcps.map(a=>s.jsx(z,{value:a.id,children:a.id},a.id))},"tcp")),o.showOrientationSelect&&n.push(s.jsx(it,{labelValue:e("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${i}`,value:o.selectedOrientation,onChange:a=>o.setSelectedOrientation(a.target.value),children:ao.map(a=>s.jsx(z,{value:a,children:r(a)},a))},"orientation")),o.showIncrementSelect&&n.push(s.jsxs(it,{labelValue:e("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${i}`,size:"small",variant:"filled",value:((l=o.activeDiscreteIncrement)==null?void 0:l.id)||"continuous",onChange:a=>o.setSelectedIncrementId(a.target.value),children:[s.jsx(z,{value:"continuous",children:e("Jogging.Increment.Continuous.dd")},"continuous"),o.discreteIncrementOptions.map(a=>s.jsx(z,{value:a.id,children:t?`${a.degrees}°`:`${a.mm}mm`},a.id))]},"increment")),s.jsx(F,{component:"div","data-testid":"jogging-options","aria-label":"jogging-options",sx:{display:"grid",gap:"16px",gridTemplateColumns:"1fr 1fr",gridAutoRows:"min-content","& label":{opacity:.7,fontSize:"12px",marginBottom:"4px"}},children:n.map((a,g)=>s.jsx(F,{sx:{gridColumn:n.length%2===1&&g===n.length-1?"span 2":"auto"},children:a},g))})}),go=B.styled(Ee)(({theme:o})=>{var t;return{"&.MuiToggleButtonGroup-root":{background:(t=o.palette.backgroundPaperElevation)==null?void 0:t[8],borderRadius:"8px",padding:"4px",gap:"4px",button:{border:"none",borderRadius:"4px",flex:"1 1 0px",minWidth:0,"&.MuiToggleButtonGroup-firstButton":{borderRadius:"8px 4px 4px 8px"},"&.MuiToggleButtonGroup-lastButton":{borderRadius:"4px 8px 8px 4px"}}}}}),qt=Q.externalizeComponent(w.observer(o=>{const{store:t}=o,{t:e}=$.useTranslation();function i(n,r){r===o.velocity||!Ce(r)||o.onVelocityChange(r,o.useDegree)}return s.jsxs(x,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[t.showVelocityLegend&&s.jsx(M,{sx:{color:H.velocitySliderLegendColor,fontSize:"14px"},children:e("Jogging.Velocity.bt")}),s.jsx(Pt,{value:o.velocity,color:"secondary",onChange:i,min:o.min,max:o.max,"aria-labelledby":"input-slider",disabled:o.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),t.showVelocitySliderLabel&&(o.renderValue?o.renderValue(o.velocity):s.jsx(yt,{value:o.velocity.toString()}))]})}));function yt({value:o,sx:t}){var i;const e=B.useTheme();return s.jsx(x,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(i=e.palette.backgroundPaperElevation)==null?void 0:i[8],borderRadius:"10px",minWidth:"111px",...t},children:s.jsx(M,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:e.palette.text.primary,whiteSpace:"nowrap"},children:o})})}const Ut=w.observer(({store:o,useDegree:t})=>{const{t:e}=$.useTranslation();function i(n,r){return r?`ω = ${e("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:n})}`:`v = ${e("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:n})}`}return s.jsx(qt,{store:o,velocity:o.velocityInDisplayUnits(t),min:o.minVelocityInDisplayUnits(t),max:o.maxVelocityInDisplayUnits(t),onVelocityChange:o.setVelocityFromSlider,useDegree:t,disabled:o.isLocked,renderValue:n=>s.jsx(yt,{value:i(n,t),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),zt=w.observer(({store:o})=>{var l,a,g;const{t}=$.useTranslation(),e=B.useTheme(),i=((g=(a=(l=o.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:l.details)==null?void 0:a.state)==null?void 0:g.kind)??"KIND_UNKNOWN",n=o.lastJogError,r=o.lastJogErrorTranslationKey;return s.jsxs(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",color:e.palette.text.primary},children:[s.jsx(M,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:t("Jogging.StreamStateSection.lb")}),s.jsx(M,{variant:"body2",color:n?"error":void 0,sx:{fontSize:"0.75rem",lineHeight:1.2,textAlign:"right"},"data-testid":n?"JOG_ERROR":i,children:n?r?t(r):n:t(`Jogging.StreamStateSection.${i}.lb`)})]})}),uo=w.observer(({store:o,children:t})=>{const{t:e}=$.useTranslation(),i=B.useTheme(),n=E.useRef(0);function r(d,c){(c==="translate"||c==="rotate")&&o.setSelectedCartesianMotionType(c)}async function l(d,c){const f=await o.activate(),y=f.motionStream.rapidlyChangingMotionState.tcp_pose,j=f.motionStream.rapidlyChangingMotionState.joint_position;y&&await o.withMotionLock(async()=>{try{o.setCurrentIncrementJog({axis:d.axis,direction:d.direction}),await o.jogger.runIncrementalCartesianMotion({currentTcpPose:y,currentJoints:j,coordSystemId:o.activeCoordSystemId,velocityInRelevantUnits:o.selectedCartesianMotionType==="translate"?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec,axis:d.axis,direction:d.direction,motion:o.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:c.mm}:{type:"rotate",distanceRads:I.degreesToRadians(c.degrees)}})}finally{o.setCurrentIncrementJog(null),await o.deactivate()}})}async function a(d){if(o.isLocked)return;const c=++n.current;try{if(await o.activate(),c!==n.current)return;if(o.activeDiscreteIncrement)return await l(d,o.activeDiscreteIncrement);d.motionType==="translate"?await o.jogger.translateTCP({axis:d.axis,direction:d.direction,velocityMmPerSec:o.translationVelocityMmPerSec}):await o.jogger.rotateTCP({axis:d.axis,direction:d.direction,velocityRadsPerSec:o.rotationVelocityRadsPerSec})}catch(f){console.error("Jogging failed:",f)}}async function g(){o.isLocked||o.activeDiscreteIncrement||(n.current++,await o.deactivate())}const u=[{id:"x",icon:s.jsx(We,{}),colors:H.cartesianAxisColors.X},{id:"y",icon:s.jsx(Ye,{}),colors:H.cartesianAxisColors.Y},{id:"z",icon:s.jsx(Qe,{}),colors:H.cartesianAxisColors.Z}];function h(d){return e("General.mm.variable",{amount:d.toFixed(1)})}function p(d){return e("General.degree.variable",{amount:I.radiansToDegrees(d).toFixed(1)})}return s.jsxs(x,{"data-testid":"jogging-cartesian-tab","aria-label":"jogging-cartesian-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[s.jsxs(x,{gap:2,children:[s.jsx(co,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),s.jsx(Ut,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),s.jsx(W,{})]}),s.jsx(x,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:s.jsxs(x,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[s.jsxs(go,{value:o.selectedCartesianMotionType,onChange:r,exclusive:!0,"aria-label":e("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[s.jsx(bt,{value:"translate",children:e("Jogging.Cartesian.Translation.bt")}),s.jsx(bt,{value:"rotate",children:e("Jogging.Cartesian.Rotation.bt")})]}),o.selectedCartesianMotionType==="translate"&&u.map(d=>{var c,f;return s.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:o.isLocked,activeJoggingDirection:((c=o.incrementJogInProgress)==null?void 0:c.axis)===d.id?o.incrementJogInProgress.direction:void 0,label:s.jsxs(s.Fragment,{children:[d.icon,s.jsx(M,{sx:{fontSize:"24px",color:((f=d.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,j;return h(((j=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.position)==null?void 0:j[I.XYZ_TO_VECTOR[d.id]])||0)},startJogging:y=>a({axis:d.id,motionType:"translate",direction:y}),stopJogging:g},d.id)}),o.selectedCartesianMotionType==="rotate"&&u.map(d=>{var c,f;return s.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:o.isLocked,activeJoggingDirection:((c=o.incrementJogInProgress)==null?void 0:c.axis)===d.id?o.incrementJogInProgress.direction:void 0,label:s.jsxs(s.Fragment,{children:[s.jsx(Xe,{}),s.jsx(M,{sx:{fontSize:"24px",color:((f=d.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,j;return p(((j=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.orientation)==null?void 0:j[I.XYZ_TO_VECTOR[d.id]])||0)},startJogging:y=>a({axis:d.id,motionType:"rotate",direction:y}),stopJogging:g},d.id)})]})}),s.jsx(Bt,{store:o}),s.jsx(W,{}),s.jsx(zt,{store:o}),t&&s.jsx(W,{}),t]})}),ho=w.observer(({store:o,children:t})=>{const e=B.useTheme(),i=E.useRef(0);async function n(l){const a=++i.current;try{if(await o.activate(),a!==i.current)return;await o.jogger.rotateJoints({joint:l.joint,direction:l.direction,velocityUnit:o.jointType===V.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:o.jointType===V.JointTypeEnum.PrismaticJoint?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec})}catch(g){console.error("Jogging failed:",g)}}async function r(){i.current++,await o.jogger.stop(),await o.deactivate()}return s.jsxs(x,{"data-testid":"jogging-joint-tab","aria-label":"jogging-joint-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[s.jsx(Ut,{store:o,useDegree:o.jointType===V.JointTypeEnum.RevoluteJoint}),s.jsx(W,{}),s.jsx(x,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:s.jsx(x,{"data-testid":"jogging-joint-value-controls-wrapper","aria-label":"jogging-joint-value-controls-wrapper",alignItems:"center",gap:"24px",children:o.jogger.motionStream.joints.map(l=>{var g,u,h;const a=(h=(u=(g=o.motionGroupDescription.operation_limits.auto_limits)==null?void 0:g.joints)==null?void 0:u[l.index])==null?void 0:h.position;return s.jsxs(x,{"data-testid":`jogging-joint-value-control-${l.index}`,"aria-label":`jogging-joint-value-control-${l.index}`,direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[o.showJointsLegend&&s.jsx(M,{color:o.isLocked?e.palette.text.disabled:e.palette.text.secondary,children:`G${l.index+1}`}),s.jsx(Lt,{disabled:o.isLocked,lowerLimit:a==null?void 0:a.lower_limit,upperLimit:a==null?void 0:a.upper_limit,useDegree:o.jointType===V.JointTypeEnum.RevoluteJoint,getValue:()=>{const p=o.jogger.motionStream.rapidlyChangingMotionState.joint_position[l.index];return p!==void 0?p:void 0},startJogging:p=>n({joint:l.index,direction:p}),stopJogging:r})]},`joint-${l.index}`)})})}),s.jsx(Bt,{store:o}),s.jsx(W,{}),s.jsx(zt,{store:o}),t&&s.jsx(W,{}),t]})}),po=Q.externalizeComponent(w.observer(o=>{const t=w.useLocalObservable(()=>({joggingStore:null,loadingError:null}));return E.useEffect(()=>{let e=!1,i;async function n(){m.runInAction(()=>{t.loadingError=null,t.joggingStore=null});try{let r=o.store;if(!r){const l=await tt.open(o.nova,o.motionGroupId,{cellId:o.cellId});if(e){l.dispose();return}try{r=await Y.loadFor(l)}catch(a){throw l.dispose(),a}if(i=r,e){r.dispose();return}}m.runInAction(()=>{t.joggingStore=r}),o.onSetup&&o.onSetup(r)}catch(r){if(e)return;m.runInAction(()=>{t.loadingError=r})}}return n(),()=>{e=!0,i==null||i.dispose()}},[o.store,o.nova,o.motionGroupId,o.cellId]),E.useEffect(()=>{const e=t.joggingStore;e&&(o.locked?e.lock("external"):e.unlock("external"))},[t.joggingStore,o.locked]),s.jsx(x,{"data-testid":"jogging-panel","aria-label":"jogging-panel",sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...o.sx},children:t.joggingStore?s.jsx(mo,{store:t.joggingStore,children:o.children}):s.jsx($t,{message:"Loading jogging",error:t.loadingError})})})),mo=w.observer(({store:o,children:t})=>{const{t:e}=$.useTranslation();function i(){if(o.currentTab.id==="cartesian")return s.jsx(uo,{store:o,children:t});if(o.currentTab.id==="joint")return s.jsx(ho,{store:o,children:t})}return s.jsxs(x,{flexGrow:1,sx:{overflow:"hidden"},children:[s.jsx(fe,{"data-testid":"jogging-tabs","aria-label":"jogging-tabs",value:o.tabIndex,onChange:o.onTabChange,variant:"fullWidth",children:o.tabs.map(n=>{const r=n.label==="Cartesian"?e("Jogging.Cartesian.bt"):e("Jogging.Joints.bt"),l=n.label==="cartesian"?s.jsx(he,{fontSize:"small",sx:{mr:1}}):s.jsx(pe,{fontSize:"small",sx:{mr:1}});return s.jsx(me,{"data-testid":`jogging-tab-${n.id}`,"aria-label":`jogging-tab-${n.id}`,label:o.showTabIcons?s.jsxs(x,{direction:"row",alignItems:"center",children:[l,r]}):r,id:`jogging-tab-${n.id}`,"aria-controls":`jogging-tab-${n.id}`},n.id)})}),s.jsx(x,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:i()}),o.blocked&&s.jsx(Ue,{store:o})]})});function fo(){const o=window.location.href;return o.substring(0,o.indexOf("/",o.indexOf("//")+2))}function yo({baseUrl:o=fo(),...t}){return s.jsxs(Oe,{"aria-labelledby":"no-motion-group-modal-title",open:!0,fullWidth:!0,sx:{"& .MuiModal-backdrop":{backdropFilter:"blur(10px)"},"& .MuiDialog-paper":{"::before":{content:'""',height:"8px",width:"100%",background:"linear-gradient(90deg, #FF0E65 0%, #47D3FF 100%)"},background:"#101629"}},children:[s.jsx(Ae,{id:"no-motion-group-modal-title",children:"No motion group found"}),s.jsxs(ke,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[s.jsx(M,{color:"#fff",children:"Found no devices to connect to."}),s.jsx(M,{color:"#fff",children:"Please ensure a motion group has been created."})]}),s.jsx(Re,{children:s.jsxs(x,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[s.jsx(ct,{href:`${o}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),s.jsx(ct,{href:`${o}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}const Ct=1e-4,So={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class at{constructor(t,e,i,n,r,l,a,g,u,h,p="cell"){this.controller=e,this.motionGroup=i,this.initialMotionState=n,this.motionStateSocket=r,this.isVirtual=l,this.tcps=a,this.description=g,this.initialControllerState=u,this.controllerStateSocket=h,this.cellId=p,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.nova=b.createNovaClient(t),this.rapidlyChangingMotionState=n,this.controllerState=u,h.addEventListener("message",d=>{var f;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;c&&m.runInAction(()=>{this.controllerState=c})}),r.addEventListener("message",d=>{var f;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;if(!c)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${d.data}`);ut(this.rapidlyChangingMotionState.joint_position,c.joint_position,Ct)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=c.joint_position}),ht(this.rapidlyChangingMotionState,c,Ct)||m.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=c.tcp_pose}),c.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==c.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=c.tcp}),this.rapidlyChangingMotionState.standstill!==c.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=c.standstill})}),m.makeAutoObservable(this)}static async connectMultiple(t,e,i={}){const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t);return Promise.all(e.map(l=>at.connect(n,l,{...i,cellId:r})))}static async connect(t,e,i={}){var R,k;const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t)??"cell",[l,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(C=>C.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const h=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await h.firstMessage(),d=(R=I.tryParseJson(p.data))==null?void 0:R.result;if(!d)throw new Error(`Unable to parse initial motion state message ${p.data}`);console.log(`Connected motion state websocket to motion group ${u.motion_group}. Initial state:
1
+ "use strict";const s=require("react/jsx-runtime"),ae=require("@mui/material/AppBar"),Ot=require("@mui/material/Backdrop"),F=require("@mui/material/Box"),le=require("@mui/material/Menu"),z=require("@mui/material/MenuItem"),ce=require("@mui/material/Toolbar"),M=require("@mui/material/Typography"),de=require("@wandelbots/design-tokens"),ge=require("@wandelbots/icons/ExpandMoreFilled"),ue=require("@wandelbots/mui"),w=require("mobx-react-lite"),E=require("react"),Q=require("./externalizeComponent-BW1UV6Gh.cjs"),he=require("@mui/icons-material/OpenWith"),pe=require("@mui/icons-material/Share"),x=require("@mui/material/Stack"),me=require("@mui/material/Tab"),fe=require("@mui/material/Tabs"),m=require("mobx"),$=require("react-i18next"),Rt=require("@mui/material/CircularProgress"),ye=require("@mui/material/utils"),kt=require("lodash-es"),Se=require("./robotSafetyOf-Y4NuRInk.cjs"),je=require("@mui/material/Alert"),be=require("@mui/material/AlertTitle"),ct=require("@mui/material/Button"),B=require("@mui/material/styles"),W=require("@mui/material/Divider"),bt=require("@mui/material/ToggleButton"),I=require("@wandelbots/nova-js"),st=require("@mui/material/IconButton"),b=require("./PoseTransformer-dP4nzrPG.cjs"),H=require("./joggingColors-ZDc_2UCp.cjs"),At=require("lodash-es/isEqual.js"),ve=require("@mui/material/InputAdornment"),xe=require("@mui/material/FormControl"),_e=require("@mui/material/InputLabel"),Ie=require("@mui/material/Select"),Ee=require("@mui/material/ToggleButtonGroup"),Pt=require("@mui/material/Slider"),Ce=require("lodash-es/isNumber.js"),V=require("@wandelbots/nova-js/v2"),Te=require("@mui/icons-material/ChevronLeft"),Me=require("@mui/icons-material/ChevronRight"),we=require("lodash-es/throttle.js"),Oe=require("@mui/material/Dialog"),Re=require("@mui/material/DialogActions"),ke=require("@mui/material/DialogContent"),Ae=require("@mui/material/DialogTitle"),q=require("three"),Jt=require("./converters-BsXgcxCW.cjs"),ot=require("lodash-es/keyBy.js"),Pe=require("lodash-es/uniqueId.js"),nt=require("./Pose3-Ch4xVeXV.cjs"),vt=require("./robotActivationOf-BCKyEgny.cjs"),U=require("./useEveryFrame-891OscPu.cjs");function Dt(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const v=Dt(E),xt=Dt(q),Je=Q.externalizeComponent(w.observer(o=>{const{appIcon:t,appName:e,apps:i=[],onAppSelect:n,disabled:r=!1,sx:l}=o,[a,g]=E.useState(null),u=!!a,h=c=>{g(c.currentTarget)},p=()=>{g(null)},d=c=>{p(),c.onClick?c.onClick():c.href&&(window.location.href=c.href),n==null||n(c)};return s.jsxs(s.Fragment,{children:[s.jsx(ae,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...l},children:s.jsxs(ce,{sx:{minHeight:"62px !important"},children:[s.jsx(F,{sx:{mr:1,display:"flex",alignItems:"center"},children:t}),s.jsxs(F,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[s.jsx(M,{component:"h1",variant:"subtitle1",children:e}),i.length>0&&s.jsx(ue.RoundedIconButton,{icon:s.jsx(ge.ExpandMoreFilled,{size:20}),ariaLabel:"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:h,disabled:r,sx:{ml:1}})]})]})}),s.jsx(Ot,{open:u,onClick:p,sx:{backdropFilter:"blur(4px)",backgroundColor:de.ZeroGravityComponentsBackdropFill,zIndex:c=>c.zIndex.modal-1}}),s.jsx(le,{id:"app-menu",anchorEl:a,open:u,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:c=>c.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:i.map(c=>s.jsxs(z,{onClick:()=>d(c),children:[s.jsx(F,{sx:{display:"flex",alignItems:"center"},children:c.icon}),s.jsx(M,{variant:"body1",sx:{ml:2},children:c.name})]},c.id))})]})})),De=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("g",{id:"JogMinus"},v.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),Le=E.forwardRef(De),Ne=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("g",{id:"JogPlus"},v.createElement("g",{id:"Plus"},v.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),v.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),v.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),Ve=E.forwardRef(Ne),dt=Q.externalizeComponent(w.observer(({colors:o,label:t,getDisplayedValue:e,startJogging:i,stopJogging:n,disabled:r,activeJoggingDirection:l,...a})=>{var O,R,k,C,A,N,G;b.useAnimationFrame(()=>{const D=e(),L=d.current;L&&(L.textContent=D)});const g=B.useTheme(),[u,h]=E.useState(null);E.useEffect(()=>{r&&T()},[r]);const p=l||u,d=E.useRef(null);o||(o={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const c=p?(O=o.buttonBackgroundColor)==null?void 0:O.pressed:o.borderColor,f={width:"55px",color:o.color,path:{fill:o.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},y={...f,backgroundColor:(R=o.buttonBackgroundColor)==null?void 0:R.default,":hover":{backgroundColor:(k=o.buttonBackgroundColor)==null?void 0:k.hovered},":active":{backgroundColor:(C=o.buttonBackgroundColor)==null?void 0:C.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor}},":disabled":{backgroundColor:(A=o.buttonBackgroundColor)==null?void 0:A.disabled,"svg path":{fill:g.palette.action.disabled}}},j={...f,backgroundColor:(N=o.buttonBackgroundColor)==null?void 0:N.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor},":disabled":{backgroundColor:(G=o.buttonBackgroundColor)==null?void 0:G.pressed,"svg path":{fill:g.palette.action.disabled}}};function _(D,L){r||D.button===0&&(h(L),i(L))}function T(){h(null),n()}return s.jsxs(x,{height:"64px",direction:"row",justifyContent:"center",...a,children:[s.jsx(st,{disabled:r,disableRipple:!0,onPointerDown:D=>_(D,"-"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="-"?j:y,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${c??"#fff"}`,borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:s.jsx(Le,{})}),s.jsxs(x,{spacing:"6px",sx:{width:"150px",backgroundColor:o.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:[s.jsx(x,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:o.color,".MuiTypography-root":{fontWeight:700,...r?{color:g.palette.action.disabled}:{}},...r?{"svg path":{fill:g.palette.action.disabled}}:{}},children:t}),s.jsx(M,{height:"22px",sx:{fontSize:"15px",color:r?g.palette.action.disabled:o.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:d,children:e()})]}),s.jsx(st,{disableRipple:!0,disabled:r,onPointerDown:D=>_(D,"+"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="+"?j:y,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${c??"#fff"}`,borderBottom:`2px solid ${c??"#fff"}`,borderTop:`2px solid ${c??"#fff"}`},children:s.jsx(Ve,{})})]})})),Lt=Q.externalizeComponent(w.observer(({startJogging:o,stopJogging:t,lowerLimit:e,upperLimit:i,useDegree:n,getValue:r,disabled:l,...a})=>{var C,A,N,G,D,L,et;const{t:g}=$.useTranslation(),[u,h]=E.useState(),p=B.useTheme(),d={background:(C=p.palette.backgroundPaperElevation)==null?void 0:C[4],color:(A=p.palette.backgroundPaperElevation)==null?void 0:A[11]},c=w.useLocalObservable(()=>({activeJoggingDir:null,startJogging(S){this.activeJoggingDir=S,o(S)},stopJogging(){this.activeJoggingDir=null,t()}})),f=we(()=>{const S=n?y(r()):r();(S===void 0||u===void 0||Math.abs(u-S)>1e-9)&&h(S)},50);b.useAnimationFrame(f);function y(S){if(S!==void 0)return I.radiansToDegrees(S)}function j(S){S.button===0&&c.startJogging("-")}function _(S){S.button===0&&c.startJogging("+")}function T(S){c.stopJogging()}function O(S){c.stopJogging()}function R(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.degree.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}function k(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.mm.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}return s.jsxs(x,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...a,sx:{"& .MuiIconButton-root":{width:"52px",color:p.palette.text.primary,alignContent:"center",backgroundColor:(N=p.palette.backgroundPaperElevation)==null?void 0:N[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(G=p.palette.backgroundPaperElevation)==null?void 0:G[11],color:p.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(D=p.palette.backgroundPaperElevation)==null?void 0:D[9]},"&:active":{...d}}},children:[s.jsx(st,{onPointerDown:j,onPointerUp:T,onPointerOut:O,disabled:l,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...c.activeJoggingDir==="-"?d:{}},children:s.jsx(Te,{sx:{pointerEvents:"none",color:H.jointArrowColor}})}),s.jsxs(x,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(L=p.palette.backgroundPaperElevation)==null?void 0:L[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[s.jsx(M,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:l?p.palette.action.disabled:p.palette.text.primary},children:n?R(u):k(u)}),s.jsx(Pt,{disabled:!0,"aria-label":"Joint position",min:n?y(e):e,max:n?y(i):i,value:u||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:l?p.palette.action.disabled:p.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:l?p.palette.action.disabled:p.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(et=p.palette.backgroundPaperElevation)==null?void 0:et[5],opacity:1}},marks:e!==void 0&&i!==void 0&&[{value:n?y(e):e,label:n?R(y(e),0):k(e)},{value:n?y(i):i,label:n?R(y(i),0):k(i)}]})]}),s.jsx(st,{onPointerDown:_,onPointerUp:T,onPointerOut:O,disabled:l,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...c.activeJoggingDir==="+"?d:{}},children:s.jsx(Me,{sx:{pointerEvents:"none",color:H.jointArrowColor}})})]})}));function $e({currentTcpPose:o,axis:t,direction:e,motion:i,useToolCoordinateSystem:n,coordinateSystemRotation:r}){const l=e==="-"?-1:1;if(i.type==="translate"){if(!o.position)throw new Error("Current pose has no position, cannot perform translation");const p=i.distanceMm*l,d=new q.Vector3;if(d[t]=p,n){if(!o.orientation)throw new Error("Current pose has no orientation, cannot translate relative to tool");d.applyQuaternion(nt.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"))}else r&&d.applyQuaternion(r);const c=[...o.position];return c[0]=(c[0]??0)+d.x,c[1]=(c[1]??0)+d.y,c[2]=(c[2]??0)+d.z,{position:c,orientation:o.orientation}}if(!o.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const a=nt.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"),g=new q.Vector3;g[t]=1,!n&&r&&g.applyQuaternion(r);const u=new q.Quaternion().setFromAxisAngle(g,i.distanceRads*l),h=n?a.multiply(u):u.multiply(a);return{position:o.position,orientation:[...nt.quaternionToRotationVector(h)]}}function Z(o,t,e){return t.length!==o.length?!1:Nt(o,t,e)}function ut(o,t,e){return t.length!==o.length?!0:Nt(o,t,e)}function Nt(o,t,e){for(let i=0;i<t.length;i++)if(Math.abs((t[i]??0)-(o[i]??0))>e)return!1;return!0}function Vt(o,t,e){if(o===void 0&&t||o&&t===void 0||(o==null?void 0:o.orientation)===void 0||(t==null?void 0:t.orientation)===void 0||(o==null?void 0:o.position)===void 0||(t==null?void 0:t.position)===void 0)return!1;if(o===void 0||t===void 0)return!0;let i=0;return i+=Math.abs(o.orientation[0]-t.orientation[0]),i+=Math.abs(o.orientation[1]-t.orientation[1]),i+=Math.abs(o.orientation[2]-t.orientation[2]),i+=Math.abs(o.position[0]-t.position[0]),i+=Math.abs(o.position[1]-t.position[1]),i+=Math.abs(o.position[2]-t.position[2]),i<=e}function ht(o,t,e){return o.coordinate_system===t.coordinate_system&&o.tcp===t.tcp&&Vt(o.tcp_pose,t.tcp_pose,e)}function pt(o,t){const e=new q.Vector3(t[0],t[1],t[2]),i=new q.Vector3(o[0],o[1],o[2]),n=e.length(),r=e.normalize();let l=i.length(),a=i.normalize();a.dot(r)<0&&(l=-l,a=a.multiplyScalar(-1));let g=l-n;return g-=2*Math.PI*Math.floor((g+Math.PI)/(2*Math.PI)),l=n+g,[...a.multiplyScalar(l)]}const Fe=2e-4;function mt(o){const{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}=o;return{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}}function ft(o,t){return o.tcp===t.tcp&&o.coordinate_system===t.coordinate_system&&o.tcp_pose===void 0==(t.tcp_pose===void 0)&&Z(o.joint_position,t.joint_position,Fe)}const _t=1e-4;class X{constructor(t,e,i,n,r,l,a="cell",g={}){this.controller=e,this.motionGroup=i,this.description=n,this.initialMotionState=r,this.motionStateSocket=l,this.cellId=a,this.nova=b.createNovaClient(t),this.logger=g.logger??console,this.rapidlyChangingMotionState=r,l.addEventListener("message",u=>{var c;const h=(c=I.tryParseJson(u.data))==null?void 0:c.result;if(!h)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${u.data}`);ht(this.rapidlyChangingMotionState,h,_t)||m.runInAction(()=>{var f,y,j;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=h.tcp_pose:(f=h.tcp_pose)!=null&&f.orientation&&((y=h.tcp_pose)!=null&&y.position)&&((j=this.rapidlyChangingMotionState.tcp_pose)!=null&&j.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:h.tcp_pose.position,orientation:pt(h.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:this.logger.debug("Received incomplete tcp_pose, ignoring",{tcpPose:h.tcp_pose})}),ut(this.rapidlyChangingMotionState.joint_position,h.joint_position,_t)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=h.joint_position}),h.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==h.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=h.tcp}),this.rapidlyChangingMotionState.standstill!==h.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=h.standstill});const p=this.rapidlyChangingMotionState.joint_limit_reached.limit_reached,d=h.joint_limit_reached.limit_reached;p.some((f,y)=>f!==d[y])&&m.runInAction(()=>{this.rapidlyChangingMotionState.joint_limit_reached=h.joint_limit_reached}),this.rapidlyChangingMotionState.execute!==h.execute&&m.runInAction(()=>{this.rapidlyChangingMotionState.execute=h.execute})}),m.makeAutoObservable(this,{logger:!1,readoutState:m.computed({equals:ft,keepAlive:!0})})}static async open(t,e,i={}){var y;const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t)??"cell",[l,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(j=>j.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const h=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await h.firstMessage(),d=(y=I.tryParseJson(p.data))==null?void 0:y.result;if(!d)throw new Error(`Unable to parse initial motion state message ${p.data}`);const c=i.logger??console;c.info("Connected motion state websocket to motion group",{motionGroup:u.motion_group,initialMotionState:d});const f=await n.api.motionGroup.getMotionGroupDescription(r,a,u.motion_group);return new X(n,g,u,f,d,h,r,{logger:c})}get readoutState(){return mt(this.rapidlyChangingMotionState)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get joints(){return this.initialMotionState.joint_position.map((t,e)=>({index:e}))}dispose(){this.motionStateSocket.close()}}const It="Movement request rejected. Another client is currently executing a 'Jogging' motion!",Be=500,Ge=5e3;function qe(o){var e;return(((e=o.times)==null?void 0:e[o.times.length-1])??0)*2e3+Ge}class tt{constructor(t,e={}){this.motionStream=t,this.options=e,this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",this.NO_TCP=void 0,this.DEFAULT_INIT_TIMEOUT=5e3,this.DEFAULT_ORIENTATION="coordsys",this.mode="off",this.joggingSocket=null,this.trajectorySocket=null,this.timeout=this.DEFAULT_INIT_TIMEOUT,this.incrementalMotionInFlight=!1,this.ownsMotionStream=!1,this.tcp=(e==null?void 0:e.tcp)||t.motionGroup.tcp||this.getDefaultTcp(t),this.coordinateSystem=e==null?void 0:e.coordinateSystem,this.orientation=(e==null?void 0:e.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(e==null?void 0:e.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(e==null?void 0:e.mode)||this.DEFAULT_MODE,this.onError=e==null?void 0:e.onError,this.logger=(e==null?void 0:e.logger)??console}static async open(t,e,i={}){const n=await X.open(t,e,{cellId:i.cellId,logger:i.logger}),r=new tt(n,i);r.ownsMotionStream=!0;try{await r.setJoggingMode(r.mode)}catch(l){throw r.dispose(),l}return r}getDefaultTcp(t){var i,n;const e=(n=(i=t.description.dh_parameters)==null?void 0:i[0])==null?void 0:n.type;return t.joints.length<6&&(e===V.JointTypeEnum.RevoluteJoint||e===V.JointTypeEnum.PrismaticJoint)?this.NO_TCP:this.DEFAULT_TCP}async setOptions(t){return t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),"coordinateSystem"in t&&(this.coordinateSystem=t.coordinateSystem),t.timeout&&(this.timeout=t.timeout),t.mode&&(this.mode=t.mode),t.onError&&(this.onError=t.onError),this.setJoggingMode(this.mode,!1)}get motionGroupId(){return this.motionStream.motionGroupId}get nova(){return this.motionStream.nova}get cellId(){return this.motionStream.cellId}get numJoints(){return this.motionStream.joints.length}async stop(){if(this.joggingSocket){const t=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:t})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const t=this.closeJoggingSockets();return this.ownsMotionStream&&this.motionStream.dispose(),t}closeJoggingSockets(){var e,i;(e=this.endJoggingInit)==null||e.call(this),(i=this.endIncrementalMotion)==null||i.call(this);const t=[this.joggingSocket,this.trajectorySocket].filter(n=>n!==null);return t.forEach(n=>{n.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(t.map(n=>n.closed()))}async setJoggingMode(t,e=!0){if(!(this.mode===t&&e)&&(this.closeJoggingSockets(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,e)=>{const i=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`);this.joggingSocket=i;let n=!1;const r=setTimeout(()=>{l(new Error(`Jogging initialization timeout after ${this.timeout} ms`))},this.timeout),l=u=>{n||(n=!0,clearTimeout(r),i.removeEventListener("close",g),this.endJoggingInit===a&&(this.endJoggingInit=void 0),u?e(u):t())},a=()=>l(),g=()=>{i.disposed&&l()};this.endJoggingInit=a,i.addEventListener("close",g),i.addEventListener("message",u=>{var p,d,c;const h=I.tryParseJson(u.data);if(((p=h==null?void 0:h.result)==null?void 0:p.kind)==="INITIALIZE_RECEIVED"){l();return}if(((d=h==null?void 0:h.result)==null?void 0:d.kind)==="MOTION_ERROR")if(this.onBlocked&&((c=h==null?void 0:h.result)!=null&&c.message.includes(It))){l(),i.dispose(),this.onBlocked();return}else this.onError?(l(),this.onError(u.data)):l(new Error(u.data))}),i.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,...this.tcp?{tcp:this.tcp}:{}})})}async rotateJoints({joint:t,direction:e,velocityValue:i,velocityUnit:n}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const r=new Array(this.numJoints).fill(0);r[t]=e==="-"?-i:i,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:r})}async translateTCP({axis:t,direction:e,velocityMmPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:this.velocityAlongAxis(t,e==="-"?-i:i),rotation:[0,0,0],use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:e,velocityRadsPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:[0,0,0],rotation:this.velocityAlongAxis(t,e==="-"?-i:i),use_tool_coordinate_system:this.orientation==="tool"})}get coordinateSystemRotation(){if(!(this.orientation==="tool"||!this.coordinateSystem))return nt.Pose3.fromCoordinateSystem(this.coordinateSystem).quaternion}velocityAlongAxis(t,e){const i=new q.Vector3;i[t]=e;const n=this.coordinateSystemRotation;return n&&i.applyQuaternion(n),[i.x,i.y,i.z]}async runIncrementalCartesianMotion(t){if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(!this.incrementalMotionInFlight){this.incrementalMotionInFlight=!0;try{const e=await this.planIncrementalCartesianMotion(t);e&&await this.executeTrajectory(e)}finally{this.incrementalMotionInFlight=!1}}}async planIncrementalCartesianMotion({currentTcpPose:t,currentJoints:e,velocityInRelevantUnits:i,axis:n,direction:r,motion:l}){var y,j,_;const a=[],g=$e({currentTcpPose:t,axis:n,direction:r,motion:l,useToolCoordinateSystem:this.orientation==="tool",coordinateSystemRotation:this.coordinateSystemRotation});a.push({limits_override:l.type==="translate"?{tcp_velocity_limit:i}:{tcp_orientation_velocity_limit:i},path:{path_definition_name:"PathLine",target_pose:{position:g.position,orientation:g.orientation}}});const u=this.motionStream.description;if(u.cycle_time===void 0){this.logger.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const h=this.motionStream.rapidlyChangingMotionState.tcp,p=h?(j=(y=u.tcps)==null?void 0:y[h])==null?void 0:j.pose:void 0,d={motion_group_model:((_=this.options)==null?void 0:_.motionGroupModel)??u.motion_group_model,cycle_time:u.cycle_time,mounting:u.mounting,tcp_offset:p,global:u.operation_limits.auto_limits},c=await this.nova.api.trajectoryPlanning.planTrajectory(this.cellId,{motion_group_setup:d,start_joint_position:e,motion_commands:a}),f=c.response;if(!f)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(c)}`);if("error_feedback"in f){if(this.onError){this.onError(f);return}throw new Error(`Failed to plan jogging increment motion: ${JSON.stringify(f.error_feedback)}`)}return f}async executeTrajectory(t){const e=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);this.trajectorySocket=e;const i=new AbortController;let n,r;try{await new Promise((l,a)=>{let g=!1;const u=()=>{g||(g=!0,l())},h=d=>{if(!g){if(g=!0,this.onError){this.onError(d),l();return}a(d instanceof Error?d:new Error(`Failed to execute trajectory: ${JSON.stringify(d)}`))}};r=u,this.endIncrementalMotion=u;const p=qe(t);n=setTimeout(()=>{h(new Error(`Jogging motion did not complete within ${p}ms`))},p),e.addEventListener("message",d=>{var f,y;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;if(!(c!=null&&c.kind)){h(new Error(`Failed to execute trajectory: Received invalid message ${d.data}`));return}if(this.onBlocked&&((y=c.message)!=null&&y.includes(It))){this.onBlocked(),u();return}if(c.kind==="INITIALIZE_RECEIVED"){if(c.add_trajectory_error||c.message){h(c);return}e.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})}else if(c.kind==="START_RECEIVED"){if(c.message){h(c);return}this.waitForMotionToFinish(i.signal).then(u,h)}else c.kind==="PAUSE_RECEIVED"||(c.kind==="MOTION_ERROR"&&c.message?h(c):h(new Error(`Failed to execute trajectory, cannot handle message type "${c.kind}"`)))}),e.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:t,tcp:this.tcp}})})}finally{clearTimeout(n),i.abort(),this.endIncrementalMotion===r&&(this.endIncrementalMotion=void 0),e.dispose(),this.trajectorySocket===e&&(this.trajectorySocket=null)}}async waitForMotionToFinish(t){const e=()=>this.motionStream.rapidlyChangingMotionState.standstill;await m.when(()=>!e(),{timeout:Be,signal:t}).catch(()=>{}),await m.when(e,{signal:t})}}const $t=o=>{const t=o.softTimeout||3e3,[e,i]=E.useState(!1);return E.useEffect(()=>{const n=setTimeout(()=>{i(!0)},t);return()=>clearTimeout(n)}),s.jsx(x,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:"text.primary"},children:o.error?s.jsx(Ft,{loadingMessage:o.message,error:o.error}):s.jsxs(s.Fragment,{children:[s.jsx(Rt,{sx:{mb:3}}),!!o.message&&s.jsx(M,{variant:"body1",children:o.message}),s.jsx(M,{variant:"body2",sx:{visibility:e?"visible":"hidden",mt:2,color:"text.secondary"},children:"This is taking longer than expected..."})]})})},Ft=o=>{const t=Se.makeErrorMessage(o.error),e=o.error instanceof Error?o.error.stack:null;return s.jsxs(x,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",p:2,overflow:"auto",color:"error.main"},children:[s.jsx(M,{variant:"body1",children:(o.loadingMessage?`Error while ${kt.lowerFirst(ye.capitalize(o.loadingMessage))} - `:"")+t}),e&&s.jsx(F,{component:"pre",sx:{typography:"body2",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",mt:2,pb:6},children:e})]})},Ue=w.observer(({store:o})=>{const{t}=$.useTranslation();return s.jsx(Ot,{"data-testid":"jogging-blocked","aria-label":"jogging-blocked",open:!0,sx:{position:"absolute",zIndex:e=>e.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:s.jsxs(x,{sx:{m:2,width:"100%"},children:[s.jsxs(je,{severity:"error",sx:{mb:2},children:[s.jsx(be,{children:t("Jogging.Blocked.ti")}),t("Jogging.Blocked.lb")]}),s.jsx(ct,{variant:"contained",color:"secondary",onClick:()=>o.unblock(),children:t("Jogging.Blocked.Reenable.bt")})]})})}),ze=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),We=E.forwardRef(ze),He=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),Ye=E.forwardRef(He),Ke=({title:o,titleId:t,...e},i)=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M9.522 14.811A.899.899 0 1 0 8.25 13.54L6.19 15.601V3.16L8.25 5.221A.9.9 0 0 0 9.522 3.95L5.926.354a.9.9 0 0 0-1.272 0L1.058 3.95a.9.9 0 1 0 1.271 1.271L4.391 3.16v12.442L2.329 13.54a.899.899 0 1 0-1.271 1.271l3.596 3.597a.9.9 0 0 0 1.272 0z",clipRule:"evenodd"})),Qe=E.forwardRef(Ke),Ze=({title:o,titleId:t,...e},i)=>v.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?v.createElement("title",{id:t},o):null,v.createElement("path",{d:"M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C11.0583 14.1 12.5083 12.1667 11.475 12.9L12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z",fill:"white"})),Xe=E.forwardRef(Ze),Bt=w.observer(({store:o})=>{const{t}=$.useTranslation(),[e,i]=E.useState(o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),n=E.useRef(e);b.useAnimationFrame(()=>{const l=o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;At(n.current,l)||(n.current=l,i(l))});const r=[];for(const[l,a]of e.entries())a&&r.push(l);return s.jsx(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"center"},children:s.jsx(M,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2,visibility:r.length?"visible":"hidden"},children:t("Jogging.JointLimitsReached.lb",{jointNumbers:r.map(l=>l+1).join(", ")})})})}),to=B.styled(xe)(({theme:o})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:o.palette.text.primary}}}}));function it({labelValue:o,...t}){return s.jsxs(to,{fullWidth:!0,variant:"filled",children:[s.jsx(_e,{id:t.labelId,children:o}),s.jsx(Ie,{...t})]})}function Gt(o){var t,e,i,n,r;if(typeof o=="string"){const l=I.tryParseJson(o);return l?Gt(l):o}if(o&&typeof o=="object"){const l=o;return((t=l.error_feedback)==null?void 0:t.error_feedback_name)||((e=l.add_trajectory_error)==null?void 0:e.message)||l.message||((n=(i=l.result)==null?void 0:i.add_trajectory_error)==null?void 0:n.message)||((r=l.result)==null?void 0:r.message)||"Jogging motion failed"}return"Jogging motion failed"}const eo=[{pattern:/^FeedbackSingularity$/,translationKey:"Jogging.StreamStateSection.Error.Singularity.lb"},{pattern:/^FeedbackJointLimitExceeded$/,translationKey:"Jogging.StreamStateSection.Error.JointLimit.lb"},{pattern:/^FeedbackOutOfWorkspace$/,translationKey:"Jogging.StreamStateSection.Error.OutOfWorkspace.lb"},{pattern:/^FeedbackCollision$/,translationKey:"Jogging.StreamStateSection.Error.Collision.lb"},{pattern:/^FeedbackNoSolutionInCurrentConfiguration$/,translationKey:"Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb"},{pattern:/^Feedback\w+$/,translationKey:"Jogging.StreamStateSection.Error.PlanningFailed.lb"}];function oo(o){var t;return((t=eo.find(({pattern:e})=>e.test(o)))==null?void 0:t.translationKey)??null}const io=5,no=250;function ro(o){var i,n,r,l;const t=[(n=(i=o==null?void 0:o.manual_t1_limits)==null?void 0:i.tcp)==null?void 0:n.velocity,(l=(r=o==null?void 0:o.manual_limits)==null?void 0:r.tcp)==null?void 0:l.velocity].filter(a=>typeof a=="number"&&Number.isFinite(a)&&a>0);return Math.min(no,...t)/10}const gt=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],so=[{id:"continuous"},...gt],ao=["coordsys","tool"],Et="joggingToolStore",lo=()=>typeof localStorage>"u"?void 0:localStorage;class Y{constructor(t,e,i,n,r,l={}){var g,u,h;this.jogger=t,this.coordSystems=e,this.motionGroupDescription=i,this.tcps=n,this.inverseSolverValue=r,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.jogCoordSystemId="world",this.selectedTcpId="",this.tcpChangeInProgress=!1,this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.lastJogError=null,this.onBeforeActivate=null,this.rotationVelocityDegPerSec=io,this.minTranslationVelocityMmPerSec=1,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=V.JointTypeEnum.RevoluteJoint,this.storage=l.storage??lo();for(const p of e)if(p.coordinate_system===""){p.coordinate_system="world";break}this.selectedCoordSystemId=((g=e[0])==null?void 0:g.coordinate_system)||"world",this.jogCoordSystemId=this.selectedCoordSystemId,this.selectedTcpId=t.motionStream.rapidlyChangingMotionState.tcp??"",this.tcpChangeInProgress=this.tcps.length>0&&!this.selectedTcpId,this.inverseSolver=r,this.translationVelocityMmPerSec=ro(i==null?void 0:i.operation_limits),this.jointType=((h=(u=i==null?void 0:i.dh_parameters)==null?void 0:u[0])==null?void 0:h.type)??V.JointTypeEnum.RevoluteJoint,m.makeAutoObservable(this,{storage:!1},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()};const a=this.jogger.onError;this.jogger.onError=p=>{this.setLastJogError(Gt(p)),a==null||a(p)},this.loadFromLocalStorage(),this.disposers.push(m.autorun(()=>this.saveToLocalStorage())),this.disposers.push(m.autorun(()=>{const p=this.jogger.motionStream.rapidlyChangingMotionState.tcp;p&&p!==this.selectedTcpId&&m.runInAction(()=>{this.selectedTcpId=p,this.tcpChangeInProgress=!1})}))}static async loadFor(t,e={}){const{nova:i,cellId:n}=t,[r,l]=await Promise.all([i.api.controller.listCoordinateSystems(n,t.motionStream.controllerId,"ROTATION_VECTOR"),i.api.motionGroup.getMotionGroupDescription(n,t.motionStream.controllerId,t.motionGroupId)]),a=await i.api.motionGroupModels.getMotionGroupKinematicModel(l.motion_group_model);return Y.create(t,{coordinateSystems:r||[],description:l,kinematicModel:a},e)}static create(t,e,i={}){const{coordinateSystems:n,description:r,kinematicModel:l}=e,a=Object.entries(r.tcps||{}).map(([g,u])=>({id:g,readable_name:u.name,position:u.pose.position,orientation:u.pose.orientation}));return new Y(t,n,r,a,l.inverse_solver,i)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return kt.countBy(this.coordSystems,t=>t.name)}async deactivate(){this.jogger.mode==="jogging"&&await this.jogger.setJoggingMode("off")}async activate(){var t;return this.lastJogError=null,await((t=this.onBeforeActivate)==null?void 0:t.call(this)),this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&await this.jogger.setOptions({tcp:this.selectedTcpId||void 0,orientation:this.selectedOrientation}),this.jogger.coordinateSystem=this.jogCoordSystem,this.activeDiscreteIncrement?await this.jogger.setJoggingMode("trajectory"):await this.jogger.setJoggingMode("jogging")):await this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){var i;const t=(i=this.storage)==null?void 0:i.getItem(Et),e=t?I.tryParseJson(t):void 0;e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.coordSystemsById[e.jogCoordSystemId]&&(this.jogCoordSystemId=e.jogCoordSystemId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){var t;(t=this.storage)==null||t.setItem(Et,JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get lastJogErrorTranslationKey(){return this.lastJogError?oo(this.lastJogError):null}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,jogCoordSystemId:this.jogCoordSystemId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get canJogCartesian(){return this.inverseSolver!==null}get tabs(){const t=[{id:"joint",label:"Joints"}];return this.canJogCartesian&&t.unshift({id:"cartesian",label:"Cartesian"}),t}get incrementOptions(){return so}get discreteIncrementOptions(){return gt}get incrementOptionsById(){return ot(this.incrementOptions,t=>t.id)}get tabsById(){return ot(this.tabs,t=>t.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return ot(this.coordSystems,t=>t.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get jogCoordSystem(){return b.resolveCoordinateSystemInWorld(this.jogCoordSystemId,this.coordSystems)}get tcpPoseInSelectedCoordSystem(){const{tcp_pose:t,coordinate_system:e}=this.jogger.motionStream.readoutState;return!(t!=null&&t.position)||!t.orientation?t:b.transformPoseToCoordinateSystem({pose:{position:t.position,orientation:t.orientation},coordinateSystemId:e||"world"},this.selectedCoordSystemId,this.coordSystems).pose}get tcpsById(){return ot(this.tcps,t=>t.id)}tcpPoseIn(t,e){const{tcp_pose:i,tcp:n,coordinate_system:r}=this.jogger.motionStream.readoutState,l=this.tcpsById[n||this.selectedTcpId],a=this.tcpsById[t];if(!(!(i!=null&&i.position)||!i.orientation)&&!(!l||!a))try{return b.transformPoseToCoordinateSystem({pose:b.transformPoseToTcp(i,l,a),coordinateSystemId:r||"world"},e,this.coordSystems).pose}catch{return}}get activeDiscreteIncrement(){return gt.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(t){return t?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(t){return t?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(t){return t?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(t,e){const i=this.tabs[e]||this.tabs[0];this.selectedTabId=i.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.requestTcpChange(t).catch(e=>{console.error("Failed to change TCP:",e)})}async requestTcpChange(t){if(t===this.selectedTcpId)return;this.tcpChangeInProgress=!0;const e=this.jogger.tcp,i=this.jogger.mode!=="jogging";try{this.jogger.tcp=t,i?await this.jogger.setJoggingMode("jogging"):await this.jogger.setJoggingMode("jogging",!1);let n=await this.waitForTcpConfirmation(t,1e3);i&&await this.jogger.setJoggingMode("off"),n||(n=await this.waitForTcpConfirmation(t,2e3)),m.runInAction(()=>{n?this.selectedTcpId=t:(this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(n){throw i&&await this.jogger.setJoggingMode("off").catch(()=>{}),m.runInAction(()=>{this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??""}),n}finally{m.runInAction(()=>{this.tcpChangeInProgress=!1})}}waitForTcpConfirmation(t,e){return new Promise(i=>{const n=setTimeout(()=>{r(),i(!1)},e),r=m.when(()=>this.jogger.motionStream.rapidlyChangingMotionState.tcp===t,()=>{clearTimeout(n),i(!0)})})}setSelectedOrientation(t){this.selectedOrientation=t}setMoveRelativeToSelectedTcp(){this.selectedOrientation="tool"}setMoveRelativeToCoordSystem(t){this.selectedOrientation="coordsys",this.jogCoordSystemId=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setLastJogError(t){this.lastJogError=t}setVelocityFromSlider(t,e){!Number.isFinite(t)||t<this.minVelocityInDisplayUnits(e)||t>this.maxVelocityInDisplayUnits(e)||(e?this.rotationVelocityDegPerSec=t:this.translationVelocityMmPerSec=t)}setSelectedCartesianMotionType(t){this.selectedCartesianMotionType=t}lock(t){this.locks.add(t)}unlock(t){this.locks.delete(t)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket().catch(t=>{console.error("Failed to initialize jogging:",t)})}async withMotionLock(t){const e=Pe();this.lock(e);try{return await t()}finally{this.unlock(e)}}}const co=w.observer(({store:o,useDegree:t})=>{var l;const{t:e}=$.useTranslation(),i=E.useId(),n=[];function r(a){switch(a){case"coordsys":return e("Jogging.Orientation.coordsys");case"tool":return e("Jogging.Orientation.tool");default:return a}}return o.showCoordSystemSelect&&n.push(s.jsx(it,{labelId:`jogging-coord-select-${i}`,labelValue:e("Jogging.CoordinateSystem.hlb"),value:o.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:a=>o.setSelectedCoordSystemId(a.target.value),children:o.coordSystems.map(a=>s.jsx(z,{value:a.coordinate_system,children:a.name&&o.coordSystemCountByName[a.name]>1?`${a.name} / ${a.coordinate_system}`:a.name||a.coordinate_system},a.coordinate_system))},"coord")),o.showTcpSelect&&n.push(s.jsx(it,{labelId:`jogging-tcp-select-${i}`,labelValue:"TCP",value:o.selectedTcpId,size:"small",variant:"filled",displayEmpty:o.tcpChangeInProgress,onChange:a=>{o.requestTcpChange(a.target.value).catch(g=>{console.error("Failed to change TCP:",g)})},disabled:o.tcpChangeInProgress,endAdornment:o.tcpChangeInProgress?s.jsx(ve,{position:"end",children:s.jsx(Rt,{size:16})}):void 0,children:o.tcps.map(a=>s.jsx(z,{value:a.id,children:a.id},a.id))},"tcp")),o.showOrientationSelect&&n.push(s.jsx(it,{labelValue:e("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${i}`,value:o.selectedOrientation,onChange:a=>o.setSelectedOrientation(a.target.value),children:ao.map(a=>s.jsx(z,{value:a,children:r(a)},a))},"orientation")),o.showIncrementSelect&&n.push(s.jsxs(it,{labelValue:e("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${i}`,size:"small",variant:"filled",value:((l=o.activeDiscreteIncrement)==null?void 0:l.id)||"continuous",onChange:a=>o.setSelectedIncrementId(a.target.value),children:[s.jsx(z,{value:"continuous",children:e("Jogging.Increment.Continuous.dd")},"continuous"),o.discreteIncrementOptions.map(a=>s.jsx(z,{value:a.id,children:t?`${a.degrees}°`:`${a.mm}mm`},a.id))]},"increment")),s.jsx(F,{component:"div","data-testid":"jogging-options","aria-label":"jogging-options",sx:{display:"grid",gap:"16px",gridTemplateColumns:"1fr 1fr",gridAutoRows:"min-content","& label":{opacity:.7,fontSize:"12px",marginBottom:"4px"}},children:n.map((a,g)=>s.jsx(F,{sx:{gridColumn:n.length%2===1&&g===n.length-1?"span 2":"auto"},children:a},g))})}),go=B.styled(Ee)(({theme:o})=>{var t;return{"&.MuiToggleButtonGroup-root":{background:(t=o.palette.backgroundPaperElevation)==null?void 0:t[8],borderRadius:"8px",padding:"4px",gap:"4px",button:{border:"none",borderRadius:"4px",flex:"1 1 0px",minWidth:0,"&.MuiToggleButtonGroup-firstButton":{borderRadius:"8px 4px 4px 8px"},"&.MuiToggleButtonGroup-lastButton":{borderRadius:"4px 8px 8px 4px"}}}}}),qt=Q.externalizeComponent(w.observer(o=>{const{store:t}=o,{t:e}=$.useTranslation();function i(n,r){r===o.velocity||!Ce(r)||o.onVelocityChange(r,o.useDegree)}return s.jsxs(x,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[t.showVelocityLegend&&s.jsx(M,{sx:{color:H.velocitySliderLegendColor,fontSize:"14px"},children:e("Jogging.Velocity.bt")}),s.jsx(Pt,{value:o.velocity,color:"secondary",onChange:i,min:o.min,max:o.max,"aria-labelledby":"input-slider",disabled:o.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),t.showVelocitySliderLabel&&(o.renderValue?o.renderValue(o.velocity):s.jsx(yt,{value:o.velocity.toString()}))]})}));function yt({value:o,sx:t}){var i;const e=B.useTheme();return s.jsx(x,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(i=e.palette.backgroundPaperElevation)==null?void 0:i[8],borderRadius:"10px",minWidth:"111px",...t},children:s.jsx(M,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:e.palette.text.primary,whiteSpace:"nowrap"},children:o})})}const Ut=w.observer(({store:o,useDegree:t})=>{const{t:e}=$.useTranslation();function i(n,r){return r?`ω = ${e("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:n})}`:`v = ${e("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:n})}`}return s.jsx(qt,{store:o,velocity:o.velocityInDisplayUnits(t),min:o.minVelocityInDisplayUnits(t),max:o.maxVelocityInDisplayUnits(t),onVelocityChange:o.setVelocityFromSlider,useDegree:t,disabled:o.isLocked,renderValue:n=>s.jsx(yt,{value:i(n,t),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),zt=w.observer(({store:o})=>{var l,a,g;const{t}=$.useTranslation(),e=B.useTheme(),i=((g=(a=(l=o.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:l.details)==null?void 0:a.state)==null?void 0:g.kind)??"KIND_UNKNOWN",n=o.lastJogError,r=o.lastJogErrorTranslationKey;return s.jsxs(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",color:e.palette.text.primary},children:[s.jsx(M,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:t("Jogging.StreamStateSection.lb")}),s.jsx(M,{variant:"body2",color:n?"error":void 0,sx:{fontSize:"0.75rem",lineHeight:1.2,textAlign:"right"},"data-testid":n?"JOG_ERROR":i,children:n?r?t(r):n:t(`Jogging.StreamStateSection.${i}.lb`)})]})}),uo=w.observer(({store:o,children:t})=>{const{t:e}=$.useTranslation(),i=B.useTheme(),n=E.useRef(0);function r(d,c){(c==="translate"||c==="rotate")&&o.setSelectedCartesianMotionType(c)}async function l(d,c){const f=await o.activate(),y=f.motionStream.rapidlyChangingMotionState.tcp_pose,j=f.motionStream.rapidlyChangingMotionState.joint_position;y&&await o.withMotionLock(async()=>{try{o.setCurrentIncrementJog({axis:d.axis,direction:d.direction}),await o.jogger.runIncrementalCartesianMotion({currentTcpPose:y,currentJoints:j,coordSystemId:o.activeCoordSystemId,velocityInRelevantUnits:o.selectedCartesianMotionType==="translate"?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec,axis:d.axis,direction:d.direction,motion:o.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:c.mm}:{type:"rotate",distanceRads:I.degreesToRadians(c.degrees)}})}finally{o.setCurrentIncrementJog(null),await o.deactivate()}})}async function a(d){if(o.isLocked)return;const c=++n.current;try{if(await o.activate(),c!==n.current)return;if(o.activeDiscreteIncrement)return await l(d,o.activeDiscreteIncrement);d.motionType==="translate"?await o.jogger.translateTCP({axis:d.axis,direction:d.direction,velocityMmPerSec:o.translationVelocityMmPerSec}):await o.jogger.rotateTCP({axis:d.axis,direction:d.direction,velocityRadsPerSec:o.rotationVelocityRadsPerSec})}catch(f){console.error("Jogging failed:",f)}}async function g(){o.activeDiscreteIncrement||(n.current++,await o.deactivate())}const u=[{id:"x",icon:s.jsx(We,{}),colors:H.cartesianAxisColors.X},{id:"y",icon:s.jsx(Ye,{}),colors:H.cartesianAxisColors.Y},{id:"z",icon:s.jsx(Qe,{}),colors:H.cartesianAxisColors.Z}];function h(d){return e("General.mm.variable",{amount:d.toFixed(1)})}function p(d){return e("General.degree.variable",{amount:I.radiansToDegrees(d).toFixed(1)})}return s.jsxs(x,{"data-testid":"jogging-cartesian-tab","aria-label":"jogging-cartesian-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[s.jsxs(x,{gap:2,children:[s.jsx(co,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),s.jsx(Ut,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),s.jsx(W,{})]}),s.jsx(x,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:s.jsxs(x,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[s.jsxs(go,{value:o.selectedCartesianMotionType,onChange:r,exclusive:!0,"aria-label":e("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[s.jsx(bt,{value:"translate",children:e("Jogging.Cartesian.Translation.bt")}),s.jsx(bt,{value:"rotate",children:e("Jogging.Cartesian.Rotation.bt")})]}),o.selectedCartesianMotionType==="translate"&&u.map(d=>{var c,f;return s.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:o.isLocked,activeJoggingDirection:((c=o.incrementJogInProgress)==null?void 0:c.axis)===d.id?o.incrementJogInProgress.direction:void 0,label:s.jsxs(s.Fragment,{children:[d.icon,s.jsx(M,{sx:{fontSize:"24px",color:((f=d.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,j;return h(((j=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.position)==null?void 0:j[I.XYZ_TO_VECTOR[d.id]])||0)},startJogging:y=>a({axis:d.id,motionType:"translate",direction:y}),stopJogging:g},d.id)}),o.selectedCartesianMotionType==="rotate"&&u.map(d=>{var c,f;return s.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:o.isLocked,activeJoggingDirection:((c=o.incrementJogInProgress)==null?void 0:c.axis)===d.id?o.incrementJogInProgress.direction:void 0,label:s.jsxs(s.Fragment,{children:[s.jsx(Xe,{}),s.jsx(M,{sx:{fontSize:"24px",color:((f=d.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,j;return p(((j=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.orientation)==null?void 0:j[I.XYZ_TO_VECTOR[d.id]])||0)},startJogging:y=>a({axis:d.id,motionType:"rotate",direction:y}),stopJogging:g},d.id)})]})}),s.jsx(Bt,{store:o}),s.jsx(W,{}),s.jsx(zt,{store:o}),t&&s.jsx(W,{}),t]})}),ho=w.observer(({store:o,children:t})=>{const e=B.useTheme(),i=E.useRef(0);async function n(l){const a=++i.current;try{if(await o.activate(),a!==i.current)return;await o.jogger.rotateJoints({joint:l.joint,direction:l.direction,velocityUnit:o.jointType===V.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:o.jointType===V.JointTypeEnum.PrismaticJoint?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec})}catch(g){console.error("Jogging failed:",g)}}async function r(){i.current++,await o.jogger.stop(),await o.deactivate()}return s.jsxs(x,{"data-testid":"jogging-joint-tab","aria-label":"jogging-joint-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[s.jsx(Ut,{store:o,useDegree:o.jointType===V.JointTypeEnum.RevoluteJoint}),s.jsx(W,{}),s.jsx(x,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:s.jsx(x,{"data-testid":"jogging-joint-value-controls-wrapper","aria-label":"jogging-joint-value-controls-wrapper",alignItems:"center",gap:"24px",children:o.jogger.motionStream.joints.map(l=>{var g,u,h;const a=(h=(u=(g=o.motionGroupDescription.operation_limits.auto_limits)==null?void 0:g.joints)==null?void 0:u[l.index])==null?void 0:h.position;return s.jsxs(x,{"data-testid":`jogging-joint-value-control-${l.index}`,"aria-label":`jogging-joint-value-control-${l.index}`,direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[o.showJointsLegend&&s.jsx(M,{color:o.isLocked?e.palette.text.disabled:e.palette.text.secondary,children:`G${l.index+1}`}),s.jsx(Lt,{disabled:o.isLocked,lowerLimit:a==null?void 0:a.lower_limit,upperLimit:a==null?void 0:a.upper_limit,useDegree:o.jointType===V.JointTypeEnum.RevoluteJoint,getValue:()=>{const p=o.jogger.motionStream.rapidlyChangingMotionState.joint_position[l.index];return p!==void 0?p:void 0},startJogging:p=>n({joint:l.index,direction:p}),stopJogging:r})]},`joint-${l.index}`)})})}),s.jsx(Bt,{store:o}),s.jsx(W,{}),s.jsx(zt,{store:o}),t&&s.jsx(W,{}),t]})}),po=Q.externalizeComponent(w.observer(o=>{const t=w.useLocalObservable(()=>({joggingStore:null,loadingError:null}));return E.useEffect(()=>{let e=!1,i;async function n(){m.runInAction(()=>{t.loadingError=null,t.joggingStore=null});try{let r=o.store;if(!r){const l=await tt.open(o.nova,o.motionGroupId,{cellId:o.cellId});if(e){l.dispose();return}try{r=await Y.loadFor(l)}catch(a){throw l.dispose(),a}if(i=r,e){r.dispose();return}}m.runInAction(()=>{t.joggingStore=r}),o.onSetup&&o.onSetup(r)}catch(r){if(e)return;m.runInAction(()=>{t.loadingError=r})}}return n(),()=>{e=!0,i==null||i.dispose()}},[o.store,o.nova,o.motionGroupId,o.cellId]),E.useEffect(()=>{const e=t.joggingStore;e&&(o.locked?e.lock("external"):e.unlock("external"))},[t.joggingStore,o.locked]),s.jsx(x,{"data-testid":"jogging-panel","aria-label":"jogging-panel",sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...o.sx},children:t.joggingStore?s.jsx(mo,{store:t.joggingStore,children:o.children}):s.jsx($t,{message:"Loading jogging",error:t.loadingError})})})),mo=w.observer(({store:o,children:t})=>{const{t:e}=$.useTranslation();function i(){if(o.currentTab.id==="cartesian")return s.jsx(uo,{store:o,children:t});if(o.currentTab.id==="joint")return s.jsx(ho,{store:o,children:t})}return s.jsxs(x,{flexGrow:1,sx:{overflow:"hidden"},children:[s.jsx(fe,{"data-testid":"jogging-tabs","aria-label":"jogging-tabs",value:o.tabIndex,onChange:o.onTabChange,variant:"fullWidth",children:o.tabs.map(n=>{const r=n.label==="Cartesian"?e("Jogging.Cartesian.bt"):e("Jogging.Joints.bt"),l=n.label==="cartesian"?s.jsx(he,{fontSize:"small",sx:{mr:1}}):s.jsx(pe,{fontSize:"small",sx:{mr:1}});return s.jsx(me,{"data-testid":`jogging-tab-${n.id}`,"aria-label":`jogging-tab-${n.id}`,label:o.showTabIcons?s.jsxs(x,{direction:"row",alignItems:"center",children:[l,r]}):r,id:`jogging-tab-${n.id}`,"aria-controls":`jogging-tab-${n.id}`},n.id)})}),s.jsx(x,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:i()}),o.blocked&&s.jsx(Ue,{store:o})]})});function fo(){const o=window.location.href;return o.substring(0,o.indexOf("/",o.indexOf("//")+2))}function yo({baseUrl:o=fo(),...t}){return s.jsxs(Oe,{"aria-labelledby":"no-motion-group-modal-title",open:!0,fullWidth:!0,sx:{"& .MuiModal-backdrop":{backdropFilter:"blur(10px)"},"& .MuiDialog-paper":{"::before":{content:'""',height:"8px",width:"100%",background:"linear-gradient(90deg, #FF0E65 0%, #47D3FF 100%)"},background:"#101629"}},children:[s.jsx(Ae,{id:"no-motion-group-modal-title",children:"No motion group found"}),s.jsxs(ke,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[s.jsx(M,{color:"#fff",children:"Found no devices to connect to."}),s.jsx(M,{color:"#fff",children:"Please ensure a motion group has been created."})]}),s.jsx(Re,{children:s.jsxs(x,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[s.jsx(ct,{href:`${o}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),s.jsx(ct,{href:`${o}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}const Ct=1e-4,So={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class at{constructor(t,e,i,n,r,l,a,g,u,h,p="cell"){this.controller=e,this.motionGroup=i,this.initialMotionState=n,this.motionStateSocket=r,this.isVirtual=l,this.tcps=a,this.description=g,this.initialControllerState=u,this.controllerStateSocket=h,this.cellId=p,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.nova=b.createNovaClient(t),this.rapidlyChangingMotionState=n,this.controllerState=u,h.addEventListener("message",d=>{var f;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;c&&m.runInAction(()=>{this.controllerState=c})}),r.addEventListener("message",d=>{var f;const c=(f=I.tryParseJson(d.data))==null?void 0:f.result;if(!c)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${d.data}`);ut(this.rapidlyChangingMotionState.joint_position,c.joint_position,Ct)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=c.joint_position}),ht(this.rapidlyChangingMotionState,c,Ct)||m.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=c.tcp_pose}),c.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==c.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=c.tcp}),this.rapidlyChangingMotionState.standstill!==c.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=c.standstill})}),m.makeAutoObservable(this)}static async connectMultiple(t,e,i={}){const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t);return Promise.all(e.map(l=>at.connect(n,l,{...i,cellId:r})))}static async connect(t,e,i={}){var R,k;const n=b.createNovaClient(t),r=i.cellId??b.cellIdOf(t)??"cell",[l,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(C=>C.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const h=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await h.firstMessage(),d=(R=I.tryParseJson(p.data))==null?void 0:R.result;if(!d)throw new Error(`Unable to parse initial motion state message ${p.data}`);console.log(`Connected motion state websocket to motion group ${u.motion_group}. Initial state:
2
2
  `,d);const f=(await n.api.controller.getRobotController(r,g.controller)).configuration.kind==="VirtualController",y=await n.api.motionGroup.getMotionGroupDescription(r,a,u.motion_group),j=Object.entries(y.tcps||{}).map(([C,A])=>({id:C,readable_name:A.name,position:A.pose.position,orientation:A.pose.orientation})),_=n.openReconnectingWebsocket(`/cells/${r}/controllers/${g.controller}/state-stream?response_rate=1000`),T=await _.firstMessage(),O=(k=I.tryParseJson(T.data))==null?void 0:k.result;if(!O)throw new Error(`Unable to parse initial controller state message ${T.data}`);return console.log(`Connected controller state websocket to controller ${g.controller}. Initial state:
3
3
  `,O),new at(n,g,u,d,h,f,j,y,O,_,r)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get modelFromController(){return this.description.motion_group_model}get joggingVelocityRads(){return this.joggingVelocity*Math.PI/180}get joints(){return this.initialMotionState.joint_position.map((t,e)=>({index:e}))}get dhParameters(){if(this.description.dh_parameters!==void 0)return this.description.dh_parameters.map(t=>({...So,...t}))}get safetyZones(){return this.description.safety_zones}get mountingPosition(){var t,e,i;return this.description.mounting?[(((t=this.description.mounting.position)==null?void 0:t[0])||0)/1e3,(((e=this.description.mounting.position)==null?void 0:e[1])||0)/1e3,(((i=this.description.mounting.position)==null?void 0:i[2])||0)/1e3]:[0,0,0]}get mountingQuaternion(){var n,r,l,a,g,u;const t=new xt.Vector3(((r=(n=this.description.mounting)==null?void 0:n.orientation)==null?void 0:r[0])||0,((a=(l=this.description.mounting)==null?void 0:l.orientation)==null?void 0:a[1])||0,((u=(g=this.description.mounting)==null?void 0:g.orientation)==null?void 0:u[2])||0),e=t.length(),i=t.normalize();return new xt.Quaternion().setFromAxisAngle(i,e)}get isEstopActive(){return["SAFETY_STATE_ROBOT_EMERGENCY_STOP","SAFETY_STATE_DEVICE_EMERGENCY_STOP"].includes(this.controllerState.safety_state)}get isMoveableSafetyState(){return["SAFETY_STATE_NORMAL","SAFETY_STATE_REDUCED"].includes(this.controllerState.safety_state)}get isMoveableOperationMode(){return["OPERATION_MODE_AUTO","OPERATION_MODE_MANUAL","OPERATION_MODE_MANUAL_T1","OPERATION_MODE_MANUAL_T2"].includes(this.controllerState.operation_mode)}get canBeMoved(){return this.isMoveableSafetyState&&this.isMoveableOperationMode&&this.activationState==="active"}async deactivate(){if(this.activationState!=="active"){console.error("Tried to deactivate while already deactivating");return}m.runInAction(()=>{this.activationState="deactivating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_MONITOR"),m.runInAction(()=>{this.activationState="inactive"})}catch(t){throw m.runInAction(()=>{this.activationState="active"}),t}}async activate(){if(this.activationState!=="inactive"){console.error("Tried to activate while already activating");return}m.runInAction(()=>{this.activationState="activating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_CONTROL"),m.runInAction(()=>{this.activationState="active"})}catch(t){throw m.runInAction(()=>{this.activationState="inactive"}),t}}toggleActivation(){this.activationState==="inactive"?this.activate():this.activationState==="active"&&this.deactivate()}dispose(){this.motionStateSocket.close(),this.controllerStateSocket.close(),this.connectedJoggingSocket&&this.connectedJoggingSocket.close()}setJoggingVelocity(t){this.joggingVelocity=t}}const St=1e-4,jo=new Set(["timestamp","sequence_number","joint_position","joint_torque","joint_current","flange_pose","tcp_pose","flange_velocity","tcp_velocity"]),bo=1,Tt=o=>Array.isArray(o)&&o.length===3&&o.every(t=>typeof t=="number");class Wt{constructor(t,e,i,n={}){this.source=t,this.motionGroupId=e,this.lastMessageReceivedAt=Date.now(),this.lastInvalidStateMessage=null,this.connectionQuality="good";const r=i.motion_groups.find(l=>l.motion_group===e);if(!r)throw new Error(`Motion group ${e} not found in initial controller state`);this.isVirtual=n.isVirtual??!1,this.onError=n.onError,this.reconnectsOnFocus=(n.reconnectOnFocus??!0)&&typeof window<"u",this.rapidlyChangingMotionState=r,this.lastValidStateMessage={receivedAt:Date.now(),data:i},m.makeAutoObservable(this,{source:!1,lastMessageReceivedAt:!1,connectionQualityInterval:!1,isVirtual:!1,onError:!1,reconnectsOnFocus:!1,readoutState:m.computed({equals:ft,keepAlive:!0})},{autoBind:!0}),this.source.addEventListener("message",this.handleMessage),this.connectionQualityInterval=setInterval(this.updateConnectionQuality,500),this.reconnectsOnFocus&&window.addEventListener("focus",this.handleWindowFocus)}get controllerState(){return this.lastValidStateMessage.data}get readoutState(){return mt(this.rapidlyChangingMotionState)}async nextMotionState(){var i,n;const t=await this.source.nextMessage(),e=(n=(i=this.source.parse(t.data))==null?void 0:i.motion_groups)==null?void 0:n.find(r=>r.motion_group===this.motionGroupId);if(!e)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${t.data}`);return e}setLastInvalidStateMessage(t){this.lastInvalidStateMessage={receivedAt:Date.now(),data:t}}setLastValidStateMessage(t){this.lastValidStateMessage={receivedAt:Date.now(),data:t}}updateRapidlyChangingMotionState(t,e){const i=this.rapidlyChangingMotionState,n=t;for(const r of Object.keys(n))e!=null&&e.has(r)||At(i[r],n[r])||(i[r]=n[r]);for(const r of Object.keys(i))e!=null&&e.has(r)||r in n||delete i[r]}setConnectionQuality(t){this.connectionQuality=t}handleWindowFocus(){this.source.reconnect()}updateConnectionQuality(){const t=Date.now()-this.lastMessageReceivedAt,e=this.isVirtual?3e3:1e3,i=this.isVirtual?6e3:3e3;if(t>i){this.source.readyState===bo&&this.source.reconnect(),this.setConnectionQuality("critical");return}if(t>e){this.setConnectionQuality("struggling");return}this.setConnectionQuality("good")}dispose(){this.source.removeEventListener("message",this.handleMessage),clearInterval(this.connectionQualityInterval),this.reconnectsOnFocus&&window.removeEventListener("focus",this.handleWindowFocus)}handleMessage(t){var u,h;const e=this.source.parse(t.data);if(!(e!=null&&e.motion_groups)){(u=this.onError)==null||u.call(this,{message:I.makeErrorMessage(t.data),url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}this.lastMessageReceivedAt=Date.now();const i=this.lastValidStateMessage.data;(i.safety_state!==e.safety_state||i.operation_mode!==e.operation_mode||i.mode!==e.mode)&&this.setLastValidStateMessage(e);const n=e.motion_groups.find(p=>p.motion_group===this.motionGroupId);if(!n){(h=this.onError)==null||h.call(this,{message:`Motion group ${this.motionGroupId} not found in controller state: ${JSON.stringify(t.data)}`,url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}const r=!Z(this.rapidlyChangingMotionState.joint_position,n.joint_position,St),l=this.rapidlyChangingMotionState.tcp!==n.tcp;if(!r&&!l){this.updateRapidlyChangingMotionState(n,jo);return}const a=this.rapidlyChangingMotionState.flange_pose,g=n.flange_pose;if((g==null?void 0:g.orientation)==null||!Tt(g.orientation)){const p=g==null?void 0:g.orientation;throw new Error(`Invalid newFlangePose.orientation: expected [number, number, number] (got ${p==null?"null":p.length})`)}if((a==null?void 0:a.orientation)==null||!Tt(a.orientation)){const p=a==null?void 0:a.orientation;throw new Error(`Invalid oldFlangePose.orientation: expected [number, number, number] (got ${p==null?"null":p.length})`)}g.orientation=pt(g.orientation,a.orientation),this.updateRapidlyChangingMotionState(n)}}function vo(o){return{get url(){return o.url},get readyState(){return o.readyState},addEventListener:(t,e)=>o.addEventListener(t,e),removeEventListener:(t,e)=>o.removeEventListener(t,e),firstMessage:()=>o.firstMessage(),nextMessage:()=>o.nextMessage(),reconnect:()=>o.reconnect(),close:()=>o.close(),parse:t=>{var e;return(e=Jt.tryParseJson(t))==null?void 0:e.result}}}function Ht(o,{controllerId:t,cellId:e,responseRateMs:i}){const n=b.createNovaClient(o),r=e??b.cellIdOf(o)??"cell",l=i===void 0?"":`?response_rate=${i}`;return vo(n.openReconnectingWebsocket(`/cells/${r}/controllers/${t}/state-stream${l}`))}const xo=["FeedbackOutOfWorkspace","FeedbackJointLimitExceeded","FeedbackAxisRangeExceeded","FeedbackNoSolutionInCurrentConfiguration"];function Yt(o){return o==="FeedbackSingularity"?"Jogging.TargetPose.Error.Singularity.lb":o==="FeedbackCollision"?"Jogging.TargetPose.Error.Collision.lb":xo.includes(o)?"Jogging.TargetPose.Error.NotReachable.lb":"Jogging.TargetPose.Error.PlanningFailed.lb"}const Kt=["motionGroupDescription","controllerConfiguration","kinematicModel","motionGroupModel","coordinateSystems","controllerState","motionStateStream","controllerStateStream"];class jt extends Error{constructor(t,e,i){super(i),this.stepId=t,this.cause=e,this.name="RobotLoadStepError"}}function rt(o){return o instanceof jt}class Qt{constructor(t=null,e=null){this.motionGroupId=null,this.controllerId=null,this.steps=[],this.retryAttempt=0,this.fatalError=null,this.currentStepStartedAt=null,this.motionGroupId=t,this.controllerId=e,this.steps=Kt.map(i=>({id:i,status:"pending",url:null,error:null})),m.makeAutoObservable(this,{},{autoBind:!0})}beginRetry(t){for(const e of this.steps)e.status="pending",e.url=null,e.error=null;this.retryAttempt=t,this.fatalError=null,this.currentStepStartedAt=null}stepById(t){return this.steps.find(e=>e.id===t)}startStep(t,e){const i=this.stepById(t);i&&(i.status="running",i.url=e,i.error=null,this.currentStepStartedAt=Date.now())}updateStepUrl(t,e){const i=this.stepById(t);i&&(i.url=e)}succeedStep(t){const e=this.stepById(t);e&&(e.status="succeeded",this.currentStepStartedAt=null)}failStep(t,e){const i=this.stepById(t);i&&(i.status="failed",i.error=e,this.currentStepStartedAt=null)}failWith(t){this.fatalError=t,this.currentStepStartedAt=null}get totalCount(){return this.steps.length}get succeededCount(){return this.steps.filter(t=>t.status==="succeeded").length}get runningStep(){return this.steps.find(t=>t.status==="running")}get failedStep(){return this.steps.find(t=>t.status==="failed")}get isFailed(){return this.fatalError!==null||this.failedStep!==void 0}get isComplete(){return this.steps.length>0&&this.steps.every(t=>t.status==="succeeded")}}const _o=1e4;async function Mt(o,t,e){let i;o.catch(()=>{});try{return await Promise.race([o,new Promise((n,r)=>{i=setTimeout(()=>r(new Error(e)),t)})])}finally{clearTimeout(i)}}async function Io({nova:o,cellId:t,controllerId:e,motionGroupId:i,progress:n,createStateSource:r,isStale:l=()=>!1,socketTimeoutMs:a=_o}){let g,u,h=!1;function p(){g==null||g.dispose(),u==null||u.close()}async function d(c,f,y){n.startStep(c,f);try{const j=await y();return n.succeedStep(c),j}catch(j){throw n.failStep(c,j),new jt(c,j,I.makeErrorMessage(j))}}try{if(l())return null;const c=`/cells/${t}/controllers/${e}/motion-groups/${i}`,f=`/cells/${t}/controllers/${e}`,y=await d("motionGroupDescription",`${c}/description`,()=>o.api.motionGroup.getMotionGroupDescription(t,e,i));if(l())return null;const{configuration:j}=await d("controllerConfiguration",f,()=>o.api.controller.getRobotController(t,e));if(l())return null;const _={model:y.motion_group_model,serialNumber:y.serial_number},T=_.serialNumber?`?serial_number=${encodeURIComponent(_.serialNumber)}`:"",O=await d("kinematicModel",`/experimental/motion-group-models/${encodeURIComponent(_.model)}/kinematic${T}`,()=>b.getMotionGroupModelResource(o,_.model,_.serialNumber,"kinematic",S=>n.updateStepUrl("kinematicModel",S)));if(l())return null;const R=await d("motionGroupModel",`/experimental/motion-group-models/${encodeURIComponent(_.model)}/description${T}`,()=>b.resolveMotionGroupModelName(o,_.model,_.serialNumber,S=>n.updateStepUrl("motionGroupModel",S)));if(l())return null;const k=await d("coordinateSystems",`${f}/coordinate-systems?orientation_type=ROTATION_VECTOR`,async()=>await o.api.controller.listCoordinateSystems(t,e,"ROTATION_VECTOR")??[]);if(l())return null;const{controllerState:C,motionGroupState:A}=await d("controllerState",`${f}/state`,async()=>{const S=await o.api.controller.getCurrentRobotControllerState(t,e),P=S==null?void 0:S.motion_groups.find(J=>J.motion_group===i);if(!S||!P)throw new Error(`Controller ${e} or motion group ${i} not found`);return{controllerState:S,motionGroupState:P}});if(l())return null;const N=`${c}/state-stream`,{socket:G,initialMotionState:D}=await d("motionStateStream",N,async()=>{var K;const S=o.openReconnectingWebsocket(N);g=S;const P=await Mt(S.firstMessage(),a,`No motion state received from ${N} within ${a/1e3}s`),J=(K=Jt.tryParseJson(P.data))==null?void 0:K.result;if(!J)throw new Error(`Unable to parse initial motion state message ${P.data}`);return{socket:S,initialMotionState:J}});if(l())return null;const{source:L,initialControllerState:et}=await d("controllerStateStream",`${f}/state`,async()=>{var K;const S=r({cellId:t,controllerId:e});u=S,n.updateStepUrl("controllerStateStream",S.url);const P=await Mt(S.firstMessage(),a,`No controller state received from ${S.url} within ${a/1e3}s`),J=S.parse(P.data);if(!J)throw new Error(`Unable to parse initial controller state message ${P.data}`);if(!((K=J.motion_groups)!=null&&K.some(se=>se.motion_group===i)))throw new Error(`Controller state from ${S.url} does not list motion group ${i} yet`);return{source:S,initialControllerState:J}});return l()?null:(h=!0,{motionGroupDescription:y,controllerConfiguration:j,kinematicModel:O,motionGroupModelName:R,coordinateSystems:k,controllerState:C,motionGroupState:A,initialMotionState:D,motionStateSocket:G,stateSource:L,initialControllerState:et,dispose:p})}finally{h||p()}}class Zt{constructor(t){this.options=t,this.plannedTrajectory=null,this.trajectoryState="idle",this.lastError=null,this.disposers=[],this.logger=t.logger??console,m.makeAutoObservable(this,{socket:!1,disposers:!1,logger:!1,options:!1},{autoBind:!0}),this.socket=this.openSocket(),this.disposers.push(m.reaction(()=>this.executionState,e=>{e==="END_OF_TRAJECTORY"&&this.reset()}))}get joggingStore(){return this.options.joggingStore}get jogger(){return this.options.joggingStore.jogger}get motionStream(){return this.options.joggingStore.jogger.motionStream}get executionState(){var t,e;return(e=(t=this.motionStream.rapidlyChangingMotionState.execute)==null?void 0:t.details)==null?void 0:e.state.kind}async planTrajectory(t){var _,T,O,R,k;if((T=(_=this.options).isLocked)!=null&&T.call(_))throw this.reset(),new Error("Cannot plan trajectory: the robot is locked");await this.ensureMovementOwnership();const e=this.motionStream.rapidlyChangingMotionState.joint_position??[],{cycle_time:i,mounting:n,motion_group_model:r,tcps:l}=this.motionStream.description,a=this.joggingStore.selectedTcpId,g=a?(O=l==null?void 0:l[a])==null?void 0:O.pose:void 0,u={motion_group_model:((R=this.jogger.options)==null?void 0:R.motionGroupModel)??r,cycle_time:i??0,mounting:n,...g&&{tcp_offset:g}};let h;if(t.type==="cartesian"){let C=t.pose;const A=t.coordinateSystemId||"world";if(A!=="world")try{C=b.transformPoseToCoordinateSystem({pose:{position:C.position??[0,0,0],orientation:C.orientation??[0,0,0]},coordinateSystemId:A},"world",this.joggingStore.coordSystems).pose}catch{return this.reset(),{ok:!1,errorFeedbackName:"FeedbackUnknown"}}h={limits_override:{tcp_velocity_limit:this.joggingStore.translationVelocityMmPerSec},path:{target_pose:C,path_definition_name:"PathCartesianPTP"}}}else h={limits_override:{joint_velocity_limits:Array(e.length).fill(this.joggingStore.rotationVelocityRadsPerSec)},path:{target_joint_position:t.joints,path_definition_name:"PathJointPTP"}};m.runInAction(()=>{this.lastError=null,this.trajectoryState="planning"});let p;try{p=await this.jogger.nova.api.trajectoryPlanning.planTrajectory(this.jogger.cellId,{motion_group_setup:u,start_joint_position:e,motion_commands:[h]})}catch(C){throw this.reset(),C}const d=p.response;if("error_feedback"in d){const C=((k=d.error_feedback)==null?void 0:k.error_feedback_name)??"FeedbackUnknown";return this.reset(),{ok:!1,errorFeedbackName:C}}const c=d.joint_positions,f=c[0],y=c[c.length-1];if(!f||!y)throw this.reset(),new Error("Trajectory returned invalid joint positions");const j={message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.jogger.motionGroupId,tcp:a||void 0,data:d}};return this.socket.sendJson(j),m.runInAction(()=>{this.plannedTrajectory={startJoints:f,endJoints:y}}),{ok:!0}}start(){if(!this.plannedTrajectory)throw new Error("Cannot start trajectory: no planned trajectory exists");if(this.trajectoryState!=="planned")throw new Error(`Cannot start trajectory: expected state "planned", got "${this.trajectoryState}"`);if(this.executionState==="RUNNING")throw new Error("Cannot start trajectory: robot is already running");const t={message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"};this.socket.sendJson(t)}async pause(){if(this.trajectoryState!=="moving")throw new Error(`Cannot pause trajectory: expected state "moving", got "${this.trajectoryState}"`);if(this.executionState==="PAUSED_BY_USER")throw new Error("Cannot pause trajectory: robot is already paused");const t={message_type:"PauseMovementRequest"};this.socket.sendJson(t),await this.waitUntilStopped(),m.runInAction(()=>{this.trajectoryState=this.plannedTrajectory?"planned":"idle"})}async stopAndReset(){try{if(this.executionState==="RUNNING"||this.trajectoryState==="moving"){const t={message_type:"PauseMovementRequest"};this.socket.sendJson(t),await this.waitUntilStopped()}}catch(t){this.logger.warn("Failed to stop trajectory execution cleanly",t)}finally{this.reset(),this.closeSocket(),this.socket=this.openSocket()}}reset(){this.plannedTrajectory=null,this.trajectoryState="idle"}clearError(){this.lastError=null}dispose(){for(const t of this.disposers)t();this.closeSocket()}async ensureMovementOwnership(){if(this.options.ensureMovementOwnership){await this.options.ensureMovementOwnership();return}this.jogger.mode!=="trajectory"&&(await this.joggingStore.deactivate(),await this.jogger.setJoggingMode("trajectory"))}async waitUntilStopped(){await m.when(()=>this.motionStream.rapidlyChangingMotionState.standstill)}handleMessage(t){var i,n;const e=(i=I.tryParseJson(t.data))==null?void 0:i.result;if(e)switch(e.kind){case"INITIALIZE_RECEIVED":e.add_trajectory_error||e.message?(this.lastError=((n=e.add_trajectory_error)==null?void 0:n.message)??e.message??"NOVA refused the trajectory",this.reset()):this.trajectoryState="planned";break;case"START_RECEIVED":this.trajectoryState="moving";break;case"PAUSE_RECEIVED":this.trajectoryState==="moving"&&(this.trajectoryState="stopping");break;case"MOTION_ERROR":this.lastError=e.message,this.reset();break}}openSocket(){const t=this.jogger.nova.openReconnectingWebsocket(`/cells/${this.jogger.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);return t.addEventListener("message",this.handleMessage),t}closeSocket(){this.socket.removeEventListener("message",this.handleMessage),this.socket.dispose()}}const Eo={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class Xt{constructor(t,e,i,n,r){this.motionGroupDescription=t,this.controllerConfiguration=e,this.kinematicModel=i,this.resolvedMotionGroupModel=n,this.coordinateSystems=r,this.dhParameters=(t.dh_parameters??[]).map(l=>({...Eo,...l}))}get isVirtual(){return this.controllerConfiguration.kind==="VirtualController"}get motionGroupModel(){return this.motionGroupDescription.motion_group_model}get serialNumber(){return this.motionGroupDescription.serial_number}get inverseSolver(){return this.kinematicModel.inverse_solver}get jointType(){var t,e;return((e=(t=this.motionGroupDescription.dh_parameters)==null?void 0:t[0])==null?void 0:e.type)??V.JointTypeEnum.RevoluteJoint}get jointLimits(){var t;return((t=this.motionGroupDescription.operation_limits.auto_limits)==null?void 0:t.joints)??[]}get safetyZones(){return this.motionGroupDescription.safety_zones}get safetyLinkColliders(){return this.motionGroupDescription.safety_link_colliders}get safetyToolColliders(){return this.motionGroupDescription.safety_tool_colliders}get kinematicChainOffset(){return this.kinematicModel.kinematic_chain_offset??this.motionGroupDescription.kinematic_chain_offset??null}get flangeOffset(){return this.kinematicModel.flange_offset??this.motionGroupDescription.flange_offset??null}get mounting(){return this.motionGroupDescription.mounting??null}get tcps(){return Object.entries(this.motionGroupDescription.tcps??{}).map(([t,e])=>({id:t,name:e.name}))}get tcpOffsetsById(){return this.motionGroupDescription.tcps??{}}}const wt=o=>Array.isArray(o)&&o.length===3&&o.every(t=>typeof t=="number"),Co=.001,To=.5,Mo=.01,lt=(o,t,e)=>!!(o&&t&&Z([...o],[...t],e));class te{constructor(t,e,i){this.stream=t,this.description=e,this.jogging=i,m.makeAutoObservable(this,{stream:!1,description:!1,jogging:!1},{autoBind:!0})}get controllerState(){return this.stream.controllerState}get rapidlyChangingMotionState(){return this.stream.rapidlyChangingMotionState}get readoutState(){return this.stream.readoutState}get jointPose(){return this.stream.readoutState.joint_position}get connectionQuality(){return this.stream.connectionQuality}get lastValidStateMessage(){return this.stream.lastValidStateMessage}get lastInvalidStateMessage(){return this.stream.lastInvalidStateMessage}get measuredTcpPoseReference(){return this.tcpPoseReferenceOf(this.rapidlyChangingMotionState)}get displayedTcpPoseReference(){return this.inSelectedFrame(this.measuredTcpPoseReference)}get displayedTcpPose(){return this.inSelectedFrame(this.tcpPoseReferenceOf(this.readoutState)).pose}isAt(t){if(t.type==="joint")return lt(t.joints,this.rapidlyChangingMotionState.joint_position,Co);try{const e=b.deriveSelectedTcpPose({inputPose:this.measuredTcpPoseReference,selectedTcpId:t.tcpPose.tcpId,selectedCoordinateSystemId:t.tcpPose.coordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems});return lt(t.tcpPose.pose.position,e.pose.position,To)&&lt(t.tcpPose.pose.orientation,e.pose.orientation,Mo)}catch{return!1}}nextMotionState(){return this.stream.nextMotionState()}async waitUntilStopped(){let t=await this.stream.nextMotionState(),e=await this.stream.nextMotionState();for(;!Z(t.joint_position,e.joint_position,St);)t=e,e=await this.stream.nextMotionState()}tcpPoseReferenceOf(t){var n,r;const e=(n=t.tcp_pose)==null?void 0:n.position,i=(r=t.tcp_pose)==null?void 0:r.orientation;if(!e||!wt(e))throw new Error(`Invalid current TCP pose position for motion group ${this.stream.motionGroupId}`);if(!i||!wt(i))throw new Error(`Invalid current TCP pose orientation for motion group ${this.stream.motionGroupId}`);return{pose:{position:e,orientation:i},tcpId:t.tcp??"",coordinateSystemId:t.coordinate_system??"world"}}inSelectedFrame(t){return b.deriveSelectedTcpPose({inputPose:t,selectedTcpId:this.jogging.selectedTcpId,selectedCoordinateSystemId:this.jogging.selectedCoordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems})}}const wo=["SAFETY_STATE_ROBOT_EMERGENCY_STOP","SAFETY_STATE_DEVICE_EMERGENCY_STOP"],Oo=["SAFETY_STATE_NORMAL","SAFETY_STATE_REDUCED"],Ro=["SAFETY_STATE_STOP","SAFETY_STATE_STOP_0","SAFETY_STATE_STOP_1","SAFETY_STATE_STOP_2"],ko=["OPERATION_MODE_AUTO","OPERATION_MODE_MANUAL","OPERATION_MODE_MANUAL_T1","OPERATION_MODE_MANUAL_T2"];class ee{constructor(t,e){this.state=t,this.activationState=e,m.makeAutoObservable(this,{state:!1,activationState:!1},{autoBind:!0})}get safetyState(){return this.state.controllerState.safety_state}get operationMode(){return this.state.controllerState.operation_mode}get isEstopActive(){return wo.includes(this.safetyState)}get isMoveableSafetyState(){return Oo.includes(this.safetyState)}get isMoveableOperationMode(){return ko.includes(this.operationMode)}get isActivatableSafetyState(){return this.isMoveableSafetyState||Ro.includes(this.safetyState)}get activationBlockedReason(){return this.isEstopActive?`an emergency stop is active (${this.safetyState})`:this.isActivatableSafetyState?this.isMoveableOperationMode?null:`the operation mode is ${this.operationMode}`:`the safety state is ${this.safetyState}`}get canBeActive(){return this.activationBlockedReason===null}get notMoveableReason(){return this.state.connectionQuality==="critical"?{code:"disconnected"}:this.isMoveableSafetyState?this.isMoveableOperationMode?this.activationState()==="inactive"?{code:"deactivated"}:null:{code:"operation_mode",value:this.operationMode}:{code:"safety_state",value:this.safetyState}}get canBeMoved(){return this.isMoveableSafetyState&&this.isMoveableOperationMode&&this.activationState()==="active"&&this.state.connectionQuality!=="critical"}}function oe(o){return o.type==="joint"?{type:"joint",joints:o.joints}:{type:"cartesian",pose:o.tcpPose.pose,coordinateSystemId:o.tcpPose.coordSystemId}}class ie{constructor(t,e){this.robot=t,this.logger=e,this.editing=!1,this.draft="",this.confirming=!1,this.staged=null,this.moveStarted=!1,this.disposers=[],m.makeAutoObservable(this,{robot:!1,logger:!1,disposers:!1,onBeforePlan:!1},{autoBind:!0}),this.disposers.push(m.reaction(()=>this.robot.jogging.selectedTabId,()=>{(this.editing||this.staged)&&this.resetToLive()})),this.disposers.push(m.reaction(()=>({trajectoryState:this.robot.trajectory.trajectoryState,executionState:this.robot.trajectory.executionState,isRobotAtStagedPose:this.isRobotAtStagedPose}),({trajectoryState:i,executionState:n,isRobotAtStagedPose:r})=>{if(!this.stagedPose)return;if(i==="moving"){this.moveStarted=!0;return}(n==="END_OF_TRAJECTORY"||this.moveStarted&&r&&i!=="stopping")&&this.resetToLive()}))}dispose(){for(const t of this.disposers)t()}get phase(){return this.editing?"editing":this.staged?this.staged.errorKey?"error":"staged":"view"}get isJointTab(){return this.robot.jogging.selectedTabId==="joint"}get liveDisplayString(){return this.isJointTab?U.jointsToText(this.robot.state.jointPose):U.poseToText(this.robot.state.displayedTcpPose)}get displayString(){var t;return((t=this.staged)==null?void 0:t.displayString)??this.liveDisplayString}get parsedDraft(){const{state:t,motionGroupId:e}=this.robot;if(this.isJointTab){const r=U.parseJointsText(this.draft,t.jointPose.length);return r?{type:"joint",motionGroupId:e,joints:r}:null}const i=U.parsePoseText(this.draft);if(!i)return null;const n=t.displayedTcpPoseReference;return{type:"cartesian",motionGroupId:e,tcpPose:{pose:{position:i.position,orientation:i.orientation},coordSystemId:n.coordinateSystemId,tcpId:n.tcpId}}}get draftValid(){return this.parsedDraft!==null}beginEdit(){this.draft=this.displayString,this.editing=!0}setDraft(t){this.draft=t}cancelEdit(){this.editing=!1,this.draft=""}async confirmEdit(){var i;const t=this.parsedDraft;if(!t||this.confirming||this.robot.notMoveableReason())return;const e=t.type==="joint"?U.jointsToText(t.joints):U.poseToText(t.tcpPose.pose);this.confirming=!0;try{await((i=this.onBeforePlan)==null?void 0:i.call(this));const n=await this.robot.trajectory.planTrajectory(oe(t));m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:n.ok?null:Yt(n.errorFeedbackName)},this.editing=!1,this.draft=""})}catch(n){this.logger.warn("Failed to plan trajectory to typed pose",n),m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:"Jogging.TargetPose.Error.PlanningFailed.lb"},this.editing=!1,this.draft=""})}finally{m.runInAction(()=>{this.confirming=!1})}}async resetToLive(){const t=this.staged!==null&&!this.staged.errorKey;this.staged=null,this.moveStarted=!1,this.editing=!1,this.draft="",t&&await this.robot.trajectory.stopAndReset()}clear(){this.editing=!1,this.staged=null}get stagedPose(){return!this.staged||this.staged.errorKey?null:this.staged.pose}get isRobotAtStagedPose(){return this.stagedPose?this.robot.state.isAt(this.stagedPose):!1}}const Ao={getItem:()=>null,setItem:()=>{}};class ne{constructor(t,e,i,n={}){const r=n.logger??console;this.onError=n.onError??(()=>{}),this.nova=t,this.motionGroupId=e.motionGroupId,this.controllerId=e.controllerId,this.cellId=e.cellId,this.stateSource=i.stateSource,this.motionStateSocket=i.motionStateSocket;const l=new X(t,i.controllerState,i.motionGroupState,i.motionGroupDescription,i.initialMotionState,i.motionStateSocket,e.cellId,{logger:r}),a=new tt(l,{cellId:e.cellId,motionGroupModel:i.motionGroupModelName,logger:r,onError:u=>this.onError({kind:"jog",message:I.makeErrorMessage(u),url:a.motionStream.motionStateSocket.url,cause:u})});this.jogging=Y.create(a,{coordinateSystems:i.coordinateSystems,description:i.motionGroupDescription,kinematicModel:i.kinematicModel},{storage:n.storage??Ao}),this.description=new Xt(i.motionGroupDescription,i.controllerConfiguration,i.kinematicModel,i.motionGroupModelName,this.jogging.coordSystems);const g=new Wt(i.stateSource,e.motionGroupId,i.initialControllerState,{isVirtual:this.description.isVirtual,onError:u=>this.onError({kind:"stream",...u})});this.state=new te(g,this.description,this.jogging),this.activation=new vt.RobotActivation(t,e,this.state,()=>this.safety,r,()=>this.releasePlannedMove()),this.safety=new ee(this.state,()=>this.activation.state),this.trajectory=new Zt({joggingStore:this.jogging,isLocked:n.isLocked,ensureMovementOwnership:()=>this.ensureMovementOwnership("trajectory"),logger:r}),this.targetPose=new ie({motionGroupId:e.motionGroupId,state:this.state,jogging:this.jogging,trajectory:this.trajectory,notMoveableReason:()=>{var u;return this.safety.notMoveableReason??((u=n.isLocked)!=null&&u.call(n)?{code:"locked"}:null)}},r),this.jogging.onBeforeActivate=async()=>{this.targetPose.staged&&await this.targetPose.resetToLive()},n.autoActivateVirtual&&this.description.isVirtual&&this.activation.state==="inactive"&&this.activation.activate().catch(u=>{this.onError({kind:"mode",message:I.makeErrorMessage(u),url:u instanceof vt.RobotModeChangeError?u.url:void 0,cause:u})})}reportError(t){this.onError(t)}get movementOwner(){return this.jogging.jogger.mode}async ensureMovementOwnership(t){this.movementOwner!==t&&(await this.jogging.deactivate(),await this.jogging.jogger.setJoggingMode(t))}async releasePlannedMove(){this.targetPose.staged&&await this.targetPose.resetToLive(),(this.trajectory.plannedTrajectory||this.trajectory.trajectoryState!=="idle")&&await this.trajectory.stopAndReset()}dispose(){this.activation.dispose(),this.targetPose.dispose(),this.state.stream.dispose(),this.trajectory.dispose(),this.stateSource.close(),this.jogging.dispose(),this.motionStateSocket.dispose()}}const Po=[1e3,2e3],Jo=o=>new Promise(t=>setTimeout(t,o));class re{constructor(t,e,i,n){this.nova=t,this.motionGroupId=e,this.ids=i,this.options=n,this.state="loading",this.session=null,this.error=null,this.attempt=0,this.disposed=!1,this.progress=new Qt(e,i.controllerId),m.makeAutoObservable(this,{nova:!1,ids:!1,options:!1,attempt:!1,disposed:!1,readyPromise:!1,settle:!1,progress:!1},{autoBind:!0}),this.start()}get ready(){return this.readyPromise}retry(){this.disposed||this.state!=="failed"||this.start()}dispose(){var t;this.disposed||(this.disposed=!0,this.attempt++,(t=this.session)==null||t.dispose(),this.session=null,this.settle.reject(new Error("The robot session load was disposed")))}start(){this.attempt++;const t=this.attempt;this.readyPromise=new Promise((e,i)=>{this.settle={resolve:e,reject:i}}),this.readyPromise.catch(()=>{}),m.runInAction(()=>{this.state="loading",this.error=null}),this.run(t)}isStale(t){return this.disposed||t!==this.attempt}async run(t){var a,g;const{cellId:e,controllerId:i}=this.ids,n=this.options.retryDelaysMs??Po,r=this.options.logger??console,l=this.options.stateSource??(u=>Ht(this.nova,u));for(let u=0;;u++)try{const h=await Io({nova:this.nova,cellId:e,controllerId:i,motionGroupId:this.motionGroupId,progress:this.progress,createStateSource:l,isStale:()=>this.isStale(t),socketTimeoutMs:this.options.socketTimeoutMs});if(!h)return;if(this.isStale(t)){h.dispose();return}let p;try{p=new ne(this.nova,{cellId:e,controllerId:i,motionGroupId:this.motionGroupId},h,this.options)}catch(d){throw h.dispose(),d}if(this.isStale(t)){p.dispose();return}m.runInAction(()=>{this.session=p,this.state="ready"}),this.settle.resolve(p);return}catch(h){if(this.isStale(t))return;const p=rt(h)?n[u]:void 0;if(p===void 0){m.runInAction(()=>{rt(h)?this.progress.failStep(h.stepId,h.cause):this.progress.failWith(h),this.state="failed",this.error=h}),(g=(a=this.options).onEvent)==null||g.call(a,{type:"loadFailed",motionGroupId:this.motionGroupId,step:rt(h)?h.stepId:"unknown",message:I.makeErrorMessage(h),attempts:u+1}),this.settle.reject(h);return}if(r.warn(`Retrying load of robot "${this.motionGroupId}" after: ${I.makeErrorMessage(h)}`),m.runInAction(()=>{this.progress.beginRetry(u+1)}),await Jo(p),this.isStale(t))return}}}function Do(o,t,e={}){return Lo(b.createNovaClient(o),t,{...e,cellId:e.cellId??b.cellIdOf(o)})}function Lo(o,t,e={}){const i=e.cellId??"cell",n=e.controllerId??t.split("@")[1]??"";return new re(o,t,{cellId:i,controllerId:n},e)}exports.AppHeader=Je;exports.ConnectedMotionGroup=at;exports.ControllerStateStream=Wt;exports.JoggerConnection=tt;exports.JoggingCartesianAxisControl=dt;exports.JoggingJointValueControl=Lt;exports.JoggingPanel=po;exports.JoggingStore=Y;exports.LoadingCover=$t;exports.LoadingErrorMessage=Ft;exports.MOTION_DELTA_THRESHOLD=St;exports.MotionStreamConnection=X;exports.NoMotionGroupModal=yo;exports.ROBOT_LOAD_STEP_IDS=Kt;exports.RobotDescription=Xt;exports.RobotLiveState=te;exports.RobotLoadProgress=Qt;exports.RobotLoadStepError=jt;exports.RobotSafety=ee;exports.RobotSession=ne;exports.RobotSessionLoad=re;exports.RobotTargetPose=ie;exports.TrajectoryExecutionStore=Zt;exports.VelocitySlider=qt;exports.VelocitySliderLabel=yt;exports.controllerStateWebsocket=Ht;exports.isRobotLoadStepError=rt;exports.jointValuesEqual=Z;exports.jointValuesUnchanged=ut;exports.loadRobotSession=Do;exports.planErrorTranslationKey=Yt;exports.poseEqual=Vt;exports.readoutOf=mt;exports.readoutsEqual=ft;exports.tcpMotionEqual=ht;exports.trajectoryTargetOf=oe;exports.unwrapRotationVector=pt;
@@ -1 +1 @@
1
- "use strict";const u=require("react/jsx-runtime"),T=require("@mui/material/Box"),g=require("@mui/material/MenuItem"),S=require("@mui/material/Stack"),b=require("@mui/material/Typography"),p=require("@wandelbots/mui"),c=require("react");function x(t,e){var i;return((i=t.find(r=>r.id===e))==null?void 0:i.label)??String(e)}function y(t){return t.map(e=>u.jsx(g,{value:e.id,children:e.label},e.id))}function j({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsx(p.AdornedSelect,{label:t,labelId:n,value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})}function I({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsxs(S,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[u.jsx(b,{id:n,variant:"body2",color:"text.secondary",children:t}),u.jsx(T,{sx:{width:"calc((100% - 12px) / 2)",flexShrink:0},children:u.jsx(p.AdornedSelect,{labelId:n,adornedSize:"small",value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})})]})}function m(){try{return document.execCommand("copy")}catch{return!1}}function q(){const[t,e]=c.useState(!1);c.useEffect(()=>{if(!t)return;const r=setTimeout(()=>e(!1),3e3);return()=>clearTimeout(r)},[t]);async function i(r,s){try{if(navigator.clipboard){await navigator.clipboard.writeText(r),e(!0);return}}catch{}if(s){s(),m()&&e(!0);return}const n=document.createElement("textarea");n.value=r,n.readOnly=!0,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),m()&&e(!0),n.remove()}return{copied:t,copy:i}}const C=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,l=(t,e)=>Number.parseFloat(t.toFixed(e));function E(t,e={}){const i=e.positionPrecision??1,r=e.rotationPrecision??4,s=n=>[0,1,2].map(o=>(n==null?void 0:n[o])??0);return`(${[...s(t.position).map(n=>l(n,i)),...s(t.orientation).map(n=>l(n,r))].join(", ")})`}function F(t){return`[${t.map(e=>l(e,4)).join(", ")}]`}function h(t,e,i){let r=t.trim();const s=r.startsWith(e),n=r.endsWith(i);if(s!==n||(s&&(r=r.slice(1,-1)),r.trim()===""))return null;const o=[];for(const a of r.split(",")){const d=a.trim();if(!C.test(d))return null;const f=Number(d);if(!Number.isFinite(f))return null;o.push(f)}return o}function P(t){const e=h(t,"(",")");if((e==null?void 0:e.length)!==6)return null;const[i,r,s,n,o,a]=e;return{position:[i,r,s],orientation:[n,o,a]}}function v(t,e){const i=h(t,"[","]");return(i==null?void 0:i.length)!==e?null:i}function w(t,e){const i=c.useRef(t);i.current=t;const[r,s]=c.useState(t);return c.useEffect(()=>{if(!e)return;let n=0;const o=()=>{s(i.current()),n=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(n)},[e]),r}exports.InlineSelect=I;exports.PanelSelect=j;exports.jointsToText=F;exports.parseJointsText=v;exports.parsePoseText=P;exports.poseToText=E;exports.useCopyText=q;exports.useEveryFrame=w;
1
+ "use strict";const u=require("react/jsx-runtime"),T=require("@mui/material/Box"),g=require("@mui/material/MenuItem"),S=require("@mui/material/Stack"),b=require("@mui/material/Typography"),p=require("@wandelbots/mui"),c=require("react");function x(t,e){var i;return((i=t.find(r=>r.id===e))==null?void 0:i.label)??String(e)}function y(t){return t.map(e=>u.jsx(g,{value:e.id,children:e.label},e.id))}function j({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsx(p.AdornedSelect,{label:t,labelId:n,value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})}function I({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsxs(S,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[u.jsx(b,{id:n,variant:"body2",color:"text.secondary",children:t}),u.jsx(T,{sx:{width:"calc((100% - 12px) / 2)",flexShrink:0},children:u.jsx(p.AdornedSelect,{labelId:n,adornedSize:"small",value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})})]})}function m(){try{return document.execCommand("copy")}catch{return!1}}function q(){const[t,e]=c.useState(!1);c.useEffect(()=>{if(!t)return;const r=setTimeout(()=>e(!1),3e3);return()=>clearTimeout(r)},[t]);async function i(r,s){try{if(navigator.clipboard){await navigator.clipboard.writeText(r),e(!0);return}}catch{}if(s){s(),m()&&e(!0);return}const n=document.createElement("textarea");n.value=r,n.readOnly=!0,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),m()&&e(!0),n.remove()}return{copied:t,copy:i}}const C=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/,l=(t,e)=>Number.parseFloat(t.toFixed(e));function E(t,e={}){const i=e.positionPrecision??1,r=e.rotationPrecision??4,s=n=>[0,1,2].map(o=>(n==null?void 0:n[o])??0);return`(${[...s(t.position).map(n=>l(n,i)),...s(t.orientation).map(n=>l(n,r))].join(", ")})`}function F(t){return`[${t.map(e=>l(e,4)).join(", ")}]`}function h(t,e,i){let r=t.trim();const s=r.startsWith(e),n=r.endsWith(i);if(s!==n||(s&&(r=r.slice(1,-1)),r.trim()===""))return null;const o=[];for(const a of r.split(",")){const d=a.trim();if(!C.test(d))return null;const f=Number(d);if(!Number.isFinite(f))return null;o.push(f)}return o}function P(t){const e=h(t,"(",")");if((e==null?void 0:e.length)!==6)return null;const[i,r,s,n,o,a]=e;return{position:[i,r,s],orientation:[n,o,a]}}function v(t,e){const i=h(t,"[","]");return(i==null?void 0:i.length)!==e?null:i}function w(t,e){const i=c.useRef(t);i.current=t;const[r,s]=c.useState(t);return c.useEffect(()=>{if(!e)return;let n=0;const o=()=>{s(i.current()),n=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(n)},[e]),r}exports.InlineSelect=I;exports.PanelSelect=j;exports.jointsToText=F;exports.parseJointsText=v;exports.parsePoseText=P;exports.poseToText=E;exports.useCopyText=q;exports.useEveryFrame=w;
@@ -95,7 +95,7 @@ function k() {
95
95
  }
96
96
  return { copied: e, copy: o };
97
97
  }
98
- const E = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/, u = (e, t) => Number.parseFloat(e.toFixed(t));
98
+ const E = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/, u = (e, t) => Number.parseFloat(e.toFixed(t));
99
99
  function B(e, t = {}) {
100
100
  const o = t.positionPrecision ?? 1, r = t.rotationPrecision ?? 4, c = (n) => [0, 1, 2].map((i) => (n == null ? void 0 : n[i]) ?? 0);
101
101
  return `(${[
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@wandelbots/mui");const o=require("./chunks/loadRobotSession-D84myCwy.cjs"),e=require("./chunks/robotActivationOf-BCKyEgny.cjs"),n=require("./chunks/CurrentPose-fWc6ySnk.cjs"),s=require("./chunks/CurrentPoseBar-CSHQ26mR.cjs"),g=require("./chunks/JoggingButtons-nXLqJLIr.cjs"),l=require("./chunks/JoggingJointSlider-D7AsxkrT.cjs"),i=require("./chunks/robotSafetyOf-Y4NuRInk.cjs"),t=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),u=require("./chunks/externalizeComponent-BW1UV6Gh.cjs"),r=require("./chunks/useEveryFrame-CHxg25f4.cjs"),a=require("./chunks/RobotSessionProvider--AekyPqD.cjs");exports.AppHeader=o.AppHeader;exports.ConnectedMotionGroup=o.ConnectedMotionGroup;exports.ControllerStateStream=o.ControllerStateStream;exports.JoggerConnection=o.JoggerConnection;exports.JoggingCartesianAxisControl=o.JoggingCartesianAxisControl;exports.JoggingJointValueControl=o.JoggingJointValueControl;exports.JoggingPanel=o.JoggingPanel;exports.JoggingStore=o.JoggingStore;exports.LoadingCover=o.LoadingCover;exports.LoadingErrorMessage=o.LoadingErrorMessage;exports.MOTION_DELTA_THRESHOLD=o.MOTION_DELTA_THRESHOLD;exports.MotionStreamConnection=o.MotionStreamConnection;exports.NoMotionGroupModal=o.NoMotionGroupModal;exports.ROBOT_LOAD_STEP_IDS=o.ROBOT_LOAD_STEP_IDS;exports.RobotDescription=o.RobotDescription;exports.RobotLiveState=o.RobotLiveState;exports.RobotLoadProgress=o.RobotLoadProgress;exports.RobotLoadStepError=o.RobotLoadStepError;exports.RobotSafety=o.RobotSafety;exports.RobotSession=o.RobotSession;exports.RobotSessionLoad=o.RobotSessionLoad;exports.RobotTargetPose=o.RobotTargetPose;exports.TrajectoryExecutionStore=o.TrajectoryExecutionStore;exports.VelocitySlider=o.VelocitySlider;exports.VelocitySliderLabel=o.VelocitySliderLabel;exports.controllerStateWebsocket=o.controllerStateWebsocket;exports.isRobotLoadStepError=o.isRobotLoadStepError;exports.jointValuesEqual=o.jointValuesEqual;exports.jointValuesUnchanged=o.jointValuesUnchanged;exports.loadRobotSession=o.loadRobotSession;exports.planErrorTranslationKey=o.planErrorTranslationKey;exports.poseEqual=o.poseEqual;exports.readoutOf=o.readoutOf;exports.readoutsEqual=o.readoutsEqual;exports.tcpMotionEqual=o.tcpMotionEqual;exports.trajectoryTargetOf=o.trajectoryTargetOf;exports.unwrapRotationVector=o.unwrapRotationVector;exports.ConnectionWarning=e.ConnectionWarning;exports.RobotActivation=e.RobotActivation;exports.RobotHeader=e.RobotHeader;exports.RobotModeChangeError=e.RobotModeChangeError;exports.connectionWarningOf=e.connectionWarningOf;exports.robotActivationOf=e.robotActivationOf;exports.CurrentPose=n.CurrentPose;exports.useCurrentPoseProps=n.useCurrentPoseProps;exports.CurrentPoseBar=s.CurrentPoseBar;exports.JoggingButtons=g.JoggingButtons;exports.JoggingJointSlider=l.JoggingJointSlider;exports.SafetyBar=i.SafetyBar;exports.robotSafetyOf=i.robotSafetyOf;exports.ValueInterpolator=t.ValueInterpolator;exports.deriveSelectedTcpPose=t.deriveSelectedTcpPose;exports.resolveCoordinateSystemInWorld=t.resolveCoordinateSystemInWorld;exports.transformPoseToCoordinateSystem=t.transformPoseToCoordinateSystem;exports.useInterpolation=t.useInterpolation;exports.useSmoothedMotionState=t.useSmoothedMotionState;exports.i18n=u.i18n;exports.jointsToText=r.jointsToText;exports.parseJointsText=r.parseJointsText;exports.parsePoseText=r.parsePoseText;exports.poseToText=r.poseToText;exports.RobotSessionProvider=a.RobotSessionProvider;exports.useRobotSession=a.useRobotSession;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@wandelbots/mui");const o=require("./chunks/loadRobotSession-TAmPu5-5.cjs"),e=require("./chunks/robotActivationOf-BCKyEgny.cjs"),n=require("./chunks/CurrentPose-d8-aJzMZ.cjs"),s=require("./chunks/CurrentPoseBar-CgNJwnxA.cjs"),g=require("./chunks/JoggingButtons-nXLqJLIr.cjs"),l=require("./chunks/JoggingJointSlider-D7AsxkrT.cjs"),i=require("./chunks/robotSafetyOf-Y4NuRInk.cjs"),t=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),u=require("./chunks/externalizeComponent-BW1UV6Gh.cjs"),r=require("./chunks/useEveryFrame-891OscPu.cjs"),a=require("./chunks/RobotSessionProvider--AekyPqD.cjs");exports.AppHeader=o.AppHeader;exports.ConnectedMotionGroup=o.ConnectedMotionGroup;exports.ControllerStateStream=o.ControllerStateStream;exports.JoggerConnection=o.JoggerConnection;exports.JoggingCartesianAxisControl=o.JoggingCartesianAxisControl;exports.JoggingJointValueControl=o.JoggingJointValueControl;exports.JoggingPanel=o.JoggingPanel;exports.JoggingStore=o.JoggingStore;exports.LoadingCover=o.LoadingCover;exports.LoadingErrorMessage=o.LoadingErrorMessage;exports.MOTION_DELTA_THRESHOLD=o.MOTION_DELTA_THRESHOLD;exports.MotionStreamConnection=o.MotionStreamConnection;exports.NoMotionGroupModal=o.NoMotionGroupModal;exports.ROBOT_LOAD_STEP_IDS=o.ROBOT_LOAD_STEP_IDS;exports.RobotDescription=o.RobotDescription;exports.RobotLiveState=o.RobotLiveState;exports.RobotLoadProgress=o.RobotLoadProgress;exports.RobotLoadStepError=o.RobotLoadStepError;exports.RobotSafety=o.RobotSafety;exports.RobotSession=o.RobotSession;exports.RobotSessionLoad=o.RobotSessionLoad;exports.RobotTargetPose=o.RobotTargetPose;exports.TrajectoryExecutionStore=o.TrajectoryExecutionStore;exports.VelocitySlider=o.VelocitySlider;exports.VelocitySliderLabel=o.VelocitySliderLabel;exports.controllerStateWebsocket=o.controllerStateWebsocket;exports.isRobotLoadStepError=o.isRobotLoadStepError;exports.jointValuesEqual=o.jointValuesEqual;exports.jointValuesUnchanged=o.jointValuesUnchanged;exports.loadRobotSession=o.loadRobotSession;exports.planErrorTranslationKey=o.planErrorTranslationKey;exports.poseEqual=o.poseEqual;exports.readoutOf=o.readoutOf;exports.readoutsEqual=o.readoutsEqual;exports.tcpMotionEqual=o.tcpMotionEqual;exports.trajectoryTargetOf=o.trajectoryTargetOf;exports.unwrapRotationVector=o.unwrapRotationVector;exports.ConnectionWarning=e.ConnectionWarning;exports.RobotActivation=e.RobotActivation;exports.RobotHeader=e.RobotHeader;exports.RobotModeChangeError=e.RobotModeChangeError;exports.connectionWarningOf=e.connectionWarningOf;exports.robotActivationOf=e.robotActivationOf;exports.CurrentPose=n.CurrentPose;exports.useCurrentPoseProps=n.useCurrentPoseProps;exports.CurrentPoseBar=s.CurrentPoseBar;exports.JoggingButtons=g.JoggingButtons;exports.JoggingJointSlider=l.JoggingJointSlider;exports.SafetyBar=i.SafetyBar;exports.robotSafetyOf=i.robotSafetyOf;exports.ValueInterpolator=t.ValueInterpolator;exports.deriveSelectedTcpPose=t.deriveSelectedTcpPose;exports.resolveCoordinateSystemInWorld=t.resolveCoordinateSystemInWorld;exports.transformPoseToCoordinateSystem=t.transformPoseToCoordinateSystem;exports.useInterpolation=t.useInterpolation;exports.useSmoothedMotionState=t.useSmoothedMotionState;exports.i18n=u.i18n;exports.jointsToText=r.jointsToText;exports.parseJointsText=r.parseJointsText;exports.parsePoseText=r.parsePoseText;exports.poseToText=r.poseToText;exports.RobotSessionProvider=a.RobotSessionProvider;exports.useRobotSession=a.useRobotSession;
package/dist/core.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import "@wandelbots/mui";
2
- import { A as s, C as t, a as r, J as n, b as i, c as p, d as g, e as l, L as S, f as d, M as u, g as c, N as b, R as f, h as R, i as m, j as C, k as x, l as T, m as E, n as J, o as L, T as P, V as y, p as O, q as M, r as V, s as v, t as j, u as A, v as D, w as q, x as B, y as I, z as _, B as h, D as H } from "./chunks/loadRobotSession-BrXLZLOr.js";
2
+ import { A as s, C as t, a as r, J as n, b as i, c as p, d as g, e as l, L as S, f as d, M as u, g as c, N as b, R as f, h as R, i as m, j as C, k as x, l as T, m as E, n as J, o as L, T as P, V as y, p as O, q as M, r as V, s as v, t as j, u as A, v as D, w as q, x as B, y as I, z as _, B as h, D as H } from "./chunks/loadRobotSession-O5JtFiwv.js";
3
3
  import { C as N, R as k, a as w, b as G, c as z, r as K } from "./chunks/robotActivationOf-DUbbBf7J.js";
4
- import { C as F, u as Q } from "./chunks/CurrentPose-DQ-FaAnr.js";
5
- import { C as Y } from "./chunks/CurrentPoseBar-B3-XLeu2.js";
4
+ import { C as F, u as Q } from "./chunks/CurrentPose-B-dYw6Qi.js";
5
+ import { C as Y } from "./chunks/CurrentPoseBar-DAgEpcgw.js";
6
6
  import { J as $ } from "./chunks/JoggingButtons-D4S2oJGt.js";
7
7
  import { J as ao } from "./chunks/JoggingJointSlider-DQneQhXH.js";
8
8
  import { S as so, r as to } from "./chunks/robotSafetyOf-BGSW_Ql3.js";
9
9
  import { V as no, d as io, r as po, t as go, u as lo, a as So } from "./chunks/PoseTransformer-tafab65c.js";
10
10
  import { i as co } from "./chunks/externalizeComponent-TgclPxwg.js";
11
- import { j as fo, p as Ro, a as mo, b as Co } from "./chunks/useEveryFrame-DAuNawGP.js";
11
+ import { j as fo, p as Ro, a as mo, b as Co } from "./chunks/useEveryFrame-D9oux4jW.js";
12
12
  import { R as To, u as Eo } from "./chunks/RobotSessionProvider-TVaKGzqa.js";
13
13
  export {
14
14
  s as AppHeader,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./chunks/Robot-DEJXhv-D.cjs"),e=require("./chunks/RobotScene-BjctJ5z1.cjs"),c=require("./chunks/JoggingGizmo-BJ3wDpAJ.cjs"),d=require("./chunks/JoggingGizmoOrientation-D9VS6nag.cjs"),R=require("./chunks/RobotControlPanel-BXUgib6Z.cjs"),s=require("./chunks/RobotControl-0tL4CY3m.cjs"),l=require("./chunks/RobotView-BlV3MdCy.cjs"),t=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),a=require("./chunks/Pose3-Ch4xVeXV.cjs");require("@wandelbots/mui");const o=require("./chunks/loadRobotSession-D84myCwy.cjs"),r=require("./chunks/robotActivationOf-BCKyEgny.cjs"),u=require("./chunks/CurrentPose-fWc6ySnk.cjs"),b=require("./chunks/CurrentPoseBar-CSHQ26mR.cjs"),p=require("./chunks/JoggingButtons-nXLqJLIr.cjs"),T=require("./chunks/JoggingJointSlider-D7AsxkrT.cjs"),g=require("./chunks/robotSafetyOf-Y4NuRInk.cjs"),E=require("./chunks/externalizeComponent-BW1UV6Gh.cjs"),i=require("./chunks/useEveryFrame-CHxg25f4.cjs"),S=require("./chunks/RobotSessionProvider--AekyPqD.cjs");exports.CollisionSceneRenderer=n.CollisionSceneRenderer;exports.JointLimitGizmo=n.JointLimitGizmo;exports.LinearAxis=n.LinearAxis;exports.Robot=n.Robot;exports.TrajectoryRenderer=n.TrajectoryRenderer;exports.FLANGE_NODE_SUFFIX=e.FLANGE_NODE_SUFFIX;exports.JOINT_NODE_NAME=e.JOINT_NODE_NAME;exports.JOINT_REST_SUFFIX=e.JOINT_REST_SUFFIX;exports.JoggingAxes=e.JoggingAxes;exports.MODEL_ROTATION=e.MODEL_ROTATION;exports.MotionGroupVisualizer=e.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=e.MotionGroupVisualizerExact;exports.PresetEnvironment=e.PresetEnvironment;exports.RobotScene=e.RobotScene;exports.RobotSceneView=e.RobotSceneView;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedLinearAxisExact=e.SupportedLinearAxisExact;exports.SupportedRobot=e.SupportedRobot;exports.SupportedRobotExact=e.SupportedRobotExact;exports.defaultGetModel=e.defaultGetModel;exports.jointIndexOf=e.jointIndexOf;exports.revokeAllModelUrls=e.revokeAllModelUrls;exports.robotModelOf=e.robotModelOf;exports.useRobotSceneProps=e.useRobotSceneProps;exports.JoggingGizmo=c.JoggingGizmo;exports.JoggingGizmoOrientation=d.JoggingGizmoOrientation;exports.RobotControlPanel=R.RobotControlPanel;exports.RobotControl=s.RobotControl;exports.useRobotControlProps=s.useRobotControlProps;exports.RobotCanvas=l.RobotCanvas;exports.RobotView=l.RobotView;exports.ValueInterpolator=t.ValueInterpolator;exports.deriveSelectedTcpPose=t.deriveSelectedTcpPose;exports.resolveCoordinateSystemInWorld=t.resolveCoordinateSystemInWorld;exports.transformPoseToCoordinateSystem=t.transformPoseToCoordinateSystem;exports.useInterpolation=t.useInterpolation;exports.useSmoothedMotionState=t.useSmoothedMotionState;exports.Pose3=a.Pose3;exports.parseRotationToQuaternion=a.parseRotationToQuaternion;exports.quaternionToRotationVector=a.quaternionToRotationVector;exports.AppHeader=o.AppHeader;exports.ConnectedMotionGroup=o.ConnectedMotionGroup;exports.ControllerStateStream=o.ControllerStateStream;exports.JoggerConnection=o.JoggerConnection;exports.JoggingCartesianAxisControl=o.JoggingCartesianAxisControl;exports.JoggingJointValueControl=o.JoggingJointValueControl;exports.JoggingPanel=o.JoggingPanel;exports.JoggingStore=o.JoggingStore;exports.LoadingCover=o.LoadingCover;exports.LoadingErrorMessage=o.LoadingErrorMessage;exports.MOTION_DELTA_THRESHOLD=o.MOTION_DELTA_THRESHOLD;exports.MotionStreamConnection=o.MotionStreamConnection;exports.NoMotionGroupModal=o.NoMotionGroupModal;exports.ROBOT_LOAD_STEP_IDS=o.ROBOT_LOAD_STEP_IDS;exports.RobotDescription=o.RobotDescription;exports.RobotLiveState=o.RobotLiveState;exports.RobotLoadProgress=o.RobotLoadProgress;exports.RobotLoadStepError=o.RobotLoadStepError;exports.RobotSafety=o.RobotSafety;exports.RobotSession=o.RobotSession;exports.RobotSessionLoad=o.RobotSessionLoad;exports.RobotTargetPose=o.RobotTargetPose;exports.TrajectoryExecutionStore=o.TrajectoryExecutionStore;exports.VelocitySlider=o.VelocitySlider;exports.VelocitySliderLabel=o.VelocitySliderLabel;exports.controllerStateWebsocket=o.controllerStateWebsocket;exports.isRobotLoadStepError=o.isRobotLoadStepError;exports.jointValuesEqual=o.jointValuesEqual;exports.jointValuesUnchanged=o.jointValuesUnchanged;exports.loadRobotSession=o.loadRobotSession;exports.planErrorTranslationKey=o.planErrorTranslationKey;exports.poseEqual=o.poseEqual;exports.readoutOf=o.readoutOf;exports.readoutsEqual=o.readoutsEqual;exports.tcpMotionEqual=o.tcpMotionEqual;exports.trajectoryTargetOf=o.trajectoryTargetOf;exports.unwrapRotationVector=o.unwrapRotationVector;exports.ConnectionWarning=r.ConnectionWarning;exports.RobotActivation=r.RobotActivation;exports.RobotHeader=r.RobotHeader;exports.RobotModeChangeError=r.RobotModeChangeError;exports.connectionWarningOf=r.connectionWarningOf;exports.robotActivationOf=r.robotActivationOf;exports.CurrentPose=u.CurrentPose;exports.useCurrentPoseProps=u.useCurrentPoseProps;exports.CurrentPoseBar=b.CurrentPoseBar;exports.JoggingButtons=p.JoggingButtons;exports.JoggingJointSlider=T.JoggingJointSlider;exports.SafetyBar=g.SafetyBar;exports.robotSafetyOf=g.robotSafetyOf;exports.i18n=E.i18n;exports.jointsToText=i.jointsToText;exports.parseJointsText=i.parseJointsText;exports.parsePoseText=i.parsePoseText;exports.poseToText=i.poseToText;exports.RobotSessionProvider=S.RobotSessionProvider;exports.useRobotSession=S.useRobotSession;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./chunks/Robot-DEJXhv-D.cjs"),e=require("./chunks/RobotScene-BjctJ5z1.cjs"),c=require("./chunks/JoggingGizmo-BJ3wDpAJ.cjs"),d=require("./chunks/JoggingGizmoOrientation-D9VS6nag.cjs"),R=require("./chunks/RobotControlPanel-BsDe4A5F.cjs"),s=require("./chunks/RobotControl-LBoKDzUK.cjs"),l=require("./chunks/RobotView-BlV3MdCy.cjs"),t=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),a=require("./chunks/Pose3-Ch4xVeXV.cjs");require("@wandelbots/mui");const o=require("./chunks/loadRobotSession-TAmPu5-5.cjs"),r=require("./chunks/robotActivationOf-BCKyEgny.cjs"),u=require("./chunks/CurrentPose-d8-aJzMZ.cjs"),b=require("./chunks/CurrentPoseBar-CgNJwnxA.cjs"),p=require("./chunks/JoggingButtons-nXLqJLIr.cjs"),T=require("./chunks/JoggingJointSlider-D7AsxkrT.cjs"),g=require("./chunks/robotSafetyOf-Y4NuRInk.cjs"),E=require("./chunks/externalizeComponent-BW1UV6Gh.cjs"),i=require("./chunks/useEveryFrame-891OscPu.cjs"),S=require("./chunks/RobotSessionProvider--AekyPqD.cjs");exports.CollisionSceneRenderer=n.CollisionSceneRenderer;exports.JointLimitGizmo=n.JointLimitGizmo;exports.LinearAxis=n.LinearAxis;exports.Robot=n.Robot;exports.TrajectoryRenderer=n.TrajectoryRenderer;exports.FLANGE_NODE_SUFFIX=e.FLANGE_NODE_SUFFIX;exports.JOINT_NODE_NAME=e.JOINT_NODE_NAME;exports.JOINT_REST_SUFFIX=e.JOINT_REST_SUFFIX;exports.JoggingAxes=e.JoggingAxes;exports.MODEL_ROTATION=e.MODEL_ROTATION;exports.MotionGroupVisualizer=e.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=e.MotionGroupVisualizerExact;exports.PresetEnvironment=e.PresetEnvironment;exports.RobotScene=e.RobotScene;exports.RobotSceneView=e.RobotSceneView;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedLinearAxisExact=e.SupportedLinearAxisExact;exports.SupportedRobot=e.SupportedRobot;exports.SupportedRobotExact=e.SupportedRobotExact;exports.defaultGetModel=e.defaultGetModel;exports.jointIndexOf=e.jointIndexOf;exports.revokeAllModelUrls=e.revokeAllModelUrls;exports.robotModelOf=e.robotModelOf;exports.useRobotSceneProps=e.useRobotSceneProps;exports.JoggingGizmo=c.JoggingGizmo;exports.JoggingGizmoOrientation=d.JoggingGizmoOrientation;exports.RobotControlPanel=R.RobotControlPanel;exports.RobotControl=s.RobotControl;exports.useRobotControlProps=s.useRobotControlProps;exports.RobotCanvas=l.RobotCanvas;exports.RobotView=l.RobotView;exports.ValueInterpolator=t.ValueInterpolator;exports.deriveSelectedTcpPose=t.deriveSelectedTcpPose;exports.resolveCoordinateSystemInWorld=t.resolveCoordinateSystemInWorld;exports.transformPoseToCoordinateSystem=t.transformPoseToCoordinateSystem;exports.useInterpolation=t.useInterpolation;exports.useSmoothedMotionState=t.useSmoothedMotionState;exports.Pose3=a.Pose3;exports.parseRotationToQuaternion=a.parseRotationToQuaternion;exports.quaternionToRotationVector=a.quaternionToRotationVector;exports.AppHeader=o.AppHeader;exports.ConnectedMotionGroup=o.ConnectedMotionGroup;exports.ControllerStateStream=o.ControllerStateStream;exports.JoggerConnection=o.JoggerConnection;exports.JoggingCartesianAxisControl=o.JoggingCartesianAxisControl;exports.JoggingJointValueControl=o.JoggingJointValueControl;exports.JoggingPanel=o.JoggingPanel;exports.JoggingStore=o.JoggingStore;exports.LoadingCover=o.LoadingCover;exports.LoadingErrorMessage=o.LoadingErrorMessage;exports.MOTION_DELTA_THRESHOLD=o.MOTION_DELTA_THRESHOLD;exports.MotionStreamConnection=o.MotionStreamConnection;exports.NoMotionGroupModal=o.NoMotionGroupModal;exports.ROBOT_LOAD_STEP_IDS=o.ROBOT_LOAD_STEP_IDS;exports.RobotDescription=o.RobotDescription;exports.RobotLiveState=o.RobotLiveState;exports.RobotLoadProgress=o.RobotLoadProgress;exports.RobotLoadStepError=o.RobotLoadStepError;exports.RobotSafety=o.RobotSafety;exports.RobotSession=o.RobotSession;exports.RobotSessionLoad=o.RobotSessionLoad;exports.RobotTargetPose=o.RobotTargetPose;exports.TrajectoryExecutionStore=o.TrajectoryExecutionStore;exports.VelocitySlider=o.VelocitySlider;exports.VelocitySliderLabel=o.VelocitySliderLabel;exports.controllerStateWebsocket=o.controllerStateWebsocket;exports.isRobotLoadStepError=o.isRobotLoadStepError;exports.jointValuesEqual=o.jointValuesEqual;exports.jointValuesUnchanged=o.jointValuesUnchanged;exports.loadRobotSession=o.loadRobotSession;exports.planErrorTranslationKey=o.planErrorTranslationKey;exports.poseEqual=o.poseEqual;exports.readoutOf=o.readoutOf;exports.readoutsEqual=o.readoutsEqual;exports.tcpMotionEqual=o.tcpMotionEqual;exports.trajectoryTargetOf=o.trajectoryTargetOf;exports.unwrapRotationVector=o.unwrapRotationVector;exports.ConnectionWarning=r.ConnectionWarning;exports.RobotActivation=r.RobotActivation;exports.RobotHeader=r.RobotHeader;exports.RobotModeChangeError=r.RobotModeChangeError;exports.connectionWarningOf=r.connectionWarningOf;exports.robotActivationOf=r.robotActivationOf;exports.CurrentPose=u.CurrentPose;exports.useCurrentPoseProps=u.useCurrentPoseProps;exports.CurrentPoseBar=b.CurrentPoseBar;exports.JoggingButtons=p.JoggingButtons;exports.JoggingJointSlider=T.JoggingJointSlider;exports.SafetyBar=g.SafetyBar;exports.robotSafetyOf=g.robotSafetyOf;exports.i18n=E.i18n;exports.jointsToText=i.jointsToText;exports.parseJointsText=i.parseJointsText;exports.parsePoseText=i.parsePoseText;exports.poseToText=i.poseToText;exports.RobotSessionProvider=S.RobotSessionProvider;exports.useRobotSession=S.useRobotSession;
package/dist/index.js CHANGED
@@ -2,21 +2,21 @@ import { C as s, J as t, L as r, R as n, T as i } from "./chunks/Robot-IG0yo_YD.
2
2
  import { F as l, J as R, a as S, b as g, M as u, c as d, d as b, P as f, R as x, e as c, S as m, f as T, g as C, h as E, i as J, j as O, k as L, r as P, l as M, u as A } from "./chunks/RobotScene-BS77SUtN.js";
3
3
  import { J as y } from "./chunks/JoggingGizmo-9wEBSe1P.js";
4
4
  import { J as v } from "./chunks/JoggingGizmoOrientation-DYeHwowd.js";
5
- import { R as j } from "./chunks/RobotControlPanel-BzqLtecA.js";
6
- import { R as D, u as G } from "./chunks/RobotControl-C59I0tMh.js";
5
+ import { R as j } from "./chunks/RobotControlPanel-TZuS0_YA.js";
6
+ import { R as D, u as G } from "./chunks/RobotControl-CKv3zrVA.js";
7
7
  import { R as z, a as F } from "./chunks/RobotView-CGvHcO7j.js";
8
8
  import { V as B, d as k, r as w, t as H, u as U, a as W } from "./chunks/PoseTransformer-tafab65c.js";
9
9
  import { P as K, p as Q, q as Z } from "./chunks/Pose3-B_fLR-Wv.js";
10
10
  import "@wandelbots/mui";
11
- import { A as $, C as oo, a as ao, J as eo, b as so, c as to, d as ro, e as no, L as io, f as po, M as lo, g as Ro, N as So, R as go, h as uo, i as bo, j as fo, k as xo, l as co, m as mo, n as To, o as Co, T as Eo, V as Jo, p as Oo, q as Lo, r as Po, s as Mo, t as Ao, u as Vo, v as yo, w as _o, x as vo, y as Io, z as jo, B as No, D as Do } from "./chunks/loadRobotSession-BrXLZLOr.js";
11
+ import { A as $, C as oo, a as ao, J as eo, b as so, c as to, d as ro, e as no, L as io, f as po, M as lo, g as Ro, N as So, R as go, h as uo, i as bo, j as fo, k as xo, l as co, m as mo, n as To, o as Co, T as Eo, V as Jo, p as Oo, q as Lo, r as Po, s as Mo, t as Ao, u as Vo, v as yo, w as _o, x as vo, y as Io, z as jo, B as No, D as Do } from "./chunks/loadRobotSession-O5JtFiwv.js";
12
12
  import { C as qo, R as zo, a as Fo, b as ho, c as Bo, r as ko } from "./chunks/robotActivationOf-DUbbBf7J.js";
13
- import { C as Ho, u as Uo } from "./chunks/CurrentPose-DQ-FaAnr.js";
14
- import { C as Xo } from "./chunks/CurrentPoseBar-B3-XLeu2.js";
13
+ import { C as Ho, u as Uo } from "./chunks/CurrentPose-B-dYw6Qi.js";
14
+ import { C as Xo } from "./chunks/CurrentPoseBar-DAgEpcgw.js";
15
15
  import { J as Qo } from "./chunks/JoggingButtons-D4S2oJGt.js";
16
16
  import { J as Yo } from "./chunks/JoggingJointSlider-DQneQhXH.js";
17
17
  import { S as oa, r as aa } from "./chunks/robotSafetyOf-BGSW_Ql3.js";
18
18
  import { i as sa } from "./chunks/externalizeComponent-TgclPxwg.js";
19
- import { j as ra, p as na, a as ia, b as pa } from "./chunks/useEveryFrame-DAuNawGP.js";
19
+ import { j as ra, p as na, a as ia, b as pa } from "./chunks/useEveryFrame-D9oux4jW.js";
20
20
  import { R as Ra, u as Sa } from "./chunks/RobotSessionProvider-TVaKGzqa.js";
21
21
  export {
22
22
  $ as AppHeader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "6.4.0-pr.revamp.667.853b1ff",
3
+ "version": "6.4.0-pr.revamp.667.8acab07",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,