'use strict';
'use client';
import { jsx, jsxs } from 'react/jsx-runtime';
import { Dialog, DialogContent } from '../dialog/Dialog.js';
import { Command as Command$1 } from 'cmdk';
import { cn } from '../../../fd-toolbox/lib/utils.js';
import { Icon, iconNames } from '../icon/Icon.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function Command({
  children,
  className,
  ref,
  value,
  defaultValue,
  onValueChange,
  loop,
  shouldFilter
}) {
  return /* @__PURE__ */jsx(Command$1, {
    ref,
    value,
    defaultValue,
    onValueChange,
    loop,
    shouldFilter,
    className: cn("bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-md", className),
    children
  });
}
__name(Command, "Command");
Command.displayName = Command$1.displayName;
function CommandDialog({
  open,
  onOpenChange,
  children
}) {
  return /* @__PURE__ */jsx(Dialog, {
    open,
    onOpenChange,
    children: /* @__PURE__ */jsx(DialogContent, {
      className: "overflow-hidden p-0",
      children: /* @__PURE__ */jsx(Command, {
        className: "[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5",
        children
      })
    })
  });
}
__name(CommandDialog, "CommandDialog");
function CommandInput({
  className,
  ref,
  value,
  defaultValue,
  onValueChange,
  placeholder,
  disabled
}) {
  return /* @__PURE__ */jsxs("div", {
    className: "flex items-center border-b px-3",
    "cmdk-input-wrapper": "",
    children: [/* @__PURE__ */jsx(Icon, {
      name: iconNames.magnifyingGlass,
      className: "mr-2 shrink-0 opacity-50"
    }), /* @__PURE__ */jsx(Command$1.Input, {
      ref,
      value,
      defaultValue,
      onValueChange,
      placeholder,
      disabled,
      className: cn("placeholder:text-muted-foreground flex h-9 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50", className)
    })]
  });
}
__name(CommandInput, "CommandInput");
CommandInput.displayName = Command$1.Input.displayName;
function CommandList({
  children,
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Command$1.List, {
    ref,
    className: cn("max-h-72 overflow-x-hidden overflow-y-auto", className),
    children
  });
}
__name(CommandList, "CommandList");
CommandList.displayName = Command$1.List.displayName;
function CommandEmpty({
  children,
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Command$1.Empty, {
    ref,
    className: cn("py-6 text-center text-sm", className),
    children
  });
}
__name(CommandEmpty, "CommandEmpty");
CommandEmpty.displayName = Command$1.Empty.displayName;
function CommandGroup({
  children,
  heading,
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Command$1.Group, {
    ref,
    heading,
    className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className),
    children
  });
}
__name(CommandGroup, "CommandGroup");
CommandGroup.displayName = Command$1.Group.displayName;
function CommandSeparator({
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Command$1.Separator, {
    ref,
    className: cn("bg-border -mx-1 h-px", className)
  });
}
__name(CommandSeparator, "CommandSeparator");
CommandSeparator.displayName = Command$1.Separator.displayName;
function CommandItem({
  children,
  value,
  disabled,
  onSelect,
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Command$1.Item, {
    ref,
    value,
    disabled,
    onSelect,
    className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50", className),
    children
  });
}
__name(CommandItem, "CommandItem");
CommandItem.displayName = Command$1.Item.displayName;
function CommandShortcut({
  children,
  className
}) {
  return /* @__PURE__ */jsx("span", {
    className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
    children
  });
}
__name(CommandShortcut, "CommandShortcut");
CommandShortcut.displayName = "CommandShortcut";

export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
