Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.83/designer/js/definition-builder/diagram-builder/components/sidebar/sections/timers/select-action/ActionTypeReassignment",["module","exports","require","liferay!frontend-js-react-web$react","../../../../../../util/fetchUtil","../select-reassignment/AssetCreator","../select-reassignment/ResourceActions","../select-reassignment/Role","../select-reassignment/RoleType","../select-reassignment/ScriptedReassignment","../select-reassignment/SelectReassignment","../select-reassignment/User"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=m();if(t&&t.has(e))return t.get(e);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=s?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(n,r,i):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),r=n("../../../../../../util/fetchUtil"),i=f(n("../select-reassignment/AssetCreator")),a=f(n("../select-reassignment/ResourceActions")),o=f(n("../select-reassignment/Role")),c=f(n("../select-reassignment/RoleType")),l=f(n("../select-reassignment/ScriptedReassignment")),u=n("../select-reassignment/SelectReassignment"),d=f(n("../select-reassignment/User"));function f(e){return e&&e.__esModule?e:{default:e}}function m(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return m=function(){return e},e}function g(e,t){if(null==e)return{};var n,s,r=function(e,t){if(null==e)return{};var n,s,r={},i=Object.keys(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const e={assetCreator:i.default,resourceActions:a.default,roleId:o.default,roleType:c.default,scriptedReassignment:l.default,user:d.default};var p=({actionData:t,actionSectionsIndex:n,identifier:i,sectionsLength:a,setActionSections:o,setContentName:c,setErrors:l})=>{var d;const f=t.assignmentType,[m,p]=(0,s.useState)((null==t||null===(d=t.users)||void 0===d?void 0:d.length)&&t.users.some((({emailAddress:e})=>e))?t.users:[{identifier:"".concat(Date.now(),"-0")}]);(0,s.useEffect)((()=>{"user"===f&&o((e=>{const t=[...e];return t[n].assignmentType="user",t[n].users=m,t}))}),[m]),(0,s.useEffect)((()=>{var e;if((null==t||null===(e=t.users)||void 0===e?void 0:e.length)&&t.users.some((({emailAddress:e})=>e))){const e=[];(0,r.retrieveUsersBy)("emailAddress",t.users.map((({emailAddress:e})=>e))).then((e=>e.json())).then((({items:t})=>{t.forEach(((t,n)=>{e.push({emailAddress:t.emailAddress,identifier:"".concat(Date.now(),"-").concat(n),name:t.name,screenName:t.alternateName,userId:t.id})}))})).then((()=>{p(e)}))}}),[]);const y=e[f];return s.default.createElement(s.default.Fragment,null,s.default.createElement(u.SelectReassignment,{currentAssignmentType:f,setSection:e=>{o((t=>{const s=[...t];return s[n].assignmentType=e,s}))},setSubSections:p}),m.map(((e,r)=>{let{identifier:u}=e,d=g(e,["identifier"]);return y&&s.default.createElement(y,{actionData:t,actionSectionsIndex:n,currentAssignmentType:f,identifier:i,index:r,key:"section-".concat(u),reassignmentType:f,restProps:d,sectionsLength:a,setActionSections:o,setContentName:c,setErrors:l,setSections:p,subSectionIdentifier:u,subSectionsLength:m.length})})))};t.default=p}}));
//# sourceMappingURL=ActionTypeReassignment.js.map