"use strict";
const jsxRuntime = require("react/jsx-runtime");
const antd = require("antd");
const React = require("react");
const kit_Theme_UI = require("./Theme/UI.cjs");
require("./Theme/themeUtils.cjs");
require("./Theme/themes.cjs");
const InputSelect = ({
  allowClear,
  autoFocus,
  customFilter,
  defaultValue,
  disabled,
  options,
  placeholder,
  value,
  width,
  onBlur,
  onFocus,
  onChange,
  onKeyDown,
  onDropdownVisibleChange
}) => {
  const {
    themeSettings: { className: themeClass }
  } = kit_Theme_UI.useTheme();
  const [filterValue, setFilterValue] = React.useState("");
  const filteredOptions = React.useMemo(() => {
    let filteredOpts = [];
    if (customFilter) {
      filteredOpts = customFilter(options, filterValue);
    } else {
      filteredOpts = options == null ? void 0 : options.filter(
        (option) => option.toLowerCase().includes(filterValue.toLowerCase())
      );
    }
    return filteredOpts.map((val) => ({ value: val }));
  }, [options, filterValue, customFilter]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    antd.AutoComplete,
    {
      allowClear,
      autoFocus,
      className: themeClass,
      defaultValue,
      disabled,
      options: filteredOptions,
      placeholder,
      popupClassName: themeClass,
      style: { width },
      value,
      onBlur,
      onChange,
      onDropdownVisibleChange,
      onFocus,
      onKeyDown,
      onSearch: (text) => setFilterValue(text)
    }
  );
};
module.exports = InputSelect;
