Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/sections/timers/CurrentTimers",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/link","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../../../util/utils","../../../../DiagramBuilderContext"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r("@frontend-taglib-clay$clayui/button"),a=s(r("@frontend-taglib-clay$clayui/layout")),o=s(r("@frontend-taglib-clay$clayui/link")),i=(s(r("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"))),l=r("../../../../../util/utils"),c=r("../../../../DiagramBuilderContext");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function s(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=({setContentName:e,taskTimers:t})=>{const{setSelectedItem:r}=(0,i.useContext)(c.DiagramBuilderContext),[u,s]=(0,i.useState)([]);(0,i.useEffect)((()=>{const e=[];t.delay.forEach(((t,r)=>{e.push({duration:t.duration[0],durationScale:t.scale[0],identifier:"".concat(Date.now(),"-").concat(r),recurrence:t.duration[1],recurrenceScale:t.scale[1]})})),s(e)}),[]);const f=(e,t)=>"".concat((0,l.titleCase)(t),": ").concat(e[t]," ").concat(e[t+"Scale"]);return u.map(((t,l)=>i.default.createElement(a.default.ContentCol,{className:"current-node-data-area mb-3",float:!0,key:t.identifier},i.default.createElement(a.default.Row,{className:"current-node-data-row",justify:"between"},i.default.createElement(o.default,{button:!1,className:"truncate-container",displayType:"secondary",href:"#",onClick:()=>e("timers")},i.default.createElement("span",{key:l},f(t,"duration")),t.recurrence&&i.default.createElement("span",{key:l},i.default.createElement("br",null),f(t,"recurrence"))),i.default.createElement(n.ClayButtonWithIcon,{className:"delete-button text-secondary trash-button",displayType:"unstyled",onClick:()=>{return e=t.identifier,n=l,r((e=>{var t,r;if(1===(null===(t=e.data.taskTimers)||void 0===t||null===(r=t.delay)||void 0===r?void 0:r.length))return d(d({},e),{},{data:d(d({},e.data),{},{taskTimers:null})});const a={};for(const t of Object.entries(e.data.taskTimers))a[t[0]]=t[1].filter(((e,t)=>t!==n));return d(d({},e),{},{data:d(d({},e.data),{},{taskTimers:a})})})),void s((t=>t.filter((({identifier:t})=>t!==e))));var e,n},symbol:"trash"})))))};t.default=b}}));
//# sourceMappingURL=CurrentTimers.js.map