import { defineComponent as k, computed as l, unref as c, openBlock as o, createBlock as n, withCtx as A, createElementBlock as f, Fragment as p, renderList as v, mergeProps as s, createCommentVNode as y } from "vue";
import { Space as F } from "@aplus-frontend/antdv";
import { isUndefined as x } from "lodash-unified";
import "../../config-provider/index.mjs";
import "../item/index.vue.mjs";
import "../item-dropdown/index.vue2.mjs";
import "../item-modal/index.vue2.mjs";
import "../item-popconfirm/index.vue2.mjs";
import { useLocale as w } from "../../config-provider/hooks/use-locale.mjs";
import _ from "../item-dropdown/index.vue.mjs";
import B from "../item-modal/index.vue.mjs";
import $ from "../item-popconfirm/index.vue.mjs";
import b from "../item/index.vue2.mjs";
const q = /* @__PURE__ */ k({
  name: "ApActionGroup",
  __name: "index",
  props: {
    count: { default: 3 },
    trigger: { default: () => ["hover"] },
    placement: { default: "bottomRight" },
    actions: { default: () => [] },
    iconFirst: { type: Boolean, default: void 0 }
  },
  setup(m) {
    const r = m, { t: d } = w(), u = l(
      () => r.actions.filter(
        (e) => e.visible || x(e.visible)
      )
    ), g = l(() => c(u).length > r.count), a = l(() => {
      const e = c(u);
      if (e.length <= r.count)
        return {
          showActions: e.map((t) => ({
            ...t,
            iconFirst: t.iconFirst ?? r.iconFirst ?? !0
          })),
          menuActions: []
        };
      let i = e.slice(0, r.count - 1);
      return r.iconFirst && (i = i.map((t) => ({
        ...t,
        iconFirst: !0
      }))), {
        showActions: i,
        menuActions: e.slice(r.count - 1)
      };
    });
    return (e, i) => (o(), n(c(F), {
      size: 16,
      align: "center"
    }, {
      default: A(() => [
        (o(!0), f(p, null, v(a.value.showActions, (t, h) => (o(), f(p, { key: h }, [
          t.actions ? (o(), n(_, s({
            key: 0,
            ref_for: !0
          }, t), null, 16)) : t.modalProps ? (o(), n(B, s({
            key: 1,
            ref_for: !0
          }, t), null, 16)) : t.popconfirmProps ? (o(), n($, s({
            key: 2,
            ref_for: !0
          }, t), null, 16)) : (o(), n(b, s({
            key: 3,
            ref_for: !0
          }, t), null, 16))
        ], 64))), 128)),
        g.value ? (o(), n(_, {
          key: 0,
          actions: a.value.menuActions,
          placement: m.placement,
          trigger: m.trigger,
          text: c(d)("ap.common.more")
        }, null, 8, ["actions", "placement", "trigger", "text"])) : y("", !0)
      ]),
      _: 1
    }));
  }
});
export {
  q as default
};
