import { isArray as u, isString as d } from "lodash-unified";
function m(e) {
  const r = e.value, i = e.emptyText || "--", l = u(r) ? r : [r].filter(Boolean);
  if (!l.length)
    return i;
  const t = [], f = e.fieldNames?.label || "label", c = e.fieldNames?.value || "value";
  function o(a) {
    for (const n of a) {
      if (l.find((s) => s === n[c]) && t.push(n[f]), t.length === l.length)
        return;
      n.children?.length && o(n.children);
    }
  }
  return o(e.treeData), t.length ? t.filter((a) => d(a)).join("、") : i;
}
export {
  m as treeSelectRenderer
};
