import { defineComponent, inject, computed, resolveComponent, openBlock, createElementBlock, unref, normalizeClass, normalizeStyle, withModifiers, createElementVNode, renderSlot, toDisplayString, createVNode, withCtx, createBlock, resolveDynamicComponent, createCommentVNode, createTextVNode } from 'vue';
import { ElIcon } from '../../icon/index2.mjs';
import '../../focus-trap/index2.mjs';
import '../../../hooks/index2.mjs';
import '../../../utils/index2.mjs';
import '../../../tokens/index2.mjs';
import { dialogContentProps, dialogContentEmits } from './dialog-content3.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { CloseComponents } from '../../../utils/vue/icon2.mjs';
import { dialogInjectionKey } from '../../../tokens/dialog2.mjs';
import { FOCUS_TRAP_INJECTION_KEY } from '../../focus-trap/src/tokens2.mjs';
import { composeRefs } from '../../../utils/vue/refs2.mjs';
import { useDraggable } from '../../../hooks/use-draggable/index2.mjs';

const _hoisted_1 = ["aria-label"];
const _hoisted_2 = ["id"];
const __default__ = { name: "ElDialogContent" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: dialogContentProps,
  emits: dialogContentEmits,
  setup(__props) {
    const props = __props;
    const { Close } = CloseComponents;
    const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
    const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
    const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
    const draggable = computed(() => props.draggable);
    useDraggable(dialogRef, headerRef, draggable);
    return (_ctx, _cache) => {
      const _component_ElButton = resolveComponent("ElButton");
      return openBlock(), createElementBlock("div", {
        ref: unref(composedDialogRef),
        class: normalizeClass([
          unref(ns).b(),
          unref(ns).is("fullscreen", _ctx.fullscreen),
          unref(ns).is("draggable", unref(draggable)),
          { [unref(ns).m("center")]: _ctx.center },
          _ctx.customClass
        ]),
        style: normalizeStyle(unref(style)),
        tabindex: "-1",
        onClick: _cache[3] || (_cache[3] = withModifiers(() => {
        }, ["stop"]))
      }, [
        createElementVNode("header", {
          ref_key: "headerRef",
          ref: headerRef,
          class: normalizeClass(unref(ns).e("header"))
        }, [
          renderSlot(_ctx.$slots, "header", {}, () => [
            createElementVNode("span", {
              role: "heading",
              class: normalizeClass(unref(ns).e("title"))
            }, toDisplayString(_ctx.title), 3)
          ]),
          _ctx.showClose ? (openBlock(), createElementBlock("button", {
            key: 0,
            "aria-label": _ctx.cancelText,
            class: normalizeClass(unref(ns).e("headerbtn")),
            type: "button",
            onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
          }, [
            createVNode(unref(ElIcon), {
              class: normalizeClass(unref(ns).e("close"))
            }, {
              default: withCtx(() => [
                (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
              ]),
              _: 1
            }, 8, ["class"])
          ], 10, _hoisted_1)) : createCommentVNode("v-if", true)
        ], 2),
        renderSlot(_ctx.$slots, "body-prefix"),
        createElementVNode("div", {
          id: unref(bodyId),
          class: normalizeClass(unref(ns).e("body"))
        }, [
          renderSlot(_ctx.$slots, "default")
        ], 10, _hoisted_2),
        renderSlot(_ctx.$slots, "body-suffix"),
        _ctx.$slots.footer && _ctx.isShowFooter ? (openBlock(), createElementBlock("footer", {
          key: 0,
          class: normalizeClass(unref(ns).e("footer"))
        }, [
          renderSlot(_ctx.$slots, "footer", {}, () => [
            _ctx.cancelText ? (openBlock(), createBlock(_component_ElButton, {
              key: 0,
              class: "el-dialog__footerBtn",
              onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close"))
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(_ctx.cancelText), 1)
              ]),
              _: 1
            })) : createCommentVNode("v-if", true),
            createVNode(_component_ElButton, {
              loading: _ctx.loading,
              type: "primary",
              class: "el-dialog__footerBtn",
              onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("handleSubmit"))
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(_ctx.submitText), 1)
              ]),
              _: 1
            }, 8, ["loading"])
          ])
        ], 2)) : createCommentVNode("v-if", true)
      ], 6);
    };
  }
});
var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/wyf/work/element-plus/packages/components/dialog/src/dialog-content.vue"]]);

export { ElDialogContent as default };
//# sourceMappingURL=dialog-content4.mjs.map
