import{a3 as _,a4 as D,r as L,al as E,am as U,an as A,au as w,ao as d,T as v,j as p,aq as F,ar as R,as as W,at as k}from"./index-B1H8BCL7.js";import{S as z}from"./Stack-BIAbaqpj.js";function B(e){return _("MuiFormControlLabel",e)}const t=D("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),H=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","required","slotProps","value"],I=e=>{const{classes:o,disabled:l,labelPlacement:n,error:s,required:r}=e,m={root:["root",l&&"disabled",`labelPlacement${R(n)}`,s&&"error",r&&"required"],label:["label",l&&"disabled"],asterisk:["asterisk",s&&"error"]};return W(m,B,o)},G=k("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:l}=e;return[{[`& .${t.label}`]:o.label},o.root,o[`labelPlacement${R(l.labelPlacement)}`]]}})(({theme:e,ownerState:o})=>d({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${t.disabled}`]:{cursor:"default"}},o.labelPlacement==="start"&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},o.labelPlacement==="top"&&{flexDirection:"column-reverse",marginLeft:16},o.labelPlacement==="bottom"&&{flexDirection:"column",marginLeft:16},{[`& .${t.label}`]:{[`&.${t.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),J=k("span",{name:"MuiFormControlLabel",slot:"Asterisk",overridesResolver:(e,o)=>o.asterisk})(({theme:e})=>({[`&.${t.error}`]:{color:(e.vars||e).palette.error.main}})),Q=L.forwardRef(function(o,l){var n,s;const r=E({props:o,name:"MuiFormControlLabel"}),{className:m,componentsProps:q={},control:i,disabled:C,disableTypography:$,label:j,labelPlacement:N="end",required:h,slotProps:T={}}=r,M=U(r,H),b=A(),y=(n=C??i.props.disabled)!=null?n:b==null?void 0:b.disabled,u=h??i.props.required,x={disabled:y,required:u};["checked","name","onChange","value","inputRef"].forEach(c=>{typeof i.props[c]>"u"&&typeof r[c]<"u"&&(x[c]=r[c])});const S=w({props:r,muiFormControl:b,states:["error"]}),f=d({},r,{disabled:y,labelPlacement:N,required:u,error:S.error}),g=I(f),P=(s=T.typography)!=null?s:q.typography;let a=j;return a!=null&&a.type!==v&&!$&&(a=p.jsx(v,d({component:"span"},P,{className:F(g.label,P==null?void 0:P.className),children:a}))),p.jsxs(G,d({className:F(g.root,m),ownerState:f,ref:l},M,{children:[L.cloneElement(i,x),u?p.jsxs(z,{display:"block",children:[a,p.jsxs(J,{ownerState:f,"aria-hidden":!0,className:g.asterisk,children:[" ","*"]})]}):a]}))});export{Q as F};
