@wandelbots/wandelbots-js-react-components 3.2.0-pr.feat-improve-exports.414.40b4b4e → 3.2.0
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.
- package/README.md +2 -79
- package/dist/components/jogging/JoggingStore.d.ts +1 -1
- package/dist/index.cjs +155 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +30530 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -24
- package/dist/3d.cjs.js +0 -2
- package/dist/3d.cjs.js.map +0 -1
- package/dist/3d.d.ts +0 -11
- package/dist/3d.d.ts.map +0 -1
- package/dist/3d.es.js +0 -16
- package/dist/3d.es.js.map +0 -1
- package/dist/PoseJointValues-C3bsJdfd.js +0 -5446
- package/dist/PoseJointValues-C3bsJdfd.js.map +0 -1
- package/dist/PoseJointValues-wLOjcYDe.cjs +0 -21
- package/dist/PoseJointValues-wLOjcYDe.cjs.map +0 -1
- package/dist/ProgramStateIndicator-CTT-CAcJ.js +0 -268
- package/dist/ProgramStateIndicator-CTT-CAcJ.js.map +0 -1
- package/dist/ProgramStateIndicator-DYKBcj1s.cjs +0 -2
- package/dist/ProgramStateIndicator-DYKBcj1s.cjs.map +0 -1
- package/dist/VelocitySlider-2Zme2MN7.cjs +0 -5
- package/dist/VelocitySlider-2Zme2MN7.cjs.map +0 -1
- package/dist/VelocitySlider-QSg_8eb1.js +0 -1906
- package/dist/VelocitySlider-QSg_8eb1.js.map +0 -1
- package/dist/core.cjs.js +0 -2
- package/dist/core.cjs.js.map +0 -1
- package/dist/core.d.ts +0 -23
- package/dist/core.d.ts.map +0 -1
- package/dist/core.es.js +0 -46
- package/dist/core.es.js.map +0 -1
- package/dist/createSvgIcon-BG4_bQuX.cjs +0 -56
- package/dist/createSvgIcon-BG4_bQuX.cjs.map +0 -1
- package/dist/createSvgIcon-D3GRPlVu.js +0 -3072
- package/dist/createSvgIcon-D3GRPlVu.js.map +0 -1
- package/dist/data.cjs.js +0 -2
- package/dist/data.cjs.js.map +0 -1
- package/dist/data.d.ts +0 -4
- package/dist/data.d.ts.map +0 -1
- package/dist/data.es.js +0 -7
- package/dist/data.es.js.map +0 -1
- package/dist/externalizeComponent-C12Qf79R.cjs +0 -24
- package/dist/externalizeComponent-C12Qf79R.cjs.map +0 -1
- package/dist/externalizeComponent-RpcZ_G17.js +0 -491
- package/dist/externalizeComponent-RpcZ_G17.js.map +0 -1
- package/dist/index-8UEqiXug.cjs +0 -7
- package/dist/index-8UEqiXug.cjs.map +0 -1
- package/dist/index-CQDi5W62.cjs +0 -2
- package/dist/index-CQDi5W62.cjs.map +0 -1
- package/dist/index-DSz82V23.js +0 -1801
- package/dist/index-DSz82V23.js.map +0 -1
- package/dist/index-DZubFUuo.js +0 -4909
- package/dist/index-DZubFUuo.js.map +0 -1
- package/dist/index-MyU3fVEK.cjs +0 -50
- package/dist/index-MyU3fVEK.cjs.map +0 -1
- package/dist/index-VURe0U2S.js +0 -9443
- package/dist/index-VURe0U2S.js.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -72
- package/dist/index.es.js.map +0 -1
- package/dist/interpolation-CVSmVNjc.cjs +0 -2
- package/dist/interpolation-CVSmVNjc.cjs.map +0 -1
- package/dist/interpolation-DjBX_Si-.js +0 -138
- package/dist/interpolation-DjBX_Si-.js.map +0 -1
- package/dist/jogging.cjs.js +0 -2
- package/dist/jogging.cjs.js.map +0 -1
- package/dist/jogging.d.ts +0 -9
- package/dist/jogging.d.ts.map +0 -1
- package/dist/jogging.es.js +0 -12
- package/dist/jogging.es.js.map +0 -1
- package/dist/manufacturerHomePositions-DHqcbFON.js +0 -979
- package/dist/manufacturerHomePositions-DHqcbFON.js.map +0 -1
- package/dist/manufacturerHomePositions-zd-CKEiQ.cjs +0 -2
- package/dist/manufacturerHomePositions-zd-CKEiQ.cjs.map +0 -1
- package/dist/theming-BO8z_Hpa.js +0 -2198
- package/dist/theming-BO8z_Hpa.js.map +0 -1
- package/dist/theming-D5DvGuxX.cjs +0 -4
- package/dist/theming-D5DvGuxX.cjs.map +0 -1
- package/dist/useThemeProps-P648Ox74.cjs +0 -2
- package/dist/useThemeProps-P648Ox74.cjs.map +0 -1
- package/dist/useThemeProps-jE_Qg6SI.js +0 -40
- package/dist/useThemeProps-jE_Qg6SI.js.map +0 -1
- package/src/3d.ts +0 -15
- package/src/core.ts +0 -23
- package/src/data.ts +0 -4
- package/src/jogging.ts +0 -9
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";const p=require("./externalizeComponent-C12Qf79R.cjs"),J=require("./createSvgIcon-BG4_bQuX.cjs"),x=require("@mui/material"),we=require("lodash-es"),Z=require("mobx"),q=require("mobx-react-lite"),F=require("react"),st=require("react-i18next"),U=require("@wandelbots/nova-js"),M=require("./VelocitySlider-2Zme2MN7.cjs"),K=require("./index-8UEqiXug.cjs"),C=require("prop-types"),Ge=require("./useThemeProps-P648Ox74.cjs"),N=require("./index-CQDi5W62.cjs");function Ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=Ue(F),qe=e=>{var i;const t={systemProps:{},otherProps:{}},n=((i=e==null?void 0:e.theme)==null?void 0:i.unstable_sxConfig)??J.defaultSxConfig;return Object.keys(e).forEach(o=>{n[o]?t.systemProps[o]=e[o]:t.otherProps[o]=e[o]}),t};function We(e){const{sx:t,...n}=e,{systemProps:i,otherProps:o}=qe(n);let r;return Array.isArray(t)?r=[i,...t]:typeof t=="function"?r=(...s)=>{const c=t(...s);return J.isPlainObject(c)?{...i,...c}:i}:r={...i,...t},{...o,sx:r}}const He=J.createStyled(),Ze=J.createTheme(),Xe=He("div",{name:"MuiStack",slot:"Root"});function Ye(e){return Ge.useThemeProps({props:e,name:"MuiStack",defaultTheme:Ze})}function Qe(e,t){const n=$.Children.toArray(e).filter(Boolean);return n.reduce((i,o,r)=>(i.push(o),r<n.length-1&&i.push($.cloneElement(t,{key:`separator-${r}`})),i),[])}const Ke=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],tn=({ownerState:e,theme:t})=>{let n={display:"flex",flexDirection:"column",...J.handleBreakpoints({theme:t},J.resolveBreakpointValues({values:e.direction,breakpoints:t.breakpoints.values}),i=>({flexDirection:i}))};if(e.spacing){const i=J.createUnarySpacing(t),o=Object.keys(t.breakpoints.values).reduce((a,l)=>((typeof e.spacing=="object"&&e.spacing[l]!=null||typeof e.direction=="object"&&e.direction[l]!=null)&&(a[l]=!0),a),{}),r=J.resolveBreakpointValues({values:e.direction,base:o}),s=J.resolveBreakpointValues({values:e.spacing,base:o});typeof r=="object"&&Object.keys(r).forEach((a,l,h)=>{if(!r[a]){const u=l>0?r[h[l-1]]:"column";r[a]=u}});const c=(a,l)=>e.useFlexGap?{gap:J.getValue(i,a)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${Ke(l?r[l]:e.direction)}`]:J.getValue(i,a)}};n=J.deepmerge(n,J.handleBreakpoints({theme:t},s,c))}return n=J.mergeBreakpointsInOrder(t.breakpoints,n),n};function en(e={}){const{createStyledComponent:t=Xe,useThemeProps:n=Ye,componentName:i="MuiStack"}=e,o=()=>{const c={root:["root"]};return J.composeClasses(c,a=>J.generateUtilityClass(i,a),{})},r=t(tn),s=$.forwardRef(function(a,l){const h=n(a),d=We(h),{component:u="div",direction:g="column",spacing:y=0,divider:E,children:m,className:v,useFlexGap:T=!1,...A}=d,L={direction:g,spacing:y,useFlexGap:T},k=o();return p.jsxRuntimeExports.jsx(r,{as:u,ownerState:L,ref:l,className:J.clsx(k.root,v),...A,children:E?Qe(m,E):m})});return process.env.NODE_ENV!=="production"&&(s.propTypes={children:C.node,direction:C.oneOfType([C.oneOf(["column-reverse","column","row-reverse","row"]),C.arrayOf(C.oneOf(["column-reverse","column","row-reverse","row"])),C.object]),divider:C.node,spacing:C.oneOfType([C.arrayOf(C.oneOfType([C.number,C.string])),C.number,C.object,C.string]),sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object])}),s}const lt=en({createStyledComponent:J.styled("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>J.useDefaultProps({props:e,name:"MuiStack"})});process.env.NODE_ENV!=="production"&&(lt.propTypes={children:C.node,component:C.elementType,direction:C.oneOfType([C.oneOf(["column-reverse","column","row-reverse","row"]),C.arrayOf(C.oneOf(["column-reverse","column","row-reverse","row"])),C.object]),divider:C.node,spacing:C.oneOfType([C.arrayOf(C.oneOfType([C.number,C.string])),C.number,C.object,C.string]),sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),useFlexGap:C.bool});const nn=({title:e,titleId:t,...n},i)=>$.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,...n},e?$.createElement("title",{id:t},e):null,$.createElement("g",{id:"JogMinus"},$.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),rn=F.forwardRef(nn),on=({title:e,titleId:t,...n},i)=>$.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,...n},e?$.createElement("title",{id:t},e):null,$.createElement("g",{id:"JogPlus"},$.createElement("g",{id:"Plus"},$.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),$.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),$.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),sn=F.forwardRef(on),At=p.externalizeComponent(q.observer(({colors:e,label:t,getDisplayedValue:n,startJogging:i,stopJogging:o,disabled:r,activeJoggingDirection:s,...c})=>{var A,L,k,I,f,_,S;K.useAnimationFrame(()=>{const j=n(),w=u.current;w&&(w.textContent=j)});const a=x.useTheme(),[l,h]=F.useState(null);F.useEffect(()=>{r&&T()},[r]);const d=s||l,u=F.useRef(null);e||(e={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const g=d?(A=e.buttonBackgroundColor)==null?void 0:A.pressed:e.borderColor,y={width:"55px",color:e.color,path:{fill:e.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},E={...y,backgroundColor:(L=e.buttonBackgroundColor)==null?void 0:L.default,":hover":{backgroundColor:(k=e.buttonBackgroundColor)==null?void 0:k.hovered},":active":{backgroundColor:(I=e.buttonBackgroundColor)==null?void 0:I.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor}},":disabled":{backgroundColor:(f=e.buttonBackgroundColor)==null?void 0:f.disabled,"svg path":{fill:a.palette.action.disabled}}},m={...y,backgroundColor:(_=e.buttonBackgroundColor)==null?void 0:_.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor},":disabled":{backgroundColor:(S=e.buttonBackgroundColor)==null?void 0:S.pressed,"svg path":{fill:a.palette.action.disabled}}};function v(j,w){r||j.button===0&&(h(w),i(w))}function T(){h(null),o()}return p.jsxRuntimeExports.jsxs(lt,{height:"64px",direction:"row",justifyContent:"center",...c,children:[p.jsxRuntimeExports.jsx(x.IconButton,{disabled:r,disableRipple:!0,onPointerDown:j=>v(j,"-"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...d==="-"?m:E,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${g??"#fff"}`,borderBottom:`2px solid ${g??"#fff"}`,borderTop:`2px solid ${g??"#fff"}`},children:p.jsxRuntimeExports.jsx(rn,{})}),p.jsxRuntimeExports.jsxs(lt,{spacing:"6px",sx:{width:"150px",backgroundColor:e.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${g??"#fff"}`,borderTop:`2px solid ${g??"#fff"}`},children:[p.jsxRuntimeExports.jsx(lt,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:e.color,".MuiTypography-root":{fontWeight:700,...r?{color:a.palette.action.disabled}:{}},...r?{"svg path":{fill:a.palette.action.disabled}}:{}},children:t}),p.jsxRuntimeExports.jsx(x.Typography,{height:"22px",sx:{fontSize:"15px",color:r?a.palette.action.disabled:e.color,fontWeight:700},ref:u,children:n()})]}),p.jsxRuntimeExports.jsx(x.IconButton,{disableRipple:!0,disabled:r,onPointerDown:j=>v(j,"+"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...d==="+"?m:E,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${g??"#fff"}`,borderBottom:`2px solid ${g??"#fff"}`,borderTop:`2px solid ${g??"#fff"}`},children:p.jsxRuntimeExports.jsx(sn,{})})]})})),an=J.createSvgIcon(p.jsxRuntimeExports.jsx("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeft"),cn=J.createSvgIcon(p.jsxRuntimeExports.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");function rt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Tt=function(){return M.root.Date.now()},ln=/\s/;function un(e){for(var t=e.length;t--&&ln.test(e.charAt(t)););return t}var hn=/^\s+/;function dn(e){return e&&e.slice(0,un(e)+1).replace(hn,"")}var pn="[object Symbol]";function _t(e){return typeof e=="symbol"||M.isObjectLike(e)&&M.baseGetTag(e)==pn}var Wt=NaN,gn=/^[-+]0x[0-9a-f]+$/i,fn=/^0b[01]+$/i,mn=/^0o[0-7]+$/i,yn=parseInt;function Ht(e){if(typeof e=="number")return e;if(_t(e))return Wt;if(rt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=rt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dn(e);var n=fn.test(e);return n||mn.test(e)?yn(e.slice(2),n?2:8):gn.test(e)?Wt:+e}var xn="Expected a function",_n=Math.max,wn=Math.min;function bn(e,t,n){var i,o,r,s,c,a,l=0,h=!1,d=!1,u=!0;if(typeof e!="function")throw new TypeError(xn);t=Ht(t)||0,rt(n)&&(h=!!n.leading,d="maxWait"in n,r=d?_n(Ht(n.maxWait)||0,t):r,u="trailing"in n?!!n.trailing:u);function g(I){var f=i,_=o;return i=o=void 0,l=I,s=e.apply(_,f),s}function y(I){return l=I,c=setTimeout(v,t),h?g(I):s}function E(I){var f=I-a,_=I-l,S=t-f;return d?wn(S,r-_):S}function m(I){var f=I-a,_=I-l;return a===void 0||f>=t||f<0||d&&_>=r}function v(){var I=Tt();if(m(I))return T(I);c=setTimeout(v,E(I))}function T(I){return c=void 0,u&&i?g(I):(i=o=void 0,s)}function A(){c!==void 0&&clearTimeout(c),l=0,i=a=o=c=void 0}function L(){return c===void 0?s:T(Tt())}function k(){var I=Tt(),f=m(I);if(i=arguments,o=this,a=I,f){if(c===void 0)return y(a);if(d)return clearTimeout(c),c=setTimeout(v,t),g(a)}return c===void 0&&(c=setTimeout(v,t)),s}return k.cancel=A,k.flush=L,k}var vn="Expected a function";function jn(e,t,n){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(vn);return rt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),bn(e,t,{leading:i,maxWait:t,trailing:o})}const be=p.externalizeComponent(q.observer(({startJogging:e,stopJogging:t,lowerLimitDegs:n,upperLimitDegs:i,getValueDegs:o,disabled:r,...s})=>{var A,L,k,I,f,_,S,j,w,b,z,P,B,O,V;const{t:c}=st.useTranslation(),[a,l]=F.useState(),h=x.useTheme(),d={background:(A=h.palette.backgroundPaperElevation)==null?void 0:A[4],color:(L=h.palette.backgroundPaperElevation)==null?void 0:L[11]},u=q.useLocalObservable(()=>({activeJoggingDir:null,startJogging(R){this.activeJoggingDir=R,e(R)},stopJogging(){this.activeJoggingDir=null,t()}})),g=jn(()=>{l(o())},50);K.useAnimationFrame(g);function y(R){R.button===0&&u.startJogging("-")}function E(R){R.button===0&&u.startJogging("+")}function m(R){u.stopJogging()}function v(R){u.stopJogging()}function T(R,G=1){if(R===void 0||isNaN(R))return"";const H=c("General.degree.variable",{amount:R.toFixed(G)});return R>0&&G===0?`+${H}`:H}return p.jsxRuntimeExports.jsxs(lt,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...s,sx:{"& .MuiIconButton-root":{width:"52px",color:h.palette.text.primary,alignContent:"center",backgroundColor:(k=h.palette.backgroundPaperElevation)==null?void 0:k[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(I=h.palette.backgroundPaperElevation)==null?void 0:I[11],color:h.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(f=h.palette.backgroundPaperElevation)==null?void 0:f[9]},"&:active":{...d}}},children:[p.jsxRuntimeExports.jsx(x.IconButton,{onPointerDown:y,onPointerUp:m,onPointerOut:v,disabled:r,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...u.activeJoggingDir==="-"?d:{}},children:p.jsxRuntimeExports.jsx(an,{sx:{pointerEvents:"none",color:(w=(j=(S=(_=h.componentsExt)==null?void 0:_.JoggingPanel)==null?void 0:S.JoggingJoint)==null?void 0:j.Joint)==null?void 0:w.arrowColor}})}),p.jsxRuntimeExports.jsxs(lt,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(b=h.palette.backgroundPaperElevation)==null?void 0:b[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[p.jsxRuntimeExports.jsx(x.Typography,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",color:r?h.palette.action.disabled:h.palette.text.primary},children:T(a)}),p.jsxRuntimeExports.jsx(x.Slider,{disabled:!0,"aria-label":"Joint position",min:n,max:i,value:a||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:r?h.palette.action.disabled:h.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:r?h.palette.action.disabled:h.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(z=h.palette.backgroundPaperElevation)==null?void 0:z[5],opacity:1}},marks:n!==void 0&&i!==void 0&&[{value:n,label:T(n,0)},{value:i,label:T(i,0)}]})]}),p.jsxRuntimeExports.jsx(x.IconButton,{onPointerDown:E,onPointerUp:m,onPointerOut:v,disabled:r,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...u.activeJoggingDir==="+"?d:{}},children:p.jsxRuntimeExports.jsx(cn,{sx:{pointerEvents:"none",color:(V=(O=(B=(P=h.componentsExt)==null?void 0:P.JoggingPanel)==null?void 0:B.JoggingJoint)==null?void 0:O.Joint)==null?void 0:V.arrowColor}})})]})})),En=J.createSvgIcon(p.jsxRuntimeExports.jsx("path",{d:"M10 9h4V6h3l-5-5-5 5h3zm-1 1H6V7l-5 5 5 5v-3h3zm14 2-5-5v3h-3v4h3v3zm-9 3h-4v3H7l5 5 5-5h-3z"}),"OpenWith"),Sn=J.createSvgIcon(p.jsxRuntimeExports.jsx("path",{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92"}),"Share");/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
-
|
|
12
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
-
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var Lt=function(e,t){return Lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},Lt(e,t)};function ve(e,t){Lt(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Cn(e){var t=typeof Symbol=="function"&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function Tn(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var i=n.call(e),o,r=[],s;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)r.push(o.value)}catch(c){s={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return r}function In(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tn(arguments[t]));return e}var je=function(){function e(t,n){this.target=n,this.type=t}return e}(),Rn=function(e){ve(t,e);function t(n,i){var o=e.call(this,"error",i)||this;return o.message=n.message,o.error=n,o}return t}(je),Mn=function(e){ve(t,e);function t(n,i,o){n===void 0&&(n=1e3),i===void 0&&(i="");var r=e.call(this,"close",o)||this;return r.wasClean=!0,r.code=n,r.reason=i,r}return t}(je);/*!
|
|
15
|
-
* Reconnecting WebSocket
|
|
16
|
-
* by Pedro Ladaria <pedro.ladaria@gmail.com>
|
|
17
|
-
* https://github.com/pladaria/reconnecting-websocket
|
|
18
|
-
* License MIT
|
|
19
|
-
*/var On=function(){if(typeof WebSocket<"u")return WebSocket},kn=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},it={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},Pn=function(){function e(t,n,i){var o=this;i===void 0&&(i={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(r){o._debug("open event");var s=o._options.minUptime,c=s===void 0?it.minUptime:s;clearTimeout(o._connectTimeout),o._uptimeTimeout=setTimeout(function(){return o._acceptOpen()},c),o._ws.binaryType=o._binaryType,o._messageQueue.forEach(function(a){return o._ws.send(a)}),o._messageQueue=[],o.onopen&&o.onopen(r),o._listeners.open.forEach(function(a){return o._callEventListener(r,a)})},this._handleMessage=function(r){o._debug("message event"),o.onmessage&&o.onmessage(r),o._listeners.message.forEach(function(s){return o._callEventListener(r,s)})},this._handleError=function(r){o._debug("error event",r.message),o._disconnect(void 0,r.message==="TIMEOUT"?"timeout":void 0),o.onerror&&o.onerror(r),o._debug("exec error listeners"),o._listeners.error.forEach(function(s){return o._callEventListener(r,s)}),o._connect()},this._handleClose=function(r){o._debug("close event"),o._clearTimeouts(),o._shouldReconnect&&o._connect(),o.onclose&&o.onclose(r),o._listeners.close.forEach(function(s){return o._callEventListener(r,s)})},this._url=t,this._protocols=n,this._options=i,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(n,i){return typeof i=="string"?n+=i.length:i instanceof Blob?n+=i.size:n+=i.byteLength,n},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,n){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,n)},e.prototype.reconnect=function(t,n){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,n),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var n=this._options.maxEnqueuedMessages,i=n===void 0?it.maxEnqueuedMessages:n;this._messageQueue.length<i&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,n){this._listeners[t]&&this._listeners[t].push(n)},e.prototype.dispatchEvent=function(t){var n,i,o=this._listeners[t.type];if(o)try{for(var r=Cn(o),s=r.next();!s.done;s=r.next()){var c=s.value;this._callEventListener(t,c)}}catch(a){n={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return!0},e.prototype.removeEventListener=function(t,n){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(i){return i!==n}))},e.prototype._debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._options.debug&&console.log.apply(console,In(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,n=t.reconnectionDelayGrowFactor,i=n===void 0?it.reconnectionDelayGrowFactor:n,o=t.minReconnectionDelay,r=o===void 0?it.minReconnectionDelay:o,s=t.maxReconnectionDelay,c=s===void 0?it.maxReconnectionDelay:s,a=0;return this._retryCount>0&&(a=r*Math.pow(i,this._retryCount-1),a>c&&(a=c)),this._debug("next delay",a),a},e.prototype._wait=function(){var t=this;return new Promise(function(n){setTimeout(n,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var n=t();if(typeof n=="string")return Promise.resolve(n);if(n.then)return n}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var n=this._options,i=n.maxRetries,o=i===void 0?it.maxRetries:i,r=n.connectionTimeout,s=r===void 0?it.connectionTimeout:r,c=n.WebSocket,a=c===void 0?On():c;if(this._retryCount>=o){this._debug("max retries reached",this._retryCount,">=",o);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!kn(a))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new a(l,t._protocols):new a(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},s))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new Rn(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,n){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new Mn(t,n,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,n){"handleEvent"in n?n.handleEvent(t):n(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}(),zn=class extends Pn{constructor(e,t={}){console.log("Opening websocket to",e),super(()=>this.targetUrl||e,void 0,{startClosed:!0}),this.opts=t,this.disposed=!1,Object.defineProperty(this,"url",{get(){return this.targetUrl}}),this.targetUrl=e,this.addEventListener("open",()=>{console.log(`Websocket to ${this.url} opened`)}),this.addEventListener("message",i=>{this.receivedFirstMessage||(this.receivedFirstMessage=i)}),this.addEventListener("close",()=>{console.log(`Websocket to ${this.url} closed`)});const n=this.reconnect;this.reconnect=()=>{this.opts.mock?this.opts.mock.handleWebsocketConnection(this):n.apply(this)},this.reconnect()}changeUrl(e){this.receivedFirstMessage=void 0,this.targetUrl=e,this.reconnect()}sendJson(e){this.opts.mock?this.opts.mock.handleWebsocketMessage(this,JSON.stringify(e)):this.send(JSON.stringify(e))}dispose(){this.close(),this.disposed=!0,this.opts.onDispose&&this.opts.onDispose()}async opened(){return new Promise((e,t)=>{this.readyState===WebSocket.OPEN?e():(this.addEventListener("open",()=>e()),this.addEventListener("error",t))})}async closed(){return new Promise((e,t)=>{this.readyState===WebSocket.CLOSED?e():(this.addEventListener("close",()=>e()),this.addEventListener("error",t))})}async firstMessage(){return this.receivedFirstMessage?this.receivedFirstMessage:new Promise((e,t)=>{const n=o=>{this.receivedFirstMessage=o,this.removeEventListener("message",n),this.removeEventListener("error",i),e(o)},i=o=>{this.removeEventListener("message",n),this.removeEventListener("error",i),t(o)};this.addEventListener("message",n),this.addEventListener("error",i)})}async nextMessage(){return new Promise((e,t)=>{const n=o=>{this.removeEventListener("message",n),this.removeEventListener("error",i),e(o)},i=o=>{this.removeEventListener("message",n),this.removeEventListener("error",i),t(o)};this.addEventListener("message",n),this.addEventListener("error",i)})}},An=class{constructor(){this.available=typeof window<"u"&&!!window.localStorage}getJSON(e){if(!this.available)return null;const t=window.localStorage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}setJSON(e,t){if(!this.available)return null;window.localStorage.setItem(e,JSON.stringify(t))}delete(e){if(!this.available)return null;window.localStorage.removeItem(e)}setString(e,t){if(!this.available)return null;window.localStorage.setItem(e,t)}getString(e){return this.available?window.localStorage.getItem(e):null}};const It=new An,ut="wandelbots.io",Rt={dev:{domain:`https://auth.portal.dev.${ut}`,clientId:"fLbJD0RLp5r2Dpucm5j8BjwMR6Hunfha"},stg:{domain:`https://auth.portal.stg.${ut}`,clientId:"joVDeD9e786WzFNSGCqoVq7HNkWt5j6s"},prod:{domain:`https://auth.portal.${ut}`,clientId:"J7WJUi38xVQdJAEBNRT9Xw1b0fXDb4J2"}},Ln=e=>{if(e.endsWith(`dev.${ut}`))return Rt.dev;if(e.endsWith(`stg.${ut}`))return Rt.stg;if(e.endsWith(ut))return Rt.prod;throw new Error("Unsupported instance URL. Cannot determine Auth0 configuration.")},$n=async e=>{if(typeof window>"u")throw new Error("Access token must be set to use NovaClient when not in a browser environment.");const t=Ln(e);if(new URL(e).origin===window.location.origin)throw window.location.reload(),new Error("Failed to reload page to get auth details, please refresh manually");const{Auth0Client:n}=await Promise.resolve().then(()=>require("./auth0-spa-js.production.esm-CEI5Uihg.cjs")),i=new n({domain:t.domain,clientId:t.clientId??"",useRefreshTokens:!1,authorizationParams:{audience:"nova-api",redirect_uri:window.location.origin}});if(window.location.search.includes("code=")&&window.location.search.includes("state=")){const{appState:o}=await i.handleRedirectCallback();window.history.replaceState({},document.title,(o==null?void 0:o.returnTo)||window.location.pathname)}else await i.loginWithRedirect();return await i.getTokenSilently()};function Dn(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var i=0;i<e.length;i++){var o=e[i];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(i>0&&(o=o.replace(/^[\/]+/,"")),i<e.length-1?o=o.replace(/[\/]+$/,""):o=o.replace(/[\/]+$/,"/"),t.push(o))}var r=t.join("/");r=r.replace(/\/(\?|&|#[^!])/g,"$1");var s=r.split("?");return r=s.shift()+(s.length>0?"?":"")+s.join("&"),r}function Mt(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),Dn(e)}var W={},Zt;function Jn(){if(Zt)return W;Zt=1,Object.defineProperty(W,"__esModule",{value:!0}),W.PathError=W.TokenData=void 0,W.parse=l,W.compile=h,W.match=g,W.pathToRegexp=y,W.stringify=L;const e="/",t=f=>f,n=/^[$_\p{ID_Start}]$/u,i=/^[$\u200c\u200d\p{ID_Continue}]$/u,o={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function r(f){return f.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function s(f){return f.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class c{constructor(_,S){this.tokens=_,this.originalPath=S}}W.TokenData=c;class a extends TypeError{constructor(_,S){let j=_;S&&(j+=`: ${S}`),j+="; visit https://git.new/pathToRegexpError for info",super(j),this.originalPath=S}}W.PathError=a;function l(f,_={}){const{encodePath:S=t}=_,j=[...f],w=[];let b=0,z=0;function P(){let O="";if(n.test(j[b]))do O+=j[b++];while(i.test(j[b]));else if(j[b]==='"'){let V=b;for(;b++<j.length;){if(j[b]==='"'){b++,V=0;break}j[b]==="\\"&&b++,O+=j[b]}if(V)throw new a(`Unterminated quote at index ${V}`,f)}if(!O)throw new a(`Missing parameter name at index ${b}`,f);return O}for(;b<j.length;){const O=j[b],V=o[O];V?w.push({type:V,index:b++,value:O}):O==="\\"?w.push({type:"escape",index:b++,value:j[b++]}):O===":"?w.push({type:"param",index:b++,value:P()}):O==="*"?w.push({type:"wildcard",index:b++,value:P()}):w.push({type:"char",index:b++,value:O})}w.push({type:"end",index:b,value:""});function B(O){const V=[];for(;;){const R=w[z++];if(R.type===O)break;if(R.type==="char"||R.type==="escape"){let G=R.value,H=w[z];for(;H.type==="char"||H.type==="escape";)G+=H.value,H=w[++z];V.push({type:"text",value:S(G)});continue}if(R.type==="param"||R.type==="wildcard"){V.push({type:R.type,name:R.value});continue}if(R.type==="{"){V.push({type:"group",tokens:B("}")});continue}throw new a(`Unexpected ${R.type} at index ${R.index}, expected ${O}`,f)}return V}return new c(B("end"),f)}function h(f,_={}){const{encode:S=encodeURIComponent,delimiter:j=e}=_,w=typeof f=="object"?f:l(f,_),b=d(w.tokens,j,S);return function(P={}){const[B,...O]=b(P);if(O.length)throw new TypeError(`Missing parameters: ${O.join(", ")}`);return B}}function d(f,_,S){const j=f.map(w=>u(w,_,S));return w=>{const b=[""];for(const z of j){const[P,...B]=z(w);b[0]+=P,b.push(...B)}return b}}function u(f,_,S){if(f.type==="text")return()=>[f.value];if(f.type==="group"){const w=d(f.tokens,_,S);return b=>{const[z,...P]=w(b);return P.length?[""]:[z]}}const j=S||t;return f.type==="wildcard"&&S!==!1?w=>{const b=w[f.name];if(b==null)return["",f.name];if(!Array.isArray(b)||b.length===0)throw new TypeError(`Expected "${f.name}" to be a non-empty array`);return[b.map((z,P)=>{if(typeof z!="string")throw new TypeError(`Expected "${f.name}/${P}" to be a string`);return j(z)}).join(_)]}:w=>{const b=w[f.name];if(b==null)return["",f.name];if(typeof b!="string")throw new TypeError(`Expected "${f.name}" to be a string`);return[j(b)]}}function g(f,_={}){const{decode:S=decodeURIComponent,delimiter:j=e}=_,{regexp:w,keys:b}=y(f,_),z=b.map(P=>S===!1?t:P.type==="param"?S:B=>B.split(j).map(S));return function(B){const O=w.exec(B);if(!O)return!1;const V=O[0],R=Object.create(null);for(let G=1;G<O.length;G++){if(O[G]===void 0)continue;const H=b[G-1],Be=z[G-1];R[H.name]=Be(O[G])}return{path:V,params:R}}}function y(f,_={}){const{delimiter:S=e,end:j=!0,sensitive:w=!1,trailing:b=!0}=_,z=[],P=w?"":"i",B=[];for(const R of E(f,[])){const G=typeof R=="object"?R:l(R,_);for(const H of m(G.tokens,0,[]))B.push(v(H,S,z,G.originalPath))}let O=`^(?:${B.join("|")})`;return b&&(O+=`(?:${s(S)}$)?`),O+=j?"$":`(?=${s(S)}|$)`,{regexp:new RegExp(O,P),keys:z}}function E(f,_){if(Array.isArray(f))for(const S of f)E(S,_);else _.push(f);return _}function*m(f,_,S){if(_===f.length)return yield S;const j=f[_];if(j.type==="group")for(const w of m(j.tokens,0,S.slice()))yield*m(f,_+1,w);else S.push(j);yield*m(f,_+1,S)}function v(f,_,S,j){let w="",b="",z=!0;for(const P of f){if(P.type==="text"){w+=s(P.value),b+=P.value,z||(z=P.value.includes(_));continue}if(P.type==="param"||P.type==="wildcard"){if(!z&&!b)throw new a(`Missing text before "${P.name}" ${P.type}`,j);P.type==="param"?w+=`(${T(_,z?"":b)}+)`:w+="([\\s\\S]+)",S.push(P),b="",z=!1;continue}}return w}function T(f,_){return _.length<2?f.length<2?`[^${s(f+_)}]`:`(?:(?!${s(f)})[^${s(_)}])`:f.length<2?`(?:(?!${s(_)})[^${s(f)}])`:`(?:(?!${s(_)}|${s(f)})[\\s\\S])`}function A(f){let _="",S=0;function j(w){return k(w)&&I(f[S])?w:JSON.stringify(w)}for(;S<f.length;){const w=f[S++];if(w.type==="text"){_+=r(w.value);continue}if(w.type==="group"){_+=`{${A(w.tokens)}}`;continue}if(w.type==="param"){_+=`:${j(w.name)}`;continue}if(w.type==="wildcard"){_+=`*${j(w.name)}`;continue}throw new TypeError(`Unknown token type: ${w.type}`)}return _}function L(f){return A(f.tokens)}function k(f){const[_,...S]=f;return n.test(_)&&S.every(j=>i.test(j))}function I(f){return f&&f.type==="text"?!i.test(f.value[0]):!0}return W}var Nn=Jn(),Fn=class{constructor(e,t){this.cellId=e,this.opts=t,this.system=this.withUnwrappedResponsesOnly(N.SystemApi),this.cell=this.withUnwrappedResponsesOnly(N.CellApi),this.motionGroup=this.withCellId(N.MotionGroupApi),this.motionGroupModels=this.withCellId(N.MotionGroupModelsApi),this.controller=this.withCellId(N.ControllerApi),this.controllerIOs=this.withCellId(N.ControllerInputsOutputsApi),this.trajectoryPlanning=this.withCellId(N.TrajectoryPlanningApi),this.trajectoryExecution=this.withCellId(N.TrajectoryExecutionApi),this.trajectoryCaching=this.withCellId(N.TrajectoryCachingApi),this.application=this.withCellId(N.ApplicationApi),this.applicationGlobal=this.withUnwrappedResponsesOnly(N.ApplicationApi),this.jogging=this.withCellId(N.JoggingApi),this.kinematics=this.withCellId(N.KinematicsApi),this.busInputsOutputs=this.withCellId(N.BUSInputsOutputsApi),this.virtualController=this.withCellId(N.VirtualControllerApi),this.virtualControllerBehavior=this.withCellId(N.VirtualControllerBehaviorApi),this.virtualControllerIOs=this.withCellId(N.VirtualControllerInputsOutputsApi),this.storeObject=this.withCellId(N.StoreObjectApi),this.storeCollisionComponents=this.withCellId(N.StoreCollisionComponentsApi),this.storeCollisionSetups=this.withCellId(N.StoreCollisionSetupsApi)}withCellId(e){const t=new e({...this.opts,isJsonMime:n=>n==="application/json"},this.opts.basePath??"",this.opts.axiosInstance??K.axios.create());for(const n of Reflect.ownKeys(Reflect.getPrototypeOf(t)))if(n!=="constructor"&&typeof t[n]=="function"){const i=t[n];t[n]=(...o)=>i.apply(t,[this.cellId,...o]).then(r=>r.data)}return t}withUnwrappedResponsesOnly(e){const t=new e({...this.opts,isJsonMime:n=>n==="application/json"},this.opts.basePath??"",this.opts.axiosInstance??K.axios.create());for(const n of Reflect.ownKeys(Reflect.getPrototypeOf(t)))if(n!=="constructor"&&typeof t[n]=="function"){const i=t[n];t[n]=(...o)=>i.apply(t,o).then(r=>r.data)}return t}},Vn=class{constructor(){this.connections=[]}async handleAPIRequest(e){var o,r,s;const t=[{method:"GET",path:"/cells/:cellId/controllers",handle(){return["mock-ur5e"]}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId",handle(){return{configuration:{initial_joint_position:"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]",kind:"VirtualController",manufacturer:"universalrobots",type:"universalrobots-ur5e"},name:"mock-ur5"}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/state",handle(){return{mode:"MODE_CONTROL",last_error:[],timestamp:"2025-10-16T09:19:26.634534092Z",sequence_number:1054764,controller:"mock-ur5e",operation_mode:"OPERATION_MODE_AUTO",safety_state:"SAFETY_STATE_NORMAL",velocity_override:100,motion_groups:[{timestamp:"2025-10-16T09:19:26.634534092Z",sequence_number:1054764,motion_group:"0@mock-ur5e",controller:"mock-ur5e",joint_position:[1.487959623336792,-1.8501918315887451,1.8003005981445312,6.034560203552246,1.4921919107437134,1.593459963798523],joint_limit_reached:{limit_reached:[!1,!1,!1,!1,!1,!1]},joint_torque:[],joint_current:[0,0,0,0,0,0],flange_pose:{position:[107.6452433732927,-409.0402987746852,524.2402132330305],orientation:[.9874434028353319,-.986571714997442,1.3336589451098142]},tcp:"Flange",tcp_pose:{position:[107.6452433732927,-409.0402987746852,524.2402132330305],orientation:[.9874434028353319,-.986571714997442,1.3336589451098142]},payload:"",coordinate_system:"",standstill:!0}]}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description",handle(){return{motion_group_model:"UniversalRobots_UR5e",mounting:{position:[0,0,0],orientation:[0,0,0]},tcps:{Flange:{name:"Default-Flange",pose:{position:[0,0,0],orientation:[0,0,0]}}},payloads:{"FPay-0":{name:"FPay-0",payload:0,center_of_mass:[0,0,0],moment_of_inertia:[0,0,0]}},cycle_time:8,dh_parameters:[{alpha:1.5707963267948966,d:162.25},{a:-425},{a:-392.2},{alpha:1.5707963267948966,d:133.3},{alpha:-1.5707963267948966,d:99.7},{d:99.6}],operation_limits:{auto_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3},elbow:{velocity:5e3},flange:{velocity:5e3}},manual_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}},manual_t1_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}},manual_t2_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}}},serial_number:"WBVirtualRobot"}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/coordinate-systems",handle(){return[{coordinate_system:"",name:"world",reference_coordinate_system:"",position:[0,0,0],orientation:[0,0,0],orientation_type:"ROTATION_VECTOR"},{coordinate_system:"CS-0",name:"Default-CS",reference_coordinate_system:"",position:[0,0,0],orientation:[0,0,0],orientation_type:"ROTATION_VECTOR"}]}}],n=((o=e.method)==null?void 0:o.toUpperCase())||"GET",i=`/cells${(s=(r=e.url)==null?void 0:r.split("/cells")[1])==null?void 0:s.split("?")[0]}`;for(const c of t){const a=Nn.match(c.path)(i||"");if(n===c.method&&a){const l=c.handle();return{status:200,statusText:"Success",data:JSON.stringify(l),headers:{},config:e,request:{responseURL:e.url}}}}throw new K.AxiosError(`No mock handler matched this request: ${n} ${i}`,"404",e)}handleWebsocketConnection(e){this.connections.push(e),setTimeout(()=>{e.dispatchEvent(new Event("open")),console.log("Websocket connection opened from",e.url),e.url.includes("/state-stream")&&e.dispatchEvent(new MessageEvent("message",{data:JSON.stringify(Bn)})),e.url.includes("/execution/jogging")&&e.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({result:{message:"string",kind:"INITIALIZE_RECEIVED"}})}))},10)}handleWebsocketMessage(e,t){console.log(`Received message on ${e.url}`,t)}};const Bn={result:{motion_group:"0@universalrobots-ur5e",controller:"universalrobots-ur5e",timestamp:new Date().toISOString(),sequence_number:1,joint_position:[1.1699999570846558,-1.5700000524520874,1.3600000143051147,1.0299999713897705,1.2899999618530273,1.2799999713897705],joint_limit_reached:{limit_reached:[!1,!1,!1,!1,!1,!1]},standstill:!1,flange_pose:{position:[1.3300010259703043,-409.2680714682808,531.0203477065281],orientation:[1.7564919306270736,-1.7542521568325058,.7326972590614671]},tcp_pose:{position:[1.3300010259703043,-409.2680714682808,531.0203477065281],orientation:[1.7564919306270736,-1.7542521568325058,.7326972590614671]}}};function Gn(e){return e.startsWith("http")||(e=`http://${e}`),new URL(e).toString()}var Un=class{constructor(e){this.authPromise=null,this.accessToken=null;const t=e.cellId??"cell";this.config={cellId:t,...e},this.accessToken=e.accessToken||It.getString("wbjs.access_token")||null,this.config.instanceUrl==="https://mock.example.com"?this.mock=new Vn:this.config.instanceUrl=Gn(this.config.instanceUrl);const n=K.axios.create({baseURL:Mt(this.config.instanceUrl,"/api/v2"),headers:typeof window<"u"&&window.location.origin.includes("localhost")?{}:{"X-Wandelbots-Client":"Wandelbots-Nova-JS-SDK"}});n.interceptors.request.use(async i=>(i.headers.Authorization||(this.accessToken?i.headers.Authorization=`Bearer ${this.accessToken}`:this.config.username&&this.config.password&&(i.headers.Authorization=`Basic ${btoa(`${e.username}:${e.password}`)}`)),i)),typeof window<"u"&&n.interceptors.response.use(i=>i,async i=>{var o,r;if(K.isAxiosError(i))if(((o=i.response)==null?void 0:o.status)===401)try{if(await this.renewAuthentication(),i.config)return this.accessToken?i.config.headers.Authorization=`Bearer ${this.accessToken}`:delete i.config.headers.Authorization,n.request(i.config)}catch(s){return Promise.reject(s)}else((r=i.response)==null?void 0:r.status)===503&&(await fetch(window.location.href)).status===503&&window.location.reload();return Promise.reject(i)}),this.api=new Fn(t,{...e,basePath:Mt(this.config.instanceUrl,"/api/v2"),isJsonMime:i=>i==="application/json",baseOptions:{...this.mock?{adapter:i=>this.mock.handleAPIRequest(i)}:{},...e.baseOptions},axiosInstance:n})}async renewAuthentication(){if(!this.authPromise){this.authPromise=$n(this.config.instanceUrl);try{this.accessToken=await this.authPromise,this.accessToken?It.setString("wbjs.access_token",this.accessToken):It.delete("wbjs.access_token")}finally{this.authPromise=null}}}makeWebsocketURL(e){const t=new URL(Mt(this.config.instanceUrl,`/api/v2/cells/${this.config.cellId}`,e));return t.protocol=t.protocol.replace("http","ws"),t.protocol=t.protocol.replace("https","wss"),this.accessToken?t.searchParams.append("token",this.accessToken):this.config.username&&this.config.password&&(t.username=this.config.username,t.password=this.config.password),t.toString()}openReconnectingWebsocket(e){return new zn(this.makeWebsocketURL(e),{mock:this.mock})}};function qn(e){var r,s,c,a,l,h;const t=[((r=e.position)==null?void 0:r[0])??0,((s=e.position)==null?void 0:s[1])??0,((c=e.position)==null?void 0:c[2])??0],n=[((a=e.orientation)==null?void 0:a[0])??0,((l=e.orientation)==null?void 0:l[1])??0,((h=e.orientation)==null?void 0:h[2])??0],i=t.map(d=>d.toFixed(1)),o=n.map(d=>d.toFixed(4));return`(${i.concat(o).join(", ")})`}function Y(e,t,n){return Math.max(t,Math.min(n,e))}class Wn{constructor(t=0,n=0,i=0,o=1){this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=o}static slerpFlat(t,n,i,o,r,s,c){let a=i[o+0],l=i[o+1],h=i[o+2],d=i[o+3];const u=r[s+0],g=r[s+1],y=r[s+2],E=r[s+3];if(c===0){t[n+0]=a,t[n+1]=l,t[n+2]=h,t[n+3]=d;return}if(c===1){t[n+0]=u,t[n+1]=g,t[n+2]=y,t[n+3]=E;return}if(d!==E||a!==u||l!==g||h!==y){let m=1-c;const v=a*u+l*g+h*y+d*E,T=v>=0?1:-1,A=1-v*v;if(A>Number.EPSILON){const k=Math.sqrt(A),I=Math.atan2(k,v*T);m=Math.sin(m*I)/k,c=Math.sin(c*I)/k}const L=c*T;if(a=a*m+u*L,l=l*m+g*L,h=h*m+y*L,d=d*m+E*L,m===1-c){const k=1/Math.sqrt(a*a+l*l+h*h+d*d);a*=k,l*=k,h*=k,d*=k}}t[n]=a,t[n+1]=l,t[n+2]=h,t[n+3]=d}static multiplyQuaternionsFlat(t,n,i,o,r,s){const c=i[o],a=i[o+1],l=i[o+2],h=i[o+3],d=r[s],u=r[s+1],g=r[s+2],y=r[s+3];return t[n]=c*y+h*d+a*g-l*u,t[n+1]=a*y+h*u+l*d-c*g,t[n+2]=l*y+h*g+c*u-a*d,t[n+3]=h*y-c*d-a*u-l*g,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,n,i,o){return this._x=t,this._y=n,this._z=i,this._w=o,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,n=!0){const i=t._x,o=t._y,r=t._z,s=t._order,c=Math.cos,a=Math.sin,l=c(i/2),h=c(o/2),d=c(r/2),u=a(i/2),g=a(o/2),y=a(r/2);switch(s){case"XYZ":this._x=u*h*d+l*g*y,this._y=l*g*d-u*h*y,this._z=l*h*y+u*g*d,this._w=l*h*d-u*g*y;break;case"YXZ":this._x=u*h*d+l*g*y,this._y=l*g*d-u*h*y,this._z=l*h*y-u*g*d,this._w=l*h*d+u*g*y;break;case"ZXY":this._x=u*h*d-l*g*y,this._y=l*g*d+u*h*y,this._z=l*h*y+u*g*d,this._w=l*h*d-u*g*y;break;case"ZYX":this._x=u*h*d-l*g*y,this._y=l*g*d+u*h*y,this._z=l*h*y-u*g*d,this._w=l*h*d+u*g*y;break;case"YZX":this._x=u*h*d+l*g*y,this._y=l*g*d+u*h*y,this._z=l*h*y-u*g*d,this._w=l*h*d-u*g*y;break;case"XZY":this._x=u*h*d-l*g*y,this._y=l*g*d-u*h*y,this._z=l*h*y+u*g*d,this._w=l*h*d+u*g*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,n){const i=n/2,o=Math.sin(i);return this._x=t.x*o,this._y=t.y*o,this._z=t.z*o,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const n=t.elements,i=n[0],o=n[4],r=n[8],s=n[1],c=n[5],a=n[9],l=n[2],h=n[6],d=n[10],u=i+c+d;if(u>0){const g=.5/Math.sqrt(u+1);this._w=.25/g,this._x=(h-a)*g,this._y=(r-l)*g,this._z=(s-o)*g}else if(i>c&&i>d){const g=2*Math.sqrt(1+i-c-d);this._w=(h-a)/g,this._x=.25*g,this._y=(o+s)/g,this._z=(r+l)/g}else if(c>d){const g=2*Math.sqrt(1+c-i-d);this._w=(r-l)/g,this._x=(o+s)/g,this._y=.25*g,this._z=(a+h)/g}else{const g=2*Math.sqrt(1+d-i-c);this._w=(s-o)/g,this._x=(r+l)/g,this._y=(a+h)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(t,n){let i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Y(this.dot(t),-1,1)))}rotateTowards(t,n){const i=this.angleTo(t);if(i===0)return this;const o=Math.min(1,n/i);return this.slerp(t,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,n){const i=t._x,o=t._y,r=t._z,s=t._w,c=n._x,a=n._y,l=n._z,h=n._w;return this._x=i*h+s*c+o*l-r*a,this._y=o*h+s*a+r*c-i*l,this._z=r*h+s*l+i*a-o*c,this._w=s*h-i*c-o*a-r*l,this._onChangeCallback(),this}slerp(t,n){if(n===0)return this;if(n===1)return this.copy(t);const i=this._x,o=this._y,r=this._z,s=this._w;let c=s*t._w+i*t._x+o*t._y+r*t._z;if(c<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,c=-c):this.copy(t),c>=1)return this._w=s,this._x=i,this._y=o,this._z=r,this;const a=1-c*c;if(a<=Number.EPSILON){const g=1-n;return this._w=g*s+n*this._w,this._x=g*i+n*this._x,this._y=g*o+n*this._y,this._z=g*r+n*this._z,this.normalize(),this}const l=Math.sqrt(a),h=Math.atan2(l,c),d=Math.sin((1-n)*h)/l,u=Math.sin(n*h)/l;return this._w=s*d+this._w*u,this._x=i*d+this._x*u,this._y=o*d+this._y*u,this._z=r*d+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,n,i){return this.copy(t).slerp(n,i)}random(){const t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),o=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(o*Math.sin(t),o*Math.cos(t),r*Math.sin(n),r*Math.cos(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,n=0){return this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t}fromBufferAttribute(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ht{constructor(t=0,n=0,i=0){ht.prototype.isVector3=!0,this.x=t,this.y=n,this.z=i}set(t,n,i){return i===void 0&&(i=this.z),this.x=t,this.y=n,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this}applyEuler(t){return this.applyQuaternion(Xt.setFromEuler(t))}applyAxisAngle(t,n){return this.applyQuaternion(Xt.setFromAxisAngle(t,n))}applyMatrix3(t){const n=this.x,i=this.y,o=this.z,r=t.elements;return this.x=r[0]*n+r[3]*i+r[6]*o,this.y=r[1]*n+r[4]*i+r[7]*o,this.z=r[2]*n+r[5]*i+r[8]*o,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const n=this.x,i=this.y,o=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*o+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*o+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*o+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*o+r[14])*s,this}applyQuaternion(t){const n=this.x,i=this.y,o=this.z,r=t.x,s=t.y,c=t.z,a=t.w,l=2*(s*o-c*i),h=2*(c*n-r*o),d=2*(r*i-s*n);return this.x=n+a*l+s*d-c*h,this.y=i+a*h+c*l-r*d,this.z=o+a*d+r*h-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const n=this.x,i=this.y,o=this.z,r=t.elements;return this.x=r[0]*n+r[4]*i+r[8]*o,this.y=r[1]*n+r[5]*i+r[9]*o,this.z=r[2]*n+r[6]*i+r[10]*o,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,n){return this.x=Y(this.x,t.x,n.x),this.y=Y(this.y,t.y,n.y),this.z=Y(this.z,t.z,n.z),this}clampScalar(t,n){return this.x=Y(this.x,t,n),this.y=Y(this.y,t,n),this.z=Y(this.z,t,n),this}clampLength(t,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Y(i,t,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this}lerpVectors(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,n){const i=t.x,o=t.y,r=t.z,s=n.x,c=n.y,a=n.z;return this.x=o*a-r*c,this.y=r*s-i*a,this.z=i*c-o*s,this}projectOnVector(t){const n=t.lengthSq();if(n===0)return this.set(0,0,0);const i=t.dot(this)/n;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ot.copy(this).projectOnVector(t),this.sub(Ot)}reflect(t){return this.sub(Ot.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(t)/n;return Math.acos(Y(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,i=this.y-t.y,o=this.z-t.z;return n*n+i*i+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,n,i){const o=Math.sin(n)*t;return this.x=o*Math.sin(i),this.y=Math.cos(n)*t,this.z=o*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,n,i){return this.x=t*Math.sin(n),this.y=i,this.z=t*Math.cos(n),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(t){const n=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),o=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=i,this.z=o,this}setFromMatrixColumn(t,n){return this.fromArray(t.elements,n*4)}setFromMatrix3Column(t,n){return this.fromArray(t.elements,n*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(t),this.y=n,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ot=new ht,Xt=new Wn,Yt=1e-4;class wt{constructor(t,n,i,o,r,s){this.nova=t,this.controller=n,this.motionGroup=i,this.description=o,this.initialMotionState=r,this.motionStateSocket=s,this.rapidlyChangingMotionState=r,s.addEventListener("message",c=>{var l;const a=(l=U.tryParseJson(c.data))==null?void 0:l.result;if(!a)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${c.data}`);M.jointValuesEqual(this.rapidlyChangingMotionState.joint_position,a.joint_position,Yt)||Z.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=a.joint_position}),M.tcpMotionEqual(this.rapidlyChangingMotionState,a,Yt)||Z.runInAction(()=>{var h,d,u;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=a.tcp_pose:(h=a.tcp_pose)!=null&&h.orientation&&((d=a.tcp_pose)!=null&&d.position)&&((u=this.rapidlyChangingMotionState.tcp_pose)!=null&&u.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:a.tcp_pose.position,orientation:M.unwrapRotationVector(a.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:console.warn("Received incomplete tcp_pose, ignoring",a.tcp_pose)}),this.rapidlyChangingMotionState.standstill!==a.standstill&&Z.runInAction(()=>{this.rapidlyChangingMotionState.standstill=a.standstill})}),Z.makeAutoObservable(this)}static async open(t,n){var d;const[i,o]=n.split("@"),r=await t.api.controller.getCurrentRobotControllerState(o),s=r==null?void 0:r.motion_groups.find(u=>u.motion_group===n);if(!r||!s)throw new Error(`Controller ${o} or motion group ${n} not found`);const c=t.openReconnectingWebsocket(`/controllers/${o}/motion-groups/${n}/state-stream`),a=await c.firstMessage(),l=(d=U.tryParseJson(a.data))==null?void 0:d.result;if(!l)throw new Error(`Unable to parse initial motion state message ${a.data}`);console.log(`Connected motion state websocket to motion group ${s.motion_group}. Initial state:
|
|
20
|
-
`,l);const h=await t.api.motionGroup.getMotionGroupDescription(o,s.motion_group);return new wt(t,r,s,h,l,c)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get wandelscriptIdentifier(){const t=this.motionGroupId.split("@")[0];return`${this.controllerId.replace(/-/g,"_")}_${t}`}get joints(){return this.initialMotionState.joint_position.map((t,n)=>({index:n}))}dispose(){this.motionStateSocket.close()}}const Qt="Movement request rejected. Another client is currently executing a 'Jogging' motion!";class bt{constructor(t,n={}){this.motionStream=t,this.options=n,this.ENDPOINT_JOGGING="/execution/jogging",this.ENDPOINT_TRAJECTORY="/execution/trajectory",this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",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.tcp=(n==null?void 0:n.tcp)||t.motionGroup.tcp||this.DEFAULT_TCP,this.orientation=(n==null?void 0:n.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(n==null?void 0:n.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(n==null?void 0:n.mode)||this.DEFAULT_MODE,this.onError=n==null?void 0:n.onError}static async open(t,n,i={}){const o=await wt.open(t,n),r=new bt(o,i);return await r.setJoggingMode(r.mode),r}async setOptions(t){t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),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 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.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,n=!0){if(!(this.mode===t&&n)&&(this.dispose(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,n)=>{const i=setTimeout(()=>{n(new Error(`Jogging initialization timeout after ${this.timeout} seconds`))},this.timeout);this.joggingSocket=this.nova.openReconnectingWebsocket(this.ENDPOINT_JOGGING),this.joggingSocket.addEventListener("message",o=>{var s,c,a,l;const r=U.tryParseJson(o.data);if(((s=r==null?void 0:r.result)==null?void 0:s.kind)==="INITIALIZE_RECEIVED"){clearTimeout(i),t();return}if(((c=r==null?void 0:r.result)==null?void 0:c.kind)==="MOTION_ERROR")if(clearTimeout(i),this.onBlocked&&((a=r==null?void 0:r.result)!=null&&a.message.includes(Qt))){(l=this.joggingSocket)==null||l.dispose(),this.onBlocked();return}else this.onError?this.onError(o.data):n(new Error(o.data))}),this.joggingSocket.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,tcp:this.tcp})})}async rotateJoints({joint:t,direction:n,velocityRadsPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const o=new Array(this.numJoints).fill(0);o[t]=n==="-"?-i:i,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:o})}async translateTCP({axis:t,direction:n,velocityMmPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const o=[0,0,0],r=[0,0,0];r[U.XYZ_TO_VECTOR[t]]=n==="-"?-i:i,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:r,rotation:o,use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:n,velocityRadsPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const o=[0,0,0],r=[0,0,0];o[U.XYZ_TO_VECTOR[t]]=n==="-"?-i:i,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:r,rotation:o})}async runIncrementalCartesianMotion({currentTcpPose:t,currentJoints:n,velocityInRelevantUnits:i,axis:o,direction:r,motion:s}){const c=[];if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(s.type==="translate"){if(!t.position)throw new Error("Current pose has no position, cannot perform translation");const m=[...t.position];m[U.XYZ_TO_VECTOR[o]]+=s.distanceMm*(r==="-"?-1:1),c.push({limits_override:{tcp_velocity_limit:i},path:{path_definition_name:"PathLine",target_pose:{position:m,orientation:t.orientation}}})}else if(s.type==="rotate"){if(!t.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const m=new ht(t.orientation[0],t.orientation[1],t.orientation[2]),v=m.length(),T=m.clone().normalize(),A=s.distanceRads*(r==="-"?-1:1),L=new ht(0,0,0);L[o]=1;const k=Math.cos(.5*A)*Math.cos(.5*v),I=Math.sin(.5*A)*Math.sin(.5*v),f=Math.sin(.5*A)*Math.cos(.5*v),_=Math.cos(.5*A)*Math.sin(.5*v),S=L.dot(T),j=L.clone().cross(T),w=2*Math.acos(k-I*S),b=w/Math.sin(.5*w),z=new ht().addScaledVector(j,I).addScaledVector(L,f).addScaledVector(T,_).multiplyScalar(b);c.push({limits_override:{tcp_orientation_velocity_limit:i},path:{path_definition_name:"PathLine",target_pose:{position:t.position,orientation:[...z]}}})}const a=this.motionStream.description;if(a.cycle_time===void 0){console.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const l={motion_group_model:a.motion_group_model,cycle_time:a.cycle_time,mounting:a.mounting,global:a.operation_limits.auto_limits},h=await this.nova.api.trajectoryPlanning.planTrajectory({motion_group_setup:l,start_joint_position:n,motion_commands:c}),d=h.response;if(!d)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(h)}`);this.trajectorySocket&&(console.warn("Trajectory jogging websocket already open; will close"),this.trajectorySocket.dispose()),this.trajectorySocket=this.nova.openReconnectingWebsocket(this.ENDPOINT_TRAJECTORY);const u=m=>{var v;if(!m||m.add_trajectory_error||m.message)if(this.onError)this.onError(m);else throw new Error(((v=m==null?void 0:m.add_trajectory_error)==null?void 0:v.message)||(m==null?void 0:m.message)||"Failed to execute trajectory, unknown error");if(!this.trajectorySocket)throw new Error("Failed to execute trajectory, websocket not available anymore");this.trajectorySocket.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})},g=async()=>{var m;await Z.when(()=>!this.motionStream.rapidlyChangingMotionState.standstill),await Z.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(m=this.trajectorySocket)==null||m.dispose(),this.trajectorySocket=null},y=async()=>{var m;await Z.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(m=this.trajectorySocket)==null||m.dispose(),this.trajectorySocket=null},E=async m=>{if(m!=null&&m.message)if(this.onError){this.onError(m);return}else throw new Error(m.message||"Failed to execute trajectory, unknown error");this.motionStream.rapidlyChangingMotionState.standstill?await g():await y()};this.trajectorySocket.addEventListener("message",m=>{var T,A;const v=U.tryParseJson(m.data);if(!((T=v==null?void 0:v.result)!=null&&T.kind))throw new Error(`Failed to execute trajectory: Received invalid message ${m.data}`);if(this.onBlocked&&((A=v.result.message)!=null&&A.includes(Qt))){this.onBlocked();return}if(v.result.kind==="INITIALIZE_RECEIVED")u(v.result);else if(v.result.kind==="START_RECEIVED")E(v);else if(v.result.kind!=="PAUSE_RECEIVED")if(v.result.kind==="MOTION_ERROR"&&v.result.message)if(this.onError){this.onError(v);return}else throw new Error(v.result.message);else throw new Error(`Failed to execute trajectory, cannot handle message type "${v.result.kind}"`)}),this.trajectorySocket.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:d,tcp:this.tcp}})}}var Hn="[object AsyncFunction]",Zn="[object Function]",Xn="[object GeneratorFunction]",Yn="[object Proxy]";function Ee(e){if(!rt(e))return!1;var t=M.baseGetTag(e);return t==Zn||t==Xn||t==Hn||t==Yn}var kt=M.root["__core-js_shared__"],Kt=function(){var e=/[^.]+$/.exec(kt&&kt.keys&&kt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Qn(e){return!!Kt&&Kt in e}var Kn=Function.prototype,ti=Kn.toString;function at(e){if(e!=null){try{return ti.call(e)}catch{}try{return e+""}catch{}}return""}var ei=/[\\^$.*+?()[\]{}|]/g,ni=/^\[object .+?Constructor\]$/,ii=Function.prototype,ri=Object.prototype,oi=ii.toString,si=ri.hasOwnProperty,ai=RegExp("^"+oi.call(si).replace(ei,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ci(e){if(!rt(e)||Qn(e))return!1;var t=Ee(e)?ai:ni;return t.test(at(e))}function li(e,t){return e==null?void 0:e[t]}function ct(e,t){var n=li(e,t);return ci(n)?n:void 0}var te=function(){try{var e=ct(Object,"defineProperty");return e({},"",{}),e}catch{}}();function ui(e,t,n){t=="__proto__"&&te?te(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function hi(e,t,n,i){for(var o=-1,r=e==null?0:e.length;++o<r;){var s=e[o];t(i,s,n(s),e)}return i}function di(e){return function(t,n,i){for(var o=-1,r=Object(t),s=i(t),c=s.length;c--;){var a=s[++o];if(n(r[a],a,r)===!1)break}return t}}var pi=di();function gi(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}var fi="[object Arguments]";function ee(e){return M.isObjectLike(e)&&M.baseGetTag(e)==fi}var Se=Object.prototype,mi=Se.hasOwnProperty,yi=Se.propertyIsEnumerable,Ce=ee(function(){return arguments}())?ee:function(e){return M.isObjectLike(e)&&mi.call(e,"callee")&&!yi.call(e,"callee")},X=Array.isArray;function xi(){return!1}var Te=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ne=Te&&typeof module=="object"&&module&&!module.nodeType&&module,_i=ne&&ne.exports===Te,ie=_i?M.root.Buffer:void 0,wi=ie?ie.isBuffer:void 0,$t=wi||xi,bi=9007199254740991,vi=/^(?:0|[1-9]\d*)$/;function Ie(e,t){var n=typeof e;return t=t??bi,!!t&&(n=="number"||n!="symbol"&&vi.test(e))&&e>-1&&e%1==0&&e<t}var ji=9007199254740991;function Bt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ji}var Ei="[object Arguments]",Si="[object Array]",Ci="[object Boolean]",Ti="[object Date]",Ii="[object Error]",Ri="[object Function]",Mi="[object Map]",Oi="[object Number]",ki="[object Object]",Pi="[object RegExp]",zi="[object Set]",Ai="[object String]",Li="[object WeakMap]",$i="[object ArrayBuffer]",Di="[object DataView]",Ji="[object Float32Array]",Ni="[object Float64Array]",Fi="[object Int8Array]",Vi="[object Int16Array]",Bi="[object Int32Array]",Gi="[object Uint8Array]",Ui="[object Uint8ClampedArray]",qi="[object Uint16Array]",Wi="[object Uint32Array]",D={};D[Ji]=D[Ni]=D[Fi]=D[Vi]=D[Bi]=D[Gi]=D[Ui]=D[qi]=D[Wi]=!0;D[Ei]=D[Si]=D[$i]=D[Ci]=D[Di]=D[Ti]=D[Ii]=D[Ri]=D[Mi]=D[Oi]=D[ki]=D[Pi]=D[zi]=D[Ai]=D[Li]=!1;function Hi(e){return M.isObjectLike(e)&&Bt(e.length)&&!!D[M.baseGetTag(e)]}function Zi(e){return function(t){return e(t)}}var Re=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dt=Re&&typeof module=="object"&&module&&!module.nodeType&&module,Xi=dt&&dt.exports===Re,Pt=Xi&&M.freeGlobal.process,re=function(){try{var e=dt&&dt.require&&dt.require("util").types;return e||Pt&&Pt.binding&&Pt.binding("util")}catch{}}(),oe=re&&re.isTypedArray,Me=oe?Zi(oe):Hi,Yi=Object.prototype,Qi=Yi.hasOwnProperty;function Ki(e,t){var n=X(e),i=!n&&Ce(e),o=!n&&!i&&$t(e),r=!n&&!i&&!o&&Me(e),s=n||i||o||r,c=s?gi(e.length,String):[],a=c.length;for(var l in e)Qi.call(e,l)&&!(s&&(l=="length"||o&&(l=="offset"||l=="parent")||r&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Ie(l,a)))&&c.push(l);return c}var tr=Object.prototype;function er(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||tr;return e===n}function nr(e,t){return function(n){return e(t(n))}}var ir=nr(Object.keys,Object),rr=Object.prototype,or=rr.hasOwnProperty;function sr(e){if(!er(e))return ir(e);var t=[];for(var n in Object(e))or.call(e,n)&&n!="constructor"&&t.push(n);return t}function Oe(e){return e!=null&&Bt(e.length)&&!Ee(e)}function Gt(e){return Oe(e)?Ki(e):sr(e)}function ar(e,t){return e&&pi(e,t,Gt)}function cr(e,t){return function(n,i){if(n==null)return n;if(!Oe(n))return e(n,i);for(var o=n.length,r=-1,s=Object(n);++r<o&&i(s[r],r,s)!==!1;);return n}}var lr=cr(ar);function ur(e,t,n,i){return lr(e,function(o,r,s){t(i,o,n(o),s)}),i}function hr(){this.__data__=[],this.size=0}function ke(e,t){return e===t||e!==e&&t!==t}function vt(e,t){for(var n=e.length;n--;)if(ke(e[n][0],t))return n;return-1}var dr=Array.prototype,pr=dr.splice;function gr(e){var t=this.__data__,n=vt(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():pr.call(t,n,1),--this.size,!0}function fr(e){var t=this.__data__,n=vt(t,e);return n<0?void 0:t[n][1]}function mr(e){return vt(this.__data__,e)>-1}function yr(e,t){var n=this.__data__,i=vt(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}function tt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}tt.prototype.clear=hr;tt.prototype.delete=gr;tt.prototype.get=fr;tt.prototype.has=mr;tt.prototype.set=yr;function xr(){this.__data__=new tt,this.size=0}function _r(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function wr(e){return this.__data__.get(e)}function br(e){return this.__data__.has(e)}var pt=ct(M.root,"Map"),gt=ct(Object,"create");function vr(){this.__data__=gt?gt(null):{},this.size=0}function jr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Er="__lodash_hash_undefined__",Sr=Object.prototype,Cr=Sr.hasOwnProperty;function Tr(e){var t=this.__data__;if(gt){var n=t[e];return n===Er?void 0:n}return Cr.call(t,e)?t[e]:void 0}var Ir=Object.prototype,Rr=Ir.hasOwnProperty;function Mr(e){var t=this.__data__;return gt?t[e]!==void 0:Rr.call(t,e)}var Or="__lodash_hash_undefined__";function kr(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gt&&t===void 0?Or:t,this}function ot(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ot.prototype.clear=vr;ot.prototype.delete=jr;ot.prototype.get=Tr;ot.prototype.has=Mr;ot.prototype.set=kr;function Pr(){this.size=0,this.__data__={hash:new ot,map:new(pt||tt),string:new ot}}function zr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jt(e,t){var n=e.__data__;return zr(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ar(e){var t=jt(this,e).delete(e);return this.size-=t?1:0,t}function Lr(e){return jt(this,e).get(e)}function $r(e){return jt(this,e).has(e)}function Dr(e,t){var n=jt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}function et(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}et.prototype.clear=Pr;et.prototype.delete=Ar;et.prototype.get=Lr;et.prototype.has=$r;et.prototype.set=Dr;var Jr=200;function Nr(e,t){var n=this.__data__;if(n instanceof tt){var i=n.__data__;if(!pt||i.length<Jr-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new et(i)}return n.set(e,t),this.size=n.size,this}function Q(e){var t=this.__data__=new tt(e);this.size=t.size}Q.prototype.clear=xr;Q.prototype.delete=_r;Q.prototype.get=wr;Q.prototype.has=br;Q.prototype.set=Nr;var Fr="__lodash_hash_undefined__";function Vr(e){return this.__data__.set(e,Fr),this}function Br(e){return this.__data__.has(e)}function xt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new et;++t<n;)this.add(e[t])}xt.prototype.add=xt.prototype.push=Vr;xt.prototype.has=Br;function Gr(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function Ur(e,t){return e.has(t)}var qr=1,Wr=2;function Pe(e,t,n,i,o,r){var s=n&qr,c=e.length,a=t.length;if(c!=a&&!(s&&a>c))return!1;var l=r.get(e),h=r.get(t);if(l&&h)return l==t&&h==e;var d=-1,u=!0,g=n&Wr?new xt:void 0;for(r.set(e,t),r.set(t,e);++d<c;){var y=e[d],E=t[d];if(i)var m=s?i(E,y,d,t,e,r):i(y,E,d,e,t,r);if(m!==void 0){if(m)continue;u=!1;break}if(g){if(!Gr(t,function(v,T){if(!Ur(g,T)&&(y===v||o(y,v,n,i,r)))return g.push(T)})){u=!1;break}}else if(!(y===E||o(y,E,n,i,r))){u=!1;break}}return r.delete(e),r.delete(t),u}var se=M.root.Uint8Array;function Hr(e){var t=-1,n=Array(e.size);return e.forEach(function(i,o){n[++t]=[o,i]}),n}function Zr(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var Xr=1,Yr=2,Qr="[object Boolean]",Kr="[object Date]",to="[object Error]",eo="[object Map]",no="[object Number]",io="[object RegExp]",ro="[object Set]",oo="[object String]",so="[object Symbol]",ao="[object ArrayBuffer]",co="[object DataView]",ae=M.Symbol?M.Symbol.prototype:void 0,zt=ae?ae.valueOf:void 0;function lo(e,t,n,i,o,r,s){switch(n){case co:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ao:return!(e.byteLength!=t.byteLength||!r(new se(e),new se(t)));case Qr:case Kr:case no:return ke(+e,+t);case to:return e.name==t.name&&e.message==t.message;case io:case oo:return e==t+"";case eo:var c=Hr;case ro:var a=i&Xr;if(c||(c=Zr),e.size!=t.size&&!a)return!1;var l=s.get(e);if(l)return l==t;i|=Yr,s.set(e,t);var h=Pe(c(e),c(t),i,o,r,s);return s.delete(e),h;case so:if(zt)return zt.call(e)==zt.call(t)}return!1}function uo(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}function ho(e,t,n){var i=t(e);return X(e)?i:uo(i,n(e))}function po(e,t){for(var n=-1,i=e==null?0:e.length,o=0,r=[];++n<i;){var s=e[n];t(s,n,e)&&(r[o++]=s)}return r}function go(){return[]}var fo=Object.prototype,mo=fo.propertyIsEnumerable,ce=Object.getOwnPropertySymbols,yo=ce?function(e){return e==null?[]:(e=Object(e),po(ce(e),function(t){return mo.call(e,t)}))}:go;function le(e){return ho(e,Gt,yo)}var xo=1,_o=Object.prototype,wo=_o.hasOwnProperty;function bo(e,t,n,i,o,r){var s=n&xo,c=le(e),a=c.length,l=le(t),h=l.length;if(a!=h&&!s)return!1;for(var d=a;d--;){var u=c[d];if(!(s?u in t:wo.call(t,u)))return!1}var g=r.get(e),y=r.get(t);if(g&&y)return g==t&&y==e;var E=!0;r.set(e,t),r.set(t,e);for(var m=s;++d<a;){u=c[d];var v=e[u],T=t[u];if(i)var A=s?i(T,v,u,t,e,r):i(v,T,u,e,t,r);if(!(A===void 0?v===T||o(v,T,n,i,r):A)){E=!1;break}m||(m=u=="constructor")}if(E&&!m){var L=e.constructor,k=t.constructor;L!=k&&"constructor"in e&&"constructor"in t&&!(typeof L=="function"&&L instanceof L&&typeof k=="function"&&k instanceof k)&&(E=!1)}return r.delete(e),r.delete(t),E}var Dt=ct(M.root,"DataView"),Jt=ct(M.root,"Promise"),Nt=ct(M.root,"Set"),Ft=ct(M.root,"WeakMap"),ue="[object Map]",vo="[object Object]",he="[object Promise]",de="[object Set]",pe="[object WeakMap]",ge="[object DataView]",jo=at(Dt),Eo=at(pt),So=at(Jt),Co=at(Nt),To=at(Ft),nt=M.baseGetTag;(Dt&&nt(new Dt(new ArrayBuffer(1)))!=ge||pt&&nt(new pt)!=ue||Jt&&nt(Jt.resolve())!=he||Nt&&nt(new Nt)!=de||Ft&&nt(new Ft)!=pe)&&(nt=function(e){var t=M.baseGetTag(e),n=t==vo?e.constructor:void 0,i=n?at(n):"";if(i)switch(i){case jo:return ge;case Eo:return ue;case So:return he;case Co:return de;case To:return pe}return t});var Io=1,fe="[object Arguments]",me="[object Array]",ft="[object Object]",Ro=Object.prototype,ye=Ro.hasOwnProperty;function Mo(e,t,n,i,o,r){var s=X(e),c=X(t),a=s?me:nt(e),l=c?me:nt(t);a=a==fe?ft:a,l=l==fe?ft:l;var h=a==ft,d=l==ft,u=a==l;if(u&&$t(e)){if(!$t(t))return!1;s=!0,h=!1}if(u&&!h)return r||(r=new Q),s||Me(e)?Pe(e,t,n,i,o,r):lo(e,t,a,n,i,o,r);if(!(n&Io)){var g=h&&ye.call(e,"__wrapped__"),y=d&&ye.call(t,"__wrapped__");if(g||y){var E=g?e.value():e,m=y?t.value():t;return r||(r=new Q),o(E,m,n,i,r)}}return u?(r||(r=new Q),bo(e,t,n,i,o,r)):!1}function Et(e,t,n,i,o){return e===t?!0:e==null||t==null||!M.isObjectLike(e)&&!M.isObjectLike(t)?e!==e&&t!==t:Mo(e,t,n,i,Et,o)}var Oo=1,ko=2;function Po(e,t,n,i){var o=n.length,r=o;if(e==null)return!r;for(e=Object(e);o--;){var s=n[o];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<r;){s=n[o];var c=s[0],a=e[c],l=s[1];if(s[2]){if(a===void 0&&!(c in e))return!1}else{var h=new Q,d;if(!(d===void 0?Et(l,a,Oo|ko,i,h):d))return!1}}return!0}function ze(e){return e===e&&!rt(e)}function zo(e){for(var t=Gt(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,ze(o)]}return t}function Ae(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Ao(e){var t=zo(e);return t.length==1&&t[0][2]?Ae(t[0][0],t[0][1]):function(n){return n===e||Po(n,e,t)}}var Lo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$o=/^\w*$/;function Ut(e,t){if(X(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||_t(e)?!0:$o.test(e)||!Lo.test(e)||t!=null&&e in Object(t)}var Do="Expected a function";function qt(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Do);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var s=e.apply(this,i);return n.cache=r.set(o,s)||r,s};return n.cache=new(qt.Cache||et),n}qt.Cache=et;var Jo=500;function No(e){var t=qt(e,function(i){return n.size===Jo&&n.clear(),i}),n=t.cache;return t}var Fo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Vo=/\\(\\)?/g,Bo=No(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Fo,function(n,i,o,r){t.push(o?r.replace(Vo,"$1"):i||n)}),t});function Go(e,t){for(var n=-1,i=e==null?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var xe=M.Symbol?M.Symbol.prototype:void 0,_e=xe?xe.toString:void 0;function Le(e){if(typeof e=="string")return e;if(X(e))return Go(e,Le)+"";if(_t(e))return _e?_e.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function $e(e){return e==null?"":Le(e)}function De(e,t){return X(e)?e:Ut(e,t)?[e]:Bo($e(e))}function St(e){if(typeof e=="string"||_t(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Je(e,t){t=De(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[St(t[n++])];return n&&n==i?e:void 0}function Uo(e,t,n){var i=e==null?void 0:Je(e,t);return i===void 0?n:i}function qo(e,t){return e!=null&&t in Object(e)}function Wo(e,t,n){t=De(t,e);for(var i=-1,o=t.length,r=!1;++i<o;){var s=St(t[i]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++i!=o?r:(o=e==null?0:e.length,!!o&&Bt(o)&&Ie(s,o)&&(X(e)||Ce(e)))}function Ho(e,t){return e!=null&&Wo(e,t,qo)}var Zo=1,Xo=2;function Yo(e,t){return Ut(e)&&ze(t)?Ae(St(e),t):function(n){var i=Uo(n,e);return i===void 0&&i===t?Ho(n,e):Et(t,i,Zo|Xo)}}function Qo(e){return e}function Ko(e){return function(t){return t==null?void 0:t[e]}}function ts(e){return function(t){return Je(t,e)}}function es(e){return Ut(e)?Ko(St(e)):ts(e)}function ns(e){return typeof e=="function"?e:e==null?Qo:typeof e=="object"?X(e)?Yo(e[0],e[1]):Ao(e):es(e)}function is(e,t){return function(n,i){var o=X(n)?hi:ur,r={};return o(n,e,ns(i),r)}}var mt=is(function(e,t,n){ui(e,n,t)}),rs=0;function os(e){var t=++rs;return $e(e)+t}const Vt=[{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}],ss=[{id:"continuous"},...Vt],as=["coordsys","tool"];class Ct{constructor(t,n,i,o){var r,s;this.jogger=t,this.coordSystems=n,this.motionGroupDescription=i,this.tcps=o,this.selectedTabId="cartesian",this.activationState="inactive",this.activationError=null,this.activationCounter=0,this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.selectedTcpId="",this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.translationVelocityMmPerSec=10,this.rotationVelocityDegPerSec=1,this.minTranslationVelocityMmPerSec=5,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=[];for(const c of n)if(c.coordinate_system===""){c.coordinate_system="world";break}this.selectedCoordSystemId=((r=n[0])==null?void 0:r.coordinate_system)||"world",this.selectedTcpId=((s=o[0])==null?void 0:s.id)||"",Z.makeAutoObservable(this,{},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()},this.loadFromLocalStorage(),this.disposers.push(Z.autorun(()=>this.saveToLocalStorage())),window.joggingStore=this}static async loadFor(t){const{nova:n}=t,[i,o]=await Promise.all([n.api.controller.listCoordinateSystems(t.motionStream.controllerId,"ROTATION_VECTOR"),n.api.motionGroup.getMotionGroupDescription(t.motionStream.controllerId,t.motionGroupId)]),r=Object.entries(o.tcps||{}).map(([s,c])=>({id:s,readable_name:c.name,position:c.pose.position,orientation:c.pose.orientation}));return new Ct(t,i||[],o,r)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return we.countBy(this.coordSystems,t=>t.name)}async deactivate(){if(this.jogger.mode==="jogging")return this.jogger.stop()}async activate(){return this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&this.jogger.setOptions({tcp:this.selectedTcpId,orientation:this.selectedOrientation}),this.activeDiscreteIncrement?this.jogger.setJoggingMode("trajectory"):this.jogger.setJoggingMode("jogging")):this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){const t=U.tryParseJson(localStorage.getItem("joggingToolStore"));t&&(this.tabsById[t.selectedTabId]&&(this.selectedTabId=t.selectedTabId),this.coordSystemsById[t.selectedCoordSystemId]&&(this.selectedCoordSystemId=t.selectedCoordSystemId),this.tcpsById[t.selectedTcpId]&&(this.selectedTcpId=t.selectedTcpId),this.incrementOptionsById[t.selectedIncrementId]&&(this.selectedIncrementId=t.selectedIncrementId),["translate","rotate"].includes(t.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=t.selectedCartesianMotionType),["coordsys","tool"].includes(t.selectedOrientation)&&(this.selectedOrientation=t.selectedOrientation))}saveToLocalStorage(){localStorage.setItem("joggingToolStore",JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,selectedTcpId:this.selectedTcpId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get tabs(){return[{id:"cartesian",label:"cartesian"},{id:"joint",label:"joint"}]}get incrementOptions(){return ss}get discreteIncrementOptions(){return Vt}get incrementOptionsById(){return mt(this.incrementOptions,t=>t.id)}get tabsById(){return mt(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 mt(this.coordSystems,t=>t.coordinate_system)}get selectedCoordSystem(){return this.coordSystemsById[this.selectedCoordSystemId]}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return mt(this.tcps,t=>t.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:Vt.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}get velocityInDisplayUnits(){return this.currentMotionType==="translate"?this.translationVelocityMmPerSec:this.rotationVelocityDegPerSec}get minVelocityInDisplayUnits(){return this.currentMotionType==="translate"?this.minTranslationVelocityMmPerSec:this.minRotationVelocityDegPerSec}get maxVelocityInDisplayUnits(){return this.currentMotionType==="translate"?this.maxTranslationVelocityMmPerSec:this.maxRotationVelocityDegPerSec}get currentMotionType(){return this.selectedTabId==="cartesian"&&this.selectedCartesianMotionType==="translate"?"translate":"rotate"}onTabChange(t,n){const i=this.tabs[n]||this.tabs[0];this.selectedTabId=i.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.selectedTcpId=t}setSelectedOrientation(t){this.selectedOrientation=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setVelocityFromSlider(t){this.currentMotionType==="translate"?this.translationVelocityMmPerSec=t:this.rotationVelocityDegPerSec=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()}async withMotionLock(t){const n=os();this.lock(n);try{return await t()}finally{this.unlock(n)}}}const cs=q.observer(({store:e})=>{const{t}=st.useTranslation();return p.jsxRuntimeExports.jsx(x.Backdrop,{open:!0,sx:{position:"absolute",zIndex:n=>n.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:p.jsxRuntimeExports.jsxs(x.Stack,{sx:{m:2,width:"100%"},children:[p.jsxRuntimeExports.jsxs(x.Alert,{severity:"error",sx:{mb:2},children:[p.jsxRuntimeExports.jsx(x.AlertTitle,{children:t("Jogging.Blocked.ti")}),t("Jogging.Blocked.lb")]}),p.jsxRuntimeExports.jsx(x.Button,{variant:"contained",color:"secondary",onClick:()=>e.unblock(),children:t("Jogging.Blocked.Reenable.bt")})]})})}),ls=({title:e,titleId:t,...n},i)=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...n},e?$.createElement("title",{id:t},e):null,$.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"})),us=F.forwardRef(ls),hs=({title:e,titleId:t,...n},i)=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...n},e?$.createElement("title",{id:t},e):null,$.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"})),ds=F.forwardRef(hs),ps=({title:e,titleId:t,...n},i)=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:i,"aria-labelledby":t,...n},e?$.createElement("title",{id:t},e):null,$.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"})),gs=F.forwardRef(ps),fs=({title:e,titleId:t,...n},i)=>$.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,...n},e?$.createElement("title",{id:t},e):null,$.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"})),ms=F.forwardRef(fs);function ys(e,t){return Et(e,t)}const Ne=({store:e})=>{const{t}=st.useTranslation(),[n,i]=F.useState(e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),o=F.useRef(n);K.useAnimationFrame(()=>{const s=e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;ys(o.current,s)||(o.current=s,i(s))});const r=[];for(const[s,c]of n.entries())c&&r.push(s);return p.jsxRuntimeExports.jsx(x.Typography,{color:"error",sx:{margin:"0.5rem 1rem",textAlign:"center",minHeight:"1.5rem",visibility:r.length?"visible":"hidden"},children:t("Jogging.JointLimitsReached.lb",{jointNumbers:r.map(s=>s+1).join(", ")})})},xs=x.styled(x.FormControl)(({theme:e})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:e.palette.text.primary}}}}));function yt({labelValue:e,...t}){return p.jsxRuntimeExports.jsxs(xs,{fullWidth:!0,variant:"filled",children:[p.jsxRuntimeExports.jsx(x.InputLabel,{id:t.labelId,children:e}),p.jsxRuntimeExports.jsx(x.Select,{...t})]})}const _s=q.observer(({store:e})=>{var o;const{t}=st.useTranslation(),n=[];function i(r){switch(r){case"coordsys":return t("Jogging.Orientation.coordsys");case"tool":return t("Jogging.Orientation.tool");default:return r}}return e.showCoordSystemSelect&&n.push(p.jsxRuntimeExports.jsx(yt,{labelId:"jogging-coord-select",labelValue:t("Jogging.CoordinateSystem.hlb"),value:e.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:r=>e.setSelectedCoordSystemId(r.target.value),disabled:e.isLocked,children:e.coordSystems.map(r=>p.jsxRuntimeExports.jsx(x.MenuItem,{value:r.coordinate_system,children:r.name&&e.coordSystemCountByName[r.name]>1?`${r.name} / ${r.coordinate_system}`:r.name||r.coordinate_system},r.coordinate_system))},"coord")),e.showTcpSelect&&n.push(p.jsxRuntimeExports.jsx(yt,{labelId:"jogging-tcp-select",labelValue:"TCP",value:e.selectedTcpId,size:"small",variant:"filled",onChange:r=>e.setSelectedTcpId(r.target.value),disabled:e.isLocked,children:e.tcps.map(r=>p.jsxRuntimeExports.jsx(x.MenuItem,{value:r.id,children:r.id},r.id))},"tcp")),e.showOrientationSelect&&n.push(p.jsxRuntimeExports.jsx(yt,{labelValue:t("Jogging.Cartesian.Orientation.lb"),id:"orientation-select",labelId:"orientation-select",value:e.selectedOrientation,onChange:r=>e.setSelectedOrientation(r.target.value),disabled:e.isLocked,children:as.map(r=>p.jsxRuntimeExports.jsx(x.MenuItem,{value:r,children:i(r)},r))},"orientation")),e.showIncrementSelect&&n.push(p.jsxRuntimeExports.jsxs(yt,{labelValue:t("Jogging.Increment.hlb"),labelId:"jogging-increment-select",size:"small",variant:"filled",value:((o=e.activeDiscreteIncrement)==null?void 0:o.id)||"continuous",onChange:r=>e.setSelectedIncrementId(r.target.value),disabled:e.isLocked,children:[p.jsxRuntimeExports.jsx(x.MenuItem,{value:"continuous",children:t("Jogging.Increment.Continuous.dd")},"continuous"),e.selectedOrientation==="tool"?null:e.discreteIncrementOptions.map(r=>p.jsxRuntimeExports.jsx(x.MenuItem,{value:r.id,children:e.currentMotionType==="translate"?`${r.mm}mm`:`${r.degrees}°`},r.id))]},"increment")),p.jsxRuntimeExports.jsx(x.Box,{component:"div",sx:{display:"grid",gap:"16px",gridTemplateColumns:"1fr 1fr",gridAutoRows:"min-content","& label":{opacity:.7,fontSize:"12px",marginBottom:"4px"}},children:n.map((r,s)=>p.jsxRuntimeExports.jsx(x.Box,{sx:{gridColumn:n.length%2===1&&s===n.length-1?"span 2":"auto"},children:r},s))})}),ws=x.styled(x.ToggleButtonGroup)(({theme:e})=>{var t;return{"&.MuiToggleButtonGroup-root":{background:(t=e.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"}}}}}),Fe=q.observer(({store:e})=>{const{t}=st.useTranslation(),n=q.useLocalObservable(()=>({get valueLabelFormat(){return e.currentMotionType==="translate"?i=>`v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:i})}`:i=>`ω = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:i})}`}}));return p.jsxRuntimeExports.jsx(M.VelocitySlider,{store:e,velocity:e.velocityInDisplayUnits,min:e.minVelocityInDisplayUnits,max:e.maxVelocityInDisplayUnits,onVelocityChange:e.setVelocityFromSlider,disabled:e.isLocked,renderValue:i=>p.jsxRuntimeExports.jsx(M.VelocitySliderLabel,{value:n.valueLabelFormat(i),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),bs=q.observer(({store:e,children:t})=>{const{t:n}=st.useTranslation(),i=x.useTheme();function o(u,g){(g==="translate"||g==="rotate")&&e.setSelectedCartesianMotionType(g)}K.useReaction(()=>[e.selectedCoordSystemId,e.selectedTcpId],()=>{e.jogger.motionStream.motionStateSocket.changeUrl(e.jogger.nova.makeWebsocketURL(`/controllers/${e.jogger.motionStream.controllerId}/motion-groups/${e.jogger.motionGroupId}/state-stream?tcp=${e.selectedTcpId}`))},{fireImmediately:!0});async function r(u,g){const y=await e.activate(),E=y.motionStream.rapidlyChangingMotionState.tcp_pose,m=y.motionStream.rapidlyChangingMotionState.joint_position;E&&await e.withMotionLock(async()=>{try{e.setCurrentIncrementJog({axis:u.axis,direction:u.direction}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:E,currentJoints:m,coordSystemId:e.activeCoordSystemId,velocityInRelevantUnits:e.selectedCartesianMotionType==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:u.axis,direction:u.direction,motion:e.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:g.mm}:{type:"rotate",distanceRads:U.degreesToRadians(g.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}async function s(u){if(!e.isLocked){if(await e.activate(),e.activeDiscreteIncrement)return r(u,e.activeDiscreteIncrement);u.motionType==="translate"?await e.jogger.translateTCP({axis:u.axis,direction:u.direction,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:u.axis,direction:u.direction,velocityRadsPerSec:e.rotationVelocityRadsPerSec})}}async function c(){e.isLocked||e.activeDiscreteIncrement||await e.deactivate()}function a(u,g,y){var m,v,T;const E=(T=(v=(m=y.componentsExt)==null?void 0:m.JoggingPanel)==null?void 0:v.JoggingCartesian)==null?void 0:T.Axis;if(E)return g==="translate"?E[u]:E.CustomRotation??E[u]}const l=[{id:"x",icon:p.jsxRuntimeExports.jsx(us,{}),colors:a("X",e.selectedCartesianMotionType,i)},{id:"y",icon:p.jsxRuntimeExports.jsx(ds,{}),colors:a("Y",e.selectedCartesianMotionType,i)},{id:"z",icon:p.jsxRuntimeExports.jsx(gs,{}),colors:a("Z",e.selectedCartesianMotionType,i)}];function h(u){return n("General.mm.variable",{amount:u.toFixed(1)})}function d(u){return n("General.degree.variable",{amount:U.radiansToDegrees(u).toFixed(1)})}return p.jsxRuntimeExports.jsxs(x.Stack,{flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[p.jsxRuntimeExports.jsxs(x.Stack,{gap:2,children:[p.jsxRuntimeExports.jsx(_s,{store:e}),p.jsxRuntimeExports.jsx(Fe,{store:e}),p.jsxRuntimeExports.jsx(x.Divider,{})]}),p.jsxRuntimeExports.jsx(x.Stack,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:p.jsxRuntimeExports.jsxs(x.Stack,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[p.jsxRuntimeExports.jsxs(ws,{value:e.selectedCartesianMotionType,onChange:o,exclusive:!0,"aria-label":n("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[p.jsxRuntimeExports.jsx(x.ToggleButton,{value:"translate",children:n("Jogging.Cartesian.Translation.bt")}),p.jsxRuntimeExports.jsx(x.ToggleButton,{value:"rotate",children:n("Jogging.Cartesian.Rotation.bt")})]}),e.selectedCartesianMotionType==="translate"&&l.map(u=>{var g,y;return p.jsxRuntimeExports.jsx(At,{colors:u.colors,disabled:e.isLocked,activeJoggingDirection:((g=e.incrementJogInProgress)==null?void 0:g.axis)===u.id?e.incrementJogInProgress.direction:void 0,label:p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[u.icon,p.jsxRuntimeExports.jsx(x.Typography,{sx:{fontSize:"24px",color:((y=u.colors)==null?void 0:y.labelColor)??i.palette.text.primary},children:u.id.toUpperCase()})]}),getDisplayedValue:()=>{var E,m;return h(((m=(E=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:E.position)==null?void 0:m[U.XYZ_TO_VECTOR[u.id]])||0)},startJogging:E=>s({axis:u.id,motionType:"translate",direction:E}),stopJogging:c},u.id)}),e.selectedCartesianMotionType==="rotate"&&l.map(u=>{var g,y;return p.jsxRuntimeExports.jsx(At,{colors:u.colors,disabled:e.isLocked,activeJoggingDirection:((g=e.incrementJogInProgress)==null?void 0:g.axis)===u.id?e.incrementJogInProgress.direction:void 0,label:p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[p.jsxRuntimeExports.jsx(ms,{}),p.jsxRuntimeExports.jsx(x.Typography,{sx:{fontSize:"24px",color:((y=u.colors)==null?void 0:y.labelColor)??i.palette.text.primary},children:u.id.toUpperCase()})]}),getDisplayedValue:()=>{var E,m;return d(((m=(E=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:E.orientation)==null?void 0:m[U.XYZ_TO_VECTOR[u.id]])||0)},startJogging:E=>s({axis:u.id,motionType:"rotate",direction:E}),stopJogging:c},u.id)})]})}),p.jsxRuntimeExports.jsx(Ne,{store:e}),t&&p.jsxRuntimeExports.jsx(x.Divider,{}),t]})}),vs=q.observer(({store:e,children:t})=>{const n=x.useTheme();async function i(r){await e.activate(),await e.jogger.rotateJoints({joint:r.joint,direction:r.direction,velocityRadsPerSec:e.rotationVelocityRadsPerSec})}async function o(){await e.jogger.stop(),await e.deactivate()}return p.jsxRuntimeExports.jsxs(x.Stack,{flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[p.jsxRuntimeExports.jsx(Fe,{store:e}),p.jsxRuntimeExports.jsx(x.Divider,{}),p.jsxRuntimeExports.jsx(x.Stack,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},id:"JointControls",children:p.jsxRuntimeExports.jsx(x.Stack,{alignItems:"center",gap:"24px",children:e.jogger.motionStream.joints.map(r=>{var l,h,d;const s=(d=(h=(l=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:l.joints)==null?void 0:h[r.index])==null?void 0:d.position,c=(s==null?void 0:s.lower_limit)!==void 0?U.radiansToDegrees(s.lower_limit):void 0,a=(s==null?void 0:s.upper_limit)!==void 0?U.radiansToDegrees(s.upper_limit):void 0;return p.jsxRuntimeExports.jsxs(x.Stack,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[e.showJointsLegend&&p.jsxRuntimeExports.jsx(x.Typography,{color:e.isLocked?n.palette.text.disabled:n.palette.text.secondary,children:`G${r.index+1}`}),p.jsxRuntimeExports.jsx(be,{disabled:e.isLocked,lowerLimitDegs:c,upperLimitDegs:a,getValueDegs:()=>{const u=e.jogger.motionStream.rapidlyChangingMotionState.joint_position[r.index];return u!==void 0?U.radiansToDegrees(u):void 0},startJogging:u=>i({joint:r.index,direction:u}),stopJogging:o})]},`joint-${r.index}`)})})}),p.jsxRuntimeExports.jsx(Ne,{store:e}),t&&p.jsxRuntimeExports.jsx(x.Divider,{}),t]})}),js=p.externalizeComponent(q.observer(e=>{const t=we.isString(e.nova)?new Un({instanceUrl:e.nova}):e.nova,n=q.useLocalObservable(()=>({joggingStore:null,loadingError:null}));async function i(){Z.runInAction(()=>{n.loadingError=null,n.joggingStore=null});try{let o=e.store;if(!o){const r=await bt.open(t,e.motionGroupId);o=await Ct.loadFor(r)}Z.runInAction(()=>{n.joggingStore=o}),e.onSetup&&e.onSetup(o)}catch(o){n.loadingError=o}}return F.useEffect(()=>(i(),e.store?()=>null:()=>{var o;(o=n.joggingStore)==null||o.dispose()}),[e.store,e.nova,e.motionGroupId]),F.useEffect(()=>{const o=n.joggingStore;o&&(e.locked?o.lock("external"):o.unlock("external"))},[n.joggingStore,e.locked]),p.jsxRuntimeExports.jsx(x.Stack,{sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...e.sx},children:n.joggingStore?p.jsxRuntimeExports.jsx(Es,{store:n.joggingStore,children:e.children}):p.jsxRuntimeExports.jsx(M.LoadingCover,{message:"Loading jogging",error:n.loadingError})})})),Es=q.observer(({store:e,children:t})=>{const{t:n}=st.useTranslation();function i(){if(e.currentTab.id==="cartesian")return p.jsxRuntimeExports.jsx(p.jsxRuntimeExports.Fragment,{children:p.jsxRuntimeExports.jsx(bs,{store:e,children:t})});if(e.currentTab.id==="joint")return p.jsxRuntimeExports.jsx(p.jsxRuntimeExports.Fragment,{children:p.jsxRuntimeExports.jsx(vs,{store:e,children:t})})}return p.jsxRuntimeExports.jsxs(x.Stack,{flexGrow:1,sx:{overflow:"hidden"},children:[p.jsxRuntimeExports.jsx(x.Tabs,{value:e.tabIndex,onChange:e.onTabChange,variant:"fullWidth",children:e.tabs.map(o=>{const r=o.label==="cartesian"?n("Jogging.Cartesian.bt"):n("Jogging.Joints.bt"),s=o.label==="cartesian"?p.jsxRuntimeExports.jsx(En,{fontSize:"small",sx:{mr:1}}):p.jsxRuntimeExports.jsx(Sn,{fontSize:"small",sx:{mr:1}});return p.jsxRuntimeExports.jsx(x.Tab,{label:e.showTabIcons?p.jsxRuntimeExports.jsxs(x.Stack,{direction:"row",alignItems:"center",children:[s,r]}):r,id:`jogging-tab-${o.id}`,"aria-controls":`jogging-tab-${o.id}`},o.id)})}),p.jsxRuntimeExports.jsx(x.Stack,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:i()}),e.blocked&&p.jsxRuntimeExports.jsx(cs,{store:e})]})}),Ve=e=>{var c;const{value:t,ref:n}=e,i=x.useTheme(),[o,r]=F.useState(!1);async function s(){if(!n||!("current"in n))return console.warn("No copy target found"),!1;try{return await navigator.clipboard.writeText(t),console.log("Copied!"),r(!0),!0}catch(a){console.error(a);const l=window.getSelection();if(l&&n&&"current"in n&&n.current){const h=document.createRange();h.selectNodeContents(n.current),l.removeAllRanges(),l.addRange(h)}}return!1}return F.useEffect(()=>{if(!o)return;const a=setTimeout(()=>r(!1),3e3);return()=>{a&&clearTimeout(a)}},[o]),p.jsxRuntimeExports.jsx(x.Tooltip,{open:o,title:"Copied!",children:p.jsxRuntimeExports.jsx(x.Stack,{justifyContent:"center",sx:{height:"100%",boxSizing:"border-box",padding:"6px 12px",background:(c=i.palette.backgroundPaperElevation)==null?void 0:c[8],borderRadius:"10px",minWidth:"0",cursor:"pointer"},onClick:()=>s(),children:p.jsxRuntimeExports.jsx(x.Typography,{ref:n,align:"center",sx:{pointerEvents:"none",fontSize:"12px",color:i.palette.text.primary,whiteSpace:"nowrap",minWidth:0,textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:t})})})},Ss=p.externalizeComponent(q.observer(({tcpPose:e,showCopyButton:t=!1})=>{const[n,i]=F.useState(null),o=qn(e),r=async()=>{try{await navigator.clipboard.writeText(o),i("Copied!"),setTimeout(()=>i(null),2e3)}catch{i("Copy failed"),setTimeout(()=>i(null),2e3)}};return p.jsxRuntimeExports.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-cartesian-values",children:[p.jsxRuntimeExports.jsx(Ve,{value:o}),t&&p.jsxRuntimeExports.jsx(x.Button,{variant:"contained",color:"secondary",size:"small",onClick:r,sx:{flexShrink:0},children:n||"Copy"})]})})),Cs=p.externalizeComponent(q.observer(({joints:e,showCopyButton:t=!1})=>{const[n,i]=F.useState(null),o=`[${e.map(s=>parseFloat(s.toFixed(4))).join(", ")}]`,r=async()=>{try{await navigator.clipboard.writeText(o),i("Copied!"),setTimeout(()=>i(null),2e3)}catch{i("Copy failed"),setTimeout(()=>i(null),2e3)}};return p.jsxRuntimeExports.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-joint-values",children:[p.jsxRuntimeExports.jsx(Ve,{value:o}),t&&p.jsxRuntimeExports.jsx(x.Button,{variant:"contained",color:"secondary",size:"small",onClick:r,sx:{flexShrink:0},children:n||"Copy"})]})}));exports.JoggerConnection=bt;exports.JoggingCartesianAxisControl=At;exports.JoggingJointRotationControl=be;exports.JoggingPanel=js;exports.JoggingStore=Ct;exports.MotionStreamConnection=wt;exports.PoseCartesianValues=Ss;exports.PoseJointValues=Cs;
|
|
21
|
-
//# sourceMappingURL=PoseJointValues-wLOjcYDe.cjs.map
|