import { j as r } from "../../node_modules/react/jsx-runtime.mjs";
import P, { useMemo as b } from "react";
import "./index.less.mjs";
import w from "../BitzPageHeader/index.mjs";
import N from "../../node_modules/classnames/index.mjs";
import H from "../../node_modules/antd/es/spin/index.mjs";
import B from "../../node_modules/antd/es/watermark/index.mjs";
import C from "../../node_modules/antd/es/affix/index.mjs";
import R from "../../node_modules/antd/es/tabs/index.mjs";
function S(e) {
  return typeof e == "object" ? e : { spinning: e };
}
const z = ({
  tabList: e,
  tabActiveKey: t,
  onTabChange: a,
  hashId: n,
  tabBarExtraContent: d,
  tabProps: u,
  prefixedClassName: p
}) => Array.isArray(e) || d ? /* @__PURE__ */ r.jsx(
  R,
  {
    className: `${p}-tabs ${n}`.trim(),
    activeKey: t,
    onChange: (o) => {
      a && a(o);
    },
    tabBarExtraContent: d,
    items: e == null ? void 0 : e.map((o, m) => {
      var f;
      return {
        label: o.tab,
        ...o,
        key: ((f = o.key) == null ? void 0 : f.toString()) || (m == null ? void 0 : m.toString())
      };
    }),
    ...u,
    children: e == null ? void 0 : e.map((o, m) => /* @__PURE__ */ r.jsx(R.TabPane, { tab: o.tab, ...o }, o.key || m))
  }
) : null, M = (e, t, a, n) => !e && !t ? null : /* @__PURE__ */ r.jsx("div", { className: `${a}-detail ${n}`.trim(), children: /* @__PURE__ */ r.jsx("div", { className: `${a}-main ${n}`.trim(), children: /* @__PURE__ */ r.jsxs("div", { className: `${a}-row ${n}`.trim(), children: [
  e && /* @__PURE__ */ r.jsx("div", { className: `${a}-content ${n}`.trim(), children: e }),
  t && /* @__PURE__ */ r.jsx(
    "div",
    {
      className: `${a}-extraContent ${n}`.trim(),
      children: t
    }
  )
] }) }) }), A = (e) => {
  var j;
  const {
    title: t,
    content: a,
    pageHeaderRender: n,
    header: d,
    prefixedClassName: u,
    extraContent: p,
    childrenContentStyle: o,
    style: m,
    prefixCls: f,
    hashId: x,
    value: s,
    breadcrumbRender: i,
    ...v
  } = e, h = () => {
    if (i)
      return i;
  };
  if (n === !1)
    return null;
  if (n)
    return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
      " ",
      n({ ...e, ...s })
    ] });
  let $ = t;
  !t && t !== !1 && ($ = s.title);
  const g = {
    ...s,
    title: $,
    ...v,
    footer: z({
      ...v,
      hashId: x,
      breadcrumbRender: i,
      prefixedClassName: u
    }),
    ...d
  }, { breadcrumb: l } = g, y = (!l || !(l != null && l.itemRender) && !((j = l == null ? void 0 : l.items) != null && j.length)) && !i;
  return [
    "title",
    "subTitle",
    "extra",
    "tags",
    "footer",
    "avatar",
    "backIcon"
  ].every((c) => !g[c]) && y && !a && !p ? null : /* @__PURE__ */ r.jsx(
    w,
    {
      ...g,
      className: `${u}-warp-page-header ${x}`.trim(),
      breadcrumb: i === !1 ? void 0 : { ...g.breadcrumb, ...s.breadcrumbProps },
      breadcrumbRender: h(),
      prefixCls: f,
      children: (d == null ? void 0 : d.children) || M(a, p, u, x)
    }
  );
}, G = (e) => {
  var j;
  const t = "id_asd123", {
    children: a,
    loading: n = !1,
    className: d,
    style: u,
    footer: p,
    affixProps: o,
    // token: propsToken,
    fixedHeader: m,
    breadcrumbRender: f,
    // footerToolBarProps,
    childrenContentStyle: x,
    ...s
  } = e, i = "bitz-page-container", v = b(() => {
    var c;
    return f == !1 ? !1 : f || ((c = s == null ? void 0 : s.header) == null ? void 0 : c.breadcrumbRender);
  }, [f, (j = s == null ? void 0 : s.header) == null ? void 0 : j.breadcrumbRender]), h = A({
    ...s,
    breadcrumbRender: v,
    ghost: !0,
    hashId: t,
    prefixCls: void 0,
    prefixedClassName: i,
    value: {}
  }), $ = b(() => {
    if (P.isValidElement(n))
      return n;
    if (typeof n == "boolean" && !n)
      return null;
    const c = S(n);
    return c.spinning ? /* @__PURE__ */ r.jsx("div", { style: { paddingBlockStart: 100, textAlign: "center" }, children: /* @__PURE__ */ r.jsx(H, { size: "large", ...c }) }) : null;
  }, [n]), g = b(() => a ? /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsx(
    "div",
    {
      className: N(
        `${i}-children-container ${t}`.trim()
      ),
      style: {
        // paddingBlockStart: props?.header ? 0 : token?.layout?.pageContainer?.paddingBlockPageContainerContent,
        ...x
      },
      children: a
    }
  ) }) : null, [a, i, x, t]), l = b(() => {
    const c = $ || g;
    if (e.waterMarkProps) {
      const k = {
        // ...value.waterMarkProps,
        ...e.waterMarkProps
      };
      return /* @__PURE__ */ r.jsx(B, { ...k, children: c });
    }
    return c;
  }, [e.waterMarkProps, $, g]), y = N(i, t, d, {
    [`${i}-with-footer`]: p,
    [`${i}-with-affix`]: m && h
    // [`${basePageContainer}-stylish`]: !!restProps.stylish,
  });
  return /* @__PURE__ */ r.jsx("div", { className: "BitzPageContainerBlock", children: /* @__PURE__ */ r.jsxs("div", { style: u, className: y, children: [
    m && h ? (
      // 在 hasHeader 且 fixedHeader 的情况下，才需要设置高度
      /* @__PURE__ */ r.jsx(
        C,
        {
          offsetTop: 1,
          ...o,
          className: `${i}-affix ${t}`.trim(),
          children: /* @__PURE__ */ r.jsx("div", { className: `${i}-warp ${t}`.trim(), children: h })
        }
      )
    ) : h,
    l && l
  ] }) });
};
export {
  G as default
};
