'use strict';

var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var React = require('react');
var index = require('../../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.cjs');
var JMHAJKUZ = require('../../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.cjs');
var dropdownMenuRoot = require('./dropdown-menu-root.cjs');
var triangleRight = require('../../icons/assets/triangle-right.svg.cjs');
var cell = require('./cell.cjs');
var utils = require('./utils.cjs');

const DropdownMenuTrigger = index.Trigger;
const DropdownMenuSubMenuTrigger = React.forwardRef(({ children, value, trailingIcon = jsxRuntime.jsxRuntimeExports.jsx(triangleRight.ReactComponent, {}), ...props }, ref) => {
    const { autocomplete, searchValue } = dropdownMenuRoot.useDropdownContext();
    const menuLevel = dropdownMenuRoot.useMenuLevel();
    const item = (jsxRuntime.jsxRuntimeExports.jsx(index.SubTrigger, { ref: ref, ...props, asChild: true, children: jsxRuntime.jsxRuntimeExports.jsx(cell.Cell, { trailingIcon: trailingIcon, isComboboxCell: autocomplete, children: children }) }));
    if ((autocomplete && menuLevel >= 3) || (!autocomplete && menuLevel >= 2))
        return item;
    const computedValue = utils.getValue(value, children);
    if (autocomplete && !utils.getMatch(computedValue, searchValue))
        return null;
    if (autocomplete)
        return jsxRuntime.jsxRuntimeExports.jsx(JMHAJKUZ.ComboboxItem, { value: value, render: item });
    return item;
});
DropdownMenuSubMenuTrigger.displayName =
    index.SubTrigger.displayName;

exports.DropdownMenuSubMenuTrigger = DropdownMenuSubMenuTrigger;
exports.DropdownMenuTrigger = DropdownMenuTrigger;
//# sourceMappingURL=dropdown-menu-trigger.cjs.map
