"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("classnames"),n=require("moment"),i=require("lodash"),r=require("@material-ui/core"),a=require("@material-ui/icons/ThumbUp"),s=require("@material-ui/icons/Comment"),o=require("../../../utils/nativeMessages.js"),u=require("../../../utils/mobileDetect.js"),l=require("../../CommentsInfo/index.js"),m=require("../../../utils/main.js"),c=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=d(e),f=d(t),x=d(n),g=d(a),C=d(s),h=r.makeStyles({reactionButton:{padding:8},reactions:{minHeight:48,marginTop:5,display:"flex",alignItems:"center",padding:"8px 16px 8px 24px",flexWrap:"wrap"},reactionsNative:{padding:"0 16px"},actions:{display:"flex",marginRight:30,alignItems:"center"}}),v=u.isNativeDetected?2:3;module.exports=function(e){var t=e.feedItem,n=e.currentUser,a=e.setOpenCommentInput,s=e.setOpenCommentList,d=e.openCommentInput,q=e.openCommentList,j=e.handleToggleLike,k=r.useTheme(),N=h(),y=t.likes_count,I=t.comments.length,B=(t.likes||[]).find((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===n.id})),b=(t.likes||[]).map((function(e){return m.getUserFullName(e.user)})),L=i.uniq((t.comments||[]).map((function(e){return m.getUserFullName(e.user)}))),F=i.uniqBy((t.comments||[]).concat(t.likes||[]).map((function(e){return e.user})).sort((function(e){return x.default(e.created_at).unix()})),"id").slice(0,v),U=!d||!q;return c.jsx("div",{className:f.default(N.reactions,p.default({},N.reactionsNative,u.isNativeDetected)),children:c.jsxs("div",{className:N.actions,children:[c.jsx(r.IconButton,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:j,className:N.reactionButton,children:c.jsx(g.default,{htmlColor:B?k.palette.primary.main:k.palette.grey[400]})}),c.jsx(r.IconButton,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){u.isNativeDetected?o.notifyOpenFeedCommentInput(t.id):(a(U),s(U))},className:N.reactionButton,children:c.jsx(C.default,{htmlColor:k.palette.grey[400]})}),c.jsx(l,{likesCount:y,usersWhoLike:b,commentsCount:I,usersWhoCommented:L,activeUsersList:F,onCommentsClick:function(){return s(!q)},small:!0})]})})};
