@wandelbots/wandelbots-js-react-components 6.0.0-pr.docs-remove-outdated-refs.623.2d4b028 → 6.0.0-pr.motion-smoothing-stream.625.fc2b591

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