let self,store;class EventHandler{constructor(e){store=e,self=this}eventHandler(e){e.actionType&&store.workflow.update((t=>{let r=t.triggers;switch(e.actionType){case"add_recipe":r.push(e.trigger);break;case"add_trigger":r.push({});break;case"delete_trigger":r.splice(e.index,1);break;case"update_trigger":r[e.triggerIndex]=e.trigger;break;case"add_action":r[e.triggerIndex].actions.push({});break;case"delete_action":r[e.triggerIndex].actions.splice(e.index,1);break;case"update_action":r[e.triggerIndex].actions[e.actionIndex]=e.action;break;case"switch_action":r[e.triggerIndex].actions.splice(e.actionIndex,1,e.action);break;case"move_action":let t=e.actionIndex,i=e.direction;if(0==t&&"moveup"==i||t==r[e.triggerIndex].actions.length-1&&"movedown"==i)return;let a="moveup"==i?t-1:t+1,n=r[e.triggerIndex].actions[t];r[e.triggerIndex].actions.splice(t,1),r[e.triggerIndex].actions.splice(a,0,n)}return t.triggers=r,t}))}}export default EventHandler;