import { ref as m, watch as g, watchEffect as _, openBlock as r, createBlock as n, withCtx as s, createElementVNode as c, renderSlot as p, createCommentVNode as d, createTextVNode as y } from "vue";
import { l as k, U as C } from "./index2.js";
import { _ as $ } from "./index15.js";
const N = { class: "s-drawer-body" }, S = { class: "s-drawer-footer" }, B = {
  __name: "SDrawer",
  props: {
    value: {
      type: Boolean,
      default: !1
    },
    title: {
      type: String,
      default: ""
    },
    mode: {
      type: String,
      default: "right"
    },
    width: {
      type: Number,
      default: 500
    },
    height: {
      type: Number,
      default: 378
    },
    footer: {
      type: Boolean,
      default: !1
    }
  },
  emits: ["update:value", "confirm"],
  setup(t, { emit: v }) {
    const l = v, o = t, i = m(o.value);
    g(
      () => o.value,
      (e) => {
        i.value = e;
      },
      { immediate: !0 }
    );
    const w = m(o.mode);
    _(() => {
      const e = {
        left: "",
        right: "",
        top: "",
        bottom: ""
      };
      Object.keys(e).includes(o.mode) || (console.warn(`当前设置mode【${o.mode}】不在【${e}】中，已默认为【right】`), w.value = "right");
    });
    const u = () => {
      l("update:value", !1);
    }, h = () => {
      l("update:value", !1), l("confirm");
    };
    return (e, a) => {
      const f = C, b = $;
      return r(), n(b, {
        rootClassName: "s-drawer-wrap",
        title: t.title,
        placement: t.mode,
        width: t.width,
        visible: i.value,
        onClose: u,
        bodyStyle: {
          padding: 0,
          display: "flex",
          flexDirection: "column"
        }
      }, {
        default: s(() => [
          c("div", N, [
            p(e.$slots, "default", {}, void 0, !0)
          ]),
          c("div", S, [
            e.$slots.footer ? p(e.$slots, "footer", { key: 0 }, void 0, !0) : d("", !0),
            !e.$slots.footer && t.footer ? (r(), n(f, {
              key: 1,
              onClick: u
            }, {
              default: s(() => a[0] || (a[0] = [
                y("取消")
              ])),
              _: 1
            })) : d("", !0),
            !e.$slots.footer && t.footer ? (r(), n(f, {
              key: 2,
              type: "primary",
              onClick: h
            }, {
              default: s(() => a[1] || (a[1] = [
                y("确定")
              ])),
              _: 1
            })) : d("", !0)
          ])
        ]),
        _: 3
      }, 8, ["title", "placement", "width", "visible"]);
    };
  }
}, E = /* @__PURE__ */ k(B, [["__scopeId", "data-v-ca619d56"]]);
export {
  E as default
};
