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