"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("classnames"),i=require("lodash"),a=require("@material-ui/core"),l=require("@material-ui/icons/DragIndicator"),s=require("../../../utils/index.js"),n=require("../../IconButton/index.js"),o=require("../RealTimeSidebarContext.js"),d=require("./RealTimeBoxStyles.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),m=u(l);var x=r.memo((function(t){var l,u=t.item,x=void 0===u?null:u,j=t.isDraggable,v=void 0===j||j,g=t.dragHandle,h=void 0===g?i.noop:g,p=t.itemSelected,q=void 0===p?null:p,f=d.useStyles(),B=r.useContext(o),D=B.handleOpenCloseDialog,y=B.handleChangeParamToEdit,N=x?x.unitTo||s.getUnitDisplay(x.unitType):null,T=x?{borderLeft:"2px solid ".concat(x.color)}:null;return x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:c.default(f.rtBox,(l={},l[f.rtBoxSelected]=!!q,l.notDraggable=!v,l)),"data-testid":"realtime_box",children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:f.rtBoxInner,style:T,onClick:function(){D(!0),y(x.key)},"data-testid":"".concat(x.name,"_edit_item"),children:[e.jsx("div",{className:f.rtBoxTitle,children:x.name}),e.jsxs("div",{className:f.rtBoxValue,children:[x.value," ",e.jsx("span",{children:N})]})]}),v&&h(e.jsx("div",{className:f.rtBoxButtonContainer,"data-testid":"realTimeValuesItemDrag",children:e.jsx(n,{tooltipProps:{title:"Drag to Reorder"},children:e.jsx(m.default,{className:f.dragIcon,color:"error"})})}))]})}),v&&e.jsx(a.Divider,{className:f.divider})]}):null}));module.exports=x;
