import{k as A,bl as k,R as O,s as ee,a_ as te,c as $,r,m as ae,F as se,an as ne,c0 as re}from"./createLucideIcon-BcINIXoS.js";function R(e){return["small","middle","large"].includes(e)}function V(e){return e?typeof e=="number"&&!Number.isNaN(e):!1}const le=e=>{const{componentCls:a,borderRadius:s,paddingSM:t,colorBorder:n,paddingXS:l,fontSizeLG:p,fontSizeSM:m,borderRadiusLG:u,borderRadiusSM:o,colorBgContainerDisabled:i,lineWidth:d}=e;return{[a]:[{display:"inline-flex",alignItems:"center",gap:0,paddingInline:t,margin:0,background:i,borderWidth:d,borderStyle:"solid",borderColor:n,borderRadius:s,"&-large":{fontSize:p,borderRadius:u},"&-small":{paddingInline:l,borderRadius:o,fontSize:m},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},k(e,{focus:!1})]}},oe=A(["Space","Addon"],e=>[le(e)]);var ie=function(e,a){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(e);n<t.length;n++)a.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(s[t[n]]=e[t[n]]);return s};const ce=O.forwardRef((e,a)=>{const{className:s,children:t,style:n,prefixCls:l}=e,p=ie(e,["className","children","style","prefixCls"]),{getPrefixCls:m,direction:u}=O.useContext(ee),o=m("space-addon",l),[i,d,I]=oe(o),{compactItemClassnames:N,compactSize:g}=te(o,u),S=$(o,d,N,I,{[`${o}-${g}`]:g},s);return i(O.createElement("div",Object.assign({ref:a,className:S,style:n},p),t))}),L=O.createContext({latestIndex:0}),de=L.Provider,pe=({className:e,index:a,children:s,split:t,style:n})=>{const{latestIndex:l}=r.useContext(L);return s==null?null:r.createElement(r.Fragment,null,r.createElement("div",{className:e,style:n},s),a<l&&t&&r.createElement("span",{className:`${e}-split`},t))},me=e=>{const{componentCls:a,antCls:s}=e;return{[a]:{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"}},[`${a}-item:empty`]:{display:"none"},[`${a}-item > ${s}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},ue=e=>{const{componentCls:a}=e;return{[a]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}},fe=A("Space",e=>{const a=ae(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[me(a),ue(a)]},()=>({}),{resetStyle:!1});var ge=function(e,a){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(e);n<t.length;n++)a.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(s[t[n]]=e[t[n]]);return s};const Se=r.forwardRef((e,a)=>{var s;const{getPrefixCls:t,direction:n,size:l,className:p,style:m,classNames:u,styles:o}=se("space"),{size:i=l??"small",align:d,className:I,rootClassName:N,children:g,direction:S="horizontal",prefixCls:M,split:W,style:D,wrap:H=!1,classNames:w,styles:G}=e,B=ge(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[y,b]=Array.isArray(i)?i:[i,i],h=R(b),P=R(y),F=V(b),X=V(y),C=ne(g,{keepEmpty:!0}),E=d===void 0&&S==="horizontal"?"center":d,c=t("space",M),[T,q,J]=fe(c),K=$(c,p,q,`${c}-${S}`,{[`${c}-rtl`]:n==="rtl",[`${c}-align-${E}`]:E,[`${c}-gap-row-${b}`]:h,[`${c}-gap-col-${y}`]:P},I,N,J),j=$(`${c}-item`,(s=w==null?void 0:w.item)!==null&&s!==void 0?s:u.item),Q=Object.assign(Object.assign({},o.item),G==null?void 0:G.item),U=C.map((f,z)=>{const v=(f==null?void 0:f.key)||`${j}-${z}`;return r.createElement(pe,{className:j,key:v,index:z,split:W,style:Q},f)}),Y=r.useMemo(()=>({latestIndex:C.reduce((z,v,Z)=>v!=null?Z:z,0)}),[C]);if(C.length===0)return null;const x={};return H&&(x.flexWrap="wrap"),!P&&X&&(x.columnGap=y),!h&&F&&(x.rowGap=b),T(r.createElement("div",Object.assign({ref:a,className:K,style:Object.assign(Object.assign(Object.assign({},x),m),D)},B),r.createElement(de,{value:Y},U)))}),_=Se;_.Compact=re;_.Addon=ce;export{_ as S};
