import { Ctx as c } from "./accelbyte-widgets33.mjs";
import { LoginPath as a } from "./accelbyte-widgets35.mjs";
import * as t from "react";
import { Route as o, Redirect as s } from "react-router-dom";
const f = ({ render: e, ...r }) => {
  if (!e)
    return null;
  const n = c.getAppState(), { user: i, isFetchingUser: m } = n.userAppManager.state;
  return !m && i === null ? /* @__PURE__ */ t.createElement(
    o,
    {
      ...r,
      render: (p) => /* @__PURE__ */ t.createElement(
        s,
        {
          to: a.Login.withSearchParams({
            [a.LoginURLGeneratorParamKeys.RETURN_PATH_PARAMS_KEY]: p.location.pathname
          })
        }
      )
    }
  ) : /* @__PURE__ */ t.createElement(o, { ...r, render: e });
};
export {
  f as PrivateRoute
};
