'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { useRouter } from 'next/navigation.js';
import { formatAdminURL } from 'payload/shared';
import React, { useCallback } from 'react';
import { useAuth } from '../../providers/Auth/index.js';
import { useConfig } from '../../providers/Config/index.js';
import { useRouteTransition } from '../../providers/RouteTransition/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
import { ConfirmationModal } from '../ConfirmationModal/index.js';
export const stayLoggedInModalSlug = 'stay-logged-in';
export const StayLoggedInModal = ()=>{
    const { refreshCookie } = useAuth();
    const router = useRouter();
    const { config } = useConfig();
    const { admin: { routes: { logout: logoutRoute } }, routes: { admin: adminRoute } } = config;
    const { t } = useTranslation();
    const { startRouteTransition } = useRouteTransition();
    const onConfirm = useCallback(()=>{
        return startRouteTransition(()=>router.push(formatAdminURL({
                adminRoute,
                path: logoutRoute
            })));
    }, [
        router,
        startRouteTransition,
        adminRoute,
        logoutRoute
    ]);
    const onCancel = useCallback(()=>{
        refreshCookie();
    }, [
        refreshCookie
    ]);
    return /*#__PURE__*/ _jsxDEV(ConfirmationModal, {
        body: t('authentication:youAreInactive'),
        cancelLabel: t('authentication:stayLoggedIn'),
        confirmLabel: t('authentication:logOut'),
        heading: t('authentication:stayLoggedIn'),
        modalSlug: stayLoggedInModalSlug,
        onCancel: onCancel,
        onConfirm: onConfirm
    }, void 0, false, {
        fileName: "src/elements/StayLoggedIn/index.tsx",
        lineNumber: 48,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map