'use strict';

var chunkDWNKXV5E_cjs = require('./chunk-DWNKXV5E.cjs');
var input = require('@base-ui/react/input');
var icons = require('@blueprintjs/icons');
var classnames2 = require('classnames');
var React2 = require('react');
var menu = require('@base-ui/react/menu');
var checkbox = require('@base-ui/react/checkbox');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var classnames2__default = /*#__PURE__*/_interopDefault(classnames2);
var React2__default = /*#__PURE__*/_interopDefault(React2);

// src/base-components/search-bar/SearchBar.module.css
var SearchBar_default = {};

// src/base-components/search-bar/SearchBar.tsx
function SearchBar({
  value,
  onChange,
  placeholder = "Search",
  "aria-label": ariaLabel,
  className,
  onKeyDown
}) {
  return /* @__PURE__ */ React2__default.default.createElement("div", {
    className: classnames2__default.default(SearchBar_default.searchBar, className)
  }, /* @__PURE__ */ React2__default.default.createElement(icons.Search, {
    className: SearchBar_default.searchIcon
  }), /* @__PURE__ */ React2__default.default.createElement(input.Input, {
    type: "text",
    placeholder,
    "aria-label": ariaLabel ?? placeholder,
    value,
    onChange,
    className: SearchBar_default.searchInput,
    onKeyDown
  }));
}

// src/base-components/searchable-menu/SearchableMenu.module.css
var SearchableMenu_default = {};

// src/base-components/searchable-menu/SearchableMenu.tsx
function SearchableMenuInner({
  items,
  onItemSelected,
  trigger,
  triggerClassName,
  disabled,
  searchPlaceholder = "Search",
  emptyMessage = "No matching items",
  className,
  collisionBoundary
}) {
  const [searchQuery, setSearchQuery] = React2.useState("");
  const portalContainer = chunkDWNKXV5E_cjs.usePortalContainer();
  const filteredItems = React2.useMemo(() => {
    const query = searchQuery.toLowerCase().trim();
    if (!query) return items;
    return items.filter((item) => item.label.toLowerCase().includes(query));
  }, [items, searchQuery]);
  const handleSearchChange = React2.useCallback((event) => {
    setSearchQuery(event.target.value);
  }, []);
  const handleMenuOpenChange = React2.useCallback((open) => {
    if (open) {
      setSearchQuery("");
    }
  }, []);
  const handleKeyDown = React2.useCallback((event) => {
    event.stopPropagation();
  }, []);
  return /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Root, {
    onOpenChange: handleMenuOpenChange
  }, /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Trigger, {
    className: triggerClassName,
    disabled
  }, trigger), /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Portal, {
    container: portalContainer
  }, /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Positioner, {
    className: classnames2__default.default(SearchableMenu_default.positioner, className),
    sideOffset: 4,
    collisionBoundary
  }, /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Popup, {
    className: SearchableMenu_default.popup
  }, /* @__PURE__ */ React2__default.default.createElement(SearchBar, {
    value: searchQuery,
    onChange: handleSearchChange,
    placeholder: searchPlaceholder,
    "aria-label": searchPlaceholder,
    className: SearchableMenu_default.searchContainer,
    onKeyDown: handleKeyDown
  }), filteredItems.map((item) => /* @__PURE__ */ React2__default.default.createElement(SearchableMenuItemRow, {
    key: item.key,
    item,
    onItemSelected
  })), filteredItems.length === 0 && /* @__PURE__ */ React2__default.default.createElement("div", {
    className: SearchableMenu_default.emptyState
  }, emptyMessage)))));
}
var SearchableMenu = /* @__PURE__ */ React2.memo(SearchableMenuInner);
function SearchableMenuItemRowInner({
  item,
  onItemSelected
}) {
  const handleClick = React2.useCallback(() => onItemSelected(item.key), [onItemSelected, item.key]);
  return /* @__PURE__ */ React2__default.default.createElement(menu.Menu.Item, {
    className: SearchableMenu_default.menuItem,
    onClick: handleClick
  }, item.label);
}
var SearchableMenuItemRow = /* @__PURE__ */ React2.memo(SearchableMenuItemRowInner);

// src/base-components/checkbox/Checkbox.module.css
var Checkbox_default = {};

// src/base-components/checkbox/Checkbox.tsx
function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}
function Checkbox({
  indeterminate,
  className,
  isExcluding,
  indicatorProps,
  ...rest
}) {
  return /* @__PURE__ */ React2__default.default.createElement(checkbox.Checkbox.Root, _extends({
    className: classnames2__default.default(Checkbox_default.osdkCheckboxRoot, className),
    indeterminate,
    "data-excluding": isExcluding || void 0
  }, rest), /* @__PURE__ */ React2__default.default.createElement(checkbox.Checkbox.Indicator, _extends({}, indicatorProps, {
    className: classnames2__default.default(Checkbox_default.osdkCheckboxIndicator, indicatorProps?.className)
  }), indeterminate ? /* @__PURE__ */ React2__default.default.createElement(icons.SmallMinus, null) : isExcluding ? /* @__PURE__ */ React2__default.default.createElement(icons.SmallCross, null) : /* @__PURE__ */ React2__default.default.createElement(icons.SmallTick, null)));
}

exports.Checkbox = Checkbox;
exports.SearchBar = SearchBar;
exports.SearchableMenu = SearchableMenu;
//# sourceMappingURL=chunk-HWBCFCBO.cjs.map
//# sourceMappingURL=chunk-HWBCFCBO.cjs.map