"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Settings2 } from "lucide-react";
import { Popover, PopoverContent, PopoverTrigger, } from "../../components/ui/popover";
import { Button } from "../../components/ui/button";
import { useGutterContextSafe } from "../tree-indicators";
import { IndicatorSettings } from "./IndicatorSettings";
import { TreeOptions } from "./TreeOptions";
const noOpFunction = () => { };
export function TreeSettingsMenu() {
    const gutterContext = useGutterContextSafe();
    const providers = gutterContext ? gutterContext.providers : [];
    const visibleGutters = gutterContext ? gutterContext.visibleGutters : [];
    const toggleGutter = gutterContext ? gutterContext.toggleGutter : noOpFunction;
    const isLoading = gutterContext ? gutterContext.isLoading : false;
    const showBadges = gutterContext ? gutterContext.showBadges : false;
    const toggleBadges = gutterContext ? gutterContext.toggleBadges : noOpFunction;
    const showDisplayNames = gutterContext
        ? gutterContext.showDisplayNames
        : false;
    const toggleDisplayNames = gutterContext
        ? gutterContext.toggleDisplayNames
        : noOpFunction;
    if (!gutterContext) {
        return null;
    }
    return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "xs", className: "gap-1 px-2", title: "Tree settings", "data-testid": "tree-settings-button", children: [_jsx(Settings2, { className: "h-3.5 w-3.5" }), visibleGutters.length > 0 && (_jsxs("span", { className: "text-xs text-muted-foreground", children: ["(", visibleGutters.length, ")"] }))] }) }), _jsx(PopoverContent, { align: "start", className: "w-56 p-2", "data-testid": "tree-settings-popover", children: _jsxs("div", { className: "space-y-1", children: [_jsx(TreeOptions, { showDisplayNames: showDisplayNames, toggleDisplayNames: toggleDisplayNames }), _jsx(IndicatorSettings, { providers: providers, visibleGutters: visibleGutters, toggleGutter: toggleGutter, isLoading: isLoading, showBadges: showBadges, toggleBadges: toggleBadges })] }) })] }));
}
export default TreeSettingsMenu;
//# sourceMappingURL=TreeSettingsMenu.js.map