import{g as j,b as w,s as $,c as k,f as U,_ as A,j as D,h as v,a as g,i as E}from"./styled-6f3628cf.js";import{_ as m}from"./emotion-use-insertion-effect-with-fallbacks.browser.esm-e1338cfd.js";import{r as F}from"./index-8ee6c85d.js";import{f as W}from"./formControlState-a1fb9590.js";import{u as z}from"./useFormControl-67bfd31d.js";import{T as x}from"./Typography-e5830f27.js";import{S as B}from"./Stack-550b34ee.js";function H(e){return w("MuiFormControlLabel",e)}const I=j("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),s=I,G=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","required","slotProps","value"],J=e=>{const{classes:o,disabled:l,labelPlacement:n,error:t,required:r}=e,p={root:["root",l&&"disabled",`labelPlacement${k(n)}`,t&&"error",r&&"required"],label:["label",l&&"disabled"],asterisk:["asterisk",t&&"error"]};return E(p,H,o)},K=$("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:l}=e;return[{[`& .${s.label}`]:o.label},o.root,o[`labelPlacement${k(l.labelPlacement)}`]]}})(({theme:e,ownerState:o})=>m({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${s.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},{[`& .${s.label}`]:{[`&.${s.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),O=$("span",{name:"MuiFormControlLabel",slot:"Asterisk",overridesResolver:(e,o)=>o.asterisk})(({theme:e})=>({[`&.${s.error}`]:{color:(e.vars||e).palette.error.main}})),Q=F.forwardRef(function(o,l){var n,t;const r=U({props:o,name:"MuiFormControlLabel"}),{className:p,componentsProps:R={},control:i,disabled:P,disableTypography:q,label:S,labelPlacement:T="end",required:h,slotProps:_={}}=r,N=A(r,G),d=z(),y=(n=P??i.props.disabled)!=null?n:d==null?void 0:d.disabled,b=h??i.props.required,L={disabled:y,required:b};["checked","name","onChange","value","inputRef"].forEach(c=>{typeof i.props[c]>"u"&&typeof r[c]<"u"&&(L[c]=r[c])});const M=W({props:r,muiFormControl:d,states:["error"]}),u=m({},r,{disabled:y,labelPlacement:T,required:b,error:M.error}),f=J(u),C=(t=_.typography)!=null?t:R.typography;let a=S;return a!=null&&a.type!==x&&!q&&(a=D(x,m({component:"span"},C,{className:v(f.label,C==null?void 0:C.className),children:a}))),g(K,m({className:v(f.root,p),ownerState:u,ref:l},N,{children:[F.cloneElement(i,L),b?g(B,{display:"block",children:[a,g(O,{ownerState:u,"aria-hidden":!0,className:f.asterisk,children:[" ","*"]})]}):a]}))}),le=Q;export{le as F};
