import{w as $,v as S,t as d,O as e,z as i,V as b,aA as x,aB as C,r as f,x as m,y,f as c,j as z,D as R,E as B,J as M,K as T}from"./index.8f299a7d.js";import{S as j,F as N}from"./FormControlLabel.4a0a74ee.js";function O(o){return S("MuiSwitch",o)}const D=$("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),t=D,F=["className","color","edge","size","sx"],I=o=>{const{classes:a,edge:s,size:r,color:p,checked:u,disabled:h}=o,g={root:["root",s&&`edge${e(s)}`,`size${e(r)}`],switchBase:["switchBase",`color${e(p)}`,u&&"checked",h&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},v=B(g,O,a);return i({},a,v)},U=d("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(o,a)=>{const{ownerState:s}=o;return[a.root,s.edge&&a[`edge${e(s.edge)}`],a[`size${e(s.size)}`]]}})(({ownerState:o})=>i({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"}},o.edge==="start"&&{marginLeft:-8},o.edge==="end"&&{marginRight:-8},o.size==="small"&&{width:40,height:24,padding:7,[`& .${t.thumb}`]:{width:16,height:16},[`& .${t.switchBase}`]:{padding:4,[`&.${t.checked}`]:{transform:"translateX(16px)"}}})),A=d(j,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(o,a)=>{const{ownerState:s}=o;return[a.switchBase,{[`& .${t.input}`]:a.input},s.color!=="default"&&a[`color${e(s.color)}`]]}})(({theme:o})=>({position:"absolute",top:0,left:0,zIndex:1,color:o.vars?o.vars.palette.Switch.defaultColor:`${o.palette.mode==="light"?o.palette.common.white:o.palette.grey[300]}`,transition:o.transitions.create(["left","transform"],{duration:o.transitions.duration.shortest}),[`&.${t.checked}`]:{transform:"translateX(20px)"},[`&.${t.disabled}`]:{color:o.vars?o.vars.palette.Switch.defaultDisabledColor:`${o.palette.mode==="light"?o.palette.grey[100]:o.palette.grey[600]}`},[`&.${t.checked} + .${t.track}`]:{opacity:.5},[`&.${t.disabled} + .${t.track}`]:{opacity:o.vars?o.vars.opacity.switchTrackDisabled:`${o.palette.mode==="light"?.12:.2}`},[`& .${t.input}`]:{left:"-100%",width:"300%"}}),({theme:o,ownerState:a})=>i({"&:hover":{backgroundColor:o.vars?`rgba(${o.vars.palette.action.activeChannel} / ${o.vars.palette.action.hoverOpacity})`:b(o.palette.action.active,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},a.color!=="default"&&{[`&.${t.checked}`]:{color:(o.vars||o).palette[a.color].main,"&:hover":{backgroundColor:o.vars?`rgba(${o.vars.palette[a.color].mainChannel} / ${o.vars.palette.action.hoverOpacity})`:b(o.palette[a.color].main,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${t.disabled}`]:{color:o.vars?o.vars.palette.Switch[`${a.color}DisabledColor`]:`${o.palette.mode==="light"?x(o.palette[a.color].main,.62):C(o.palette[a.color].main,.55)}`}},[`&.${t.checked} + .${t.track}`]:{backgroundColor:(o.vars||o).palette[a.color].main}})),L=d("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(o,a)=>a.track})(({theme:o})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:o.transitions.create(["opacity","background-color"],{duration:o.transitions.duration.shortest}),backgroundColor:o.vars?o.vars.palette.common.onBackground:`${o.palette.mode==="light"?o.palette.common.black:o.palette.common.white}`,opacity:o.vars?o.vars.opacity.switchTrack:`${o.palette.mode==="light"?.38:.3}`})),P=d("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(o,a)=>a.thumb})(({theme:o})=>({boxShadow:(o.vars||o).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),_=f.exports.forwardRef(function(a,s){const r=m({props:a,name:"MuiSwitch"}),{className:p,color:u="primary",edge:h=!1,size:g="medium",sx:v}=r,k=y(r,F),l=i({},r,{color:u,edge:h,size:g}),n=I(l),w=c(P,{className:n.thumb,ownerState:l});return z(U,{className:R(n.root,p),sx:v,ownerState:l,children:[c(A,i({type:"checkbox",icon:w,checkedIcon:w,ref:s,ownerState:l},k,{classes:i({},n,{root:n.switchBase})})),c(L,{className:n.track,ownerState:l})]})}),E=_;function J({name:o,...a}){const{control:s}=M();return c(N,{control:c(T,{name:o,control:s,render:({field:r})=>c(E,{...r,checked:r.value})}),...a})}export{J as R};
