import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { forwardRef } from 'react';
import { SubTrigger as $d08ef79370b62062$export$2ea8a7a591ac5eac, Trigger as $d08ef79370b62062$export$41fb9f06171c75f4 } from '../../node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.0.5_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@1_e7gmnqwdc4f4ybjj7qkfdho6zy/node_modules/@radix-ui/react-dropdown-menu/dist/index.js';
import { ComboboxItem } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/__chunks/JMHAJKUZ.js';
import { useDropdownContext, useMenuLevel } from './dropdown-menu-root.js';
import { ReactComponent as SvgTriangleRight } from '../../icons/assets/triangle-right.svg.js';
import { Cell } from './cell.js';
import { getMatch, getValue } from './utils.js';

const DropdownMenuTrigger = $d08ef79370b62062$export$41fb9f06171c75f4;
const DropdownMenuSubMenuTrigger = forwardRef(({ children, value, trailingIcon = jsxRuntimeExports.jsx(SvgTriangleRight, {}), ...props }, ref) => {
    const { autocomplete, searchValue } = useDropdownContext();
    const menuLevel = useMenuLevel();
    const item = (jsxRuntimeExports.jsx($d08ef79370b62062$export$2ea8a7a591ac5eac, { ref: ref, ...props, asChild: true, children: jsxRuntimeExports.jsx(Cell, { trailingIcon: trailingIcon, isComboboxCell: autocomplete, children: children }) }));
    if ((autocomplete && menuLevel >= 3) || (!autocomplete && menuLevel >= 2))
        return item;
    const computedValue = getValue(value, children);
    if (autocomplete && !getMatch(computedValue, searchValue))
        return null;
    if (autocomplete)
        return jsxRuntimeExports.jsx(ComboboxItem, { value: value, render: item });
    return item;
});
DropdownMenuSubMenuTrigger.displayName =
    $d08ef79370b62062$export$2ea8a7a591ac5eac.displayName;

export { DropdownMenuSubMenuTrigger, DropdownMenuTrigger };
//# sourceMappingURL=dropdown-menu-trigger.js.map
