import{cO as r,dH as j,dI as R,f as $,R as k,o as e,r as b,dJ as M,t as O,cQ as W,j as u}from"./index-6c48ebe4.js";import{u as z}from"./Select-c5c274bb.js";import{c as U}from"./composeClasses-b42b2e69.js";import{C as _}from"./CircularProgress-7b4c6820.js";function B(n,o){const i=r({},o);return Object.keys(n).forEach(t=>{if(t.toString().match(/^(components|slots)$/))i[t]=r({},n[t],i[t]);else if(t.toString().match(/^(componentsProps|slotProps)$/)){const s=n[t]||{},a=o[t];i[t]={},!a||!Object.keys(a)?i[t]=s:!s||!Object.keys(s)?i[t]=a:(i[t]=r({},a),Object.keys(s).forEach(l=>{i[t][l]=B(s[l],a[l])}))}else i[t]===void 0&&(i[t]=n[t])}),i}function F(n){return R("MuiLoadingButton",n)}const m=j("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),d=m,p=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],D=n=>{const{loading:o,loadingPosition:i,classes:t}=n,s={root:["root",o&&"loading"],startIcon:[o&&`startIconLoading${e(i)}`],endIcon:[o&&`endIconLoading${e(i)}`],loadingIndicator:["loadingIndicator",o&&`loadingIndicator${e(i)}`]},a=U(s,F,t);return r({},t,a)},G=n=>n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"&&n!=="classes",H=$(k,{shouldForwardProp:n=>G(n)||n==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(n,o)=>[o.root,o.startIconLoadingStart&&{[`& .${d.startIconLoadingStart}`]:o.startIconLoadingStart},o.endIconLoadingEnd&&{[`& .${d.endIconLoadingEnd}`]:o.endIconLoadingEnd}]})(({ownerState:n,theme:o})=>r({[`& .${d.startIconLoadingStart}, & .${d.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0}},n.loadingPosition==="center"&&{transition:o.transitions.create(["background-color","box-shadow","border-color"],{duration:o.transitions.duration.short}),[`&.${d.loading}`]:{color:"transparent"}},n.loadingPosition==="start"&&n.fullWidth&&{[`& .${d.startIconLoadingStart}, & .${d.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginRight:-8}},n.loadingPosition==="end"&&n.fullWidth&&{[`& .${d.startIconLoadingStart}, & .${d.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginLeft:-8}})),J=$("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(n,o)=>{const{ownerState:i}=n;return[o.loadingIndicator,o[`loadingIndicator${e(i.loadingPosition)}`]]}})(({theme:n,ownerState:o})=>r({position:"absolute",visibility:"visible",display:"flex"},o.loadingPosition==="start"&&(o.variant==="outlined"||o.variant==="contained")&&{left:o.size==="small"?10:14},o.loadingPosition==="start"&&o.variant==="text"&&{left:6},o.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(n.vars||n).palette.action.disabled},o.loadingPosition==="end"&&(o.variant==="outlined"||o.variant==="contained")&&{right:o.size==="small"?10:14},o.loadingPosition==="end"&&o.variant==="text"&&{right:6},o.loadingPosition==="start"&&o.fullWidth&&{position:"relative",left:-10},o.loadingPosition==="end"&&o.fullWidth&&{position:"relative",right:-10})),Q=b.forwardRef(function(o,i){const t=b.useContext(M),s=B(t,o),a=O({props:s,name:"MuiLoadingButton"}),{children:l,disabled:I=!1,id:y,loading:g=!1,loadingIndicator:L,loadingPosition:C="center",variant:f="text"}=a,E=W(a,p),P=z(y),v=L??u.jsx(_,{"aria-labelledby":P,color:"inherit",size:16}),c=r({},a,{disabled:I,loading:g,loadingIndicator:v,loadingPosition:C,variant:f}),h=D(c),x=g?u.jsx(J,{className:h.loadingIndicator,ownerState:c,children:v}):null;return u.jsxs(H,r({disabled:I||g,id:P,ref:i},E,{variant:f,classes:h,ownerState:c,children:[c.loadingPosition==="end"?l:x,c.loadingPosition==="end"?x:l]}))}),V=Q;export{V as L};
