import { j as t, e as K } from "./externalizeComponent-Dc3fViZA.js";
import * as m from "three";
import { Matrix4 as F, Vector3 as E, Quaternion as ie } from "three";
import { ConvexGeometry as X } from "three-stdlib";
import { useThree as ae, useFrame as le, Canvas as B } from "@react-three/fiber";
import { Environment as ce, Lightformer as R, Line as Z, useGLTF as ue, Bounds as W } from "@react-three/drei";
import { useTheme as fe, Card as de, Box as y, Typography as $, Divider as N, Button as H } from "@mui/material";
import { observer as he } from "mobx-react-lite";
import me, { useRef as _, useEffect as I, useCallback as v, useState as G, Suspense as pe } from "react";
import { useTranslation as xe } from "react-i18next";
import { N as ge, V as ye, c as je, b as J, M as j } from "./interpolation-DcPbemBD.js";
import { ErrorBoundary as we } from "react-error-boundary";
function be(e) {
  switch (e.shape_type) {
    case "convex_hull":
      return new X(
        e.vertices.map(
          (r) => new m.Vector3(
            r[0] / 1e3,
            r[1] / 1e3,
            r[2] / 1e3
          )
        )
      );
    case "box":
      return new m.BoxGeometry(
        e.size_x / 1e3,
        e.size_y / 1e3,
        e.size_z / 1e3
      );
    case "sphere":
      return new m.SphereGeometry(e.radius / 1e3);
    case "capsule":
      return new m.CapsuleGeometry(
        e.radius / 1e3,
        e.cylinder_height / 1e3
      );
    case "cylinder":
      return new m.CylinderGeometry(
        e.radius / 1e3,
        e.radius / 1e3,
        e.height / 1e3
      );
    case "rectangle":
      return new m.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
    default:
      return console.warn(`${e.shape_type} is not supported`), new m.BufferGeometry();
  }
}
function Me({
  name: e,
  collider: n,
  children: r
}) {
  var c, a;
  const s = ((c = n.pose) == null ? void 0 : c.position) ?? [0, 0, 0], o = ((a = n.pose) == null ? void 0 : a.orientation) ?? [0, 0, 0];
  return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
    "mesh",
    {
      name: e,
      position: new m.Vector3(
        s[0],
        s[1],
        s[2]
      ).divideScalar(1e3),
      rotation: new m.Euler(o[0], o[1], o[2], "XYZ"),
      geometry: be(n.shape),
      children: r
    }
  );
}
function Re({
  name: e,
  colliders: n,
  meshChildrenProvider: r,
  ...s
}) {
  return /* @__PURE__ */ t.jsx("group", { name: e, ...s, children: Object.entries(n).map(([o, c]) => /* @__PURE__ */ t.jsx(
    Me,
    {
      name: o,
      collider: c,
      children: r(o, c)
    },
    o
  )) });
}
function Qe({
  scene: e,
  meshChildrenProvider: n
}) {
  const r = e.colliders;
  return /* @__PURE__ */ t.jsx("group", { children: r && /* @__PURE__ */ t.jsx(
    Re,
    {
      meshChildrenProvider: n,
      colliders: r
    }
  ) });
}
function Y() {
  return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(ve, {}) });
}
function ve({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
    /* @__PURE__ */ t.jsx(
      R,
      {
        intensity: 5,
        "rotation-x": Math.PI / 2,
        position: [0, 5, -9],
        scale: [10, 10, 1]
      }
    ),
    /* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((n, r) => /* @__PURE__ */ t.jsx(
      R,
      {
        form: "circle",
        intensity: 5,
        rotation: [Math.PI / 2, 0, 0],
        position: [n, 4, r * 4],
        scale: [3, 1, 1]
      },
      r
    )) }) }),
    /* @__PURE__ */ t.jsx(
      R,
      {
        intensity: 40,
        "rotation-y": Math.PI / 2,
        position: [-5, 1, -1],
        scale: [20, 0.1, 1]
      }
    ),
    /* @__PURE__ */ t.jsx(
      R,
      {
        intensity: 20,
        "rotation-y": -Math.PI,
        position: [-5, -2, -1],
        scale: [20, 0.1, 1]
      }
    ),
    /* @__PURE__ */ t.jsx(
      R,
      {
        "rotation-y": Math.PI / 2,
        position: [-5, -1, -1],
        scale: [20, 0.5, 1],
        intensity: 5
      }
    ),
    /* @__PURE__ */ t.jsx(
      R,
      {
        "rotation-y": -Math.PI / 2,
        position: [10, 1, 0],
        scale: [20, 1, 1],
        intensity: 10
      }
    ),
    /* @__PURE__ */ t.jsx(
      R,
      {
        form: "ring",
        color: "white",
        intensity: 5,
        scale: 10,
        position: [-15, 4, -18],
        target: [0, 0, 0]
      }
    )
  ] });
}
function _e(e) {
  if (e.length < 3)
    return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
  const n = new m.Vector3(e[0].x, e[0].y, e[0].z), r = new m.Vector3(e[1].x, e[1].y, e[1].z), s = new m.Vector3(e[2].x, e[2].y, e[2].z), o = new m.Vector3().subVectors(r, n), c = new m.Vector3().subVectors(s, n), a = new m.Vector3().crossVectors(o, c).normalize();
  for (let f = 3; f < e.length; f++) {
    const i = new m.Vector3(e[f].x, e[f].y, e[f].z), d = new m.Vector3().subVectors(i, n), h = a.dot(d);
    if (Math.abs(h) > 1e-6)
      return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
  }
  return { isCoplanar: !0, normal: a };
}
function et({
  safetyZones: e,
  ...n
}) {
  return /* @__PURE__ */ t.jsx("group", { ...n, children: e.map((r, s) => {
    let o = [];
    return r.geometry && (r.geometry.compound ? o = r.geometry.compound.child_geometries : r.geometry.convex_hull && (o = [r.geometry])), o.map((c, a) => {
      if (!c.convex_hull) return null;
      const f = c.convex_hull.vertices.map(
        (h) => new m.Vector3(h.x / 1e3, h.y / 1e3, h.z / 1e3)
      ), i = _e(f);
      if (i.isCoplanar && i.normal) {
        const l = new m.Vector3().addVectors(
          f[0],
          i.normal.multiplyScalar(1e-4)
        );
        f.push(l);
      }
      let d;
      try {
        d = new X(f);
      } catch (h) {
        return console.log("Error creating ConvexGeometry:", h), null;
      }
      return /* @__PURE__ */ t.jsx("mesh", { geometry: d, children: /* @__PURE__ */ t.jsx(
        "meshStandardMaterial",
        {
          attach: "material",
          color: "#009f4d",
          opacity: 0.2,
          depthTest: !1,
          depthWrite: !1,
          transparent: !0,
          polygonOffset: !0,
          polygonOffsetFactor: -a
        },
        s
      ) }, `${s}-${a}`);
    });
  }) });
}
function tt({
  trajectory: e,
  ...n
}) {
  var s;
  const r = ((s = e.trajectory) == null ? void 0 : s.map((o) => o.tcp_pose ? new m.Vector3(
    o.tcp_pose.position.x / 1e3,
    o.tcp_pose.position.z / 1e3,
    -o.tcp_pose.position.y / 1e3
  ) : null).filter((o) => o !== null)) || [];
  return /* @__PURE__ */ t.jsx("group", { ...n, children: r.length > 0 && /* @__PURE__ */ t.jsx(
    Z,
    {
      points: r,
      lineWidth: 3,
      polygonOffset: !0,
      polygonOffsetFactor: 10,
      polygonOffsetUnits: 10
    }
  ) });
}
const D = /* @__PURE__ */ new Map();
async function Q(e) {
  if (D.has(e))
    return D.get(e);
  const n = (async () => {
    var c;
    const s = new ge({ instanceUrl: "" }), o = s.api.motionGroupModels;
    (c = o.axios) != null && c.interceptors && o.axios.interceptors.request.use((a) => {
      var f;
      return (f = a.url) != null && f.includes("/glb") && (a.responseType = "blob"), a;
    });
    try {
      const a = await s.api.motionGroupModels.getMotionGroupGlbModel(e);
      return URL.createObjectURL(a);
    } catch (a) {
      throw console.error("Failed to fetch model:", a), a;
    }
  })();
  return D.set(e, n), n;
}
function Ge(e) {
  function n(r) {
    return r.children.length === 0 ? [r] : [r, ...r.children.flatMap((s) => n(s))];
  }
  return n(e).filter((r) => te(r));
}
function ee(e) {
  return e.name.endsWith("_FLG");
}
function te(e) {
  return /_J[0-9]+$/.test(e.name);
}
function Ie(e, n) {
  let r;
  function s(o) {
    if (ee(o)) {
      if (r)
        throw Error(
          `Found multiple flange groups in robot model ${n}; first ${r.name} then ${o.name}. Only one _FLG group is allowed.`
        );
      r = o;
    }
    te(o), o.children.map(s);
  }
  if (s(e.scene), !r)
    throw Error(
      `No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
    );
  return { gltf: e };
}
function re({
  rapidlyChangingMotionState: e,
  dhParameters: n,
  onRotationChanged: r,
  children: s
}) {
  const o = _([]), c = _([]), a = _(null), { invalidate: f } = ae();
  I(() => {
    const l = e.joint_position.filter(
      (u) => u !== void 0
    );
    return a.current = new ye(l, {
      tension: 120,
      // Controls spring stiffness - higher values create faster, more responsive motion
      friction: 20,
      // Controls damping - higher values reduce oscillation and create smoother settling
      threshold: 1e-3
    }), () => {
      var u;
      (u = a.current) == null || u.destroy();
    };
  }, []), le((l, u) => {
    if (a.current) {
      const p = a.current.update(u);
      d(), p || f();
    }
  });
  function i(l) {
    l && (c.current = Ge(l), d(), f());
  }
  function d() {
    var u;
    const l = ((u = a.current) == null ? void 0 : u.getCurrentValues()) || [];
    if (r)
      r(c.current, l);
    else
      for (const [p, x] of c.current.entries()) {
        const g = n[p], b = g.theta || 0, M = g.reverse_rotation_direction ? -1 : 1;
        x.rotation.y = M * (l[p] || 0) + b;
      }
  }
  const h = v(() => {
    const l = e.joint_position.filter(
      (u) => u !== void 0
    );
    requestAnimationFrame(() => {
      var u;
      o.current = l, (u = a.current) == null || u.setTarget(l);
    });
  }, [e]);
  return I(() => {
    h();
  }, [e, h]), je(() => {
    h();
  }), /* @__PURE__ */ t.jsx("group", { ref: i, children: s });
}
const Fe = "line", Ve = "mesh";
function Le({
  rapidlyChangingMotionState: e,
  dhParameters: n,
  ...r
}) {
  const s = new F(), o = _([]), c = _([]);
  me.useEffect(() => {
    o.current = new Array(n.length).fill(null), c.current = new Array(n.length).fill(null);
  }, [n.length]);
  function a(d, h) {
    const l = new E(), u = new ie(), p = new E();
    s.decompose(l, u, p);
    const x = l.clone(), g = new F().makeRotationY(
      d.theta + h * (d.reverse_rotation_direction ? -1 : 1)
    ).multiply(new F().makeTranslation(0, d.d / 1e3, 0)).multiply(new F().makeTranslation(d.a / 1e3, 0, 0)).multiply(new F().makeRotationX(d.alpha));
    return s.multiply(g), s.decompose(l, u, p), { a: x, b: l };
  }
  function f(d, h, l, u) {
    if (!n)
      return;
    const p = n[d];
    if (!p)
      return;
    const { a: x, b: g } = a(p, u);
    h.geometry.setPositions([x.toArray(), g.toArray()].flat()), l.position.set(g.x, g.y, g.z);
  }
  function i(d, h) {
    s.identity();
    for (let l = 0; l < Math.min(d.length, h.length); l++) {
      const u = o.current[l], p = c.current[l];
      u && p && f(l, u, p, h[l]);
    }
  }
  return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
    re,
    {
      rapidlyChangingMotionState: e,
      dhParameters: n,
      onRotationChanged: i,
      children: /* @__PURE__ */ t.jsxs("group", { ...r, name: "Scene", children: [
        /* @__PURE__ */ t.jsxs("mesh", { children: [
          /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
          /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
        ] }),
        n.map((d, h) => {
          const { a: l, b: u } = a(
            d,
            e.joint_position[h] ?? 0
          ), p = `dhrobot_J0${h}`;
          return /* @__PURE__ */ t.jsxs("group", { name: p, children: [
            /* @__PURE__ */ t.jsx(
              Z,
              {
                ref: (x) => {
                  o.current[h] = x;
                },
                name: Fe,
                points: [l, u],
                color: "white",
                lineWidth: 5
              }
            ),
            /* @__PURE__ */ t.jsxs(
              "mesh",
              {
                ref: (x) => {
                  c.current[h] = x;
                },
                name: Ve,
                position: u,
                children: [
                  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
                  /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
                ]
              },
              "mesh_" + h
            )
          ] }, p);
        })
      ] })
    }
  ) });
}
const Se = console.warn;
function Te() {
  return I(() => {
    console.warn = (e) => {
      e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Se(e);
    };
  }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
}
function Ce(e) {
  return e.type === "Mesh";
}
function De({
  url: e,
  flangeRef: n,
  postModelRender: r,
  ...s
}) {
  const o = ue(e);
  let c;
  try {
    c = Ie(o, "robot.glb").gltf;
  } catch (i) {
    throw i;
  }
  const a = v(
    (i) => {
      i && r && r();
    },
    [r]
  );
  function f(i) {
    try {
      return Ce(i) ? i.geometry ? /* @__PURE__ */ t.jsx(
        "mesh",
        {
          name: i.name,
          geometry: i.geometry,
          material: i.material,
          position: i.position,
          rotation: i.rotation
        },
        i.uuid
      ) : /* @__PURE__ */ t.jsx("group", { name: i.name, position: i.position, rotation: i.rotation }, i.uuid) : /* @__PURE__ */ t.jsx(
        "group",
        {
          name: i.name,
          position: i.position,
          rotation: i.rotation,
          ref: ee(i) ? n : void 0,
          children: i.children.map(f)
        },
        i.uuid
      );
    } catch (d) {
      return console.warn("Error rendering node", i.name, d), null;
    }
  }
  return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: a, children: f(c.scene) });
}
function ke({
  modelURL: e,
  flangeRef: n,
  postModelRender: r,
  ...s
}) {
  const [o, c] = G(null);
  return I(() => {
    (async () => {
      try {
        if (typeof e == "string")
          c(e);
        else {
          const f = await e;
          c(f);
        }
      } catch (f) {
        console.error("Failed to resolve model URL:", f);
      }
    })();
  }, [e]), o ? /* @__PURE__ */ t.jsx(
    De,
    {
      url: o,
      flangeRef: n,
      postModelRender: r,
      ...s
    }
  ) : null;
}
const Ae = (e, n) => {
  e.userData.isGhost || (e.traverse((r) => {
    if (r instanceof m.Mesh) {
      r.material instanceof m.Material && (r.material.colorWrite = !1);
      const s = r.clone(), o = r.clone();
      s.material = new m.MeshStandardMaterial({
        depthTest: !0,
        depthWrite: !0,
        colorWrite: !1,
        polygonOffset: !0,
        polygonOffsetFactor: -1,
        side: m.DoubleSide
      }), s.userData.isGhost = !0, o.material = new m.MeshStandardMaterial({
        color: n,
        opacity: 0.3,
        depthTest: !0,
        depthWrite: !1,
        transparent: !0,
        polygonOffset: !0,
        polygonOffsetFactor: -2,
        side: m.DoubleSide
      }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
    }
  }), e.userData.isGhost = !0);
}, Pe = (e) => {
  if (!e.userData.isGhost) return;
  const n = [];
  e.traverse((r) => {
    var s;
    r instanceof m.Mesh && ((s = r.userData) != null && s.isGhost ? n.push(r) : r.material instanceof m.Material && (r.material.colorWrite = !0));
  }), n.forEach((r) => {
    r.parent && r.parent.remove(r);
  }), e.userData.isGhost = !1;
}, ze = K(
  ({
    rapidlyChangingMotionState: e,
    modelFromController: n,
    dhParameters: r,
    getModel: s = Q,
    flangeRef: o,
    postModelRender: c,
    transparentColor: a,
    ...f
  }) => {
    const [i, d] = G(null), h = v((u) => {
      d(u);
    }, []);
    I(() => {
      i && (a ? Ae(i, a) : Pe(i));
    }, [i, a]);
    const l = /* @__PURE__ */ t.jsx(
      Le,
      {
        rapidlyChangingMotionState: e,
        dhParameters: r,
        ...f
      }
    );
    return /* @__PURE__ */ t.jsxs(
      we,
      {
        fallback: l,
        onError: (u) => {
          console.warn(u);
        },
        children: [
          /* @__PURE__ */ t.jsx(pe, { fallback: l, children: /* @__PURE__ */ t.jsx("group", { ref: h, children: /* @__PURE__ */ t.jsx(
            re,
            {
              rapidlyChangingMotionState: e,
              dhParameters: r,
              children: /* @__PURE__ */ t.jsx(
                ke,
                {
                  modelURL: (() => {
                    const u = s(n);
                    if (!u) {
                      const p = new Blob([], { type: "model/gltf-binary" }), x = new File([p], `${n}.glb`, { type: "model/gltf-binary" });
                      return Promise.resolve(URL.createObjectURL(x));
                    }
                    return u;
                  })(),
                  postModelRender: c,
                  flangeRef: o,
                  ...f
                }
              )
            }
          ) }) }),
          /* @__PURE__ */ t.jsx(Te, {})
        ]
      }
    );
  }
);
function Oe({
  connectedMotionGroup: e,
  getModel: n = Q,
  flangeRef: r,
  transparentColor: s,
  postModelRender: o,
  ...c
}) {
  return e.dhParameters ? /* @__PURE__ */ t.jsx(
    ze,
    {
      rapidlyChangingMotionState: e.rapidlyChangingMotionState,
      modelFromController: e.modelFromController || "",
      dhParameters: e.dhParameters,
      getModel: n,
      flangeRef: r,
      transparentColor: s,
      postModelRender: o,
      ...c
    }
  ) : null;
}
const rt = K(
  he(
    ({
      robotName: e,
      programState: n,
      safetyState: r,
      operationMode: s,
      driveToHomeEnabled: o = !1,
      onDriveToHomePress: c,
      onDriveToHomeRelease: a,
      connectedMotionGroup: f,
      robotComponent: i = Oe,
      customContentComponent: d,
      className: h
    }) => {
      var P;
      const l = fe(), { t: u } = xe(), [p, x] = G(!1), g = _(null), b = _(null), [M, ne] = G(!1), [V, oe] = G({ width: 400, height: 600 }), [Ee, se] = G(0);
      I(() => {
        const C = () => {
          if (b.current) {
            const { offsetWidth: O, offsetHeight: U } = b.current;
            ne(O > U), oe({ width: O, height: U });
          }
        };
        C();
        const z = new ResizeObserver(C);
        return b.current && z.observe(b.current), () => {
          z.disconnect();
        };
      }, []);
      const k = v(() => {
        se((C) => C + 1);
      }, []), L = v(() => {
        !o || !c || (x(!0), c());
      }, [o, c]), S = v(() => {
        !o || !a || (x(!1), a());
      }, [o, a]), A = v(() => {
        p && a && (x(!1), a());
      }, [p, a]), w = M ? V.width < 350 : V.height < 200, T = M ? V.height < 310 : V.height < 450;
      return /* @__PURE__ */ t.jsx(
        de,
        {
          ref: b,
          className: h,
          sx: {
            width: "100%",
            height: "100%",
            display: "flex",
            flexDirection: M ? "row" : "column",
            position: "relative",
            overflow: "hidden",
            minWidth: { xs: 180, sm: 220, md: 250 },
            minHeight: M ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
            // Allow progressive hiding in portrait mode
            border: `1px solid ${l.palette.divider}`,
            borderRadius: "18px",
            boxShadow: "none",
            backgroundColor: ((P = l.palette.backgroundPaperElevation) == null ? void 0 : P[8]) || "#2A2A3F",
            backgroundImage: "none"
            // Override any gradient from elevation
          },
          children: M ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
            /* @__PURE__ */ t.jsx(
              y,
              {
                sx: {
                  flex: "0 0 50%",
                  position: "relative",
                  height: "100%",
                  minHeight: "100%",
                  maxHeight: "100%",
                  borderRadius: 1,
                  m: { xs: 1.5, sm: 2, md: 3 },
                  mr: { xs: 0.75, sm: 1, md: 1.5 },
                  overflow: "hidden",
                  // Prevent content from affecting container size
                  display: w ? "none" : "block"
                },
                children: !w && /* @__PURE__ */ t.jsxs(
                  B,
                  {
                    orthographic: !0,
                    camera: {
                      position: [3, 2, 3],
                      zoom: 1
                    },
                    shadows: !0,
                    frameloop: "demand",
                    style: {
                      borderRadius: l.shape.borderRadius,
                      width: "100%",
                      height: "100%",
                      background: "transparent",
                      position: "absolute",
                      top: 0,
                      left: 0
                    },
                    dpr: [1, 2],
                    gl: { alpha: !0, antialias: !0 },
                    children: [
                      /* @__PURE__ */ t.jsx(Y, {}),
                      /* @__PURE__ */ t.jsx(W, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
                        i,
                        {
                          connectedMotionGroup: f,
                          postModelRender: k
                        }
                      ) })
                    ]
                  }
                )
              }
            ),
            /* @__PURE__ */ t.jsxs(
              y,
              {
                sx: {
                  flex: "1",
                  display: "flex",
                  flexDirection: "column",
                  justifyContent: "flex-start",
                  width: w ? "100%" : "50%"
                },
                children: [
                  /* @__PURE__ */ t.jsxs(
                    y,
                    {
                      sx: {
                        p: { xs: 1.5, sm: 2, md: 3 },
                        pb: { xs: 1, sm: 1.5, md: 2 },
                        textAlign: "left"
                      },
                      children: [
                        /* @__PURE__ */ t.jsx($, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
                        /* @__PURE__ */ t.jsx(
                          J,
                          {
                            programState: n,
                            safetyState: r,
                            operationMode: s
                          }
                        )
                      ]
                    }
                  ),
                  /* @__PURE__ */ t.jsxs(
                    y,
                    {
                      sx: {
                        p: { xs: 1.5, sm: 2, md: 3 },
                        pt: 0,
                        flex: "1",
                        display: "flex",
                        flexDirection: "column",
                        justifyContent: "space-between"
                      },
                      children: [
                        !T && d && /* @__PURE__ */ t.jsxs(y, { children: [
                          /* @__PURE__ */ t.jsx(d, {}),
                          /* @__PURE__ */ t.jsx(
                            N,
                            {
                              sx: {
                                mt: 1,
                                mb: 0,
                                borderColor: l.palette.divider,
                                opacity: 0.5
                              }
                            }
                          )
                        ] }),
                        /* @__PURE__ */ t.jsx(
                          y,
                          {
                            sx: {
                              mt: !T && d ? "auto" : 0
                            },
                            children: /* @__PURE__ */ t.jsx(
                              y,
                              {
                                sx: {
                                  display: "flex",
                                  justifyContent: "flex-start",
                                  mt: { xs: 1, sm: 1.5, md: 2 },
                                  mb: { xs: 0.5, sm: 0.75, md: 1 }
                                },
                                children: /* @__PURE__ */ t.jsx(
                                  H,
                                  {
                                    ref: g,
                                    variant: "contained",
                                    color: "secondary",
                                    size: "small",
                                    disabled: !o,
                                    onMouseDown: L,
                                    onMouseUp: S,
                                    onMouseLeave: A,
                                    onTouchStart: L,
                                    onTouchEnd: S,
                                    sx: {
                                      textTransform: "none",
                                      px: 1.5,
                                      py: 0.5
                                    },
                                    children: u("RobotCard.DriveToHome.bt")
                                  }
                                )
                              }
                            )
                          }
                        )
                      ]
                    }
                  )
                ]
              }
            )
          ] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
            y,
            {
              sx: {
                p: 3,
                height: "100%",
                display: "flex",
                flexDirection: "column"
              },
              children: [
                /* @__PURE__ */ t.jsxs(y, { children: [
                  /* @__PURE__ */ t.jsx($, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
                  /* @__PURE__ */ t.jsx(
                    J,
                    {
                      programState: n,
                      safetyState: r,
                      operationMode: s
                    }
                  )
                ] }),
                /* @__PURE__ */ t.jsx(
                  y,
                  {
                    sx: {
                      flex: w ? 0 : 1,
                      position: "relative",
                      minHeight: w ? 0 : { xs: 120, sm: 150, md: 200 },
                      height: w ? 0 : "auto",
                      borderRadius: 1,
                      overflow: "hidden",
                      display: w ? "none" : "block"
                    },
                    children: !w && /* @__PURE__ */ t.jsxs(
                      B,
                      {
                        orthographic: !0,
                        camera: {
                          position: [3, 2, 3],
                          zoom: 1
                        },
                        shadows: !0,
                        frameloop: "demand",
                        style: {
                          borderRadius: l.shape.borderRadius,
                          width: "100%",
                          height: "100%",
                          background: "transparent",
                          position: "absolute"
                        },
                        dpr: [1, 2],
                        gl: { alpha: !0, antialias: !0 },
                        children: [
                          /* @__PURE__ */ t.jsx(Y, {}),
                          /* @__PURE__ */ t.jsx(W, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
                            i,
                            {
                              connectedMotionGroup: f,
                              postModelRender: k
                            }
                          ) })
                        ]
                      }
                    )
                  }
                ),
                /* @__PURE__ */ t.jsxs(y, { children: [
                  !T && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
                    /* @__PURE__ */ t.jsx(d, {}),
                    /* @__PURE__ */ t.jsx(
                      N,
                      {
                        sx: {
                          mt: 1,
                          mb: 0,
                          borderColor: l.palette.divider,
                          opacity: 0.5
                        }
                      }
                    )
                  ] }),
                  /* @__PURE__ */ t.jsx(
                    y,
                    {
                      sx: {
                        display: "flex",
                        justifyContent: "flex-start",
                        mt: !T && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
                        mb: { xs: 0.5, sm: 0.75, md: 1 }
                      },
                      children: /* @__PURE__ */ t.jsx(
                        H,
                        {
                          ref: g,
                          variant: "contained",
                          color: "secondary",
                          size: "small",
                          disabled: !o,
                          onMouseDown: L,
                          onMouseUp: S,
                          onMouseLeave: A,
                          onTouchStart: L,
                          onTouchEnd: S,
                          sx: {
                            textTransform: "none",
                            px: 1.5,
                            py: 0.5
                          },
                          children: u("RobotCard.DriveToHome.bt")
                        }
                      )
                    }
                  )
                ] })
              ]
            }
          ) })
        }
      );
    }
  )
), nt = Array(6).fill(2 * Math.PI), q = {
  [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
  [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
  [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
  [j.Kuka]: [
    0,
    -Math.PI / 2,
    Math.PI / 2,
    0,
    Math.PI / 2,
    0,
    0
  ],
  [j.Universalrobots]: [
    0,
    -Math.PI / 2,
    -Math.PI / 2,
    -Math.PI / 2,
    Math.PI / 2,
    -Math.PI / 2,
    0
  ]
};
function Ue(e) {
  const [n] = e.split("_");
  switch (n) {
    case "ABB":
      return j.Abb;
    case "FANUC":
      return j.Fanuc;
    case "YASKAWA":
      return j.Yaskawa;
    case "KUKA":
      return j.Kuka;
    case "UniversalRobots":
      return j.Universalrobots;
    default:
      return null;
  }
}
function ot(e, n) {
  const r = Ue(e);
  return r && r in q ? q[r] : n || null;
}
export {
  Qe as C,
  q as M,
  Y as P,
  Oe as R,
  et as S,
  tt as T,
  rt as a,
  ze as b,
  Q as c,
  nt as d,
  Ue as e,
  ot as g
};
//# sourceMappingURL=manufacturerHomePositions-BD6C5qZJ.js.map
