@wandelbots/wandelbots-js-react-components 6.0.0 → 6.1.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.
@@ -1,28 +1,28 @@
1
- import { jsx as r, jsxs as x, Fragment as J } from "react/jsx-runtime";
2
- import * as w from "three";
3
- import { Matrix4 as v, Vector3 as L, Quaternion as $ } from "three";
4
- import { ConvexGeometry as ce, RoundedBoxGeometry as Ge } from "three-stdlib";
5
- import Le, { useMemo as F, forwardRef as Ie, useRef as R, useEffect as T, useImperativeHandle as Pe, useState as I, useCallback as G, Suspense as le } from "react";
6
- import { d as Ae, v as Fe, o as De, e as C } from "./externalizeComponent-EDymnaGR.js";
7
- import { Environment as Oe, Lightformer as A, Line as N, useGLTF as Ve, Bounds as z } from "@react-three/drei";
1
+ import { jsx as r, jsxs as x, Fragment as B } from "react/jsx-runtime";
2
+ import * as b from "three";
3
+ import { Matrix4 as v, Vector3 as k, Quaternion as J } from "three";
4
+ import { ConvexGeometry as ce, RoundedBoxGeometry as Te } from "three-stdlib";
5
+ import ke, { useMemo as F, forwardRef as Ge, useRef as R, useImperativeHandle as Le, useEffect as I, useState as G, useCallback as L, Suspense as le } from "react";
6
+ import { d as Ie, v as Pe, o as Ae, e as A } from "./externalizeComponent-EDymnaGR.js";
7
+ import { Environment as De, Lightformer as P, Line as N, useGLTF as Fe, Bounds as z } from "@react-three/drei";
8
8
  import { useTheme as Ee } from "@mui/material/styles";
9
9
  import M from "@mui/material/Box";
10
10
  import ee from "@mui/material/Button";
11
- import Ue from "@mui/material/Card";
11
+ import Oe from "@mui/material/Card";
12
12
  import te from "@mui/material/Divider";
13
- import re from "@mui/material/Typography";
14
- import { useThree as ue, useFrame as fe, Canvas as ne } from "@react-three/fiber";
15
- import { observer as Je } from "mobx-react-lite";
16
- import { useTranslation as Ce } from "react-i18next";
17
- import { V as pe, c as de, b as oe } from "./interpolation-DG8VTxzS.js";
18
- import { Nova as je, Manufacturer as _, JointTypeEnum as U } from "@wandelbots/nova-js/v2";
19
- import { ErrorBoundary as he } from "react-error-boundary";
13
+ import ne from "@mui/material/Typography";
14
+ import { useThree as ue, Canvas as re } from "@react-three/fiber";
15
+ import { observer as Ue } from "mobx-react-lite";
16
+ import { useTranslation as je } from "react-i18next";
17
+ import { d as fe, u as H, b as oe } from "./useSmoothedMotionState-CpGsrwj4.js";
18
+ import { Nova as Ce, Manufacturer as S, JointTypeEnum as C } from "@wandelbots/nova-js/v2";
19
+ import { ErrorBoundary as pe } from "react-error-boundary";
20
20
  function Be(e) {
21
21
  switch (e.shape_type) {
22
22
  case "convex_hull":
23
23
  return new ce(
24
24
  e.vertices.map(
25
- (t) => new w.Vector3(
25
+ (t) => new b.Vector3(
26
26
  t[0] / 1e3,
27
27
  t[1] / 1e3,
28
28
  t[2] / 1e3
@@ -30,75 +30,75 @@ function Be(e) {
30
30
  )
31
31
  );
32
32
  case "box":
33
- return new w.BoxGeometry(
33
+ return new b.BoxGeometry(
34
34
  e.size_x / 1e3,
35
35
  e.size_y / 1e3,
36
36
  e.size_z / 1e3
37
37
  );
38
38
  case "sphere":
39
- return new w.SphereGeometry(e.radius / 1e3);
39
+ return new b.SphereGeometry(e.radius / 1e3);
40
40
  case "capsule":
41
- return new w.CapsuleGeometry(
41
+ return new b.CapsuleGeometry(
42
42
  e.radius / 1e3,
43
43
  e.cylinder_height / 1e3
44
44
  );
45
45
  case "cylinder":
46
- return new w.CylinderGeometry(
46
+ return new b.CylinderGeometry(
47
47
  e.radius / 1e3,
48
48
  e.radius / 1e3,
49
49
  e.height / 1e3
50
50
  );
51
51
  case "rectangle":
52
- return new w.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
52
+ return new b.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
53
53
  default:
54
- return console.warn(`${e.shape_type} is not supported`), new w.BufferGeometry();
54
+ return console.warn(`${e.shape_type} is not supported`), new b.BufferGeometry();
55
55
  }
56
56
  }
57
- function We({
57
+ function Ve({
58
58
  name: e,
59
59
  collider: n,
60
60
  children: t
61
61
  }) {
62
62
  var f, c;
63
- const s = ((f = n.pose) == null ? void 0 : f.position) ?? [0, 0, 0], a = ((c = n.pose) == null ? void 0 : c.orientation) ?? [0, 0, 0];
63
+ const a = ((f = n.pose) == null ? void 0 : f.position) ?? [0, 0, 0], i = ((c = n.pose) == null ? void 0 : c.orientation) ?? [0, 0, 0];
64
64
  return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ r(
65
65
  "mesh",
66
66
  {
67
67
  name: e,
68
- position: new w.Vector3(
69
- s[0],
70
- s[1],
71
- s[2]
68
+ position: new b.Vector3(
69
+ a[0],
70
+ a[1],
71
+ a[2]
72
72
  ).divideScalar(1e3),
73
- rotation: new w.Euler(a[0], a[1], a[2], "XYZ"),
73
+ rotation: new b.Euler(i[0], i[1], i[2], "XYZ"),
74
74
  geometry: Be(n.shape),
75
75
  children: t
76
76
  }
77
77
  );
78
78
  }
79
- function $e({
79
+ function We({
80
80
  name: e,
81
81
  colliders: n,
82
82
  meshChildrenProvider: t,
83
- ...s
83
+ ...a
84
84
  }) {
85
- return /* @__PURE__ */ r("group", { name: e, ...s, children: Object.entries(n).map(([a, f]) => /* @__PURE__ */ r(
86
- We,
85
+ return /* @__PURE__ */ r("group", { name: e, ...a, children: Object.entries(n).map(([i, f]) => /* @__PURE__ */ r(
86
+ Ve,
87
87
  {
88
- name: a,
88
+ name: i,
89
89
  collider: f,
90
- children: t(a, f)
90
+ children: t(i, f)
91
91
  },
92
- a
92
+ i
93
93
  )) });
94
94
  }
95
- function xt({
95
+ function vt({
96
96
  scene: e,
97
97
  meshChildrenProvider: n
98
98
  }) {
99
99
  const t = e.colliders;
100
100
  return /* @__PURE__ */ r("group", { children: t && /* @__PURE__ */ r(
101
- $e,
101
+ We,
102
102
  {
103
103
  meshChildrenProvider: n,
104
104
  colliders: t
@@ -106,13 +106,13 @@ function xt({
106
106
  ) });
107
107
  }
108
108
  function ie() {
109
- return /* @__PURE__ */ r(Oe, { frames: 1, children: /* @__PURE__ */ r(He, {}) });
109
+ return /* @__PURE__ */ r(De, { frames: 1, children: /* @__PURE__ */ r(Je, {}) });
110
110
  }
111
- const Ne = [2, 0, 2, 0, 2, 0, 2, 0];
112
- function He({ positions: e = Ne }) {
113
- return /* @__PURE__ */ x(J, { children: [
111
+ const $e = [2, 0, 2, 0, 2, 0, 2, 0];
112
+ function Je({ positions: e = $e }) {
113
+ return /* @__PURE__ */ x(B, { children: [
114
114
  /* @__PURE__ */ r(
115
- A,
115
+ P,
116
116
  {
117
117
  intensity: 5,
118
118
  "rotation-x": Math.PI / 2,
@@ -121,7 +121,7 @@ function He({ positions: e = Ne }) {
121
121
  }
122
122
  ),
123
123
  /* @__PURE__ */ r("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ r("group", { children: e.map((n, t) => /* @__PURE__ */ r(
124
- A,
124
+ P,
125
125
  {
126
126
  form: "circle",
127
127
  intensity: 5,
@@ -132,7 +132,7 @@ function He({ positions: e = Ne }) {
132
132
  t
133
133
  )) }) }),
134
134
  /* @__PURE__ */ r(
135
- A,
135
+ P,
136
136
  {
137
137
  intensity: 40,
138
138
  "rotation-y": Math.PI / 2,
@@ -141,7 +141,7 @@ function He({ positions: e = Ne }) {
141
141
  }
142
142
  ),
143
143
  /* @__PURE__ */ r(
144
- A,
144
+ P,
145
145
  {
146
146
  intensity: 20,
147
147
  "rotation-y": -Math.PI,
@@ -150,7 +150,7 @@ function He({ positions: e = Ne }) {
150
150
  }
151
151
  ),
152
152
  /* @__PURE__ */ r(
153
- A,
153
+ P,
154
154
  {
155
155
  "rotation-y": Math.PI / 2,
156
156
  position: [-5, -1, -1],
@@ -159,7 +159,7 @@ function He({ positions: e = Ne }) {
159
159
  }
160
160
  ),
161
161
  /* @__PURE__ */ r(
162
- A,
162
+ P,
163
163
  {
164
164
  "rotation-y": -Math.PI / 2,
165
165
  position: [10, 1, 0],
@@ -168,7 +168,7 @@ function He({ positions: e = Ne }) {
168
168
  }
169
169
  ),
170
170
  /* @__PURE__ */ r(
171
- A,
171
+ P,
172
172
  {
173
173
  form: "ring",
174
174
  color: "white",
@@ -189,50 +189,50 @@ const se = {
189
189
  transparent: !0,
190
190
  polygonOffset: !0
191
191
  };
192
- function Rt({
192
+ function Mt({
193
193
  safetyZones: e,
194
194
  dhParameters: n,
195
195
  ...t
196
196
  }) {
197
- const s = F(
198
- () => Ae(n ?? []),
197
+ const a = F(
198
+ () => Ie(n ?? []),
199
199
  [n]
200
- ), a = (c, o) => {
201
- var p, y;
202
- if (!((p = o == null ? void 0 : o.pose) != null && p.position) || !((y = o == null ? void 0 : o.pose) != null && y.orientation))
200
+ ), i = (c, o) => {
201
+ var m, h;
202
+ if (!((m = o == null ? void 0 : o.pose) != null && m.position) || !((h = o == null ? void 0 : o.pose) != null && h.orientation))
203
203
  return null;
204
- const g = new w.Vector3(
204
+ const g = new b.Vector3(
205
205
  o.pose.position[0] / 1e3,
206
206
  o.pose.position[1] / 1e3,
207
207
  o.pose.position[2] / 1e3
208
- ), i = new w.Vector3(
208
+ ), s = new b.Vector3(
209
209
  o.pose.orientation[0],
210
210
  o.pose.orientation[1],
211
211
  o.pose.orientation[2]
212
212
  );
213
- let h;
214
- const l = o.shape.shape_type === "plane" ? { ...se, side: w.DoubleSide } : { ...se, side: w.FrontSide };
213
+ let p;
214
+ const l = o.shape.shape_type === "plane" ? { ...se, side: b.DoubleSide } : { ...se, side: b.FrontSide };
215
215
  switch (o.shape.shape_type) {
216
216
  /**
217
217
  * Plane shape, uses DH parameters to calculate the size of the plane (reach distance of a robot)
218
218
  */
219
219
  case "plane":
220
- h = /* @__PURE__ */ r("planeGeometry", { args: [s, s] });
220
+ p = /* @__PURE__ */ r("planeGeometry", { args: [a, a] });
221
221
  break;
222
222
  /**
223
223
  * Sphere shape
224
224
  */
225
225
  case "sphere": {
226
- const m = (o == null ? void 0 : o.shape).radius / 1e3;
227
- h = /* @__PURE__ */ r("sphereGeometry", { args: [m] });
226
+ const d = (o == null ? void 0 : o.shape).radius / 1e3;
227
+ p = /* @__PURE__ */ r("sphereGeometry", { args: [d] });
228
228
  break;
229
229
  }
230
230
  /**
231
231
  * Capsule shape
232
232
  */
233
233
  case "capsule": {
234
- const m = (o == null ? void 0 : o.shape).radius / 1e3, u = (o == null ? void 0 : o.shape).cylinder_height / 1e3;
235
- h = /* @__PURE__ */ r("capsuleGeometry", { args: [m, u] });
234
+ const d = (o == null ? void 0 : o.shape).radius / 1e3, u = (o == null ? void 0 : o.shape).cylinder_height / 1e3;
235
+ p = /* @__PURE__ */ r("capsuleGeometry", { args: [d, u] });
236
236
  break;
237
237
  }
238
238
  /**
@@ -240,26 +240,26 @@ function Rt({
240
240
  * renderer to be able to visualize the convex hull.
241
241
  */
242
242
  case "convex_hull": {
243
- const m = (o == null ? void 0 : o.shape).vertices.map(
244
- (d) => new w.Vector3(d[0] / 1e3, d[1] / 1e3, d[2] / 1e3)
245
- ), u = Fe(m);
243
+ const d = (o == null ? void 0 : o.shape).vertices.map(
244
+ (y) => new b.Vector3(y[0] / 1e3, y[1] / 1e3, y[2] / 1e3)
245
+ ), u = Pe(d);
246
246
  if (u.isCoplanar && u.normal) {
247
- const b = new w.Vector3().addVectors(
248
- m[0],
247
+ const w = new b.Vector3().addVectors(
248
+ d[0],
249
249
  u.normal.multiplyScalar(1e-4)
250
250
  );
251
- m.push(b);
251
+ d.push(w);
252
252
  }
253
253
  try {
254
- h = /* @__PURE__ */ r(
254
+ p = /* @__PURE__ */ r(
255
255
  "primitive",
256
256
  {
257
- object: new ce(m),
257
+ object: new ce(d),
258
258
  attach: "geometry"
259
259
  }
260
260
  );
261
- } catch (d) {
262
- return console.log("Error creating ConvexGeometry:", d), null;
261
+ } catch (y) {
262
+ return console.log("Error creating ConvexGeometry:", y), null;
263
263
  }
264
264
  break;
265
265
  }
@@ -271,11 +271,11 @@ function Rt({
271
271
  * Basically a rounded box with a rectangular cross-section.
272
272
  */
273
273
  case "rectangular_capsule": {
274
- const m = o.shape, u = m.radius / 1e3, d = m.sphere_center_distance_x / 1e3, b = m.sphere_center_distance_y / 1e3, S = u * 2;
275
- h = /* @__PURE__ */ r(
274
+ const d = o.shape, u = d.radius / 1e3, y = d.sphere_center_distance_x / 1e3, w = d.sphere_center_distance_y / 1e3, T = u * 2;
275
+ p = /* @__PURE__ */ r(
276
276
  "primitive",
277
277
  {
278
- object: new Ge(d, b, S, 2, u),
278
+ object: new Te(y, w, T, 2, u),
279
279
  attach: "geometry"
280
280
  }
281
281
  );
@@ -285,38 +285,38 @@ function Rt({
285
285
  console.warn(
286
286
  "Unsupported safety zone shape type:",
287
287
  o.shape.shape_type
288
- ), h = null;
288
+ ), p = null;
289
289
  }
290
290
  return /* @__PURE__ */ x(
291
291
  "mesh",
292
292
  {
293
293
  renderOrder: c,
294
294
  position: g,
295
- quaternion: De(i),
295
+ quaternion: Ae(s),
296
296
  children: [
297
- h,
297
+ p,
298
298
  /* @__PURE__ */ r("meshStandardMaterial", { ...l, polygonOffsetFactor: -c })
299
299
  ]
300
300
  },
301
301
  `safety-zone-${o.shape.shape_type}-${c}`
302
302
  );
303
303
  }, f = F(() => Object.values(e ?? {}).map(
304
- (c, o) => a(o, c)
305
- ), [e, s]);
304
+ (c, o) => i(o, c)
305
+ ), [e, a]);
306
306
  return /* @__PURE__ */ r("group", { ...t, children: f });
307
307
  }
308
- function vt({
308
+ function St({
309
309
  trajectory: e,
310
310
  ...n
311
311
  }) {
312
- const t = (e == null ? void 0 : e.map((s) => {
313
- if (s.position && s.position.length >= 3) {
314
- const [a, f, c] = s.position;
315
- if (Number.isFinite(a) && Number.isFinite(f) && Number.isFinite(c))
316
- return new w.Vector3(a / 1e3, c / 1e3, -f / 1e3);
312
+ const t = (e == null ? void 0 : e.map((a) => {
313
+ if (a.position && a.position.length >= 3) {
314
+ const [i, f, c] = a.position;
315
+ if (Number.isFinite(i) && Number.isFinite(f) && Number.isFinite(c))
316
+ return new b.Vector3(i / 1e3, c / 1e3, -f / 1e3);
317
317
  }
318
318
  return null;
319
- }).filter((s) => s !== null)) || [];
319
+ }).filter((a) => a !== null)) || [];
320
320
  return /* @__PURE__ */ r("group", { ...n, children: t.length > 0 && /* @__PURE__ */ r(
321
321
  N,
322
322
  {
@@ -328,19 +328,19 @@ function vt({
328
328
  }
329
329
  ) });
330
330
  }
331
- const W = /* @__PURE__ */ new Map();
332
- async function j(e, n) {
333
- if (W.has(e))
334
- return W.get(e);
331
+ const $ = /* @__PURE__ */ new Map();
332
+ async function V(e, n) {
333
+ if ($.has(e))
334
+ return $.get(e);
335
335
  const t = (async () => {
336
336
  var c;
337
- const s = n || "", a = new je({ instanceUrl: s }), f = a.api.motionGroupModels;
337
+ const a = n || "", i = new Ce({ instanceUrl: a }), f = i.api.motionGroupModels;
338
338
  (c = f.axios) != null && c.interceptors && f.axios.interceptors.request.use((o) => {
339
339
  var g;
340
340
  return (g = o.url) != null && g.includes("/glb") && (o.responseType = "blob"), o;
341
341
  });
342
342
  try {
343
- const o = await a.api.motionGroupModels.getMotionGroupGlbModel(
343
+ const o = await i.api.motionGroupModels.getMotionGroupGlbModel(
344
344
  e
345
345
  );
346
346
  return URL.createObjectURL(o);
@@ -348,128 +348,110 @@ async function j(e, n) {
348
348
  throw console.error("Failed to fetch model:", o), o;
349
349
  }
350
350
  })();
351
- return W.set(e, t), t;
351
+ return $.set(e, t), t;
352
352
  }
353
- function me(e) {
353
+ function de(e) {
354
354
  function n(t) {
355
- return t.children.length === 0 ? [t] : [t, ...t.children.flatMap((s) => n(s))];
355
+ return t.children.length === 0 ? [t] : [t, ...t.children.flatMap((a) => n(a))];
356
356
  }
357
- return n(e).filter((t) => ge(t));
357
+ return n(e).filter((t) => me(t));
358
358
  }
359
- function ye(e) {
359
+ function he(e) {
360
360
  return e.name.endsWith("_FLG");
361
361
  }
362
- function ge(e) {
362
+ function me(e) {
363
363
  return /_J[0-9]+$/.test(e.name);
364
364
  }
365
- function Ye(e, n) {
365
+ function Ne(e, n) {
366
366
  let t;
367
- function s(a) {
368
- if (ye(a)) {
367
+ function a(i) {
368
+ if (he(i)) {
369
369
  if (t)
370
370
  throw Error(
371
- `Found multiple flange groups in robot model ${n}; first ${t.name} then ${a.name}. Only one _FLG group is allowed.`
371
+ `Found multiple flange groups in robot model ${n}; first ${t.name} then ${i.name}. Only one _FLG group is allowed.`
372
372
  );
373
- t = a;
373
+ t = i;
374
374
  }
375
- ge(a), a.children.map(s);
375
+ me(i), i.children.map(a);
376
376
  }
377
- if (s(e.scene), !t)
377
+ if (a(e.scene), !t)
378
378
  throw Error(
379
379
  `No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
380
380
  );
381
381
  return { gltf: e };
382
382
  }
383
- const be = Ie(
384
- function({ rapidlyChangingMotionState: n, dhParameters: t, onRotationChanged: s, children: a }, f) {
385
- const c = R(null), o = R([]), g = R(null), { invalidate: i } = ue(), h = R(n);
386
- h.current = n, T(() => {
387
- const u = n.joint_position.filter(
388
- (d) => d !== void 0
389
- );
390
- return g.current = new pe(u, {
391
- tension: 120,
392
- // Controls spring stiffness - higher values create faster, more responsive motion
393
- friction: 20,
394
- // Controls damping - higher values reduce oscillation and create smoother settling
395
- threshold: 1e-3
396
- }), () => {
397
- var d;
398
- (d = g.current) == null || d.destroy();
399
- };
400
- }, []), fe((u, d) => {
401
- if (!g.current) return;
402
- o.current.length === 0 && c.current && p();
403
- const b = g.current.update(d);
404
- y(), b || i();
405
- });
383
+ const ye = Ge(
384
+ function({ rapidlyChangingMotionState: n, dhParameters: t, onRotationChanged: a, children: i }, f) {
385
+ const c = R(null), o = R([]), g = R(
386
+ n.joint_position.filter(
387
+ (u) => u !== void 0
388
+ )
389
+ ), { invalidate: s } = ue(), p = R(n);
390
+ p.current = n;
406
391
  function l(u) {
407
- c.current = u, u && p();
392
+ c.current = u, u && m();
408
393
  }
409
- function p() {
410
- c.current && (o.current = me(c.current), y(), i());
394
+ function m() {
395
+ c.current && (o.current = de(c.current), h(), s());
411
396
  }
412
- Pe(f, () => ({ recollectJoints: p }));
413
- function y() {
414
- var d;
415
- const u = ((d = g.current) == null ? void 0 : d.getCurrentValues()) || [];
416
- if (s)
417
- s(o.current, u);
397
+ Le(f, () => ({ recollectJoints: m }));
398
+ function h() {
399
+ const u = g.current;
400
+ if (a)
401
+ a(o.current, u);
418
402
  else
419
- for (const [b, S] of o.current.entries()) {
420
- const P = t[b], B = P.theta || 0, H = P.reverse_rotation_direction ? -1 : 1;
421
- S.rotation.y = H * (u[b] || 0) + B;
403
+ for (const [y, w] of o.current.entries()) {
404
+ const T = t[y], D = T.theta || 0, W = T.reverse_rotation_direction ? -1 : 1;
405
+ w.rotation.y = W * (u[y] || 0) + D;
422
406
  }
423
407
  }
424
- function m(u) {
425
- var b;
426
- const d = u.joint_position.filter(
427
- (S) => S !== void 0
428
- );
429
- (b = g.current) == null || b.setTarget(d), i();
408
+ function d(u) {
409
+ g.current = u.joint_position.filter(
410
+ (y) => y !== void 0
411
+ ), h(), s();
430
412
  }
431
- return de(() => {
432
- m(h.current);
433
- }), T(() => {
434
- m(n);
435
- }, [n]), /* @__PURE__ */ r("group", { ref: l, children: a });
413
+ return fe(() => {
414
+ d(p.current);
415
+ }), I(() => {
416
+ d(n);
417
+ }, [n]), /* @__PURE__ */ r("group", { ref: l, children: i });
436
418
  }
437
- ), qe = "line", Xe = "mesh";
438
- function Ke({
419
+ ), He = "line", Ye = "mesh";
420
+ function qe({
439
421
  rapidlyChangingMotionState: e,
440
422
  dhParameters: n,
441
423
  ...t
442
424
  }) {
443
- const s = new v(), a = R([]), f = R([]);
444
- Le.useEffect(() => {
445
- a.current = new Array(n.length).fill(null), f.current = new Array(n.length).fill(null);
425
+ const a = new v(), i = R([]), f = R([]);
426
+ ke.useEffect(() => {
427
+ i.current = new Array(n.length).fill(null), f.current = new Array(n.length).fill(null);
446
428
  }, [n.length]);
447
- function c(i, h) {
448
- const l = new L(), p = new $(), y = new L();
449
- s.decompose(l, p, y);
450
- const m = l.clone(), u = new v().makeRotationY(
451
- i.theta + h * (i.reverse_rotation_direction ? -1 : 1)
452
- ).multiply(new v().makeTranslation(0, i.d / 1e3, 0)).multiply(new v().makeTranslation(i.a / 1e3, 0, 0)).multiply(new v().makeRotationX(i.alpha));
453
- return s.multiply(u), s.decompose(l, p, y), { a: m, b: l };
429
+ function c(s, p) {
430
+ const l = new k(), m = new J(), h = new k();
431
+ a.decompose(l, m, h);
432
+ const d = l.clone(), u = new v().makeRotationY(
433
+ s.theta + p * (s.reverse_rotation_direction ? -1 : 1)
434
+ ).multiply(new v().makeTranslation(0, s.d / 1e3, 0)).multiply(new v().makeTranslation(s.a / 1e3, 0, 0)).multiply(new v().makeRotationX(s.alpha));
435
+ return a.multiply(u), a.decompose(l, m, h), { a: d, b: l };
454
436
  }
455
- function o(i, h, l, p) {
437
+ function o(s, p, l, m) {
456
438
  if (!n)
457
439
  return;
458
- const y = n[i];
459
- if (!y)
440
+ const h = n[s];
441
+ if (!h)
460
442
  return;
461
- const { a: m, b: u } = c(y, p);
462
- h.geometry.setPositions([m.toArray(), u.toArray()].flat()), l.position.set(u.x, u.y, u.z);
443
+ const { a: d, b: u } = c(h, m);
444
+ p.geometry.setPositions([d.toArray(), u.toArray()].flat()), l.position.set(u.x, u.y, u.z);
463
445
  }
464
- function g(i, h) {
465
- s.identity();
466
- for (let l = 0; l < Math.min(i.length, h.length); l++) {
467
- const p = a.current[l], y = f.current[l];
468
- p && y && o(l, p, y, h[l]);
446
+ function g(s, p) {
447
+ a.identity();
448
+ for (let l = 0; l < Math.min(s.length, p.length); l++) {
449
+ const m = i.current[l], h = f.current[l];
450
+ m && h && o(l, m, h, p[l]);
469
451
  }
470
452
  }
471
453
  return /* @__PURE__ */ r(
472
- be,
454
+ ye,
473
455
  {
474
456
  rapidlyChangingMotionState: e,
475
457
  dhParameters: n,
@@ -479,20 +461,20 @@ function Ke({
479
461
  /* @__PURE__ */ r("sphereGeometry", { args: [0.01, 32, 32] }),
480
462
  /* @__PURE__ */ r("meshStandardMaterial", { color: "black", depthTest: !0 })
481
463
  ] }),
482
- n == null ? void 0 : n.map((i, h) => {
483
- const { a: l, b: p } = c(
484
- i,
485
- e.joint_position[h] ?? 0
486
- ), y = `dhrobot_J0${h}`;
487
- return /* @__PURE__ */ x("group", { name: y, children: [
464
+ n == null ? void 0 : n.map((s, p) => {
465
+ const { a: l, b: m } = c(
466
+ s,
467
+ e.joint_position[p] ?? 0
468
+ ), h = `dhrobot_J0${p}`;
469
+ return /* @__PURE__ */ x("group", { name: h, children: [
488
470
  /* @__PURE__ */ r(
489
471
  N,
490
472
  {
491
- ref: (m) => {
492
- a.current[h] = m;
473
+ ref: (d) => {
474
+ i.current[p] = d;
493
475
  },
494
- name: qe,
495
- points: [l, p],
476
+ name: He,
477
+ points: [l, m],
496
478
  color: "white",
497
479
  lineWidth: 5
498
480
  }
@@ -500,126 +482,126 @@ function Ke({
500
482
  /* @__PURE__ */ x(
501
483
  "mesh",
502
484
  {
503
- ref: (m) => {
504
- f.current[h] = m;
485
+ ref: (d) => {
486
+ f.current[p] = d;
505
487
  },
506
- name: Xe,
507
- position: p,
488
+ name: Ye,
489
+ position: m,
508
490
  children: [
509
491
  /* @__PURE__ */ r("sphereGeometry", { args: [0.01, 32, 32] }),
510
492
  /* @__PURE__ */ r("meshStandardMaterial", { color: "black", depthTest: !0 })
511
493
  ]
512
494
  },
513
- `mesh_${h}`
495
+ `mesh_${p}`
514
496
  )
515
- ] }, y);
497
+ ] }, h);
516
498
  })
517
499
  ] })
518
500
  }
519
501
  );
520
502
  }
521
- const Ze = console.warn;
522
- function we() {
523
- return T(() => {
503
+ const Xe = console.warn;
504
+ function ge() {
505
+ return I(() => {
524
506
  console.warn = (e) => {
525
- e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Ze(e);
507
+ e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Xe(e);
526
508
  };
527
509
  }, []), null;
528
510
  }
529
- function Qe(e) {
511
+ function Ke(e) {
530
512
  return e.type === "Mesh";
531
513
  }
532
- function ze({
514
+ function Ze({
533
515
  url: e,
534
516
  flangeRef: n,
535
517
  postModelRender: t,
536
- ...s
518
+ ...a
537
519
  }) {
538
- const a = Ve(e), c = Ye(a, "robot.glb").gltf, o = G(
539
- (i) => {
540
- i && t && t();
520
+ const i = Fe(e), c = Ne(i, "robot.glb").gltf, o = L(
521
+ (s) => {
522
+ s && t && t();
541
523
  },
542
524
  [t]
543
525
  );
544
- function g(i) {
526
+ function g(s) {
545
527
  try {
546
- return Qe(i) ? i.geometry ? /* @__PURE__ */ r(
528
+ return Ke(s) ? s.geometry ? /* @__PURE__ */ r(
547
529
  "mesh",
548
530
  {
549
- name: i.name,
550
- geometry: i.geometry,
551
- material: i.material,
552
- position: i.position,
553
- rotation: i.rotation
531
+ name: s.name,
532
+ geometry: s.geometry,
533
+ material: s.material,
534
+ position: s.position,
535
+ rotation: s.rotation
554
536
  },
555
- i.uuid
537
+ s.uuid
556
538
  ) : /* @__PURE__ */ r(
557
539
  "group",
558
540
  {
559
- name: i.name,
560
- position: i.position,
561
- rotation: i.rotation
541
+ name: s.name,
542
+ position: s.position,
543
+ rotation: s.rotation
562
544
  },
563
- i.uuid
545
+ s.uuid
564
546
  ) : /* @__PURE__ */ r(
565
547
  "group",
566
548
  {
567
- name: i.name,
568
- position: i.position,
569
- rotation: i.rotation,
570
- ref: ye(i) ? n : void 0,
571
- children: i.children.map(g)
549
+ name: s.name,
550
+ position: s.position,
551
+ rotation: s.rotation,
552
+ ref: he(s) ? n : void 0,
553
+ children: s.children.map(g)
572
554
  },
573
- i.uuid
555
+ s.uuid
574
556
  );
575
- } catch (h) {
576
- return console.warn("Error rendering node", i.name, h), null;
557
+ } catch (p) {
558
+ return console.warn("Error rendering node", s.name, p), null;
577
559
  }
578
560
  }
579
- return /* @__PURE__ */ r("group", { ...s, dispose: null, ref: o, children: g(c.scene) });
561
+ return /* @__PURE__ */ r("group", { ...a, dispose: null, ref: o, children: g(c.scene) });
580
562
  }
581
- function xe({
563
+ function be({
582
564
  modelURL: e,
583
565
  flangeRef: n,
584
566
  postModelRender: t,
585
- ...s
567
+ ...a
586
568
  }) {
587
- const [a, f] = I(null);
588
- return T(() => {
569
+ const [i, f] = G(null);
570
+ return I(() => {
589
571
  let c = !1;
590
572
  return (async () => {
591
573
  try {
592
574
  const g = typeof e == "string" ? e : await e;
593
- c || f((i) => i === g ? i : g);
575
+ c || f((s) => s === g ? s : g);
594
576
  } catch (g) {
595
577
  console.error("Failed to resolve model URL:", g);
596
578
  }
597
579
  })(), () => {
598
580
  c = !0;
599
581
  };
600
- }, [e]), a ? /* @__PURE__ */ r(
601
- ze,
582
+ }, [e]), i ? /* @__PURE__ */ r(
583
+ Ze,
602
584
  {
603
- url: a,
585
+ url: i,
604
586
  flangeRef: n,
605
587
  postModelRender: t,
606
- ...s
588
+ ...a
607
589
  }
608
590
  ) : null;
609
591
  }
610
- const Re = (e, n) => {
592
+ const xe = (e, n) => {
611
593
  e.userData.isGhost || (e.traverse((t) => {
612
- if (t instanceof w.Mesh) {
613
- t.material instanceof w.Material && (t.material.colorWrite = !1);
614
- const s = t.clone(), a = t.clone();
615
- s.material = new w.MeshStandardMaterial({
594
+ if (t instanceof b.Mesh) {
595
+ t.material instanceof b.Material && (t.material.colorWrite = !1);
596
+ const a = t.clone(), i = t.clone();
597
+ a.material = new b.MeshStandardMaterial({
616
598
  depthTest: !0,
617
599
  depthWrite: !0,
618
600
  colorWrite: !1,
619
601
  polygonOffset: !0,
620
602
  polygonOffsetFactor: -1,
621
- side: w.DoubleSide
622
- }), s.userData.isGhost = !0, a.material = new w.MeshStandardMaterial({
603
+ side: b.DoubleSide
604
+ }), a.userData.isGhost = !0, i.material = new b.MeshStandardMaterial({
623
605
  color: n,
624
606
  opacity: 0.3,
625
607
  depthTest: !0,
@@ -627,49 +609,49 @@ const Re = (e, n) => {
627
609
  transparent: !0,
628
610
  polygonOffset: !0,
629
611
  polygonOffsetFactor: -2,
630
- side: w.DoubleSide
631
- }), a.userData.isGhost = !0, t.parent && (t.parent.add(s), t.parent.add(a));
612
+ side: b.DoubleSide
613
+ }), i.userData.isGhost = !0, t.parent && (t.parent.add(a), t.parent.add(i));
632
614
  }
633
615
  }), e.userData.isGhost = !0);
634
- }, ve = (e) => {
616
+ }, we = (e) => {
635
617
  if (!e.userData.isGhost) return;
636
618
  const n = [];
637
619
  e.traverse((t) => {
638
- var s;
639
- t instanceof w.Mesh && ((s = t.userData) != null && s.isGhost ? n.push(t) : t.material instanceof w.Material && (t.material.colorWrite = !0));
620
+ var a;
621
+ t instanceof b.Mesh && ((a = t.userData) != null && a.isGhost ? n.push(t) : t.material instanceof b.Material && (t.material.colorWrite = !0));
640
622
  }), n.forEach((t) => {
641
623
  t.parent && t.parent.remove(t);
642
624
  }), e.userData.isGhost = !1;
643
- }, Me = C(
625
+ }, Re = A(
644
626
  ({
645
627
  rapidlyChangingMotionState: e,
646
628
  modelFromController: n,
647
629
  dhParameters: t,
648
- getModel: s = j,
649
- flangeRef: a,
630
+ getModel: a = V,
631
+ flangeRef: i,
650
632
  postModelRender: f,
651
633
  transparentColor: c,
652
634
  instanceUrl: o,
653
635
  ...g
654
636
  }) => {
655
- const [i, h] = I(null), l = R(null), p = G((d) => {
656
- h(d);
657
- }, []), y = G(() => {
658
- var d;
659
- (d = l.current) == null || d.recollectJoints(), f == null || f();
637
+ const [s, p] = G(null), l = R(null), m = L((y) => {
638
+ p(y);
639
+ }, []), h = L(() => {
640
+ var y;
641
+ (y = l.current) == null || y.recollectJoints(), f == null || f();
660
642
  }, [f]);
661
- T(() => {
662
- i && (c ? Re(i, c) : ve(i));
663
- }, [i, c]);
664
- const m = F(() => {
665
- const d = s(n, o);
666
- if (!d)
643
+ I(() => {
644
+ s && (c ? xe(s, c) : we(s));
645
+ }, [s, c]);
646
+ const d = F(() => {
647
+ const y = a(n, o);
648
+ if (!y)
667
649
  throw new Error(
668
650
  `No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`
669
651
  );
670
- return d;
671
- }, [n, o, s]), u = /* @__PURE__ */ r(
672
- Ke,
652
+ return y;
653
+ }, [n, o, a]), u = /* @__PURE__ */ r(
654
+ qe,
673
655
  {
674
656
  rapidlyChangingMotionState: e,
675
657
  dhParameters: t,
@@ -677,111 +659,124 @@ const Re = (e, n) => {
677
659
  }
678
660
  );
679
661
  return /* @__PURE__ */ x(
680
- he,
662
+ pe,
681
663
  {
682
664
  fallback: u,
683
- onError: (d) => {
684
- console.warn(d);
665
+ onError: (y) => {
666
+ console.warn(y);
685
667
  },
686
668
  children: [
687
- /* @__PURE__ */ r(le, { fallback: u, children: /* @__PURE__ */ r("group", { ref: p, children: /* @__PURE__ */ r(
688
- be,
669
+ /* @__PURE__ */ r(le, { fallback: u, children: /* @__PURE__ */ r("group", { ref: m, children: /* @__PURE__ */ r(
670
+ ye,
689
671
  {
690
672
  ref: l,
691
673
  rapidlyChangingMotionState: e,
692
674
  dhParameters: t,
693
675
  children: /* @__PURE__ */ r(
694
- xe,
676
+ be,
695
677
  {
696
- modelURL: m,
697
- postModelRender: y,
698
- flangeRef: a,
678
+ modelURL: d,
679
+ postModelRender: h,
680
+ flangeRef: i,
699
681
  ...g
700
682
  }
701
683
  )
702
684
  }
703
685
  ) }) }),
704
- /* @__PURE__ */ r(we, {})
686
+ /* @__PURE__ */ r(ge, {})
705
687
  ]
706
688
  }
707
689
  );
708
690
  }
691
+ ), Qe = A(
692
+ ({ rapidlyChangingMotionState: e, ...n }) => {
693
+ const t = H(
694
+ e
695
+ );
696
+ return /* @__PURE__ */ r(
697
+ Re,
698
+ {
699
+ rapidlyChangingMotionState: t,
700
+ ...n
701
+ }
702
+ );
703
+ }
709
704
  );
710
- function et({
705
+ function ze({
711
706
  connectedMotionGroup: e,
712
- getModel: n = j,
707
+ getModel: n = V,
713
708
  flangeRef: t,
714
- transparentColor: s,
715
- postModelRender: a,
709
+ transparentColor: a,
710
+ postModelRender: i,
716
711
  ...f
717
712
  }) {
718
713
  return e.dhParameters ? /* @__PURE__ */ r(
719
- Me,
714
+ Qe,
720
715
  {
721
716
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
722
717
  modelFromController: e.modelFromController || "",
723
718
  dhParameters: e.dhParameters,
724
719
  getModel: n,
725
720
  flangeRef: t,
726
- transparentColor: s,
727
- postModelRender: a,
721
+ transparentColor: a,
722
+ postModelRender: i,
728
723
  ...f
729
724
  }
730
725
  ) : null;
731
726
  }
732
- const Mt = C(
733
- Je(
727
+ const _t = A(
728
+ Ue(
734
729
  ({
735
730
  robotName: e,
736
731
  programState: n,
737
732
  safetyState: t,
738
- operationMode: s,
739
- driveToHomeEnabled: a = !1,
733
+ operationMode: a,
734
+ driveToHomeEnabled: i = !1,
740
735
  onDriveToHomePress: f,
741
736
  onDriveToHomeRelease: c,
742
737
  connectedMotionGroup: o,
743
- robotComponent: g = et,
744
- customContentComponent: i,
745
- className: h
738
+ robotComponent: g = ze,
739
+ customContentComponent: s,
740
+ className: p
746
741
  }) => {
747
742
  var X;
748
- const l = Ee(), { t: p } = Ce(), [y, m] = I(!1), u = R(null), d = R(null), [b, S] = I(!1), [P, B] = I({ width: 400, height: 600 }), [H, ke] = I(0);
749
- T(() => {
750
- const E = () => {
751
- if (d.current) {
752
- const { offsetWidth: Z, offsetHeight: Q } = d.current;
753
- S(Z > Q), B({ width: Z, height: Q });
743
+ const l = Ee(), { t: m } = je(), [h, d] = G(!1), u = R(null), y = R(null), [w, T] = G(!1), [D, W] = G({ width: 400, height: 600 }), [rt, _e] = G(0);
744
+ I(() => {
745
+ const j = () => {
746
+ if (y.current) {
747
+ const { offsetWidth: Z, offsetHeight: Q } = y.current;
748
+ T(Z > Q), W({ width: Z, height: Q });
754
749
  }
755
750
  };
756
- E();
757
- const K = new ResizeObserver(E);
758
- return d.current && K.observe(d.current), () => {
751
+ j();
752
+ const K = new ResizeObserver(j);
753
+ return y.current && K.observe(y.current), () => {
759
754
  K.disconnect();
760
755
  };
761
756
  }, []);
762
- const Y = G(() => {
763
- ke((E) => E + 1);
764
- }, []), D = G(() => {
765
- !a || !f || (m(!0), f());
766
- }, [a, f]), O = G(() => {
767
- !a || !c || (m(!1), c());
768
- }, [a, c]), q = G(() => {
769
- y && c && (m(!1), c());
770
- }, [y, c]), k = b ? P.width < 350 : P.height < 200, V = b ? P.height < 310 : P.height < 450;
757
+ const Y = L(() => {
758
+ _e((j) => j + 1);
759
+ }, []), E = L(() => {
760
+ !i || !f || (d(!0), f());
761
+ }, [i, f]), O = L(() => {
762
+ !i || !c || (d(!1), c());
763
+ }, [i, c]), q = L(() => {
764
+ h && c && (d(!1), c());
765
+ }, [h, c]), _ = w ? D.width < 350 : D.height < 200, U = w ? D.height < 310 : D.height < 450;
771
766
  return /* @__PURE__ */ r(
772
- Ue,
767
+ Oe,
773
768
  {
774
- ref: d,
775
- className: h,
769
+ ref: y,
770
+ className: p,
776
771
  sx: {
777
772
  width: "100%",
778
773
  height: "100%",
779
774
  display: "flex",
780
- flexDirection: b ? "row" : "column",
775
+ flexDirection: w ? "row" : "column",
781
776
  position: "relative",
782
777
  overflow: "hidden",
783
778
  minWidth: { xs: 180, sm: 220, md: 250 },
784
- minHeight: b ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
779
+ minHeight: w ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
785
780
  // Allow progressive hiding in portrait mode
786
781
  border: `1px solid ${l.palette.divider}`,
787
782
  borderRadius: "18px",
@@ -790,7 +785,7 @@ const Mt = C(
790
785
  backgroundImage: "none"
791
786
  // Override any gradient from elevation
792
787
  },
793
- children: b ? /* @__PURE__ */ x(J, { children: [
788
+ children: w ? /* @__PURE__ */ x(B, { children: [
794
789
  /* @__PURE__ */ r(
795
790
  M,
796
791
  {
@@ -805,10 +800,10 @@ const Mt = C(
805
800
  mr: { xs: 0.75, sm: 1, md: 1.5 },
806
801
  overflow: "hidden",
807
802
  // Prevent content from affecting container size
808
- display: k ? "none" : "block"
803
+ display: _ ? "none" : "block"
809
804
  },
810
- children: !k && /* @__PURE__ */ x(
811
- ne,
805
+ children: !_ && /* @__PURE__ */ x(
806
+ re,
812
807
  {
813
808
  orthographic: !0,
814
809
  camera: {
@@ -850,7 +845,7 @@ const Mt = C(
850
845
  display: "flex",
851
846
  flexDirection: "column",
852
847
  justifyContent: "flex-start",
853
- width: k ? "100%" : "50%"
848
+ width: _ ? "100%" : "50%"
854
849
  },
855
850
  children: [
856
851
  /* @__PURE__ */ x(
@@ -862,13 +857,13 @@ const Mt = C(
862
857
  textAlign: "left"
863
858
  },
864
859
  children: [
865
- /* @__PURE__ */ r(re, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
860
+ /* @__PURE__ */ r(ne, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
866
861
  /* @__PURE__ */ r(
867
862
  oe,
868
863
  {
869
864
  programState: n,
870
865
  safetyState: t,
871
- operationMode: s
866
+ operationMode: a
872
867
  }
873
868
  )
874
869
  ]
@@ -886,8 +881,8 @@ const Mt = C(
886
881
  justifyContent: "space-between"
887
882
  },
888
883
  children: [
889
- !V && i && /* @__PURE__ */ x(M, { children: [
890
- /* @__PURE__ */ r(i, {}),
884
+ !U && s && /* @__PURE__ */ x(M, { children: [
885
+ /* @__PURE__ */ r(s, {}),
891
886
  /* @__PURE__ */ r(
892
887
  te,
893
888
  {
@@ -904,7 +899,7 @@ const Mt = C(
904
899
  M,
905
900
  {
906
901
  sx: {
907
- mt: !V && i ? "auto" : 0
902
+ mt: !U && s ? "auto" : 0
908
903
  },
909
904
  children: /* @__PURE__ */ r(
910
905
  M,
@@ -922,18 +917,18 @@ const Mt = C(
922
917
  variant: "contained",
923
918
  color: "secondary",
924
919
  size: "small",
925
- disabled: !a,
926
- onMouseDown: D,
920
+ disabled: !i,
921
+ onMouseDown: E,
927
922
  onMouseUp: O,
928
923
  onMouseLeave: q,
929
- onTouchStart: D,
924
+ onTouchStart: E,
930
925
  onTouchEnd: O,
931
926
  sx: {
932
927
  textTransform: "none",
933
928
  px: 1.5,
934
929
  py: 0.5
935
930
  },
936
- children: p("RobotCard.DriveToHome.bt")
931
+ children: m("RobotCard.DriveToHome.bt")
937
932
  }
938
933
  )
939
934
  }
@@ -946,7 +941,7 @@ const Mt = C(
946
941
  ]
947
942
  }
948
943
  )
949
- ] }) : /* @__PURE__ */ r(J, { children: /* @__PURE__ */ x(
944
+ ] }) : /* @__PURE__ */ r(B, { children: /* @__PURE__ */ x(
950
945
  M,
951
946
  {
952
947
  sx: {
@@ -957,13 +952,13 @@ const Mt = C(
957
952
  },
958
953
  children: [
959
954
  /* @__PURE__ */ x(M, { children: [
960
- /* @__PURE__ */ r(re, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
955
+ /* @__PURE__ */ r(ne, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
961
956
  /* @__PURE__ */ r(
962
957
  oe,
963
958
  {
964
959
  programState: n,
965
960
  safetyState: t,
966
- operationMode: s
961
+ operationMode: a
967
962
  }
968
963
  )
969
964
  ] }),
@@ -971,16 +966,16 @@ const Mt = C(
971
966
  M,
972
967
  {
973
968
  sx: {
974
- flex: k ? 0 : 1,
969
+ flex: _ ? 0 : 1,
975
970
  position: "relative",
976
- minHeight: k ? 0 : { xs: 120, sm: 150, md: 200 },
977
- height: k ? 0 : "auto",
971
+ minHeight: _ ? 0 : { xs: 120, sm: 150, md: 200 },
972
+ height: _ ? 0 : "auto",
978
973
  borderRadius: 1,
979
974
  overflow: "hidden",
980
- display: k ? "none" : "block"
975
+ display: _ ? "none" : "block"
981
976
  },
982
- children: !k && /* @__PURE__ */ x(
983
- ne,
977
+ children: !_ && /* @__PURE__ */ x(
978
+ re,
984
979
  {
985
980
  orthographic: !0,
986
981
  camera: {
@@ -1013,8 +1008,8 @@ const Mt = C(
1013
1008
  }
1014
1009
  ),
1015
1010
  /* @__PURE__ */ x(M, { children: [
1016
- !V && i && /* @__PURE__ */ x(J, { children: [
1017
- /* @__PURE__ */ r(i, {}),
1011
+ !U && s && /* @__PURE__ */ x(B, { children: [
1012
+ /* @__PURE__ */ r(s, {}),
1018
1013
  /* @__PURE__ */ r(
1019
1014
  te,
1020
1015
  {
@@ -1033,7 +1028,7 @@ const Mt = C(
1033
1028
  sx: {
1034
1029
  display: "flex",
1035
1030
  justifyContent: "flex-start",
1036
- mt: !V && i ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
1031
+ mt: !U && s ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
1037
1032
  mb: { xs: 0.5, sm: 0.75, md: 1 }
1038
1033
  },
1039
1034
  children: /* @__PURE__ */ r(
@@ -1043,18 +1038,18 @@ const Mt = C(
1043
1038
  variant: "contained",
1044
1039
  color: "secondary",
1045
1040
  size: "small",
1046
- disabled: !a,
1047
- onMouseDown: D,
1041
+ disabled: !i,
1042
+ onMouseDown: E,
1048
1043
  onMouseUp: O,
1049
1044
  onMouseLeave: q,
1050
- onTouchStart: D,
1045
+ onTouchStart: E,
1051
1046
  onTouchEnd: O,
1052
1047
  sx: {
1053
1048
  textTransform: "none",
1054
1049
  px: 1.5,
1055
1050
  py: 0.5
1056
1051
  },
1057
- children: p("RobotCard.DriveToHome.bt")
1052
+ children: m("RobotCard.DriveToHome.bt")
1058
1053
  }
1059
1054
  )
1060
1055
  }
@@ -1067,102 +1062,82 @@ const Mt = C(
1067
1062
  );
1068
1063
  }
1069
1064
  )
1070
- ), _t = Array(6).fill(2 * Math.PI);
1071
- function _e({
1065
+ ), Tt = Array(6).fill(2 * Math.PI);
1066
+ function ve({
1072
1067
  rapidlyChangingMotionState: e,
1073
1068
  dhParameters: n,
1074
1069
  onTranslationChanged: t,
1075
- children: s
1070
+ children: a
1076
1071
  }) {
1077
- const a = R([]), f = R([]), c = R(null), { invalidate: o } = ue();
1078
- T(() => {
1079
- const l = e.joint_position.filter(
1080
- (p) => p !== void 0
1081
- );
1082
- return c.current = new pe(l, {
1083
- tension: 120,
1084
- // Controls spring stiffness - higher values create faster, more responsive motion
1085
- friction: 20,
1086
- // Controls damping - higher values reduce oscillation and create smoother settling
1087
- threshold: 1e-3
1088
- }), () => {
1089
- var p;
1090
- (p = c.current) == null || p.destroy();
1091
- };
1092
- }, []), fe((l, p) => {
1093
- if (c.current) {
1094
- const y = c.current.update(p);
1095
- i(), y || o();
1096
- }
1097
- });
1072
+ const i = R([]), f = R(
1073
+ e.joint_position.filter(
1074
+ (l) => l !== void 0
1075
+ )
1076
+ ), { invalidate: c } = ue(), o = R(e);
1077
+ o.current = e;
1098
1078
  function g(l) {
1099
- l && (f.current = me(l), i(), o());
1079
+ l && (i.current = de(l), s(), c());
1100
1080
  }
1101
- function i() {
1102
- var p;
1103
- const l = ((p = c.current) == null ? void 0 : p.getCurrentValues()) || [];
1081
+ function s() {
1082
+ const l = f.current;
1104
1083
  if (t)
1105
- t(f.current, l);
1084
+ t(i.current, l);
1106
1085
  else
1107
- for (const [y, m] of f.current.entries()) {
1108
- const d = n[y].reverse_rotation_direction ? -1 : 1;
1109
- m.position.y = d * (l[y] || 0) / 1e3;
1086
+ for (const [m, h] of i.current.entries()) {
1087
+ const u = n[m].reverse_rotation_direction ? -1 : 1;
1088
+ h.position.y = u * (l[m] || 0) / 1e3;
1110
1089
  }
1111
1090
  }
1112
- const h = G(() => {
1113
- const l = e.joint_position.filter(
1114
- (p) => p !== void 0
1115
- );
1116
- requestAnimationFrame(() => {
1117
- var p;
1118
- a.current = l, (p = c.current) == null || p.setTarget(l);
1119
- });
1120
- }, [e]);
1121
- return T(() => {
1122
- h();
1123
- }, [e, h]), de(() => {
1124
- h();
1125
- }), /* @__PURE__ */ r("group", { ref: g, children: s });
1091
+ function p(l) {
1092
+ f.current = l.joint_position.filter(
1093
+ (m) => m !== void 0
1094
+ ), s(), c();
1095
+ }
1096
+ return fe(() => {
1097
+ p(o.current);
1098
+ }), I(() => {
1099
+ p(e);
1100
+ }, [e]), /* @__PURE__ */ r("group", { ref: g, children: a });
1126
1101
  }
1127
- function Te({
1102
+ function Me({
1128
1103
  rapidlyChangingMotionState: e,
1129
1104
  dhParameters: n,
1130
1105
  ...t
1131
1106
  }) {
1132
- const s = new v(), a = R(null), f = R(null);
1133
- function c(i) {
1134
- const h = new v();
1135
- for (let m = 0; m < n.length; m++) {
1136
- const u = n[m], d = i[m] ?? 0, b = new v().makeRotationY(u.theta).multiply(
1107
+ const a = new v(), i = R(null), f = R(null);
1108
+ function c(s) {
1109
+ const p = new v();
1110
+ for (let d = 0; d < n.length; d++) {
1111
+ const u = n[d], y = s[d] ?? 0, w = new v().makeRotationY(u.theta).multiply(
1137
1112
  new v().makeTranslation(
1138
1113
  u.a / 1e3,
1139
- (u.d + d * (u.reverse_rotation_direction ? -1 : 1)) / 1e3,
1114
+ (u.d + y * (u.reverse_rotation_direction ? -1 : 1)) / 1e3,
1140
1115
  0
1141
1116
  )
1142
1117
  ).multiply(new v().makeRotationX(u.alpha));
1143
- h.multiply(b);
1118
+ p.multiply(w);
1144
1119
  }
1145
- const l = new L(), p = new $(), y = new L();
1146
- return h.decompose(l, p, y), l;
1120
+ const l = new k(), m = new J(), h = new k();
1121
+ return p.decompose(l, m, h), l;
1147
1122
  }
1148
1123
  const o = c(
1149
1124
  e.joint_position
1150
1125
  );
1151
- function g(i, h) {
1152
- s.identity();
1153
- let l = new L();
1126
+ function g(s, p) {
1127
+ a.identity();
1128
+ let l = new k();
1154
1129
  for (let u = 0; u < n.length; u++) {
1155
- const d = h[u] ?? 0, b = n[u], S = new v().makeRotationY(b.theta).multiply(
1130
+ const y = p[u] ?? 0, w = n[u], T = new v().makeRotationY(w.theta).multiply(
1156
1131
  new v().makeTranslation(
1157
- b.a / 1e3,
1158
- (b.d + d * (b.reverse_rotation_direction ? -1 : 1)) / 1e3,
1132
+ w.a / 1e3,
1133
+ (w.d + y * (w.reverse_rotation_direction ? -1 : 1)) / 1e3,
1159
1134
  0
1160
1135
  )
1161
- ).multiply(new v().makeRotationX(b.alpha));
1162
- s.multiply(S);
1136
+ ).multiply(new v().makeRotationX(w.alpha));
1137
+ a.multiply(T);
1163
1138
  }
1164
- const p = new L(), y = new $(), m = new L();
1165
- if (s.decompose(p, y, m), l = p, a.current && a.current.position.set(
1139
+ const m = new k(), h = new J(), d = new k();
1140
+ if (a.decompose(m, h, d), l = m, i.current && i.current.position.set(
1166
1141
  l.x,
1167
1142
  l.y,
1168
1143
  l.z
@@ -1179,7 +1154,7 @@ function Te({
1179
1154
  }
1180
1155
  }
1181
1156
  return /* @__PURE__ */ r(
1182
- _e,
1157
+ ve,
1183
1158
  {
1184
1159
  rapidlyChangingMotionState: e,
1185
1160
  dhParameters: n,
@@ -1193,12 +1168,12 @@ function Te({
1193
1168
  N,
1194
1169
  {
1195
1170
  ref: f,
1196
- points: [new L(0, 0, 0), o],
1171
+ points: [new k(0, 0, 0), o],
1197
1172
  color: "White",
1198
1173
  lineWidth: 5
1199
1174
  }
1200
1175
  ),
1201
- /* @__PURE__ */ x("mesh", { ref: a, name: "TCP", position: o, children: [
1176
+ /* @__PURE__ */ x("mesh", { ref: i, name: "TCP", position: o, children: [
1202
1177
  /* @__PURE__ */ r("sphereGeometry", { args: [0.025, 32, 32] }),
1203
1178
  /* @__PURE__ */ r("meshStandardMaterial", { color: "red", depthTest: !0 })
1204
1179
  ] })
@@ -1206,26 +1181,26 @@ function Te({
1206
1181
  }
1207
1182
  );
1208
1183
  }
1209
- const Se = C(
1184
+ const Se = A(
1210
1185
  ({
1211
1186
  rapidlyChangingMotionState: e,
1212
1187
  modelFromController: n,
1213
1188
  dhParameters: t,
1214
- getModel: s = j,
1215
- flangeRef: a,
1189
+ getModel: a = V,
1190
+ flangeRef: i,
1216
1191
  postModelRender: f,
1217
1192
  transparentColor: c,
1218
1193
  instanceUrl: o,
1219
1194
  ...g
1220
1195
  }) => {
1221
- const [i, h] = I(null), l = G((y) => {
1222
- h(y);
1196
+ const [s, p] = G(null), l = L((h) => {
1197
+ p(h);
1223
1198
  }, []);
1224
- T(() => {
1225
- i && (c ? Re(i, c) : ve(i));
1226
- }, [i, c]);
1227
- const p = /* @__PURE__ */ r(
1228
- Te,
1199
+ I(() => {
1200
+ s && (c ? xe(s, c) : we(s));
1201
+ }, [s, c]);
1202
+ const m = /* @__PURE__ */ r(
1203
+ Me,
1229
1204
  {
1230
1205
  rapidlyChangingMotionState: e,
1231
1206
  dhParameters: t,
@@ -1233,71 +1208,84 @@ const Se = C(
1233
1208
  }
1234
1209
  );
1235
1210
  return /* @__PURE__ */ x(
1236
- he,
1211
+ pe,
1237
1212
  {
1238
- fallback: p,
1239
- onError: (y) => {
1240
- console.warn(y);
1213
+ fallback: m,
1214
+ onError: (h) => {
1215
+ console.warn(h);
1241
1216
  },
1242
1217
  children: [
1243
- /* @__PURE__ */ r(le, { fallback: p, children: /* @__PURE__ */ r("group", { ref: l, children: /* @__PURE__ */ r(
1244
- _e,
1218
+ /* @__PURE__ */ r(le, { fallback: m, children: /* @__PURE__ */ r("group", { ref: l, children: /* @__PURE__ */ r(
1219
+ ve,
1245
1220
  {
1246
1221
  rapidlyChangingMotionState: e,
1247
1222
  dhParameters: t,
1248
1223
  children: /* @__PURE__ */ r(
1249
- xe,
1224
+ be,
1250
1225
  {
1251
1226
  modelURL: (() => {
1252
- const y = s(n, o);
1253
- if (!y) {
1254
- const m = new Blob([], { type: "model/gltf-binary" }), u = new File(
1255
- [m],
1227
+ const h = a(n, o);
1228
+ if (!h) {
1229
+ const d = new Blob([], { type: "model/gltf-binary" }), u = new File(
1230
+ [d],
1256
1231
  `${n}.glb`,
1257
1232
  { type: "model/gltf-binary" }
1258
1233
  );
1259
1234
  return Promise.resolve(URL.createObjectURL(u));
1260
1235
  }
1261
- return y;
1236
+ return h;
1262
1237
  })(),
1263
1238
  postModelRender: f,
1264
- flangeRef: a,
1239
+ flangeRef: i,
1265
1240
  ...g
1266
1241
  }
1267
1242
  )
1268
1243
  }
1269
1244
  ) }) }),
1270
- /* @__PURE__ */ r(we, {})
1245
+ /* @__PURE__ */ r(ge, {})
1271
1246
  ]
1272
1247
  }
1273
1248
  );
1274
1249
  }
1250
+ ), et = A(
1251
+ ({ rapidlyChangingMotionState: e, ...n }) => {
1252
+ const t = H(
1253
+ e
1254
+ );
1255
+ return /* @__PURE__ */ r(
1256
+ Se,
1257
+ {
1258
+ rapidlyChangingMotionState: t,
1259
+ ...n
1260
+ }
1261
+ );
1262
+ }
1275
1263
  );
1276
- function Tt({
1264
+ function kt({
1277
1265
  connectedMotionGroup: e,
1278
- getModel: n = j,
1266
+ getModel: n = V,
1279
1267
  flangeRef: t,
1280
- transparentColor: s,
1281
- postModelRender: a,
1268
+ transparentColor: a,
1269
+ postModelRender: i,
1282
1270
  ...f
1283
1271
  }) {
1284
1272
  if (!e.dhParameters)
1285
1273
  return null;
1286
1274
  const c = e.modelFromController || "";
1287
1275
  return c && n(c) ? /* @__PURE__ */ r(
1288
- Se,
1276
+ et,
1289
1277
  {
1290
1278
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
1291
1279
  modelFromController: c,
1292
1280
  dhParameters: e.dhParameters,
1293
1281
  getModel: n,
1294
1282
  flangeRef: t,
1295
- transparentColor: s,
1296
- postModelRender: a,
1283
+ transparentColor: a,
1284
+ postModelRender: i,
1297
1285
  ...f
1298
1286
  }
1299
1287
  ) : /* @__PURE__ */ r(
1300
- Te,
1288
+ Me,
1301
1289
  {
1302
1290
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
1303
1291
  dhParameters: e.dhParameters,
@@ -1306,10 +1294,10 @@ function Tt({
1306
1294
  );
1307
1295
  }
1308
1296
  const ae = {
1309
- [_.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
1310
- [_.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1311
- [_.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1312
- [_.Kuka]: [
1297
+ [S.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
1298
+ [S.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1299
+ [S.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
1300
+ [S.Kuka]: [
1313
1301
  0,
1314
1302
  -Math.PI / 2,
1315
1303
  Math.PI / 2,
@@ -1318,7 +1306,7 @@ const ae = {
1318
1306
  0,
1319
1307
  0
1320
1308
  ],
1321
- [_.Universalrobots]: [
1309
+ [S.Universalrobots]: [
1322
1310
  0,
1323
1311
  -Math.PI / 2,
1324
1312
  -Math.PI / 2,
@@ -1327,55 +1315,69 @@ const ae = {
1327
1315
  -Math.PI / 2,
1328
1316
  0
1329
1317
  ],
1330
- [_.Staubli]: [0, -Math.PI / 2, Math.PI / 2, 0, 0, 0, 0]
1318
+ [S.Staubli]: [0, -Math.PI / 2, Math.PI / 2, 0, 0, 0, 0]
1331
1319
  };
1332
1320
  function tt(e) {
1333
1321
  const [n] = e.split("_");
1334
1322
  switch (n) {
1335
1323
  case "ABB":
1336
- return _.Abb;
1324
+ return S.Abb;
1337
1325
  case "FANUC":
1338
- return _.Fanuc;
1326
+ return S.Fanuc;
1339
1327
  case "YASKAWA":
1340
- return _.Yaskawa;
1328
+ return S.Yaskawa;
1341
1329
  case "KUKA":
1342
- return _.Kuka;
1330
+ return S.Kuka;
1343
1331
  case "UniversalRobots":
1344
- return _.Universalrobots;
1332
+ return S.Universalrobots;
1345
1333
  case "STAUBLI":
1346
- return _.Staubli;
1334
+ return S.Staubli;
1347
1335
  default:
1348
1336
  return null;
1349
1337
  }
1350
1338
  }
1351
- function St(e, n) {
1339
+ function Gt(e, n) {
1352
1340
  const t = tt(e);
1353
1341
  return t && t in ae ? ae[t] : n || null;
1354
1342
  }
1355
- const kt = C((e) => {
1356
- const { inverseSolver: n, dhParameters: t, ...s } = e, [a, f] = I(
1357
- U.RevoluteJoint
1343
+ const nt = A((e) => {
1344
+ const { inverseSolver: n, dhParameters: t, ...a } = e, [i, f] = G(
1345
+ C.RevoluteJoint
1358
1346
  );
1359
- T(() => {
1360
- t.length && f(t[0].type ?? U.RevoluteJoint);
1347
+ I(() => {
1348
+ t.length && f(t[0].type ?? C.RevoluteJoint);
1361
1349
  }, [t]);
1362
- const c = F(() => n === null && a === U.RevoluteJoint, [n, a]), o = F(() => n === null && a === U.PrismaticJoint, [n, a]);
1363
- return F(() => !!n, [n]) || c ? /* @__PURE__ */ r(Me, { dhParameters: t, ...s }) : o ? /* @__PURE__ */ r(Se, { dhParameters: t, ...s }) : null;
1350
+ const c = F(() => n === null && i === C.RevoluteJoint, [n, i]), o = F(() => n === null && i === C.PrismaticJoint, [n, i]);
1351
+ return F(() => !!n, [n]) || c ? /* @__PURE__ */ r(Re, { dhParameters: t, ...a }) : o ? /* @__PURE__ */ r(Se, { dhParameters: t, ...a }) : null;
1352
+ }), Lt = A((e) => {
1353
+ const n = H(
1354
+ e.rapidlyChangingMotionState
1355
+ );
1356
+ return /* @__PURE__ */ r(
1357
+ nt,
1358
+ {
1359
+ ...e,
1360
+ rapidlyChangingMotionState: n
1361
+ }
1362
+ );
1364
1363
  });
1365
1364
  export {
1366
- xt as C,
1367
- Tt as L,
1365
+ vt as C,
1366
+ kt as L,
1368
1367
  ae as M,
1369
1368
  ie as P,
1370
- Mt as R,
1371
- Rt as S,
1372
- vt as T,
1373
- _t as a,
1374
- et as b,
1369
+ _t as R,
1370
+ Mt as S,
1371
+ St as T,
1372
+ Tt as a,
1373
+ ze as b,
1375
1374
  Se as c,
1376
- j as d,
1375
+ V as d,
1377
1376
  tt as e,
1378
- Me as f,
1379
- St as g,
1380
- kt as h
1377
+ et as f,
1378
+ Gt as g,
1379
+ Re as h,
1380
+ Qe as i,
1381
+ nt as j,
1382
+ Lt as k
1381
1383
  };