"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),v=require("lodash-es"),I=require("../_util/classNames.js"),g=require("../_util/createContext.js"),h=require("../_util/props-util/index.js"),i=require("../_util/type.js"),f=require("../_util/vue-types/index.js"),z=require("../config-provider/hooks/useConfigInject.js"),q=require("./style/index.js"),S=()=>({compactSize:String,compactDirection:f.default.oneOf(i.tuple("horizontal","vertical")).def("horizontal"),isFirstItem:i.booleanType(),isLastItem:i.booleanType()}),s=g.default(null),b=(e,o)=>{const a=s.useInject(),c=t.computed(()=>{if(!a||v.isEmpty(a))return"";const{compactDirection:l,isFirstItem:n,isLastItem:u}=a,r=l==="vertical"?"-vertical-":"-";return I.default({[`${e.value}-compact${r}item`]:!0,[`${e.value}-compact${r}first-item`]:n,[`${e.value}-compact${r}last-item`]:u,[`${e.value}-compact${r}item-rtl`]:o.value==="rtl"})});return{compactSize:t.computed(()=>a?.compactSize),compactDirection:t.computed(()=>a?.compactDirection),compactItemClassnames:c}},N=t.defineComponent({name:"NoCompactStyle",setup(e,{slots:o}){return s.useProvide(null),()=>o.default?.()}}),$=()=>({prefixCls:String,size:{type:String},direction:f.default.oneOf(i.tuple("horizontal","vertical")).def("horizontal"),align:f.default.oneOf(i.tuple("start","end","center","baseline")),block:{type:Boolean,default:void 0}}),P=t.defineComponent({name:"CompactItem",props:S(),setup(e,{slots:o}){return s.useProvide(e),()=>o.default?.()}}),k=t.defineComponent({name:"ASpaceCompact",inheritAttrs:!1,props:$(),setup(e,{attrs:o,slots:a}){const{prefixCls:c,direction:l}=z.default("space-compact",e),n=s.useInject(),[u,r]=q.default(c),y=t.computed(()=>I.default(c.value,r.value,{[`${c.value}-rtl`]:l.value==="rtl",[`${c.value}-block`]:e.block,[`${c.value}-vertical`]:e.direction==="vertical"}));return()=>{const m=h.flattenChildren(a.default?.()||[]);return m.length===0?null:u(t.createVNode("div",{...o,class:[y.value,o.class]},[m.map((p,d)=>{const x=p&&p.key||`${c.value}-item-${d}`,C=!n||v.isEmpty(n);return t.createVNode(P,{key:x,compactSize:e.size??"middle",compactDirection:e.direction,isFirstItem:d===0&&(C||n?.isFirstItem),isLastItem:d===m.length-1&&(C||n?.isLastItem)},{default:()=>[p]})})]))}}});exports.NoCompactStyle=N;exports.SpaceCompactItemContext=s;exports.default=k;exports.spaceCompactItemProps=S;exports.spaceCompactProps=$;exports.useCompactItemContext=b;
