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 m,Tooltip as l,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 h,InfoIcon as C,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/Dashboard.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";import"../../icons/customIcons/icons/MoreApp.js";var k,N=((k={})[u.success]=j,k[u.warning]=I,k[u.error]=h,k[u.info]=C,k[u.neutral]=v,k),g=function(j){var I,h=j.onDismissClick,C=j.toast,v=o(j,["onDismissClick","toast"]),k=C.alertLevel,g=C.autoHideDuration,x=void 0===g?3e3:g,F=C.content,T=C.hideIcon,D=C.icon,P=C.id,z=C.onClick,A=void 0===z?r:z,B=C.onClose,E=void 0===B?r:B,L=C.timestamp,M=C.title,O=C.tooltipProps,R=C.variant,W=void 0===R?"info":R;c((function(){if(x!==1/0){var o=setTimeout((function(){return h(P)}),x);return function(){return clearTimeout(o)}}}),[]);var q=f(),w=N[W];return i(a,{appear:!0,in:!0,children:i(m,s({classes:{root:e(q.main,!k&&q[W],k&&q.alertNotification,k&&q["alertLevels-".concat(k)]),action:q.actionContainer,message:q.messageContainer},"aria-describedby":"client-snackbar","data-testid":"notificationPopup_".concat(u[W]),message:i(l,s({},O,{title:F,classes:{tooltip:q.tooltip},placement:"bottom",children:t("div",{id:"client-snackbar",className:q.messageWrapper,onClick:A,children:[!T&&i("div",{className:q.iconWrapper,children:D?n(D,{className:q.icon,nativeColor:"#fff"}):i(w,{fill:W===u.warning?"#000":"#fff",size:16,className:q.icon})}),t("div",{className:q.message,children:[t("div",{className:q.messageTop,children:[M&&i(p,{"data-testid":"title",variant:"subtitle2",className:e(q.title,(I={},I[q.alertTitle]=k,I)),children:M}),L&&i(p,{className:e(q.timestamp,!k&&q[W]),children:L})]}),i("div",{className:e(q.messageContent,!k&&q[W]),children:i(p,{"data-testid":"content",className:e(k?q.alertContent:q.content),children:F})})]})]})})),action:[i(d,{"data-testid":"closeButton","aria-label":"Close",color:"inherit",onClick:function(){E(),h(P)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:q.tooltip}},className:q.closeIconButton,children:i(b,{size:24,fill:k?"#000":"#fff"})},"close")]},v))})};export{g as Toast};
