import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useEditContext } from "../../client/editContext";
import { SimpleIconButton } from "../../ui/SimpleIconButton";
import { Layers } from "lucide-react";
import { SecretAgentIcon } from "../../ui/Icons";
import { EnterFullScreenIcon } from "@radix-ui/react-icons";
import { useAgentStatus } from "../../ai/useAgentStatus";
import { AgentStatusBadge } from "../../ai/AgentStatusBadge";
import { LicenseFeatures, useFeature } from "../../../licensing";
export function UtilityControls() {
    const editContext = useEditContext();
    const canUseAi = useFeature(LicenseFeatures.AI);
    const agentStatus = useAgentStatus(canUseAi);
    if (!editContext)
        return null;
    // Get page from active slot context if available, fallback to editContext.page
    const activeSlotContext = editContext.getActiveSlotContext?.();
    const page = activeSlotContext?.primaryPageViewContext?.page ?? editContext.page;
    const isMobile = editContext.isMobile;
    const isAgentsSidebarOpen = editContext.openSidebars.includes("agents-panel");
    const handleAgentsClick = () => {
        if (isMobile) {
            editContext.toggleSidebar?.("agents-panel");
            return;
        }
        editContext.setShowAgentsPanel(!editContext.showAgentsPanel);
    };
    return (_jsxs(_Fragment, { children: [page && (_jsx(SimpleIconButton, { icon: _jsx(EnterFullScreenIcon, { className: "h-6 w-6 p-1" }), label: "Fullscreen", size: "large", "data-testid": "fullscreen-button", onClick: () => editContext.setFullscreen(true) })), !editContext.isMobile && page && (_jsx(SimpleIconButton, { icon: _jsx(Layers, { className: "h-6 w-6 p-1", strokeWidth: 1 }), label: "Component Navigator", size: "large", "data-testid": "component-navigator-button", selected: editContext.showComponentNavigator, onClick: () => editContext.setShowComponentNavigator(!editContext.showComponentNavigator) })), canUseAi && (_jsx(SimpleIconButton, { icon: _jsxs("div", { className: "relative", children: [_jsx(SecretAgentIcon, { className: "h-6 w-6 p-0.5" }), _jsx(AgentStatusBadge, { status: agentStatus })] }), label: "Agents", size: "large", "data-testid": "agents-panel-button", selected: isMobile ? isAgentsSidebarOpen : editContext.showAgentsPanel, onClick: handleAgentsClick }))] }));
}
//# sourceMappingURL=UtilityControls.js.map