import{$t as e,Bn as t,Bt as n,Or as r,Q as i,Sr as a,St as o,Tr as s,Xt as c,Y as l,_n as u,an as d,cn as f,dn as p,et as m,it as h,lr as g,m as _,mn as v,sn as y,tr as b,ur as x}from"./jsx-runtime-NwRKtVrk.js";import{a as S,i as C}from"./ColorPresets-BBbJffTn.js";import{F as w,I as T,w as E}from"./index-B7MUL4ct.js";var D=r(s()),O=D.createContext(void 0),k=O.Provider,A=D.createContext(void 0),j=A.Provider,M=t=>{let{componentCls:n,antCls:r,lineWidth:i,borderRadius:a,borderRadiusLG:o,borderRadiusSM:s,calc:c}=t,l=`${n}-group`,u=`${n}-button-wrapper`,d=`${r}-badge`,f=e=>({[`> ${d}`]:{width:`auto`},[`> ${d} > ${u}`]:{width:`100%`},[`> ${d}:not(:last-child)`]:{marginBlockEnd:c(i).mul(-1).equal()},[`> ${d} > ${u}:not(:last-child)`]:{marginBlockEnd:0},[`> ${d}:first-child > ${u}`]:{borderStartStartRadius:e,borderStartEndRadius:e,borderEndStartRadius:0,borderEndEndRadius:0},[`> ${d}:last-child > ${u}`]:{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:e,borderEndEndRadius:e},[`> ${d}:not(:first-child):not(:last-child) > ${u}`]:{borderRadius:0},[`> ${d}:first-child:last-child > ${u}`]:{borderRadius:e}});return{[l]:{...e(t),display:`inline-block`,fontSize:0,[`&${l}-rtl`]:{direction:`rtl`},[`&${l}-block`]:{display:`flex`},[`${r}-badge ${r}-badge-count`]:{zIndex:1},[`> ${r}-badge:not(:first-child) > ${r}-button-wrapper`]:{borderInlineStart:`none`},"&-vertical":{display:`flex`,flexDirection:`column`,rowGap:t.marginXS,[`&:has(> ${u}, > ${d} > ${u})`]:{rowGap:0},[`${n}-wrapper`]:{marginInlineEnd:0},...f(a),[`&${l}-large`]:{...f(o)},[`&${l}-small`]:{...f(s)}}}}},N=t=>{let{componentCls:n,wrapperMarginInlineEnd:r,colorPrimary:i,colorPrimaryHover:a,radioSize:o,motionDurationSlow:s,motionDurationMid:l,motionEaseInOutCirc:u,colorBgContainer:f,colorBorder:p,lineWidth:m,colorBgContainerDisabled:h,colorTextDisabled:g,paddingXS:_,dotColorDisabled:v,dotSize:y,lineType:b,radioColor:x,radioBgColor:S}=t;return{[`${n}-wrapper`]:{...e(t),display:`inline-flex`,alignItems:`baseline`,marginInlineStart:0,marginInlineEnd:r,cursor:`pointer`,"&:last-child":{marginInlineEnd:0},[`&${n}-wrapper-rtl`]:{direction:`rtl`},"&-disabled":{cursor:`not-allowed`,color:t.colorTextDisabled},"&::after":{display:`inline-block`,width:0,overflow:`hidden`,content:`"\\a0"`},"&-block":{flex:1,justifyContent:`center`},[n]:{...e(t),position:`relative`,whiteSpace:`nowrap`,lineHeight:1,cursor:`pointer`,alignSelf:`center`,boxSizing:`border-box`,display:`block`,width:`calc(${o} * 1px)`,height:`calc(${o} * 1px)`,backgroundColor:f,border:`${d(m)} ${b} ${p}`,borderRadius:`50%`,transition:`all ${l}`,flex:`none`,"&:after":{content:`""`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%) scale(0)`,width:`calc(${y} * 1px)`,height:`calc(${y} * 1px)`,backgroundColor:x,borderRadius:`50%`,transformOrigin:`50% 50%`,opacity:0,transition:`all ${s} ${u}`},[`${n}-input`]:{position:`absolute`,inset:0,zIndex:1,cursor:`pointer`,opacity:0,margin:0},[`&:has(${n}-input:focus-visible)`]:c(t)},[`&:hover:not(${n}-wrapper-disabled) ${n}`]:{borderColor:i},[`&:hover ${n}-checked:not(${n}-disabled)`]:{backgroundColor:a,borderColor:`transparent`},[`${n}-checked`]:{backgroundColor:S,borderColor:i,"&::after":{transform:`translate(-50%, -50%)`,opacity:1}},[`${n}-disabled`]:{[`&, ${n}-input`]:{cursor:`not-allowed`,pointerEvents:`none`},background:h,borderColor:p,"&::after":{backgroundColor:v}},[`${n}-disabled + span`]:{color:g,cursor:`not-allowed`},[`span${n} + *`]:{paddingInlineStart:_,paddingInlineEnd:_}}}},P=e=>{let{buttonColor:t,controlHeight:n,componentCls:r,lineWidth:i,lineType:a,colorBorder:o,motionDurationMid:s,buttonPaddingInline:l,fontSize:u,buttonBg:f,fontSizeLG:p,controlHeightLG:m,controlHeightSM:h,paddingXS:g,borderRadius:_,borderRadiusSM:v,borderRadiusLG:y,buttonCheckedBg:b,buttonSolidCheckedColor:x,colorTextDisabled:S,colorBgContainerDisabled:C,buttonCheckedBgDisabled:w,buttonCheckedColorDisabled:T,colorPrimary:E,colorPrimaryHover:D,colorPrimaryActive:O,buttonSolidCheckedBg:k,buttonSolidCheckedHoverBg:A,buttonSolidCheckedActiveBg:j,calc:M}=e;return{[`${r}-button-wrapper`]:{position:`relative`,display:`inline-block`,height:n,margin:0,paddingInline:l,paddingBlock:0,color:t,fontSize:u,lineHeight:d(M(n).sub(M(i).mul(2)).equal()),background:f,border:`${d(i)} ${a} ${o}`,borderBlockStartWidth:M(i).add(.02).equal(),borderInlineEndWidth:i,cursor:`pointer`,transition:[`color`,`background-color`,`box-shadow`].map(e=>`${e} ${s}`).join(`,`),a:{color:t},[`> ${r}-button`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:`100%`,height:`100%`},"&:not(:last-child)":{marginInlineEnd:M(i).mul(-1).equal()},"&:first-child":{borderInlineStart:`${d(i)} ${a} ${o}`,borderStartStartRadius:_,borderEndStartRadius:_},"&:last-child":{borderStartEndRadius:_,borderEndEndRadius:_},"&:first-child:last-child":{borderRadius:_},[`${r}-group-large &`]:{height:m,fontSize:p,lineHeight:d(M(m).sub(M(i).mul(2)).equal()),"&:first-child":{borderStartStartRadius:y,borderEndStartRadius:y},"&:last-child":{borderStartEndRadius:y,borderEndEndRadius:y}},[`${r}-group-small &`]:{height:h,paddingInline:M(g).sub(i).equal(),paddingBlock:0,lineHeight:d(M(h).sub(M(i).mul(2)).equal()),"&:first-child":{borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v}},[`${r}-group-vertical > &`]:{marginInlineEnd:0,borderRadius:0,"&:not(:last-child)":{marginBlockEnd:M(i).mul(-1).equal()},"&:first-child":{borderStartStartRadius:_,borderStartEndRadius:_,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:_,borderEndEndRadius:_},"&:first-child:last-child":{borderRadius:_}},[`${r}-group-vertical${r}-group-large > &`]:{"&:first-child":{borderStartStartRadius:y,borderStartEndRadius:y},"&:last-child":{borderEndStartRadius:y,borderEndEndRadius:y},"&:first-child:last-child":{borderRadius:y}},[`${r}-group-vertical${r}-group-small > &`]:{"&:first-child":{borderStartStartRadius:v,borderStartEndRadius:v},"&:last-child":{borderEndStartRadius:v,borderEndEndRadius:v},"&:first-child:last-child":{borderRadius:v}},"&:hover":{position:`relative`,color:E},"&:has(:focus-visible)":c(e),[`${r}, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:`none`},[`&-checked:not(${r}-button-wrapper-disabled)`]:{zIndex:1,color:E,background:b,borderColor:E,"&::before":{backgroundColor:E},"&:first-child":{borderColor:E},"&:hover":{color:D,borderColor:D,"&::before":{backgroundColor:D}},"&:active":{color:O,borderColor:O,"&::before":{backgroundColor:O}}},[`${r}-group-solid &-checked:not(${r}-button-wrapper-disabled)`]:{color:x,background:k,borderColor:k,"&:hover":{color:x,background:A,borderColor:A},"&:active":{color:x,background:j,borderColor:j}},"&-disabled":{color:S,backgroundColor:C,borderColor:o,cursor:`not-allowed`,"&:first-child, &:hover":{color:S,backgroundColor:C,borderColor:o}},[`&-disabled${r}-button-wrapper-checked`]:{color:T,backgroundColor:w,borderColor:o,boxShadow:`none`},"&-block":{flex:1,textAlign:`center`}}}},F=o(`Radio`,e=>{let{controlOutline:t,controlOutlineWidth:r}=e,i=`0 0 0 ${d(r)} ${t}`,a=n(e,{radioFocusShadow:i,radioButtonFocusShadow:i});return[M(a),N(a),P(a)]},e=>{let{wireframe:t,padding:n,marginXS:r,lineWidth:i,fontSizeLG:a,colorText:o,colorBgContainer:s,colorTextDisabled:c,controlItemBgActiveDisabled:l,colorTextLightSolid:u,colorPrimary:d,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:m}=e,h=a;return{radioSize:h,dotSize:t?h-8:h-(4+i)*2,dotColorDisabled:c,buttonSolidCheckedColor:u,buttonSolidCheckedBg:d,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:s,buttonCheckedBg:s,buttonColor:o,buttonCheckedBgDisabled:l,buttonCheckedColorDisabled:c,buttonPaddingInline:n-i,wrapperMarginInlineEnd:r,radioColor:t?d:m,radioBgColor:t?s:d}},{unitless:{radioSize:!0,dotSize:!0}}),I=D.forwardRef((e,t)=>{let n=D.useContext(O),r=D.useContext(A),{getPrefixCls:i,direction:o,className:s,style:c,classNames:l,styles:d}=f(`radio`),g=b(t,D.useRef(null)),{isFormItemInput:v}=D.useContext(_),y=t=>{e.onChange?.(t),n?.onChange?.(t)},{prefixCls:x,className:E,rootClassName:k,children:j,style:M,title:N,classNames:P,styles:I,checked:L,...R}=e,z=i(`radio`,x),B=(n?.optionType||r)===`button`,V=B?`${z}-button`:z,H=m(z),[U,W]=F(z,H),G={...R},K=D.useContext(h),q=`checked`in e,J=L;n&&(G.name=n.name,G.onChange=y,J=e.value===n.value,G.disabled=G.disabled??n.disabled),(q||n)&&(G.checked=J),G.disabled=G.disabled??K;let Y={...e,...G,checked:J},[X,Z]=p([l,P],[d,I],{props:Y}),Q=a(`${V}-wrapper`,{[`${V}-wrapper-checked`]:J,[`${V}-wrapper-disabled`]:G.disabled,[`${V}-wrapper-rtl`]:o===`rtl`,[`${V}-wrapper-in-form-item`]:v,[`${V}-wrapper-block`]:!!n?.block},s,E,k,X.root,U,W,H),[$,ee]=w(G.onClick);return D.createElement(C,{component:`Radio`,disabled:G.disabled},D.createElement(`label`,{className:Q,style:{...Z.root,...c,...M},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:N,onClick:$},D.createElement(T,{...G,className:a(X.icon,{[S]:!B}),style:Z.icon,type:`radio`,prefixCls:V,ref:g,onClick:ee}),u(j)?D.createElement(`span`,{className:a(`${V}-label`,X.label),style:Z.label},j):null))}),L=D.forwardRef((e,n)=>{let{getPrefixCls:r,direction:o}=D.useContext(y),{name:s}=D.useContext(_),c=g(E(s)),{prefixCls:u,className:d,rootClassName:f,options:p,buttonStyle:h=`outline`,disabled:b,children:S,size:C,style:w,id:T,optionType:O,name:A=c,defaultValue:j,value:M,block:N=!1,onChange:P,onMouseEnter:L,onMouseLeave:R,onFocus:z,onBlur:B,orientation:V,vertical:H,role:U=`radiogroup`}=e,[W,G]=x(j,M),K=D.useCallback(t=>{let n=W,r=t.target.value;`value`in e||G(r),r!==n&&P?.(t)},[W,G,P]),q=r(`radio`,u),J=`${q}-group`,Y=m(q),[X,Z]=F(q,Y),Q=S;p&&p.length>0&&(Q=p.map(e=>typeof e==`string`||v(e)?D.createElement(I,{key:e.toString(),prefixCls:q,disabled:b,value:e,checked:W===e},e):D.createElement(I,{key:`radio-group-value-options-${e.value}`,prefixCls:q,disabled:e.disabled||b,value:e.value,checked:W===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let $=l(C),[,ee]=i(V,H),te=a(J,`${J}-${h}`,{[`${J}-large`]:$===`large`,[`${J}-small`]:$===`small`,[`${J}-rtl`]:o===`rtl`,[`${J}-block`]:N},d,f,X,Z,Y),ne=D.useMemo(()=>({onChange:K,value:W,disabled:b,name:A,optionType:O,block:N}),[K,W,b,A,O,N]);return D.createElement(`div`,{...t(e,{aria:!0,data:!0}),role:U,className:a(te,{[`${q}-group-vertical`]:ee}),style:w,onMouseEnter:L,onMouseLeave:R,onFocus:z,onBlur:B,id:T,ref:n},D.createElement(k,{value:ne},Q))}),R=D.memo(L),z=D.forwardRef((e,t)=>{let{getPrefixCls:n}=D.useContext(y),{prefixCls:r,...i}=e,a=n(`radio`,r);return D.createElement(j,{value:`button`},D.createElement(I,{prefixCls:a,...i,type:`radio`,ref:t}))}),B=I;B.Button=z,B.Group=R,B.__ANT_RADIO=!0;export{B as t};