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