@wandelbots/wandelbots-js-react-components 3.7.2 → 3.7.4-pr.feat-add-linear-axis-support.509.8e469ba

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +46 -0
  2. package/dist/3d.cjs.js +1 -1
  3. package/dist/3d.d.ts +2 -1
  4. package/dist/3d.d.ts.map +1 -1
  5. package/dist/3d.es.js +8 -7
  6. package/dist/{LoadingCover-Dr9hDTku.js → LoadingCover-6gWr11KP.js} +11 -10
  7. package/dist/{LoadingCover-Dr9hDTku.js.map → LoadingCover-6gWr11KP.js.map} +1 -1
  8. package/dist/LoadingCover-CukpS_aj.cjs +2 -0
  9. package/dist/{LoadingCover-r2yhJZF9.cjs.map → LoadingCover-CukpS_aj.cjs.map} +1 -1
  10. package/dist/SupportedLinearAxis-Cc5zohcs.cjs +2 -0
  11. package/dist/SupportedLinearAxis-Cc5zohcs.cjs.map +1 -0
  12. package/dist/SupportedLinearAxis-DAK0IyqZ.js +1228 -0
  13. package/dist/SupportedLinearAxis-DAK0IyqZ.js.map +1 -0
  14. package/dist/{WandelscriptEditor-DnJvITTA.js → WandelscriptEditor-7eN-Yw7m.js} +3 -3
  15. package/dist/{WandelscriptEditor-DnJvITTA.js.map → WandelscriptEditor-7eN-Yw7m.js.map} +1 -1
  16. package/dist/WandelscriptEditor-D6_vS5Uk.cjs +2 -0
  17. package/dist/{WandelscriptEditor-Dj7TBCkF.cjs.map → WandelscriptEditor-D6_vS5Uk.cjs.map} +1 -1
  18. package/dist/auth0-spa-js.production.esm-D_IhPirK.cjs +5 -0
  19. package/dist/auth0-spa-js.production.esm-D_IhPirK.cjs.map +1 -0
  20. package/dist/auth0-spa-js.production.esm-mvPojIrB.js +4043 -0
  21. package/dist/auth0-spa-js.production.esm-mvPojIrB.js.map +1 -0
  22. package/dist/components/RobotCard.d.ts +1 -1
  23. package/dist/components/RobotCard.d.ts.map +1 -1
  24. package/dist/components/robots/DHLinearAxis.d.ts +3 -0
  25. package/dist/components/robots/DHLinearAxis.d.ts.map +1 -0
  26. package/dist/components/robots/GenericRobot.d.ts +2 -2
  27. package/dist/components/robots/GenericRobot.d.ts.map +1 -1
  28. package/dist/components/robots/LinearAxis.d.ts +25 -0
  29. package/dist/components/robots/LinearAxis.d.ts.map +1 -0
  30. package/dist/components/robots/LinearAxisAnimator.d.ts +12 -0
  31. package/dist/components/robots/LinearAxisAnimator.d.ts.map +1 -0
  32. package/dist/components/robots/Robot.d.ts +3 -1
  33. package/dist/components/robots/Robot.d.ts.map +1 -1
  34. package/dist/components/robots/SupportedLinearAxis.d.ts +18 -0
  35. package/dist/components/robots/SupportedLinearAxis.d.ts.map +1 -0
  36. package/dist/components/robots/SupportedRobot.d.ts +1 -1
  37. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  38. package/dist/components/robots/robotModelLogic.d.ts +11 -1
  39. package/dist/components/robots/robotModelLogic.d.ts.map +1 -1
  40. package/dist/core.cjs.js +1 -1
  41. package/dist/core.es.js +4 -4
  42. package/dist/externalizeComponent-CkVWk2F_.cjs +24 -0
  43. package/dist/externalizeComponent-CkVWk2F_.cjs.map +1 -0
  44. package/dist/externalizeComponent-Dc3fViZA.js +489 -0
  45. package/dist/externalizeComponent-Dc3fViZA.js.map +1 -0
  46. package/dist/index.cjs.js +1 -1
  47. package/dist/index.es.js +58 -57
  48. package/dist/interpolation-DZhBKo-u.cjs +20 -0
  49. package/dist/interpolation-DZhBKo-u.cjs.map +1 -0
  50. package/dist/interpolation-baUmFLkh.js +6924 -0
  51. package/dist/interpolation-baUmFLkh.js.map +1 -0
  52. package/dist/lib/JoggerConnection.d.ts.map +1 -1
  53. package/dist/{theming-DxiD0Q3m.js → theming-BTlS2afw.js} +4951 -6394
  54. package/dist/theming-BTlS2afw.js.map +1 -0
  55. package/dist/theming-DPoEjzxv.cjs +115 -0
  56. package/dist/theming-DPoEjzxv.cjs.map +1 -0
  57. package/dist/wandelscript.cjs.js +1 -1
  58. package/dist/wandelscript.es.js +1 -1
  59. package/package.json +16 -6
  60. package/src/3d.ts +3 -2
  61. package/src/components/RobotCard.tsx +1 -1
  62. package/src/components/robots/DHLinearAxis.tsx +128 -0
  63. package/src/components/robots/GenericRobot.tsx +97 -36
  64. package/src/components/robots/LinearAxis.tsx +73 -0
  65. package/src/components/robots/LinearAxisAnimator.tsx +115 -0
  66. package/src/components/robots/Robot.tsx +3 -1
  67. package/src/components/robots/RobotAnimator.test.tsx +1 -1
  68. package/src/components/robots/SupportedLinearAxis.tsx +99 -0
  69. package/src/components/robots/SupportedRobot.tsx +11 -3
  70. package/src/components/robots/robotModelLogic.ts +75 -6
  71. package/src/env.d.ts +3 -0
  72. package/src/lib/JoggerConnection.ts +10 -10
  73. package/src/lib/MotionStreamConnection.ts +1 -1
  74. package/dist/LoadingCover-r2yhJZF9.cjs +0 -2
  75. package/dist/WandelscriptEditor-Dj7TBCkF.cjs +0 -2
  76. package/dist/auth0-spa-js.production.esm-DL9f1uDJ.js +0 -1438
  77. package/dist/auth0-spa-js.production.esm-DL9f1uDJ.js.map +0 -1
  78. package/dist/auth0-spa-js.production.esm-DTiWXa87.cjs +0 -5
  79. package/dist/auth0-spa-js.production.esm-DTiWXa87.cjs.map +0 -1
  80. package/dist/index-CAib4NKw.js +0 -2261
  81. package/dist/index-CAib4NKw.js.map +0 -1
  82. package/dist/index-CqMZL0FV.cjs +0 -2
  83. package/dist/index-CqMZL0FV.cjs.map +0 -1
  84. package/dist/index-CxasuX80.js +0 -5212
  85. package/dist/index-CxasuX80.js.map +0 -1
  86. package/dist/index-DxwppshT.cjs +0 -29
  87. package/dist/index-DxwppshT.cjs.map +0 -1
  88. package/dist/manufacturerHomePositions-BW0KbWeg.js +0 -980
  89. package/dist/manufacturerHomePositions-BW0KbWeg.js.map +0 -1
  90. package/dist/manufacturerHomePositions-r9dAEtsx.cjs +0 -2
  91. package/dist/manufacturerHomePositions-r9dAEtsx.cjs.map +0 -1
  92. package/dist/theming-CKlFOjJ_.cjs +0 -133
  93. package/dist/theming-CKlFOjJ_.cjs.map +0 -1
  94. package/dist/theming-DxiD0Q3m.js.map +0 -1
@@ -1,980 +0,0 @@
1
- import { j as t, e as q } from "./index-CAib4NKw.js";
2
- import * as h from "three";
3
- import { Matrix4 as G, Vector3 as L, Quaternion as ie } from "three";
4
- import { ConvexGeometry as X } from "three-stdlib";
5
- import { useThree as ae, useFrame as le, Canvas as W } from "@react-three/fiber";
6
- import { Environment as ce, Lightformer as v, Line as Z, useGLTF as ue, Bounds as $ } from "@react-three/drei";
7
- import { useTheme as fe, Card as de, Box as y, Typography as B, Divider as H, Button as J } from "@mui/material";
8
- import { observer as he } from "mobx-react-lite";
9
- import me, { useRef as _, useEffect as F, useCallback as R, useState as V, Suspense as pe } from "react";
10
- import { useTranslation as xe } from "react-i18next";
11
- import { V as ge, c as ye, b as U, M as j } from "./index-CxasuX80.js";
12
- import { ErrorBoundary as je } from "react-error-boundary";
13
- function we(e) {
14
- switch (e.shape_type) {
15
- case "convex_hull":
16
- return new X(
17
- e.vertices.map(
18
- (r) => new h.Vector3(
19
- r[0] / 1e3,
20
- r[1] / 1e3,
21
- r[2] / 1e3
22
- )
23
- )
24
- );
25
- case "box":
26
- return new h.BoxGeometry(
27
- e.size_x / 1e3,
28
- e.size_y / 1e3,
29
- e.size_z / 1e3
30
- );
31
- case "sphere":
32
- return new h.SphereGeometry(e.radius / 1e3);
33
- case "capsule":
34
- return new h.CapsuleGeometry(
35
- e.radius / 1e3,
36
- e.cylinder_height / 1e3
37
- );
38
- case "cylinder":
39
- return new h.CylinderGeometry(
40
- e.radius / 1e3,
41
- e.radius / 1e3,
42
- e.height / 1e3
43
- );
44
- case "rectangle":
45
- return new h.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
46
- default:
47
- return console.warn(`${e.shape_type} is not supported`), new h.BufferGeometry();
48
- }
49
- }
50
- function be({
51
- name: e,
52
- collider: n,
53
- children: r
54
- }) {
55
- var f, l;
56
- const s = ((f = n.pose) == null ? void 0 : f.position) ?? [0, 0, 0], o = ((l = n.pose) == null ? void 0 : l.orientation) ?? [0, 0, 0];
57
- return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
58
- "mesh",
59
- {
60
- name: e,
61
- position: new h.Vector3(
62
- s[0],
63
- s[1],
64
- s[2]
65
- ).divideScalar(1e3),
66
- rotation: new h.Euler(o[0], o[1], o[2], "XYZ"),
67
- geometry: we(n.shape),
68
- children: r
69
- }
70
- );
71
- }
72
- function Me({
73
- name: e,
74
- colliders: n,
75
- meshChildrenProvider: r,
76
- ...s
77
- }) {
78
- return /* @__PURE__ */ t.jsx("group", { name: e, ...s, children: Object.entries(n).map(([o, f]) => /* @__PURE__ */ t.jsx(
79
- be,
80
- {
81
- name: o,
82
- collider: f,
83
- children: r(o, f)
84
- },
85
- o
86
- )) });
87
- }
88
- function Xe({
89
- scene: e,
90
- meshChildrenProvider: n
91
- }) {
92
- const r = e.colliders;
93
- return /* @__PURE__ */ t.jsx("group", { children: r && /* @__PURE__ */ t.jsx(
94
- Me,
95
- {
96
- meshChildrenProvider: n,
97
- colliders: r
98
- }
99
- ) });
100
- }
101
- function N() {
102
- return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(ve, {}) });
103
- }
104
- function ve({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
105
- return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
106
- /* @__PURE__ */ t.jsx(
107
- v,
108
- {
109
- intensity: 5,
110
- "rotation-x": Math.PI / 2,
111
- position: [0, 5, -9],
112
- scale: [10, 10, 1]
113
- }
114
- ),
115
- /* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((n, r) => /* @__PURE__ */ t.jsx(
116
- v,
117
- {
118
- form: "circle",
119
- intensity: 5,
120
- rotation: [Math.PI / 2, 0, 0],
121
- position: [n, 4, r * 4],
122
- scale: [3, 1, 1]
123
- },
124
- r
125
- )) }) }),
126
- /* @__PURE__ */ t.jsx(
127
- v,
128
- {
129
- intensity: 40,
130
- "rotation-y": Math.PI / 2,
131
- position: [-5, 1, -1],
132
- scale: [20, 0.1, 1]
133
- }
134
- ),
135
- /* @__PURE__ */ t.jsx(
136
- v,
137
- {
138
- intensity: 20,
139
- "rotation-y": -Math.PI,
140
- position: [-5, -2, -1],
141
- scale: [20, 0.1, 1]
142
- }
143
- ),
144
- /* @__PURE__ */ t.jsx(
145
- v,
146
- {
147
- "rotation-y": Math.PI / 2,
148
- position: [-5, -1, -1],
149
- scale: [20, 0.5, 1],
150
- intensity: 5
151
- }
152
- ),
153
- /* @__PURE__ */ t.jsx(
154
- v,
155
- {
156
- "rotation-y": -Math.PI / 2,
157
- position: [10, 1, 0],
158
- scale: [20, 1, 1],
159
- intensity: 10
160
- }
161
- ),
162
- /* @__PURE__ */ t.jsx(
163
- v,
164
- {
165
- form: "ring",
166
- color: "white",
167
- intensity: 5,
168
- scale: 10,
169
- position: [-15, 4, -18],
170
- target: [0, 0, 0]
171
- }
172
- )
173
- ] });
174
- }
175
- function Re(e) {
176
- if (e.length < 3)
177
- return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
178
- const n = new h.Vector3(e[0].x, e[0].y, e[0].z), r = new h.Vector3(e[1].x, e[1].y, e[1].z), s = new h.Vector3(e[2].x, e[2].y, e[2].z), o = new h.Vector3().subVectors(r, n), f = new h.Vector3().subVectors(s, n), l = new h.Vector3().crossVectors(o, f).normalize();
179
- for (let a = 3; a < e.length; a++) {
180
- const p = new h.Vector3(e[a].x, e[a].y, e[a].z), d = new h.Vector3().subVectors(p, n), u = l.dot(d);
181
- if (Math.abs(u) > 1e-6)
182
- return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
183
- }
184
- return { isCoplanar: !0, normal: l };
185
- }
186
- function Ze({
187
- safetyZones: e,
188
- ...n
189
- }) {
190
- return /* @__PURE__ */ t.jsx("group", { ...n, children: e.map((r, s) => {
191
- let o = [];
192
- return r.geometry && (r.geometry.compound ? o = r.geometry.compound.child_geometries : r.geometry.convex_hull && (o = [r.geometry])), o.map((f, l) => {
193
- if (!f.convex_hull) return null;
194
- const a = f.convex_hull.vertices.map(
195
- (u) => new h.Vector3(u.x / 1e3, u.y / 1e3, u.z / 1e3)
196
- ), p = Re(a);
197
- if (p.isCoplanar && p.normal) {
198
- const i = new h.Vector3().addVectors(
199
- a[0],
200
- p.normal.multiplyScalar(1e-4)
201
- );
202
- a.push(i);
203
- }
204
- let d;
205
- try {
206
- d = new X(a);
207
- } catch (u) {
208
- return console.log("Error creating ConvexGeometry:", u), null;
209
- }
210
- return /* @__PURE__ */ t.jsx("mesh", { geometry: d, children: /* @__PURE__ */ t.jsx(
211
- "meshStandardMaterial",
212
- {
213
- attach: "material",
214
- color: "#009f4d",
215
- opacity: 0.2,
216
- depthTest: !1,
217
- depthWrite: !1,
218
- transparent: !0,
219
- polygonOffset: !0,
220
- polygonOffsetFactor: -l
221
- },
222
- s
223
- ) }, `${s}-${l}`);
224
- });
225
- }) });
226
- }
227
- function Qe({
228
- trajectory: e,
229
- ...n
230
- }) {
231
- var s;
232
- const r = ((s = e.trajectory) == null ? void 0 : s.map((o) => o.tcp_pose ? new h.Vector3(
233
- o.tcp_pose.position.x / 1e3,
234
- o.tcp_pose.position.z / 1e3,
235
- -o.tcp_pose.position.y / 1e3
236
- ) : null).filter((o) => o !== null)) || [];
237
- return /* @__PURE__ */ t.jsx("group", { ...n, children: r.length > 0 && /* @__PURE__ */ t.jsx(
238
- Z,
239
- {
240
- points: r,
241
- lineWidth: 3,
242
- polygonOffset: !0,
243
- polygonOffsetFactor: 10,
244
- polygonOffsetUnits: 10
245
- }
246
- ) });
247
- }
248
- const Y = "0.0.0-semantically-released";
249
- function Q(e) {
250
- let n = Y;
251
- return Y.startsWith("0.") && (n = ""), `https://cdn.jsdelivr.net/gh/wandelbotsgmbh/wandelbots-js-react-components${n ? `@${n}` : ""}/public/models/${e}.glb`;
252
- }
253
- function _e(e) {
254
- function n(r) {
255
- return r.children.length === 0 ? [r] : [r, ...r.children.flatMap((s) => n(s))];
256
- }
257
- return n(e).filter((r) => te(r));
258
- }
259
- function ee(e) {
260
- return e.name.endsWith("_FLG");
261
- }
262
- function te(e) {
263
- return /_J[0-9]+$/.test(e.name);
264
- }
265
- function Ge(e, n) {
266
- let r;
267
- function s(o) {
268
- if (ee(o)) {
269
- if (r)
270
- throw Error(
271
- `Found multiple flange groups in robot model ${n}; first ${r.name} then ${o.name}. Only one _FLG group is allowed.`
272
- );
273
- r = o;
274
- }
275
- te(o), o.children.map(s);
276
- }
277
- if (s(e.scene), !r)
278
- throw Error(
279
- `No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
280
- );
281
- return { gltf: e };
282
- }
283
- function re({
284
- rapidlyChangingMotionState: e,
285
- dhParameters: n,
286
- onRotationChanged: r,
287
- children: s
288
- }) {
289
- const o = _([]), f = _([]), l = _(null), { invalidate: a } = ae();
290
- F(() => {
291
- const i = e.joint_position.filter(
292
- (c) => c !== void 0
293
- );
294
- return l.current = new ge(i, {
295
- tension: 120,
296
- // Controls spring stiffness - higher values create faster, more responsive motion
297
- friction: 20,
298
- // Controls damping - higher values reduce oscillation and create smoother settling
299
- threshold: 1e-3
300
- }), () => {
301
- var c;
302
- (c = l.current) == null || c.destroy();
303
- };
304
- }, []), le((i, c) => {
305
- if (l.current) {
306
- const m = l.current.update(c);
307
- d(), m || a();
308
- }
309
- });
310
- function p(i) {
311
- i && (f.current = _e(i), d(), a());
312
- }
313
- function d() {
314
- var c;
315
- const i = ((c = l.current) == null ? void 0 : c.getCurrentValues()) || [];
316
- if (r)
317
- r(f.current, i);
318
- else
319
- for (const [m, x] of f.current.entries()) {
320
- const g = n[m], b = g.theta || 0, M = g.reverse_rotation_direction ? -1 : 1;
321
- x.rotation.y = M * (i[m] || 0) + b;
322
- }
323
- }
324
- const u = R(() => {
325
- const i = e.joint_position.filter(
326
- (c) => c !== void 0
327
- );
328
- requestAnimationFrame(() => {
329
- var c;
330
- o.current = i, (c = l.current) == null || c.setTarget(i);
331
- });
332
- }, [e]);
333
- return F(() => {
334
- u();
335
- }, [e, u]), ye(() => {
336
- u();
337
- }), /* @__PURE__ */ t.jsx("group", { ref: p, children: s });
338
- }
339
- const Ve = "line", Fe = "mesh";
340
- function Ie({
341
- rapidlyChangingMotionState: e,
342
- dhParameters: n,
343
- ...r
344
- }) {
345
- const s = new G(), o = _([]), f = _([]);
346
- me.useEffect(() => {
347
- o.current = new Array(n.length).fill(null), f.current = new Array(n.length).fill(null);
348
- }, [n.length]);
349
- function l(d, u) {
350
- const i = new L(), c = new ie(), m = new L();
351
- s.decompose(i, c, m);
352
- const x = i.clone(), g = new G().makeRotationY(
353
- d.theta + u * (d.reverse_rotation_direction ? -1 : 1)
354
- ).multiply(new G().makeTranslation(0, d.d / 1e3, 0)).multiply(new G().makeTranslation(d.a / 1e3, 0, 0)).multiply(new G().makeRotationX(d.alpha));
355
- return s.multiply(g), s.decompose(i, c, m), { a: x, b: i };
356
- }
357
- function a(d, u, i, c) {
358
- if (!n)
359
- return;
360
- const m = n[d];
361
- if (!m)
362
- return;
363
- const { a: x, b: g } = l(m, c);
364
- u.geometry.setPositions([x.toArray(), g.toArray()].flat()), i.position.set(g.x, g.y, g.z);
365
- }
366
- function p(d, u) {
367
- s.identity();
368
- for (let i = 0; i < Math.min(d.length, u.length); i++) {
369
- const c = o.current[i], m = f.current[i];
370
- c && m && a(i, c, m, u[i]);
371
- }
372
- }
373
- return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
374
- re,
375
- {
376
- rapidlyChangingMotionState: e,
377
- dhParameters: n,
378
- onRotationChanged: p,
379
- children: /* @__PURE__ */ t.jsxs("group", { ...r, name: "Scene", children: [
380
- /* @__PURE__ */ t.jsxs("mesh", { children: [
381
- /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
382
- /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
383
- ] }),
384
- n.map((d, u) => {
385
- const { a: i, b: c } = l(
386
- d,
387
- e.joint_position[u] ?? 0
388
- ), m = `dhrobot_J0${u}`;
389
- return /* @__PURE__ */ t.jsxs("group", { name: m, children: [
390
- /* @__PURE__ */ t.jsx(
391
- Z,
392
- {
393
- ref: (x) => {
394
- o.current[u] = x;
395
- },
396
- name: Ve,
397
- points: [i, c],
398
- color: "white",
399
- lineWidth: 5
400
- }
401
- ),
402
- /* @__PURE__ */ t.jsxs(
403
- "mesh",
404
- {
405
- ref: (x) => {
406
- f.current[u] = x;
407
- },
408
- name: Fe,
409
- position: c,
410
- children: [
411
- /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
412
- /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
413
- ]
414
- },
415
- "mesh_" + u
416
- )
417
- ] }, m);
418
- })
419
- ] })
420
- }
421
- ) });
422
- }
423
- const Ce = console.warn;
424
- function Se() {
425
- return F(() => {
426
- console.warn = (e) => {
427
- e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Ce(e);
428
- };
429
- }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
430
- }
431
- function De(e) {
432
- return e.type === "Mesh";
433
- }
434
- function Te({
435
- modelURL: e,
436
- flangeRef: n,
437
- postModelRender: r,
438
- ...s
439
- }) {
440
- const { gltf: o } = Ge(
441
- ue(e),
442
- e.split("/").pop() || e
443
- ), f = R(
444
- (a) => {
445
- a && r && r();
446
- },
447
- [e]
448
- );
449
- function l(a) {
450
- return De(a) ? /* @__PURE__ */ t.jsx(
451
- "mesh",
452
- {
453
- name: a.name,
454
- geometry: a.geometry,
455
- material: a.material,
456
- position: a.position,
457
- rotation: a.rotation
458
- },
459
- a.uuid
460
- ) : /* @__PURE__ */ t.jsx(
461
- "group",
462
- {
463
- name: a.name,
464
- position: a.position,
465
- rotation: a.rotation,
466
- ref: ee(a) ? n : void 0,
467
- children: a.children.map(l)
468
- },
469
- a.uuid
470
- );
471
- }
472
- return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: f, children: l(o.scene) });
473
- }
474
- const Ae = (e, n) => {
475
- e.userData.isGhost || (e.traverse((r) => {
476
- if (r instanceof h.Mesh) {
477
- r.material instanceof h.Material && (r.material.colorWrite = !1);
478
- const s = r.clone(), o = r.clone();
479
- s.material = new h.MeshStandardMaterial({
480
- depthTest: !0,
481
- depthWrite: !0,
482
- colorWrite: !1,
483
- polygonOffset: !0,
484
- polygonOffsetFactor: -1,
485
- side: h.DoubleSide
486
- }), s.userData.isGhost = !0, o.material = new h.MeshStandardMaterial({
487
- color: n,
488
- opacity: 0.3,
489
- depthTest: !0,
490
- depthWrite: !1,
491
- transparent: !0,
492
- polygonOffset: !0,
493
- polygonOffsetFactor: -2,
494
- side: h.DoubleSide
495
- }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
496
- }
497
- }), e.userData.isGhost = !0);
498
- }, ke = (e) => {
499
- if (!e.userData.isGhost) return;
500
- const n = [];
501
- e.traverse((r) => {
502
- var s;
503
- r instanceof h.Mesh && ((s = r.userData) != null && s.isGhost ? n.push(r) : r.material instanceof h.Material && (r.material.colorWrite = !0));
504
- }), n.forEach((r) => {
505
- r.parent && r.parent.remove(r);
506
- }), e.userData.isGhost = !1;
507
- }, ze = q(
508
- ({
509
- rapidlyChangingMotionState: e,
510
- modelFromController: n,
511
- dhParameters: r,
512
- getModel: s = Q,
513
- flangeRef: o,
514
- postModelRender: f,
515
- transparentColor: l,
516
- ...a
517
- }) => {
518
- const [p, d] = V(null), u = R((c) => {
519
- d(c);
520
- }, []);
521
- F(() => {
522
- p && (l ? Ae(p, l) : ke(p));
523
- }, [p, l]);
524
- const i = /* @__PURE__ */ t.jsx(
525
- Ie,
526
- {
527
- rapidlyChangingMotionState: e,
528
- dhParameters: r,
529
- ...a
530
- }
531
- );
532
- return /* @__PURE__ */ t.jsxs(
533
- je,
534
- {
535
- fallback: i,
536
- onError: (c) => {
537
- console.error(c);
538
- },
539
- children: [
540
- /* @__PURE__ */ t.jsx(pe, { fallback: i, children: /* @__PURE__ */ t.jsx("group", { ref: u, children: /* @__PURE__ */ t.jsx(
541
- re,
542
- {
543
- rapidlyChangingMotionState: e,
544
- dhParameters: r,
545
- children: /* @__PURE__ */ t.jsx(
546
- Te,
547
- {
548
- modelURL: s(n),
549
- postModelRender: f,
550
- flangeRef: o,
551
- ...a
552
- }
553
- )
554
- }
555
- ) }) }),
556
- /* @__PURE__ */ t.jsx(Se, {})
557
- ]
558
- }
559
- );
560
- }
561
- );
562
- function Pe({
563
- connectedMotionGroup: e,
564
- getModel: n = Q,
565
- flangeRef: r,
566
- transparentColor: s,
567
- postModelRender: o,
568
- ...f
569
- }) {
570
- return e.dhParameters ? /* @__PURE__ */ t.jsx(
571
- ze,
572
- {
573
- rapidlyChangingMotionState: e.rapidlyChangingMotionState,
574
- modelFromController: e.modelFromController || "",
575
- dhParameters: e.dhParameters,
576
- getModel: n,
577
- flangeRef: r,
578
- transparentColor: s,
579
- postModelRender: o,
580
- ...f
581
- }
582
- ) : null;
583
- }
584
- const et = q(
585
- he(
586
- ({
587
- robotName: e,
588
- programState: n,
589
- safetyState: r,
590
- operationMode: s,
591
- driveToHomeEnabled: o = !1,
592
- onDriveToHomePress: f,
593
- onDriveToHomeRelease: l,
594
- connectedMotionGroup: a,
595
- robotComponent: p = Pe,
596
- customContentComponent: d,
597
- className: u
598
- }) => {
599
- var z;
600
- const i = fe(), { t: c } = xe(), [m, x] = V(!1), g = _(null), b = _(null), [M, ne] = V(!1), [I, oe] = V({ width: 400, height: 600 }), [Ee, se] = V(0);
601
- F(() => {
602
- const T = () => {
603
- if (b.current) {
604
- const { offsetWidth: O, offsetHeight: E } = b.current;
605
- ne(O > E), oe({ width: O, height: E });
606
- }
607
- };
608
- T();
609
- const P = new ResizeObserver(T);
610
- return b.current && P.observe(b.current), () => {
611
- P.disconnect();
612
- };
613
- }, []);
614
- const A = R(() => {
615
- se((T) => T + 1);
616
- }, []), C = R(() => {
617
- !o || !f || (x(!0), f());
618
- }, [o, f]), S = R(() => {
619
- !o || !l || (x(!1), l());
620
- }, [o, l]), k = R(() => {
621
- m && l && (x(!1), l());
622
- }, [m, l]), w = M ? I.width < 350 : I.height < 200, D = M ? I.height < 310 : I.height < 450;
623
- return /* @__PURE__ */ t.jsx(
624
- de,
625
- {
626
- ref: b,
627
- className: u,
628
- sx: {
629
- width: "100%",
630
- height: "100%",
631
- display: "flex",
632
- flexDirection: M ? "row" : "column",
633
- position: "relative",
634
- overflow: "hidden",
635
- minWidth: { xs: 180, sm: 220, md: 250 },
636
- minHeight: M ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
637
- // Allow progressive hiding in portrait mode
638
- border: `1px solid ${i.palette.divider}`,
639
- borderRadius: "18px",
640
- boxShadow: "none",
641
- backgroundColor: ((z = i.palette.backgroundPaperElevation) == null ? void 0 : z[8]) || "#2A2A3F",
642
- backgroundImage: "none"
643
- // Override any gradient from elevation
644
- },
645
- children: M ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
646
- /* @__PURE__ */ t.jsx(
647
- y,
648
- {
649
- sx: {
650
- flex: "0 0 50%",
651
- position: "relative",
652
- height: "100%",
653
- minHeight: "100%",
654
- maxHeight: "100%",
655
- borderRadius: 1,
656
- m: { xs: 1.5, sm: 2, md: 3 },
657
- mr: { xs: 0.75, sm: 1, md: 1.5 },
658
- overflow: "hidden",
659
- // Prevent content from affecting container size
660
- display: w ? "none" : "block"
661
- },
662
- children: !w && /* @__PURE__ */ t.jsxs(
663
- W,
664
- {
665
- orthographic: !0,
666
- camera: {
667
- position: [3, 2, 3],
668
- zoom: 1
669
- },
670
- shadows: !0,
671
- frameloop: "demand",
672
- style: {
673
- borderRadius: i.shape.borderRadius,
674
- width: "100%",
675
- height: "100%",
676
- background: "transparent",
677
- position: "absolute",
678
- top: 0,
679
- left: 0
680
- },
681
- dpr: [1, 2],
682
- gl: { alpha: !0, antialias: !0 },
683
- children: [
684
- /* @__PURE__ */ t.jsx(N, {}),
685
- /* @__PURE__ */ t.jsx($, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
686
- p,
687
- {
688
- connectedMotionGroup: a,
689
- postModelRender: A
690
- }
691
- ) })
692
- ]
693
- }
694
- )
695
- }
696
- ),
697
- /* @__PURE__ */ t.jsxs(
698
- y,
699
- {
700
- sx: {
701
- flex: "1",
702
- display: "flex",
703
- flexDirection: "column",
704
- justifyContent: "flex-start",
705
- width: w ? "100%" : "50%"
706
- },
707
- children: [
708
- /* @__PURE__ */ t.jsxs(
709
- y,
710
- {
711
- sx: {
712
- p: { xs: 1.5, sm: 2, md: 3 },
713
- pb: { xs: 1, sm: 1.5, md: 2 },
714
- textAlign: "left"
715
- },
716
- children: [
717
- /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
718
- /* @__PURE__ */ t.jsx(
719
- U,
720
- {
721
- programState: n,
722
- safetyState: r,
723
- operationMode: s
724
- }
725
- )
726
- ]
727
- }
728
- ),
729
- /* @__PURE__ */ t.jsxs(
730
- y,
731
- {
732
- sx: {
733
- p: { xs: 1.5, sm: 2, md: 3 },
734
- pt: 0,
735
- flex: "1",
736
- display: "flex",
737
- flexDirection: "column",
738
- justifyContent: "space-between"
739
- },
740
- children: [
741
- !D && d && /* @__PURE__ */ t.jsxs(y, { children: [
742
- /* @__PURE__ */ t.jsx(d, {}),
743
- /* @__PURE__ */ t.jsx(
744
- H,
745
- {
746
- sx: {
747
- mt: 1,
748
- mb: 0,
749
- borderColor: i.palette.divider,
750
- opacity: 0.5
751
- }
752
- }
753
- )
754
- ] }),
755
- /* @__PURE__ */ t.jsx(
756
- y,
757
- {
758
- sx: {
759
- mt: !D && d ? "auto" : 0
760
- },
761
- children: /* @__PURE__ */ t.jsx(
762
- y,
763
- {
764
- sx: {
765
- display: "flex",
766
- justifyContent: "flex-start",
767
- mt: { xs: 1, sm: 1.5, md: 2 },
768
- mb: { xs: 0.5, sm: 0.75, md: 1 }
769
- },
770
- children: /* @__PURE__ */ t.jsx(
771
- J,
772
- {
773
- ref: g,
774
- variant: "contained",
775
- color: "secondary",
776
- size: "small",
777
- disabled: !o,
778
- onMouseDown: C,
779
- onMouseUp: S,
780
- onMouseLeave: k,
781
- onTouchStart: C,
782
- onTouchEnd: S,
783
- sx: {
784
- textTransform: "none",
785
- px: 1.5,
786
- py: 0.5
787
- },
788
- children: c("RobotCard.DriveToHome.bt")
789
- }
790
- )
791
- }
792
- )
793
- }
794
- )
795
- ]
796
- }
797
- )
798
- ]
799
- }
800
- )
801
- ] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
802
- y,
803
- {
804
- sx: {
805
- p: 3,
806
- height: "100%",
807
- display: "flex",
808
- flexDirection: "column"
809
- },
810
- children: [
811
- /* @__PURE__ */ t.jsxs(y, { children: [
812
- /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
813
- /* @__PURE__ */ t.jsx(
814
- U,
815
- {
816
- programState: n,
817
- safetyState: r,
818
- operationMode: s
819
- }
820
- )
821
- ] }),
822
- /* @__PURE__ */ t.jsx(
823
- y,
824
- {
825
- sx: {
826
- flex: w ? 0 : 1,
827
- position: "relative",
828
- minHeight: w ? 0 : { xs: 120, sm: 150, md: 200 },
829
- height: w ? 0 : "auto",
830
- borderRadius: 1,
831
- overflow: "hidden",
832
- display: w ? "none" : "block"
833
- },
834
- children: !w && /* @__PURE__ */ t.jsxs(
835
- W,
836
- {
837
- orthographic: !0,
838
- camera: {
839
- position: [3, 2, 3],
840
- zoom: 1
841
- },
842
- shadows: !0,
843
- frameloop: "demand",
844
- style: {
845
- borderRadius: i.shape.borderRadius,
846
- width: "100%",
847
- height: "100%",
848
- background: "transparent",
849
- position: "absolute"
850
- },
851
- dpr: [1, 2],
852
- gl: { alpha: !0, antialias: !0 },
853
- children: [
854
- /* @__PURE__ */ t.jsx(N, {}),
855
- /* @__PURE__ */ t.jsx($, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
856
- p,
857
- {
858
- connectedMotionGroup: a,
859
- postModelRender: A
860
- }
861
- ) })
862
- ]
863
- }
864
- )
865
- }
866
- ),
867
- /* @__PURE__ */ t.jsxs(y, { children: [
868
- !D && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
869
- /* @__PURE__ */ t.jsx(d, {}),
870
- /* @__PURE__ */ t.jsx(
871
- H,
872
- {
873
- sx: {
874
- mt: 1,
875
- mb: 0,
876
- borderColor: i.palette.divider,
877
- opacity: 0.5
878
- }
879
- }
880
- )
881
- ] }),
882
- /* @__PURE__ */ t.jsx(
883
- y,
884
- {
885
- sx: {
886
- display: "flex",
887
- justifyContent: "flex-start",
888
- mt: !D && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
889
- mb: { xs: 0.5, sm: 0.75, md: 1 }
890
- },
891
- children: /* @__PURE__ */ t.jsx(
892
- J,
893
- {
894
- ref: g,
895
- variant: "contained",
896
- color: "secondary",
897
- size: "small",
898
- disabled: !o,
899
- onMouseDown: C,
900
- onMouseUp: S,
901
- onMouseLeave: k,
902
- onTouchStart: C,
903
- onTouchEnd: S,
904
- sx: {
905
- textTransform: "none",
906
- px: 1.5,
907
- py: 0.5
908
- },
909
- children: c("RobotCard.DriveToHome.bt")
910
- }
911
- )
912
- }
913
- )
914
- ] })
915
- ]
916
- }
917
- ) })
918
- }
919
- );
920
- }
921
- )
922
- ), tt = Array(6).fill(2 * Math.PI), K = {
923
- [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
924
- [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
925
- [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
926
- [j.Kuka]: [
927
- 0,
928
- -Math.PI / 2,
929
- Math.PI / 2,
930
- 0,
931
- Math.PI / 2,
932
- 0,
933
- 0
934
- ],
935
- [j.Universalrobots]: [
936
- 0,
937
- -Math.PI / 2,
938
- -Math.PI / 2,
939
- -Math.PI / 2,
940
- Math.PI / 2,
941
- -Math.PI / 2,
942
- 0
943
- ]
944
- };
945
- function Oe(e) {
946
- const [n] = e.split("_");
947
- switch (n) {
948
- case "ABB":
949
- return j.Abb;
950
- case "FANUC":
951
- return j.Fanuc;
952
- case "YASKAWA":
953
- return j.Yaskawa;
954
- case "KUKA":
955
- return j.Kuka;
956
- case "UniversalRobots":
957
- return j.Universalrobots;
958
- default:
959
- return null;
960
- }
961
- }
962
- function rt(e, n) {
963
- const r = Oe(e);
964
- return r && r in K ? K[r] : n || null;
965
- }
966
- export {
967
- Xe as C,
968
- K as M,
969
- N as P,
970
- et as R,
971
- Ze as S,
972
- Qe as T,
973
- tt as a,
974
- Pe as b,
975
- ze as c,
976
- Q as d,
977
- Oe as e,
978
- rt as g
979
- };
980
- //# sourceMappingURL=manufacturerHomePositions-BW0KbWeg.js.map