import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { Combobox } 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/combobox/combobox.js';
import { ComboboxList } 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/MAXQOH4L.js';
import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import { forwardRef, useCallback } from 'react';
import { useSelectContext } from './select-root.js';
import styles from './select.module.css.js';
import { Portal, Content as Content2, Viewport } from '../../node_modules/.pnpm/@radix-ui_react-select@2.2.5_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.js';
import { Root as Slot } from '../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.js';

const SelectContent = forwardRef(({ className, children, position = 'popper', searchPlaceholder = 'Search...', sideOffset = 4, asChild, onEscapeKeyDown: providedOnEscapeKeyDown, onPointerDownOutside: providedOnPointerDownOutside, ...props }, ref) => {
    const { autocomplete, multiple, updateSelectionInProgress } = useSelectContext();
    const onPointerDownOutside = useCallback(event => {
        updateSelectionInProgress(false);
        providedOnPointerDownOutside?.(event);
    }, [updateSelectionInProgress, providedOnPointerDownOutside]);
    const onEscapeKeyDown = useCallback(event => {
        updateSelectionInProgress(false);
        providedOnEscapeKeyDown?.(event);
    }, [updateSelectionInProgress, providedOnEscapeKeyDown]);
    return (jsxRuntimeExports.jsx(Portal, { children: jsxRuntimeExports.jsx(Content2, { ref: ref, position: position, sideOffset: sideOffset, className: cx(styles.content, className), onEscapeKeyDown: multiple ? onEscapeKeyDown : providedOnEscapeKeyDown, onPointerDownOutside: multiple ? onPointerDownOutside : providedOnPointerDownOutside, role: autocomplete ? 'dialog' : 'listbox', "aria-multiselectable": !autocomplete && multiple ? true : undefined, "data-multiselectable": multiple ? true : undefined, ...props, children: jsxRuntimeExports.jsx(Viewport, { className: cx(styles.viewport, autocomplete && styles.comboboxViewport), asChild: !autocomplete ? asChild : undefined, children: autocomplete ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Combobox, { autoSelect: true, placeholder: searchPlaceholder, className: styles.comboboxInput, onBlurCapture: event => {
                                event.preventDefault();
                                event.stopPropagation();
                            } }), jsxRuntimeExports.jsx(ComboboxList, { className: styles.comboboxContent, "aria-multiselectable": multiple ? true : undefined, render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, children: children })] })) : (children) }) }) }));
});
SelectContent.displayName = Content2.displayName;

export { SelectContent };
//# sourceMappingURL=select-content.js.map
