import { j as s } from "../../node_modules/react/jsx-runtime.mjs";
import { useState as B } from "react";
import j from "../../node_modules/classnames/index.mjs";
import { createNamespace as C } from "../../utils/create.mjs";
import R from "../../node_modules/rc-resize-observer/es/index.mjs";
import "./index.less.mjs";
import w from "../../node_modules/antd/es/avatar/index.mjs";
import y from "../../node_modules/antd/es/space/index.mjs";
import A from "../../node_modules/antd/es/breadcrumb/Breadcrumb.mjs";
import F from "../../node_modules/@ant-design/icons/es/icons/ArrowRightOutlined.mjs";
import O from "../../node_modules/@ant-design/icons/es/icons/ArrowLeftOutlined.mjs";
const P = (e, t, i, n) => !i || !n ? null : /* @__PURE__ */ s.jsx("div", { className: `${e}-back ${t}`.trim(), children: /* @__PURE__ */ s.jsx(
  "div",
  {
    role: "button",
    onClick: (o) => {
      n == null || n(o);
    },
    className: `${e}-back-button ${t}`.trim(),
    "aria-label": "back",
    children: i
  }
) }), T = (e, t) => {
  var i;
  return (i = e.items) != null && i.length ? /* @__PURE__ */ s.jsx(
    A,
    {
      ...e,
      className: j(`${t}-breadcrumb`, e.className)
    }
  ) : null;
}, H = (e, t = "ltr") => e.backIcon !== void 0 ? e.backIcon : t === "rtl" ? /* @__PURE__ */ s.jsx(F, {}) : /* @__PURE__ */ s.jsx(O, {}), S = (e, t, i = "ltr", n) => {
  const {
    title: o,
    avatar: l,
    subTitle: a,
    tags: m,
    extra: d,
    onBack: f
  } = t, c = `${e}-heading`, r = o || a || m || d;
  if (!r)
    return null;
  const u = H(t, i), $ = P(e, n, u, f), x = $ || l || r;
  return /* @__PURE__ */ s.jsxs("div", { className: c + " " + n, children: [
    x && /* @__PURE__ */ s.jsxs("div", { className: `${c}-left ${n}`.trim(), children: [
      $,
      l && /* @__PURE__ */ s.jsx(
        w,
        {
          className: j(
            `${c}-avatar`,
            n,
            l.className
          ),
          ...l
        }
      ),
      o && /* @__PURE__ */ s.jsx(
        "span",
        {
          className: `${c}-title ${n}`.trim(),
          title: typeof o == "string" ? o : void 0,
          children: o
        }
      ),
      a && /* @__PURE__ */ s.jsx(
        "span",
        {
          className: `${c}-sub-title ${n}`.trim(),
          title: typeof a == "string" ? a : void 0,
          children: a
        }
      ),
      m && /* @__PURE__ */ s.jsx("span", { className: `${c}-tags ${n}`.trim(), children: m })
    ] }),
    d && /* @__PURE__ */ s.jsx("span", { className: `${c}-extra ${n}`.trim(), children: /* @__PURE__ */ s.jsx(y, { children: d }) })
  ] });
}, E = (e, t, i) => /* @__PURE__ */ s.jsx("div", { className: `${e}-content ${i}`.trim(), children: t }), L = (e, t, i) => t ? /* @__PURE__ */ s.jsx("div", { className: `${e}-footer ${i}`.trim(), children: t }) : null, Z = (e) => {
  const [t, i] = C("bitz-page-header"), n = "ltr", o = "id_123123", [l, a] = B(!1), m = ({ width: z }) => a(z < 768), {
    style: d,
    footer: f,
    children: c,
    breadcrumb: r,
    breadcrumbRender: u,
    className: $,
    contentWidth: x
  } = e, N = (() => (r && !(r != null && r.items) && (r != null && r.routes) && (r.items = r.routes), r != null && r.items ? T(r, t) : null))(), h = r && "props" in r, D = (u == null ? void 0 : u({ ...e, prefixCls: t }, N)) ?? N, p = h ? r : D, k = j(t, o, $, {
    [`${t}-has-breadcrumb`]: !!p,
    [`${t}-has-footer`]: !!f,
    // [`${prefixCls}-rtl`]: direction === 'rtl',
    [`${t}-compact`]: l,
    [`${t}-wide`]: x === "Fixed",
    [`${t}-ghost`]: !0
  }), g = S(t, e, n, o), v = c && E(t, c, o), b = L(t, f, o);
  return !p && !g && !b && !v ? null : /* @__PURE__ */ s.jsx(R, { onResize: m, children: /* @__PURE__ */ s.jsxs("div", { className: k, style: d, children: [
    p,
    g,
    v,
    b
  ] }) });
};
export {
  Z as default
};
