lecom-modeler 0.15.1 → 0.16.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,5 +1,5 @@
1
- "use strict";var Du=Object.create;var dn=Object.defineProperty,Ru=Object.defineProperties,Ou=Object.getOwnPropertyDescriptor,Vu=Object.getOwnPropertyDescriptors,Hu=Object.getOwnPropertyNames,Jn=Object.getOwnPropertySymbols,Gu=Object.getPrototypeOf,Ci=Object.prototype.hasOwnProperty,Es=Object.prototype.propertyIsEnumerable;var xs=(e,t,o)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))Ci.call(t,o)&&xs(e,o,t[o]);if(Jn)for(var o of Jn(t))Es.call(t,o)&&xs(e,o,t[o]);return e},v=(e,t)=>Ru(e,Vu(t));var ht=(e,t)=>{var o={};for(var n in e)Ci.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Jn)for(var n of Jn(e))t.indexOf(n)<0&&Es.call(e,n)&&(o[n]=e[n]);return o};var Bu=(e,t)=>{for(var o in t)dn(e,o,{get:t[o],enumerable:!0})},bs=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Hu(t))!Ci.call(e,r)&&r!==o&&dn(e,r,{get:()=>t[r],enumerable:!(n=Ou(t,r))||n.enumerable});return e};var zu=(e,t,o)=>(o=e!=null?Du(Gu(e)):{},bs(t||!e||!e.__esModule?dn(o,"default",{value:e,enumerable:!0}):o,e)),Fu=e=>bs(dn({},"__esModule",{value:!0}),e);var pg={};Bu(pg,{EditorMode:()=>Fe,ElementPosition:()=>jn,ElementType:()=>un,GatewayElementVariant:()=>er,GatewayVariant:()=>rt,Modeler:()=>ku,ModelerProvider:()=>Mu,NodeAttribute:()=>At,NodeType:()=>j,NodeVariant:()=>nt,RoutingVariant:()=>tr,useModeler:()=>Ii});module.exports=Fu(pg);var Si=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 Qn=require("lecom-ui");var _s={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",connect_node:"Connect element",connecting:"Connecting..."},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:{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"}},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"}}},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 Ts={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",connect_node:"Conectar elemento",connecting:"Conectando..."},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:{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"}},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"}},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 Ns={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",connect_node:"Conectar elemento",connecting:"Conectando..."},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:{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"}},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 tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa 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"}}},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 vs={pt_BR:Ns,en_US:_s,es_ES:Ts};var ws,Is,Wu=(Is=(ws=Si("LecomUserLanguage"))!=null?ws:Si("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Is:Qn.Translations.PT_BR;(0,Qn.initializeI18n)({lng:Wu,resources:vs});var Fe=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Fe||{});var un=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(un||{}),jn=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(jn||{}),er=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(er||{}),tr=(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))(tr||{});var ko=require("lucide-react");var eo=require("react/jsx-runtime"),or=({size:e=24,className:t})=>(0,eo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,eo.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,eo.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,eo.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,eo.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Mi=require("react/jsx-runtime"),wo=({size:e=24,className:t})=>(0,Mi.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,Mi.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 Dt=require("react/jsx-runtime"),Io=({size:e=24,className:t})=>(0,Dt.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,Dt.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,Dt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ao=require("react/jsx-runtime"),Co=({size:e=24,className:t})=>(0,Ao.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,Ao.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,Ao.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ao.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var So=require("react/jsx-runtime"),Mo=({size:e=24,className:t})=>(0,So.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,So.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,So.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,So.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var Po=require("react/jsx-runtime"),As=({size:e=24,className:t})=>(0,Po.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,Po.jsxs)("g",{children:[(0,Po.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,Po.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Cs=require("clsx"),Ss=require("tailwind-merge");function k(...e){return(0,Ss.twMerge)((0,Cs.clsx)(e))}var Rt=(e=0,t=0)=>e<t?t:e,nr=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var pn=require("react/jsx-runtime"),Ms=({size:e=24,className:t})=>(0,pn.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:k("stroke-2",t),children:[(0,pn.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,pn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var rr=require("react/jsx-runtime"),Ps=({size:e=24,className:t})=>(0,rr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,rr.jsx)("g",{children:(0,rr.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 Pi=require("react/jsx-runtime"),ir=({size:e=24,className:t})=>(0,Pi.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,Pi.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 Li=require("react/jsx-runtime"),fn=({size:e=24,className:t})=>(0,Li.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:k("stroke-2",t),children:(0,Li.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 Lo=require("react/jsx-runtime"),Ls=({size:e=24,className:t})=>(0,Lo.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,Lo.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,Lo.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,Lo.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ot=require("react/jsx-runtime"),ks=({size:e=24,className:t})=>(0,Ot.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,Ot.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,Ot.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,Ot.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,Ot.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ot.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var to=require("react/jsx-runtime"),Ds=({size:e=24,className:t})=>(0,to.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,to.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,to.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,to.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,to.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var j=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(j||{}),nt=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(nt||{}),sr={SCRIPT:{icon:ko.ScrollText},SUBPROCESS:{icon:ko.SquarePlus}},At=(t=>(t.LOOP="LOOP",t))(At||{}),ar={LOOP:{icon:ko.RotateCcw}},rt=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(rt||{}),ki={EXCLUSIVE:{icon:Co},PARALLEL:{icon:Mo},COMPLEX:{icon:Io}};var Pu=require("@xyflow/react"),we=require("react");var qt=require("@xyflow/react"),vi=require("react");var $t=require("@xyflow/react"),kt=require("react");var Rs=require("zustand"),Os=require("@xyflow/react"),Vs=require("react");var lr=()=>{let{setEdges:e}=(0,Os.useReactFlow)();return(0,Vs.useCallback)(()=>{let o=oo.getState().pathEdgeIds;e(n=>n.map(r=>v(E({},r),{selected:o.includes(r.id)})))},[e])},oo=(0,Rs.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=E({},n.statusByNodeId),i=E({},n.statusData),a=!1;return o.forEach(s=>{let l=`${s.diagramId}-${s.activityId}`;r[s.diagramId]!==s.status&&(r[s.diagramId]=s.status,i[l]=s,a=!0)}),a?{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=[],a={};o.forEach(d=>{a[d.source]||(a[d.source]=[]),a[d.source].push({targetId:d.target,edgeId:d.id})});let s=r[0],l=r[r.length-1];o.forEach(d=>{d.target===s&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let p=[],m=new Set;for(p.push({node:d,path:[]}),m.add(d);p.length>0;){let{node:h,path:g}=p.shift();if(h===u)return g;let f=a[h]||[];for(let{targetId:x,edgeId:y}of f)m.has(x)||(m.add(x),p.push({node:x,path:[...g,y]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],p=r[d+1],m=c(u,p);m.length>0&&i.push(...m)}i.length>0&&e({pathEdgeIds:i})}}));var Ho=require("@xyflow/react");var Yu={value:()=>{}};function Gs(){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 cr(o)}function cr(e){this._=e}function Uu(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}})}cr.prototype=Gs.prototype={constructor:cr,on:function(e,t){var o=this._,n=Uu(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=$u(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(r=(e=n[i]).type)o[r]=Hs(o[r],e.name,t);else if(t==null)for(r in o)o[r]=Hs(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 cr(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 $u(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function Hs(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=Yu,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Di=Gs;var dr="http://www.w3.org/1999/xhtml",Ri={svg:"http://www.w3.org/2000/svg",xhtml:dr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ct(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ri.hasOwnProperty(t)?{space:Ri[t],local:e}:e}function Xu(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===dr&&t.documentElement.namespaceURI===dr?t.createElement(e):t.createElementNS(o,e)}}function Ku(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ur(e){var t=Ct(e);return(t.local?Ku:Xu)(t)}function qu(){}function no(e){return e==null?qu:function(){return this.querySelector(e)}}function Bs(e){typeof e!="function"&&(e=no(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=new Array(a),l,c,d=0;d<a;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),s[d]=c);return new Pe(n,this._parents)}function Oi(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Zu(){return[]}function mn(e){return e==null?Zu:function(){return this.querySelectorAll(e)}}function Ju(e){return function(){return Oi(e.apply(this,arguments))}}function zs(e){typeof e=="function"?e=Ju(e):e=mn(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var a=t[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(n.push(e.call(l,l.__data__,c,a)),r.push(l));return new Pe(n,r)}function gn(e){return function(){return this.matches(e)}}function pr(e){return function(t){return t.matches(e)}}var Qu=Array.prototype.find;function ju(e){return function(){return Qu.call(this.children,e)}}function ep(){return this.firstElementChild}function Fs(e){return this.select(e==null?ep:ju(typeof e=="function"?e:pr(e)))}var tp=Array.prototype.filter;function op(){return Array.from(this.children)}function np(e){return function(){return tp.call(this.children,e)}}function Ws(e){return this.selectAll(e==null?op:np(typeof e=="function"?e:pr(e)))}function Ys(e){typeof e!="function"&&(e=gn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new Pe(n,this._parents)}function fr(e){return new Array(e.length)}function Us(){return new Pe(this._enter||this._groups.map(fr),this._parents)}function hn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}hn.prototype={constructor:hn,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 $s(e){return function(){return e}}function rp(e,t,o,n,r,i){for(var a=0,s,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],n[a]=s):o[a]=new hn(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function ip(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,u=i.length,p=new Array(d),m;for(s=0;s<d;++s)(l=t[s])&&(p[s]=m=a.call(l,l.__data__,s,t)+"",c.has(m)?r[s]=l:c.set(m,l));for(s=0;s<u;++s)m=a.call(e,i[s],s,i)+"",(l=c.get(m))?(n[s]=l,l.__data__=i[s],c.delete(m)):o[s]=new hn(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(p[s])===l&&(r[s]=l)}function sp(e){return e.__data__}function Xs(e,t){if(!arguments.length)return Array.from(this,sp);var o=t?ip:rp,n=this._parents,r=this._groups;typeof e!="function"&&(e=$s(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],p=u.length,m=ap(e.call(d,d&&d.__data__,c,n)),h=m.length,g=s[c]=new Array(h),f=a[c]=new Array(h),x=l[c]=new Array(p);o(d,u,g,f,x,m,t);for(var y=0,b=0,N,T;y<h;++y)if(N=g[y]){for(y>=b&&(b=y+1);!(T=f[b])&&++b<h;);N._next=T||null}}return a=new Pe(a,n),a._enter=s,a._exit=l,a}function ap(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ks(){return new Pe(this._exit||this._groups.map(fr),this._parents)}function qs(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 Zs(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c=o[l],d=n[l],u=c.length,p=s[l]=new Array(u),m,h=0;h<u;++h)(m=c[h]||d[h])&&(p[h]=m);for(;l<r;++l)s[l]=o[l];return new Pe(s,this._parents)}function Js(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],a;--r>=0;)(a=n[r])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Qs(e){e||(e=lp);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 a=o[i],s=a.length,l=r[i]=new Array(s),c,d=0;d<s;++d)(c=a[d])&&(l[d]=c);l.sort(t)}return new Pe(r,this._parents).order()}function lp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function js(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ea(){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 a=n[r];if(a)return a}return null}function oa(){let e=0;for(let t of this)++e;return e}function na(){return!this.node()}function ra(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,a=r.length,s;i<a;++i)(s=r[i])&&e.call(s,s.__data__,i,r);return this}function cp(e){return function(){this.removeAttribute(e)}}function dp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function up(e,t){return function(){this.setAttribute(e,t)}}function pp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function mp(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 ia(e,t){var o=Ct(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?dp:cp:typeof t=="function"?o.local?mp:fp:o.local?pp:up)(o,t))}function mr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gp(e){return function(){this.style.removeProperty(e)}}function hp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function yp(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function sa(e,t,o){return arguments.length>1?this.each((t==null?gp:typeof t=="function"?yp:hp)(e,t,o==null?"":o)):Vt(this.node(),e)}function Vt(e,t){return e.style.getPropertyValue(t)||mr(e).getComputedStyle(e,null).getPropertyValue(t)}function xp(e){return function(){delete this[e]}}function Ep(e,t){return function(){this[e]=t}}function bp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function aa(e,t){return arguments.length>1?this.each((t==null?xp:typeof t=="function"?bp:Ep)(e,t)):this.node()[e]}function la(e){return e.trim().split(/^|\s+/)}function Vi(e){return e.classList||new ca(e)}function ca(e){this._node=e,this._names=la(e.getAttribute("class")||"")}ca.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 da(e,t){for(var o=Vi(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function ua(e,t){for(var o=Vi(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function _p(e){return function(){da(this,e)}}function Tp(e){return function(){ua(this,e)}}function Np(e,t){return function(){(t.apply(this,arguments)?da:ua)(this,e)}}function pa(e,t){var o=la(e+"");if(arguments.length<2){for(var n=Vi(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?Np:t?_p:Tp)(o,t))}function vp(){this.textContent=""}function wp(e){return function(){this.textContent=e}}function Ip(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function fa(e){return arguments.length?this.each(e==null?vp:(typeof e=="function"?Ip:wp)(e)):this.node().textContent}function Ap(){this.innerHTML=""}function Cp(e){return function(){this.innerHTML=e}}function Sp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function ma(e){return arguments.length?this.each(e==null?Ap:(typeof e=="function"?Sp:Cp)(e)):this.node().innerHTML}function Mp(){this.nextSibling&&this.parentNode.appendChild(this)}function ga(){return this.each(Mp)}function Pp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ha(){return this.each(Pp)}function ya(e){var t=typeof e=="function"?e:ur(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lp(){return null}function xa(e,t){var o=typeof e=="function"?e:ur(e),n=t==null?Lp:typeof t=="function"?t:no(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function kp(){var e=this.parentNode;e&&e.removeChild(this)}function Ea(){return this.each(kp)}function Dp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ba(e){return this.select(e?Rp:Dp)}function _a(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Op(e){return function(t){e.call(this,t,this.__data__)}}function Vp(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 Hp(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 Gp(e,t,o){return function(){var n=this.__on,r,i=Op(t);if(n){for(var a=0,s=n.length;a<s;++a)if((r=n[a]).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 Ta(e,t,o){var n=Vp(e+""),r,i=n.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,d;l<c;++l)for(r=0,d=s[l];r<i;++r)if((a=n[r]).type===d.type&&a.name===d.name)return d.value}return}for(s=t?Gp:Hp,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function Na(e,t,o){var n=mr(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 Bp(e,t){return function(){return Na(this,e,t)}}function zp(e,t){return function(){return Na(this,e,t.apply(this,arguments))}}function va(e,t){return this.each((typeof t=="function"?zp:Bp)(e,t))}function*wa(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,a;r<i;++r)(a=n[r])&&(yield a)}var Fp=[null];function Pe(e,t){this._groups=e,this._parents=t}function Ia(){return new Pe([[document.documentElement]],Fp)}function Wp(){return this}Pe.prototype=Ia.prototype={constructor:Pe,select:Bs,selectAll:zs,selectChild:Fs,selectChildren:Ws,filter:Ys,data:Xs,enter:Us,exit:Ks,join:qs,merge:Zs,selection:Wp,order:Js,sort:Qs,call:js,nodes:ea,node:ta,size:oa,empty:na,each:ra,attr:ia,style:sa,property:aa,classed:pa,text:fa,html:ma,raise:ga,lower:ha,append:ya,insert:xa,remove:Ea,clone:ba,datum:_a,on:Ta,dispatch:va,[Symbol.iterator]:wa};var St=Ia;function gr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Hi(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function En(){}var yn=.7,xr=1/yn,Do="\\s*([+-]?\\d+)\\s*",xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yp=/^#([0-9a-f]{3,8})$/,Up=new RegExp(`^rgb\\(${Do},${Do},${Do}\\)$`),$p=new RegExp(`^rgb\\(${yt},${yt},${yt}\\)$`),Xp=new RegExp(`^rgba\\(${Do},${Do},${Do},${xn}\\)$`),Kp=new RegExp(`^rgba\\(${yt},${yt},${yt},${xn}\\)$`),qp=new RegExp(`^hsl\\(${xn},${yt},${yt}\\)$`),Zp=new RegExp(`^hsla\\(${xn},${yt},${yt},${xn}\\)$`),Aa={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};gr(En,Ht,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ca,formatHex:Ca,formatHex8:Jp,formatHsl:Qp,formatRgb:Sa,toString:Sa});function Ca(){return this.rgb().formatHex()}function Jp(){return this.rgb().formatHex8()}function Qp(){return Ra(this).formatHsl()}function Sa(){return this.rgb().formatRgb()}function Ht(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Yp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ma(t):o===3?new We(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?hr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?hr(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=Up.exec(e))?new We(t[1],t[2],t[3],1):(t=$p.exec(e))?new We(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Xp.exec(e))?hr(t[1],t[2],t[3],t[4]):(t=Kp.exec(e))?hr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qp.exec(e))?ka(t[1],t[2]/100,t[3]/100,1):(t=Zp.exec(e))?ka(t[1],t[2]/100,t[3]/100,t[4]):Aa.hasOwnProperty(e)?Ma(Aa[e]):e==="transparent"?new We(NaN,NaN,NaN,0):null}function Ma(e){return new We(e>>16&255,e>>8&255,e&255,1)}function hr(e,t,o,n){return n<=0&&(e=t=o=NaN),new We(e,t,o,n)}function jp(e){return e instanceof En||(e=Ht(e)),e?(e=e.rgb(),new We(e.r,e.g,e.b,e.opacity)):new We}function Ro(e,t,o,n){return arguments.length===1?jp(e):new We(e,t,o,n==null?1:n)}function We(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}gr(We,Ro,Hi(En,{brighter(e){return e=e==null?xr:Math.pow(xr,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new We(io(this.r),io(this.g),io(this.b),Er(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:Pa,formatHex:Pa,formatHex8:ef,formatRgb:La,toString:La}));function Pa(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}`}function ef(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}${ro((isNaN(this.opacity)?1:this.opacity)*255)}`}function La(){let e=Er(this.opacity);return`${e===1?"rgb(":"rgba("}${io(this.r)}, ${io(this.g)}, ${io(this.b)}${e===1?")":`, ${e})`}`}function Er(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ro(e){return e=io(e),(e<16?"0":"")+e.toString(16)}function ka(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new dt(e,t,o,n)}function Ra(e){if(e instanceof dt)return new dt(e.h,e.s,e.l,e.opacity);if(e instanceof En||(e=Ht(e)),!e)return new dt;if(e instanceof dt)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),a=NaN,s=i-r,l=(i+r)/2;return s?(t===i?a=(o-n)/s+(o<n)*6:o===i?a=(n-t)/s+2:a=(t-o)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new dt(a,s,l,e.opacity)}function Oa(e,t,o,n){return arguments.length===1?Ra(e):new dt(e,t,o,n==null?1:n)}function dt(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}gr(dt,Oa,Hi(En,{brighter(e){return e=e==null?xr:Math.pow(xr,e),new dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new dt(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 We(Gi(e>=240?e-240:e+120,r,n),Gi(e,r,n),Gi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new dt(Da(this.h),yr(this.s),yr(this.l),Er(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=Er(this.opacity);return`${e===1?"hsl(":"hsla("}${Da(this.h)}, ${yr(this.s)*100}%, ${yr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Da(e){return e=(e||0)%360,e<0?e+360:e}function yr(e){return Math.max(0,Math.min(1,e||0))}function Gi(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 Bi(e,t,o,n,r){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*o+(1+3*e+3*i-3*a)*n+a*r)/6}function Va(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],a=n>0?e[n-1]:2*r-i,s=n<t-1?e[n+2]:2*i-r;return Bi((o-n/t)*t,a,r,i,s)}}function Ha(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],a=e[(n+1)%t],s=e[(n+2)%t];return Bi((o-n/t)*t,r,i,a,s)}}var zi=e=>()=>e;function tf(e,t){return function(o){return e+o*t}}function of(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 Ga(e){return(e=+e)==1?br:function(t,o){return o-t?of(t,o,e):zi(isNaN(t)?o:t)}}function br(e,t){var o=t-e;return o?tf(e,o):zi(isNaN(e)?t:e)}var _r=function e(t){var o=Ga(t);function n(r,i){var a=o((r=Ro(r)).r,(i=Ro(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=br(r.opacity,i.opacity);return function(d){return r.r=a(d),r.g=s(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function Ba(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),a,s;for(a=0;a<o;++a)s=Ro(t[a]),n[a]=s.r||0,r[a]=s.g||0,i[a]=s.b||0;return n=e(n),r=e(r),i=e(i),s.opacity=1,function(l){return s.r=n(l),s.g=r(l),s.b=i(l),s+""}}}var nf=Ba(Va),rf=Ba(Ha);function it(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Wi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fi=new RegExp(Wi.source,"g");function sf(e){return function(){return e}}function af(e){return function(t){return e(t)+""}}function Yi(e,t){var o=Wi.lastIndex=Fi.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=Wi.exec(e))&&(r=Fi.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:it(n,r)})),o=Fi.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?af(l[0].x):sf(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)s[(u=l[d]).i]=u.x(c);return s.join("")})}var za=180/Math.PI,Tr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ui(e,t,o,n,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(s=Math.sqrt(o*o+n*n))&&(o/=s,n/=s,l/=s),e*n<t*o&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*za,skewX:Math.atan(l)*za,scaleX:a,scaleY:s}}var Nr;function Fa(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Tr:Ui(t.a,t.b,t.c,t.d,t.e,t.f)}function Wa(e){return e==null?Tr:(Nr||(Nr=document.createElementNS("http://www.w3.org/2000/svg","g")),Nr.setAttribute("transform",e),(e=Nr.transform.baseVal.consolidate())?(e=e.matrix,Ui(e.a,e.b,e.c,e.d,e.e,e.f)):Tr)}function Ya(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,p,m,h){if(c!==u||d!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:it(c,u)},{i:g-2,x:it(d,p)})}else(u||p)&&m.push("translate("+u+t+p+o)}function a(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:it(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function s(c,d,u,p){c!==d?p.push({i:u.push(r(u)+"skewX(",null,n)-2,x:it(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,p,m,h){if(c!==u||d!==p){var g=m.push(r(m)+"scale(",null,",",null,")");h.push({i:g-4,x:it(c,u)},{i:g-2,x:it(d,p)})}else(u!==1||p!==1)&&m.push(r(m)+"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),a(c.rotate,d.rotate,u,p),s(c.skewX,d.skewX,u,p),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,p),c=d=null,function(m){for(var h=-1,g=p.length,f;++h<g;)u[(f=p[h]).i]=f.x(m);return u.join("")}}}var $i=Ya(Fa,"px, ","px)","deg)"),Xi=Ya(Wa,", ",")",")");var Oo=0,_n=0,bn=0,$a=1e3,vr,Tn,wr=0,so=0,Ir=0,Nn=typeof performance=="object"&&performance.now?performance:Date,Xa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wn(){return so||(Xa(lf),so=Nn.now()+Ir)}function lf(){so=0}function vn(){this._call=this._time=this._next=null}vn.prototype=Ar.prototype={constructor:vn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?wn():+o)+(t==null?0:+t),!this._next&&Tn!==this&&(Tn?Tn._next=this:vr=this,Tn=this),this._call=e,this._time=o,Ki()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ki())}};function Ar(e,t,o){var n=new vn;return n.restart(e,t,o),n}function Ka(){wn(),++Oo;for(var e=vr,t;e;)(t=so-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oo}function Ua(){so=(wr=Nn.now())+Ir,Oo=_n=0;try{Ka()}finally{Oo=0,df(),so=0}}function cf(){var e=Nn.now(),t=e-wr;t>$a&&(Ir-=t,wr=e)}function df(){for(var e,t=vr,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:vr=o);Tn=e,Ki(n)}function Ki(e){if(!Oo){_n&&(_n=clearTimeout(_n));var t=e-so;t>24?(e<1/0&&(_n=setTimeout(Ua,e-Nn.now()-Ir)),bn&&(bn=clearInterval(bn))):(bn||(wr=Nn.now(),bn=setInterval(cf,$a)),Oo=1,Xa(Ua))}}function Cr(e,t,o){var n=new vn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var uf=Di("start","end","cancel","interrupt"),pf=[],Ja=0,qa=1,Mr=2,Sr=3,Za=4,Pr=5,In=6;function Gt(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;ff(e,o,{name:t,index:n,group:r,on:uf,tween:pf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ja})}function An(e,t){var o=Le(e,t);if(o.state>Ja)throw new Error("too late; already scheduled");return o}function Oe(e,t){var o=Le(e,t);if(o.state>Sr)throw new Error("too late; already running");return o}function Le(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function ff(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Ar(i,0,o.time);function i(c){o.state=qa,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,u,p,m;if(o.state!==qa)return l();for(d in n)if(m=n[d],m.name===o.name){if(m.state===Sr)return Cr(a);m.state===Za?(m.state=In,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[d]):+d<t&&(m.state=In,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete n[d])}if(Cr(function(){o.state===Sr&&(o.state=Za,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=Mr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Mr){for(o.state=Sr,r=new Array(p=o.tween.length),d=0,u=-1;d<p;++d)(m=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=m);r.length=u+1}}function s(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=Pr,1),u=-1,p=r.length;++u<p;)r[u].call(e,d);o.state===Pr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=In,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function qi(e,t){var o=e.__transition,n,r,i=!0,a;if(o){t=t==null?null:t+"";for(a in o){if((n=o[a]).name!==t){i=!1;continue}r=n.state>Mr&&n.state<Pr,n.state=In,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function Qa(e){return this.each(function(){qi(this,e)})}function mf(e,t){var o,n;return function(){var r=Oe(this,e),i=r.tween;if(i!==o){n=o=i;for(var a=0,s=n.length;a<s;++a)if(n[a].name===t){n=n.slice(),n.splice(a,1);break}}r.tween=n}}function gf(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=Oe(this,e),a=i.tween;if(a!==n){r=(n=a).slice();for(var s={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function ja(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=Le(this.node(),o).tween,r=0,i=n.length,a;r<i;++r)if((a=n[r]).name===e)return a.value;return null}return this.each((t==null?mf:gf)(o,e,t))}function Vo(e,t,o){var n=e._id;return e.each(function(){var r=Oe(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return Le(r,n).value[t]}}function Lr(e,t){var o;return(typeof t=="number"?it:t instanceof Ht?_r:(o=Ht(t))?(t=o,_r):Yi)(e,t)}function hf(e){return function(){this.removeAttribute(e)}}function yf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xf(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttribute(e);return a===r?null:a===n?i:i=t(n=a,o)}}function Ef(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===r?null:a===n?i:i=t(n=a,o)}}function bf(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function _f(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function el(e,t){var o=Ct(e),n=o==="transform"?Xi:Lr;return this.attrTween(e,typeof t=="function"?(o.local?_f:bf)(o,n,Vo(this,"attr."+e,t)):t==null?(o.local?yf:hf)(o):(o.local?Ef:xf)(o,n,t))}function Tf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Nf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function vf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&Nf(e,i)),o}return r._value=t,r}function wf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&Tf(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=Ct(e);return this.tween(o,(n.local?vf:wf)(n,t))}function If(e,t){return function(){An(this,e).delay=+t.apply(this,arguments)}}function Af(e,t){return t=+t,function(){An(this,e).delay=t}}function ol(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?If:Af)(t,e)):Le(this.node(),t).delay}function Cf(e,t){return function(){Oe(this,e).duration=+t.apply(this,arguments)}}function Sf(e,t){return t=+t,function(){Oe(this,e).duration=t}}function nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Cf:Sf)(t,e)):Le(this.node(),t).duration}function Mf(e,t){if(typeof t!="function")throw new Error;return function(){Oe(this,e).ease=t}}function rl(e){var t=this._id;return arguments.length?this.each(Mf(t,e)):Le(this.node(),t).ease}function Pf(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Oe(this,e).ease=o}}function il(e){if(typeof e!="function")throw new Error;return this.each(Pf(this._id,e))}function sl(e){typeof e!="function"&&(e=gn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new Ge(n,this._parents,this._name,this._id)}function al(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),a=new Array(n),s=0;s<i;++s)for(var l=t[s],c=o[s],d=l.length,u=a[s]=new Array(d),p,m=0;m<d;++m)(p=l[m]||c[m])&&(u[m]=p);for(;s<n;++s)a[s]=t[s];return new Ge(a,this._parents,this._name,this._id)}function Lf(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 kf(e,t,o){var n,r,i=Lf(t)?An:Oe;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function ll(e,t){var o=this._id;return arguments.length<2?Le(this.node(),o).on.on(e):this.each(kf(o,e,t))}function Df(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function cl(){return this.on("end.remove",Df(this._id))}function dl(e){var t=this._name,o=this._id;typeof e!="function"&&(e=no(e));for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a)for(var s=n[a],l=s.length,c=i[a]=new Array(l),d,u,p=0;p<l;++p)(d=s[p])&&(u=e.call(d,d.__data__,p,s))&&("__data__"in d&&(u.__data__=d.__data__),c[p]=u,Gt(c[p],t,o,p,c,Le(d,o)));return new Ge(i,this._parents,t,o)}function ul(e){var t=this._name,o=this._id;typeof e!="function"&&(e=mn(e));for(var n=this._groups,r=n.length,i=[],a=[],s=0;s<r;++s)for(var l=n[s],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var p=e.call(d,d.__data__,u,l),m,h=Le(d,o),g=0,f=p.length;g<f;++g)(m=p[g])&&Gt(m,t,o,g,p,h);i.push(p),a.push(d)}return new Ge(i,a,t,o)}var Rf=St.prototype.constructor;function pl(){return new Rf(this._groups,this._parents)}function Of(e,t){var o,n,r;return function(){var i=Vt(this,e),a=(this.style.removeProperty(e),Vt(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function fl(e){return function(){this.style.removeProperty(e)}}function Vf(e,t,o){var n,r=o+"",i;return function(){var a=Vt(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function Hf(e,t,o){var n,r,i;return function(){var a=Vt(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),Vt(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function Gf(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=Oe(this,e),c=l.on,d=l.value[i]==null?s||(s=fl(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function ml(e,t,o){var n=(e+="")=="transform"?$i:Lr;return t==null?this.styleTween(e,Of(e,n)).on("end.style."+e,fl(e)):typeof t=="function"?this.styleTween(e,Hf(e,n,Vo(this,"style."+e,t))).each(Gf(this._id,e)):this.styleTween(e,Vf(e,n,t),o).on("end.style."+e,null)}function Bf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function zf(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Bf(e,a,o)),n}return i._value=t,i}function gl(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,zf(e,t,o==null?"":o))}function Ff(e){return function(){this.textContent=e}}function Wf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function hl(e){return this.tween("text",typeof e=="function"?Wf(Vo(this,"text",e)):Ff(e==null?"":e+""))}function Yf(e){return function(t){this.textContent=e.call(this,t)}}function Uf(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Yf(r)),t}return n._value=e,n}function yl(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,Uf(e))}function xl(){for(var e=this._name,t=this._id,o=kr(),n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,c=0;c<s;++c)if(l=a[c]){var d=Le(l,t);Gt(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ge(n,this._parents,e,o)}function El(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,a){var s={value:a},l={value:function(){--r===0&&i()}};o.each(function(){var c=Oe(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),c.on=t}),r===0&&i()})}var $f=0;function Ge(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function bl(e){return St().transition(e)}function kr(){return++$f}var Mt=St.prototype;Ge.prototype=bl.prototype={constructor:Ge,select:dl,selectAll:ul,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:sl,merge:al,selection:pl,transition:xl,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:ll,attr:el,attrTween:tl,style:ml,styleTween:gl,text:hl,textTween:yl,remove:cl,tween:ja,delay:ol,duration:nl,ease:rl,easeVarying:il,end:El,[Symbol.iterator]:Mt[Symbol.iterator]};function Dr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Xf={time:null,delay:0,duration:250,ease:Dr};function Kf(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 _l(e){var t,o;e instanceof Ge?(t=e._id,e=e._name):(t=kr(),(o=Xf).time=wn(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&Gt(l,e,t,c,a,o||Kf(l,t));return new Ge(n,this._parents,e,t)}St.prototype.interrupt=Qa;St.prototype.transition=_l;function Bt(e,t,o){this.k=e,this.x=t,this.y=o}Bt.prototype={constructor:Bt,scale:function(e){return e===1?this:new Bt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bt(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 Rr=new Bt(1,0,0);Or.prototype=Bt.prototype;function Or(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rr;return e.__zoom}var Zf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Tl;(function(e){e.Strict="strict",e.Loose="loose"})(Tl||(Tl={}));var Nl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Nl||(Nl={}));var vl;(function(e){e.Partial="partial",e.Full="full"})(vl||(vl={}));var wl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(wl||(wl={}));var Il;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Il||(Il={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));var xE={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top};var Jf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Qf=(e,t=[0,0])=>{var s;let{width:o,height:n}=jf(e),r=(s=e.origin)!=null?s:t,i=o*r[0],a=n*r[1];return{x:e.position.x-i,y:e.position.y-a}};var Xe=(e,t=[0,0])=>{var r,i,a,s,l,c,d,u;let{x:o,y:n}=Jf(e)?e.internals.positionAbsolute:Qf(e,t);return{x:o,y:n,x2:o+((s=(a=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?a:e.initialWidth)!=null?s: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 jf(e){var t,o,n,r,i,a,s,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=(s=(a=(i=e.measured)==null?void 0:i.height)!=null?a:e.height)!=null?s:e.initialHeight)!=null?l:0}}var EE={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}};var em={nodeOrigin:[0,0],nodeExtent:Zf,elevateNodesOnSelect:!0,defaults:{}},bE=v(E({},em),{checkEquality:!0});var Al;(function(e){e.Line="line",e.Handle="handle"})(Al||(Al={}));var tm={width:0,height:0,x:0,y:0},_E=v(E({},tm),{pointerX:0,pointerY:0,aspectRatio:1});var Ke=require("react"),Pl=require("zustand/shallow");var om=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function nm(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 Vr=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){let i=t==="horizontal"?this.yLines:this.xLines,[a,s]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],l=[];for(let p of i){if(p.position<a)continue;if(p.position>s)break;if(p.node.id===n.id||p.node.parentId===n.id||!om(p.nodeBox,r))continue;let m=Math.abs(p.position-o);if(m>Hr)continue;let g=nm(p.nodeBox,Xe(n))>0?0:rm(p.nodeBox,Xe(n));l.push({line:p,lineDist:m,nodeDist:g})}let c=.5,d=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((p,m)=>{if(d){if(p.line===d&&m.line!==d)return-1;if(m.line===d&&p.line!==d)return 1}return Math.abs(p.lineDist-m.lineDist)<=c?p.nodeDist-m.nodeDist:p.lineDist-m.lineDist});let u=l.length>0?l[0].line:void 0;return u&&(t==="horizontal"?this.lastHorizontalLine=u:this.lastVerticalLine=u),u}};function Cl(e,t=ao,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 a=Xe(i);Object.entries(t).forEach(([s,l])=>{var c;n.push({nodeBox:a,node:r,orientation:l.orientation,position:l.resolve(r,a),color:(c=r.style)==null?void 0:c.backgroundColor,anchorName:s})})}),n}function Sl(e,t,o,n,r=Object.keys(ao)){let i=[];for(let s of r){let l=ao[s],c=l.resolve(o,n),d=e.search(l.orientation,c,o,t);d&&i.push({anchorName:s,sourcePosition:c,anchor:l,line:d})}let a={horizontal:void 0,vertical:void 0};for(let s of i){let l=a[s.anchor.orientation],c=Math.abs(s.sourcePosition-s.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(a[s.anchor.orientation]=s)}return a}function Ml(e,t,o,n,r,i,a,s){var u,p,m,h,g,f,x,y;if(!(o!=null&&o.position))return{snappedX:!1,snappedY:!1};let l=!1,c=!1,d={x:o.position.x,y:o.position.y,x2:o.position.x+((p=(u=e.measured)==null?void 0:u.width)!=null?p:0),y2:o.position.y+((h=(m=e.measured)==null?void 0:m.height)!=null?h:0)};if(a){let N=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(N)<=Hr){if(o.position.y-=N,r!=null&&r.dimensions)if(n){let T=t.internals.positionAbsolute.y+((f=(g=e.measured)==null?void 0:g.height)!=null?f:0);r.dimensions.height=T-a.line.position}else r.dimensions.height=a.line.position-t.internals.positionAbsolute.y;c=!0}}if(s){let N=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(N)<=Hr){if(o.position.x-=N,r!=null&&r.dimensions)if(n){let T=t.internals.positionAbsolute.x+((y=(x=e.measured)==null?void 0:x.width)!=null?y:0);r.dimensions.width=T-s.line.position}else r.dimensions.width=s.line.position-t.internals.positionAbsolute.x;l=!0}}return i&&(l||c)&&(o.position.x-=i.position.x,o.position.y-=i.position.y),{snappedX:l,snappedY:c}}var Hr=10,ao={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 Ll=require("react/jsx-runtime"),im=new Vr;function Gr(){let[e,t]=(0,Ke.useState)(void 0),[o,n]=(0,Ke.useState)(void 0),{width:r,height:i}=(0,Ho.useStore)(f=>({width:f.width,height:f.height}),Pl.shallow),a=(0,Ho.useNodesInitialized)(),s=(0,Ke.useRef)(im),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,Ho.useReactFlow)(),u=(0,Ke.useCallback)(()=>{t(void 0),n(void 0)},[]),p=(0,Ke.useCallback)(f=>{let x=f!=null?f:d();u();let y=Cl(x,ao,c);s.current.initialize(y)},[c,u,d]),m=(0,Ke.useCallback)(()=>{setTimeout(()=>{p()},100)},[p]);(0,Ke.useEffect)(()=>{a&&p(d())},[a,p,d]);let h=(0,Ke.useCallback)((f,x)=>{var ie,A,R,Y,B;if(!s.current||f.length===0||f.length>2)return f;u();let y,b,N=Object.keys(ao);f.length===1?f[0].type==="position"?y=f[0]:f[0].type==="dimensions"&&(b=f[0],N=["right","bottom"]):f[0].type==="position"&&f[1].type==="dimensions"&&f[1].dimensions&&(y=f[0],b=f[1],N=["top","left"]);let T=x.find(X=>X.id===f[0].id);if(!T)return f;let _=c(T.id);if(!_)throw new Error(`Node with id ${T.id} not found in internal nodes`);let w=c((ie=_.parentId)!=null?ie:""),P=Xe(_);b!=null&&b.dimensions&&(P.x2=P.x+b.dimensions.width,P.y2=P.y+b.dimensions.height);let{x:H,y:C}=l({x:0,y:0}),{x:I,y:L}=l({x:r,y:i}),G={x:H,y:C,x2:I,y2:L},{horizontal:M,vertical:S}=Sl(s.current,G,T,P,N),D={id:T.id,type:"position",position:{x:_.internals.positionAbsolute.x,y:_.internals.positionAbsolute.y},dragging:!1};y!=null&&y.position&&D.position&&(w?(D.position.x=y.position.x+((R=(A=w==null?void 0:w.position)==null?void 0:A.x)!=null?R:0),D.position.y=y.position.y+((B=(Y=w==null?void 0:w.position)==null?void 0:Y.y)!=null?B:0)):(D.position.x=y.position.x,D.position.y=y.position.y));let{snappedX:q,snappedY:z}=Ml(T,_,D,y,b,w,M,S);if(q||z){if((b!=null&&b.resizing||y!=null&&y.dragging)&&(q&&n(S==null?void 0:S.line),z&&t(M==null?void 0:M.line)),b&&y)return[D,b];if(y)return[D];if(b)return[b]}return f},[l,c,r,i,t,n,u]),g=(0,Ke.useCallback)(()=>(0,Ll.jsx)(kl,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:p,forceRebuildIndex:m,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var gi=require("@xyflow/react"),Nt=require("react");var Go=e=>new Map(e.map(t=>[t.id,t])),Cn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),Dl=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),Br=e=>e.some(t=>t.type==="START_EVENT"),Rl=(e,t,o,n,r)=>{let i=Go(o),a=i.get(e);if(!a||a.type!=="START_EVENT")return!1;let s=i.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Cn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Ol=(e,t,o,n,r)=>{let i=Go(o),a=i.get(t);if(!a||a.type!=="END_EVENT")return!1;let s=i.get(e);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Dl(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},zr=(e,t,o,n)=>{var a;let r=t.find(s=>s.id===e);return!r||r.type!=="GATEWAY"||((a=r.data)==null?void 0:a.variant)!=="EXCLUSIVE"?!1:Cn(e,o,n).length>=2},Vl=(e,t,o)=>{var a,s,l,c;let n=Go(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((a=r==null?void 0:r.data)==null?void 0:a.variant)==="EXCLUSIVE"&&((s=i==null?void 0:i.data)==null?void 0:s.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"},Fr=(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"},Wr=(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"},Yr=(e,t,o,n)=>{let r=Go(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Dl(e,o,n).some(s=>{let l=r.get(s.source);return(l==null?void 0:l.type)==="START_EVENT"})},Ur=(e,t,o,n)=>{let r=Go(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Cn(e,o,n).some(s=>{let l=r.get(s.target);return(l==null?void 0:l.type)==="END_EVENT"})},$r=(e,t,o)=>Cn(e,t,o).length>0,Xr=(e,t,o,n,r)=>{let i=Go(o),a=i.get(e);if(!a||a.type!=="TASK")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:Cn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var sm=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!Rl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!Ol(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!zr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!Xr(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:Vl(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==="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:!(Fr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(Wr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Yr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(Ur(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!($r(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:[],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],Zi=e=>{for(let t of sm){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var am=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:zr(e.sourceNodeId,e.nodes,e.edges),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:Br(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Fr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Wr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Yr(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Ur(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:$r(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Xr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Hl=e=>{let t=am.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 ut=require("@xyflow/react");var Bo=require("@xyflow/react");function Gl(e,t){var b,N,T,_;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,a=o/2,s=n/2,l=r.x+a,c=r.y+s,d=i.x+((N=(b=t==null?void 0:t.measured)==null?void 0:b.width)!=null?N:0)/2,u=i.y+((_=(T=t==null?void 0:t.measured)==null?void 0:T.height)!=null?_:0)/2,p=(d-l)/(2*a)-(u-c)/(2*s),m=(d-l)/(2*a)+(u-c)/(2*s),h=1/(Math.abs(p)+Math.abs(m)||1),g=h*p,f=h*m,x=a*(g+f)+l,y=s*(-g+f)+c;return{x,y}}function Bl(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),a=Math.round(o.y),s=Math.round(t.x),l=Math.round(t.y);return s<=i+1?Bo.Position.Left:s>=i+n-1?Bo.Position.Right:l<=a+1?Bo.Position.Top:l>=a+r-1?Bo.Position.Bottom:Bo.Position.Top}function zt(e,t){let o=Gl(e,t),n=Gl(t,e),r=Bl(e,o),i=Bl(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function Kr(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 xt=require("lecom-ui"),Fl=require("lucide-react");var st=require("@xyflow/react");var zl=require("@xyflow/react"),Ft=()=>{let e=(0,zl.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:a,triggerNodeChanges:s}=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 s(l),a(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await nr(),!0}}};var qr=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,st.useReactFlow)(),{selectElements:r}=Ft(),i=f=>{let x=o(),y=n(),b=(0,st.getIncomers)(f,x,y),N=(0,st.getOutgoers)(f,x,y),T=b.some(w=>w.type==="START_EVENT"),_=N.some(w=>w.type==="END_EVENT");return T?"start":_?"end":"between"},a=(f,x,y)=>{var T,_,w,P;if(!f)return;let b={type:f.type,variant:(T=f.data)==null?void 0:T.variant,attribute:(_=f.data)==null?void 0:_.attribute},N={id:f.id,position:i(f),label:(w=f.data)==null?void 0:w.label,node:b};return f.type==="TASK"&&((P=f.data)==null?void 0:P.variant)==="SUBPROCESS"?v(E({},N),{type:"sub_process"}):f.type==="GATEWAY"?v(E({},N),{type:"gateway",variant:s(f,x,y)}):v(E({},N),{type:"activity"})},s=(f,x,y)=>{if(f.type!=="GATEWAY")return;let b=(0,st.getIncomers)(f,x,y),N=!1,T=!1;if(b.forEach(_=>{var w,P;_.type==="TASK"&&(((w=_.data)==null?void 0:w.variant)==="SCRIPT"&&(N=!0),((P=_.data)==null?void 0:P.attribute)==="LOOP"&&(T=!0))}),N&&T)return"script_loop";if(N)return"script";if(T)return"loop"},l=(f,x,y)=>{var w,P,H,C;let b=e(f.source),N=e(f.target);if(!b||!N)return"simple";if((0,st.getOutgoers)(b,x,y).some(I=>I.type==="END_EVENT"))return"final";if(b.type==="GATEWAY")switch((w=b.data)==null?void 0:w.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(b.type==="TASK"){let I=(P=b.data)==null?void 0:P.variant,L=(H=b.data)==null?void 0:H.attribute;if(I==="SUBPROCESS")return"from_sub_process";if(N.type==="TASK"&&((C=N.data)==null?void 0:C.variant)==="SUBPROCESS")return"to_sub_process";let G=I==="SCRIPT",M=L==="LOOP";return G&&M?"script_loop":G?"script":M?"loop":"simple"}return"simple"},c=(f,x,y)=>{let b=[];function N(_,w,P=0){let H=a(_,x,y);if(H.depth=P,w.push(H),_.type==="TASK"){b.push([...w]),w.pop();return}let C=(0,st.getIncomers)(_,x,y);if(C.length)for(let I of C)N(I,w,P+1);w.pop()}let T=(0,st.getIncomers)(f,x,y);for(let _ of T)N(_,[]);return b},d=(f,x,y)=>{let b=[];function N(_,w,P=0){let H=a(_,x,y);if(H.depth=P,w.push(H),_.type==="TASK"){b.push([...w]),w.pop();return}let C=(0,st.getOutgoers)(_,x,y);if(C.length)for(let I of C)N(I,w,P+1);w.pop()}let T=(0,st.getOutgoers)(f,x,y);for(let _ of T)N(_,[]);return b},u=(f,x,y)=>(y=y.filter(N=>N.source===f.id),y.map(N=>{var w;let T=e(N.target),_;return T&&(_=a(T,x,y)),{id:N.id,type:"routing",variant:l(N,x,y),label:(w=N.data)==null?void 0:w.label,target:_}})),p=f=>{let x=e(f);if(!x)return;let y=o(),b=n(),N=a(x,y,b);return N.sources=c(x,y,b),N.targets=d(x,y,b),N.edgeTargets=u(x,y,b),x.type==="GATEWAY"&&(N.variant=s(x,y,b)),N},m=f=>{let x=t(f);if(!x)return;let y=o(),b=n(),N=l(x,y,b),_={id:x.id,type:"routing",variant:N,gatewayVariant:void 0},w=e(x.source);if(w){let H=a(w,y,b);_.source=H;let C=s(w,y,b);if(_.gatewayVariant=C,w.type==="TASK")_.sources=[[H]];else{let I=c(w,y,b);_.sources=I.length?I:[[H]]}}let P=e(x.target);if(P){let H=a(P,y,b);if(_.target=H,P.type==="TASK")_.targets=[[H]];else{let C=d(P,y,b);_.targets=C.length?C:[[H]]}}return _},h=f=>{let x=e(f);if(x)return p(x.id);let y=t(f);if(y)return m(y.id)};return{configureElement:f=>{let x=h(f);if(x)return r([f]),x},getConfigureElement:h,getNodeConfigure:p,getEdgeConfigure:m}};var lo=require("react/jsx-runtime"),Wt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,xt.useTranslation)(),{onConfigureElement:n}=W(),{getConfigureElement:r}=qr();return(0,lo.jsxs)(xt.Tooltip,{children:[(0,lo.jsx)(xt.TooltipTrigger,{asChild:!0,children:(0,lo.jsx)(xt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,lo.jsx)(Fl.Settings,{size:16})})}),(0,lo.jsx)(xt.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Wl=require("@xyflow/react"),Et=require("lecom-ui"),Yl=require("lucide-react"),co=require("react/jsx-runtime"),Zr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Et.useTranslation)(),{deleteElements:n}=(0,Wl.useReactFlow)();return(0,co.jsxs)(Et.Tooltip,{children:[(0,co.jsx)(Et.TooltipTrigger,{asChild:!0,children:(0,co.jsx)(Et.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,co.jsx)(Yl.TrashIcon,{size:16})})}),(0,co.jsx)(Et.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var bt=require("lecom-ui"),Ul=require("lucide-react"),$l=require("react"),uo=require("react/jsx-runtime"),Sn=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,bt.useTranslation)(),r=(0,$l.useCallback)(i=>{i.stopPropagation();let a=document.querySelector(`[data-id="${e}"]`);if(!a)return;let s=a.querySelector(".react-flow__handle.source");if(!s)return;let l=s.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});s.dispatchEvent(u)},[e]);return(0,uo.jsxs)(bt.Tooltip,{children:[(0,uo.jsx)(bt.TooltipTrigger,{asChild:!0,children:(0,uo.jsx)(bt.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,uo.jsx)(Ul.MoveUpRightIcon,{size:16})})}),(0,uo.jsx)(bt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var zo=require("react/jsx-runtime"),Wo=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=ht(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=W(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d}=Kr(o,n),u=!l&&!c&&!d,p=[{component:(0,zo.jsx)(Zr,{elementId:e,elementType:"edge"})}],m=()=>s==="view"?u?[{component:(0,zo.jsx)(Wt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,zo.jsx)(Wt,{elementId:e,elementType:"edge"})},...p]:p,g=(f=>{switch(f){case"SEQUENCE_EDGE":return m();case"MESSAGE_EDGE":return s==="view"?[]:[...p];case"ANNOTATION_EDGE":return s==="view"?[]:[...p];default:return[]}})(t);if(!(g.length===0||s==="view"))return(0,zo.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((f,x)=>(0,zo.jsx)("div",{children:f.component},x))}))};var po=require("react/jsx-runtime"),Yo={type:"ANNOTATION_EDGE",reconnectable:!0},Xl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,ut.useViewport)(),{isMultipleSelection:a}=W(),s=(0,ut.useInternalNode)(t),l=(0,ut.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:u,ty:p}=zt(s,l),[m,h,g]=(0,ut.getStraightPath)({sourceX:c,sourceY:d,targetX:u,targetY:p}),f=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected),x=1/i;return(0,po.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":f}),children:[(0,po.jsx)(ut.BaseEdge,{id:e,path:m,strokeDasharray:4,className:k("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)]":f&&!(r!=null&&r.hasError)})}),(0,po.jsx)(ut.EdgeLabelRenderer,{children:(0,po.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${g}px)`},children:n&&!a&&(0,po.jsx)(Wo,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${x})`}})})})]})};var Be=require("react"),he=require("@xyflow/react");var fo=require("react");var Ji=require("react/jsx-runtime"),He=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s})=>{let l=(0,fo.useRef)(null),[c,d]=(0,fo.useState)(!1);(0,fo.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,fo.useEffect)(()=>{if(c&&l.current){l.current.focus();let g=document.createRange();g.selectNodeContents(l.current);let f=window.getSelection();f&&(f.removeAllRanges(),f.addRange(g))}},[c]);let u=g=>{g.stopPropagation(),c||d(!0)},p=g=>{let f=g.currentTarget.innerText.trim(),x=t&&f.length>=t,y=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],b=g.ctrlKey||g.metaKey,N=b&&g.key==="a",T=b&&g.key==="c",_=b&&g.key==="x",w=b&&g.key==="v";function P(C){return/\w/.test(C)}if(f.length===0&&!P(g.key)&&!y.includes(g.key)&&!b){g.preventDefault();return}x&&(y.includes(g.key)||N||T||_||w||g.preventDefault())},m=g=>{if(!t)return;g.preventDefault();let f=g.clipboardData.getData("text/plain"),x=g.currentTarget.innerText,y=window.getSelection();if(!y||y.rangeCount===0)return;let b=y.getRangeAt(0);if((x.substring(0,b.startOffset)+f+x.substring(b.endOffset)).length>t){let T=t-(x.length-(b.endOffset-b.startOffset)),_=f.substring(0,Math.max(0,T));_&&(b.deleteContents(),b.insertNode(document.createTextNode(_)),b.setStartAfter(b.endContainer),b.collapse(!0),y.removeAllRanges(),y.addRange(b))}else b.deleteContents(),b.insertNode(document.createTextNode(f)),b.setStartAfter(b.endContainer),b.collapse(!0),y.removeAllRanges(),y.addRange(b)},h=g=>{d(!1);let f=g.currentTarget.innerText.trim();t&&f.length>t&&(f=f.substring(0,t)),g.currentTarget.innerText=f,s==null||s(),f!==e&&(a==null||a(f))};return(0,Ji.jsx)("div",{className:k("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",n,{"border border-dashed border-grey-400":c}),style:o,onDoubleClick:u,children:(0,Ji.jsx)("div",{ref:l,className:k("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:p,onPaste:m,onBlur:h,children:e})})};var Mn=require("@xyflow/react"),Pn=e=>e===Mn.Position.Left||e===Mn.Position.Right,Qi=(e,t=30)=>e===Mn.Position.Right||e===Mn.Position.Bottom?t:-t,ji=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,Uo=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Jr=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Ln={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};function lm(e,t,o,n,r,i,a=0){let s=Qi(r,Ln.OFFSET),l=Qi(i,Ln.OFFSET),c=Pn(r),d=Pn(i),u=c?0:a,p=c?a:0,m=d?0:a,h=d?a:0,g={x:e+u,y:t+p},f={x:o+m,y:n+h};if(c&&d){let x=(t+n)/2+a;return[g,{x:e+s,y:t+a},{x:e+s,y:x},{x:o+l,y:x},{x:o+l,y:n+a},f]}if(!c&&!d){let x=(e+o)/2+a;return[g,{x:e+a,y:t+s},{x,y:t+s},{x,y:n+l},{x:o+a,y:n+l},f]}return c?[g,{x:e+s,y:t+a},{x:e+s,y:n+l+a},{x:o+a,y:n+l+a},f]:[g,{x:e+a,y:t+s},{x:o+l+a,y:t+s},{x:o+l+a,y:n+a},f]}function Kl(e,t,o,n,r,i,a,s=0){let l=lm(e,t,o,n,r,i,s);if(!(a!=null&&a.length))return l;let c=[...a];if(c.length>0){let d={x:e,y:t},u=c[0],p=Pn(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=Pn(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 ql=e=>{if(e.length<2)return"";let[t,...o]=e;return`M ${t.x},${t.y}${o.map(n=>` L ${n.x},${n.y}`).join("")}`};var fe=require("react"),Qr=require("@xyflow/react");var cm=50,Zl=.1,dm=.6,jr=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:a,getNodes:s,getEdge:l,screenToFlowPosition:c}=(0,Qr.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=W(),p=(0,Qr.useStore)(A=>A.isValidConnection),[m,h]=(0,fe.useState)(null),[g,f]=(0,fe.useState)(null),[x,y]=(0,fe.useState)(null),[b,N]=(0,fe.useState)(null),[T,_]=(0,fe.useState)(null),[w,P]=(0,fe.useState)(!1),H=(0,fe.useRef)(null),C=(0,fe.useRef)(null),I=(0,fe.useRef)(null),L=(0,fe.useRef)(t),G=(0,fe.useRef)(o);(0,fe.useEffect)(()=>{L.current=t,G.current=o},[t,o]),(0,fe.useEffect)(()=>{H.current=m},[m]),(0,fe.useEffect)(()=>{C.current=T},[T]);let M=(0,fe.useCallback)(A=>{let R=s(),Y=R.find(oe=>oe.id===A);if(!Y)return{x:0,y:0};let B=Y.position.x,X=Y.position.y,K=Y.parentId;for(;K;){let oe=R.find(O=>O.id===K);if(!oe)break;B+=oe.position.x,X+=oe.position.y,K=oe.parentId}return{x:B,y:X}},[s]),S=(0,fe.useCallback)(A=>{var K,oe,O,U,$,F;let R=s(),Y=null,B=cm,X=R.filter(V=>V.type!=="LANE"&&V.type!=="ANNOTATION");for(let V of X){if(V.id===e)continue;let J=M(V.id),Z=(O=(oe=(K=V.measured)==null?void 0:K.width)!=null?oe:V.width)!=null?O:0,ae=(F=($=(U=V.measured)==null?void 0:U.height)!=null?$:V.height)!=null?F:0;if(A.x>=J.x&&A.x<=J.x+Z&&A.y>=J.y&&A.y<=J.y+ae)return V.id;let ge=Math.max(J.x-A.x,0,A.x-(J.x+Z)),Ee=Math.max(J.y-A.y,0,A.y-(J.y+ae)),ke=Math.sqrt(ge*ge+Ee*Ee);ke<B&&(B=ke,Y=V.id)}return Y},[s,M,e]),D=(0,fe.useCallback)((A,R)=>{var ge,Ee,ke,De,Ve,Me;let Y=a(A);if(!Y)return null;let B=M(A),X=(ke=(Ee=(ge=Y.measured)==null?void 0:ge.width)!=null?Ee:Y.width)!=null?ke:0,K=(Me=(Ve=(De=Y.measured)==null?void 0:De.height)!=null?Ve:Y.height)!=null?Me:0,oe=Math.abs(B.x+X-R.x),O=Math.abs(R.x-B.x),U=Math.abs(B.y+K-R.y),$=Math.abs(R.y-B.y),F={right:oe,left:O,bottom:U,top:$},V=Object.entries(F).reduce((ee,[Q,Re])=>Re<ee[1]?[Q,Re]:ee,["right",F.right])[0],J=I.current;if(J&&J!==V){let ee=F[V],Q=F[J],Re=Math.abs(Q-ee),ct=Math.min(Math.abs(Q),Math.abs(ee));Re<ct*dm&&(V=J)}let Z=V,ae,Ie;if(Z==="right"||Z==="left"){let Q=(Math.max(B.y,Math.min(B.y+K,R.y))-B.y)/(K||1);Math.abs(Q-.5)<Zl&&(Q=.5),Ie=Q,ae={x:Z==="right"?B.x+X:B.x,y:B.y+Ie*K}}else{let Q=(Math.max(B.x,Math.min(B.x+X,R.x))-B.x)/(X||1);Math.abs(Q-.5)<Zl&&(Q=.5),Ie=Q,ae={x:B.x+Ie*X,y:Z==="bottom"?B.y+K:B.y}}return{side:Z,snapPosition:ae,offset:Ie}},[a,M]),q=(0,fe.useCallback)(A=>{var O,U,$;let R=H.current;if(!R)return;let Y=c({x:A.clientX,y:A.clientY}),B=S(Y);y(B);let X=Y,K=null,oe=null;if(B){let F=D(B,Y);F&&(K=F.side,X=F.snapPosition,oe=F.offset,I.current=K);let V=l(e),J={source:R==="source"?B:L.current,target:R==="target"?B:G.current,sourceHandle:R==="source"?K:(O=V==null?void 0:V.sourceHandle)!=null?O:null,targetHandle:R==="target"?K:(U=V==null?void 0:V.targetHandle)!=null?U:null},Z=($=p==null?void 0:p(J))!=null?$:!0;P(Z)}else I.current=null,P(!1);N(K),_(oe),f(X)},[S,D,l,e,c,p]),z=(0,fe.useCallback)(A=>{var K,oe,O,U,$;let R=H.current;if(!R)return;let Y=c({x:A.clientX,y:A.clientY}),B=S(Y);if(B){let F=D(B,Y),V=(K=F==null?void 0:F.side)!=null?K:null,J=(oe=F==null?void 0:F.offset)!=null?oe:.5,Z=l(e),ae={source:R==="source"?B:L.current,target:R==="target"?B:G.current,sourceHandle:R==="source"?V:(O=Z==null?void 0:Z.sourceHandle)!=null?O:null,targetHandle:R==="target"?V:(U=Z==null?void 0:Z.targetHandle)!=null?U:null};(($=p==null?void 0:p(ae))==null||$)&&i(Ie=>Ie.map(ge=>{var Ee,ke;return ge.id===e?v(E({},ge),{source:ae.source,target:ae.target,sourceHandle:ae.sourceHandle,targetHandle:ae.targetHandle,data:v(E({},ge.data),{points:void 0,sourceOffset:R==="source"?J:(Ee=ge.data)==null?void 0:Ee.sourceOffset,targetOffset:R==="target"?J:(ke=ge.data)==null?void 0:ke.targetOffset})}):ge}))}h(null),f(null),y(null),N(null),_(null),d(!1),P(!1),u(null),I.current=null,document.removeEventListener("mouseup",z),document.removeEventListener("mousemove",q);let X=_t.get(n);X==null||X.clearReconnectingEdge()},[e,S,D,l,i,n,q,p,c,d,u]),ie=(0,fe.useCallback)((A,R)=>{if(r||R.button!==0)return;R.stopPropagation(),R.preventDefault(),i(B=>B.map(X=>X.id===e?v(E({},X),{data:v(E({},X.data),{points:void 0})}):X)),h(A),u(e);let Y=_t.get(n);Y==null||Y.setReconnectingEdge(e),document.addEventListener("mousemove",q),document.addEventListener("mouseup",z)},[r,e,n,q,z,u,i]);return(0,fe.useEffect)(()=>()=>{if(H.current){document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",z),u(null);let A=_t.get(n);A==null||A.clearReconnectingEdge()}},[n,q,z,u]),{reconnectingHandle:m,cursorPosition:g,hoveredNodeId:x,reconnectingSide:b,reconnectingOffset:T,isValidReconnection:w,handleReconnectStart:ie}};var le=require("react/jsx-runtime"),pt={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:he.MarkerType.ArrowClosed},markerEnd:{type:he.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:ei,MIN_SEGMENT_LENGTH:um,PARALLEL_OFFSET:Jl}=Ln;function pm(e,t,o,n){let r=n.filter(s=>s.source===t&&s.target===o||s.source===o&&s.target===t);if(r.length<=1){let s=n.filter(d=>d.source===t);if(s.length<=1)return 0;let l=s.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(s.length-1)/2;return(l-c)*Jl}let i=r.findIndex(s=>s.id===e),a=(r.length-1)/2;return(i-a)*Jl}var Ql=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var oe;let{zoom:c}=(0,he.useViewport)(),{updateEdgeData:d}=(0,he.useReactFlow)(),u=(0,he.useEdges)(),{isMultipleSelection:p,mode:m,instanceId:h}=W(),[g,f]=(0,Be.useState)(!1),[x,y]=(0,Be.useState)(null),b=(0,Be.useRef)(null),N=(0,Be.useRef)(null),T=m!=="edit",{reconnectingHandle:_,cursorPosition:w,hoveredNodeId:P,reconnectingSide:H,isValidReconnection:C,handleReconnectStart:I}=jr({edgeId:e,source:t,target:o,instanceId:h,isReadOnly:T}),L=(0,he.useInternalNode)(t),G=(0,he.useInternalNode)(o),{sx:M,sy:S,tx:D,ty:q,sourcePos:z,targetPos:ie}=(0,Be.useMemo)(()=>{var Ee,ke;let O=L&&G?zt(L,G):{sx:0,sy:0,tx:0,ty:0,sourcePos:he.Position.Right,targetPos:he.Position.Left},U=s?i:O.sourcePos,$=l?a:O.targetPos,F=(De,Ve,Me)=>{var Jt,Qt,jt,vo,cn,ys;let{x:ee,y:Q}=De.internals.positionAbsolute,Re=(jt=(Qt=(Jt=De.measured)==null?void 0:Jt.width)!=null?Qt:De.width)!=null?jt:0,ct=(ys=(cn=(vo=De.measured)==null?void 0:vo.height)!=null?cn:De.height)!=null?ys:0;switch(Ve){case he.Position.Top:return{x:ee+Re*Me,y:Q};case he.Position.Bottom:return{x:ee+Re*Me,y:Q+ct};case he.Position.Left:return{x:ee,y:Q+ct*Me};case he.Position.Right:return{x:ee+Re,y:Q+ct*Me};default:return{x:ee+Re/2,y:Q+ct/2}}},V=(Ee=n==null?void 0:n.sourceOffset)!=null?Ee:.5,J=(ke=n==null?void 0:n.targetOffset)!=null?ke:.5,Z=L?F(L,U,V).x:O.sx,ae=L?F(L,U,V).y:O.sy,Ie=G?F(G,$,J).x:O.tx,ge=G?F(G,$,J).y:O.ty;return _==="source"&&w?(Z=w.x,ae=w.y,H&&(U=H)):_==="target"&&w&&(Ie=w.x,ge=w.y,H&&($=H)),{sx:Z,sy:ae,tx:Ie,ty:ge,sourcePos:U,targetPos:$}},[L,G,s,l,i,a,_,w,H,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,Be.useEffect)(()=>{var $;if(!N.current){N.current={sx:M,sy:S,tx:D,ty:q,sourcePos:z,targetPos:ie};return}let O=N.current;(Math.abs(M-O.sx)>ei||Math.abs(S-O.sy)>ei||Math.abs(D-O.tx)>ei||Math.abs(q-O.ty)>ei||O.sourcePos!==z||O.targetPos!==ie)&&(($=n==null?void 0:n.points)!=null&&$.length)&&!_&&d(e,v(E({},n),{points:void 0})),N.current={sx:M,sy:S,tx:D,ty:q,sourcePos:z,targetPos:ie}},[M,S,D,q,z,ie,n,e,d,_]);let A=(0,Be.useMemo)(()=>{let O=pm(e,t,o,u);return Kl(M,S,D,q,z,ie,n==null?void 0:n.points,O)},[M,S,D,q,z,ie,n==null?void 0:n.points,u,e,t,o]),R=(0,Be.useMemo)(()=>{if(A.length<2)return Jr({x:M,y:S},{x:D,y:q});let O=0;for(let F=0;F<A.length-1;F++)O+=Uo(A[F],A[F+1]);let U=O/2,$=0;for(let F=0;F<A.length-1;F++){let V=Uo(A[F],A[F+1]);if($+V>=U){let J=(U-$)/V,Z=A[F],ae=A[F+1];return{x:Z.x+(ae.x-Z.x)*J,y:Z.y+(ae.y-Z.y)*J}}$+=V}return Jr({x:M,y:S},{x:D,y:q})},[A,M,S,D,q]),Y=(0,Be.useMemo)(()=>{if(A.length<2){let V=Math.abs(D-M);return Math.abs(q-S)>V?{x:-60,y:0}:{x:0,y:-60}}let U=0;for(let V=0;V<A.length-1;V++)U+=Uo(A[V],A[V+1]);let $=U/2,F=0;for(let V=0;V<A.length-1;V++){let J=Uo(A[V],A[V+1]);if(F+J>=$){let Z=A[V],ae=A[V+1],Ie=Math.abs(ae.x-Z.x);return Math.abs(ae.y-Z.y)>Ie?{x:-60,y:0}:{x:0,y:-60}}F+=J}return{x:0,y:-60}},[A,M,S,D,q]),B=(0,Be.useCallback)((O,U)=>{if(m!=="edit"||U.button!==0)return;U.stopPropagation(),U.preventDefault();let $=A[O],F=A[O+1],V=ji($,F,"y"),J=V?$.y:$.x,Z=[...A],ae=Z.length,Ie=O,ge=O+1;y(O);let Ee=De=>{let Ve=J+(V?De.clientY-U.clientY:De.clientX-U.clientX)/c;b.current=V?{x:($.x+F.x)/2,y:Ve}:{x:Ve,y:($.y+F.y)/2};let Me=[];for(let ee=1;ee<ae-1;ee++){let Q=Z[ee];ee===Ie||ee===ge?V?Me.push({x:Q.x,y:Ve}):Me.push({x:Ve,y:Q.y}):Me.push(E({},Q))}d(e,v(E({},n),{points:Me}))},ke=()=>{y(null),b.current=null,document.removeEventListener("mousemove",Ee),document.removeEventListener("mouseup",ke)};document.addEventListener("mousemove",Ee),document.addEventListener("mouseup",ke)},[m,A,c,n,e,d]);if(!L||!G)return null;let X=ql(A),K=r||L.selected||G.selected;return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":K}),onBlur:()=>f(!1),onDoubleClick:()=>f(!0),children:[(0,le.jsx)(he.BaseEdge,{id:e,path:X,markerEnd:`url(#${K?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||_&&P&&!C,"stroke-green-500":_&&P&&C,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":K&&!(n!=null&&n.hasError)&&!_})}),r&&!p&&!T&&(0,le.jsx)("g",{children:A.slice(0,-1).map((O,U)=>{let $=A[U+1];if(U===0||U===A.length-2||Uo(O,$)<um)return null;let F=ji(O,$,"y"),V=x===U,J=V&&b.current?b.current:Jr(O,$);return(0,le.jsxs)("g",{children:[(0,le.jsx)("line",{x1:O.x,y1:O.y,x2:$.x,y2:$.y,stroke:"transparent",strokeWidth:20/c,className:k("cursor-pointer",{"cursor-ns-resize":F,"cursor-ew-resize":!F}),onMouseDown:Z=>B(U,Z)}),(0,le.jsx)("circle",{cx:J.x,cy:J.y,r:4/c,fill:V?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:J.x,cy:J.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:V?.6:.3,className:"pointer-events-none"})]},U)})})]}),(0,le.jsxs)(he.EdgeLabelRenderer,{children:[(0,le.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${R.x}px, ${R.y}px)`},children:[r&&!p&&(0,le.jsx)("div",{className:"absolute",style:{transform:`translate(${Y.x}px, ${Y.y}px)`},children:(0,le.jsx)(Wo,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:L,targetNode:G,style:{transform:`scale(${1/c})`}})}),(g||((oe=n==null?void 0:n.label)==null?void 0:oe.trim()))&&(0,le.jsx)(He,{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,onChange:O=>d(e,{label:O.trim()})})]}),r&&!p&&!T&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A[0].x}px, ${A[0].y}px)`},children:(0,le.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="source"?.6:.3,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!_||_!=="source","cursor-not-allowed":_==="source"&&P&&!C,"cursor-grabbing":_==="source"&&(!P||C)}),onMouseDown:O=>I("source",O.nativeEvent)})]})}),(0,le.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A[A.length-1].x}px, ${A[A.length-1].y}px)`},children:(0,le.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="target"?.6:.3,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!_||_!=="target","cursor-not-allowed":_==="target"&&P&&!C,"cursor-grabbing":_==="target"&&(!P||C)}),onMouseDown:O=>I("target",O.nativeEvent)})]})})]})]})]})};var dd=require("use-debounce");var cd=require("@xyflow/react"),as=require("react");var kn=(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))(kn||{});var ti=require("xml-js");var jl={compact:!0,spaces:4},fm=e=>e.replaceAll(`
2
- `,"&#xA;");function oi(e,t=jl){if(e)return JSON.parse((0,ti.xml2json)(e,v(E({},t),{attributeValueFn:fm})))}function ec(e,t=jl){return e?(0,ti.json2xml)(e,t):""}var mm={MIN_WIDTH:36,MIN_HEIGHT:36},gm={MIN_WIDTH:36,MIN_HEIGHT:36},hm={MIN_WIDTH:56,MIN_HEIGHT:56},ni={MIN_WIDTH:176,MIN_HEIGHT:96},ri={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},be={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ii={MIN_WIDTH:176,MIN_HEIGHT:64},ym={MIN_WIDTH:128,MIN_HEIGHT:64},te={START_EVENT:mm,END_EVENT:gm,GATEWAY:hm,TASK:ni,LANE:be,ANNOTATION:ii,UNSUPPORTED:ym};var tc={"attribute-loop":"LOOP"},oc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},nc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},rc={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},ic={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var $o=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=Rt(Number(n),t),a=Rt(Number(r),o);return{width:i,height:a,measured:{width:i,height:a}}},Xo=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,a={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},s={id:n,position:a,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(s.parentId=l),s},Em=e=>{let{mxGeometry:t}=e,o=Xo(e),n=$o(t,te.START_EVENT.MIN_WIDTH,te.START_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"START_EVENT"})},bm=e=>{let{mxGeometry:t}=e,o=Xo(e),n=$o(t,te.END_EVENT.MIN_WIDTH,te.END_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"END_EVENT"})},es=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=Xo(e),i=$o(n,te.TASK.MIN_WIDTH,te.TASK.MIN_HEIGHT),a=t==null?void 0:t.find(l=>{let{parent:c}=l._attributes;return c===e._attributes.id});if(a){let{style:l}=a._attributes,c=tc[l];c&&(r.data.attribute=c)}let s=oc[o.style];return s&&(r.data.variant=s),v(E(E({},r),i),{type:"TASK"})},ts=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=Xo(e),i=$o(o,te.GATEWAY.MIN_WIDTH,te.GATEWAY.MIN_HEIGHT);return r.data.variant=nc[n],v(E(E({},r),i),{type:"GATEWAY"})},_m=e=>{let{mxGeometry:t}=e,o=Xo(e),n=$o(t,te.ANNOTATION.MIN_WIDTH,te.ANNOTATION.MIN_HEIGHT);return v(E(E({},o),n),{type:"ANNOTATION"})},Tm=e=>{let{mxGeometry:t}=e,o=Xo(e),n=$o(t,te.LANE.MIN_WIDTH,te.LANE.MIN_HEIGHT);return v(E(E({},o),n),{type:"LANE"})},sc={task:es,"task-script":es,"subprocess-collapsed":es,"start-event":Em,"end-event-terminate":bm,"gateway-parallel":ts,"gateway-exclusive":ts,"gateway-complex":ts,annotation:_m,lane:Tm},Nm=e=>{if(e&&Array.isArray(e))return e.map(t=>({x:Number(t._attributes.x),y:Number(t._attributes.y)}))},ac=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:a,style:s}=t,l=Nm(o==null?void 0:o.Array),c={id:n,source:r,target:i,data:E({label:a||""},l&&l.length>0?{points:l}:{})};return s.includes("association")&&s.includes('endArrow=""')?E(E({},Yo),c):E(E({},pt),c)},lc=(e,t)=>{let{id:o,type:n,source:r,target:i,data:a}=e,s=t==null?void 0:t.find(u=>u.id===r),l="";n==="ANNOTATION_EDGE"&&(l='association;endArrow=""');let c={_attributes:{as:"geometry",relative:"1"}};return a!=null&&a.points&&Array.isArray(a.points)&&a.points.length>0&&(c.Array=a.points.map(u=>({_attributes:{as:"mxPoint",x:u.x,y:u.y}}))),{_attributes:{id:o,parent:(s==null?void 0:s.parentId)||"1",edge:"1",style:l,source:r,target:i,value:(a==null?void 0:a.label)||""},mxGeometry:c}},Ko=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}}}},vm=e=>{let{variant:t}=e.data,o=Ko(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:rc[t]||"task"})})},wm=e=>{let t=Ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"start-event"})})},Im=e=>{let t=Ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"end-event-terminate"})})},Am=e=>{let{variant:t}=e.data,o=Ko(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:ic[t]})})},Cm=e=>{let t=Ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"lane"})})},Sm=e=>{let t=Ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"annotation"})})},cc={TASK:vm,START_EVENT:wm,END_EVENT:Im,GATEWAY:Am,ANNOTATION:Sm,LANE:Cm},dc=(e,t)=>{var a,s;let r=((a=e.measured)==null?void 0:a.width)||0,i=((s=e.measured)==null?void 0:s.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 os=zu(require("@dagrejs/dagre"),1),mc=require("@xyflow/react");var gc=require("lodash");var uc=require("lodash");var Pt=e=>{var t,o,n,r,i,a,s,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},mo=e=>(0,uc.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),pc=(e,t)=>{let{x:o,y:n}=Pt(e),{x:r,y:i}=Pt(t);return{x:o-r,y:n-i}};var qo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(j)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Mm=(e,t)=>{let{x:o,y:n}=Pt(e),{x:r,y:i}=Pt(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},Pm=(e,t)=>{let{x:o,y:n,w:r,h:i}=Pt(e),{x:a,y:s,w:l,h:c}=Pt(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},Dn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Pm(e,r)){let i=Mm(e,r);i<n&&(n=i,o=r)}return o},fc=(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 hc=(e=[],t=[],o="LR")=>{let n=new os.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>n.setNode(i,{width:a,height:s})),t.forEach(i=>n.setEdge(i.source,i.target)),os.default.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return v(E({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},Rn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=On(n.id,o)}),o},On=(e,t)=>{var m,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,gc.orderBy)(r,["position.y"]),a=Math.max((h=(m=n.measured)==null?void 0:m.width)!=null?h:0,ri.MIN_WIDTH),s=fc(e,i)||be.MIN_WIDTH,l=Math.max(a,s),c=a-be.HEADER_WIDTH>=s,d=0,u=0;i.forEach(g=>{var f,x,y,b;o=o.map(N=>N.id===g.id?v(E({},N),{width:c?l-be.HEADER_WIDTH:l,measured:v(E({},N.measured),{width:c?l-be.HEADER_WIDTH:l}),position:{x:be.HEADER_WIDTH,y:d}}):N),d+=(x=(f=g.measured)==null?void 0:f.height)!=null?x:0,u+=(b=(y=g.measured)==null?void 0:y.height)!=null?b:0}),o=o.map(g=>g.id===e?v(E({},g),{height:u,width:c?l:l+be.HEADER_WIDTH,measured:v(E({},g.measured),{height:u,width:c?l:l+be.HEADER_WIDTH})}):g);let p=o.find(g=>g.id===e);return p!=null&&p.parentId&&(o=On(p.parentId,o)),o},yc=(e,t,o)=>{if(e.type==="LANE")return o;let n=Xe(t),r=Xe(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+be.HEADER_WIDTH&&(e.position.x=be.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},xc=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Lm=50,Ec=(e,t=Lm)=>{let o=(0,mc.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Vn=1,bc=()=>`<mxGraphModel>
1
+ "use strict";var Ou=Object.create;var un=Object.defineProperty,Vu=Object.defineProperties,Hu=Object.getOwnPropertyDescriptor,Gu=Object.getOwnPropertyDescriptors,Bu=Object.getOwnPropertyNames,jn=Object.getOwnPropertySymbols,zu=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty,Es=Object.prototype.propertyIsEnumerable;var xs=(e,t,o)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))Si.call(t,o)&&xs(e,o,t[o]);if(jn)for(var o of jn(t))Es.call(t,o)&&xs(e,o,t[o]);return e},v=(e,t)=>Vu(e,Gu(t));var ht=(e,t)=>{var o={};for(var n in e)Si.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&jn)for(var n of jn(e))t.indexOf(n)<0&&Es.call(e,n)&&(o[n]=e[n]);return o};var Fu=(e,t)=>{for(var o in t)un(e,o,{get:t[o],enumerable:!0})},bs=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Bu(t))!Si.call(e,r)&&r!==o&&un(e,r,{get:()=>t[r],enumerable:!(n=Hu(t,r))||n.enumerable});return e};var Wu=(e,t,o)=>(o=e!=null?Ou(zu(e)):{},bs(t||!e||!e.__esModule?un(o,"default",{value:e,enumerable:!0}):o,e)),Yu=e=>bs(un({},"__esModule",{value:!0}),e);var mg={};Fu(mg,{EditorMode:()=>We,ElementPosition:()=>tr,ElementType:()=>pn,GatewayElementVariant:()=>or,GatewayVariant:()=>it,Modeler:()=>Ru,ModelerProvider:()=>Lu,NodeAttribute:()=>It,NodeType:()=>J,NodeVariant:()=>rt,RoutingVariant:()=>nr,useModeler:()=>Ai});module.exports=Yu(mg);var Mi=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 er=require("lecom-ui");var _s={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..."},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:{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"}}},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 Ts={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..."},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:{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"}},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 Ns={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..."},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:{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"}}},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 vs={pt_BR:Ns,en_US:_s,es_ES:Ts};var ws,As,Uu=(As=(ws=Mi("LecomUserLanguage"))!=null?ws:Mi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?As:er.Translations.PT_BR;(0,er.initializeI18n)({lng:Uu,resources:vs});var We=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(We||{});var pn=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(pn||{}),tr=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(tr||{}),or=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(or||{}),nr=(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))(nr||{});var Ro=require("lucide-react");var oo=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,oo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,oo.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,oo.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,oo.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,oo.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Pi=require("react/jsx-runtime"),Io=({size:e=24,className:t})=>(0,Pi.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,Pi.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 Dt=require("react/jsx-runtime"),Co=({size:e=24,className:t})=>(0,Dt.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,Dt.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,Dt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Dt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var So=require("react/jsx-runtime"),Mo=({size:e=24,className:t})=>(0,So.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,So.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,So.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,So.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Po=require("react/jsx-runtime"),Lo=({size:e=24,className:t})=>(0,Po.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,Po.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,Po.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Po.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var ko=require("react/jsx-runtime"),Is=({size:e=24,className:t})=>(0,ko.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,ko.jsxs)("g",{children:[(0,ko.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,ko.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Cs=require("clsx"),Ss=require("tailwind-merge");function k(...e){return(0,Ss.twMerge)((0,Cs.clsx)(e))}var Rt=(e=0,t=0)=>e<t?t:e,ir=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var fn=require("react/jsx-runtime"),Ms=({size:e=24,className:t})=>(0,fn.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:k("stroke-2",t),children:[(0,fn.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,fn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var sr=require("react/jsx-runtime"),Ps=({size:e=24,className:t})=>(0,sr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,sr.jsx)("g",{children:(0,sr.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 Li=require("react/jsx-runtime"),ar=({size:e=24,className:t})=>(0,Li.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,Li.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 ki=require("react/jsx-runtime"),mn=({size:e=24,className:t})=>(0,ki.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:k("stroke-2",t),children:(0,ki.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 Do=require("react/jsx-runtime"),Ls=({size:e=24,className:t})=>(0,Do.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,Do.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,Do.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,Do.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ot=require("react/jsx-runtime"),ks=({size:e=24,className:t})=>(0,Ot.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,Ot.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,Ot.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,Ot.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,Ot.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ot.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var no=require("react/jsx-runtime"),Ds=({size:e=24,className:t})=>(0,no.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,no.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,no.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,no.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,no.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var J=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(J||{}),rt=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(rt||{}),lr={SCRIPT:{icon:Ro.ScrollText},SUBPROCESS:{icon:Ro.SquarePlus}},It=(t=>(t.LOOP="LOOP",t))(It||{}),cr={LOOP:{icon:Ro.RotateCcw}},it=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(it||{}),Di={EXCLUSIVE:{icon:Mo},PARALLEL:{icon:Lo},COMPLEX:{icon:Co}};var ku=require("@xyflow/react"),Ae=require("react");var Zt=require("@xyflow/react"),vi=require("react");var Xt=require("@xyflow/react"),kt=require("react");var Rs=require("zustand"),Os=require("@xyflow/react"),Vs=require("react");var dr=()=>{let{setEdges:e}=(0,Os.useReactFlow)();return(0,Vs.useCallback)(()=>{let o=ro.getState().pathEdgeIds;e(n=>n.map(r=>v(E({},r),{selected:o.includes(r.id)})))},[e])},ro=(0,Rs.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=E({},n.statusByNodeId),i=E({},n.statusData),a=!1;return o.forEach(s=>{let l=`${s.diagramId}-${s.activityId}`;r[s.diagramId]!==s.status&&(r[s.diagramId]=s.status,i[l]=s,a=!0)}),a?{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=[],a={};o.forEach(d=>{a[d.source]||(a[d.source]=[]),a[d.source].push({targetId:d.target,edgeId:d.id})});let s=r[0],l=r[r.length-1];o.forEach(d=>{d.target===s&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let p=[],m=new Set;for(p.push({node:d,path:[]}),m.add(d);p.length>0;){let{node:h,path:g}=p.shift();if(h===u)return g;let f=a[h]||[];for(let{targetId:x,edgeId:y}of f)m.has(x)||(m.add(x),p.push({node:x,path:[...g,y]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],p=r[d+1],m=c(u,p);m.length>0&&i.push(...m)}i.length>0&&e({pathEdgeIds:i})}}));var Bo=require("@xyflow/react");var $u={value:()=>{}};function Gs(){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 ur(o)}function ur(e){this._=e}function Xu(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}})}ur.prototype=Gs.prototype={constructor:ur,on:function(e,t){var o=this._,n=Xu(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=Ku(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(r=(e=n[i]).type)o[r]=Hs(o[r],e.name,t);else if(t==null)for(r in o)o[r]=Hs(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 ur(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 Ku(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function Hs(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=$u,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ri=Gs;var pr="http://www.w3.org/1999/xhtml",Oi={svg:"http://www.w3.org/2000/svg",xhtml:pr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ct(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Oi.hasOwnProperty(t)?{space:Oi[t],local:e}:e}function qu(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===pr&&t.documentElement.namespaceURI===pr?t.createElement(e):t.createElementNS(o,e)}}function Zu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fr(e){var t=Ct(e);return(t.local?Zu:qu)(t)}function Ju(){}function io(e){return e==null?Ju:function(){return this.querySelector(e)}}function Bs(e){typeof e!="function"&&(e=io(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=new Array(a),l,c,d=0;d<a;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),s[d]=c);return new Le(n,this._parents)}function Vi(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qu(){return[]}function gn(e){return e==null?Qu:function(){return this.querySelectorAll(e)}}function ju(e){return function(){return Vi(e.apply(this,arguments))}}function zs(e){typeof e=="function"?e=ju(e):e=gn(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var a=t[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(n.push(e.call(l,l.__data__,c,a)),r.push(l));return new Le(n,r)}function hn(e){return function(){return this.matches(e)}}function mr(e){return function(t){return t.matches(e)}}var ep=Array.prototype.find;function tp(e){return function(){return ep.call(this.children,e)}}function op(){return this.firstElementChild}function Fs(e){return this.select(e==null?op:tp(typeof e=="function"?e:mr(e)))}var np=Array.prototype.filter;function rp(){return Array.from(this.children)}function ip(e){return function(){return np.call(this.children,e)}}function Ws(e){return this.selectAll(e==null?rp:ip(typeof e=="function"?e:mr(e)))}function Ys(e){typeof e!="function"&&(e=hn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new Le(n,this._parents)}function gr(e){return new Array(e.length)}function Us(){return new Le(this._enter||this._groups.map(gr),this._parents)}function yn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yn.prototype={constructor:yn,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 $s(e){return function(){return e}}function sp(e,t,o,n,r,i){for(var a=0,s,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],n[a]=s):o[a]=new yn(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function ap(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,u=i.length,p=new Array(d),m;for(s=0;s<d;++s)(l=t[s])&&(p[s]=m=a.call(l,l.__data__,s,t)+"",c.has(m)?r[s]=l:c.set(m,l));for(s=0;s<u;++s)m=a.call(e,i[s],s,i)+"",(l=c.get(m))?(n[s]=l,l.__data__=i[s],c.delete(m)):o[s]=new yn(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(p[s])===l&&(r[s]=l)}function lp(e){return e.__data__}function Xs(e,t){if(!arguments.length)return Array.from(this,lp);var o=t?ap:sp,n=this._parents,r=this._groups;typeof e!="function"&&(e=$s(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],p=u.length,m=cp(e.call(d,d&&d.__data__,c,n)),h=m.length,g=s[c]=new Array(h),f=a[c]=new Array(h),x=l[c]=new Array(p);o(d,u,g,f,x,m,t);for(var y=0,b=0,T,N;y<h;++y)if(T=g[y]){for(y>=b&&(b=y+1);!(N=f[b])&&++b<h;);T._next=N||null}}return a=new Le(a,n),a._enter=s,a._exit=l,a}function cp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ks(){return new Le(this._exit||this._groups.map(gr),this._parents)}function qs(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 Zs(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c=o[l],d=n[l],u=c.length,p=s[l]=new Array(u),m,h=0;h<u;++h)(m=c[h]||d[h])&&(p[h]=m);for(;l<r;++l)s[l]=o[l];return new Le(s,this._parents)}function Js(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],a;--r>=0;)(a=n[r])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Qs(e){e||(e=dp);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 a=o[i],s=a.length,l=r[i]=new Array(s),c,d=0;d<s;++d)(c=a[d])&&(l[d]=c);l.sort(t)}return new Le(r,this._parents).order()}function dp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function js(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ea(){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 a=n[r];if(a)return a}return null}function oa(){let e=0;for(let t of this)++e;return e}function na(){return!this.node()}function ra(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,a=r.length,s;i<a;++i)(s=r[i])&&e.call(s,s.__data__,i,r);return this}function up(e){return function(){this.removeAttribute(e)}}function pp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fp(e,t){return function(){this.setAttribute(e,t)}}function mp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function hp(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 ia(e,t){var o=Ct(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?pp:up:typeof t=="function"?o.local?hp:gp:o.local?mp:fp)(o,t))}function hr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yp(e){return function(){this.style.removeProperty(e)}}function xp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Ep(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function sa(e,t,o){return arguments.length>1?this.each((t==null?yp:typeof t=="function"?Ep:xp)(e,t,o==null?"":o)):Vt(this.node(),e)}function Vt(e,t){return e.style.getPropertyValue(t)||hr(e).getComputedStyle(e,null).getPropertyValue(t)}function bp(e){return function(){delete this[e]}}function _p(e,t){return function(){this[e]=t}}function Tp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function aa(e,t){return arguments.length>1?this.each((t==null?bp:typeof t=="function"?Tp:_p)(e,t)):this.node()[e]}function la(e){return e.trim().split(/^|\s+/)}function Hi(e){return e.classList||new ca(e)}function ca(e){this._node=e,this._names=la(e.getAttribute("class")||"")}ca.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 da(e,t){for(var o=Hi(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function ua(e,t){for(var o=Hi(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function Np(e){return function(){da(this,e)}}function vp(e){return function(){ua(this,e)}}function wp(e,t){return function(){(t.apply(this,arguments)?da:ua)(this,e)}}function pa(e,t){var o=la(e+"");if(arguments.length<2){for(var n=Hi(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?wp:t?Np:vp)(o,t))}function Ap(){this.textContent=""}function Ip(e){return function(){this.textContent=e}}function Cp(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function fa(e){return arguments.length?this.each(e==null?Ap:(typeof e=="function"?Cp:Ip)(e)):this.node().textContent}function Sp(){this.innerHTML=""}function Mp(e){return function(){this.innerHTML=e}}function Pp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function ma(e){return arguments.length?this.each(e==null?Sp:(typeof e=="function"?Pp:Mp)(e)):this.node().innerHTML}function Lp(){this.nextSibling&&this.parentNode.appendChild(this)}function ga(){return this.each(Lp)}function kp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ha(){return this.each(kp)}function ya(e){var t=typeof e=="function"?e:fr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Dp(){return null}function xa(e,t){var o=typeof e=="function"?e:fr(e),n=t==null?Dp:typeof t=="function"?t:io(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function Rp(){var e=this.parentNode;e&&e.removeChild(this)}function Ea(){return this.each(Rp)}function Op(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ba(e){return this.select(e?Vp:Op)}function _a(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Hp(e){return function(t){e.call(this,t,this.__data__)}}function Gp(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 Bp(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 zp(e,t,o){return function(){var n=this.__on,r,i=Hp(t);if(n){for(var a=0,s=n.length;a<s;++a)if((r=n[a]).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 Ta(e,t,o){var n=Gp(e+""),r,i=n.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,d;l<c;++l)for(r=0,d=s[l];r<i;++r)if((a=n[r]).type===d.type&&a.name===d.name)return d.value}return}for(s=t?zp:Bp,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function Na(e,t,o){var n=hr(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 Fp(e,t){return function(){return Na(this,e,t)}}function Wp(e,t){return function(){return Na(this,e,t.apply(this,arguments))}}function va(e,t){return this.each((typeof t=="function"?Wp:Fp)(e,t))}function*wa(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,a;r<i;++r)(a=n[r])&&(yield a)}var Yp=[null];function Le(e,t){this._groups=e,this._parents=t}function Aa(){return new Le([[document.documentElement]],Yp)}function Up(){return this}Le.prototype=Aa.prototype={constructor:Le,select:Bs,selectAll:zs,selectChild:Fs,selectChildren:Ws,filter:Ys,data:Xs,enter:Us,exit:Ks,join:qs,merge:Zs,selection:Up,order:Js,sort:Qs,call:js,nodes:ea,node:ta,size:oa,empty:na,each:ra,attr:ia,style:sa,property:aa,classed:pa,text:fa,html:ma,raise:ga,lower:ha,append:ya,insert:xa,remove:Ea,clone:ba,datum:_a,on:Ta,dispatch:va,[Symbol.iterator]:wa};var St=Aa;function yr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Gi(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function bn(){}var xn=.7,br=1/xn,Oo="\\s*([+-]?\\d+)\\s*",En="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$p=/^#([0-9a-f]{3,8})$/,Xp=new RegExp(`^rgb\\(${Oo},${Oo},${Oo}\\)$`),Kp=new RegExp(`^rgb\\(${yt},${yt},${yt}\\)$`),qp=new RegExp(`^rgba\\(${Oo},${Oo},${Oo},${En}\\)$`),Zp=new RegExp(`^rgba\\(${yt},${yt},${yt},${En}\\)$`),Jp=new RegExp(`^hsl\\(${En},${yt},${yt}\\)$`),Qp=new RegExp(`^hsla\\(${En},${yt},${yt},${En}\\)$`),Ia={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};yr(bn,Ht,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ca,formatHex:Ca,formatHex8:jp,formatHsl:ef,formatRgb:Sa,toString:Sa});function Ca(){return this.rgb().formatHex()}function jp(){return this.rgb().formatHex8()}function ef(){return Ra(this).formatHsl()}function Sa(){return this.rgb().formatRgb()}function Ht(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=$p.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ma(t):o===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?xr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?xr(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=Xp.exec(e))?new Ye(t[1],t[2],t[3],1):(t=Kp.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qp.exec(e))?xr(t[1],t[2],t[3],t[4]):(t=Zp.exec(e))?xr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Jp.exec(e))?ka(t[1],t[2]/100,t[3]/100,1):(t=Qp.exec(e))?ka(t[1],t[2]/100,t[3]/100,t[4]):Ia.hasOwnProperty(e)?Ma(Ia[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function Ma(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function xr(e,t,o,n){return n<=0&&(e=t=o=NaN),new Ye(e,t,o,n)}function tf(e){return e instanceof bn||(e=Ht(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function Vo(e,t,o,n){return arguments.length===1?tf(e):new Ye(e,t,o,n==null?1:n)}function Ye(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}yr(Ye,Vo,Gi(bn,{brighter(e){return e=e==null?br:Math.pow(br,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xn:Math.pow(xn,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(ao(this.r),ao(this.g),ao(this.b),_r(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:Pa,formatHex:Pa,formatHex8:of,formatRgb:La,toString:La}));function Pa(){return`#${so(this.r)}${so(this.g)}${so(this.b)}`}function of(){return`#${so(this.r)}${so(this.g)}${so(this.b)}${so((isNaN(this.opacity)?1:this.opacity)*255)}`}function La(){let e=_r(this.opacity);return`${e===1?"rgb(":"rgba("}${ao(this.r)}, ${ao(this.g)}, ${ao(this.b)}${e===1?")":`, ${e})`}`}function _r(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ao(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function so(e){return e=ao(e),(e<16?"0":"")+e.toString(16)}function ka(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new dt(e,t,o,n)}function Ra(e){if(e instanceof dt)return new dt(e.h,e.s,e.l,e.opacity);if(e instanceof bn||(e=Ht(e)),!e)return new dt;if(e instanceof dt)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),a=NaN,s=i-r,l=(i+r)/2;return s?(t===i?a=(o-n)/s+(o<n)*6:o===i?a=(n-t)/s+2:a=(t-o)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new dt(a,s,l,e.opacity)}function Oa(e,t,o,n){return arguments.length===1?Ra(e):new dt(e,t,o,n==null?1:n)}function dt(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}yr(dt,Oa,Gi(bn,{brighter(e){return e=e==null?br:Math.pow(br,e),new dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xn:Math.pow(xn,e),new dt(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 Ye(Bi(e>=240?e-240:e+120,r,n),Bi(e,r,n),Bi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new dt(Da(this.h),Er(this.s),Er(this.l),_r(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=_r(this.opacity);return`${e===1?"hsl(":"hsla("}${Da(this.h)}, ${Er(this.s)*100}%, ${Er(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Da(e){return e=(e||0)%360,e<0?e+360:e}function Er(e){return Math.max(0,Math.min(1,e||0))}function Bi(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 zi(e,t,o,n,r){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*o+(1+3*e+3*i-3*a)*n+a*r)/6}function Va(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],a=n>0?e[n-1]:2*r-i,s=n<t-1?e[n+2]:2*i-r;return zi((o-n/t)*t,a,r,i,s)}}function Ha(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],a=e[(n+1)%t],s=e[(n+2)%t];return zi((o-n/t)*t,r,i,a,s)}}var Fi=e=>()=>e;function nf(e,t){return function(o){return e+o*t}}function rf(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 Ga(e){return(e=+e)==1?Tr:function(t,o){return o-t?rf(t,o,e):Fi(isNaN(t)?o:t)}}function Tr(e,t){var o=t-e;return o?nf(e,o):Fi(isNaN(e)?t:e)}var Nr=function e(t){var o=Ga(t);function n(r,i){var a=o((r=Vo(r)).r,(i=Vo(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=Tr(r.opacity,i.opacity);return function(d){return r.r=a(d),r.g=s(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function Ba(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),a,s;for(a=0;a<o;++a)s=Vo(t[a]),n[a]=s.r||0,r[a]=s.g||0,i[a]=s.b||0;return n=e(n),r=e(r),i=e(i),s.opacity=1,function(l){return s.r=n(l),s.g=r(l),s.b=i(l),s+""}}}var sf=Ba(Va),af=Ba(Ha);function st(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Yi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wi=new RegExp(Yi.source,"g");function lf(e){return function(){return e}}function cf(e){return function(t){return e(t)+""}}function Ui(e,t){var o=Yi.lastIndex=Wi.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=Yi.exec(e))&&(r=Wi.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:st(n,r)})),o=Wi.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?cf(l[0].x):lf(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)s[(u=l[d]).i]=u.x(c);return s.join("")})}var za=180/Math.PI,vr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $i(e,t,o,n,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(s=Math.sqrt(o*o+n*n))&&(o/=s,n/=s,l/=s),e*n<t*o&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*za,skewX:Math.atan(l)*za,scaleX:a,scaleY:s}}var wr;function Fa(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?vr:$i(t.a,t.b,t.c,t.d,t.e,t.f)}function Wa(e){return e==null?vr:(wr||(wr=document.createElementNS("http://www.w3.org/2000/svg","g")),wr.setAttribute("transform",e),(e=wr.transform.baseVal.consolidate())?(e=e.matrix,$i(e.a,e.b,e.c,e.d,e.e,e.f)):vr)}function Ya(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,p,m,h){if(c!==u||d!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:st(c,u)},{i:g-2,x:st(d,p)})}else(u||p)&&m.push("translate("+u+t+p+o)}function a(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:st(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function s(c,d,u,p){c!==d?p.push({i:u.push(r(u)+"skewX(",null,n)-2,x:st(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,p,m,h){if(c!==u||d!==p){var g=m.push(r(m)+"scale(",null,",",null,")");h.push({i:g-4,x:st(c,u)},{i:g-2,x:st(d,p)})}else(u!==1||p!==1)&&m.push(r(m)+"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),a(c.rotate,d.rotate,u,p),s(c.skewX,d.skewX,u,p),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,p),c=d=null,function(m){for(var h=-1,g=p.length,f;++h<g;)u[(f=p[h]).i]=f.x(m);return u.join("")}}}var Xi=Ya(Fa,"px, ","px)","deg)"),Ki=Ya(Wa,", ",")",")");var Ho=0,Tn=0,_n=0,$a=1e3,Ar,Nn,Ir=0,lo=0,Cr=0,vn=typeof performance=="object"&&performance.now?performance:Date,Xa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function An(){return lo||(Xa(df),lo=vn.now()+Cr)}function df(){lo=0}function wn(){this._call=this._time=this._next=null}wn.prototype=Sr.prototype={constructor:wn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?An():+o)+(t==null?0:+t),!this._next&&Nn!==this&&(Nn?Nn._next=this:Ar=this,Nn=this),this._call=e,this._time=o,qi()},stop:function(){this._call&&(this._call=null,this._time=1/0,qi())}};function Sr(e,t,o){var n=new wn;return n.restart(e,t,o),n}function Ka(){An(),++Ho;for(var e=Ar,t;e;)(t=lo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ho}function Ua(){lo=(Ir=vn.now())+Cr,Ho=Tn=0;try{Ka()}finally{Ho=0,pf(),lo=0}}function uf(){var e=vn.now(),t=e-Ir;t>$a&&(Cr-=t,Ir=e)}function pf(){for(var e,t=Ar,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:Ar=o);Nn=e,qi(n)}function qi(e){if(!Ho){Tn&&(Tn=clearTimeout(Tn));var t=e-lo;t>24?(e<1/0&&(Tn=setTimeout(Ua,e-vn.now()-Cr)),_n&&(_n=clearInterval(_n))):(_n||(Ir=vn.now(),_n=setInterval(uf,$a)),Ho=1,Xa(Ua))}}function Mr(e,t,o){var n=new wn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var ff=Ri("start","end","cancel","interrupt"),mf=[],Ja=0,qa=1,Lr=2,Pr=3,Za=4,kr=5,In=6;function Gt(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;gf(e,o,{name:t,index:n,group:r,on:ff,tween:mf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ja})}function Cn(e,t){var o=ke(e,t);if(o.state>Ja)throw new Error("too late; already scheduled");return o}function Oe(e,t){var o=ke(e,t);if(o.state>Pr)throw new Error("too late; already running");return o}function ke(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function gf(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Sr(i,0,o.time);function i(c){o.state=qa,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,u,p,m;if(o.state!==qa)return l();for(d in n)if(m=n[d],m.name===o.name){if(m.state===Pr)return Mr(a);m.state===Za?(m.state=In,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[d]):+d<t&&(m.state=In,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete n[d])}if(Mr(function(){o.state===Pr&&(o.state=Za,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=Lr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Lr){for(o.state=Pr,r=new Array(p=o.tween.length),d=0,u=-1;d<p;++d)(m=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=m);r.length=u+1}}function s(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=In,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function Zi(e,t){var o=e.__transition,n,r,i=!0,a;if(o){t=t==null?null:t+"";for(a in o){if((n=o[a]).name!==t){i=!1;continue}r=n.state>Lr&&n.state<kr,n.state=In,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function Qa(e){return this.each(function(){Zi(this,e)})}function hf(e,t){var o,n;return function(){var r=Oe(this,e),i=r.tween;if(i!==o){n=o=i;for(var a=0,s=n.length;a<s;++a)if(n[a].name===t){n=n.slice(),n.splice(a,1);break}}r.tween=n}}function yf(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=Oe(this,e),a=i.tween;if(a!==n){r=(n=a).slice();for(var s={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function ja(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=ke(this.node(),o).tween,r=0,i=n.length,a;r<i;++r)if((a=n[r]).name===e)return a.value;return null}return this.each((t==null?hf:yf)(o,e,t))}function Go(e,t,o){var n=e._id;return e.each(function(){var r=Oe(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return ke(r,n).value[t]}}function Dr(e,t){var o;return(typeof t=="number"?st:t instanceof Ht?Nr:(o=Ht(t))?(t=o,Nr):Ui)(e,t)}function xf(e){return function(){this.removeAttribute(e)}}function Ef(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bf(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttribute(e);return a===r?null:a===n?i:i=t(n=a,o)}}function _f(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===r?null:a===n?i:i=t(n=a,o)}}function Tf(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function Nf(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function el(e,t){var o=Ct(e),n=o==="transform"?Ki:Dr;return this.attrTween(e,typeof t=="function"?(o.local?Nf:Tf)(o,n,Go(this,"attr."+e,t)):t==null?(o.local?Ef:xf)(o):(o.local?_f:bf)(o,n,t))}function vf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function wf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Af(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&wf(e,i)),o}return r._value=t,r}function If(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&vf(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=Ct(e);return this.tween(o,(n.local?Af:If)(n,t))}function Cf(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function Sf(e,t){return t=+t,function(){Cn(this,e).delay=t}}function ol(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Cf:Sf)(t,e)):ke(this.node(),t).delay}function Mf(e,t){return function(){Oe(this,e).duration=+t.apply(this,arguments)}}function Pf(e,t){return t=+t,function(){Oe(this,e).duration=t}}function nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Mf:Pf)(t,e)):ke(this.node(),t).duration}function Lf(e,t){if(typeof t!="function")throw new Error;return function(){Oe(this,e).ease=t}}function rl(e){var t=this._id;return arguments.length?this.each(Lf(t,e)):ke(this.node(),t).ease}function kf(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Oe(this,e).ease=o}}function il(e){if(typeof e!="function")throw new Error;return this.each(kf(this._id,e))}function sl(e){typeof e!="function"&&(e=hn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new Ge(n,this._parents,this._name,this._id)}function al(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),a=new Array(n),s=0;s<i;++s)for(var l=t[s],c=o[s],d=l.length,u=a[s]=new Array(d),p,m=0;m<d;++m)(p=l[m]||c[m])&&(u[m]=p);for(;s<n;++s)a[s]=t[s];return new Ge(a,this._parents,this._name,this._id)}function Df(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 Rf(e,t,o){var n,r,i=Df(t)?Cn:Oe;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function ll(e,t){var o=this._id;return arguments.length<2?ke(this.node(),o).on.on(e):this.each(Rf(o,e,t))}function Of(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function cl(){return this.on("end.remove",Of(this._id))}function dl(e){var t=this._name,o=this._id;typeof e!="function"&&(e=io(e));for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a)for(var s=n[a],l=s.length,c=i[a]=new Array(l),d,u,p=0;p<l;++p)(d=s[p])&&(u=e.call(d,d.__data__,p,s))&&("__data__"in d&&(u.__data__=d.__data__),c[p]=u,Gt(c[p],t,o,p,c,ke(d,o)));return new Ge(i,this._parents,t,o)}function ul(e){var t=this._name,o=this._id;typeof e!="function"&&(e=gn(e));for(var n=this._groups,r=n.length,i=[],a=[],s=0;s<r;++s)for(var l=n[s],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var p=e.call(d,d.__data__,u,l),m,h=ke(d,o),g=0,f=p.length;g<f;++g)(m=p[g])&&Gt(m,t,o,g,p,h);i.push(p),a.push(d)}return new Ge(i,a,t,o)}var Vf=St.prototype.constructor;function pl(){return new Vf(this._groups,this._parents)}function Hf(e,t){var o,n,r;return function(){var i=Vt(this,e),a=(this.style.removeProperty(e),Vt(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function fl(e){return function(){this.style.removeProperty(e)}}function Gf(e,t,o){var n,r=o+"",i;return function(){var a=Vt(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function Bf(e,t,o){var n,r,i;return function(){var a=Vt(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),Vt(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function zf(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=Oe(this,e),c=l.on,d=l.value[i]==null?s||(s=fl(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function ml(e,t,o){var n=(e+="")=="transform"?Xi:Dr;return t==null?this.styleTween(e,Hf(e,n)).on("end.style."+e,fl(e)):typeof t=="function"?this.styleTween(e,Bf(e,n,Go(this,"style."+e,t))).each(zf(this._id,e)):this.styleTween(e,Gf(e,n,t),o).on("end.style."+e,null)}function Ff(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function Wf(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Ff(e,a,o)),n}return i._value=t,i}function gl(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,Wf(e,t,o==null?"":o))}function Yf(e){return function(){this.textContent=e}}function Uf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function hl(e){return this.tween("text",typeof e=="function"?Uf(Go(this,"text",e)):Yf(e==null?"":e+""))}function $f(e){return function(t){this.textContent=e.call(this,t)}}function Xf(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&$f(r)),t}return n._value=e,n}function yl(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,Xf(e))}function xl(){for(var e=this._name,t=this._id,o=Rr(),n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,c=0;c<s;++c)if(l=a[c]){var d=ke(l,t);Gt(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ge(n,this._parents,e,o)}function El(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,a){var s={value:a},l={value:function(){--r===0&&i()}};o.each(function(){var c=Oe(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),c.on=t}),r===0&&i()})}var Kf=0;function Ge(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function bl(e){return St().transition(e)}function Rr(){return++Kf}var Mt=St.prototype;Ge.prototype=bl.prototype={constructor:Ge,select:dl,selectAll:ul,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:sl,merge:al,selection:pl,transition:xl,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:ll,attr:el,attrTween:tl,style:ml,styleTween:gl,text:hl,textTween:yl,remove:cl,tween:ja,delay:ol,duration:nl,ease:rl,easeVarying:il,end:El,[Symbol.iterator]:Mt[Symbol.iterator]};function Or(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qf={time:null,delay:0,duration:250,ease:Or};function Zf(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 _l(e){var t,o;e instanceof Ge?(t=e._id,e=e._name):(t=Rr(),(o=qf).time=An(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&Gt(l,e,t,c,a,o||Zf(l,t));return new Ge(n,this._parents,e,t)}St.prototype.interrupt=Qa;St.prototype.transition=_l;function Bt(e,t,o){this.k=e,this.x=t,this.y=o}Bt.prototype={constructor:Bt,scale:function(e){return e===1?this:new Bt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bt(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 Vr=new Bt(1,0,0);Hr.prototype=Bt.prototype;function Hr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vr;return e.__zoom}var Qf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Tl;(function(e){e.Strict="strict",e.Loose="loose"})(Tl||(Tl={}));var Nl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Nl||(Nl={}));var vl;(function(e){e.Partial="partial",e.Full="full"})(vl||(vl={}));var wl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(wl||(wl={}));var Al;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Al||(Al={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));var bE={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top};var jf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var em=(e,t=[0,0])=>{var s;let{width:o,height:n}=tm(e),r=(s=e.origin)!=null?s:t,i=o*r[0],a=n*r[1];return{x:e.position.x-i,y:e.position.y-a}};var Ke=(e,t=[0,0])=>{var r,i,a,s,l,c,d,u;let{x:o,y:n}=jf(e)?e.internals.positionAbsolute:em(e,t);return{x:o,y:n,x2:o+((s=(a=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?a:e.initialWidth)!=null?s: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 tm(e){var t,o,n,r,i,a,s,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=(s=(a=(i=e.measured)==null?void 0:i.height)!=null?a:e.height)!=null?s:e.initialHeight)!=null?l:0}}var _E={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}};var om={nodeOrigin:[0,0],nodeExtent:Qf,elevateNodesOnSelect:!0,defaults:{}},TE=v(E({},om),{checkEquality:!0});var Il;(function(e){e.Line="line",e.Handle="handle"})(Il||(Il={}));var nm={width:0,height:0,x:0,y:0},NE=v(E({},nm),{pointerX:0,pointerY:0,aspectRatio:1});var qe=require("react"),Pl=require("zustand/shallow");var rm=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function im(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 sm(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 Gr=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){let i=t==="horizontal"?this.yLines:this.xLines,[a,s]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],l=[];for(let p of i){if(p.position<a)continue;if(p.position>s)break;if(p.node.id===n.id||p.node.parentId===n.id||!rm(p.nodeBox,r))continue;let m=Math.abs(p.position-o);if(m>Br)continue;let g=im(p.nodeBox,Ke(n))>0?0:sm(p.nodeBox,Ke(n));l.push({line:p,lineDist:m,nodeDist:g})}let c=.5,d=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((p,m)=>{if(d){if(p.line===d&&m.line!==d)return-1;if(m.line===d&&p.line!==d)return 1}return Math.abs(p.lineDist-m.lineDist)<=c?p.nodeDist-m.nodeDist:p.lineDist-m.lineDist});let u=l.length>0?l[0].line:void 0;return u&&(t==="horizontal"?this.lastHorizontalLine=u:this.lastVerticalLine=u),u}};function Cl(e,t=co,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 a=Ke(i);Object.entries(t).forEach(([s,l])=>{var c;n.push({nodeBox:a,node:r,orientation:l.orientation,position:l.resolve(r,a),color:(c=r.style)==null?void 0:c.backgroundColor,anchorName:s})})}),n}function Sl(e,t,o,n,r=Object.keys(co)){let i=[];for(let s of r){let l=co[s],c=l.resolve(o,n),d=e.search(l.orientation,c,o,t);d&&i.push({anchorName:s,sourcePosition:c,anchor:l,line:d})}let a={horizontal:void 0,vertical:void 0};for(let s of i){let l=a[s.anchor.orientation],c=Math.abs(s.sourcePosition-s.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(a[s.anchor.orientation]=s)}return a}function Ml(e,t,o,n,r,i,a,s){var u,p,m,h,g,f,x,y;if(!(o!=null&&o.position))return{snappedX:!1,snappedY:!1};let l=!1,c=!1,d={x:o.position.x,y:o.position.y,x2:o.position.x+((p=(u=e.measured)==null?void 0:u.width)!=null?p:0),y2:o.position.y+((h=(m=e.measured)==null?void 0:m.height)!=null?h:0)};if(a){let T=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(T)<=Br){if(o.position.y-=T,r!=null&&r.dimensions)if(n){let N=t.internals.positionAbsolute.y+((f=(g=e.measured)==null?void 0:g.height)!=null?f:0);r.dimensions.height=N-a.line.position}else r.dimensions.height=a.line.position-t.internals.positionAbsolute.y;c=!0}}if(s){let T=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(T)<=Br){if(o.position.x-=T,r!=null&&r.dimensions)if(n){let N=t.internals.positionAbsolute.x+((y=(x=e.measured)==null?void 0:x.width)!=null?y:0);r.dimensions.width=N-s.line.position}else r.dimensions.width=s.line.position-t.internals.positionAbsolute.x;l=!0}}return i&&(l||c)&&(o.position.x-=i.position.x,o.position.y-=i.position.y),{snappedX:l,snappedY:c}}var Br=10,co={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 Ll=require("react/jsx-runtime"),am=new Gr;function zr(){let[e,t]=(0,qe.useState)(void 0),[o,n]=(0,qe.useState)(void 0),{width:r,height:i}=(0,Bo.useStore)(f=>({width:f.width,height:f.height}),Pl.shallow),a=(0,Bo.useNodesInitialized)(),s=(0,qe.useRef)(am),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,Bo.useReactFlow)(),u=(0,qe.useCallback)(()=>{t(void 0),n(void 0)},[]),p=(0,qe.useCallback)(f=>{let x=f!=null?f:d();u();let y=Cl(x,co,c);s.current.initialize(y)},[c,u,d]),m=(0,qe.useCallback)(()=>{setTimeout(()=>{p()},100)},[p]);(0,qe.useEffect)(()=>{a&&p(d())},[a,p,d]);let h=(0,qe.useCallback)((f,x)=>{var te,I,O,U,B;if(!s.current||f.length===0||f.length>2)return f;u();let y,b,T=Object.keys(co);f.length===1?f[0].type==="position"?y=f[0]:f[0].type==="dimensions"&&(b=f[0],T=["right","bottom"]):f[0].type==="position"&&f[1].type==="dimensions"&&f[1].dimensions&&(y=f[0],b=f[1],T=["top","left"]);let N=x.find($=>$.id===f[0].id);if(!N)return f;let _=c(N.id);if(!_)throw new Error(`Node with id ${N.id} not found in internal nodes`);let w=c((te=_.parentId)!=null?te:""),P=Ke(_);b!=null&&b.dimensions&&(P.x2=P.x+b.dimensions.width,P.y2=P.y+b.dimensions.height);let{x:H,y:C}=l({x:0,y:0}),{x:A,y:L}=l({x:r,y:i}),G={x:H,y:C,x2:A,y2:L},{horizontal:M,vertical:S}=Sl(s.current,G,N,P,T),D={id:N.id,type:"position",position:{x:_.internals.positionAbsolute.x,y:_.internals.positionAbsolute.y},dragging:!1};y!=null&&y.position&&D.position&&(w?(D.position.x=y.position.x+((O=(I=w==null?void 0:w.position)==null?void 0:I.x)!=null?O:0),D.position.y=y.position.y+((B=(U=w==null?void 0:w.position)==null?void 0:U.y)!=null?B:0)):(D.position.x=y.position.x,D.position.y=y.position.y));let{snappedX:Y,snappedY:F}=Ml(N,_,D,y,b,w,M,S);if(Y||F){if((b!=null&&b.resizing||y!=null&&y.dragging)&&(Y&&n(S==null?void 0:S.line),F&&t(M==null?void 0:M.line)),b&&y)return[D,b];if(y)return[D];if(b)return[b]}return f},[l,c,r,i,t,n,u]),g=(0,qe.useCallback)(()=>(0,Ll.jsx)(kl,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:p,forceRebuildIndex:m,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var gi=require("@xyflow/react"),Nt=require("react");var uo=e=>new Map(e.map(t=>[t.id,t])),Sn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),Dl=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),Fr=e=>e.some(t=>t.type==="START_EVENT"),Rl=(e,t,o,n,r)=>{let i=uo(o),a=i.get(e);if(!a||a.type!=="START_EVENT")return!1;let s=i.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Sn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Ol=(e,t,o,n,r)=>{let i=uo(o),a=i.get(t);if(!a||a.type!=="END_EVENT")return!1;let s=i.get(e);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Dl(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Wr=(e,t,o,n)=>{var a;let r=t.find(s=>s.id===e);return!r||r.type!=="GATEWAY"||((a=r.data)==null?void 0:a.variant)!=="EXCLUSIVE"?!1:Sn(e,o,n).length>=2},Vl=(e,t,o)=>{var a,s,l,c;let n=uo(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((a=r==null?void 0:r.data)==null?void 0:a.variant)==="EXCLUSIVE"&&((s=i==null?void 0:i.data)==null?void 0:s.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"},Yr=(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"},Hl=(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"},Ur=(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"},Mn=(e,t,o,n)=>{let r=uo(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Dl(e,o,n).some(s=>{let l=r.get(s.source);return(l==null?void 0:l.type)==="START_EVENT"})},Pn=(e,t,o,n)=>{let r=uo(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Sn(e,o,n).some(s=>{let l=r.get(s.target);return(l==null?void 0:l.type)==="END_EVENT"})},Gl=(e,t,o,n,r)=>{let i=uo(o),a=i.get(e),s=i.get(t);return(a==null?void 0:a.type)==="START_EVENT"&&(s==null?void 0:s.type)==="TASK"?Pn(t,o,n,r):(s==null?void 0:s.type)==="END_EVENT"&&(a==null?void 0:a.type)==="TASK"?Mn(e,o,n,r):!1},$r=(e,t,o)=>Sn(e,t,o).length>0,Xr=(e,t,o,n,r)=>{let i=uo(o),a=i.get(e);if(!a||a.type!=="TASK")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:Sn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var Bl=(e,t,o,n)=>o.some(r=>n&&r.id===n?!1:r.source===e&&r.target===t);var lm=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!Bl(e.sourceNodeId,e.targetNodeId,e.edges,e.reconnectingEdgeId),reason:"duplicate_connection_not_allowed"}),e=>({isValid:!Rl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!Ol(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!Wr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!Xr(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:Vl(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"&&Hl(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:!(Yr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(Ur(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Mn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!Gl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"concurrent_initial_and_final_activity"}),e=>({isValid:!(Pn(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!($r(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"})],Ji=e=>{for(let t of lm){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var cm=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:Wr(e.sourceNodeId,e.nodes,e.edges),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:Fr(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Yr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Ur(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Mn(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Pn(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:$r(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Xr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],zl=e=>{let t=cm.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 ut=require("@xyflow/react");var zo=require("@xyflow/react");function Fl(e,t){var b,T,N,_;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,a=o/2,s=n/2,l=r.x+a,c=r.y+s,d=i.x+((T=(b=t==null?void 0:t.measured)==null?void 0:b.width)!=null?T:0)/2,u=i.y+((_=(N=t==null?void 0:t.measured)==null?void 0:N.height)!=null?_:0)/2,p=(d-l)/(2*a)-(u-c)/(2*s),m=(d-l)/(2*a)+(u-c)/(2*s),h=1/(Math.abs(p)+Math.abs(m)||1),g=h*p,f=h*m,x=a*(g+f)+l,y=s*(-g+f)+c;return{x,y}}function Wl(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),a=Math.round(o.y),s=Math.round(t.x),l=Math.round(t.y);return s<=i+1?zo.Position.Left:s>=i+n-1?zo.Position.Right:l<=a+1?zo.Position.Top:l>=a+r-1?zo.Position.Bottom:zo.Position.Top}function zt(e,t){let o=Fl(e,t),n=Fl(t,e),r=Wl(e,o),i=Wl(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function Kr(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 xt=require("lecom-ui"),Ul=require("lucide-react");var at=require("@xyflow/react");var Yl=require("@xyflow/react"),Ft=()=>{let e=(0,Yl.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:a,triggerNodeChanges:s}=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 s(l),a(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await ir(),!0}}};var qr=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,at.useReactFlow)(),{selectElements:r}=Ft(),i=f=>{let x=o(),y=n(),b=(0,at.getIncomers)(f,x,y),T=(0,at.getOutgoers)(f,x,y),N=b.some(w=>w.type==="START_EVENT"),_=T.some(w=>w.type==="END_EVENT");return N?"start":_?"end":"between"},a=(f,x,y)=>{var N,_,w,P;if(!f)return;let b={type:f.type,variant:(N=f.data)==null?void 0:N.variant,attribute:(_=f.data)==null?void 0:_.attribute},T={id:f.id,position:i(f),label:(w=f.data)==null?void 0:w.label,node:b};return f.type==="TASK"&&((P=f.data)==null?void 0:P.variant)==="SUBPROCESS"?v(E({},T),{type:"sub_process"}):f.type==="GATEWAY"?v(E({},T),{type:"gateway",variant:s(f,x,y)}):v(E({},T),{type:"activity"})},s=(f,x,y)=>{if(f.type!=="GATEWAY")return;let b=(0,at.getIncomers)(f,x,y),T=!1,N=!1;if(b.forEach(_=>{var w,P;_.type==="TASK"&&(((w=_.data)==null?void 0:w.variant)==="SCRIPT"&&(T=!0),((P=_.data)==null?void 0:P.attribute)==="LOOP"&&(N=!0))}),T&&N)return"script_loop";if(T)return"script";if(N)return"loop"},l=(f,x,y)=>{var w,P,H,C;let b=e(f.source),T=e(f.target);if(!b||!T)return"simple";if((0,at.getOutgoers)(b,x,y).some(A=>A.type==="END_EVENT"))return"final";if(b.type==="GATEWAY")switch((w=b.data)==null?void 0:w.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(b.type==="TASK"){let A=(P=b.data)==null?void 0:P.variant,L=(H=b.data)==null?void 0:H.attribute;if(A==="SUBPROCESS")return"from_sub_process";if(T.type==="TASK"&&((C=T.data)==null?void 0:C.variant)==="SUBPROCESS")return"to_sub_process";let G=A==="SCRIPT",M=L==="LOOP";return G&&M?"script_loop":G?"script":M?"loop":"simple"}return"simple"},c=(f,x,y)=>{let b=[];function T(_,w,P=0){let H=a(_,x,y);if(H.depth=P,w.push(H),_.type==="TASK"){b.push([...w]),w.pop();return}let C=(0,at.getIncomers)(_,x,y);if(C.length)for(let A of C)T(A,w,P+1);w.pop()}let N=(0,at.getIncomers)(f,x,y);for(let _ of N)T(_,[]);return b},d=(f,x,y)=>{let b=[];function T(_,w,P=0){let H=a(_,x,y);if(H.depth=P,w.push(H),_.type==="TASK"){b.push([...w]),w.pop();return}let C=(0,at.getOutgoers)(_,x,y);if(C.length)for(let A of C)T(A,w,P+1);w.pop()}let N=(0,at.getOutgoers)(f,x,y);for(let _ of N)T(_,[]);return b},u=(f,x,y)=>(y=y.filter(T=>T.source===f.id),y.map(T=>{var w;let N=e(T.target),_;return N&&(_=a(N,x,y)),{id:T.id,type:"routing",variant:l(T,x,y),label:(w=T.data)==null?void 0:w.label,target:_}})),p=f=>{let x=e(f);if(!x)return;let y=o(),b=n(),T=a(x,y,b);return T.sources=c(x,y,b),T.targets=d(x,y,b),T.edgeTargets=u(x,y,b),x.type==="GATEWAY"&&(T.variant=s(x,y,b)),T},m=f=>{let x=t(f);if(!x)return;let y=o(),b=n(),T=l(x,y,b),_={id:x.id,type:"routing",variant:T,gatewayVariant:void 0},w=e(x.source);if(w){let H=a(w,y,b);_.source=H;let C=s(w,y,b);if(_.gatewayVariant=C,w.type==="TASK")_.sources=[[H]];else{let A=c(w,y,b);_.sources=A.length?A:[[H]]}}let P=e(x.target);if(P){let H=a(P,y,b);if(_.target=H,P.type==="TASK")_.targets=[[H]];else{let C=d(P,y,b);_.targets=C.length?C:[[H]]}}return _},h=f=>{let x=e(f);if(x)return p(x.id);let y=t(f);if(y)return m(y.id)};return{configureElement:f=>{let x=h(f);if(x)return r([f]),x},getConfigureElement:h,getNodeConfigure:p,getEdgeConfigure:m}};var po=require("react/jsx-runtime"),Wt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,xt.useTranslation)(),{onConfigureElement:n}=W(),{getConfigureElement:r}=qr();return(0,po.jsxs)(xt.Tooltip,{children:[(0,po.jsx)(xt.TooltipTrigger,{asChild:!0,children:(0,po.jsx)(xt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,po.jsx)(Ul.Settings,{size:16})})}),(0,po.jsx)(xt.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var $l=require("@xyflow/react"),Et=require("lecom-ui"),Xl=require("lucide-react"),fo=require("react/jsx-runtime"),Zr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Et.useTranslation)(),{deleteElements:n}=(0,$l.useReactFlow)();return(0,fo.jsxs)(Et.Tooltip,{children:[(0,fo.jsx)(Et.TooltipTrigger,{asChild:!0,children:(0,fo.jsx)(Et.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,fo.jsx)(Xl.TrashIcon,{size:16})})}),(0,fo.jsx)(Et.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var bt=require("lecom-ui"),Kl=require("lucide-react"),ql=require("react"),mo=require("react/jsx-runtime"),Fo=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,bt.useTranslation)(),r=(0,ql.useCallback)(i=>{i.stopPropagation();let a=document.querySelector(`[data-id="${e}"]`);if(!a)return;let s=a.querySelector(".react-flow__handle.source");if(!s)return;let l=s.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});s.dispatchEvent(u)},[e]);return(0,mo.jsxs)(bt.Tooltip,{children:[(0,mo.jsx)(bt.TooltipTrigger,{asChild:!0,children:(0,mo.jsx)(bt.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,mo.jsx)(Kl.MoveUpRightIcon,{size:16})})}),(0,mo.jsx)(bt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var Wo=require("react/jsx-runtime"),Uo=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=ht(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=W(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d}=Kr(o,n),u=!l&&!c&&!d,p=[{component:(0,Wo.jsx)(Zr,{elementId:e,elementType:"edge"})}],m=()=>s==="view"?u?[{component:(0,Wo.jsx)(Wt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,Wo.jsx)(Wt,{elementId:e,elementType:"edge"})},...p]:p,g=(f=>{switch(f){case"SEQUENCE_EDGE":return m();case"MESSAGE_EDGE":return s==="view"?[]:[...p];case"ANNOTATION_EDGE":return s==="view"?[]:[...p];default:return[]}})(t);if(!(g.length===0||s==="view"))return(0,Wo.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((f,x)=>(0,Wo.jsx)("div",{children:f.component},x))}))};var go=require("react/jsx-runtime"),$o={type:"ANNOTATION_EDGE",reconnectable:!0},Zl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,ut.useViewport)(),{isMultipleSelection:a}=W(),s=(0,ut.useInternalNode)(t),l=(0,ut.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:u,ty:p}=zt(s,l),[m,h,g]=(0,ut.getStraightPath)({sourceX:c,sourceY:d,targetX:u,targetY:p}),f=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected),x=1/i;return(0,go.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":f}),children:[(0,go.jsx)(ut.BaseEdge,{id:e,path:m,strokeDasharray:4,className:k("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)]":f&&!(r!=null&&r.hasError)})}),(0,go.jsx)(ut.EdgeLabelRenderer,{children:(0,go.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${g}px)`},children:n&&!a&&(0,go.jsx)(Uo,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${x})`}})})})]})};var Be=require("react"),ye=require("@xyflow/react");var ho=require("react");var Qi=require("react/jsx-runtime"),He=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s})=>{let l=(0,ho.useRef)(null),[c,d]=(0,ho.useState)(!1);(0,ho.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,ho.useEffect)(()=>{if(c&&l.current){l.current.focus();let g=document.createRange();g.selectNodeContents(l.current);let f=window.getSelection();f&&(f.removeAllRanges(),f.addRange(g))}},[c]);let u=g=>{g.stopPropagation(),c||d(!0)},p=g=>{let f=g.currentTarget.innerText.trim(),x=t&&f.length>=t,y=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],b=g.ctrlKey||g.metaKey,T=b&&g.key==="a",N=b&&g.key==="c",_=b&&g.key==="x",w=b&&g.key==="v";function P(C){return/\w/.test(C)}if(f.length===0&&!P(g.key)&&!y.includes(g.key)&&!b){g.preventDefault();return}x&&(y.includes(g.key)||T||N||_||w||g.preventDefault())},m=g=>{if(!t)return;g.preventDefault();let f=g.clipboardData.getData("text/plain"),x=g.currentTarget.innerText,y=window.getSelection();if(!y||y.rangeCount===0)return;let b=y.getRangeAt(0);if((x.substring(0,b.startOffset)+f+x.substring(b.endOffset)).length>t){let N=t-(x.length-(b.endOffset-b.startOffset)),_=f.substring(0,Math.max(0,N));_&&(b.deleteContents(),b.insertNode(document.createTextNode(_)),b.setStartAfter(b.endContainer),b.collapse(!0),y.removeAllRanges(),y.addRange(b))}else b.deleteContents(),b.insertNode(document.createTextNode(f)),b.setStartAfter(b.endContainer),b.collapse(!0),y.removeAllRanges(),y.addRange(b)},h=g=>{d(!1);let f=g.currentTarget.innerText.trim();t&&f.length>t&&(f=f.substring(0,t)),g.currentTarget.innerText=f,s==null||s(),f!==e&&(a==null||a(f))};return(0,Qi.jsx)("div",{className:k("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",n,{"border border-dashed border-grey-400":c}),style:o,onDoubleClick:u,children:(0,Qi.jsx)("div",{ref:l,className:k("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:p,onPaste:m,onBlur:h,children:e})})};var Ln=require("@xyflow/react"),kn=e=>e===Ln.Position.Left||e===Ln.Position.Right,ji=(e,t=30)=>e===Ln.Position.Right||e===Ln.Position.Bottom?t:-t,es=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,Xo=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Jr=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Dn={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};function dm(e,t,o,n,r,i,a=0){let s=ji(r,Dn.OFFSET),l=ji(i,Dn.OFFSET),c=kn(r),d=kn(i),u=c?0:a,p=c?a:0,m=d?0:a,h=d?a:0,g={x:e+u,y:t+p},f={x:o+m,y:n+h};if(c&&d){let x=(t+n)/2+a;return[g,{x:e+s,y:t+a},{x:e+s,y:x},{x:o+l,y:x},{x:o+l,y:n+a},f]}if(!c&&!d){let x=(e+o)/2+a;return[g,{x:e+a,y:t+s},{x,y:t+s},{x,y:n+l},{x:o+a,y:n+l},f]}return c?[g,{x:e+s,y:t+a},{x:e+s,y:n+l+a},{x:o+a,y:n+l+a},f]:[g,{x:e+a,y:t+s},{x:o+l+a,y:t+s},{x:o+l+a,y:n+a},f]}function Jl(e,t,o,n,r,i,a,s=0){let l=dm(e,t,o,n,r,i,s);if(!(a!=null&&a.length))return l;let c=[...a];if(c.length>0){let d={x:e,y:t},u=c[0],p=kn(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=kn(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 Ql=e=>{if(e.length<2)return"";let[t,...o]=e;return`M ${t.x},${t.y}${o.map(n=>` L ${n.x},${n.y}`).join("")}`};var me=require("react"),Qr=require("@xyflow/react");var um=50,jl=.1,pm=.6,jr=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:a,getNodes:s,getEdge:l,screenToFlowPosition:c}=(0,Qr.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=W(),p=(0,Qr.useStore)(I=>I.isValidConnection),[m,h]=(0,me.useState)(null),[g,f]=(0,me.useState)(null),[x,y]=(0,me.useState)(null),[b,T]=(0,me.useState)(null),[N,_]=(0,me.useState)(null),[w,P]=(0,me.useState)(!1),H=(0,me.useRef)(null),C=(0,me.useRef)(null),A=(0,me.useRef)(null),L=(0,me.useRef)(t),G=(0,me.useRef)(o);(0,me.useEffect)(()=>{L.current=t,G.current=o},[t,o]),(0,me.useEffect)(()=>{H.current=m},[m]),(0,me.useEffect)(()=>{C.current=N},[N]);let M=(0,me.useCallback)(I=>{let O=s(),U=O.find(oe=>oe.id===I);if(!U)return{x:0,y:0};let B=U.position.x,$=U.position.y,q=U.parentId;for(;q;){let oe=O.find(R=>R.id===q);if(!oe)break;B+=oe.position.x,$+=oe.position.y,q=oe.parentId}return{x:B,y:$}},[s]),S=(0,me.useCallback)(I=>{var q,oe,R,K,X,z;let O=s(),U=null,B=um,$=O.filter(V=>V.type!=="LANE"&&V.type!=="ANNOTATION");for(let V of $){if(V.id===e)continue;let Z=M(V.id),Q=(R=(oe=(q=V.measured)==null?void 0:q.width)!=null?oe:V.width)!=null?R:0,ne=(z=(X=(K=V.measured)==null?void 0:K.height)!=null?X:V.height)!=null?z:0;if(I.x>=Z.x&&I.x<=Z.x+Q&&I.y>=Z.y&&I.y<=Z.y+ne)return V.id;let he=Math.max(Z.x-I.x,0,I.x-(Z.x+Q)),_e=Math.max(Z.y-I.y,0,I.y-(Z.y+ne)),De=Math.sqrt(he*he+_e*_e);De<B&&(B=De,U=V.id)}return U},[s,M,e]),D=(0,me.useCallback)((I,O)=>{var he,_e,De,Re,Ve,Pe;let U=a(I);if(!U)return null;let B=M(I),$=(De=(_e=(he=U.measured)==null?void 0:he.width)!=null?_e:U.width)!=null?De:0,q=(Pe=(Ve=(Re=U.measured)==null?void 0:Re.height)!=null?Ve:U.height)!=null?Pe:0,oe=Math.abs(B.x+$-O.x),R=Math.abs(O.x-B.x),K=Math.abs(B.y+q-O.y),X=Math.abs(O.y-B.y),z={right:oe,left:R,bottom:K,top:X},V=Object.entries(z).reduce((pe,[j,fe])=>fe<pe[1]?[j,fe]:pe,["right",z.right])[0],Z=A.current;if(Z&&Z!==V){let pe=z[V],j=z[Z],fe=Math.abs(j-pe),Fe=Math.min(Math.abs(j),Math.abs(pe));fe<Fe*pm&&(V=Z)}let Q=V,ne,Ie;if(Q==="right"||Q==="left"){let j=(Math.max(B.y,Math.min(B.y+q,O.y))-B.y)/(q||1);Math.abs(j-.5)<jl&&(j=.5),Ie=j,ne={x:Q==="right"?B.x+$:B.x,y:B.y+Ie*q}}else{let j=(Math.max(B.x,Math.min(B.x+$,O.x))-B.x)/($||1);Math.abs(j-.5)<jl&&(j=.5),Ie=j,ne={x:B.x+Ie*$,y:Q==="bottom"?B.y+q:B.y}}return{side:Q,snapPosition:ne,offset:Ie}},[a,M]),Y=(0,me.useCallback)(I=>{var R,K,X;let O=H.current;if(!O)return;let U=c({x:I.clientX,y:I.clientY}),B=S(U);y(B);let $=U,q=null,oe=null;if(B){let z=D(B,U);z&&(q=z.side,$=z.snapPosition,oe=z.offset,A.current=q);let V=l(e),Z={source:O==="source"?B:L.current,target:O==="target"?B:G.current,sourceHandle:O==="source"?q:(R=V==null?void 0:V.sourceHandle)!=null?R:null,targetHandle:O==="target"?q:(K=V==null?void 0:V.targetHandle)!=null?K:null},Q=(X=p==null?void 0:p(Z))!=null?X:!0;P(Q)}else A.current=null,P(!1);T(q),_(oe),f($)},[S,D,l,e,c,p]),F=(0,me.useCallback)(I=>{var q,oe,R,K,X;let O=H.current;if(!O)return;let U=c({x:I.clientX,y:I.clientY}),B=S(U);if(B){let z=D(B,U),V=(q=z==null?void 0:z.side)!=null?q:null,Z=(oe=z==null?void 0:z.offset)!=null?oe:.5,Q=l(e),ne={source:O==="source"?B:L.current,target:O==="target"?B:G.current,sourceHandle:O==="source"?V:(R=Q==null?void 0:Q.sourceHandle)!=null?R:null,targetHandle:O==="target"?V:(K=Q==null?void 0:Q.targetHandle)!=null?K:null};((X=p==null?void 0:p(ne))==null||X)&&i(Ie=>Ie.map(he=>{var _e,De;return he.id===e?v(E({},he),{source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle,targetHandle:ne.targetHandle,data:v(E({},he.data),{points:void 0,sourceOffset:O==="source"?Z:(_e=he.data)==null?void 0:_e.sourceOffset,targetOffset:O==="target"?Z:(De=he.data)==null?void 0:De.targetOffset})}):he}))}h(null),f(null),y(null),T(null),_(null),d(!1),P(!1),u(null),A.current=null,document.removeEventListener("mouseup",F),document.removeEventListener("mousemove",Y);let $=_t.get(n);$==null||$.clearReconnectingEdge()},[e,S,D,l,i,n,Y,p,c,d,u]),te=(0,me.useCallback)((I,O)=>{if(r||O.button!==0)return;O.stopPropagation(),O.preventDefault(),i(B=>B.map($=>$.id===e?v(E({},$),{data:v(E({},$.data),{points:void 0})}):$)),h(I),u(e);let U=_t.get(n);U==null||U.setReconnectingEdge(e),document.addEventListener("mousemove",Y),document.addEventListener("mouseup",F)},[r,e,n,Y,F,u,i]);return(0,me.useEffect)(()=>()=>{if(H.current){document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",F),u(null);let I=_t.get(n);I==null||I.clearReconnectingEdge()}},[n,Y,F,u]),{reconnectingHandle:m,cursorPosition:g,hoveredNodeId:x,reconnectingSide:b,reconnectingOffset:N,isValidReconnection:w,handleReconnectStart:te}};var ae=require("react/jsx-runtime"),pt={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:ye.MarkerType.ArrowClosed},markerEnd:{type:ye.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:ei,MIN_SEGMENT_LENGTH:fm,PARALLEL_OFFSET:ec}=Dn;function mm(e,t,o,n){let r=n.filter(s=>s.source===t&&s.target===o||s.source===o&&s.target===t);if(r.length<=1){let s=n.filter(d=>d.source===t);if(s.length<=1)return 0;let l=s.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(s.length-1)/2;return(l-c)*ec}let i=r.findIndex(s=>s.id===e),a=(r.length-1)/2;return(i-a)*ec}var tc=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var oe;let{zoom:c}=(0,ye.useViewport)(),{updateEdgeData:d}=(0,ye.useReactFlow)(),u=(0,ye.useEdges)(),{isMultipleSelection:p,mode:m,instanceId:h}=W(),[g,f]=(0,Be.useState)(!1),[x,y]=(0,Be.useState)(null),b=(0,Be.useRef)(null),T=(0,Be.useRef)(null),N=m!=="edit",{reconnectingHandle:_,cursorPosition:w,hoveredNodeId:P,reconnectingSide:H,isValidReconnection:C,handleReconnectStart:A}=jr({edgeId:e,source:t,target:o,instanceId:h,isReadOnly:N}),L=(0,ye.useInternalNode)(t),G=(0,ye.useInternalNode)(o),{sx:M,sy:S,tx:D,ty:Y,sourcePos:F,targetPos:te}=(0,Be.useMemo)(()=>{var _e,De;let R=L&&G?zt(L,G):{sx:0,sy:0,tx:0,ty:0,sourcePos:ye.Position.Right,targetPos:ye.Position.Left},K=s?i:R.sourcePos,X=l?a:R.targetPos,z=(Re,Ve,Pe)=>{var Qt,jt,eo,to,Ci,dn;let{x:pe,y:j}=Re.internals.positionAbsolute,fe=(eo=(jt=(Qt=Re.measured)==null?void 0:Qt.width)!=null?jt:Re.width)!=null?eo:0,Fe=(dn=(Ci=(to=Re.measured)==null?void 0:to.height)!=null?Ci:Re.height)!=null?dn:0;switch(Ve){case ye.Position.Top:return{x:pe+fe*Pe,y:j};case ye.Position.Bottom:return{x:pe+fe*Pe,y:j+Fe};case ye.Position.Left:return{x:pe,y:j+Fe*Pe};case ye.Position.Right:return{x:pe+fe,y:j+Fe*Pe};default:return{x:pe+fe/2,y:j+Fe/2}}},V=(_e=n==null?void 0:n.sourceOffset)!=null?_e:.5,Z=(De=n==null?void 0:n.targetOffset)!=null?De:.5,Q=L?z(L,K,V).x:R.sx,ne=L?z(L,K,V).y:R.sy,Ie=G?z(G,X,Z).x:R.tx,he=G?z(G,X,Z).y:R.ty;return _==="source"&&w?(Q=w.x,ne=w.y,H&&(K=H)):_==="target"&&w&&(Ie=w.x,he=w.y,H&&(X=H)),{sx:Q,sy:ne,tx:Ie,ty:he,sourcePos:K,targetPos:X}},[L,G,s,l,i,a,_,w,H,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,Be.useEffect)(()=>{var X;if(!T.current){T.current={sx:M,sy:S,tx:D,ty:Y,sourcePos:F,targetPos:te};return}let R=T.current;(Math.abs(M-R.sx)>ei||Math.abs(S-R.sy)>ei||Math.abs(D-R.tx)>ei||Math.abs(Y-R.ty)>ei||R.sourcePos!==F||R.targetPos!==te)&&((X=n==null?void 0:n.points)!=null&&X.length)&&!_&&d(e,v(E({},n),{points:void 0})),T.current={sx:M,sy:S,tx:D,ty:Y,sourcePos:F,targetPos:te}},[M,S,D,Y,F,te,n,e,d,_]);let I=(0,Be.useMemo)(()=>{let R=mm(e,t,o,u);return Jl(M,S,D,Y,F,te,n==null?void 0:n.points,R)},[M,S,D,Y,F,te,n==null?void 0:n.points,u,e,t,o]),O=(0,Be.useMemo)(()=>{if(I.length<2)return Jr({x:M,y:S},{x:D,y:Y});let R=0;for(let z=0;z<I.length-1;z++)R+=Xo(I[z],I[z+1]);let K=R/2,X=0;for(let z=0;z<I.length-1;z++){let V=Xo(I[z],I[z+1]);if(X+V>=K){let Z=(K-X)/V,Q=I[z],ne=I[z+1];return{x:Q.x+(ne.x-Q.x)*Z,y:Q.y+(ne.y-Q.y)*Z}}X+=V}return Jr({x:M,y:S},{x:D,y:Y})},[I,M,S,D,Y]),U=(0,Be.useMemo)(()=>{if(I.length<2){let V=Math.abs(D-M);return Math.abs(Y-S)>V?{x:-60,y:0}:{x:0,y:-60}}let K=0;for(let V=0;V<I.length-1;V++)K+=Xo(I[V],I[V+1]);let X=K/2,z=0;for(let V=0;V<I.length-1;V++){let Z=Xo(I[V],I[V+1]);if(z+Z>=X){let Q=I[V],ne=I[V+1],Ie=Math.abs(ne.x-Q.x);return Math.abs(ne.y-Q.y)>Ie?{x:-60,y:0}:{x:0,y:-60}}z+=Z}return{x:0,y:-60}},[I,M,S,D,Y]),B=(0,Be.useCallback)((R,K)=>{if(m!=="edit"||K.button!==0)return;K.stopPropagation(),K.preventDefault();let X=I[R],z=I[R+1],V=es(X,z,"y"),Z=V?X.y:X.x,Q=[...I],ne=Q.length,Ie=R,he=R+1;y(R);let _e=Re=>{let Ve=Z+(V?Re.clientY-K.clientY:Re.clientX-K.clientX)/c;b.current=V?{x:(X.x+z.x)/2,y:Ve}:{x:Ve,y:(X.y+z.y)/2};let Pe=[];for(let pe=1;pe<ne-1;pe++){let j=Q[pe];pe===Ie||pe===he?V?Pe.push({x:j.x,y:Ve}):Pe.push({x:Ve,y:j.y}):Pe.push(E({},j))}d(e,v(E({},n),{points:Pe}))},De=()=>{y(null),b.current=null,document.removeEventListener("mousemove",_e),document.removeEventListener("mouseup",De)};document.addEventListener("mousemove",_e),document.addEventListener("mouseup",De)},[m,I,c,n,e,d]);if(!L||!G)return null;let $=Ql(I),q=r||L.selected||G.selected;return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":q}),onBlur:()=>f(!1),onDoubleClick:()=>f(!0),children:[(0,ae.jsx)(ye.BaseEdge,{id:e,path:$,markerEnd:`url(#${q?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||_&&P&&!C,"stroke-green-500":_&&P&&C,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":q&&!(n!=null&&n.hasError)&&!_})}),r&&!p&&!N&&(0,ae.jsx)("g",{children:I.slice(0,-1).map((R,K)=>{let X=I[K+1];if(K===0||K===I.length-2||Xo(R,X)<fm)return null;let z=es(R,X,"y"),V=x===K,Z=V&&b.current?b.current:Jr(R,X);return(0,ae.jsxs)("g",{children:[(0,ae.jsx)("line",{x1:R.x,y1:R.y,x2:X.x,y2:X.y,stroke:"transparent",strokeWidth:20/c,className:k("cursor-pointer",{"cursor-ns-resize":z,"cursor-ew-resize":!z}),onMouseDown:Q=>B(K,Q)}),(0,ae.jsx)("circle",{cx:Z.x,cy:Z.y,r:4/c,fill:V?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,ae.jsx)("circle",{cx:Z.x,cy:Z.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:V?.6:.3,className:"pointer-events-none"})]},K)})})]}),(0,ae.jsxs)(ye.EdgeLabelRenderer,{children:[(0,ae.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${O.x}px, ${O.y}px)`},children:[r&&!p&&(0,ae.jsx)("div",{className:"absolute",style:{transform:`translate(${U.x}px, ${U.y}px)`},children:(0,ae.jsx)(Uo,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:L,targetNode:G,style:{transform:`scale(${1/c})`}})}),(g||((oe=n==null?void 0:n.label)==null?void 0:oe.trim()))&&(0,ae.jsx)(He,{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,onChange:R=>d(e,{label:R.trim()})})]}),r&&!p&&!N&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${I[0].x}px, ${I[0].y}px)`},children:(0,ae.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="source"?.6:.3,className:"pointer-events-none"}),(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!_||_!=="source","cursor-not-allowed":_==="source"&&P&&!C,"cursor-grabbing":_==="source"&&(!P||C)}),onMouseDown:R=>A("source",R.nativeEvent)})]})}),(0,ae.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${I[I.length-1].x}px, ${I[I.length-1].y}px)`},children:(0,ae.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="target"?.6:.3,className:"pointer-events-none"}),(0,ae.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!_||_!=="target","cursor-not-allowed":_==="target"&&P&&!C,"cursor-grabbing":_==="target"&&(!P||C)}),onMouseDown:R=>A("target",R.nativeEvent)})]})})]})]})]})};var fd=require("use-debounce");var pd=require("@xyflow/react"),ls=require("react");var Rn=(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))(Rn||{});var ti=require("xml-js");var oc={compact:!0,spaces:4},gm=e=>e.replaceAll(`
2
+ `,"&#xA;");function oi(e,t=oc){if(e)return JSON.parse((0,ti.xml2json)(e,v(E({},t),{attributeValueFn:gm})))}function nc(e,t=oc){return e?(0,ti.json2xml)(e,t):""}var hm={MIN_WIDTH:36,MIN_HEIGHT:36},ym={MIN_WIDTH:36,MIN_HEIGHT:36},xm={MIN_WIDTH:56,MIN_HEIGHT:56},ni={MIN_WIDTH:176,MIN_HEIGHT:96},ri={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Te={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ii={MIN_WIDTH:176,MIN_HEIGHT:64},Em={MIN_WIDTH:128,MIN_HEIGHT:64},ee={START_EVENT:hm,END_EVENT:ym,GATEWAY:xm,TASK:ni,LANE:Te,ANNOTATION:ii,UNSUPPORTED:Em};var rc={"attribute-loop":"LOOP"},ic={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},sc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},ac={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},lc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var Ko=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=Rt(Number(n),t),a=Rt(Number(r),o);return{width:i,height:a,measured:{width:i,height:a}}},qo=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,a={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},s={id:n,position:a,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(s.parentId=l),s},_m=e=>{let{mxGeometry:t}=e,o=qo(e),n=Ko(t,ee.START_EVENT.MIN_WIDTH,ee.START_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"START_EVENT"})},Tm=e=>{let{mxGeometry:t}=e,o=qo(e),n=Ko(t,ee.END_EVENT.MIN_WIDTH,ee.END_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"END_EVENT"})},ts=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=qo(e),i=Ko(n,ee.TASK.MIN_WIDTH,ee.TASK.MIN_HEIGHT),a=t==null?void 0:t.find(l=>{let{parent:c}=l._attributes;return c===e._attributes.id});if(a){let{style:l}=a._attributes,c=rc[l];c&&(r.data.attribute=c)}let s=ic[o.style];return s&&(r.data.variant=s),v(E(E({},r),i),{type:"TASK"})},os=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=qo(e),i=Ko(o,ee.GATEWAY.MIN_WIDTH,ee.GATEWAY.MIN_HEIGHT);return r.data.variant=sc[n],v(E(E({},r),i),{type:"GATEWAY"})},Nm=e=>{let{mxGeometry:t}=e,o=qo(e),n=Ko(t,ee.ANNOTATION.MIN_WIDTH,ee.ANNOTATION.MIN_HEIGHT);return v(E(E({},o),n),{type:"ANNOTATION"})},vm=e=>{let{mxGeometry:t}=e,o=qo(e),n=Ko(t,ee.LANE.MIN_WIDTH,ee.LANE.MIN_HEIGHT);return v(E(E({},o),n),{type:"LANE"})},cc={task:ts,"task-script":ts,"subprocess-collapsed":ts,"start-event":_m,"end-event-terminate":Tm,"gateway-parallel":os,"gateway-exclusive":os,"gateway-complex":os,annotation:Nm,lane:vm},wm=e=>{if(e&&Array.isArray(e))return e.map(t=>({x:Number(t._attributes.x),y:Number(t._attributes.y)}))},dc=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:a,style:s}=t,l=wm(o==null?void 0:o.Array),c={id:n,source:r,target:i,data:E({label:a||""},l&&l.length>0?{points:l}:{})};return s.includes("association")&&s.includes('endArrow=""')?E(E({},$o),c):E(E({},pt),c)},uc=(e,t)=>{let{id:o,type:n,source:r,target:i,data:a}=e,s=t==null?void 0:t.find(u=>u.id===r),l="";n==="ANNOTATION_EDGE"&&(l='association;endArrow=""');let c={_attributes:{as:"geometry",relative:"1"}};return a!=null&&a.points&&Array.isArray(a.points)&&a.points.length>0&&(c.Array=a.points.map(u=>({_attributes:{as:"mxPoint",x:u.x,y:u.y}}))),{_attributes:{id:o,parent:(s==null?void 0:s.parentId)||"1",edge:"1",style:l,source:r,target:i,value:(a==null?void 0:a.label)||""},mxGeometry:c}},Zo=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}}}},Am=e=>{let{variant:t}=e.data,o=Zo(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:ac[t]||"task"})})},Im=e=>{let t=Zo(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"start-event"})})},Cm=e=>{let t=Zo(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"end-event-terminate"})})},Sm=e=>{let{variant:t}=e.data,o=Zo(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:lc[t]})})},Mm=e=>{let t=Zo(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"lane"})})},Pm=e=>{let t=Zo(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"annotation"})})},pc={TASK:Am,START_EVENT:Im,END_EVENT:Cm,GATEWAY:Sm,ANNOTATION:Pm,LANE:Mm},fc=(e,t)=>{var a,s;let r=((a=e.measured)==null?void 0:a.width)||0,i=((s=e.measured)==null?void 0:s.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 ns=Wu(require("@dagrejs/dagre"),1),yc=require("@xyflow/react");var xc=require("lodash");var mc=require("lodash");var Pt=e=>{var t,o,n,r,i,a,s,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},yo=e=>(0,mc.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}=Pt(e),{x:r,y:i}=Pt(t);return{x:o-r,y:n-i}};var Jo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(J)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Lm=(e,t)=>{let{x:o,y:n}=Pt(e),{x:r,y:i}=Pt(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},km=(e,t)=>{let{x:o,y:n,w:r,h:i}=Pt(e),{x:a,y:s,w:l,h:c}=Pt(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},On=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&km(e,r)){let i=Lm(e,r);i<n&&(n=i,o=r)}return o},hc=(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 Ec=(e=[],t=[],o="LR")=>{let n=new ns.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>n.setNode(i,{width:a,height:s})),t.forEach(i=>n.setEdge(i.source,i.target)),ns.default.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return v(E({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},Vn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Hn(n.id,o)}),o},Hn=(e,t)=>{var m,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,xc.orderBy)(r,["position.y"]),a=Math.max((h=(m=n.measured)==null?void 0:m.width)!=null?h:0,ri.MIN_WIDTH),s=hc(e,i)||Te.MIN_WIDTH,l=Math.max(a,s),c=a-Te.HEADER_WIDTH>=s,d=0,u=0;i.forEach(g=>{var f,x,y,b;o=o.map(T=>T.id===g.id?v(E({},T),{width:c?l-Te.HEADER_WIDTH:l,measured:v(E({},T.measured),{width:c?l-Te.HEADER_WIDTH:l}),position:{x:Te.HEADER_WIDTH,y:d}}):T),d+=(x=(f=g.measured)==null?void 0:f.height)!=null?x:0,u+=(b=(y=g.measured)==null?void 0:y.height)!=null?b:0}),o=o.map(g=>g.id===e?v(E({},g),{height:u,width:c?l:l+Te.HEADER_WIDTH,measured:v(E({},g.measured),{height:u,width:c?l:l+Te.HEADER_WIDTH})}):g);let p=o.find(g=>g.id===e);return p!=null&&p.parentId&&(o=Hn(p.parentId,o)),o},bc=(e,t,o)=>{if(e.type==="LANE")return o;let n=Ke(t),r=Ke(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+Te.HEADER_WIDTH&&(e.position.x=Te.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},_c=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Dm=50,Tc=(e,t=Dm)=>{let o=(0,yc.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Gn=1,Nc=()=>`<mxGraphModel>
3
3
  <root version="1.1">
4
4
  <mxCell id="0" />
5
5
  <mxCell id="1" parent="0" />
@@ -32,9 +32,9 @@
32
32
  <mxGeometry as="geometry" relative="1" />
33
33
  </mxCell>
34
34
  </root>
35
- </mxGraphModel>`,_c=(e,t)=>{if(!e.length&&!t.length)return Vn;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var km=e=>{let t=Object.values(kn),o=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return t.includes(a)}),n=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return["attribute-loop"].includes(a)}),r=[];for(let i of o){let{style:a}=i._attributes,s=sc[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},Dm=(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=ac(r),a=t.find(l=>l.id===i.source),s=t.find(l=>l.id===i.target);(a==null?void 0:a.type)==="LANE"||(s==null?void 0:s.type)==="LANE"||n.push(i)}return n},Rm=(e,t)=>{let o=[];return e.forEach(n=>{var a,s;let r=(s=(a=cc)[n.type])==null?void 0:s.call(a,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=dc(n,t);o.push(l)}}),o},Om=(e,t)=>{let o=[];return e.forEach(n=>{let r=lc(n,t);o.push(r)}),o},Tc=(e=[],t=[],o)=>{let n=Rm(e,o),r=Om(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return ec(JSON.stringify(i),{compact:!0,spaces:0})},Nc=async e=>{var s,l,c,d,u;let t=await oi(e),o=((l=(s=t==null?void 0:t.mxGraphModel)==null?void 0:s.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)||Vn),r=km(o),i=Dm(o,r);return{nodes:mo(Rn(r)),edges:i,lastElementId:n}};var Qo=require("@xyflow/react");var Hn=require("@xyflow/react");var ns=require("react/jsx-runtime"),se=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=ht(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,ns.jsx)(Hn.Handle,E({type:e,position:t,className:k("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!s},o)},r))},ze=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=ht(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,Hn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let m=c();if(t==="TASK")return m.filter(g=>g.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return m.filter(g=>g.source===e).length>=2;if(t==="START_EVENT"){let h=d();return m.filter(f=>{if(f.source!==e)return!1;let x=h.find(y=>y.id===f.target);return(x==null?void 0:x.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,ns.jsx)(Hn.Handle,E({type:n,position:r,className:k("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"}},a))};var si=require("@xyflow/react"),vc=require("lodash");var wc=require("react/jsx-runtime"),Zo=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=ht(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,si.useReactFlow)(),{isMultipleSelection:l}=W(),c=({width:u,height:p})=>{if(!e)return;let m=i(e);if((m==null?void 0:m.type)!=="LANE")return;let h=[...a()],g=!m.parentId,f=g?m.id:m.parentId,x=h.filter(N=>N.type==="LANE"&&N.parentId===f);if(!x.length)return;let y=(0,vc.orderBy)(x,["position.y"]),b=0;y.forEach((N,T)=>{var P,H;let _=T===y.length-1,w=(H=(P=N.measured)==null?void 0:P.height)!=null?H:0;h=h.map(C=>{if(C.id===N.id){let I=g?u-be.HEADER_WIDTH:u,L=v(E({},C),{width:I,measured:v(E({},C.measured),{width:I}),position:v(E({},C.position),{y:b})});return _&&g&&(L.height=p-b),L}return C}),b+=w}),h=h.map(N=>{if(N.id===f){let T=g?u:u+be.HEADER_WIDTH;return v(E({},N),{width:T,height:g?p:b,measured:{width:T,height:g?p:b}})}return N}),s(h)};return(0,wc.jsx)(si.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 ci=require("@xyflow/react"),Tt=require("lecom-ui"),ho=require("react");var Ic=require("zustand"),Jo=(0,Ic.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var ai=require("react"),Ac=(e,t=!1)=>{let[o,n]=(0,ai.useState)({width:0,height:0});return(0,ai.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var Yt=require("@xyflow/react"),Cc=require("react"),Vm=120,Hm=12,Sc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,Yt.useReactFlow)(),{instanceId:i}=W();return(0,Cc.useMemo)(()=>{var m,h;if(!t)return{position:Yt.Position.Right,align:"start"};let a=n(e);if(!a)return{position:Yt.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((m=a.measured)==null?void 0:m.width)||a.width||100)*s.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:Yt.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||Vm;return{position:l+c+u+Hm>d?Yt.Position.Left:Yt.Position.Right}},[i,e,t,o,n,r])};var li=require("@xyflow/react"),ce=require("lecom-ui"),Mc=require("lucide-react");var me=require("react/jsx-runtime"),Pc=({nodeId:e})=>{let{t}=(0,ce.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,li.useReactFlow)(),i=(0,li.useNodesData)(e),s=n().filter(m=>m.source===e).some(m=>{let h=r(m.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,me.jsxs)(ce.DropdownMenu,{children:[(0,me.jsxs)(ce.Tooltip,{children:[(0,me.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(ce.DropdownMenuTrigger,{asChild:!0,children:(0,me.jsx)(ce.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,me.jsx)(Mc.WrenchIcon,{})})})}),(0,me.jsx)(ce.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,me.jsxs)(ce.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,me.jsxs)(ce.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,me.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,me.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(ar).map(([u,p])=>{let m=u==="LOOP"&&(s||l),g=(()=>{if(u==="LOOP"&&s)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")})();return(0,me.jsxs)(ce.Tooltip,{children:[(0,me.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(ce.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:m,className:k({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":m}),onClick:m?void 0:()=>d(u),children:(0,me.jsx)(p.icon,{className:"stroke-inherit"})})}),g&&(0,me.jsx)(ce.TooltipContent,{color:"black",children:g})]},u)})})]}),(0,me.jsx)(ce.DropdownMenuGroup,{children:(0,me.jsxs)(ce.Tooltip,{children:[(0,me.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,me.jsxs)(ce.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50 cursor-not-allowed":s}),disabled:s,onClick:s?void 0:()=>c("SCRIPT"),children:[(0,me.jsx)(sr.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),s&&(0,me.jsx)(ce.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var _e=require("react/jsx-runtime"),go={START_EVENT:{type:"START_EVENT",icon:fn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:wo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:fn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:or,label:"bpmn.annotation.variant.default"}},Gm={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Co,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Mo,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:Io,label:"bpmn.gateway.variant.complex"}},Ue=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,ho.useRef)(null),a=(0,ho.useRef)(null),{t:s}=(0,Tt.useTranslation)(),{setDraggableNode:l}=Jo(),{getEdges:c,getNodes:d}=(0,ci.useReactFlow)(),{setIsDragging:u,mode:p}=W(),{dimensions:m}=Ac(i,r),{position:h}=Sc(e,r,m),[g,f]=(0,ho.useState)(void 0),x=d(),y=c(),b=o==="SUBPROCESS",N=(0,ho.useCallback)((S,D)=>{u(!1),l({type:D.type,variant:D.variant,attribute:D.attribute,icon:D.icon}),D.icon&&f((0,_e.jsx)(D.icon,{})),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("sourceId",e),a.current&&S.dataTransfer.setDragImage(a.current,10,10),setTimeout(()=>{u(!0)},100)},[e,l,u]),T=[{component:(0,_e.jsx)(Zr,{elementId:e})}],_=()=>{if(p==="view")return[];let S=!y.some(D=>{var q;return D.source===e&&((q=x.find(z=>z.id===D.target))==null?void 0:q.type)!=="ANNOTATION"});return[{component:(0,_e.jsx)(Sn,{nodeId:e,disabled:!S,tooltipMessage:S?void 0:s("editor.toolbar.start_event_limit_reached")})},go.TASK,go.ANNOTATION,...T]},w=()=>p==="view"?[{component:(0,_e.jsx)(Wt,{elementId:e})}]:[{component:(0,_e.jsx)(Wt,{elementId:e})},...b?[]:[{component:(0,_e.jsx)(Pc,{nodeId:e})}],{component:(0,_e.jsx)(Sn,{nodeId:e})},go.TASK,...Object.values(Gm),...T],P=()=>p==="view"?[{component:(0,_e.jsx)(Wt,{elementId:e})}]:[{component:(0,_e.jsx)(Wt,{elementId:e})},{component:(0,_e.jsx)(Sn,{nodeId:e})},go.TASK,go.ANNOTATION,...T],H=()=>p==="view"?[]:[{component:(0,_e.jsx)(Sn,{nodeId:e})},go.ANNOTATION,...T],C=()=>p==="view"?[]:[...n?[]:[go.ANNOTATION],...T],I=()=>p==="view"?[]:[...T],L=()=>p==="view"?[]:[...T],M=(S=>{switch(S){case"START_EVENT":return _();case"TASK":return w();case"GATEWAY":return P();case"END_EVENT":return H();case"LANE":return C();case"ANNOTATION":return I();case"UNSUPPORTED":return L();default:return[]}})(t);if(!(M.length===0||p==="readonly"))return(0,_e.jsxs)(ci.NodeToolbar,{position:h,align:"start",className:"-top-8",isVisible:r,children:[(0,_e.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:M.map((S,D)=>{if(S.component)return(0,_e.jsx)("div",{children:S.component},D);let q={sourceNodeType:t,targetNodeType:S.type,sourceNodeId:e,nodes:x,edges:y},z=Hl(q),ie={gateway_limit_reached:s("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:s("editor.toolbar.start_event_limit_reached"),start_event_already_exists:s("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:s("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:s("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:s("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:s("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:s("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:s("editor.toolbar.task_limit_reached")},A=z.shouldDisable&&z.reason?ie[z.reason]||s(S.label):s(S.label)||"";return(0,_e.jsxs)(Tt.Tooltip,{children:[(0,_e.jsx)(Tt.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(Tt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!z.shouldDisable,disabled:z.shouldDisable,className:z.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:z.shouldDisable?void 0:R=>N(R,S),children:S.icon&&(0,_e.jsx)(S.icon,{size:16})})}),(0,_e.jsx)(Tt.TooltipContent,{color:"black",children:A})]},D)})}),(0,_e.jsx)("div",{ref:a,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:g})]})};var yo=require("react/jsx-runtime"),Lc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Qo.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Qo.useConnection)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=W(),u=i&&(a==null?void 0:a.id)!==e,p=h=>{r(e,{label:h})},m=!l&&!c&&!d;return(0,yo.jsxs)("div",{className:k("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,yo.jsx)(He,{value:t.label,className:"m-1 text-grey-600",onChange:p}),m&&(0,yo.jsx)(Ue,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),s==="edit"&&(0,yo.jsx)(Zo,{minWidth:ii.MIN_WIDTH,minHeight:ii.MIN_HEIGHT,isVisible:!n&&o}),(!i||u)&&(0,yo.jsx)(se,{type:"target",position:Qo.Position.Left,className:k({"annotation-handle":u})})]})};var qe=require("@xyflow/react"),kc=require("react");var Ae=require("react/jsx-runtime"),Dc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,qe.useReactFlow)(),{inProgress:i,fromNode:a}=(0,qe.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c,reconnectingEdgeId:d}=W(),[u,p]=(0,kc.useState)(!1),m=i&&(a==null?void 0:a.id)!==e||!!d,h=y=>{r(e,{label:y})},g=()=>{p(!0)},f=()=>{p(!1)},x=!s&&!l&&!c;return(0,Ae.jsxs)("div",{className:"relative",onBlur:f,onDoubleClick:g,children:[(0,Ae.jsx)(wo,{className:k("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,Ae.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ae.jsx)(He,{value:t.label,isEditing:u,onChange:h})}),x&&(0,Ae.jsx)(Ue,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||m)&&(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(se,{type:"target",position:qe.Position.Left,id:"left",className:k({"event-handle":m})}),(0,Ae.jsx)(se,{type:"target",position:qe.Position.Right,id:"right",className:k({"event-handle":m})}),(0,Ae.jsx)(se,{type:"target",position:qe.Position.Top,id:"top",className:k({"event-handle":m})}),(0,Ae.jsx)(se,{type:"target",position:qe.Position.Bottom,id:"bottom",className:k({"event-handle":m})})]}),!i&&(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(se,{type:"source",position:qe.Position.Left,id:"left"}),(0,Ae.jsx)(se,{type:"source",position:qe.Position.Right,id:"right"}),(0,Ae.jsx)(se,{type:"source",position:qe.Position.Top,id:"top"}),(0,Ae.jsx)(se,{type:"source",position:qe.Position.Bottom,id:"bottom"})]})]})};var Ze=require("@xyflow/react"),di=require("react");var Ce=require("react/jsx-runtime"),Rc=({id:e,data:t,selected:o,dragging:n})=>{let r=ki[t.variant].icon,{updateNodeData:i}=(0,Ze.useReactFlow)(),{inProgress:a,fromNode:s}=(0,Ze.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d,reconnectingEdgeId:u}=W(),[p,m]=(0,di.useState)(!1),h=a&&(s==null?void 0:s.id)!==e||!!u,g=(0,di.useCallback)(b=>{i(e,{label:b})},[e,i]),f=()=>{m(!0)},x=()=>{m(!1)},y=!l&&!c&&!d;return(0,Ce.jsxs)("div",{className:"relative",onBlur:x,onDoubleClick:f,children:[(0,Ce.jsx)(r,{className:k("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,Ce.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ce.jsx)(He,{value:t.label,isEditing:p,onChange:g})}),y&&(0,Ce.jsx)(Ue,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!a||h)&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(se,{type:"target",position:Ze.Position.Left,id:"left",className:k({"gateway-handle":h})}),(0,Ce.jsx)(se,{type:"target",position:Ze.Position.Right,id:"right",className:k({"gateway-handle":h})}),(0,Ce.jsx)(se,{type:"target",position:Ze.Position.Top,id:"top",className:k({"gateway-handle":h})}),(0,Ce.jsx)(se,{type:"target",position:Ze.Position.Bottom,id:"bottom",className:k({"gateway-handle":h})})]}),!a&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(ze,{type:"source",position:Ze.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Ce.jsx)(ze,{type:"source",position:Ze.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Ce.jsx)(ze,{type:"source",position:Ze.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Ce.jsx)(ze,{type:"source",position:Ze.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var Oc=require("@xyflow/react"),ft=require("lecom-ui"),Bm=require("lucide-react");var Vc=require("react/jsx-runtime");var Je=require("@xyflow/react"),Hc=require("react");var Se=require("react/jsx-runtime"),Gc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Je.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Je.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c,reconnectingEdgeId:d}=W(),[u,p]=(0,Hc.useState)(!1),m=i&&(a==null?void 0:a.id)!==e||!!d,h=y=>{r(e,{label:y})},g=()=>{p(!0)},f=()=>{p(!1)},x=!s&&!l&&!c;return(0,Se.jsxs)("div",{className:"relative",onBlur:f,onDoubleClick:g,children:[(0,Se.jsx)(ir,{className:k("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,Se.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Se.jsx)(He,{value:t.label,isEditing:u,onChange:h})}),x&&(0,Se.jsx)(Ue,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||m)&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(se,{type:"target",position:Je.Position.Left,id:"left",className:k({"event-handle":m})}),(0,Se.jsx)(se,{type:"target",position:Je.Position.Right,id:"right",className:k({"event-handle":m})}),(0,Se.jsx)(se,{type:"target",position:Je.Position.Top,id:"top",className:k({"event-handle":m})}),(0,Se.jsx)(se,{type:"target",position:Je.Position.Bottom,id:"bottom",className:k({"event-handle":m})})]}),!i&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(ze,{type:"source",position:Je.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var Qe=require("@xyflow/react"),zn=require("lecom-ui"),Wc=require("react");var ui=(e,t)=>{let n=e.filter(i=>i.type==="TASK").map(i=>{var s;let a=(s=i.data)==null?void 0:s.label;if(a&&a.startsWith(`${t} `)){let l=a.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(i=>i>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},jo=(e,t)=>{let n=t.filter(l=>l.type==="TASK").map(l=>{var c;return(c=l.data)==null?void 0:c.label}).filter(Boolean);if(!n.includes(e))return e;let i=e.replace(/\s+\(\d+\)$/,""),a=n.filter(l=>l===i||l.startsWith(`${i} (`)).map(l=>{if(l===i)return 1;let c=l.match(/\s+\((\d+)\)$/);return c?parseInt(c[1],10):0}).filter(l=>l>0),s=2;for(;a.includes(s);)s++;return`${i} (${s})`};var Gn=require("react/jsx-runtime"),Bc=e=>(0,Gn.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,Gn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,Gn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var rs=require("react/jsx-runtime"),zc=e=>(0,rs.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,rs.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 Bn=require("react/jsx-runtime"),Fc=e=>(0,Bn.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,Bn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,Bn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ne=require("react/jsx-runtime"),zm={APROVADO:Bc,EM_ANDAMENTO:zc,REJEITADO:Fc},is={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)]"},Yc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,zn.useTranslation)(),{updateNodeData:i,getNodes:a}=(0,Qe.useReactFlow)(),{inProgress:s,fromNode:l}=(0,Qe.useConnection)(),{mode:c,isConnecting:d,isDragging:u,isMultipleSelection:p,onSubprocessValidationClick:m,reconnectingEdgeId:h}=W(),{getTaskStatus:g}=oo(),f=s&&(l==null?void 0:l.id)!==e||!!h,x=(0,Wc.useCallback)(L=>{let G=L.trim(),M=t.label||"";if(G===M)return;let S=G,D=a();if(!(G&&G!=="")){S=ui(D,r("bpmn.task.label.prefix")),i(e,{label:S}),(0,zn.toast)({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,ne.jsx)("strong",{children:S})]})});return}let z=jo(S,D);z===M||(i(e,{label:z}),z!==S&&(0,zn.toast)({variant:"warning",content:(0,ne.jsxs)(ne.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,ne.jsx)("strong",{children:G})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,ne.jsx)("strong",{children:z})]})}))},[t.label,a,e,r,i]),y=g(e),b=y?zm[y]:null,N=t.variant?sr[t.variant].icon:null,T=t.attribute?ar[t.attribute].icon:null,_=t.variant==="SUBPROCESS",w=N&&!_,P=T||_,H=()=>t.hasError?is.error:y?is[y]:is.default,C=()=>{m==null||m({id:e,type:"sub_process",label:t.label})},I=!d&&!u&&!p;return(0,ne.jsxs)("div",{className:k("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",H(),{"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)(He,{value:t.label,maxLength:60,className:k("m-1",{"py-6":w||P}),onChange:x}),N&&(0,ne.jsx)("div",{className:k("absolute flex items-center p-1",_?"bottom-0":"top-0 left-0"),children:(0,ne.jsx)(N,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500",_&&"cursor-pointer"),onClick:_?C:void 0})}),T&&(0,ne.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ne.jsx)("div",{className:k("flex items-center w-16 p-1",_?"justify-between":"justify-center"),children:(0,ne.jsx)(T,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})})}),b&&(0,ne.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,ne.jsx)(b,{})}),I&&(0,ne.jsx)(Ue,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),c==="edit"&&(0,ne.jsx)(Zo,{minWidth:ni.MIN_WIDTH,minHeight:ni.MIN_HEIGHT,isVisible:!n&&o}),(!s||f)&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(se,{type:"target",position:Qe.Position.Left,id:"left",className:k({"task-handle":f})}),(0,ne.jsx)(se,{type:"target",position:Qe.Position.Right,id:"right",className:k({"task-handle":f})}),(0,ne.jsx)(se,{type:"target",position:Qe.Position.Top,id:"top",className:k({"task-handle":f})}),(0,ne.jsx)(se,{type:"target",position:Qe.Position.Bottom,id:"bottom",className:k({"task-handle":f})})]}),!s&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(ze,{type:"source",position:Qe.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(ze,{type:"source",position:Qe.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(ze,{type:"source",position:Qe.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,ne.jsx)(ze,{type:"source",position:Qe.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var ss=require("@xyflow/react");var Lt=require("react/jsx-runtime"),Uc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:a}=W(),s=!r&&!i&&!a;return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.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}),s&&(0,Lt.jsx)(Ue,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,Lt.jsx)(se,{type:"source",position:ss.Position.Right}),(0,Lt.jsx)(se,{type:"target",position:ss.Position.Left})]})};var Te=require("@xyflow/react"),pi=require("react");var ye=require("react/jsx-runtime"),Hv={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:Te.MarkerType.Arrow},data:{label:""}},$c=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{let{zoom:c}=(0,Te.useViewport)(),{updateEdgeData:d}=(0,Te.useReactFlow)(),{isMultipleSelection:u,mode:p,instanceId:m}=W(),h=p!=="edit",[g,f]=(0,pi.useState)(!1),{reconnectingHandle:x,cursorPosition:y,hoveredNodeId:b,reconnectingSide:N,isValidReconnection:T,handleReconnectStart:_}=jr({edgeId:e,source:t,target:o,instanceId:m,isReadOnly:h}),w=(0,Te.useInternalNode)(t),P=(0,Te.useInternalNode)(o),{sx:H,sy:C,tx:I,ty:L,sourcePos:G,targetPos:M}=(0,pi.useMemo)(()=>{var Ie,ge;if(!w||!P)return{sx:0,sy:0,tx:0,ty:0,sourcePos:Te.Position.Left,targetPos:Te.Position.Right};let K=zt(w,P),oe=s?i:K.sourcePos,O=l?a:K.targetPos,U=(Ee,ke,De)=>{var Re,ct,Jt,Qt,jt,vo;let{x:Ve,y:Me}=Ee.internals.positionAbsolute,ee=(Jt=(ct=(Re=Ee.measured)==null?void 0:Re.width)!=null?ct:Ee.width)!=null?Jt:0,Q=(vo=(jt=(Qt=Ee.measured)==null?void 0:Qt.height)!=null?jt:Ee.height)!=null?vo:0;switch(ke){case Te.Position.Top:return{x:Ve+ee*De,y:Me};case Te.Position.Bottom:return{x:Ve+ee*De,y:Me+Q};case Te.Position.Left:return{x:Ve,y:Me+Q*De};case Te.Position.Right:return{x:Ve+ee,y:Me+Q*De};default:return{x:Ve+ee/2,y:Me+Q/2}}},$=(Ie=n==null?void 0:n.sourceOffset)!=null?Ie:.5,F=(ge=n==null?void 0:n.targetOffset)!=null?ge:.5,V=w?U(w,oe,$).x:K.sx,J=w?U(w,oe,$).y:K.sy,Z=P?U(P,O,F).x:K.tx,ae=P?U(P,O,F).y:K.ty;return x==="source"&&y?(V=y.x,J=y.y,N&&(oe=N)):x==="target"&&y&&(Z=y.x,ae=y.y,N&&(O=N)),{sx:V,sy:J,tx:Z,ty:ae,sourcePos:oe,targetPos:O}},[w,P,s,l,i,a,x,y,N,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!w||!P)return null;let[S,D,q]=(0,Te.getSmoothStepPath)({sourceX:H,sourceY:C,targetX:I,targetY:L,sourcePosition:G,targetPosition:M}),z=r||(w==null?void 0:w.selected)||(P==null?void 0:P.selected),ie=z?"sequence-edge-marker-highlighted":"sequence-edge-marker",A=g||(n==null?void 0:n.label.trim().length)>0,R=1/c,Y=()=>{f(!0)},B=()=>{f(!1)},X=K=>{d(e,{label:K.trim()})};return(0,ye.jsx)(ye.Fragment,{children:(0,ye.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":z}),onBlur:B,onDoubleClick:Y,children:[(0,ye.jsx)(Te.BaseEdge,{id:e,path:S,markerEnd:`url(#${ie})`,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||x&&b&&!T,"stroke-green-500":x&&b&&T,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":z&&!(n!=null&&n.hasError)&&!x})}),(0,ye.jsxs)(Te.EdgeLabelRenderer,{children:[(0,ye.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${D}px, ${q}px)`},children:[r&&!u&&(0,ye.jsx)(Wo,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${R})`}}),A&&(0,ye.jsx)(He,{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,onChange:X})]}),r&&!u&&!h&&(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${H}px, ${C}px)`},children:(0,ye.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="source"?.6:.3,className:"pointer-events-none"}),(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!x||x!=="source","cursor-not-allowed":x==="source"&&b&&!T,"cursor-grabbing":x==="source"&&(!b||T)}),onMouseDown:K=>_("source",K.nativeEvent)})]})}),(0,ye.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${I}px, ${L}px)`},children:(0,ye.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="target"?.6:.3,className:"pointer-events-none"}),(0,ye.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!x||x!=="target","cursor-not-allowed":x==="target"&&b&&!T,"cursor-grabbing":x==="target"&&(!b||T)}),onMouseDown:K=>_("target",K.nativeEvent)})]})})]})]})]})})};var Xc=require("@xyflow/react"),Fn=require("react/jsx-runtime"),Kc=({toX:e,toY:t,fromNode:o})=>{if(!o)return null;let n={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:r,sy:i,tx:a,ty:s}=zt(o,n),[l]=(0,Xc.getStraightPath)({sourceX:r,sourceY:i,targetX:a||e,targetY:s||t});return(0,Fn.jsxs)("g",{children:[(0,Fn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:l}),(0,Fn.jsx)("circle",{cx:a||e,cy:s||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var fi=require("@xyflow/react"),qc=require("lodash"),Wn=require("react");var je=require("react/jsx-runtime"),Zc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,fi.useReactFlow)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=W(),[u,p]=(0,Wn.useState)(!1),m=a(),h=!r,g=(0,Wn.useMemo)(()=>(0,qc.orderBy)([...m.filter(_=>_.parentId===e&&_.type==="LANE")],"position.y","asc"),[m,e]),f=h?ri.MIN_WIDTH:be.MIN_WIDTH,x=(0,Wn.useMemo)(()=>{if(h&&g.length>1){let _=[...g];return _.pop(),_.reduce((P,H)=>{var C,I;return P+((I=(C=H.measured)==null?void 0:C.height)!=null?I:0)},0)+be.MIN_HEIGHT}return be.MIN_HEIGHT},[h,g]),y=_=>{i(e,{label:_})},b=()=>{p(!0)},N=()=>{p(!1)},T=!l&&!c&&!d;return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsxs)("div",{className:k("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,je.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:N,onDoubleClick:b,children:(0,je.jsx)("div",{className:k("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!u}),children:(0,je.jsx)(He,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:k({"whitespace-nowrap":u}),isEditing:u,onChange:y})})}),(0,je.jsx)("div",{className:"flex-1"})]}),T&&(0,je.jsx)(Ue,{nodeId:e,nodeType:"LANE",isChild:!h,isVisible:!n&&o}),s==="edit"&&(0,je.jsx)(Zo,{nodeId:e,minWidth:f,minHeight:x,isVisible:!n&&o}),h&&(0,je.jsx)(se,{type:"source",position:fi.Position.Right})]})};var Jc={START_EVENT:Gc,END_EVENT:Dc,TASK:Yc,GATEWAY:Rc,ANNOTATION:Lc,LANE:Zc,UNSUPPORTED:Uc},Qc={SEQUENCE_EDGE:Ql,MESSAGE_EDGE:$c,ANNOTATION_EDGE:Xl},jc="#fafafa",ed="#bebebe",td=1,od=10,nd="bottom-left",rd=.2,id=5,en=.5,tn=.4,on=1,sd={x:0,y:0,zoom:.75},Fm=1,Wm=2,ad=[Fm,Wm];var ld=require("@xyflow/react");var at=()=>{let{getEdges:e,getNodes:t}=(0,ld.useReactFlow)(),{lastElementId:o}=W(),n=()=>{let i=t(),a=e(),s=_c(i,a);return Math.max(s,o)};return{getLastId:n,getNextId:()=>n()+1}};var nn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,cd.useReactFlow)(),{getLastId:i}=at(),{setLastElementId:a}=W(),s=(0,as.useCallback)(async(c="")=>{let{nodes:d,edges:u,lastElementId:p}=await Nc(c);o(d),n(u),a(p),r({padding:en,minZoom:tn,maxZoom:on})},[o,n,a,r]),l=(0,as.useCallback)((c,d)=>{let u=c||e()||[],p=d||t()||[],m=i();return Tc(u,p,m)},[e,t,i]);return{importFromMxGraph:s,exportToMxGraph:l}};var ls=require("react"),Ym=500,mi=()=>{let{isInitialized:e,onElementChanges:t}=W(),{exportToMxGraph:o}=nn(),n=(0,dd.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},Ym),r=(0,ls.useCallback)(a=>{a.every(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,ls.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var ud=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,gi.useReactFlow)(),{emitElementChanges:r}=mi(),i=(0,Nt.useRef)(null),{getNextId:a}=at(),s=(0,Nt.useCallback)(h=>{var b;let g=t(h.source),f=t(h.target);if(!g||!f)return!1;let x={sourceNodeId:g.id,targetNodeId:f.id,sourceNodeType:g.type,targetNodeType:f.type,nodes:n(),edges:o(),reconnectingEdgeId:(b=i.current)!=null?b:void 0};return Zi(x).isValid},[t,o,n]),l=(0,Nt.useCallback)(h=>{let g=a(),f=t(h.target),x=(f==null?void 0:f.type)==="ANNOTATION"?Yo:pt,y=v(E(E({},h),x),{id:String(g)});e(b=>b.concat(y)),r()},[t,a,e,r]),c=(0,Nt.useCallback)((h,g)=>{i.current=g.id},[]),d=(0,Nt.useCallback)(()=>{i.current=null},[]),u=(0,Nt.useCallback)((h,g)=>{let f=t(g.source),x=t(g.target);if(!f||!x){i.current=null;return}let y={sourceNodeId:f.id,targetNodeId:x.id,sourceNodeType:f.type,targetNodeType:x.type,nodes:n(),edges:o(),reconnectingEdgeId:h.id};if(!Zi(y).isValid){i.current=null;return}e(N=>(0,gi.reconnectEdge)(h,g,N).map(_=>_.id===h.id?v(E({},_),{data:v(E({},_.data),{points:void 0})}):_)),i.current=null,r()},[t,n,o,e,r]),p=(0,Nt.useCallback)(h=>{i.current=h},[]),m=(0,Nt.useCallback)(()=>{i.current=null},[]);return{isValidConnection:s,onConnect:l,onReconnect:u,onReconnectStart:c,onReconnectEnd:d,setReconnectingEdge:p,clearReconnectingEdge:m}};var bd=require("@xyflow/react"),yi=require("lecom-ui"),mt=require("react");var Yn=(e=[])=>e.filter(t=>t.type==="START_EVENT"),xo=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ut=(e=[])=>e.filter(t=>t.type==="TASK")||[],pd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),fd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),hi=(e=[])=>e.filter(t=>t.type==="GATEWAY"),md=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),et=(e,t=[])=>t.filter(o=>o.source===e),Un=(e,t=[])=>t.filter(o=>o.target===e),gd=(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=et(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},yd=e=>e?/\w/g.test(e.trim()):!1,ue=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:[]}},vt=(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)}},xd=(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 $n=[{id:"start_event_not_found",validate:e=>{let t=Yn(e.nodes);return ue({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=xo(e.nodes);return ue({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Yn(e.nodes),o=t.length===1;if(t.length===0)return ue({isValid:!0});if(!o)return ue({isValid:!1,nodeIds:t.map(i=>i.id)});let n=et(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return ue({isValid:!1,nodeIds:[...new Set(i)]})}return ue({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ut(e.nodes),o=vt(t,n=>et(n.id,e.edges).length<=2);return ue({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ut(e.nodes),o=vt(t,n=>!!n.label&&n.label.trim()!=="");return ue({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ut(e.nodes),n=vt(o,r=>!r.label||r.label.length<=60);return ue({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ut(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 ue({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=hi(e.nodes),o=[],n=[];for(let r of t){let i=et(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return ue({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Yn(e.nodes),...xo(e.nodes)],o=[],n=[];for(let r of t){let i=et(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(r.id,s.id),n.push(a.id))}}return ue({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=xo(e.nodes),o=[],n=[];for(let r of t){let i=Un(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=et(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return ue({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=md(e.nodes),o=vt(t,r=>et(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>et(r,e.edges).map(i=>i.id));return ue({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=Ut(e.nodes),o=vt(t,n=>!n.label||yd(n.label));return ue({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return ue({isValid:!0});let t=xo(e.nodes)[0];if(!t)return ue({isValid:!0});let o=Un(t.id,e.edges);if(!o.length)return ue({isValid:!0});let r=Ut(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=vt(r,l=>!gd(l.id,e));return ue({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ut(e.nodes),o=xo(e.nodes)[0];if(!o)return ue({isValid:!0});let n=t.filter(l=>{let c=Un(l.id,e.edges),d=et(l.id,e.edges),u=c.some(m=>{var h;return((h=e.nodes.find(g=>g.id===m.source))==null?void 0:h.type)==="START_EVENT"}),p=d.some(m=>{var h;return((h=e.nodes.find(g=>g.id===m.target))==null?void 0:h.type)==="END_EVENT"});return u&&p}),r=Un(o.id,e.edges),i=r.length>1,a=r.map(l=>l.source),s={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?a:[]]};return ue(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=hi(e.nodes),o=[],n=[];for(let r of t){let i=et(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(r.id,s.id),n.push(a.id))}}return ue({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=hi(e.nodes),o=vt(t,n=>et(n.id,e.edges).length>=1);return ue({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Yn(e.nodes),...xo(e.nodes)],o=[],n=[];for(let r of t){let i=et(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return ue({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=pd(e.nodes),o=vt(t,n=>!hd(n.id,e));return ue({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=fd(e.nodes),o=vt(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 ue({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Ed=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of $n){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 Eo=require("react/jsx-runtime"),_d=()=>{let{t:e}=(0,yi.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,bd.useReactFlow)(),[i,a]=(0,mt.useState)(!1),s=(0,mt.useRef)(!1),l=(0,mt.useRef)(!1),c=(0,mt.useCallback)(h=>{let g=xd(h.nodes,h.edges),f=Ed(g),x=f.errors.map(y=>v(E({},y),{message:e(`validation.errors.${y.id}`)}));return i||a(!0),{isValid:f.isValid,errors:x}},[i,e]),d=(0,mt.useCallback)((h,g=!0)=>{if(g&&h&&(0,yi.toast)({variant:h.isValid?"success":"error",duration:5e3,title:h.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,Eo.jsxs)("div",{className:"flex flex-col gap-1",children:[!h.isValid&&(0,Eo.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,Eo.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:h.isValid?(0,Eo.jsx)("li",{children:e("validation.success.message")}):h.errors.map(C=>(0,Eo.jsx)("li",{className:"text-xs",children:C.message},C.id))})]})}),!h)return;s.current=!0,l.current=!0;let f=[],x=[];h.errors.forEach(C=>{C.nodeIds&&C.nodeIds.length>0&&C.nodeIds.forEach(I=>f.push(I)),C.edgeIds&&C.edgeIds.length>0&&C.edgeIds.forEach(I=>x.push(I))});let y=[...new Set(f)];t(C=>C.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:!1})}))),o(C=>C.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:!1})})));let b=n(),N=r(),T=new Set(y),_=new Set;h.errors.forEach(C=>{var G,M;let I=$n.find(S=>S.id===C.id);(I==null?void 0:I.highlightRelatedEdges)!==!1&&((G=C.edgeIds)==null||G.forEach(S=>_.add(S)),(M=C.nodeIds)==null||M.forEach(S=>{N.forEach(D=>{(D.source===S||D.target===S)&&_.add(D.id)})}))});let w=new Set,P=new Set,H=new Set;b.forEach(C=>{C.type==="START_EVENT"?w.add(C.id):C.type==="END_EVENT"&&P.add(C.id)}),N.forEach(C=>{w.has(C.source)&&H.add(C.target),P.has(C.target)&&H.add(C.source)}),H.forEach(C=>{var I,L;if(T.has(C)){let G=(I=h.errors.find(S=>{var D;return(D=S.nodeIds)==null?void 0:D.includes(C)}))==null?void 0:I.id;((L=$n.find(S=>S.id===G))==null?void 0:L.highlightRelatedEdges)!==!1&&N.forEach(S=>{S.source===C&&P.has(S.target)&&(T.add(S.target),_.add(S.id)),S.target===C&&w.has(S.source)&&(T.add(S.source),_.add(S.id))})}}),T.size>0&&t(C=>C.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:T.has(I.id)})}))),_.size>0&&o(C=>C.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:_.has(I.id)})}))),setTimeout(()=>{s.current=!1},0)},[e,r,n,o,t]),u=(0,mt.useCallback)(()=>{a(!1),l.current=!1,t(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),o(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})})))},[o,t]),p=(0,mt.useCallback)(()=>{l.current&&(s.current=!0,l.current=!1,t(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),o(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),setTimeout(()=>{s.current=!1},0))},[o,t]),m=(0,mt.useCallback)(()=>s.current,[]);return{validateDiagram:c,handleValidationComplete:d,clearValidation:u,dismissValidationPanel:p,isAutoValidationEnabled:i,getIsClearingValidation:m}};var vd=require("@xyflow/react"),wd=require("lecom-ui"),Id=require("react");var Um=15,Td="bpmn:selection",$m=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},Nd=e=>{if(!$m(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},Ad=({offset:e=Um}={})=>{let{t}=(0,wd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,vd.useReactFlow)(),{getNextId:a}=at();(0,Id.useEffect)(()=>{let s=c=>{var f,x;if(!Nd(c))return;let d=o(),u=r(),p=d.filter(y=>y.selected);if(!p.length)return;c.preventDefault(),c.stopPropagation();let m=u.filter(y=>p.some(b=>b.id===y.source)&&p.some(b=>b.id===y.target)),g=JSON.stringify({nodes:p,edges:m});(f=c.clipboardData)==null||f.setData(Td,g),(x=c.clipboardData)==null||x.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},l=c=>{var T,_;if(!Nd(c))return;let d=(T=c.clipboardData)==null?void 0:T.getData(Td);if(!d)return;c.preventDefault(),c.stopPropagation();let u;try{u=JSON.parse(d)}catch(w){return}if(!((_=u.nodes)!=null&&_.length))return;let p=new Map,m=o(),h=[],g=m.some(w=>w.type==="START_EVENT"),f=u.nodes.filter(w=>w.type==="START_EVENT"),x=u.nodes;if(g&&f.length>0&&(x=u.nodes.filter(w=>w.type!=="START_EVENT"),x.length===0))return;let y=a(),b=x.map(w=>{var C;let P=String(y++);p.set(w.id,P);let H=v(E({},w),{id:P,selected:!0,position:{x:w.position.x+e,y:w.position.y+e}});if(w.type==="TASK"){let I=(C=w.data)==null?void 0:C.label,L=jo(I||t("bpmn.task.label.prefix"),[...m,...h]);H.data=v(E({},w.data),{label:L})}return h.push(H),H}),N=u.edges.map(w=>v(E({},w),{id:String(y++),selected:!0,source:p.get(w.source)||w.source,target:p.get(w.target)||w.target}));n(w=>[...w.map(P=>v(E({},P),{selected:!1})),...b]),i(w=>[...w.map(P=>v(E({},P),{selected:!1})),...N])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",l,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",l,!0)}},[o,n,r,i,a,e,t])};var xi=require("@xyflow/react");var Cd=require("lecom-ui"),Sd=require("react");var Md=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,xi.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=Jo(),{t:a}=(0,Cd.useTranslation)(),{getInternalNode:s,screenToFlowPosition:l}=(0,xi.useReactFlow)(),{getNextId:c}=at(),{setIsDragging:d}=W(),{rebuildIndex:u,forceRebuildIndex:p}=Gr(),[m,h]=(0,Sd.useState)(null),g=(I,L=!1)=>{let G=L?"[&>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(M=>M.map(S=>v(E({},S),{className:S.id===I?G:""})))},f=()=>{let{nodeLookup:I}=n.getState();return Array.from(I.values())},x=I=>{let L=s(I.id),G=f();if(I.type==="LANE"){if(qo({parentId:I.id,nodes:e,includeTypes:["LANE"]})){g();return}let ie=G.filter(Y=>Y.id!==I.id&&Y.type==="LANE"&&!Y.parentId),A=Dn(L,ie);if(!A){g();return}if(qo({parentId:A.id,nodes:e,excludeTypes:["LANE"]})){g(A.id,!0);return}g(A.id);return}let S=G.filter(z=>z.id!==I.id&&z.type==="LANE"),D=Dn(L,S);if(!D){g();return}if(qo({parentId:D.id,nodes:e,includeTypes:["LANE"]})){g();return}g(D.id)},y=I=>I.map(L=>v(E({},L),{className:void 0})),b=I=>I.some(G=>G.dragging)?I.map(G=>G.dragging?v(E({},G),{dragging:!1}):G):I,N=I=>{I.preventDefault(),I.dataTransfer.dropEffect="move"},T=(I,L)=>{I.preventDefault(),x(L)},_=(I,L,G)=>{var z,ie;let M=[...G];if(I.parentId===L.id)return M=yc(I,L,M),M=Rn(M),y(M);if(I.type==="LANE"){if(qo({parentId:L.id,nodes:M,excludeTypes:["LANE"]})){let X=Xe(L),K=50,oe=50;return M.map(O=>{var U,$;return O.id===I.id?v(E({},O),{position:{x:(U=m==null?void 0:m.x)!=null?U:X.x+K,y:($=m==null?void 0:m.y)!=null?$:X.y2+oe}}):O})}let Y=M.filter(X=>X.parentId===L.id).reduce((X,K)=>{var oe,O;return X+((O=(oe=K.measured)==null?void 0:oe.height)!=null?O:0)},0),B={x:be.HEADER_WIDTH,y:Y};return M=M.map(X=>X.id===I.id?v(E({},X),{parentId:L.id,position:B,className:void 0}):v(E({},X),{className:void 0})),M=On(L.id,M),M}if(qo({parentId:L.id,nodes:M,includeTypes:["LANE"]})){let A;if(I.parentId){let R=s(I.parentId),{x:Y,y:B}=Pt(R);A={x:Y+((z=I.position.x)!=null?z:0),y:B+((ie=I.position.y)!=null?ie:0)}}return M=M.map(R=>R.id===I.id?v(E({},R),{position:A!=null?A:R.position,parentId:void 0,className:void 0}):v(E({},R),{className:void 0})),M}let q=pc(I,L);return M=M.map(A=>{if(A.id===I.id){let R=Xe(I),Y=Xe(L);return R.y<Y.y&&(q.y=0),R.x<Y.x+be.HEADER_WIDTH&&(q.x=be.HEADER_WIDTH),v(E({},A),{parentId:L.id,position:q,className:void 0})}return v(E({},A),{className:void 0})}),M=Rn(M),M},w=I=>{if(I.preventDefault(),!(r!=null&&r.type))return;let L=l({x:I.clientX,y:I.clientY}),G={width:te[r.type].MIN_WIDTH,height:te[r.type].MIN_HEIGHT},M=c(),S={id:String(M),type:r.type,position:L,measured:G,data:{label:r.type==="TASK"?ui(e,a("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},D=v(E({},S),{internals:{positionAbsolute:L}}),q=f(),z=r.type==="LANE",ie=q.filter(B=>z?B.type==="LANE"&&!B.parentId:B.type==="LANE"),A=Dn(D,ie),R=[...e.map(B=>v(E({},B),{selected:!1})),S];A&&(R=_(D,A,R)),R=mo(R),t(R),p();let Y=I.dataTransfer.getData("sourceId");if(Y){let B={id:String(M+1),source:Y,target:S.id};if(r.type==="ANNOTATION"){o(X=>X.concat(E(E({},B),Yo)));return}o(X=>X.concat(E(E({},B),pt)))}d(!1),i(null)},P=async(I,L,G)=>{let M=[...e];G.forEach(S=>{let D=f(),q=s(S.id),z=S.type==="LANE",ie=D.filter(R=>R.id!==S.id&&(z?R.type==="LANE"&&!R.parentId:R.type==="LANE")),A=Dn(q,ie);if(A){M=_(q,A,M);return}S.parentId&&(M=C(S,M))}),M=b(M),M=mo(M),M=y(M),t(M),u(M),h(null)},H=(I,L)=>{h({x:L.position.x,y:L.position.y})},C=(I,L)=>{var q,z;let G=s(I.parentId),{x:M,y:S}=Pt(G),D={x:M+((q=I.position.x)!=null?q:0),y:S+((z=I.position.y)!=null?z:0)};return L=L.map(ie=>ie.id===I.id?v(E({},ie),{position:D,parentId:void 0}):ie),L=On(I.parentId,L),L};return{onDragOver:N,onDrop:w,onNodeDrag:T,onNodeDragStart:H,onNodeDragStop:P}};var Pd=require("@xyflow/react"),Ld=require("lecom-ui"),kd=require("react");var Xm=30,Km=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},qm=e=>!Km(e.target),Dd=({offset:e=Xm}={})=>{let{t}=(0,Ld.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,Pd.useReactFlow)(),{getNextId:a}=at();(0,kd.useEffect)(()=>{let s=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&qm(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),u=c.filter(T=>T.selected);if(!u.length)return;let p=new Map,m=[],h=c.some(T=>T.type==="START_EVENT"),g=u.filter(T=>T.type==="START_EVENT"),f=u;if(h&&g.length>0&&(f=u.filter(T=>T.type!=="START_EVENT"),f.length===0))return;let x=d.filter(T=>f.some(_=>_.id===T.source)&&f.some(_=>_.id===T.target)),y=a(),b=f.map(T=>{var P;let _=String(y++);p.set(T.id,_);let w=v(E({},T),{id:_,selected:!0,position:{x:T.position.x+e,y:T.position.y+e}});if(T.type==="TASK"){let H=(P=T.data)==null?void 0:P.label,C=jo(H||t("bpmn.task.label.prefix"),[...c,...m]);w.data=v(E({},T.data),{label:C})}return m.push(w),w}),N=x.map(T=>v(E({},T),{id:String(y++),selected:!0,source:p.get(T.source)||T.source,target:p.get(T.target)||T.target}));n(T=>[...T.map(_=>v(E({},_),{selected:!1})),...b]),i(T=>[...T.map(_=>v(E({},_),{selected:!1})),...N])}};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[o,n,r,i,a,e,t])};var Gd=require("@xyflow/react");var Od={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Vd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Rd=(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)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a||(a="task",s=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},Zm=e=>{e=e||"";let t=e.trim().split(`
36
- `),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 a=Rd(i[0],o),s=Rd(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},Hd=e=>{let{components:t,connections:o}=Zm(e);return{nodes:t,edges:o}};var Bd=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Gd.useReactFlow)(),{getNextId:n}=at();return{importFromLia:i=>{let a=typeof i=="string"?i:i.diagramXml||"",{nodes:s,edges:l}=Hd(a),c=[],d=new Map,u=!1,p=n();for(let[f,x]of Object.entries(s)){let y=String(p++),b=Od[x.type],N=Vd[x.type];b==="START_EVENT"&&(u=!0),d.set(f,y);let T=te[b].MIN_WIDTH,_=te[b].MIN_HEIGHT;c.push({id:y,type:b,data:{label:x.label||"",variant:N,attribute:""},position:{x:0,y:0},width:T,height:_,measured:{width:T,height:_}})}let m=[];for(let f of l){let x=v(E({},pt),{id:String(p++),source:d.get(f.sourceId)||f.sourceId,target:d.get(f.targetId)||f.targetId});m.push(x)}if(!u&&c.length>0){let f=String(p++),x={id:f,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(x);let y=c[1];if(y){let b=v(E({},pt),{id:String(p++),source:f,target:y.id});m.unshift(b)}}let{nodes:h,edges:g}=hc(c,m);e(h),t(g),o({padding:en,minZoom:tn,maxZoom:on})}}};var Ei=require("react"),Jm={origin:"*",debug:!1};function zd(e,t=Jm){let{origin:o,debug:n}=t,r=(0,Ei.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,Ei.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||(s==null?void 0:s.data)===void 0)return;let{event:l,data:c}=s,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",s),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 Fd=require("@xyflow/react"),cs=require("react");var Wd=()=>{let e=(0,Fd.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=W(),{importFromMxGraph:n}=nn();(0,cs.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,cs.useEffect)(()=>{if(!e)return;(async()=>{await nr(),o(!0)})()},[e,o])};var ds=require("react"),Yd=require("@xyflow/react");function Ud(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=oo(),{getEdges:n}=(0,Yd.useReactFlow)(),r=lr(),i=(0,ds.useCallback)(s=>{if(!(s!=null&&s.activities))return;e(s.activities);let l=s.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),a=(0,ds.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var Kd=require("@xyflow/react"),lt=require("react"),qd=require("use-debounce");var $d=[{nodes:[],edges:[]}],Qm=500,Xd=100,Zd=(e=$d)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Kd.useReactFlow)(),[i,a]=(0,lt.useState)(e),[s,l]=(0,lt.useState)(0),c=i[s],d=s>0,u=s<i.length-1,p=(0,lt.useCallback)(N=>{n(i[N].nodes),r(i[N].edges)},[i,n,r]),m=(0,lt.useCallback)(()=>{if(s>0){let N=s-1;l(N),p(N)}},[s,p]),h=(0,lt.useCallback)(()=>{if(s<i.length-1){let N=s+1;l(N),p(N)}},[i,s,p]),g=N=>{let _=[...i.slice(0,s+1),N],w=_.length>Xd?_.slice(_.length-Xd):_;a(w),l(w.length-1)},f=(0,qd.useDebouncedCallback)(()=>{let N=t(),T=o(),_=N.map(H=>v(E({},H),{selected:!1,className:""})),w={nodes:mo(_),edges:T};JSON.stringify(c)!==JSON.stringify(w)&&g(w)},Qm),x=(0,lt.useCallback)(N=>{if(N==="forceSave"){f();return}N.some(w=>w.type==="select")||N.some(w=>w.type==="position"&&w.dragging)||f()},[f]),y=(0,lt.useCallback)(N=>{a(N||$d),l(0)},[]),b=(0,lt.useCallback)(()=>{a([]),l(0)},[]);return(0,lt.useEffect)(()=>{let N=T=>{(T.ctrlKey||T.metaKey)&&(T.shiftKey&&T.key.toLowerCase()==="z"?(T.preventDefault(),h()):T.key.toLowerCase()==="z"&&(T.preventDefault(),m()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N)}},[m,h]),{history:i,undo:m,redo:h,canUndo:d,canRedo:u,saveHistory:x,resetHistory:y,clearHistory:b}};var Jd=()=>{let[e,t,o]=(0,$t.useNodesState)([]),[n,r,i]=(0,$t.useEdgesState)([]),{getNode:a}=(0,$t.useReactFlow)(),{instanceId:s,setIsConnecting:l,setIsMultipleSelection:c,onElementClick:d}=W(),{updateHelperLines:u,HelperLines:p}=Gr(),{undo:m,redo:h,canUndo:g,canRedo:f,saveHistory:x}=Zd(),{onNodeDrag:y,onDrop:b,onDragOver:N,onNodeDragStop:T,onNodeDragStart:_}=Md({nodes:e,setNodes:t,setEdges:r}),{isValidConnection:w,onConnect:P,onReconnect:H,onReconnectStart:C,onReconnectEnd:I,setReconnectingEdge:L,clearReconnectingEdge:G}=ud({setEdges:r}),{handleValidationComplete:M,clearValidation:S,dismissValidationPanel:D,validateDiagram:q,getIsClearingValidation:z}=_d(),{importFromLia:ie}=Bd(),{handleTasksStatus:A,handleClearTaskStatus:R}=Ud(),{clearPathEdges:Y}=oo(),B=lr(),{emitElementChanges:X,handleNodeChanges:K,handleEdgeChanges:oe}=mi();Ad(),Dd(),Wd();let O=(0,kt.useCallback)(()=>{t([]),r([]),Y(),setTimeout(()=>{B()},0)},[t,r,Y,B]);zd({LIA_CREATE_DIAGRAM:ie,CLEAR_DIAGRAM:O,TASKS_STATUS:A,CLEAR_TASKS_STATUS:R});let{selectElements:U,clearSelection:$}=Ft(),{importFromMxGraph:F,exportToMxGraph:V}=nn(),{configureElement:J,getConfigureElement:Z}=qr(),ae=(0,kt.useCallback)(()=>e.length+n.length,[e,n]);(0,kt.useEffect)(()=>(_t.set(s,{importFromMxGraph:F,exportToMxGraph:V,selectElements:U,clearSelection:$,configureElement:J,getConfigureElement:Z,getElementsCount:ae,setReconnectingEdge:L,clearReconnectingEdge:G}),()=>{_t.delete(s)}),[s,F,V,U,$,J,Z,ae,L,G]);let Ie=(0,kt.useCallback)((ee,Q)=>{if(Q.type!=="TASK"&&Q.type!=="GATEWAY")return;let Re=Z(Q.id);Re&&(d==null||d(Re))},[Z,d]),ge=(0,kt.useCallback)((ee,Q)=>{if(Q.type!=="SEQUENCE_EDGE")return;let Re=a(Q.source),ct=a(Q.target),{isFromStartEvent:Jt,isGatewayToGateway:Qt,isActiviyToAndGateway:jt}=Kr(Re,ct);if(!(!Jt&&!Qt&&!jt))return;let cn=Z(Q.id);cn&&(d==null||d(cn))},[Z,d]),Ee=(0,kt.useCallback)(ee=>{let Q=u(ee,e);o(Q),x(ee),z()||D(),K(ee)},[e,o,x,z,D,u,K]),ke=(0,kt.useCallback)(ee=>{i(ee),x(ee),z()||D(),oe(ee)},[i,x,z,D,oe]);return(0,$t.useOnSelectionChange)({onChange:({nodes:ee,edges:Q})=>{c(ee.length+Q.length>1)}}),{nodes:e,setNodes:t,edges:n,setEdges:r,events:{isValidConnection:w,onConnect:P,onReconnect:H,onReconnectStart:C,onReconnectEnd:I,onDrop:b,onDragOver:N,onNodeDrag:y,onNodeDragStop:T,onNodeDragStart:_,onNodeClick:Ie,onEdgeClick:ge,onDropCapture:()=>{x("forceSave"),X(),D()},onConnectStart:()=>{l(!0)},onConnectEnd:()=>{l(!1),D()},onNodesChange:Ee,onEdgesChange:ke},ui:{handleCloseValidationPanel:S},controls:{undo:m,redo:h,canUndo:g,canRedo:f},components:{HelperLines:p},actions:{saveHistory:x,selectElements:U,clearSelection:$,exportToMxGraph:V,validateDiagram:q,handleValidationComplete:M,setReconnectingEdge:L,clearReconnectingEdge:G}}};var us=require("react/jsx-runtime"),ps=({id:e,className:t})=>(0,us.jsx)("marker",{id:e,className:k("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,us.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var rn=require("react/jsx-runtime"),Qd=()=>(0,rn.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,rn.jsxs)("defs",{children:[(0,rn.jsx)(ps,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,rn.jsx)(ps,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var qn=require("@xyflow/react"),Ne=require("lecom-ui"),Kt=require("lucide-react"),No=require("react");var wt=require("lecom-ui");var Xn=(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))(Xn||{});var lu=require("@xyflow/react"),sn=require("lecom-ui");var jd=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 eu({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
37
- `),i=encodeURI(r);bi(i,`${o}.csv`)}var bi=(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 tu(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"},ou={script:"SCRIPT",subprocess:"SUBPROCESS"},nu={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var bo=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i,parent:a}=n,s=Number(r._attributes.width),l=Number(r._attributes.height),c=a==="1"?void 0:a;return{id:n.id,parentId:c,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x)||0,y:Number(r._attributes.y)||0},width:s,height:l,measured:{width:s,height:l}}},eg=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:bo({cell:e,type:"START_EVENT"}),status:n,originalType:o}},tg=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:bo({cell:e,type:"END_EVENT"}),status:n,originalType:o}},og=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=ou[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Rt(e.mxGeometry._attributes.width||0,te.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Rt(e.mxGeometry._attributes.height||0,te.TASK.MIN_HEIGHT),{node:bo({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},ng=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=nu[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:bo({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},rg=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:bo({cell:e,type:"LANE"}),status:"imported",originalType:t}},ig=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Rt(e.mxGeometry._attributes.width||0,te.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Rt(e.mxGeometry._attributes.height||0,te.ANNOTATION.MIN_HEIGHT),{node:bo({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},ru=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:bo({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},iu=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(E({},pt),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},su={TASK:og,GATEWAY:ng,START_EVENT:eg,END_EVENT:tg,LANE:rg,ANNOTATION:ig};var sg=e=>{let t=new Map,o=Object.values(Xn),n=e.filter(a=>{var l;let s=(l=a._attributes)==null?void 0:l.type;return o.includes(s)}),r=[],i=[];for(let a of n){let{type:s}=a._attributes,l=su[s]||ru,{node:c,status:d,originalType:u}=l(a);i.push(c),r.push({originalType:u,type:c.type,variant:c.data.variant,value:tu(c.data.label),status:d})}return{nodes:i,governanceIdToNodeIdMap:t,summary:r}},ag=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>iu(r,t)),lg=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=sg(t.root.mxCell),i=ag(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},cg=async e=>{let t=await jd(e),o=oi(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),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},au=async e=>{try{let t=await cg(e),{nodes:o,edges:n,summary:r}=lg(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var du=require("react/jsx-runtime"),cu=()=>{let{t:e}=(0,sn.useTranslation)(),{toast:t}=(0,sn.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,lu.useReactFlow)(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.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,du.jsx)(sn.Button,{size:"small",variant:"ghost",onClick:()=>eu({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async s=>{try{let{nodes:l,edges:c,summary:d}=await au(s);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r({padding:en,minZoom:tn,maxZoom:on}),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 uu=require("lecom-ui"),pu=require("react");var _o=require("react/jsx-runtime"),fu=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=ht(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,pu.useRef)(null),d=p=>{let m=p.target.files;m!=null&&m.length&&i(m),c.current&&(c.current.value="")};return(0,_o.jsxs)(_o.Fragment,{children:[(0,_o.jsx)(uu.Button,v(E({onClick:p=>{var m;(m=c.current)==null||m.click(),r==null||r(p)}},a),{children:e})),(0,_o.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var To=require("react/jsx-runtime"),mu=({disabled:e=!1})=>{let{t}=(0,wt.useTranslation)(),{toast:o}=(0,wt.useNotificationToast)(),{importFromGovernance:n}=cu(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(s)};return(0,To.jsxs)(wt.Tooltip,{children:[(0,To.jsx)(wt.TooltipTrigger,{asChild:!0,children:(0,To.jsx)(fu,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,To.jsx)(As,{})})}),(0,To.jsx)(wt.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var gu=require("react/jsx-runtime"),fs=({shortcut:e})=>(0,gu.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 de=require("lecom-ui"),Xt=require("lucide-react"),Eu=require("react");var hu=require("@xyflow/react"),Kn=require("html-to-image"),_i=require("lecom-ui"),yu=require("react");var dg=3,ms="diagram",xu=()=>{let{t:e}=(0,_i.useTranslation)(),{getNodes:t}=(0,hu.useReactFlow)(),{clearSelection:o}=Ft(),[n,r]=(0,yu.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:d,y:u,width:p,height:m}=Ec(t());return{width:p,height:m,style:{width:`${p}px`,height:`${m}px`,transform:`translate(${-d}px, ${-u}px)`}}},a=async(d,u)=>{r(v(E({},n),{[u]:!0})),await o();try{let p=xc();if(!p)throw new Error("Flow element not found");let m=i();return await d(p,m)}catch(p){(0,_i.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(v(E({},n),{[u]:!1}))}};return{exportAsPng:async(d=ms)=>{await a(async(u,p)=>{let m=await(0,Kn.toPng)(u,v(E({},p),{backgroundColor:"#fcfcfc"}));bi(m,`${d}.png`)},"png")},exportAsHtml:async(d=ms)=>{await a(async(u,p)=>{let m=await(0,Kn.toSvg)(u,v(E({},p),{backgroundColor:"#fcfcfc"})),h=`
35
+ </mxGraphModel>`,vc=(e,t)=>{if(!e.length&&!t.length)return Gn;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var Rm=e=>{let t=Object.values(Rn),o=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return t.includes(a)}),n=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return["attribute-loop"].includes(a)}),r=[];for(let i of o){let{style:a}=i._attributes,s=cc[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},Om=(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=dc(r),a=t.find(l=>l.id===i.source),s=t.find(l=>l.id===i.target);(a==null?void 0:a.type)==="LANE"||(s==null?void 0:s.type)==="LANE"||n.push(i)}return n},Vm=(e,t)=>{let o=[];return e.forEach(n=>{var a,s;let r=(s=(a=pc)[n.type])==null?void 0:s.call(a,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=fc(n,t);o.push(l)}}),o},Hm=(e,t)=>{let o=[];return e.forEach(n=>{let r=uc(n,t);o.push(r)}),o},wc=(e=[],t=[],o)=>{let n=Vm(e,o),r=Hm(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})},Ac=async e=>{var s,l,c,d,u;let t=await oi(e),o=((l=(s=t==null?void 0:t.mxGraphModel)==null?void 0:s.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)||Gn),r=Rm(o),i=Om(o,r);return{nodes:yo(Vn(r)),edges:i,lastElementId:n}};var bo=require("@xyflow/react");var Bn=require("@xyflow/react");var rs=require("react/jsx-runtime"),ie=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=ht(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,rs.jsx)(Bn.Handle,E({type:e,position:t,className:k("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!s},o)},r))},ze=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=ht(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,Bn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let m=c();if(t==="TASK")return m.filter(g=>g.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return m.filter(g=>g.source===e).length>=2;if(t==="START_EVENT"){let h=d();return m.filter(f=>{if(f.source!==e)return!1;let x=h.find(y=>y.id===f.target);return(x==null?void 0:x.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,rs.jsx)(Bn.Handle,E({type:n,position:r,className:k("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"}},a))};var si=require("@xyflow/react"),Ic=require("lodash");var Cc=require("react/jsx-runtime"),Qo=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=ht(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,si.useReactFlow)(),{isMultipleSelection:l}=W(),c=({width:u,height:p})=>{if(!e)return;let m=i(e);if((m==null?void 0:m.type)!=="LANE")return;let h=[...a()],g=!m.parentId,f=g?m.id:m.parentId,x=h.filter(T=>T.type==="LANE"&&T.parentId===f);if(!x.length)return;let y=(0,Ic.orderBy)(x,["position.y"]),b=0;y.forEach((T,N)=>{var P,H;let _=N===y.length-1,w=(H=(P=T.measured)==null?void 0:P.height)!=null?H:0;h=h.map(C=>{if(C.id===T.id){let A=g?u-Te.HEADER_WIDTH:u,L=v(E({},C),{width:A,measured:v(E({},C.measured),{width:A}),position:v(E({},C.position),{y:b})});return _&&g&&(L.height=p-b),L}return C}),b+=w}),h=h.map(T=>{if(T.id===f){let N=g?u:u+Te.HEADER_WIDTH;return v(E({},T),{width:N,height:g?p:b,measured:{width:N,height:g?p:b}})}return T}),s(h)};return(0,Cc.jsx)(si.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 ci=require("@xyflow/react"),Tt=require("lecom-ui"),Eo=require("react");var Sc=require("zustand"),jo=(0,Sc.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var ai=require("react"),Mc=(e,t=!1)=>{let[o,n]=(0,ai.useState)({width:0,height:0});return(0,ai.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var Yt=require("@xyflow/react"),Pc=require("react"),Gm=120,Bm=12,Lc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,Yt.useReactFlow)(),{instanceId:i}=W();return(0,Pc.useMemo)(()=>{var m,h;if(!t)return{position:Yt.Position.Right,align:"start"};let a=n(e);if(!a)return{position:Yt.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((m=a.measured)==null?void 0:m.width)||a.width||100)*s.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:Yt.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||Gm;return{position:l+c+u+Bm>d?Yt.Position.Left:Yt.Position.Right}},[i,e,t,o,n,r])};var li=require("@xyflow/react"),le=require("lecom-ui"),kc=require("lucide-react");var ge=require("react/jsx-runtime"),Dc=({nodeId:e})=>{let{t}=(0,le.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,li.useReactFlow)(),i=(0,li.useNodesData)(e),s=n().filter(m=>m.source===e).some(m=>{let h=r(m.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,ge.jsxs)(le.DropdownMenu,{children:[(0,ge.jsxs)(le.Tooltip,{children:[(0,ge.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(le.DropdownMenuTrigger,{asChild:!0,children:(0,ge.jsx)(le.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ge.jsx)(kc.WrenchIcon,{})})})}),(0,ge.jsx)(le.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,ge.jsxs)(le.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ge.jsxs)(le.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,ge.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,ge.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(cr).map(([u,p])=>{let m=u==="LOOP"&&(s||l),g=(()=>{if(u==="LOOP"&&s)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,ge.jsxs)(le.Tooltip,{children:[(0,ge.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(le.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:m,className:k({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":m}),onClick:m?void 0:()=>d(u),children:(0,ge.jsx)(p.icon,{className:"stroke-inherit"})})}),g&&(0,ge.jsx)(le.TooltipContent,{color:"black",children:g})]},u)})})]}),(0,ge.jsx)(le.DropdownMenuGroup,{children:(0,ge.jsxs)(le.Tooltip,{children:[(0,ge.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,ge.jsxs)(le.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50 cursor-not-allowed":s}),disabled:s,onClick:s?void 0:()=>c("SCRIPT"),children:[(0,ge.jsx)(lr.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),s&&(0,ge.jsx)(le.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var xe=require("react/jsx-runtime"),xo={START_EVENT:{type:"START_EVENT",icon:mn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Io,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:mn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:rr,label:"bpmn.annotation.variant.default"}},zm={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Mo,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Lo,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:Co,label:"bpmn.gateway.variant.complex"}},$e=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,Eo.useRef)(null),a=(0,Eo.useRef)(null),{t:s}=(0,Tt.useTranslation)(),{setDraggableNode:l}=jo(),{getEdges:c,getNodes:d}=(0,ci.useReactFlow)(),{setIsDragging:u,mode:p}=W(),{dimensions:m}=Mc(i,r),{position:h}=Lc(e,r,m),[g,f]=(0,Eo.useState)(void 0),x=d(),y=c(),b=o==="SUBPROCESS",T=(0,Eo.useCallback)((S,D)=>{u(!1),l({type:D.type,variant:D.variant,attribute:D.attribute,icon:D.icon}),D.icon&&f((0,xe.jsx)(D.icon,{})),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("sourceId",e),a.current&&S.dataTransfer.setDragImage(a.current,10,10),setTimeout(()=>{u(!0)},100)},[e,l,u]),N=[{component:(0,xe.jsx)(Zr,{elementId:e})}],_=()=>{if(p==="view")return[];let S=!y.some(D=>{var Y;return D.source===e&&((Y=x.find(F=>F.id===D.target))==null?void 0:Y.type)!=="ANNOTATION"});return[{component:(0,xe.jsx)(Fo,{nodeId:e,disabled:!S,tooltipMessage:S?void 0:s("editor.toolbar.start_event_limit_reached")})},xo.TASK,xo.ANNOTATION,...N]},w=()=>p==="view"?[{component:(0,xe.jsx)(Wt,{elementId:e})}]:[{component:(0,xe.jsx)(Wt,{elementId:e})},...b?[]:[{component:(0,xe.jsx)(Dc,{nodeId:e})}],{component:(0,xe.jsx)(Fo,{nodeId:e})},xo.TASK,...Object.values(zm),...N],P=()=>p==="view"?[{component:(0,xe.jsx)(Wt,{elementId:e})}]:[{component:(0,xe.jsx)(Wt,{elementId:e})},{component:(0,xe.jsx)(Fo,{nodeId:e})},xo.TASK,xo.ANNOTATION,...N],H=()=>p==="view"?[]:[{component:(0,xe.jsx)(Fo,{nodeId:e})},xo.ANNOTATION,...N],C=()=>p==="view"?[]:[...n?[]:[xo.ANNOTATION],...N],A=()=>p==="view"?[]:[{component:(0,xe.jsx)(Fo,{nodeId:e})},...N],L=()=>p==="view"?[]:[...N],M=(S=>{switch(S){case"START_EVENT":return _();case"TASK":return w();case"GATEWAY":return P();case"END_EVENT":return H();case"LANE":return C();case"ANNOTATION":return A();case"UNSUPPORTED":return L();default:return[]}})(t);if(!(M.length===0||p==="readonly"))return(0,xe.jsxs)(ci.NodeToolbar,{position:h,align:"start",className:"-top-8",isVisible:r,children:[(0,xe.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:M.map((S,D)=>{if(S.component)return(0,xe.jsx)("div",{children:S.component},D);let Y={sourceNodeType:t,targetNodeType:S.type,sourceNodeId:e,nodes:x,edges:y},F=zl(Y),te={gateway_limit_reached:s("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:s("editor.toolbar.start_event_limit_reached"),start_event_already_exists:s("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:s("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:s("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:s("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:s("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:s("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:s("editor.toolbar.task_limit_reached")},I=F.shouldDisable&&F.reason?te[F.reason]||s(S.label):s(S.label)||"";return(0,xe.jsxs)(Tt.Tooltip,{children:[(0,xe.jsx)(Tt.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(Tt.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:O=>T(O,S),children:S.icon&&(0,xe.jsx)(S.icon,{size:16})})}),(0,xe.jsx)(Tt.TooltipContent,{color:"black",children:I})]},D)})}),(0,xe.jsx)("div",{ref:a,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:g})]})};var Ut=require("react/jsx-runtime"),Rc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,bo.useReactFlow)(),{inProgress:i,fromNode:a}=(0,bo.useConnection)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=W(),u=i&&(a==null?void 0:a.id)!==e,p=h=>{r(e,{label:h})},m=!l&&!c&&!d;return(0,Ut.jsxs)("div",{className:k("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-transparent 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,Ut.jsx)(He,{value:t.label,className:"m-1 text-grey-600",onChange:p}),(0,Ut.jsx)($e,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o&&m}),s==="edit"&&(0,Ut.jsx)(Qo,{minWidth:ii.MIN_WIDTH,minHeight:ii.MIN_HEIGHT,isVisible:!n&&o}),!i&&(0,Ut.jsx)(ie,{type:"source",position:bo.Position.Right}),(!i||u)&&(0,Ut.jsx)(ie,{type:"target",position:bo.Position.Left,className:k({"annotation-handle":u})})]})};var Ze=require("@xyflow/react"),Oc=require("react");var Ce=require("react/jsx-runtime"),Vc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ze.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Ze.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c,reconnectingEdgeId:d}=W(),[u,p]=(0,Oc.useState)(!1),m=i&&(a==null?void 0:a.id)!==e||!!d,h=y=>{r(e,{label:y})},g=()=>{p(!0)},f=()=>{p(!1)},x=!s&&!l&&!c;return(0,Ce.jsxs)("div",{className:"relative",onBlur:f,onDoubleClick:g,children:[(0,Ce.jsx)(Io,{className:k("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,Ce.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ce.jsx)(He,{value:t.label,isEditing:u,onChange:h})}),(0,Ce.jsx)($e,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o&&x}),(!i||m)&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(ie,{type:"target",position:Ze.Position.Left,id:"left",className:k({"event-handle":m})}),(0,Ce.jsx)(ie,{type:"target",position:Ze.Position.Right,id:"right",className:k({"event-handle":m})}),(0,Ce.jsx)(ie,{type:"target",position:Ze.Position.Top,id:"top",className:k({"event-handle":m})}),(0,Ce.jsx)(ie,{type:"target",position:Ze.Position.Bottom,id:"bottom",className:k({"event-handle":m})})]}),!i&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(ie,{type:"source",position:Ze.Position.Left,id:"left"}),(0,Ce.jsx)(ie,{type:"source",position:Ze.Position.Right,id:"right"}),(0,Ce.jsx)(ie,{type:"source",position:Ze.Position.Top,id:"top"}),(0,Ce.jsx)(ie,{type:"source",position:Ze.Position.Bottom,id:"bottom"})]})]})};var Je=require("@xyflow/react"),di=require("react");var Se=require("react/jsx-runtime"),Hc=({id:e,data:t,selected:o,dragging:n})=>{let r=Di[t.variant].icon,{updateNodeData:i}=(0,Je.useReactFlow)(),{inProgress:a,fromNode:s}=(0,Je.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d,reconnectingEdgeId:u}=W(),[p,m]=(0,di.useState)(!1),h=a&&(s==null?void 0:s.id)!==e||!!u,g=(0,di.useCallback)(b=>{i(e,{label:b})},[e,i]),f=()=>{m(!0)},x=()=>{m(!1)},y=!l&&!c&&!d;return(0,Se.jsxs)("div",{className:"relative",onBlur:x,onDoubleClick:f,children:[(0,Se.jsx)(r,{className:k("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,Se.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Se.jsx)(He,{value:t.label,isEditing:p,onChange:g})}),(0,Se.jsx)($e,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o&&y}),(!a||h)&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(ie,{type:"target",position:Je.Position.Left,id:"left",className:k({"gateway-handle":h})}),(0,Se.jsx)(ie,{type:"target",position:Je.Position.Right,id:"right",className:k({"gateway-handle":h})}),(0,Se.jsx)(ie,{type:"target",position:Je.Position.Top,id:"top",className:k({"gateway-handle":h})}),(0,Se.jsx)(ie,{type:"target",position:Je.Position.Bottom,id:"bottom",className:k({"gateway-handle":h})})]}),!a&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(ze,{type:"source",position:Je.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,Se.jsx)(ze,{type:"source",position:Je.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var Gc=require("@xyflow/react"),ft=require("lecom-ui"),Fm=require("lucide-react");var Bc=require("react/jsx-runtime");var Qe=require("@xyflow/react"),zc=require("react");var Me=require("react/jsx-runtime"),Fc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Qe.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Qe.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c,reconnectingEdgeId:d}=W(),[u,p]=(0,zc.useState)(!1),m=i&&(a==null?void 0:a.id)!==e||!!d,h=y=>{r(e,{label:y})},g=()=>{p(!0)},f=()=>{p(!1)},x=!s&&!l&&!c;return(0,Me.jsxs)("div",{className:"relative",onBlur:f,onDoubleClick:g,children:[(0,Me.jsx)(ar,{className:k("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,Me.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Me.jsx)(He,{value:t.label,isEditing:u,onChange:h})}),(0,Me.jsx)($e,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o&&x}),(!i||m)&&(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(ie,{type:"target",position:Qe.Position.Left,id:"left",className:k({"event-handle":m})}),(0,Me.jsx)(ie,{type:"target",position:Qe.Position.Right,id:"right",className:k({"event-handle":m})}),(0,Me.jsx)(ie,{type:"target",position:Qe.Position.Top,id:"top",className:k({"event-handle":m})}),(0,Me.jsx)(ie,{type:"target",position:Qe.Position.Bottom,id:"bottom",className:k({"event-handle":m})})]}),!i&&(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(ze,{type:"source",position:Qe.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,Me.jsx)(ze,{type:"source",position:Qe.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,Me.jsx)(ze,{type:"source",position:Qe.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,Me.jsx)(ze,{type:"source",position:Qe.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var je=require("@xyflow/react"),Wn=require("lecom-ui"),$c=require("react");var ui=(e,t)=>{let n=e.filter(i=>i.type==="TASK").map(i=>{var s;let a=(s=i.data)==null?void 0:s.label;if(a&&a.startsWith(`${t} `)){let l=a.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(i=>i>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},en=(e,t)=>{let n=t.filter(l=>l.type==="TASK").map(l=>{var c;return(c=l.data)==null?void 0:c.label}).filter(Boolean);if(!n.includes(e))return e;let i=e.replace(/\s+\(\d+\)$/,""),a=n.filter(l=>l===i||l.startsWith(`${i} (`)).map(l=>{if(l===i)return 1;let c=l.match(/\s+\((\d+)\)$/);return c?parseInt(c[1],10):0}).filter(l=>l>0),s=2;for(;a.includes(s);)s++;return`${i} (${s})`};var zn=require("react/jsx-runtime"),Wc=e=>(0,zn.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,zn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,zn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var is=require("react/jsx-runtime"),Yc=e=>(0,is.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,is.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 Fn=require("react/jsx-runtime"),Uc=e=>(0,Fn.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,Fn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,Fn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var re=require("react/jsx-runtime"),Wm={APROVADO:Wc,EM_ANDAMENTO:Yc,REJEITADO:Uc},ss={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)]"},Xc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,Wn.useTranslation)(),{updateNodeData:i,getNodes:a}=(0,je.useReactFlow)(),{inProgress:s,fromNode:l}=(0,je.useConnection)(),{mode:c,isConnecting:d,isDragging:u,isMultipleSelection:p,onSubprocessValidationClick:m,reconnectingEdgeId:h}=W(),{getTaskStatus:g}=ro(),f=s&&(l==null?void 0:l.id)!==e||!!h,x=(0,$c.useCallback)(L=>{let G=L.trim(),M=t.label||"";if(G===M)return;let S=G,D=a();if(!(G&&G!=="")){S=ui(D,r("bpmn.task.label.prefix")),i(e,{label:S}),(0,Wn.toast)({variant:"warning",content:(0,re.jsxs)(re.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,re.jsx)("strong",{children:S})]})});return}let F=en(S,D);F===M||(i(e,{label:F}),F!==S&&(0,Wn.toast)({variant:"warning",content:(0,re.jsxs)(re.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,re.jsx)("strong",{children:G})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,re.jsx)("strong",{children:F})]})}))},[t.label,a,e,r,i]),y=g(e),b=y?Wm[y]:null,T=t.variant?lr[t.variant].icon:null,N=t.attribute?cr[t.attribute].icon:null,_=t.variant==="SUBPROCESS",w=T&&!_,P=N||_,H=()=>t.hasError?ss.error:y?ss[y]:ss.default,C=()=>{m==null||m({id:e,type:"sub_process",label:t.label})},A=!d&&!u&&!p;return(0,re.jsxs)("div",{className:k("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",H(),{"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,re.jsx)(He,{value:t.label,maxLength:60,className:k("m-1",{"py-6":w||P}),onChange:x}),T&&(0,re.jsx)("div",{className:k("absolute flex items-center p-1",_?"bottom-0":"top-0 left-0"),children:(0,re.jsx)(T,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500",_&&"cursor-pointer"),onClick:_?C:void 0})}),N&&(0,re.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,re.jsx)("div",{className:k("flex items-center w-16 p-1",_?"justify-between":"justify-center"),children:(0,re.jsx)(N,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})})}),b&&(0,re.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,re.jsx)(b,{})}),(0,re.jsx)($e,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o&&A}),c==="edit"&&(0,re.jsx)(Qo,{minWidth:ni.MIN_WIDTH,minHeight:ni.MIN_HEIGHT,isVisible:!n&&o}),(!s||f)&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(ie,{type:"target",position:je.Position.Left,id:"left",className:k({"task-handle":f})}),(0,re.jsx)(ie,{type:"target",position:je.Position.Right,id:"right",className:k({"task-handle":f})}),(0,re.jsx)(ie,{type:"target",position:je.Position.Top,id:"top",className:k({"task-handle":f})}),(0,re.jsx)(ie,{type:"target",position:je.Position.Bottom,id:"bottom",className:k({"task-handle":f})})]}),!s&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(ze,{type:"source",position:je.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,re.jsx)(ze,{type:"source",position:je.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,re.jsx)(ze,{type:"source",position:je.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,re.jsx)(ze,{type:"source",position:je.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var as=require("@xyflow/react");var Lt=require("react/jsx-runtime"),Kc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:a}=W(),s=!r&&!i&&!a;return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.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,Lt.jsx)($e,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o&&s}),(0,Lt.jsx)(ie,{type:"source",position:as.Position.Right}),(0,Lt.jsx)(ie,{type:"target",position:as.Position.Left})]})};var Ne=require("@xyflow/react"),pi=require("react");var Ee=require("react/jsx-runtime"),Bv={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:Ne.MarkerType.Arrow},data:{label:""}},qc=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{let{zoom:c}=(0,Ne.useViewport)(),{updateEdgeData:d}=(0,Ne.useReactFlow)(),{isMultipleSelection:u,mode:p,instanceId:m}=W(),h=p!=="edit",[g,f]=(0,pi.useState)(!1),{reconnectingHandle:x,cursorPosition:y,hoveredNodeId:b,reconnectingSide:T,isValidReconnection:N,handleReconnectStart:_}=jr({edgeId:e,source:t,target:o,instanceId:m,isReadOnly:h}),w=(0,Ne.useInternalNode)(t),P=(0,Ne.useInternalNode)(o),{sx:H,sy:C,tx:A,ty:L,sourcePos:G,targetPos:M}=(0,pi.useMemo)(()=>{var Ie,he;if(!w||!P)return{sx:0,sy:0,tx:0,ty:0,sourcePos:Ne.Position.Left,targetPos:Ne.Position.Right};let q=zt(w,P),oe=s?i:q.sourcePos,R=l?a:q.targetPos,K=(_e,De,Re)=>{var fe,Fe,Qt,jt,eo,to;let{x:Ve,y:Pe}=_e.internals.positionAbsolute,pe=(Qt=(Fe=(fe=_e.measured)==null?void 0:fe.width)!=null?Fe:_e.width)!=null?Qt:0,j=(to=(eo=(jt=_e.measured)==null?void 0:jt.height)!=null?eo:_e.height)!=null?to:0;switch(De){case Ne.Position.Top:return{x:Ve+pe*Re,y:Pe};case Ne.Position.Bottom:return{x:Ve+pe*Re,y:Pe+j};case Ne.Position.Left:return{x:Ve,y:Pe+j*Re};case Ne.Position.Right:return{x:Ve+pe,y:Pe+j*Re};default:return{x:Ve+pe/2,y:Pe+j/2}}},X=(Ie=n==null?void 0:n.sourceOffset)!=null?Ie:.5,z=(he=n==null?void 0:n.targetOffset)!=null?he:.5,V=w?K(w,oe,X).x:q.sx,Z=w?K(w,oe,X).y:q.sy,Q=P?K(P,R,z).x:q.tx,ne=P?K(P,R,z).y:q.ty;return x==="source"&&y?(V=y.x,Z=y.y,T&&(oe=T)):x==="target"&&y&&(Q=y.x,ne=y.y,T&&(R=T)),{sx:V,sy:Z,tx:Q,ty:ne,sourcePos:oe,targetPos:R}},[w,P,s,l,i,a,x,y,T,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!w||!P)return null;let[S,D,Y]=(0,Ne.getSmoothStepPath)({sourceX:H,sourceY:C,targetX:A,targetY:L,sourcePosition:G,targetPosition:M}),F=r||(w==null?void 0:w.selected)||(P==null?void 0:P.selected),te=F?"sequence-edge-marker-highlighted":"sequence-edge-marker",I=g||(n==null?void 0:n.label.trim().length)>0,O=1/c,U=()=>{f(!0)},B=()=>{f(!1)},$=q=>{d(e,{label:q.trim()})};return(0,Ee.jsx)(Ee.Fragment,{children:(0,Ee.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":F}),onBlur:B,onDoubleClick:U,children:[(0,Ee.jsx)(Ne.BaseEdge,{id:e,path:S,markerEnd:`url(#${te})`,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||x&&b&&!N,"stroke-green-500":x&&b&&N,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":F&&!(n!=null&&n.hasError)&&!x})}),(0,Ee.jsxs)(Ne.EdgeLabelRenderer,{children:[(0,Ee.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${D}px, ${Y}px)`},children:[r&&!u&&(0,Ee.jsx)(Uo,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${O})`}}),I&&(0,Ee.jsx)(He,{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,onChange:$})]}),r&&!u&&!h&&(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${H}px, ${C}px)`},children:(0,Ee.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="source"?.6:.3,className:"pointer-events-none"}),(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!x||x!=="source","cursor-not-allowed":x==="source"&&b&&!N,"cursor-grabbing":x==="source"&&(!b||N)}),onMouseDown:q=>_("source",q.nativeEvent)})]})}),(0,Ee.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A}px, ${L}px)`},children:(0,Ee.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="target"?.6:.3,className:"pointer-events-none"}),(0,Ee.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:k("pointer-events-auto",{"cursor-move":!x||x!=="target","cursor-not-allowed":x==="target"&&b&&!N,"cursor-grabbing":x==="target"&&(!b||N)}),onMouseDown:q=>_("target",q.nativeEvent)})]})})]})]})]})})};var Zc=require("@xyflow/react"),Yn=require("react/jsx-runtime"),Jc=({toX:e,toY:t,fromNode:o})=>{if(!o)return null;let n={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:r,sy:i,tx:a,ty:s}=zt(o,n),[l]=(0,Zc.getStraightPath)({sourceX:r,sourceY:i,targetX:a||e,targetY:s||t});return(0,Yn.jsxs)("g",{children:[(0,Yn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:l}),(0,Yn.jsx)("circle",{cx:a||e,cy:s||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var fi=require("@xyflow/react"),Qc=require("lodash"),Un=require("react");var et=require("react/jsx-runtime"),jc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,fi.useReactFlow)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=W(),[u,p]=(0,Un.useState)(!1),m=a(),h=!r,g=(0,Un.useMemo)(()=>(0,Qc.orderBy)([...m.filter(_=>_.parentId===e&&_.type==="LANE")],"position.y","asc"),[m,e]),f=h?ri.MIN_WIDTH:Te.MIN_WIDTH,x=(0,Un.useMemo)(()=>{if(h&&g.length>1){let _=[...g];return _.pop(),_.reduce((P,H)=>{var C,A;return P+((A=(C=H.measured)==null?void 0:C.height)!=null?A:0)},0)+Te.MIN_HEIGHT}return Te.MIN_HEIGHT},[h,g]),y=_=>{i(e,{label:_})},b=()=>{p(!0)},T=()=>{p(!1)},N=!l&&!c&&!d;return(0,et.jsxs)(et.Fragment,{children:[(0,et.jsxs)("div",{className:k("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,et.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:T,onDoubleClick:b,children:(0,et.jsx)("div",{className:k("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!u}),children:(0,et.jsx)(He,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:k({"whitespace-nowrap":u}),isEditing:u,onChange:y})})}),(0,et.jsx)("div",{className:"flex-1"})]}),(0,et.jsx)($e,{nodeId:e,nodeType:"LANE",isChild:!h,isVisible:!n&&o&&N}),s==="edit"&&(0,et.jsx)(Qo,{nodeId:e,minWidth:f,minHeight:x,isVisible:!n&&o}),h&&(0,et.jsx)(ie,{type:"source",position:fi.Position.Right})]})};var ed={START_EVENT:Fc,END_EVENT:Vc,TASK:Xc,GATEWAY:Hc,ANNOTATION:Rc,LANE:jc,UNSUPPORTED:Kc},td={SEQUENCE_EDGE:tc,MESSAGE_EDGE:qc,ANNOTATION_EDGE:Zl},od="#fafafa",nd="#bebebe",rd=1,id=10,sd="bottom-left",ad=.2,ld=5,tn=.5,on=.4,nn=1,cd={x:0,y:0,zoom:.75},Ym=1,Um=2,dd=[Ym,Um];var ud=require("@xyflow/react");var lt=()=>{let{getEdges:e,getNodes:t}=(0,ud.useReactFlow)(),{lastElementId:o}=W(),n=()=>{let i=t(),a=e(),s=vc(i,a);return Math.max(s,o)};return{getLastId:n,getNextId:()=>n()+1}};var rn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,pd.useReactFlow)(),{getLastId:i}=lt(),{setLastElementId:a}=W(),s=(0,ls.useCallback)(async(c="")=>{let{nodes:d,edges:u,lastElementId:p}=await Ac(c);o(d),n(u),a(p),r({padding:tn,minZoom:on,maxZoom:nn})},[o,n,a,r]),l=(0,ls.useCallback)((c,d)=>{let u=c||e()||[],p=d||t()||[],m=i();return wc(u,p,m)},[e,t,i]);return{importFromMxGraph:s,exportToMxGraph:l}};var cs=require("react"),$m=500,mi=()=>{let{isInitialized:e,onElementChanges:t}=W(),{exportToMxGraph:o}=rn(),n=(0,fd.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},$m),r=(0,cs.useCallback)(a=>{a.every(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,cs.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var md=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,gi.useReactFlow)(),{emitElementChanges:r}=mi(),i=(0,Nt.useRef)(null),{getNextId:a}=lt(),s=(0,Nt.useCallback)(h=>{var b;let g=t(h.source),f=t(h.target);if(!g||!f)return!1;let x={sourceNodeId:g.id,targetNodeId:f.id,sourceNodeType:g.type,targetNodeType:f.type,nodes:n(),edges:o(),reconnectingEdgeId:(b=i.current)!=null?b:void 0};return Ji(x).isValid},[t,o,n]),l=(0,Nt.useCallback)(h=>{let g=a(),f=t(h.source),x=t(h.target),y=(x==null?void 0:x.type)==="ANNOTATION"||(f==null?void 0:f.type)==="ANNOTATION"?$o:pt,b=v(E(E({},h),y),{id:String(g)});e(T=>T.concat(b)),r()},[t,a,e,r]),c=(0,Nt.useCallback)((h,g)=>{i.current=g.id},[]),d=(0,Nt.useCallback)(()=>{i.current=null},[]),u=(0,Nt.useCallback)((h,g)=>{let f=t(g.source),x=t(g.target);if(!f||!x){i.current=null;return}let y={sourceNodeId:f.id,targetNodeId:x.id,sourceNodeType:f.type,targetNodeType:x.type,nodes:n(),edges:o(),reconnectingEdgeId:h.id};if(!Ji(y).isValid){i.current=null;return}e(T=>(0,gi.reconnectEdge)(h,g,T).map(_=>_.id===h.id?v(E({},_),{data:v(E({},_.data),{points:void 0})}):_)),i.current=null,r()},[t,n,o,e,r]),p=(0,Nt.useCallback)(h=>{i.current=h},[]),m=(0,Nt.useCallback)(()=>{i.current=null},[]);return{isValidConnection:s,onConnect:l,onReconnect:u,onReconnectStart:c,onReconnectEnd:d,setReconnectingEdge:p,clearReconnectingEdge:m}};var Nd=require("@xyflow/react"),yi=require("lecom-ui"),mt=require("react");var $n=(e=[])=>e.filter(t=>t.type==="START_EVENT"),_o=(e=[])=>e.filter(t=>t.type==="END_EVENT"),$t=(e=[])=>e.filter(t=>t.type==="TASK")||[],gd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),hd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),hi=(e=[])=>e.filter(t=>t.type==="GATEWAY"),yd=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),tt=(e,t=[])=>t.filter(o=>o.source===e),Xn=(e,t=[])=>t.filter(o=>o.target===e),xd=(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"},Ed=(e,t)=>{let o=tt(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},bd=e=>e?/\w/g.test(e.trim()):!1,de=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:[]}},vt=(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)}},_d=(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 Kn=[{id:"start_event_not_found",validate:e=>{let t=$n(e.nodes);return de({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=_o(e.nodes);return de({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=$n(e.nodes),o=t.length===1;if(t.length===0)return de({isValid:!0});if(!o)return de({isValid:!1,nodeIds:t.map(i=>i.id)});let n=tt(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return de({isValid:!1,nodeIds:[...new Set(i)]})}return de({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=$t(e.nodes),o=vt(t,n=>tt(n.id,e.edges).length<=2);return de({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=$t(e.nodes),o=vt(t,n=>!!n.label&&n.label.trim()!=="");return de({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=$t(e.nodes),n=vt(o,r=>!r.label||r.label.length<=60);return de({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=$t(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 de({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=hi(e.nodes),o=[],n=[];for(let r of t){let i=tt(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return de({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...$n(e.nodes),..._o(e.nodes)],o=[],n=[];for(let r of t){let i=tt(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(r.id,s.id),n.push(a.id))}}return de({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=_o(e.nodes),o=[],n=[];for(let r of t){let i=Xn(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=tt(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return de({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=yd(e.nodes),o=vt(t,r=>tt(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>tt(r,e.edges).map(i=>i.id));return de({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=$t(e.nodes),o=vt(t,n=>!n.label||bd(n.label));return de({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return de({isValid:!0});let t=_o(e.nodes)[0];if(!t)return de({isValid:!0});let o=Xn(t.id,e.edges);if(!o.length)return de({isValid:!0});let r=$t(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=vt(r,l=>!xd(l.id,e));return de({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=$t(e.nodes),o=_o(e.nodes)[0];if(!o)return de({isValid:!0});let n=t.filter(l=>{let c=Xn(l.id,e.edges),d=tt(l.id,e.edges),u=c.some(m=>{var h;return((h=e.nodes.find(g=>g.id===m.source))==null?void 0:h.type)==="START_EVENT"}),p=d.some(m=>{var h;return((h=e.nodes.find(g=>g.id===m.target))==null?void 0:h.type)==="END_EVENT"});return u&&p}),r=Xn(o.id,e.edges),i=r.length>1,a=r.map(l=>l.source),s={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?a:[]]};return de(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=hi(e.nodes),o=[],n=[];for(let r of t){let i=tt(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(r.id,s.id),n.push(a.id))}}return de({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=hi(e.nodes),o=vt(t,n=>tt(n.id,e.edges).length>=1);return de({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...$n(e.nodes),..._o(e.nodes)],o=[],n=[];for(let r of t){let i=tt(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return de({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=gd(e.nodes),o=vt(t,n=>!Ed(n.id,e));return de({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=hd(e.nodes),o=vt(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 de({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Td=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Kn){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 To=require("react/jsx-runtime"),vd=()=>{let{t:e}=(0,yi.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,Nd.useReactFlow)(),[i,a]=(0,mt.useState)(!1),s=(0,mt.useRef)(!1),l=(0,mt.useRef)(!1),c=(0,mt.useCallback)(h=>{let g=_d(h.nodes,h.edges),f=Td(g),x=f.errors.map(y=>v(E({},y),{message:e(`validation.errors.${y.id}`)}));return i||a(!0),{isValid:f.isValid,errors:x}},[i,e]),d=(0,mt.useCallback)((h,g=!0)=>{if(g&&h&&(0,yi.toast)({variant:h.isValid?"success":"error",duration:5e3,title:h.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,To.jsxs)("div",{className:"flex flex-col gap-1",children:[!h.isValid&&(0,To.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,To.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:h.isValid?(0,To.jsx)("li",{children:e("validation.success.message")}):h.errors.map(C=>(0,To.jsx)("li",{className:"text-xs",children:C.message},C.id))})]})}),!h)return;s.current=!0,l.current=!0;let f=[],x=[];h.errors.forEach(C=>{C.nodeIds&&C.nodeIds.length>0&&C.nodeIds.forEach(A=>f.push(A)),C.edgeIds&&C.edgeIds.length>0&&C.edgeIds.forEach(A=>x.push(A))});let y=[...new Set(f)];t(C=>C.map(A=>v(E({},A),{data:v(E({},A.data),{hasError:!1})}))),o(C=>C.map(A=>v(E({},A),{data:v(E({},A.data),{hasError:!1})})));let b=n(),T=r(),N=new Set(y),_=new Set;h.errors.forEach(C=>{var G,M;let A=Kn.find(S=>S.id===C.id);(A==null?void 0:A.highlightRelatedEdges)!==!1&&((G=C.edgeIds)==null||G.forEach(S=>_.add(S)),(M=C.nodeIds)==null||M.forEach(S=>{T.forEach(D=>{(D.source===S||D.target===S)&&_.add(D.id)})}))});let w=new Set,P=new Set,H=new Set;b.forEach(C=>{C.type==="START_EVENT"?w.add(C.id):C.type==="END_EVENT"&&P.add(C.id)}),T.forEach(C=>{w.has(C.source)&&H.add(C.target),P.has(C.target)&&H.add(C.source)}),H.forEach(C=>{var A,L;if(N.has(C)){let G=(A=h.errors.find(S=>{var D;return(D=S.nodeIds)==null?void 0:D.includes(C)}))==null?void 0:A.id;((L=Kn.find(S=>S.id===G))==null?void 0:L.highlightRelatedEdges)!==!1&&T.forEach(S=>{S.source===C&&P.has(S.target)&&(N.add(S.target),_.add(S.id)),S.target===C&&w.has(S.source)&&(N.add(S.source),_.add(S.id))})}}),N.size>0&&t(C=>C.map(A=>v(E({},A),{data:v(E({},A.data),{hasError:N.has(A.id)})}))),_.size>0&&o(C=>C.map(A=>v(E({},A),{data:v(E({},A.data),{hasError:_.has(A.id)})}))),setTimeout(()=>{s.current=!1},0)},[e,r,n,o,t]),u=(0,mt.useCallback)(()=>{a(!1),l.current=!1,t(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),o(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})})))},[o,t]),p=(0,mt.useCallback)(()=>{l.current&&(s.current=!0,l.current=!1,t(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),o(h=>h.map(g=>v(E({},g),{data:v(E({},g.data),{hasError:!1})}))),setTimeout(()=>{s.current=!1},0))},[o,t]),m=(0,mt.useCallback)(()=>s.current,[]);return{validateDiagram:c,handleValidationComplete:d,clearValidation:u,dismissValidationPanel:p,isAutoValidationEnabled:i,getIsClearingValidation:m}};var Id=require("@xyflow/react"),Cd=require("lecom-ui"),Sd=require("react");var Xm=15,wd="bpmn:selection",Km=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},Ad=e=>{if(!Km(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},Md=({offset:e=Xm}={})=>{let{t}=(0,Cd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,Id.useReactFlow)(),{getNextId:a}=lt();(0,Sd.useEffect)(()=>{let s=c=>{var f,x;if(!Ad(c))return;let d=o(),u=r(),p=d.filter(y=>y.selected);if(!p.length)return;c.preventDefault(),c.stopPropagation();let m=u.filter(y=>p.some(b=>b.id===y.source)&&p.some(b=>b.id===y.target)),g=JSON.stringify({nodes:p,edges:m});(f=c.clipboardData)==null||f.setData(wd,g),(x=c.clipboardData)==null||x.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},l=c=>{var N,_;if(!Ad(c))return;let d=(N=c.clipboardData)==null?void 0:N.getData(wd);if(!d)return;c.preventDefault(),c.stopPropagation();let u;try{u=JSON.parse(d)}catch(w){return}if(!((_=u.nodes)!=null&&_.length))return;let p=new Map,m=o(),h=[],g=m.some(w=>w.type==="START_EVENT"),f=u.nodes.filter(w=>w.type==="START_EVENT"),x=u.nodes;if(g&&f.length>0&&(x=u.nodes.filter(w=>w.type!=="START_EVENT"),x.length===0))return;let y=a(),b=x.map(w=>{var C;let P=String(y++);p.set(w.id,P);let H=v(E({},w),{id:P,selected:!0,position:{x:w.position.x+e,y:w.position.y+e}});if(w.type==="TASK"){let A=(C=w.data)==null?void 0:C.label,L=en(A||t("bpmn.task.label.prefix"),[...m,...h]);H.data=v(E({},w.data),{label:L})}return h.push(H),H}),T=u.edges.map(w=>v(E({},w),{id:String(y++),selected:!0,source:p.get(w.source)||w.source,target:p.get(w.target)||w.target}));n(w=>[...w.map(P=>v(E({},P),{selected:!1})),...b]),i(w=>[...w.map(P=>v(E({},P),{selected:!1})),...T])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",l,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",l,!0)}},[o,n,r,i,a,e,t])};var xi=require("@xyflow/react");var Pd=require("lecom-ui"),Ld=require("react");var kd=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,xi.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=jo(),{t:a}=(0,Pd.useTranslation)(),{getInternalNode:s,screenToFlowPosition:l}=(0,xi.useReactFlow)(),{getNextId:c}=lt(),{setIsDragging:d}=W(),{rebuildIndex:u,forceRebuildIndex:p}=zr(),[m,h]=(0,Ld.useState)(null),g=(A,L=!1)=>{let G=L?"[&>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(M=>M.map(S=>v(E({},S),{className:S.id===A?G:""})))},f=()=>{let{nodeLookup:A}=n.getState();return Array.from(A.values())},x=A=>{let L=s(A.id),G=f();if(A.type==="LANE"){if(Jo({parentId:A.id,nodes:e,includeTypes:["LANE"]})){g();return}let te=G.filter(U=>U.id!==A.id&&U.type==="LANE"&&!U.parentId),I=On(L,te);if(!I){g();return}if(Jo({parentId:I.id,nodes:e,excludeTypes:["LANE"]})){g(I.id,!0);return}g(I.id);return}let S=G.filter(F=>F.id!==A.id&&F.type==="LANE"),D=On(L,S);if(!D){g();return}if(Jo({parentId:D.id,nodes:e,includeTypes:["LANE"]})){g();return}g(D.id)},y=A=>A.map(L=>v(E({},L),{className:void 0})),b=A=>A.some(G=>G.dragging)?A.map(G=>G.dragging?v(E({},G),{dragging:!1}):G):A,T=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},N=(A,L)=>{A.preventDefault(),x(L)},_=(A,L,G)=>{var F,te;let M=[...G];if(A.parentId===L.id)return M=bc(A,L,M),M=Vn(M),y(M);if(A.type==="LANE"){if(Jo({parentId:L.id,nodes:M,excludeTypes:["LANE"]})){let $=Ke(L),q=50,oe=50;return M.map(R=>{var K,X;return R.id===A.id?v(E({},R),{position:{x:(K=m==null?void 0:m.x)!=null?K:$.x+q,y:(X=m==null?void 0:m.y)!=null?X:$.y2+oe}}):R})}let U=M.filter($=>$.parentId===L.id).reduce(($,q)=>{var oe,R;return $+((R=(oe=q.measured)==null?void 0:oe.height)!=null?R:0)},0),B={x:Te.HEADER_WIDTH,y:U};return M=M.map($=>$.id===A.id?v(E({},$),{parentId:L.id,position:B,className:void 0}):v(E({},$),{className:void 0})),M=Hn(L.id,M),M}if(Jo({parentId:L.id,nodes:M,includeTypes:["LANE"]})){let I;if(A.parentId){let O=s(A.parentId),{x:U,y:B}=Pt(O);I={x:U+((F=A.position.x)!=null?F:0),y:B+((te=A.position.y)!=null?te:0)}}return M=M.map(O=>O.id===A.id?v(E({},O),{position:I!=null?I:O.position,parentId:void 0,className:void 0}):v(E({},O),{className:void 0})),M}let Y=gc(A,L);return M=M.map(I=>{if(I.id===A.id){let O=Ke(A),U=Ke(L);return O.y<U.y&&(Y.y=0),O.x<U.x+Te.HEADER_WIDTH&&(Y.x=Te.HEADER_WIDTH),v(E({},I),{parentId:L.id,position:Y,className:void 0})}return v(E({},I),{className:void 0})}),M=Vn(M),M},w=A=>{if(A.preventDefault(),!(r!=null&&r.type))return;let L=l({x:A.clientX,y:A.clientY}),G={width:ee[r.type].MIN_WIDTH,height:ee[r.type].MIN_HEIGHT},M=c(),S={id:String(M),type:r.type,position:L,measured:G,data:{label:r.type==="TASK"?ui(e,a("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},D=v(E({},S),{internals:{positionAbsolute:L}}),Y=f(),F=r.type==="LANE",te=Y.filter(B=>F?B.type==="LANE"&&!B.parentId:B.type==="LANE"),I=On(D,te),O=[...e.map(B=>v(E({},B),{selected:!1})),S];I&&(O=_(D,I,O)),O=yo(O),t(O),p();let U=A.dataTransfer.getData("sourceId");if(U){let B={id:String(M+1),source:U,target:S.id};if(r.type==="ANNOTATION"){o($=>$.concat(E(E({},B),$o)));return}o($=>$.concat(E(E({},B),pt)))}d(!1),i(null)},P=async(A,L,G)=>{let M=[...e];G.forEach(S=>{let D=f(),Y=s(S.id),F=S.type==="LANE",te=D.filter(O=>O.id!==S.id&&(F?O.type==="LANE"&&!O.parentId:O.type==="LANE")),I=On(Y,te);if(I){M=_(Y,I,M);return}S.parentId&&(M=C(S,M))}),M=b(M),M=yo(M),M=y(M),t(M),u(M),h(null)},H=(A,L)=>{h({x:L.position.x,y:L.position.y})},C=(A,L)=>{var Y,F;let G=s(A.parentId),{x:M,y:S}=Pt(G),D={x:M+((Y=A.position.x)!=null?Y:0),y:S+((F=A.position.y)!=null?F:0)};return L=L.map(te=>te.id===A.id?v(E({},te),{position:D,parentId:void 0}):te),L=Hn(A.parentId,L),L};return{onDragOver:T,onDrop:w,onNodeDrag:N,onNodeDragStart:H,onNodeDragStop:P}};var Dd=require("@xyflow/react"),Rd=require("lecom-ui"),Od=require("react");var qm=30,Zm=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},Jm=e=>!Zm(e.target),Vd=({offset:e=qm}={})=>{let{t}=(0,Rd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,Dd.useReactFlow)(),{getNextId:a}=lt();(0,Od.useEffect)(()=>{let s=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&Jm(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),u=c.filter(N=>N.selected);if(!u.length)return;let p=new Map,m=[],h=c.some(N=>N.type==="START_EVENT"),g=u.filter(N=>N.type==="START_EVENT"),f=u;if(h&&g.length>0&&(f=u.filter(N=>N.type!=="START_EVENT"),f.length===0))return;let x=d.filter(N=>f.some(_=>_.id===N.source)&&f.some(_=>_.id===N.target)),y=a(),b=f.map(N=>{var P;let _=String(y++);p.set(N.id,_);let w=v(E({},N),{id:_,selected:!0,position:{x:N.position.x+e,y:N.position.y+e}});if(N.type==="TASK"){let H=(P=N.data)==null?void 0:P.label,C=en(H||t("bpmn.task.label.prefix"),[...c,...m]);w.data=v(E({},N.data),{label:C})}return m.push(w),w}),T=x.map(N=>v(E({},N),{id:String(y++),selected:!0,source:p.get(N.source)||N.source,target:p.get(N.target)||N.target}));n(N=>[...N.map(_=>v(E({},_),{selected:!1})),...b]),i(N=>[...N.map(_=>v(E({},_),{selected:!1})),...T])}};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[o,n,r,i,a,e,t])};var Fd=require("@xyflow/react");var Gd={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Bd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Hd=(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)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a||(a="task",s=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},Qm=e=>{e=e||"";let t=e.trim().split(`
36
+ `),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 a=Hd(i[0],o),s=Hd(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},zd=e=>{let{components:t,connections:o}=Qm(e);return{nodes:t,edges:o}};var Wd=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Fd.useReactFlow)(),{getNextId:n}=lt();return{importFromLia:i=>{let a=typeof i=="string"?i:i.diagramXml||"",{nodes:s,edges:l}=zd(a),c=[],d=new Map,u=!1,p=n();for(let[f,x]of Object.entries(s)){let y=String(p++),b=Gd[x.type],T=Bd[x.type];b==="START_EVENT"&&(u=!0),d.set(f,y);let N=ee[b].MIN_WIDTH,_=ee[b].MIN_HEIGHT;c.push({id:y,type:b,data:{label:x.label||"",variant:T,attribute:""},position:{x:0,y:0},width:N,height:_,measured:{width:N,height:_}})}let m=[];for(let f of l){let x=v(E({},pt),{id:String(p++),source:d.get(f.sourceId)||f.sourceId,target:d.get(f.targetId)||f.targetId});m.push(x)}if(!u&&c.length>0){let f=String(p++),x={id:f,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:ee.START_EVENT.MIN_WIDTH,height:ee.START_EVENT.MIN_HEIGHT,measured:{width:ee.START_EVENT.MIN_WIDTH,height:ee.START_EVENT.MIN_HEIGHT}};c.unshift(x);let y=c[1];if(y){let b=v(E({},pt),{id:String(p++),source:f,target:y.id});m.unshift(b)}}let{nodes:h,edges:g}=Ec(c,m);e(h),t(g),o({padding:tn,minZoom:on,maxZoom:nn})}}};var Ei=require("react"),jm={origin:"*",debug:!1};function Yd(e,t=jm){let{origin:o,debug:n}=t,r=(0,Ei.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,Ei.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||(s==null?void 0:s.data)===void 0)return;let{event:l,data:c}=s,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",s),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 Ud=require("@xyflow/react"),ds=require("react");var $d=()=>{let e=(0,Ud.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=W(),{importFromMxGraph:n}=rn();(0,ds.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,ds.useEffect)(()=>{if(!e)return;(async()=>{await ir(),o(!0)})()},[e,o])};var us=require("react"),Xd=require("@xyflow/react");function Kd(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=ro(),{getEdges:n}=(0,Xd.useReactFlow)(),r=dr(),i=(0,us.useCallback)(s=>{if(!(s!=null&&s.activities))return;e(s.activities);let l=s.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),a=(0,us.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var Zd=require("@xyflow/react"),ct=require("react"),Jd=require("use-debounce");var eg=500,qd=100,Qd=(e=!1)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Zd.useReactFlow)(),[i,a]=(0,ct.useState)([]),[s,l]=(0,ct.useState)(0),c=i[s],d=s>0,u=s<i.length-1,p=(0,ct.useCallback)(T=>{n(i[T].nodes),r(i[T].edges)},[i,n,r]),m=(0,ct.useCallback)(()=>{if(s>0){let T=s-1;l(T),p(T)}},[s,p]),h=(0,ct.useCallback)(()=>{if(s<i.length-1){let T=s+1;l(T),p(T)}},[i,s,p]),g=T=>{let _=[...i.slice(0,s+1),T],w=_.length>qd?_.slice(_.length-qd):_;a(w),l(w.length-1)},f=(0,Jd.useDebouncedCallback)(()=>{let T=t(),N=o(),_=T.map(H=>v(E({},H),{selected:!1,className:""})),w={nodes:yo(_),edges:N};JSON.stringify(c)!==JSON.stringify(w)&&g(w)},eg),x=(0,ct.useCallback)(T=>{if(!e)return;if(i.length===0){f();return}if(T==="forceSave"){f();return}T.some(w=>w.type==="select")||T.some(w=>w.type==="position"&&w.dragging)||f()},[e,f,i.length]),y=(0,ct.useCallback)(T=>{a(T||[]),l(0)},[]),b=(0,ct.useCallback)(()=>{a([]),l(0)},[]);return(0,ct.useEffect)(()=>{let T=N=>{(N.ctrlKey||N.metaKey)&&(N.shiftKey&&N.key.toLowerCase()==="z"?(N.preventDefault(),h()):N.key.toLowerCase()==="z"&&(N.preventDefault(),m()))};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[m,h]),{history:i,undo:m,redo:h,canUndo:d,canRedo:u,saveHistory:x,resetHistory:y,clearHistory:b}};var jd=()=>{let[e,t,o]=(0,Xt.useNodesState)([]),[n,r,i]=(0,Xt.useEdgesState)([]),{getNode:a}=(0,Xt.useReactFlow)(),{instanceId:s,isInitialized:l,setIsConnecting:c,setIsMultipleSelection:d,onElementClick:u}=W(),{updateHelperLines:p,HelperLines:m}=zr(),{undo:h,redo:g,canUndo:f,canRedo:x,saveHistory:y}=Qd(l),{onNodeDrag:b,onDrop:T,onDragOver:N,onNodeDragStop:_,onNodeDragStart:w}=kd({nodes:e,setNodes:t,setEdges:r}),{isValidConnection:P,onConnect:H,onReconnect:C,onReconnectStart:A,onReconnectEnd:L,setReconnectingEdge:G,clearReconnectingEdge:M}=md({setEdges:r}),{handleValidationComplete:S,clearValidation:D,dismissValidationPanel:Y,validateDiagram:F,getIsClearingValidation:te}=vd(),{importFromLia:I}=Wd(),{handleTasksStatus:O,handleClearTaskStatus:U}=Kd(),{clearPathEdges:B}=ro(),$=dr(),{emitElementChanges:q,handleNodeChanges:oe,handleEdgeChanges:R}=mi();Md(),Vd(),$d();let K=(0,kt.useCallback)(()=>{t([]),r([]),B(),setTimeout(()=>{$()},0)},[t,r,B,$]);Yd({LIA_CREATE_DIAGRAM:I,CLEAR_DIAGRAM:K,TASKS_STATUS:O,CLEAR_TASKS_STATUS:U});let{selectElements:X,clearSelection:z}=Ft(),{importFromMxGraph:V,exportToMxGraph:Z}=rn(),{configureElement:Q,getConfigureElement:ne}=qr(),Ie=(0,kt.useCallback)(()=>e.length+n.length,[e,n]);(0,kt.useEffect)(()=>(_t.set(s,{importFromMxGraph:V,exportToMxGraph:Z,selectElements:X,clearSelection:z,configureElement:Q,getConfigureElement:ne,getElementsCount:Ie,setReconnectingEdge:G,clearReconnectingEdge:M}),()=>{_t.delete(s)}),[s,V,Z,X,z,Q,ne,Ie,G,M]);let he=(0,kt.useCallback)((j,fe)=>{if(fe.type!=="TASK"&&fe.type!=="GATEWAY")return;let Fe=ne(fe.id);Fe&&(u==null||u(Fe))},[ne,u]),_e=(0,kt.useCallback)((j,fe)=>{if(fe.type!=="SEQUENCE_EDGE")return;let Fe=a(fe.source),Qt=a(fe.target),{isFromStartEvent:jt,isGatewayToGateway:eo,isActiviyToAndGateway:to}=Kr(Fe,Qt);if(!(!jt&&!eo&&!to))return;let dn=ne(fe.id);dn&&(u==null||u(dn))},[ne,a,u]),De=(0,kt.useCallback)(j=>{let fe=p(j,e);o(fe),y(j),te()||Y(),oe(j)},[e,o,y,te,Y,p,oe]),Re=(0,kt.useCallback)(j=>{i(j),y(j),te()||Y(),R(j)},[i,y,te,Y,R]);return(0,Xt.useOnSelectionChange)({onChange:({nodes:j,edges:fe})=>{d(j.length+fe.length>1)}}),{nodes:e,setNodes:t,edges:n,setEdges:r,events:{isValidConnection:P,onConnect:H,onReconnect:C,onReconnectStart:A,onReconnectEnd:L,onDrop:T,onDragOver:N,onNodeDrag:b,onNodeDragStop:_,onNodeDragStart:w,onNodeClick:he,onEdgeClick:_e,onDropCapture:()=>{y("forceSave"),q(),Y()},onConnectStart:()=>{c(!0)},onConnectEnd:()=>{c(!1),Y()},onNodesChange:De,onEdgesChange:Re},ui:{handleCloseValidationPanel:D},controls:{undo:h,redo:g,canUndo:f,canRedo:x},components:{HelperLines:m},actions:{saveHistory:y,selectElements:X,clearSelection:z,exportToMxGraph:Z,validateDiagram:F,handleValidationComplete:S,setReconnectingEdge:G,clearReconnectingEdge:M}}};var ps=require("react/jsx-runtime"),fs=({id:e,className:t})=>(0,ps.jsx)("marker",{id:e,className:k("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,ps.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var sn=require("react/jsx-runtime"),eu=()=>(0,sn.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,sn.jsxs)("defs",{children:[(0,sn.jsx)(fs,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,sn.jsx)(fs,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Jn=require("@xyflow/react"),ve=require("lecom-ui"),qt=require("lucide-react"),Ao=require("react");var wt=require("lecom-ui");var qn=(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))(qn||{});var du=require("@xyflow/react"),an=require("lecom-ui");var tu=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 ou({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
37
+ `),i=encodeURI(r);bi(i,`${o}.csv`)}var bi=(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 nu(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var LA={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},ru={script:"SCRIPT",subprocess:"SUBPROCESS"},iu={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var No=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i,parent:a}=n,s=Number(r._attributes.width),l=Number(r._attributes.height),c=a==="1"?void 0:a;return{id:n.id,parentId:c,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x)||0,y:Number(r._attributes.y)||0},width:s,height:l,measured:{width:s,height:l}}},og=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ee.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=ee.START_EVENT.MIN_HEIGHT,{node:No({cell:e,type:"START_EVENT"}),status:n,originalType:o}},ng=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ee.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=ee.END_EVENT.MIN_HEIGHT,{node:No({cell:e,type:"END_EVENT"}),status:n,originalType:o}},rg=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=ru[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Rt(e.mxGeometry._attributes.width||0,ee.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Rt(e.mxGeometry._attributes.height||0,ee.TASK.MIN_HEIGHT),{node:No({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},ig=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=iu[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=ee.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=ee.GATEWAY.MIN_HEIGHT,{node:No({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},sg=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:No({cell:e,type:"LANE"}),status:"imported",originalType:t}},ag=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Rt(e.mxGeometry._attributes.width||0,ee.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Rt(e.mxGeometry._attributes.height||0,ee.ANNOTATION.MIN_HEIGHT),{node:No({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},su=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ee.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=ee.UNSUPPORTED.MIN_HEIGHT,{node:No({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},au=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(E({},pt),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},lu={TASK:rg,GATEWAY:ig,START_EVENT:og,END_EVENT:ng,LANE:sg,ANNOTATION:ag};var lg=e=>{let t=new Map,o=Object.values(qn),n=e.filter(a=>{var l;let s=(l=a._attributes)==null?void 0:l.type;return o.includes(s)}),r=[],i=[];for(let a of n){let{type:s}=a._attributes,l=lu[s]||su,{node:c,status:d,originalType:u}=l(a);i.push(c),r.push({originalType:u,type:c.type,variant:c.data.variant,value:nu(c.data.label),status:d})}return{nodes:i,governanceIdToNodeIdMap:t,summary:r}},cg=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>au(r,t)),dg=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=lg(t.root.mxCell),i=cg(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},ug=async e=>{let t=await tu(e),o=oi(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),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},cu=async e=>{try{let t=await ug(e),{nodes:o,edges:n,summary:r}=dg(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var pu=require("react/jsx-runtime"),uu=()=>{let{t:e}=(0,an.useTranslation)(),{toast:t}=(0,an.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,du.useReactFlow)(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.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,pu.jsx)(an.Button,{size:"small",variant:"ghost",onClick:()=>ou({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async s=>{try{let{nodes:l,edges:c,summary:d}=await cu(s);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r({padding:tn,minZoom:on,maxZoom:nn}),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 fu=require("lecom-ui"),mu=require("react");var vo=require("react/jsx-runtime"),gu=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=ht(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,mu.useRef)(null),d=p=>{let m=p.target.files;m!=null&&m.length&&i(m),c.current&&(c.current.value="")};return(0,vo.jsxs)(vo.Fragment,{children:[(0,vo.jsx)(fu.Button,v(E({onClick:p=>{var m;(m=c.current)==null||m.click(),r==null||r(p)}},a),{children:e})),(0,vo.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var wo=require("react/jsx-runtime"),hu=({disabled:e=!1})=>{let{t}=(0,wt.useTranslation)(),{toast:o}=(0,wt.useNotificationToast)(),{importFromGovernance:n}=uu(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(s)};return(0,wo.jsxs)(wt.Tooltip,{children:[(0,wo.jsx)(wt.TooltipTrigger,{asChild:!0,children:(0,wo.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,wo.jsx)(Is,{})})}),(0,wo.jsx)(wt.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var yu=require("react/jsx-runtime"),ms=({shortcut:e})=>(0,yu.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 ce=require("lecom-ui"),Kt=require("lucide-react"),_u=require("react");var xu=require("@xyflow/react"),Zn=require("html-to-image"),_i=require("lecom-ui"),Eu=require("react");var pg=3,gs="diagram",bu=()=>{let{t:e}=(0,_i.useTranslation)(),{getNodes:t}=(0,xu.useReactFlow)(),{clearSelection:o}=Ft(),[n,r]=(0,Eu.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:d,y:u,width:p,height:m}=Tc(t());return{width:p,height:m,style:{width:`${p}px`,height:`${m}px`,transform:`translate(${-d}px, ${-u}px)`}}},a=async(d,u)=>{r(v(E({},n),{[u]:!0})),await o();try{let p=_c();if(!p)throw new Error("Flow element not found");let m=i();return await d(p,m)}catch(p){(0,_i.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(v(E({},n),{[u]:!1}))}};return{exportAsPng:async(d=gs)=>{await a(async(u,p)=>{let m=await(0,Zn.toPng)(u,v(E({},p),{backgroundColor:"#fcfcfc"}));bi(m,`${d}.png`)},"png")},exportAsHtml:async(d=gs)=>{await a(async(u,p)=>{let m=await(0,Zn.toSvg)(u,v(E({},p),{backgroundColor:"#fcfcfc"})),h=`
38
38
  <!DOCTYPE html>
39
39
  <html>
40
40
  <head>
@@ -48,7 +48,7 @@
48
48
  <img src="${m}" alt="Diagram" />
49
49
  </body>
50
50
  </html>
51
- `,g=new Blob([h],{type:"text/html"}),f=URL.createObjectURL(g);bi(f,`${d}.html`),setTimeout(()=>URL.revokeObjectURL(f),100)},"html")},printDiagram:async(d=ms)=>{await a(async(u,p)=>{let m=await(0,Kn.toPng)(u,v(E({},p),{pixelRatio:dg})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let g=h.document;g.open(),g.write(`
51
+ `,g=new Blob([h],{type:"text/html"}),f=URL.createObjectURL(g);bi(f,`${d}.html`),setTimeout(()=>URL.revokeObjectURL(f),100)},"html")},printDiagram:async(d=gs)=>{await a(async(u,p)=>{let m=await(0,Zn.toPng)(u,v(E({},p),{pixelRatio:pg})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let g=h.document;g.open(),g.write(`
52
52
  <!DOCTYPE html>
53
53
  <html>
54
54
  <head>
@@ -64,4 +64,4 @@
64
64
  <img src="${m}" alt="Diagram" onload="window.print(); window.close();" />
65
65
  </body>
66
66
  </html>
67
- `),g.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var pe=require("react/jsx-runtime");function bu(){let{t:e}=(0,de.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=xu(),[s,l]=(0,Eu.useState)(!1);return(0,pe.jsxs)(de.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,pe.jsx)(de.DropdownMenuTrigger,{asChild:!0,children:(0,pe.jsx)("div",{children:(0,pe.jsxs)(de.Tooltip,{children:[(0,pe.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(de.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,pe.jsx)(Xt.FolderOutputIcon,{})})}),!s&&(0,pe.jsx)(de.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,pe.jsxs)(de.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,pe.jsxs)(de.Tooltip,{children:[(0,pe.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(de.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,pe.jsx)(Xt.FileImageIcon,{})})}),(0,pe.jsx)(de.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,pe.jsxs)(de.Tooltip,{children:[(0,pe.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(de.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,pe.jsx)(Xt.FileCodeIcon,{})})}),(0,pe.jsx)(de.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,pe.jsxs)(de.Tooltip,{children:[(0,pe.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(de.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,pe.jsx)(Xt.PrinterIcon,{})})}),(0,pe.jsx)(de.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var re=require("react/jsx-runtime"),_u=({nodes:e,validateDiagram:t,handleValidationComplete:o})=>{let{t:n}=(0,Ne.useTranslation)(),{clearSelection:r}=Ft(),{mode:i,isMinimapOpen:a,setIsMinimapOpen:s,isMoveTool:l,isHandTool:c,setIsMoveTool:d,setIsHandTool:u}=W(),{getNodes:p,getEdges:m}=(0,qn.useReactFlow)(),h=(0,qn.useKeyPress)(["v","V"]),g=(0,qn.useKeyPress)(["h","H"]),f=(0,No.useCallback)(()=>{r(),u(!0),d(!1)},[r,u,d]),x=(0,No.useCallback)(()=>{d(!0),u(!1)},[d,u]),y=(0,No.useCallback)(()=>{let b=p(),N=m(),T=t({nodes:b,edges:N});o(T)},[p,m,t,o]);return(0,No.useEffect)(()=>{h&&!l&&i==="edit"&&x()},[h,x,l,i]),(0,No.useEffect)(()=>{g&&!c&&i==="edit"&&f()},[g,f,c,i]),(0,re.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[i==="edit"&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsxs)(Ne.Tooltip,{children:[(0,re.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,re.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",className:k(l&&"bg-grey-400"),iconButton:!0,onClick:x,children:(0,re.jsx)(Kt.MousePointerIcon,{})})}),(0,re.jsxs)(Ne.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.move_tool"),(0,re.jsx)(fs,{shortcut:"V"})]})]}),(0,re.jsxs)(Ne.Tooltip,{children:[(0,re.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,re.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",className:k(c&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,re.jsx)(Kt.HandIcon,{})})}),(0,re.jsxs)(Ne.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.hand_tool")," ",(0,re.jsx)(fs,{shortcut:"H"})]})]})]}),(0,re.jsx)(bu,{}),i==="edit"&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsxs)(Ne.Tooltip,{children:[(0,re.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,re.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:y,children:(0,re.jsx)(Kt.ListCheckIcon,{})})}),(0,re.jsx)(Ne.TooltipContent,{color:"black",children:n("editor.controls.actions.check")})]}),(0,re.jsx)(mu,{disabled:e.length>0})]}),(0,re.jsxs)(Ne.Tooltip,{children:[(0,re.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,re.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",className:k(a&&"bg-grey-400"),iconButton:!0,onClick:()=>s(!a),children:(0,re.jsx)(Kt.MapIcon,{})})}),(0,re.jsx)(Ne.TooltipContent,{color:"black",children:n(a?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var $e=require("lecom-ui"),Ti=require("lucide-react"),tt=require("react/jsx-runtime"),Tu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,$e.useTranslation)();return(0,tt.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,tt.jsxs)($e.Tooltip,{children:[(0,tt.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,tt.jsx)($e.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,tt.jsx)(Ti.UndoIcon,{})})}),(0,tt.jsx)($e.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,tt.jsxs)($e.Tooltip,{children:[(0,tt.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,tt.jsx)($e.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,tt.jsx)(Ti.RedoIcon,{})})}),(0,tt.jsx)($e.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var Nu=require("@xyflow/react"),ve=require("lecom-ui"),an=require("lucide-react");var xe=require("react/jsx-runtime"),vu=()=>{let{t:e}=(0,ve.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,Nu.useReactFlow)();return(0,xe.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,xe.jsxs)(ve.Tooltip,{children:[(0,xe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,xe.jsx)(an.ScanIcon,{})})}),(0,xe.jsx)(ve.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,xe.jsxs)(ve.Tooltip,{children:[(0,xe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,xe.jsx)(an.ZoomOut,{})})}),(0,xe.jsx)(ve.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,xe.jsxs)(ve.Tooltip,{children:[(0,xe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,xe.jsx)(Ps,{})})}),(0,xe.jsx)(ve.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,xe.jsxs)(ve.Tooltip,{children:[(0,xe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,xe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,xe.jsx)(an.ZoomIn,{})})}),(0,xe.jsx)(ve.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var wu=require("@xyflow/react"),It=require("lecom-ui"),Ni=require("react");var gt=require("react/jsx-runtime"),Iu=()=>{let e=(0,Ni.useRef)(null),{t}=(0,It.useTranslation)(),{setDraggableNode:o}=Jo(),{getNodes:n}=(0,wu.useReactFlow)(),{setIsDragging:r}=W(),[i,a]=(0,Ni.useState)(void 0),s=n(),l=Br(s),c=[{type:"START_EVENT",icon:ir,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:wo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:fn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Ds,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ks,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Ls,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Co,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Mo,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Io,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:Ms,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:or,label:t("bpmn.annotation.variant.default")}],d=(u,p)=>{o({type:p.type,variant:p.variant,attribute:p.attribute,icon:p.icon}),a((0,gt.jsx)(p.icon,{})),u.dataTransfer.effectAllowed="move",e.current&&u.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,gt.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,gt.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:c.map((u,p)=>{let m=l&&u.type==="START_EVENT",h=m?t("editor.toolbar.start_event_already_exists"):u.label;return(0,gt.jsxs)(It.Tooltip,{children:[(0,gt.jsx)(It.TooltipTrigger,{asChild:!0,children:(0,gt.jsx)(It.Button,{className:k("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":m}),size:"small",variant:"ghost",color:"grey",draggable:!m,disabled:m,iconButton:!0,onDragStart:m?void 0:g=>d(g,u),children:(0,gt.jsx)(u.icon,{})},p)}),(0,gt.jsx)(It.TooltipContent,{color:"black",side:"right",children:h})]},p)})}),(0,gt.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var ot=require("react/jsx-runtime"),gs=(0,vi.forwardRef)((e,t)=>{let{instanceId:o,mode:n,isMinimapOpen:r,isMoveTool:i,isHandTool:a}=W(),{nodes:s,edges:l,actions:c,events:d,components:u,controls:p}=Jd();return(0,vi.useImperativeHandle)(t,()=>({selectElements:c.selectElements,clearSelection:c.clearSelection})),(0,ot.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,ot.jsx)(Iu,{}),(0,ot.jsx)(Qd,{}),(0,ot.jsxs)(qt.ReactFlow,v(E({},d),{id:`modeler-${o}`,edges:l,nodes:s,nodeTypes:Jc,edgeTypes:Qc,minZoom:rd,maxZoom:id,panOnDrag:a||n!=="edit"?!0:ad,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!1,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:Kc,selectionMode:qt.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:sd,connectOnClick:!1,connectionRadius:30,proOptions:{hideAttribution:!0},children:[(0,ot.jsx)(qt.Background,{gap:od,size:td,color:ed,bgColor:jc}),r&&(0,ot.jsx)(qt.MiniMap,{pannable:!0,zoomable:!0,position:nd,className:"shadow-md rounded-md"}),(0,ot.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,ot.jsx)(Tu,E({},p)),(0,ot.jsx)(_u,{nodes:s,validateDiagram:c.validateDiagram,handleValidationComplete:c.handleValidationComplete}),(0,ot.jsx)(vu,{})]}),(0,ot.jsx)(u.HelperLines,{})]}))]})});gs.displayName="Editor";var Au=require("@xyflow/react"),wi=require("react"),Cu=require("react/jsx-runtime"),ug=e=>({width:e.width,height:e.height,transform:e.transform}),hs="rgba(51, 103, 217, 0.4)",kl=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,Au.useStore)(ug),i=(0,wi.useRef)(null);return(0,wi.useEffect)(()=>{let a=i.current,s=a==null?void 0:a.getContext("2d");if(!s||!a)return;let l=window.devicePixelRatio;a.width=o*l,a.height=n*l,s.clearRect(0,0,o,n),s.scale(l,l),s.strokeStyle=hs,t&&(s.beginPath(),s.strokeStyle=t.color||hs,s.moveTo(t.position*r[2]+r[0],0),s.lineTo(t.position*r[2]+r[0],n),s.stroke()),e&&(s.beginPath(),s.strokeStyle=e.color||hs,s.moveTo(0,e.position*r[2]+r[1]),s.lineTo(o,e.position*r[2]+r[1]),s.stroke())},[o,n,r,e,t]),(0,Cu.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var ln=require("lecom-ui"),Zt=require("react");var Zn=require("react/jsx-runtime"),_t=new Map,Su=(0,Zt.createContext)(null),Ii=()=>{let e=(0,Zt.useContext)(Su);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Mu=({locale:e,defaultMode:t="view",showNotification:o=!0,children:n})=>{let[r,i]=(0,Zt.useState)(e||"pt_BR");(0,Zt.useEffect)(()=>{e&&(i(e),ln.i18n.changeLanguage(e))},[e]);let a=h=>{let g=_t.size;if(g===0)throw new Error("No modeler instances found");if(g===1||!h){let[x]=_t.values();return x}let f=_t.get(h);if(!f)throw new Error(`Modeler instance with ID "${h}" not found`);return f},s=(h,g)=>{let f=a(g);return f==null?void 0:f.selectElements(h)},l=async h=>{let g=a(h);return g==null?void 0:g.clearSelection()},c=(h,g)=>{let f=a(g);return f==null?void 0:f.configureElement(h)},d=(h,g)=>{let f=a(g);return f==null?void 0:f.getConfigureElement(h)},u=async(h,g)=>{let f=a(g);await(f==null?void 0:f.importFromMxGraph(h))},p=h=>{let g=a(h);return g==null?void 0:g.exportToMxGraph()},m=h=>{let g=a(h);return(g==null?void 0:g.getElementsCount())||0};return(0,Zn.jsx)(Su.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:p,getElementsCount:m},children:(0,Zn.jsxs)(ln.TooltipProvider,{children:[o&&(0,Zn.jsx)(ln.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var Ai=require("react/jsx-runtime"),Lu=(0,we.createContext)(null),W=()=>{let e=(0,we.useContext)(Lu);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},ku=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s})=>{let{defaultMode:l}=Ii(),c=(0,we.useId)(),[d]=(0,we.useState)(o||c),[u,p]=(0,we.useState)(n||l||"edit"),[m,h]=(0,we.useState)(Vn),[g,f]=(0,we.useState)(!1),[x,y]=(0,we.useState)(!0),[b,N]=(0,we.useState)(!1),[T,_]=(0,we.useState)(!1),[w,P]=(0,we.useState)(!1),[H,C]=(0,we.useState)(!1),[I,L]=(0,we.useState)(!1),[G,M]=(0,we.useState)(null);(0,we.useEffect)(()=>{n&&p(n)},[n]);let S=(0,we.useMemo)(()=>t||bc(),[t]),D={instanceId:d,initialDiagram:S,mode:u,lastElementId:m,isInitialized:g,isMinimapOpen:T,isMoveTool:x,isHandTool:b,isDragging:w,isMultipleSelection:I,isConnecting:H,setLastElementId:h,setIsInitialized:f,reconnectingEdgeId:G,setIsMinimapOpen:_,setIsMoveTool:y,setIsHandTool:N,setIsDragging:P,setIsConnecting:C,setIsMultipleSelection:L,setReconnectingEdgeId:M,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s};return(0,Ai.jsx)(Pu.ReactFlowProvider,{children:(0,Ai.jsx)(Lu.Provider,{value:D,children:(0,Ai.jsx)(gs,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
67
+ `),g.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var ue=require("react/jsx-runtime");function Tu(){let{t:e}=(0,ce.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=bu(),[s,l]=(0,_u.useState)(!1);return(0,ue.jsxs)(ce.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,ue.jsx)(ce.DropdownMenuTrigger,{asChild:!0,children:(0,ue.jsx)("div",{children:(0,ue.jsxs)(ce.Tooltip,{children:[(0,ue.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,ue.jsx)(Kt.FolderOutputIcon,{})})}),!s&&(0,ue.jsx)(ce.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,ue.jsxs)(ce.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,ue.jsxs)(ce.Tooltip,{children:[(0,ue.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(ce.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,ue.jsx)(Kt.FileImageIcon,{})})}),(0,ue.jsx)(ce.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,ue.jsxs)(ce.Tooltip,{children:[(0,ue.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(ce.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,ue.jsx)(Kt.FileCodeIcon,{})})}),(0,ue.jsx)(ce.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,ue.jsxs)(ce.Tooltip,{children:[(0,ue.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(ce.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,ue.jsx)(Kt.PrinterIcon,{})})}),(0,ue.jsx)(ce.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var se=require("react/jsx-runtime"),Nu=({nodes:e,validateDiagram:t,handleValidationComplete:o})=>{let{t:n}=(0,ve.useTranslation)(),{clearSelection:r}=Ft(),{mode:i,isMinimapOpen:a,setIsMinimapOpen:s,isMoveTool:l,isHandTool:c,setIsMoveTool:d,setIsHandTool:u}=W(),{getNodes:p,getEdges:m}=(0,Jn.useReactFlow)(),h=(0,Jn.useKeyPress)(["v","V"]),g=(0,Jn.useKeyPress)(["h","H"]),f=(0,Ao.useCallback)(()=>{r(),u(!0),d(!1)},[r,u,d]),x=(0,Ao.useCallback)(()=>{d(!0),u(!1)},[d,u]),y=(0,Ao.useCallback)(()=>{let b=p(),T=m(),N=t({nodes:b,edges:T});o(N)},[p,m,t,o]);return(0,Ao.useEffect)(()=>{h&&!l&&i==="edit"&&x()},[h,x,l,i]),(0,Ao.useEffect)(()=>{g&&!c&&i==="edit"&&f()},[g,f,c,i]),(0,se.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[i==="edit"&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(ve.Tooltip,{children:[(0,se.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",className:k(l&&"bg-grey-400"),iconButton:!0,onClick:x,children:(0,se.jsx)(qt.MousePointerIcon,{})})}),(0,se.jsxs)(ve.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.move_tool"),(0,se.jsx)(ms,{shortcut:"V"})]})]}),(0,se.jsxs)(ve.Tooltip,{children:[(0,se.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",className:k(c&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,se.jsx)(qt.HandIcon,{})})}),(0,se.jsxs)(ve.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.hand_tool")," ",(0,se.jsx)(ms,{shortcut:"H"})]})]})]}),(0,se.jsx)(Tu,{}),i==="edit"&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(ve.Tooltip,{children:[(0,se.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:y,children:(0,se.jsx)(qt.ListCheckIcon,{})})}),(0,se.jsx)(ve.TooltipContent,{color:"black",children:n("editor.controls.actions.check")})]}),(0,se.jsx)(hu,{disabled:e.length>0})]}),(0,se.jsxs)(ve.Tooltip,{children:[(0,se.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",className:k(a&&"bg-grey-400"),iconButton:!0,onClick:()=>s(!a),children:(0,se.jsx)(qt.MapIcon,{})})}),(0,se.jsx)(ve.TooltipContent,{color:"black",children:n(a?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Xe=require("lecom-ui"),Ti=require("lucide-react"),ot=require("react/jsx-runtime"),vu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Xe.useTranslation)();return(0,ot.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ot.jsxs)(Xe.Tooltip,{children:[(0,ot.jsx)(Xe.TooltipTrigger,{asChild:!0,children:(0,ot.jsx)(Xe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ot.jsx)(Ti.UndoIcon,{})})}),(0,ot.jsx)(Xe.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,ot.jsxs)(Xe.Tooltip,{children:[(0,ot.jsx)(Xe.TooltipTrigger,{asChild:!0,children:(0,ot.jsx)(Xe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,ot.jsx)(Ti.RedoIcon,{})})}),(0,ot.jsx)(Xe.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var wu=require("@xyflow/react"),we=require("lecom-ui"),ln=require("lucide-react");var be=require("react/jsx-runtime"),Au=()=>{let{t:e}=(0,we.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,wu.useReactFlow)();return(0,be.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,be.jsxs)(we.Tooltip,{children:[(0,be.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,be.jsx)(we.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,be.jsx)(ln.ScanIcon,{})})}),(0,be.jsx)(we.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,be.jsxs)(we.Tooltip,{children:[(0,be.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,be.jsx)(we.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,be.jsx)(ln.ZoomOut,{})})}),(0,be.jsx)(we.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,be.jsxs)(we.Tooltip,{children:[(0,be.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,be.jsx)(we.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,be.jsx)(Ps,{})})}),(0,be.jsx)(we.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,be.jsxs)(we.Tooltip,{children:[(0,be.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,be.jsx)(we.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,be.jsx)(ln.ZoomIn,{})})}),(0,be.jsx)(we.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Iu=require("@xyflow/react"),At=require("lecom-ui"),Ni=require("react");var gt=require("react/jsx-runtime"),Cu=()=>{let e=(0,Ni.useRef)(null),{t}=(0,At.useTranslation)(),{setDraggableNode:o}=jo(),{getNodes:n}=(0,Iu.useReactFlow)(),{setIsDragging:r}=W(),[i,a]=(0,Ni.useState)(void 0),s=n(),l=Fr(s),c=[{type:"START_EVENT",icon:ar,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Io,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:mn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Ds,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ks,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Ls,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Mo,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Lo,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Co,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:Ms,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:rr,label:t("bpmn.annotation.variant.default")}],d=(u,p)=>{o({type:p.type,variant:p.variant,attribute:p.attribute,icon:p.icon}),a((0,gt.jsx)(p.icon,{})),u.dataTransfer.effectAllowed="move",e.current&&u.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,gt.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,gt.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:c.map((u,p)=>{let m=l&&u.type==="START_EVENT",h=m?t("editor.toolbar.start_event_already_exists"):u.label;return(0,gt.jsxs)(At.Tooltip,{children:[(0,gt.jsx)(At.TooltipTrigger,{asChild:!0,children:(0,gt.jsx)(At.Button,{className:k("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":m}),size:"small",variant:"ghost",color:"grey",draggable:!m,disabled:m,iconButton:!0,onDragStart:m?void 0:g=>d(g,u),children:(0,gt.jsx)(u.icon,{})},p)}),(0,gt.jsx)(At.TooltipContent,{color:"black",side:"right",children:h})]},p)})}),(0,gt.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var nt=require("react/jsx-runtime"),hs=(0,vi.forwardRef)((e,t)=>{let{instanceId:o,mode:n,isMinimapOpen:r,isMoveTool:i,isHandTool:a}=W(),{nodes:s,edges:l,actions:c,events:d,components:u,controls:p}=jd();return(0,vi.useImperativeHandle)(t,()=>({selectElements:c.selectElements,clearSelection:c.clearSelection})),(0,nt.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,nt.jsx)(Cu,{}),(0,nt.jsx)(eu,{}),(0,nt.jsxs)(Zt.ReactFlow,v(E({},d),{id:`modeler-${o}`,edges:l,nodes:s,nodeTypes:ed,edgeTypes:td,minZoom:ad,maxZoom:ld,panOnDrag:a||n!=="edit"?!0:dd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!1,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:Jc,selectionMode:Zt.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,defaultViewport:cd,connectOnClick:!1,connectionRadius:30,proOptions:{hideAttribution:!0},children:[(0,nt.jsx)(Zt.Background,{gap:id,size:rd,color:nd,bgColor:od}),r&&(0,nt.jsx)(Zt.MiniMap,{pannable:!0,zoomable:!0,position:sd,className:"shadow-md rounded-md"}),(0,nt.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,nt.jsx)(vu,E({},p)),(0,nt.jsx)(Nu,{nodes:s,validateDiagram:c.validateDiagram,handleValidationComplete:c.handleValidationComplete}),(0,nt.jsx)(Au,{})]}),(0,nt.jsx)(u.HelperLines,{})]}))]})});hs.displayName="Editor";var Su=require("@xyflow/react"),wi=require("react"),Mu=require("react/jsx-runtime"),fg=e=>({width:e.width,height:e.height,transform:e.transform}),ys="rgba(51, 103, 217, 0.4)",kl=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,Su.useStore)(fg),i=(0,wi.useRef)(null);return(0,wi.useEffect)(()=>{let a=i.current,s=a==null?void 0:a.getContext("2d");if(!s||!a)return;let l=window.devicePixelRatio;a.width=o*l,a.height=n*l,s.clearRect(0,0,o,n),s.scale(l,l),s.strokeStyle=ys,t&&(s.beginPath(),s.strokeStyle=t.color||ys,s.moveTo(t.position*r[2]+r[0],0),s.lineTo(t.position*r[2]+r[0],n),s.stroke()),e&&(s.beginPath(),s.strokeStyle=e.color||ys,s.moveTo(0,e.position*r[2]+r[1]),s.lineTo(o,e.position*r[2]+r[1]),s.stroke())},[o,n,r,e,t]),(0,Mu.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var cn=require("lecom-ui"),Jt=require("react");var Qn=require("react/jsx-runtime"),_t=new Map,Pu=(0,Jt.createContext)(null),Ai=()=>{let e=(0,Jt.useContext)(Pu);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Lu=({locale:e,defaultMode:t="view",showNotification:o=!0,children:n})=>{let[r,i]=(0,Jt.useState)(e||"pt_BR");(0,Jt.useEffect)(()=>{e&&(i(e),cn.i18n.changeLanguage(e))},[e]);let a=h=>{let g=_t.size;if(g===0)throw new Error("No modeler instances found");if(g===1||!h){let[x]=_t.values();return x}let f=_t.get(h);if(!f)throw new Error(`Modeler instance with ID "${h}" not found`);return f},s=(h,g)=>{let f=a(g);return f==null?void 0:f.selectElements(h)},l=async h=>{let g=a(h);return g==null?void 0:g.clearSelection()},c=(h,g)=>{let f=a(g);return f==null?void 0:f.configureElement(h)},d=(h,g)=>{let f=a(g);return f==null?void 0:f.getConfigureElement(h)},u=async(h,g)=>{let f=a(g);await(f==null?void 0:f.importFromMxGraph(h))},p=h=>{let g=a(h);return g==null?void 0:g.exportToMxGraph()},m=h=>{let g=a(h);return(g==null?void 0:g.getElementsCount())||0};return(0,Qn.jsx)(Pu.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:p,getElementsCount:m},children:(0,Qn.jsxs)(cn.TooltipProvider,{children:[o&&(0,Qn.jsx)(cn.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var Ii=require("react/jsx-runtime"),Du=(0,Ae.createContext)(null),W=()=>{let e=(0,Ae.useContext)(Du);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},Ru=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s})=>{let{defaultMode:l}=Ai(),c=(0,Ae.useId)(),[d]=(0,Ae.useState)(o||c),[u,p]=(0,Ae.useState)(n||l||"edit"),[m,h]=(0,Ae.useState)(Gn),[g,f]=(0,Ae.useState)(!1),[x,y]=(0,Ae.useState)(!0),[b,T]=(0,Ae.useState)(!1),[N,_]=(0,Ae.useState)(!1),[w,P]=(0,Ae.useState)(!1),[H,C]=(0,Ae.useState)(!1),[A,L]=(0,Ae.useState)(!1),[G,M]=(0,Ae.useState)(null);(0,Ae.useEffect)(()=>{n&&p(n)},[n]);let S=(0,Ae.useMemo)(()=>t||Nc(),[t]),D={instanceId:d,initialDiagram:S,mode:u,lastElementId:m,isInitialized:g,isMinimapOpen:N,isMoveTool:x,isHandTool:b,isDragging:w,isMultipleSelection:A,isConnecting:H,setLastElementId:h,setIsInitialized:f,reconnectingEdgeId:G,setIsMinimapOpen:_,setIsMoveTool:y,setIsHandTool:T,setIsDragging:P,setIsConnecting:C,setIsMultipleSelection:L,setReconnectingEdgeId:M,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s};return(0,Ii.jsx)(ku.ReactFlowProvider,{children:(0,Ii.jsx)(Du.Provider,{value:D,children:(0,Ii.jsx)(hs,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});