import { defineComponent, computed, watch, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, renderSlot, createVNode, unref, withCtx } from 'vue';
import { ElResult } from 'element-plus';
import { MePageResult } from '../../page-result/index.mjs';

"use strict";
const _hoisted_1 = {
  key: 0,
  style: { "width": "100%", "height": "100%", "overflow": "hidden", "display": "flex" }
};
const _hoisted_2 = ["space"];
const _hoisted_3 = ["space"];
const _hoisted_4 = { style: { "height": "100%", "padding": "15px", "box-sizing": "border-box" } };
const _hoisted_5 = {
  key: 3,
  class: "me-body-container"
};
const _hoisted_6 = {
  key: 4,
  style: { "width": "100%", "height": "100%", "overflow": "hidden", "display": "flex" },
  class: "me-body-container"
};
const _hoisted_7 = { style: {} };
const _hoisted_8 = {
  style: { "overflow": "auto", "height": "100%" },
  class: "me-div-scroller"
};
const _hoisted_9 = { style: {} };
const __default__ = defineComponent({
  name: "me-body"
});
var script = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    background: { type: String, required: false, default: "#fff" },
    space: { type: Number, required: false, default: 0 },
    mode: { type: String, required: false, default: "normal" },
    fullScreen: { type: Boolean, required: false, default: false },
    error: { type: Boolean, required: false, skipCheck: true, default: false },
    loading: { type: Boolean, required: false, default: false },
    result: { type: null, required: false, default: void 0 },
    title: { type: String, required: false },
    subTitle: { type: String, required: false }
  },
  setup(__props) {
    const props = __props;
    let space = computed(() => {
      return props.fullScreen ? 0 : props.space;
    });
    const bodyStyle = computed(() => {
      let height = "100%";
      if (props.loading || props.mode == "full") {
        height = "100%";
      } else {
        height = "fit-content";
      }
      return {
        height
      };
    });
    watch(
      () => props.fullScreen,
      (fullScreen) => {
        console.log(`fullScreen is: ${fullScreen}`);
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: "me-body",
          style: normalizeStyle(bodyStyle.value)
        },
        [
          props.loading && !props.error ? (openBlock(), createElementBlock("div", _hoisted_1, [
            createElementVNode(
              "div",
              {
                style: normalizeStyle([{ "width": "100%", "overflow": "hidden", "display": "flex", "align-items": "center", "justify-content": "center", "background": "rgb(255, 255, 255)" }, { margin: props.space + "px" }])
              },
              [..._cache[0] || (_cache[0] = [
                createElementVNode(
                  "div",
                  { class: "me-body__loader" },
                  "loading",
                  -1
                  /* CACHED */
                )
              ])],
              4
              /* STYLE */
            )
          ])) : createCommentVNode("v-if", true),
          props.error ? (openBlock(), createElementBlock("div", {
            key: 1,
            space: props.space
          }, [
            renderSlot(_ctx.$slots, "me-body-error", {}, () => [
              createVNode(unref(MePageResult))
            ])
          ], 8, _hoisted_2)) : createCommentVNode("v-if", true),
          props.result ? (openBlock(), createElementBlock("div", {
            key: 2,
            space: props.space,
            style: { "height": "100%" }
          }, [
            createElementVNode("div", _hoisted_4, [
              createVNode(unref(ElResult), {
                style: { "height": "100%", "background": "#fff" },
                icon: props.result,
                title: props.title,
                "sub-title": props.subTitle
              }, {
                extra: withCtx(() => [
                  renderSlot(_ctx.$slots, "me-body-result", {}, () => [
                    renderSlot(_ctx.$slots, "default")
                  ])
                ]),
                _: 3
                /* FORWARDED */
              }, 8, ["icon", "title", "sub-title"])
            ])
          ], 8, _hoisted_3)) : createCommentVNode("v-if", true),
          createCommentVNode(" mode normal "),
          !props.loading && !props.error && !props.result && props.mode == "normal" ? (openBlock(), createElementBlock("div", _hoisted_5, [
            createElementVNode(
              "div",
              {
                style: normalizeStyle({ background: props.background, margin: `${unref(space)}px` })
              },
              [
                renderSlot(_ctx.$slots, "me-body-header"),
                renderSlot(_ctx.$slots, "me-body-main"),
                renderSlot(_ctx.$slots, "me-body-footer")
              ],
              4
              /* STYLE */
            )
          ])) : createCommentVNode("v-if", true),
          createCommentVNode(" mode full "),
          !props.loading && !props.error && !props.result && props.mode == "full" ? (openBlock(), createElementBlock("div", _hoisted_6, [
            createElementVNode(
              "div",
              {
                style: normalizeStyle([{ "width": "100%", "flex": "1", "overflow": "hidden", "display": "flex", "flex-direction": "column" }, { background: props.background, margin: `${unref(space)}px` }])
              },
              [
                createElementVNode("div", _hoisted_7, [
                  renderSlot(_ctx.$slots, "me-body-header")
                ]),
                createElementVNode("div", _hoisted_8, [
                  renderSlot(_ctx.$slots, "me-body-main")
                ]),
                createElementVNode("div", _hoisted_9, [
                  renderSlot(_ctx.$slots, "me-body-footer")
                ])
              ],
              4
              /* STYLE */
            )
          ])) : createCommentVNode("v-if", true)
        ],
        4
        /* STYLE */
      );
    };
  }
});

export { script as default };
//# sourceMappingURL=body.vue2.mjs.map
