import { u as W, bV as k, c as L, d as m, bb as M, _ as G, bn as q, P as I, bg as j, bW as b } from "./index2.js"; import { defineComponent as H, computed as o, ref as B, watch as J, createVNode as p, Fragment as K } from "vue"; import { u as Q } from "./useFlexGapSupport.js"; const U = { small: 8, middle: 16, large: 24 }, X = () => ({ prefixCls: String, size: { type: [String, Number, Array] }, direction: I.oneOf(j("horizontal", "vertical")).def("horizontal"), align: I.oneOf(j("start", "end", "center", "baseline")), wrap: q() }); function Y(e) { return typeof e == "string" ? U[e] : e || 0; } const d = H({ compatConfig: { MODE: 3 }, name: "ASpace", inheritAttrs: !1, props: X(), slots: Object, setup(e, F) { let { slots: r, attrs: f } = F; const { prefixCls: l, space: g, direction: x } = W("space", e), [P, V] = k(l), z = Q(), n = o(() => { var t, a, i; return (i = (t = e.size) !== null && t !== void 0 ? t : (a = g == null ? void 0 : g.value) === null || a === void 0 ? void 0 : a.size) !== null && i !== void 0 ? i : "small"; }), y = B(), s = B(); J(n, () => { [y.value, s.value] = (Array.isArray(n.value) ? n.value : [n.value, n.value]).map((t) => Y(t)); }, { immediate: !0 }); const h = o(() => e.align === void 0 && e.direction === "horizontal" ? "center" : e.align), D = o(() => L(l.value, V.value, `${l.value}-${e.direction}`, { [`${l.value}-rtl`]: x.value === "rtl", [`${l.value}-align-${h.value}`]: h.value })), E = o(() => x.value === "rtl" ? "marginLeft" : "marginRight"), R = o(() => { const t = {}; return z.value && (t.columnGap = `${y.value}px`, t.rowGap = `${s.value}px`), m(m({}, t), e.wrap && { flexWrap: "wrap", marginBottom: `${-s.value}px` }); }); return () => { var t, a; const { wrap: i, direction: T = "horizontal" } = e, C = (t = r.default) === null || t === void 0 ? void 0 : t.call(r), _ = M(C), w = _.length; if (w === 0) return null; const c = (a = r.split) === null || a === void 0 ? void 0 : a.call(r), A = `${l.value}-item`, N = y.value, S = w - 1; return p("div", G(G({}, f), {}, { class: [D.value, f.class], style: [R.value, f.style] }), [_.map((O, u) => { let $ = C.indexOf(O); $ === -1 && ($ = `$$space-${u}`); let v = {}; return z.value || (T === "vertical" ? u < S && (v = { marginBottom: `${N / (c ? 2 : 1)}px` }) : v = m(m({}, u < S && { [E.value]: `${N / (c ? 2 : 1)}px` }), i && { paddingBottom: `${s.value}px` })), P(p(K, { key: $ }, [p("div", { class: A, style: v }, [O]), u < S && c && p("span", { class: `${A}-split`, style: v }, [c])])); })]); }; } }); d.Compact = b; d.install = function(e) { return e.component(d.name, d), e.component(b.name, b), e; }; export { d as S };