import { jsx as s } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import C from "classnames";
import { memo as S } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/compat/dist/compat.module.js";
import { useRef as _, useEffect as D } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { DROPDOWN_ELEMENT_CHECKMARK_CLASS as O, DROPDOWN_ELEMENT_CLASS as f, DROPDOWN_ELEMENT_KEYBOARD_ACTIVE_CLASS as u, DROPDOWN_ELEMENT_DISABLED_CLASS as L, DROPDOWN_ELEMENT_ACTIVE_CLASS as d, DROPDOWN_ELEMENT_ICON_CLASS as p, DROPDOWN_ELEMENT_CONTENT_CLASS as h, DROPDOWN_ELEMENT_CHECKBOX_CLASS as A } from "../constants.js";
import { Icon as r } from "../../../Icon/Icon.js";
import R from "../../../Img/Img.js";
import { Fragment as T } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
import { boolOrFalse as I } from "../../../../../utils/value/bool.js";
const M = (e) => e.multiSelect ? /* @__PURE__ */ s("span", { className: A, children: e.selected ? /* @__PURE__ */ s(r, { name: "checkmark-square-fill" }) : /* @__PURE__ */ s(r, { name: "square" }) }) : null, k = (e) => e.multiSelect ? null : /* @__PURE__ */ s("span", { className: O, children: e.selected && /* @__PURE__ */ s(r, { name: "checkmark" }) }), K = (e) => /* @__PURE__ */ s(T, { children: [
  M(e),
  /* @__PURE__ */ s("div", { className: e.contentClassName, children: [
    e.item.icon && /* @__PURE__ */ s(R, { className: e.iconClassName, alt: e.item.name, src: e.item.icon }),
    /* @__PURE__ */ s("span", { children: e.item.name })
  ] }),
  k(e)
] }), b = ({
  item: e,
  multiSelect: o,
  onKeyDown: a,
  onSelect: c,
  renderListItem: i,
  selected: l,
  isKeyboardActive: n
}) => {
  const m = !!e.disabled, t = _(null), E = I(e.disabled) || null, N = C(f, {
    [d]: l,
    [L]: m,
    [u]: n
  });
  return D(() => {
    n && t.current && t.current.scrollIntoView({ block: "nearest", behavior: "smooth" });
  }, [n]), /* @__PURE__ */ s(
    "li",
    {
      ref: t,
      "aria-disabled": m,
      "aria-selected": l,
      className: N,
      "data-disabled": E,
      "data-value": e.id,
      onClick: c,
      onKeyDown: a,
      title: e.name,
      role: "option",
      tabIndex: -1,
      children: i({
        item: e,
        multiSelect: o,
        selected: l,
        contentClassName: h,
        iconClassName: p
      })
    }
  );
}, j = S(b);
export {
  j as default,
  M as renderDefaultMultiSelectionCheckedness,
  k as renderDefaultSingleSelectionCheckedness,
  K as renderListItemDefault
};
