import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { homepage, packageIdentifier, } from "../../../package.js";
import { useData, useIsTrusted, useMaybeAuthenticationState, useMaybeUser, useRoles, } from "../data/provider.js";
export const path = "/home";
export const anonymous = true;
export function Home() {
    const { isUnauthenticated } = useData();
    const roles = useRoles();
    const isTrusted = useIsTrusted();
    const user = useMaybeUser();
    const authenticationState = useMaybeAuthenticationState();
    // console.log({
    //     home: {
    //         roles,
    //         isUnauthenticated
    //     }
    // })
    return (_jsxs(_Fragment, { children: [isUnauthenticated ? (_jsxs(_Fragment, { children: [_jsx("p", { children: "Welcome!" }), _jsx("br", {}), _jsx("br", {}), _jsxs("p", { children: [_jsx("a", { href: "/login", className: "text-blue-600 hover:bg-white underline hover:underline-offset-2", children: "Login" }), _jsx("br", {})] }), _jsx("br", {}), _jsx("br", {}), _jsx("hr", {}), _jsx("br", {}), _jsx("br", {}), _jsxs("p", { children: ["You are running ", packageIdentifier] }), _jsx("p", { children: _jsx("a", { href: "/api/documentation", target: "_blank", className: "text-blue-600 hover:bg-white underline hover:underline-offset-2", children: "Checkout the API documentation!" }) }), _jsx("p", { children: _jsx("a", { href: homepage, target: "_blank", className: "text-blue-600 hover:bg-white underline hover:underline-offset-2", children: "Checkout the source code!" }) })] })) : (_jsxs(_Fragment, { children: ["You are logged in!", _jsx("br", {}), !roles.length ? ("You have no assigned roles") : (_jsxs(_Fragment, { children: [_jsx("br", {}), "You have the roles:", _jsx("br", {}), _jsx("ul", { className: "list-disc list-outside", children: roles.map((role) => (_jsx("li", { children: role }, role))) }), _jsx("br", {}), isTrusted && user ? (_jsxs("p", { children: ["User Id: ", user.userId, _jsx("br", {}), "Initially Authenticated With: ", user.externalType, authenticationState && authenticationState.from.type !== user.externalType ? (_jsxs(_Fragment, { children: [_jsx("br", {}), "Authenticated With: ", authenticationState.type, _jsx("br", {}), "Authenticated From: ", authenticationState.from.type] })) : undefined] })) : isTrusted ? ("No user associated") : undefined] }))] })), _jsx("br", {}), _jsx("br", {}), _jsx("div", { id: "react-home" })] }));
}
export const Component = Home;
//# sourceMappingURL=home.js.map