import{g as $,r as D}from"./index-BP8_t0zE.js";import{_ as K}from"./pick-BQz50zYv.js";import{_ as V}from"./_isIterateeCall-D0xvKagp.js";import{_ as W}from"./_baseUniq-BtunyI9N.js";import{i as G}from"./isArrayLikeObject-WBq23Ido.js";import{L as H,K as J,s as x,ae as M,ac as Q,_ as T,ai as X,c as Y,V as Z,P as ee}from"./defaultI18nProvider-C_r1y4tu.js";import{_ as c,j as C}from"./assertThisInitialized-ClXgY4BW.js";import{u as se}from"./useFormControl-D0zEVldg.js";var te=K,oe=V,ae=W,ne=G,ie=oe(function(e){return ae(te(e,1,ne,!0))}),ce=ie;const Ce=$(ce);function re(e){return H("PrivateSwitchBase",e)}J("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const de=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],le=e=>{const{classes:o,checked:r,disabled:d,edge:a}=e,l={root:["root",r&&"checked",d&&"disabled",a&&`edge${Z(a)}`],input:["input"]};return ee(l,re,o)},ue=x(M)(({ownerState:e})=>c({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),pe=x("input",{shouldForwardProp:Q})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),xe=D.forwardRef(function(o,r){const{autoFocus:d,checked:a,checkedIcon:l,className:y,defaultChecked:p,disabled:R,disableFocusRipple:h=!1,edge:_=!1,icon:w,id:P,inputProps:S,inputRef:v,name:j,onBlur:f,onChange:m,onFocus:b,readOnly:I,required:L=!1,tabIndex:U,type:i,value:g}=o,E=T(o,de),[k,q]=X({controlled:a,default:!!p,name:"SwitchBase",state:"checked"}),t=se(),z=s=>{b&&b(s),t&&t.onFocus&&t.onFocus(s)},N=s=>{f&&f(s),t&&t.onBlur&&t.onBlur(s)},O=s=>{if(s.nativeEvent.defaultPrevented)return;const B=s.target.checked;q(B),m&&m(s,B)};let n=R;t&&typeof n>"u"&&(n=t.disabled);const A=i==="checkbox"||i==="radio",u=c({},o,{checked:k,disabled:n,disableFocusRipple:h,edge:_}),F=le(u);return C.jsxs(ue,c({component:"span",className:Y(F.root,y),centerRipple:!0,focusRipple:!h,disabled:n,tabIndex:null,role:void 0,onFocus:z,onBlur:N,ownerState:u,ref:r},E,{children:[C.jsx(pe,c({autoFocus:d,checked:a,defaultChecked:p,className:F.input,disabled:n,id:A?P:void 0,name:j,onChange:O,readOnly:I,ref:v,required:L,ownerState:u,tabIndex:U,type:i},i==="checkbox"&&g===void 0?{}:{value:g},S)),k?l:w]}))});export{xe as S,Ce as u};
