import '@das-fed/upf-ui/packages/components/popover/style.css';
import { defineComponent as O, useAttrs as x, ref as h, computed as D, openBlock as n, createBlock as P, unref as o, mergeProps as b, withCtx as r, renderSlot as m, withDirectives as g, createElementBlock as l, toDisplayString as i, createCommentVNode as u, createElementVNode as z, createTextVNode as p, createVNode as f } from "vue";
import { withInstall as R } from "@das-fed/upf-utils/with-install/index";
import { i18n as v, setI18nRule as V } from "@das-fed/upf-web/packages/i18n/index";
import { ElPopover as E, ClickOutside as I } from "element-plus";
import { DasButton as C } from "@das-fed/upf-ui/packages/components/button/index";
import "element-plus/es/components/popover/style/css";
import "@das-fed/upf-ui/packages/global/theme";
const M = { class: "das-ui-popover-container" }, S = {
  key: 0,
  class: "das-ui-popover-title"
}, T = { class: "das-ui-popover-content" }, A = {
  key: 0,
  class: "btn-groups"
}, K = /* @__PURE__ */ O({
  __name: "Index",
  props: {
    title: {},
    width: { default: "240px" },
    content: {},
    popperClass: {},
    showBtns: { type: Boolean, default: !1 },
    placement: { default: "bottom-start" }
  },
  emits: ["cancel", "confirm", "clickOutside"],
  setup(e, { expose: k, emit: w }) {
    const c = e, a = w, $ = x(), d = h(null), y = D(() => {
      let t = "das-ui-popover-over-container";
      return c.popperClass && (t = `${t} ${c.popperClass}`), t;
    }), N = () => {
      $.visible !== void 0 && a("clickOutside");
    };
    return k({ $popoverRef: d }), (t, s) => (n(), P(o(E), b({
      ref_key: "$popoverRef",
      ref: d,
      class: "das-ui-popover",
      placement: e.placement,
      width: e.width,
      "popper-class": y.value
    }, t.$attrs), {
      reference: r(() => [
        m(t.$slots, "reference")
      ]),
      default: r(() => [
        g((n(), l("div", M, [
          e.title ? (n(), l(
            "div",
            S,
            i(e.title),
            1
            /* TEXT */
          )) : u("v-if", !0),
          m(t.$slots, "default", {}, () => [
            z("div", T, [
              p(
                i(e.content) + " ",
                1
                /* TEXT */
              ),
              e.showBtns ? (n(), l("div", A, [
                f(o(C), {
                  onClick: s[0] || (s[0] = (B) => a("cancel"))
                }, {
                  default: r(() => [
                    p(
                      i(o(v)("das-ui-popover-cancel").value),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                }),
                f(o(C), {
                  btnType: "primary",
                  onClick: s[1] || (s[1] = (B) => a("confirm")),
                  style: { "margin-left": "12px" }
                }, {
                  default: r(() => [
                    p(
                      i(o(v)("das-ui-popover-confirm").value),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                })
              ])) : u("v-if", !0)
            ])
          ])
        ])), [
          [o(I), N]
        ])
      ]),
      _: 3
      /* FORWARDED */
    }, 16, ["placement", "width", "popper-class"]));
  }
}), _ = {
  "das-ui-popover-confirm": { "zh-CN": "确定", en: "OK", "zh-MO": "確定", _appCode: "framework" },
  "das-ui-popover-cancel": { "zh-CN": "取消", en: "Cancel", "zh-MO": "取消", _appCode: "framework" }
};
V(_);
const Q = () => h(null), U = R(K), W = { title: "Popover 气泡卡片" };
export {
  U as DasPopover,
  Q as DasPopoverRef,
  W as default
};
