import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { notFound } from 'next/navigation';
import { resolve } from '../../../../lib/server-container.js';
import { getFeatureFlags } from '../../../../lib/feature-flags.js';
import { SupervisorConfigForm } from '../../../../components/supervisor/supervisor-config-form.js';
/** Skip static pre-rendering — the page resolves a runtime DI container. */
export const dynamic = 'force-dynamic';
export default async function RepositorySupervisorRoute({ params, searchParams }) {
    const flags = getFeatureFlags();
    if (!flags.collaboration) {
        notFound();
    }
    const { repositoryId } = await params;
    const { feature } = await searchParams;
    const featureId = feature?.trim() ? feature : undefined;
    const repoRepository = resolve('IRepositoryRepository');
    const repo = await repoRepository.findById(repositoryId);
    if (!repo) {
        notFound();
    }
    const useCase = resolve('GetSupervisorPolicyUseCase');
    const policy = await useCase.execute({ scopeType: 'repo', scopeId: repositoryId, featureId });
    return (_jsxs("div", { className: "flex h-full flex-col gap-6 p-6", children: [_jsxs("header", { children: [_jsxs("h1", { className: "text-2xl font-semibold", children: ["Supervisor \u2014 ", repo.name] }), _jsxs("p", { className: "text-muted-foreground text-sm", children: ["Configure a delegated guardian agent for this repository", featureId ? ' (feature override)' : '', "."] })] }), _jsx(SupervisorConfigForm, { scopeType: "repo", scopeId: repositoryId, featureId: featureId, initialPolicy: policy })] }));
}
