import{a3 as $,a4 as A,r as D,am as G,av as H,an as J,ao as d,j as C,aq as K,ar as M,as as Q,at as F,aw as T,ax as V}from"./index-B1H8BCL7.js";function X(e){return $("PrivateSwitchBase",e)}A("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Y=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],Z=e=>{const{classes:t,checked:i,disabled:l,edge:o}=e,r={root:["root",i&&"checked",l&&"disabled",o&&`edge${M(o)}`],input:["input"]};return Q(r,X,t)},ee=F(T)(({ownerState:e})=>d({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),se=F("input",{shouldForwardProp:V})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),te=D.forwardRef(function(t,i){const{autoFocus:l,checked:o,checkedIcon:r,className:w,defaultChecked:h,disabled:y,disableFocusRipple:p=!1,edge:R=!1,icon:P,id:S,inputProps:I,inputRef:v,name:j,onBlur:f,onChange:g,onFocus:m,readOnly:z,required:E=!1,tabIndex:N,type:c,value:b}=t,U=G(t,Y),[k,q]=H({controlled:o,default:!!h,name:"SwitchBase",state:"checked"}),a=J(),L=s=>{m&&m(s),a&&a.onFocus&&a.onFocus(s)},_=s=>{f&&f(s),a&&a.onBlur&&a.onBlur(s)},O=s=>{if(s.nativeEvent.defaultPrevented)return;const x=s.target.checked;q(x),g&&g(s,x)};let n=y;a&&typeof n>"u"&&(n=a.disabled);const W=c==="checkbox"||c==="radio",u=d({},t,{checked:k,disabled:n,disableFocusRipple:p,edge:R}),B=Z(u);return C.jsxs(ee,d({component:"span",className:K(B.root,w),centerRipple:!0,focusRipple:!p,disabled:n,tabIndex:null,role:void 0,onFocus:L,onBlur:_,ownerState:u,ref:i},U,{children:[C.jsx(se,d({autoFocus:l,checked:o,defaultChecked:h,className:B.input,disabled:n,id:W?S:void 0,name:j,onChange:O,readOnly:z,ref:v,required:E,ownerState:u,tabIndex:N,type:c},c==="checkbox"&&b===void 0?{}:{value:b},I)),k?r:P]}))});export{te as S};
