Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/sections/actions/ActionsInfo",["module","exports","require","@frontend-taglib-clay$clayui/button","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../../../source-builder/constants","../../../../DiagramBuilderContext","../../SidebarPanel","../shared-components/BaseActionsInfo"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=p(n("@frontend-taglib-clay$clayui/button")),r=(c(n("liferay!frontend-js-react-web$prop-types")),p(n("liferay!frontend-js-react-web$react"))),i=n("../../../../../source-builder/constants"),o=n("../../../../DiagramBuilderContext"),l=c(n("../../SidebarPanel")),u=c(n("../shared-components/BaseActionsInfo"));function c(e){return e&&e.__esModule?e:{default:e}}function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function p(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=a?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(n,r,i):n[r]=e[r]}return n.default=e,t&&t.set(e,n),n}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const e=[{label:Liferay.Language.get("groovy"),value:"groovy"},{label:Liferay.Language.get("java"),value:"java"}];var g=({identifier:t,index:n,executionTypeInput:c=(()=>{}),sectionsLength:s,setSections:p})=>{var d,y,g,b,m,v,O;const{selectedItem:L,setSelectedItem:j}=(0,r.useContext)(o.DiagramBuilderContext),{actions:w}=L.data,[x,P]=(0,r.useState)((null==w||null===(d=w.script)||void 0===d?void 0:d[n])||""),[h,S]=(0,r.useState)((null==w||null===(y=w.description)||void 0===y?void 0:y[n])||""),[T,D]=(0,r.useState)([{label:Liferay.Language.get("on-entry"),value:"onEntry"},{label:Liferay.Language.get("on-exit"),value:"onExit"}]),[E,I]=(0,r.useState)((null==w||null===(g=w.scriptLanguage)||void 0===g?void 0:g[n])||i.DEFAULT_LANGUAGE);"task"===L.type&&T&&"onAssignment"!==T[0].value&&T.unshift({label:Liferay.Language.get("on-assignment"),value:"onAssignment"});const[k,A]=(0,r.useState)(null!==(b=null==w||null===(m=w.executionType)||void 0===m?void 0:m[n])&&void 0!==b?b:T[0].value),[$,C]=(0,r.useState)((null==w||null===(v=w.name)||void 0===v?void 0:v[n])||""),[N,_]=(0,r.useState)((null==w||null===(O=w.priority)||void 0===O?void 0:O[n])||1),B=e=>{j((t=>f(f({},t),{},{data:f(f({},t.data),{},{actions:{description:e.map((({description:e})=>e)),executionType:e.map((({executionType:e})=>e)),name:e.map((({name:e})=>e)),priority:e.map((({priority:e})=>e)),script:e.map((({script:e})=>e)),scriptLanguage:e.map((({scriptLanguage:e})=>e)),sectionsData:e.map((e=>e))}})})))};return r.default.createElement(l.default,{panelTitle:Liferay.Language.get("information")},r.default.createElement(u.default,{description:h,executionType:k,executionTypeInput:c,executionTypeOptions:T,index:n,name:$,placeholderName:Liferay.Language.get("my-action"),placeholderScript:"${userName} sent you a ${entryType} for review in the workflow.",priority:N,script:x,scriptLanguage:E,scriptLanguageOptions:e,selectedItem:L,setDescription:S,setExecutionType:A,setExecutionTypeOptions:D,setName:C,setPriority:_,setScript:P,setScriptLanguage:I,updateActionInfo:e=>{e.name&&e.script&&e.executionType&&p((t=>(t[n]=f(f({},t[n]),e),B(t),t)))}}),r.default.createElement("div",{className:"section-buttons-area"},r.default.createElement(a.default,{className:"mr-3",disabled:""===(null==w?void 0:w.name)||""===x,displayType:"secondary",onClick:()=>p((e=>[...e,{identifier:"".concat(Date.now(),"-").concat(e.length)}]))},Liferay.Language.get("new-action")),s>1&&r.default.createElement(a.ClayButtonWithIcon,{className:"delete-button",displayType:"unstyled",onClick:()=>{p((e=>{const n=e.filter((e=>e.identifier!==t));return B(n),n}))},symbol:"trash"})))};t.default=g}}));
//# sourceMappingURL=ActionsInfo.js.map