import{J as l,r as u,j as o,H as p}from"./vendor-ClLR6ncd.js";import{C as j}from"./CardContent-B36bxiGw.js";import{C}from"./CardActions-DbEyUhB8.js";function a(r,s,e,c=!1){const{enqueueSnackbar:t}=l(),n=u.useRef(r.status);u.useEffect(()=>{r.status===e&&n.current!==e&&t(s,{variant:e,persist:c}),n.current=r.status},[t,r.status,c,s,e])}function S({disabled:r=!1,mutation:s,loadingTitle:e,idleTitle:c,errorTitle:t="Error",successTitle:n="Success",children:i,contentSx:f,withResetOnError:d=!0,variant:x}){return a(s,t,"error",!d),a(s,n,"success"),o.jsxs(o.Fragment,{children:[o.jsx(j,{sx:{flexGrow:1,width:1,p:0,...f},children:i}),o.jsx(C,{sx:{p:0},children:o.jsx(p,{variant:x,disabled:r||s.isLoading,onClick:s.mutate,color:s.isError?"error":void 0,children:s.isLoading?e:s.isError?"Retry":c})})]})}export{S as M,a as u};
