"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),n=require("moment"),a=require("classnames"),o=require("@material-ui/core"),i=require("../../../Modal/Modal.js"),s=require("../../../PostInput/PostInput.js"),l=require("../../../IconButton/index.js"),c=require("../../../Typography.js"),u=require("../../../Icons/SendIcon.js"),d=require("../../../UserMention/utils/index.js"),p=require("../../../../utils/convert.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(n),x=f(a);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){g.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var N=o.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",paddingLeft:4},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.hookload_broomstick_comment,n=t.body,a=t.attachment,f=t.data,g=t.data,b=g.timestamp,w=g.measuredDepth,O=g.activityLabel,P=g.hookload,q=e.onClose,I=e.onSave,C=e.userCompanyId,M=N(),k=p.convertValue(+w,"length","ft"),S=p.convertValue(+P,"force","klbf"),D=r.useRef(),T=r.useState({body:n,attachment:a}),L=y.default(T,2),B=L[0],R=L[1],E=function(){I({context:{hookload_broomstick_comment:v(v({},B),{},{data:f})}})};return h.jsxs(i,{open:!0,onClose:q,title:"Edit Comment",contentClassName:M.modal,actionsClassName:M.modalActions,onClick:function(e){e.stopPropagation()},actions:h.jsxs(o.Grid,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:M.actions,children:[h.jsx(o.Grid,{item:!0,children:h.jsx(o.Typography,{variant:"caption",className:x.default(M.inputMain,M.cancelText,M.highlightedLabel),component:"div",gutterBottom:!0,onClick:q,children:"Cancel"})}),h.jsxs(o.Grid,{item:!0,direction:"row",alignItems:"center",className:M.sendRow,children:[h.jsxs(o.Typography,{variant:"caption",className:x.default(M.inputMain,M.inputHelper),component:"div",gutterBottom:!0,children:["Press ",h.jsx(o.Typography,{variant:"caption",color:"primary",className:x.default(M.inputMain,M.highlightedLabel),children:"Enter"})," to send"]}),h.jsx(l,{onClick:E,className:M.sendIcon,disabled:!B||!B.body&&!B.attachment,children:h.jsx(u,{})})]})]}),ref:D,children:[h.jsx(s,{initialValue:{body:n,attachment:a},userCompanyId:C,onChange:R,filePreviewWrapperClass:M.filePreviewWrapper,className:M.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||d.isSuggestionsListOpened()||(e.preventDefault(),E())},mentionStyle:m.MENTION_STYLE,suggestionsPortalHost:D.current,allowSuggestionsAboveCursor:!0}),h.jsxs("div",{className:M.info,children:[Number.isFinite(w)&&h.jsxs(c.Regular14,{className:M.text,gutterBottom:!0,children:["Measured Depth:",h.jsx("span",{className:M.value,children:"".concat(Math.round(k).toLocaleString()," ").concat(p.getUnitDisplay("length"))})]}),P&&h.jsxs(c.Regular14,{className:M.text,gutterBottom:!0,children:["Hookload:",h.jsx("span",{className:M.value,children:"".concat(Math.round(S).toLocaleString()," ").concat(p.getUnitDisplay("force"))})]}),O&&h.jsxs(c.Regular14,{className:M.text,gutterBottom:!0,children:["Activity:",h.jsx("span",{className:M.value,children:O})]}),b&&h.jsxs(c.Regular14,{className:M.text,gutterBottom:!0,children:["Time:",h.jsx("span",{className:M.value,children:j.default.unix(b).format("MM/DD/YY HH:mm")})]})]})]})};
