import{cG as E,cF as U,f as L,cH as F,cI as v,r as P,cJ as A,cK as H,T as x,j as d,cL as y,cM as I}from"./index-55b8aeb0.js";import{u as z,f as B}from"./useFormControl-0fae9ee7.js";function G(e){return U("MuiFormControlLabel",e)}const J=E("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),l=J,K=e=>{const{classes:o,disabled:s,labelPlacement:r,error:m,required:b}=e,u={root:["root",s&&"disabled",`labelPlacement${F(r)}`,m&&"error",b&&"required"],label:["label",s&&"disabled"],asterisk:["asterisk",m&&"error"]};return I(u,G,o)},W=L("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:s}=e;return[{[`& .${l.label}`]:o.label},o.root,o[`labelPlacement${F(s.labelPlacement)}`]]}})(v(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${l.disabled}`]:{cursor:"default"},[`& .${l.label}`]:{[`&.${l.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:o})=>o==="start"||o==="top"||o==="bottom",style:{marginLeft:16}}]}))),O=L("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(v(({theme:e})=>({[`&.${l.error}`]:{color:(e.vars||e).palette.error.main}}))),Q=P.forwardRef(function(o,s){const r=A({props:o,name:"MuiFormControlLabel"}),{checked:m,className:b,componentsProps:u={},control:a,disabled:R,disableTypography:$,inputRef:V,label:T,labelPlacement:q="end",name:X,onChange:Y,required:w,slots:S={},slotProps:j={},value:Z,...k}=r,n=z(),g=R??a.props.disabled??(n==null?void 0:n.disabled),f=w??a.props.required,h={disabled:g,required:f};["checked","name","onChange","value","inputRef"].forEach(p=>{typeof a.props[p]>"u"&&typeof r[p]<"u"&&(h[p]=r[p])});const M=B({props:r,muiFormControl:n,states:["error"]}),i={...r,disabled:g,labelPlacement:q,required:f,error:M.error},C=K(i),N={slots:S,slotProps:{...u,...j}},[D,c]=H("typography",{elementType:x,externalForwardedProps:N,ownerState:i});let t=T;return t!=null&&t.type!==x&&!$&&(t=d.jsx(D,{component:"span",...c,className:y(C.label,c==null?void 0:c.className),children:t})),d.jsxs(W,{className:y(C.root,b),ownerState:i,ref:s,...k,children:[P.cloneElement(a,h),f?d.jsxs("div",{children:[t,d.jsxs(O,{ownerState:i,"aria-hidden":!0,className:C.asterisk,children:[" ","*"]})]}):t]})}),oe=Q;export{oe as F};
