Files
weiguang-jewelry-ledger/新账系统/web/dist/assets/checkbox-C-coepK7.js
T

8 lines
19 KiB
JavaScript

import{n as e}from"./rolldown-runtime-Dl_DZoUm.js";import{$n as t,An as n,En as r,In as i,Kn as a,Nt as o,On as s,Qn as c,Rt as l,U as u,Wt as d,Xt as f,_t as p,cn as m,kn as h,kt as g,nn as _,on as v,qn as y,qt as b,rt as x,tn as S,tr as C,vt as w,wn as T,xt as E,yt as D}from"./index-D422TGjj.js";import{t as O}from"./useForm-gd33qHRf.js";var k=e(C()),A={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z`}}]},name:`right`,theme:`outlined`},j=k.forwardRef(function(e,t){return k.createElement(l,c({},e,{ref:t,icon:A}))}),M=e(t()),N=k.createContext(null),P=N.Provider,F=k.createContext(null),I=F.Provider,L=[`prefixCls`,`className`,`style`,`checked`,`disabled`,`defaultChecked`,`type`,`title`,`onChange`],R=(0,k.forwardRef)(function(e,t){var n=e.prefixCls,i=n===void 0?`rc-checkbox`:n,o=e.className,l=e.style,u=e.checked,d=e.disabled,f=e.defaultChecked,p=f!==void 0&&f,m=e.type,h=m===void 0?`checkbox`:m,g=e.title,v=e.onChange,b=r(e,L),x=(0,k.useRef)(null),S=(0,k.useRef)(null),C=_(p,{value:u}),w=s(C,2),T=w[0],E=w[1];(0,k.useImperativeHandle)(t,function(){return{focus:function(e){var t;(t=x.current)==null||t.focus(e)},blur:function(){var e;(e=x.current)==null||e.blur()},input:x.current,nativeElement:S.current}});var D=(0,M.default)(i,o,y(y({},`${i}-checked`,T),`${i}-disabled`,d));return k.createElement(`span`,{className:D,title:g,style:l,ref:S},k.createElement(`input`,c({},b,{className:`${i}-input`,ref:x,onChange:function(t){d||(`checked`in e||E(t.target.checked),v?.({target:a(a({},e),{},{type:h,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:d,checked:!!T,type:h})),k.createElement(`span`,{className:`${i}-inner`}))});function z(e){let t=k.useRef(null),n=()=>{h.cancel(t.current),t.current=null};return[()=>{n(),t.current=h(()=>{t.current=null})},r=>{t.current&&(r.stopPropagation(),n()),e?.(r)}]}var B=e=>{let{componentCls:t,antCls:n}=e,r=`${t}-group`;return{[r]:Object.assign(Object.assign({},f(e)),{display:`inline-block`,fontSize:0,[`&${r}-rtl`]:{direction:`rtl`},[`&${r}-block`]:{display:`flex`},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:`none`}})}},V=e=>{let{componentCls:t,wrapperMarginInlineEnd:n,colorPrimary:r,radioSize:i,motionDurationSlow:a,motionDurationMid:o,motionEaseInOutCirc:s,colorBgContainer:c,colorBorder:l,lineWidth:u,colorBgContainerDisabled:d,colorTextDisabled:p,paddingXS:m,dotColorDisabled:h,lineType:g,radioColor:_,radioBgColor:v,calc:y}=e,x=`${t}-inner`,S=y(i).sub(y(4).mul(2)),C=y(1).mul(i).equal({unit:!0});return{[`${t}-wrapper`]:Object.assign(Object.assign({},f(e)),{display:`inline-flex`,alignItems:`baseline`,marginInlineStart:0,marginInlineEnd:n,cursor:`pointer`,"&:last-child":{marginInlineEnd:0},[`&${t}-wrapper-rtl`]:{direction:`rtl`},"&-disabled":{cursor:`not-allowed`,color:e.colorTextDisabled},"&::after":{display:`inline-block`,width:0,overflow:`hidden`,content:`"\\a0"`},"&-block":{flex:1,justifyContent:`center`},[`${t}-checked::after`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,width:`100%`,height:`100%`,border:`${T(u)} ${g} ${r}`,borderRadius:`50%`,visibility:`hidden`,opacity:0,content:`""`},[t]:Object.assign(Object.assign({},f(e)),{position:`relative`,display:`inline-block`,outline:`none`,cursor:`pointer`,alignSelf:`center`,borderRadius:`50%`}),[`${t}-wrapper:hover &,
&:hover ${x}`]:{borderColor:r},[`${t}-input:focus-visible + ${x}`]:b(e),[`${t}:hover::after, ${t}-wrapper:hover &::after`]:{visibility:`visible`},[`${t}-inner`]:{"&::after":{boxSizing:`border-box`,position:`absolute`,insetBlockStart:`50%`,insetInlineStart:`50%`,display:`block`,width:C,height:C,marginBlockStart:y(1).mul(i).div(-2).equal({unit:!0}),marginInlineStart:y(1).mul(i).div(-2).equal({unit:!0}),backgroundColor:_,borderBlockStart:0,borderInlineStart:0,borderRadius:C,transform:`scale(0)`,opacity:0,transition:`all ${a} ${s}`,content:`""`},boxSizing:`border-box`,position:`relative`,insetBlockStart:0,insetInlineStart:0,display:`block`,width:C,height:C,backgroundColor:c,borderColor:l,borderStyle:`solid`,borderWidth:u,borderRadius:`50%`,transition:`all ${o}`},[`${t}-input`]:{position:`absolute`,inset:0,zIndex:1,cursor:`pointer`,opacity:0},[`${t}-checked`]:{[x]:{borderColor:r,backgroundColor:v,"&::after":{transform:`scale(${e.calc(e.dotSize).div(i).equal()})`,opacity:1,transition:`all ${a} ${s}`}}},[`${t}-disabled`]:{cursor:`not-allowed`,[x]:{backgroundColor:d,borderColor:l,cursor:`not-allowed`,"&::after":{backgroundColor:h}},[`${t}-input`]:{cursor:`not-allowed`},[`${t}-disabled + span`]:{color:p,cursor:`not-allowed`},[`&${t}-checked`]:{[x]:{"&::after":{transform:`scale(${y(S).div(i).equal()})`}}}},[`span${t} + *`]:{paddingInlineStart:m,paddingInlineEnd:m}})}},H=e=>{let{buttonColor:t,controlHeight:n,componentCls:r,lineWidth:i,lineType:a,colorBorder:o,motionDurationMid:s,buttonPaddingInline:c,fontSize:l,buttonBg:u,fontSizeLG:d,controlHeightLG:f,controlHeightSM:p,paddingXS:m,borderRadius:h,borderRadiusSM:g,borderRadiusLG:_,buttonCheckedBg:v,buttonSolidCheckedColor:y,colorTextDisabled:x,colorBgContainerDisabled:S,buttonCheckedBgDisabled:C,buttonCheckedColorDisabled:w,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:c,paddingBlock:0,color:t,fontSize:l,lineHeight:T(M(n).sub(M(i).mul(2)).equal()),background:u,border:`${T(i)} ${a} ${o}`,borderBlockStartWidth:M(i).add(.02).equal(),borderInlineEndWidth:i,cursor:`pointer`,transition:[`color ${s}`,`background ${s}`,`box-shadow ${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:`${T(i)} ${a} ${o}`,borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},[`${r}-group-large &`]:{height:f,fontSize:d,lineHeight:T(M(f).sub(M(i).mul(2)).equal()),"&:first-child":{borderStartStartRadius:_,borderEndStartRadius:_},"&:last-child":{borderStartEndRadius:_,borderEndEndRadius:_}},[`${r}-group-small &`]:{height:p,paddingInline:M(m).sub(i).equal(),paddingBlock:0,lineHeight:T(M(p).sub(M(i).mul(2)).equal()),"&:first-child":{borderStartStartRadius:g,borderEndStartRadius:g},"&:last-child":{borderStartEndRadius:g,borderEndEndRadius:g}},"&:hover":{position:`relative`,color:E},"&:has(:focus-visible)":b(e),[`${r}-inner, 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:v,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:y,background:k,borderColor:k,"&:hover":{color:y,background:A,borderColor:A},"&:active":{color:y,background:j,borderColor:j}},"&-disabled":{color:x,backgroundColor:S,borderColor:o,cursor:`not-allowed`,"&:first-child, &:hover":{color:x,backgroundColor:S,borderColor:o}},[`&-disabled${r}-button-wrapper-checked`]:{color:w,backgroundColor:C,borderColor:o,boxShadow:`none`},"&-block":{flex:1,textAlign:`center`}}}},U=d(`Radio`,e=>{let{controlOutline:t,controlOutlineWidth:n}=e,r=`0 0 0 ${T(n)} ${t}`,i=S(e,{radioFocusShadow:r,radioButtonFocusShadow:r});return[B(i),V(i),H(i)]},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}}),W=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},G=k.forwardRef((e,t)=>{let n=k.useContext(N),r=k.useContext(F),{getPrefixCls:a,direction:o,radio:s}=k.useContext(m),c=k.useRef(null),l=i(t,c),{isFormItemInput:d}=k.useContext(u),f=t=>{var r,i;(r=e.onChange)==null||r.call(e,t),(i=n?.onChange)==null||i.call(n,t)},{prefixCls:p,className:h,rootClassName:_,children:y,style:b,title:x}=e,S=W(e,[`prefixCls`,`className`,`rootClassName`,`children`,`style`,`title`]),C=a(`radio`,p),T=(n?.optionType||r)===`button`,E=T?`${C}-button`:C,O=g(C),[A,j,P]=U(C,O),I=Object.assign({},S),L=k.useContext(v);n&&(I.name=n.name,I.onChange=f,I.checked=e.value===n.value,I.disabled=I.disabled??n.disabled),I.disabled=I.disabled??L;let B=(0,M.default)(`${E}-wrapper`,{[`${E}-wrapper-checked`]:I.checked,[`${E}-wrapper-disabled`]:I.disabled,[`${E}-wrapper-rtl`]:o===`rtl`,[`${E}-wrapper-in-form-item`]:d,[`${E}-wrapper-block`]:!!n?.block},s?.className,h,_,j,P,O),[V,H]=z(I.onClick);return A(k.createElement(w,{component:`Radio`,disabled:I.disabled},k.createElement(`label`,{className:B,style:Object.assign(Object.assign({},s?.style),b),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:x,onClick:V},k.createElement(R,Object.assign({},I,{className:(0,M.default)(I.className,{[D]:!T}),type:`radio`,prefixCls:E,ref:l,onClick:H})),y===void 0?null:k.createElement(`span`,{className:`${E}-label`},y))))}),K=k.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r}=k.useContext(m),{name:i}=k.useContext(u),a=x(O(i)),{prefixCls:s,className:c,rootClassName:l,options:d,buttonStyle:f=`outline`,disabled:h,children:v,size:y,style:b,id:S,optionType:C,name:w=a,defaultValue:T,value:E,block:D=!1,onChange:A,onMouseEnter:j,onMouseLeave:N,onFocus:F,onBlur:I}=e,[L,R]=_(T,{value:E}),z=k.useCallback(t=>{let n=L,r=t.target.value;`value`in e||R(r),r!==n&&A?.(t)},[L,R,A]),B=n(`radio`,s),V=`${B}-group`,H=g(B),[W,K,q]=U(B,H),J=v;d&&d.length>0&&(J=d.map(e=>typeof e==`string`||typeof e==`number`?k.createElement(G,{key:e.toString(),prefixCls:B,disabled:h,value:e,checked:L===e},e):k.createElement(G,{key:`radio-group-value-options-${e.value}`,prefixCls:B,disabled:e.disabled||h,value:e.value,checked:L===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let Y=p(y),X=(0,M.default)(V,`${V}-${f}`,{[`${V}-${Y}`]:Y,[`${V}-rtl`]:r===`rtl`,[`${V}-block`]:D},c,l,K,q,H),Z=k.useMemo(()=>({onChange:z,value:L,disabled:h,name:w,optionType:C,block:D}),[z,L,h,w,C,D]);return W(k.createElement(`div`,Object.assign({},o(e,{aria:!0,data:!0}),{className:X,style:b,onMouseEnter:j,onMouseLeave:N,onFocus:F,onBlur:I,id:S,ref:t}),k.createElement(P,{value:Z},J)))}),q=k.memo(K),J=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Y=k.forwardRef((e,t)=>{let{getPrefixCls:n}=k.useContext(m),{prefixCls:r}=e,i=J(e,[`prefixCls`]),a=n(`radio`,r);return k.createElement(I,{value:`button`},k.createElement(G,Object.assign({prefixCls:a},i,{type:`radio`,ref:t})))}),X=G;X.Button=Y,X.Group=q,X.__ANT_RADIO=!0;var Z=e=>{let{checkboxCls:t}=e,n=`${t}-wrapper`;return[{[`${t}-group`]:Object.assign(Object.assign({},f(e)),{display:`inline-flex`,flexWrap:`wrap`,columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[n]:Object.assign(Object.assign({},f(e)),{display:`inline-flex`,alignItems:`baseline`,cursor:`pointer`,"&:after":{display:`inline-block`,width:0,overflow:`hidden`,content:`'\\a0'`},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[t]:Object.assign(Object.assign({},f(e)),{position:`relative`,whiteSpace:`nowrap`,lineHeight:1,cursor:`pointer`,borderRadius:e.borderRadiusSM,alignSelf:`center`,[`${t}-input`]:{position:`absolute`,inset:0,zIndex:1,cursor:`pointer`,opacity:0,margin:0,[`&:focus-visible + ${t}-inner`]:b(e)},[`${t}-inner`]:{boxSizing:`border-box`,display:`block`,width:e.checkboxSize,height:e.checkboxSize,direction:`ltr`,backgroundColor:e.colorBgContainer,border:`${T(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:`separate`,transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:`border-box`,position:`absolute`,top:`50%`,insetInlineStart:`25%`,display:`table`,width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:`${T(e.lineWidthBold)} solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:`rotate(45deg) scale(0) translate(-50%,-50%)`,opacity:0,content:`""`,transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[`
${n}:not(${n}-disabled),
${t}:not(${t}-disabled)
`]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${n}:not(${n}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:`transparent`},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:`rotate(45deg) scale(1) translate(-50%,-50%)`,transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[`
${n}-checked:not(${n}-disabled),
${t}-checked:not(${t}-disabled)
`]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:`transparent`}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:`50%`,insetInlineStart:`50%`,width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:`translate(-50%, -50%) scale(1)`,opacity:1,content:`""`}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${n}-disabled`]:{cursor:`not-allowed`},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:`not-allowed`,pointerEvents:`none`},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:`none`},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]};function Q(e,t){return Z(S(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}var ee=d(`Checkbox`,(e,{prefixCls:t})=>[Q(t,e)]),te=k.createContext(null),ne=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},re=k.forwardRef((e,t)=>{let{prefixCls:n,className:r,rootClassName:a,children:o,indeterminate:s=!1,style:c,onMouseEnter:l,onMouseLeave:d,skipGroup:f=!1,disabled:p}=e,h=ne(e,[`prefixCls`,`className`,`rootClassName`,`children`,`indeterminate`,`style`,`onMouseEnter`,`onMouseLeave`,`skipGroup`,`disabled`]),{getPrefixCls:_,direction:y,checkbox:b}=k.useContext(m),x=k.useContext(te),{isFormItemInput:S}=k.useContext(u),C=k.useContext(v),T=(x?.disabled||p)??C,E=k.useRef(h.value),O=k.useRef(null),A=i(t,O);k.useEffect(()=>{x?.registerValue(h.value)},[]),k.useEffect(()=>{if(!f)return h.value!==E.current&&(x?.cancelValue(E.current),x?.registerValue(h.value),E.current=h.value),()=>x?.cancelValue(h.value)},[h.value]),k.useEffect(()=>{O.current?.input&&(O.current.input.indeterminate=s)},[s]);let j=_(`checkbox`,n),N=g(j),[P,F,I]=ee(j,N),L=Object.assign({},h);x&&!f&&(L.onChange=(...e)=>{h.onChange&&h.onChange.apply(h,e),x.toggleOption&&x.toggleOption({label:o,value:h.value})},L.name=x.name,L.checked=x.value.includes(h.value));let B=(0,M.default)(`${j}-wrapper`,{[`${j}-rtl`]:y===`rtl`,[`${j}-wrapper-checked`]:L.checked,[`${j}-wrapper-disabled`]:T,[`${j}-wrapper-in-form-item`]:S},b?.className,r,a,I,N,F),V=(0,M.default)({[`${j}-indeterminate`]:s},D,F),[H,U]=z(L.onClick);return P(k.createElement(w,{component:`Checkbox`,disabled:T},k.createElement(`label`,{className:B,style:Object.assign(Object.assign({},b?.style),c),onMouseEnter:l,onMouseLeave:d,onClick:H},k.createElement(R,Object.assign({},L,{onClick:U,prefixCls:j,className:V,disabled:T,ref:A})),o!=null&&k.createElement(`span`,{className:`${j}-label`},o))))}),ie=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ae=k.forwardRef((e,t)=>{let{defaultValue:r,children:i,options:a=[],prefixCls:o,className:s,rootClassName:c,style:l,onChange:u}=e,d=ie(e,[`defaultValue`,`children`,`options`,`prefixCls`,`className`,`rootClassName`,`style`,`onChange`]),{getPrefixCls:f,direction:p}=k.useContext(m),[h,_]=k.useState(d.value||r||[]),[v,y]=k.useState([]);k.useEffect(()=>{`value`in d&&_(d.value||[])},[d.value]);let b=k.useMemo(()=>a.map(e=>typeof e==`string`||typeof e==`number`?{label:e,value:e}:e),[a]),x=e=>{y(t=>t.filter(t=>t!==e))},S=e=>{y(t=>[].concat(n(t),[e]))},C=e=>{let t=h.indexOf(e.value),r=n(h);t===-1?r.push(e.value):r.splice(t,1),`value`in d||_(r),u?.(r.filter(e=>v.includes(e)).sort((e,t)=>b.findIndex(t=>t.value===e)-b.findIndex(e=>e.value===t)))},w=f(`checkbox`,o),T=`${w}-group`,D=g(w),[O,A,j]=ee(w,D),N=E(d,[`value`,`disabled`]),P=a.length?b.map(e=>k.createElement(re,{prefixCls:w,key:e.value.toString(),disabled:`disabled`in e?e.disabled:d.disabled,value:e.value,checked:h.includes(e.value),onChange:e.onChange,className:(0,M.default)(`${T}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):i,F=k.useMemo(()=>({toggleOption:C,value:h,disabled:d.disabled,name:d.name,registerValue:S,cancelValue:x}),[C,h,d.disabled,d.name,S,x]),I=(0,M.default)(T,{[`${T}-rtl`]:p===`rtl`},s,c,j,D,A);return O(k.createElement(`div`,Object.assign({className:I,style:l},N,{ref:t}),k.createElement(te.Provider,{value:F},P)))}),$=re;$.Group=ae,$.__ANT_CHECKBOX=!0;export{j as i,Q as n,X as r,$ as t};