import w from "../../../@babel/runtime/helpers/esm/toConsumableArray.mjs";
import u from "../../../classnames/index.mjs";
import * as f from "react";
import S from "../../../@ant-design/icons/es/icons/LoadingOutlined.mjs";
import k from "./TimelineItem.mjs";
var h = globalThis && globalThis.__rest || function(n, t) {
  var o = {};
  for (var r in n)
    Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (o[r] = n[r]);
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
    for (var s = 0, r = Object.getOwnPropertySymbols(n); s < r.length; s++)
      t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (o[r[s]] = n[r[s]]);
  return o;
};
const x = (n) => {
  var {
    prefixCls: t,
    className: o,
    pending: r = !1,
    children: s,
    items: v,
    rootClassName: b,
    reverse: m = !1,
    direction: $,
    hashId: y,
    pendingDot: O,
    mode: i = ""
  } = n, C = h(n, ["prefixCls", "className", "pending", "children", "items", "rootClassName", "reverse", "direction", "hashId", "pendingDot", "mode"]);
  const N = (e, l) => i === "alternate" ? e === "right" ? `${t}-item-right` : e === "left" ? `${t}-item-left` : l % 2 === 0 ? `${t}-item-left` : `${t}-item-right` : i === "left" ? `${t}-item-left` : i === "right" ? `${t}-item-right` : e === "right" ? `${t}-item-right` : "", a = w(v || []), I = typeof r == "boolean" ? null : r;
  r && a.push({
    pending: !!r,
    dot: O || /* @__PURE__ */ f.createElement(S, null),
    children: I
  }), m && a.reverse();
  const d = a.length, p = `${t}-item-last`, j = a.filter((e) => !!e).map((e, l) => {
    var c;
    const L = l === d - 2 ? p : "", T = l === d - 1 ? p : "", {
      className: _
    } = e, E = h(e, ["className"]);
    return /* @__PURE__ */ f.createElement(k, Object.assign({}, E, {
      className: u([_, !m && r ? L : T, N((c = e == null ? void 0 : e.position) !== null && c !== void 0 ? c : "", l)]),
      /* eslint-disable-next-line react/no-array-index-key */
      key: (e == null ? void 0 : e.key) || l
    }));
  }), g = a.some((e) => !!(e != null && e.label)), P = u(t, {
    [`${t}-pending`]: !!r,
    [`${t}-reverse`]: !!m,
    [`${t}-${i}`]: !!i && !g,
    [`${t}-label`]: g,
    [`${t}-rtl`]: $ === "rtl"
  }, o, b, y);
  return /* @__PURE__ */ f.createElement("ul", Object.assign({}, C, {
    className: P
  }), j);
}, z = x;
export {
  z as default
};
