import { j as s } from "../../node_modules/react/jsx-runtime.mjs";
import { useState as j, useRef as v } from "react";
import r from "./index.module.less.mjs";
import N from "../BitzEmpty/index.mjs";
import B from "../BitzDrawer/index.mjs";
import x from "../BitzButton/index.mjs";
import y from "../../node_modules/@ant-design/icons/es/icons/SearchOutlined.mjs";
import C from "../../node_modules/@ant-design/icons/es/icons/AlignCenterOutlined.mjs";
import A from "../../node_modules/antd/es/tabs/index.mjs";
import g from "../../node_modules/antd/es/grid/row.mjs";
import k from "../../node_modules/antd/es/space/index.mjs";
const z = ({ list: l, onSelect: t, onClickItem: n }) => {
  const d = ["全部", "0-9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], o = v(null), [u, p] = j("全部");
  function m(e) {
    return /[\u4e00-\u9fa5]/.test(e) ? e == null ? void 0 : e.slice(1) : e == null ? void 0 : e.slice(0, 4);
  }
  function f(e) {
    return e.length ? e == null ? void 0 : e.map((i) => s.jsxs("div", { className: r.item, onClick: () => {
      n == null || n(i);
    }, children: [s.jsx("div", { className: r.avatar, children: m(i.name) }), s.jsxs("div", { className: r.info, children: [s.jsx("div", { className: r.name, children: i.name }), s.jsx("div", { className: r.phone, children: i.phone })] })] }, i.id)) : s.jsx(N, { style: { marginTop: 100 } });
  }
  return s.jsxs("div", { ref: o, className: r.container, children: [s.jsx("div", { className: r.main, children: f(l) }), s.jsx("div", { className: r.sidebar, children: d.map((e) => s.jsx("div", { className: `${r.item} ${u === e ? r.active : ""}`, onClick: () => {
    p(e), t == null || t(e);
  }, children: e }, e)) })] });
}, U = ({ tabs: l = [], list: t = [], filterChildren: n, filterHeight: d = 240, onSearch: o = () => {
}, onSelect: u = () => {
}, tabChange: p = () => {
}, onClickItem: m = () => {
}, onReset: f = () => {
}, onOk: e = () => {
} }) => {
  const i = l.map((c) => ({
    ...c,
    children: s.jsx(z, { list: t, onSelect: u, onClickItem: m })
  })), [h, a] = j(!1);
  return s.jsxs("div", { className: r.BitzAdressBook, children: [s.jsxs("div", { className: r.filter, children: [s.jsxs("div", { className: r.input, children: [s.jsx(y, { className: r.icon }), s.jsx("input", { placeholder: "姓名", type: "text", onKeyUp: (c) => {
    c.code.toLowerCase() === "enter" && (o == null || o(c.currentTarget.value));
  } })] }), s.jsx("div", { className: r.filterIcon, onClick: () => {
    a(!0);
  }, children: s.jsx(C, {}) })] }), s.jsx(A, { items: i, onChange: p, destroyInactiveTabPane: !0 }), s.jsx(B, { title: "筛选", height: d, open: h, placement: "bottom", onClose: () => a(!1), footer: s.jsx(g, { justify: "center", children: s.jsxs(k, { children: [s.jsx(x, { onClick: () => {
    f(), a(!1);
  }, children: "重置" }), s.jsx(x, { type: "primary", onClick: () => {
    e(), a(!1);
  }, children: "确认" })] }) }), children: n })] });
};
export {
  z as AdressBook,
  U as default
};
