"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("react"),r=require("moment"),i=require("classnames"),a=require("@material-ui/core"),o=require("../../../../utils/index.js"),s=require("../../../Modal/Modal.js"),l=require("../../../PostInput/PostInput.js"),c=require("../../../IconButton/index.js"),u=require("../../../Typography.js"),p=require("../../../Icons/SendIcon.js"),d=require("../../../UserMention/utils/index.js"),m=require("../../../../constants/feed.js"),h=require("react/jsx-runtime");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=f(e),y=f(t),j=f(r),x=f(i);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){g.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var E=a.makeStyles((function(e){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},info:{marginTop:16},text:{color:e.palette.primary.text6},value:{color:"#fff"},inputMain:{marginBottom:0,fontSize:"11px",color:e.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:e.palette.primary.main},modalActions:{paddingTop:16},actions:{height:36},sendRow:{display:"flex"},sendIcon:{"&.Mui-disabled":{cursor:"not-allowed!important"}}}}));module.exports=function(e){var t=e.feedItem.context[m.FEED_ITEM_TYPES.TRACES_MEMO],r=t.body,i=t.attachment,f=t.bitDepth,b=t.holeDepth,O=t.timestamp,w=e.onClose,N=e.onSave,P=e.userCompanyId,C=E(),D=n.useRef(),T=n.useState({body:r,attachment:i}),I=y.default(T,2),M=I[0],q=I[1],S=function(){N({context:g.default({},m.FEED_ITEM_TYPES.TRACES_MEMO,v(v({},M),{},{bitDepth:f,holeDepth:b,timestamp:O}))})};return h.jsxs(s,{open:!0,onClose:w,title:"Edit Comment",contentClassName:C.modal,actionsClassName:C.modalActions,onClick:function(e){e.stopPropagation()},actions:h.jsxs(a.Grid,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:C.actions,children:[h.jsx(a.Grid,{item:!0,children:h.jsx(a.Typography,{variant:"caption",className:x.default(C.inputMain,C.cancelText,C.highlightedLabel),"data-testid":"".concat("EditComment","_cancel"),component:"div",gutterBottom:!0,onClick:w,children:"Cancel"})}),h.jsxs(a.Grid,{item:!0,direction:"row",alignItems:"center",className:C.sendRow,children:[h.jsxs(a.Typography,{variant:"caption",className:x.default(C.inputMain,C.inputHelper),component:"div",gutterBottom:!0,children:["Press ",h.jsx(a.Typography,{variant:"caption",color:"primary",className:x.default(C.inputMain,C.highlightedLabel),children:"Enter"})," to send"]}),h.jsx(c,{onClick:S,className:C.sendIcon,"data-testid":"".concat("EditComment","_send"),disabled:!M||!M.body&&!M.attachment,children:h.jsx(p,{})})]})]}),ref:D,children:[h.jsx(l,{initialValue:{body:r,attachment:i},userCompanyId:P,onChange:q,filePreviewWrapperClass:C.filePreviewWrapper,className:C.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||d.isSuggestionsListOpened()||(e.preventDefault(),S())},mentionStyle:m.MENTION_STYLE,suggestionsPortalHost:D.current,allowSuggestionsAboveCursor:!0}),h.jsxs("div",{className:C.info,children:[O&&h.jsxs(u.Regular14,{className:C.text,gutterBottom:!0,children:["Time:"," ",h.jsx("span",{className:C.value,children:j.default(O).format("MM/DD/YY, HH:mm")})," "]}),Number.isFinite(f)&&h.jsxs(u.Regular14,{className:C.text,gutterBottom:!0,children:["Bit Depth:"," ",h.jsx("span",{className:C.value,children:"".concat(f," ").concat(o.getUnitDisplay("length"))})]}),Number.isFinite(b)&&h.jsxs(u.Regular14,{className:C.text,gutterBottom:!0,children:["Hole Depth:"," ",h.jsx("span",{className:C.value,children:"".concat(b," ").concat(o.getUnitDisplay("length"))})]})]})]})};
//# sourceMappingURL=NptLessonsCommentEdit.js.map
