import{n as e,s as t}from"./jsx-runtime-Bzw2jH9X.js";import{$ as n,Ct as r,D as i,E as a,Et as o,F as s,G as c,I as l,J as u,P as d,Q as f,St as ee,V as p,X as m,Y as te,Z as h,_ as g,a as _,c as ne,ct as v,d as re,f as y,ft as b,g as x,gt as ie,h as S,ht as C,i as w,kt as T,m as ae,nt as oe,pt as se,s as ce,t as le,u as E,v as ue,w as de,x as D}from"./useSize--KU1gilk.js";import{t as fe}from"./es-C117l6fq.js";import{a as pe,r as me}from"./Compact-XqF1GfzW.js";import{t as he}from"./DisabledContext-BTU2x9XV.js";import{n as ge,t as _e}from"./compact-item-DEzs8Bfx.js";import{n as ve,t as ye}from"./color-ETsnQMUW.js";var O=t(e()),be=S(`Wave`,e=>{let{componentCls:t,colorPrimary:n,motionDurationSlow:r,motionEaseInOut:i,motionEaseOutCirc:a,antCls:o}=e,[,s]=x(o,`wave`);return{[t]:{position:`absolute`,background:`transparent`,pointerEvents:`none`,boxSizing:`border-box`,color:s(`color`,n),boxShadow:`0 0 0 0 currentcolor`,opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s`,`opacity 2s`].map(e=>`${e} ${a}`).join(`,`),"&-active":{boxShadow:`0 0 0 6px currentcolor`,opacity:0},"&.wave-quick":{transition:[`box-shadow`,`opacity`].map(e=>`${e} ${r} ${i}`).join(`,`)}}}}}),k=`ant-wave-target`,A=e=>e?y(e)&&e!==`#fff`&&e!==`#ffffff`&&e!==`rgb(255, 255, 255)`&&e!==`rgba(255, 255, 255, 1)`&&!/rgba\((?:\d*, ){3}0\)/i.test(e)&&!/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i.test(e)&&e!==`transparent`&&e!==`canvastext`:!1;function xe(e,t=null){let n=getComputedStyle(e),{borderTopColor:r,borderColor:i,backgroundColor:a}=n;return t&&A(n[t])?n[t]:[r,i,a].find(A)??null}function j(e){return Number.isNaN(e)?0:e}var M=e=>{let{className:t,target:n,component:i,colorSource:a}=e,o=O.useRef(null),{getPrefixCls:s}=O.useContext(c),l=s(),[u]=x(l,`wave`),[d,ee]=O.useState(null),[p,te]=O.useState([]),[h,g]=O.useState(0),[_,ne]=O.useState(0),[v,re]=O.useState(0),[y,ie]=O.useState(0),[S,C]=O.useState(!1),w={left:h,top:_,width:v,height:y,borderRadius:p.map(e=>`${e}px`).join(` `)};d&&(w[u(`color`)]=d);function T(){let e=getComputedStyle(n);ee(xe(n,a));let t=e.position===`static`,{borderLeftWidth:r,borderTopWidth:i}=e;g(t?n.offsetLeft:j(-Number.parseFloat(r))),ne(t?n.offsetTop:j(-Number.parseFloat(i))),re(n.offsetWidth),ie(n.offsetHeight);let{borderTopLeftRadius:o,borderTopRightRadius:s,borderBottomLeftRadius:c,borderBottomRightRadius:l}=e;te([o,s,l,c].map(e=>j(Number.parseFloat(e))))}if(O.useEffect(()=>{if(n){let e=r(()=>{T(),C(!0)}),t;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(T),t.observe(n)),()=>{r.cancel(e),t?.disconnect()}}},[n]),!S)return null;let oe=(i===`Checkbox`||i===`Radio`)&&n?.classList.contains(k);return O.createElement(fe,{visible:!0,motionAppear:!0,motionName:`wave-motion`,motionDeadline:5e3,onAppearEnd:(e,t)=>{if(t.deadline||ae(t)&&t.propertyName===`opacity`){let e=o.current?.parentElement;f(e).then(()=>{e?.remove()})}return!1}},({className:e},n)=>O.createElement(`div`,{ref:b(o,n),className:m(t,e,{"wave-quick":oe}),style:w}))},N=(e,t)=>{let{component:n}=t;if(n===`Checkbox`&&!e.querySelector(`input`)?.checked)return;let r=document.createElement(`div`);r.style.position=`absolute`,r.style.left=`0px`,r.style.top=`0px`,e?.insertBefore(r,e?.firstChild),h(O.createElement(M,{...t,target:e}),r)},P=(e,t,n,i)=>{let{wave:o}=O.useContext(c),[,s,l]=a(),u=T(r=>{let a=e.current;if(o?.disabled||!a)return;let c=a.querySelector(`.${k}`)||a,{showEffect:u}=o||{};(u||N)(c,{className:t,token:s,component:n,event:r,hashId:l,colorSource:i})}),d=O.useRef(null);return O.useEffect(()=>()=>{r.cancel(d.current)},[]),e=>{r.cancel(d.current),d.current=r(()=>{u(e)})}},F={click:`click`,mousedown:`mousedown`,mouseup:`mouseup`,pointerdown:`pointerdown`,pointerup:`pointerup`},Se=e=>{let{children:t,disabled:n,component:r,colorSource:i}=e,{getPrefixCls:a,wave:o}=(0,O.useContext)(c),s=(0,O.useRef)(null),l=a(`wave`),u=be(l),d=P(s,m(l,u),r,i);if(O.useEffect(()=>{let e=s.current;if(!e||e.nodeType!==window.Node.ELEMENT_NODE||n)return;let t=t=>{!v(t.target)||!e.getAttribute||e.getAttribute(`disabled`)||e.disabled||e.className.includes(`disabled`)&&!e.className.includes(`disabled:`)||e.getAttribute(`aria-disabled`)===`true`||e.className.includes(`-leave`)||d(t)},r=o?.triggerType,i=r&&r in F?F[r]:`click`;return e.addEventListener(i,t,!0),()=>{e.removeEventListener(i,t,!0)}},[n,o?.triggerType]),!O.isValidElement(t))return t??null;let f=C(t)?b(se(t),s):s;return w(t,{ref:f})},Ce=O.createContext(void 0),I=e=>{let{getPrefixCls:t,direction:n}=O.useContext(c),{prefixCls:r,size:i,className:o,...s}=e,l=t(`btn-group`,r),[,,u]=a(),d=O.useMemo(()=>{switch(i){case`large`:return`lg`;case`small`:return`sm`;default:return``}},[i]),f=m(l,{[`${l}-${d}`]:d,[`${l}-rtl`]:n===`rtl`},o,u);return O.createElement(Ce.Provider,{value:i},O.createElement(`div`,{...s,className:f}))},L=/^[\u4E00-\u9FA5]{2}$/,we=L.test.bind(L);function Te(e){return e===`danger`?{danger:!0}:{type:e}}function Ee(e){return e===`text`||e===`link`}function De(e,t,n,r){if(!oe(e))return;let i=t?` `:``;return!y(e)&&!E(e)&&y(e.type)&&we(e.props.children)?w(e,e=>{let t=m(e.className,r)||void 0,a={...n,...e.style};return{...e,children:e.children.split(``).join(i),className:t,style:a}}):y(e)?O.createElement(`span`,{className:r,style:n},we(e)?e.split(``).join(i):e):_(e)?O.createElement(`span`,{className:r,style:n},e):w(e,e=>({...e,className:m(e.className,r)||void 0,style:{...e.style,...n}}))}function Oe(e,t,n,r){let i=!1,a=[];return O.Children.forEach(e,e=>{let t=y(e)||E(e);if(i&&t){let t=a.length-1,n=a[t];a[t]=`${n}${e}`}else a.push(e);i=t}),O.Children.map(a,e=>De(e,t,n,r))}[`default`,`primary`,`danger`].concat(te(s));var ke=(0,O.forwardRef)((e,t)=>{let{className:n,style:r,children:i,prefixCls:a}=e,o=m(`${a}-icon`,n);return O.createElement(`span`,{ref:t,className:o,style:r},i)}),R=(0,O.forwardRef)((e,t)=>{let{prefixCls:n,className:r,style:i,iconClassName:a}=e,o=m(`${n}-loading-icon`,r);return O.createElement(ke,{prefixCls:n,className:o,style:i,ref:t},O.createElement(ge,{className:a}))}),z=()=>({width:0,opacity:0,transform:`scale(0)`}),B=e=>({width:e.scrollWidth,opacity:1,transform:`scale(1)`}),Ae=e=>{let{prefixCls:t,loading:n,existIcon:r,className:i,style:a,mount:o}=e,s=!!n;return r?O.createElement(R,{prefixCls:t,className:i,style:a}):O.createElement(fe,{visible:s,motionName:`${t}-loading-icon-motion`,motionAppear:!o,motionEnter:!o,motionLeave:!o,removeOnLeave:!0,onAppearStart:z,onAppearActive:B,onEnterStart:z,onEnterActive:B,onLeaveStart:B,onLeaveActive:z},({className:e,style:n},r)=>{let o={...a,...n};return O.createElement(R,{prefixCls:t,className:m(i,e),style:o,ref:r})})},je=()=>({"@media (prefers-reduced-motion: reduce)":{"&, &::before, &::after":{transition:`none`,animation:`none`}}}),Me=()=>({"@media (prefers-reduced-motion: reduce)":{transition:`none`,animation:`none`}}),V=(e,t)=>({[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineEndColor:t}}},"&:not(:first-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineStartColor:t}}}}}),Ne=e=>{let{componentCls:t,fontSize:n,lineWidth:r,groupBorderColor:i,colorErrorHover:a}=e;return{[`${t}-group`]:[{position:`relative`,display:`inline-flex`,[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:e.calc(r).mul(-1).equal(),[`&, & > ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[t]:{position:`relative`,zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${t}-icon-only`]:{fontSize:n}},V(`${t}-primary`,i),V(`${t}-danger`,a)]}},H=(e,t)=>{let{r:n,g:r,b:i,a}=e.toRgb(),o=new ve(e.toRgbString()).onBackground(t).toHsv();return a<=.5?o.v>.5:n*.299+r*.587+i*.114>192},U=e=>{let{paddingInline:t,onlyIconSize:n,borderColorDisabled:r}=e;return l(e,{buttonPaddingHorizontal:t,buttonPaddingVertical:0,buttonIconOnlyFontSize:n,colorBorderDisabled:r})},W=e=>{let t=e.contentFontSize??e.fontSize,n=e.contentFontSizeSM??e.fontSize,r=e.contentFontSizeLG??e.fontSizeLG,a=e.contentLineHeight??d(t),o=e.contentLineHeightSM??d(n),c=e.contentLineHeightLG??d(r),l=H(new ye(e.colorBgSolid),`#fff`)?`#000`:`#fff`,u=s.reduce((t,n)=>({...t,[`${n}ShadowColor`]:`0 ${p(e.controlOutlineWidth)} 0 ${i(e[`${n}1`],e.colorBgContainer)}`}),{}),f=e.colorBgContainerDisabled,ee=e.colorBgContainerDisabled;return{...u,fontWeight:400,iconGap:e.marginXS,defaultShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`,primaryShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`,dangerShadow:`0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`,primaryColor:e.colorTextLightSolid,dangerColor:e.colorTextLightSolid,borderColorDisabled:e.colorBorderDisabled,defaultGhostColor:e.colorBgContainer,ghostBg:`transparent`,defaultGhostBorderColor:e.colorBgContainer,paddingInline:e.paddingContentHorizontal-e.lineWidth,paddingInlineLG:e.paddingContentHorizontal-e.lineWidth,paddingInlineSM:8-e.lineWidth,onlyIconSize:`inherit`,onlyIconSizeSM:`inherit`,onlyIconSizeLG:`inherit`,groupBorderColor:e.colorPrimaryHover,linkHoverBg:`transparent`,textTextColor:e.colorText,textTextHoverColor:e.colorText,textTextActiveColor:e.colorText,textHoverBg:e.colorFillTertiary,defaultColor:e.colorText,defaultBg:e.colorBgContainer,defaultBorderColor:e.colorBorder,defaultBorderColorDisabled:e.colorBorder,defaultHoverBg:e.colorBgContainer,defaultHoverColor:e.colorPrimaryHover,defaultHoverBorderColor:e.colorPrimaryHover,defaultActiveBg:e.colorBgContainer,defaultActiveColor:e.colorPrimaryActive,defaultActiveBorderColor:e.colorPrimaryActive,solidTextColor:l,contentFontSize:t,contentFontSizeSM:n,contentFontSizeLG:r,contentLineHeight:a,contentLineHeightSM:o,contentLineHeightLG:c,paddingBlock:Math.max((e.controlHeight-t*a)/2-e.lineWidth,0),paddingBlockSM:Math.max((e.controlHeightSM-n*o)/2-e.lineWidth,0),paddingBlockLG:Math.max((e.controlHeightLG-r*c)/2-e.lineWidth,0),defaultBgDisabled:f,dashedBgDisabled:ee}},G=e=>{let{componentCls:t,antCls:n,lineWidth:r,lineType:i}=e,[a,o]=x(n,`btn`);return{[t]:[{[a(`border-width`)]:r,[a(`border-color`)]:`#000`,[a(`border-color-hover`)]:o(`border-color`),[a(`border-color-active`)]:o(`border-color`),[a(`border-color-disabled`)]:o(`border-color`),[a(`border-style`)]:i,[a(`text-color`)]:`#000`,[a(`text-color-hover`)]:o(`text-color`),[a(`text-color-active`)]:o(`text-color`),[a(`text-color-disabled`)]:o(`text-color`),[a(`bg-color`)]:`#ddd`,[a(`bg-color-hover`)]:o(`bg-color`),[a(`bg-color-active`)]:o(`bg-color`),[a(`bg-color-disabled`)]:e.colorBgContainerDisabled,[a(`bg-color-container`)]:e.colorBgContainer,[a(`shadow`)]:`none`},{border:[o(`border-width`),o(`border-style`),o(`border-color`)].join(` `),color:o(`text-color`),backgroundColor:o(`bg-color`),[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":{border:[o(`border-width`),o(`border-style`),o(`border-color-hover`)].join(` `),color:o(`text-color-hover`),backgroundColor:o(`bg-color-hover`)},"&:active":{border:[o(`border-width`),o(`border-style`),o(`border-color-active`)].join(` `),color:o(`text-color-active`),backgroundColor:o(`bg-color-active`)}}},{[`&${t}-variant-solid`]:{[a(`solid-bg-color`)]:o(`color-base`),[a(`solid-bg-color-hover`)]:o(`color-hover`),[a(`solid-bg-color-active`)]:o(`color-active`),[a(`border-color`)]:`transparent`,[a(`text-color`)]:e.colorTextLightSolid,[a(`bg-color`)]:o(`solid-bg-color`),[a(`bg-color-hover`)]:o(`solid-bg-color-hover`),[a(`bg-color-active`)]:o(`solid-bg-color-active`),boxShadow:o(`shadow`)},[`&${t}-variant-outlined, &${t}-variant-dashed`]:{[a(`border-color`)]:o(`color-base`),[a(`border-color-hover`)]:o(`color-hover`),[a(`border-color-active`)]:o(`color-active`),[a(`bg-color`)]:o(`bg-color-container`),[a(`text-color`)]:o(`color-base`),[a(`text-color-hover`)]:o(`color-hover`),[a(`text-color-active`)]:o(`color-active`),boxShadow:o(`shadow`)},[`&${t}-variant-dashed`]:{[a(`border-style`)]:`dashed`,[a(`bg-color-disabled`)]:e.dashedBgDisabled},[`&${t}-variant-filled`]:{[a(`border-color`)]:`transparent`,[a(`text-color`)]:o(`color-base`),[a(`bg-color`)]:o(`color-light`),[a(`bg-color-hover`)]:o(`color-light-hover`),[a(`bg-color-active`)]:o(`color-light-active`)},[`&${t}-variant-text, &${t}-variant-link`]:{[a(`border-color`)]:`transparent`,[a(`text-color`)]:o(`color-base`),[a(`text-color-hover`)]:o(`color-hover`),[a(`text-color-active`)]:o(`color-active`),[a(`bg-color`)]:`transparent`,[a(`bg-color-hover`)]:`transparent`,[a(`bg-color-active`)]:`transparent`,[`&:disabled, &${e.componentCls}-disabled`]:{background:`transparent`,borderColor:`transparent`}},[`&${t}-variant-text`]:{[a(`bg-color-hover`)]:o(`color-light`),[a(`bg-color-active`)]:o(`color-light-active`)}},{[`&${t}-variant-link`]:{[a(`color-base`)]:e.colorLink,[a(`color-hover`)]:e.colorLinkHover,[a(`color-active`)]:e.colorLinkActive,[a(`bg-color-hover`)]:e.linkHoverBg},[`&${t}-color-primary`]:{[a(`color-base`)]:e.colorPrimary,[a(`color-hover`)]:e.colorPrimaryHover,[a(`color-active`)]:e.colorPrimaryActive,[a(`color-light`)]:e.colorPrimaryBg,[a(`color-light-hover`)]:e.colorPrimaryBgHover,[a(`color-light-active`)]:e.colorPrimaryBorder,[a(`shadow`)]:e.primaryShadow,[`&${t}-variant-solid`]:{[a(`text-color`)]:e.primaryColor,[a(`text-color-hover`)]:o(`text-color`),[a(`text-color-active`)]:o(`text-color`)}},[`&${t}-color-dangerous`]:{[a(`color-base`)]:e.colorError,[a(`color-hover`)]:e.colorErrorHover,[a(`color-active`)]:e.colorErrorActive,[a(`color-light`)]:e.colorErrorBg,[a(`color-light-hover`)]:e.colorErrorBgFilledHover,[a(`color-light-active`)]:e.colorErrorBgActive,[a(`shadow`)]:e.dangerShadow,[`&${t}-variant-solid`]:{[a(`text-color`)]:e.dangerColor,[a(`text-color-hover`)]:o(`text-color`),[a(`text-color-active`)]:o(`text-color`)}},[`&${t}-color-default`]:{[a(`solid-bg-color`)]:e.colorBgSolid,[a(`solid-bg-color-hover`)]:e.colorBgSolidHover,[a(`solid-bg-color-active`)]:e.colorBgSolidActive,[a(`color-base`)]:e.defaultBorderColor,[a(`color-hover`)]:e.defaultHoverBorderColor,[a(`color-active`)]:e.defaultActiveBorderColor,[a(`color-light`)]:e.colorFillTertiary,[a(`color-light-hover`)]:e.colorFillSecondary,[a(`color-light-active`)]:e.colorFill,[a(`text-color`)]:e.defaultColor,[a(`text-color-hover`)]:e.defaultHoverColor,[a(`text-color-active`)]:e.defaultActiveColor,[a(`shadow`)]:e.defaultShadow,[`&${t}-variant-outlined`]:{[a(`bg-color-disabled`)]:e.defaultBgDisabled},[`&${t}-variant-solid`]:{[a(`text-color`)]:e.solidTextColor,[a(`text-color-hover`)]:o(`text-color`),[a(`text-color-active`)]:o(`text-color`)},[`&${t}-variant-filled, &${t}-variant-text`]:{[a(`text-color-hover`)]:o(`text-color`),[a(`text-color-active`)]:o(`text-color`)},[`&${t}-variant-outlined, &${t}-variant-dashed`]:{[a(`text-color`)]:e.defaultColor,[a(`text-color-hover`)]:e.defaultHoverColor,[a(`text-color-active`)]:e.defaultActiveColor,[a(`bg-color-container`)]:e.defaultBg,[a(`bg-color-hover`)]:e.defaultHoverBg,[a(`bg-color-active`)]:e.defaultActiveBg},[`&${t}-variant-text`]:{[a(`text-color`)]:e.textTextColor,[a(`text-color-hover`)]:e.textTextHoverColor,[a(`text-color-active`)]:e.textTextActiveColor,[a(`bg-color-hover`)]:e.textHoverBg},[`&${t}-background-ghost`]:{[`&${t}-variant-outlined, &${t}-variant-dashed`]:{[a(`text-color`)]:e.defaultGhostColor,[a(`border-color`)]:e.defaultGhostBorderColor}}}},s.map(n=>{let r=e[`${n}6`],i=e[`${n}1`],o=e[`${n}Hover`],s=e[`${n}2`],c=e[`${n}3`],l=e[`${n}Active`],u=e[`${n}ShadowColor`];return{[`&${t}-color-${n}`]:{[a(`color-base`)]:r,[a(`color-hover`)]:o,[a(`color-active`)]:l,[a(`color-light`)]:i,[a(`color-light-hover`)]:s,[a(`color-light-active`)]:c,[a(`shadow`)]:u}}}),{[`&:disabled, &${e.componentCls}-disabled`]:{cursor:`not-allowed`,borderColor:e.colorBorderDisabled,background:o(`bg-color-disabled`),color:e.colorTextDisabled,boxShadow:`none`}},{[`&${t}-background-ghost`]:{[a(`bg-color`)]:e.ghostBg,[a(`bg-color-hover`)]:e.ghostBg,[a(`bg-color-active`)]:e.ghostBg,[a(`shadow`)]:`none`,[`&${t}-variant-outlined, &${t}-variant-dashed`]:{[a(`bg-color-hover`)]:e.ghostBg,[a(`bg-color-active`)]:e.ghostBg}}}]}},Pe=e=>{let{componentCls:t,iconCls:n,fontWeight:r,opacityLoading:i,motionDurationSlow:a,motionEaseInOut:o,iconGap:s,calc:c}=e;return{[t]:{outline:`none`,position:`relative`,display:`inline-flex`,gap:s,alignItems:`center`,justifyContent:`center`,fontWeight:r,whiteSpace:`nowrap`,textAlign:`center`,backgroundImage:`none`,cursor:`pointer`,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,userSelect:`none`,touchAction:`manipulation`,...je(),"&:disabled > *":{pointerEvents:`none`},[`${t}-icon > svg`]:de(),[`${t}-icon`]:{display:`inline-flex`,alignItems:`center`,[n]:{verticalAlign:`middle`,"&:before":{content:`"\\a0"`,display:`inline-block`,width:0}}},"> a":{color:`currentColor`},"&:not(:disabled)":D(e),[`&${t}-two-chinese-chars::first-letter`]:{letterSpacing:`0.34em`},[`&${t}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:`-0.34em`,letterSpacing:`0.34em`},[`&${t}-icon-only`]:{paddingInline:0,[`&${t}-compact-item`]:{flex:`none`}},[`&${t}-loading`]:{opacity:i,cursor:`default`},[`${t}-loading-icon`]:{transition:[`width`,`opacity`,`margin`].map(e=>`${e} ${a} ${o}`).join(`,`)},[`&:not(${t}-icon-end)`]:{[`${t}-loading-icon-motion`]:{"&-appear-start, &-enter-start, &-appear-prepare, &-enter-prepare":{marginInlineEnd:c(s).mul(-1).equal(),opacity:0},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:c(s).mul(-1).equal()}}},"&-icon-end":{flexDirection:`row-reverse`,[`${t}-loading-icon-motion`]:{"&-appear-start, &-enter-start, &-appear-prepare, &-enter-prepare":{marginInlineStart:c(s).mul(-1).equal(),opacity:0},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:c(s).mul(-1).equal()}}}}}},K=e=>({minWidth:e.controlHeight,paddingInline:0,borderRadius:`50%`}),q=(e,t=``)=>{let{componentCls:n,controlHeight:r,fontSize:i,borderRadius:a,buttonPaddingHorizontal:o,iconCls:s,buttonPaddingVertical:c,buttonIconOnlyFontSize:l}=e;return[{[t]:{fontSize:i,height:r,padding:`${p(c)} ${p(o)}`,borderRadius:a,[`&${n}-icon-only`]:{width:r,[s]:{fontSize:l}}}},{[`${n}${n}-circle${t}`]:K(e)},{[`${n}${n}-round${t}`]:{borderRadius:e.controlHeight,[`&:not(${n}-icon-only)`]:{paddingInline:e.buttonPaddingHorizontal}}}]},Fe=e=>q(l(e,{fontSize:e.contentFontSize}),e.componentCls),J=e=>q(l(e,{controlHeight:e.controlHeightSM,fontSize:e.contentFontSizeSM,padding:e.paddingXS,buttonPaddingHorizontal:e.paddingInlineSM,buttonPaddingVertical:0,borderRadius:e.borderRadiusSM,buttonIconOnlyFontSize:e.onlyIconSizeSM}),`${e.componentCls}-sm`),Ie=e=>q(l(e,{controlHeight:e.controlHeightLG,fontSize:e.contentFontSizeLG,buttonPaddingHorizontal:e.paddingInlineLG,buttonPaddingVertical:0,borderRadius:e.borderRadiusLG,buttonIconOnlyFontSize:e.onlyIconSizeLG}),`${e.componentCls}-lg`),Le=e=>{let{componentCls:t}=e;return{[t]:{[`&${t}-block`]:{width:`100%`}}}},Re=g(`Button`,e=>{let t=U(e);return[Pe(t),Fe(t),J(t),Ie(t),Le(t),G(t),Ne(t)]},W,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function ze(e,t,n){return{[`&-item:not(${t}-last-item)`]:{marginBottom:e.calc(e.lineWidth).mul(-1).equal()},[`&-item:not(${n}-status-success)`]:{zIndex:2},"&-item":{"&:focus,&:active":{zIndex:3},"&:hover":{zIndex:4},"&[disabled]":{zIndex:0}}}}function Y(e,t){return{[`&-item:not(${t}-first-item):not(${t}-last-item)`]:{borderRadius:0},[`&-item${t}-first-item:not(${t}-last-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${t}-last-item:not(${t}-first-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function Be(e){let t=`${e.componentCls}-compact-vertical`;return{[t]:{...ze(e,t,e.componentCls),...Y(e.componentCls,t)}}}var X=e=>{let{antCls:t,componentCls:n,lineWidth:r,calc:i,colorBgContainer:a}=e,o=`${n}-variant-solid:not([disabled])`,s=i(r).mul(-1).equal(),[c,l]=x(t,`btn`),u=e=>({[`${n}-compact${e?`-vertical`:``}-item`]:{[c(`compact-connect-border-color`)]:l(`bg-color-hover`),[`&${o}`]:{transition:`none`,[`& + ${o}:before`]:[{position:`absolute`,backgroundColor:l(`compact-connect-border-color`),content:`""`},e?{top:s,insetInline:s,height:r}:{insetBlock:s,insetInlineStart:s,width:r}],"&:hover:before":{display:`none`}}}});return[u(),u(!0),{[`${o}${n}-color-default`]:{[c(`compact-connect-border-color`)]:`color-mix(in srgb, ${l(`bg-color-hover`)} 75%, ${a})`}}]},Ve=ue([`Button`,`compact`],e=>{let t=U(e);return[_e(t),Be(t),X(t)]},W);function He(e){if(re(e)){let t=e?.delay;return t=E(t)?t:0,{loading:t<=0,delay:t}}return{loading:!!e,delay:0}}var Ue={default:[`default`,`outlined`],primary:[`primary`,`solid`],dashed:[`default`,`dashed`],link:[`link`,`link`],text:[`default`,`text`]},Z=O.forwardRef((e,t)=>{let{_skipSemantic:r,loading:i=!1,prefixCls:a,color:s,variant:c,type:l,danger:d=!1,shape:f,size:p,disabled:te,className:h,rootClassName:g,children:_,icon:v,iconPosition:y,iconPlacement:b,ghost:x=!1,block:S=!1,htmlType:C=`button`,classNames:w,styles:T,style:ae,autoInsertSpace:se,autoFocus:E,...ue}=e,de=n(_),D=l||`default`,{getPrefixCls:fe,direction:ge,autoInsertSpace:_e,className:ve,style:ye,classNames:be,styles:k,loadingIcon:A,shape:xe,color:j,variant:M}=u(`button`),N=f||xe||`default`,[P,F]=(0,O.useMemo)(()=>{if(s&&c)return[s,c];if(l||d){let e=Ue[D]||[];return d?[`danger`,e[1]]:e}return c===`solid`?[`primary`,c]:j&&M?[j,M]:M===`solid`?[`primary`,M]:[`default`,`outlined`]},[s,c,l,d,j,M,D]),[I,L]=(0,O.useMemo)(()=>x&&F===`solid`?[P,`outlined`]:[P,F],[P,F,x]),Te=I===`danger`,De=Te?`dangerous`:I,R=se??_e??!0,z=fe(`btn`,a),[B,je]=Re(z),Me=(0,O.useContext)(he),V=te??Me,Ne=(0,O.useContext)(Ce),H=(0,O.useMemo)(()=>He(i),[i]),[U,W]=ee(H.loading),[G,Pe]=(0,O.useState)(!1),K=(0,O.useRef)(null),q=ie(t,K),Fe=de.length===1&&!v&&!Ee(L),J=(0,O.useRef)(!0);O.useEffect(()=>(J.current=!1,()=>{J.current=!0}),[]),o(()=>{H.delay>0?W(!0,{ms:H.delay}):W(H.loading,!0)},[H.delay,H.loading]),(0,O.useEffect)(()=>{if(!K.current||!R)return;let e=K.current.textContent||``;Fe&&we(e)?G||Pe(!0):G&&Pe(!1)}),(0,O.useEffect)(()=>{E&&K.current?.focus()},[]);let Ie=O.useCallback(t=>{if(U||V){t.preventDefault();return}e.onClick?.((`href`in e,t))},[e.onClick,U,V]),{compactSize:Le,compactItemClassnames:ze}=me(z,ge),Y=le(e=>p??Le??Ne??e),Be=U?`loading`:v,X=b??y??`start`,Z=pe(ue,[`navigate`]),We={...e,type:D,color:I,variant:L,danger:Te,shape:N,size:Y,disabled:V,loading:U,iconPlacement:X},Ge=ne(ye),Ke=ne(ae),[qe,Q]=ce([r?void 0:be,w],[r?void 0:k,Ge,T,Ke],{props:We}),Je=m(z,B,je,{[`${z}-${N}`]:N!=="default"&&N!==`square`&&N,[`${z}-${D}`]:D,[`${z}-dangerous`]:d,[`${z}-color-${De}`]:De,[`${z}-variant-${L}`]:L,[`${z}-lg`]:Y===`large`,[`${z}-sm`]:Y===`small`,[`${z}-icon-only`]:!_&&_!==0&&!!Be,[`${z}-background-ghost`]:x&&!Ee(L),[`${z}-loading`]:U,[`${z}-two-chinese-chars`]:G&&R&&!U,[`${z}-block`]:S,[`${z}-rtl`]:ge===`rtl`,[`${z}-icon-end`]:X===`end`},ze,h,g,ve,qe.root),Ye={className:qe.icon,style:Q.icon},Xe=e=>O.createElement(ke,{prefixCls:z,...Ye},e),Ze=O.createElement(Ae,{existIcon:!!v,prefixCls:z,loading:U,mount:J.current,...Ye}),Qe=re(i)&&i.icon||A,$e;$e=v&&!U?Xe(v):i&&Qe?Xe(Qe):Ze;let et=oe(_)?Oe(_,Fe&&R,Q.content,qe.content):null;if(Z.href!==void 0)return O.createElement(`a`,{...Z,className:m(Je,{[`${z}-disabled`]:V}),href:V?void 0:Z.href,style:Q.root,onClick:Ie,ref:q,tabIndex:V?-1:0,"aria-disabled":V},$e,et);let $=O.createElement(`button`,{...ue,type:C,className:Je,style:Q.root,onClick:Ie,disabled:V,ref:q},$e,et,ze&&O.createElement(Ve,{prefixCls:z}));return Ee(L)||($=O.createElement(Se,{component:`Button`,disabled:U},$)),$});Z.Group=I,Z.__ANT_BUTTON=!0;export{Se as a,Te as i,Me as n,je as r,Z as t};