@wandelbots/wandelbots-js-react-components 3.4.0-pr.feat-add-yaskawa-gp200s.438.0503e4b → 3.4.0-pr.feat-yaskawa-gp200s.437.1b5737e

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 (165) hide show
  1. package/README.md +61 -10
  2. package/dist/3d.cjs.js +2 -0
  3. package/dist/3d.cjs.js.map +1 -0
  4. package/dist/3d.d.ts +11 -0
  5. package/dist/3d.d.ts.map +1 -0
  6. package/dist/3d.es.js +16 -0
  7. package/dist/3d.es.js.map +1 -0
  8. package/dist/LoadingCover-Dr9hDTku.js +87 -0
  9. package/dist/LoadingCover-Dr9hDTku.js.map +1 -0
  10. package/dist/LoadingCover-r2yhJZF9.cjs +2 -0
  11. package/dist/LoadingCover-r2yhJZF9.cjs.map +1 -0
  12. package/dist/WandelscriptEditor-Dj7TBCkF.cjs +2 -0
  13. package/dist/WandelscriptEditor-Dj7TBCkF.cjs.map +1 -0
  14. package/dist/WandelscriptEditor-DnJvITTA.js +140 -0
  15. package/dist/WandelscriptEditor-DnJvITTA.js.map +1 -0
  16. package/dist/auth0-spa-js.production.esm-9WdmjTxR.js +1429 -0
  17. package/dist/auth0-spa-js.production.esm-9WdmjTxR.js.map +1 -0
  18. package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs +5 -0
  19. package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs.map +1 -0
  20. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
  21. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
  22. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
  23. package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
  24. package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
  25. package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
  26. package/dist/components/3d-viewport/collider/ColliderElement.d.ts.map +1 -1
  27. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +1 -1
  28. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts.map +1 -1
  29. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
  30. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts.map +1 -1
  31. package/dist/components/ProgramStateIndicator.d.ts +3 -3
  32. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  33. package/dist/components/RobotCard.d.ts +4 -3
  34. package/dist/components/RobotCard.d.ts.map +1 -1
  35. package/dist/components/jogging/JoggingBlocked.d.ts +7 -0
  36. package/dist/components/jogging/JoggingBlocked.d.ts.map +1 -0
  37. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  38. package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
  39. package/dist/components/jogging/JoggingPanel.d.ts +1 -1
  40. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  41. package/dist/components/jogging/JoggingStore.d.ts +10 -5
  42. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  43. package/dist/components/jogging/PoseCartesianValues.d.ts +2 -2
  44. package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
  45. package/dist/components/jogging/PoseJointValues.d.ts +1 -2
  46. package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
  47. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  48. package/dist/components/robots/Robot.d.ts +1 -1
  49. package/dist/components/robots/Robot.d.ts.map +1 -1
  50. package/dist/components/robots/RobotAnimator.d.ts +2 -2
  51. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  52. package/dist/components/robots/SupportedRobot.d.ts +3 -3
  53. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  54. package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
  55. package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -1
  56. package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
  57. package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
  58. package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
  59. package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
  60. package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
  61. package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
  62. package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
  63. package/dist/components/utils/errorHandling.d.ts.map +1 -1
  64. package/dist/components/utils/errorHandling.test.d.ts +2 -0
  65. package/dist/components/utils/errorHandling.test.d.ts.map +1 -0
  66. package/dist/core.cjs.js +2 -0
  67. package/dist/core.cjs.js.map +1 -0
  68. package/dist/core.d.ts +33 -0
  69. package/dist/core.d.ts.map +1 -0
  70. package/dist/core.es.js +54 -0
  71. package/dist/core.es.js.map +1 -0
  72. package/dist/index-CAib4NKw.js +2261 -0
  73. package/dist/index-CAib4NKw.js.map +1 -0
  74. package/dist/index-CqMZL0FV.cjs +2 -0
  75. package/dist/index-CqMZL0FV.cjs.map +1 -0
  76. package/dist/index-CxasuX80.js +5212 -0
  77. package/dist/index-CxasuX80.js.map +1 -0
  78. package/dist/index-DxwppshT.cjs +29 -0
  79. package/dist/index-DxwppshT.cjs.map +1 -0
  80. package/dist/index.cjs.js +2 -0
  81. package/dist/index.cjs.js.map +1 -0
  82. package/dist/index.d.ts +3 -39
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.es.js +69 -0
  85. package/dist/index.es.js.map +1 -0
  86. package/dist/lib/ConnectedMotionGroup.d.ts +90 -0
  87. package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -0
  88. package/dist/lib/JoggerConnection.d.ts +113 -0
  89. package/dist/lib/JoggerConnection.d.ts.map +1 -0
  90. package/dist/lib/JoggerConnection.test.d.ts +2 -0
  91. package/dist/lib/JoggerConnection.test.d.ts.map +1 -0
  92. package/dist/lib/MotionStreamConnection.d.ts +24 -0
  93. package/dist/lib/MotionStreamConnection.d.ts.map +1 -0
  94. package/dist/lib/MotionStreamConnection.test.d.ts +2 -0
  95. package/dist/lib/MotionStreamConnection.test.d.ts.map +1 -0
  96. package/dist/lib/motionStateUpdate.d.ts +7 -0
  97. package/dist/lib/motionStateUpdate.d.ts.map +1 -0
  98. package/dist/lib/motionStateUpdate.test.d.ts +2 -0
  99. package/dist/lib/motionStateUpdate.test.d.ts.map +1 -0
  100. package/dist/manufacturerHomePositions-Ca80ycLi.cjs +2 -0
  101. package/dist/manufacturerHomePositions-Ca80ycLi.cjs.map +1 -0
  102. package/dist/manufacturerHomePositions-CgaG5vaK.js +976 -0
  103. package/dist/manufacturerHomePositions-CgaG5vaK.js.map +1 -0
  104. package/dist/theming-BQcKj8Gp.cjs +133 -0
  105. package/dist/theming-BQcKj8Gp.cjs.map +1 -0
  106. package/dist/theming-Bafjg0Wg.js +23460 -0
  107. package/dist/theming-Bafjg0Wg.js.map +1 -0
  108. package/dist/wandelscript.cjs.js +2 -0
  109. package/dist/wandelscript.cjs.js.map +1 -0
  110. package/dist/wandelscript.d.ts +2 -0
  111. package/dist/wandelscript.d.ts.map +1 -0
  112. package/dist/wandelscript.es.js +5 -0
  113. package/dist/wandelscript.es.js.map +1 -0
  114. package/package.json +49 -21
  115. package/src/3d.ts +15 -0
  116. package/src/components/3d-viewport/CoordinateSystemTransform.tsx +1 -1
  117. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +1 -2
  118. package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
  119. package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
  120. package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +1 -1
  121. package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
  122. package/src/components/AppHeader.md +1 -1
  123. package/src/components/ProgramStateIndicator.tsx +3 -6
  124. package/src/components/RobotCard.tsx +4 -7
  125. package/src/components/jogging/JoggingBlocked.tsx +37 -0
  126. package/src/components/jogging/JoggingCartesianTab.tsx +13 -11
  127. package/src/components/jogging/JoggingJointLimitDetector.tsx +2 -2
  128. package/src/components/jogging/JoggingJointTab.tsx +4 -4
  129. package/src/components/jogging/JoggingOptions.tsx +6 -5
  130. package/src/components/jogging/JoggingPanel.tsx +6 -3
  131. package/src/components/jogging/JoggingStore.ts +66 -39
  132. package/src/components/jogging/PoseCartesianValues.tsx +3 -4
  133. package/src/components/jogging/PoseJointValues.tsx +3 -4
  134. package/src/components/robots/DHRobot.tsx +2 -3
  135. package/src/components/robots/Robot.tsx +1 -1
  136. package/src/components/robots/RobotAnimator.test.tsx +7 -22
  137. package/src/components/robots/RobotAnimator.tsx +8 -13
  138. package/src/components/robots/SupportedRobot.tsx +3 -6
  139. package/src/components/robots/manufacturerHomePositions.ts +1 -1
  140. package/src/components/safetyBar/ControllerTypeIndicator.tsx +4 -2
  141. package/src/components/safetyBar/OperationModeIndicator.tsx +7 -5
  142. package/src/components/safetyBar/SafetyBar.tsx +3 -6
  143. package/src/components/safetyBar/SafetyStateIndicator.tsx +9 -7
  144. package/src/components/utils/errorHandling.test.ts +41 -0
  145. package/src/components/utils/errorHandling.ts +4 -0
  146. package/src/core.ts +33 -0
  147. package/src/i18n/locales/de/translations.json +3 -0
  148. package/src/i18n/locales/en/translations.json +3 -0
  149. package/src/index.ts +4 -43
  150. package/src/lib/ConnectedMotionGroup.ts +444 -0
  151. package/src/lib/JoggerConnection.test.ts +120 -0
  152. package/src/lib/JoggerConnection.ts +674 -0
  153. package/src/lib/MotionStreamConnection.test.ts +23 -0
  154. package/src/lib/MotionStreamConnection.ts +189 -0
  155. package/src/lib/motionStateUpdate.test.ts +28 -0
  156. package/src/lib/motionStateUpdate.ts +117 -0
  157. package/src/wandelscript.ts +2 -0
  158. package/dist/auth0-spa-js.production.esm-1QXzndwB.js +0 -950
  159. package/dist/auth0-spa-js.production.esm-1QXzndwB.js.map +0 -1
  160. package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs +0 -5
  161. package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs.map +0 -1
  162. package/dist/index.cjs +0 -155
  163. package/dist/index.cjs.map +0 -1
  164. package/dist/index.js +0 -34927
  165. package/dist/index.js.map +0 -1
@@ -0,0 +1,976 @@
1
+ import { j as t, e as q } from "./index-CAib4NKw.js";
2
+ import * as d 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 U } from "@mui/material";
8
+ import { observer as he } from "mobx-react-lite";
9
+ import me, { useRef as R, useEffect as T, useCallback as _, useState as C, Suspense as pe } from "react";
10
+ import { useTranslation as xe } from "react-i18next";
11
+ import { V as ge, c as ye, b as J, 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 d.Vector3(
19
+ r[0] / 1e3,
20
+ r[1] / 1e3,
21
+ r[2] / 1e3
22
+ )
23
+ )
24
+ );
25
+ case "box":
26
+ return new d.BoxGeometry(
27
+ e.size_x / 1e3,
28
+ e.size_y / 1e3,
29
+ e.size_z / 1e3
30
+ );
31
+ case "sphere":
32
+ return new d.SphereGeometry(e.radius / 1e3);
33
+ case "capsule":
34
+ return new d.CapsuleGeometry(
35
+ e.radius / 1e3,
36
+ e.cylinder_height / 1e3
37
+ );
38
+ case "cylinder":
39
+ return new d.CylinderGeometry(
40
+ e.radius / 1e3,
41
+ e.radius / 1e3,
42
+ e.height / 1e3
43
+ );
44
+ case "rectangle":
45
+ return new d.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
46
+ default:
47
+ return console.warn(`${e.shape_type} is not supported`), new d.BufferGeometry();
48
+ }
49
+ }
50
+ function be({
51
+ name: e,
52
+ collider: n,
53
+ children: r
54
+ }) {
55
+ var u, l;
56
+ const s = ((u = n.pose) == null ? void 0 : u.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 d.Vector3(
62
+ s[0],
63
+ s[1],
64
+ s[2]
65
+ ).divideScalar(1e3),
66
+ rotation: new d.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, u]) => /* @__PURE__ */ t.jsx(
79
+ be,
80
+ {
81
+ name: o,
82
+ collider: u,
83
+ children: r(o, u)
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 d.Vector3(e[0].x, e[0].y, e[0].z), r = new d.Vector3(e[1].x, e[1].y, e[1].z), s = new d.Vector3(e[2].x, e[2].y, e[2].z), o = new d.Vector3().subVectors(r, n), u = new d.Vector3().subVectors(s, n), l = new d.Vector3().crossVectors(o, u).normalize();
179
+ for (let a = 3; a < e.length; a++) {
180
+ const p = new d.Vector3(e[a].x, e[a].y, e[a].z), h = new d.Vector3().subVectors(p, n), f = l.dot(h);
181
+ if (Math.abs(f) > 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((u, l) => {
193
+ if (!u.convex_hull) return null;
194
+ const a = u.convex_hull.vertices.map(
195
+ (f) => new d.Vector3(f.x / 1e3, f.y / 1e3, f.z / 1e3)
196
+ ), p = Re(a);
197
+ if (p.isCoplanar && p.normal) {
198
+ const i = new d.Vector3().addVectors(
199
+ a[0],
200
+ p.normal.multiplyScalar(1e-4)
201
+ );
202
+ a.push(i);
203
+ }
204
+ let h;
205
+ try {
206
+ h = new X(a);
207
+ } catch (f) {
208
+ return console.log("Error creating ConvexGeometry:", f), null;
209
+ }
210
+ return /* @__PURE__ */ t.jsx("mesh", { geometry: h, 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 d.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 = R([]), u = R([]), l = R(null), { invalidate: a } = ae();
290
+ T(() => {
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
+ f(), m || a();
308
+ }
309
+ });
310
+ function p(i) {
311
+ i && (u.current = _e(i), f(), a());
312
+ }
313
+ function h(i) {
314
+ var c;
315
+ o.current = i, (c = l.current) == null || c.setTarget(i);
316
+ }
317
+ function f() {
318
+ var c;
319
+ const i = ((c = l.current) == null ? void 0 : c.getCurrentValues()) || [];
320
+ if (r)
321
+ r(u.current, i);
322
+ else
323
+ for (const [m, x] of u.current.entries()) {
324
+ const g = n[m], b = g.theta || 0, M = g.reverse_rotation_direction ? -1 : 1;
325
+ x.rotation.y = M * (i[m] || 0) + b;
326
+ }
327
+ }
328
+ return ye(() => {
329
+ const i = e.joint_position.filter(
330
+ (c) => c !== void 0
331
+ );
332
+ requestAnimationFrame(() => h(i));
333
+ }), /* @__PURE__ */ t.jsx("group", { ref: p, children: s });
334
+ }
335
+ const Ce = "line", Fe = "mesh";
336
+ function Ie({
337
+ rapidlyChangingMotionState: e,
338
+ dhParameters: n,
339
+ ...r
340
+ }) {
341
+ const s = new G(), o = R([]), u = R([]);
342
+ me.useEffect(() => {
343
+ o.current = new Array(n.length).fill(null), u.current = new Array(n.length).fill(null);
344
+ }, [n.length]);
345
+ function l(h, f) {
346
+ const i = new L(), c = new ie(), m = new L();
347
+ s.decompose(i, c, m);
348
+ const x = i.clone(), g = new G().makeRotationY(
349
+ h.theta + f * (h.reverse_rotation_direction ? -1 : 1)
350
+ ).multiply(new G().makeTranslation(0, h.d / 1e3, 0)).multiply(new G().makeTranslation(h.a / 1e3, 0, 0)).multiply(new G().makeRotationX(h.alpha));
351
+ return s.multiply(g), s.decompose(i, c, m), { a: x, b: i };
352
+ }
353
+ function a(h, f, i, c) {
354
+ if (!n)
355
+ return;
356
+ const m = n[h];
357
+ if (!m)
358
+ return;
359
+ const { a: x, b: g } = l(m, c);
360
+ f.geometry.setPositions([x.toArray(), g.toArray()].flat()), i.position.set(g.x, g.y, g.z);
361
+ }
362
+ function p(h, f) {
363
+ s.identity();
364
+ for (let i = 0; i < Math.min(h.length, f.length); i++) {
365
+ const c = o.current[i], m = u.current[i];
366
+ c && m && a(i, c, m, f[i]);
367
+ }
368
+ }
369
+ return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
370
+ re,
371
+ {
372
+ rapidlyChangingMotionState: e,
373
+ dhParameters: n,
374
+ onRotationChanged: p,
375
+ children: /* @__PURE__ */ t.jsxs("group", { ...r, name: "Scene", children: [
376
+ /* @__PURE__ */ t.jsxs("mesh", { children: [
377
+ /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
378
+ /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
379
+ ] }),
380
+ n.map((h, f) => {
381
+ const { a: i, b: c } = l(
382
+ h,
383
+ e.joint_position[f] ?? 0
384
+ ), m = `dhrobot_J0${f}`;
385
+ return /* @__PURE__ */ t.jsxs("group", { name: m, children: [
386
+ /* @__PURE__ */ t.jsx(
387
+ Z,
388
+ {
389
+ ref: (x) => {
390
+ o.current[f] = x;
391
+ },
392
+ name: Ce,
393
+ points: [i, c],
394
+ color: "white",
395
+ lineWidth: 5
396
+ }
397
+ ),
398
+ /* @__PURE__ */ t.jsxs(
399
+ "mesh",
400
+ {
401
+ ref: (x) => {
402
+ u.current[f] = x;
403
+ },
404
+ name: Fe,
405
+ position: c,
406
+ children: [
407
+ /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
408
+ /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
409
+ ]
410
+ },
411
+ "mesh_" + f
412
+ )
413
+ ] }, m);
414
+ })
415
+ ] })
416
+ }
417
+ ) });
418
+ }
419
+ const Se = console.warn;
420
+ function Ve() {
421
+ return T(() => {
422
+ console.warn = (e) => {
423
+ e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Se(e);
424
+ };
425
+ }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
426
+ }
427
+ function De(e) {
428
+ return e.type === "Mesh";
429
+ }
430
+ function Te({
431
+ modelURL: e,
432
+ flangeRef: n,
433
+ postModelRender: r,
434
+ ...s
435
+ }) {
436
+ const { gltf: o } = Ge(
437
+ ue(e),
438
+ e.split("/").pop() || e
439
+ ), u = _(
440
+ (a) => {
441
+ a && r && r();
442
+ },
443
+ [e]
444
+ );
445
+ function l(a) {
446
+ return De(a) ? /* @__PURE__ */ t.jsx(
447
+ "mesh",
448
+ {
449
+ name: a.name,
450
+ geometry: a.geometry,
451
+ material: a.material,
452
+ position: a.position,
453
+ rotation: a.rotation
454
+ },
455
+ a.uuid
456
+ ) : /* @__PURE__ */ t.jsx(
457
+ "group",
458
+ {
459
+ name: a.name,
460
+ position: a.position,
461
+ rotation: a.rotation,
462
+ ref: ee(a) ? n : void 0,
463
+ children: a.children.map(l)
464
+ },
465
+ a.uuid
466
+ );
467
+ }
468
+ return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: u, children: l(o.scene) });
469
+ }
470
+ const Ae = (e, n) => {
471
+ e.userData.isGhost || (e.traverse((r) => {
472
+ if (r instanceof d.Mesh) {
473
+ r.material instanceof d.Material && (r.material.colorWrite = !1);
474
+ const s = r.clone(), o = r.clone();
475
+ s.material = new d.MeshStandardMaterial({
476
+ depthTest: !0,
477
+ depthWrite: !0,
478
+ colorWrite: !1,
479
+ polygonOffset: !0,
480
+ polygonOffsetFactor: -1,
481
+ side: d.DoubleSide
482
+ }), s.userData.isGhost = !0, o.material = new d.MeshStandardMaterial({
483
+ color: n,
484
+ opacity: 0.3,
485
+ depthTest: !0,
486
+ depthWrite: !1,
487
+ transparent: !0,
488
+ polygonOffset: !0,
489
+ polygonOffsetFactor: -2,
490
+ side: d.DoubleSide
491
+ }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
492
+ }
493
+ }), e.userData.isGhost = !0);
494
+ }, ke = (e) => {
495
+ if (!e.userData.isGhost) return;
496
+ const n = [];
497
+ e.traverse((r) => {
498
+ var s;
499
+ r instanceof d.Mesh && ((s = r.userData) != null && s.isGhost ? n.push(r) : r.material instanceof d.Material && (r.material.colorWrite = !0));
500
+ }), n.forEach((r) => {
501
+ r.parent && r.parent.remove(r);
502
+ }), e.userData.isGhost = !1;
503
+ }, ze = q(
504
+ ({
505
+ rapidlyChangingMotionState: e,
506
+ modelFromController: n,
507
+ dhParameters: r,
508
+ getModel: s = Q,
509
+ flangeRef: o,
510
+ postModelRender: u,
511
+ transparentColor: l,
512
+ ...a
513
+ }) => {
514
+ const [p, h] = C(null), f = _((c) => {
515
+ h(c);
516
+ }, []);
517
+ T(() => {
518
+ p && (l ? Ae(p, l) : ke(p));
519
+ }, [p, l]);
520
+ const i = /* @__PURE__ */ t.jsx(
521
+ Ie,
522
+ {
523
+ rapidlyChangingMotionState: e,
524
+ dhParameters: r,
525
+ ...a
526
+ }
527
+ );
528
+ return /* @__PURE__ */ t.jsxs(
529
+ je,
530
+ {
531
+ fallback: i,
532
+ onError: (c) => {
533
+ console.error(c);
534
+ },
535
+ children: [
536
+ /* @__PURE__ */ t.jsx(pe, { fallback: i, children: /* @__PURE__ */ t.jsx("group", { ref: f, children: /* @__PURE__ */ t.jsx(
537
+ re,
538
+ {
539
+ rapidlyChangingMotionState: e,
540
+ dhParameters: r,
541
+ children: /* @__PURE__ */ t.jsx(
542
+ Te,
543
+ {
544
+ modelURL: s(n),
545
+ postModelRender: u,
546
+ flangeRef: o,
547
+ ...a
548
+ }
549
+ )
550
+ }
551
+ ) }) }),
552
+ /* @__PURE__ */ t.jsx(Ve, {})
553
+ ]
554
+ }
555
+ );
556
+ }
557
+ );
558
+ function Pe({
559
+ connectedMotionGroup: e,
560
+ getModel: n = Q,
561
+ flangeRef: r,
562
+ transparentColor: s,
563
+ postModelRender: o,
564
+ ...u
565
+ }) {
566
+ return e.dhParameters ? /* @__PURE__ */ t.jsx(
567
+ ze,
568
+ {
569
+ rapidlyChangingMotionState: e.rapidlyChangingMotionState,
570
+ modelFromController: e.modelFromController || "",
571
+ dhParameters: e.dhParameters,
572
+ getModel: n,
573
+ flangeRef: r,
574
+ transparentColor: s,
575
+ postModelRender: o,
576
+ ...u
577
+ }
578
+ ) : null;
579
+ }
580
+ const et = q(
581
+ he(
582
+ ({
583
+ robotName: e,
584
+ programState: n,
585
+ safetyState: r,
586
+ operationMode: s,
587
+ driveToHomeEnabled: o = !1,
588
+ onDriveToHomePress: u,
589
+ onDriveToHomeRelease: l,
590
+ connectedMotionGroup: a,
591
+ robotComponent: p = Pe,
592
+ customContentComponent: h,
593
+ className: f
594
+ }) => {
595
+ var z;
596
+ const i = fe(), { t: c } = xe(), [m, x] = C(!1), g = R(null), b = R(null), [M, ne] = C(!1), [F, oe] = C({ width: 400, height: 600 }), [Ee, se] = C(0);
597
+ T(() => {
598
+ const D = () => {
599
+ if (b.current) {
600
+ const { offsetWidth: O, offsetHeight: E } = b.current;
601
+ ne(O > E), oe({ width: O, height: E });
602
+ }
603
+ };
604
+ D();
605
+ const P = new ResizeObserver(D);
606
+ return b.current && P.observe(b.current), () => {
607
+ P.disconnect();
608
+ };
609
+ }, []);
610
+ const A = _(() => {
611
+ se((D) => D + 1);
612
+ }, []), I = _(() => {
613
+ !o || !u || (x(!0), u());
614
+ }, [o, u]), S = _(() => {
615
+ !o || !l || (x(!1), l());
616
+ }, [o, l]), k = _(() => {
617
+ m && l && (x(!1), l());
618
+ }, [m, l]), w = M ? F.width < 350 : F.height < 200, V = M ? F.height < 310 : F.height < 450;
619
+ return /* @__PURE__ */ t.jsx(
620
+ de,
621
+ {
622
+ ref: b,
623
+ className: f,
624
+ sx: {
625
+ width: "100%",
626
+ height: "100%",
627
+ display: "flex",
628
+ flexDirection: M ? "row" : "column",
629
+ position: "relative",
630
+ overflow: "hidden",
631
+ minWidth: { xs: 180, sm: 220, md: 250 },
632
+ minHeight: M ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
633
+ // Allow progressive hiding in portrait mode
634
+ border: `1px solid ${i.palette.divider}`,
635
+ borderRadius: "18px",
636
+ boxShadow: "none",
637
+ backgroundColor: ((z = i.palette.backgroundPaperElevation) == null ? void 0 : z[8]) || "#2A2A3F",
638
+ backgroundImage: "none"
639
+ // Override any gradient from elevation
640
+ },
641
+ children: M ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
642
+ /* @__PURE__ */ t.jsx(
643
+ y,
644
+ {
645
+ sx: {
646
+ flex: "0 0 50%",
647
+ position: "relative",
648
+ height: "100%",
649
+ minHeight: "100%",
650
+ maxHeight: "100%",
651
+ borderRadius: 1,
652
+ m: { xs: 1.5, sm: 2, md: 3 },
653
+ mr: { xs: 0.75, sm: 1, md: 1.5 },
654
+ overflow: "hidden",
655
+ // Prevent content from affecting container size
656
+ display: w ? "none" : "block"
657
+ },
658
+ children: !w && /* @__PURE__ */ t.jsxs(
659
+ W,
660
+ {
661
+ orthographic: !0,
662
+ camera: {
663
+ position: [3, 2, 3],
664
+ zoom: 1
665
+ },
666
+ shadows: !0,
667
+ frameloop: "demand",
668
+ style: {
669
+ borderRadius: i.shape.borderRadius,
670
+ width: "100%",
671
+ height: "100%",
672
+ background: "transparent",
673
+ position: "absolute",
674
+ top: 0,
675
+ left: 0
676
+ },
677
+ dpr: [1, 2],
678
+ gl: { alpha: !0, antialias: !0 },
679
+ children: [
680
+ /* @__PURE__ */ t.jsx(N, {}),
681
+ /* @__PURE__ */ t.jsx($, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
682
+ p,
683
+ {
684
+ connectedMotionGroup: a,
685
+ postModelRender: A
686
+ }
687
+ ) })
688
+ ]
689
+ }
690
+ )
691
+ }
692
+ ),
693
+ /* @__PURE__ */ t.jsxs(
694
+ y,
695
+ {
696
+ sx: {
697
+ flex: "1",
698
+ display: "flex",
699
+ flexDirection: "column",
700
+ justifyContent: "flex-start",
701
+ width: w ? "100%" : "50%"
702
+ },
703
+ children: [
704
+ /* @__PURE__ */ t.jsxs(
705
+ y,
706
+ {
707
+ sx: {
708
+ p: { xs: 1.5, sm: 2, md: 3 },
709
+ pb: { xs: 1, sm: 1.5, md: 2 },
710
+ textAlign: "left"
711
+ },
712
+ children: [
713
+ /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
714
+ /* @__PURE__ */ t.jsx(
715
+ J,
716
+ {
717
+ programState: n,
718
+ safetyState: r,
719
+ operationMode: s
720
+ }
721
+ )
722
+ ]
723
+ }
724
+ ),
725
+ /* @__PURE__ */ t.jsxs(
726
+ y,
727
+ {
728
+ sx: {
729
+ p: { xs: 1.5, sm: 2, md: 3 },
730
+ pt: 0,
731
+ flex: "1",
732
+ display: "flex",
733
+ flexDirection: "column",
734
+ justifyContent: "space-between"
735
+ },
736
+ children: [
737
+ !V && h && /* @__PURE__ */ t.jsxs(y, { children: [
738
+ /* @__PURE__ */ t.jsx(h, {}),
739
+ /* @__PURE__ */ t.jsx(
740
+ H,
741
+ {
742
+ sx: {
743
+ mt: 1,
744
+ mb: 0,
745
+ borderColor: i.palette.divider,
746
+ opacity: 0.5
747
+ }
748
+ }
749
+ )
750
+ ] }),
751
+ /* @__PURE__ */ t.jsx(
752
+ y,
753
+ {
754
+ sx: {
755
+ mt: !V && h ? "auto" : 0
756
+ },
757
+ children: /* @__PURE__ */ t.jsx(
758
+ y,
759
+ {
760
+ sx: {
761
+ display: "flex",
762
+ justifyContent: "flex-start",
763
+ mt: { xs: 1, sm: 1.5, md: 2 },
764
+ mb: { xs: 0.5, sm: 0.75, md: 1 }
765
+ },
766
+ children: /* @__PURE__ */ t.jsx(
767
+ U,
768
+ {
769
+ ref: g,
770
+ variant: "contained",
771
+ color: "secondary",
772
+ size: "small",
773
+ disabled: !o,
774
+ onMouseDown: I,
775
+ onMouseUp: S,
776
+ onMouseLeave: k,
777
+ onTouchStart: I,
778
+ onTouchEnd: S,
779
+ sx: {
780
+ textTransform: "none",
781
+ px: 1.5,
782
+ py: 0.5
783
+ },
784
+ children: c("RobotCard.DriveToHome.bt")
785
+ }
786
+ )
787
+ }
788
+ )
789
+ }
790
+ )
791
+ ]
792
+ }
793
+ )
794
+ ]
795
+ }
796
+ )
797
+ ] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
798
+ y,
799
+ {
800
+ sx: {
801
+ p: 3,
802
+ height: "100%",
803
+ display: "flex",
804
+ flexDirection: "column"
805
+ },
806
+ children: [
807
+ /* @__PURE__ */ t.jsxs(y, { children: [
808
+ /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
809
+ /* @__PURE__ */ t.jsx(
810
+ J,
811
+ {
812
+ programState: n,
813
+ safetyState: r,
814
+ operationMode: s
815
+ }
816
+ )
817
+ ] }),
818
+ /* @__PURE__ */ t.jsx(
819
+ y,
820
+ {
821
+ sx: {
822
+ flex: w ? 0 : 1,
823
+ position: "relative",
824
+ minHeight: w ? 0 : { xs: 120, sm: 150, md: 200 },
825
+ height: w ? 0 : "auto",
826
+ borderRadius: 1,
827
+ overflow: "hidden",
828
+ display: w ? "none" : "block"
829
+ },
830
+ children: !w && /* @__PURE__ */ t.jsxs(
831
+ W,
832
+ {
833
+ orthographic: !0,
834
+ camera: {
835
+ position: [3, 2, 3],
836
+ zoom: 1
837
+ },
838
+ shadows: !0,
839
+ frameloop: "demand",
840
+ style: {
841
+ borderRadius: i.shape.borderRadius,
842
+ width: "100%",
843
+ height: "100%",
844
+ background: "transparent",
845
+ position: "absolute"
846
+ },
847
+ dpr: [1, 2],
848
+ gl: { alpha: !0, antialias: !0 },
849
+ children: [
850
+ /* @__PURE__ */ t.jsx(N, {}),
851
+ /* @__PURE__ */ t.jsx($, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
852
+ p,
853
+ {
854
+ connectedMotionGroup: a,
855
+ postModelRender: A
856
+ }
857
+ ) })
858
+ ]
859
+ }
860
+ )
861
+ }
862
+ ),
863
+ /* @__PURE__ */ t.jsxs(y, { children: [
864
+ !V && h && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
865
+ /* @__PURE__ */ t.jsx(h, {}),
866
+ /* @__PURE__ */ t.jsx(
867
+ H,
868
+ {
869
+ sx: {
870
+ mt: 1,
871
+ mb: 0,
872
+ borderColor: i.palette.divider,
873
+ opacity: 0.5
874
+ }
875
+ }
876
+ )
877
+ ] }),
878
+ /* @__PURE__ */ t.jsx(
879
+ y,
880
+ {
881
+ sx: {
882
+ display: "flex",
883
+ justifyContent: "flex-start",
884
+ mt: !V && h ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
885
+ mb: { xs: 0.5, sm: 0.75, md: 1 }
886
+ },
887
+ children: /* @__PURE__ */ t.jsx(
888
+ U,
889
+ {
890
+ ref: g,
891
+ variant: "contained",
892
+ color: "secondary",
893
+ size: "small",
894
+ disabled: !o,
895
+ onMouseDown: I,
896
+ onMouseUp: S,
897
+ onMouseLeave: k,
898
+ onTouchStart: I,
899
+ onTouchEnd: S,
900
+ sx: {
901
+ textTransform: "none",
902
+ px: 1.5,
903
+ py: 0.5
904
+ },
905
+ children: c("RobotCard.DriveToHome.bt")
906
+ }
907
+ )
908
+ }
909
+ )
910
+ ] })
911
+ ]
912
+ }
913
+ ) })
914
+ }
915
+ );
916
+ }
917
+ )
918
+ ), tt = Array(6).fill(2 * Math.PI), K = {
919
+ [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
920
+ [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
921
+ [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
922
+ [j.Kuka]: [
923
+ 0,
924
+ -Math.PI / 2,
925
+ Math.PI / 2,
926
+ 0,
927
+ Math.PI / 2,
928
+ 0,
929
+ 0
930
+ ],
931
+ [j.Universalrobots]: [
932
+ 0,
933
+ -Math.PI / 2,
934
+ -Math.PI / 2,
935
+ -Math.PI / 2,
936
+ Math.PI / 2,
937
+ -Math.PI / 2,
938
+ 0
939
+ ]
940
+ };
941
+ function Oe(e) {
942
+ const [n] = e.split("_");
943
+ switch (n) {
944
+ case "ABB":
945
+ return j.Abb;
946
+ case "FANUC":
947
+ return j.Fanuc;
948
+ case "YASKAWA":
949
+ return j.Yaskawa;
950
+ case "KUKA":
951
+ return j.Kuka;
952
+ case "UniversalRobots":
953
+ return j.Universalrobots;
954
+ default:
955
+ return null;
956
+ }
957
+ }
958
+ function rt(e, n) {
959
+ const r = Oe(e);
960
+ return r && r in K ? K[r] : n || null;
961
+ }
962
+ export {
963
+ Xe as C,
964
+ K as M,
965
+ N as P,
966
+ et as R,
967
+ Ze as S,
968
+ Qe as T,
969
+ tt as a,
970
+ Pe as b,
971
+ ze as c,
972
+ Q as d,
973
+ Oe as e,
974
+ rt as g
975
+ };
976
+ //# sourceMappingURL=manufacturerHomePositions-CgaG5vaK.js.map