import{__rest as o,__assign as s}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useEffect as c,cloneElement as n}from"react";import e from"classnames";import{noop as r}from"lodash";import{Grow as a,SnackbarContent as l,Tooltip as m,Typography as p}from"@material-ui/core";import d from"../IconButton/index.js";import{NOTIFICATION_VARIANTS as u}from"../../constants/notifications.js";import{useStyles as f}from"./Toast.styles.js";import{CheckOneIcon as j,CautionIcon as I,AttentionIcon as C,InfoIcon as h,PuzzleIcon as v,CloseSmallIcon as b}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";var k,N=((k={})[u.success]=j,k[u.warning]=I,k[u.error]=C,k[u.info]=h,k[u.neutral]=v,k),g=function(j){var I,C=j.onDismissClick,h=j.toast,v=o(j,["onDismissClick","toast"]),k=h.alertLevel,g=h.autoHideDuration,x=void 0===g?3e3:g,F=h.content,T=h.hideIcon,P=h.icon,z=h.id,B=h.onClick,D=void 0===B?r:B,E=h.onClose,L=void 0===E?r:E,O=h.timestamp,R=h.title,W=h.tooltipProps,q=h.variant,w=void 0===q?"info":q;c((function(){if(x!==1/0){var o=setTimeout((function(){return C(z)}),x);return function(){return clearTimeout(o)}}}),[]);var y=f(),A=N[w];return i(a,s({appear:!0,in:!0},{children:i(l,s({classes:{root:e(y.main,!k&&y[w],k&&y.alertNotification,k&&y["alertLevels-".concat(k)]),action:y.actionContainer,message:y.messageContainer},"aria-describedby":"client-snackbar","data-testid":"notificationPopup_".concat(u[w]),message:i(m,s({},W,{title:F,classes:{tooltip:y.tooltip},placement:"bottom"},{children:t("div",s({id:"client-snackbar",className:y.messageWrapper,onClick:D},{children:[!T&&i("div",s({className:y.iconWrapper},{children:P?n(P,{className:y.icon,nativeColor:"#fff"}):i(A,{fill:w===u.warning?"#000":"#fff",size:16,className:y.icon})})),t("div",s({className:y.message},{children:[t("div",s({className:y.messageTop},{children:[R&&i(p,s({"data-testid":"title",variant:"subtitle2",className:e(y.title,(I={},I[y.alertTitle]=k,I))},{children:R})),O&&i(p,s({className:e(y.timestamp,!k&&y[w])},{children:O}))]})),i("div",s({className:e(y.messageContent,!k&&y[w])},{children:i(p,s({"data-testid":"content",className:e(k?y.alertContent:y.content)},{children:F}))}))]}))]}))})),action:[i(d,s({"data-testid":"closeButton","aria-label":"Close",color:"inherit",onClick:function(){L(),C(z)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:y.tooltip}},className:y.closeIconButton},{children:i(b,{size:24,fill:k?"#000":"#fff"})}),"close")]},v))}))};export{g as Toast};
