import{bh as Q,bi as V,d as F,bA as W,by as X,r as Y,bl as y,j as C,bo as Z,bn as _}from"./index-60a3c753.js";import{u as ee}from"./useFormControl-e13b5747.js";import{u as oe}from"./useControlled-194ef007.js";function te(t){return Q("PrivateSwitchBase",t)}V("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const se=t=>{const{classes:s,checked:l,disabled:d,edge:n}=t,u={root:["root",l&&"checked",d&&"disabled",n&&`edge${Z(n)}`],input:["input"]};return _(u,te,s)},ae=F(W,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:t,ownerState:s})=>t==="start"&&s.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:t,ownerState:s})=>t==="end"&&s.size!=="small",style:{marginRight:-12}}]}),ie=F("input",{name:"MuiSwitchBase",shouldForwardProp:X})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),ne=Y.forwardRef(function(s,l){const{autoFocus:d,checked:n,checkedIcon:u,defaultChecked:f,disabled:k,disableFocusRipple:h=!1,edge:x=!1,icon:R,id:I,inputProps:z,inputRef:j,name:E,onBlur:m,onChange:g,onFocus:S,readOnly:U,required:L=!1,tabIndex:M,type:c,value:b,slots:N={},slotProps:T={},...$}=s,[w,q]=oe({controlled:n,default:!!f,name:"SwitchBase",state:"checked"}),a=ee(),A=e=>{S&&S(e),a&&a.onFocus&&a.onFocus(e)},O=e=>{m&&m(e),a&&a.onBlur&&a.onBlur(e)},v=e=>{if(e.nativeEvent.defaultPrevented)return;const o=e.target.checked;q(o),g&&g(e,o)};let r=k;a&&typeof r>"u"&&(r=a.disabled);const D=c==="checkbox"||c==="radio",p={...s,checked:w,disabled:r,disableFocusRipple:h,edge:x},B=se(p),P={slots:N,slotProps:{input:z,...T}},[G,H]=y("root",{ref:l,elementType:ae,className:B.root,shouldForwardComponentProp:!0,externalForwardedProps:{...P,component:"span",...$},getSlotProps:e=>({...e,onFocus:o=>{var i;(i=e.onFocus)==null||i.call(e,o),A(o)},onBlur:o=>{var i;(i=e.onBlur)==null||i.call(e,o),O(o)}}),ownerState:p,additionalProps:{centerRipple:!0,focusRipple:!h,disabled:r,role:void 0,tabIndex:null}}),[J,K]=y("input",{ref:j,elementType:ie,className:B.input,externalForwardedProps:P,getSlotProps:e=>({...e,onChange:o=>{var i;(i=e.onChange)==null||i.call(e,o),v(o)}}),ownerState:p,additionalProps:{autoFocus:d,checked:n,defaultChecked:f,disabled:r,id:D?I:void 0,name:E,readOnly:U,required:L,tabIndex:M,type:c,...c==="checkbox"&&b===void 0?{}:{value:b}}});return C.jsxs(G,{...H,children:[C.jsx(J,{...K}),w?u:R]})}),de=ne;export{de as S};
