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