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