@wandelbots/wandelbots-js-react-components 4.5.0 → 4.6.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.
Files changed (27) hide show
  1. package/dist/3d.cjs.js +1 -1
  2. package/dist/3d.es.js +1 -1
  3. package/dist/{MotionGroupVisualizer-Ce9kTMPy.js → MotionGroupVisualizer-BlWkdkaM.js} +458 -409
  4. package/dist/MotionGroupVisualizer-BlWkdkaM.js.map +1 -0
  5. package/dist/MotionGroupVisualizer-Bw-h3U_t.cjs +2 -0
  6. package/dist/MotionGroupVisualizer-Bw-h3U_t.cjs.map +1 -0
  7. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +3 -2
  8. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
  9. package/dist/core.cjs.js +1 -1
  10. package/dist/core.es.js +2 -2
  11. package/dist/index.cjs.js +1 -1
  12. package/dist/index.es.js +3 -3
  13. package/dist/{interpolation-Chyc6Hfo.js → interpolation-BxZtUOAs.js} +273 -273
  14. package/dist/interpolation-BxZtUOAs.js.map +1 -0
  15. package/dist/{interpolation-CiEw5jkz.cjs → interpolation-D4zTPZou.cjs} +4 -4
  16. package/dist/interpolation-D4zTPZou.cjs.map +1 -0
  17. package/dist/{theming-CZbXnFej.js → theming-3PEA0ksG.js} +2 -2
  18. package/dist/{theming-CZbXnFej.js.map → theming-3PEA0ksG.js.map} +1 -1
  19. package/dist/{theming-b98f6nXs.cjs → theming-U3LOZpcT.cjs} +2 -2
  20. package/dist/{theming-b98f6nXs.cjs.map → theming-U3LOZpcT.cjs.map} +1 -1
  21. package/package.json +1 -1
  22. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +83 -11
  23. package/dist/MotionGroupVisualizer-COKQraKa.cjs +0 -2
  24. package/dist/MotionGroupVisualizer-COKQraKa.cjs.map +0 -1
  25. package/dist/MotionGroupVisualizer-Ce9kTMPy.js.map +0 -1
  26. package/dist/interpolation-Chyc6Hfo.js.map +0 -1
  27. package/dist/interpolation-CiEw5jkz.cjs.map +0 -1
@@ -1,16 +1,16 @@
1
- import { j as t, e as C } from "./externalizeComponent-Dc3fViZA.js";
1
+ import { j as t, e as O } from "./externalizeComponent-Dc3fViZA.js";
2
2
  import * as x from "three";
3
- import { Matrix4 as w, Vector3 as T, Quaternion as E } from "three";
3
+ import { Matrix4 as w, Vector3 as V, Quaternion as J } from "three";
4
4
  import { ConvexGeometry as re } from "three-stdlib";
5
- import Me, { useEffect as v, useMemo as z, useRef as R, useCallback as V, useState as A, Suspense as oe } from "react";
6
- import { useThree as se, useFrame as ie, Canvas as q } from "@react-three/fiber";
7
- import { Environment as _e, Lightformer as L, Line as J, useGLTF as Ve, Bounds as X } from "@react-three/drei";
8
- import { useTheme as Te, Card as Ae, Box as b, Typography as K, Divider as Q, Button as Z } from "@mui/material";
9
- import { observer as Le } from "mobx-react-lite";
10
- import { useTranslation as Ge } from "react-i18next";
11
- import { N as Se, V as ae, c as le, b as ee, M, J as I } from "./interpolation-Chyc6Hfo.js";
5
+ import ve, { useEffect as M, useMemo as F, useRef as R, useCallback as T, useState as S, Suspense as oe } from "react";
6
+ import { useThree as se, useFrame as ie, Canvas as Y } from "@react-three/fiber";
7
+ import { Environment as _e, Lightformer as A, Line as z, useGLTF as Te, Bounds as X } from "@react-three/drei";
8
+ import { useTheme as Ve, Card as Se, Box as b, Typography as K, Divider as Q, Button as Z } from "@mui/material";
9
+ import { observer as Ae } from "mobx-react-lite";
10
+ import { useTranslation as Fe } from "react-i18next";
11
+ import { N as Le, V as ae, c as le, b as ee, M as v, J as D } from "./interpolation-BxZtUOAs.js";
12
12
  import { ErrorBoundary as ce } from "react-error-boundary";
13
- function ke(e) {
13
+ function Ge(e) {
14
14
  switch (e.shape_type) {
15
15
  case "convex_hull":
16
16
  return new re(
@@ -47,13 +47,13 @@ function ke(e) {
47
47
  return console.warn(`${e.shape_type} is not supported`), new x.BufferGeometry();
48
48
  }
49
49
  }
50
- function Fe({
50
+ function Pe({
51
51
  name: e,
52
52
  collider: r,
53
53
  children: n
54
54
  }) {
55
- var f, s;
56
- const l = ((f = r.pose) == null ? void 0 : f.position) ?? [0, 0, 0], o = ((s = r.pose) == null ? void 0 : s.orientation) ?? [0, 0, 0];
55
+ var d, u;
56
+ const l = ((d = r.pose) == null ? void 0 : d.position) ?? [0, 0, 0], i = ((u = r.pose) == null ? void 0 : u.orientation) ?? [0, 0, 0];
57
57
  return r.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
58
58
  "mesh",
59
59
  {
@@ -63,26 +63,26 @@ function Fe({
63
63
  l[1],
64
64
  l[2]
65
65
  ).divideScalar(1e3),
66
- rotation: new x.Euler(o[0], o[1], o[2], "XYZ"),
67
- geometry: ke(r.shape),
66
+ rotation: new x.Euler(i[0], i[1], i[2], "XYZ"),
67
+ geometry: Ge(r.shape),
68
68
  children: n
69
69
  }
70
70
  );
71
71
  }
72
- function Pe({
72
+ function ke({
73
73
  name: e,
74
74
  colliders: r,
75
75
  meshChildrenProvider: n,
76
76
  ...l
77
77
  }) {
78
- return /* @__PURE__ */ t.jsx("group", { name: e, ...l, children: Object.entries(r).map(([o, f]) => /* @__PURE__ */ t.jsx(
79
- Fe,
78
+ return /* @__PURE__ */ t.jsx("group", { name: e, ...l, children: Object.entries(r).map(([i, d]) => /* @__PURE__ */ t.jsx(
79
+ Pe,
80
80
  {
81
- name: o,
82
- collider: f,
83
- children: n(o, f)
81
+ name: i,
82
+ collider: d,
83
+ children: n(i, d)
84
84
  },
85
- o
85
+ i
86
86
  )) });
87
87
  }
88
88
  function ot({
@@ -91,7 +91,7 @@ function ot({
91
91
  }) {
92
92
  const n = e.colliders;
93
93
  return /* @__PURE__ */ t.jsx("group", { children: n && /* @__PURE__ */ t.jsx(
94
- Pe,
94
+ ke,
95
95
  {
96
96
  meshChildrenProvider: r,
97
97
  colliders: n
@@ -104,7 +104,7 @@ function te() {
104
104
  function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
105
105
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
106
106
  /* @__PURE__ */ t.jsx(
107
- L,
107
+ A,
108
108
  {
109
109
  intensity: 5,
110
110
  "rotation-x": Math.PI / 2,
@@ -113,7 +113,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
113
113
  }
114
114
  ),
115
115
  /* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((r, n) => /* @__PURE__ */ t.jsx(
116
- L,
116
+ A,
117
117
  {
118
118
  form: "circle",
119
119
  intensity: 5,
@@ -124,7 +124,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
124
124
  n
125
125
  )) }) }),
126
126
  /* @__PURE__ */ t.jsx(
127
- L,
127
+ A,
128
128
  {
129
129
  intensity: 40,
130
130
  "rotation-y": Math.PI / 2,
@@ -133,7 +133,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
133
133
  }
134
134
  ),
135
135
  /* @__PURE__ */ t.jsx(
136
- L,
136
+ A,
137
137
  {
138
138
  intensity: 20,
139
139
  "rotation-y": -Math.PI,
@@ -142,7 +142,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
142
142
  }
143
143
  ),
144
144
  /* @__PURE__ */ t.jsx(
145
- L,
145
+ A,
146
146
  {
147
147
  "rotation-y": Math.PI / 2,
148
148
  position: [-5, -1, -1],
@@ -151,7 +151,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
151
151
  }
152
152
  ),
153
153
  /* @__PURE__ */ t.jsx(
154
- L,
154
+ A,
155
155
  {
156
156
  "rotation-y": -Math.PI / 2,
157
157
  position: [10, 1, 0],
@@ -160,7 +160,7 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
160
160
  }
161
161
  ),
162
162
  /* @__PURE__ */ t.jsx(
163
- L,
163
+ A,
164
164
  {
165
165
  form: "ring",
166
166
  color: "white",
@@ -172,40 +172,41 @@ function Ie({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
172
172
  )
173
173
  ] });
174
174
  }
175
- function ze(e) {
175
+ function De(e) {
176
176
  if (e.length < 3)
177
177
  return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
178
- const r = new x.Vector3(e[0].x, e[0].y, e[0].z), n = new x.Vector3(e[1].x, e[1].y, e[1].z), l = new x.Vector3(e[2].x, e[2].y, e[2].z), o = new x.Vector3().subVectors(n, r), f = new x.Vector3().subVectors(l, r), s = new x.Vector3().crossVectors(o, f).normalize();
179
- for (let u = 3; u < e.length; u++) {
180
- const a = new x.Vector3(e[u].x, e[u].y, e[u].z), d = new x.Vector3().subVectors(a, r), m = s.dot(d);
181
- if (Math.abs(m) > 1e-6)
178
+ const r = new x.Vector3(e[0].x, e[0].y, e[0].z), n = new x.Vector3(e[1].x, e[1].y, e[1].z), l = new x.Vector3(e[2].x, e[2].y, e[2].z), i = new x.Vector3().subVectors(n, r), d = new x.Vector3().subVectors(l, r), u = new x.Vector3().crossVectors(i, d).normalize();
179
+ for (let m = 3; m < e.length; m++) {
180
+ const f = new x.Vector3(e[m].x, e[m].y, e[m].z), s = new x.Vector3().subVectors(f, r), p = u.dot(s);
181
+ if (Math.abs(p) > 1e-6)
182
182
  return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
183
183
  }
184
- return { isCoplanar: !0, normal: s };
184
+ return { isCoplanar: !0, normal: u };
185
185
  }
186
186
  function st({
187
187
  safetyZones: e,
188
- ...r
188
+ dhParameters: r,
189
+ ...n
189
190
  }) {
190
- v(() => {
191
+ M(() => {
191
192
  Array.isArray(e) && console.warn("SafetyZonesRenderer: The support of V1 safety zones is deprecated. Please migrate to V2 safety zones.");
192
193
  }, [e]);
193
- const n = (s, u) => {
194
- const a = ze(s);
195
- if (a.isCoplanar && a.normal) {
196
- const i = new x.Vector3().addVectors(
194
+ const l = (s, p) => {
195
+ const o = De(s);
196
+ if (o.isCoplanar && o.normal) {
197
+ const y = new x.Vector3().addVectors(
197
198
  s[0],
198
- a.normal.multiplyScalar(1e-4)
199
+ o.normal.multiplyScalar(1e-4)
199
200
  );
200
- s.push(i);
201
+ s.push(y);
201
202
  }
202
- let d;
203
+ let a;
203
204
  try {
204
- d = new re(s);
205
- } catch (m) {
206
- return console.log("Error creating ConvexGeometry:", m), null;
205
+ a = new re(s);
206
+ } catch (c) {
207
+ return console.log("Error creating ConvexGeometry:", c), null;
207
208
  }
208
- return /* @__PURE__ */ t.jsx("mesh", { geometry: d, children: /* @__PURE__ */ t.jsx(
209
+ return /* @__PURE__ */ t.jsx("mesh", { geometry: a, children: /* @__PURE__ */ t.jsx(
209
210
  "meshStandardMaterial",
210
211
  {
211
212
  attach: "material",
@@ -215,39 +216,87 @@ function st({
215
216
  depthWrite: !1,
216
217
  transparent: !0,
217
218
  polygonOffset: !0,
218
- polygonOffsetFactor: -u
219
+ polygonOffsetFactor: -p
220
+ },
221
+ `safety-zone-material-${p}`
222
+ ) }, `safety-zone-mesh-${p}`);
223
+ }, i = F(() => {
224
+ if (!r || r.length === 0)
225
+ return 5;
226
+ const o = r.reduce((a, c) => a + Math.abs(c.a ?? 0) / 1e3 + Math.abs(c.d ?? 0) / 1e3, 0) * 2;
227
+ return !Number.isFinite(o) || o <= 0 ? 5 : o;
228
+ }, [r]), d = (s, p, o) => {
229
+ const a = p.length(), c = new x.Quaternion();
230
+ if (a > 1e-6) {
231
+ const y = p.clone().normalize();
232
+ c.setFromAxisAngle(y, a);
233
+ }
234
+ return /* @__PURE__ */ t.jsxs(
235
+ "mesh",
236
+ {
237
+ renderOrder: o,
238
+ position: s,
239
+ quaternion: c,
240
+ children: [
241
+ /* @__PURE__ */ t.jsx("planeGeometry", { args: [i, i] }),
242
+ /* @__PURE__ */ t.jsx(
243
+ "meshStandardMaterial",
244
+ {
245
+ attach: "material",
246
+ color: "#009f4d",
247
+ opacity: 0.2,
248
+ depthTest: !1,
249
+ depthWrite: !1,
250
+ transparent: !0,
251
+ side: x.DoubleSide,
252
+ polygonOffset: !0,
253
+ polygonOffsetFactor: -o
254
+ },
255
+ `safety-zone-plane-material-${o}`
256
+ )
257
+ ]
219
258
  },
220
- `safety-zone-material-${u}`
221
- ) }, `safety-zone-mesh-${u}`);
222
- }, l = () => Object.values(e ?? {}).map((s, u) => {
223
- let a = [];
224
- Object.keys(s.shape).includes("vertices") && (a = s.shape.vertices);
225
- const d = a.map((m) => new x.Vector3(m[0] / 1e3, m[1] / 1e3, m[2] / 1e3));
226
- return n(d, u);
227
- }), o = () => Array.isArray(e) ? e.map((s, u) => {
228
- let a = [];
229
- return s.geometry && (s.geometry.compound ? a = s.geometry.compound.child_geometries : s.geometry.convex_hull && (a = [s.geometry])), a.map((d, m) => {
230
- if (!d.convex_hull) return null;
231
- const i = d.convex_hull.vertices.map(
232
- (c) => new x.Vector3(c.x / 1e3, c.y / 1e3, c.z / 1e3)
259
+ `safety-zone-plane-${o}`
260
+ );
261
+ }, u = () => Object.values(e ?? {}).map((s, p) => {
262
+ var o, a;
263
+ switch (s.shape.shape_type) {
264
+ case "convex_hull":
265
+ return l(
266
+ s.shape.vertices.map((c) => new x.Vector3(c[0] / 1e3, c[1] / 1e3, c[2] / 1e3)),
267
+ p
268
+ );
269
+ case "plane":
270
+ return ((o = s == null ? void 0 : s.pose) == null ? void 0 : o.position) && ((a = s == null ? void 0 : s.pose) == null ? void 0 : a.orientation) && d(
271
+ new x.Vector3(s.pose.position[0] / 1e3, s.pose.position[1] / 1e3, s.pose.position[2] / 1e3),
272
+ new x.Vector3(s.pose.orientation[0], s.pose.orientation[1], s.pose.orientation[2]),
273
+ p
274
+ );
275
+ }
276
+ }), m = () => Array.isArray(e) ? e.map((s, p) => {
277
+ let o = [];
278
+ return s.geometry && (s.geometry.compound ? o = s.geometry.compound.child_geometries : s.geometry.convex_hull && (o = [s.geometry])), o.map((a, c) => {
279
+ if (!a.convex_hull) return null;
280
+ const y = a.convex_hull.vertices.map(
281
+ (h) => new x.Vector3(h.x / 1e3, h.y / 1e3, h.z / 1e3)
233
282
  );
234
- return n(i, u * 1e3 + m);
283
+ return l(y, p * 1e3 + c);
235
284
  });
236
- }) : null, f = z(() => Array.isArray(e) ? o() : l(), [e, o, l]);
237
- return /* @__PURE__ */ t.jsx("group", { ...r, children: f });
285
+ }) : null, f = F(() => Array.isArray(e) ? m() : u(), [e, m, u]);
286
+ return /* @__PURE__ */ t.jsx("group", { ...n, children: f });
238
287
  }
239
288
  function it({
240
289
  trajectory: e,
241
290
  ...r
242
291
  }) {
243
292
  var l;
244
- const n = ((l = e.trajectory) == null ? void 0 : l.map((o) => o.tcp_pose ? new x.Vector3(
245
- o.tcp_pose.position.x / 1e3,
246
- o.tcp_pose.position.z / 1e3,
247
- -o.tcp_pose.position.y / 1e3
248
- ) : null).filter((o) => o !== null)) || [];
293
+ const n = ((l = e.trajectory) == null ? void 0 : l.map((i) => i.tcp_pose ? new x.Vector3(
294
+ i.tcp_pose.position.x / 1e3,
295
+ i.tcp_pose.position.z / 1e3,
296
+ -i.tcp_pose.position.y / 1e3
297
+ ) : null).filter((i) => i !== null)) || [];
249
298
  return /* @__PURE__ */ t.jsx("group", { ...r, children: n.length > 0 && /* @__PURE__ */ t.jsx(
250
- J,
299
+ z,
251
300
  {
252
301
  points: n,
253
302
  lineWidth: 3,
@@ -257,25 +306,25 @@ function it({
257
306
  }
258
307
  ) });
259
308
  }
260
- const U = /* @__PURE__ */ new Map();
261
- async function D(e, r) {
262
- if (U.has(e))
263
- return U.get(e);
309
+ const E = /* @__PURE__ */ new Map();
310
+ async function C(e, r) {
311
+ if (E.has(e))
312
+ return E.get(e);
264
313
  const n = (async () => {
265
- var s;
266
- const l = r || "", o = new Se({ instanceUrl: l }), f = o.api.motionGroupModels;
267
- (s = f.axios) != null && s.interceptors && f.axios.interceptors.request.use((u) => {
268
- var a;
269
- return (a = u.url) != null && a.includes("/glb") && (u.responseType = "blob"), u;
314
+ var u;
315
+ const l = r || "", i = new Le({ instanceUrl: l }), d = i.api.motionGroupModels;
316
+ (u = d.axios) != null && u.interceptors && d.axios.interceptors.request.use((m) => {
317
+ var f;
318
+ return (f = m.url) != null && f.includes("/glb") && (m.responseType = "blob"), m;
270
319
  });
271
320
  try {
272
- const u = await o.api.motionGroupModels.getMotionGroupGlbModel(e);
273
- return URL.createObjectURL(u);
274
- } catch (u) {
275
- throw console.error("Failed to fetch model:", u), u;
321
+ const m = await i.api.motionGroupModels.getMotionGroupGlbModel(e);
322
+ return URL.createObjectURL(m);
323
+ } catch (m) {
324
+ throw console.error("Failed to fetch model:", m), m;
276
325
  }
277
326
  })();
278
- return U.set(e, n), n;
327
+ return E.set(e, n), n;
279
328
  }
280
329
  function ue(e) {
281
330
  function r(n) {
@@ -289,17 +338,17 @@ function fe(e) {
289
338
  function de(e) {
290
339
  return /_J[0-9]+$/.test(e.name);
291
340
  }
292
- function Ce(e, r) {
341
+ function Oe(e, r) {
293
342
  let n;
294
- function l(o) {
295
- if (fe(o)) {
343
+ function l(i) {
344
+ if (fe(i)) {
296
345
  if (n)
297
346
  throw Error(
298
- `Found multiple flange groups in robot model ${r}; first ${n.name} then ${o.name}. Only one _FLG group is allowed.`
347
+ `Found multiple flange groups in robot model ${r}; first ${n.name} then ${i.name}. Only one _FLG group is allowed.`
299
348
  );
300
- n = o;
349
+ n = i;
301
350
  }
302
- de(o), o.children.map(l);
351
+ de(i), i.children.map(l);
303
352
  }
304
353
  if (l(e.scene), !n)
305
354
  throw Error(
@@ -307,121 +356,121 @@ function Ce(e, r) {
307
356
  );
308
357
  return { gltf: e };
309
358
  }
310
- function me({
359
+ function pe({
311
360
  rapidlyChangingMotionState: e,
312
361
  dhParameters: r,
313
362
  onRotationChanged: n,
314
363
  children: l
315
364
  }) {
316
- const o = R([]), f = R([]), s = R(null), { invalidate: u } = se();
317
- v(() => {
318
- const i = e.joint_position.filter(
319
- (c) => c !== void 0
365
+ const i = R([]), d = R([]), u = R(null), { invalidate: m } = se();
366
+ M(() => {
367
+ const o = e.joint_position.filter(
368
+ (a) => a !== void 0
320
369
  );
321
- return s.current = new ae(i, {
370
+ return u.current = new ae(o, {
322
371
  tension: 120,
323
372
  // Controls spring stiffness - higher values create faster, more responsive motion
324
373
  friction: 20,
325
374
  // Controls damping - higher values reduce oscillation and create smoother settling
326
375
  threshold: 1e-3
327
376
  }), () => {
328
- var c;
329
- (c = s.current) == null || c.destroy();
377
+ var a;
378
+ (a = u.current) == null || a.destroy();
330
379
  };
331
- }, []), ie((i, c) => {
332
- if (s.current) {
333
- const h = s.current.update(c);
334
- d(), h || u();
380
+ }, []), ie((o, a) => {
381
+ if (u.current) {
382
+ const c = u.current.update(a);
383
+ s(), c || m();
335
384
  }
336
385
  });
337
- function a(i) {
338
- i && (f.current = ue(i), d(), u());
386
+ function f(o) {
387
+ o && (d.current = ue(o), s(), m());
339
388
  }
340
- function d() {
341
- var c;
342
- const i = ((c = s.current) == null ? void 0 : c.getCurrentValues()) || [];
389
+ function s() {
390
+ var a;
391
+ const o = ((a = u.current) == null ? void 0 : a.getCurrentValues()) || [];
343
392
  if (n)
344
- n(f.current, i);
393
+ n(d.current, o);
345
394
  else
346
- for (const [h, y] of f.current.entries()) {
347
- const p = r[h], j = p.theta || 0, g = p.reverse_rotation_direction ? -1 : 1;
348
- y.rotation.y = g * (i[h] || 0) + j;
395
+ for (const [c, y] of d.current.entries()) {
396
+ const h = r[c], j = h.theta || 0, g = h.reverse_rotation_direction ? -1 : 1;
397
+ y.rotation.y = g * (o[c] || 0) + j;
349
398
  }
350
399
  }
351
- const m = V(() => {
352
- const i = e.joint_position.filter(
353
- (c) => c !== void 0
400
+ const p = T(() => {
401
+ const o = e.joint_position.filter(
402
+ (a) => a !== void 0
354
403
  );
355
404
  requestAnimationFrame(() => {
356
- var c;
357
- o.current = i, (c = s.current) == null || c.setTarget(i);
405
+ var a;
406
+ i.current = o, (a = u.current) == null || a.setTarget(o);
358
407
  });
359
408
  }, [e]);
360
- return v(() => {
361
- m();
362
- }, [e, m]), le(() => {
363
- m();
364
- }), /* @__PURE__ */ t.jsx("group", { ref: a, children: l });
409
+ return M(() => {
410
+ p();
411
+ }, [e, p]), le(() => {
412
+ p();
413
+ }), /* @__PURE__ */ t.jsx("group", { ref: f, children: l });
365
414
  }
366
- const De = "line", Oe = "mesh";
367
- function Ue({
415
+ const Ce = "line", Ue = "mesh";
416
+ function Ee({
368
417
  rapidlyChangingMotionState: e,
369
418
  dhParameters: r,
370
419
  ...n
371
420
  }) {
372
- const l = new w(), o = R([]), f = R([]);
373
- Me.useEffect(() => {
374
- o.current = new Array(r.length).fill(null), f.current = new Array(r.length).fill(null);
421
+ const l = new w(), i = R([]), d = R([]);
422
+ ve.useEffect(() => {
423
+ i.current = new Array(r.length).fill(null), d.current = new Array(r.length).fill(null);
375
424
  }, [r.length]);
376
- function s(d, m) {
377
- const i = new T(), c = new E(), h = new T();
378
- l.decompose(i, c, h);
379
- const y = i.clone(), p = new w().makeRotationY(
380
- d.theta + m * (d.reverse_rotation_direction ? -1 : 1)
381
- ).multiply(new w().makeTranslation(0, d.d / 1e3, 0)).multiply(new w().makeTranslation(d.a / 1e3, 0, 0)).multiply(new w().makeRotationX(d.alpha));
382
- return l.multiply(p), l.decompose(i, c, h), { a: y, b: i };
425
+ function u(s, p) {
426
+ const o = new V(), a = new J(), c = new V();
427
+ l.decompose(o, a, c);
428
+ const y = o.clone(), h = new w().makeRotationY(
429
+ s.theta + p * (s.reverse_rotation_direction ? -1 : 1)
430
+ ).multiply(new w().makeTranslation(0, s.d / 1e3, 0)).multiply(new w().makeTranslation(s.a / 1e3, 0, 0)).multiply(new w().makeRotationX(s.alpha));
431
+ return l.multiply(h), l.decompose(o, a, c), { a: y, b: o };
383
432
  }
384
- function u(d, m, i, c) {
433
+ function m(s, p, o, a) {
385
434
  if (!r)
386
435
  return;
387
- const h = r[d];
388
- if (!h)
436
+ const c = r[s];
437
+ if (!c)
389
438
  return;
390
- const { a: y, b: p } = s(h, c);
391
- m.geometry.setPositions([y.toArray(), p.toArray()].flat()), i.position.set(p.x, p.y, p.z);
439
+ const { a: y, b: h } = u(c, a);
440
+ p.geometry.setPositions([y.toArray(), h.toArray()].flat()), o.position.set(h.x, h.y, h.z);
392
441
  }
393
- function a(d, m) {
442
+ function f(s, p) {
394
443
  l.identity();
395
- for (let i = 0; i < Math.min(d.length, m.length); i++) {
396
- const c = o.current[i], h = f.current[i];
397
- c && h && u(i, c, h, m[i]);
444
+ for (let o = 0; o < Math.min(s.length, p.length); o++) {
445
+ const a = i.current[o], c = d.current[o];
446
+ a && c && m(o, a, c, p[o]);
398
447
  }
399
448
  }
400
449
  return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
401
- me,
450
+ pe,
402
451
  {
403
452
  rapidlyChangingMotionState: e,
404
453
  dhParameters: r,
405
- onRotationChanged: a,
454
+ onRotationChanged: f,
406
455
  children: /* @__PURE__ */ t.jsxs("group", { ...n, name: "Scene", children: [
407
456
  /* @__PURE__ */ t.jsxs("mesh", { children: [
408
457
  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
409
458
  /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
410
459
  ] }),
411
- r.map((d, m) => {
412
- const { a: i, b: c } = s(
413
- d,
414
- e.joint_position[m] ?? 0
415
- ), h = `dhrobot_J0${m}`;
416
- return /* @__PURE__ */ t.jsxs("group", { name: h, children: [
460
+ r.map((s, p) => {
461
+ const { a: o, b: a } = u(
462
+ s,
463
+ e.joint_position[p] ?? 0
464
+ ), c = `dhrobot_J0${p}`;
465
+ return /* @__PURE__ */ t.jsxs("group", { name: c, children: [
417
466
  /* @__PURE__ */ t.jsx(
418
- J,
467
+ z,
419
468
  {
420
469
  ref: (y) => {
421
- o.current[m] = y;
470
+ i.current[p] = y;
422
471
  },
423
- name: De,
424
- points: [i, c],
472
+ name: Ce,
473
+ points: [o, a],
425
474
  color: "white",
426
475
  lineWidth: 5
427
476
  }
@@ -430,32 +479,32 @@ function Ue({
430
479
  "mesh",
431
480
  {
432
481
  ref: (y) => {
433
- f.current[m] = y;
482
+ d.current[p] = y;
434
483
  },
435
- name: Oe,
436
- position: c,
484
+ name: Ue,
485
+ position: a,
437
486
  children: [
438
487
  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
439
488
  /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
440
489
  ]
441
490
  },
442
- "mesh_" + m
491
+ "mesh_" + p
443
492
  )
444
- ] }, h);
493
+ ] }, c);
445
494
  })
446
495
  ] })
447
496
  }
448
497
  ) });
449
498
  }
450
- const Ee = console.warn;
451
- function he() {
452
- return v(() => {
499
+ const Je = console.warn;
500
+ function me() {
501
+ return M(() => {
453
502
  console.warn = (e) => {
454
- e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Ee(e);
503
+ e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Je(e);
455
504
  };
456
505
  }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
457
506
  }
458
- function Je(e) {
507
+ function ze(e) {
459
508
  return e.type === "Mesh";
460
509
  }
461
510
  function Be({
@@ -464,72 +513,72 @@ function Be({
464
513
  postModelRender: n,
465
514
  ...l
466
515
  }) {
467
- const o = Ve(e);
468
- let f;
516
+ const i = Te(e);
517
+ let d;
469
518
  try {
470
- f = Ce(o, "robot.glb").gltf;
471
- } catch (a) {
472
- throw a;
519
+ d = Oe(i, "robot.glb").gltf;
520
+ } catch (f) {
521
+ throw f;
473
522
  }
474
- const s = V(
475
- (a) => {
476
- a && n && n();
523
+ const u = T(
524
+ (f) => {
525
+ f && n && n();
477
526
  },
478
527
  [n]
479
528
  );
480
- function u(a) {
529
+ function m(f) {
481
530
  try {
482
- return Je(a) ? a.geometry ? /* @__PURE__ */ t.jsx(
531
+ return ze(f) ? f.geometry ? /* @__PURE__ */ t.jsx(
483
532
  "mesh",
484
533
  {
485
- name: a.name,
486
- geometry: a.geometry,
487
- material: a.material,
488
- position: a.position,
489
- rotation: a.rotation
534
+ name: f.name,
535
+ geometry: f.geometry,
536
+ material: f.material,
537
+ position: f.position,
538
+ rotation: f.rotation
490
539
  },
491
- a.uuid
492
- ) : /* @__PURE__ */ t.jsx("group", { name: a.name, position: a.position, rotation: a.rotation }, a.uuid) : /* @__PURE__ */ t.jsx(
540
+ f.uuid
541
+ ) : /* @__PURE__ */ t.jsx("group", { name: f.name, position: f.position, rotation: f.rotation }, f.uuid) : /* @__PURE__ */ t.jsx(
493
542
  "group",
494
543
  {
495
- name: a.name,
496
- position: a.position,
497
- rotation: a.rotation,
498
- ref: fe(a) ? r : void 0,
499
- children: a.children.map(u)
544
+ name: f.name,
545
+ position: f.position,
546
+ rotation: f.rotation,
547
+ ref: fe(f) ? r : void 0,
548
+ children: f.children.map(m)
500
549
  },
501
- a.uuid
550
+ f.uuid
502
551
  );
503
- } catch (d) {
504
- return console.warn("Error rendering node", a.name, d), null;
552
+ } catch (s) {
553
+ return console.warn("Error rendering node", f.name, s), null;
505
554
  }
506
555
  }
507
- return /* @__PURE__ */ t.jsx("group", { ...l, dispose: null, ref: s, children: u(f.scene) });
556
+ return /* @__PURE__ */ t.jsx("group", { ...l, dispose: null, ref: u, children: m(d.scene) });
508
557
  }
509
- function pe({
558
+ function he({
510
559
  modelURL: e,
511
560
  flangeRef: r,
512
561
  postModelRender: n,
513
562
  ...l
514
563
  }) {
515
- const [o, f] = A(null);
516
- return v(() => {
564
+ const [i, d] = S(null);
565
+ return M(() => {
517
566
  (async () => {
518
567
  try {
519
568
  if (typeof e == "string")
520
- f(e);
569
+ d(e);
521
570
  else {
522
- const u = await e;
523
- f(u);
571
+ const m = await e;
572
+ d(m);
524
573
  }
525
- } catch (u) {
526
- console.error("Failed to resolve model URL:", u);
574
+ } catch (m) {
575
+ console.error("Failed to resolve model URL:", m);
527
576
  }
528
577
  })();
529
- }, [e]), o ? /* @__PURE__ */ t.jsx(
578
+ }, [e]), i ? /* @__PURE__ */ t.jsx(
530
579
  Be,
531
580
  {
532
- url: o,
581
+ url: i,
533
582
  flangeRef: r,
534
583
  postModelRender: n,
535
584
  ...l
@@ -540,7 +589,7 @@ const xe = (e, r) => {
540
589
  e.userData.isGhost || (e.traverse((n) => {
541
590
  if (n instanceof x.Mesh) {
542
591
  n.material instanceof x.Material && (n.material.colorWrite = !1);
543
- const l = n.clone(), o = n.clone();
592
+ const l = n.clone(), i = n.clone();
544
593
  l.material = new x.MeshStandardMaterial({
545
594
  depthTest: !0,
546
595
  depthWrite: !0,
@@ -548,7 +597,7 @@ const xe = (e, r) => {
548
597
  polygonOffset: !0,
549
598
  polygonOffsetFactor: -1,
550
599
  side: x.DoubleSide
551
- }), l.userData.isGhost = !0, o.material = new x.MeshStandardMaterial({
600
+ }), l.userData.isGhost = !0, i.material = new x.MeshStandardMaterial({
552
601
  color: r,
553
602
  opacity: 0.3,
554
603
  depthTest: !0,
@@ -557,7 +606,7 @@ const xe = (e, r) => {
557
606
  polygonOffset: !0,
558
607
  polygonOffsetFactor: -2,
559
608
  side: x.DoubleSide
560
- }), o.userData.isGhost = !0, n.parent && (n.parent.add(l), n.parent.add(o));
609
+ }), i.userData.isGhost = !0, n.parent && (n.parent.add(l), n.parent.add(i));
561
610
  }
562
611
  }), e.userData.isGhost = !0);
563
612
  }, ye = (e) => {
@@ -569,64 +618,64 @@ const xe = (e, r) => {
569
618
  }), r.forEach((n) => {
570
619
  n.parent && n.parent.remove(n);
571
620
  }), e.userData.isGhost = !1;
572
- }, ge = C(
621
+ }, ge = O(
573
622
  ({
574
623
  rapidlyChangingMotionState: e,
575
624
  modelFromController: r,
576
625
  dhParameters: n,
577
- getModel: l = D,
578
- flangeRef: o,
579
- postModelRender: f,
580
- transparentColor: s,
581
- instanceUrl: u,
582
- ...a
626
+ getModel: l = C,
627
+ flangeRef: i,
628
+ postModelRender: d,
629
+ transparentColor: u,
630
+ instanceUrl: m,
631
+ ...f
583
632
  }) => {
584
- const [d, m] = A(null), i = V((h) => {
585
- m(h);
633
+ const [s, p] = S(null), o = T((c) => {
634
+ p(c);
586
635
  }, []);
587
- v(() => {
588
- d && (s ? xe(d, s) : ye(d));
589
- }, [d, s]);
590
- const c = /* @__PURE__ */ t.jsx(
591
- Ue,
636
+ M(() => {
637
+ s && (u ? xe(s, u) : ye(s));
638
+ }, [s, u]);
639
+ const a = /* @__PURE__ */ t.jsx(
640
+ Ee,
592
641
  {
593
642
  rapidlyChangingMotionState: e,
594
643
  dhParameters: n,
595
- ...a
644
+ ...f
596
645
  }
597
646
  );
598
647
  return /* @__PURE__ */ t.jsxs(
599
648
  ce,
600
649
  {
601
- fallback: c,
602
- onError: (h) => {
603
- console.warn(h);
650
+ fallback: a,
651
+ onError: (c) => {
652
+ console.warn(c);
604
653
  },
605
654
  children: [
606
- /* @__PURE__ */ t.jsx(oe, { fallback: c, children: /* @__PURE__ */ t.jsx("group", { ref: i, children: /* @__PURE__ */ t.jsx(
607
- me,
655
+ /* @__PURE__ */ t.jsx(oe, { fallback: a, children: /* @__PURE__ */ t.jsx("group", { ref: o, children: /* @__PURE__ */ t.jsx(
656
+ pe,
608
657
  {
609
658
  rapidlyChangingMotionState: e,
610
659
  dhParameters: n,
611
660
  children: /* @__PURE__ */ t.jsx(
612
- pe,
661
+ he,
613
662
  {
614
663
  modelURL: (() => {
615
- const h = l(r, u);
616
- if (!h) {
617
- const y = new Blob([], { type: "model/gltf-binary" }), p = new File([y], `${r}.glb`, { type: "model/gltf-binary" });
618
- return Promise.resolve(URL.createObjectURL(p));
664
+ const c = l(r, m);
665
+ if (!c) {
666
+ const y = new Blob([], { type: "model/gltf-binary" }), h = new File([y], `${r}.glb`, { type: "model/gltf-binary" });
667
+ return Promise.resolve(URL.createObjectURL(h));
619
668
  }
620
- return h;
669
+ return c;
621
670
  })(),
622
- postModelRender: f,
623
- flangeRef: o,
624
- ...a
671
+ postModelRender: d,
672
+ flangeRef: i,
673
+ ...f
625
674
  }
626
675
  )
627
676
  }
628
677
  ) }) }),
629
- /* @__PURE__ */ t.jsx(he, {})
678
+ /* @__PURE__ */ t.jsx(me, {})
630
679
  ]
631
680
  }
632
681
  );
@@ -634,11 +683,11 @@ const xe = (e, r) => {
634
683
  );
635
684
  function We({
636
685
  connectedMotionGroup: e,
637
- getModel: r = D,
686
+ getModel: r = C,
638
687
  flangeRef: n,
639
688
  transparentColor: l,
640
- postModelRender: o,
641
- ...f
689
+ postModelRender: i,
690
+ ...d
642
691
  }) {
643
692
  return e.dhParameters ? /* @__PURE__ */ t.jsx(
644
693
  ge,
@@ -649,55 +698,55 @@ function We({
649
698
  getModel: r,
650
699
  flangeRef: n,
651
700
  transparentColor: l,
652
- postModelRender: o,
653
- ...f
701
+ postModelRender: i,
702
+ ...d
654
703
  }
655
704
  ) : null;
656
705
  }
657
- const at = C(
658
- Le(
706
+ const at = O(
707
+ Ae(
659
708
  ({
660
709
  robotName: e,
661
710
  programState: r,
662
711
  safetyState: n,
663
712
  operationMode: l,
664
- driveToHomeEnabled: o = !1,
665
- onDriveToHomePress: f,
666
- onDriveToHomeRelease: s,
667
- connectedMotionGroup: u,
668
- robotComponent: a = We,
669
- customContentComponent: d,
670
- className: m
713
+ driveToHomeEnabled: i = !1,
714
+ onDriveToHomePress: d,
715
+ onDriveToHomeRelease: u,
716
+ connectedMotionGroup: m,
717
+ robotComponent: f = We,
718
+ customContentComponent: s,
719
+ className: p
671
720
  }) => {
672
721
  var $;
673
- const i = Te(), { t: c } = Ge(), [h, y] = A(!1), p = R(null), j = R(null), [g, O] = A(!1), [G, Re] = A({ width: 400, height: 600 }), [He, ve] = A(0);
674
- v(() => {
675
- const P = () => {
722
+ const o = Ve(), { t: a } = Fe(), [c, y] = S(!1), h = R(null), j = R(null), [g, U] = S(!1), [L, Re] = S({ width: 400, height: 600 }), [He, Me] = S(0);
723
+ M(() => {
724
+ const I = () => {
676
725
  if (j.current) {
677
- const { offsetWidth: N, offsetHeight: Y } = j.current;
678
- O(N > Y), Re({ width: N, height: Y });
726
+ const { offsetWidth: N, offsetHeight: q } = j.current;
727
+ U(N > q), Re({ width: N, height: q });
679
728
  }
680
729
  };
681
- P();
682
- const H = new ResizeObserver(P);
730
+ I();
731
+ const H = new ResizeObserver(I);
683
732
  return j.current && H.observe(j.current), () => {
684
733
  H.disconnect();
685
734
  };
686
735
  }, []);
687
- const B = V(() => {
688
- ve((P) => P + 1);
689
- }, []), S = V(() => {
690
- !o || !f || (y(!0), f());
691
- }, [o, f]), k = V(() => {
692
- !o || !s || (y(!1), s());
693
- }, [o, s]), W = V(() => {
694
- h && s && (y(!1), s());
695
- }, [h, s]), _ = g ? G.width < 350 : G.height < 200, F = g ? G.height < 310 : G.height < 450;
736
+ const B = T(() => {
737
+ Me((I) => I + 1);
738
+ }, []), G = T(() => {
739
+ !i || !d || (y(!0), d());
740
+ }, [i, d]), P = T(() => {
741
+ !i || !u || (y(!1), u());
742
+ }, [i, u]), W = T(() => {
743
+ c && u && (y(!1), u());
744
+ }, [c, u]), _ = g ? L.width < 350 : L.height < 200, k = g ? L.height < 310 : L.height < 450;
696
745
  return /* @__PURE__ */ t.jsx(
697
- Ae,
746
+ Se,
698
747
  {
699
748
  ref: j,
700
- className: m,
749
+ className: p,
701
750
  sx: {
702
751
  width: "100%",
703
752
  height: "100%",
@@ -708,10 +757,10 @@ const at = C(
708
757
  minWidth: { xs: 180, sm: 220, md: 250 },
709
758
  minHeight: g ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
710
759
  // Allow progressive hiding in portrait mode
711
- border: `1px solid ${i.palette.divider}`,
760
+ border: `1px solid ${o.palette.divider}`,
712
761
  borderRadius: "18px",
713
762
  boxShadow: "none",
714
- backgroundColor: (($ = i.palette.backgroundPaperElevation) == null ? void 0 : $[8]) || "#2A2A3F",
763
+ backgroundColor: (($ = o.palette.backgroundPaperElevation) == null ? void 0 : $[8]) || "#2A2A3F",
715
764
  backgroundImage: "none"
716
765
  // Override any gradient from elevation
717
766
  },
@@ -733,7 +782,7 @@ const at = C(
733
782
  display: _ ? "none" : "block"
734
783
  },
735
784
  children: !_ && /* @__PURE__ */ t.jsxs(
736
- q,
785
+ Y,
737
786
  {
738
787
  orthographic: !0,
739
788
  camera: {
@@ -743,7 +792,7 @@ const at = C(
743
792
  shadows: !0,
744
793
  frameloop: "demand",
745
794
  style: {
746
- borderRadius: i.shape.borderRadius,
795
+ borderRadius: o.shape.borderRadius,
747
796
  width: "100%",
748
797
  height: "100%",
749
798
  background: "transparent",
@@ -756,9 +805,9 @@ const at = C(
756
805
  children: [
757
806
  /* @__PURE__ */ t.jsx(te, {}),
758
807
  /* @__PURE__ */ t.jsx(X, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
759
- a,
808
+ f,
760
809
  {
761
- connectedMotionGroup: u,
810
+ connectedMotionGroup: m,
762
811
  postModelRender: B
763
812
  }
764
813
  ) })
@@ -811,15 +860,15 @@ const at = C(
811
860
  justifyContent: "space-between"
812
861
  },
813
862
  children: [
814
- !F && d && /* @__PURE__ */ t.jsxs(b, { children: [
815
- /* @__PURE__ */ t.jsx(d, {}),
863
+ !k && s && /* @__PURE__ */ t.jsxs(b, { children: [
864
+ /* @__PURE__ */ t.jsx(s, {}),
816
865
  /* @__PURE__ */ t.jsx(
817
866
  Q,
818
867
  {
819
868
  sx: {
820
869
  mt: 1,
821
870
  mb: 0,
822
- borderColor: i.palette.divider,
871
+ borderColor: o.palette.divider,
823
872
  opacity: 0.5
824
873
  }
825
874
  }
@@ -829,7 +878,7 @@ const at = C(
829
878
  b,
830
879
  {
831
880
  sx: {
832
- mt: !F && d ? "auto" : 0
881
+ mt: !k && s ? "auto" : 0
833
882
  },
834
883
  children: /* @__PURE__ */ t.jsx(
835
884
  b,
@@ -843,22 +892,22 @@ const at = C(
843
892
  children: /* @__PURE__ */ t.jsx(
844
893
  Z,
845
894
  {
846
- ref: p,
895
+ ref: h,
847
896
  variant: "contained",
848
897
  color: "secondary",
849
898
  size: "small",
850
- disabled: !o,
851
- onMouseDown: S,
852
- onMouseUp: k,
899
+ disabled: !i,
900
+ onMouseDown: G,
901
+ onMouseUp: P,
853
902
  onMouseLeave: W,
854
- onTouchStart: S,
855
- onTouchEnd: k,
903
+ onTouchStart: G,
904
+ onTouchEnd: P,
856
905
  sx: {
857
906
  textTransform: "none",
858
907
  px: 1.5,
859
908
  py: 0.5
860
909
  },
861
- children: c("RobotCard.DriveToHome.bt")
910
+ children: a("RobotCard.DriveToHome.bt")
862
911
  }
863
912
  )
864
913
  }
@@ -905,7 +954,7 @@ const at = C(
905
954
  display: _ ? "none" : "block"
906
955
  },
907
956
  children: !_ && /* @__PURE__ */ t.jsxs(
908
- q,
957
+ Y,
909
958
  {
910
959
  orthographic: !0,
911
960
  camera: {
@@ -915,7 +964,7 @@ const at = C(
915
964
  shadows: !0,
916
965
  frameloop: "demand",
917
966
  style: {
918
- borderRadius: i.shape.borderRadius,
967
+ borderRadius: o.shape.borderRadius,
919
968
  width: "100%",
920
969
  height: "100%",
921
970
  background: "transparent",
@@ -926,9 +975,9 @@ const at = C(
926
975
  children: [
927
976
  /* @__PURE__ */ t.jsx(te, {}),
928
977
  /* @__PURE__ */ t.jsx(X, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
929
- a,
978
+ f,
930
979
  {
931
- connectedMotionGroup: u,
980
+ connectedMotionGroup: m,
932
981
  postModelRender: B
933
982
  }
934
983
  ) })
@@ -938,15 +987,15 @@ const at = C(
938
987
  }
939
988
  ),
940
989
  /* @__PURE__ */ t.jsxs(b, { children: [
941
- !F && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
942
- /* @__PURE__ */ t.jsx(d, {}),
990
+ !k && s && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
991
+ /* @__PURE__ */ t.jsx(s, {}),
943
992
  /* @__PURE__ */ t.jsx(
944
993
  Q,
945
994
  {
946
995
  sx: {
947
996
  mt: 1,
948
997
  mb: 0,
949
- borderColor: i.palette.divider,
998
+ borderColor: o.palette.divider,
950
999
  opacity: 0.5
951
1000
  }
952
1001
  }
@@ -958,28 +1007,28 @@ const at = C(
958
1007
  sx: {
959
1008
  display: "flex",
960
1009
  justifyContent: "flex-start",
961
- mt: !F && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
1010
+ mt: !k && s ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
962
1011
  mb: { xs: 0.5, sm: 0.75, md: 1 }
963
1012
  },
964
1013
  children: /* @__PURE__ */ t.jsx(
965
1014
  Z,
966
1015
  {
967
- ref: p,
1016
+ ref: h,
968
1017
  variant: "contained",
969
1018
  color: "secondary",
970
1019
  size: "small",
971
- disabled: !o,
972
- onMouseDown: S,
973
- onMouseUp: k,
1020
+ disabled: !i,
1021
+ onMouseDown: G,
1022
+ onMouseUp: P,
974
1023
  onMouseLeave: W,
975
- onTouchStart: S,
976
- onTouchEnd: k,
1024
+ onTouchStart: G,
1025
+ onTouchEnd: P,
977
1026
  sx: {
978
1027
  textTransform: "none",
979
1028
  px: 1.5,
980
1029
  py: 0.5
981
1030
  },
982
- children: c("RobotCard.DriveToHome.bt")
1031
+ children: a("RobotCard.DriveToHome.bt")
983
1032
  }
984
1033
  )
985
1034
  }
@@ -999,95 +1048,95 @@ function je({
999
1048
  onTranslationChanged: n,
1000
1049
  children: l
1001
1050
  }) {
1002
- const o = R([]), f = R([]), s = R(null), { invalidate: u } = se();
1003
- v(() => {
1004
- const i = e.joint_position.filter(
1005
- (c) => c !== void 0
1051
+ const i = R([]), d = R([]), u = R(null), { invalidate: m } = se();
1052
+ M(() => {
1053
+ const o = e.joint_position.filter(
1054
+ (a) => a !== void 0
1006
1055
  );
1007
- return s.current = new ae(i, {
1056
+ return u.current = new ae(o, {
1008
1057
  tension: 120,
1009
1058
  // Controls spring stiffness - higher values create faster, more responsive motion
1010
1059
  friction: 20,
1011
1060
  // Controls damping - higher values reduce oscillation and create smoother settling
1012
1061
  threshold: 1e-3
1013
1062
  }), () => {
1014
- var c;
1015
- (c = s.current) == null || c.destroy();
1063
+ var a;
1064
+ (a = u.current) == null || a.destroy();
1016
1065
  };
1017
- }, []), ie((i, c) => {
1018
- if (s.current) {
1019
- const h = s.current.update(c);
1020
- d(), h || u();
1066
+ }, []), ie((o, a) => {
1067
+ if (u.current) {
1068
+ const c = u.current.update(a);
1069
+ s(), c || m();
1021
1070
  }
1022
1071
  });
1023
- function a(i) {
1024
- i && (f.current = ue(i), d(), u());
1072
+ function f(o) {
1073
+ o && (d.current = ue(o), s(), m());
1025
1074
  }
1026
- function d() {
1027
- var c;
1028
- const i = ((c = s.current) == null ? void 0 : c.getCurrentValues()) || [];
1075
+ function s() {
1076
+ var a;
1077
+ const o = ((a = u.current) == null ? void 0 : a.getCurrentValues()) || [];
1029
1078
  if (n)
1030
- n(f.current, i);
1079
+ n(d.current, o);
1031
1080
  else
1032
- for (const [h, y] of f.current.entries()) {
1033
- const j = r[h].reverse_rotation_direction ? -1 : 1;
1034
- y.position.y = j * (i[h] || 0) / 1e3;
1081
+ for (const [c, y] of d.current.entries()) {
1082
+ const j = r[c].reverse_rotation_direction ? -1 : 1;
1083
+ y.position.y = j * (o[c] || 0) / 1e3;
1035
1084
  }
1036
1085
  }
1037
- const m = V(() => {
1038
- const i = e.joint_position.filter(
1039
- (c) => c !== void 0
1086
+ const p = T(() => {
1087
+ const o = e.joint_position.filter(
1088
+ (a) => a !== void 0
1040
1089
  );
1041
1090
  requestAnimationFrame(() => {
1042
- var c;
1043
- o.current = i, (c = s.current) == null || c.setTarget(i);
1091
+ var a;
1092
+ i.current = o, (a = u.current) == null || a.setTarget(o);
1044
1093
  });
1045
1094
  }, [e]);
1046
- return v(() => {
1047
- m();
1048
- }, [e, m]), le(() => {
1049
- m();
1050
- }), /* @__PURE__ */ t.jsx("group", { ref: a, children: l });
1095
+ return M(() => {
1096
+ p();
1097
+ }, [e, p]), le(() => {
1098
+ p();
1099
+ }), /* @__PURE__ */ t.jsx("group", { ref: f, children: l });
1051
1100
  }
1052
1101
  function we({
1053
1102
  rapidlyChangingMotionState: e,
1054
1103
  dhParameters: r,
1055
1104
  ...n
1056
1105
  }) {
1057
- const l = new w(), o = R(null), f = R(null);
1058
- function s(d) {
1059
- const m = new w();
1106
+ const l = new w(), i = R(null), d = R(null);
1107
+ function u(s) {
1108
+ const p = new w();
1060
1109
  for (let y = 0; y < r.length; y++) {
1061
- const p = r[y], j = d[y] ?? 0, g = new w().makeRotationY(p.theta).multiply(
1110
+ const h = r[y], j = s[y] ?? 0, g = new w().makeRotationY(h.theta).multiply(
1062
1111
  new w().makeTranslation(
1063
- p.a / 1e3,
1064
- (p.d + j * (p.reverse_rotation_direction ? -1 : 1)) / 1e3,
1112
+ h.a / 1e3,
1113
+ (h.d + j * (h.reverse_rotation_direction ? -1 : 1)) / 1e3,
1065
1114
  0
1066
1115
  )
1067
- ).multiply(new w().makeRotationX(p.alpha));
1068
- m.multiply(g);
1116
+ ).multiply(new w().makeRotationX(h.alpha));
1117
+ p.multiply(g);
1069
1118
  }
1070
- const i = new T(), c = new E(), h = new T();
1071
- return m.decompose(i, c, h), i;
1119
+ const o = new V(), a = new J(), c = new V();
1120
+ return p.decompose(o, a, c), o;
1072
1121
  }
1073
- const u = s(e.joint_position);
1074
- function a(d, m) {
1122
+ const m = u(e.joint_position);
1123
+ function f(s, p) {
1075
1124
  l.identity();
1076
- let i = new T();
1077
- for (let p = 0; p < r.length; p++) {
1078
- const j = m[p] ?? 0, g = r[p], O = new w().makeRotationY(g.theta).multiply(
1125
+ let o = new V();
1126
+ for (let h = 0; h < r.length; h++) {
1127
+ const j = p[h] ?? 0, g = r[h], U = new w().makeRotationY(g.theta).multiply(
1079
1128
  new w().makeTranslation(
1080
1129
  g.a / 1e3,
1081
1130
  (g.d + j * (g.reverse_rotation_direction ? -1 : 1)) / 1e3,
1082
1131
  0
1083
1132
  )
1084
1133
  ).multiply(new w().makeRotationX(g.alpha));
1085
- l.multiply(O);
1134
+ l.multiply(U);
1086
1135
  }
1087
- const c = new T(), h = new E(), y = new T();
1088
- if (l.decompose(c, h, y), i = c, o.current && o.current.position.set(i.x, i.y, i.z), f.current) {
1089
- const p = f.current.geometry;
1090
- p && p.setPositions && p.setPositions([0, 0, 0, i.x, i.y, i.z]);
1136
+ const a = new V(), c = new J(), y = new V();
1137
+ if (l.decompose(a, c, y), o = a, i.current && i.current.position.set(o.x, o.y, o.z), d.current) {
1138
+ const h = d.current.geometry;
1139
+ h && h.setPositions && h.setPositions([0, 0, 0, o.x, o.y, o.z]);
1091
1140
  }
1092
1141
  }
1093
1142
  return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
@@ -1095,22 +1144,22 @@ function we({
1095
1144
  {
1096
1145
  rapidlyChangingMotionState: e,
1097
1146
  dhParameters: r,
1098
- onTranslationChanged: a,
1147
+ onTranslationChanged: f,
1099
1148
  children: /* @__PURE__ */ t.jsxs("group", { ...n, name: "Scene", children: [
1100
1149
  /* @__PURE__ */ t.jsxs("mesh", { name: "Base", position: [0, 0, 0], children: [
1101
1150
  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.02, 32, 32] }),
1102
1151
  /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "green", depthTest: !0 })
1103
1152
  ] }),
1104
1153
  /* @__PURE__ */ t.jsx(
1105
- J,
1154
+ z,
1106
1155
  {
1107
- ref: f,
1108
- points: [new T(0, 0, 0), u],
1156
+ ref: d,
1157
+ points: [new V(0, 0, 0), m],
1109
1158
  color: "White",
1110
1159
  lineWidth: 5
1111
1160
  }
1112
1161
  ),
1113
- /* @__PURE__ */ t.jsxs("mesh", { ref: o, name: "TCP", position: u, children: [
1162
+ /* @__PURE__ */ t.jsxs("mesh", { ref: i, name: "TCP", position: m, children: [
1114
1163
  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.025, 32, 32] }),
1115
1164
  /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "red", depthTest: !0 })
1116
1165
  ] })
@@ -1118,64 +1167,64 @@ function we({
1118
1167
  }
1119
1168
  ) });
1120
1169
  }
1121
- const be = C(
1170
+ const be = O(
1122
1171
  ({
1123
1172
  rapidlyChangingMotionState: e,
1124
1173
  modelFromController: r,
1125
1174
  dhParameters: n,
1126
- getModel: l = D,
1127
- flangeRef: o,
1128
- postModelRender: f,
1129
- transparentColor: s,
1130
- instanceUrl: u,
1131
- ...a
1175
+ getModel: l = C,
1176
+ flangeRef: i,
1177
+ postModelRender: d,
1178
+ transparentColor: u,
1179
+ instanceUrl: m,
1180
+ ...f
1132
1181
  }) => {
1133
- const [d, m] = A(null), i = V((h) => {
1134
- m(h);
1182
+ const [s, p] = S(null), o = T((c) => {
1183
+ p(c);
1135
1184
  }, []);
1136
- v(() => {
1137
- d && (s ? xe(d, s) : ye(d));
1138
- }, [d, s]);
1139
- const c = /* @__PURE__ */ t.jsx(
1185
+ M(() => {
1186
+ s && (u ? xe(s, u) : ye(s));
1187
+ }, [s, u]);
1188
+ const a = /* @__PURE__ */ t.jsx(
1140
1189
  we,
1141
1190
  {
1142
1191
  rapidlyChangingMotionState: e,
1143
1192
  dhParameters: n,
1144
- ...a
1193
+ ...f
1145
1194
  }
1146
1195
  );
1147
1196
  return /* @__PURE__ */ t.jsxs(
1148
1197
  ce,
1149
1198
  {
1150
- fallback: c,
1151
- onError: (h) => {
1152
- console.warn(h);
1199
+ fallback: a,
1200
+ onError: (c) => {
1201
+ console.warn(c);
1153
1202
  },
1154
1203
  children: [
1155
- /* @__PURE__ */ t.jsx(oe, { fallback: c, children: /* @__PURE__ */ t.jsx("group", { ref: i, children: /* @__PURE__ */ t.jsx(
1204
+ /* @__PURE__ */ t.jsx(oe, { fallback: a, children: /* @__PURE__ */ t.jsx("group", { ref: o, children: /* @__PURE__ */ t.jsx(
1156
1205
  je,
1157
1206
  {
1158
1207
  rapidlyChangingMotionState: e,
1159
1208
  dhParameters: n,
1160
1209
  children: /* @__PURE__ */ t.jsx(
1161
- pe,
1210
+ he,
1162
1211
  {
1163
1212
  modelURL: (() => {
1164
- const h = l(r, u);
1165
- if (!h) {
1166
- const y = new Blob([], { type: "model/gltf-binary" }), p = new File([y], `${r}.glb`, { type: "model/gltf-binary" });
1167
- return Promise.resolve(URL.createObjectURL(p));
1213
+ const c = l(r, m);
1214
+ if (!c) {
1215
+ const y = new Blob([], { type: "model/gltf-binary" }), h = new File([y], `${r}.glb`, { type: "model/gltf-binary" });
1216
+ return Promise.resolve(URL.createObjectURL(h));
1168
1217
  }
1169
- return h;
1218
+ return c;
1170
1219
  })(),
1171
- postModelRender: f,
1172
- flangeRef: o,
1173
- ...a
1220
+ postModelRender: d,
1221
+ flangeRef: i,
1222
+ ...f
1174
1223
  }
1175
1224
  )
1176
1225
  }
1177
1226
  ) }) }),
1178
- /* @__PURE__ */ t.jsx(he, {})
1227
+ /* @__PURE__ */ t.jsx(me, {})
1179
1228
  ]
1180
1229
  }
1181
1230
  );
@@ -1183,41 +1232,41 @@ const be = C(
1183
1232
  );
1184
1233
  function ct({
1185
1234
  connectedMotionGroup: e,
1186
- getModel: r = D,
1235
+ getModel: r = C,
1187
1236
  flangeRef: n,
1188
1237
  transparentColor: l,
1189
- postModelRender: o,
1190
- ...f
1238
+ postModelRender: i,
1239
+ ...d
1191
1240
  }) {
1192
1241
  if (!e.dhParameters)
1193
1242
  return null;
1194
- const s = e.modelFromController || "";
1195
- return s && r(s) ? /* @__PURE__ */ t.jsx(
1243
+ const u = e.modelFromController || "";
1244
+ return u && r(u) ? /* @__PURE__ */ t.jsx(
1196
1245
  be,
1197
1246
  {
1198
1247
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
1199
- modelFromController: s,
1248
+ modelFromController: u,
1200
1249
  dhParameters: e.dhParameters,
1201
1250
  getModel: r,
1202
1251
  flangeRef: n,
1203
1252
  transparentColor: l,
1204
- postModelRender: o,
1205
- ...f
1253
+ postModelRender: i,
1254
+ ...d
1206
1255
  }
1207
1256
  ) : /* @__PURE__ */ t.jsx(
1208
1257
  we,
1209
1258
  {
1210
1259
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
1211
1260
  dhParameters: e.dhParameters,
1212
- ...f
1261
+ ...d
1213
1262
  }
1214
1263
  );
1215
1264
  }
1216
1265
  const ne = {
1217
- [M.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
1218
- [M.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1219
- [M.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1220
- [M.Kuka]: [
1266
+ [v.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
1267
+ [v.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1268
+ [v.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1269
+ [v.Kuka]: [
1221
1270
  0,
1222
1271
  -Math.PI / 2,
1223
1272
  Math.PI / 2,
@@ -1226,7 +1275,7 @@ const ne = {
1226
1275
  0,
1227
1276
  0
1228
1277
  ],
1229
- [M.Universalrobots]: [
1278
+ [v.Universalrobots]: [
1230
1279
  0,
1231
1280
  -Math.PI / 2,
1232
1281
  -Math.PI / 2,
@@ -1240,15 +1289,15 @@ function $e(e) {
1240
1289
  const [r] = e.split("_");
1241
1290
  switch (r) {
1242
1291
  case "ABB":
1243
- return M.Abb;
1292
+ return v.Abb;
1244
1293
  case "FANUC":
1245
- return M.Fanuc;
1294
+ return v.Fanuc;
1246
1295
  case "YASKAWA":
1247
- return M.Yaskawa;
1296
+ return v.Yaskawa;
1248
1297
  case "KUKA":
1249
- return M.Kuka;
1298
+ return v.Kuka;
1250
1299
  case "UniversalRobots":
1251
- return M.Universalrobots;
1300
+ return v.Universalrobots;
1252
1301
  default:
1253
1302
  return null;
1254
1303
  }
@@ -1257,17 +1306,17 @@ function ut(e, r) {
1257
1306
  const n = $e(e);
1258
1307
  return n && n in ne ? ne[n] : r || null;
1259
1308
  }
1260
- const ft = C((e) => {
1309
+ const ft = O((e) => {
1261
1310
  const {
1262
1311
  inverseSolver: r,
1263
1312
  dhParameters: n,
1264
1313
  ...l
1265
- } = e, [o, f] = A(I.RevoluteJoint);
1266
- v(() => {
1267
- n.length && f(n[0].type ?? I.RevoluteJoint);
1314
+ } = e, [i, d] = S(D.RevoluteJoint);
1315
+ M(() => {
1316
+ n.length && d(n[0].type ?? D.RevoluteJoint);
1268
1317
  }, [n]);
1269
- const s = z(() => r === null && o === I.RevoluteJoint, [r, o]), u = z(() => r === null && o === I.PrismaticJoint, [r, o]);
1270
- return z(() => !!r, [r]) || s ? /* @__PURE__ */ t.jsx(ge, { dhParameters: n, ...l }) : u ? /* @__PURE__ */ t.jsx(be, { dhParameters: n, ...l }) : /* @__PURE__ */ t.jsx(t.Fragment, {});
1318
+ const u = F(() => r === null && i === D.RevoluteJoint, [r, i]), m = F(() => r === null && i === D.PrismaticJoint, [r, i]);
1319
+ return F(() => !!r, [r]) || u ? /* @__PURE__ */ t.jsx(ge, { dhParameters: n, ...l }) : m ? /* @__PURE__ */ t.jsx(be, { dhParameters: n, ...l }) : /* @__PURE__ */ t.jsx(t.Fragment, {});
1271
1320
  });
1272
1321
  export {
1273
1322
  ot as C,
@@ -1282,8 +1331,8 @@ export {
1282
1331
  be as c,
1283
1332
  ge as d,
1284
1333
  lt as e,
1285
- D as f,
1334
+ C as f,
1286
1335
  $e as g,
1287
1336
  ut as h
1288
1337
  };
1289
- //# sourceMappingURL=MotionGroupVisualizer-Ce9kTMPy.js.map
1338
+ //# sourceMappingURL=MotionGroupVisualizer-BlWkdkaM.js.map