Liferay.Loader.define("change-tracking-web@2.0.87/publications/js/components/manage-collaborators-modal/CollaboratorRow",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/sticker","@frontend-taglib-clay$clayui/table","liferay!frontend-js-react-web$react"],(function(e,t,l){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=_interopRequireDefault(l("@frontend-taglib-clay$clayui/button")),r=_interopRequireWildcard(l("@frontend-taglib-clay$clayui/drop-down")),n=_interopRequireDefault(l("@frontend-taglib-clay$clayui/icon")),i=_interopRequireDefault(l("@frontend-taglib-clay$clayui/sticker")),o=_interopRequireDefault(l("@frontend-taglib-clay$clayui/table")),u=_interopRequireWildcard(l("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var l={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=a?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(l,r,n):l[r]=e[r]}return l.default=e,t&&t.set(e,l),l}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({handleSelect:e,readOnly:t,roles:l,selectedItems:c,spritemap:d,updatedRoles:s,user:f})=>{const[m,p]=(0,u.useState)(!1);let y=l[0],g=!1,b="";if(f.new)y=c[f.userId.toString()],b="table-add";else if(Object.prototype.hasOwnProperty.call(s,f.userId.toString()))g=!0,y=s[f.userId.toString()],-1===s[f.userId.toString()].value?b="table-delete":s[f.userId.toString()].value!==f.roleValue&&(b="table-active");else for(let e=0;e<l.length;e++)if(l[e].value===f.roleValue){y=l[e];break}const v=[];for(let t=0;t<l.length;t++)v.push({className:y.value!==l[t].value&&f.roleValue===l[t].value?"font-italic":"",description:l[t].shortDescription,label:l[t].label,onClick:()=>{p(!1),e(l[t])},symbolLeft:y.value===l[t].value?"check":""});v.push({type:"divider"},{label:Liferay.Language.get("remove"),onClick:()=>{p(!1),e({label:Liferay.Language.get("remove"),value:-1})},symbolLeft:-1===y.value?"check":""});let L=null;f.isOwner?L=Liferay.Language.get("owners-can-view,-edit,-publish,-and-invite-other-users"):y.longDescription&&(L=y.longDescription);let w=y.label;return f.isOwner?w=Liferay.Language.get("owner"):f.new?w=Liferay.Language.get("add")+" ("+w+")":g&&Object.prototype.hasOwnProperty.call(f,"roleValue")&&(w=w+" ("+f.roleLabel+")"),u.default.createElement(o.default.Row,{className:b,key:f.userId},u.default.createElement(o.default.Cell,null,u.default.createElement(i.default,{className:"sticker-user-icon ".concat(f.portraitURL?"":"user-icon-color-"+f.userId%10),size:"lg"},f.portraitURL?u.default.createElement("div",{className:"sticker-overlay"},u.default.createElement("img",{className:"sticker-img",src:f.portraitURL})):u.default.createElement(n.default,{symbol:"user"}))),u.default.createElement(o.default.Cell,{className:"table-cell-expand"},f.isCurrentUser?f.fullName+" ("+Liferay.Language.get("you")+")":f.fullName),u.default.createElement(o.default.Cell,{className:"table-cell-expand"},f.emailAddress),u.default.createElement(o.default.Cell,{className:"table-column-text-end"},t?u.default.createElement("div",{className:"role-read-only","data-tooltip-align":"top",title:L},w,u.default.createElement(n.default,{spritemap:d,symbol:"exclamation-circle"})):u.default.createElement(r.default,{active:m,alignmentPosition:r.Align.BottomLeft,hasLeftSymbols:!0,menuWidth:"sm",onActiveChange:p,spritemap:d,trigger:u.default.createElement(a.default,{borderless:!0,"data-tooltip-align":"top",disabled:f.isCurrent||f.isOwner,displayType:"secondary",small:!0,title:L},w,u.default.createElement("span",{className:"inline-item inline-item-after"},u.default.createElement(n.default,{spritemap:d,symbol:"caret-bottom"})))},u.default.createElement(r.default.ItemList,null,u.default.createElement(r.default.Group,null,v.map(((e,t)=>"divider"===e.type?u.default.createElement(r.default.Divider,{key:t}):u.default.createElement(r.default.Item,{className:e.className,key:t,onClick:e.onClick,symbolLeft:e.symbolLeft},u.default.createElement("strong",null,e.label),u.default.createElement("div",null,e.description)))))))))};t.default=_default}}));
//# sourceMappingURL=CollaboratorRow.js.map