@wandelbots/wandelbots-js-react-components 5.5.2 → 5.5.3

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