import { j as m } from "../../node_modules/react/jsx-runtime.mjs";
import { getDefaultUrl as f, getFlatRoutes as c } from "../../utils/menu.mjs";
import g from "../../routes/index.mjs";
import { getItem as x } from "../../utils/local.mjs";
import "../../config/nprogress.mjs";
import { isMobile as b } from "../../node_modules/react-device-detect/dist/lib.mjs";
import e from "../../node_modules/nprogress/nprogress.mjs";
import { useLocation as d, Navigate as u } from "../../node_modules/react-router/dist/index.mjs";
const L = ({ title: r, children: i }) => {
  var n;
  const l = f(), p = c(g);
  e.start();
  const { pathname: t } = d(), s = x("bitzToken") || null;
  if (s && t === "/login") {
    const o = b ? "/appLayout" : l;
    return /* @__PURE__ */ m.jsx(u, { to: o, replace: !0 });
  }
  if (t === "/login")
    return e.done(), i;
  if (!s)
    return /* @__PURE__ */ m.jsx(u, { to: "/login", replace: !0 });
  const a = p.filter((o) => o.path === t);
  return (n = a[0]) != null && n.title && (r += "-" + a[0].title), document.title = r, e.done(), i;
};
export {
  L as default
};
