Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/sections/assignments/select-assignment/ScriptedAssignment",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/link","liferay!frontend-js-react-web$react","../../../../../DiagramBuilderContext","../../../SidebarPanel"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=f(a("@frontend-taglib-clay$clayui/button")),r=a("@frontend-taglib-clay$clayui/form"),l=s(a("@frontend-taglib-clay$clayui/layout")),i=s(a("@frontend-taglib-clay$clayui/link")),o=f(a("liferay!frontend-js-react-web$react")),u=a("../../../../../DiagramBuilderContext"),c=s(a("../../../SidebarPanel"));function s(e){return e&&e.__esModule?e:{default:e}}function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}function g(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function y(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?g(Object(a),!0).forEach((function(t){p(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):g(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e=[{label:Liferay.Language.get("groovy"),value:"groovy"},{label:Liferay.Language.get("java"),value:"java"}];var b=({setContentName:t})=>{var a,s;const{selectedItem:d,setSelectedItem:f}=(0,o.useContext)(u.DiagramBuilderContext),[g,p]=(0,o.useState)(null==d||null===(a=d.data.assignments)||void 0===a?void 0:a.script),[b,m]=(0,o.useState)(null==d||null===(s=d.data.assignments)||void 0===s?void 0:s.scriptLanguage),v=Liferay.Language.get("add-source-code"),O=()=>t("scripted-assignment");return(0,o.useEffect)((()=>{var e;p(null==d||null===(e=d.data.assignments)||void 0===e?void 0:e.script)}),[d]),o.default.createElement(c.default,{panelTitle:Liferay.Language.get("script")},o.default.createElement("label",{htmlFor:"script-language"},Liferay.Language.get("script-language")),o.default.createElement(r.ClaySelect,{"aria-label":"Select",defaultValue:b,id:"script-language",onChange:({target:e})=>{m(e.value),f((t=>y(y({},t),{},{data:y(y({},t.data),{},{assignments:y(y({},t.data.assignments),{},{scriptLanguage:[e.value]})})})))}},e&&e.map((e=>o.default.createElement(r.ClaySelect.Option,{key:e.value,label:e.label,value:e.value})))),g?o.default.createElement(l.default.ContentCol,{className:"current-node-data-area",float:!0},o.default.createElement(l.default.Row,{className:"current-node-data-row",justify:"between"},o.default.createElement(i.default,{button:!1,className:"truncate-container",displayType:"secondary",href:"#",onClick:O},o.default.createElement("span",null,Liferay.Language.get("script"))),o.default.createElement(n.ClayButtonWithIcon,{className:"delete-button text-secondary trash-button",displayType:"unstyled",onClick:()=>{f((e=>y(y({},e),{},{data:y(y({},e.data),{},{assignments:null})})))},symbol:"trash"}))):o.default.createElement(n.default,{displayType:"secondary",onClick:O},v.toUpperCase()))};t.default=b}}));
//# sourceMappingURL=ScriptedAssignment.js.map