import{j as e}from"./vendor-mui-69397583.js";import{r as x}from"./vendor-react-ece1c85f.js";import{bn as N,d as P,b5 as v,bo as A,b6 as E,aU as I,bp as R,bq as Y,br as S}from"./index-c62ac197.js";const m="warning",_={success:{backgroundColor:"bg-emerald-50 dark:bg-emerald-500",titleColor:"text-emerald-700 dark:text-emerald-50",textColor:"text-emerald-500 dark:text-emerald-50",iconColor:"text-emerald-400 dark:text-emerald-50",icon:e.jsx(I,{})},info:{backgroundColor:"bg-blue-50 dark:bg-blue-500",titleColor:"text-blue-700 dark:text-blue-100",textColor:"text-blue-500 dark:text-blue-100",iconColor:"text-blue-400 dark:text-blue-100",icon:e.jsx(R,{})},warning:{backgroundColor:"bg-yellow-50 dark:bg-yellow-500",titleColor:"text-yellow-700 dark:text-yellow-50",textColor:"text-yellow-500 dark:text-yellow-50",iconColor:"text-yellow-400 dark:text-yellow-50",icon:e.jsx(Y,{})},danger:{backgroundColor:"bg-red-50 dark:bg-red-500",titleColor:"text-red-700 dark:text-red-100",textColor:"text-red-500 dark:text-red-100",iconColor:"text-red-400 dark:text-red-100",icon:e.jsx(S,{})}},B=["success","danger","info","warning"],M=x.forwardRef((s,b)=>{const{children:C,className:g,closable:a=!1,customClose:y,customIcon:f,duration:n=3e3,title:o=null,onClose:r,rounded:k=!0,showIcon:i=!1,triggerByToast:p=!1,...w}=s,d=(()=>{const{type:t=m}=s;return B.includes(t)?t:m})(),l=_[d],[c,u]=x.useState("show"),{clear:h}=N(r,n,n>0),j=t=>{u("hiding"),r==null||r(t),h(),p||setTimeout(()=>{u("hide")},400)},T=()=>e.jsx("div",{className:"cursor-pointer",role:"presentation",onClick:t=>j(t),children:y||e.jsx(E,{defaultStyle:!1})}),D=P("alert","p-4 relative flex",l.backgroundColor,l.textColor,o?"":"font-semibold",a?"justify-between":"",a&&!o?"items-center":"",k&&"rounded-lg",g);return c==="hide"?null:e.jsxs(v.div,{ref:b,className:D,initial:{opacity:1},animate:c==="hiding"?"exit":"animate",transition:{duration:.25,type:"tween"},variants:{animate:{opacity:1},exit:{opacity:0}},...w,children:[e.jsxs("div",{className:`flex ${o?"":"items-center"}`,children:[i&&e.jsx(A,{iconColor:l.iconColor,custom:f,type:d}),e.jsxs("div",{className:i?"ltr:ml-2 rtl:mr-2":"",children:[o?e.jsx("div",{className:`font-semibold mb-1 ${l.titleColor}`,children:o}):null,C]})]}),a?T():null]})});M.displayName="Alert";export{M as A};
