import c from "../../../classnames/index.mjs";
import u from "../../../rc-util/es/pickAttrs.mjs";
import * as i from "react";
var m = globalThis && globalThis.__rest || function(t, r) {
  var a = {};
  for (var e in t)
    Object.prototype.hasOwnProperty.call(t, e) && r.indexOf(e) < 0 && (a[e] = t[e]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var n = 0, e = Object.getOwnPropertySymbols(t); n < e.length; n++)
      r.indexOf(e[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[n]) && (a[e[n]] = t[e[n]]);
  return a;
};
function p(t, r) {
  if (t.title === void 0 || t.title === null)
    return null;
  const a = Object.keys(r).join("|");
  return typeof t.title == "object" ? t.title : String(t.title).replace(new RegExp(`:(${a})`, "g"), (e, n) => r[n] || e);
}
function b(t, r, a, e) {
  if (a == null)
    return null;
  const {
    className: n,
    onClick: s
  } = r, o = m(r, ["className", "onClick"]), l = Object.assign(Object.assign({}, u(o, {
    data: !0,
    aria: !0
  })), {
    onClick: s
  });
  return e !== void 0 ? /* @__PURE__ */ i.createElement("a", Object.assign({}, l, {
    className: c(`${t}-link`, n),
    href: e
  }), a) : /* @__PURE__ */ i.createElement("span", Object.assign({}, l, {
    className: c(`${t}-link`, n)
  }), a);
}
function O(t, r) {
  return (e, n, s, o, l) => {
    if (r)
      return r(e, n, s, o);
    const f = p(e, n);
    return b(t, e, f, l);
  };
}
export {
  O as default,
  b as renderItem
};
