import { j as e } from "../../node_modules/react/jsx-runtime.mjs";
import { useEffect as k } from "react";
import { useImmer as y } from "../../node_modules/use-immer/dist/use-immer.module.mjs";
import "../../node_modules/react-device-detect/dist/lib.mjs";
import "../BitzDrawer/index.less.mjs";
import o from "./index.module.less.mjs";
import E from "../../node_modules/antd/es/theme/index.mjs";
import b from "../../node_modules/antd/es/input/index.mjs";
import N from "../../node_modules/antd/es/tree/index.mjs";
import S from "../../node_modules/@ant-design/icons/es/icons/CaretDownFilled.mjs";
import w from "../../node_modules/antd/es/space/index.mjs";
import z from "../../node_modules/antd/es/button/button.mjs";
import D from "../../node_modules/@ant-design/icons/es/icons/SettingFilled.mjs";
import K from "../../node_modules/antd/es/tag/index.mjs";
const { CheckableTag: T } = K, R = (u) => {
  const { headerRender: s, tags: t, onTagChange: a, onSearch: c, treeTitle: p, defaultCheckedKeys: f, defaultExpandedKeys: d, treeData: h, onCheck: x } = u, { token: g } = E.useToken(), [i, l] = y({
    tags: []
  });
  k(() => {
    t && l((r) => {
      r.tags = t;
    });
  }, [t == null ? void 0 : t.length]);
  function j() {
    return i.tags.length ? e.jsxs("div", { className: o.header, children: [e.jsx(w, { size: [0, 8], wrap: !0, children: i.tags.map((r, m) => e.jsx(T, { checked: !!r.checked, onChange: async (n) => {
      l((C) => {
        C.tags[m].checked = n;
      }), a == null || a({ ...r, checked: n }, n);
    }, children: r.label }, m)) }), e.jsx(z, { icon: e.jsx(D, { style: { color: g.colorPrimary } }), type: "text", className: o["setting-btn"] })] }) : s == null ? void 0 : s();
  }
  return e.jsxs("div", { className: o.container, children: [j(), c && e.jsx(b, { className: o.search, placeholder: "组织名称查询", onChange: c }), p, e.jsx(N, { checkable: !0, showLine: !0, blockNode: !0, selectable: !1, switcherIcon: e.jsx(S, { style: { verticalAlign: "top", fontSize: 24, color: "#86909C" } }), defaultCheckedKeys: f, defaultExpandedKeys: d, treeData: h, onCheck: x })] });
};
export {
  R as default
};
