import { defineComponent as F, useSlots as M, shallowRef as m, ref as O, computed as i, h as R, provide as U, onMounted as A, openBlock as a, createElementBlock as l, normalizeClass as n, unref as t, createElementVNode as p, normalizeStyle as L, createBlock as u, withCtx as y, Fragment as f, renderList as v, createTextVNode as G, toDisplayString as S, createCommentVNode as d, renderSlot as b, resolveDynamicComponent as _, mergeProps as J, withDirectives as Q } from "vue";
import { useNamespace as W, ElLoading as X, ElBreadcrumb as Y, ElBreadcrumbItem as Z, ElTabs as ee, ElTabPane as te } from "element-plus";
import { wetProPageContainerProps as ae } from "./types.mjs";
import { useElementBounding as $ } from "../../node_modules/.pnpm/@vueuse_core@10.9.0_vue@3.4.21/node_modules/@vueuse/core/index.mjs";
import { SymbolState as re } from "./symbol.mjs";
const se = { key: 0 }, ce = /* @__PURE__ */ F({
  __name: "index",
  props: ae,
  emits: ["update:loading", "update:tabKey", "update:status"],
  setup(B, { expose: C, emit: T }) {
    const V = M(), g = m(), k = m(), o = W("pro-page-container"), H = X.directive, e = B, x = T, c = m(!1), w = O({}), K = i(() => e.status), N = i(() => c.value ? c.value : e.loading), { height: q } = $(g), { width: E } = $(k), P = i(() => e.tabList && e.tabList.length !== 0), D = i(() => {
      var s;
      return P.value && !((s = e.tabProps) != null && s.type);
    }), z = (s) => {
      x("update:tabKey", s);
    }, I = (s) => {
      x("update:status", Object.assign(e.status, s));
    }, j = i(() => R("div", {
      class: o.m()
    }, {
      default() {
        return e.extra;
      }
    })), h = async () => {
      if (c.value = !0, e.request)
        try {
          w.value = await e.request();
        } catch (s) {
          console.error(s);
        }
      c.value = !1;
    };
    return U(re, {
      pageInfo: w,
      pageStatus: K,
      refresh: h,
      setPageStatus: I
    }), A(() => {
      h();
    }), C({
      refresh: h
    }), (s, oe) => (a(), l("div", {
      class: n([t(o).b()])
    }, [
      p("div", {
        style: L({
          width: t(E) ? `${t(E)}px` : "auto"
        }),
        class: n([t(o).e("header"), t(o).is("fixed", e.fixedHeader)]),
        ref_key: "header",
        ref: g
      }, [
        e.breadcrumb ? (a(), u(t(Y), { key: 0 }, {
          default: y(() => [
            (a(!0), l(f, null, v(e.breadcrumb, (r) => (a(), u(t(Z), {
              to: { path: r.path },
              key: r.path
            }, {
              default: y(() => [
                G(S(r.name), 1)
              ]),
              _: 2
            }, 1032, ["to"]))), 128))
          ]),
          _: 1
        })) : d("", !0),
        b(s.$slots, "header", {}, () => [
          e.title || e.extra && e.extra.length !== 0 ? (a(), l("div", {
            key: 0,
            class: n([t(o).e("default-header"), t(o).is("tabs", D.value), t(o).is("fixed", e.fixedHeader)])
          }, [
            p("h2", null, S(e.title), 1),
            p("div", null, [
              (a(), u(_(j.value)))
            ])
          ], 2)) : d("", !0)
        ]),
        P.value ? (a(), u(t(ee), J({ key: 1 }, e.tabProps, {
          style: { width: "100%" },
          "onUpdate:modelValue": z,
          modelValue: s.tabKey
        }), {
          default: y(() => [
            (a(!0), l(f, null, v(e.tabList, (r) => (a(), u(t(te), {
              key: r.key,
              name: r.key,
              label: r.tab,
              closable: r.closable,
              disabled: r.disabled
            }, null, 8, ["name", "label", "closable", "disabled"]))), 128))
          ]),
          _: 1
        }, 16, ["modelValue"])) : d("", !0)
      ], 6),
      e.fixedHeader ? (a(), l("div", {
        key: 0,
        ref_key: "shadowheader",
        ref: k,
        style: L({
          height: `${t(q)}px`,
          marginBottom: "15px"
        })
      }, null, 4)) : d("", !0),
      Q((a(), l("div", {
        class: n([t(o).e("body"), t(o).is("header-fixed", e.fixedHeader)])
      }, [
        p("div", {
          class: n([t(o).e("body-innder")])
        }, [
          (a(!0), l(f, null, v(e.tabList, (r) => (a(), l(f, {
            key: r.key
          }, [
            r.key === e.tabKey ? (a(), l("div", se, [
              r.children ? (a(), u(_(r.children), { key: 0 })) : d("", !0),
              b(s.$slots, r.key)
            ])) : d("", !0)
          ], 64))), 128)),
          b(s.$slots, "default")
        ], 2)
      ], 2)), [
        [t(H), N.value]
      ]),
      t(V).footer ? (a(), l("div", {
        key: 1,
        class: n([t(o).e("footer"), t(o).is("header-fixed", e.fixedHeader)])
      }, [
        b(s.$slots, "footer")
      ], 2)) : d("", !0)
    ], 2));
  }
});
export {
  ce as default
};
