lecom-modeler 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -1,8 +1,9 @@
1
- "use strict";var dp=Object.create;var bn=Object.defineProperty,up=Object.defineProperties,pp=Object.getOwnPropertyDescriptor,fp=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertyNames,ur=Object.getOwnPropertySymbols,gp=Object.getPrototypeOf,Gi=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable;var ks=(e,t,o)=>t in e?bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))Gi.call(t,o)&&ks(e,o,t[o]);if(ur)for(var o of ur(t))Rs.call(t,o)&&ks(e,o,t[o]);return e},v=(e,t)=>up(e,fp(t));var _t=(e,t)=>{var o={};for(var n in e)Gi.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&ur)for(var n of ur(e))t.indexOf(n)<0&&Rs.call(e,n)&&(o[n]=e[n]);return o};var hp=(e,t)=>{for(var o in t)bn(e,o,{get:t[o],enumerable:!0})},Ds=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of mp(t))!Gi.call(e,r)&&r!==o&&bn(e,r,{get:()=>t[r],enumerable:!(n=pp(t,r))||n.enumerable});return e};var yp=(e,t,o)=>(o=e!=null?dp(gp(e)):{},Ds(t||!e||!e.__esModule?bn(o,"default",{value:e,enumerable:!0}):o,e)),xp=e=>Ds(bn({},"__esModule",{value:!0}),e);var Xg={};hp(Xg,{EditorMode:()=>Fe,ElementPosition:()=>fr,ElementType:()=>_n,GatewayElementVariant:()=>mr,GatewayVariant:()=>lt,Modeler:()=>sp,ModelerProvider:()=>op,NodeAttribute:()=>ft,NodeType:()=>ee,NodeVariant:()=>at,RoutingVariant:()=>gr,useModeler:()=>Jo});module.exports=xp(Xg);var Bi=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};var pr=require("@produto-lecom/lecom-ui");var Os={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",start_event_limit_reached:"Start event can only connect to a single element",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",concurrent_initial_and_final_activity:"An activity cannot be connected to both start and end events",duplicate_connection_not_allowed:"A connection already exists between these elements",connect_node:"Connect element",connecting:"Connecting...",delete_pool_lane_error:"Cannot delete the pool or lane while there are elements inside it."},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{label:"Minimap",open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess",loop:"Activity with loop"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"},feedback:{label_empty:{prefix:"Activity name was automatically set to"},label_already_exists:{prefix:"The name",middle:"already exists. The name was changed to"},invalid_first_character:"Activity name must start with a letter or number"}},lane:{variant:{default:"Pool / Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var Vs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",start_event_limit_reached:"Evento inicial solo puede conectarse a un \xFAnico elemento",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",concurrent_initial_and_final_activity:"Una actividad no puede estar conectada al evento inicial y final al mismo tiempo",duplicate_connection_not_allowed:"Ya existe una conexi\xF3n entre estos elementos",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"No se puede eliminar la piscina o carril mientras haya elementos dentro."},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso",loop:"Actividad con loop"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"},feedback:{label_empty:{prefix:"El nombre de la actividad se estableci\xF3 autom\xE1ticamente como"},label_already_exists:{prefix:"El nombre",middle:"ya existe. El nombre fue cambiado a"},invalid_first_character:"El nombre de la actividad debe comenzar con una letra o n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var Hs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",start_event_limit_reached:"Evento inicial s\xF3 pode se conectar a um \xFAnico elemento",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",concurrent_initial_and_final_activity:"Uma atividade n\xE3o pode estar conectada ao evento inicial e final ao mesmo tempo",duplicate_connection_not_allowed:"J\xE1 existe uma conex\xE3o entre esses elementos",start_event_to_subprocess_not_allowed:"Evento inicial n\xE3o pode se conectar a um subprocesso",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"N\xE3o \xE9 poss\xEDvel excluir a piscina ou raia enquanto houver elementos dentro dela."},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso",loop:"Atividade com loop"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de Atividade"},variant:{default:"Atividade",script:"Atividade de script",subprocess:"Subprocesso"},attribute:{loop:"Atividade com loop"},label:{prefix:"Atividade"},feedback:{label_empty:{prefix:"O nome da atividade foi definido automaticamente como"},label_already_exists:{prefix:"O nome",middle:"j\xE1 existe. O nome foi alterado para"},invalid_first_character:"O nome da atividade deve come\xE7ar com uma letra ou n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var Gs={pt_BR:Hs,en_US:Os,es_ES:Vs};var Bs,zs,Ep=(zs=(Bs=Bi("LecomUserLanguage"))!=null?Bs:Bi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?zs:pr.Translations.PT_BR;(0,pr.initializeI18n)({lng:Ep,resources:Gs});var Fe=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Fe||{});var _n=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(_n||{}),fr=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(fr||{}),mr=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(mr||{}),gr=(d=>(d.SIMPLE="simple",d.LOOP="loop",d.SCRIPT="script",d.SCRIPT_LOOP="script_loop",d.COMPLEX="complex",d.EXCLUSIVE="exclusive",d.PARALLEL="parallel",d.FINAL="final",d.TO_SUB_PROCESS="to_sub_process",d.FROM_SUB_PROCESS="from_sub_process",d))(gr||{});var Wo=require("lucide-react");var co=require("react/jsx-runtime"),hr=({size:e=24,className:t})=>(0,co.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,co.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,co.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,co.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,co.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var zi=require("react/jsx-runtime"),Do=({size:e=24,className:t})=>(0,zi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,zi.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Wt=require("react/jsx-runtime"),Oo=({size:e=24,className:t})=>(0,Wt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Wt.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Vo=require("react/jsx-runtime"),Ho=({size:e=24,className:t})=>(0,Vo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Vo.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Vo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Vo.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Go=require("react/jsx-runtime"),Bo=({size:e=24,className:t})=>(0,Go.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Go.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Go.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Go.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var zo=require("react/jsx-runtime"),Fs=({size:e=24,className:t})=>(0,zo.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,zo.jsxs)("g",{children:[(0,zo.jsx)("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),(0,zo.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Ws=require("clsx"),Ys=require("tailwind-merge");function R(...e){return(0,Ys.twMerge)((0,Ws.clsx)(e))}var Yt=(e=0,t=0)=>e<t?t:e,yr=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Tn=require("react/jsx-runtime"),Us=({size:e=24,className:t})=>(0,Tn.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:R("stroke-2",t),children:[(0,Tn.jsx)("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Tn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var xr=require("react/jsx-runtime"),$s=({size:e=24,className:t})=>(0,xr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,xr.jsx)("g",{children:(0,xr.jsx)("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});var Fi=require("react/jsx-runtime"),Er=({size:e=24,className:t})=>(0,Fi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#5fd9b0",stroke:"#1cad86",strokeWidth:"2",className:t,children:(0,Fi.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Wi=require("react/jsx-runtime"),Nn=({size:e=24,className:t})=>(0,Wi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:R("stroke-2",t),children:(0,Wi.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Fo=require("react/jsx-runtime"),Xs=({size:e=24,className:t})=>(0,Fo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Fo.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Fo.jsx)("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Fo.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ut=require("react/jsx-runtime"),Ks=({size:e=24,className:t})=>(0,Ut.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Ut.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var uo=require("react/jsx-runtime"),qs=({size:e=24,className:t})=>(0,uo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,uo.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,uo.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,uo.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,uo.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var ee=(a=>(a.START_EVENT="START_EVENT",a.END_EVENT="END_EVENT",a.TASK="TASK",a.LANE="LANE",a.GATEWAY="GATEWAY",a.ANNOTATION="ANNOTATION",a.UNSUPPORTED="UNSUPPORTED",a))(ee||{}),at=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(at||{}),br={SCRIPT:{icon:Wo.ScrollText},SUBPROCESS:{icon:Wo.SquarePlus}},ft=(t=>(t.LOOP="LOOP",t))(ft||{}),_r={LOOP:{icon:Wo.RotateCcw}},lt=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(lt||{}),Yi={EXCLUSIVE:{icon:Ho},PARALLEL:{icon:Bo},COMPLEX:{icon:Oo}};var np=require("@xyflow/react"),Ce=require("react");var Rt=require("@xyflow/react"),Oi=require("react");var _u=require("@produto-lecom/lecom-ui"),Lt=require("@xyflow/react"),xt=require("react");var Yo=require("@xyflow/react");function Zs(e,t){var h,x,_,N;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,s=o/2,a=n/2,l=r.x+s,c=r.y+a,d=i.x+((x=(h=t==null?void 0:t.measured)==null?void 0:h.width)!=null?x:0)/2,u=i.y+((N=(_=t==null?void 0:t.measured)==null?void 0:_.height)!=null?N:0)/2,p=(d-l)/(2*s)-(u-c)/(2*a),f=(d-l)/(2*s)+(u-c)/(2*a),y=1/(Math.abs(p)+Math.abs(f)||1),g=y*p,m=y*f,b=s*(g+m)+l,T=a*(-g+m)+c;return{x:b,y:T}}function Js(e,t){var c,d,u,p;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(p=(u=e.measured)==null?void 0:u.height)!=null?p:0,i=Math.round(o.x),s=Math.round(o.y),a=Math.round(t.x),l=Math.round(t.y);return a<=i+1?Yo.Position.Left:a>=i+n-1?Yo.Position.Right:l<=s+1?Yo.Position.Top:l>=s+r-1?Yo.Position.Bottom:Yo.Position.Top}function Uo(e,t){let o=Zs(e,t),n=Zs(t,e),r=Js(e,o),i=Js(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function Tr(e,t){return{isFromStartEvent:(e==null?void 0:e.type)==="START_EVENT",isGatewayToGateway:(e==null?void 0:e.type)==="GATEWAY"&&(t==null?void 0:t.type)==="GATEWAY",isActiviyToAndGateway:(e==null?void 0:e.type)==="TASK"&&(t==null?void 0:t.type)==="GATEWAY"}}var Qs=require("zustand"),js=require("@xyflow/react"),ea=require("react");var Nr=()=>{let{setEdges:e}=(0,js.useReactFlow)();return(0,ea.useCallback)(()=>{let o=po.getState().pathEdgeIds;e(n=>n.map(r=>v(E({},r),{selected:o.includes(r.id)})))},[e])},po=(0,Qs.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=E({},n.statusByNodeId),i=E({},n.statusData),s=!1;return o.forEach(a=>{let l=`${a.diagramId}-${a.activityId}`;r[a.diagramId]!==a.status&&(r[a.diagramId]=a.status,i[l]=a,s=!0)}),s?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],s={};o.forEach(d=>{s[d.source]||(s[d.source]=[]),s[d.source].push({targetId:d.target,edgeId:d.id})});let a=r[0],l=r[r.length-1];o.forEach(d=>{d.target===a&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let p=[],f=new Set;for(p.push({node:d,path:[]}),f.add(d);p.length>0;){let{node:y,path:g}=p.shift();if(y===u)return g;let m=s[y]||[];for(let{targetId:b,edgeId:T}of m)f.has(b)||(f.add(b),p.push({node:b,path:[...g,T]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],p=r[d+1],f=c(u,p);f.length>0&&i.push(...f)}i.length>0&&e({pathEdgeIds:i})}}));var Zo=require("@xyflow/react"),je=require("react"),Kl=require("zustand/shallow");var bp={value:()=>{}};function oa(){for(var e=0,t=arguments.length,o={},n;e<t;++e){if(!(n=arguments[e]+"")||n in o||/[\s.]/.test(n))throw new Error("illegal type: "+n);o[n]=[]}return new vr(o)}function vr(e){this._=e}function _p(e,t){return e.trim().split(/^|\s+/).map(function(o){var n="",r=o.indexOf(".");if(r>=0&&(n=o.slice(r+1),o=o.slice(0,r)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:n}})}vr.prototype=oa.prototype={constructor:vr,on:function(e,t){var o=this._,n=_p(e+"",o),r,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((r=(e=n[i]).type)&&(r=Tp(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=n[i]).type)o[r]=ta(o[r],e.name,t);else if(t==null)for(r in o)o[r]=ta(o[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new vr(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var o=new Array(r),n=0,r,i;n<r;++n)o[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,r=i.length;n<r;++n)i[n].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],r=0,i=n.length;r<i;++r)n[r].value.apply(t,o)}};function Tp(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function ta(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=bp,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ui=oa;var wr="http://www.w3.org/1999/xhtml",$i={svg:"http://www.w3.org/2000/svg",xhtml:wr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Dt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),$i.hasOwnProperty(t)?{space:$i[t],local:e}:e}function Np(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===wr&&t.documentElement.namespaceURI===wr?t.createElement(e):t.createElementNS(o,e)}}function vp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ar(e){var t=Dt(e);return(t.local?vp:Np)(t)}function wp(){}function fo(e){return e==null?wp:function(){return this.querySelector(e)}}function na(e){typeof e!="function"&&(e=fo(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new Oe(n,this._parents)}function Xi(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ap(){return[]}function vn(e){return e==null?Ap:function(){return this.querySelectorAll(e)}}function Ip(e){return function(){return Xi(e.apply(this,arguments))}}function ra(e){typeof e=="function"?e=Ip(e):e=vn(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),r.push(l));return new Oe(n,r)}function wn(e){return function(){return this.matches(e)}}function Ir(e){return function(t){return t.matches(e)}}var Cp=Array.prototype.find;function Sp(e){return function(){return Cp.call(this.children,e)}}function Mp(){return this.firstElementChild}function ia(e){return this.select(e==null?Mp:Sp(typeof e=="function"?e:Ir(e)))}var Pp=Array.prototype.filter;function Lp(){return Array.from(this.children)}function kp(e){return function(){return Pp.call(this.children,e)}}function sa(e){return this.selectAll(e==null?Lp:kp(typeof e=="function"?e:Ir(e)))}function aa(e){typeof e!="function"&&(e=wn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Oe(n,this._parents)}function Cr(e){return new Array(e.length)}function la(){return new Oe(this._enter||this._groups.map(Cr),this._parents)}function An(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}An.prototype={constructor:An,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ca(e){return function(){return e}}function Rp(e,t,o,n,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],n[s]=a):o[s]=new An(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Dp(e,t,o,n,r,i,s){var a,l,c=new Map,d=t.length,u=i.length,p=new Array(d),f;for(a=0;a<d;++a)(l=t[a])&&(p[a]=f=s.call(l,l.__data__,a,t)+"",c.has(f)?r[a]=l:c.set(f,l));for(a=0;a<u;++a)f=s.call(e,i[a],a,i)+"",(l=c.get(f))?(n[a]=l,l.__data__=i[a],c.delete(f)):o[a]=new An(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(p[a])===l&&(r[a]=l)}function Op(e){return e.__data__}function da(e,t){if(!arguments.length)return Array.from(this,Op);var o=t?Dp:Rp,n=this._parents,r=this._groups;typeof e!="function"&&(e=ca(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],p=u.length,f=Vp(e.call(d,d&&d.__data__,c,n)),y=f.length,g=a[c]=new Array(y),m=s[c]=new Array(y),b=l[c]=new Array(p);o(d,u,g,m,b,f,t);for(var T=0,h=0,x,_;T<y;++T)if(x=g[T]){for(T>=h&&(h=T+1);!(_=m[h])&&++h<y;);x._next=_||null}}return s=new Oe(s,n),s._enter=a,s._exit=l,s}function Vp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ua(){return new Oe(this._exit||this._groups.map(Cr),this._parents)}function pa(e,t,o){var n=this.enter(),r=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),o==null?i.remove():o(i),n&&r?n.merge(r).order():r}function fa(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=o[l],d=n[l],u=c.length,p=a[l]=new Array(u),f,y=0;y<u;++y)(f=c[y]||d[y])&&(p[y]=f);for(;l<r;++l)a[l]=o[l];return new Oe(a,this._parents)}function ma(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],s;--r>=0;)(s=n[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ga(e){e||(e=Hp);function t(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,n=o.length,r=new Array(n),i=0;i<n;++i){for(var s=o[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new Oe(r,this._parents).order()}function Hp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ha(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ya(){return Array.from(this)}function xa(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length;r<i;++r){var s=n[r];if(s)return s}return null}function Ea(){let e=0;for(let t of this)++e;return e}function ba(){return!this.node()}function _a(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Gp(e){return function(){this.removeAttribute(e)}}function Bp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zp(e,t){return function(){this.setAttribute(e,t)}}function Fp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Wp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Yp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Ta(e,t){var o=Dt(e);if(arguments.length<2){var n=this.node();return o.local?n.getAttributeNS(o.space,o.local):n.getAttribute(o)}return this.each((t==null?o.local?Bp:Gp:typeof t=="function"?o.local?Yp:Wp:o.local?Fp:zp)(o,t))}function Sr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Up(e){return function(){this.style.removeProperty(e)}}function $p(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Xp(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Na(e,t,o){return arguments.length>1?this.each((t==null?Up:typeof t=="function"?Xp:$p)(e,t,o==null?"":o)):$t(this.node(),e)}function $t(e,t){return e.style.getPropertyValue(t)||Sr(e).getComputedStyle(e,null).getPropertyValue(t)}function Kp(e){return function(){delete this[e]}}function qp(e,t){return function(){this[e]=t}}function Zp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function va(e,t){return arguments.length>1?this.each((t==null?Kp:typeof t=="function"?Zp:qp)(e,t)):this.node()[e]}function wa(e){return e.trim().split(/^|\s+/)}function Ki(e){return e.classList||new Aa(e)}function Aa(e){this._node=e,this._names=wa(e.getAttribute("class")||"")}Aa.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ia(e,t){for(var o=Ki(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Ca(e,t){for(var o=Ki(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function Jp(e){return function(){Ia(this,e)}}function Qp(e){return function(){Ca(this,e)}}function jp(e,t){return function(){(t.apply(this,arguments)?Ia:Ca)(this,e)}}function Sa(e,t){var o=wa(e+"");if(arguments.length<2){for(var n=Ki(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?jp:t?Jp:Qp)(o,t))}function ef(){this.textContent=""}function tf(e){return function(){this.textContent=e}}function of(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ma(e){return arguments.length?this.each(e==null?ef:(typeof e=="function"?of:tf)(e)):this.node().textContent}function nf(){this.innerHTML=""}function rf(e){return function(){this.innerHTML=e}}function sf(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Pa(e){return arguments.length?this.each(e==null?nf:(typeof e=="function"?sf:rf)(e)):this.node().innerHTML}function af(){this.nextSibling&&this.parentNode.appendChild(this)}function La(){return this.each(af)}function lf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ka(){return this.each(lf)}function Ra(e){var t=typeof e=="function"?e:Ar(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cf(){return null}function Da(e,t){var o=typeof e=="function"?e:Ar(e),n=t==null?cf:typeof t=="function"?t:fo(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function df(){var e=this.parentNode;e&&e.removeChild(this)}function Oa(){return this.each(df)}function uf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pf(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Va(e){return this.select(e?pf:uf)}function Ha(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ff(e){return function(t){e.call(this,t,this.__data__)}}function mf(e){return e.trim().split(/^|\s+/).map(function(t){var o="",n=t.indexOf(".");return n>=0&&(o=t.slice(n+1),t=t.slice(0,n)),{type:t,name:o}})}function gf(e){return function(){var t=this.__on;if(t){for(var o=0,n=-1,r=t.length,i;o<r;++o)i=t[o],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function hf(e,t,o){return function(){var n=this.__on,r,i=ff(t);if(n){for(var s=0,a=n.length;s<a;++s)if((r=n[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=o),r.value=t;return}}this.addEventListener(e.type,i,o),r={type:e.type,name:e.name,value:t,listener:i,options:o},n?n.push(r):this.__on=[r]}}function Ga(e,t,o){var n=mf(e+""),r,i=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=n[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?hf:gf,r=0;r<i;++r)this.each(a(n[r],t,o));return this}function Ba(e,t,o){var n=Sr(e),r=n.CustomEvent;typeof r=="function"?r=new r(t,o):(r=n.document.createEvent("Event"),o?(r.initEvent(t,o.bubbles,o.cancelable),r.detail=o.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function yf(e,t){return function(){return Ba(this,e,t)}}function xf(e,t){return function(){return Ba(this,e,t.apply(this,arguments))}}function za(e,t){return this.each((typeof t=="function"?xf:yf)(e,t))}function*Fa(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,s;r<i;++r)(s=n[r])&&(yield s)}var Ef=[null];function Oe(e,t){this._groups=e,this._parents=t}function Wa(){return new Oe([[document.documentElement]],Ef)}function bf(){return this}Oe.prototype=Wa.prototype={constructor:Oe,select:na,selectAll:ra,selectChild:ia,selectChildren:sa,filter:aa,data:da,enter:la,exit:ua,join:pa,merge:fa,selection:bf,order:ma,sort:ga,call:ha,nodes:ya,node:xa,size:Ea,empty:ba,each:_a,attr:Ta,style:Na,property:va,classed:Sa,text:Ma,html:Pa,raise:La,lower:ka,append:Ra,insert:Da,remove:Oa,clone:Va,datum:Ha,on:Ga,dispatch:za,[Symbol.iterator]:Fa};var Ot=Wa;function Mr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function qi(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Sn(){}var In=.7,kr=1/In,$o="\\s*([+-]?\\d+)\\s*",Cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_f=/^#([0-9a-f]{3,8})$/,Tf=new RegExp(`^rgb\\(${$o},${$o},${$o}\\)$`),Nf=new RegExp(`^rgb\\(${Tt},${Tt},${Tt}\\)$`),vf=new RegExp(`^rgba\\(${$o},${$o},${$o},${Cn}\\)$`),wf=new RegExp(`^rgba\\(${Tt},${Tt},${Tt},${Cn}\\)$`),Af=new RegExp(`^hsl\\(${Cn},${Tt},${Tt}\\)$`),If=new RegExp(`^hsla\\(${Cn},${Tt},${Tt},${Cn}\\)$`),Ya={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Mr(Sn,Xt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ua,formatHex:Ua,formatHex8:Cf,formatHsl:Sf,formatRgb:$a,toString:$a});function Ua(){return this.rgb().formatHex()}function Cf(){return this.rgb().formatHex8()}function Sf(){return Qa(this).formatHsl()}function $a(){return this.rgb().formatRgb()}function Xt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=_f.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Xa(t):o===3?new Ue(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Pr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Pr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Tf.exec(e))?new Ue(t[1],t[2],t[3],1):(t=Nf.exec(e))?new Ue(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vf.exec(e))?Pr(t[1],t[2],t[3],t[4]):(t=wf.exec(e))?Pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Af.exec(e))?Za(t[1],t[2]/100,t[3]/100,1):(t=If.exec(e))?Za(t[1],t[2]/100,t[3]/100,t[4]):Ya.hasOwnProperty(e)?Xa(Ya[e]):e==="transparent"?new Ue(NaN,NaN,NaN,0):null}function Xa(e){return new Ue(e>>16&255,e>>8&255,e&255,1)}function Pr(e,t,o,n){return n<=0&&(e=t=o=NaN),new Ue(e,t,o,n)}function Mf(e){return e instanceof Sn||(e=Xt(e)),e?(e=e.rgb(),new Ue(e.r,e.g,e.b,e.opacity)):new Ue}function Xo(e,t,o,n){return arguments.length===1?Mf(e):new Ue(e,t,o,n==null?1:n)}function Ue(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Mr(Ue,Xo,qi(Sn,{brighter(e){return e=e==null?kr:Math.pow(kr,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ue(go(this.r),go(this.g),go(this.b),Rr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ka,formatHex:Ka,formatHex8:Pf,formatRgb:qa,toString:qa}));function Ka(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}`}function Pf(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}${mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function qa(){let e=Rr(this.opacity);return`${e===1?"rgb(":"rgba("}${go(this.r)}, ${go(this.g)}, ${go(this.b)}${e===1?")":`, ${e})`}`}function Rr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function go(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mo(e){return e=go(e),(e<16?"0":"")+e.toString(16)}function Za(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new mt(e,t,o,n)}function Qa(e){if(e instanceof mt)return new mt(e.h,e.s,e.l,e.opacity);if(e instanceof Sn||(e=Xt(e)),!e)return new mt;if(e instanceof mt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,n=e.b/255,r=Math.min(t,o,n),i=Math.max(t,o,n),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(o-n)/a+(o<n)*6:o===i?s=(n-t)/a+2:s=(t-o)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new mt(s,a,l,e.opacity)}function ja(e,t,o,n){return arguments.length===1?Qa(e):new mt(e,t,o,n==null?1:n)}function mt(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Mr(mt,ja,qi(Sn,{brighter(e){return e=e==null?kr:Math.pow(kr,e),new mt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new mt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,n=o+(o<.5?o:1-o)*t,r=2*o-n;return new Ue(Zi(e>=240?e-240:e+120,r,n),Zi(e,r,n),Zi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new mt(Ja(this.h),Lr(this.s),Lr(this.l),Rr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Rr(this.opacity);return`${e===1?"hsl(":"hsla("}${Ja(this.h)}, ${Lr(this.s)*100}%, ${Lr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ja(e){return e=(e||0)%360,e<0?e+360:e}function Lr(e){return Math.max(0,Math.min(1,e||0))}function Zi(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}function Ji(e,t,o,n,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*o+(1+3*e+3*i-3*s)*n+s*r)/6}function el(e){var t=e.length-1;return function(o){var n=o<=0?o=0:o>=1?(o=1,t-1):Math.floor(o*t),r=e[n],i=e[n+1],s=n>0?e[n-1]:2*r-i,a=n<t-1?e[n+2]:2*i-r;return Ji((o-n/t)*t,s,r,i,a)}}function tl(e){var t=e.length;return function(o){var n=Math.floor(((o%=1)<0?++o:o)*t),r=e[(n+t-1)%t],i=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return Ji((o-n/t)*t,r,i,s,a)}}var Qi=e=>()=>e;function Lf(e,t){return function(o){return e+o*t}}function kf(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(n){return Math.pow(e+n*t,o)}}function ol(e){return(e=+e)==1?Dr:function(t,o){return o-t?kf(t,o,e):Qi(isNaN(t)?o:t)}}function Dr(e,t){var o=t-e;return o?Lf(e,o):Qi(isNaN(e)?t:e)}var Or=function e(t){var o=ol(t);function n(r,i){var s=o((r=Xo(r)).r,(i=Xo(i)).r),a=o(r.g,i.g),l=o(r.b,i.b),c=Dr(r.opacity,i.opacity);return function(d){return r.r=s(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function nl(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),s,a;for(s=0;s<o;++s)a=Xo(t[s]),n[s]=a.r||0,r[s]=a.g||0,i[s]=a.b||0;return n=e(n),r=e(r),i=e(i),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=i(l),a+""}}}var Rf=nl(el),Df=nl(tl);function ct(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var es=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ji=new RegExp(es.source,"g");function Of(e){return function(){return e}}function Vf(e){return function(t){return e(t)+""}}function ts(e,t){var o=es.lastIndex=ji.lastIndex=0,n,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(n=es.exec(e))&&(r=ji.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:ct(n,r)})),o=ji.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Vf(l[0].x):Of(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)a[(u=l[d]).i]=u.x(c);return a.join("")})}var rl=180/Math.PI,Vr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function os(e,t,o,n,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(a=Math.sqrt(o*o+n*n))&&(o/=a,n/=a,l/=a),e*n<t*o&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*rl,skewX:Math.atan(l)*rl,scaleX:s,scaleY:a}}var Hr;function il(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Vr:os(t.a,t.b,t.c,t.d,t.e,t.f)}function sl(e){return e==null?Vr:(Hr||(Hr=document.createElementNS("http://www.w3.org/2000/svg","g")),Hr.setAttribute("transform",e),(e=Hr.transform.baseVal.consolidate())?(e=e.matrix,os(e.a,e.b,e.c,e.d,e.e,e.f)):Vr)}function al(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,p,f,y){if(c!==u||d!==p){var g=f.push("translate(",null,t,null,o);y.push({i:g-4,x:ct(c,u)},{i:g-2,x:ct(d,p)})}else(u||p)&&f.push("translate("+u+t+p+o)}function s(c,d,u,p){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),p.push({i:u.push(r(u)+"rotate(",null,n)-2,x:ct(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function a(c,d,u,p){c!==d?p.push({i:u.push(r(u)+"skewX(",null,n)-2,x:ct(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,p,f,y){if(c!==u||d!==p){var g=f.push(r(f)+"scale(",null,",",null,")");y.push({i:g-4,x:ct(c,u)},{i:g-2,x:ct(d,p)})}else(u!==1||p!==1)&&f.push(r(f)+"scale("+u+","+p+")")}return function(c,d){var u=[],p=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,p),s(c.rotate,d.rotate,u,p),a(c.skewX,d.skewX,u,p),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,p),c=d=null,function(f){for(var y=-1,g=p.length,m;++y<g;)u[(m=p[y]).i]=m.x(f);return u.join("")}}}var ns=al(il,"px, ","px)","deg)"),rs=al(sl,", ",")",")");var Ko=0,Pn=0,Mn=0,cl=1e3,Gr,Ln,Br=0,ho=0,zr=0,kn=typeof performance=="object"&&performance.now?performance:Date,dl=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Dn(){return ho||(dl(Hf),ho=kn.now()+zr)}function Hf(){ho=0}function Rn(){this._call=this._time=this._next=null}Rn.prototype=Fr.prototype={constructor:Rn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Dn():+o)+(t==null?0:+t),!this._next&&Ln!==this&&(Ln?Ln._next=this:Gr=this,Ln=this),this._call=e,this._time=o,is()},stop:function(){this._call&&(this._call=null,this._time=1/0,is())}};function Fr(e,t,o){var n=new Rn;return n.restart(e,t,o),n}function ul(){Dn(),++Ko;for(var e=Gr,t;e;)(t=ho-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ko}function ll(){ho=(Br=kn.now())+zr,Ko=Pn=0;try{ul()}finally{Ko=0,Bf(),ho=0}}function Gf(){var e=kn.now(),t=e-Br;t>cl&&(zr-=t,Br=e)}function Bf(){for(var e,t=Gr,o,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Gr=o);Ln=e,is(n)}function is(e){if(!Ko){Pn&&(Pn=clearTimeout(Pn));var t=e-ho;t>24?(e<1/0&&(Pn=setTimeout(ll,e-kn.now()-zr)),Mn&&(Mn=clearInterval(Mn))):(Mn||(Br=kn.now(),Mn=setInterval(Gf,cl)),Ko=1,dl(ll))}}function Wr(e,t,o){var n=new Rn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var zf=Ui("start","end","cancel","interrupt"),Ff=[],ml=0,pl=1,Ur=2,Yr=3,fl=4,$r=5,On=6;function Kt(e,t,o,n,r,i){var s=e.__transition;if(!s)e.__transition={};else if(o in s)return;Wf(e,o,{name:t,index:n,group:r,on:zf,tween:Ff,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ml})}function Vn(e,t){var o=Ve(e,t);if(o.state>ml)throw new Error("too late; already scheduled");return o}function Ge(e,t){var o=Ve(e,t);if(o.state>Yr)throw new Error("too late; already running");return o}function Ve(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Wf(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Fr(i,0,o.time);function i(c){o.state=pl,o.timer.restart(s,o.delay,o.time),o.delay<=c&&s(c-o.delay)}function s(c){var d,u,p,f;if(o.state!==pl)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===Yr)return Wr(s);f.state===fl?(f.state=On,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=On,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(Wr(function(){o.state===Yr&&(o.state=fl,o.timer.restart(a,o.delay,o.time),a(c))}),o.state=Ur,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ur){for(o.state=Yr,r=new Array(p=o.tween.length),d=0,u=-1;d<p;++d)(f=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=f);r.length=u+1}}function a(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=$r,1),u=-1,p=r.length;++u<p;)r[u].call(e,d);o.state===$r&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=On,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function ss(e,t){var o=e.__transition,n,r,i=!0,s;if(o){t=t==null?null:t+"";for(s in o){if((n=o[s]).name!==t){i=!1;continue}r=n.state>Ur&&n.state<$r,n.state=On,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[s]}i&&delete e.__transition}}function gl(e){return this.each(function(){ss(this,e)})}function Yf(e,t){var o,n;return function(){var r=Ge(this,e),i=r.tween;if(i!==o){n=o=i;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}r.tween=n}}function Uf(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=Ge(this,e),s=i.tween;if(s!==n){r=(n=s).slice();for(var a={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function hl(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=Ve(this.node(),o).tween,r=0,i=n.length,s;r<i;++r)if((s=n[r]).name===e)return s.value;return null}return this.each((t==null?Yf:Uf)(o,e,t))}function qo(e,t,o){var n=e._id;return e.each(function(){var r=Ge(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return Ve(r,n).value[t]}}function Xr(e,t){var o;return(typeof t=="number"?ct:t instanceof Xt?Or:(o=Xt(t))?(t=o,Or):ts)(e,t)}function $f(e){return function(){this.removeAttribute(e)}}function Xf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===n?i:i=t(n=s,o)}}function qf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===n?i:i=t(n=s,o)}}function Zf(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function Jf(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function yl(e,t){var o=Dt(e),n=o==="transform"?rs:Xr;return this.attrTween(e,typeof t=="function"?(o.local?Jf:Zf)(o,n,qo(this,"attr."+e,t)):t==null?(o.local?Xf:$f)(o):(o.local?qf:Kf)(o,n,t))}function Qf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function jf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function em(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&jf(e,i)),o}return r._value=t,r}function tm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&Qf(e,i)),o}return r._value=t,r}function xl(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var n=Dt(e);return this.tween(o,(n.local?em:tm)(n,t))}function om(e,t){return function(){Vn(this,e).delay=+t.apply(this,arguments)}}function nm(e,t){return t=+t,function(){Vn(this,e).delay=t}}function El(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?om:nm)(t,e)):Ve(this.node(),t).delay}function rm(e,t){return function(){Ge(this,e).duration=+t.apply(this,arguments)}}function im(e,t){return t=+t,function(){Ge(this,e).duration=t}}function bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rm:im)(t,e)):Ve(this.node(),t).duration}function sm(e,t){if(typeof t!="function")throw new Error;return function(){Ge(this,e).ease=t}}function _l(e){var t=this._id;return arguments.length?this.each(sm(t,e)):Ve(this.node(),t).ease}function am(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Ge(this,e).ease=o}}function Tl(e){if(typeof e!="function")throw new Error;return this.each(am(this._id,e))}function Nl(e){typeof e!="function"&&(e=wn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new We(n,this._parents,this._name,this._id)}function vl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),s=new Array(n),a=0;a<i;++a)for(var l=t[a],c=o[a],d=l.length,u=s[a]=new Array(d),p,f=0;f<d;++f)(p=l[f]||c[f])&&(u[f]=p);for(;a<n;++a)s[a]=t[a];return new We(s,this._parents,this._name,this._id)}function lm(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function cm(e,t,o){var n,r,i=lm(t)?Vn:Ge;return function(){var s=i(this,e),a=s.on;a!==n&&(r=(n=a).copy()).on(t,o),s.on=r}}function wl(e,t){var o=this._id;return arguments.length<2?Ve(this.node(),o).on.on(e):this.each(cm(o,e,t))}function dm(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Al(){return this.on("end.remove",dm(this._id))}function Il(e){var t=this._name,o=this._id;typeof e!="function"&&(e=fo(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],l=a.length,c=i[s]=new Array(l),d,u,p=0;p<l;++p)(d=a[p])&&(u=e.call(d,d.__data__,p,a))&&("__data__"in d&&(u.__data__=d.__data__),c[p]=u,Kt(c[p],t,o,p,c,Ve(d,o)));return new We(i,this._parents,t,o)}function Cl(e){var t=this._name,o=this._id;typeof e!="function"&&(e=vn(e));for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var l=n[a],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var p=e.call(d,d.__data__,u,l),f,y=Ve(d,o),g=0,m=p.length;g<m;++g)(f=p[g])&&Kt(f,t,o,g,p,y);i.push(p),s.push(d)}return new We(i,s,t,o)}var um=Ot.prototype.constructor;function Sl(){return new um(this._groups,this._parents)}function pm(e,t){var o,n,r;return function(){var i=$t(this,e),s=(this.style.removeProperty(e),$t(this,e));return i===s?null:i===o&&s===n?r:r=t(o=i,n=s)}}function Ml(e){return function(){this.style.removeProperty(e)}}function fm(e,t,o){var n,r=o+"",i;return function(){var s=$t(this,e);return s===r?null:s===n?i:i=t(n=s,o)}}function mm(e,t,o){var n,r,i;return function(){var s=$t(this,e),a=o(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),$t(this,e))),s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a))}}function gm(e,t){var o,n,r,i="style."+t,s="end."+i,a;return function(){var l=Ge(this,e),c=l.on,d=l.value[i]==null?a||(a=Ml(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(s,r=d),l.on=n}}function Pl(e,t,o){var n=(e+="")=="transform"?ns:Xr;return t==null?this.styleTween(e,pm(e,n)).on("end.style."+e,Ml(e)):typeof t=="function"?this.styleTween(e,mm(e,n,qo(this,"style."+e,t))).each(gm(this._id,e)):this.styleTween(e,fm(e,n,t),o).on("end.style."+e,null)}function hm(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function ym(e,t,o){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&hm(e,s,o)),n}return i._value=t,i}function Ll(e,t,o){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,ym(e,t,o==null?"":o))}function xm(e){return function(){this.textContent=e}}function Em(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function kl(e){return this.tween("text",typeof e=="function"?Em(qo(this,"text",e)):xm(e==null?"":e+""))}function bm(e){return function(t){this.textContent=e.call(this,t)}}function _m(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&bm(r)),t}return n._value=e,n}function Rl(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,_m(e))}function Dl(){for(var e=this._name,t=this._id,o=Kr(),n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=Ve(l,t);Kt(l,e,o,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new We(n,this._parents,e,o)}function Ol(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};o.each(function(){var c=Ge(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Tm=0;function We(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Vl(e){return Ot().transition(e)}function Kr(){return++Tm}var Vt=Ot.prototype;We.prototype=Vl.prototype={constructor:We,select:Il,selectAll:Cl,selectChild:Vt.selectChild,selectChildren:Vt.selectChildren,filter:Nl,merge:vl,selection:Sl,transition:Dl,call:Vt.call,nodes:Vt.nodes,node:Vt.node,size:Vt.size,empty:Vt.empty,each:Vt.each,on:wl,attr:yl,attrTween:xl,style:Pl,styleTween:Ll,text:kl,textTween:Rl,remove:Al,tween:hl,delay:El,duration:bl,ease:_l,easeVarying:Tl,end:Ol,[Symbol.iterator]:Vt[Symbol.iterator]};function qr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Nm={time:null,delay:0,duration:250,ease:qr};function vm(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Hl(e){var t,o;e instanceof We?(t=e._id,e=e._name):(t=Kr(),(o=Nm).time=Dn(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Kt(l,e,t,c,s,o||vm(l,t));return new We(n,this._parents,e,t)}Ot.prototype.interrupt=gl;Ot.prototype.transition=Hl;function qt(e,t,o){this.k=e,this.x=t,this.y=o}qt.prototype={constructor:qt,scale:function(e){return e===1?this:new qt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Zr=new qt(1,0,0);Jr.prototype=qt.prototype;function Jr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Zr;return e.__zoom}var Am=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Gl;(function(e){e.Strict="strict",e.Loose="loose"})(Gl||(Gl={}));var Bl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Bl||(Bl={}));var zl;(function(e){e.Partial="partial",e.Full="full"})(zl||(zl={}));var Fl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Fl||(Fl={}));var Wl;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wl||(Wl={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));var nb={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top};var Im=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Cm=(e,t=[0,0])=>{var a;let{width:o,height:n}=Sm(e),r=(a=e.origin)!=null?a:t,i=o*r[0],s=n*r[1];return{x:e.position.x-i,y:e.position.y-s}};var Ht=(e,t=[0,0])=>{var r,i,s,a,l,c,d,u;let{x:o,y:n}=Im(e)?e.internals.positionAbsolute:Cm(e,t);return{x:o,y:n,x2:o+((a=(s=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?s:e.initialWidth)!=null?a:0),y2:n+((u=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?u:0)}};function Sm(e){var t,o,n,r,i,s,a,l;return{width:(r=(n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:e.initialWidth)!=null?r:0,height:(l=(a=(s=(i=e.measured)==null?void 0:i.height)!=null?s:e.height)!=null?a:e.initialHeight)!=null?l:0}}var rb={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};var Mm={nodeOrigin:[0,0],nodeExtent:Am,elevateNodesOnSelect:!0,defaults:{}},ib=v(E({},Mm),{checkEquality:!0});var Yl;(function(e){e.Line="line",e.Handle="handle"})(Yl||(Yl={}));var Pm={width:0,height:0,x:0,y:0},sb=v(E({},Pm),{pointerX:0,pointerY:0,aspectRatio:1});var Lm=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function km(e,t){let o=Math.max(0,Math.min(e.x2,t.x2)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y2,t.y2)-Math.max(e.y,t.y));return o*n}function Rm(e,t){let o=Math.max(0,Math.max(e.x-t.x2,t.x-e.x2)),n=Math.max(0,Math.max(e.y-t.y2,t.y-e.y2));return Math.sqrt(o*o+n*n)}var Qr=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r,i){let s=t==="horizontal"?this.yLines:this.xLines,[a,l]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],c=[];for(let f of s){if(f.position<a)continue;if(f.position>l)break;if(i.has(f.node.id)||f.node.parentId&&i.has(f.node.parentId)||!Lm(f.nodeBox,r))continue;let y=Math.abs(f.position-o);if(y>jr)continue;let m=km(f.nodeBox,n)>0?0:Rm(f.nodeBox,n);c.push({line:f,lineDist:y,nodeDist:m})}let d=.5,u=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;c.sort((f,y)=>{if(u){if(f.line===u&&y.line!==u)return-1;if(y.line===u&&f.line!==u)return 1}return Math.abs(f.lineDist-y.lineDist)<=d?f.nodeDist-y.nodeDist:f.lineDist-y.lineDist});let p=c.length>0?c[0].line:void 0;return p&&(t==="horizontal"?this.lastHorizontalLine=p:this.lastVerticalLine=p),p}};function Ul(e,t=yo,o){let n=[];return e==null||e.forEach(r=>{let i=o(r.id);if(!i)throw new Error(`Node with id ${r.id} not found in internal nodes.`);let s=Ht(i);Object.entries(t).forEach(([a,l])=>{var c;n.push({position:l.resolve(r,s),color:(c=r.style)==null?void 0:c.backgroundColor,orientation:l.orientation,anchorName:a,nodeBox:s,node:r})})}),n}function $l(e,t,o,n,r=Object.keys(yo)){let i=[];for(let a of r){let l=yo[a],c=l.resolve(null,o),d=e.search(l.orientation,c,o,t,n);d&&i.push({sourcePosition:c,anchorName:a,anchor:l,line:d})}let s={horizontal:void 0,vertical:void 0};for(let a of i){let l=s[a.anchor.orientation],c=Math.abs(a.sourcePosition-a.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(s[a.anchor.orientation]=a)}return s}function Xl(e,t,o){let n=0,r=0,i=!1,s=!1;if(t){let l=t.anchor.resolve(null,e)-t.line.position;Math.abs(l)<=jr&&(r=l,s=!0)}if(o){let l=o.anchor.resolve(null,e)-o.line.position;Math.abs(l)<=jr&&(n=l,i=!0)}return{deltaX:n,deltaY:r,snappedX:i,snappedY:s}}var jr=10,yo={top:{orientation:"horizontal",resolve:(e,t)=>t.y},bottom:{orientation:"horizontal",resolve:(e,t)=>t.y2},left:{orientation:"vertical",resolve:(e,t)=>t.x},right:{orientation:"vertical",resolve:(e,t)=>t.x2},centerX:{orientation:"vertical",resolve:(e,t)=>(t.x+t.x2)/2},centerY:{orientation:"horizontal",resolve:(e,t)=>(t.y+t.y2)/2}};var ql=require("react/jsx-runtime"),Dm=new Qr;function ei(){let[e,t]=(0,je.useState)(void 0),[o,n]=(0,je.useState)(void 0),{width:r,height:i}=(0,Zo.useStore)(m=>({width:m.width,height:m.height}),Kl.shallow),s=(0,Zo.useNodesInitialized)(),a=(0,je.useRef)(Dm),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,Zo.useReactFlow)(),u=(0,je.useCallback)(()=>{t(void 0),n(void 0)},[]),p=(0,je.useCallback)(m=>{let b=m!=null?m:d();u();let T=Ul(b,yo,c);a.current.initialize(T)},[c,u,d]),f=(0,je.useCallback)(()=>{setTimeout(()=>{p()},100)},[p]);(0,je.useEffect)(()=>{s&&p(d())},[s,p,d]);let y=(0,je.useCallback)((m,b)=>{var D,G,Y,F,oe,B,X,J,U,K;if(!a.current||m.length===0)return m;u();let T=m.filter($=>$.type==="position"&&!!$.position),h=m.find($=>$.type==="dimensions");if(T.length===0&&!h)return m;let x=Object.keys(yo),_=new Set,N=1/0,A=1/0,I=-1/0,M=-1/0;if(T.length>0)T.forEach($=>{var Me,xe,ce,ie,He,Qe;let Z=b.find(Ft=>Ft.id===$.id);if(!Z)return;_.add(Z.id);let j=c(Z.id);if(!j)return;let le=j.parentId?c(j.parentId):void 0,fe=$.position.x+((Me=le==null?void 0:le.internals.positionAbsolute.x)!=null?Me:0),re=$.position.y+((xe=le==null?void 0:le.internals.positionAbsolute.y)!=null?xe:0),_e=(ie=(ce=Z.measured)==null?void 0:ce.width)!=null?ie:0,Se=(Qe=(He=Z.measured)==null?void 0:He.height)!=null?Qe:0;N=Math.min(N,fe),A=Math.min(A,re),I=Math.max(I,fe+_e),M=Math.max(M,re+Se)}),h&&(x=["top","left"]);else if(h){let $=b.find(_e=>_e.id===h.id);if(!$)return m;_.add($.id);let Z=c($.id);if(!Z)return m;let j=Z.internals.positionAbsolute.x,le=Z.internals.positionAbsolute.y,fe=(F=(Y=(D=h.dimensions)==null?void 0:D.width)!=null?Y:(G=$.measured)==null?void 0:G.width)!=null?F:0,re=(J=(X=(oe=h.dimensions)==null?void 0:oe.height)!=null?X:(B=$.measured)==null?void 0:B.height)!=null?J:0;N=j,A=le,I=j+fe,M=le+re,x=["right","bottom"]}if(N===1/0)return m;let H={x:N,y:A,x2:I,y2:M},{x:S,y:w}=l({x:0,y:0}),{x:k,y:V}=l({x:r,y:i}),P={x:S,y:w,x2:k,y2:V},{horizontal:L,vertical:W}=$l(a.current,P,H,_,x),{deltaX:Q,deltaY:z,snappedX:C,snappedY:O}=Xl(H,L,W);if(C||O){let $=T.some(j=>j.dragging),Z=!!(h!=null&&h.resizing);($||Z)&&(C&&n(W==null?void 0:W.line),O&&t(L==null?void 0:L.line)),C&&(T.forEach(j=>{j.position&&(j.position.x-=Q)}),(h==null?void 0:h.id)===((U=T[0])==null?void 0:U.id)?h.dimensions&&(h.dimensions.width+=Q):h&&!T.length&&h.dimensions&&(h.dimensions.width-=Q)),O&&(T.forEach(j=>{j.position&&(j.position.y-=z)}),(h==null?void 0:h.id)===((K=T[0])==null?void 0:K.id)?h.dimensions&&(h.dimensions.height+=z):h&&!T.length&&h.dimensions&&(h.dimensions.height-=z))}return m},[l,c,r,i,t,n,u]),g=(0,je.useCallback)(()=>(0,ql.jsx)(Zl,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:p,forceRebuildIndex:f,updateHelperLines:y,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var Ci=require("@xyflow/react"),Mt=require("react");var Zt=e=>new Map(e.map(t=>[t.id,t])),Hn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),Jl=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),as=e=>e.some(t=>t.type==="START_EVENT"),Jt=(e,t)=>e==="START_EVENT"?!as(t):!0,Ql=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e);if(!s||s.type!=="START_EVENT")return!1;let a=i.get(t);return(a==null?void 0:a.type)==="ANNOTATION"?!1:Hn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},jl=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(t);if(!s||s.type!=="END_EVENT")return!1;let a=i.get(e);return(a==null?void 0:a.type)==="ANNOTATION"?!1:Jl(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},ti=(e,t,o,n,r)=>{var c;let i=Zt(o),s=i.get(e);if(!s||s.type!=="GATEWAY"||((c=s.data)==null?void 0:c.variant)!=="EXCLUSIVE")return!1;let a=t?i.get(t):null;return(a==null?void 0:a.type)==="ANNOTATION"?!1:Hn(e,n,r).filter(d=>{let u=i.get(d.target);return(u==null?void 0:u.type)!=="ANNOTATION"}).length>=2},ec=(e,t,o)=>{var s,a,l,c;let n=Zt(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((s=r==null?void 0:r.data)==null?void 0:s.variant)==="EXCLUSIVE"&&((a=i==null?void 0:i.data)==null?void 0:a.variant)==="PARALLEL"||((l=r==null?void 0:r.data)==null?void 0:l.variant)==="COMPLEX"&&((c=i==null?void 0:i.data)==null?void 0:c.variant)==="PARALLEL"},oi=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SCRIPT"},tc=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SUBPROCESS"},ni=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.attribute)==="LOOP"},Gn=(e,t,o,n)=>{let r=Zt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Jl(e,o,n).some(a=>{let l=r.get(a.source);return(l==null?void 0:l.type)==="START_EVENT"})},Bn=(e,t,o,n)=>{let r=Zt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Hn(e,o,n).some(a=>{let l=r.get(a.target);return(l==null?void 0:l.type)==="END_EVENT"})},oc=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e),a=i.get(t);return(s==null?void 0:s.type)==="START_EVENT"&&(a==null?void 0:a.type)==="TASK"?Bn(t,o,n,r):(a==null?void 0:a.type)==="END_EVENT"&&(s==null?void 0:s.type)==="TASK"?Gn(e,o,n,r):!1},ri=(e,t,o)=>Hn(e,t,o).length>0,ii=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e);if(!s||s.type!=="TASK")return!1;let a=t?i.get(t):null;return(a==null?void 0:a.type)==="ANNOTATION"?!1:Hn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var nc=(e,t,o,n)=>o.some(r=>n&&r.id===n?!1:r.source===e&&r.target===t);var Om=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!nc(e.sourceNodeId,e.targetNodeId,e.edges,e.reconnectingEdgeId),reason:"duplicate_connection_not_allowed"}),e=>({isValid:!Ql(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!jl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!ti(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!ii(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:ec(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&tc(e.targetNodeId,e.nodes)),reason:"start_event_to_subprocess_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(oi(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(ni(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Gn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!oc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"concurrent_initial_and_final_activity"}),e=>({isValid:!(Bn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(ri(e.sourceNodeId,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:["START_EVENT","END_EVENT","TASK","GATEWAY","LANE"],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],ls=e=>{for(let t of Om){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Vm=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:ti(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"gateway_limit_reached"})},{sourceTypes:["START_EVENT"],validate:e=>({shouldDisable:e.edges.some(o=>{if(o.source!==e.sourceNodeId)return!1;let n=e.nodes.find(r=>r.id===o.target);return(n==null?void 0:n.type)!=="ANNOTATION"})&&e.targetNodeType!=="ANNOTATION",reason:"start_event_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:as(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:oi(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ni(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Gn(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Bn(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ri(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:ii(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],rc=e=>{let t=Vm.filter(o=>{let n=!o.sourceTypes||o.sourceTypes.includes(e.sourceNodeType),r=!o.targetTypes||o.targetTypes.includes(e.targetNodeType);return n&&r});for(let o of t){let n=o.validate(e);if(n.shouldDisable)return n}return{shouldDisable:!1}};var Gt=require("@xyflow/react");var Nt=require("@produto-lecom/lecom-ui"),sc=require("lucide-react");var dt=require("@xyflow/react");var ic=require("@xyflow/react"),Qt=()=>{let e=(0,ic.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:s,triggerNodeChanges:a}=e.getState(),l=i.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]),c=r.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]);return a(l),s(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await yr(),!0}}};var si=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,dt.useReactFlow)(),{selectElements:r}=Qt(),i=m=>{let b=o(),T=n(),h=(0,dt.getIncomers)(m,b,T),x=(0,dt.getOutgoers)(m,b,T),_=h.some(A=>A.type==="START_EVENT"),N=x.some(A=>A.type==="END_EVENT");return _?"start":N?"end":"between"},s=(m,b,T)=>{var _,N,A,I;if(!m)return;let h={type:m.type,variant:(_=m.data)==null?void 0:_.variant,attribute:(N=m.data)==null?void 0:N.attribute},x={id:m.id,position:i(m),label:(A=m.data)==null?void 0:A.label,node:h};return m.type==="TASK"&&((I=m.data)==null?void 0:I.variant)==="SUBPROCESS"?v(E({},x),{type:"sub_process"}):m.type==="GATEWAY"?v(E({},x),{type:"gateway",variant:a(m,b,T)}):v(E({},x),{type:"activity"})},a=(m,b,T)=>{if(m.type!=="GATEWAY")return;let h=(0,dt.getIncomers)(m,b,T),x=!1,_=!1;if(h.forEach(N=>{var A,I;N.type==="TASK"&&(((A=N.data)==null?void 0:A.variant)==="SCRIPT"&&(x=!0),((I=N.data)==null?void 0:I.attribute)==="LOOP"&&(_=!0))}),x&&_)return"script_loop";if(x)return"script";if(_)return"loop"},l=(m,b,T)=>{var A,I,M,H;let h=e(m.source),x=e(m.target);if(!h||!x)return"simple";if((0,dt.getOutgoers)(h,b,T).some(S=>S.type==="END_EVENT"))return"final";if(h.type==="GATEWAY")switch((A=h.data)==null?void 0:A.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(h.type==="TASK"){let S=(I=h.data)==null?void 0:I.variant,w=(M=h.data)==null?void 0:M.attribute;if(S==="SUBPROCESS")return"from_sub_process";if(x.type==="TASK"&&((H=x.data)==null?void 0:H.variant)==="SUBPROCESS")return"to_sub_process";let k=S==="SCRIPT",V=w==="LOOP";return k&&V?"script_loop":k?"script":V?"loop":"simple"}return"simple"},c=(m,b,T)=>{let h=[];function x(N,A,I=0){let M=s(N,b,T);if(M.depth=I,A.push(M),N.type==="TASK"){h.push([...A]),A.pop();return}let H=(0,dt.getIncomers)(N,b,T);if(H.length)for(let S of H)x(S,A,I+1);A.pop()}let _=(0,dt.getIncomers)(m,b,T);for(let N of _)x(N,[]);return h},d=(m,b,T)=>{let h=[];function x(N,A,I=0){let M=s(N,b,T);if(M.depth=I,A.push(M),N.type==="TASK"){h.push([...A]),A.pop();return}let H=(0,dt.getOutgoers)(N,b,T);if(H.length)for(let S of H)x(S,A,I+1);A.pop()}let _=(0,dt.getOutgoers)(m,b,T);for(let N of _)x(N,[]);return h},u=(m,b,T)=>(T=T.filter(x=>x.source===m.id),T.map(x=>{var A;let _=e(x.target),N;return _&&(N=s(_,b,T)),{id:x.id,type:"routing",variant:l(x,b,T),label:(A=x.data)==null?void 0:A.label,target:N}})),p=m=>{let b=e(m);if(!b)return;let T=o(),h=n(),x=s(b,T,h);return x.sources=c(b,T,h),x.targets=d(b,T,h),x.edgeTargets=u(b,T,h),b.type==="GATEWAY"&&(x.variant=a(b,T,h)),x},f=m=>{let b=t(m);if(!b)return;let T=o(),h=n(),x=l(b,T,h),N={id:b.id,type:"routing",variant:x,gatewayVariant:void 0},A=e(b.source);if(A){let M=s(A,T,h);N.source=M;let H=a(A,T,h);if(N.gatewayVariant=H,A.type==="TASK")N.sources=[[M]];else{let S=c(A,T,h);N.sources=S.length?S:[[M]]}}let I=e(b.target);if(I){let M=s(I,T,h);if(N.target=M,I.type==="TASK")N.targets=[[M]];else{let H=d(I,T,h);N.targets=H.length?H:[[M]]}}return N},y=m=>{let b=e(m);if(b)return p(b.id);let T=t(m);if(T)return f(T.id)};return{configureElement:m=>{let b=y(m);if(b)return r([m]),b},getConfigureElement:y,getNodeConfigure:p,getEdgeConfigure:f}};var xo=require("react/jsx-runtime"),jt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Nt.useTranslation)(),{onConfigureElement:n}=q(),{getConfigureElement:r}=si();return(0,xo.jsxs)(Nt.Tooltip,{children:[(0,xo.jsx)(Nt.TooltipTrigger,{asChild:!0,children:(0,xo.jsx)(Nt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let s=r(e);s&&(n==null||n(s))},children:(0,xo.jsx)(sc.Settings,{size:16})})}),(0,xo.jsx)(Nt.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var vt=require("@produto-lecom/lecom-ui"),lc=require("@xyflow/react"),cc=require("lucide-react");var ac=require("@produto-lecom/lecom-ui");function Xe(){let{toast:e}=Jo(),{toast:t}=(0,ac.useNotificationToast)();return{toast:e||t}}var Eo=require("react/jsx-runtime"),ai=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,vt.useTranslation)(),{toast:n}=Xe(),{deleteElements:r,getNodes:i}=(0,lc.useReactFlow)();return(0,Eo.jsxs)(vt.Tooltip,{children:[(0,Eo.jsx)(vt.TooltipTrigger,{asChild:!0,children:(0,Eo.jsx)(vt.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{if(t==="node"){let a=i(),l=a.find(c=>c.id===e);if((l==null?void 0:l.type)==="LANE"&&a.some(d=>d.parentId===e)){n({variant:"error",title:o("validation.errors.title"),content:o("editor.toolbar.delete_pool_lane_error")});return}r({nodes:[{id:e}]})}else r({edges:[{id:e}]})},children:(0,Eo.jsx)(cc.TrashIcon,{size:16})})}),(0,Eo.jsx)(vt.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var wt=require("@produto-lecom/lecom-ui"),dc=require("lucide-react"),uc=require("react"),bo=require("react/jsx-runtime"),_o=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,wt.useTranslation)(),r=(0,uc.useCallback)(i=>{i.stopPropagation();let s=document.querySelectorAll(`.react-flow__handle.source[data-nodeid="${e}"]`);if(s.length===0)return;let a=Array.from(s).reduce((p,f)=>{let y=p.getBoundingClientRect(),g=f.getBoundingClientRect(),m=Math.hypot(i.clientX-(y.left+y.width/2),i.clientY-(y.top+y.height/2));return Math.hypot(i.clientX-(g.left+g.width/2),i.clientY-(g.top+g.height/2))<m?f:p}),l=a.getBoundingClientRect(),c=l.left+l.width/2,d=l.top+l.height/2,u=new MouseEvent("mousedown",{clientX:c,clientY:d,bubbles:!0,cancelable:!0});a.dispatchEvent(u)},[e]);return(0,bo.jsxs)(wt.Tooltip,{children:[(0,bo.jsx)(wt.TooltipTrigger,{asChild:!0,children:(0,bo.jsx)(wt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:t,className:t?"opacity-50 cursor-not-allowed":"",onMouseDown:t?void 0:r,children:(0,bo.jsx)(dc.MoveUpRightIcon,{size:16})})}),(0,bo.jsx)(wt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var Qo=require("react/jsx-runtime"),en=i=>{var s=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=s,r=_t(s,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:a}=q(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d}=Tr(o,n),u=!l&&!c&&!d,p=[{component:(0,Qo.jsx)(ai,{elementId:e,elementType:"edge"})}],f=()=>a==="view"?u?[{component:(0,Qo.jsx)(jt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,Qo.jsx)(jt,{elementId:e,elementType:"edge"})},...p]:p,g=(m=>{switch(m){case"SEQUENCE_EDGE":return f();case"MESSAGE_EDGE":return a==="view"?[]:[...p];case"ANNOTATION_EDGE":return a==="view"?[]:[...p];default:return[]}})(t);if(!(g.length===0||a==="view"))return(0,Qo.jsx)("div",v(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:g.map((m,b)=>(0,Qo.jsx)("div",{children:m.component},b))}))};var pc=require("@xyflow/react"),fc=require("react");var cs=require("react/jsx-runtime"),At=12,tn=({sx:e,sy:t,tx:o,ty:n,hasLabel:r=!1,children:i})=>{let{zoom:s}=(0,pc.useViewport)(),a=1/s,l=(0,fc.useMemo)(()=>t===n?{bottom:`${At}px`,transform:"translateX(-50%)"}:e===o?{left:`${At}px`,transform:r?"translateY(-100%)":"translateY(-50%)"}:n>t&&o>e?{left:`${At}px`,bottom:`${At}px`}:n>t&&o<e?{right:`${At}px`,bottom:`${At}px`}:t>n&&o>e?{right:`${At}px`,bottom:`${At}px`}:{left:`${At}px`,bottom:`${At}px`},[e,t,o,n,r]);return(0,cs.jsx)("div",{style:{transform:`scale(${a})`},children:(0,cs.jsx)("div",{className:"absolute pointer-events-auto",style:E({},l),children:i})})};var eo=require("react/jsx-runtime"),on={type:"ANNOTATION_EDGE",reconnectable:!0},mc=({id:e,source:t,target:o,selected:n,data:r})=>{let{isMultipleSelection:i}=q(),s=(0,Gt.useInternalNode)(t),a=(0,Gt.useInternalNode)(o);if(!s||!a)return null;let{sx:l,sy:c,tx:d,ty:u}=Uo(s,a),[p,f,y]=(0,Gt.getStraightPath)({sourceX:l,sourceY:c,targetX:d,targetY:u}),g=n||(s==null?void 0:s.selected)||(a==null?void 0:a.selected);return(0,eo.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,eo.jsx)(Gt.BaseEdge,{id:e,path:p,strokeDasharray:4,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(r!=null&&r.hasError)})}),(0,eo.jsx)(Gt.EdgeLabelRenderer,{children:(0,eo.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${f}px, ${y}px)`},children:n&&!i&&(0,eo.jsx)(tn,{sx:l,sy:c,tx:d,ty:u,children:(0,eo.jsx)(en,{edgeId:e,edgeType:"ANNOTATION_EDGE"})})})})]})};var Ke=require("react"),Te=require("@xyflow/react");var gt=require("react");var us=require("react/jsx-runtime"),ds=/[a-zA-Z0-9À-ÖØ-öø-ÿ]/,gc=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],ze=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:s,onBlur:a,onInput:l,onInvalidFirstCharacter:c})=>{let d=(0,gt.useRef)(null),u=(0,gt.useRef)(null),[p,f]=(0,gt.useState)(!1);(0,gt.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,gt.useEffect)(()=>{f(i!=null?i:!1)},[i]),(0,gt.useEffect)(()=>{if(p&&d.current){d.current.focus();let x=document.createRange();x.selectNodeContents(d.current);let _=window.getSelection();_&&(_.removeAllRanges(),_.addRange(x))}},[p]);let y=(0,gt.useCallback)(()=>{u.current||(c==null||c(),u.current=setTimeout(()=>{u.current=null},500))},[c]),g=x=>{x.stopPropagation(),p||f(!0)},m=x=>{let _=x.currentTarget.innerText.replace(/\n$/,""),N=t&&_.length>=t,A=window.getSelection(),I=(A==null?void 0:A.toString())||"",M=I.length>0,H=(x.ctrlKey||x.metaKey)&&!x.altKey,S=H&&x.key==="a",w=H&&x.key==="c",k=H&&x.key==="x",V=H&&x.key==="v";if((_.length===0||M&&I.length===_.length)&&!ds.test(x.key)&&!gc.includes(x.key)&&!H){x.preventDefault(),y();return}if(x.key==="Enter"&&!x.shiftKey){x.preventDefault(),x.currentTarget.blur();return}N&&!M&&(gc.includes(x.key)||S||w||k||V||x.preventDefault())},b=x=>{x.preventDefault();let _=x.clipboardData.getData("text/plain").replace(/\r\n/g,`
1
+ "use strict";var mp=Object.create;var Tn=Object.defineProperty,gp=Object.defineProperties,hp=Object.getOwnPropertyDescriptor,yp=Object.getOwnPropertyDescriptors,xp=Object.getOwnPropertyNames,fr=Object.getOwnPropertySymbols,Ep=Object.getPrototypeOf,Fi=Object.prototype.hasOwnProperty,Hs=Object.prototype.propertyIsEnumerable;var Vs=(e,t,o)=>t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,x=(e,t)=>{for(var o in t||(t={}))Fi.call(t,o)&&Vs(e,o,t[o]);if(fr)for(var o of fr(t))Hs.call(t,o)&&Vs(e,o,t[o]);return e},v=(e,t)=>gp(e,yp(t));var _t=(e,t)=>{var o={};for(var n in e)Fi.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&fr)for(var n of fr(e))t.indexOf(n)<0&&Hs.call(e,n)&&(o[n]=e[n]);return o};var bp=(e,t)=>{for(var o in t)Tn(e,o,{get:t[o],enumerable:!0})},Gs=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of xp(t))!Fi.call(e,r)&&r!==o&&Tn(e,r,{get:()=>t[r],enumerable:!(n=hp(t,r))||n.enumerable});return e};var _p=(e,t,o)=>(o=e!=null?mp(Ep(e)):{},Gs(t||!e||!e.__esModule?Tn(o,"default",{value:e,enumerable:!0}):o,e)),Tp=e=>Gs(Tn({},"__esModule",{value:!0}),e);var Jg={};bp(Jg,{EditorMode:()=>Fe,ElementPosition:()=>gr,ElementType:()=>Nn,GatewayElementVariant:()=>hr,GatewayVariant:()=>lt,Modeler:()=>dp,ModelerProvider:()=>sp,NodeAttribute:()=>ft,NodeType:()=>ee,NodeVariant:()=>at,RoutingVariant:()=>yr,useModeler:()=>Jo});module.exports=Tp(Jg);var Wi=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};var mr=require("@produto-lecom/lecom-ui");var Bs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",start_event_limit_reached:"Start event can only connect to a single element",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",concurrent_initial_and_final_activity:"An activity cannot be connected to both start and end events",duplicate_connection_not_allowed:"A connection already exists between these elements",connect_node:"Connect element",connecting:"Connecting...",delete_pool_lane_error:"Cannot delete the pool or lane while there are elements inside it."},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{label:"Minimap",open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess",loop:"Activity with loop"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"},feedback:{label_empty:{prefix:"Activity name was automatically set to"},label_already_exists:{prefix:"The name",middle:"already exists. The name was changed to"},invalid_first_character:"Activity name must start with a letter or number"}},lane:{variant:{default:"Pool / Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var zs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",start_event_limit_reached:"Evento inicial solo puede conectarse a un \xFAnico elemento",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",concurrent_initial_and_final_activity:"Una actividad no puede estar conectada al evento inicial y final al mismo tiempo",duplicate_connection_not_allowed:"Ya existe una conexi\xF3n entre estos elementos",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"No se puede eliminar la piscina o carril mientras haya elementos dentro."},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso",loop:"Actividad con loop"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"},feedback:{label_empty:{prefix:"El nombre de la actividad se estableci\xF3 autom\xE1ticamente como"},label_already_exists:{prefix:"El nombre",middle:"ya existe. El nombre fue cambiado a"},invalid_first_character:"El nombre de la actividad debe comenzar con una letra o n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var Fs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",start_event_limit_reached:"Evento inicial s\xF3 pode se conectar a um \xFAnico elemento",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",concurrent_initial_and_final_activity:"Uma atividade n\xE3o pode estar conectada ao evento inicial e final ao mesmo tempo",duplicate_connection_not_allowed:"J\xE1 existe uma conex\xE3o entre esses elementos",start_event_to_subprocess_not_allowed:"Evento inicial n\xE3o pode se conectar a um subprocesso",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"N\xE3o \xE9 poss\xEDvel excluir a piscina ou raia enquanto houver elementos dentro dela."},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso",loop:"Atividade com loop"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de Atividade"},variant:{default:"Atividade",script:"Atividade de script",subprocess:"Subprocesso"},attribute:{loop:"Atividade com loop"},label:{prefix:"Atividade"},feedback:{label_empty:{prefix:"O nome da atividade foi definido automaticamente como"},label_already_exists:{prefix:"O nome",middle:"j\xE1 existe. O nome foi alterado para"},invalid_first_character:"O nome da atividade deve come\xE7ar com uma letra ou n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var Ws={pt_BR:Fs,en_US:Bs,es_ES:zs};var Ys,Us,Np=(Us=(Ys=Wi("LecomUserLanguage"))!=null?Ys:Wi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Us:mr.Translations.PT_BR;(0,mr.initializeI18n)({lng:Np,resources:Ws});var Fe=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Fe||{});var Nn=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Nn||{}),gr=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(gr||{}),hr=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(hr||{}),yr=(d=>(d.SIMPLE="simple",d.LOOP="loop",d.SCRIPT="script",d.SCRIPT_LOOP="script_loop",d.COMPLEX="complex",d.EXCLUSIVE="exclusive",d.PARALLEL="parallel",d.FINAL="final",d.TO_SUB_PROCESS="to_sub_process",d.FROM_SUB_PROCESS="from_sub_process",d))(yr||{});var Wo=require("lucide-react");var co=require("react/jsx-runtime"),xr=({size:e=24,className:t})=>(0,co.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,co.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,co.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,co.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,co.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Yi=require("react/jsx-runtime"),Do=({size:e=24,className:t})=>(0,Yi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,Yi.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Wt=require("react/jsx-runtime"),Oo=({size:e=24,className:t})=>(0,Wt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Wt.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Vo=require("react/jsx-runtime"),Ho=({size:e=24,className:t})=>(0,Vo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Vo.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Vo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Vo.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Go=require("react/jsx-runtime"),Bo=({size:e=24,className:t})=>(0,Go.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Go.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Go.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Go.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var zo=require("react/jsx-runtime"),$s=({size:e=24,className:t})=>(0,zo.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,zo.jsxs)("g",{children:[(0,zo.jsx)("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),(0,zo.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Xs=require("clsx"),Ks=require("tailwind-merge");function O(...e){return(0,Ks.twMerge)((0,Xs.clsx)(e))}var Yt=(e=0,t=0)=>e<t?t:e,Er=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var vn=require("react/jsx-runtime"),qs=({size:e=24,className:t})=>(0,vn.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:O("stroke-2",t),children:[(0,vn.jsx)("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,vn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var br=require("react/jsx-runtime"),Zs=({size:e=24,className:t})=>(0,br.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,br.jsx)("g",{children:(0,br.jsx)("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});var Ui=require("react/jsx-runtime"),_r=({size:e=24,className:t})=>(0,Ui.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#5fd9b0",stroke:"#1cad86",strokeWidth:"2",className:t,children:(0,Ui.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var $i=require("react/jsx-runtime"),wn=({size:e=24,className:t})=>(0,$i.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:O("stroke-2",t),children:(0,$i.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Fo=require("react/jsx-runtime"),Js=({size:e=24,className:t})=>(0,Fo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Fo.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Fo.jsx)("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Fo.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ut=require("react/jsx-runtime"),Qs=({size:e=24,className:t})=>(0,Ut.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Ut.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ut.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var uo=require("react/jsx-runtime"),js=({size:e=24,className:t})=>(0,uo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,uo.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,uo.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,uo.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,uo.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var ee=(a=>(a.START_EVENT="START_EVENT",a.END_EVENT="END_EVENT",a.TASK="TASK",a.LANE="LANE",a.GATEWAY="GATEWAY",a.ANNOTATION="ANNOTATION",a.UNSUPPORTED="UNSUPPORTED",a))(ee||{}),at=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(at||{}),Tr={SCRIPT:{icon:Wo.ScrollText},SUBPROCESS:{icon:Wo.SquarePlus}},ft=(t=>(t.LOOP="LOOP",t))(ft||{}),Nr={LOOP:{icon:Wo.RotateCcw}},lt=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(lt||{}),Xi={EXCLUSIVE:{icon:Ho},PARALLEL:{icon:Bo},COMPLEX:{icon:Oo}};var ap=require("@xyflow/react"),Ce=require("react");var Rt=require("@xyflow/react"),Hi=require("react");var wu=require("@produto-lecom/lecom-ui"),Lt=require("@xyflow/react"),xt=require("react");var Yo=require("@xyflow/react");function ea(e,t){var y,E,_,N;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,s=o/2,a=n/2,l=r.x+s,c=r.y+a,d=i.x+((E=(y=t==null?void 0:t.measured)==null?void 0:y.width)!=null?E:0)/2,u=i.y+((N=(_=t==null?void 0:t.measured)==null?void 0:_.height)!=null?N:0)/2,p=(d-l)/(2*s)-(u-c)/(2*a),f=(d-l)/(2*s)+(u-c)/(2*a),h=1/(Math.abs(p)+Math.abs(f)||1),g=h*p,m=h*f,b=s*(g+m)+l,T=a*(-g+m)+c;return{x:b,y:T}}function ta(e,t){var c,d,u,p;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(p=(u=e.measured)==null?void 0:u.height)!=null?p:0,i=Math.round(o.x),s=Math.round(o.y),a=Math.round(t.x),l=Math.round(t.y);return a<=i+1?Yo.Position.Left:a>=i+n-1?Yo.Position.Right:l<=s+1?Yo.Position.Top:l>=s+r-1?Yo.Position.Bottom:Yo.Position.Top}function Uo(e,t){let o=ea(e,t),n=ea(t,e),r=ta(e,o),i=ta(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function vr(e,t){return{isFromStartEvent:(e==null?void 0:e.type)==="START_EVENT",isGatewayToGateway:(e==null?void 0:e.type)==="GATEWAY"&&(t==null?void 0:t.type)==="GATEWAY",isActiviyToAndGateway:(e==null?void 0:e.type)==="TASK"&&(t==null?void 0:t.type)==="GATEWAY"}}var oa=require("zustand"),na=require("@xyflow/react"),ra=require("react");var wr=()=>{let{setEdges:e}=(0,na.useReactFlow)();return(0,ra.useCallback)(()=>{let o=po.getState().pathEdgeIds;e(n=>n.map(r=>v(x({},r),{selected:o.includes(r.id)})))},[e])},po=(0,oa.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=x({},n.statusByNodeId),i=x({},n.statusData),s=!1;return o.forEach(a=>{let l=`${a.diagramId}-${a.activityId}`;r[a.diagramId]!==a.status&&(r[a.diagramId]=a.status,i[l]=a,s=!0)}),s?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],s={};o.forEach(d=>{s[d.source]||(s[d.source]=[]),s[d.source].push({targetId:d.target,edgeId:d.id})});let a=r[0],l=r[r.length-1];o.forEach(d=>{d.target===a&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let p=[],f=new Set;for(p.push({node:d,path:[]}),f.add(d);p.length>0;){let{node:h,path:g}=p.shift();if(h===u)return g;let m=s[h]||[];for(let{targetId:b,edgeId:T}of m)f.has(b)||(f.add(b),p.push({node:b,path:[...g,T]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],p=r[d+1],f=c(u,p);f.length>0&&i.push(...f)}i.length>0&&e({pathEdgeIds:i})}}));var Zo=require("@xyflow/react"),je=require("react"),Ql=require("zustand/shallow");var vp={value:()=>{}};function sa(){for(var e=0,t=arguments.length,o={},n;e<t;++e){if(!(n=arguments[e]+"")||n in o||/[\s.]/.test(n))throw new Error("illegal type: "+n);o[n]=[]}return new Ar(o)}function Ar(e){this._=e}function wp(e,t){return e.trim().split(/^|\s+/).map(function(o){var n="",r=o.indexOf(".");if(r>=0&&(n=o.slice(r+1),o=o.slice(0,r)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:n}})}Ar.prototype=sa.prototype={constructor:Ar,on:function(e,t){var o=this._,n=wp(e+"",o),r,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((r=(e=n[i]).type)&&(r=Ap(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=n[i]).type)o[r]=ia(o[r],e.name,t);else if(t==null)for(r in o)o[r]=ia(o[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Ar(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var o=new Array(r),n=0,r,i;n<r;++n)o[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,r=i.length;n<r;++n)i[n].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],r=0,i=n.length;r<i;++r)n[r].value.apply(t,o)}};function Ap(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function ia(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=vp,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ki=sa;var Ir="http://www.w3.org/1999/xhtml",qi={svg:"http://www.w3.org/2000/svg",xhtml:Ir,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Dt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),qi.hasOwnProperty(t)?{space:qi[t],local:e}:e}function Ip(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ir&&t.documentElement.namespaceURI===Ir?t.createElement(e):t.createElementNS(o,e)}}function Cp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cr(e){var t=Dt(e);return(t.local?Cp:Ip)(t)}function Sp(){}function fo(e){return e==null?Sp:function(){return this.querySelector(e)}}function aa(e){typeof e!="function"&&(e=fo(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new De(n,this._parents)}function Zi(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Mp(){return[]}function An(e){return e==null?Mp:function(){return this.querySelectorAll(e)}}function Pp(e){return function(){return Zi(e.apply(this,arguments))}}function la(e){typeof e=="function"?e=Pp(e):e=An(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),r.push(l));return new De(n,r)}function In(e){return function(){return this.matches(e)}}function Sr(e){return function(t){return t.matches(e)}}var Lp=Array.prototype.find;function kp(e){return function(){return Lp.call(this.children,e)}}function Rp(){return this.firstElementChild}function ca(e){return this.select(e==null?Rp:kp(typeof e=="function"?e:Sr(e)))}var Dp=Array.prototype.filter;function Op(){return Array.from(this.children)}function Vp(e){return function(){return Dp.call(this.children,e)}}function da(e){return this.selectAll(e==null?Op:Vp(typeof e=="function"?e:Sr(e)))}function ua(e){typeof e!="function"&&(e=In(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new De(n,this._parents)}function Mr(e){return new Array(e.length)}function pa(){return new De(this._enter||this._groups.map(Mr),this._parents)}function Cn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Cn.prototype={constructor:Cn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fa(e){return function(){return e}}function Hp(e,t,o,n,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],n[s]=a):o[s]=new Cn(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Gp(e,t,o,n,r,i,s){var a,l,c=new Map,d=t.length,u=i.length,p=new Array(d),f;for(a=0;a<d;++a)(l=t[a])&&(p[a]=f=s.call(l,l.__data__,a,t)+"",c.has(f)?r[a]=l:c.set(f,l));for(a=0;a<u;++a)f=s.call(e,i[a],a,i)+"",(l=c.get(f))?(n[a]=l,l.__data__=i[a],c.delete(f)):o[a]=new Cn(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(p[a])===l&&(r[a]=l)}function Bp(e){return e.__data__}function ma(e,t){if(!arguments.length)return Array.from(this,Bp);var o=t?Gp:Hp,n=this._parents,r=this._groups;typeof e!="function"&&(e=fa(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],p=u.length,f=zp(e.call(d,d&&d.__data__,c,n)),h=f.length,g=a[c]=new Array(h),m=s[c]=new Array(h),b=l[c]=new Array(p);o(d,u,g,m,b,f,t);for(var T=0,y=0,E,_;T<h;++T)if(E=g[T]){for(T>=y&&(y=T+1);!(_=m[y])&&++y<h;);E._next=_||null}}return s=new De(s,n),s._enter=a,s._exit=l,s}function zp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ga(){return new De(this._exit||this._groups.map(Mr),this._parents)}function ha(e,t,o){var n=this.enter(),r=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),o==null?i.remove():o(i),n&&r?n.merge(r).order():r}function ya(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=o[l],d=n[l],u=c.length,p=a[l]=new Array(u),f,h=0;h<u;++h)(f=c[h]||d[h])&&(p[h]=f);for(;l<r;++l)a[l]=o[l];return new De(a,this._parents)}function xa(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],s;--r>=0;)(s=n[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Ea(e){e||(e=Fp);function t(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,n=o.length,r=new Array(n),i=0;i<n;++i){for(var s=o[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new De(r,this._parents).order()}function Fp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ba(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _a(){return Array.from(this)}function Ta(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length;r<i;++r){var s=n[r];if(s)return s}return null}function Na(){let e=0;for(let t of this)++e;return e}function va(){return!this.node()}function wa(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Wp(e){return function(){this.removeAttribute(e)}}function Yp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Up(e,t){return function(){this.setAttribute(e,t)}}function $p(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Kp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Aa(e,t){var o=Dt(e);if(arguments.length<2){var n=this.node();return o.local?n.getAttributeNS(o.space,o.local):n.getAttribute(o)}return this.each((t==null?o.local?Yp:Wp:typeof t=="function"?o.local?Kp:Xp:o.local?$p:Up)(o,t))}function Pr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function qp(e){return function(){this.style.removeProperty(e)}}function Zp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Jp(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Ia(e,t,o){return arguments.length>1?this.each((t==null?qp:typeof t=="function"?Jp:Zp)(e,t,o==null?"":o)):$t(this.node(),e)}function $t(e,t){return e.style.getPropertyValue(t)||Pr(e).getComputedStyle(e,null).getPropertyValue(t)}function Qp(e){return function(){delete this[e]}}function jp(e,t){return function(){this[e]=t}}function ef(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ca(e,t){return arguments.length>1?this.each((t==null?Qp:typeof t=="function"?ef:jp)(e,t)):this.node()[e]}function Sa(e){return e.trim().split(/^|\s+/)}function Ji(e){return e.classList||new Ma(e)}function Ma(e){this._node=e,this._names=Sa(e.getAttribute("class")||"")}Ma.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Pa(e,t){for(var o=Ji(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function La(e,t){for(var o=Ji(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function tf(e){return function(){Pa(this,e)}}function of(e){return function(){La(this,e)}}function nf(e,t){return function(){(t.apply(this,arguments)?Pa:La)(this,e)}}function ka(e,t){var o=Sa(e+"");if(arguments.length<2){for(var n=Ji(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?nf:t?tf:of)(o,t))}function rf(){this.textContent=""}function sf(e){return function(){this.textContent=e}}function af(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ra(e){return arguments.length?this.each(e==null?rf:(typeof e=="function"?af:sf)(e)):this.node().textContent}function lf(){this.innerHTML=""}function cf(e){return function(){this.innerHTML=e}}function df(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Da(e){return arguments.length?this.each(e==null?lf:(typeof e=="function"?df:cf)(e)):this.node().innerHTML}function uf(){this.nextSibling&&this.parentNode.appendChild(this)}function Oa(){return this.each(uf)}function pf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Va(){return this.each(pf)}function Ha(e){var t=typeof e=="function"?e:Cr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ff(){return null}function Ga(e,t){var o=typeof e=="function"?e:Cr(e),n=t==null?ff:typeof t=="function"?t:fo(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function mf(){var e=this.parentNode;e&&e.removeChild(this)}function Ba(){return this.each(mf)}function gf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hf(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function za(e){return this.select(e?hf:gf)}function Fa(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yf(e){return function(t){e.call(this,t,this.__data__)}}function xf(e){return e.trim().split(/^|\s+/).map(function(t){var o="",n=t.indexOf(".");return n>=0&&(o=t.slice(n+1),t=t.slice(0,n)),{type:t,name:o}})}function Ef(e){return function(){var t=this.__on;if(t){for(var o=0,n=-1,r=t.length,i;o<r;++o)i=t[o],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function bf(e,t,o){return function(){var n=this.__on,r,i=yf(t);if(n){for(var s=0,a=n.length;s<a;++s)if((r=n[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=o),r.value=t;return}}this.addEventListener(e.type,i,o),r={type:e.type,name:e.name,value:t,listener:i,options:o},n?n.push(r):this.__on=[r]}}function Wa(e,t,o){var n=xf(e+""),r,i=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=n[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?bf:Ef,r=0;r<i;++r)this.each(a(n[r],t,o));return this}function Ya(e,t,o){var n=Pr(e),r=n.CustomEvent;typeof r=="function"?r=new r(t,o):(r=n.document.createEvent("Event"),o?(r.initEvent(t,o.bubbles,o.cancelable),r.detail=o.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function _f(e,t){return function(){return Ya(this,e,t)}}function Tf(e,t){return function(){return Ya(this,e,t.apply(this,arguments))}}function Ua(e,t){return this.each((typeof t=="function"?Tf:_f)(e,t))}function*$a(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,s;r<i;++r)(s=n[r])&&(yield s)}var Nf=[null];function De(e,t){this._groups=e,this._parents=t}function Xa(){return new De([[document.documentElement]],Nf)}function vf(){return this}De.prototype=Xa.prototype={constructor:De,select:aa,selectAll:la,selectChild:ca,selectChildren:da,filter:ua,data:ma,enter:pa,exit:ga,join:ha,merge:ya,selection:vf,order:xa,sort:Ea,call:ba,nodes:_a,node:Ta,size:Na,empty:va,each:wa,attr:Aa,style:Ia,property:Ca,classed:ka,text:Ra,html:Da,raise:Oa,lower:Va,append:Ha,insert:Ga,remove:Ba,clone:za,datum:Fa,on:Wa,dispatch:Ua,[Symbol.iterator]:$a};var Ot=Xa;function Lr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Qi(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Pn(){}var Sn=.7,Dr=1/Sn,$o="\\s*([+-]?\\d+)\\s*",Mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wf=/^#([0-9a-f]{3,8})$/,Af=new RegExp(`^rgb\\(${$o},${$o},${$o}\\)$`),If=new RegExp(`^rgb\\(${Tt},${Tt},${Tt}\\)$`),Cf=new RegExp(`^rgba\\(${$o},${$o},${$o},${Mn}\\)$`),Sf=new RegExp(`^rgba\\(${Tt},${Tt},${Tt},${Mn}\\)$`),Mf=new RegExp(`^hsl\\(${Mn},${Tt},${Tt}\\)$`),Pf=new RegExp(`^hsla\\(${Mn},${Tt},${Tt},${Mn}\\)$`),Ka={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Lr(Pn,Xt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qa,formatHex:qa,formatHex8:Lf,formatHsl:kf,formatRgb:Za,toString:Za});function qa(){return this.rgb().formatHex()}function Lf(){return this.rgb().formatHex8()}function kf(){return ol(this).formatHsl()}function Za(){return this.rgb().formatRgb()}function Xt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=wf.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ja(t):o===3?new $e(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?kr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?kr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Af.exec(e))?new $e(t[1],t[2],t[3],1):(t=If.exec(e))?new $e(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cf.exec(e))?kr(t[1],t[2],t[3],t[4]):(t=Sf.exec(e))?kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Mf.exec(e))?el(t[1],t[2]/100,t[3]/100,1):(t=Pf.exec(e))?el(t[1],t[2]/100,t[3]/100,t[4]):Ka.hasOwnProperty(e)?Ja(Ka[e]):e==="transparent"?new $e(NaN,NaN,NaN,0):null}function Ja(e){return new $e(e>>16&255,e>>8&255,e&255,1)}function kr(e,t,o,n){return n<=0&&(e=t=o=NaN),new $e(e,t,o,n)}function Rf(e){return e instanceof Pn||(e=Xt(e)),e?(e=e.rgb(),new $e(e.r,e.g,e.b,e.opacity)):new $e}function Xo(e,t,o,n){return arguments.length===1?Rf(e):new $e(e,t,o,n==null?1:n)}function $e(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Lr($e,Xo,Qi(Pn,{brighter(e){return e=e==null?Dr:Math.pow(Dr,e),new $e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Sn:Math.pow(Sn,e),new $e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $e(go(this.r),go(this.g),go(this.b),Or(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qa,formatHex:Qa,formatHex8:Df,formatRgb:ja,toString:ja}));function Qa(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}`}function Df(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}${mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function ja(){let e=Or(this.opacity);return`${e===1?"rgb(":"rgba("}${go(this.r)}, ${go(this.g)}, ${go(this.b)}${e===1?")":`, ${e})`}`}function Or(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function go(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mo(e){return e=go(e),(e<16?"0":"")+e.toString(16)}function el(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new mt(e,t,o,n)}function ol(e){if(e instanceof mt)return new mt(e.h,e.s,e.l,e.opacity);if(e instanceof Pn||(e=Xt(e)),!e)return new mt;if(e instanceof mt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,n=e.b/255,r=Math.min(t,o,n),i=Math.max(t,o,n),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(o-n)/a+(o<n)*6:o===i?s=(n-t)/a+2:s=(t-o)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new mt(s,a,l,e.opacity)}function nl(e,t,o,n){return arguments.length===1?ol(e):new mt(e,t,o,n==null?1:n)}function mt(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Lr(mt,nl,Qi(Pn,{brighter(e){return e=e==null?Dr:Math.pow(Dr,e),new mt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Sn:Math.pow(Sn,e),new mt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,n=o+(o<.5?o:1-o)*t,r=2*o-n;return new $e(ji(e>=240?e-240:e+120,r,n),ji(e,r,n),ji(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new mt(tl(this.h),Rr(this.s),Rr(this.l),Or(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Or(this.opacity);return`${e===1?"hsl(":"hsla("}${tl(this.h)}, ${Rr(this.s)*100}%, ${Rr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tl(e){return e=(e||0)%360,e<0?e+360:e}function Rr(e){return Math.max(0,Math.min(1,e||0))}function ji(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}function es(e,t,o,n,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*o+(1+3*e+3*i-3*s)*n+s*r)/6}function rl(e){var t=e.length-1;return function(o){var n=o<=0?o=0:o>=1?(o=1,t-1):Math.floor(o*t),r=e[n],i=e[n+1],s=n>0?e[n-1]:2*r-i,a=n<t-1?e[n+2]:2*i-r;return es((o-n/t)*t,s,r,i,a)}}function il(e){var t=e.length;return function(o){var n=Math.floor(((o%=1)<0?++o:o)*t),r=e[(n+t-1)%t],i=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return es((o-n/t)*t,r,i,s,a)}}var ts=e=>()=>e;function Of(e,t){return function(o){return e+o*t}}function Vf(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(n){return Math.pow(e+n*t,o)}}function sl(e){return(e=+e)==1?Vr:function(t,o){return o-t?Vf(t,o,e):ts(isNaN(t)?o:t)}}function Vr(e,t){var o=t-e;return o?Of(e,o):ts(isNaN(e)?t:e)}var Hr=function e(t){var o=sl(t);function n(r,i){var s=o((r=Xo(r)).r,(i=Xo(i)).r),a=o(r.g,i.g),l=o(r.b,i.b),c=Vr(r.opacity,i.opacity);return function(d){return r.r=s(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function al(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),s,a;for(s=0;s<o;++s)a=Xo(t[s]),n[s]=a.r||0,r[s]=a.g||0,i[s]=a.b||0;return n=e(n),r=e(r),i=e(i),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=i(l),a+""}}}var Hf=al(rl),Gf=al(il);function ct(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,os=new RegExp(ns.source,"g");function Bf(e){return function(){return e}}function zf(e){return function(t){return e(t)+""}}function rs(e,t){var o=ns.lastIndex=os.lastIndex=0,n,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(n=ns.exec(e))&&(r=os.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:ct(n,r)})),o=os.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?zf(l[0].x):Bf(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)a[(u=l[d]).i]=u.x(c);return a.join("")})}var ll=180/Math.PI,Gr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function is(e,t,o,n,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(a=Math.sqrt(o*o+n*n))&&(o/=a,n/=a,l/=a),e*n<t*o&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ll,skewX:Math.atan(l)*ll,scaleX:s,scaleY:a}}var Br;function cl(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gr:is(t.a,t.b,t.c,t.d,t.e,t.f)}function dl(e){return e==null?Gr:(Br||(Br=document.createElementNS("http://www.w3.org/2000/svg","g")),Br.setAttribute("transform",e),(e=Br.transform.baseVal.consolidate())?(e=e.matrix,is(e.a,e.b,e.c,e.d,e.e,e.f)):Gr)}function ul(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,p,f,h){if(c!==u||d!==p){var g=f.push("translate(",null,t,null,o);h.push({i:g-4,x:ct(c,u)},{i:g-2,x:ct(d,p)})}else(u||p)&&f.push("translate("+u+t+p+o)}function s(c,d,u,p){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),p.push({i:u.push(r(u)+"rotate(",null,n)-2,x:ct(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function a(c,d,u,p){c!==d?p.push({i:u.push(r(u)+"skewX(",null,n)-2,x:ct(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,p,f,h){if(c!==u||d!==p){var g=f.push(r(f)+"scale(",null,",",null,")");h.push({i:g-4,x:ct(c,u)},{i:g-2,x:ct(d,p)})}else(u!==1||p!==1)&&f.push(r(f)+"scale("+u+","+p+")")}return function(c,d){var u=[],p=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,p),s(c.rotate,d.rotate,u,p),a(c.skewX,d.skewX,u,p),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,p),c=d=null,function(f){for(var h=-1,g=p.length,m;++h<g;)u[(m=p[h]).i]=m.x(f);return u.join("")}}}var ss=ul(cl,"px, ","px)","deg)"),as=ul(dl,", ",")",")");var Ko=0,kn=0,Ln=0,fl=1e3,zr,Rn,Fr=0,ho=0,Wr=0,Dn=typeof performance=="object"&&performance.now?performance:Date,ml=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vn(){return ho||(ml(Ff),ho=Dn.now()+Wr)}function Ff(){ho=0}function On(){this._call=this._time=this._next=null}On.prototype=Yr.prototype={constructor:On,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vn():+o)+(t==null?0:+t),!this._next&&Rn!==this&&(Rn?Rn._next=this:zr=this,Rn=this),this._call=e,this._time=o,ls()},stop:function(){this._call&&(this._call=null,this._time=1/0,ls())}};function Yr(e,t,o){var n=new On;return n.restart(e,t,o),n}function gl(){Vn(),++Ko;for(var e=zr,t;e;)(t=ho-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ko}function pl(){ho=(Fr=Dn.now())+Wr,Ko=kn=0;try{gl()}finally{Ko=0,Yf(),ho=0}}function Wf(){var e=Dn.now(),t=e-Fr;t>fl&&(Wr-=t,Fr=e)}function Yf(){for(var e,t=zr,o,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:zr=o);Rn=e,ls(n)}function ls(e){if(!Ko){kn&&(kn=clearTimeout(kn));var t=e-ho;t>24?(e<1/0&&(kn=setTimeout(pl,e-Dn.now()-Wr)),Ln&&(Ln=clearInterval(Ln))):(Ln||(Fr=Dn.now(),Ln=setInterval(Wf,fl)),Ko=1,ml(pl))}}function Ur(e,t,o){var n=new On;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var Uf=Ki("start","end","cancel","interrupt"),$f=[],xl=0,hl=1,Xr=2,$r=3,yl=4,Kr=5,Hn=6;function Kt(e,t,o,n,r,i){var s=e.__transition;if(!s)e.__transition={};else if(o in s)return;Xf(e,o,{name:t,index:n,group:r,on:Uf,tween:$f,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xl})}function Gn(e,t){var o=Oe(e,t);if(o.state>xl)throw new Error("too late; already scheduled");return o}function He(e,t){var o=Oe(e,t);if(o.state>$r)throw new Error("too late; already running");return o}function Oe(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Xf(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Yr(i,0,o.time);function i(c){o.state=hl,o.timer.restart(s,o.delay,o.time),o.delay<=c&&s(c-o.delay)}function s(c){var d,u,p,f;if(o.state!==hl)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===$r)return Ur(s);f.state===yl?(f.state=Hn,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=Hn,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(Ur(function(){o.state===$r&&(o.state=yl,o.timer.restart(a,o.delay,o.time),a(c))}),o.state=Xr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Xr){for(o.state=$r,r=new Array(p=o.tween.length),d=0,u=-1;d<p;++d)(f=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=f);r.length=u+1}}function a(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=Kr,1),u=-1,p=r.length;++u<p;)r[u].call(e,d);o.state===Kr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=Hn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function cs(e,t){var o=e.__transition,n,r,i=!0,s;if(o){t=t==null?null:t+"";for(s in o){if((n=o[s]).name!==t){i=!1;continue}r=n.state>Xr&&n.state<Kr,n.state=Hn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[s]}i&&delete e.__transition}}function El(e){return this.each(function(){cs(this,e)})}function Kf(e,t){var o,n;return function(){var r=He(this,e),i=r.tween;if(i!==o){n=o=i;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}r.tween=n}}function qf(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=He(this,e),s=i.tween;if(s!==n){r=(n=s).slice();for(var a={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function bl(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=Oe(this.node(),o).tween,r=0,i=n.length,s;r<i;++r)if((s=n[r]).name===e)return s.value;return null}return this.each((t==null?Kf:qf)(o,e,t))}function qo(e,t,o){var n=e._id;return e.each(function(){var r=He(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return Oe(r,n).value[t]}}function qr(e,t){var o;return(typeof t=="number"?ct:t instanceof Xt?Hr:(o=Xt(t))?(t=o,Hr):rs)(e,t)}function Zf(e){return function(){this.removeAttribute(e)}}function Jf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===n?i:i=t(n=s,o)}}function jf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===n?i:i=t(n=s,o)}}function em(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function tm(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function _l(e,t){var o=Dt(e),n=o==="transform"?as:qr;return this.attrTween(e,typeof t=="function"?(o.local?tm:em)(o,n,qo(this,"attr."+e,t)):t==null?(o.local?Jf:Zf)(o):(o.local?jf:Qf)(o,n,t))}function om(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function nm(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function rm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&nm(e,i)),o}return r._value=t,r}function im(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&om(e,i)),o}return r._value=t,r}function Tl(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var n=Dt(e);return this.tween(o,(n.local?rm:im)(n,t))}function sm(e,t){return function(){Gn(this,e).delay=+t.apply(this,arguments)}}function am(e,t){return t=+t,function(){Gn(this,e).delay=t}}function Nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sm:am)(t,e)):Oe(this.node(),t).delay}function lm(e,t){return function(){He(this,e).duration=+t.apply(this,arguments)}}function cm(e,t){return t=+t,function(){He(this,e).duration=t}}function vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lm:cm)(t,e)):Oe(this.node(),t).duration}function dm(e,t){if(typeof t!="function")throw new Error;return function(){He(this,e).ease=t}}function wl(e){var t=this._id;return arguments.length?this.each(dm(t,e)):Oe(this.node(),t).ease}function um(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;He(this,e).ease=o}}function Al(e){if(typeof e!="function")throw new Error;return this.each(um(this._id,e))}function Il(e){typeof e!="function"&&(e=In(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new We(n,this._parents,this._name,this._id)}function Cl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),s=new Array(n),a=0;a<i;++a)for(var l=t[a],c=o[a],d=l.length,u=s[a]=new Array(d),p,f=0;f<d;++f)(p=l[f]||c[f])&&(u[f]=p);for(;a<n;++a)s[a]=t[a];return new We(s,this._parents,this._name,this._id)}function pm(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function fm(e,t,o){var n,r,i=pm(t)?Gn:He;return function(){var s=i(this,e),a=s.on;a!==n&&(r=(n=a).copy()).on(t,o),s.on=r}}function Sl(e,t){var o=this._id;return arguments.length<2?Oe(this.node(),o).on.on(e):this.each(fm(o,e,t))}function mm(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ml(){return this.on("end.remove",mm(this._id))}function Pl(e){var t=this._name,o=this._id;typeof e!="function"&&(e=fo(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],l=a.length,c=i[s]=new Array(l),d,u,p=0;p<l;++p)(d=a[p])&&(u=e.call(d,d.__data__,p,a))&&("__data__"in d&&(u.__data__=d.__data__),c[p]=u,Kt(c[p],t,o,p,c,Oe(d,o)));return new We(i,this._parents,t,o)}function Ll(e){var t=this._name,o=this._id;typeof e!="function"&&(e=An(e));for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var l=n[a],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var p=e.call(d,d.__data__,u,l),f,h=Oe(d,o),g=0,m=p.length;g<m;++g)(f=p[g])&&Kt(f,t,o,g,p,h);i.push(p),s.push(d)}return new We(i,s,t,o)}var gm=Ot.prototype.constructor;function kl(){return new gm(this._groups,this._parents)}function hm(e,t){var o,n,r;return function(){var i=$t(this,e),s=(this.style.removeProperty(e),$t(this,e));return i===s?null:i===o&&s===n?r:r=t(o=i,n=s)}}function Rl(e){return function(){this.style.removeProperty(e)}}function ym(e,t,o){var n,r=o+"",i;return function(){var s=$t(this,e);return s===r?null:s===n?i:i=t(n=s,o)}}function xm(e,t,o){var n,r,i;return function(){var s=$t(this,e),a=o(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),$t(this,e))),s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a))}}function Em(e,t){var o,n,r,i="style."+t,s="end."+i,a;return function(){var l=He(this,e),c=l.on,d=l.value[i]==null?a||(a=Rl(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(s,r=d),l.on=n}}function Dl(e,t,o){var n=(e+="")=="transform"?ss:qr;return t==null?this.styleTween(e,hm(e,n)).on("end.style."+e,Rl(e)):typeof t=="function"?this.styleTween(e,xm(e,n,qo(this,"style."+e,t))).each(Em(this._id,e)):this.styleTween(e,ym(e,n,t),o).on("end.style."+e,null)}function bm(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function _m(e,t,o){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&bm(e,s,o)),n}return i._value=t,i}function Ol(e,t,o){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,_m(e,t,o==null?"":o))}function Tm(e){return function(){this.textContent=e}}function Nm(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Vl(e){return this.tween("text",typeof e=="function"?Nm(qo(this,"text",e)):Tm(e==null?"":e+""))}function vm(e){return function(t){this.textContent=e.call(this,t)}}function wm(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&vm(r)),t}return n._value=e,n}function Hl(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,wm(e))}function Gl(){for(var e=this._name,t=this._id,o=Zr(),n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=Oe(l,t);Kt(l,e,o,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new We(n,this._parents,e,o)}function Bl(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};o.each(function(){var c=He(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Am=0;function We(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function zl(e){return Ot().transition(e)}function Zr(){return++Am}var Vt=Ot.prototype;We.prototype=zl.prototype={constructor:We,select:Pl,selectAll:Ll,selectChild:Vt.selectChild,selectChildren:Vt.selectChildren,filter:Il,merge:Cl,selection:kl,transition:Gl,call:Vt.call,nodes:Vt.nodes,node:Vt.node,size:Vt.size,empty:Vt.empty,each:Vt.each,on:Sl,attr:_l,attrTween:Tl,style:Dl,styleTween:Ol,text:Vl,textTween:Hl,remove:Ml,tween:bl,delay:Nl,duration:vl,ease:wl,easeVarying:Al,end:Bl,[Symbol.iterator]:Vt[Symbol.iterator]};function Jr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Im={time:null,delay:0,duration:250,ease:Jr};function Cm(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Fl(e){var t,o;e instanceof We?(t=e._id,e=e._name):(t=Zr(),(o=Im).time=Vn(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Kt(l,e,t,c,s,o||Cm(l,t));return new We(n,this._parents,e,t)}Ot.prototype.interrupt=El;Ot.prototype.transition=Fl;function qt(e,t,o){this.k=e,this.x=t,this.y=o}qt.prototype={constructor:qt,scale:function(e){return e===1?this:new qt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qr=new qt(1,0,0);jr.prototype=qt.prototype;function jr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qr;return e.__zoom}var Mm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Wl;(function(e){e.Strict="strict",e.Loose="loose"})(Wl||(Wl={}));var Yl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Yl||(Yl={}));var Ul;(function(e){e.Partial="partial",e.Full="full"})(Ul||(Ul={}));var $l;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})($l||($l={}));var Xl;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xl||(Xl={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));var ab={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};var Pm=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Lm=(e,t=[0,0])=>{var a;let{width:o,height:n}=km(e),r=(a=e.origin)!=null?a:t,i=o*r[0],s=n*r[1];return{x:e.position.x-i,y:e.position.y-s}};var Ht=(e,t=[0,0])=>{var r,i,s,a,l,c,d,u;let{x:o,y:n}=Pm(e)?e.internals.positionAbsolute:Lm(e,t);return{x:o,y:n,x2:o+((a=(s=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?s:e.initialWidth)!=null?a:0),y2:n+((u=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?u:0)}};function km(e){var t,o,n,r,i,s,a,l;return{width:(r=(n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:e.initialWidth)!=null?r:0,height:(l=(a=(s=(i=e.measured)==null?void 0:i.height)!=null?s:e.height)!=null?a:e.initialHeight)!=null?l:0}}var lb={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}};var Rm={nodeOrigin:[0,0],nodeExtent:Mm,elevateNodesOnSelect:!0,defaults:{}},cb=v(x({},Rm),{checkEquality:!0});var Kl;(function(e){e.Line="line",e.Handle="handle"})(Kl||(Kl={}));var Dm={width:0,height:0,x:0,y:0},db=v(x({},Dm),{pointerX:0,pointerY:0,aspectRatio:1});var Om=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Vm(e,t){let o=Math.max(0,Math.min(e.x2,t.x2)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y2,t.y2)-Math.max(e.y,t.y));return o*n}function Hm(e,t){let o=Math.max(0,Math.max(e.x-t.x2,t.x-e.x2)),n=Math.max(0,Math.max(e.y-t.y2,t.y-e.y2));return Math.sqrt(o*o+n*n)}var ei=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r,i){let s=t==="horizontal"?this.yLines:this.xLines,[a,l]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],c=[];for(let f of s){if(f.position<a)continue;if(f.position>l)break;if(i.has(f.node.id)||f.node.parentId&&i.has(f.node.parentId)||!Om(f.nodeBox,r))continue;let h=Math.abs(f.position-o);if(h>ti)continue;let m=Vm(f.nodeBox,n)>0?0:Hm(f.nodeBox,n);c.push({line:f,lineDist:h,nodeDist:m})}let d=.5,u=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;c.sort((f,h)=>{if(u){if(f.line===u&&h.line!==u)return-1;if(h.line===u&&f.line!==u)return 1}return Math.abs(f.lineDist-h.lineDist)<=d?f.nodeDist-h.nodeDist:f.lineDist-h.lineDist});let p=c.length>0?c[0].line:void 0;return p&&(t==="horizontal"?this.lastHorizontalLine=p:this.lastVerticalLine=p),p}};function ql(e,t=yo,o){let n=[];return e==null||e.forEach(r=>{let i=o(r.id);if(!i)throw new Error(`Node with id ${r.id} not found in internal nodes.`);let s=Ht(i);Object.entries(t).forEach(([a,l])=>{var c;n.push({position:l.resolve(r,s),color:(c=r.style)==null?void 0:c.backgroundColor,orientation:l.orientation,anchorName:a,nodeBox:s,node:r})})}),n}function Zl(e,t,o,n,r=Object.keys(yo)){let i=[];for(let a of r){let l=yo[a],c=l.resolve(null,o),d=e.search(l.orientation,c,o,t,n);d&&i.push({sourcePosition:c,anchorName:a,anchor:l,line:d})}let s={horizontal:void 0,vertical:void 0};for(let a of i){let l=s[a.anchor.orientation],c=Math.abs(a.sourcePosition-a.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(s[a.anchor.orientation]=a)}return s}function Jl(e,t,o){let n=0,r=0,i=!1,s=!1;if(t){let l=t.anchor.resolve(null,e)-t.line.position;Math.abs(l)<=ti&&(r=l,s=!0)}if(o){let l=o.anchor.resolve(null,e)-o.line.position;Math.abs(l)<=ti&&(n=l,i=!0)}return{deltaX:n,deltaY:r,snappedX:i,snappedY:s}}var ti=10,yo={top:{orientation:"horizontal",resolve:(e,t)=>t.y},bottom:{orientation:"horizontal",resolve:(e,t)=>t.y2},left:{orientation:"vertical",resolve:(e,t)=>t.x},right:{orientation:"vertical",resolve:(e,t)=>t.x2},centerX:{orientation:"vertical",resolve:(e,t)=>(t.x+t.x2)/2},centerY:{orientation:"horizontal",resolve:(e,t)=>(t.y+t.y2)/2}};var jl=require("react/jsx-runtime"),Gm=new ei;function oi(){let[e,t]=(0,je.useState)(void 0),[o,n]=(0,je.useState)(void 0),{width:r,height:i}=(0,Zo.useStore)(m=>({width:m.width,height:m.height}),Ql.shallow),s=(0,Zo.useNodesInitialized)(),a=(0,je.useRef)(Gm),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,Zo.useReactFlow)(),u=(0,je.useCallback)(()=>{t(void 0),n(void 0)},[]),p=(0,je.useCallback)(m=>{let b=m!=null?m:d();u();let T=ql(b,yo,c);a.current.initialize(T)},[c,u,d]),f=(0,je.useCallback)(()=>{setTimeout(()=>{p()},100)},[p]);(0,je.useEffect)(()=>{s&&p(d())},[s,p,d]);let h=(0,je.useCallback)((m,b)=>{var F,V,G,W,te,k,X,J,Y,$;if(!a.current||m.length===0)return m;u();let T=m.filter(U=>U.type==="position"&&!!U.position),y=m.find(U=>U.type==="dimensions");if(T.length===0&&!y)return m;let E=Object.keys(yo),_=new Set,N=1/0,w=1/0,A=-1/0,P=-1/0;if(T.length>0)T.forEach(U=>{var Me,_e,ae,re,Ve,Ue;let Z=b.find(Ft=>Ft.id===U.id);if(!Z)return;_.add(Z.id);let j=c(Z.id);if(!j)return;let le=j.parentId?c(j.parentId):void 0,ce=U.position.x+((Me=le==null?void 0:le.internals.positionAbsolute.x)!=null?Me:0),fe=U.position.y+((_e=le==null?void 0:le.internals.positionAbsolute.y)!=null?_e:0),me=(re=(ae=Z.measured)==null?void 0:ae.width)!=null?re:0,Se=(Ue=(Ve=Z.measured)==null?void 0:Ve.height)!=null?Ue:0;N=Math.min(N,ce),w=Math.min(w,fe),A=Math.max(A,ce+me),P=Math.max(P,fe+Se)}),y&&(E=["top","left"]);else if(y){let U=b.find(me=>me.id===y.id);if(!U)return m;_.add(U.id);let Z=c(U.id);if(!Z)return m;let j=Z.internals.positionAbsolute.x,le=Z.internals.positionAbsolute.y,ce=(W=(G=(F=y.dimensions)==null?void 0:F.width)!=null?G:(V=U.measured)==null?void 0:V.width)!=null?W:0,fe=(J=(X=(te=y.dimensions)==null?void 0:te.height)!=null?X:(k=U.measured)==null?void 0:k.height)!=null?J:0;N=j,w=le,A=j+ce,P=le+fe,E=["right","bottom"]}if(N===1/0)return m;let B={x:N,y:w,x2:A,y2:P},{x:S,y:D}=l({x:0,y:0}),{x:Q,y:I}=l({x:r,y:i}),R={x:S,y:D,x2:Q,y2:I},{horizontal:L,vertical:M}=Zl(a.current,R,B,_,E),{deltaX:q,deltaY:z,snappedX:C,snappedY:H}=Jl(B,L,M);if(C||H){let U=T.some(j=>j.dragging),Z=!!(y!=null&&y.resizing);(U||Z)&&(C&&n(M==null?void 0:M.line),H&&t(L==null?void 0:L.line)),C&&(T.forEach(j=>{j.position&&(j.position.x-=q)}),(y==null?void 0:y.id)===((Y=T[0])==null?void 0:Y.id)?y.dimensions&&(y.dimensions.width+=q):y&&!T.length&&y.dimensions&&(y.dimensions.width-=q)),H&&(T.forEach(j=>{j.position&&(j.position.y-=z)}),(y==null?void 0:y.id)===(($=T[0])==null?void 0:$.id)?y.dimensions&&(y.dimensions.height+=z):y&&!T.length&&y.dimensions&&(y.dimensions.height-=z))}return m},[l,c,r,i,t,n,u]),g=(0,je.useCallback)(()=>(0,jl.jsx)(ec,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:p,forceRebuildIndex:f,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var Mi=require("@xyflow/react"),Mt=require("react");var Zt=e=>new Map(e.map(t=>[t.id,t])),Bn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),tc=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),ds=e=>e.some(t=>t.type==="START_EVENT"),Jt=(e,t)=>e==="START_EVENT"?!ds(t):!0,oc=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e);if(!s||s.type!=="START_EVENT")return!1;let a=i.get(t);return(a==null?void 0:a.type)==="ANNOTATION"?!1:Bn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},nc=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(t);if(!s||s.type!=="END_EVENT")return!1;let a=i.get(e);return(a==null?void 0:a.type)==="ANNOTATION"?!1:tc(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},ni=(e,t,o,n,r)=>{var c;let i=Zt(o),s=i.get(e);if(!s||s.type!=="GATEWAY"||((c=s.data)==null?void 0:c.variant)!=="EXCLUSIVE")return!1;let a=t?i.get(t):null;return(a==null?void 0:a.type)==="ANNOTATION"?!1:Bn(e,n,r).filter(d=>{let u=i.get(d.target);return(u==null?void 0:u.type)!=="ANNOTATION"}).length>=2},rc=(e,t,o)=>{var s,a,l,c;let n=Zt(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((s=r==null?void 0:r.data)==null?void 0:s.variant)==="EXCLUSIVE"&&((a=i==null?void 0:i.data)==null?void 0:a.variant)==="PARALLEL"||((l=r==null?void 0:r.data)==null?void 0:l.variant)==="COMPLEX"&&((c=i==null?void 0:i.data)==null?void 0:c.variant)==="PARALLEL"},ri=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SCRIPT"},ic=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SUBPROCESS"},ii=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.attribute)==="LOOP"},zn=(e,t,o,n)=>{let r=Zt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:tc(e,o,n).some(a=>{let l=r.get(a.source);return(l==null?void 0:l.type)==="START_EVENT"})},Fn=(e,t,o,n)=>{let r=Zt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Bn(e,o,n).some(a=>{let l=r.get(a.target);return(l==null?void 0:l.type)==="END_EVENT"})},sc=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e),a=i.get(t);return(s==null?void 0:s.type)==="START_EVENT"&&(a==null?void 0:a.type)==="TASK"?Fn(t,o,n,r):(a==null?void 0:a.type)==="END_EVENT"&&(s==null?void 0:s.type)==="TASK"?zn(e,o,n,r):!1},si=(e,t,o)=>Bn(e,t,o).length>0,ai=(e,t,o,n,r)=>{let i=Zt(o),s=i.get(e);if(!s||s.type!=="TASK")return!1;let a=t?i.get(t):null;return(a==null?void 0:a.type)==="ANNOTATION"?!1:Bn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var ac=(e,t,o,n)=>o.some(r=>n&&r.id===n?!1:r.source===e&&r.target===t);var Bm=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!ac(e.sourceNodeId,e.targetNodeId,e.edges,e.reconnectingEdgeId),reason:"duplicate_connection_not_allowed"}),e=>({isValid:!oc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!nc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!ni(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!ai(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:rc(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&ic(e.targetNodeId,e.nodes)),reason:"start_event_to_subprocess_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(ri(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(ii(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(zn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!sc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"concurrent_initial_and_final_activity"}),e=>({isValid:!(Fn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(si(e.sourceNodeId,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:["START_EVENT","END_EVENT","TASK","GATEWAY","LANE"],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],us=e=>{for(let t of Bm){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var zm=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:ni(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"gateway_limit_reached"})},{sourceTypes:["START_EVENT"],validate:e=>({shouldDisable:e.edges.some(o=>{if(o.source!==e.sourceNodeId)return!1;let n=e.nodes.find(r=>r.id===o.target);return(n==null?void 0:n.type)!=="ANNOTATION"})&&e.targetNodeType!=="ANNOTATION",reason:"start_event_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:ds(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ri(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ii(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:zn(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Fn(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:si(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:ai(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],lc=e=>{let t=zm.filter(o=>{let n=!o.sourceTypes||o.sourceTypes.includes(e.sourceNodeType),r=!o.targetTypes||o.targetTypes.includes(e.targetNodeType);return n&&r});for(let o of t){let n=o.validate(e);if(n.shouldDisable)return n}return{shouldDisable:!1}};var Gt=require("@xyflow/react");var Nt=require("@produto-lecom/lecom-ui"),dc=require("lucide-react");var dt=require("@xyflow/react");var cc=require("@xyflow/react"),Qt=()=>{let e=(0,cc.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:s,triggerNodeChanges:a}=e.getState(),l=i.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]),c=r.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]);return a(l),s(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await Er(),!0}}};var li=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,dt.useReactFlow)(),{selectElements:r}=Qt(),i=m=>{let b=o(),T=n(),y=(0,dt.getIncomers)(m,b,T),E=(0,dt.getOutgoers)(m,b,T),_=y.some(w=>w.type==="START_EVENT"),N=E.some(w=>w.type==="END_EVENT");return _?"start":N?"end":"between"},s=(m,b,T)=>{var _,N,w,A;if(!m)return;let y={type:m.type,variant:(_=m.data)==null?void 0:_.variant,attribute:(N=m.data)==null?void 0:N.attribute},E={id:m.id,position:i(m),label:(w=m.data)==null?void 0:w.label,node:y};return m.type==="TASK"&&((A=m.data)==null?void 0:A.variant)==="SUBPROCESS"?v(x({},E),{type:"sub_process"}):m.type==="GATEWAY"?v(x({},E),{type:"gateway",variant:a(m,b,T)}):v(x({},E),{type:"activity"})},a=(m,b,T)=>{if(m.type!=="GATEWAY")return;let y=(0,dt.getIncomers)(m,b,T),E=!1,_=!1;if(y.forEach(N=>{var w,A;N.type==="TASK"&&(((w=N.data)==null?void 0:w.variant)==="SCRIPT"&&(E=!0),((A=N.data)==null?void 0:A.attribute)==="LOOP"&&(_=!0))}),E&&_)return"script_loop";if(E)return"script";if(_)return"loop"},l=(m,b,T)=>{var w,A,P,B;let y=e(m.source),E=e(m.target);if(!y||!E)return"simple";if((0,dt.getOutgoers)(y,b,T).some(S=>S.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((w=y.data)==null?void 0:w.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let S=(A=y.data)==null?void 0:A.variant,D=(P=y.data)==null?void 0:P.attribute;if(S==="SUBPROCESS")return"from_sub_process";if(E.type==="TASK"&&((B=E.data)==null?void 0:B.variant)==="SUBPROCESS")return"to_sub_process";let Q=S==="SCRIPT",I=D==="LOOP";return Q&&I?"script_loop":Q?"script":I?"loop":"simple"}return"simple"},c=(m,b,T)=>{let y=[];function E(N,w,A=0){let P=s(N,b,T);if(P.depth=A,w.push(P),N.type==="TASK"){y.push([...w]),w.pop();return}let B=(0,dt.getIncomers)(N,b,T);if(B.length)for(let S of B)E(S,w,A+1);w.pop()}let _=(0,dt.getIncomers)(m,b,T);for(let N of _)E(N,[]);return y},d=(m,b,T)=>{let y=[];function E(N,w,A=0){let P=s(N,b,T);if(P.depth=A,w.push(P),N.type==="TASK"){y.push([...w]),w.pop();return}let B=(0,dt.getOutgoers)(N,b,T);if(B.length)for(let S of B)E(S,w,A+1);w.pop()}let _=(0,dt.getOutgoers)(m,b,T);for(let N of _)E(N,[]);return y},u=(m,b,T)=>(T=T.filter(E=>E.source===m.id),T.map(E=>{var w;let _=e(E.target),N;return _&&(N=s(_,b,T)),{id:E.id,type:"routing",variant:l(E,b,T),label:(w=E.data)==null?void 0:w.label,target:N}})),p=m=>{let b=e(m);if(!b)return;let T=o(),y=n(),E=s(b,T,y);return E.sources=c(b,T,y),E.targets=d(b,T,y),E.edgeTargets=u(b,T,y),b.type==="GATEWAY"&&(E.variant=a(b,T,y)),E},f=m=>{let b=t(m);if(!b)return;let T=o(),y=n(),E=l(b,T,y),N={id:b.id,type:"routing",variant:E,gatewayVariant:void 0},w=e(b.source);if(w){let P=s(w,T,y);N.source=P;let B=a(w,T,y);if(N.gatewayVariant=B,w.type==="TASK")N.sources=[[P]];else{let S=c(w,T,y);N.sources=S.length?S:[[P]]}}let A=e(b.target);if(A){let P=s(A,T,y);if(N.target=P,A.type==="TASK")N.targets=[[P]];else{let B=d(A,T,y);N.targets=B.length?B:[[P]]}}return N},h=m=>{let b=e(m);if(b)return p(b.id);let T=t(m);if(T)return f(T.id)};return{configureElement:m=>{let b=h(m);if(b)return r([m]),b},getConfigureElement:h,getNodeConfigure:p,getEdgeConfigure:f}};var xo=require("react/jsx-runtime"),jt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Nt.useTranslation)(),{onConfigureElement:n}=K(),{getConfigureElement:r}=li();return(0,xo.jsxs)(Nt.Tooltip,{children:[(0,xo.jsx)(Nt.TooltipTrigger,{asChild:!0,children:(0,xo.jsx)(Nt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let s=r(e);s&&(n==null||n(s))},children:(0,xo.jsx)(dc.Settings,{size:16})})}),(0,xo.jsx)(Nt.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var vt=require("@produto-lecom/lecom-ui"),pc=require("@xyflow/react"),fc=require("lucide-react");var uc=require("@produto-lecom/lecom-ui");function Ke(){let{toast:e}=Jo(),{toast:t}=(0,uc.useNotificationToast)();return{toast:e||t}}var Eo=require("react/jsx-runtime"),ci=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,vt.useTranslation)(),{toast:n}=Ke(),{deleteElements:r,getNodes:i}=(0,pc.useReactFlow)();return(0,Eo.jsxs)(vt.Tooltip,{children:[(0,Eo.jsx)(vt.TooltipTrigger,{asChild:!0,children:(0,Eo.jsx)(vt.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{if(t==="node"){let a=i(),l=a.find(c=>c.id===e);if((l==null?void 0:l.type)==="LANE"&&a.some(d=>d.parentId===e)){n({variant:"error",title:o("validation.errors.title"),content:o("editor.toolbar.delete_pool_lane_error")});return}r({nodes:[{id:e}]})}else r({edges:[{id:e}]})},children:(0,Eo.jsx)(fc.TrashIcon,{size:16})})}),(0,Eo.jsx)(vt.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var wt=require("@produto-lecom/lecom-ui"),mc=require("lucide-react"),gc=require("react"),bo=require("react/jsx-runtime"),_o=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,wt.useTranslation)(),r=(0,gc.useCallback)(i=>{i.stopPropagation();let s=document.querySelectorAll(`.react-flow__handle.source[data-nodeid="${e}"]`);if(s.length===0)return;let a=Array.from(s).reduce((p,f)=>{let h=p.getBoundingClientRect(),g=f.getBoundingClientRect(),m=Math.hypot(i.clientX-(h.left+h.width/2),i.clientY-(h.top+h.height/2));return Math.hypot(i.clientX-(g.left+g.width/2),i.clientY-(g.top+g.height/2))<m?f:p}),l=a.getBoundingClientRect(),c=l.left+l.width/2,d=l.top+l.height/2,u=new MouseEvent("mousedown",{clientX:c,clientY:d,bubbles:!0,cancelable:!0});a.dispatchEvent(u)},[e]);return(0,bo.jsxs)(wt.Tooltip,{children:[(0,bo.jsx)(wt.TooltipTrigger,{asChild:!0,children:(0,bo.jsx)(wt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:t,className:t?"opacity-50 cursor-not-allowed":"",onMouseDown:t?void 0:r,children:(0,bo.jsx)(mc.MoveUpRightIcon,{size:16})})}),(0,bo.jsx)(wt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var Qo=require("react/jsx-runtime"),en=i=>{var s=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=s,r=_t(s,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:a}=K(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d}=vr(o,n),u=!l&&!c&&!d,p=[{component:(0,Qo.jsx)(ci,{elementId:e,elementType:"edge"})}],f=()=>a==="view"?u?[{component:(0,Qo.jsx)(jt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,Qo.jsx)(jt,{elementId:e,elementType:"edge"})},...p]:p,g=(m=>{switch(m){case"SEQUENCE_EDGE":return f();case"MESSAGE_EDGE":return a==="view"?[]:[...p];case"ANNOTATION_EDGE":return a==="view"?[]:[...p];default:return[]}})(t);if(!(g.length===0||a==="view"))return(0,Qo.jsx)("div",v(x({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:g.map((m,b)=>(0,Qo.jsx)("div",{children:m.component},b))}))};var hc=require("@xyflow/react"),yc=require("react");var ps=require("react/jsx-runtime"),At=12,tn=({sx:e,sy:t,tx:o,ty:n,hasLabel:r=!1,children:i})=>{let{zoom:s}=(0,hc.useViewport)(),a=1/s,l=(0,yc.useMemo)(()=>t===n?{bottom:`${At}px`,transform:"translateX(-50%)"}:e===o?{left:`${At}px`,transform:r?"translateY(-100%)":"translateY(-50%)"}:n>t&&o>e?{left:`${At}px`,bottom:`${At}px`}:n>t&&o<e?{right:`${At}px`,bottom:`${At}px`}:t>n&&o>e?{right:`${At}px`,bottom:`${At}px`}:{left:`${At}px`,bottom:`${At}px`},[e,t,o,n,r]);return(0,ps.jsx)("div",{style:{transform:`scale(${a})`},children:(0,ps.jsx)("div",{className:"absolute pointer-events-auto",style:x({},l),children:i})})};var eo=require("react/jsx-runtime"),on={type:"ANNOTATION_EDGE",reconnectable:!0},xc=({id:e,source:t,target:o,selected:n,data:r})=>{let{isMultipleSelection:i}=K(),s=(0,Gt.useInternalNode)(t),a=(0,Gt.useInternalNode)(o);if(!s||!a)return null;let{sx:l,sy:c,tx:d,ty:u}=Uo(s,a),[p,f,h]=(0,Gt.getStraightPath)({sourceX:l,sourceY:c,targetX:d,targetY:u}),g=n||(s==null?void 0:s.selected)||(a==null?void 0:a.selected);return(0,eo.jsxs)("g",{className:O("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,eo.jsx)(Gt.BaseEdge,{id:e,path:p,strokeDasharray:4,className:O("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(r!=null&&r.hasError)})}),(0,eo.jsx)(Gt.EdgeLabelRenderer,{children:(0,eo.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${f}px, ${h}px)`},children:n&&!i&&(0,eo.jsx)(tn,{sx:l,sy:c,tx:d,ty:u,children:(0,eo.jsx)(en,{edgeId:e,edgeType:"ANNOTATION_EDGE"})})})})]})};var qe=require("react"),Te=require("@xyflow/react");var gt=require("react");var ms=require("react/jsx-runtime"),fs=/[a-zA-Z0-9À-ÖØ-öø-ÿ]/,Ec=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],ze=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:s,onBlur:a,onInput:l,onInvalidFirstCharacter:c})=>{let d=(0,gt.useRef)(null),u=(0,gt.useRef)(null),[p,f]=(0,gt.useState)(!1);(0,gt.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,gt.useEffect)(()=>{f(i!=null?i:!1)},[i]),(0,gt.useEffect)(()=>{if(p&&d.current){d.current.focus();let E=document.createRange();E.selectNodeContents(d.current);let _=window.getSelection();_&&(_.removeAllRanges(),_.addRange(E))}},[p]);let h=(0,gt.useCallback)(()=>{u.current||(c==null||c(),u.current=setTimeout(()=>{u.current=null},500))},[c]),g=E=>{E.stopPropagation(),p||f(!0)},m=E=>{let _=E.currentTarget.innerText.replace(/\n$/,""),N=t&&_.length>=t,w=window.getSelection(),A=(w==null?void 0:w.toString())||"",P=A.length>0,B=(E.ctrlKey||E.metaKey)&&!E.altKey,S=B&&E.key==="a",D=B&&E.key==="c",Q=B&&E.key==="x",I=B&&E.key==="v";if((_.length===0||P&&A.length===_.length)&&!fs.test(E.key)&&!Ec.includes(E.key)&&!B){E.preventDefault(),h();return}if(E.key==="Enter"&&!E.shiftKey){E.preventDefault(),E.currentTarget.blur();return}N&&!P&&(Ec.includes(E.key)||S||D||Q||I||E.preventDefault())},b=E=>{E.preventDefault();let _=E.clipboardData.getData("text/plain").replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
- `),N=x.currentTarget.innerText.replace(/\n$/,""),A=window.getSelection();if(!A||A.rangeCount===0)return;let I=A.toString(),M=N.length-I.length,H=t?Math.max(0,t-M):1/0;if(H<=0&&I.length===0)return;let S=_;if(S.length>H&&(S=S.substring(0,H)),!S&&I.length===0)return;let w=A.getRangeAt(0);if(w.startOffset===0&&(w.startContainer===x.currentTarget||w.startContainer.parentNode===x.currentTarget)&&S.length>0&&!ds.test(S[0])){y();return}w.deleteContents();let V=document.createTextNode(S);w.insertNode(V),w.setStartAfter(V),w.collapse(!0),A.removeAllRanges(),A.addRange(w),l==null||l(x.currentTarget.innerText.replace(/\n$/,""))},T=x=>{let _=x.currentTarget,N=_.innerText.replace(/\n$/,"");if(N.length>0&&!ds.test(N[0])){let A=N.slice(1);if(_.innerText=A,A.length>0&&_.firstChild){let I=document.createRange(),M=window.getSelection();I.setStart(_.firstChild,0),I.collapse(!0),M==null||M.removeAllRanges(),M==null||M.addRange(I)}y(),l==null||l(A);return}l==null||l(N)},h=x=>{f(!1);let _=x.currentTarget.innerText.replace(/\r\n/g,`
3
+ `),N=E.currentTarget.innerText.replace(/\n$/,""),w=window.getSelection();if(!w||w.rangeCount===0)return;let A=w.toString(),P=N.length-A.length,B=t?Math.max(0,t-P):1/0;if(B<=0&&A.length===0)return;let S=_;if(S.length>B&&(S=S.substring(0,B)),!S&&A.length===0)return;let D=w.getRangeAt(0);if(D.startOffset===0&&(D.startContainer===E.currentTarget||D.startContainer.parentNode===E.currentTarget)&&S.length>0&&!fs.test(S[0])){h();return}D.deleteContents();let I=document.createTextNode(S);D.insertNode(I),D.setStartAfter(I),D.collapse(!0),w.removeAllRanges(),w.addRange(D),l==null||l(E.currentTarget.innerText.replace(/\n$/,""))},T=E=>{let _=E.currentTarget,N=_.innerText.replace(/\n$/,"");if(N.length>0&&!fs.test(N[0])){let w=N.slice(1);if(_.innerText=w,w.length>0&&_.firstChild){let A=document.createRange(),P=window.getSelection();A.setStart(_.firstChild,0),A.collapse(!0),P==null||P.removeAllRanges(),P==null||P.addRange(A)}h(),l==null||l(w);return}l==null||l(N)},y=E=>{f(!1);let _=E.currentTarget.innerText.replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
- `).trim();t&&_.length>t&&(_=_.substring(0,t)),x.currentTarget.innerText=_,a==null||a(),_!==e&&(s==null||s(_))};return(0,us.jsx)("div",{className:R("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis body-medium-400 text-center rounded-sm",{"border border-dashed border-grey-400 bg-white shadow-md":p,"bg-white":e.length>0},n),style:o,onDoubleClick:g,children:(0,us.jsx)("div",{ref:d,className:R("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":p}),contentEditable:p,suppressContentEditableWarning:!0,onKeyDown:m,onPaste:b,onInput:T,onBlur:h,children:e})})};var zn=require("@xyflow/react"),Fn=e=>e===zn.Position.Left||e===zn.Position.Right,ps=(e,t=30)=>e===zn.Position.Right||e===zn.Position.Bottom?t:-t,fs=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,li=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),ci=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Wn={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};function Hm(e,t,o,n,r,i,s=0){let a=ps(r,Wn.OFFSET),l=ps(i,Wn.OFFSET),c=Fn(r),d=Fn(i),u=c?0:s,p=c?s:0,f=d?0:s,y=d?s:0,g={x:e+u,y:t+p},m={x:o+f,y:n+y};if(c&&d){let b=(t+n)/2+s;return[g,{x:e+a,y:t+s},{x:e+a,y:b},{x:o+l,y:b},{x:o+l,y:n+s},m]}if(!c&&!d){let b=(e+o)/2+s;return[g,{x:e+s,y:t+a},{x:b,y:t+a},{x:b,y:n+l},{x:o+s,y:n+l},m]}return c?[g,{x:e+a,y:t+s},{x:e+a,y:n+l+s},{x:o+s,y:n+l+s},m]:[g,{x:e+s,y:t+a},{x:o+l+s,y:t+a},{x:o+l+s,y:n+s},m]}function di(e,t,o,n,r,i,s,a=0){let l=Hm(e,t,o,n,r,i,a);if(!(s!=null&&s.length))return l;let c=[...s];if(c.length>0){let d={x:e,y:t},u=c[0],p=Fn(r);p&&Math.abs(d.y-u.y)>1?c.unshift({x:u.x,y:d.y}):!p&&Math.abs(d.x-u.x)>1&&c.unshift({x:d.x,y:u.y})}if(c.length>0){let d={x:o,y:n},u=c[c.length-1],p=Fn(i);p&&Math.abs(d.y-u.y)>1?c.push({x:u.x,y:d.y}):!p&&Math.abs(d.x-u.x)>1&&c.push({x:d.x,y:u.y})}return[{x:e,y:t},...c,{x:o,y:n}]}var hc=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Gm(e,t,o,n){let r=Math.min(hc(e,t)/2,hc(t,o)/2,n),{x:i,y:s}=t;if(e.x===i&&i===o.x||e.y===s&&s===o.y)return`L${i} ${s}`;if(e.y===s){let c=e.x<o.x?-1:1,d=e.y<o.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}let a=e.x<o.x?1:-1,l=e.y<o.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}var yc=(e,t=5)=>e.length<2?"":e.reduce((o,n,r)=>{let i="";return r>0&&r<e.length-1?i=Gm(e[r-1],n,e[r+1],t):i=`${r===0?"M":"L"}${n.x} ${n.y}`,o+=i,o},"");var he=require("react"),ui=require("@xyflow/react");var Bm=50,xc=.1,zm=.6,pi=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:s,getNodes:a,getEdge:l,screenToFlowPosition:c}=(0,ui.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=q(),p=(0,ui.useStore)(C=>C.isValidConnection),[f,y]=(0,he.useState)(null),[g,m]=(0,he.useState)(null),[b,T]=(0,he.useState)(null),[h,x]=(0,he.useState)(null),[_,N]=(0,he.useState)(null),[A,I]=(0,he.useState)(!1),M=(0,he.useRef)(null),H=(0,he.useRef)(null),S=(0,he.useRef)(null),w=(0,he.useRef)(t),k=(0,he.useRef)(o);(0,he.useEffect)(()=>{w.current=t,k.current=o},[t,o]),(0,he.useEffect)(()=>{M.current=f},[f]),(0,he.useEffect)(()=>{H.current=_},[_]);let V=(0,he.useCallback)(C=>{let O=a(),D=O.find(oe=>oe.id===C);if(!D)return{x:0,y:0};let G=D.position.x,Y=D.position.y,F=D.parentId;for(;F;){let oe=O.find(B=>B.id===F);if(!oe)break;G+=oe.position.x,Y+=oe.position.y,F=oe.parentId}return{x:G,y:Y}},[a]),P=(0,he.useCallback)(C=>{var F,oe,B,X,J,U;let O=a(),D=null,G=Bm,Y=O.filter(K=>K.type!=="LANE"&&K.type!=="ANNOTATION");for(let K of Y){if(K.id===e)continue;let $=V(K.id),Z=(B=(oe=(F=K.measured)==null?void 0:F.width)!=null?oe:K.width)!=null?B:0,j=(U=(J=(X=K.measured)==null?void 0:X.height)!=null?J:K.height)!=null?U:0;if(C.x>=$.x&&C.x<=$.x+Z&&C.y>=$.y&&C.y<=$.y+j)return K.id;let fe=Math.max($.x-C.x,0,C.x-($.x+Z)),re=Math.max($.y-C.y,0,C.y-($.y+j)),_e=Math.sqrt(fe*fe+re*re);_e<G&&(G=_e,D=K.id)}return D},[a,V,e]),L=(0,he.useCallback)((C,O)=>{var fe,re,_e,Se,Me,xe;let D=s(C);if(!D)return null;let G=V(C),Y=(_e=(re=(fe=D.measured)==null?void 0:fe.width)!=null?re:D.width)!=null?_e:0,F=(xe=(Me=(Se=D.measured)==null?void 0:Se.height)!=null?Me:D.height)!=null?xe:0,oe=Math.abs(G.x+Y-O.x),B=Math.abs(O.x-G.x),X=Math.abs(G.y+F-O.y),J=Math.abs(O.y-G.y),U={right:oe,left:B,bottom:X,top:J},K=Object.entries(U).reduce((ce,[ie,He])=>He<ce[1]?[ie,He]:ce,["right",U.right])[0],$=S.current;if($&&$!==K){let ce=U[K],ie=U[$],He=Math.abs(ie-ce),Qe=Math.min(Math.abs(ie),Math.abs(ce));He<Qe*zm&&(K=$)}let Z=K,j,le;if(Z==="right"||Z==="left"){let ie=(Math.max(G.y,Math.min(G.y+F,O.y))-G.y)/(F||1);Math.abs(ie-.5)<xc&&(ie=.5),le=ie,j={x:Z==="right"?G.x+Y:G.x,y:G.y+le*F}}else{let ie=(Math.max(G.x,Math.min(G.x+Y,O.x))-G.x)/(Y||1);Math.abs(ie-.5)<xc&&(ie=.5),le=ie,j={x:G.x+le*Y,y:Z==="bottom"?G.y+F:G.y}}return{side:Z,snapPosition:j,offset:le}},[s,V]),W=(0,he.useCallback)(C=>{var B,X,J;let O=M.current;if(!O)return;let D=c({x:C.clientX,y:C.clientY}),G=P(D);T(G);let Y=D,F=null,oe=null;if(G){let U=L(G,D);U&&(F=U.side,Y=U.snapPosition,oe=U.offset,S.current=F);let K=l(e),$={source:O==="source"?G:w.current,target:O==="target"?G:k.current,sourceHandle:O==="source"?F:(B=K==null?void 0:K.sourceHandle)!=null?B:null,targetHandle:O==="target"?F:(X=K==null?void 0:K.targetHandle)!=null?X:null},Z=(J=p==null?void 0:p($))!=null?J:!0;I(Z)}else S.current=null,I(!1);x(F),N(oe),m(Y)},[P,L,l,e,c,p]),Q=(0,he.useCallback)(C=>{var F,oe,B,X,J;let O=M.current;if(!O)return;let D=c({x:C.clientX,y:C.clientY}),G=P(D);if(G){let U=L(G,D),K=(F=U==null?void 0:U.side)!=null?F:null,$=(oe=U==null?void 0:U.offset)!=null?oe:.5,Z=l(e),j={source:O==="source"?G:w.current,target:O==="target"?G:k.current,sourceHandle:O==="source"?K:(B=Z==null?void 0:Z.sourceHandle)!=null?B:null,targetHandle:O==="target"?K:(X=Z==null?void 0:Z.targetHandle)!=null?X:null};((J=p==null?void 0:p(j))==null||J)&&i(le=>le.map(fe=>{var re,_e;return fe.id===e?v(E({},fe),{source:j.source,target:j.target,sourceHandle:j.sourceHandle,targetHandle:j.targetHandle,data:v(E({},fe.data),{points:void 0,sourceOffset:O==="source"?$:(re=fe.data)==null?void 0:re.sourceOffset,targetOffset:O==="target"?$:(_e=fe.data)==null?void 0:_e.targetOffset})}):fe}))}y(null),m(null),T(null),x(null),N(null),d(!1),I(!1),u(null),S.current=null,document.removeEventListener("mouseup",Q),document.removeEventListener("mousemove",W);let Y=It.get(n);Y==null||Y.clearReconnectingEdge()},[e,P,L,l,i,n,W,p,c,d,u]),z=(0,he.useCallback)((C,O)=>{if(r||O.button!==0)return;O.stopPropagation(),O.preventDefault(),i(G=>G.map(Y=>Y.id===e?v(E({},Y),{data:v(E({},Y.data),{points:void 0})}):Y)),y(C),u(e);let D=It.get(n);D==null||D.setReconnectingEdge(e),document.addEventListener("mousemove",W),document.addEventListener("mouseup",Q)},[r,e,n,W,Q,u,i]);return(0,he.useEffect)(()=>()=>{if(M.current){document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Q),u(null);let C=It.get(n);C==null||C.clearReconnectingEdge()}},[n,W,Q,u]),{reconnectingHandle:f,cursorPosition:g,hoveredNodeId:b,reconnectingSide:h,reconnectingOffset:_,isValidReconnection:A,handleReconnectStart:z}};var de=require("react/jsx-runtime"),ut={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:Te.MarkerType.ArrowClosed},markerEnd:{type:Te.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:fi,MIN_SEGMENT_LENGTH:Fm,PARALLEL_OFFSET:Ec}=Wn;function Wm(e,t,o,n){let r=n.filter(a=>a.source===t&&a.target===o||a.source===o&&a.target===t);if(r.length<=1){let a=n.filter(d=>d.source===t);if(a.length<=1)return 0;let l=a.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(a.length-1)/2;return(l-c)*Ec}let i=r.findIndex(a=>a.id===e),s=(r.length-1)/2;return(i-s)*Ec}var bc=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:s,sourceHandleId:a,targetHandleId:l})=>{var F,oe;let{zoom:c}=(0,Te.useViewport)(),{updateEdgeData:d}=(0,Te.useReactFlow)(),u=(0,Te.useEdges)(),{isMultipleSelection:p,mode:f,instanceId:y}=q(),[g,m]=(0,Ke.useState)(!1),[b,T]=(0,Ke.useState)(null),h=(0,Ke.useRef)(null),x=(0,Ke.useRef)(null),_=f!=="edit",{reconnectingHandle:N,cursorPosition:A,hoveredNodeId:I,reconnectingSide:M,isValidReconnection:H,handleReconnectStart:S}=pi({edgeId:e,source:t,target:o,instanceId:y,isReadOnly:_}),w=(0,Te.useInternalNode)(t),k=(0,Te.useInternalNode)(o),{sx:V,sy:P,tx:L,ty:W,sourcePos:Q,targetPos:z}=(0,Ke.useMemo)(()=>{var re,_e;let B=w&&k?Uo(w,k):{sx:0,sy:0,tx:0,ty:0,sourcePos:Te.Position.Right,targetPos:Te.Position.Left},X=a?i:B.sourcePos,J=l?s:B.targetPos,U=(Se,Me,xe)=>{var Ft,ko,Re,De,bt,Ro;let{x:ce,y:ie}=Se.internals.positionAbsolute,He=(Re=(ko=(Ft=Se.measured)==null?void 0:Ft.width)!=null?ko:Se.width)!=null?Re:0,Qe=(Ro=(bt=(De=Se.measured)==null?void 0:De.height)!=null?bt:Se.height)!=null?Ro:0;switch(Me){case Te.Position.Top:return{x:ce+He*xe,y:ie};case Te.Position.Bottom:return{x:ce+He*xe,y:ie+Qe};case Te.Position.Left:return{x:ce,y:ie+Qe*xe};case Te.Position.Right:return{x:ce+He,y:ie+Qe*xe};default:return{x:ce+He/2,y:ie+Qe/2}}},K=(re=n==null?void 0:n.sourceOffset)!=null?re:.5,$=(_e=n==null?void 0:n.targetOffset)!=null?_e:.5,Z=w?U(w,X,K).x:B.sx,j=w?U(w,X,K).y:B.sy,le=k?U(k,J,$).x:B.tx,fe=k?U(k,J,$).y:B.ty;return N==="source"&&A?(Z=A.x,j=A.y,M&&(X=M)):N==="target"&&A&&(le=A.x,fe=A.y,M&&(J=M)),{sx:Z,sy:j,tx:le,ty:fe,sourcePos:X,targetPos:J}},[w,k,a,l,i,s,N,A,M,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,Ke.useEffect)(()=>{var J;if(!x.current){x.current={sx:V,sy:P,tx:L,ty:W,sourcePos:Q,targetPos:z};return}let B=x.current;(Math.abs(V-B.sx)>fi||Math.abs(P-B.sy)>fi||Math.abs(L-B.tx)>fi||Math.abs(W-B.ty)>fi||B.sourcePos!==Q||B.targetPos!==z)&&((J=n==null?void 0:n.points)!=null&&J.length)&&!N&&d(e,v(E({},n),{points:void 0})),x.current={sx:V,sy:P,tx:L,ty:W,sourcePos:Q,targetPos:z}},[V,P,L,W,Q,z,n,e,d,N]);let C=(0,Ke.useMemo)(()=>{let B=Wm(e,t,o,u);return di(V,P,L,W,Q,z,n==null?void 0:n.points,B)},[V,P,L,W,Q,z,n==null?void 0:n.points,u,e,t,o]),O=(0,Ke.useMemo)(()=>{if(C.length<2)return ci({x:V,y:P},{x:L,y:W});let B=0;for(let U=0;U<C.length-1;U++)B+=li(C[U],C[U+1]);let X=B/2,J=0;for(let U=0;U<C.length-1;U++){let K=li(C[U],C[U+1]);if(J+K>=X){let $=(X-J)/K,Z=C[U],j=C[U+1];return{x:Z.x+(j.x-Z.x)*$,y:Z.y+(j.y-Z.y)*$}}J+=K}return ci({x:V,y:P},{x:L,y:W})},[C,V,P,L,W]),D=(0,Ke.useCallback)((B,X)=>{if(f!=="edit"||X.button!==0)return;X.stopPropagation(),X.preventDefault();let J=C[B],U=C[B+1],K=fs(J,U,"y"),$=K?J.y:J.x,Z=[...C],j=Z.length,le=B,fe=B+1;T(B);let re=Se=>{let Me=$+(K?Se.clientY-X.clientY:Se.clientX-X.clientX)/c;h.current=K?{x:(J.x+U.x)/2,y:Me}:{x:Me,y:(J.y+U.y)/2};let xe=[];for(let ce=1;ce<j-1;ce++){let ie=Z[ce];ce===le||ce===fe?K?xe.push({x:ie.x,y:Me}):xe.push({x:Me,y:ie.y}):xe.push(E({},ie))}d(e,v(E({},n),{points:xe}))},_e=()=>{T(null),h.current=null,document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",_e)};document.addEventListener("mousemove",re),document.addEventListener("mouseup",_e)},[f,C,c,n,e,d]);if(!w||!k)return null;let G=yc(C),Y=r||w.selected||k.selected;return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":Y}),onDoubleClick:()=>m(!0),children:[(0,de.jsx)(Te.BaseEdge,{id:e,path:G,markerEnd:`url(#${Y?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||N&&I&&!H,"stroke-green-500":N&&I&&H,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":Y&&!(n!=null&&n.hasError)&&!N})}),r&&!p&&!_&&(0,de.jsx)("g",{children:C.slice(0,-1).map((B,X)=>{let J=C[X+1];if(X===0||X===C.length-2||li(B,J)<Fm)return null;let U=fs(B,J,"y"),K=b===X,$=K&&h.current?h.current:ci(B,J);return(0,de.jsxs)("g",{children:[(0,de.jsx)("line",{x1:B.x,y1:B.y,x2:J.x,y2:J.y,stroke:"transparent",strokeWidth:20/c,className:R("cursor-pointer",{"cursor-ns-resize":U,"cursor-ew-resize":!U}),onMouseDown:Z=>D(X,Z)}),(0,de.jsx)("circle",{cx:$.x,cy:$.y,r:4/c,fill:K?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:$.x,cy:$.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:K?.6:.3,className:"pointer-events-none"})]},X)})})]}),(0,de.jsxs)(Te.EdgeLabelRenderer,{children:[(0,de.jsxs)("div",{className:"absolute z-[3000] pointer-events-none flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${O.x}px, ${O.y}px)`},children:[r&&!p&&(0,de.jsx)(tn,{sx:V,sy:P,tx:L,ty:W,hasLabel:!!((F=n==null?void 0:n.label)!=null&&F.trim()),children:(0,de.jsx)(en,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:w,targetNode:k})}),(g||((oe=n==null?void 0:n.label)==null?void 0:oe.trim()))&&(0,de.jsx)(ze,{value:n==null?void 0:n.label,className:R("min-w-8 max-w-56 px-2 py-1 body-small-400",{"pointer-events-auto":g,"pointer-events-none":!g}),isEditing:g,onBlur:()=>m(!1),onChange:B=>d(e,{label:B.trim()})})]}),r&&!p&&!_&&(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${C[0].x}px, ${C[0].y}px)`},children:(0,de.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:N==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:N==="source"?.6:.3,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!N||N!=="source","cursor-not-allowed":N==="source"&&I&&!H,"cursor-grabbing":N==="source"&&(!I||H)}),onMouseDown:B=>S("source",B.nativeEvent)})]})}),(0,de.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${C[C.length-1].x}px, ${C[C.length-1].y}px)`},children:(0,de.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:N==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:N==="target"?.6:.3,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!N||N!=="target","cursor-not-allowed":N==="target"&&I&&!H,"cursor-grabbing":N==="target"&&(!I||H)}),onMouseDown:B=>S("target",B.nativeEvent)})]})})]})]})]})};var Ct=require("@xyflow/react"),Ym={right:Ct.Position.Right,left:Ct.Position.Left,top:Ct.Position.Top,bottom:Ct.Position.Bottom},mi=e=>{var t;return(t=Ym[e!=null?e:""])!=null?t:Ct.Position.Right},ms=(e,t,o=.5)=>{var l,c,d,u;let{x:n,y:r}=e.internals.positionAbsolute,i=(c=(l=e.measured)==null?void 0:l.width)!=null?c:0,s=(u=(d=e.measured)==null?void 0:d.height)!=null?u:0;switch(mi(t)){case Ct.Position.Right:return{x:n+i,y:r+s*o};case Ct.Position.Left:return{x:n,y:r+s*o};case Ct.Position.Top:return{x:n+i*o,y:r};case Ct.Position.Bottom:return{x:n+i*o,y:r+s};default:return{x:n+i/2,y:r+s/2}}},_c=(e,t,o)=>{var d,u;let{position:{x:n,y:r},measured:i}=e,s=(d=i.width)!=null?d:0,a=(u=i.height)!=null?u:0;return[{id:"left",x:n,y:r+a/2},{id:"right",x:n+s,y:r+a/2},{id:"top",x:n+s/2,y:r},{id:"bottom",x:n+s/2,y:r+a}].reduce((p,f)=>{let y=Math.hypot(t-p.x,o-p.y);return Math.hypot(t-f.x,o-f.y)<y?f:p}).id};var Ld=require("use-debounce");var Pd=require("@xyflow/react"),Ts=require("react");var Yn=(d=>(d.START_EVENT="start-event",d.END_EVENT_TERMINATE="end-event-terminate",d.TASK="task",d.TASK_SCRIPT="task-script",d.SUBPROCESS="subprocess-collapsed",d.GATEWAY_EXCLUSIVE="gateway-exclusive",d.GATEWAY_PARALLEL="gateway-parallel",d.GATEWAY_COMPLEX="gateway-complex",d.ANNOTATION="annotation",d.LANE="lane",d))(Yn||{});var gi=require("xml-js");var Tc={compact:!0,spaces:4},Um=e=>e.replace(/\n/g,"&#xA;");function hi(e,t=Tc){if(e)return JSON.parse((0,gi.xml2json)(e,t))}function Nc(e,t=Tc){return e?(0,gi.json2xml)(e,v(E({},t),{attributeValueFn:Um})):""}var $m={MIN_WIDTH:36,MIN_HEIGHT:36},Xm={MIN_WIDTH:36,MIN_HEIGHT:36},Km={MIN_WIDTH:56,MIN_HEIGHT:56},nn={MIN_WIDTH:176,MIN_HEIGHT:96},yi={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},ve={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},xi={MIN_WIDTH:176,MIN_HEIGHT:64},qm={MIN_WIDTH:128,MIN_HEIGHT:64},te={START_EVENT:$m,END_EVENT:Xm,GATEWAY:Km,TASK:nn,LANE:ve,ANNOTATION:xi,UNSUPPORTED:qm};var vc={"attribute-loop":"LOOP"},wc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Ac={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Ic={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Cc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var rn=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=Yt(Number(n),t),s=Yt(Number(r),o);return{width:i,height:s,measured:{width:i,height:s}}},sn=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,s={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},a={id:n,position:s,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(a.parentId=l),a},Jm=e=>{let{mxGeometry:t}=e,o=sn(e),n=rn(t,te.START_EVENT.MIN_WIDTH,te.START_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"START_EVENT"})},Qm=e=>{let{mxGeometry:t}=e,o=sn(e),n=rn(t,te.END_EVENT.MIN_WIDTH,te.END_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"END_EVENT"})},gs=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=sn(e),i=rn(n,te.TASK.MIN_WIDTH,te.TASK.MIN_HEIGHT),s=t==null?void 0:t.find(l=>{let{parent:c}=l._attributes;return c===e._attributes.id});if(s){let{style:l}=s._attributes,c=vc[l];c&&(r.data.attribute=c)}let a=wc[o.style];return a&&(r.data.variant=a),v(E(E({},r),i),{type:"TASK"})},hs=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=sn(e),i=rn(o,te.GATEWAY.MIN_WIDTH,te.GATEWAY.MIN_HEIGHT);return r.data.variant=Ac[n],v(E(E({},r),i),{type:"GATEWAY"})},jm=e=>{let{mxGeometry:t}=e,o=sn(e),n=rn(t,te.ANNOTATION.MIN_WIDTH,te.ANNOTATION.MIN_HEIGHT);return v(E(E({},o),n),{type:"ANNOTATION"})},eg=e=>{let{mxGeometry:t}=e,o=sn(e),n=rn(t,te.LANE.MIN_WIDTH,te.LANE.MIN_HEIGHT);return v(E(E({},o),n),{type:"LANE"})},Sc={task:gs,"task-script":gs,"subprocess-collapsed":gs,"start-event":Jm,"end-event-terminate":Qm,"gateway-parallel":hs,"gateway-exclusive":hs,"gateway-complex":hs,annotation:jm,lane:eg},tg=e=>{if(e&&Array.isArray(e))return e.map(t=>({x:Number(t._attributes.x),y:Number(t._attributes.y)}))},Mc=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:s,style:a,sourceHandle:l,targetHandle:c,sourceOffset:d,targetOffset:u}=t,p=tg(o==null?void 0:o.Array),f=d!==void 0?Number(d):void 0,y=u!==void 0?Number(u):void 0,g=v(E(E({id:n,source:r,target:i},l?{sourceHandle:l}:{}),c?{targetHandle:c}:{}),{data:E(E(E({label:s||""},p&&p.length>0?{points:p}:{}),f!==void 0?{sourceOffset:f}:{}),y!==void 0?{targetOffset:y}:{})});return a.includes("association")&&a.includes('endArrow=""')?E(E({},on),g):E(E({},ut),g)},Pc=(e,t)=>{let{id:o,type:n,source:r,target:i,sourceHandle:s,targetHandle:a,data:l}=e,c=t==null?void 0:t.find(f=>f.id===r),d="";n==="ANNOTATION_EDGE"&&(d='association;endArrow=""');let u={_attributes:{as:"geometry",relative:"1"}};return l!=null&&l.points&&Array.isArray(l.points)&&l.points.length>0&&(u.Array=l.points.map(f=>({_attributes:{as:"mxPoint",x:f.x,y:f.y}}))),{_attributes:{id:o,parent:(c==null?void 0:c.parentId)||"1",edge:"1",style:d,source:r,target:i,value:(l==null?void 0:l.label)||"",sourceHandle:s!=null?s:void 0,targetHandle:a!=null?a:void 0,sourceOffset:(l==null?void 0:l.sourceOffset)!==void 0?String(l.sourceOffset):void 0,targetOffset:(l==null?void 0:l.targetOffset)!==void 0?String(l.targetOffset):void 0},mxGeometry:u}},an=e=>{let{id:t,parentId:o,position:n,measured:r,data:i}=e;return{_attributes:{id:t,parent:o||"1",value:i.label,vertex:"1"},mxGeometry:{_attributes:{as:"geometry",width:(r==null?void 0:r.width)||0,height:(r==null?void 0:r.height)||0,x:n.x||0,y:n.y||0}}}},og=e=>{let{variant:t}=e.data,o=an(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Ic[t]||"task"})})},ng=e=>{let t=an(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"start-event"})})},rg=e=>{let t=an(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"end-event-terminate"})})},ig=e=>{let{variant:t}=e.data,o=an(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Cc[t]})})},sg=e=>{let t=an(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"lane"})})},ag=e=>{let t=an(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"annotation"})})},Lc={TASK:og,START_EVENT:ng,END_EVENT:rg,GATEWAY:ig,ANNOTATION:ag,LANE:sg},kc=(e,t)=>{var s,a;let r=((s=e.measured)==null?void 0:s.width)||0,i=((a=e.measured)==null?void 0:a.height)||0;return{_attributes:{id:`${t+1}`,parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:r/2-22/2,y:i-22,width:22,height:22}}}};var ys=yp(require("@dagrejs/dagre"),1),Vc=require("@xyflow/react");var Hc=require("lodash");var Rc=require("lodash");var Bt=e=>{var t,o,n,r,i,s,a,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(i=e.measured)==null?void 0:i.width)!=null?s:0,h:(l=(a=e.measured)==null?void 0:a.height)!=null?l:0}},To=e=>(0,Rc.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Dc=(e,t)=>{let{x:o,y:n}=Bt(e),{x:r,y:i}=Bt(t);return{x:o-r,y:n-i}};var ln=({parentId:e,nodes:t,includeTypes:o=[...Object.values(ee)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),lg=(e,t)=>{let{x:o,y:n}=Bt(e),{x:r,y:i}=Bt(t),s=o-r,a=n-i;return Math.sqrt(s*s+a*a)},cg=(e,t)=>{let{x:o,y:n,w:r,h:i}=Bt(e),{x:s,y:a,w:l,h:c}=Bt(t);return o<s+l&&s<o+r&&n<a+c&&a<n+i},Un=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&cg(e,r)){let i=lg(e,r);i<n&&(n=i,o=r)}return o},Oc=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0);var Gc=(e=[],t=[],o="LR")=>{let n=new ys.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:s,height:a})=>n.setNode(i,{width:s,height:a})),t.forEach(i=>n.setEdge(i.source,i.target)),ys.default.layout(n),{nodes:e.map(i=>{let s=n.node(i.id);return v(E({},i),{position:{x:s.x-i.width/2,y:s.y-i.height/2}})}),edges:t}},$n=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Xn(n.id,o)}),o},Xn=(e,t)=>{var f,y;let o=[...t],n=o.find(g=>g.id===e);if(!n)return o;let r=o.filter(g=>g.parentId===e&&g.type==="LANE");if(r.length===0)return o;let i=(0,Hc.orderBy)(r,["position.y"]),s=Math.max((y=(f=n.measured)==null?void 0:f.width)!=null?y:0,yi.MIN_WIDTH),a=Oc(e,i)||ve.MIN_WIDTH,l=Math.max(s,a),c=s-ve.HEADER_WIDTH>=a,d=0,u=0;i.forEach(g=>{var m,b,T,h;o=o.map(x=>x.id===g.id?v(E({},x),{width:c?l-ve.HEADER_WIDTH:l,measured:v(E({},x.measured),{width:c?l-ve.HEADER_WIDTH:l}),position:{x:ve.HEADER_WIDTH,y:d}}):x),d+=(b=(m=g.measured)==null?void 0:m.height)!=null?b:0,u+=(h=(T=g.measured)==null?void 0:T.height)!=null?h:0}),o=o.map(g=>g.id===e?v(E({},g),{height:u,width:c?l:l+ve.HEADER_WIDTH,measured:v(E({},g.measured),{height:u,width:c?l:l+ve.HEADER_WIDTH})}):g);let p=o.find(g=>g.id===e);return p!=null&&p.parentId&&(o=Xn(p.parentId,o)),o},Bc=(e,t,o)=>{if(e.type==="LANE")return o;let n=Ht(t),r=Ht(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+ve.HEADER_WIDTH&&(e.position.x=ve.HEADER_WIDTH),r.y2>n.y2&&(t.height=r.y2-n.y,t.measured.height=r.y2-n.y),r.x2>n.x2&&(t.width=r.x2-n.x,t.measured.width=r.x2-n.x),o=o.map(i=>i.id===t.id?v(E({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?v(E({},i),{position:e.position}):i),o},zc=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},dg=50,Fc=(e,t=dg)=>{let o=(0,Vc.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Kn=1,Wc=e=>`<mxGraphModel>
5
+ `).trim();t&&_.length>t&&(_=_.substring(0,t)),E.currentTarget.innerText=_,a==null||a(),_!==e&&(s==null||s(_))};return(0,ms.jsx)("div",{className:O("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis body-medium-400 text-center rounded-sm",{"border border-dashed border-grey-400 bg-white shadow-md":p,"bg-white":e.length>0},n),style:o,onDoubleClick:g,children:(0,ms.jsx)("div",{ref:d,className:O("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":p}),contentEditable:p,suppressContentEditableWarning:!0,onKeyDown:m,onPaste:b,onInput:T,onBlur:y,children:e})})};var Wn=require("@xyflow/react"),Yn=e=>e===Wn.Position.Left||e===Wn.Position.Right,gs=(e,t=30)=>e===Wn.Position.Right||e===Wn.Position.Bottom?t:-t,hs=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,di=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),ui=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Un={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};function Fm(e,t,o,n,r,i,s=0){let a=gs(r,Un.OFFSET),l=gs(i,Un.OFFSET),c=Yn(r),d=Yn(i),u=c?0:s,p=c?s:0,f=d?0:s,h=d?s:0,g={x:e+u,y:t+p},m={x:o+f,y:n+h};if(c&&d){let b=(t+n)/2+s;return[g,{x:e+a,y:t+s},{x:e+a,y:b},{x:o+l,y:b},{x:o+l,y:n+s},m]}if(!c&&!d){let b=(e+o)/2+s;return[g,{x:e+s,y:t+a},{x:b,y:t+a},{x:b,y:n+l},{x:o+s,y:n+l},m]}return c?[g,{x:e+a,y:t+s},{x:e+a,y:n+l+s},{x:o+s,y:n+l+s},m]:[g,{x:e+s,y:t+a},{x:o+l+s,y:t+a},{x:o+l+s,y:n+s},m]}function pi(e,t,o,n,r,i,s,a=0){let l=Fm(e,t,o,n,r,i,a);if(!(s!=null&&s.length))return l;let c=[...s];if(c.length>0){let d={x:e,y:t},u=c[0],p=Yn(r);p&&Math.abs(d.y-u.y)>1?c.unshift({x:u.x,y:d.y}):!p&&Math.abs(d.x-u.x)>1&&c.unshift({x:d.x,y:u.y})}if(c.length>0){let d={x:o,y:n},u=c[c.length-1],p=Yn(i);p&&Math.abs(d.y-u.y)>1?c.push({x:u.x,y:d.y}):!p&&Math.abs(d.x-u.x)>1&&c.push({x:d.x,y:u.y})}return[{x:e,y:t},...c,{x:o,y:n}]}var bc=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wm(e,t,o,n){let r=Math.min(bc(e,t)/2,bc(t,o)/2,n),{x:i,y:s}=t;if(e.x===i&&i===o.x||e.y===s&&s===o.y)return`L${i} ${s}`;if(e.y===s){let c=e.x<o.x?-1:1,d=e.y<o.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}let a=e.x<o.x?1:-1,l=e.y<o.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}var _c=(e,t=5)=>e.length<2?"":e.reduce((o,n,r)=>{let i="";return r>0&&r<e.length-1?i=Wm(e[r-1],n,e[r+1],t):i=`${r===0?"M":"L"}${n.x} ${n.y}`,o+=i,o},"");var ye=require("react"),fi=require("@xyflow/react");var Ym=50,Tc=.1,Um=.6,mi=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:s,getNodes:a,getEdge:l,screenToFlowPosition:c}=(0,fi.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=K(),p=(0,fi.useStore)(C=>C.isValidConnection),[f,h]=(0,ye.useState)(null),[g,m]=(0,ye.useState)(null),[b,T]=(0,ye.useState)(null),[y,E]=(0,ye.useState)(null),[_,N]=(0,ye.useState)(null),[w,A]=(0,ye.useState)(!1),P=(0,ye.useRef)(null),B=(0,ye.useRef)(null),S=(0,ye.useRef)(null),D=(0,ye.useRef)(t),Q=(0,ye.useRef)(o);(0,ye.useEffect)(()=>{D.current=t,Q.current=o},[t,o]),(0,ye.useEffect)(()=>{P.current=f},[f]),(0,ye.useEffect)(()=>{B.current=_},[_]);let I=(0,ye.useCallback)(C=>{let H=a(),F=H.find(te=>te.id===C);if(!F)return{x:0,y:0};let V=F.position.x,G=F.position.y,W=F.parentId;for(;W;){let te=H.find(k=>k.id===W);if(!te)break;V+=te.position.x,G+=te.position.y,W=te.parentId}return{x:V,y:G}},[a]),R=(0,ye.useCallback)(C=>{var W,te,k,X,J,Y;let H=a(),F=null,V=Ym,G=H.filter($=>$.type!=="LANE"&&$.type!=="ANNOTATION");for(let $ of G){if($.id===e)continue;let U=I($.id),Z=(k=(te=(W=$.measured)==null?void 0:W.width)!=null?te:$.width)!=null?k:0,j=(Y=(J=(X=$.measured)==null?void 0:X.height)!=null?J:$.height)!=null?Y:0;if(C.x>=U.x&&C.x<=U.x+Z&&C.y>=U.y&&C.y<=U.y+j)return $.id;let ce=Math.max(U.x-C.x,0,C.x-(U.x+Z)),fe=Math.max(U.y-C.y,0,C.y-(U.y+j)),me=Math.sqrt(ce*ce+fe*fe);me<V&&(V=me,F=$.id)}return F},[a,I,e]),L=(0,ye.useCallback)((C,H)=>{var ce,fe,me,Se,Me,_e;let F=s(C);if(!F)return null;let V=I(C),G=(me=(fe=(ce=F.measured)==null?void 0:ce.width)!=null?fe:F.width)!=null?me:0,W=(_e=(Me=(Se=F.measured)==null?void 0:Se.height)!=null?Me:F.height)!=null?_e:0,te=Math.abs(V.x+G-H.x),k=Math.abs(H.x-V.x),X=Math.abs(V.y+W-H.y),J=Math.abs(H.y-V.y),Y={right:te,left:k,bottom:X,top:J},$=Object.entries(Y).reduce((ae,[re,Ve])=>Ve<ae[1]?[re,Ve]:ae,["right",Y.right])[0],U=S.current;if(U&&U!==$){let ae=Y[$],re=Y[U],Ve=Math.abs(re-ae),Ue=Math.min(Math.abs(re),Math.abs(ae));Ve<Ue*Um&&($=U)}let Z=$,j,le;if(Z==="right"||Z==="left"){let re=(Math.max(V.y,Math.min(V.y+W,H.y))-V.y)/(W||1);Math.abs(re-.5)<Tc&&(re=.5),le=re,j={x:Z==="right"?V.x+G:V.x,y:V.y+le*W}}else{let re=(Math.max(V.x,Math.min(V.x+G,H.x))-V.x)/(G||1);Math.abs(re-.5)<Tc&&(re=.5),le=re,j={x:V.x+le*G,y:Z==="bottom"?V.y+W:V.y}}return{side:Z,snapPosition:j,offset:le}},[s,I]),M=(0,ye.useCallback)(C=>{var k,X,J;let H=P.current;if(!H)return;let F=c({x:C.clientX,y:C.clientY}),V=R(F);T(V);let G=F,W=null,te=null;if(V){let Y=L(V,F);Y&&(W=Y.side,G=Y.snapPosition,te=Y.offset,S.current=W);let $=l(e),U={source:H==="source"?V:D.current,target:H==="target"?V:Q.current,sourceHandle:H==="source"?W:(k=$==null?void 0:$.sourceHandle)!=null?k:null,targetHandle:H==="target"?W:(X=$==null?void 0:$.targetHandle)!=null?X:null},Z=(J=p==null?void 0:p(U))!=null?J:!0;A(Z)}else S.current=null,A(!1);E(W),N(te),m(G)},[R,L,l,e,c,p]),q=(0,ye.useCallback)(C=>{var W,te,k,X,J;let H=P.current;if(!H)return;let F=c({x:C.clientX,y:C.clientY}),V=R(F);if(V){let Y=L(V,F),$=(W=Y==null?void 0:Y.side)!=null?W:null,U=(te=Y==null?void 0:Y.offset)!=null?te:.5,Z=l(e),j={source:H==="source"?V:D.current,target:H==="target"?V:Q.current,sourceHandle:H==="source"?$:(k=Z==null?void 0:Z.sourceHandle)!=null?k:null,targetHandle:H==="target"?$:(X=Z==null?void 0:Z.targetHandle)!=null?X:null};((J=p==null?void 0:p(j))==null||J)&&i(le=>le.map(ce=>{var fe,me;return ce.id===e?v(x({},ce),{source:j.source,target:j.target,sourceHandle:j.sourceHandle,targetHandle:j.targetHandle,data:v(x({},ce.data),{points:void 0,sourceOffset:H==="source"?U:(fe=ce.data)==null?void 0:fe.sourceOffset,targetOffset:H==="target"?U:(me=ce.data)==null?void 0:me.targetOffset})}):ce}))}h(null),m(null),T(null),E(null),N(null),d(!1),A(!1),u(null),S.current=null,document.removeEventListener("mouseup",q),document.removeEventListener("mousemove",M);let G=It.get(n);G==null||G.clearReconnectingEdge()},[e,R,L,l,i,n,M,p,c,d,u]),z=(0,ye.useCallback)((C,H)=>{if(r||H.button!==0)return;H.stopPropagation(),H.preventDefault(),i(V=>V.map(G=>G.id===e?v(x({},G),{data:v(x({},G.data),{points:void 0})}):G)),h(C),u(e);let F=It.get(n);F==null||F.setReconnectingEdge(e),document.addEventListener("mousemove",M),document.addEventListener("mouseup",q)},[r,e,n,M,q,u,i]);return(0,ye.useEffect)(()=>()=>{if(P.current){document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",q),u(null);let C=It.get(n);C==null||C.clearReconnectingEdge()}},[n,M,q,u]),{reconnectingHandle:f,cursorPosition:g,hoveredNodeId:b,reconnectingSide:y,reconnectingOffset:_,isValidReconnection:w,handleReconnectStart:z}};var de=require("react/jsx-runtime"),ut={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:Te.MarkerType.ArrowClosed},markerEnd:{type:Te.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:gi,MIN_SEGMENT_LENGTH:$m,PARALLEL_OFFSET:Nc}=Un;function Xm(e,t,o,n){let r=n.filter(a=>a.source===t&&a.target===o||a.source===o&&a.target===t);if(r.length<=1){let a=n.filter(d=>d.source===t);if(a.length<=1)return 0;let l=a.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(a.length-1)/2;return(l-c)*Nc}let i=r.findIndex(a=>a.id===e),s=(r.length-1)/2;return(i-s)*Nc}var vc=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:s,sourceHandleId:a,targetHandleId:l})=>{var W,te;let{zoom:c}=(0,Te.useViewport)(),{updateEdgeData:d}=(0,Te.useReactFlow)(),u=(0,Te.useEdges)(),{isMultipleSelection:p,mode:f,instanceId:h}=K(),[g,m]=(0,qe.useState)(!1),[b,T]=(0,qe.useState)(null),y=(0,qe.useRef)(null),E=(0,qe.useRef)(null),_=f!=="edit",{reconnectingHandle:N,cursorPosition:w,hoveredNodeId:A,reconnectingSide:P,isValidReconnection:B,handleReconnectStart:S}=mi({edgeId:e,source:t,target:o,instanceId:h,isReadOnly:_}),D=(0,Te.useInternalNode)(t),Q=(0,Te.useInternalNode)(o),{sx:I,sy:R,tx:L,ty:M,sourcePos:q,targetPos:z}=(0,qe.useMemo)(()=>{var fe,me;let k=D&&Q?Uo(D,Q):{sx:0,sy:0,tx:0,ty:0,sourcePos:Te.Position.Right,targetPos:Te.Position.Left},X=a?i:k.sourcePos,J=l?s:k.targetPos,Y=(Se,Me,_e)=>{var Ft,ko,Ro,Re,Be,bt;let{x:ae,y:re}=Se.internals.positionAbsolute,Ve=(Ro=(ko=(Ft=Se.measured)==null?void 0:Ft.width)!=null?ko:Se.width)!=null?Ro:0,Ue=(bt=(Be=(Re=Se.measured)==null?void 0:Re.height)!=null?Be:Se.height)!=null?bt:0;switch(Me){case Te.Position.Top:return{x:ae+Ve*_e,y:re};case Te.Position.Bottom:return{x:ae+Ve*_e,y:re+Ue};case Te.Position.Left:return{x:ae,y:re+Ue*_e};case Te.Position.Right:return{x:ae+Ve,y:re+Ue*_e};default:return{x:ae+Ve/2,y:re+Ue/2}}},$=(fe=n==null?void 0:n.sourceOffset)!=null?fe:.5,U=(me=n==null?void 0:n.targetOffset)!=null?me:.5,Z=D?Y(D,X,$).x:k.sx,j=D?Y(D,X,$).y:k.sy,le=Q?Y(Q,J,U).x:k.tx,ce=Q?Y(Q,J,U).y:k.ty;return N==="source"&&w?(Z=w.x,j=w.y,P&&(X=P)):N==="target"&&w&&(le=w.x,ce=w.y,P&&(J=P)),{sx:Z,sy:j,tx:le,ty:ce,sourcePos:X,targetPos:J}},[D,Q,a,l,i,s,N,w,P,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,qe.useEffect)(()=>{var J;if(!E.current){E.current={sx:I,sy:R,tx:L,ty:M,sourcePos:q,targetPos:z};return}let k=E.current;(Math.abs(I-k.sx)>gi||Math.abs(R-k.sy)>gi||Math.abs(L-k.tx)>gi||Math.abs(M-k.ty)>gi||k.sourcePos!==q||k.targetPos!==z)&&((J=n==null?void 0:n.points)!=null&&J.length)&&!N&&d(e,v(x({},n),{points:void 0})),E.current={sx:I,sy:R,tx:L,ty:M,sourcePos:q,targetPos:z}},[I,R,L,M,q,z,n,e,d,N]);let C=(0,qe.useMemo)(()=>{let k=Xm(e,t,o,u);return pi(I,R,L,M,q,z,n==null?void 0:n.points,k)},[I,R,L,M,q,z,n==null?void 0:n.points,u,e,t,o]),H=(0,qe.useMemo)(()=>{if(C.length<2)return ui({x:I,y:R},{x:L,y:M});let k=0;for(let Y=0;Y<C.length-1;Y++)k+=di(C[Y],C[Y+1]);let X=k/2,J=0;for(let Y=0;Y<C.length-1;Y++){let $=di(C[Y],C[Y+1]);if(J+$>=X){let U=(X-J)/$,Z=C[Y],j=C[Y+1];return{x:Z.x+(j.x-Z.x)*U,y:Z.y+(j.y-Z.y)*U}}J+=$}return ui({x:I,y:R},{x:L,y:M})},[C,I,R,L,M]),F=(0,qe.useCallback)((k,X)=>{if(f!=="edit"||X.button!==0)return;X.stopPropagation(),X.preventDefault();let J=C[k],Y=C[k+1],$=hs(J,Y,"y"),U=$?J.y:J.x,Z=[...C],j=Z.length,le=k,ce=k+1;T(k);let fe=Se=>{let Me=U+($?Se.clientY-X.clientY:Se.clientX-X.clientX)/c;y.current=$?{x:(J.x+Y.x)/2,y:Me}:{x:Me,y:(J.y+Y.y)/2};let _e=[];for(let ae=1;ae<j-1;ae++){let re=Z[ae];ae===le||ae===ce?$?_e.push({x:re.x,y:Me}):_e.push({x:Me,y:re.y}):_e.push(x({},re))}d(e,v(x({},n),{points:_e}))},me=()=>{T(null),y.current=null,document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",me)};document.addEventListener("mousemove",fe),document.addEventListener("mouseup",me)},[f,C,c,n,e,d]);if(!D||!Q)return null;let V=_c(C),G=r||D.selected||Q.selected;return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsxs)("g",{className:O("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":G}),onDoubleClick:()=>m(!0),children:[(0,de.jsx)(Te.BaseEdge,{id:e,path:V,markerEnd:`url(#${G?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:O("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||N&&A&&!B,"stroke-green-500":N&&A&&B,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":G&&!(n!=null&&n.hasError)&&!N})}),r&&!p&&!_&&(0,de.jsx)("g",{children:C.slice(0,-1).map((k,X)=>{let J=C[X+1];if(X===0||X===C.length-2||di(k,J)<$m)return null;let Y=hs(k,J,"y"),$=b===X,U=$&&y.current?y.current:ui(k,J);return(0,de.jsxs)("g",{children:[(0,de.jsx)("line",{x1:k.x,y1:k.y,x2:J.x,y2:J.y,stroke:"transparent",strokeWidth:20/c,className:O("cursor-pointer",{"cursor-ns-resize":Y,"cursor-ew-resize":!Y}),onMouseDown:Z=>F(X,Z)}),(0,de.jsx)("circle",{cx:U.x,cy:U.y,r:4/c,fill:$?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:U.x,cy:U.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:$?.6:.3,className:"pointer-events-none"})]},X)})})]}),(0,de.jsxs)(Te.EdgeLabelRenderer,{children:[(0,de.jsxs)("div",{className:"absolute z-[3000] pointer-events-none flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${H.x}px, ${H.y}px)`},children:[r&&!p&&(0,de.jsx)(tn,{sx:I,sy:R,tx:L,ty:M,hasLabel:!!((W=n==null?void 0:n.label)!=null&&W.trim()),children:(0,de.jsx)(en,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:D,targetNode:Q})}),(g||((te=n==null?void 0:n.label)==null?void 0:te.trim()))&&(0,de.jsx)(ze,{value:n==null?void 0:n.label,className:O("min-w-8 max-w-56 px-2 py-1 body-small-400",{"pointer-events-auto":g,"pointer-events-none":!g}),isEditing:g,onBlur:()=>m(!1),onChange:k=>d(e,{label:k.trim()})})]}),r&&!p&&!_&&(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${C[0].x}px, ${C[0].y}px)`},children:(0,de.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:N==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:N==="source"?.6:.3,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:O("pointer-events-auto",{"cursor-move":!N||N!=="source","cursor-not-allowed":N==="source"&&A&&!B,"cursor-grabbing":N==="source"&&(!A||B)}),onMouseDown:k=>S("source",k.nativeEvent)})]})}),(0,de.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${C[C.length-1].x}px, ${C[C.length-1].y}px)`},children:(0,de.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:N==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:N==="target"?.6:.3,className:"pointer-events-none"}),(0,de.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:O("pointer-events-auto",{"cursor-move":!N||N!=="target","cursor-not-allowed":N==="target"&&A&&!B,"cursor-grabbing":N==="target"&&(!A||B)}),onMouseDown:k=>S("target",k.nativeEvent)})]})})]})]})]})};var Ct=require("@xyflow/react"),Km={right:Ct.Position.Right,left:Ct.Position.Left,top:Ct.Position.Top,bottom:Ct.Position.Bottom},hi=e=>{var t;return(t=Km[e!=null?e:""])!=null?t:Ct.Position.Right},ys=(e,t,o=.5)=>{var l,c,d,u;let{x:n,y:r}=e.internals.positionAbsolute,i=(c=(l=e.measured)==null?void 0:l.width)!=null?c:0,s=(u=(d=e.measured)==null?void 0:d.height)!=null?u:0;switch(hi(t)){case Ct.Position.Right:return{x:n+i,y:r+s*o};case Ct.Position.Left:return{x:n,y:r+s*o};case Ct.Position.Top:return{x:n+i*o,y:r};case Ct.Position.Bottom:return{x:n+i*o,y:r+s};default:return{x:n+i/2,y:r+s/2}}},wc=(e,t,o)=>{var d,u;let{position:{x:n,y:r},measured:i}=e,s=(d=i.width)!=null?d:0,a=(u=i.height)!=null?u:0;return[{id:"left",x:n,y:r+a/2},{id:"right",x:n+s,y:r+a/2},{id:"top",x:n+s/2,y:r},{id:"bottom",x:n+s/2,y:r+a}].reduce((p,f)=>{let h=Math.hypot(t-p.x,o-p.y);return Math.hypot(t-f.x,o-f.y)<h?f:p}).id};var Od=require("use-debounce");var hn=require("@xyflow/react"),As=require("react");var $n=(d=>(d.START_EVENT="start-event",d.END_EVENT_TERMINATE="end-event-terminate",d.TASK="task",d.TASK_SCRIPT="task-script",d.SUBPROCESS="subprocess-collapsed",d.GATEWAY_EXCLUSIVE="gateway-exclusive",d.GATEWAY_PARALLEL="gateway-parallel",d.GATEWAY_COMPLEX="gateway-complex",d.ANNOTATION="annotation",d.LANE="lane",d))($n||{});var yi=require("xml-js");var Ac={compact:!0,spaces:4},qm=e=>e.replace(/\n/g,"&#xA;");function xi(e,t=Ac){if(e)return JSON.parse((0,yi.xml2json)(e,t))}function Ic(e,t=Ac){return e?(0,yi.json2xml)(e,v(x({},t),{attributeValueFn:qm})):""}var Zm={MIN_WIDTH:36,MIN_HEIGHT:36},Jm={MIN_WIDTH:36,MIN_HEIGHT:36},Qm={MIN_WIDTH:56,MIN_HEIGHT:56},nn={MIN_WIDTH:176,MIN_HEIGHT:96},Ei={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},ve={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},rn={MIN_WIDTH:176,MIN_HEIGHT:64},jm={MIN_WIDTH:128,MIN_HEIGHT:64},oe={START_EVENT:Zm,END_EVENT:Jm,GATEWAY:Qm,TASK:nn,LANE:ve,ANNOTATION:rn,UNSUPPORTED:jm};var Cc={"attribute-loop":"LOOP"},Sc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Mc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Pc={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Lc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var sn=(e,t,o,n,r,i)=>{let s=e._attributes.width||0,a=e._attributes.height||0,l=0,c=0;if(n&&r!==void 0&&i!==void 0){let h=n.split(`
6
+ `),g=h.length;l=h.reduce((b,T)=>Math.max(b,T.length),0)*7+r,c=g*20+i}let d=Math.max(Yt(Number(s),t),l),u=Math.max(Yt(Number(a),o),c);return{width:d,height:u,measured:{width:d,height:u}}},an=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,s={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},a={id:n,position:s,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(a.parentId=l),a},tg=e=>{let{mxGeometry:t}=e,o=an(e),n=sn(t,oe.START_EVENT.MIN_WIDTH,oe.START_EVENT.MIN_HEIGHT);return v(x(x({},o),n),{type:"START_EVENT"})},og=e=>{let{mxGeometry:t}=e,o=an(e),n=sn(t,oe.END_EVENT.MIN_WIDTH,oe.END_EVENT.MIN_HEIGHT);return v(x(x({},o),n),{type:"END_EVENT"})},xs=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=an(e),a=sn(n,oe.TASK.MIN_WIDTH,oe.TASK.MIN_HEIGHT,r.data.label,48,24),l=t==null?void 0:t.find(d=>{let{parent:u}=d._attributes;return u===e._attributes.id});if(l){let{style:d}=l._attributes,u=Cc[d];u&&(r.data.attribute=u)}let c=Sc[o.style];return c&&(r.data.variant=c),v(x(x({},r),a),{type:"TASK"})},Es=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=an(e),i=sn(o,oe.GATEWAY.MIN_WIDTH,oe.GATEWAY.MIN_HEIGHT);return r.data.variant=Mc[n],v(x(x({},r),i),{type:"GATEWAY"})},ng=e=>{let{mxGeometry:t}=e,o=an(e),i=sn(t,oe.ANNOTATION.MIN_WIDTH,oe.ANNOTATION.MIN_HEIGHT,o.data.label,32,24);return v(x(x({},o),i),{type:"ANNOTATION"})},rg=e=>{let{mxGeometry:t}=e,o=an(e),n=sn(t,oe.LANE.MIN_WIDTH,oe.LANE.MIN_HEIGHT);return v(x(x({},o),n),{type:"LANE"})},kc={task:xs,"task-script":xs,"subprocess-collapsed":xs,"start-event":tg,"end-event-terminate":og,"gateway-parallel":Es,"gateway-exclusive":Es,"gateway-complex":Es,annotation:ng,lane:rg},ig=e=>{if(e&&Array.isArray(e))return e.map(t=>({x:Number(t._attributes.x),y:Number(t._attributes.y)}))},Rc=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:s,style:a,sourceHandle:l,targetHandle:c,sourceOffset:d,targetOffset:u}=t,p=ig(o==null?void 0:o.Array),f=d!==void 0?Number(d):void 0,h=u!==void 0?Number(u):void 0,g=v(x(x({id:n,source:r,target:i},l?{sourceHandle:l}:{}),c?{targetHandle:c}:{}),{data:x(x(x({label:s||""},p&&p.length>0?{points:p}:{}),f!==void 0?{sourceOffset:f}:{}),h!==void 0?{targetOffset:h}:{})});return a.includes("association")&&a.includes('endArrow=""')?x(x({},on),g):x(x({},ut),g)},Dc=(e,t)=>{let{id:o,type:n,source:r,target:i,sourceHandle:s,targetHandle:a,data:l}=e,c=t==null?void 0:t.find(f=>f.id===r),d="";n==="ANNOTATION_EDGE"&&(d='association;endArrow=""');let u={_attributes:{as:"geometry",relative:"1"}};return l!=null&&l.points&&Array.isArray(l.points)&&l.points.length>0&&(u.Array=l.points.map(f=>({_attributes:{as:"mxPoint",x:f.x,y:f.y}}))),{_attributes:{id:o,parent:(c==null?void 0:c.parentId)||"1",edge:"1",style:d,source:r,target:i,value:(l==null?void 0:l.label)||"",sourceHandle:s!=null?s:void 0,targetHandle:a!=null?a:void 0,sourceOffset:(l==null?void 0:l.sourceOffset)!==void 0?String(l.sourceOffset):void 0,targetOffset:(l==null?void 0:l.targetOffset)!==void 0?String(l.targetOffset):void 0},mxGeometry:u}},ln=e=>{let{id:t,parentId:o,position:n,measured:r,data:i}=e;return{_attributes:{id:t,parent:o||"1",value:i.label,vertex:"1"},mxGeometry:{_attributes:{as:"geometry",width:(r==null?void 0:r.width)||0,height:(r==null?void 0:r.height)||0,x:n.x||0,y:n.y||0}}}},sg=e=>{let{variant:t}=e.data,o=ln(e);return v(x({},o),{_attributes:v(x({},o._attributes),{style:Pc[t]||"task"})})},ag=e=>{let t=ln(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"start-event"})})},lg=e=>{let t=ln(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"end-event-terminate"})})},cg=e=>{let{variant:t}=e.data,o=ln(e);return v(x({},o),{_attributes:v(x({},o._attributes),{style:Lc[t]})})},dg=e=>{let t=ln(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"lane"})})},ug=e=>{let t=ln(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"annotation"})})},Oc={TASK:sg,START_EVENT:ag,END_EVENT:lg,GATEWAY:cg,ANNOTATION:ug,LANE:dg},Vc=(e,t)=>{var s,a;let r=((s=e.measured)==null?void 0:s.width)||0,i=((a=e.measured)==null?void 0:a.height)||0;return{_attributes:{id:`${t+1}`,parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:r/2-22/2,y:i-22,width:22,height:22}}}};var bs=_p(require("@dagrejs/dagre"),1),Wc=require("@xyflow/react");var Yc=require("lodash");var Hc=require("lodash");var Bt=e=>{var t,o,n,r,i,s,a,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(i=e.measured)==null?void 0:i.width)!=null?s:0,h:(l=(a=e.measured)==null?void 0:a.height)!=null?l:0}},To=e=>(0,Hc.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Gc=(e,t)=>{let{x:o,y:n}=Bt(e),{x:r,y:i}=Bt(t);return{x:o-r,y:n-i}};var cn=({parentId:e,nodes:t,includeTypes:o=[...Object.values(ee)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),pg=(e,t)=>{let{x:o,y:n}=Bt(e),{x:r,y:i}=Bt(t),s=o-r,a=n-i;return Math.sqrt(s*s+a*a)},fg=(e,t)=>{let{x:o,y:n,w:r,h:i}=Bt(e),{x:s,y:a,w:l,h:c}=Bt(t),d=o+r/2,u=n+i/2;return d>=s&&d<=s+l&&u>=a&&u<=a+c},Xn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&fg(e,r)){let i=pg(e,r);i<n&&(n=i,o=r)}return o},Bc=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0),zc=(e,t)=>{let o=e.filter(c=>!c.parentId);if(o.length===0)return{nodes:e,edges:t};let n=o.filter(c=>c.type==="LANE"),r=n.length>0?n:o,i=Math.min(...r.map(c=>c.position.x||0)),s=Math.min(...r.map(c=>c.position.y||0)),a=e.map(c=>c.parentId?c:v(x({},c),{position:{x:c.position.x-i,y:c.position.y-s}})),l=t.map(c=>{let d=c.data;return d!=null&&d.points?v(x({},c),{data:v(x({},d),{points:d.points.map(u=>({x:u.x-i,y:u.y-s}))})}):c});return{nodes:a,edges:l}},Fc=e=>{var l,c;let t=e.filter(d=>!d.parentId),o=t.filter(d=>d.type==="LANE"),n=o.length>0?o:t;if(n.length===0)return null;let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let d of n){let u=d.position.x+((l=d.width)!=null?l:0),p=d.position.y+((c=d.height)!=null?c:0);d.position.x<r&&(r=d.position.x),d.position.y<i&&(i=d.position.y),u>s&&(s=u),p>a&&(a=p)}return{x:r,y:i,width:s-r,height:a-i}};var Uc=(e=[],t=[],o="LR")=>{let n=new bs.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:s,height:a})=>n.setNode(i,{width:s,height:a})),t.forEach(i=>n.setEdge(i.source,i.target)),bs.default.layout(n),{nodes:e.map(i=>{let s=n.node(i.id);return v(x({},i),{position:{x:s.x-i.width/2,y:s.y-i.height/2}})}),edges:t}},Kn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=qn(n.id,o)}),o},qn=(e,t)=>{var f,h;let o=[...t],n=o.find(g=>g.id===e);if(!n)return o;let r=o.filter(g=>g.parentId===e&&g.type==="LANE");if(r.length===0)return o;let i=(0,Yc.orderBy)(r,["position.y"]),s=Math.max((h=(f=n.measured)==null?void 0:f.width)!=null?h:0,Ei.MIN_WIDTH),a=Bc(e,i)||ve.MIN_WIDTH,l=Math.max(s,a),c=s-ve.HEADER_WIDTH>=a,d=0,u=0;i.forEach(g=>{var m,b,T,y;o=o.map(E=>E.id===g.id?v(x({},E),{width:c?l-ve.HEADER_WIDTH:l,measured:v(x({},E.measured),{width:c?l-ve.HEADER_WIDTH:l}),position:{x:ve.HEADER_WIDTH,y:d}}):E),d+=(b=(m=g.measured)==null?void 0:m.height)!=null?b:0,u+=(y=(T=g.measured)==null?void 0:T.height)!=null?y:0}),o=o.map(g=>g.id===e?v(x({},g),{height:u,width:c?l:l+ve.HEADER_WIDTH,measured:v(x({},g.measured),{height:u,width:c?l:l+ve.HEADER_WIDTH})}):g);let p=o.find(g=>g.id===e);return p!=null&&p.parentId&&(o=qn(p.parentId,o)),o},$c=(e,t,o)=>{if(e.type==="LANE")return o;let n=Ht(t),r=Ht(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+ve.HEADER_WIDTH&&(e.position.x=ve.HEADER_WIDTH),r.y2>n.y2&&(t.height=r.y2-n.y,t.measured.height=r.y2-n.y),r.x2>n.x2&&(t.width=r.x2-n.x,t.measured.width=r.x2-n.x),o=o.map(i=>i.id===t.id?v(x({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?v(x({},i),{position:e.position}):i),o},Xc=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},mg=50,Kc=(e,t=mg)=>{let o=(0,Wc.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Zn=1,qc=e=>`<mxGraphModel>
6
7
  <root version="1.1">
7
8
  <mxCell id="0" />
8
9
  <mxCell id="1" parent="0" />
@@ -35,10 +36,11 @@
35
36
  <mxGeometry as="geometry" relative="1" />
36
37
  </mxCell>
37
38
  </root>
38
- </mxGraphModel>`,Yc=(e,t)=>{if(!e.length&&!t.length)return Kn;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var ug=e=>{let t=Object.values(Yn),o=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return t.includes(s)}),n=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return["attribute-loop"].includes(s)}),r=[];for(let i of o){let{style:s}=i._attributes,a=Sc[s],l=a==null?void 0:a(i,n);if(!l){console.warn(`Node ${s} not supported`);continue}r.push(l)}return r},pg=(e,t)=>{let o=e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}),n=[];for(let r of o){let i=Mc(r),s=t.find(l=>l.id===i.source),a=t.find(l=>l.id===i.target);(s==null?void 0:s.type)==="LANE"||(a==null?void 0:a.type)==="LANE"||n.push(i)}return n},fg=(e,t)=>{let o=[];return e.forEach(n=>{var s,a;let r=(a=(s=Lc)[n.type])==null?void 0:a.call(s,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=kc(n,t);o.push(l)}}),o},mg=(e,t)=>{let o=[];return e.forEach(n=>{let r=Pc(n,t);o.push(r)}),o},Uc=(e=[],t=[],o)=>{let n=fg(e,o),r=mg(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return Nc(JSON.stringify(i),{compact:!0,spaces:0})},$c=async e=>{var a,l,c,d,u;let t=await hi(e),o=((l=(a=t==null?void 0:t.mxGraphModel)==null?void 0:a.root)==null?void 0:l.mxCell)||[],n=Number(((u=(d=(c=t==null?void 0:t.mxGraphModel)==null?void 0:c.root)==null?void 0:d._attributes)==null?void 0:u.lastId)||Kn),r=ug(o),i=pg(o,r);return{nodes:To($n(r)),edges:i,lastElementId:n}};var wo=require("@xyflow/react");var qn=require("@xyflow/react");var xs=require("react/jsx-runtime"),se=i=>{var s=i,{type:e,position:t,className:o,nodeType:n}=s,r=_t(s,["type","position","className","nodeType"]);let a=n==="TASK";return(0,xs.jsx)(qn.Handle,E({type:e,position:t,className:R("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":a,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!a},o)},r))},Ye=a=>{var l=a,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,s=_t(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,qn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let f=c();if(t==="TASK")return f.filter(g=>g.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return f.filter(g=>g.source===e).length>=2;if(t==="START_EVENT"){let y=d();return f.filter(m=>{if(m.source!==e)return!1;let b=y.find(T=>T.id===m.target);return(b==null?void 0:b.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,xs.jsx)(qn.Handle,E({type:n,position:r,className:R("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":p,"hover:border-grey-500":!p},i),style:{pointerEvents:p?"none":"auto"}},s))};var Ei=require("@xyflow/react"),Xc=require("lodash");var Kc=require("react/jsx-runtime"),cn=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=_t(r,["nodeId","isVisible"]);let{getNode:i,getNodes:s,setNodes:a}=(0,Ei.useReactFlow)(),{isMultipleSelection:l}=q(),c=({width:u,height:p})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let y=[...s()],g=!f.parentId,m=g?f.id:f.parentId,b=y.filter(x=>x.type==="LANE"&&x.parentId===m);if(!b.length)return;let T=(0,Xc.orderBy)(b,["position.y"]),h=0;T.forEach((x,_)=>{var I,M;let N=_===T.length-1,A=(M=(I=x.measured)==null?void 0:I.height)!=null?M:0;y=y.map(H=>{if(H.id===x.id){let S=g?u-ve.HEADER_WIDTH:u,w=v(E({},H),{width:S,measured:v(E({},H.measured),{width:S}),position:v(E({},H.position),{y:h})});return N&&g&&(w.height=p-h),w}return H}),h+=A}),y=y.map(x=>{if(x.id===m){let _=g?u:u+ve.HEADER_WIDTH;return v(E({},x),{width:_,height:g?p:h,measured:{width:_,height:g?p:h}})}return x}),a(y)};return(0,Kc.jsx)(Ei.NodeResizer,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400 relative before:content-[''] before:absolute before:w-5 before:h-5 before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:cursor-[inherit]",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(u,p)=>c(p)},o))};var Ti=require("@xyflow/react"),St=require("@produto-lecom/lecom-ui"),vo=require("react");var qc=require("zustand"),dn=(0,qc.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var bi=require("react"),Zc=(e,t=!1)=>{let[o,n]=(0,bi.useState)({width:0,height:0});return(0,bi.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var to=require("@xyflow/react"),Jc=require("react"),gg=120,hg=12,Qc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,to.useReactFlow)(),{instanceId:i}=q();return(0,Jc.useMemo)(()=>{var f,y;if(!t)return{position:to.Position.Right,align:"start"};let s=n(e);if(!s)return{position:to.Position.Right,align:"start"};let a=r(),l=s.position.x*a.zoom+a.x,c=(((f=s.measured)==null?void 0:f.width)||s.width||100)*a.zoom,d=(y=document.getElementById(`modeler-${i}`))==null?void 0:y.clientWidth;if(!d)return{position:to.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||gg;return{position:l+c+u+hg>d?to.Position.Left:to.Position.Right}},[i,e,t,o,n,r])};var _i=require("@xyflow/react"),ue=require("@produto-lecom/lecom-ui"),jc=require("lucide-react");var ye=require("react/jsx-runtime"),ed=({nodeId:e})=>{let{t}=(0,ue.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,_i.useReactFlow)(),i=(0,_i.useNodesData)(e),a=n().filter(f=>f.source===e).some(f=>{let y=r(f.target);return(y==null?void 0:y.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=u=>{o(e,{variant:(i==null?void 0:i.data.variant)===u?"":u})},d=u=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===u?"":u})};return(0,ye.jsxs)(ue.DropdownMenu,{children:[(0,ye.jsxs)(ue.Tooltip,{children:[(0,ye.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,ye.jsx)(ue.DropdownMenuTrigger,{asChild:!0,children:(0,ye.jsx)(ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ye.jsx)(jc.WrenchIcon,{})})})}),(0,ye.jsx)(ue.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,ye.jsxs)(ue.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ye.jsxs)(ue.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,ye.jsx)("div",{className:"flex-1 body-medium-500",children:t("bpmn.task.menu.title")}),(0,ye.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(_r).map(([u,p])=>{let f=u==="LOOP"&&(a||l),g=(()=>{if(u==="LOOP"&&a)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(u==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess");if(u==="LOOP")return t("editor.task_menu.loop")})();return(0,ye.jsxs)(ue.Tooltip,{children:[(0,ye.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,ye.jsx)(ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:R({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":f}),onClick:f?void 0:()=>d(u),children:(0,ye.jsx)(p.icon,{className:"stroke-inherit"})})}),g&&(0,ye.jsx)(ue.TooltipContent,{color:"black",children:g})]},u)})})]}),(0,ye.jsx)(ue.DropdownMenuGroup,{children:(0,ye.jsxs)(ue.Tooltip,{children:[(0,ye.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,ye.jsx)("div",{className:R({"cursor-not-allowed":a}),children:(0,ye.jsxs)(ue.DropdownMenuItem,{className:R({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50":a}),disabled:a,onClick:()=>c("SCRIPT"),children:[(0,ye.jsx)(br.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})})}),a&&(0,ye.jsx)(ue.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var Ee=require("react/jsx-runtime"),No={START_EVENT:{type:"START_EVENT",icon:Nn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Do,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:Nn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:hr,label:"bpmn.annotation.variant.default"}},yg={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Ho,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Bo,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:Oo,label:"bpmn.gateway.variant.complex"}},qe=({nodeId:e,nodeType:t,nodeVariant:o})=>{let n=(0,vo.useRef)(null),r=(0,vo.useRef)(null),{t:i}=(0,St.useTranslation)(),{setDraggableNode:s}=dn(),{getEdges:a,getNodes:l,getNode:c}=(0,Ti.useReactFlow)(),{setIsDragging:d,mode:u,isConnecting:p,isDragging:f,isMultipleSelection:y}=q(),g=c(e),m=!!(g!=null&&g.selected)&&!g.dragging&&!p&&!f&&!y,{dimensions:b}=Zc(n,m),{position:T}=Qc(e,m,b),[h,x]=(0,vo.useState)(void 0),_=l(),N=a(),A=o==="SUBPROCESS",I=(0,vo.useCallback)((z,C)=>{d(!1),s({type:C.type,variant:C.variant,attribute:C.attribute,icon:C.icon}),C.icon&&x((0,Ee.jsx)(C.icon,{})),z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("sourceId",e),r.current&&z.dataTransfer.setDragImage(r.current,10,10),setTimeout(()=>{d(!0)},100)},[e,s,d]),M=[{component:(0,Ee.jsx)(ai,{elementId:e})}],H=()=>{if(u==="view")return[];let z=!N.some(C=>{var O;return C.source===e&&((O=_.find(D=>D.id===C.target))==null?void 0:O.type)!=="ANNOTATION"});return[{component:(0,Ee.jsx)(_o,{nodeId:e,disabled:!z,tooltipMessage:z?void 0:i("editor.toolbar.start_event_limit_reached")})},No.TASK,No.ANNOTATION,...M]},S=()=>u==="view"?[{component:(0,Ee.jsx)(jt,{elementId:e})}]:[{component:(0,Ee.jsx)(jt,{elementId:e})},...A?[]:[{component:(0,Ee.jsx)(ed,{nodeId:e})}],{component:(0,Ee.jsx)(_o,{nodeId:e})},No.TASK,...Object.values(yg),...M],w=()=>u==="view"?[{component:(0,Ee.jsx)(jt,{elementId:e})}]:[{component:(0,Ee.jsx)(jt,{elementId:e})},{component:(0,Ee.jsx)(_o,{nodeId:e})},No.TASK,No.ANNOTATION,...M],k=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},No.ANNOTATION,...M],V=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},No.ANNOTATION,...M],P=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},...M],L=()=>u==="view"?[]:[...M],Q=(z=>{switch(z){case"START_EVENT":return H();case"TASK":return S();case"GATEWAY":return w();case"END_EVENT":return k();case"LANE":return V();case"ANNOTATION":return P();case"UNSUPPORTED":return L();default:return[]}})(t);if(!(Q.length===0||u==="readonly"))return(0,Ee.jsxs)(Ti.NodeToolbar,{position:T,align:"start",className:"-top-8",isVisible:m,children:[(0,Ee.jsx)("div",{ref:n,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:Q.map((z,C)=>{if(z.component)return(0,Ee.jsx)("div",{children:z.component},C);let O={sourceNodeType:t,targetNodeType:z.type,sourceNodeId:e,nodes:_,edges:N},D=rc(O),G={gateway_limit_reached:i("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:i("editor.toolbar.start_event_limit_reached"),start_event_already_exists:i("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:i("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:i("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:i("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:i("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:i("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:i("editor.toolbar.task_limit_reached")},Y=D.shouldDisable&&D.reason?G[D.reason]||i(z.label):i(z.label)||"";return(0,Ee.jsxs)(St.Tooltip,{children:[(0,Ee.jsx)(St.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(St.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!D.shouldDisable,disabled:D.shouldDisable,className:D.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:D.shouldDisable?void 0:F=>I(F,z),children:z.icon&&(0,Ee.jsx)(z.icon,{size:16})})}),(0,Ee.jsx)(St.TooltipContent,{color:"black",children:Y})]},C)})}),(0,Ee.jsx)("div",{ref:r,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:h})]})};var oo=require("react/jsx-runtime"),td=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,wo.useReactFlow)(),{inProgress:i,fromNode:s}=(0,wo.useConnection)(),{mode:a}=q(),l=i&&(s==null?void 0:s.id)!==e,c=d=>{r(e,{label:d})};return(0,oo.jsxs)("div",{className:R("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:[(0,oo.jsx)(ze,{value:t.label,className:"m-1 text-grey-600 text-left",onChange:c}),(0,oo.jsx)(qe,{nodeId:e,nodeType:"ANNOTATION"}),a==="edit"&&(0,oo.jsx)(cn,{minWidth:xi.MIN_WIDTH,minHeight:xi.MIN_HEIGHT,isVisible:!n&&o}),!i&&(0,oo.jsx)(se,{type:"source",position:wo.Position.Right}),(!i||l)&&(0,oo.jsx)(se,{type:"target",position:wo.Position.Left,className:R({"annotation-handle":l})})]})};var et=require("@xyflow/react"),od=require("react");var Pe=require("react/jsx-runtime"),nd=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,et.useReactFlow)(),{inProgress:r,fromNode:i}=(0,et.useConnection)(),{reconnectingEdgeId:s}=q(),[a,l]=(0,od.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!s,d=f=>{n(e,{label:f})},u=()=>{l(!0)},p=()=>{l(!1)};return(0,Pe.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,Pe.jsx)(Do,{className:R("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,Pe.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Pe.jsx)(ze,{value:t.label,isEditing:a,onBlur:p,onChange:d})}),(0,Pe.jsx)(qe,{nodeId:e,nodeType:"END_EVENT"}),(!r||c)&&(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(se,{type:"target",position:et.Position.Left,id:"left",className:R({"event-handle":c})}),(0,Pe.jsx)(se,{type:"target",position:et.Position.Right,id:"right",className:R({"event-handle":c})}),(0,Pe.jsx)(se,{type:"target",position:et.Position.Top,id:"top",className:R({"event-handle":c})}),(0,Pe.jsx)(se,{type:"target",position:et.Position.Bottom,id:"bottom",className:R({"event-handle":c})})]}),!r&&(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(se,{type:"source",position:et.Position.Left,id:"left"}),(0,Pe.jsx)(se,{type:"source",position:et.Position.Right,id:"right"}),(0,Pe.jsx)(se,{type:"source",position:et.Position.Top,id:"top"}),(0,Pe.jsx)(se,{type:"source",position:et.Position.Bottom,id:"bottom"})]})]})};var tt=require("@xyflow/react"),Ni=require("react");var Le=require("react/jsx-runtime"),rd=({id:e,data:t,selected:o})=>{let n=Yi[t.variant].icon,{updateNodeData:r}=(0,tt.useReactFlow)(),{inProgress:i,fromNode:s}=(0,tt.useConnection)(),{reconnectingEdgeId:a}=q(),[l,c]=(0,Ni.useState)(!1),d=i&&(s==null?void 0:s.id)!==e||!!a,u=(0,Ni.useCallback)(y=>{r(e,{label:y})},[e,r]),p=()=>{c(!0)},f=()=>{c(!1)};return(0,Le.jsxs)("div",{className:"relative",onDoubleClick:p,children:[(0,Le.jsx)(n,{className:R("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,Le.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Le.jsx)(ze,{value:t.label,isEditing:l,onBlur:f,onChange:u})}),(0,Le.jsx)(qe,{nodeId:e,nodeType:"GATEWAY"}),(!i||d)&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(se,{type:"target",position:tt.Position.Left,id:"left",className:R({"gateway-handle":d})}),(0,Le.jsx)(se,{type:"target",position:tt.Position.Right,id:"right",className:R({"gateway-handle":d})}),(0,Le.jsx)(se,{type:"target",position:tt.Position.Top,id:"top",className:R({"gateway-handle":d})}),(0,Le.jsx)(se,{type:"target",position:tt.Position.Bottom,id:"bottom",className:R({"gateway-handle":d})})]}),!i&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var id=require("@xyflow/react"),ht=require("@produto-lecom/lecom-ui"),xg=require("lucide-react");var sd=require("react/jsx-runtime");var ot=require("@xyflow/react"),ad=require("react");var ke=require("react/jsx-runtime"),ld=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,ot.useReactFlow)(),{inProgress:r,fromNode:i}=(0,ot.useConnection)(),{reconnectingEdgeId:s}=q(),[a,l]=(0,ad.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!s,d=f=>{n(e,{label:f})},u=()=>{l(!0)},p=()=>{l(!1)};return(0,ke.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,ke.jsx)(Er,{className:R("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ke.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ke.jsx)(ze,{value:t.label,isEditing:a,onBlur:p,onChange:d})}),(0,ke.jsx)(qe,{nodeId:e,nodeType:"START_EVENT"}),(!r||c)&&(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(se,{type:"target",position:ot.Position.Left,id:"left",className:R({"event-handle":c})}),(0,ke.jsx)(se,{type:"target",position:ot.Position.Right,id:"right",className:R({"event-handle":c})}),(0,ke.jsx)(se,{type:"target",position:ot.Position.Top,id:"top",className:R({"event-handle":c})}),(0,ke.jsx)(se,{type:"target",position:ot.Position.Bottom,id:"bottom",className:R({"event-handle":c})})]}),!r&&(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var pd=require("@produto-lecom/lecom-ui"),nt=require("@xyflow/react"),jn=require("react");var Zn=60,vi=(e,t)=>{var s;let o=[],n=`${t} `;for(let a of e){if(!(a.type==="TASK"))continue;let c=(s=a.data)==null?void 0:s.label;if(c&&c.startsWith(n)){let d=c.substring(n.length);/^\d{1,15}$/.test(d)&&o.push(parseInt(d,10))}}let r=o.length>0?Math.max(...o)+1:1,i=`${t} ${r}`;return i.length<=Zn?i:i.substring(0,Zn).trim()},un=(e,t)=>{var a;let o=new Set;for(let l of t)l.type==="TASK"&&((a=l.data)!=null&&a.label)&&o.add(l.data.label);let n=e;if(n.length>Zn&&(n=n.substring(0,Zn).trim()),!o.has(n))return n;let r=n.replace(/\s+\(\d+\)$/,""),i=2,s=o.size+2;for(;i<=s;){let l=` (${i})`,c=Zn-l.length,u=`${r.substring(0,c).trim()}${l}`;if(!o.has(u))return u;i++}return n};var Jn=require("react/jsx-runtime"),cd=e=>(0,Jn.jsxs)("svg",v(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,Jn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,Jn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var Es=require("react/jsx-runtime"),dd=e=>(0,Es.jsx)("svg",v(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,Es.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z",fill:"#38bdf8"})}));var Qn=require("react/jsx-runtime"),ud=e=>(0,Qn.jsxs)("svg",v(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,Qn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,Qn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ne=require("react/jsx-runtime"),Eg={APROVADO:cd,EM_ANDAMENTO:dd,REJEITADO:ud},bs={APROVADO:"border-green-500 border-[3px] border-solid",EM_ANDAMENTO:"border-turquoise-400 border-[3px] border-solid",REJEITADO:"border-red-500 border-[3px] border-solid",default:"border-grey-400 border-2 border-solid",error:"border-red-500 border-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)]"},fd=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,pd.useTranslation)(),{toast:i}=Xe(),{updateNodeData:s,getNodes:a,setNodes:l}=(0,nt.useReactFlow)(),{inProgress:c,fromNode:d}=(0,nt.useConnection)(),{mode:u,onSubprocessValidationClick:p,reconnectingEdgeId:f}=q(),{getTaskStatus:y}=po(),g=c&&(d==null?void 0:d.id)!==e||!!f,m=(0,jn.useCallback)(k=>{let Q=k.split(`
39
- `),z=Q.reduce((G,Y)=>Math.max(G,Y.length),0),C=Q.length,O=Math.max(nn.MIN_WIDTH,z*7+48),D=Math.max(nn.MIN_HEIGHT,C*20+24);l(G=>G.map(Y=>Y.id===e?v(E({},Y),{width:O,height:D,style:v(E({},Y.style),{width:O,height:D})}):Y))},[e,l]),b=(0,jn.useCallback)(k=>{let V=k.trim(),P=t.label||"";if(V===P)return;let L=V,W=a();if(!(V&&V!=="")){L=vi(W,r("bpmn.task.label.prefix")),s(e,{label:L}),m(L),i({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,ne.jsx)("strong",{children:L})]})});return}let z=un(L,W);z===P||(s(e,{label:z}),m(z),z!==L&&i({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,ne.jsx)("strong",{children:V})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,ne.jsx)("strong",{children:z})]})}))},[t.label,a,e,r,s,m]),T=(0,jn.useCallback)(k=>{m(k)},[m]),h=(0,jn.useCallback)(()=>{i({variant:"error",content:r("bpmn.task.feedback.invalid_first_character")})},[r]),x=y(e),_=x?Eg[x]:null,N=t.variant?br[t.variant].icon:null,A=t.attribute?_r[t.attribute].icon:null,I=t.variant==="SUBPROCESS",M=N&&!I,H=A||I,S=()=>t.hasError?bs.error:x?bs[x]:bs.default,w=()=>{p==null||p({id:e,type:"sub_process",label:t.label})};return(0,ne.jsxs)("div",{className:R("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md hover:shadow-md transition-colors duration-75",S(),{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ne.jsx)(ze,{value:t.label,maxLength:60,className:R("m-1",{"py-6":M||H}),onChange:b,onInput:T,onInvalidFirstCharacter:h}),N&&(0,ne.jsx)("div",{className:R("absolute flex items-center p-1",I?"bottom-0":"top-0 left-0"),children:(0,ne.jsx)(N,{size:16,className:R(t.hasError?"text-red-500":"text-grey-500",I&&"cursor-pointer"),onClick:I?w:void 0})}),A&&(0,ne.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ne.jsx)("div",{className:R("flex items-center w-16 p-1",I?"justify-between":"justify-center"),children:(0,ne.jsx)(A,{size:16,className:R(t.hasError?"text-red-500":"text-grey-500")})})}),_&&(0,ne.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,ne.jsx)(_,{})}),(0,ne.jsx)(qe,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant}),u==="edit"&&(0,ne.jsx)(cn,{minWidth:nn.MIN_WIDTH,minHeight:nn.MIN_HEIGHT,isVisible:!n&&o}),(!c||g)&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(se,{type:"target",position:nt.Position.Left,id:"left",className:R({"task-handle":g})}),(0,ne.jsx)(se,{type:"target",position:nt.Position.Right,id:"right",className:R({"task-handle":g})}),(0,ne.jsx)(se,{type:"target",position:nt.Position.Top,id:"top",className:R({"task-handle":g})}),(0,ne.jsx)(se,{type:"target",position:nt.Position.Bottom,id:"bottom",className:R({"task-handle":g})})]}),!c&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var _s=require("@xyflow/react");var zt=require("react/jsx-runtime"),md=({id:e,data:t})=>(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,zt.jsx)(qe,{nodeId:e,nodeType:"UNSUPPORTED"}),(0,zt.jsx)(se,{type:"source",position:_s.Position.Right}),(0,zt.jsx)(se,{type:"target",position:_s.Position.Left})]});var we=require("@xyflow/react"),wi=require("react");var be=require("react/jsx-runtime"),Sw={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:we.MarkerType.Arrow},data:{label:""}},gd=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:s,sourceHandleId:a,targetHandleId:l})=>{var Y;let{zoom:c}=(0,we.useViewport)(),{updateEdgeData:d}=(0,we.useReactFlow)(),{isMultipleSelection:u,mode:p,instanceId:f}=q(),y=p!=="edit",[g,m]=(0,wi.useState)(!1),{reconnectingHandle:b,cursorPosition:T,hoveredNodeId:h,reconnectingSide:x,isValidReconnection:_,handleReconnectStart:N}=pi({edgeId:e,source:t,target:o,instanceId:f,isReadOnly:y}),A=(0,we.useInternalNode)(t),I=(0,we.useInternalNode)(o),{sx:M,sy:H,tx:S,ty:w,sourcePos:k,targetPos:V}=(0,wi.useMemo)(()=>{var le,fe;if(!A||!I)return{sx:0,sy:0,tx:0,ty:0,sourcePos:we.Position.Left,targetPos:we.Position.Right};let F=Uo(A,I),oe=a?i:F.sourcePos,B=l?s:F.targetPos,X=(re,_e,Se)=>{var He,Qe,Ft,ko,Re,De;let{x:Me,y:xe}=re.internals.positionAbsolute,ce=(Ft=(Qe=(He=re.measured)==null?void 0:He.width)!=null?Qe:re.width)!=null?Ft:0,ie=(De=(Re=(ko=re.measured)==null?void 0:ko.height)!=null?Re:re.height)!=null?De:0;switch(_e){case we.Position.Top:return{x:Me+ce*Se,y:xe};case we.Position.Bottom:return{x:Me+ce*Se,y:xe+ie};case we.Position.Left:return{x:Me,y:xe+ie*Se};case we.Position.Right:return{x:Me+ce,y:xe+ie*Se};default:return{x:Me+ce/2,y:xe+ie/2}}},J=(le=n==null?void 0:n.sourceOffset)!=null?le:.5,U=(fe=n==null?void 0:n.targetOffset)!=null?fe:.5,K=A?X(A,oe,J).x:F.sx,$=A?X(A,oe,J).y:F.sy,Z=I?X(I,B,U).x:F.tx,j=I?X(I,B,U).y:F.ty;return b==="source"&&T?(K=T.x,$=T.y,x&&(oe=x)):b==="target"&&T&&(Z=T.x,j=T.y,x&&(B=x)),{sx:K,sy:$,tx:Z,ty:j,sourcePos:oe,targetPos:B}},[A,I,a,l,i,s,b,T,x,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!A||!I)return null;let[P,L,W]=(0,we.getSmoothStepPath)({sourceX:M,sourceY:H,targetX:S,targetY:w,sourcePosition:k,targetPosition:V}),Q=r||(A==null?void 0:A.selected)||(I==null?void 0:I.selected),z=Q?"sequence-edge-marker-highlighted":"sequence-edge-marker",C=g||(n==null?void 0:n.label.trim().length)>0,O=()=>{m(!0)},D=()=>{m(!1)},G=F=>{d(e,{label:F.trim()})};return(0,be.jsx)(be.Fragment,{children:(0,be.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":Q}),onDoubleClick:O,children:[(0,be.jsx)(we.BaseEdge,{id:e,path:P,markerEnd:`url(#${z})`,strokeDasharray:4,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||b&&h&&!_,"stroke-green-500":b&&h&&_,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":Q&&!(n!=null&&n.hasError)&&!b})}),(0,be.jsxs)(we.EdgeLabelRenderer,{children:[(0,be.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${L}px, ${W}px)`},children:[r&&!u&&(0,be.jsx)(tn,{sx:M,sy:H,tx:S,ty:w,hasLabel:!!((Y=n==null?void 0:n.label)!=null&&Y.trim()),children:(0,be.jsx)(en,{edgeId:e,edgeType:"MESSAGE_EDGE"})}),C&&(0,be.jsx)(ze,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onBlur:D,onChange:G})]}),r&&!u&&!y&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${M}px, ${H}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:b==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:b==="source"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!b||b!=="source","cursor-not-allowed":b==="source"&&h&&!_,"cursor-grabbing":b==="source"&&(!h||_)}),onMouseDown:F=>N("source",F.nativeEvent)})]})}),(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${S}px, ${w}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:b==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:b==="target"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!b||b!=="target","cursor-not-allowed":b==="target"&&h&&!_,"cursor-grabbing":b==="target"&&(!h||_)}),onMouseDown:F=>N("target",F.nativeEvent)})]})})]})]})]})})};var Ao=require("@xyflow/react"),er=require("react/jsx-runtime"),hd=({toX:e,toY:t,fromNode:o})=>{var u,p;if(!o)return null;let{internals:{positionAbsolute:{x:n,y:r}},measured:i}=o,s=(u=i.width)!=null?u:0,a=(p=i.height)!=null?p:0,c=[{x:n,y:r+a/2,pos:Ao.Position.Left},{x:n+s,y:r+a/2,pos:Ao.Position.Right},{x:n+s/2,y:r,pos:Ao.Position.Top},{x:n+s/2,y:r+a,pos:Ao.Position.Bottom}].reduce((f,y)=>{let g=Math.hypot(e-f.x,t-f.y);return Math.hypot(e-y.x,t-y.y)<g?y:f}),[d]=(0,Ao.getStraightPath)({sourceX:c.x,sourceY:c.y,targetX:e,targetY:t});return(0,er.jsxs)("g",{children:[(0,er.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d}),(0,er.jsx)("circle",{cx:e,cy:t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Ai=require("@xyflow/react"),yd=require("lodash"),tr=require("react");var rt=require("react/jsx-runtime"),xd=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:s}=(0,Ai.useReactFlow)(),{mode:a}=q(),[l,c]=(0,tr.useState)(!1),d=s(),u=!r,p=(0,tr.useMemo)(()=>(0,yd.orderBy)([...d.filter(T=>T.parentId===e&&T.type==="LANE")],"position.y","asc"),[d,e]),f=u?yi.MIN_WIDTH:ve.MIN_WIDTH,y=(0,tr.useMemo)(()=>{if(u&&p.length>1){let T=[...p];return T.pop(),T.reduce((x,_)=>{var N,A;return x+((A=(N=_.measured)==null?void 0:N.height)!=null?A:0)},0)+ve.MIN_HEIGHT}return ve.MIN_HEIGHT},[u,p]),g=T=>{i(e,{label:T})},m=()=>{c(!0)},b=()=>{c(!1)};return(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsxs)("div",{className:R("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,rt.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onDoubleClick:m,children:(0,rt.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,rt.jsx)(ze,{value:t.label,className:"w-full h-full self-auto",contentClassName:R({"whitespace-nowrap":l}),isEditing:l,onBlur:b,onChange:g})})}),(0,rt.jsx)("div",{className:"flex-1"})]}),(0,rt.jsx)(qe,{nodeId:e,nodeType:"LANE",isChild:!u}),a==="edit"&&(0,rt.jsx)(cn,{nodeId:e,minWidth:f,minHeight:y,isVisible:!n&&o}),(0,rt.jsx)(se,{type:"source",position:Ai.Position.Right})]})};var Ed={START_EVENT:ld,END_EVENT:nd,TASK:fd,GATEWAY:rd,ANNOTATION:td,LANE:xd,UNSUPPORTED:md},bd={SEQUENCE_EDGE:bc,MESSAGE_EDGE:gd,ANNOTATION_EDGE:mc},_d="#fafafa",Td="#bebebe",Nd=1,vd=10,wd="bottom-left",Ad=.2,Id=5,pn=.5,fn=.4,mn=1,Cd={x:0,y:0,zoom:.75},bg=1,_g=2,Sd=[bg,_g];var Md=require("@xyflow/react");var pt=()=>{let{getEdges:e,getNodes:t}=(0,Md.useReactFlow)(),{lastElementId:o}=q(),n=()=>{let i=t(),s=e(),a=Yc(i,s);return Math.max(a,o)};return{getLastId:n,getNextId:()=>n()+1}};var gn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,Pd.useReactFlow)(),{getLastId:i}=pt(),{setLastElementId:s}=q(),a=(0,Ts.useCallback)(async(c="")=>{let{nodes:d,edges:u,lastElementId:p}=await $c(c);o(d),n(u),s(p),r({padding:pn,minZoom:fn,maxZoom:mn})},[o,n,s,r]),l=(0,Ts.useCallback)((c,d)=>{let u=c||e()||[],p=d||t()||[],f=i();return Uc(u,p,f)},[e,t,i]);return{importFromMxGraph:a,exportToMxGraph:l}};var Ns=require("react"),Tg=500,Ii=()=>{let{isInitialized:e,onElementChanges:t}=q(),{exportToMxGraph:o}=gn(),n=(0,Ld.useDebouncedCallback)(()=>{if(!e)return;let s=o();t==null||t(s)},Tg),r=(0,Ns.useCallback)(s=>{s.every(c=>c.type==="select")||s.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Ns.useCallback)(s=>{s.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var kd=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n,getInternalNode:r}=(0,Ci.useReactFlow)(),{emitElementChanges:i}=Ii(),s=(0,Mt.useRef)(null),{getNextId:a}=pt(),l=(0,Mt.useCallback)(g=>{var x;let m=t(g.source),b=t(g.target);if(!m||!b)return!1;let T={sourceNodeId:m.id,targetNodeId:b.id,sourceNodeType:m.type,targetNodeType:b.type,nodes:n(),edges:o(),reconnectingEdgeId:(x=s.current)!=null?x:void 0};return ls(T).isValid},[t,o,n]),c=(0,Mt.useCallback)(g=>{var T,h;let m=a(),b=r(g.source);if(b){let x=r(g.target),_=x?x.internals.positionAbsolute.x+((T=x.measured.width)!=null?T:0)/2:0,N=x?x.internals.positionAbsolute.y+((h=x.measured.height)!=null?h:0)/2:0,A=_c(b,_,N),I=(x==null?void 0:x.type)==="ANNOTATION"||(b==null?void 0:b.type)==="ANNOTATION",M=I?on:ut,H;if(!I&&x&&g.targetHandle){let w=mi(A),k=mi(g.targetHandle),{x:V,y:P}=ms(b,A),{x:L,y:W}=ms(x,g.targetHandle),z=di(V,P,L,W,w,k).slice(1,-1);z.length>0&&(H=z)}let S=v(E(E({},g),M),{id:String(m),sourceHandle:A,data:E(E({},I?{}:ut.data),H?{points:H}:{})});e(w=>w.concat(S))}i()},[a,e,i,r]),d=(0,Mt.useCallback)((g,m)=>{s.current=m.id},[]),u=(0,Mt.useCallback)(()=>{s.current=null},[]),p=(0,Mt.useCallback)((g,m)=>{let b=t(m.source),T=t(m.target);if(!b||!T){s.current=null;return}let h={sourceNodeId:b.id,targetNodeId:T.id,sourceNodeType:b.type,targetNodeType:T.type,nodes:n(),edges:o(),reconnectingEdgeId:g.id};if(!ls(h).isValid){s.current=null;return}e(_=>(0,Ci.reconnectEdge)(g,m,_).map(A=>A.id===g.id?v(E({},A),{data:v(E({},A.data),{points:void 0})}):A)),s.current=null,i()},[t,n,o,e,i]),f=(0,Mt.useCallback)(g=>{s.current=g},[]),y=(0,Mt.useCallback)(()=>{s.current=null},[]);return{isValidConnection:l,onConnect:c,onReconnect:p,onReconnectStart:d,onReconnectEnd:u,setReconnectingEdge:f,clearReconnectingEdge:y}};var Fd=require("@produto-lecom/lecom-ui"),Wd=require("@xyflow/react"),yt=require("react");var or=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Io=(e=[])=>e.filter(t=>t.type==="END_EVENT"),no=(e=[])=>e.filter(t=>t.type==="TASK")||[],Rd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Dd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Si=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Od=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),it=(e,t=[])=>t.filter(o=>o.source===e),nr=(e,t=[])=>t.filter(o=>o.target===e),Vd=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Hd=(e,t)=>{let o=it(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},Gd=e=>e?/[^\s]/.test(e.trim()):!1,me=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Pt=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},Bd=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var rr=[{id:"start_event_not_found",validate:e=>{let t=or(e.nodes);return me({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Io(e.nodes);return me({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=or(e.nodes),o=t.length===1;if(t.length===0)return me({isValid:!0});if(!o)return me({isValid:!1,nodeIds:t.map(i=>i.id)});let n=it(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(s=>s.id),...n.map(s=>s.target)];return me({isValid:!1,nodeIds:[...new Set(i)]})}return me({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=no(e.nodes),o=Pt(t,n=>it(n.id,e.edges).length<=2);return me({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=no(e.nodes),o=Pt(t,n=>!!n.label&&n.label.trim()!=="");return me({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=no(e.nodes),n=Pt(o,r=>!r.label||r.label.length<=60);return me({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=no(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return me({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Si(e.nodes),o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return me({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...or(e.nodes),...Io(e.nodes)],o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&(a.type==="START_EVENT"||a.type==="END_EVENT")&&(o.push(r.id,a.id),n.push(s.id))}}return me({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Io(e.nodes),o=[],n=[];for(let r of t){let i=nr(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.source);if(a&&a.type==="TASK"){let l=it(a.id,e.edges);l.length>1&&(o.push(a.id),l.forEach(c=>n.push(c.id)))}}}return me({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Od(e.nodes),o=Pt(t,r=>it(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>it(r,e.edges).map(i=>i.id));return me({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=no(e.nodes),o=Pt(t,n=>!n.label||Gd(n.label));return me({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,a;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((a=e==null?void 0:e.edges)!=null&&a.length))return me({isValid:!0});let t=Io(e.nodes)[0];if(!t)return me({isValid:!0});let o=nr(t.id,e.edges);if(!o.length)return me({isValid:!0});let r=no(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Pt(r,l=>!Vd(l.id,e));return me({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=no(e.nodes),o=Io(e.nodes)[0];if(!o)return me({isValid:!0});let n=t.filter(l=>{let c=nr(l.id,e.edges),d=it(l.id,e.edges),u=c.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.source))==null?void 0:y.type)==="START_EVENT"}),p=d.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.target))==null?void 0:y.type)==="END_EVENT"});return u&&p}),r=nr(o.id,e.edges),i=r.length>1,s=r.map(l=>l.source),a={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?s:[]]};return me(a)}},{id:"gateway_flow_to_event",validate:e=>{let t=Si(e.nodes),o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="END_EVENT"&&(o.push(r.id,a.id),n.push(s.id))}}return me({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Si(e.nodes),o=Pt(t,n=>it(n.id,e.edges).length>=1);return me({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...or(e.nodes),...Io(e.nodes)],o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return me({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Rd(e.nodes),o=Pt(t,n=>!Hd(n.id,e));return me({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Dd(e.nodes),o=Pt(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return me({isValid:o.isValid,nodeIds:o.invalidIds})}}];var zd=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of rr){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Co=require("react/jsx-runtime"),Yd=()=>{let{t:e}=(0,Fd.useTranslation)(),{toast:t}=Xe(),{setNodes:o,setEdges:n,getNodes:r,getEdges:i}=(0,Wd.useReactFlow)(),[s,a]=(0,yt.useState)(!1),l=(0,yt.useRef)(!1),c=(0,yt.useRef)(!1),d=(0,yt.useCallback)(g=>{let m=Bd(g.nodes,g.edges),b=zd(m),T=b.errors.map(h=>v(E({},h),{message:e(`validation.errors.${h.id}`)}));return s||a(!0),{isValid:b.isValid,errors:T}},[s,e]),u=(0,yt.useCallback)((g,m=!0)=>{if(m&&g&&t({variant:g.isValid?"success":"error",duration:5e3,title:g.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,Co.jsxs)("div",{className:"flex flex-col gap-1",children:[!g.isValid&&(0,Co.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,Co.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:g.isValid?(0,Co.jsx)("li",{children:e("validation.success.message")}):g.errors.map(S=>(0,Co.jsx)("li",{className:"text-xs",children:S.message},S.id))})]})}),!g)return;l.current=!0,c.current=!0;let b=[],T=[];g.errors.forEach(S=>{S.nodeIds&&S.nodeIds.length>0&&S.nodeIds.forEach(w=>b.push(w)),S.edgeIds&&S.edgeIds.length>0&&S.edgeIds.forEach(w=>T.push(w))});let h=[...new Set(b)];o(S=>S.map(w=>v(E({},w),{data:v(E({},w.data),{hasError:!1})}))),n(S=>S.map(w=>v(E({},w),{data:v(E({},w.data),{hasError:!1})})));let x=r(),_=i(),N=new Set(h),A=new Set;g.errors.forEach(S=>{var V,P;let w=rr.find(L=>L.id===S.id);(w==null?void 0:w.highlightRelatedEdges)!==!1&&((V=S.edgeIds)==null||V.forEach(L=>A.add(L)),(P=S.nodeIds)==null||P.forEach(L=>{_.forEach(W=>{(W.source===L||W.target===L)&&A.add(W.id)})}))});let I=new Set,M=new Set,H=new Set;x.forEach(S=>{S.type==="START_EVENT"?I.add(S.id):S.type==="END_EVENT"&&M.add(S.id)}),_.forEach(S=>{I.has(S.source)&&H.add(S.target),M.has(S.target)&&H.add(S.source)}),H.forEach(S=>{var w,k;if(N.has(S)){let V=(w=g.errors.find(L=>{var W;return(W=L.nodeIds)==null?void 0:W.includes(S)}))==null?void 0:w.id;((k=rr.find(L=>L.id===V))==null?void 0:k.highlightRelatedEdges)!==!1&&_.forEach(L=>{L.source===S&&M.has(L.target)&&(N.add(L.target),A.add(L.id)),L.target===S&&I.has(L.source)&&(N.add(L.source),A.add(L.id))})}}),N.size>0&&o(S=>S.map(w=>v(E({},w),{data:v(E({},w.data),{hasError:N.has(w.id)})}))),A.size>0&&n(S=>S.map(w=>v(E({},w),{data:v(E({},w.data),{hasError:A.has(w.id)})}))),setTimeout(()=>{l.current=!1},0)},[e,i,r,n,o]),p=(0,yt.useCallback)(()=>{a(!1),c.current=!1,o(g=>g.map(m=>v(E({},m),{data:v(E({},m.data),{hasError:!1})}))),n(g=>g.map(m=>v(E({},m),{data:v(E({},m.data),{hasError:!1})})))},[n,o]),f=(0,yt.useCallback)(()=>{c.current&&(l.current=!0,c.current=!1,o(g=>g.map(m=>v(E({},m),{data:v(E({},m.data),{hasError:!1})}))),n(g=>g.map(m=>v(E({},m),{data:v(E({},m.data),{hasError:!1})}))),setTimeout(()=>{l.current=!1},0))},[n,o]),y=(0,yt.useCallback)(()=>l.current,[]);return{validateDiagram:d,handleValidationComplete:u,clearValidation:p,dismissValidationPanel:f,isAutoValidationEnabled:s,getIsClearingValidation:y}};var Xd=require("@xyflow/react"),Kd=require("@produto-lecom/lecom-ui"),qd=require("react");var Ng=15,Ud="bpmn:selection",vg=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},$d=e=>{if(!vg(e.target))return!0;let t=window.getSelection(),o=t&&t.toString().length>0;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement){let n=e.target;return n.selectionStart===n.selectionEnd&&!o}return!o},Zd=({offset:e=Ng}={})=>{let{t}=(0,Kd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,Xd.useReactFlow)(),{getNextId:s}=pt();(0,qd.useEffect)(()=>{let a=c=>{var m,b;if(!$d(c))return;let d=o(),u=r(),p=d.filter(T=>T.selected);if(!p.length)return;c.preventDefault(),c.stopPropagation();let f=u.filter(T=>p.some(h=>h.id===T.source)&&p.some(h=>h.id===T.target)),g=JSON.stringify({nodes:p,edges:f});(m=c.clipboardData)==null||m.setData(Ud,g),(b=c.clipboardData)==null||b.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},l=c=>{var h,x;if(!$d(c))return;let d=(h=c.clipboardData)==null?void 0:h.getData(Ud);if(!d)return;c.preventDefault(),c.stopPropagation();let u;try{u=JSON.parse(d)}catch(_){return}if(!((x=u.nodes)!=null&&x.length))return;let p=new Map,f=o(),y=[],g=u.nodes.filter(_=>Jt(_.type,f));if(g.length===0)return;let m=s(),b=g.map(_=>{var I;let N=String(m++);p.set(_.id,N);let A=v(E({},_),{id:N,selected:!0,position:{x:_.position.x+e,y:_.position.y+e}});if(_.type==="TASK"){let M=(I=_.data)==null?void 0:I.label,H=un(M||t("bpmn.task.label.prefix"),[...f,...y]);A.data=v(E({},_.data),{label:H})}return y.push(A),A}),T=u.edges.map(_=>v(E({},_),{id:String(m++),selected:!0,source:p.get(_.source)||_.source,target:p.get(_.target)||_.target}));n(_=>[..._.map(N=>v(E({},N),{selected:!1})),...b]),i(_=>[..._.map(N=>v(E({},N),{selected:!1})),...T])};return document.addEventListener("copy",a,!0),document.addEventListener("paste",l,!0),()=>{document.removeEventListener("copy",a,!0),document.removeEventListener("paste",l,!0)}},[o,n,r,i,s,e,t])};var Mi=require("@xyflow/react");var Jd=require("@produto-lecom/lecom-ui"),Qd=require("react");var jd=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,Mi.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=dn(),{t:s}=(0,Jd.useTranslation)(),{getInternalNode:a,getNodes:l,screenToFlowPosition:c}=(0,Mi.useReactFlow)(),{getNextId:d}=pt(),{setIsDragging:u}=q(),{rebuildIndex:p,forceRebuildIndex:f}=ei(),[y,g]=(0,Qd.useState)(null),m=(w,k=!1)=>{let V=k?"[&>div]:bg-red-50 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-red-500":"[&>div]:bg-green-50/75 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-green-500";t(P=>P.map(L=>v(E({},L),{className:L.id===w?V:""})))},b=()=>{let{nodeLookup:w}=n.getState();return Array.from(w.values())},T=w=>{let k=a(w.id),V=b();if(w.type==="LANE"){if(ln({parentId:w.id,nodes:e,includeTypes:["LANE"]})){m();return}let C=V.filter(G=>G.id!==w.id&&G.type==="LANE"&&!G.parentId),O=Un(k,C);if(!O){m();return}if(ln({parentId:O.id,nodes:e,excludeTypes:["LANE"]})){m(O.id,!0);return}m(O.id);return}let L=V.filter(z=>z.id!==w.id&&z.type==="LANE"),W=Un(k,L);if(!W){m();return}if(ln({parentId:W.id,nodes:e,includeTypes:["LANE"]})){m();return}m(W.id)},h=w=>w.map(k=>v(E({},k),{className:void 0})),x=w=>w.some(V=>V.dragging)?w.map(V=>V.dragging?v(E({},V),{dragging:!1}):V):w,_=w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},N=(w,k)=>{w.preventDefault(),T(k)},A=(w,k,V)=>{var z,C;let P=[...V];if(w.parentId===k.id)return P=Bc(w,k,P),P=$n(P),h(P);if(w.type==="LANE"){if(ln({parentId:k.id,nodes:P,excludeTypes:["LANE"]})){let F=Ht(k),oe=50,B=50;return P.map(X=>{var J,U;return X.id===w.id?v(E({},X),{position:{x:(J=y==null?void 0:y.x)!=null?J:F.x+oe,y:(U=y==null?void 0:y.y)!=null?U:F.y2+B}}):X})}let G=P.filter(F=>F.parentId===k.id).reduce((F,oe)=>{var B,X;return F+((X=(B=oe.measured)==null?void 0:B.height)!=null?X:0)},0),Y={x:ve.HEADER_WIDTH,y:G};return P=P.map(F=>F.id===w.id?v(E({},F),{parentId:k.id,position:Y,className:void 0}):v(E({},F),{className:void 0})),P=Xn(k.id,P),P}if(ln({parentId:k.id,nodes:P,includeTypes:["LANE"]})){let O;if(w.parentId){let D=a(w.parentId),{x:G,y:Y}=Bt(D);O={x:G+((z=w.position.x)!=null?z:0),y:Y+((C=w.position.y)!=null?C:0)}}return P=P.map(D=>D.id===w.id?v(E({},D),{position:O!=null?O:D.position,parentId:void 0,className:void 0}):v(E({},D),{className:void 0})),P}let Q=Dc(w,k);return P=P.map(O=>{if(O.id===w.id){let D=Ht(w),G=Ht(k);return D.y<G.y&&(Q.y=0),D.x<G.x+ve.HEADER_WIDTH&&(Q.x=ve.HEADER_WIDTH),v(E({},O),{parentId:k.id,position:Q,className:void 0})}return v(E({},O),{className:void 0})}),P=$n(P),P},I=w=>{if(w.preventDefault(),!(r!=null&&r.type))return;if(!Jt(r.type,l())){u(!1),i(null);return}let k=c({x:w.clientX,y:w.clientY}),V={width:te[r.type].MIN_WIDTH,height:te[r.type].MIN_HEIGHT},P=d(),L={id:String(P),type:r.type,position:k,measured:V,data:{label:r.type==="TASK"?vi(e,s("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},W=v(E({},L),{internals:{positionAbsolute:k}}),Q=b(),z=r.type==="LANE",C=Q.filter(Y=>z?Y.type==="LANE"&&!Y.parentId:Y.type==="LANE"),O=Un(W,C),D=[...e.map(Y=>v(E({},Y),{selected:!1})),L];O&&(D=A(W,O,D)),D=To(D),t(D),f();let G=w.dataTransfer.getData("sourceId");if(G){let Y={id:String(P+1),source:G,target:L.id};r.type==="ANNOTATION"?o(F=>F.concat(E(E({},Y),on))):o(F=>F.concat(E(E({},Y),ut)))}u(!1),i(null)},M=async(w,k,V)=>{let P=[...e];V.forEach(L=>{let W=b(),Q=a(L.id),z=L.type==="LANE",C=W.filter(D=>D.id!==L.id&&(z?D.type==="LANE"&&!D.parentId:D.type==="LANE")),O=Un(Q,C);if(O){P=A(Q,O,P);return}L.parentId&&(P=S(L,P))}),P=x(P),P=To(P),P=h(P),t(P),p(P),g(null)},H=(w,k)=>{g({x:k.position.x,y:k.position.y})},S=(w,k)=>{var Q,z;let V=a(w.parentId),{x:P,y:L}=Bt(V),W={x:P+((Q=w.position.x)!=null?Q:0),y:L+((z=w.position.y)!=null?z:0)};return k=k.map(C=>C.id===w.id?v(E({},C),{position:W,parentId:void 0}):C),k=Xn(w.parentId,k),k};return{onDragOver:_,onDrop:I,onNodeDrag:N,onNodeDragStart:H,onNodeDragStop:M}};var eu=require("@xyflow/react"),tu=require("@produto-lecom/lecom-ui"),ou=require("react");var wg=30,Ag=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},Ig=e=>!Ag(e.target),nu=({offset:e=wg}={})=>{let{t}=(0,tu.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,eu.useReactFlow)(),{getNextId:s}=pt();(0,ou.useEffect)(()=>{let a=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&Ig(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),u=c.filter(h=>h.selected);if(!u.length)return;let p=new Map,f=[],y=u.filter(h=>Jt(h.type,c));if(y.length===0)return;let g=d.filter(h=>y.some(x=>x.id===h.source)&&y.some(x=>x.id===h.target)),m=s(),b=y.map(h=>{var N;let x=String(m++);p.set(h.id,x);let _=v(E({},h),{id:x,selected:!0,position:{x:h.position.x+e,y:h.position.y+e}});if(h.type==="TASK"){let A=(N=h.data)==null?void 0:N.label,I=un(A||t("bpmn.task.label.prefix"),[...c,...f]);_.data=v(E({},h.data),{label:I})}return f.push(_),_}),T=g.map(h=>v(E({},h),{id:String(m++),selected:!0,source:p.get(h.source)||h.source,target:p.get(h.target)||h.target}));n(h=>[...h.map(x=>v(E({},x),{selected:!1})),...b]),i(h=>[...h.map(x=>v(E({},x),{selected:!1})),...T])}};return document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("keydown",a,!0)}},[o,n,r,i,s,e,t])};var sr=require("react"),ru=require("@xyflow/react");var Cg=20,Sg=50,ir={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},Mg=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},iu=e=>{let{getNodes:t}=(0,ru.useReactFlow)(),{mode:o,isMoveTool:n}=q(),r=(0,sr.useRef)(0),i=(0,sr.useRef)(new Map);(0,sr.useEffect)(()=>{let s=a=>{if(o!=="edit"||!n||Mg(a.target)||!Object.values(ir).includes(a.key))return;let u=t().filter(T=>T.selected);if(u.length===0){i.current.clear();return}a.preventDefault();let p=Date.now(),f=p-r.current<500;r.current=p;let y=a.shiftKey?Sg:Cg,g=0,m=0;switch(a.key){case ir.UP:m=-y;break;case ir.DOWN:m=y;break;case ir.LEFT:g=-y;break;case ir.RIGHT:g=y;break}let b=u.map(T=>{let h=i.current.get(T.id);(!f||!h)&&(h={x:T.position.x,y:T.position.y});let x={x:h.x+g,y:h.y+m};return i.current.set(T.id,x),{id:T.id,dragging:!0,type:"position",position:x}});e&&e(b)};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t,e,o,n])};var du=require("@xyflow/react");var au={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},lu={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},su=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],s="",a="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",a=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",a=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),s||(s="task",a=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:a}),{step:e,type:s,label:a,edgeLabel:l}},Pg=e=>{e=e||"";let t=e.trim().split(`
40
- `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let s=su(i[0],o),a=su(i[1],o);s&&a&&n.push({sourceId:s.step,targetId:a.step,label:s.edgeLabel||a.edgeLabel||""})}),{components:o,connections:n}},cu=e=>{let{components:t,connections:o}=Pg(e);return{nodes:t,edges:o}};var uu=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,du.useReactFlow)(),{getNextId:n}=pt();return{importFromLia:i=>{let s=typeof i=="string"?i:i.diagramXml||"",{nodes:a,edges:l}=cu(s),c=[],d=new Map,u=!1,p=n();for(let[m,b]of Object.entries(a)){let T=String(p++),h=au[b.type],x=lu[b.type];h==="START_EVENT"&&(u=!0),d.set(m,T);let _=te[h].MIN_WIDTH,N=te[h].MIN_HEIGHT;c.push({id:T,type:h,data:{label:b.label||"",variant:x,attribute:""},position:{x:0,y:0},width:_,height:N,measured:{width:_,height:N}})}let f=[];for(let m of l){let b=v(E({},ut),{id:String(p++),source:d.get(m.sourceId)||m.sourceId,target:d.get(m.targetId)||m.targetId});f.push(b)}if(!u&&c.length>0){let m=String(p++),b={id:m,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:te.START_EVENT.MIN_WIDTH,height:te.START_EVENT.MIN_HEIGHT,measured:{width:te.START_EVENT.MIN_WIDTH,height:te.START_EVENT.MIN_HEIGHT}};c.unshift(b);let T=c[1];if(T){let h=v(E({},ut),{id:String(p++),source:m,target:T.id});f.unshift(h)}}let{nodes:y,edges:g}=Gc(c,f);e(y),t(g),o({padding:pn,minZoom:fn,maxZoom:mn})}}};var Pi=require("react"),Lg={origin:"*",debug:!1};function pu(e,t=Lg){let{origin:o,debug:n}=t,r=(0,Pi.useCallback)((i,s)=>{let a={event:i,data:[i,{event:i,data:s}]};window.parent.postMessage(a,o||"*")},[o]);return(0,Pi.useEffect)(()=>{let i=s=>{let a=s.data;if(!(a!=null&&a.event)||(a==null?void 0:a.data)===void 0)return;let{event:l,data:c}=a,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",a),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var fu=require("@xyflow/react"),vs=require("react");var mu=()=>{let e=(0,fu.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=q(),{importFromMxGraph:n}=gn();(0,vs.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,vs.useEffect)(()=>{if(!e)return;(async()=>{await yr(),o(!0)})()},[e,o])};var ws=require("react"),gu=require("@xyflow/react");function hu(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=po(),{getEdges:n}=(0,gu.useReactFlow)(),r=Nr(),i=(0,ws.useCallback)(a=>{if(!(a!=null&&a.activities))return;e(a.activities);let l=a.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),s=(0,ws.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:s}}var xu=require("@xyflow/react"),Ze=require("react"),Eu=require("use-debounce");var kg=500,yu=100,bu=(e=!1)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,xu.useReactFlow)(),[i,s]=(0,Ze.useState)({history:[],currentStep:0}),{history:a,currentStep:l}=i,c=a[l],d=l>0,u=l<a.length-1,p=(0,Ze.useCallback)((_,N)=>{n(_[N].nodes),r(_[N].edges)},[n,r]),f=(0,Ze.useCallback)(()=>{if(l>0){let _=l-1;s(N=>v(E({},N),{currentStep:_})),p(a,_)}},[l,a,p]),y=(0,Ze.useCallback)(()=>{if(l<a.length-1){let _=l+1;s(N=>v(E({},N),{currentStep:_})),p(a,_)}},[a,l,p]),g=(0,Ze.useCallback)(_=>{s(N=>{let I=[...N.history.slice(0,N.currentStep+1),_],M=I.length>yu?I.slice(I.length-yu):I;return{history:M,currentStep:M.length-1}})},[]),m=(0,Ze.useCallback)(()=>{let _=t(),N=o(),A=_.map(M=>v(E({},M),{selected:!1,className:"",data:v(E({},M.data),{hasError:!1})})),I=N.map(M=>v(E({},M),{data:v(E({},M.data),{hasError:!1})}));return{nodes:To(A),edges:I}},[t,o]),b=(0,Eu.useDebouncedCallback)(()=>{let _=m();JSON.stringify(c)!==JSON.stringify(_)&&g(_)},kg),T=(0,Ze.useCallback)(_=>{if(!e)return;if(a.length===0){let I=m();s({history:[I],currentStep:0})}if(_==="forceSave"){b();return}_.some(I=>I.type==="select")||_.some(I=>I.type==="position"&&I.dragging)||b()},[e,b,a.length,m]);(0,Ze.useEffect)(()=>{if(e&&a.length===0){let _=m();s({history:[_],currentStep:0})}},[e,a.length,m]);let h=(0,Ze.useCallback)(_=>{s({history:_||[],currentStep:0})},[]),x=(0,Ze.useCallback)(()=>{s({history:[],currentStep:0})},[]);return(0,Ze.useEffect)(()=>{let _=N=>{(N.ctrlKey||N.metaKey)&&(N.shiftKey&&N.key.toLowerCase()==="z"?(N.preventDefault(),y()):N.key.toLowerCase()==="z"&&(N.preventDefault(),f()))};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[f,y]),{history:a,undo:f,redo:y,canUndo:d,canRedo:u,saveHistory:T,resetHistory:h,clearHistory:x}};var Tu=()=>{let{t:e}=(0,_u.useTranslation)(),[t,o,n]=(0,Lt.useNodesState)([]),[r,i,s]=(0,Lt.useEdgesState)([]),{getNode:a}=(0,Lt.useReactFlow)(),{toast:l}=Xe(),c=(0,Lt.useStoreApi)(),{instanceId:d,isInitialized:u,setIsConnecting:p,setIsMultipleSelection:f,onElementClick:y}=q(),{updateHelperLines:g,HelperLines:m}=ei(),{undo:b,redo:T,canUndo:h,canRedo:x,saveHistory:_}=bu(u),{onNodeDrag:N,onDrop:A,onDragOver:I,onNodeDragStop:M,onNodeDragStart:H}=jd({nodes:t,setNodes:o,setEdges:i}),{isValidConnection:S,onConnect:w,onReconnect:k,onReconnectStart:V,onReconnectEnd:P,setReconnectingEdge:L,clearReconnectingEdge:W}=kd({setEdges:i}),{handleValidationComplete:Q,clearValidation:z,dismissValidationPanel:C,validateDiagram:O,getIsClearingValidation:D}=Yd(),{importFromLia:G}=uu(),{handleTasksStatus:Y,handleClearTaskStatus:F}=hu(),{clearPathEdges:oe}=po(),{emitElementChanges:B,handleNodeChanges:X,handleEdgeChanges:J}=Ii(),U=Nr();Zd(),nu(),mu();let K=(0,xt.useCallback)(()=>{o([]),i([]),oe(),setTimeout(U,0)},[o,i,oe,U]);pu({LIA_CREATE_DIAGRAM:G,CLEAR_DIAGRAM:K,TASKS_STATUS:Y,CLEAR_TASKS_STATUS:F});let{selectElements:$,clearSelection:Z}=Qt(),{importFromMxGraph:j,exportToMxGraph:le}=gn(),{configureElement:fe,getConfigureElement:re}=si(),_e=(0,xt.useCallback)(()=>t.length+r.length,[t,r]);(0,xt.useEffect)(()=>(It.set(d,{importFromMxGraph:j,exportToMxGraph:le,selectElements:$,clearSelection:Z,configureElement:fe,getConfigureElement:re,getElementsCount:_e,setReconnectingEdge:L,clearReconnectingEdge:W}),()=>{It.delete(d)}),[d,j,le,$,Z,fe,re,_e,L,W]);let Se=(0,xt.useCallback)((Re,De)=>{if(De.type!=="TASK"&&De.type!=="GATEWAY")return;let bt=re(De.id);bt&&(y==null||y(bt))},[re,y]),Me=(0,xt.useCallback)((Re,De)=>{if(De.type!=="SEQUENCE_EDGE")return;let bt=a(De.source),Ro=a(De.target),{isFromStartEvent:ap,isGatewayToGateway:lp,isActiviyToAndGateway:cp}=Tr(bt,Ro);if(!(!ap&&!lp&&!cp))return;let Ls=re(De.id);Ls&&(y==null||y(Ls))},[re,a,y]),xe=(0,xt.useCallback)(Re=>{let De=g(Re,t);n(De),_(Re),D()||C(),X(Re)},[t,n,_,D,C,g,X]),ce=(0,xt.useCallback)(Re=>{s(Re),_(Re),D()||C(),J(Re)},[s,_,D,C,J]);iu(xe);let ie=(0,xt.useCallback)(({nodes:Re,edges:De})=>{f(Re.length+De.length>=2)},[f]);(0,Lt.useOnSelectionChange)({onChange:ie});let He=(0,xt.useCallback)(async({nodes:Re})=>Re.some(bt=>bt.type==="LANE"&&t.some(Ro=>Ro.parentId===bt.id))?(l({variant:"error",title:e("validation.errors.title"),content:e("editor.toolbar.delete_pool_lane_error")}),!1):!0,[t,e]);return{nodes:t,setNodes:o,edges:r,setEdges:i,events:{isValidConnection:S,onConnect:w,onReconnect:k,onReconnectStart:V,onReconnectEnd:P,onDrop:A,onDragOver:I,onNodeDrag:N,onNodeDragStop:M,onNodeDragStart:H,onNodeClick:Se,onEdgeClick:Me,onDropCapture:()=>{_("forceSave"),B(),C()},onConnectStart:()=>{p(!0)},onConnectEnd:()=>{p(!1),C()},onSelectionEnd:()=>c.setState({nodesSelectionActive:!1}),onNodesChange:xe,onEdgesChange:ce,onBeforeDelete:He},ui:{handleCloseValidationPanel:z},controls:{undo:b,redo:T,canUndo:h,canRedo:x},components:{HelperLines:m},actions:{saveHistory:_,selectElements:$,clearSelection:Z,exportToMxGraph:le,validateDiagram:O,handleValidationComplete:Q,setReconnectingEdge:L,clearReconnectingEdge:W}}};var As=require("react/jsx-runtime"),Is=({id:e,className:t})=>(0,As.jsx)("marker",{id:e,className:R("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,As.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var hn=require("react/jsx-runtime"),Nu=()=>(0,hn.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,hn.jsxs)("defs",{children:[(0,hn.jsx)(Is,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,hn.jsx)(Is,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var ao=require("@produto-lecom/lecom-ui");var cr=require("@xyflow/react"),Ae=require("@produto-lecom/lecom-ui"),so=require("lucide-react"),Lo=require("react");var ro=require("@produto-lecom/lecom-ui");var ar=(h=>(h.START_EVENT="START_EVENT",h.END_EVENT="END_EVENT",h.TASK="TASK",h.SUBPROCESS="SUBPROCESS",h.GATEWAY="GATEWAY",h.LANE="LANE",h.ANNOTATION="ANNOTATION",h.CONNECTION="CONNECTION",h.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",h.ACTIVITY="ACTIVITY",h.PROCESS_INTERFACE="PROCESS_INTERFACE",h.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",h.VARIANT_ACTIVITY="VARIANT_ACTIVITY",h.AUTO_ACTIVITY="AUTO_ACTIVITY",h.DATA_STORE="DATA_STORE",h.DATA_OBJECT="DATA_OBJECT",h.DATA_OUTPUT="DATA_OUTPUT",h.DATA_INPUT="DATA_INPUT",h.MARKER="MARKER",h))(ar||{});var ki=require("@produto-lecom/lecom-ui"),Ru=require("@xyflow/react");var vu=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function wu({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
41
- `),i=encodeURI(r);Li(i,`${o}.csv`)}var Li=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};function Au(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var MI={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Iu={script:"SCRIPT",subprocess:"SUBPROCESS"},Cu={"marker-loop":"LOOP"},Su={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL",inclusive:"EXCLUSIVE"};var So=({cell:e,type:t,variant:o="",attribute:n=""})=>{let{_attributes:r,mxGeometry:i}=e,{value:s,parent:a}=r,l=Number(i._attributes.width),c=Number(i._attributes.height),d=a==="1"?void 0:a;return{id:r.id,parentId:d,type:t,data:{label:s||"",variant:o,attribute:n},position:{x:Number(i._attributes.x)||0,y:Number(i._attributes.y)||0},width:l,height:c,measured:{width:l,height:c}}},Dg=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=te.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=te.START_EVENT.MIN_HEIGHT,{node:So({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Og=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=te.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=te.END_EVENT.MIN_HEIGHT,{node:So({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Vg=(e,t)=>{let{id:o,subType:n,style:r}=e==null?void 0:e._attributes,i=Iu[n],s=t.get(o)||"",a=Cu[s]||"",l=a==="LOOP",c="imported";return!["script","none"].includes(n)&&!l&&(c="adapted"),e.mxGeometry._attributes.width=Yt(e.mxGeometry._attributes.width||0,te.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Yt(e.mxGeometry._attributes.height||0,te.TASK.MIN_HEIGHT),{node:So({cell:e,type:"TASK",variant:i,attribute:a}),status:c,originalType:r}},Hg=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=Su[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=te.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=te.GATEWAY.MIN_HEIGHT,{node:So({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Gg=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:So({cell:e,type:"LANE"}),status:"imported",originalType:t}},Bg=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Yt(e.mxGeometry._attributes.width||0,te.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Yt(e.mxGeometry._attributes.height||0,te.ANNOTATION.MIN_HEIGHT),{node:So({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Mu=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=te.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=te.UNSUPPORTED.MIN_HEIGHT,{node:So({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Pu=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(E({},ut),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},Lu={TASK:Vg,GATEWAY:Hg,START_EVENT:Dg,END_EVENT:Og,LANE:Gg,ANNOTATION:Bg};var zg=e=>{let t=new Map,o=Object.values(ar),n=[],r=new Map;e.forEach(a=>{var c;let l=(c=a._attributes)==null?void 0:c.type;if(l==="MARKER"){r.set(a._attributes.parent,a._attributes.style);return}if(o.includes(l)){n.push(a);return}});let i=[],s=[];for(let a of n){let{type:l}=a._attributes,c=Lu[l]||Mu,{node:d,status:u,originalType:p}=c(a,r);s.push(d),i.push({originalType:p,type:d.type,variant:d.data.variant,value:Au(d.data.label),status:u})}return{nodes:s,governanceIdToNodeIdMap:t,summary:i}},Fg=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>Pu(r,t)),Wg=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=zg(t.root.mxCell),i=Fg(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Yg=async e=>{let t=await vu(e),o=hi(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!i||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},ku=async e=>{try{let t=await Yg(e),{nodes:o,edges:n,summary:r}=Wg(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Ou=require("react/jsx-runtime"),Du=()=>{let{t:e}=(0,ki.useTranslation)(),{toast:t}=Xe(),{setNodes:o,setEdges:n,fitView:r}=(0,Ru.useReactFlow)(),i=a=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=a.map(d=>[d.originalType,d.value,e(`adapter.governance.report.status.${d.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Ou.jsx)(ki.Button,{size:"small",variant:"ghost",onClick:()=>wu({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async a=>{try{let{nodes:l,edges:c,summary:d}=await ku(a);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r({padding:pn,minZoom:fn,maxZoom:mn}),d.some(p=>p.status==="unsupported")){i(d);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};var Vu=require("@produto-lecom/lecom-ui"),Hu=require("react");var Mo=require("react/jsx-runtime"),Gu=a=>{var l=a,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,s=_t(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,Hu.useRef)(null),d=p=>{let f=p.target.files;f!=null&&f.length&&i(f),c.current&&(c.current.value="")};return(0,Mo.jsxs)(Mo.Fragment,{children:[(0,Mo.jsx)(Vu.Button,v(E({disabled:n,onClick:p=>{var f;(f=c.current)==null||f.click(),r==null||r(p)}},s),{children:e})),(0,Mo.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var Po=require("react/jsx-runtime"),Bu=({disabled:e=!1})=>{let{t}=(0,ro.useTranslation)(),{toast:o}=Xe(),{importFromGovernance:n}=Du(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=s=>{let a=s[0];if(!a){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(a)};return(0,Po.jsxs)(ro.Tooltip,{children:[(0,Po.jsx)(ro.TooltipTrigger,{asChild:!0,children:(0,Po.jsx)(Gu,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Po.jsx)(Fs,{})})}),(0,Po.jsx)(ro.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var zu=require("react/jsx-runtime"),Cs=({shortcut:e})=>(0,zu.jsx)("span",{className:"min-h-7.5 inline-flex justify-center items-center py-0.5 px-1.5 bg-grey-100 border border-grey-300 font-mono text-gray-800 shadow-lg rounded-md text-grey-900",children:e});var pe=require("@produto-lecom/lecom-ui"),io=require("lucide-react"),$u=require("react");var Fu=require("@produto-lecom/lecom-ui"),Wu=require("@xyflow/react"),lr=require("html-to-image"),Yu=require("react");var Ug=3,Ss="diagram",Uu=()=>{let{t:e}=(0,Fu.useTranslation)(),{toast:t}=Xe(),{getNodes:o}=(0,Wu.useReactFlow)(),{clearSelection:n}=Qt(),[r,i]=(0,Yu.useState)({png:!1,html:!1,print:!1}),s=()=>{let{x:u,y:p,width:f,height:y}=Fc(o());return{width:f,height:y,style:{width:`${f}px`,height:`${y}px`,transform:`translate(${-u}px, ${-p}px)`}}},a=async(u,p)=>{i(v(E({},r),{[p]:!0})),await n();try{let f=zc();if(!f)throw new Error("Flow element not found");let y=s();return await u(f,y)}catch(f){t({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{i(v(E({},r),{[p]:!1}))}};return{exportAsPng:async(u=Ss)=>{await a(async(p,f)=>{let y=await(0,lr.toPng)(p,v(E({},f),{backgroundColor:"#fcfcfc"}));Li(y,`${u}.png`)},"png")},exportAsHtml:async(u=Ss)=>{await a(async(p,f)=>{let y=await(0,lr.toSvg)(p,v(E({},f),{backgroundColor:"#fcfcfc"})),g=`
39
+ </mxGraphModel>`,Zc=(e,t)=>{if(!e.length&&!t.length)return Zn;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var gg=e=>{let t=Object.values($n),o=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return t.includes(s)}),n=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return["attribute-loop"].includes(s)}),r=[];for(let i of o){let{style:s}=i._attributes,a=kc[s],l=a==null?void 0:a(i,n);if(!l){console.warn(`Node ${s} not supported`);continue}r.push(l)}return r},hg=(e,t)=>{let o=e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}),n=[];for(let r of o){let i=Rc(r),s=t.find(l=>l.id===i.source),a=t.find(l=>l.id===i.target);(s==null?void 0:s.type)==="LANE"||(a==null?void 0:a.type)==="LANE"||n.push(i)}return n},yg=(e,t)=>{let o=[];return e.forEach(n=>{var s,a;let r=(a=(s=Oc)[n.type])==null?void 0:a.call(s,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=Vc(n,t);o.push(l)}}),o},xg=(e,t)=>{let o=[];return e.forEach(n=>{let r=Dc(n,t);o.push(r)}),o},Jc=(e=[],t=[],o)=>{let n=yg(e,o),r=xg(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return Ic(JSON.stringify(i),{compact:!0,spaces:0})},Qc=async e=>{var c,d,u,p,f;let t=await xi(e),o=((d=(c=t==null?void 0:t.mxGraphModel)==null?void 0:c.root)==null?void 0:d.mxCell)||[],n=Number(((f=(p=(u=t==null?void 0:t.mxGraphModel)==null?void 0:u.root)==null?void 0:p._attributes)==null?void 0:f.lastId)||Zn),r=gg(o),i=hg(o,r),s=Kn(r),{nodes:a,edges:l}=zc(s,i);return{lastElementId:n,edges:l,nodes:To(a)}};var wo=require("@xyflow/react"),vi=require("react");var Jn=require("@xyflow/react");var _s=require("react/jsx-runtime"),ie=i=>{var s=i,{type:e,position:t,className:o,nodeType:n}=s,r=_t(s,["type","position","className","nodeType"]);let a=n==="TASK";return(0,_s.jsx)(Jn.Handle,x({type:e,position:t,className:O("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":a,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!a},o)},r))},Ye=a=>{var l=a,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,s=_t(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,Jn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let f=c();if(t==="TASK")return f.filter(g=>g.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return f.filter(g=>g.source===e).length>=2;if(t==="START_EVENT"){let h=d();return f.filter(m=>{if(m.source!==e)return!1;let b=h.find(T=>T.id===m.target);return(b==null?void 0:b.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,_s.jsx)(Jn.Handle,x({type:n,position:r,className:O("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":p,"hover:border-grey-500":!p},i),style:{pointerEvents:p?"none":"auto"}},s))};var bi=require("@xyflow/react"),jc=require("lodash");var ed=require("react/jsx-runtime"),dn=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=_t(r,["nodeId","isVisible"]);let{getNode:i,getNodes:s,setNodes:a}=(0,bi.useReactFlow)(),{isMultipleSelection:l}=K(),c=({width:u,height:p})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let h=[...s()],g=!f.parentId,m=g?f.id:f.parentId,b=h.filter(E=>E.type==="LANE"&&E.parentId===m);if(!b.length)return;let T=(0,jc.orderBy)(b,["position.y"]),y=0;T.forEach((E,_)=>{var A,P;let N=_===T.length-1,w=(P=(A=E.measured)==null?void 0:A.height)!=null?P:0;h=h.map(B=>{if(B.id===E.id){let S=g?u-ve.HEADER_WIDTH:u,D=v(x({},B),{width:S,measured:v(x({},B.measured),{width:S}),position:v(x({},B.position),{y})});return N&&g&&(D.height=p-y),D}return B}),y+=w}),h=h.map(E=>{if(E.id===m){let _=g?u:u+ve.HEADER_WIDTH;return v(x({},E),{width:_,height:g?p:y,measured:{width:_,height:g?p:y}})}return E}),a(h)};return(0,ed.jsx)(bi.NodeResizer,x({nodeId:e,handleClassName:"size-1.5 bg-blue-400 relative before:content-[''] before:absolute before:w-5 before:h-5 before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:cursor-[inherit]",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(u,p)=>c(p)},o))};var Ni=require("@xyflow/react"),St=require("@produto-lecom/lecom-ui"),vo=require("react");var td=require("zustand"),un=(0,td.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var _i=require("react"),od=(e,t=!1)=>{let[o,n]=(0,_i.useState)({width:0,height:0});return(0,_i.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var to=require("@xyflow/react"),nd=require("react"),Eg=120,bg=12,rd=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,to.useReactFlow)(),{instanceId:i}=K();return(0,nd.useMemo)(()=>{var f,h;if(!t)return{position:to.Position.Right,align:"start"};let s=n(e);if(!s)return{position:to.Position.Right,align:"start"};let a=r(),l=s.position.x*a.zoom+a.x,c=(((f=s.measured)==null?void 0:f.width)||s.width||100)*a.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:to.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||Eg;return{position:l+c+u+bg>d?to.Position.Left:to.Position.Right}},[i,e,t,o,n,r])};var Ti=require("@xyflow/react"),ue=require("@produto-lecom/lecom-ui"),id=require("lucide-react");var xe=require("react/jsx-runtime"),sd=({nodeId:e})=>{let{t}=(0,ue.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Ti.useReactFlow)(),i=(0,Ti.useNodesData)(e),a=n().filter(f=>f.source===e).some(f=>{let h=r(f.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=u=>{o(e,{variant:(i==null?void 0:i.data.variant)===u?"":u})},d=u=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===u?"":u})};return(0,xe.jsxs)(ue.DropdownMenu,{children:[(0,xe.jsxs)(ue.Tooltip,{children:[(0,xe.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ue.DropdownMenuTrigger,{asChild:!0,children:(0,xe.jsx)(ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,xe.jsx)(id.WrenchIcon,{})})})}),(0,xe.jsx)(ue.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,xe.jsxs)(ue.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,xe.jsxs)(ue.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,xe.jsx)("div",{className:"flex-1 body-medium-500",children:t("bpmn.task.menu.title")}),(0,xe.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Nr).map(([u,p])=>{let f=u==="LOOP"&&(a||l),g=(()=>{if(u==="LOOP"&&a)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(u==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess");if(u==="LOOP")return t("editor.task_menu.loop")})();return(0,xe.jsxs)(ue.Tooltip,{children:[(0,xe.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:O({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":f}),onClick:f?void 0:()=>d(u),children:(0,xe.jsx)(p.icon,{className:"stroke-inherit"})})}),g&&(0,xe.jsx)(ue.TooltipContent,{color:"black",children:g})]},u)})})]}),(0,xe.jsx)(ue.DropdownMenuGroup,{children:(0,xe.jsxs)(ue.Tooltip,{children:[(0,xe.jsx)(ue.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)("div",{className:O({"cursor-not-allowed":a}),children:(0,xe.jsxs)(ue.DropdownMenuItem,{className:O({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50":a}),disabled:a,onClick:()=>c("SCRIPT"),children:[(0,xe.jsx)(Tr.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})})}),a&&(0,xe.jsx)(ue.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var Ee=require("react/jsx-runtime"),No={START_EVENT:{type:"START_EVENT",icon:wn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Do,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:wn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:xr,label:"bpmn.annotation.variant.default"}},_g={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Ho,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Bo,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:Oo,label:"bpmn.gateway.variant.complex"}},Ze=({nodeId:e,nodeType:t,nodeVariant:o})=>{let n=(0,vo.useRef)(null),r=(0,vo.useRef)(null),{t:i}=(0,St.useTranslation)(),{setDraggableNode:s}=un(),{getEdges:a,getNodes:l,getNode:c}=(0,Ni.useReactFlow)(),{setIsDragging:d,mode:u,isConnecting:p,isDragging:f,isMultipleSelection:h}=K(),g=c(e),m=!!(g!=null&&g.selected)&&!g.dragging&&!p&&!f&&!h,{dimensions:b}=od(n,m),{position:T}=rd(e,m,b),[y,E]=(0,vo.useState)(void 0),_=l(),N=a(),w=o==="SUBPROCESS",A=(0,vo.useCallback)((z,C)=>{d(!1),s({type:C.type,variant:C.variant,attribute:C.attribute,icon:C.icon}),C.icon&&E((0,Ee.jsx)(C.icon,{})),z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("sourceId",e),r.current&&z.dataTransfer.setDragImage(r.current,10,10),setTimeout(()=>{d(!0)},100)},[e,s,d]),P=[{component:(0,Ee.jsx)(ci,{elementId:e})}],B=()=>{if(u==="view")return[];let z=!N.some(C=>{var H;return C.source===e&&((H=_.find(F=>F.id===C.target))==null?void 0:H.type)!=="ANNOTATION"});return[{component:(0,Ee.jsx)(_o,{nodeId:e,disabled:!z,tooltipMessage:z?void 0:i("editor.toolbar.start_event_limit_reached")})},No.TASK,No.ANNOTATION,...P]},S=()=>u==="view"?[{component:(0,Ee.jsx)(jt,{elementId:e})}]:[{component:(0,Ee.jsx)(jt,{elementId:e})},...w?[]:[{component:(0,Ee.jsx)(sd,{nodeId:e})}],{component:(0,Ee.jsx)(_o,{nodeId:e})},No.TASK,...Object.values(_g),...P],D=()=>u==="view"?[{component:(0,Ee.jsx)(jt,{elementId:e})}]:[{component:(0,Ee.jsx)(jt,{elementId:e})},{component:(0,Ee.jsx)(_o,{nodeId:e})},No.TASK,No.ANNOTATION,...P],Q=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},No.ANNOTATION,...P],I=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},No.ANNOTATION,...P],R=()=>u==="view"?[]:[{component:(0,Ee.jsx)(_o,{nodeId:e})},...P],L=()=>u==="view"?[]:[...P],q=(z=>{switch(z){case"START_EVENT":return B();case"TASK":return S();case"GATEWAY":return D();case"END_EVENT":return Q();case"LANE":return I();case"ANNOTATION":return R();case"UNSUPPORTED":return L();default:return[]}})(t);if(!(q.length===0||u==="readonly"))return(0,Ee.jsxs)(Ni.NodeToolbar,{position:T,align:"start",className:"-top-8",isVisible:m,children:[(0,Ee.jsx)("div",{ref:n,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:q.map((z,C)=>{if(z.component)return(0,Ee.jsx)("div",{children:z.component},C);let H={sourceNodeType:t,targetNodeType:z.type,sourceNodeId:e,nodes:_,edges:N},F=lc(H),V={gateway_limit_reached:i("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:i("editor.toolbar.start_event_limit_reached"),start_event_already_exists:i("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:i("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:i("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:i("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:i("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:i("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:i("editor.toolbar.task_limit_reached")},G=F.shouldDisable&&F.reason?V[F.reason]||i(z.label):i(z.label)||"";return(0,Ee.jsxs)(St.Tooltip,{children:[(0,Ee.jsx)(St.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(St.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!F.shouldDisable,disabled:F.shouldDisable,className:F.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:F.shouldDisable?void 0:W=>A(W,z),children:z.icon&&(0,Ee.jsx)(z.icon,{size:16})})}),(0,Ee.jsx)(St.TooltipContent,{color:"black",children:G})]},C)})}),(0,Ee.jsx)("div",{ref:r,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:y})]})};var oo=require("react/jsx-runtime"),ad=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r,setNodes:i}=(0,wo.useReactFlow)(),{inProgress:s,fromNode:a}=(0,wo.useConnection)(),{mode:l}=K(),c=s&&(a==null?void 0:a.id)!==e,d=(0,vi.useCallback)(f=>{let T=f.split(`
40
+ `),y=T.reduce((w,A)=>Math.max(w,A.length),0),E=T.length,_=Math.max(rn.MIN_WIDTH,y*7+32),N=Math.max(rn.MIN_HEIGHT,E*20+24);i(w=>w.map(A=>A.id===e?v(x({},A),{width:_,height:N,style:v(x({},A.style),{width:_,height:N})}):A))},[e,i]),u=(0,vi.useCallback)(f=>{r(e,{label:f}),d(f)},[e,r,d]),p=(0,vi.useCallback)(f=>{d(f)},[d]);return(0,oo.jsxs)("div",{className:O("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:[(0,oo.jsx)(ze,{value:t.label,className:"m-1 text-grey-600 text-left",onChange:u,onInput:p}),(0,oo.jsx)(Ze,{nodeId:e,nodeType:"ANNOTATION"}),l==="edit"&&(0,oo.jsx)(dn,{minWidth:rn.MIN_WIDTH,minHeight:rn.MIN_HEIGHT,isVisible:!n&&o}),!s&&(0,oo.jsx)(ie,{type:"source",position:wo.Position.Right}),(!s||c)&&(0,oo.jsx)(ie,{type:"target",position:wo.Position.Left,className:O({"annotation-handle":c})})]})};var et=require("@xyflow/react"),ld=require("react");var Pe=require("react/jsx-runtime"),cd=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,et.useReactFlow)(),{inProgress:r,fromNode:i}=(0,et.useConnection)(),{reconnectingEdgeId:s}=K(),[a,l]=(0,ld.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!s,d=f=>{n(e,{label:f})},u=()=>{l(!0)},p=()=>{l(!1)};return(0,Pe.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,Pe.jsx)(Do,{className:O("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,Pe.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Pe.jsx)(ze,{value:t.label,isEditing:a,onBlur:p,onChange:d})}),(0,Pe.jsx)(Ze,{nodeId:e,nodeType:"END_EVENT"}),(!r||c)&&(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(ie,{type:"target",position:et.Position.Left,id:"left",className:O({"event-handle":c})}),(0,Pe.jsx)(ie,{type:"target",position:et.Position.Right,id:"right",className:O({"event-handle":c})}),(0,Pe.jsx)(ie,{type:"target",position:et.Position.Top,id:"top",className:O({"event-handle":c})}),(0,Pe.jsx)(ie,{type:"target",position:et.Position.Bottom,id:"bottom",className:O({"event-handle":c})})]}),!r&&(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(ie,{type:"source",position:et.Position.Left,id:"left"}),(0,Pe.jsx)(ie,{type:"source",position:et.Position.Right,id:"right"}),(0,Pe.jsx)(ie,{type:"source",position:et.Position.Top,id:"top"}),(0,Pe.jsx)(ie,{type:"source",position:et.Position.Bottom,id:"bottom"})]})]})};var tt=require("@xyflow/react"),wi=require("react");var Le=require("react/jsx-runtime"),dd=({id:e,data:t,selected:o})=>{let n=Xi[t.variant].icon,{updateNodeData:r}=(0,tt.useReactFlow)(),{inProgress:i,fromNode:s}=(0,tt.useConnection)(),{reconnectingEdgeId:a}=K(),[l,c]=(0,wi.useState)(!1),d=i&&(s==null?void 0:s.id)!==e||!!a,u=(0,wi.useCallback)(h=>{r(e,{label:h})},[e,r]),p=()=>{c(!0)},f=()=>{c(!1)};return(0,Le.jsxs)("div",{className:"relative",onDoubleClick:p,children:[(0,Le.jsx)(n,{className:O("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,Le.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Le.jsx)(ze,{value:t.label,isEditing:l,onBlur:f,onChange:u})}),(0,Le.jsx)(Ze,{nodeId:e,nodeType:"GATEWAY"}),(!i||d)&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(ie,{type:"target",position:tt.Position.Left,id:"left",className:O({"gateway-handle":d})}),(0,Le.jsx)(ie,{type:"target",position:tt.Position.Right,id:"right",className:O({"gateway-handle":d})}),(0,Le.jsx)(ie,{type:"target",position:tt.Position.Top,id:"top",className:O({"gateway-handle":d})}),(0,Le.jsx)(ie,{type:"target",position:tt.Position.Bottom,id:"bottom",className:O({"gateway-handle":d})})]}),!i&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Le.jsx)(Ye,{type:"source",position:tt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var ud=require("@xyflow/react"),ht=require("@produto-lecom/lecom-ui"),Tg=require("lucide-react");var pd=require("react/jsx-runtime");var ot=require("@xyflow/react"),fd=require("react");var ke=require("react/jsx-runtime"),md=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,ot.useReactFlow)(),{inProgress:r,fromNode:i}=(0,ot.useConnection)(),{reconnectingEdgeId:s}=K(),[a,l]=(0,fd.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!s,d=f=>{n(e,{label:f})},u=()=>{l(!0)},p=()=>{l(!1)};return(0,ke.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,ke.jsx)(_r,{className:O("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ke.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ke.jsx)(ze,{value:t.label,isEditing:a,onBlur:p,onChange:d})}),(0,ke.jsx)(Ze,{nodeId:e,nodeType:"START_EVENT"}),(!r||c)&&(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(ie,{type:"target",position:ot.Position.Left,id:"left",className:O({"event-handle":c})}),(0,ke.jsx)(ie,{type:"target",position:ot.Position.Right,id:"right",className:O({"event-handle":c})}),(0,ke.jsx)(ie,{type:"target",position:ot.Position.Top,id:"top",className:O({"event-handle":c})}),(0,ke.jsx)(ie,{type:"target",position:ot.Position.Bottom,id:"bottom",className:O({"event-handle":c})})]}),!r&&(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,ke.jsx)(Ye,{type:"source",position:ot.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var xd=require("@produto-lecom/lecom-ui"),nt=require("@xyflow/react"),tr=require("react");var Qn=60,Ai=(e,t)=>{var s;let o=[],n=`${t} `;for(let a of e){if(!(a.type==="TASK"))continue;let c=(s=a.data)==null?void 0:s.label;if(c&&c.startsWith(n)){let d=c.substring(n.length);/^\d{1,15}$/.test(d)&&o.push(parseInt(d,10))}}let r=o.length>0?Math.max(...o)+1:1,i=`${t} ${r}`;return i.length<=Qn?i:i.substring(0,Qn).trim()},pn=(e,t)=>{var a;let o=new Set;for(let l of t)l.type==="TASK"&&((a=l.data)!=null&&a.label)&&o.add(l.data.label);let n=e;if(n.length>Qn&&(n=n.substring(0,Qn).trim()),!o.has(n))return n;let r=n.replace(/\s+\(\d+\)$/,""),i=2,s=o.size+2;for(;i<=s;){let l=` (${i})`,c=Qn-l.length,u=`${r.substring(0,c).trim()}${l}`;if(!o.has(u))return u;i++}return n};var jn=require("react/jsx-runtime"),gd=e=>(0,jn.jsxs)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,jn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,jn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var Ts=require("react/jsx-runtime"),hd=e=>(0,Ts.jsx)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,Ts.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z",fill:"#38bdf8"})}));var er=require("react/jsx-runtime"),yd=e=>(0,er.jsxs)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,er.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,er.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ne=require("react/jsx-runtime"),Ng={APROVADO:gd,EM_ANDAMENTO:hd,REJEITADO:yd},Ns={APROVADO:"border-green-500 border-[3px] border-solid",EM_ANDAMENTO:"border-turquoise-400 border-[3px] border-solid",REJEITADO:"border-red-500 border-[3px] border-solid",default:"border-grey-400 border-2 border-solid",error:"border-red-500 border-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)]"},Ed=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,xd.useTranslation)(),{toast:i}=Ke(),{updateNodeData:s,getNodes:a,setNodes:l}=(0,nt.useReactFlow)(),{inProgress:c,fromNode:d}=(0,nt.useConnection)(),{mode:u,onSubprocessValidationClick:p,reconnectingEdgeId:f}=K(),{getTaskStatus:h}=po(),g=c&&(d==null?void 0:d.id)!==e||!!f,m=(0,tr.useCallback)(Q=>{let q=Q.split(`
41
+ `),z=q.reduce((V,G)=>Math.max(V,G.length),0),C=q.length,H=Math.max(nn.MIN_WIDTH,z*7+48),F=Math.max(nn.MIN_HEIGHT,C*20+24);l(V=>V.map(G=>G.id===e?v(x({},G),{width:H,height:F,style:v(x({},G.style),{width:H,height:F})}):G))},[e,l]),b=(0,tr.useCallback)(Q=>{let I=Q.trim(),R=t.label||"";if(I===R)return;let L=I,M=a();if(!(I&&I!=="")){L=Ai(M,r("bpmn.task.label.prefix")),s(e,{label:L}),m(L),i({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,ne.jsx)("strong",{children:L})]})});return}let z=pn(L,M);z===R||(s(e,{label:z}),m(z),z!==L&&i({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,ne.jsx)("strong",{children:I})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,ne.jsx)("strong",{children:z})]})}))},[t.label,a,e,r,s,m,i]),T=(0,tr.useCallback)(Q=>{m(Q)},[m]),y=(0,tr.useCallback)(()=>{i({variant:"error",content:r("bpmn.task.feedback.invalid_first_character")})},[r,i]),E=h(e),_=E?Ng[E]:null,N=t.variant?Tr[t.variant].icon:null,w=t.attribute?Nr[t.attribute].icon:null,A=t.variant==="SUBPROCESS",P=N&&!A,B=w||A,S=()=>t.hasError?Ns.error:E?Ns[E]:Ns.default,D=()=>{p==null||p({id:e,type:"sub_process",label:t.label})};return(0,ne.jsxs)("div",{className:O("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md hover:shadow-md transition-colors duration-75",S(),{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ne.jsx)(ze,{value:t.label,maxLength:60,className:O("m-1",{"py-6":P||B}),onChange:b,onInput:T,onInvalidFirstCharacter:y}),N&&(0,ne.jsx)("div",{className:O("absolute flex items-center p-1",A?"bottom-0":"top-0 left-0"),children:(0,ne.jsx)(N,{size:16,className:O(t.hasError?"text-red-500":"text-grey-500",A&&"cursor-pointer"),onClick:A?D:void 0})}),w&&(0,ne.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ne.jsx)("div",{className:O("flex items-center w-16 p-1",A?"justify-between":"justify-center"),children:(0,ne.jsx)(w,{size:16,className:O(t.hasError?"text-red-500":"text-grey-500")})})}),_&&(0,ne.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,ne.jsx)(_,{})}),(0,ne.jsx)(Ze,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant}),u==="edit"&&(0,ne.jsx)(dn,{minWidth:nn.MIN_WIDTH,minHeight:nn.MIN_HEIGHT,isVisible:!n&&o}),(!c||g)&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(ie,{type:"target",position:nt.Position.Left,id:"left",className:O({"task-handle":g})}),(0,ne.jsx)(ie,{type:"target",position:nt.Position.Right,id:"right",className:O({"task-handle":g})}),(0,ne.jsx)(ie,{type:"target",position:nt.Position.Top,id:"top",className:O({"task-handle":g})}),(0,ne.jsx)(ie,{type:"target",position:nt.Position.Bottom,id:"bottom",className:O({"task-handle":g})})]}),!c&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(Ye,{type:"source",position:nt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var vs=require("@xyflow/react");var zt=require("react/jsx-runtime"),bd=({id:e,data:t})=>(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,zt.jsx)(Ze,{nodeId:e,nodeType:"UNSUPPORTED"}),(0,zt.jsx)(ie,{type:"source",position:vs.Position.Right}),(0,zt.jsx)(ie,{type:"target",position:vs.Position.Left})]});var we=require("@xyflow/react"),Ii=require("react");var be=require("react/jsx-runtime"),Dw={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:we.MarkerType.Arrow},data:{label:""}},_d=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:s,sourceHandleId:a,targetHandleId:l})=>{var G;let{zoom:c}=(0,we.useViewport)(),{updateEdgeData:d}=(0,we.useReactFlow)(),{isMultipleSelection:u,mode:p,instanceId:f}=K(),h=p!=="edit",[g,m]=(0,Ii.useState)(!1),{reconnectingHandle:b,cursorPosition:T,hoveredNodeId:y,reconnectingSide:E,isValidReconnection:_,handleReconnectStart:N}=mi({edgeId:e,source:t,target:o,instanceId:f,isReadOnly:h}),w=(0,we.useInternalNode)(t),A=(0,we.useInternalNode)(o),{sx:P,sy:B,tx:S,ty:D,sourcePos:Q,targetPos:I}=(0,Ii.useMemo)(()=>{var le,ce;if(!w||!A)return{sx:0,sy:0,tx:0,ty:0,sourcePos:we.Position.Left,targetPos:we.Position.Right};let W=Uo(w,A),te=a?i:W.sourcePos,k=l?s:W.targetPos,X=(fe,me,Se)=>{var Ve,Ue,Ft,ko,Ro,Re;let{x:Me,y:_e}=fe.internals.positionAbsolute,ae=(Ft=(Ue=(Ve=fe.measured)==null?void 0:Ve.width)!=null?Ue:fe.width)!=null?Ft:0,re=(Re=(Ro=(ko=fe.measured)==null?void 0:ko.height)!=null?Ro:fe.height)!=null?Re:0;switch(me){case we.Position.Top:return{x:Me+ae*Se,y:_e};case we.Position.Bottom:return{x:Me+ae*Se,y:_e+re};case we.Position.Left:return{x:Me,y:_e+re*Se};case we.Position.Right:return{x:Me+ae,y:_e+re*Se};default:return{x:Me+ae/2,y:_e+re/2}}},J=(le=n==null?void 0:n.sourceOffset)!=null?le:.5,Y=(ce=n==null?void 0:n.targetOffset)!=null?ce:.5,$=w?X(w,te,J).x:W.sx,U=w?X(w,te,J).y:W.sy,Z=A?X(A,k,Y).x:W.tx,j=A?X(A,k,Y).y:W.ty;return b==="source"&&T?($=T.x,U=T.y,E&&(te=E)):b==="target"&&T&&(Z=T.x,j=T.y,E&&(k=E)),{sx:$,sy:U,tx:Z,ty:j,sourcePos:te,targetPos:k}},[w,A,a,l,i,s,b,T,E,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!w||!A)return null;let[R,L,M]=(0,we.getSmoothStepPath)({sourceX:P,sourceY:B,targetX:S,targetY:D,sourcePosition:Q,targetPosition:I}),q=r||(w==null?void 0:w.selected)||(A==null?void 0:A.selected),z=q?"sequence-edge-marker-highlighted":"sequence-edge-marker",C=g||(n==null?void 0:n.label.trim().length)>0,H=()=>{m(!0)},F=()=>{m(!1)},V=W=>{d(e,{label:W.trim()})};return(0,be.jsx)(be.Fragment,{children:(0,be.jsxs)("g",{className:O("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":q}),onDoubleClick:H,children:[(0,be.jsx)(we.BaseEdge,{id:e,path:R,markerEnd:`url(#${z})`,strokeDasharray:4,className:O("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||b&&y&&!_,"stroke-green-500":b&&y&&_,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":q&&!(n!=null&&n.hasError)&&!b})}),(0,be.jsxs)(we.EdgeLabelRenderer,{children:[(0,be.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${L}px, ${M}px)`},children:[r&&!u&&(0,be.jsx)(tn,{sx:P,sy:B,tx:S,ty:D,hasLabel:!!((G=n==null?void 0:n.label)!=null&&G.trim()),children:(0,be.jsx)(en,{edgeId:e,edgeType:"MESSAGE_EDGE"})}),C&&(0,be.jsx)(ze,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onBlur:F,onChange:V})]}),r&&!u&&!h&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${P}px, ${B}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:b==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:b==="source"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:O("pointer-events-auto",{"cursor-move":!b||b!=="source","cursor-not-allowed":b==="source"&&y&&!_,"cursor-grabbing":b==="source"&&(!y||_)}),onMouseDown:W=>N("source",W.nativeEvent)})]})}),(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${S}px, ${D}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:b==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:b==="target"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:O("pointer-events-auto",{"cursor-move":!b||b!=="target","cursor-not-allowed":b==="target"&&y&&!_,"cursor-grabbing":b==="target"&&(!y||_)}),onMouseDown:W=>N("target",W.nativeEvent)})]})})]})]})]})})};var Ao=require("@xyflow/react"),or=require("react/jsx-runtime"),Td=({toX:e,toY:t,fromNode:o})=>{var u,p;if(!o)return null;let{internals:{positionAbsolute:{x:n,y:r}},measured:i}=o,s=(u=i.width)!=null?u:0,a=(p=i.height)!=null?p:0,c=[{x:n,y:r+a/2,pos:Ao.Position.Left},{x:n+s,y:r+a/2,pos:Ao.Position.Right},{x:n+s/2,y:r,pos:Ao.Position.Top},{x:n+s/2,y:r+a,pos:Ao.Position.Bottom}].reduce((f,h)=>{let g=Math.hypot(e-f.x,t-f.y);return Math.hypot(e-h.x,t-h.y)<g?h:f}),[d]=(0,Ao.getStraightPath)({sourceX:c.x,sourceY:c.y,targetX:e,targetY:t});return(0,or.jsxs)("g",{children:[(0,or.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d}),(0,or.jsx)("circle",{cx:e,cy:t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Ci=require("@xyflow/react"),Nd=require("lodash"),nr=require("react");var rt=require("react/jsx-runtime"),vd=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:s}=(0,Ci.useReactFlow)(),{mode:a}=K(),[l,c]=(0,nr.useState)(!1),d=s(),u=!r,p=(0,nr.useMemo)(()=>(0,Nd.orderBy)([...d.filter(T=>T.parentId===e&&T.type==="LANE")],"position.y","asc"),[d,e]),f=u?Ei.MIN_WIDTH:ve.MIN_WIDTH,h=(0,nr.useMemo)(()=>{if(u&&p.length>1){let T=[...p];return T.pop(),T.reduce((E,_)=>{var N,w;return E+((w=(N=_.measured)==null?void 0:N.height)!=null?w:0)},0)+ve.MIN_HEIGHT}return ve.MIN_HEIGHT},[u,p]),g=T=>{i(e,{label:T})},m=()=>{c(!0)},b=()=>{c(!1)};return(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsxs)("div",{className:O("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,rt.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onDoubleClick:m,children:(0,rt.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,rt.jsx)(ze,{value:t.label,className:"w-full h-full self-auto",contentClassName:O({"whitespace-nowrap":l}),isEditing:l,onBlur:b,onChange:g})})}),(0,rt.jsx)("div",{className:"flex-1"})]}),(0,rt.jsx)(Ze,{nodeId:e,nodeType:"LANE",isChild:!u}),a==="edit"&&(0,rt.jsx)(dn,{nodeId:e,minWidth:f,minHeight:h,isVisible:!n&&o}),(0,rt.jsx)(ie,{type:"source",position:Ci.Position.Right})]})};var wd={START_EVENT:md,END_EVENT:cd,TASK:Ed,GATEWAY:dd,ANNOTATION:ad,LANE:vd,UNSUPPORTED:bd},Ad={SEQUENCE_EDGE:vc,MESSAGE_EDGE:_d,ANNOTATION_EDGE:xc},Id="#fafafa",Cd="#bebebe",Sd=1,Md=10,Pd="bottom-left",ws=.05,Ld=5,fn=.5,mn=ws,gn=1,kd={x:0,y:0,zoom:.75},vg=1,wg=2,Rd=[vg,wg];var Dd=require("@xyflow/react");var pt=()=>{let{getEdges:e,getNodes:t}=(0,Dd.useReactFlow)(),{lastElementId:o}=K(),n=()=>{let i=t(),s=e(),a=Zc(i,s);return Math.max(a,o)};return{getLastId:n,getNextId:()=>n()+1}};var yn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,setViewport:r}=(0,hn.useReactFlow)(),{getLastId:i}=pt(),s=(0,hn.useStoreApi)(),{setLastElementId:a}=K(),l=(0,As.useCallback)(async(d="")=>{let{nodes:u,edges:p,lastElementId:f}=await Qc(d),{width:h,height:g}=s.getState();if(h>0&&g>0){let m=Fc(u);m&&r((0,hn.getViewportForBounds)(m,h,g,mn,gn,fn))}o(u),n(p),a(f)},[o,n,a,s,r]),c=(0,As.useCallback)(()=>{let d=e(),u=t(),p=i();return Jc(d,u,p)},[e,t,i]);return{importFromMxGraph:l,exportToMxGraph:c}};var Is=require("react"),Ag=500,Si=()=>{let{isInitialized:e,onElementChanges:t}=K(),{exportToMxGraph:o}=yn(),n=(0,Od.useDebouncedCallback)(()=>{if(!e)return;let s=o();t==null||t(s)},Ag),r=(0,Is.useCallback)(s=>{s.every(c=>c.type==="select")||s.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Is.useCallback)(s=>{s.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var Vd=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n,getInternalNode:r}=(0,Mi.useReactFlow)(),{emitElementChanges:i}=Si(),s=(0,Mt.useRef)(null),{getNextId:a}=pt(),l=(0,Mt.useCallback)(g=>{var E;let m=t(g.source),b=t(g.target);if(!m||!b)return!1;let T={sourceNodeId:m.id,targetNodeId:b.id,sourceNodeType:m.type,targetNodeType:b.type,nodes:n(),edges:o(),reconnectingEdgeId:(E=s.current)!=null?E:void 0};return us(T).isValid},[t,o,n]),c=(0,Mt.useCallback)(g=>{var T,y;let m=a(),b=r(g.source);if(b){let E=r(g.target),_=E?E.internals.positionAbsolute.x+((T=E.measured.width)!=null?T:0)/2:0,N=E?E.internals.positionAbsolute.y+((y=E.measured.height)!=null?y:0)/2:0,w=wc(b,_,N),A=(E==null?void 0:E.type)==="ANNOTATION"||(b==null?void 0:b.type)==="ANNOTATION",P=A?on:ut,B;if(!A&&E&&g.targetHandle){let D=hi(w),Q=hi(g.targetHandle),{x:I,y:R}=ys(b,w),{x:L,y:M}=ys(E,g.targetHandle),z=pi(I,R,L,M,D,Q).slice(1,-1);z.length>0&&(B=z)}let S=v(x(x({},g),P),{id:String(m),sourceHandle:w,data:x(x({},A?{}:ut.data),B?{points:B}:{})});e(D=>D.concat(S))}i()},[a,e,i,r]),d=(0,Mt.useCallback)((g,m)=>{s.current=m.id},[]),u=(0,Mt.useCallback)(()=>{s.current=null},[]),p=(0,Mt.useCallback)((g,m)=>{let b=t(m.source),T=t(m.target);if(!b||!T){s.current=null;return}let y={sourceNodeId:b.id,targetNodeId:T.id,sourceNodeType:b.type,targetNodeType:T.type,nodes:n(),edges:o(),reconnectingEdgeId:g.id};if(!us(y).isValid){s.current=null;return}e(_=>(0,Mi.reconnectEdge)(g,m,_).map(w=>w.id===g.id?v(x({},w),{data:v(x({},w.data),{points:void 0})}):w)),s.current=null,i()},[t,n,o,e,i]),f=(0,Mt.useCallback)(g=>{s.current=g},[]),h=(0,Mt.useCallback)(()=>{s.current=null},[]);return{isValidConnection:l,onConnect:c,onReconnect:p,onReconnectStart:d,onReconnectEnd:u,setReconnectingEdge:f,clearReconnectingEdge:h}};var $d=require("@produto-lecom/lecom-ui"),Xd=require("@xyflow/react"),yt=require("react");var rr=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Io=(e=[])=>e.filter(t=>t.type==="END_EVENT"),no=(e=[])=>e.filter(t=>t.type==="TASK")||[],Hd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Gd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Pi=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Bd=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),it=(e,t=[])=>t.filter(o=>o.source===e),ir=(e,t=[])=>t.filter(o=>o.target===e),zd=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Fd=(e,t)=>{let o=it(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},Wd=e=>e?/[^\s]/.test(e.trim()):!1,ge=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Pt=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},Yd=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var sr=[{id:"start_event_not_found",validate:e=>{let t=rr(e.nodes);return ge({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Io(e.nodes);return ge({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=rr(e.nodes),o=t.length===1;if(t.length===0)return ge({isValid:!0});if(!o)return ge({isValid:!1,nodeIds:t.map(i=>i.id)});let n=it(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(s=>s.id),...n.map(s=>s.target)];return ge({isValid:!1,nodeIds:[...new Set(i)]})}return ge({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=no(e.nodes),o=Pt(t,n=>it(n.id,e.edges).length<=2);return ge({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=no(e.nodes),o=Pt(t,n=>!!n.label&&n.label.trim()!=="");return ge({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=no(e.nodes),n=Pt(o,r=>!r.label||r.label.length<=60);return ge({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=no(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return ge({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Pi(e.nodes),o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return ge({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...rr(e.nodes),...Io(e.nodes)],o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&(a.type==="START_EVENT"||a.type==="END_EVENT")&&(o.push(r.id,a.id),n.push(s.id))}}return ge({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Io(e.nodes),o=[],n=[];for(let r of t){let i=ir(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.source);if(a&&a.type==="TASK"){let l=it(a.id,e.edges);l.length>1&&(o.push(a.id),l.forEach(c=>n.push(c.id)))}}}return ge({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Bd(e.nodes),o=Pt(t,r=>it(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>it(r,e.edges).map(i=>i.id));return ge({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=no(e.nodes),o=Pt(t,n=>!n.label||Wd(n.label));return ge({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,a;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((a=e==null?void 0:e.edges)!=null&&a.length))return ge({isValid:!0});let t=Io(e.nodes)[0];if(!t)return ge({isValid:!0});let o=ir(t.id,e.edges);if(!o.length)return ge({isValid:!0});let r=no(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Pt(r,l=>!zd(l.id,e));return ge({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=no(e.nodes),o=Io(e.nodes)[0];if(!o)return ge({isValid:!0});let n=t.filter(l=>{let c=ir(l.id,e.edges),d=it(l.id,e.edges),u=c.some(f=>{var h;return((h=e.nodes.find(g=>g.id===f.source))==null?void 0:h.type)==="START_EVENT"}),p=d.some(f=>{var h;return((h=e.nodes.find(g=>g.id===f.target))==null?void 0:h.type)==="END_EVENT"});return u&&p}),r=ir(o.id,e.edges),i=r.length>1,s=r.map(l=>l.source),a={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?s:[]]};return ge(a)}},{id:"gateway_flow_to_event",validate:e=>{let t=Pi(e.nodes),o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="END_EVENT"&&(o.push(r.id,a.id),n.push(s.id))}}return ge({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Pi(e.nodes),o=Pt(t,n=>it(n.id,e.edges).length>=1);return ge({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...rr(e.nodes),...Io(e.nodes)],o=[],n=[];for(let r of t){let i=it(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return ge({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Hd(e.nodes),o=Pt(t,n=>!Fd(n.id,e));return ge({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Gd(e.nodes),o=Pt(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return ge({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Ud=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of sr){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Co=require("react/jsx-runtime"),Kd=()=>{let{t:e}=(0,$d.useTranslation)(),{toast:t}=Ke(),{setNodes:o,setEdges:n,getNodes:r,getEdges:i}=(0,Xd.useReactFlow)(),[s,a]=(0,yt.useState)(!1),l=(0,yt.useRef)(!1),c=(0,yt.useRef)(!1),d=(0,yt.useCallback)(g=>{let m=Yd(g.nodes,g.edges),b=Ud(m),T=b.errors.map(y=>v(x({},y),{message:e(`validation.errors.${y.id}`)}));return s||a(!0),{isValid:b.isValid,errors:T}},[s,e]),u=(0,yt.useCallback)((g,m=!0)=>{if(m&&g&&t({variant:g.isValid?"success":"error",duration:5e3,title:g.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,Co.jsxs)("div",{className:"flex flex-col gap-1",children:[!g.isValid&&(0,Co.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,Co.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:g.isValid?(0,Co.jsx)("li",{children:e("validation.success.message")}):g.errors.map(S=>(0,Co.jsx)("li",{className:"text-xs",children:S.message},S.id))})]})}),!g)return;l.current=!0,c.current=!0;let b=[],T=[];g.errors.forEach(S=>{S.nodeIds&&S.nodeIds.length>0&&S.nodeIds.forEach(D=>b.push(D)),S.edgeIds&&S.edgeIds.length>0&&S.edgeIds.forEach(D=>T.push(D))});let y=[...new Set(b)];o(S=>S.map(D=>v(x({},D),{data:v(x({},D.data),{hasError:!1})}))),n(S=>S.map(D=>v(x({},D),{data:v(x({},D.data),{hasError:!1})})));let E=r(),_=i(),N=new Set(y),w=new Set;g.errors.forEach(S=>{var I,R;let D=sr.find(L=>L.id===S.id);(D==null?void 0:D.highlightRelatedEdges)!==!1&&((I=S.edgeIds)==null||I.forEach(L=>w.add(L)),(R=S.nodeIds)==null||R.forEach(L=>{_.forEach(M=>{(M.source===L||M.target===L)&&w.add(M.id)})}))});let A=new Set,P=new Set,B=new Set;E.forEach(S=>{S.type==="START_EVENT"?A.add(S.id):S.type==="END_EVENT"&&P.add(S.id)}),_.forEach(S=>{A.has(S.source)&&B.add(S.target),P.has(S.target)&&B.add(S.source)}),B.forEach(S=>{var D,Q;if(N.has(S)){let I=(D=g.errors.find(L=>{var M;return(M=L.nodeIds)==null?void 0:M.includes(S)}))==null?void 0:D.id;((Q=sr.find(L=>L.id===I))==null?void 0:Q.highlightRelatedEdges)!==!1&&_.forEach(L=>{L.source===S&&P.has(L.target)&&(N.add(L.target),w.add(L.id)),L.target===S&&A.has(L.source)&&(N.add(L.source),w.add(L.id))})}}),N.size>0&&o(S=>S.map(D=>v(x({},D),{data:v(x({},D.data),{hasError:N.has(D.id)})}))),w.size>0&&n(S=>S.map(D=>v(x({},D),{data:v(x({},D.data),{hasError:w.has(D.id)})}))),setTimeout(()=>{l.current=!1},0)},[e,i,r,n,o,t]),p=(0,yt.useCallback)(()=>{a(!1),c.current=!1,o(g=>g.map(m=>v(x({},m),{data:v(x({},m.data),{hasError:!1})}))),n(g=>g.map(m=>v(x({},m),{data:v(x({},m.data),{hasError:!1})})))},[n,o]),f=(0,yt.useCallback)(()=>{c.current&&(l.current=!0,c.current=!1,o(g=>g.map(m=>v(x({},m),{data:v(x({},m.data),{hasError:!1})}))),n(g=>g.map(m=>v(x({},m),{data:v(x({},m.data),{hasError:!1})}))),setTimeout(()=>{l.current=!1},0))},[n,o]),h=(0,yt.useCallback)(()=>l.current,[]);return{validateDiagram:d,handleValidationComplete:u,clearValidation:p,dismissValidationPanel:f,isAutoValidationEnabled:s,getIsClearingValidation:h}};var Jd=require("@xyflow/react"),Qd=require("@produto-lecom/lecom-ui"),jd=require("react");var Ig=15,qd="bpmn:selection",Cg=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},Zd=e=>{if(!Cg(e.target))return!0;let t=window.getSelection(),o=t&&t.toString().length>0;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement){let n=e.target;return n.selectionStart===n.selectionEnd&&!o}return!o},eu=({offset:e=Ig}={})=>{let{t}=(0,Qd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,Jd.useReactFlow)(),{getNextId:s}=pt();(0,jd.useEffect)(()=>{let a=c=>{var m,b;if(!Zd(c))return;let d=o(),u=r(),p=d.filter(T=>T.selected);if(!p.length)return;c.preventDefault(),c.stopPropagation();let f=u.filter(T=>p.some(y=>y.id===T.source)&&p.some(y=>y.id===T.target)),g=JSON.stringify({nodes:p,edges:f});(m=c.clipboardData)==null||m.setData(qd,g),(b=c.clipboardData)==null||b.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},l=c=>{var y,E;if(!Zd(c))return;let d=(y=c.clipboardData)==null?void 0:y.getData(qd);if(!d)return;c.preventDefault(),c.stopPropagation();let u;try{u=JSON.parse(d)}catch(_){return}if(!((E=u.nodes)!=null&&E.length))return;let p=new Map,f=o(),h=[],g=u.nodes.filter(_=>Jt(_.type,f));if(g.length===0)return;let m=s(),b=g.map(_=>{var A;let N=String(m++);p.set(_.id,N);let w=v(x({},_),{id:N,selected:!0,position:{x:_.position.x+e,y:_.position.y+e}});if(_.type==="TASK"){let P=(A=_.data)==null?void 0:A.label,B=pn(P||t("bpmn.task.label.prefix"),[...f,...h]);w.data=v(x({},_.data),{label:B})}return h.push(w),w}),T=u.edges.map(_=>v(x({},_),{id:String(m++),selected:!0,source:p.get(_.source)||_.source,target:p.get(_.target)||_.target}));n(_=>[..._.map(N=>v(x({},N),{selected:!1})),...b]),i(_=>[..._.map(N=>v(x({},N),{selected:!1})),...T])};return document.addEventListener("copy",a,!0),document.addEventListener("paste",l,!0),()=>{document.removeEventListener("copy",a,!0),document.removeEventListener("paste",l,!0)}},[o,n,r,i,s,e,t])};var Li=require("@xyflow/react");var tu=require("@produto-lecom/lecom-ui"),ou=require("react");var nu=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,Li.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=un(),{t:s}=(0,tu.useTranslation)(),{getInternalNode:a,getNodes:l,screenToFlowPosition:c}=(0,Li.useReactFlow)(),{getNextId:d}=pt(),{setIsDragging:u}=K(),{rebuildIndex:p,forceRebuildIndex:f}=oi(),[h,g]=(0,ou.useState)(null),m=(I,R=!1)=>{let L=R?"node-drop-target-error":"node-drop-target",M=R?"node-drop-target-lane-error":"node-drop-target-lane";t(q=>q.map(z=>z.id===I?v(x({},z),{className:L}):I!==void 0&&z.parentId===I&&z.type==="LANE"?v(x({},z),{className:M}):v(x({},z),{className:""})))},b=()=>{let{nodeLookup:I}=n.getState();return Array.from(I.values())},T=(I,R)=>{let L=b();if(I.type==="LANE"){if(R){m();return}let H=L.filter(G=>G.id!==I.id&&G.type==="LANE"&&!G.parentId),F=Xn(I,H);if(!F){m();return}if(cn({parentId:F.id,nodes:e,excludeTypes:["LANE"]})){m(F.id,!0);return}m(F.id);return}let q=L.filter(H=>H.id!==I.id&&H.type==="LANE"),z=Xn(I,q);if(!z){m();return}if(cn({parentId:z.id,nodes:e,includeTypes:["LANE"]})){m();return}m(z.id)},y=I=>{let R=a(I.id),L=I.type==="LANE"&&cn({parentId:I.id,nodes:e,includeTypes:["LANE"]});T(R,L)},E=I=>I.map(R=>v(x({},R),{className:void 0})),_=I=>I.some(L=>L.dragging)?I.map(L=>L.dragging?v(x({},L),{dragging:!1}):L):I,N=I=>{if(I.preventDefault(),I.dataTransfer.dropEffect="move",!(r!=null&&r.type))return;let R=c({x:I.clientX,y:I.clientY}),L={id:"__sidebar_drag__",type:r.type,position:R,measured:{width:1,height:1},internals:{positionAbsolute:R}};T(L,!1)},w=I=>{let R=I.relatedTarget;(!R||!I.currentTarget.contains(R))&&m()},A=(I,R)=>{I.preventDefault(),y(R)},P=(I,R,L)=>{var H,F;let M=[...L];if(I.parentId===R.id)return M=$c(I,R,M),M=Kn(M),E(M);if(I.type==="LANE"){if(cn({parentId:R.id,nodes:M,excludeTypes:["LANE"]})){let k=Ht(R),X=50,J=50;return M.map(Y=>{var $,U;return Y.id===I.id?v(x({},Y),{position:{x:($=h==null?void 0:h.x)!=null?$:k.x+X,y:(U=h==null?void 0:h.y)!=null?U:k.y2+J}}):Y})}let W=M.filter(k=>k.parentId===R.id).reduce((k,X)=>{var J,Y;return k+((Y=(J=X.measured)==null?void 0:J.height)!=null?Y:0)},0),te={x:ve.HEADER_WIDTH,y:W};return M=M.map(k=>k.id===I.id?v(x({},k),{parentId:R.id,position:te,className:void 0}):v(x({},k),{className:void 0})),M=qn(R.id,M),M}if(cn({parentId:R.id,nodes:M,includeTypes:["LANE"]})){let V;if(I.parentId){let G=a(I.parentId),{x:W,y:te}=Bt(G);V={x:W+((H=I.position.x)!=null?H:0),y:te+((F=I.position.y)!=null?F:0)}}return M=M.map(G=>G.id===I.id?v(x({},G),{position:V!=null?V:G.position,parentId:void 0,className:void 0}):v(x({},G),{className:void 0})),M}let C=Gc(I,R);return M=M.map(V=>{if(V.id===I.id){let G=Ht(I),W=Ht(R);return G.y<W.y&&(C.y=0),G.x<W.x+ve.HEADER_WIDTH&&(C.x=ve.HEADER_WIDTH),v(x({},V),{parentId:R.id,position:C,className:void 0})}return v(x({},V),{className:void 0})}),M=Kn(M),M},B=I=>{if(I.preventDefault(),!(r!=null&&r.type))return;if(!Jt(r.type,l())){u(!1),i(null);return}let R=c({x:I.clientX,y:I.clientY}),L={width:oe[r.type].MIN_WIDTH,height:oe[r.type].MIN_HEIGHT},M=d(),q={id:String(M),type:r.type,position:R,measured:L,data:{label:r.type==="TASK"?Ai(e,s("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},z=v(x({},q),{internals:{positionAbsolute:R}}),C=v(x({},z),{measured:{width:1,height:1}}),H=b(),F=r.type==="LANE",V=H.filter(k=>F?k.type==="LANE"&&!k.parentId:k.type==="LANE"),G=Xn(C,V),W=[...e.map(k=>v(x({},k),{selected:!1})),q];G&&(W=P(z,G,W)),W=To(W),W=E(W),t(W),f();let te=I.dataTransfer.getData("sourceId");if(te){let k={id:String(M+1),source:te,target:q.id};r.type==="ANNOTATION"?o(X=>X.concat(x(x({},k),on))):o(X=>X.concat(x(x({},k),ut)))}u(!1),i(null)},S=async(I,R,L)=>{let M=[...e];L.forEach(q=>{let z=b(),C=a(q.id),H=q.type==="LANE",F=z.filter(G=>G.id!==q.id&&(H?G.type==="LANE"&&!G.parentId:G.type==="LANE")),V=Xn(C,F);if(V){M=P(C,V,M);return}q.parentId&&(M=Q(q,M))}),M=_(M),M=To(M),M=E(M),t(M),p(M),g(null)},D=(I,R)=>{g({x:R.position.x,y:R.position.y})},Q=(I,R)=>{var C,H;let L=a(I.parentId),{x:M,y:q}=Bt(L),z={x:M+((C=I.position.x)!=null?C:0),y:q+((H=I.position.y)!=null?H:0)};return R=R.map(F=>F.id===I.id?v(x({},F),{position:z,parentId:void 0}):F),R=qn(I.parentId,R),R};return{onDragOver:N,onDragLeave:w,onDrop:B,onNodeDrag:A,onNodeDragStart:D,onNodeDragStop:S}};var ru=require("@xyflow/react"),iu=require("@produto-lecom/lecom-ui"),su=require("react");var Sg=30,Mg=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},Pg=e=>!Mg(e.target),au=({offset:e=Sg}={})=>{let{t}=(0,iu.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,ru.useReactFlow)(),{getNextId:s}=pt();(0,su.useEffect)(()=>{let a=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&Pg(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),u=c.filter(y=>y.selected);if(!u.length)return;let p=new Map,f=[],h=u.filter(y=>Jt(y.type,c));if(h.length===0)return;let g=d.filter(y=>h.some(E=>E.id===y.source)&&h.some(E=>E.id===y.target)),m=s(),b=h.map(y=>{var N;let E=String(m++);p.set(y.id,E);let _=v(x({},y),{id:E,selected:!0,position:{x:y.position.x+e,y:y.position.y+e}});if(y.type==="TASK"){let w=(N=y.data)==null?void 0:N.label,A=pn(w||t("bpmn.task.label.prefix"),[...c,...f]);_.data=v(x({},y.data),{label:A})}return f.push(_),_}),T=g.map(y=>v(x({},y),{id:String(m++),selected:!0,source:p.get(y.source)||y.source,target:p.get(y.target)||y.target}));n(y=>[...y.map(E=>v(x({},E),{selected:!1})),...b]),i(y=>[...y.map(E=>v(x({},E),{selected:!1})),...T])}};return document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("keydown",a,!0)}},[o,n,r,i,s,e,t])};var lr=require("react"),lu=require("@xyflow/react");var Lg=20,kg=50,ar={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},Rg=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},cu=e=>{let{getNodes:t}=(0,lu.useReactFlow)(),{mode:o,isMoveTool:n}=K(),r=(0,lr.useRef)(0),i=(0,lr.useRef)(new Map);(0,lr.useEffect)(()=>{let s=a=>{if(o!=="edit"||!n||Rg(a.target)||!Object.values(ar).includes(a.key))return;let u=t().filter(T=>T.selected);if(u.length===0){i.current.clear();return}a.preventDefault();let p=Date.now(),f=p-r.current<500;r.current=p;let h=a.shiftKey?kg:Lg,g=0,m=0;switch(a.key){case ar.UP:m=-h;break;case ar.DOWN:m=h;break;case ar.LEFT:g=-h;break;case ar.RIGHT:g=h;break}let b=u.map(T=>{let y=i.current.get(T.id);(!f||!y)&&(y={x:T.position.x,y:T.position.y});let E={x:y.x+g,y:y.y+m};return i.current.set(T.id,E),{id:T.id,dragging:!0,type:"position",position:E}});e&&e(b)};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t,e,o,n])};var mu=require("@xyflow/react");var uu={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},pu={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},du=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],s="",a="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",a=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",a=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),s||(s="task",a=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:a}),{step:e,type:s,label:a,edgeLabel:l}},Dg=e=>{e=e||"";let t=e.trim().split(`
42
+ `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let s=du(i[0],o),a=du(i[1],o);s&&a&&n.push({sourceId:s.step,targetId:a.step,label:s.edgeLabel||a.edgeLabel||""})}),{components:o,connections:n}},fu=e=>{let{components:t,connections:o}=Dg(e);return{nodes:t,edges:o}};var gu=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,mu.useReactFlow)(),{getNextId:n}=pt();return{importFromLia:i=>{let s=typeof i=="string"?i:i.diagramXml||"",{nodes:a,edges:l}=fu(s),c=[],d=new Map,u=!1,p=n();for(let[m,b]of Object.entries(a)){let T=String(p++),y=uu[b.type],E=pu[b.type];y==="START_EVENT"&&(u=!0),d.set(m,T);let _=oe[y].MIN_WIDTH,N=oe[y].MIN_HEIGHT;c.push({id:T,type:y,data:{label:b.label||"",variant:E,attribute:""},position:{x:0,y:0},width:_,height:N,measured:{width:_,height:N}})}let f=[];for(let m of l){let b=v(x({},ut),{id:String(p++),source:d.get(m.sourceId)||m.sourceId,target:d.get(m.targetId)||m.targetId});f.push(b)}if(!u&&c.length>0){let m=String(p++),b={id:m,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:oe.START_EVENT.MIN_WIDTH,height:oe.START_EVENT.MIN_HEIGHT,measured:{width:oe.START_EVENT.MIN_WIDTH,height:oe.START_EVENT.MIN_HEIGHT}};c.unshift(b);let T=c[1];if(T){let y=v(x({},ut),{id:String(p++),source:m,target:T.id});f.unshift(y)}}let{nodes:h,edges:g}=Uc(c,f);e(h),t(g),o({padding:fn,minZoom:mn,maxZoom:gn})}}};var ki=require("react"),Og={origin:"*",debug:!1};function hu(e,t=Og){let{origin:o,debug:n}=t,r=(0,ki.useCallback)((i,s)=>{let a={event:i,data:[i,{event:i,data:s}]};window.parent.postMessage(a,o||"*")},[o]);return(0,ki.useEffect)(()=>{let i=s=>{let a=s.data;if(!(a!=null&&a.event)||(a==null?void 0:a.data)===void 0)return;let{event:l,data:c}=a,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",a),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var yu=require("@xyflow/react"),Cs=require("react");var xu=()=>{let e=(0,yu.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=K(),{importFromMxGraph:n}=yn();(0,Cs.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,Cs.useEffect)(()=>{if(!e)return;(async()=>{await Er(),o(!0)})()},[e,o])};var Ss=require("react"),Eu=require("@xyflow/react");function bu(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=po(),{getEdges:n}=(0,Eu.useReactFlow)(),r=wr(),i=(0,Ss.useCallback)(a=>{if(!(a!=null&&a.activities))return;e(a.activities);let l=a.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),s=(0,Ss.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:s}}var Tu=require("@xyflow/react"),Je=require("react"),Nu=require("use-debounce");var Vg=500,_u=100,vu=(e=!1)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Tu.useReactFlow)(),[i,s]=(0,Je.useState)({history:[],currentStep:0}),{history:a,currentStep:l}=i,c=a[l],d=l>0,u=l<a.length-1,p=(0,Je.useCallback)((_,N)=>{n(_[N].nodes),r(_[N].edges)},[n,r]),f=(0,Je.useCallback)(()=>{if(l>0){let _=l-1;s(N=>v(x({},N),{currentStep:_})),p(a,_)}},[l,a,p]),h=(0,Je.useCallback)(()=>{if(l<a.length-1){let _=l+1;s(N=>v(x({},N),{currentStep:_})),p(a,_)}},[a,l,p]),g=(0,Je.useCallback)(_=>{s(N=>{let A=[...N.history.slice(0,N.currentStep+1),_],P=A.length>_u?A.slice(A.length-_u):A;return{history:P,currentStep:P.length-1}})},[]),m=(0,Je.useCallback)(()=>{let _=t(),N=o(),w=_.map(P=>v(x({},P),{selected:!1,className:"",data:v(x({},P.data),{hasError:!1})})),A=N.map(P=>v(x({},P),{data:v(x({},P.data),{hasError:!1})}));return{nodes:To(w),edges:A}},[t,o]),b=(0,Nu.useDebouncedCallback)(()=>{let _=m();JSON.stringify(c)!==JSON.stringify(_)&&g(_)},Vg),T=(0,Je.useCallback)(_=>{if(!e)return;if(a.length===0){let A=m();s({history:[A],currentStep:0})}if(_==="forceSave"){b();return}_.some(A=>A.type==="select")||_.some(A=>A.type==="position"&&A.dragging)||b()},[e,b,a.length,m]);(0,Je.useEffect)(()=>{if(e&&a.length===0){let _=m();s({history:[_],currentStep:0})}},[e,a.length,m]);let y=(0,Je.useCallback)(_=>{s({history:_||[],currentStep:0})},[]),E=(0,Je.useCallback)(()=>{s({history:[],currentStep:0})},[]);return(0,Je.useEffect)(()=>{let _=N=>{(N.ctrlKey||N.metaKey)&&(N.shiftKey&&N.key.toLowerCase()==="z"?(N.preventDefault(),h()):N.key.toLowerCase()==="z"&&(N.preventDefault(),f()))};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[f,h]),{history:a,undo:f,redo:h,canUndo:d,canRedo:u,saveHistory:T,resetHistory:y,clearHistory:E}};var Au=()=>{let{t:e}=(0,wu.useTranslation)(),[t,o,n]=(0,Lt.useNodesState)([]),[r,i,s]=(0,Lt.useEdgesState)([]),{getNode:a}=(0,Lt.useReactFlow)(),{toast:l}=Ke(),c=(0,Lt.useStoreApi)(),{instanceId:d,isInitialized:u,setIsConnecting:p,setIsMultipleSelection:f,onElementClick:h}=K(),{updateHelperLines:g,HelperLines:m}=oi(),{undo:b,redo:T,canUndo:y,canRedo:E,saveHistory:_}=vu(u),{onNodeDrag:N,onDrop:w,onDragOver:A,onDragLeave:P,onNodeDragStop:B,onNodeDragStart:S}=nu({nodes:t,setNodes:o,setEdges:i}),{isValidConnection:D,onConnect:Q,onReconnect:I,onReconnectStart:R,onReconnectEnd:L,setReconnectingEdge:M,clearReconnectingEdge:q}=Vd({setEdges:i}),{handleValidationComplete:z,clearValidation:C,dismissValidationPanel:H,validateDiagram:F,getIsClearingValidation:V}=Kd(),{importFromLia:G}=gu(),{handleTasksStatus:W,handleClearTaskStatus:te}=bu(),{clearPathEdges:k}=po(),{emitElementChanges:X,handleNodeChanges:J,handleEdgeChanges:Y}=Si(),$=wr();eu(),au(),xu();let U=(0,xt.useCallback)(()=>{o([]),i([]),k(),setTimeout($,0)},[o,i,k,$]);hu({LIA_CREATE_DIAGRAM:G,CLEAR_DIAGRAM:U,TASKS_STATUS:W,CLEAR_TASKS_STATUS:te});let{selectElements:Z,clearSelection:j}=Qt(),{importFromMxGraph:le,exportToMxGraph:ce}=yn(),{configureElement:fe,getConfigureElement:me}=li(),Se=(0,xt.useCallback)(()=>t.length+r.length,[t,r]);(0,xt.useEffect)(()=>(It.set(d,{importFromMxGraph:le,exportToMxGraph:ce,selectElements:Z,clearSelection:j,configureElement:fe,getConfigureElement:me,getElementsCount:Se,setReconnectingEdge:M,clearReconnectingEdge:q}),()=>{It.delete(d)}),[d,le,ce,Z,j,fe,me,Se,M,q]);let Me=(0,xt.useCallback)((Re,Be)=>{if(Be.type!=="TASK"&&Be.type!=="GATEWAY")return;let bt=me(Be.id);bt&&(h==null||h(bt))},[me,h]),_e=(0,xt.useCallback)((Re,Be)=>{if(Be.type!=="SEQUENCE_EDGE")return;let bt=a(Be.source),zi=a(Be.target),{isFromStartEvent:up,isGatewayToGateway:pp,isActiviyToAndGateway:fp}=vr(bt,zi);if(!(!up&&!pp&&!fp))return;let Os=me(Be.id);Os&&(h==null||h(Os))},[me,a,h]),ae=(0,xt.useCallback)(Re=>{let Be=g(Re,t);n(Be),_(Re),V()||H(),J(Re)},[t,n,_,V,H,g,J]),re=(0,xt.useCallback)(Re=>{s(Re),_(Re),V()||H(),Y(Re)},[s,_,V,H,Y]);cu(ae);let Ve=(0,xt.useCallback)(({nodes:Re,edges:Be})=>{f(Re.length+Be.length>=2)},[f]);(0,Lt.useOnSelectionChange)({onChange:Ve});let Ue=(0,xt.useCallback)(async({nodes:Re})=>Re.some(bt=>bt.type==="LANE"&&t.some(zi=>zi.parentId===bt.id))?(l({variant:"error",title:e("validation.errors.title"),content:e("editor.toolbar.delete_pool_lane_error")}),!1):!0,[t,e,l]);return{nodes:t,setNodes:o,edges:r,setEdges:i,events:{isValidConnection:D,onConnect:Q,onReconnect:I,onReconnectStart:R,onReconnectEnd:L,onDrop:w,onDragOver:A,onDragLeave:P,onNodeDrag:N,onNodeDragStop:B,onNodeDragStart:S,onNodeClick:Me,onEdgeClick:_e,onDropCapture:()=>{_("forceSave"),X(),H()},onConnectStart:()=>{p(!0)},onConnectEnd:()=>{p(!1),H()},onSelectionEnd:()=>c.setState({nodesSelectionActive:!1}),onNodesChange:ae,onEdgesChange:re,onBeforeDelete:Ue},ui:{handleCloseValidationPanel:C},controls:{undo:b,redo:T,canUndo:y,canRedo:E},components:{HelperLines:m},actions:{saveHistory:_,selectElements:Z,clearSelection:j,exportToMxGraph:ce,validateDiagram:F,handleValidationComplete:z,setReconnectingEdge:M,clearReconnectingEdge:q}}};var Ms=require("react/jsx-runtime"),Ps=({id:e,className:t})=>(0,Ms.jsx)("marker",{id:e,className:O("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Ms.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var xn=require("react/jsx-runtime"),Iu=()=>(0,xn.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,xn.jsxs)("defs",{children:[(0,xn.jsx)(Ps,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,xn.jsx)(Ps,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var ao=require("@produto-lecom/lecom-ui");var ur=require("@xyflow/react"),Ae=require("@produto-lecom/lecom-ui"),so=require("lucide-react"),Lo=require("react");var ro=require("@produto-lecom/lecom-ui");var cr=(y=>(y.START_EVENT="START_EVENT",y.END_EVENT="END_EVENT",y.TASK="TASK",y.SUBPROCESS="SUBPROCESS",y.GATEWAY="GATEWAY",y.LANE="LANE",y.ANNOTATION="ANNOTATION",y.CONNECTION="CONNECTION",y.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",y.ACTIVITY="ACTIVITY",y.PROCESS_INTERFACE="PROCESS_INTERFACE",y.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",y.VARIANT_ACTIVITY="VARIANT_ACTIVITY",y.AUTO_ACTIVITY="AUTO_ACTIVITY",y.DATA_STORE="DATA_STORE",y.DATA_OBJECT="DATA_OBJECT",y.DATA_OUTPUT="DATA_OUTPUT",y.DATA_INPUT="DATA_INPUT",y.MARKER="MARKER",y))(cr||{});var Di=require("@produto-lecom/lecom-ui"),Hu=require("@xyflow/react");var Cu=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function Su({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
43
+ `),i=encodeURI(r);Ri(i,`${o}.csv`)}var Ri=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};function Mu(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var VI={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Pu={script:"SCRIPT",subprocess:"SUBPROCESS"},Lu={"marker-loop":"LOOP"},ku={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL",inclusive:"EXCLUSIVE"};var So=({cell:e,type:t,variant:o="",attribute:n=""})=>{let{_attributes:r,mxGeometry:i}=e,{value:s,parent:a}=r,l=Number(i._attributes.width),c=Number(i._attributes.height),d=a==="1"?void 0:a;return{id:r.id,parentId:d,type:t,data:{label:s||"",variant:o,attribute:n},position:{x:Number(i._attributes.x)||0,y:Number(i._attributes.y)||0},width:l,height:c,measured:{width:l,height:c}}},Gg=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=oe.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=oe.START_EVENT.MIN_HEIGHT,{node:So({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Bg=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=oe.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=oe.END_EVENT.MIN_HEIGHT,{node:So({cell:e,type:"END_EVENT"}),status:n,originalType:o}},zg=(e,t)=>{let{id:o,subType:n,style:r}=e==null?void 0:e._attributes,i=Pu[n],s=t.get(o)||"",a=Lu[s]||"",l=a==="LOOP",c="imported";return!["script","none"].includes(n)&&!l&&(c="adapted"),e.mxGeometry._attributes.width=Yt(e.mxGeometry._attributes.width||0,oe.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Yt(e.mxGeometry._attributes.height||0,oe.TASK.MIN_HEIGHT),{node:So({cell:e,type:"TASK",variant:i,attribute:a}),status:c,originalType:r}},Fg=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=ku[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=oe.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=oe.GATEWAY.MIN_HEIGHT,{node:So({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Wg=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:So({cell:e,type:"LANE"}),status:"imported",originalType:t}},Yg=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Yt(e.mxGeometry._attributes.width||0,oe.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Yt(e.mxGeometry._attributes.height||0,oe.ANNOTATION.MIN_HEIGHT),{node:So({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Ru=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=oe.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=oe.UNSUPPORTED.MIN_HEIGHT,{node:So({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Du=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(x({},ut),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},Ou={TASK:zg,GATEWAY:Fg,START_EVENT:Gg,END_EVENT:Bg,LANE:Wg,ANNOTATION:Yg};var Ug=e=>{let t=new Map,o=Object.values(cr),n=[],r=new Map;e.forEach(a=>{var c;let l=(c=a._attributes)==null?void 0:c.type;if(l==="MARKER"){r.set(a._attributes.parent,a._attributes.style);return}if(o.includes(l)){n.push(a);return}});let i=[],s=[];for(let a of n){let{type:l}=a._attributes,c=Ou[l]||Ru,{node:d,status:u,originalType:p}=c(a,r);s.push(d),i.push({originalType:p,type:d.type,variant:d.data.variant,value:Mu(d.data.label),status:u})}return{nodes:s,governanceIdToNodeIdMap:t,summary:i}},$g=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>Du(r,t)),Xg=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Ug(t.root.mxCell),i=$g(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Kg=async e=>{let t=await Cu(e),o=xi(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!i||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},Vu=async e=>{try{let t=await Kg(e),{nodes:o,edges:n,summary:r}=Xg(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Bu=require("react/jsx-runtime"),Gu=()=>{let{t:e}=(0,Di.useTranslation)(),{toast:t}=Ke(),{setNodes:o,setEdges:n,fitView:r}=(0,Hu.useReactFlow)(),i=a=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=a.map(d=>[d.originalType,d.value,e(`adapter.governance.report.status.${d.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Bu.jsx)(Di.Button,{size:"small",variant:"ghost",onClick:()=>Su({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async a=>{try{let{nodes:l,edges:c,summary:d}=await Vu(a);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r({padding:fn,minZoom:mn,maxZoom:gn}),d.some(p=>p.status==="unsupported")){i(d);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};var zu=require("@produto-lecom/lecom-ui"),Fu=require("react");var Mo=require("react/jsx-runtime"),Wu=a=>{var l=a,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,s=_t(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,Fu.useRef)(null),d=p=>{let f=p.target.files;f!=null&&f.length&&i(f),c.current&&(c.current.value="")};return(0,Mo.jsxs)(Mo.Fragment,{children:[(0,Mo.jsx)(zu.Button,v(x({disabled:n,onClick:p=>{var f;(f=c.current)==null||f.click(),r==null||r(p)}},s),{children:e})),(0,Mo.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var Po=require("react/jsx-runtime"),Yu=({disabled:e=!1})=>{let{t}=(0,ro.useTranslation)(),{toast:o}=Ke(),{importFromGovernance:n}=Gu(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=s=>{let a=s[0];if(!a){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(a)};return(0,Po.jsxs)(ro.Tooltip,{children:[(0,Po.jsx)(ro.TooltipTrigger,{asChild:!0,children:(0,Po.jsx)(Wu,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Po.jsx)($s,{})})}),(0,Po.jsx)(ro.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var Uu=require("react/jsx-runtime"),Ls=({shortcut:e})=>(0,Uu.jsx)("span",{className:"min-h-7.5 inline-flex justify-center items-center py-0.5 px-1.5 bg-grey-100 border border-grey-300 font-mono text-gray-800 shadow-lg rounded-md text-grey-900",children:e});var pe=require("@produto-lecom/lecom-ui"),io=require("lucide-react"),Zu=require("react");var $u=require("@produto-lecom/lecom-ui"),Xu=require("@xyflow/react"),dr=require("html-to-image"),Ku=require("react");var qg=3,ks="diagram",qu=()=>{let{t:e}=(0,$u.useTranslation)(),{toast:t}=Ke(),{getNodes:o}=(0,Xu.useReactFlow)(),{clearSelection:n}=Qt(),[r,i]=(0,Ku.useState)({png:!1,html:!1,print:!1}),s=()=>{let{x:u,y:p,width:f,height:h}=Kc(o());return{width:f,height:h,style:{width:`${f}px`,height:`${h}px`,transform:`translate(${-u}px, ${-p}px)`}}},a=async(u,p)=>{i(v(x({},r),{[p]:!0})),await n();try{let f=Xc();if(!f)throw new Error("Flow element not found");let h=s();return await u(f,h)}catch(f){t({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{i(v(x({},r),{[p]:!1}))}};return{exportAsPng:async(u=ks)=>{await a(async(p,f)=>{let h=await(0,dr.toPng)(p,v(x({},f),{backgroundColor:"#fcfcfc"}));Ri(h,`${u}.png`)},"png")},exportAsHtml:async(u=ks)=>{await a(async(p,f)=>{let h=await(0,dr.toSvg)(p,v(x({},f),{backgroundColor:"#fcfcfc"})),g=`
42
44
  <!DOCTYPE html>
43
45
  <html>
44
46
  <head>
@@ -49,10 +51,10 @@
49
51
  </style>
50
52
  </head>
51
53
  <body>
52
- <img src="${y}" alt="Diagram" />
54
+ <img src="${h}" alt="Diagram" />
53
55
  </body>
54
56
  </html>
55
- `,m=new Blob([g],{type:"text/html"}),b=URL.createObjectURL(m);Li(b,`${u}.html`),setTimeout(()=>URL.revokeObjectURL(b),100)},"html")},printDiagram:async(u=Ss)=>{await a(async(p,f)=>{let y=await(0,lr.toPng)(p,v(E({},f),{pixelRatio:Ug})),g=window.open("","_blank");if(!g)throw new Error("Failed to open print window.");let m=g.document;m.open(),m.write(`
57
+ `,m=new Blob([g],{type:"text/html"}),b=URL.createObjectURL(m);Ri(b,`${u}.html`),setTimeout(()=>URL.revokeObjectURL(b),100)},"html")},printDiagram:async(u=ks)=>{await a(async(p,f)=>{let h=await(0,dr.toPng)(p,v(x({},f),{pixelRatio:qg})),g=window.open("","_blank");if(!g)throw new Error("Failed to open print window.");let m=g.document;m.open(),m.write(`
56
58
  <!DOCTYPE html>
57
59
  <html>
58
60
  <head>
@@ -65,7 +67,7 @@
65
67
  </style>
66
68
  </head>
67
69
  <body>
68
- <img src="${y}" alt="Diagram" onload="window.print(); window.close();" />
70
+ <img src="${h}" alt="Diagram" onload="window.print(); window.close();" />
69
71
  </body>
70
72
  </html>
71
- `),m.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var ge=require("react/jsx-runtime");function Xu(){let{t:e}=(0,pe.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:s}=Uu(),[a,l]=(0,$u.useState)(!1);return(0,ge.jsxs)(pe.DropdownMenu,{modal:!1,open:a,onOpenChange:l,children:[(0,ge.jsx)(pe.DropdownMenuTrigger,{asChild:!0,children:(0,ge.jsx)("div",{children:(0,ge.jsxs)(pe.Tooltip,{children:[(0,ge.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(pe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,ge.jsx)(io.FolderOutputIcon,{})})}),!a&&(0,ge.jsx)(pe.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,ge.jsxs)(pe.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,ge.jsxs)(pe.Tooltip,{children:[(0,ge.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,ge.jsx)(io.FileImageIcon,{})})}),(0,ge.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,ge.jsxs)(pe.Tooltip,{children:[(0,ge.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,ge.jsx)(io.FileCodeIcon,{})})}),(0,ge.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,ge.jsxs)(pe.Tooltip,{children:[(0,ge.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,ge.jsx)(io.PrinterIcon,{})})}),(0,ge.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var ae=require("react/jsx-runtime"),Ku=({nodes:e,edges:t,validateDiagram:o,handleValidationComplete:n})=>{let{t:r}=(0,Ae.useTranslation)(),{clearSelection:i}=Qt(),{mode:s,isMinimapOpen:a,setIsMinimapOpen:l,isMoveTool:c,isHandTool:d,setIsMoveTool:u,setIsHandTool:p}=q(),{getNodes:f,getEdges:y}=(0,cr.useReactFlow)(),g=(0,cr.useKeyPress)(["v","V"]),m=(0,cr.useKeyPress)(["h","H"]),b=(0,Lo.useCallback)(()=>{i(),p(!0),u(!1)},[i,p,u]),T=(0,Lo.useCallback)(()=>{u(!0),p(!1)},[u,p]),h=(0,Lo.useCallback)(()=>{let x=f(),_=y(),N=o({nodes:x,edges:_});n(N)},[f,y,o,n]);return(0,Lo.useEffect)(()=>{g&&!c&&s==="edit"&&T()},[g,T,c,s]),(0,Lo.useEffect)(()=>{m&&!d&&s==="edit"&&b()},[m,b,d,s]),(0,ae.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[s==="edit"&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(Ae.Tooltip,{children:[(0,ae.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:R(c&&"bg-grey-400"),iconButton:!0,onClick:T,children:(0,ae.jsx)(so.MousePointerIcon,{})})}),(0,ae.jsxs)(Ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.move_tool"),(0,ae.jsx)(Cs,{shortcut:"V"})]})]}),(0,ae.jsxs)(Ae.Tooltip,{children:[(0,ae.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:R(d&&"bg-grey-400"),iconButton:!0,onClick:b,children:(0,ae.jsx)(so.HandIcon,{})})}),(0,ae.jsxs)(Ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.hand_tool")," ",(0,ae.jsx)(Cs,{shortcut:"H"})]})]})]}),(0,ae.jsx)(Xu,{}),s==="edit"&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(Ae.Tooltip,{children:[(0,ae.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:h,children:(0,ae.jsx)(so.ListCheckIcon,{})})}),(0,ae.jsx)(Ae.TooltipContent,{color:"black",children:r("editor.controls.actions.check")})]}),(0,ae.jsx)(Bu,{disabled:e.length>0||t.length>0})]}),(0,ae.jsxs)(Ae.Tooltip,{children:[(0,ae.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:R(a&&"bg-grey-400"),iconButton:!0,onClick:()=>l(!a),children:(0,ae.jsx)(so.MapIcon,{})})}),(0,ae.jsx)(Ae.TooltipContent,{color:"black",children:r(a?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Je=require("@produto-lecom/lecom-ui"),Ri=require("lucide-react"),st=require("react/jsx-runtime"),qu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Je.useTranslation)();return(0,st.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,st.jsxs)(Je.Tooltip,{children:[(0,st.jsx)(Je.TooltipTrigger,{asChild:!0,children:(0,st.jsx)(Je.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,st.jsx)(Ri.UndoIcon,{})})}),(0,st.jsx)(Je.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,st.jsxs)(Je.Tooltip,{children:[(0,st.jsx)(Je.TooltipTrigger,{asChild:!0,children:(0,st.jsx)(Je.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,st.jsx)(Ri.RedoIcon,{})})}),(0,st.jsx)(Je.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var yn=require("@xyflow/react"),Ie=require("@produto-lecom/lecom-ui"),xn=require("lucide-react");var Ne=require("react/jsx-runtime"),Zu=()=>{let{t:e}=(0,Ie.useTranslation)(),t=(0,yn.useNodes)(),o=(0,yn.useEdges)(),{zoomIn:n,zoomOut:r,zoomTo:i,fitView:s}=(0,yn.useReactFlow)(),a=t.length===0&&o.length===0;return(0,Ne.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>s(),children:(0,Ne.jsx)(xn.ScanIcon,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>r(),children:(0,Ne.jsx)(xn.ZoomOut,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>i(1),children:(0,Ne.jsx)($s,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>n(),children:(0,Ne.jsx)(xn.ZoomIn,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Ju=require("@xyflow/react"),kt=require("@produto-lecom/lecom-ui"),Di=require("react");var Et=require("react/jsx-runtime"),Qu=()=>{let e=(0,Di.useRef)(null),{t}=(0,kt.useTranslation)(),{setDraggableNode:o}=dn(),n=(0,Ju.useNodes)(),{setIsDragging:r}=q(),[i,s]=(0,Di.useState)(void 0),a=[{type:"START_EVENT",icon:Er,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Do,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Nn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:qs,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Ks,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Xs,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Ho,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Bo,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Oo,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:Us,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:hr,label:t("bpmn.annotation.variant.default")}],l=(c,d)=>{o({type:d.type,variant:d.variant,attribute:d.attribute,icon:d.icon}),s((0,Et.jsx)(d.icon,{})),c.dataTransfer.effectAllowed="move",e.current&&c.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Et.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Et.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:a.map((c,d)=>{let u=!Jt(c.type,n),p=u?t("editor.toolbar.start_event_already_exists"):c.label;return(0,Et.jsxs)(kt.Tooltip,{children:[(0,Et.jsx)(kt.TooltipTrigger,{asChild:!0,children:(0,Et.jsx)(kt.Button,{className:R("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":u}),size:"small",variant:"ghost",color:"grey",draggable:!u,disabled:u,iconButton:!0,onDragStart:u?void 0:f=>l(f,c),children:(0,Et.jsx)(c.icon,{})},d)}),(0,Et.jsx)(kt.TooltipContent,{color:"black",side:"right",children:p})]},d)})}),(0,Et.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Be=require("react/jsx-runtime"),Ms=(0,Oi.forwardRef)((e,t)=>{let o=(0,Rt.useKeyPress)("Space"),{instanceId:n,mode:r,isMinimapOpen:i,isMoveTool:s,isHandTool:a}=q(),{nodes:l,edges:c,actions:d,events:u,components:p,controls:f}=Tu(),{t:y}=(0,ao.useTranslation)();(0,Oi.useImperativeHandle)(t,()=>({selectElements:d.selectElements,clearSelection:d.clearSelection}));let g=a||o||r!=="edit"?!0:Sd,m=r!=="readonly"&&s&&!o,b=r==="edit"&&s&&!o,T=r==="edit"&&s&&!o;return(0,Be.jsxs)("div",{className:"w-full h-full",children:[r==="edit"&&(0,Be.jsx)(Qu,{}),(0,Be.jsx)(Nu,{}),(0,Be.jsxs)(Rt.ReactFlow,v(E({},u),{id:`modeler-${n}`,className:R({"is-hand-tool":a||o}),edges:c,nodes:l,nodeTypes:Ed,edgeTypes:bd,minZoom:Ad,maxZoom:Id,panOnDrag:g,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!1,elementsSelectable:m,nodesConnectable:b,nodesDraggable:T,connectionLineComponent:hd,selectionMode:Rt.SelectionMode.Partial,multiSelectionKeyCode:["Control","Meta"],deleteKeyCode:"Delete",selectionKeyCode:null,defaultViewport:Cd,connectOnClick:!1,connectionRadius:50,proOptions:{hideAttribution:!0},children:[(0,Be.jsx)(Rt.Background,{gap:vd,size:Nd,color:Td,bgColor:_d}),i&&(0,Be.jsxs)(ao.Tooltip,{children:[(0,Be.jsx)(ao.TooltipTrigger,{asChild:!0,children:(0,Be.jsx)("div",{className:"absolute bottom-[0px] left-[0px] z-[5]",children:(0,Be.jsx)(Rt.MiniMap,{pannable:!0,zoomable:!0,position:wd,className:"shadow-md rounded-md",ariaLabel:"",style:{pointerEvents:"all",position:"relative"}})})}),(0,Be.jsx)(ao.TooltipContent,{color:"black",children:y("editor.controls.actions.minimap.label")})]}),(0,Be.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[r==="edit"&&(0,Be.jsx)(qu,E({},f)),(0,Be.jsx)(Ku,{nodes:l,edges:c,validateDiagram:d.validateDiagram,handleValidationComplete:d.handleValidationComplete}),(0,Be.jsx)(Zu,{})]}),(0,Be.jsx)(p.HelperLines,{})]}))]})});Ms.displayName="Editor";var ju=require("@xyflow/react"),Vi=require("react"),ep=require("react/jsx-runtime"),$g=e=>({width:e.width,height:e.height,transform:e.transform}),Ps="rgba(51, 103, 217, 0.4)",Zl=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,ju.useStore)($g),i=(0,Vi.useRef)(null);return(0,Vi.useEffect)(()=>{let s=i.current,a=s==null?void 0:s.getContext("2d");if(!a||!s)return;let l=window.devicePixelRatio;s.width=o*l,s.height=n*l,a.clearRect(0,0,o,n),a.scale(l,l),a.strokeStyle=Ps,t&&(a.beginPath(),a.strokeStyle=t.color||Ps,a.moveTo(t.position*r[2]+r[0],0),a.lineTo(t.position*r[2]+r[0],n),a.stroke()),e&&(a.beginPath(),a.strokeStyle=e.color||Ps,a.moveTo(0,e.position*r[2]+r[1]),a.lineTo(o,e.position*r[2]+r[1]),a.stroke())},[o,n,r,e,t]),(0,ep.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var En=require("@produto-lecom/lecom-ui"),lo=require("react");var dr=require("react/jsx-runtime"),It=new Map,tp=(0,lo.createContext)(null),Jo=()=>{let e=(0,lo.useContext)(tp);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},op=({locale:e,defaultMode:t="view",toast:o,children:n})=>{let[r,i]=(0,lo.useState)(e||"pt_BR");(0,lo.useEffect)(()=>{e&&(i(e),En.i18n.changeLanguage(e))},[e]);let s=y=>{let g=It.size;if(g===0)throw new Error("No modeler instances found");if(g===1||!y){let[b]=It.values();return b}let m=It.get(y);if(!m)throw new Error(`Modeler instance with ID "${y}" not found`);return m},a=(y,g)=>{let m=s(g);return m==null?void 0:m.selectElements(y)},l=async y=>{let g=s(y);return g==null?void 0:g.clearSelection()},c=(y,g)=>{let m=s(g);return m==null?void 0:m.configureElement(y)},d=(y,g)=>{let m=s(g);return m==null?void 0:m.getConfigureElement(y)},u=async(y,g)=>{let m=s(g);await(m==null?void 0:m.importFromMxGraph(y))},p=y=>{let g=s(y);return g==null?void 0:g.exportToMxGraph()},f=y=>{let g=s(y);return(g==null?void 0:g.getElementsCount())||0};return(0,dr.jsx)(tp.Provider,{value:{defaultMode:t,locale:r,selectElements:a,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:p,getElementsCount:f,toast:o},children:(0,dr.jsxs)(En.TooltipProvider,{children:[!o&&(0,dr.jsx)(En.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var rp=require("@produto-lecom/lecom-ui"),Hi=require("react/jsx-runtime"),ip=(0,Ce.createContext)(null),q=()=>{let e=(0,Ce.useContext)(ip);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},sp=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:s,onSubprocessValidationClick:a})=>{let{t:l}=(0,rp.useTranslation)(),{defaultMode:c}=Jo(),d=(0,Ce.useId)(),[u]=(0,Ce.useState)(o||d),[p,f]=(0,Ce.useState)(n||c||"edit"),[y,g]=(0,Ce.useState)(Kn),[m,b]=(0,Ce.useState)(!1),[T,h]=(0,Ce.useState)(!0),[x,_]=(0,Ce.useState)(!1),[N,A]=(0,Ce.useState)(!1),[I,M]=(0,Ce.useState)(!1),[H,S]=(0,Ce.useState)(!1),[w,k]=(0,Ce.useState)(!1),[V,P]=(0,Ce.useState)(null);(0,Ce.useEffect)(()=>{n&&f(n)},[n]);let L=(0,Ce.useMemo)(()=>t||Wc(l),[t,l]),W={instanceId:u,initialDiagram:L,mode:p,lastElementId:y,isInitialized:m,isMinimapOpen:N,isMoveTool:T,isHandTool:x,isDragging:I,isMultipleSelection:w,isConnecting:H,setLastElementId:g,setIsInitialized:b,reconnectingEdgeId:V,setIsMinimapOpen:A,setIsMoveTool:h,setIsHandTool:_,setIsDragging:M,setIsConnecting:S,setIsMultipleSelection:k,setReconnectingEdgeId:P,onElementChanges:r,onConfigureElement:i,onElementClick:s,onSubprocessValidationClick:a};return(0,Hi.jsx)(np.ReactFlowProvider,{children:(0,Hi.jsx)(ip.Provider,{value:W,children:(0,Hi.jsx)(Ms,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
73
+ `),m.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var he=require("react/jsx-runtime");function Ju(){let{t:e}=(0,pe.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:s}=qu(),[a,l]=(0,Zu.useState)(!1);return(0,he.jsxs)(pe.DropdownMenu,{modal:!1,open:a,onOpenChange:l,children:[(0,he.jsx)(pe.DropdownMenuTrigger,{asChild:!0,children:(0,he.jsx)("div",{children:(0,he.jsxs)(pe.Tooltip,{children:[(0,he.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,he.jsx)(pe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,he.jsx)(io.FolderOutputIcon,{})})}),!a&&(0,he.jsx)(pe.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,he.jsxs)(pe.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,he.jsxs)(pe.Tooltip,{children:[(0,he.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,he.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,he.jsx)(io.FileImageIcon,{})})}),(0,he.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,he.jsxs)(pe.Tooltip,{children:[(0,he.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,he.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,he.jsx)(io.FileCodeIcon,{})})}),(0,he.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,he.jsxs)(pe.Tooltip,{children:[(0,he.jsx)(pe.TooltipTrigger,{asChild:!0,children:(0,he.jsx)(pe.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,he.jsx)(io.PrinterIcon,{})})}),(0,he.jsx)(pe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var se=require("react/jsx-runtime"),Qu=({nodes:e,edges:t,validateDiagram:o,handleValidationComplete:n})=>{let{t:r}=(0,Ae.useTranslation)(),{clearSelection:i}=Qt(),{mode:s,isMinimapOpen:a,setIsMinimapOpen:l,isMoveTool:c,isHandTool:d,setIsMoveTool:u,setIsHandTool:p}=K(),{getNodes:f,getEdges:h}=(0,ur.useReactFlow)(),g=(0,ur.useKeyPress)(["v","V"]),m=(0,ur.useKeyPress)(["h","H"]),b=(0,Lo.useCallback)(()=>{i(),p(!0),u(!1)},[i,p,u]),T=(0,Lo.useCallback)(()=>{u(!0),p(!1)},[u,p]),y=(0,Lo.useCallback)(()=>{let E=f(),_=h(),N=o({nodes:E,edges:_});n(N)},[f,h,o,n]);return(0,Lo.useEffect)(()=>{g&&!c&&s==="edit"&&T()},[g,T,c,s]),(0,Lo.useEffect)(()=>{m&&!d&&s==="edit"&&b()},[m,b,d,s]),(0,se.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[s==="edit"&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(Ae.Tooltip,{children:[(0,se.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:O(c&&"bg-grey-400"),iconButton:!0,onClick:T,children:(0,se.jsx)(so.MousePointerIcon,{})})}),(0,se.jsxs)(Ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.move_tool"),(0,se.jsx)(Ls,{shortcut:"V"})]})]}),(0,se.jsxs)(Ae.Tooltip,{children:[(0,se.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:O(d&&"bg-grey-400"),iconButton:!0,onClick:b,children:(0,se.jsx)(so.HandIcon,{})})}),(0,se.jsxs)(Ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.hand_tool")," ",(0,se.jsx)(Ls,{shortcut:"H"})]})]})]}),(0,se.jsx)(Ju,{}),s==="edit"&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(Ae.Tooltip,{children:[(0,se.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:y,children:(0,se.jsx)(so.ListCheckIcon,{})})}),(0,se.jsx)(Ae.TooltipContent,{color:"black",children:r("editor.controls.actions.check")})]}),(0,se.jsx)(Yu,{disabled:e.length>0||t.length>0})]}),(0,se.jsxs)(Ae.Tooltip,{children:[(0,se.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",className:O(a&&"bg-grey-400"),iconButton:!0,onClick:()=>l(!a),children:(0,se.jsx)(so.MapIcon,{})})}),(0,se.jsx)(Ae.TooltipContent,{color:"black",children:r(a?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Qe=require("@produto-lecom/lecom-ui"),Oi=require("lucide-react"),st=require("react/jsx-runtime"),ju=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Qe.useTranslation)();return(0,st.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,st.jsxs)(Qe.Tooltip,{children:[(0,st.jsx)(Qe.TooltipTrigger,{asChild:!0,children:(0,st.jsx)(Qe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,st.jsx)(Oi.UndoIcon,{})})}),(0,st.jsx)(Qe.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,st.jsxs)(Qe.Tooltip,{children:[(0,st.jsx)(Qe.TooltipTrigger,{asChild:!0,children:(0,st.jsx)(Qe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,st.jsx)(Oi.RedoIcon,{})})}),(0,st.jsx)(Qe.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var En=require("@xyflow/react"),Ie=require("@produto-lecom/lecom-ui"),bn=require("lucide-react");var Ne=require("react/jsx-runtime"),ep=()=>{let{t:e}=(0,Ie.useTranslation)(),t=(0,En.useNodes)(),o=(0,En.useEdges)(),{zoomIn:n,zoomOut:r,zoomTo:i,fitView:s}=(0,En.useReactFlow)(),a=t.length===0&&o.length===0;return(0,Ne.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>s(),children:(0,Ne.jsx)(bn.ScanIcon,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>r(),children:(0,Ne.jsx)(bn.ZoomOut,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>i(1),children:(0,Ne.jsx)(Zs,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Ne.jsxs)(Ie.Tooltip,{children:[(0,Ne.jsx)(Ie.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(Ie.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:a,onClick:()=>n(),children:(0,Ne.jsx)(bn.ZoomIn,{})})}),(0,Ne.jsx)(Ie.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var tp=require("@xyflow/react"),kt=require("@produto-lecom/lecom-ui"),Vi=require("react");var Et=require("react/jsx-runtime"),op=()=>{let e=(0,Vi.useRef)(null),{t}=(0,kt.useTranslation)(),{setDraggableNode:o}=un(),n=(0,tp.useNodes)(),{setIsDragging:r}=K(),[i,s]=(0,Vi.useState)(void 0),a=[{type:"START_EVENT",icon:_r,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Do,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:wn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:js,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Qs,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Js,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Ho,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Bo,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Oo,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:qs,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:xr,label:t("bpmn.annotation.variant.default")}],l=(c,d)=>{o({type:d.type,variant:d.variant,attribute:d.attribute,icon:d.icon}),s((0,Et.jsx)(d.icon,{})),c.dataTransfer.effectAllowed="move",e.current&&c.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Et.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Et.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:a.map((c,d)=>{let u=!Jt(c.type,n),p=u?t("editor.toolbar.start_event_already_exists"):c.label;return(0,Et.jsxs)(kt.Tooltip,{children:[(0,Et.jsx)(kt.TooltipTrigger,{asChild:!0,children:(0,Et.jsx)(kt.Button,{className:O("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":u}),size:"small",variant:"ghost",color:"grey",draggable:!u,disabled:u,iconButton:!0,onDragStart:u?void 0:f=>l(f,c),children:(0,Et.jsx)(c.icon,{})},d)}),(0,Et.jsx)(kt.TooltipContent,{color:"black",side:"right",children:p})]},d)})}),(0,Et.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Ge=require("react/jsx-runtime"),Rs=(0,Hi.forwardRef)((e,t)=>{let o=(0,Rt.useKeyPress)("Space"),{instanceId:n,mode:r,isMinimapOpen:i,isMoveTool:s,isHandTool:a}=K(),{nodes:l,edges:c,actions:d,events:u,components:p,controls:f}=Au(),{t:h}=(0,ao.useTranslation)();(0,Hi.useImperativeHandle)(t,()=>({selectElements:d.selectElements,clearSelection:d.clearSelection}));let g=a||o||r!=="edit"?!0:Rd,m=r!=="readonly"&&s&&!o,b=r==="edit"&&s&&!o,T=r==="edit"&&s&&!o;return(0,Ge.jsxs)("div",{className:"w-full h-full",children:[r==="edit"&&(0,Ge.jsx)(op,{}),(0,Ge.jsx)(Iu,{}),(0,Ge.jsxs)(Rt.ReactFlow,v(x({},u),{id:`modeler-${n}`,className:O({"is-hand-tool":a||o}),edges:c,nodes:l,nodeTypes:wd,edgeTypes:Ad,minZoom:ws,maxZoom:Ld,panOnDrag:g,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!1,elementsSelectable:m,nodesConnectable:b,nodesDraggable:T,connectionLineComponent:Td,selectionMode:Rt.SelectionMode.Partial,multiSelectionKeyCode:["Control","Meta"],deleteKeyCode:"Delete",selectionKeyCode:null,defaultViewport:kd,connectOnClick:!1,connectionRadius:50,proOptions:{hideAttribution:!0},children:[(0,Ge.jsx)(Rt.Background,{gap:Md,size:Sd,color:Cd,bgColor:Id}),i&&(0,Ge.jsxs)(ao.Tooltip,{children:[(0,Ge.jsx)(ao.TooltipTrigger,{asChild:!0,children:(0,Ge.jsx)("div",{className:"absolute bottom-[0px] left-[0px] z-[5]",children:(0,Ge.jsx)(Rt.MiniMap,{pannable:!0,zoomable:!0,position:Pd,className:"shadow-md rounded-md",ariaLabel:"",style:{pointerEvents:"all",position:"relative"}})})}),(0,Ge.jsx)(ao.TooltipContent,{color:"black",children:h("editor.controls.actions.minimap.label")})]}),(0,Ge.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[r==="edit"&&(0,Ge.jsx)(ju,x({},f)),(0,Ge.jsx)(Qu,{nodes:l,edges:c,validateDiagram:d.validateDiagram,handleValidationComplete:d.handleValidationComplete}),(0,Ge.jsx)(ep,{})]}),(0,Ge.jsx)(p.HelperLines,{})]}))]})});Rs.displayName="Editor";var np=require("@xyflow/react"),Gi=require("react"),rp=require("react/jsx-runtime"),Zg=e=>({width:e.width,height:e.height,transform:e.transform}),Ds="rgba(51, 103, 217, 0.4)",ec=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,np.useStore)(Zg),i=(0,Gi.useRef)(null);return(0,Gi.useEffect)(()=>{let s=i.current,a=s==null?void 0:s.getContext("2d");if(!a||!s)return;let l=window.devicePixelRatio;s.width=o*l,s.height=n*l,a.clearRect(0,0,o,n),a.scale(l,l),a.strokeStyle=Ds,t&&(a.beginPath(),a.strokeStyle=t.color||Ds,a.moveTo(t.position*r[2]+r[0],0),a.lineTo(t.position*r[2]+r[0],n),a.stroke()),e&&(a.beginPath(),a.strokeStyle=e.color||Ds,a.moveTo(0,e.position*r[2]+r[1]),a.lineTo(o,e.position*r[2]+r[1]),a.stroke())},[o,n,r,e,t]),(0,rp.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var _n=require("@produto-lecom/lecom-ui"),lo=require("react");var pr=require("react/jsx-runtime"),It=new Map,ip=(0,lo.createContext)(null),Jo=()=>{let e=(0,lo.useContext)(ip);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},sp=({locale:e,defaultMode:t="view",toast:o,children:n})=>{let[r,i]=(0,lo.useState)(e||"pt_BR");(0,lo.useEffect)(()=>{e&&(i(e),_n.i18n.changeLanguage(e))},[e]);let s=h=>{let g=It.size;if(g===0)throw new Error("No modeler instances found");if(g===1||!h){let[b]=It.values();return b}let m=It.get(h);if(!m)throw new Error(`Modeler instance with ID "${h}" not found`);return m},a=(h,g)=>{let m=s(g);return m==null?void 0:m.selectElements(h)},l=async h=>{let g=s(h);return g==null?void 0:g.clearSelection()},c=(h,g)=>{let m=s(g);return m==null?void 0:m.configureElement(h)},d=(h,g)=>{let m=s(g);return m==null?void 0:m.getConfigureElement(h)},u=async(h,g)=>{let m=s(g);await(m==null?void 0:m.importFromMxGraph(h))},p=h=>{let g=s(h);return g==null?void 0:g.exportToMxGraph()},f=h=>{let g=s(h);return(g==null?void 0:g.getElementsCount())||0};return(0,pr.jsx)(ip.Provider,{value:{defaultMode:t,locale:r,selectElements:a,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:p,getElementsCount:f,toast:o},children:(0,pr.jsxs)(_n.TooltipProvider,{children:[!o&&(0,pr.jsx)(_n.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var lp=require("@produto-lecom/lecom-ui"),Bi=require("react/jsx-runtime"),cp=(0,Ce.createContext)(null),K=()=>{let e=(0,Ce.useContext)(cp);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},dp=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:s,onSubprocessValidationClick:a})=>{let{t:l}=(0,lp.useTranslation)(),{defaultMode:c}=Jo(),d=(0,Ce.useId)(),[u]=(0,Ce.useState)(o||d),[p,f]=(0,Ce.useState)(n||c||"edit"),[h,g]=(0,Ce.useState)(Zn),[m,b]=(0,Ce.useState)(!1),[T,y]=(0,Ce.useState)(!0),[E,_]=(0,Ce.useState)(!1),[N,w]=(0,Ce.useState)(!1),[A,P]=(0,Ce.useState)(!1),[B,S]=(0,Ce.useState)(!1),[D,Q]=(0,Ce.useState)(!1),[I,R]=(0,Ce.useState)(null);(0,Ce.useEffect)(()=>{n&&f(n)},[n]);let L=(0,Ce.useMemo)(()=>t||qc(l),[t,l]),M={instanceId:u,initialDiagram:L,mode:p,lastElementId:h,isInitialized:m,isMinimapOpen:N,isMoveTool:T,isHandTool:E,isDragging:A,isMultipleSelection:D,isConnecting:B,setLastElementId:g,setIsInitialized:b,reconnectingEdgeId:I,setIsMinimapOpen:w,setIsMoveTool:y,setIsHandTool:_,setIsDragging:P,setIsConnecting:S,setIsMultipleSelection:Q,setReconnectingEdgeId:R,onElementChanges:r,onConfigureElement:i,onElementClick:s,onSubprocessValidationClick:a};return(0,Bi.jsx)(ap.ReactFlowProvider,{children:(0,Bi.jsx)(cp.Provider,{value:M,children:(0,Bi.jsx)(Rs,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});