"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("react"),r=require("moment"),a=require("classnames"),i=require("@material-ui/core"),o=require("../../../../utils/index.js"),s=require("../../../Modal/Modal.js"),c=require("../../../PostInput/PostInput.js"),l=require("../../../IconButton/index.js"),d=require("../../../Typography.js"),u=require("../../../Icons/SendIcon.js"),p=require("../../../UserMention/utils/index.js"),m=require("../../../../constants/feed.js"),h=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=g(e),y=g(t),j=g(r),x=g(a);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){f.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 N=i.makeStyles((function(e){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},actionsAdornment:{flex:1},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,r=e.feedItem.context.dvd_comment,a=r.body,g=r.attachment,f=r.data,b=r.data,w=b.bitDepth,O=b.holeDepth,C=b.cost,P=b.timestamp,q=e.onClose,I=e.onSave,D=e.userCompanyId,S=N(),T=o.convertValue(+w,"length","ft"),B=o.convertValue(+O,"length","ft"),M=n.useRef(),E=n.useState({body:a,attachment:g}),R=y.default(E,2),H=R[0],k=R[1],L=function(){I({context:{dvd_comment:v(v({},H),{},{data:f})}})};return h.jsxs(s,{open:!0,onClose:q,title:"Edit Comment",contentClassName:S.modal,actionsClassName:S.modalActions,onClick:function(e){e.stopPropagation()},actions:h.jsxs(i.Grid,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:S.actions,children:[h.jsx(i.Grid,{item:!0,children:h.jsx(i.Typography,{variant:"caption",className:x.default(S.inputMain,S.cancelText,S.highlightedLabel),"data-testid":"".concat("EditComment","_cancel"),component:"div",gutterBottom:!0,onClick:q,children:"Cancel"})}),h.jsxs(i.Grid,{item:!0,direction:"row",alignItems:"center",className:S.sendRow,children:[h.jsxs(i.Typography,{variant:"caption",className:x.default(S.inputMain,S.inputHelper),component:"div",gutterBottom:!0,children:["Press ",h.jsx(i.Typography,{variant:"caption",color:"primary",className:x.default(S.inputMain,S.highlightedLabel),children:"Enter"})," to send"]}),h.jsx(l,{onClick:L,className:S.sendIcon,"data-testid":"".concat("EditComment","_send"),disabled:!H||!H.body&&!H.attachment,children:h.jsx(u,{})})]})]}),ref:M,children:[h.jsx(c,{initialValue:{body:a,attachment:g},userCompanyId:D,onChange:k,filePreviewWrapperClass:S.filePreviewWrapper,className:S.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||p.isSuggestionsListOpened()||(e.preventDefault(),L())},mentionStyle:m.MENTION_STYLE,suggestionsPortalHost:M.current,allowSuggestionsAboveCursor:!0}),h.jsxs("div",{className:S.info,children:[P&&h.jsxs(d.Regular14,{className:S.text,gutterBottom:!0,children:["Time:",h.jsx("span",{className:S.value,children:j.default(1e3*P).format("MM/DD/YY, HH:mm")})]}),Number.isFinite(C)&&h.jsxs(d.Regular14,{className:S.text,gutterBottom:!0,children:["Cost: ",h.jsxs("span",{className:S.value,children:[" ",(t=C,t.toString().replace(/\B(?=(\d{3})+(?!\d))/g," "))]}),h.jsx("span",{className:S.currency,children:"$"})]}),Number.isFinite(T)&&h.jsxs(d.Regular14,{className:S.text,gutterBottom:!0,children:["Bit Depth:",h.jsx("span",{className:S.value,children:"".concat(T," ").concat(o.getUnitDisplay("length"))})]}),Number.isFinite(B)&&h.jsxs(d.Regular14,{className:S.text,gutterBottom:!0,children:["Hole Depth:",h.jsx("span",{className:S.value,children:"".concat(B," ").concat(o.getUnitDisplay("length"))})]})]})]})};
