"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),a=require("prop-types"),s=require("@material-ui/core"),i=require("./icons/Critical.js"),r=require("./icons/Major.js"),n=require("./icons/Minor.js"),l=require("../../../Attachment/index.js"),c=require("../../../../utils/convert.js"),o=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=d(e),u=d(a);function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,s)}return a}function j(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach((function(t){m.default(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var v="LessonsLearnedFeedItem",h=s.makeStyles({item:{marginTop:"4px"},itemLabel:{fontWeight:"normal",fontSize:"14px",color:"#BDBDBD",marginRight:"8px"},itemValue:{fontSize:"14px",color:"#FFFFFF"},attachment:{paddingTop:10,width:300}});function x(e){var a,s=e.feedItem,d=h(),m=t.useMemo((function(){var e,t,a=(null===(e=s.context)||void 0===e||null===(t=e.lessons_learned)||void 0===t?void 0:t.data)||{};return j(j({},a),{},{md_start:c.convertValue(a.md_start,"length","ft"),tvd_start:c.convertValue(a.tvd_start,"length","ft")})}),[s]),u=null===(a=s.context)||void 0===a?void 0:a.lessons_learned.attachment,p=(null==u?void 0:u.signed_url)||(null==u?void 0:u.url),x=(null==u?void 0:u.file_name)||(null==u?void 0:u.name);return o.jsxs("div",{children:[o.jsx("div",{className:d.item,children:o.jsx("span",{"data-testid":"".concat(v,"_topic"),className:d.itemLabel,children:m.topic})}),o.jsxs("div",{className:d.item,children:[o.jsx("span",{className:d.itemLabel,children:"Event Cause:"}),o.jsx("span",{"data-testid":"".concat(v,"_Cause"),className:d.itemValue,children:m.cause})]}),o.jsxs("div",{className:d.item,style:{display:"flex",alignItems:"center"},children:[o.jsx("span",{className:d.itemLabel,children:"Event Severity:"}),o.jsx("span",{"data-testid":"".concat(v,"_severityIcon"),children:"Major"===m.severity?o.jsx(r,{}):"Critical"===m.severity?o.jsx(i,{}):"Minor"===m.severity?o.jsx(n,{}):null}),o.jsx("span",{"data-testid":"".concat(v,"_Severity"),className:d.itemValue,children:m.severity})]}),o.jsxs("div",{className:d.item,children:[o.jsx("span",{className:d.itemLabel,children:"MD/TVD:"}),o.jsxs("span",{"data-testid":"".concat(v,"_MD/TVD"),className:d.itemValue,children:[Number.isFinite(m.md_start)?m.md_start.fixFloat(2):"-","/",Number.isFinite(m.tvd_start)?m.tvd_start.fixFloat(2):"-"]})]}),o.jsxs("div",{className:d.item,children:[o.jsx("span",{className:d.itemLabel,children:"Hole Section:"}),o.jsx("span",{"data-testid":"".concat(v,"_HoleSection"),className:d.itemValue,children:m.section})]}),o.jsxs("div",{className:d.item,children:[o.jsx("span",{className:d.itemLabel,children:"Operation:"}),o.jsx("span",{"data-testid":"".concat(v,"_Operation"),className:d.itemValue,children:m.activity})]}),o.jsxs("div",{className:d.item,children:[o.jsx("span",{className:d.itemLabel,children:"Description:"}),o.jsx("div",{"data-testid":"".concat(v,"_Description"),className:d.itemValue,children:m.description})]}),u&&(p||x)&&o.jsx("div",{className:d.attachment,children:o.jsx(l,{small:!0,attachmentUrl:p,fileName:x,displayName:x})})]})}x.propTypes={feedItem:u.default.shape().isRequired};var f=t.memo(x);module.exports=f;
//# sourceMappingURL=index.js.map
