Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/util/populateNotificationsData",["module","exports","require","portal-workflow-kaleo-designer-web$react-flow-renderer","../../util/fetchUtil"],(function(e,t,i){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i("portal-workflow-kaleo-designer-web$react-flow-renderer"),r=i("../../util/fetchUtil");var o=(e,t)=>{for(let i=0;i<e.length;i++){const o=e[i];if((0,a.isNode)(o)&&o.data.notifications){o.data.notifications.recipients.map(((a,o)=>{var n,s;if("roleId"===(null==a||null===(n=a.assignmentType)||void 0===n?void 0:n[0]))(0,r.retrieveRolesBy)("roleId",a.roleId).then((e=>e.json())).then((a=>{e[i].data.notifications.recipients[o].sectionsData={id:a.id,name:a.name,roleType:a.roleType},t([...e])}));else if("user"===(null==a||null===(s=a.assignmentType)||void 0===s?void 0:s[0])&&(a.emailAddress||a.screenName||a.userId)){const n=[];let s=Object.keys(a)[1];const l=Object.values(a)[1];"screenName"===s?s="alternateName":"userId"===s&&(s=s.toLocaleLowerCase().replace("user","")),(0,r.retrieveUsersBy)(s,l).then((e=>e.json())).then((({items:e})=>{e.forEach(((e,t)=>{n.push({emailAddress:e.emailAddress,identifier:"".concat(Date.now(),"-").concat(t),name:e.name,screenName:e.alternateName,userId:e.id})}))})).then((()=>{e[i].data.notifications.recipients[o].sectionsData=n,t([...e])}))}}))}}};t.default=o}));
//# sourceMappingURL=populateNotificationsData.js.map