import { defineComponent, computed, resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeStyle, normalizeClass, unref, createVNode, withCtx, createElementVNode, renderSlot, mergeProps, toDisplayString } from 'vue';
import '../../../hooks/index.mjs';
import '../../../utils/index.mjs';
import { modalOverlayEmits, modalOverlayProps } from './modal-overlay.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';
import { useScroll } from '../../../hooks/use-scroll/index.mjs';

"use strict";
const _hoisted_1 = { class: "close-text" };
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlModalOverlay" },
  __name: "modal-overlay",
  props: modalOverlayProps,
  emits: modalOverlayEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace("modal-overlay");
    const { scrollPosition, isHasScrollBar, scrollRef } = useScroll();
    const isShowContentBottomBox = computed(() => {
      if (props.footerShadowPlacement === "inner") {
        return props.isShowFooterShadow && isHasScrollBar.value && scrollPosition.value !== "bottom";
      } else {
        return props.isShowFooterShadow;
      }
    });
    const scrollToTop = () => {
      if (scrollRef.value) {
        scrollRef.value.scrollTo({
          top: 0,
          behavior: "smooth"
        });
      }
    };
    const close = () => {
      emits("close", false);
      emits("update:open", false);
    };
    const rootStyle = computed(() => ({
      zIndex: props.zIndex,
      borderRadius: props.borderRadius
    }));
    __expose({
      scrollToTop
    });
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_a_spin = resolveComponent("a-spin");
      return _ctx.open ? (openBlock(), createElementBlock(
        "div",
        {
          key: 0,
          class: normalizeClass([unref(bem).b(), _ctx.rootClass]),
          style: normalizeStyle(rootStyle.value)
        },
        [
          createVNode(_component_a_spin, {
            spinning: _ctx.fullLoading,
            "wrapper-class-name": unref(bem).e("content")
          }, {
            default: withCtx(() => [
              createCommentVNode(" \u5934\u90E8\u533A "),
              createElementVNode(
                "div",
                {
                  class: normalizeClass(unref(bem).e("header"))
                },
                [
                  createCommentVNode(" \u5173\u95ED\u6309\u94AE "),
                  _ctx.showClose ? (openBlock(), createElementBlock(
                    "div",
                    {
                      key: 0,
                      class: normalizeClass([unref(bem).e("close"), _ctx.mediaClass]),
                      style: normalizeStyle(_ctx.closeStyle)
                    },
                    [
                      createElementVNode("div", {
                        class: "close-content",
                        onClick: close
                      }, [
                        renderSlot(_ctx.$slots, "closeIcon", {}, () => [
                          createVNode(_component_ll_icon, mergeProps(_ctx.closeIcon, {
                            "icon-name": _ctx.closeIcon.iconName || "icon-return-arrow",
                            style: { marginRight: _ctx.closeIconTextSpace + "px" }
                          }), null, 16, ["icon-name", "style"])
                        ]),
                        createElementVNode("div", _hoisted_1, [
                          renderSlot(_ctx.$slots, "closeText", {}, () => [
                            createElementVNode(
                              "span",
                              {
                                style: normalizeStyle({
                                  "font-size": _ctx.closeTextSize + "px",
                                  color: _ctx.closeTextColor
                                })
                              },
                              toDisplayString(_ctx.closeText),
                              5
                              /* TEXT, STYLE */
                            )
                          ])
                        ])
                      ])
                    ],
                    6
                    /* CLASS, STYLE */
                  )) : createCommentVNode("v-if", true),
                  createCommentVNode(" \u5934\u90E8\u6807\u9898\u63D2\u69FD "),
                  _ctx.showHeader ? (openBlock(), createElementBlock(
                    "div",
                    {
                      key: 1,
                      style: normalizeStyle(_ctx.headerStyle),
                      class: normalizeClass(["header-content", _ctx.mediaClass])
                    },
                    [
                      renderSlot(_ctx.$slots, "header")
                    ],
                    6
                    /* CLASS, STYLE */
                  )) : createCommentVNode("v-if", true)
                ],
                2
                /* CLASS */
              ),
              createCommentVNode(" \u4E3B\u5185\u5BB9\u533A "),
              createVNode(_component_a_spin, {
                spinning: _ctx.mainLoading,
                "wrapper-class-name": unref(bem).e("main-loading")
              }, {
                default: withCtx(() => [
                  createElementVNode(
                    "div",
                    {
                      ref_key: "scrollRef",
                      ref: scrollRef,
                      class: normalizeClass([
                        unref(bem).e("main"),
                        _ctx.isBespreadMain ? "bespread-main" : "",
                        _ctx.mainClass
                      ]),
                      style: normalizeStyle(_ctx.mainStyle)
                    },
                    [
                      createElementVNode(
                        "div",
                        {
                          class: normalizeClass(["main-content", _ctx.mediaClass])
                        },
                        [
                          createCommentVNode(" \u4E3B\u5185\u5BB9\u533A\u57DF\u63D2\u69FD "),
                          renderSlot(_ctx.$slots, "main")
                        ],
                        2
                        /* CLASS */
                      )
                    ],
                    6
                    /* CLASS, STYLE */
                  )
                ]),
                _: 3
                /* FORWARDED */
              }, 8, ["spinning", "wrapper-class-name"]),
              createCommentVNode(" \u9875\u811A "),
              _ctx.showFooter ? (openBlock(), createElementBlock(
                "div",
                {
                  key: 0,
                  class: normalizeClass([
                    unref(bem).e("footer"),
                    isShowContentBottomBox.value ? unref(bem).is("shadow") : ""
                  ]),
                  style: normalizeStyle(_ctx.footerStyle)
                },
                [
                  createElementVNode(
                    "div",
                    {
                      class: normalizeClass(["footer-content", _ctx.mediaClass])
                    },
                    [
                      createCommentVNode(" \u9875\u811A\u533A\u57DF\u63D2\u69FD "),
                      renderSlot(_ctx.$slots, "footer")
                    ],
                    2
                    /* CLASS */
                  )
                ],
                6
                /* CLASS, STYLE */
              )) : createCommentVNode("v-if", true)
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["spinning", "wrapper-class-name"])
        ],
        6
        /* CLASS, STYLE */
      )) : createCommentVNode("v-if", true);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=modal-overlay.vue2.mjs.map
