import { jsx as _jsx } from "react/jsx-runtime";
import { resolve } from '../../../../lib/server-container.js';
import { AdoptDrawerClient } from '../../../../components/common/control-center-drawer/adopt-drawer-client.js';
/** Skip static pre-rendering since we need runtime DI container. */
export const dynamic = 'force-dynamic';
export default async function AdoptDrawerPage({ searchParams }) {
    const { repo } = await searchParams;
    let repositoryPath = repo ?? '';
    let repositoryOptions = [];
    try {
        const listRepos = resolve('ListRepositoriesUseCase');
        const repositories = await listRepos.execute();
        repositoryOptions = repositories.map((r) => ({
            id: r.id,
            name: r.name,
            path: r.path,
        }));
        if (!repositoryPath && repositories.length > 0) {
            repositoryPath = repositories[0].path;
        }
    }
    catch {
        // Fall through with empty path — server action will validate
    }
    return _jsx(AdoptDrawerClient, { repositoryPath: repositoryPath, repositories: repositoryOptions });
}
