import{a as n,j as Q,t as A,u as T,h as x,k as w,_ as V,C as j,z as U,D as X,S as Y}from"./index-a6248777.js";import{u as W}from"./index-d52e4464.js";import{F as Z}from"./index-3bb9c29d.js";function ee(e){return Object.keys(e).reduce(function(o,r){return(r.startsWith("data-")||r.startsWith("aria-")||r==="role")&&!r.startsWith("data-__")&&(o[r]=e[r]),o},{})}var H=n.createContext(null),te=H.Provider,q=n.createContext(null),ae=q.Provider,ne=["prefixCls","className","style","checked","disabled","defaultChecked","type","onChange"],re=n.forwardRef(function(e,o){var r,t=e.prefixCls,a=t===void 0?"rc-checkbox":t,b=e.className,v=e.style,g=e.checked,f=e.disabled,d=e.defaultChecked,E=d===void 0?!1:d,R=e.type,P=R===void 0?"checkbox":R,C=e.onChange,S=Q(e,ne),s=n.useRef(null),h=W(E,{value:g}),p=A(h,2),y=p[0],k=p[1];n.useImperativeHandle(o,function(){return{focus:function(){var l;(l=s.current)===null||l===void 0||l.focus()},blur:function(){var l;(l=s.current)===null||l===void 0||l.blur()},input:s.current}});var O=T(a,b,(r={},x(r,"".concat(a,"-checked"),y),x(r,"".concat(a,"-disabled"),f),r)),u=function(l){f||("checked"in e||k(l.target.checked),C==null||C({target:V(V({},e),{},{type:P,checked:l.target.checked}),stopPropagation:function(){l.stopPropagation()},preventDefault:function(){l.preventDefault()},nativeEvent:l.nativeEvent}))};return n.createElement("span",{className:O,style:v},n.createElement("input",w({},S,{className:"".concat(a,"-input"),ref:s,onChange:u,disabled:f,checked:!!y,type:P})),n.createElement("span",{className:"".concat(a,"-inner")}))}),oe=globalThis&&globalThis.__rest||function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)o.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]]);return r},le=function(o,r){var t,a=n.useContext(H),b=n.useContext(q),v=n.useContext(j),g=v.getPrefixCls,f=v.direction,d=n.useRef(),E=U(r,d),R=n.useContext(Z),P=R.isFormItemInput,C=function(M){var _,m;(_=o.onChange)===null||_===void 0||_.call(o,M),(m=a==null?void 0:a.onChange)===null||m===void 0||m.call(a,M)},S=o.prefixCls,s=o.className,h=o.children,p=o.style,y=o.disabled,k=oe(o,["prefixCls","className","children","style","disabled"]),O=g("radio",S),u=((a==null?void 0:a.optionType)||b)==="button"?"".concat(O,"-button"):O,i=w({},k),l=n.useContext(X);i.disabled=y||l,a&&(i.name=a.name,i.onChange=C,i.checked=o.value===a.value,i.disabled=i.disabled||a.disabled);var N=T("".concat(u,"-wrapper"),(t={},x(t,"".concat(u,"-wrapper-checked"),i.checked),x(t,"".concat(u,"-wrapper-disabled"),i.disabled),x(t,"".concat(u,"-wrapper-rtl"),f==="rtl"),x(t,"".concat(u,"-wrapper-in-form-item"),P),t),s);return n.createElement("label",{className:N,style:p,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave},n.createElement(re,w({},i,{type:"radio",prefixCls:u,ref:E})),h!==void 0?n.createElement("span",null,h):null)},ie=n.forwardRef(le);const $=ie;var ce=n.forwardRef(function(e,o){var r,t=n.useContext(j),a=t.getPrefixCls,b=t.direction,v=n.useContext(Y),g=W(e.defaultValue,{value:e.value}),f=A(g,2),d=f[0],E=f[1],R=function(F){var K=d,G=F.target.value;"value"in e||E(G);var L=e.onChange;L&&G!==K&&L(F)},P=e.prefixCls,C=e.className,S=C===void 0?"":C,s=e.options,h=e.buttonStyle,p=h===void 0?"outline":h,y=e.disabled,k=e.children,O=e.size,u=e.style,i=e.id,l=e.onMouseEnter,N=e.onMouseLeave,z=e.onFocus,M=e.onBlur,_=a("radio",P),m="".concat(_,"-group"),D=k;s&&s.length>0&&(D=s.map(function(c){return typeof c=="string"||typeof c=="number"?n.createElement($,{key:c.toString(),prefixCls:_,disabled:y,value:c,checked:d===c},c):n.createElement($,{key:"radio-group-value-options-".concat(c.value),prefixCls:_,disabled:c.disabled||y,value:c.value,checked:d===c.value,style:c.style},c.label)}));var B=O||v,J=T(m,"".concat(m,"-").concat(p),(r={},x(r,"".concat(m,"-").concat(B),B),x(r,"".concat(m,"-rtl"),b==="rtl"),r),S);return n.createElement("div",w({},ee(e),{className:J,style:u,onMouseEnter:l,onMouseLeave:N,onFocus:z,onBlur:M,id:i,ref:o}),n.createElement(te,{value:{onChange:R,value:d,disabled:e.disabled,name:e.name,optionType:e.optionType}},D))});const se=n.memo(ce);var ue=globalThis&&globalThis.__rest||function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)o.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]]);return r},de=function(o,r){var t=n.useContext(j),a=t.getPrefixCls,b=o.prefixCls,v=ue(o,["prefixCls"]),g=a("radio",b);return n.createElement(ae,{value:"button"},n.createElement($,w({prefixCls:g},v,{type:"radio",ref:r})))};const ve=n.forwardRef(de);var I=$;I.Button=ve;I.Group=se;I.__ANT_RADIO=!0;const be=I;const fe="_grid_b5nrm_1",ge={grid:fe};export{be as R,ge as s};
