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