import{g as P,d as y,u as D,E as _,h as C,_ as b,i as c,P as g,Q as I,al as h,e as x,j as l}from"./preload-helper.BAt0wiQU.js";import{c as k}from"./createContext.DKLY0CB7.js";import{i as A,b as R,E as N,Y as O,V as T,A as B,q as L,Z as w}from"./motion.DDNFslEg.js";const F=t=>{const{componentCls:e}=t;return{[e]:{display:"inline-flex","&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},V=t=>{const{componentCls:e}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(e,"-item")]:{"&:empty":{display:"none"}}}}},q=P("Space",t=>[V(t),F(t)]);var H="[object Map]",K="[object Set]",M=Object.prototype,Q=M.hasOwnProperty;function z(t){if(t==null)return!0;if(A(t)&&(R(t)||typeof t=="string"||typeof t.splice=="function"||N(t)||O(t)||T(t)))return!t.length;var e=B(t);if(e==H||e==K)return!t.size;if(L(t))return!w(t).length;for(var o in t)if(Q.call(t,o))return!1;return!0}const W=()=>({compactSize:String,compactDirection:g.oneOf(I("horizontal","vertical")).def("horizontal"),isFirstItem:h(),isLastItem:h()}),m=k(null),et=(t,e)=>{const o=m.useInject(),n=c(()=>{if(!o||z(o))return"";const{compactDirection:a,isFirstItem:s,isLastItem:i}=o,r=a==="vertical"?"-vertical-":"-";return x({["".concat(t.value,"-compact").concat(r,"item")]:!0,["".concat(t.value,"-compact").concat(r,"first-item")]:s,["".concat(t.value,"-compact").concat(r,"last-item")]:i,["".concat(t.value,"-compact").concat(r,"item-rtl")]:e.value==="rtl"})});return{compactSize:c(()=>o==null?void 0:o.compactSize),compactDirection:c(()=>o==null?void 0:o.compactDirection),compactItemClassnames:n}},ot=y({name:"NoCompactStyle",setup(t,e){let{slots:o}=e;return m.useProvide(null),()=>{var n;return(n=o.default)===null||n===void 0?void 0:n.call(o)}}}),Y=()=>({prefixCls:String,size:{type:String},direction:g.oneOf(I("horizontal","vertical")).def("horizontal"),align:g.oneOf(I("start","end","center","baseline")),block:{type:Boolean,default:void 0}}),Z=y({name:"CompactItem",props:W(),setup(t,e){let{slots:o}=e;return m.useProvide(t),()=>{var n;return(n=o.default)===null||n===void 0?void 0:n.call(o)}}}),nt=y({name:"ASpaceCompact",inheritAttrs:!1,props:Y(),setup(t,e){let{attrs:o,slots:n}=e;const{prefixCls:a,direction:s}=D("space-compact",t),i=m.useInject(),[r,u]=q(a),E=c(()=>x(a.value,u.value,{["".concat(a.value,"-rtl")]:s.value==="rtl",["".concat(a.value,"-block")]:t.block,["".concat(a.value,"-vertical")]:t.direction==="vertical"}));return()=>{var d;const p=_(((d=n.default)===null||d===void 0?void 0:d.call(n))||[]);return p.length===0?null:r(C("div",b(b({},o),{},{class:[E.value,o.class]}),[p.map((f,$)=>{var v;const j=f&&f.key||"".concat(a.value,"-item-").concat($),S=!i||z(i);return C(Z,{key:j,compactSize:(v=t.size)!==null&&v!==void 0?v:"middle",compactDirection:t.direction,isFirstItem:$===0&&(S||(i==null?void 0:i.isFirstItem)),isLastItem:$===p.length-1&&(S||(i==null?void 0:i.isLastItem))},{default:()=>[f]})})]))}}});function G(t,e,o){const{focusElCls:n,focus:a,borderElCls:s}=o,i=s?"> *":"",r=["hover",a?"focus":null,"active"].filter(Boolean).map(u=>"&:".concat(u," ").concat(i)).join(",");return{["&-item:not(".concat(e,"-last-item)")]:{marginInlineEnd:-t.lineWidth},"&-item":l(l({[r]:{zIndex:2}},n?{["&".concat(n)]:{zIndex:2}}:{}),{["&[disabled] ".concat(i)]:{zIndex:0}})}}function J(t,e,o){const{borderElCls:n}=o,a=n?"> ".concat(n):"";return{["&-item:not(".concat(e,"-first-item):not(").concat(e,"-last-item) ").concat(a)]:{borderRadius:0},["&-item:not(".concat(e,"-last-item)").concat(e,"-first-item")]:{["& ".concat(a,", &").concat(t,"-sm ").concat(a,", &").concat(t,"-lg ").concat(a)]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&-item:not(".concat(e,"-first-item)").concat(e,"-last-item")]:{["& ".concat(a,", &").concat(t,"-sm ").concat(a,", &").concat(t,"-lg ").concat(a)]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function at(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:o}=t,n="".concat(o,"-compact");return{[n]:l(l({},G(t,n,e)),J(o,n,e))}}export{nt as C,ot as N,q as a,at as g,et as u};
