{"version":3,"file":"AuthGuard.cjs","names":[],"sources":["../../src/auth/AuthGuard.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nexport interface AuthGuardProps {\n    /** Whether the current user is authenticated. */\n    isAuthenticated: boolean;\n    /** Element to render when authenticated. */\n    children: ReactNode;\n    /** Element to render when not authenticated. Use this to redirect (e.g. `<Navigate to=\"/login\" />`). */\n    fallback: ReactNode;\n}\n\n/**\n * Router-agnostic auth gate. The caller decides what to render in either\n * branch — typically `<Outlet />` for protected layouts and `<Navigate />` for\n * the redirect. Pair with {@link createAuthStore} or any custom auth source.\n *\n * @example\n * <AuthGuard\n *     isAuthenticated={useAuthStore((s) => s.isAuthenticated)}\n *     fallback={<Navigate to=\"/login\" replace />}\n * >\n *     <Outlet />\n * </AuthGuard>\n */\nexport function AuthGuard({ isAuthenticated, children, fallback }: AuthGuardProps) {\n    return <>{isAuthenticated ? children : fallback}</>;\n}\n"],"mappings":"mCAwBA,SAAgB,EAAU,CAAE,kBAAiB,WAAU,YAA4B,CAC/E,OAAO,EAAA,EAAA,IAAA,CAAA,EAAA,SAAA,CAAA,SAAG,EAAkB,EAAW,CAAW,CAAA,CACtD"}