import { jsx as o } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { ALL_BALANCE_ACCOUNTS_SELECTION_ID as C } from "../../../../../hooks/useBalanceAccountSelection.js";
import { memo as d } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/compat/dist/compat.module.js";
import { useMemo as p, useCallback as _ } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { useResponsiveContainer as S, containerQueries as f } from "../../../../../hooks/useResponsiveContainer.js";
import { renderDefaultSingleSelectionCheckedness as u } from "../components/SelectListItem.js";
/* empty css                            */
import L from "../../../../../core/Context/preact/useCoreContext.js";
import { Fragment as A } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
import h from "../Select.js";
const r = "adyen-pe-balance-account-selector", E = `${r}__account-id`, m = `${r}__account-label`, w = d(
  ({
    activeBalanceAccount: s,
    balanceAccountSelectionOptions: t,
    onBalanceAccountSelection: i
  }) => {
    const { i18n: n } = L(), l = S(f.down.xs), a = p(() => n.get("common.filters.types.account.label"), [n]), c = _(
      (e) => /* @__PURE__ */ o(A, { children: [
        /* @__PURE__ */ o("div", { className: e.contentClassName, children: [
          e.item.name && /* @__PURE__ */ o("span", { className: m, children: e.item.name }),
          e.item.id !== C && /* @__PURE__ */ o(
            "span",
            {
              className: e.item.name ? E : m,
              "data-testid": "balance-account-id",
              children: e.item.id
            }
          )
        ] }),
        u(e)
      ] }),
      []
    );
    return t && t.length > 1 && /* @__PURE__ */ o(
      h,
      {
        popoverClassNameModifiers: [r],
        onChange: i,
        filterable: !1,
        multiSelect: !1,
        placeholder: s?.id || a,
        selected: s?.id,
        withoutCollapseIndicator: !0,
        items: t,
        renderListItem: c,
        showOverlay: l,
        "aria-label": a
      }
    );
  }
);
export {
  w as default
};
