lecom-modeler 0.8.5 → 0.9.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 +7 -7
- package/lib/index.css +1 -1
- package/lib/index.js +7 -7
- package/lib/style.min.css +1 -1
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Eu=Object.create;var Wo=Object.defineProperty,bu=Object.defineProperties,_u=Object.getOwnPropertyDescriptor,Tu=Object.getOwnPropertyDescriptors,Nu=Object.getOwnPropertyNames,In=Object.getOwnPropertySymbols,vu=Object.getPrototypeOf,ti=Object.prototype.hasOwnProperty,Ji=Object.prototype.propertyIsEnumerable;var Zi=(e,t,o)=>t in e?Wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t)=>{for(var o in t||(t={}))ti.call(t,o)&&Zi(e,o,t[o]);if(In)for(var o of In(t))Ji.call(t,o)&&Zi(e,o,t[o]);return e},v=(e,t)=>bu(e,Tu(t));var Ye=(e,t)=>{var o={};for(var n in e)ti.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&In)for(var n of In(e))t.indexOf(n)<0&&Ji.call(e,n)&&(o[n]=e[n]);return o};var wu=(e,t)=>{for(var o in t)Wo(e,o,{get:t[o],enumerable:!0})},Qi=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Nu(t))!ti.call(e,r)&&r!==o&&Wo(e,r,{get:()=>t[r],enumerable:!(n=_u(t,r))||n.enumerable});return e};var Au=(e,t,o)=>(o=e!=null?Eu(vu(e)):{},Qi(t||!e||!e.__esModule?Wo(o,"default",{value:e,enumerable:!0}):o,e)),Iu=e=>Qi(Wo({},"__esModule",{value:!0}),e);var qm={};wu(qm,{EditorMode:()=>we,ElementPosition:()=>Sn,ElementType:()=>Yo,GatewayElementVariant:()=>Mn,GatewayVariant:()=>De,Modeler:()=>mu,ModelerProvider:()=>uu,NodeAttribute:()=>et,NodeType:()=>O,NodeVariant:()=>Le,RoutingVariant:()=>Pn,useModeler:()=>jr});module.exports=Iu(qm);var oi=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 Cn=require("lecom-ui");var ji={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",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"}},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 es={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",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:"Verificar 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 ts={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",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:"Verificar 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"}},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 os={pt_BR:ts,en_US:ji,es_ES:es};var ns,rs,Cu=(rs=(ns=oi("LecomUserLanguage"))!=null?ns:oi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?rs:Cn.Translations.PT_BR;(0,Cn.initializeI18n)({lng:Cu,resources:os});var we=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(we||{});var Yo=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Yo||{}),Sn=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Sn||{}),Mn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Mn||{}),Pn=(c=>(c.SIMPLE="simple",c.LOOP="loop",c.SCRIPT="script",c.SCRIPT_LOOP="script_loop",c.COMPLEX="complex",c.EXCLUSIVE="exclusive",c.PARALLEL="parallel",c.FINAL="final",c.TO_SUB_PROCESS="to_sub_process",c))(Pn||{});var uo=require("lucide-react");var Ct=require("react/jsx-runtime"),Ln=({size:e=24,className:t})=>(0,Ct.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Ct.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Ct.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Ct.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Ct.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var ni=require("react/jsx-runtime"),oo=({size:e=24,className:t})=>(0,ni.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,ni.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 pt=require("react/jsx-runtime"),no=({size:e=24,className:t})=>(0,pt.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,pt.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,pt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,pt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,pt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,pt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var ro=require("react/jsx-runtime"),io=({size:e=24,className:t})=>(0,ro.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,ro.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,ro.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ro.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var so=require("react/jsx-runtime"),ao=({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 lo=require("react/jsx-runtime"),is=({size:e=24,className:t})=>(0,lo.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,lo.jsxs)("g",{children:[(0,lo.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,lo.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var ss=require("clsx"),as=require("tailwind-merge");function D(...e){return(0,as.twMerge)((0,ss.clsx)(e))}var ft=(e=0,t=0)=>e<t?t:e,Dn=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Uo=require("react/jsx-runtime"),ls=({size:e=24,className:t})=>(0,Uo.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:D("stroke-2",t),children:[(0,Uo.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,Uo.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var kn=require("react/jsx-runtime"),cs=({size:e=24,className:t})=>(0,kn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,kn.jsx)("g",{children:(0,kn.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 ri=require("react/jsx-runtime"),Rn=({size:e=24,className:t})=>(0,ri.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,ri.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 ii=require("react/jsx-runtime"),$o=({size:e=24,className:t})=>(0,ii.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:D("stroke-2",t),children:(0,ii.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 co=require("react/jsx-runtime"),ds=({size:e=24,className:t})=>(0,co.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,co.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,co.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,co.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var mt=require("react/jsx-runtime"),us=({size:e=24,className:t})=>(0,mt.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,mt.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,mt.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,mt.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,mt.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,mt.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var St=require("react/jsx-runtime"),ps=({size:e=24,className:t})=>(0,St.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,St.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,St.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,St.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,St.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var O=(a=>(a.START_EVENT="START_EVENT",a.END_EVENT="END_EVENT",a.TASK="TASK",a.LANE="LANE",a.GATEWAY="GATEWAY",a.ANNOTATION="ANNOTATION",a.UNSUPPORTED="UNSUPPORTED",a))(O||{}),Le=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(Le||{}),Vn={SCRIPT:{icon:uo.ScrollText},SUBPROCESS:{icon:uo.SquarePlus}},et=(t=>(t.LOOP="LOOP",t))(et||{}),On={LOOP:{icon:uo.RotateCcw}},De=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(De||{}),si={EXCLUSIVE:{icon:io},PARALLEL:{icon:ao},COMPLEX:{icon:no}};var pu=require("@xyflow/react"),re=require("react");var At=require("@xyflow/react"),Jr=require("react");var vt=require("@xyflow/react"),Me=require("react"),Sd=require("use-debounce");var fs=require("zustand"),ms=require("@xyflow/react"),gs=require("react");var Hn=()=>{let{setEdges:e}=(0,ms.useReactFlow)();return(0,gs.useCallback)(()=>{let o=Mt.getState().pathEdgeIds;e(n=>n.map(r=>v(b({},r),{selected:o.includes(r.id)})))},[e])},Mt=(0,fs.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=b({},n.statusByNodeId),i=b({},n.statusData),s=!1;return o.forEach(a=>{let l=`${a.diagramId}-${a.activityId}`;r[a.diagramId]!==a.status&&(r[a.diagramId]=a.status,i[l]=a,s=!0)}),s?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],s={};o.forEach(d=>{s[d.source]||(s[d.source]=[]),s[d.source].push({targetId:d.target,edgeId:d.id})});let a=r[0],l=r[r.length-1];o.forEach(d=>{d.target===a&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,p)=>{let u=[],f=new Set;for(u.push({node:d,path:[]}),f.add(d);u.length>0;){let{node:y,path:g}=u.shift();if(y===p)return g;let m=s[y]||[];for(let{targetId:_,edgeId:h}of m)f.has(_)||(f.add(_),u.push({node:_,path:[...g,h]}))}return[]};for(let d=0;d<r.length-1;d++){let p=r[d],u=r[d+1],f=c(p,u);f.length>0&&i.push(...f)}i.length>0&&e({pathEdgeIds:i})}}));var ho=require("@xyflow/react");var Su={value:()=>{}};function ys(){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 Gn(o)}function Gn(e){this._=e}function Mu(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}})}Gn.prototype=ys.prototype={constructor:Gn,on:function(e,t){var o=this._,n=Mu(e+"",o),r,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((r=(e=n[i]).type)&&(r=Pu(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=n[i]).type)o[r]=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 Gn(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 Pu(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]=Su,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var ai=ys;var Bn="http://www.w3.org/1999/xhtml",li={svg:"http://www.w3.org/2000/svg",xhtml:Bn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),li.hasOwnProperty(t)?{space:li[t],local:e}:e}function Lu(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Bn&&t.documentElement.namespaceURI===Bn?t.createElement(e):t.createElementNS(o,e)}}function Du(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zn(e){var t=tt(e);return(t.local?Du:Lu)(t)}function ku(){}function Pt(e){return e==null?ku:function(){return this.querySelector(e)}}function xs(e){typeof e!="function"&&(e=Pt(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new ie(n,this._parents)}function ci(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ru(){return[]}function Xo(e){return e==null?Ru:function(){return this.querySelectorAll(e)}}function Vu(e){return function(){return ci(e.apply(this,arguments))}}function Es(e){typeof e=="function"?e=Vu(e):e=Xo(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),r.push(l));return new ie(n,r)}function Ko(e){return function(){return this.matches(e)}}function Fn(e){return function(t){return t.matches(e)}}var Ou=Array.prototype.find;function Hu(e){return function(){return Ou.call(this.children,e)}}function Gu(){return this.firstElementChild}function bs(e){return this.select(e==null?Gu:Hu(typeof e=="function"?e:Fn(e)))}var Bu=Array.prototype.filter;function zu(){return Array.from(this.children)}function Fu(e){return function(){return Bu.call(this.children,e)}}function _s(e){return this.selectAll(e==null?zu:Fu(typeof e=="function"?e:Fn(e)))}function Ts(e){typeof e!="function"&&(e=Ko(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ie(n,this._parents)}function Wn(e){return new Array(e.length)}function Ns(){return new ie(this._enter||this._groups.map(Wn),this._parents)}function qo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qo.prototype={constructor:qo,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 vs(e){return function(){return e}}function Wu(e,t,o,n,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],n[s]=a):o[s]=new qo(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Yu(e,t,o,n,r,i,s){var a,l,c=new Map,d=t.length,p=i.length,u=new Array(d),f;for(a=0;a<d;++a)(l=t[a])&&(u[a]=f=s.call(l,l.__data__,a,t)+"",c.has(f)?r[a]=l:c.set(f,l));for(a=0;a<p;++a)f=s.call(e,i[a],a,i)+"",(l=c.get(f))?(n[a]=l,l.__data__=i[a],c.delete(f)):o[a]=new qo(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function Uu(e){return e.__data__}function ws(e,t){if(!arguments.length)return Array.from(this,Uu);var o=t?Yu:Wu,n=this._parents,r=this._groups;typeof e!="function"&&(e=vs(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],p=r[c],u=p.length,f=$u(e.call(d,d&&d.__data__,c,n)),y=f.length,g=a[c]=new Array(y),m=s[c]=new Array(y),_=l[c]=new Array(u);o(d,p,g,m,_,f,t);for(var h=0,E=0,T,N;h<y;++h)if(T=g[h]){for(h>=E&&(E=h+1);!(N=m[E])&&++E<y;);T._next=N||null}}return s=new ie(s,n),s._enter=a,s._exit=l,s}function $u(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function As(){return new ie(this._exit||this._groups.map(Wn),this._parents)}function Is(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 Cs(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=o[l],d=n[l],p=c.length,u=a[l]=new Array(p),f,y=0;y<p;++y)(f=c[y]||d[y])&&(u[y]=f);for(;l<r;++l)a[l]=o[l];return new ie(a,this._parents)}function Ss(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],s;--r>=0;)(s=n[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Ms(e){e||(e=Xu);function t(p,u){return p&&u?e(p.__data__,u.__data__):!p-!u}for(var o=this._groups,n=o.length,r=new Array(n),i=0;i<n;++i){for(var s=o[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new ie(r,this._parents).order()}function Xu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ps(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ls(){return Array.from(this)}function Ds(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length;r<i;++r){var s=n[r];if(s)return s}return null}function ks(){let e=0;for(let t of this)++e;return e}function Rs(){return!this.node()}function Vs(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Ku(e){return function(){this.removeAttribute(e)}}function qu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zu(e,t){return function(){this.setAttribute(e,t)}}function Ju(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Qu(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function ju(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 Os(e,t){var o=tt(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?qu:Ku:typeof t=="function"?o.local?ju:Qu:o.local?Ju:Zu)(o,t))}function Yn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ep(e){return function(){this.style.removeProperty(e)}}function tp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function op(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Hs(e,t,o){return arguments.length>1?this.each((t==null?ep:typeof t=="function"?op:tp)(e,t,o==null?"":o)):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||Yn(e).getComputedStyle(e,null).getPropertyValue(t)}function np(e){return function(){delete this[e]}}function rp(e,t){return function(){this[e]=t}}function ip(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Gs(e,t){return arguments.length>1?this.each((t==null?np:typeof t=="function"?ip:rp)(e,t)):this.node()[e]}function Bs(e){return e.trim().split(/^|\s+/)}function di(e){return e.classList||new zs(e)}function zs(e){this._node=e,this._names=Bs(e.getAttribute("class")||"")}zs.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 Fs(e,t){for(var o=di(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Ws(e,t){for(var o=di(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function sp(e){return function(){Fs(this,e)}}function ap(e){return function(){Ws(this,e)}}function lp(e,t){return function(){(t.apply(this,arguments)?Fs:Ws)(this,e)}}function Ys(e,t){var o=Bs(e+"");if(arguments.length<2){for(var n=di(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?lp:t?sp:ap)(o,t))}function cp(){this.textContent=""}function dp(e){return function(){this.textContent=e}}function up(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Us(e){return arguments.length?this.each(e==null?cp:(typeof e=="function"?up:dp)(e)):this.node().textContent}function pp(){this.innerHTML=""}function fp(e){return function(){this.innerHTML=e}}function mp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function $s(e){return arguments.length?this.each(e==null?pp:(typeof e=="function"?mp:fp)(e)):this.node().innerHTML}function gp(){this.nextSibling&&this.parentNode.appendChild(this)}function Xs(){return this.each(gp)}function hp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ks(){return this.each(hp)}function qs(e){var t=typeof e=="function"?e:zn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yp(){return null}function Zs(e,t){var o=typeof e=="function"?e:zn(e),n=t==null?yp:typeof t=="function"?t:Pt(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function xp(){var e=this.parentNode;e&&e.removeChild(this)}function Js(){return this.each(xp)}function Ep(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qs(e){return this.select(e?bp:Ep)}function js(e){return arguments.length?this.property("__data__",e):this.node().__data__}function _p(e){return function(t){e.call(this,t,this.__data__)}}function Tp(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 Np(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 vp(e,t,o){return function(){var n=this.__on,r,i=_p(t);if(n){for(var s=0,a=n.length;s<a;++s)if((r=n[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=o),r.value=t;return}}this.addEventListener(e.type,i,o),r={type:e.type,name:e.name,value:t,listener:i,options:o},n?n.push(r):this.__on=[r]}}function ea(e,t,o){var n=Tp(e+""),r,i=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=n[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?vp:Np,r=0;r<i;++r)this.each(a(n[r],t,o));return this}function ta(e,t,o){var n=Yn(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 wp(e,t){return function(){return ta(this,e,t)}}function Ap(e,t){return function(){return ta(this,e,t.apply(this,arguments))}}function oa(e,t){return this.each((typeof t=="function"?Ap:wp)(e,t))}function*na(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,s;r<i;++r)(s=n[r])&&(yield s)}var Ip=[null];function ie(e,t){this._groups=e,this._parents=t}function ra(){return new ie([[document.documentElement]],Ip)}function Cp(){return this}ie.prototype=ra.prototype={constructor:ie,select:xs,selectAll:Es,selectChild:bs,selectChildren:_s,filter:Ts,data:ws,enter:Ns,exit:As,join:Is,merge:Cs,selection:Cp,order:Ss,sort:Ms,call:Ps,nodes:Ls,node:Ds,size:ks,empty:Rs,each:Vs,attr:Os,style:Hs,property:Gs,classed:Ys,text:Us,html:$s,raise:Xs,lower:Ks,append:qs,insert:Zs,remove:Js,clone:Qs,datum:js,on:ea,dispatch:oa,[Symbol.iterator]:na};var ot=ra;function Un(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function ui(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Qo(){}var Zo=.7,Kn=1/Zo,po="\\s*([+-]?\\d+)\\s*",Jo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ue="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sp=/^#([0-9a-f]{3,8})$/,Mp=new RegExp(`^rgb\\(${po},${po},${po}\\)$`),Pp=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),Lp=new RegExp(`^rgba\\(${po},${po},${po},${Jo}\\)$`),Dp=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${Jo}\\)$`),kp=new RegExp(`^hsl\\(${Jo},${Ue},${Ue}\\)$`),Rp=new RegExp(`^hsla\\(${Jo},${Ue},${Ue},${Jo}\\)$`),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};Un(Qo,ht,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sa,formatHex:sa,formatHex8:Vp,formatHsl:Op,formatRgb:aa,toString:aa});function sa(){return this.rgb().formatHex()}function Vp(){return this.rgb().formatHex8()}function Op(){return fa(this).formatHsl()}function aa(){return this.rgb().formatRgb()}function ht(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Sp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?la(t):o===3?new Ee(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?$n(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?$n(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=Mp.exec(e))?new Ee(t[1],t[2],t[3],1):(t=Pp.exec(e))?new Ee(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Lp.exec(e))?$n(t[1],t[2],t[3],t[4]):(t=Dp.exec(e))?$n(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kp.exec(e))?ua(t[1],t[2]/100,t[3]/100,1):(t=Rp.exec(e))?ua(t[1],t[2]/100,t[3]/100,t[4]):ia.hasOwnProperty(e)?la(ia[e]):e==="transparent"?new Ee(NaN,NaN,NaN,0):null}function la(e){return new Ee(e>>16&255,e>>8&255,e&255,1)}function $n(e,t,o,n){return n<=0&&(e=t=o=NaN),new Ee(e,t,o,n)}function Hp(e){return e instanceof Qo||(e=ht(e)),e?(e=e.rgb(),new Ee(e.r,e.g,e.b,e.opacity)):new Ee}function fo(e,t,o,n){return arguments.length===1?Hp(e):new Ee(e,t,o,n==null?1:n)}function Ee(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Un(Ee,fo,ui(Qo,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new Ee(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zo:Math.pow(Zo,e),new Ee(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ee(Dt(this.r),Dt(this.g),Dt(this.b),qn(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:ca,formatHex:ca,formatHex8:Gp,formatRgb:da,toString:da}));function ca(){return`#${Lt(this.r)}${Lt(this.g)}${Lt(this.b)}`}function Gp(){return`#${Lt(this.r)}${Lt(this.g)}${Lt(this.b)}${Lt((isNaN(this.opacity)?1:this.opacity)*255)}`}function da(){let e=qn(this.opacity);return`${e===1?"rgb(":"rgba("}${Dt(this.r)}, ${Dt(this.g)}, ${Dt(this.b)}${e===1?")":`, ${e})`}`}function qn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Dt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Lt(e){return e=Dt(e),(e<16?"0":"")+e.toString(16)}function ua(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new He(e,t,o,n)}function fa(e){if(e instanceof He)return new He(e.h,e.s,e.l,e.opacity);if(e instanceof Qo||(e=ht(e)),!e)return new He;if(e instanceof He)return e;e=e.rgb();var t=e.r/255,o=e.g/255,n=e.b/255,r=Math.min(t,o,n),i=Math.max(t,o,n),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(o-n)/a+(o<n)*6:o===i?s=(n-t)/a+2:s=(t-o)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new He(s,a,l,e.opacity)}function ma(e,t,o,n){return arguments.length===1?fa(e):new He(e,t,o,n==null?1:n)}function He(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Un(He,ma,ui(Qo,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new He(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zo:Math.pow(Zo,e),new He(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 Ee(pi(e>=240?e-240:e+120,r,n),pi(e,r,n),pi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new He(pa(this.h),Xn(this.s),Xn(this.l),qn(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=qn(this.opacity);return`${e===1?"hsl(":"hsla("}${pa(this.h)}, ${Xn(this.s)*100}%, ${Xn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function pa(e){return e=(e||0)%360,e<0?e+360:e}function Xn(e){return Math.max(0,Math.min(1,e||0))}function pi(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 fi(e,t,o,n,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*o+(1+3*e+3*i-3*s)*n+s*r)/6}function ga(e){var t=e.length-1;return function(o){var n=o<=0?o=0:o>=1?(o=1,t-1):Math.floor(o*t),r=e[n],i=e[n+1],s=n>0?e[n-1]:2*r-i,a=n<t-1?e[n+2]:2*i-r;return fi((o-n/t)*t,s,r,i,a)}}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],s=e[(n+1)%t],a=e[(n+2)%t];return fi((o-n/t)*t,r,i,s,a)}}var mi=e=>()=>e;function Bp(e,t){return function(o){return e+o*t}}function zp(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 ya(e){return(e=+e)==1?Zn:function(t,o){return o-t?zp(t,o,e):mi(isNaN(t)?o:t)}}function Zn(e,t){var o=t-e;return o?Bp(e,o):mi(isNaN(e)?t:e)}var Jn=function e(t){var o=ya(t);function n(r,i){var s=o((r=fo(r)).r,(i=fo(i)).r),a=o(r.g,i.g),l=o(r.b,i.b),c=Zn(r.opacity,i.opacity);return function(d){return r.r=s(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function xa(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),s,a;for(s=0;s<o;++s)a=fo(t[s]),n[s]=a.r||0,r[s]=a.g||0,i[s]=a.b||0;return n=e(n),r=e(r),i=e(i),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=i(l),a+""}}}var Fp=xa(ga),Wp=xa(ha);function ke(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var hi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gi=new RegExp(hi.source,"g");function Yp(e){return function(){return e}}function Up(e){return function(t){return e(t)+""}}function yi(e,t){var o=hi.lastIndex=gi.lastIndex=0,n,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(n=hi.exec(e))&&(r=gi.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:ke(n,r)})),o=gi.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Up(l[0].x):Yp(t):(t=l.length,function(c){for(var d=0,p;d<t;++d)a[(p=l[d]).i]=p.x(c);return a.join("")})}var Ea=180/Math.PI,Qn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xi(e,t,o,n,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(a=Math.sqrt(o*o+n*n))&&(o/=a,n/=a,l/=a),e*n<t*o&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Ea,skewX:Math.atan(l)*Ea,scaleX:s,scaleY:a}}var jn;function ba(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Qn:xi(t.a,t.b,t.c,t.d,t.e,t.f)}function _a(e){return e==null?Qn:(jn||(jn=document.createElementNS("http://www.w3.org/2000/svg","g")),jn.setAttribute("transform",e),(e=jn.transform.baseVal.consolidate())?(e=e.matrix,xi(e.a,e.b,e.c,e.d,e.e,e.f)):Qn)}function Ta(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,p,u,f,y){if(c!==p||d!==u){var g=f.push("translate(",null,t,null,o);y.push({i:g-4,x:ke(c,p)},{i:g-2,x:ke(d,u)})}else(p||u)&&f.push("translate("+p+t+u+o)}function s(c,d,p,u){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),u.push({i:p.push(r(p)+"rotate(",null,n)-2,x:ke(c,d)})):d&&p.push(r(p)+"rotate("+d+n)}function a(c,d,p,u){c!==d?u.push({i:p.push(r(p)+"skewX(",null,n)-2,x:ke(c,d)}):d&&p.push(r(p)+"skewX("+d+n)}function l(c,d,p,u,f,y){if(c!==p||d!==u){var g=f.push(r(f)+"scale(",null,",",null,")");y.push({i:g-4,x:ke(c,p)},{i:g-2,x:ke(d,u)})}else(p!==1||u!==1)&&f.push(r(f)+"scale("+p+","+u+")")}return function(c,d){var p=[],u=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,p,u),s(c.rotate,d.rotate,p,u),a(c.skewX,d.skewX,p,u),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,p,u),c=d=null,function(f){for(var y=-1,g=u.length,m;++y<g;)p[(m=u[y]).i]=m.x(f);return p.join("")}}}var Ei=Ta(ba,"px, ","px)","deg)"),bi=Ta(_a,", ",")",")");var mo=0,en=0,jo=0,va=1e3,er,tn,tr=0,kt=0,or=0,on=typeof performance=="object"&&performance.now?performance:Date,wa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rn(){return kt||(wa($p),kt=on.now()+or)}function $p(){kt=0}function nn(){this._call=this._time=this._next=null}nn.prototype=nr.prototype={constructor:nn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?rn():+o)+(t==null?0:+t),!this._next&&tn!==this&&(tn?tn._next=this:er=this,tn=this),this._call=e,this._time=o,_i()},stop:function(){this._call&&(this._call=null,this._time=1/0,_i())}};function nr(e,t,o){var n=new nn;return n.restart(e,t,o),n}function Aa(){rn(),++mo;for(var e=er,t;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mo}function Na(){kt=(tr=on.now())+or,mo=en=0;try{Aa()}finally{mo=0,Kp(),kt=0}}function Xp(){var e=on.now(),t=e-tr;t>va&&(or-=t,tr=e)}function Kp(){for(var e,t=er,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:er=o);tn=e,_i(n)}function _i(e){if(!mo){en&&(en=clearTimeout(en));var t=e-kt;t>24?(e<1/0&&(en=setTimeout(Na,e-on.now()-or)),jo&&(jo=clearInterval(jo))):(jo||(tr=on.now(),jo=setInterval(Xp,va)),mo=1,wa(Na))}}function rr(e,t,o){var n=new nn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var qp=ai("start","end","cancel","interrupt"),Zp=[],Sa=0,Ia=1,sr=2,ir=3,Ca=4,ar=5,sn=6;function yt(e,t,o,n,r,i){var s=e.__transition;if(!s)e.__transition={};else if(o in s)return;Jp(e,o,{name:t,index:n,group:r,on:qp,tween:Zp,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Sa})}function an(e,t){var o=se(e,t);if(o.state>Sa)throw new Error("too late; already scheduled");return o}function le(e,t){var o=se(e,t);if(o.state>ir)throw new Error("too late; already running");return o}function se(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Jp(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=nr(i,0,o.time);function i(c){o.state=Ia,o.timer.restart(s,o.delay,o.time),o.delay<=c&&s(c-o.delay)}function s(c){var d,p,u,f;if(o.state!==Ia)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===ir)return rr(s);f.state===Ca?(f.state=sn,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=sn,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(rr(function(){o.state===ir&&(o.state=Ca,o.timer.restart(a,o.delay,o.time),a(c))}),o.state=sr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===sr){for(o.state=ir,r=new Array(u=o.tween.length),d=0,p=-1;d<u;++d)(f=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++p]=f);r.length=p+1}}function a(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=ar,1),p=-1,u=r.length;++p<u;)r[p].call(e,d);o.state===ar&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=sn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function Ti(e,t){var o=e.__transition,n,r,i=!0,s;if(o){t=t==null?null:t+"";for(s in o){if((n=o[s]).name!==t){i=!1;continue}r=n.state>sr&&n.state<ar,n.state=sn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[s]}i&&delete e.__transition}}function Ma(e){return this.each(function(){Ti(this,e)})}function Qp(e,t){var o,n;return function(){var r=le(this,e),i=r.tween;if(i!==o){n=o=i;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}r.tween=n}}function jp(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=le(this,e),s=i.tween;if(s!==n){r=(n=s).slice();for(var a={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Pa(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=se(this.node(),o).tween,r=0,i=n.length,s;r<i;++r)if((s=n[r]).name===e)return s.value;return null}return this.each((t==null?Qp:jp)(o,e,t))}function go(e,t,o){var n=e._id;return e.each(function(){var r=le(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return se(r,n).value[t]}}function lr(e,t){var o;return(typeof t=="number"?ke:t instanceof ht?Jn:(o=ht(t))?(t=o,Jn):yi)(e,t)}function ef(e){return function(){this.removeAttribute(e)}}function tf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function of(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===n?i:i=t(n=s,o)}}function nf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===n?i:i=t(n=s,o)}}function rf(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function sf(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function La(e,t){var o=tt(e),n=o==="transform"?bi:lr;return this.attrTween(e,typeof t=="function"?(o.local?sf:rf)(o,n,go(this,"attr."+e,t)):t==null?(o.local?tf:ef)(o):(o.local?nf:of)(o,n,t))}function af(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function lf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function cf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&lf(e,i)),o}return r._value=t,r}function df(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&af(e,i)),o}return r._value=t,r}function Da(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=tt(e);return this.tween(o,(n.local?cf:df)(n,t))}function uf(e,t){return function(){an(this,e).delay=+t.apply(this,arguments)}}function pf(e,t){return t=+t,function(){an(this,e).delay=t}}function ka(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uf:pf)(t,e)):se(this.node(),t).delay}function ff(e,t){return function(){le(this,e).duration=+t.apply(this,arguments)}}function mf(e,t){return t=+t,function(){le(this,e).duration=t}}function Ra(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ff:mf)(t,e)):se(this.node(),t).duration}function gf(e,t){if(typeof t!="function")throw new Error;return function(){le(this,e).ease=t}}function Va(e){var t=this._id;return arguments.length?this.each(gf(t,e)):se(this.node(),t).ease}function hf(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;le(this,e).ease=o}}function Oa(e){if(typeof e!="function")throw new Error;return this.each(hf(this._id,e))}function Ha(e){typeof e!="function"&&(e=Ko(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ge(n,this._parents,this._name,this._id)}function Ga(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),s=new Array(n),a=0;a<i;++a)for(var l=t[a],c=o[a],d=l.length,p=s[a]=new Array(d),u,f=0;f<d;++f)(u=l[f]||c[f])&&(p[f]=u);for(;a<n;++a)s[a]=t[a];return new ge(s,this._parents,this._name,this._id)}function yf(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 xf(e,t,o){var n,r,i=yf(t)?an:le;return function(){var s=i(this,e),a=s.on;a!==n&&(r=(n=a).copy()).on(t,o),s.on=r}}function Ba(e,t){var o=this._id;return arguments.length<2?se(this.node(),o).on.on(e):this.each(xf(o,e,t))}function Ef(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function za(){return this.on("end.remove",Ef(this._id))}function Fa(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Pt(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],l=a.length,c=i[s]=new Array(l),d,p,u=0;u<l;++u)(d=a[u])&&(p=e.call(d,d.__data__,u,a))&&("__data__"in d&&(p.__data__=d.__data__),c[u]=p,yt(c[u],t,o,u,c,se(d,o)));return new ge(i,this._parents,t,o)}function Wa(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Xo(e));for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var l=n[a],c=l.length,d,p=0;p<c;++p)if(d=l[p]){for(var u=e.call(d,d.__data__,p,l),f,y=se(d,o),g=0,m=u.length;g<m;++g)(f=u[g])&&yt(f,t,o,g,u,y);i.push(u),s.push(d)}return new ge(i,s,t,o)}var bf=ot.prototype.constructor;function Ya(){return new bf(this._groups,this._parents)}function _f(e,t){var o,n,r;return function(){var i=gt(this,e),s=(this.style.removeProperty(e),gt(this,e));return i===s?null:i===o&&s===n?r:r=t(o=i,n=s)}}function Ua(e){return function(){this.style.removeProperty(e)}}function Tf(e,t,o){var n,r=o+"",i;return function(){var s=gt(this,e);return s===r?null:s===n?i:i=t(n=s,o)}}function Nf(e,t,o){var n,r,i;return function(){var s=gt(this,e),a=o(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),gt(this,e))),s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a))}}function vf(e,t){var o,n,r,i="style."+t,s="end."+i,a;return function(){var l=le(this,e),c=l.on,d=l.value[i]==null?a||(a=Ua(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(s,r=d),l.on=n}}function $a(e,t,o){var n=(e+="")=="transform"?Ei:lr;return t==null?this.styleTween(e,_f(e,n)).on("end.style."+e,Ua(e)):typeof t=="function"?this.styleTween(e,Nf(e,n,go(this,"style."+e,t))).each(vf(this._id,e)):this.styleTween(e,Tf(e,n,t),o).on("end.style."+e,null)}function wf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function Af(e,t,o){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&wf(e,s,o)),n}return i._value=t,i}function Xa(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,Af(e,t,o==null?"":o))}function If(e){return function(){this.textContent=e}}function Cf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Ka(e){return this.tween("text",typeof e=="function"?Cf(go(this,"text",e)):If(e==null?"":e+""))}function Sf(e){return function(t){this.textContent=e.call(this,t)}}function Mf(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Sf(r)),t}return n._value=e,n}function qa(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,Mf(e))}function Za(){for(var e=this._name,t=this._id,o=cr(),n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=se(l,t);yt(l,e,o,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ge(n,this._parents,e,o)}function Ja(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};o.each(function(){var c=le(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Pf=0;function ge(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Qa(e){return ot().transition(e)}function cr(){return++Pf}var nt=ot.prototype;ge.prototype=Qa.prototype={constructor:ge,select:Fa,selectAll:Wa,selectChild:nt.selectChild,selectChildren:nt.selectChildren,filter:Ha,merge:Ga,selection:Ya,transition:Za,call:nt.call,nodes:nt.nodes,node:nt.node,size:nt.size,empty:nt.empty,each:nt.each,on:Ba,attr:La,attrTween:Da,style:$a,styleTween:Xa,text:Ka,textTween:qa,remove:za,tween:Pa,delay:ka,duration:Ra,ease:Va,easeVarying:Oa,end:Ja,[Symbol.iterator]:nt[Symbol.iterator]};function dr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Lf={time:null,delay:0,duration:250,ease:dr};function Df(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 ja(e){var t,o;e instanceof ge?(t=e._id,e=e._name):(t=cr(),(o=Lf).time=rn(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&yt(l,e,t,c,s,o||Df(l,t));return new ge(n,this._parents,e,t)}ot.prototype.interrupt=Ma;ot.prototype.transition=ja;function xt(e,t,o){this.k=e,this.x=t,this.y=o}xt.prototype={constructor:xt,scale:function(e){return e===1?this:new xt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xt(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 ur=new xt(1,0,0);pr.prototype=xt.prototype;function pr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ur;return e.__zoom}var Rf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var el;(function(e){e.Strict="strict",e.Loose="loose"})(el||(el={}));var tl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(tl||(tl={}));var ol;(function(e){e.Partial="partial",e.Full="full"})(ol||(ol={}));var nl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(nl||(nl={}));var rl;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(rl||(rl={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));var rE={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};var Vf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Of=(e,t=[0,0])=>{var a;let{width:o,height:n}=Hf(e),r=(a=e.origin)!=null?a:t,i=o*r[0],s=n*r[1];return{x:e.position.x-i,y:e.position.y-s}};var Ae=(e,t=[0,0])=>{var r,i,s,a,l,c,d,p;let{x:o,y:n}=Vf(e)?e.internals.positionAbsolute:Of(e,t);return{x:o,y:n,x2:o+((a=(s=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?s:e.initialWidth)!=null?a:0),y2:n+((p=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?p:0)}};function Hf(e){var t,o,n,r,i,s,a,l;return{width:(r=(n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:e.initialWidth)!=null?r:0,height:(l=(a=(s=(i=e.measured)==null?void 0:i.height)!=null?s:e.height)!=null?a:e.initialHeight)!=null?l:0}}var iE={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}};var Gf={nodeOrigin:[0,0],nodeExtent:Rf,elevateNodesOnSelect:!0,defaults:{}},sE=v(b({},Gf),{checkEquality:!0});var il;(function(e){e.Line="line",e.Handle="handle"})(il||(il={}));var Bf={width:0,height:0,x:0,y:0},aE=v(b({},Bf),{pointerX:0,pointerY:0,aspectRatio:1});var Ie=require("react"),cl=require("zustand/shallow");var zf=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Ff(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 Wf(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 fr=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,[s,a]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],l=[];for(let u of i){if(u.position<s)continue;if(u.position>a)break;if(u.node.id===n.id||u.node.parentId===n.id||!zf(u.nodeBox,r))continue;let f=Math.abs(u.position-o);if(f>mr)continue;let g=Ff(u.nodeBox,Ae(n))>0?0:Wf(u.nodeBox,Ae(n));l.push({line:u,lineDist:f,nodeDist:g})}let c=.5,d=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((u,f)=>{if(d){if(u.line===d&&f.line!==d)return-1;if(f.line===d&&u.line!==d)return 1}return Math.abs(u.lineDist-f.lineDist)<=c?u.nodeDist-f.nodeDist:u.lineDist-f.lineDist});let p=l.length>0?l[0].line:void 0;return p&&(t==="horizontal"?this.lastHorizontalLine=p:this.lastVerticalLine=p),p}};function sl(e,t=Rt,o){let n=[];return e==null||e.forEach(r=>{let i=o(r.id);if(!i)throw new Error(`Node with id ${r.id} not found in internal nodes.`);let s=Ae(i);Object.entries(t).forEach(([a,l])=>{var c;n.push({nodeBox:s,node:r,orientation:l.orientation,position:l.resolve(r,s),color:(c=r.style)==null?void 0:c.backgroundColor,anchorName:a})})}),n}function al(e,t,o,n,r=Object.keys(Rt)){let i=[];for(let a of r){let l=Rt[a],c=l.resolve(o,n),d=e.search(l.orientation,c,o,t);d&&i.push({anchorName:a,sourcePosition:c,anchor:l,line:d})}let s={horizontal:void 0,vertical:void 0};for(let a of i){let l=s[a.anchor.orientation],c=Math.abs(a.sourcePosition-a.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(s[a.anchor.orientation]=a)}return s}function ll(e,t,o,n,r,i,s,a){var p,u,f,y,g,m,_,h;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+((u=(p=e.measured)==null?void 0:p.width)!=null?u:0),y2:o.position.y+((y=(f=e.measured)==null?void 0:f.height)!=null?y:0)};if(s){let T=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(T)<=mr){if(o.position.y-=T,r!=null&&r.dimensions)if(n){let N=t.internals.positionAbsolute.y+((m=(g=e.measured)==null?void 0:g.height)!=null?m:0);r.dimensions.height=N-s.line.position}else r.dimensions.height=s.line.position-t.internals.positionAbsolute.y;c=!0}}if(a){let T=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(T)<=mr){if(o.position.x-=T,r!=null&&r.dimensions)if(n){let N=t.internals.positionAbsolute.x+((h=(_=e.measured)==null?void 0:_.width)!=null?h:0);r.dimensions.width=N-a.line.position}else r.dimensions.width=a.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 mr=10,Rt={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 dl=require("react/jsx-runtime"),Yf=new fr;function yo(){let[e,t]=(0,Ie.useState)(void 0),[o,n]=(0,Ie.useState)(void 0),{width:r,height:i}=(0,ho.useStore)(m=>({width:m.width,height:m.height}),cl.shallow),s=(0,ho.useNodesInitialized)(),a=(0,Ie.useRef)(Yf),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,ho.useReactFlow)(),p=(0,Ie.useCallback)(()=>{t(void 0),n(void 0)},[]),u=(0,Ie.useCallback)(m=>{let _=m!=null?m:d();p();let h=sl(_,Rt,c);a.current.initialize(h)},[c,p,d]),f=(0,Ie.useCallback)(()=>{setTimeout(()=>{u()},100)},[u]);(0,Ie.useEffect)(()=>{s&&u(d())},[s,u,d]);let y=(0,Ie.useCallback)((m,_)=>{var W,B,F,J,ne;if(!a.current||m.length===0||m.length>2)return m;p();let h,E,T=Object.keys(Rt);m.length===1?m[0].type==="position"?h=m[0]:m[0].type==="dimensions"&&(E=m[0],T=["right","bottom"]):m[0].type==="position"&&m[1].type==="dimensions"&&m[1].dimensions&&(h=m[0],E=m[1],T=["top","left"]);let N=_.find(X=>X.id===m[0].id);if(!N)return m;let w=c(N.id);if(!w)throw new Error(`Node with id ${N.id} not found in internal nodes`);let x=c((W=w.parentId)!=null?W:""),I=Ae(w);E!=null&&E.dimensions&&(I.x2=I.x+E.dimensions.width,I.y2=I.y+E.dimensions.height);let{x:R,y:k}=l({x:0,y:0}),{x:A,y:S}=l({x:r,y:i}),P={x:R,y:k,x2:A,y2:S},{horizontal:C,vertical:M}=al(a.current,P,N,I,T),L={id:N.id,type:"position",position:{x:w.internals.positionAbsolute.x,y:w.internals.positionAbsolute.y},dragging:!1};h!=null&&h.position&&L.position&&(x?(L.position.x=h.position.x+((F=(B=x==null?void 0:x.position)==null?void 0:B.x)!=null?F:0),L.position.y=h.position.y+((ne=(J=x==null?void 0:x.position)==null?void 0:J.y)!=null?ne:0)):(L.position.x=h.position.x,L.position.y=h.position.y));let{snappedX:z,snappedY:H}=ll(N,w,L,h,E,x,C,M);if(z||H){if((E!=null&&E.resizing||h!=null&&h.dragging)&&(z&&n(M==null?void 0:M.line),H&&t(C==null?void 0:C.line)),E&&h)return[L,E];if(h)return[L];if(E)return[E]}return m},[l,c,r,i,t,n,p]),g=(0,Ie.useCallback)(()=>(0,dl.jsx)(ul,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:u,forceRebuildIndex:f,updateHelperLines:y,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var zc=require("@xyflow/react"),Oi=require("react");var ln=e=>new Map(e.map(t=>[t.id,t])),gr=e=>e.some(t=>t.type==="START_EVENT"),pl=(e,t,o,n)=>{let r=ln(o),i=r.get(e);if(!i||i.type!=="START_EVENT")return!1;let s=r.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let c=r.get(l.target);return(c==null?void 0:c.type)!=="ANNOTATION"}).length>=1},hr=(e,t,o)=>{var i;let n=t.find(s=>s.id===e);return!n||n.type!=="GATEWAY"||((i=n.data)==null?void 0:i.variant)!=="EXCLUSIVE"?!1:o.filter(s=>s.source===e).length>=2},fl=(e,t,o)=>{var s,a,l,c;let n=ln(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((s=r==null?void 0:r.data)==null?void 0:s.variant)==="EXCLUSIVE"&&((a=i==null?void 0:i.data)==null?void 0:a.variant)==="PARALLEL"||((l=r==null?void 0:r.data)==null?void 0:l.variant)==="COMPLEX"&&((c=i==null?void 0:i.data)==null?void 0:c.variant)==="PARALLEL"},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"},xr=(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"},Er=(e,t,o)=>{let n=ln(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(s=>s.target===e).some(s=>{let a=n.get(s.source);return(a==null?void 0:a.type)==="START_EVENT"})},br=(e,t,o)=>{let n=ln(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(s=>s.source===e).some(s=>{let a=n.get(s.target);return(a==null?void 0:a.type)==="END_EVENT"})},_r=(e,t)=>t.filter(n=>n.source===e).length>0,Tr=(e,t,o,n)=>{let r=ln(o),i=r.get(e);if(!i||i.type!=="TASK")return!1;let s=t?r.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let c=r.get(l.target);return(c==null?void 0:c.type)!=="ANNOTATION"}).length>=2};var Uf=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!pl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"start_event_limit_reached"}),e=>({isValid:!hr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!Tr(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:fl(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:!(yr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(xr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Er(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(br(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(_r(e.sourceNodeId,e.edges)&&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"})],ml=e=>{for(let t of Uf){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var $f=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:hr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:gr(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:xr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Er(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:br(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:Tr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],gl=e=>{let t=$f.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 Ge=require("@xyflow/react");var xo=require("@xyflow/react");function hl(e,t){var E,T,N,w;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,s=o/2,a=n/2,l=r.x+s,c=r.y+a,d=i.x+((T=(E=t==null?void 0:t.measured)==null?void 0:E.width)!=null?T:0)/2,p=i.y+((w=(N=t==null?void 0:t.measured)==null?void 0:N.height)!=null?w:0)/2,u=(d-l)/(2*s)-(p-c)/(2*a),f=(d-l)/(2*s)+(p-c)/(2*a),y=1/(Math.abs(u)+Math.abs(f)||1),g=y*u,m=y*f,_=s*(g+m)+l,h=a*(-g+m)+c;return{x:_,y:h}}function yl(e,t){var c,d,p,u;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(u=(p=e.measured)==null?void 0:p.height)!=null?u:0,i=Math.round(o.x),s=Math.round(o.y),a=Math.round(t.x),l=Math.round(t.y);return a<=i+1?xo.Position.Left:a>=i+n-1?xo.Position.Right:l<=s+1?xo.Position.Top:l>=s+r-1?xo.Position.Bottom:xo.Position.Top}function rt(e,t){let o=hl(e,t),n=hl(t,e),r=yl(e,o),i=yl(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var $e=require("lecom-ui"),El=require("lucide-react");var Re=require("@xyflow/react");var xl=require("@xyflow/react");var Et=()=>{let{getNodes:e,setNodes:t,getEdges:o,setEdges:n}=(0,xl.useReactFlow)();return{selectElements:s=>{let a=e().map(c=>v(b({},c),{selected:s.includes(c.id)})),l=o().map(c=>v(b({},c),{selected:s.includes(c.id)}));return t(a),n(l),!0},clearSelection:async()=>{let s=e().map(l=>v(b({},l),{selected:!1})),a=o().map(l=>v(b({},l),{selected:!1}));return t(s),n(a),await Dn(),!0}}};var Nr=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,Re.useReactFlow)(),{selectElements:r}=Et(),i=m=>{let _=o(),h=n(),E=(0,Re.getIncomers)(m,_,h),T=(0,Re.getOutgoers)(m,_,h),N=E.some(x=>x.type==="START_EVENT"),w=T.some(x=>x.type==="END_EVENT");return N?"start":w?"end":"between"},s=(m,_,h)=>{var N,w,x,I;if(!m)return;let E={type:m.type,variant:(N=m.data)==null?void 0:N.variant,attribute:(w=m.data)==null?void 0:w.attribute},T={id:m.id,position:i(m),label:(x=m.data)==null?void 0:x.label,node:E};return m.type==="TASK"&&((I=m.data)==null?void 0:I.variant)==="SUBPROCESS"?v(b({},T),{type:"sub_process"}):m.type==="GATEWAY"?v(b({},T),{type:"gateway",variant:a(m,_,h)}):v(b({},T),{type:"activity"})},a=(m,_,h)=>{if(m.type!=="GATEWAY")return;let E=(0,Re.getIncomers)(m,_,h),T=!1,N=!1;if(E.forEach(w=>{var x,I;w.type==="TASK"&&(((x=w.data)==null?void 0:x.variant)==="SCRIPT"&&(T=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(N=!0))}),T&&N)return"script_loop";if(T)return"script";if(N)return"loop"},l=(m,_,h)=>{var x,I,R,k;let E=e(m.source),T=e(m.target);if(!E||!T)return"simple";if((0,Re.getOutgoers)(E,_,h).some(A=>A.type==="END_EVENT"))return"final";if(E.type==="GATEWAY")switch((x=E.data)==null?void 0:x.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(E.type==="TASK"){let A=(I=E.data)==null?void 0:I.variant,S=(R=E.data)==null?void 0:R.attribute;if(T.type==="TASK"&&((k=T.data)==null?void 0:k.variant)==="SUBPROCESS")return"to_sub_process";let P=A==="SCRIPT",C=S==="LOOP";return P&&C?"script_loop":P?"script":C?"loop":"simple"}return"simple"},c=(m,_,h)=>{let E=[];function T(w,x,I=0){let R=s(w,_,h);if(R.depth=I,x.push(R),w.type==="TASK"){E.push([...x]),x.pop();return}let k=(0,Re.getIncomers)(w,_,h);if(k.length)for(let A of k)T(A,x,I+1);x.pop()}let N=(0,Re.getIncomers)(m,_,h);for(let w of N)T(w,[]);return E},d=(m,_,h)=>{let E=[];function T(w,x,I=0){let R=s(w,_,h);if(R.depth=I,x.push(R),w.type==="TASK"){E.push([...x]),x.pop();return}let k=(0,Re.getOutgoers)(w,_,h);if(k.length)for(let A of k)T(A,x,I+1);x.pop()}let N=(0,Re.getOutgoers)(m,_,h);for(let w of N)T(w,[]);return E},p=(m,_,h)=>{h=h.filter(T=>T.source===m.id);let E=h.map(T=>{var x;let N=e(T.target),w;return N&&(w=s(N,_,h)),{id:T.id,type:"routing",variant:l(T,_,h),label:(x=T.data)==null?void 0:x.label,target:w}});return console.log(E),E},u=m=>{let _=e(m);if(!_)return;let h=o(),E=n(),T=s(_,h,E);return T.sources=c(_,h,E),T.targets=d(_,h,E),T.edgeTargets=p(_,h,E),_.type==="GATEWAY"&&(T.variant=a(_,h,E)),T},f=m=>{let _=t(m);if(!_)return;let h=o(),E=n(),T=l(_,h,E),w={id:_.id,type:"routing",variant:T,gatewayVariant:void 0},x=e(_.source);if(x){let R=s(x,h,E),k=c(x,h,E),A=a(x,h,E);w.source=R,w.sources=k.length?k:[[R]],w.gatewayVariant=A}let I=e(_.target);if(I){let R=s(I,h,E),k=d(I,h,E);w.target=R,w.targets=k.length?k:[[R]]}return w},y=m=>{let _=e(m);if(_)return u(_.id);let h=t(m);if(h)return f(h.id)};return{configureElement:m=>{let _=y(m);if(_)return r([m]),_},getConfigureElement:y,getNodeConfigure:u,getEdgeConfigure:f}};var Vt=require("react/jsx-runtime"),bt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,$e.useTranslation)(),{onConfigureElement:n}=V(),{getConfigureElement:r}=Nr();return(0,Vt.jsxs)($e.Tooltip,{children:[(0,Vt.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,Vt.jsx)($e.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let s=r(e);s&&(n==null||n(s))},children:(0,Vt.jsx)(El.Settings,{size:16})})}),(0,Vt.jsx)($e.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var bl=require("@xyflow/react"),Xe=require("lecom-ui"),_l=require("lucide-react"),Ot=require("react/jsx-runtime"),vr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Xe.useTranslation)(),{deleteElements:n}=(0,bl.useReactFlow)();return(0,Ot.jsxs)(Xe.Tooltip,{children:[(0,Ot.jsx)(Xe.TooltipTrigger,{asChild:!0,children:(0,Ot.jsx)(Xe.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ot.jsx)(_l.TrashIcon,{size:16})})}),(0,Ot.jsx)(Xe.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Ke=require("lecom-ui"),Tl=require("lucide-react"),Nl=require("react"),Ht=require("react/jsx-runtime"),cn=({nodeId:e})=>{let{t}=(0,Ke.useTranslation)(),o=(0,Nl.useCallback)(n=>{n.stopPropagation();let r=document.querySelector(`[data-id="${e}"]`);if(!r)return;let i=r.querySelector(".react-flow__handle.source");if(!i)return;let s=i.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=new MouseEvent("mousedown",{clientX:a,clientY:l,bubbles:!0,cancelable:!0});i.dispatchEvent(c)},[e]);return(0,Ht.jsxs)(Ke.Tooltip,{children:[(0,Ht.jsx)(Ke.TooltipTrigger,{asChild:!0,children:(0,Ht.jsx)(Ke.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onMouseDown:o,children:(0,Ht.jsx)(Tl.MoveUpRightIcon,{size:16})})}),(0,Ht.jsx)(Ke.TooltipContent,{color:"black",children:t("editor.toolbar.connect_node")})]})};var Eo=require("react/jsx-runtime"),bo=i=>{var s=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=s,r=Ye(s,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:a}=V(),l=(o==null?void 0:o.type)==="START_EVENT",c=(n==null?void 0:n.type)==="END_EVENT",d=(o==null?void 0:o.type)==="GATEWAY"&&(n==null?void 0:n.type)==="GATEWAY",p=(o==null?void 0:o.type)==="TASK"&&(n==null?void 0:n.type)==="GATEWAY",u=!l&&!c&&!d&&!p,f=[{component:(0,Eo.jsx)(vr,{elementId:e,elementType:"edge"})}],y=()=>a==="view"?u?[{component:(0,Eo.jsx)(bt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,Eo.jsx)(bt,{elementId:e,elementType:"edge"})},...f]:f,m=(_=>{switch(_){case"SEQUENCE_EDGE":return y();case"MESSAGE_EDGE":return a==="view"?[]:[...f];case"ANNOTATION_EDGE":return a==="view"?[]:[...f];default:return[]}})(t);if(!(m.length===0||a==="view"))return(0,Eo.jsx)("div",v(b({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:m.map((_,h)=>(0,Eo.jsx)("div",{children:_.component},h))}))};var Gt=require("react/jsx-runtime"),_o={type:"ANNOTATION_EDGE",reconnectable:!0},vl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,Ge.useViewport)(),{isMultipleSelection:s}=V(),a=(0,Ge.useInternalNode)(t),l=(0,Ge.useInternalNode)(o);if(!a||!l)return null;let{sx:c,sy:d,tx:p,ty:u}=rt(a,l),[f,y,g]=(0,Ge.getStraightPath)({sourceX:c,sourceY:d,targetX:p,targetY:u}),m=n||(a==null?void 0:a.selected)||(l==null?void 0:l.selected),_=1/i;return(0,Gt.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":m}),children:[(0,Gt.jsx)(Ge.BaseEdge,{id:e,path:f,strokeDasharray:4,className:D("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)]":m&&!(r!=null&&r.hasError)})}),(0,Gt.jsx)(Ge.EdgeLabelRenderer,{children:(0,Gt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${g}px)`},children:n&&!s&&(0,Gt.jsx)(bo,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${_})`}})})})]})};var _e=require("react"),ce=require("@xyflow/react");var Bt=require("react");var Ni=require("react/jsx-runtime"),ue=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:s,onBlur:a})=>{let l=(0,Bt.useRef)(null),[c,d]=(0,Bt.useState)(!1);(0,Bt.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,Bt.useEffect)(()=>{if(c&&l.current){l.current.focus();let g=document.createRange();g.selectNodeContents(l.current);let m=window.getSelection();m&&(m.removeAllRanges(),m.addRange(g))}},[c]);let p=g=>{g.stopPropagation(),c||d(!0)},u=g=>{let m=g.currentTarget.innerText.trim(),_=t&&m.length>=t,h=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],E=g.ctrlKey||g.metaKey,T=E&&g.key==="a",N=E&&g.key==="c",w=E&&g.key==="x",x=E&&g.key==="v";function I(k){return/\w/.test(k)}if(m.length===0&&!I(g.key)&&!h.includes(g.key)&&!E){g.preventDefault();return}_&&(h.includes(g.key)||T||N||w||x||g.preventDefault())},f=g=>{if(!t)return;g.preventDefault();let m=g.clipboardData.getData("text/plain"),_=g.currentTarget.innerText,h=window.getSelection();if(!h||h.rangeCount===0)return;let E=h.getRangeAt(0);if((_.substring(0,E.startOffset)+m+_.substring(E.endOffset)).length>t){let N=t-(_.length-(E.endOffset-E.startOffset)),w=m.substring(0,Math.max(0,N));w&&(E.deleteContents(),E.insertNode(document.createTextNode(w)),E.setStartAfter(E.endContainer),E.collapse(!0),h.removeAllRanges(),h.addRange(E))}else E.deleteContents(),E.insertNode(document.createTextNode(m)),E.setStartAfter(E.endContainer),E.collapse(!0),h.removeAllRanges(),h.addRange(E)},y=g=>{d(!1);let m=g.currentTarget.innerText.trim();t&&m.length>t&&(m=m.substring(0,t)),g.currentTarget.innerText=m,a==null||a(),m!==e&&(s==null||s(m))};return(0,Ni.jsx)("div",{className:D("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:p,children:(0,Ni.jsx)("div",{ref:l,className:D("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:u,onPaste:f,onBlur:y,children:e})})};var un=require("@xyflow/react"),wr=e=>e===un.Position.Left||e===un.Position.Right,vi=(e,t=30)=>e===un.Position.Right||e===un.Position.Bottom?t:-t,wi=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,Ar=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Ir=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var zt={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15};function Xf(e,t,o,n,r,i){let s=vi(r,zt.OFFSET),a=vi(i,zt.OFFSET),l=wr(r),c=wr(i),d={x:e,y:t},p={x:o,y:n};if(l&&c){let u=(t+n)/2;return[d,{x:e+s,y:t},{x:e+s,y:u},{x:o+a,y:u},{x:o+a,y:n},p]}if(!l&&!c){let u=(e+o)/2;return[d,{x:e,y:t+s},{x:u,y:t+s},{x:u,y:n+a},{x:o,y:n+a},p]}return l?[d,{x:e+s,y:t},{x:e+s,y:n+a},{x:o,y:n+a},p]:[d,{x:e,y:t+s},{x:o+a,y:t+s},{x:o+a,y:n},p]}function Ai(e,t,o,n,r,i,s){let a=Xf(e,t,o,n,r,i);if(!(s!=null&&s.length)||s.length!==a.length-2)return a;let l=[{x:e,y:t},...s,{x:o,y:n}],c=wr(r);for(let d=0;d<l.length-1;d++){let p=l[d],u=l[d+1];if(Math.abs(u.x-p.x)>zt.TOLERANCE&&Math.abs(u.y-p.y)>zt.TOLERANCE){let y=d%2===0===c;l[d+1]=y?{x:u.x,y:p.y}:{x:p.x,y:u.y}}}return l}var wl=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 pe=require("react/jsx-runtime"),Be={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:ce.MarkerType.ArrowClosed},markerEnd:{type:ce.MarkerType.Arrow},data:{label:""}},{TOLERANCE:Al,MOVE_THRESHOLD:Cr,MIN_SEGMENT_LENGTH:Kf}=zt,Il=({id:e,source:t,target:o,data:n,selected:r})=>{var S;let{zoom:i}=(0,ce.useViewport)(),{updateEdgeData:s}=(0,ce.useReactFlow)(),{isMultipleSelection:a,mode:l}=V(),[c,d]=(0,_e.useState)(!1),[p,u]=(0,_e.useState)(null),f=(0,_e.useRef)(null),y=(0,_e.useRef)(null),g=(0,ce.useInternalNode)(t),m=(0,ce.useInternalNode)(o),{sx:_,sy:h,tx:E,ty:T,sourcePos:N,targetPos:w}=(0,_e.useMemo)(()=>g&&m?rt(g,m):{sx:0,sy:0,tx:0,ty:0,sourcePos:ce.Position.Right,targetPos:ce.Position.Left},[g,m]);(0,_e.useEffect)(()=>{var M;if(!y.current){y.current={sx:_,sy:h,tx:E,ty:T,sourcePos:N,targetPos:w};return}let P=y.current;(Math.abs(_-P.sx)>Cr||Math.abs(h-P.sy)>Cr||Math.abs(E-P.tx)>Cr||Math.abs(T-P.ty)>Cr||P.sourcePos!==N||P.targetPos!==w)&&((M=n==null?void 0:n.points)!=null&&M.length)&&s(e,v(b({},n),{points:void 0})),y.current={sx:_,sy:h,tx:E,ty:T,sourcePos:N,targetPos:w}},[_,h,E,T,N,w,n,e,s]);let x=(0,_e.useMemo)(()=>{var P;if((P=n==null?void 0:n.points)!=null&&P.length&&m){let M={internals:{positionAbsolute:n.points[n.points.length-1]},measured:{width:1,height:1}},L=rt(M,m);return Ai(_,h,L.tx,L.ty,N,L.targetPos,n.points)}return Ai(_,h,E,T,N,w,n==null?void 0:n.points)},[_,h,E,T,N,w,n==null?void 0:n.points,m]),I=(0,_e.useMemo)(()=>{if(x.length<2)return Ir({x:_,y:h},{x:E,y:T});let P=0;for(let L=0;L<x.length-1;L++)P+=Ar(x[L],x[L+1]);let C=P/2,M=0;for(let L=0;L<x.length-1;L++){let z=Ar(x[L],x[L+1]);if(M+z>=C){let H=(C-M)/z,W=x[L],B=x[L+1];return{x:W.x+(B.x-W.x)*H,y:W.y+(B.y-W.y)*H}}M+=z}return Ir({x:_,y:h},{x:E,y:T})},[x,_,h,E,T]),R=(0,_e.useCallback)((P,C)=>{if(l!=="edit"||C.button!==0)return;C.stopPropagation(),C.preventDefault();let M=x[P],L=x[P+1],z=wi(M,L,"y"),H=z?M.y:M.x;u(P);let W=F=>{let J=H+(z?F.clientY-C.clientY:F.clientX-C.clientX)/i;f.current=z?{x:(M.x+L.x)/2,y:J}:{x:J,y:(M.y+L.y)/2};let ne=x.map((X,ut)=>ut===0||ut===x.length-1?X:(z?Math.abs(X.y-H)<Al:Math.abs(X.x-H)<Al)?z?v(b({},X),{y:J}):v(b({},X),{x:J}):X);s(e,v(b({},n),{points:ne.slice(1,-1)}))},B=()=>{u(null),f.current=null,document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",B)};document.addEventListener("mousemove",W),document.addEventListener("mouseup",B)},[l,x,i,n,e,s]);if(!g||!m)return null;let k=wl(x),A=r||g.selected||m.selected;return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:()=>d(!1),onDoubleClick:()=>d(!0),children:[(0,pe.jsx)(ce.BaseEdge,{id:e,path:k,markerEnd:`url(#${A?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:D("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(n!=null&&n.hasError)})}),r&&!a&&l==="edit"&&(0,pe.jsx)("g",{children:x.slice(0,-1).map((P,C)=>{let M=x[C+1];if(C===0||C===x.length-2||Ar(P,M)<Kf)return null;let L=wi(P,M,"y"),z=p===C,H=z&&f.current?f.current:Ir(P,M);return(0,pe.jsxs)("g",{children:[(0,pe.jsx)("line",{x1:P.x,y1:P.y,x2:M.x,y2:M.y,stroke:"transparent",strokeWidth:20/i,className:D("cursor-pointer",{"cursor-ns-resize":L,"cursor-ew-resize":!L}),onMouseDown:W=>R(C,W)}),(0,pe.jsx)("circle",{cx:H.x,cy:H.y,r:4/i,fill:z?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/i,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:H.x,cy:H.y,r:6/i,fill:"none",stroke:"#3b82f6",strokeWidth:1/i,opacity:z?.6:.3,className:"pointer-events-none"})]},C)})})]}),(0,pe.jsx)(ce.EdgeLabelRenderer,{children:(0,pe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${I.x}px, ${I.y}px)`},children:[r&&!a&&(0,pe.jsx)(bo,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:g,targetNode:m,style:{transform:`scale(${1/i})`}}),(c||((S=n==null?void 0:n.label)==null?void 0:S.trim()))&&(0,pe.jsx)(ue,{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:c,onChange:P=>s(e,{label:P.trim()})})]})})]})};var Bc=require("use-debounce");var Gc=require("@xyflow/react"),Ri=require("react");var pn=(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))(pn||{});var Sr=require("xml-js");var Cl={compact:!0,spaces:4},qf=e=>e.replaceAll(`
|
|
2
|
-
`,"
");function Mr(e,t=Cl){if(e)return JSON.parse((0,Sr.xml2json)(e,v(b({},t),{attributeValueFn:qf})))}function Sl(e,t=Cl){return e?(0,Sr.json2xml)(e,t):""}var Zf={MIN_WIDTH:36,MIN_HEIGHT:36},Jf={MIN_WIDTH:36,MIN_HEIGHT:36},Qf={MIN_WIDTH:56,MIN_HEIGHT:56},Pr={MIN_WIDTH:176,MIN_HEIGHT:96},Lr={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},j={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Dr={MIN_WIDTH:176,MIN_HEIGHT:64},jf={MIN_WIDTH:128,MIN_HEIGHT:64},G={START_EVENT:Zf,END_EVENT:Jf,GATEWAY:Qf,TASK:Pr,LANE:j,ANNOTATION:Dr,UNSUPPORTED:jf};var Ml={"attribute-loop":"LOOP"},Pl={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Ll={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Dl={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},kl={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var To=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=ft(Number(n),t),s=ft(Number(r),o);return{width:i,height:s,measured:{width:i,height:s}}},No=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,s={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},a={id:n,position:s,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(a.parentId=l),a},tm=e=>{let{mxGeometry:t}=e,o=No(e),n=To(t,G.START_EVENT.MIN_WIDTH,G.START_EVENT.MIN_HEIGHT);return v(b(b({},o),n),{type:"START_EVENT"})},om=e=>{let{mxGeometry:t}=e,o=No(e),n=To(t,G.END_EVENT.MIN_WIDTH,G.END_EVENT.MIN_HEIGHT);return v(b(b({},o),n),{type:"END_EVENT"})},Ii=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=No(e),i=To(n,G.TASK.MIN_WIDTH,G.TASK.MIN_HEIGHT),s=t==null?void 0:t.find(l=>{let{parent:c}=l._attributes;return c===e._attributes.id});if(s){let{style:l}=s._attributes,c=Ml[l];c&&(r.data.attribute=c)}let a=Pl[o.style];return a&&(r.data.variant=a),v(b(b({},r),i),{type:"TASK"})},Ci=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=No(e),i=To(o,G.GATEWAY.MIN_WIDTH,G.GATEWAY.MIN_HEIGHT);return r.data.variant=Ll[n],v(b(b({},r),i),{type:"GATEWAY"})},nm=e=>{let{mxGeometry:t}=e,o=No(e),n=To(t,G.ANNOTATION.MIN_WIDTH,G.ANNOTATION.MIN_HEIGHT);return v(b(b({},o),n),{type:"ANNOTATION"})},rm=e=>{let{mxGeometry:t}=e,o=No(e),n=To(t,G.LANE.MIN_WIDTH,G.LANE.MIN_HEIGHT);return v(b(b({},o),n),{type:"LANE"})},Rl={task:Ii,"task-script":Ii,"subprocess-collapsed":Ii,"start-event":tm,"end-event-terminate":om,"gateway-parallel":Ci,"gateway-exclusive":Ci,"gateway-complex":Ci,annotation:nm,lane:rm},Vl=e=>{var d;let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:s,style:a}=t,l=(d=o==null?void 0:o.Array)==null?void 0:d.map(p=>({x:Number(p._attributes.x),y:Number(p._attributes.y)})),c={id:n,source:r,target:i,data:b({label:s||""},l&&l.length>0?{points:l}:{})};return a.includes("association")&&a.includes('endArrow=""')?b(b({},_o),c):b(b({},Be),c)},Ol=(e,t)=>{let{id:o,type:n,source:r,target:i,data:s}=e,a=t==null?void 0:t.find(p=>p.id===r),l="";n==="ANNOTATION_EDGE"&&(l='association;endArrow=""');let c={_attributes:{as:"geometry",relative:"1"}};return s!=null&&s.points&&Array.isArray(s.points)&&s.points.length>0&&(c.Array=s.points.map(p=>({_attributes:{as:"mxPoint",x:p.x,y:p.y}}))),{_attributes:{id:o,parent:(a==null?void 0:a.parentId)||"1",edge:"1",style:l,source:r,target:i,value:(s==null?void 0:s.label)||""},mxGeometry:c}},vo=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}}}},im=e=>{let{variant:t}=e.data,o=vo(e);return v(b({},o),{_attributes:v(b({},o._attributes),{style:Dl[t]||"task"})})},sm=e=>{let t=vo(e);return v(b({},t),{_attributes:v(b({},t._attributes),{style:"start-event"})})},am=e=>{let t=vo(e);return v(b({},t),{_attributes:v(b({},t._attributes),{style:"end-event-terminate"})})},lm=e=>{let{variant:t}=e.data,o=vo(e);return v(b({},o),{_attributes:v(b({},o._attributes),{style:kl[t]})})},cm=e=>{let t=vo(e);return v(b({},t),{_attributes:v(b({},t._attributes),{style:"lane"})})},dm=e=>{let t=vo(e);return v(b({},t),{_attributes:v(b({},t._attributes),{style:"annotation"})})},Hl={TASK:im,START_EVENT:sm,END_EVENT:am,GATEWAY:lm,ANNOTATION:dm,LANE:cm},Gl=(e,t)=>{var s,a;let r=((s=e.measured)==null?void 0:s.width)||0,i=((a=e.measured)==null?void 0:a.height)||0;return{_attributes:{id:`${t+1}`,parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:r/2-22/2,y:i-22,width:22,height:22}}}};var Si=Au(require("@dagrejs/dagre"),1),Wl=require("@xyflow/react");var Yl=require("lodash");var Bl=require("lodash");var it=e=>{var t,o,n,r,i,s,a,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(i=e.measured)==null?void 0:i.width)!=null?s:0,h:(l=(a=e.measured)==null?void 0:a.height)!=null?l:0}},st=e=>(0,Bl.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),zl=(e,t)=>{let{x:o,y:n}=it(e),{x:r,y:i}=it(t);return{x:o-r,y:n-i}};var wo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(O)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),um=(e,t)=>{let{x:o,y:n}=it(e),{x:r,y:i}=it(t),s=o-r,a=n-i;return Math.sqrt(s*s+a*a)},pm=(e,t)=>{let{x:o,y:n,w:r,h:i}=it(e),{x:s,y:a,w:l,h:c}=it(t);return o<s+l&&s<o+r&&n<a+c&&a<n+i},fn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&pm(e,r)){let i=um(e,r);i<n&&(n=i,o=r)}return o},Fl=(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 Ul=(e=[],t=[],o="LR")=>{let n=new Si.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:s,height:a})=>n.setNode(i,{width:s,height:a})),t.forEach(i=>n.setEdge(i.source,i.target)),Si.default.layout(n),{nodes:e.map(i=>{let s=n.node(i.id);return v(b({},i),{position:{x:s.x-i.width/2,y:s.y-i.height/2}})}),edges:t}},mn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Ft(n.id,o)}),o},Ft=(e,t)=>{var f,y;let o=[...t],n=o.find(g=>g.id===e);if(!n)return o;let r=o.filter(g=>g.parentId===e&&g.type==="LANE");if(r.length===0)return o;let i=(0,Yl.orderBy)(r,["position.y"]),s=Math.max((y=(f=n.measured)==null?void 0:f.width)!=null?y:0,Lr.MIN_WIDTH),a=Fl(e,i)||j.MIN_WIDTH,l=Math.max(s,a),c=s-j.HEADER_WIDTH>=a,d=0,p=0;i.forEach(g=>{var m,_,h,E;o=o.map(T=>T.id===g.id?v(b({},T),{width:c?l-j.HEADER_WIDTH:l,measured:v(b({},T.measured),{width:c?l-j.HEADER_WIDTH:l}),position:{x:j.HEADER_WIDTH,y:d}}):T),d+=(_=(m=g.measured)==null?void 0:m.height)!=null?_:0,p+=(E=(h=g.measured)==null?void 0:h.height)!=null?E:0}),o=o.map(g=>g.id===e?v(b({},g),{height:p,width:c?l:l+j.HEADER_WIDTH,measured:v(b({},g.measured),{height:p,width:c?l:l+j.HEADER_WIDTH})}):g);let u=o.find(g=>g.id===e);return u!=null&&u.parentId&&(o=Ft(u.parentId,o)),o},$l=(e,t,o)=>{if(e.type==="LANE")return o;let n=Ae(t),r=Ae(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+j.HEADER_WIDTH&&(e.position.x=j.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(b({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?v(b({},i),{position:e.position}):i),o},Xl=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},fm=50,Kl=(e,t=fm)=>{let o=(0,Wl.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var mm=e=>{let t=Object.values(pn),o=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return t.includes(s)}),n=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return["attribute-loop"].includes(s)}),r=[];for(let i of o){let{style:s}=i._attributes,a=Rl[s],l=a==null?void 0:a(i,n);if(!l){console.warn(`Node ${s} not supported`);continue}r.push(l)}return r},gm=(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=Vl(r),s=t.find(l=>l.id===i.source),a=t.find(l=>l.id===i.target);(s==null?void 0:s.type)==="LANE"||(a==null?void 0:a.type)==="LANE"||n.push(i)}return n},hm=(e,t)=>{let o=[];return e.forEach(n=>{var s,a;let r=(a=(s=Hl)[n.type])==null?void 0:a.call(s,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=Gl(n,t);o.push(l)}}),o},ym=(e,t)=>{let o=[];return e.forEach(n=>{let r=Ol(n,t);o.push(r)}),o},ql=(e=[],t=[],o)=>{let n=hm(e,o),r=ym(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return Sl(JSON.stringify(i),{compact:!0,spaces:0})},Zl=async e=>{var s,a;let t=await Mr(e),o=((a=(s=t==null?void 0:t.mxGraphModel)==null?void 0:s.root)==null?void 0:a.mxCell)||[],n=mm(o),r=gm(o,n);return{nodes:st(mn(n)),edges:r}};var Co=require("@xyflow/react");var gn=require("@xyflow/react");var Mi=require("react/jsx-runtime"),de=i=>{var s=i,{type:e,position:t,className:o,nodeType:n}=s,r=Ye(s,["type","position","className","nodeType"]);let a=n==="TASK";return(0,Mi.jsx)(gn.Handle,b({type:e,position:t,className:D("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":a,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!a},o)},r))},kr=a=>{var l=a,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,s=Ye(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,gn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let u=c();return t==="TASK"?u.filter(y=>y.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?u.filter(y=>y.source===e).length>=2:!1})();return(0,Mi.jsx)(gn.Handle,b({type:n,position:r,className:D("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":p,"hover:border-grey-500":!p},i),style:{pointerEvents:p?"none":"auto"}},s))};var Rr=require("@xyflow/react"),Jl=require("lodash");var Ql=require("react/jsx-runtime"),Ao=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=Ye(r,["nodeId","isVisible"]);let{getNode:i,getNodes:s,setNodes:a}=(0,Rr.useReactFlow)(),{isMultipleSelection:l}=V(),c=({width:p,height:u})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let y=[...s()],g=!f.parentId,m=g?f.id:f.parentId,_=y.filter(T=>T.type==="LANE"&&T.parentId===m);if(!_.length)return;let h=(0,Jl.orderBy)(_,["position.y"]),E=0;h.forEach((T,N)=>{var I,R;let w=N===h.length-1,x=(R=(I=T.measured)==null?void 0:I.height)!=null?R:0;y=y.map(k=>{if(k.id===T.id){let A=g?p-j.HEADER_WIDTH:p,S=v(b({},k),{width:A,measured:v(b({},k.measured),{width:A}),position:v(b({},k.position),{y:E})});return w&&g&&(S.height=u-E),S}return k}),E+=x}),y=y.map(T=>{if(T.id===m){let N=g?p:p+j.HEADER_WIDTH;return v(b({},T),{width:N,height:g?u:E,measured:{width:N,height:g?u:E}})}return T}),a(y)};return(0,Ql.jsx)(Rr.NodeResizer,b({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(p,u)=>c(u)},o))};var Hr=require("@xyflow/react"),qe=require("lecom-ui"),Yt=require("react");var jl=require("zustand"),Io=(0,jl.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var Vr=require("react"),ec=(e,t=!1)=>{let[o,n]=(0,Vr.useState)({width:0,height:0});return(0,Vr.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var _t=require("@xyflow/react"),tc=require("react"),xm=120,Em=12,oc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,_t.useReactFlow)(),{instanceId:i}=V();return(0,tc.useMemo)(()=>{var f,y;if(!t)return{position:_t.Position.Right,align:"start"};let s=n(e);if(!s)return{position:_t.Position.Right,align:"start"};let a=r(),l=s.position.x*a.zoom+a.x,c=(((f=s.measured)==null?void 0:f.width)||s.width||100)*a.zoom,d=(y=document.getElementById(`modeler-${i}`))==null?void 0:y.clientWidth;if(!d)return{position:_t.Position.Right,align:"start"};let p=(o==null?void 0:o.width)||xm;return{position:l+c+p+Em>d?_t.Position.Left:_t.Position.Right}},[i,e,t,o,n,r])};var Or=require("@xyflow/react"),Y=require("lecom-ui"),nc=require("lucide-react");var Z=require("react/jsx-runtime"),rc=({nodeId:e})=>{let{t}=(0,Y.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Or.useReactFlow)(),i=(0,Or.useNodesData)(e),a=n().filter(f=>f.source===e).some(f=>{let y=r(f.target);return(y==null?void 0:y.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=p=>{o(e,{variant:(i==null?void 0:i.data.variant)===p?"":p})},d=p=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===p?"":p})};return(0,Z.jsxs)(Y.DropdownMenu,{children:[(0,Z.jsxs)(Y.Tooltip,{children:[(0,Z.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(Y.DropdownMenuTrigger,{asChild:!0,children:(0,Z.jsx)(Y.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,Z.jsx)(nc.WrenchIcon,{})})})}),(0,Z.jsx)(Y.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,Z.jsxs)(Y.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,Z.jsxs)(Y.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,Z.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,Z.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(On).map(([p,u])=>{let f=p==="LOOP"&&(a||l),g=(()=>{if(p==="LOOP"&&a)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(p==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess")})();return(0,Z.jsxs)(Y.Tooltip,{children:[(0,Z.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(Y.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:D({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===p,"opacity-50 cursor-not-allowed":f}),onClick:f?void 0:()=>d(p),children:(0,Z.jsx)(u.icon,{className:"stroke-inherit"})})}),g&&(0,Z.jsx)(Y.TooltipContent,{color:"black",children:g})]},p)})})]}),(0,Z.jsx)(Y.DropdownMenuGroup,{children:(0,Z.jsxs)(Y.Tooltip,{children:[(0,Z.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,Z.jsxs)(Y.DropdownMenuItem,{className:D({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50 cursor-not-allowed":a}),disabled:a,onClick:a?void 0:()=>c("SCRIPT"),children:[(0,Z.jsx)(Vn.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),a&&(0,Z.jsx)(Y.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var ee=require("react/jsx-runtime"),Wt={START_EVENT:{type:"START_EVENT",icon:$o,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:oo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:$o,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:Ln,label:"bpmn.annotation.variant.default"}},bm={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:io,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:ao,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:no,label:"bpmn.gateway.variant.complex"}},Te=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,Yt.useRef)(null),s=(0,Yt.useRef)(null),{t:a}=(0,qe.useTranslation)(),{setDraggableNode:l}=Io(),{getEdges:c,getNodes:d}=(0,Hr.useReactFlow)(),{setIsDragging:p,mode:u}=V(),{dimensions:f}=ec(i,r),{position:y}=oc(e,r,f),[g,m]=(0,Yt.useState)(void 0),_=d(),h=c(),E=o==="SUBPROCESS",T=(0,Yt.useCallback)((M,L)=>{l({type:L.type,variant:L.variant,attribute:L.attribute,icon:L.icon}),L.icon&&m((0,ee.jsx)(L.icon,{})),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("sourceId",e),s.current&&M.dataTransfer.setDragImage(s.current,10,10),setTimeout(()=>{p(!0)},100)},[e,l,p]),N=[{component:(0,ee.jsx)(vr,{elementId:e})}],w=()=>u==="view"?[]:[{component:(0,ee.jsx)(cn,{nodeId:e})},Wt.TASK,Wt.ANNOTATION,...N],x=()=>u==="view"?[{component:(0,ee.jsx)(bt,{elementId:e})}]:[{component:(0,ee.jsx)(bt,{elementId:e})},...E?[]:[{component:(0,ee.jsx)(rc,{nodeId:e})}],{component:(0,ee.jsx)(cn,{nodeId:e})},Wt.TASK,...Object.values(bm),...N],I=()=>u==="view"?[{component:(0,ee.jsx)(bt,{elementId:e})}]:[{component:(0,ee.jsx)(bt,{elementId:e})},{component:(0,ee.jsx)(cn,{nodeId:e})},Wt.TASK,Wt.ANNOTATION,...N],R=()=>u==="view"?[]:[{component:(0,ee.jsx)(cn,{nodeId:e})},Wt.ANNOTATION,...N],k=()=>u==="view"?[]:[...n?[]:[Wt.ANNOTATION],...N],A=()=>u==="view"?[]:[...N],S=()=>u==="view"?[]:[...N],C=(M=>{switch(M){case"START_EVENT":return w();case"TASK":return x();case"GATEWAY":return I();case"END_EVENT":return R();case"LANE":return k();case"ANNOTATION":return A();case"UNSUPPORTED":return S();default:return[]}})(t);if(!(C.length===0||u==="readonly"))return(0,ee.jsxs)(Hr.NodeToolbar,{position:y,align:"start",className:"-top-8",isVisible:r,children:[(0,ee.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:C.map((M,L)=>{if(M.component)return(0,ee.jsx)("div",{children:M.component},L);let z={sourceNodeType:t,targetNodeType:M.type,sourceNodeId:e,nodes:_,edges:h},H=gl(z),W={gateway_limit_reached:a("editor.toolbar.gateway_limit_reached"),start_event_already_exists:a("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:a("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:a("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:a("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:a("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:a("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:a("editor.toolbar.task_limit_reached")},B=H.shouldDisable&&H.reason?W[H.reason]||a(M.label):a(M.label)||"";return(0,ee.jsxs)(qe.Tooltip,{children:[(0,ee.jsx)(qe.TooltipTrigger,{asChild:!0,children:(0,ee.jsx)(qe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!H.shouldDisable,disabled:H.shouldDisable,className:H.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:H.shouldDisable?void 0:F=>T(F,M),children:M.icon&&(0,ee.jsx)(M.icon,{size:16})})}),(0,ee.jsx)(qe.TooltipContent,{color:"black",children:B})]},L)})}),(0,ee.jsx)("div",{ref:s,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:g})]})};var Ut=require("react/jsx-runtime"),ic=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Co.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Co.useConnection)(),{mode:a,isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),p=i&&(s==null?void 0:s.id)!==e,u=y=>{r(e,{label:y})},f=!l&&!c&&!d;return(0,Ut.jsxs)("div",{className:D("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,Ut.jsx)(ue,{value:t.label,className:"m-1 text-grey-600",onChange:u}),f&&(0,Ut.jsx)(Te,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),a==="edit"&&(0,Ut.jsx)(Ao,{minWidth:Dr.MIN_WIDTH,minHeight:Dr.MIN_HEIGHT,isVisible:!n&&o}),(!i||p)&&(0,Ut.jsx)(de,{type:"target",position:Co.Position.Left,className:D({"annotation-handle":p})})]})};var $t=require("@xyflow/react"),sc=require("react");var at=require("react/jsx-runtime"),ac=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,$t.useReactFlow)(),{inProgress:i,fromNode:s}=(0,$t.useConnection)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=V(),[d,p]=(0,sc.useState)(!1),u=i&&(s==null?void 0:s.id)!==e,f=_=>{r(e,{label:_})},y=()=>{p(!0)},g=()=>{p(!1)},m=!a&&!l&&!c;return(0,at.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:y,children:[(0,at.jsx)(oo,{className:D("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,at.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,at.jsx)(ue,{value:t.label,isEditing:d,onChange:f})}),m&&(0,at.jsx)(Te,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||u)&&(0,at.jsx)(de,{type:"target",position:$t.Position.Left,className:D({"event-handle":u})}),!i&&(0,at.jsx)(de,{type:"source",position:$t.Position.Right})]})};var Xt=require("@xyflow/react"),Gr=require("react");var lt=require("react/jsx-runtime"),lc=({id:e,data:t,selected:o,dragging:n})=>{let r=si[t.variant].icon,{updateNodeData:i}=(0,Xt.useReactFlow)(),{inProgress:s,fromNode:a}=(0,Xt.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),[p,u]=(0,Gr.useState)(!1),f=s&&(a==null?void 0:a.id)!==e,y=(0,Gr.useCallback)(h=>{i(e,{label:h})},[e,i]),g=()=>{u(!0)},m=()=>{u(!1)},_=!l&&!c&&!d;return(0,lt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:g,children:[(0,lt.jsx)(r,{className:D("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,lt.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,lt.jsx)(ue,{value:t.label,isEditing:p,onChange:y})}),_&&(0,lt.jsx)(Te,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!s||f)&&(0,lt.jsx)(de,{type:"target",position:Xt.Position.Left,className:D({"gateway-handle":f})}),!s&&(0,lt.jsx)(kr,{type:"source",position:Xt.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var cc=require("@xyflow/react"),ze=require("lecom-ui"),_m=require("lucide-react");var dc=require("react/jsx-runtime");var Kt=require("@xyflow/react"),uc=require("react");var ct=require("react/jsx-runtime"),pc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Kt.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Kt.useConnection)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=V(),[d,p]=(0,uc.useState)(!1),u=i&&(s==null?void 0:s.id)!==e,f=_=>{r(e,{label:_})},y=()=>{p(!0)},g=()=>{p(!1)},m=!a&&!l&&!c;return(0,ct.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:y,children:[(0,ct.jsx)(Rn,{className:D("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,ct.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ct.jsx)(ue,{value:t.label,isEditing:d,onChange:f})}),m&&(0,ct.jsx)(Te,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||u)&&(0,ct.jsx)(de,{type:"target",position:Kt.Position.Left,className:D({"event-handle":u})}),!i&&(0,ct.jsx)(de,{type:"source",position:Kt.Position.Right})]})};var qt=require("@xyflow/react"),hc=require("lecom-ui"),yc=require("react");var Br=(e,t)=>{let n=e.filter(i=>i.type==="TASK").map(i=>{var a;let s=(a=i.data)==null?void 0:a.label;if(s&&s.startsWith(`${t} `)){let l=s.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}`},So=(e,t)=>{let n=t.filter(a=>a.type==="TASK").map(a=>{var l;return(l=a.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),i=n.filter(a=>a===r||a.startsWith(`${r} (`)).map(a=>{if(a===r)return 1;let l=a.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(a=>a>0),s=2;for(;i.includes(s);)s++;return`${r} (${s})`};var hn=require("react/jsx-runtime"),fc=e=>(0,hn.jsxs)("svg",v(b({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,hn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,hn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var Pi=require("react/jsx-runtime"),mc=e=>(0,Pi.jsx)("svg",v(b({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,Pi.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 yn=require("react/jsx-runtime"),gc=e=>(0,yn.jsxs)("svg",v(b({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,yn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,yn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var he=require("react/jsx-runtime"),Tm={APROVADO:fc,EM_ANDAMENTO:mc,REJEITADO:gc},Li={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,hc.useTranslation)(),{updateNodeData:i,getNodes:s}=(0,qt.useReactFlow)(),{inProgress:a,fromNode:l}=(0,qt.useConnection)(),{mode:c,isConnecting:d,isDragging:p,isMultipleSelection:u,onSubprocessValidationClick:f}=V(),{getTaskStatus:y}=Mt(),g=a&&(l==null?void 0:l.id)!==e,m=(0,yc.useCallback)(A=>{let S=A.trim(),P=t.label||"";if(S===P)return;let C=s(),M=S;S||(M=Br(C,r("bpmn.task.label.prefix")));let L=So(M,C);L!==P&&i(e,{label:L})},[t.label,s,e,r,i]),_=y(e),h=_?Tm[_]:null,E=t.variant?Vn[t.variant].icon:null,T=t.attribute?On[t.attribute].icon:null,N=t.variant==="SUBPROCESS",w=E&&!N,x=T||N,I=()=>t.hasError?Li.error:_?Li[_]:Li.default,R=()=>{f==null||f({id:e,type:"sub_process",label:t.label})},k=!d&&!p&&!u;return(0,he.jsxs)("div",{className:D("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",I(),{"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,he.jsx)(ue,{value:t.label,maxLength:60,className:D("m-1",{"py-6":w||x}),onChange:m}),E&&(0,he.jsx)("div",{className:D("absolute flex items-center p-1",N?"bottom-0":"top-0 left-0"),children:(0,he.jsx)(E,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500",N&&"cursor-pointer"),onClick:N?R:void 0})}),T&&(0,he.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,he.jsx)("div",{className:D("flex items-center w-16 p-1",N?"justify-between":"justify-center"),children:(0,he.jsx)(T,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500")})})}),h&&(0,he.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,he.jsx)(h,{})}),k&&(0,he.jsx)(Te,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),c==="edit"&&(0,he.jsx)(Ao,{minWidth:Pr.MIN_WIDTH,minHeight:Pr.MIN_HEIGHT,isVisible:!n&&o}),(!a||g)&&(0,he.jsx)(de,{type:"target",position:qt.Position.Left,className:D({"task-handle":g})}),!a&&(0,he.jsx)(kr,{type:"source",position:qt.Position.Right,nodeId:e,nodeType:"TASK"})]})};var Di=require("@xyflow/react");var dt=require("react/jsx-runtime"),Ec=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:s}=V(),a=!r&&!i&&!s;return(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.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}),a&&(0,dt.jsx)(Te,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,dt.jsx)(de,{type:"source",position:Di.Position.Right}),(0,dt.jsx)(de,{type:"target",position:Di.Position.Left})]})};var ye=require("@xyflow/react"),bc=require("react");var Tt=require("react/jsx-runtime"),pv={type:"MESSAGE_EDGE",markerEnd:{type:ye.MarkerType.Arrow},data:{label:""}},_c=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,ye.useViewport)(),{updateEdgeData:s}=(0,ye.useReactFlow)(),{isMultipleSelection:a}=V(),[l,c]=(0,bc.useState)(!1),d=(0,ye.useInternalNode)(t),p=(0,ye.useInternalNode)(o);if(!d||!p)return null;let{sx:u,sy:f,tx:y,ty:g,sourcePos:m,targetPos:_}=rt(d,p),[h,E,T]=(0,ye.getSmoothStepPath)({sourceX:u,sourceY:f,targetX:y,targetY:g,sourcePosition:m,targetPosition:_}),N=r||(d==null?void 0:d.selected)||(p==null?void 0:p.selected),w=N?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=l||(n==null?void 0:n.label.trim().length)>0,I=1/i,R=()=>{c(!0)},k=()=>{c(!1)},A=S=>{s(e,{label:S.trim()})};return(0,Tt.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":N}),onBlur:k,onDoubleClick:R,children:[(0,Tt.jsx)(ye.BaseEdge,{id:e,path:h,markerEnd:`url(#${w})`,strokeDasharray:4,className:D("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":N&&!(n!=null&&n.hasError)})}),(0,Tt.jsx)(ye.EdgeLabelRenderer,{children:(0,Tt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${T}px)`},children:[r&&!a&&(0,Tt.jsx)(bo,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${I})`}}),x&&(0,Tt.jsx)(ue,{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:l,onChange:A})]})})]})};var Tc=require("@xyflow/react"),xn=require("react/jsx-runtime"),Nc=({toX:e,toY:t,fromPosition:o,toPosition:n,fromNode:r})=>{if(!r)return null;let i={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:s,sy:a,tx:l,ty:c,sourcePos:d,targetPos:p}=rt(r,i),[u]=(0,Tc.getBezierPath)({sourceX:s,sourceY:a,sourcePosition:d||o,targetPosition:p||n,targetX:l||e,targetY:c||t});return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:u}),(0,xn.jsx)("circle",{cx:l||e,cy:c||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var zr=require("@xyflow/react"),vc=require("lodash"),En=require("react");var Ce=require("react/jsx-runtime"),wc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:s}=(0,zr.useReactFlow)(),{mode:a,isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),[p,u]=(0,En.useState)(!1),f=s(),y=!r,g=(0,En.useMemo)(()=>(0,vc.orderBy)([...f.filter(w=>w.parentId===e&&w.type==="LANE")],"position.y","asc"),[f,e]),m=y?Lr.MIN_WIDTH:j.MIN_WIDTH,_=(0,En.useMemo)(()=>{if(y&&g.length>1){let w=[...g];return w.pop(),w.reduce((I,R)=>{var k,A;return I+((A=(k=R.measured)==null?void 0:k.height)!=null?A:0)},0)+j.MIN_HEIGHT}return j.MIN_HEIGHT},[y,g]),h=w=>{i(e,{label:w})},E=()=>{u(!0)},T=()=>{u(!1)},N=!l&&!c&&!d;return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("div",{className:D("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,Ce.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:T,onDoubleClick:E,children:(0,Ce.jsx)("div",{className:D("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!p}),children:(0,Ce.jsx)(ue,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:D({"whitespace-nowrap":p}),isEditing:p,onChange:h})})}),(0,Ce.jsx)("div",{className:"flex-1"})]}),N&&(0,Ce.jsx)(Te,{nodeId:e,nodeType:"LANE",isChild:!y,isVisible:!n&&o}),a==="edit"&&(0,Ce.jsx)(Ao,{nodeId:e,minWidth:m,minHeight:_,isVisible:!n&&o}),y&&(0,Ce.jsx)(de,{type:"source",position:zr.Position.Right})]})};var Ac={START_EVENT:pc,END_EVENT:ac,TASK:xc,GATEWAY:lc,ANNOTATION:ic,LANE:wc,UNSUPPORTED:Ec},Ic={SEQUENCE_EDGE:Il,MESSAGE_EDGE:_c,ANNOTATION_EDGE:vl},Cc="#fafafa",Sc="#bebebe",Mc=1,Pc=10,Lc="bottom-left",Dc=.2,kc=5,Mo=.5,Rc={x:0,y:0,zoom:.75},Nm=1,vm=2,Vc=[Nm,vm];var Hc=require("@xyflow/react");var wm=1,Oc=()=>`<mxGraphModel>
|
|
1
|
+
"use strict";var Iu=Object.create;var jo=Object.defineProperty,Au=Object.defineProperties,Cu=Object.getOwnPropertyDescriptor,Su=Object.getOwnPropertyDescriptors,Mu=Object.getOwnPropertyNames,On=Object.getOwnPropertySymbols,Pu=Object.getPrototypeOf,pi=Object.prototype.hasOwnProperty,is=Object.prototype.propertyIsEnumerable;var rs=(e,t,o)=>t in e?jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))pi.call(t,o)&&rs(e,o,t[o]);if(On)for(var o of On(t))is.call(t,o)&&rs(e,o,t[o]);return e},v=(e,t)=>Au(e,Su(t));var Ke=(e,t)=>{var o={};for(var n in e)pi.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&On)for(var n of On(e))t.indexOf(n)<0&&is.call(e,n)&&(o[n]=e[n]);return o};var Lu=(e,t)=>{for(var o in t)jo(e,o,{get:t[o],enumerable:!0})},ss=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Mu(t))!pi.call(e,r)&&r!==o&&jo(e,r,{get:()=>t[r],enumerable:!(n=Cu(t,r))||n.enumerable});return e};var ku=(e,t,o)=>(o=e!=null?Iu(Pu(e)):{},ss(t||!e||!e.__esModule?jo(o,"default",{value:e,enumerable:!0}):o,e)),Du=e=>ss(jo({},"__esModule",{value:!0}),e);var og={};Lu(og,{EditorMode:()=>Ce,ElementPosition:()=>Gn,ElementType:()=>en,GatewayElementVariant:()=>Bn,GatewayVariant:()=>Re,Modeler:()=>Tu,ModelerProvider:()=>Eu,NodeAttribute:()=>at,NodeType:()=>z,NodeVariant:()=>De,RoutingVariant:()=>zn,useModeler:()=>ci});module.exports=Du(og);var fi=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 Hn=require("lecom-ui");var as={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"}},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 ls={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:"Verificar 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 cs={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:"Verificar 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"}},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 ds={pt_BR:cs,en_US:as,es_ES:ls};var us,ps,Ru=(ps=(us=fi("LecomUserLanguage"))!=null?us:fi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?ps:Hn.Translations.PT_BR;(0,Hn.initializeI18n)({lng:Ru,resources:ds});var Ce=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Ce||{});var en=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(en||{}),Gn=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Gn||{}),Bn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Bn||{}),zn=(c=>(c.SIMPLE="simple",c.LOOP="loop",c.SCRIPT="script",c.SCRIPT_LOOP="script_loop",c.COMPLEX="complex",c.EXCLUSIVE="exclusive",c.PARALLEL="parallel",c.FINAL="final",c.TO_SUB_PROCESS="to_sub_process",c))(zn||{});var Eo=require("lucide-react");var Vt=require("react/jsx-runtime"),Fn=({size:e=24,className:t})=>(0,Vt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Vt.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Vt.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Vt.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Vt.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"),uo=({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 xt=require("react/jsx-runtime"),po=({size:e=24,className:t})=>(0,xt.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,xt.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,xt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,xt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,xt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,xt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var fo=require("react/jsx-runtime"),mo=({size:e=24,className:t})=>(0,fo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,fo.jsx)("path",{d:"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,fo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,fo.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var go=require("react/jsx-runtime"),ho=({size:e=24,className:t})=>(0,go.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,go.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,go.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,go.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var yo=require("react/jsx-runtime"),fs=({size:e=24,className:t})=>(0,yo.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,yo.jsxs)("g",{children:[(0,yo.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,yo.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var ms=require("clsx"),gs=require("tailwind-merge");function R(...e){return(0,gs.twMerge)((0,ms.clsx)(e))}var Et=(e=0,t=0)=>e<t?t:e,Wn=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var tn=require("react/jsx-runtime"),hs=({size:e=24,className:t})=>(0,tn.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:R("stroke-2",t),children:[(0,tn.jsx)("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,tn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Yn=require("react/jsx-runtime"),ys=({size:e=24,className:t})=>(0,Yn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Yn.jsx)("g",{children:(0,Yn.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 gi=require("react/jsx-runtime"),Un=({size:e=24,className:t})=>(0,gi.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,gi.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 hi=require("react/jsx-runtime"),on=({size:e=24,className:t})=>(0,hi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:R("stroke-2",t),children:(0,hi.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 xo=require("react/jsx-runtime"),xs=({size:e=24,className:t})=>(0,xo.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,xo.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,xo.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,xo.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var bt=require("react/jsx-runtime"),Es=({size:e=24,className:t})=>(0,bt.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,bt.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,bt.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,bt.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,bt.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,bt.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ot=require("react/jsx-runtime"),bs=({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",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ot.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,Ot.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ot.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var z=(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))(z||{}),De=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(De||{}),$n={SCRIPT:{icon:Eo.ScrollText},SUBPROCESS:{icon:Eo.SquarePlus}},at=(t=>(t.LOOP="LOOP",t))(at||{}),Xn={LOOP:{icon:Eo.RotateCcw}},Re=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(Re||{}),yi={EXCLUSIVE:{icon:mo},PARALLEL:{icon:ho},COMPLEX:{icon:po}};var bu=require("@xyflow/react"),ae=require("react");var kt=require("@xyflow/react"),ai=require("react");var Uo=require("@xyflow/react"),yt=require("react");var _s=require("zustand"),Ts=require("@xyflow/react"),vs=require("react");var Kn=()=>{let{setEdges:e}=(0,Ts.useReactFlow)();return(0,vs.useCallback)(()=>{let o=Ht.getState().pathEdgeIds;e(n=>n.map(r=>v(E({},r),{selected:o.includes(r.id)})))},[e])},Ht=(0,_s.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=[],f=new Set;for(p.push({node:d,path:[]}),f.add(d);p.length>0;){let{node:y,path:g}=p.shift();if(y===u)return g;let m=a[y]||[];for(let{targetId:h,edgeId:x}of m)f.has(h)||(f.add(h),p.push({node:h,path:[...g,x]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],p=r[d+1],f=c(u,p);f.length>0&&i.push(...f)}i.length>0&&e({pathEdgeIds:i})}}));var No=require("@xyflow/react");var Vu={value:()=>{}};function ws(){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 qn(o)}function qn(e){this._=e}function Ou(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}})}qn.prototype=ws.prototype={constructor:qn,on:function(e,t){var o=this._,n=Ou(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=Hu(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]=Ns(o[r],e.name,t);else if(t==null)for(r in o)o[r]=Ns(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 qn(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 Hu(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function Ns(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=Vu,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var xi=ws;var Zn="http://www.w3.org/1999/xhtml",Ei={svg:"http://www.w3.org/2000/svg",xhtml:Zn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ei.hasOwnProperty(t)?{space:Ei[t],local:e}:e}function Gu(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Zn&&t.documentElement.namespaceURI===Zn?t.createElement(e):t.createElementNS(o,e)}}function Bu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Jn(e){var t=lt(e);return(t.local?Bu:Gu)(t)}function zu(){}function Gt(e){return e==null?zu:function(){return this.querySelector(e)}}function Is(e){typeof e!="function"&&(e=Gt(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 bi(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fu(){return[]}function nn(e){return e==null?Fu:function(){return this.querySelectorAll(e)}}function Wu(e){return function(){return bi(e.apply(this,arguments))}}function As(e){typeof e=="function"?e=Wu(e):e=nn(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 rn(e){return function(){return this.matches(e)}}function Qn(e){return function(t){return t.matches(e)}}var Yu=Array.prototype.find;function Uu(e){return function(){return Yu.call(this.children,e)}}function $u(){return this.firstElementChild}function Cs(e){return this.select(e==null?$u:Uu(typeof e=="function"?e:Qn(e)))}var Xu=Array.prototype.filter;function Ku(){return Array.from(this.children)}function qu(e){return function(){return Xu.call(this.children,e)}}function Ss(e){return this.selectAll(e==null?Ku:qu(typeof e=="function"?e:Qn(e)))}function Ms(e){typeof e!="function"&&(e=rn(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 jn(e){return new Array(e.length)}function Ps(){return new le(this._enter||this._groups.map(jn),this._parents)}function sn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sn.prototype={constructor:sn,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 Ls(e){return function(){return e}}function Zu(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 sn(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function Ju(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,u=i.length,p=new Array(d),f;for(s=0;s<d;++s)(l=t[s])&&(p[s]=f=a.call(l,l.__data__,s,t)+"",c.has(f)?r[s]=l:c.set(f,l));for(s=0;s<u;++s)f=a.call(e,i[s],s,i)+"",(l=c.get(f))?(n[s]=l,l.__data__=i[s],c.delete(f)):o[s]=new sn(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(p[s])===l&&(r[s]=l)}function Qu(e){return e.__data__}function ks(e,t){if(!arguments.length)return Array.from(this,Qu);var o=t?Ju:Zu,n=this._parents,r=this._groups;typeof e!="function"&&(e=Ls(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,f=ju(e.call(d,d&&d.__data__,c,n)),y=f.length,g=s[c]=new Array(y),m=a[c]=new Array(y),h=l[c]=new Array(p);o(d,u,g,m,h,f,t);for(var x=0,b=0,T,_;x<y;++x)if(T=g[x]){for(x>=b&&(b=x+1);!(_=m[b])&&++b<y;);T._next=_||null}}return a=new le(a,n),a._enter=s,a._exit=l,a}function ju(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ds(){return new le(this._exit||this._groups.map(jn),this._parents)}function Rs(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 Vs(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),f,y=0;y<u;++y)(f=c[y]||d[y])&&(p[y]=f);for(;l<r;++l)s[l]=o[l];return new le(s,this._parents)}function Os(){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 Hs(e){e||(e=ep);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 ep(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bs(){return Array.from(this)}function zs(){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 Fs(){let e=0;for(let t of this)++e;return e}function Ws(){return!this.node()}function Ys(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 tp(e){return function(){this.removeAttribute(e)}}function op(e){return function(){this.removeAttributeNS(e.space,e.local)}}function np(e,t){return function(){this.setAttribute(e,t)}}function rp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ip(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function sp(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 Us(e,t){var o=lt(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?op:tp:typeof t=="function"?o.local?sp:ip:o.local?rp:np)(o,t))}function er(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ap(e){return function(){this.style.removeProperty(e)}}function lp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function cp(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function $s(e,t,o){return arguments.length>1?this.each((t==null?ap:typeof t=="function"?cp:lp)(e,t,o==null?"":o)):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||er(e).getComputedStyle(e,null).getPropertyValue(t)}function dp(e){return function(){delete this[e]}}function up(e,t){return function(){this[e]=t}}function pp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Xs(e,t){return arguments.length>1?this.each((t==null?dp:typeof t=="function"?pp:up)(e,t)):this.node()[e]}function Ks(e){return e.trim().split(/^|\s+/)}function _i(e){return e.classList||new qs(e)}function qs(e){this._node=e,this._names=Ks(e.getAttribute("class")||"")}qs.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 Zs(e,t){for(var o=_i(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Js(e,t){for(var o=_i(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function fp(e){return function(){Zs(this,e)}}function mp(e){return function(){Js(this,e)}}function gp(e,t){return function(){(t.apply(this,arguments)?Zs:Js)(this,e)}}function Qs(e,t){var o=Ks(e+"");if(arguments.length<2){for(var n=_i(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?gp:t?fp:mp)(o,t))}function hp(){this.textContent=""}function yp(e){return function(){this.textContent=e}}function xp(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function js(e){return arguments.length?this.each(e==null?hp:(typeof e=="function"?xp:yp)(e)):this.node().textContent}function Ep(){this.innerHTML=""}function bp(e){return function(){this.innerHTML=e}}function _p(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function ea(e){return arguments.length?this.each(e==null?Ep:(typeof e=="function"?_p:bp)(e)):this.node().innerHTML}function Tp(){this.nextSibling&&this.parentNode.appendChild(this)}function ta(){return this.each(Tp)}function vp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oa(){return this.each(vp)}function na(e){var t=typeof e=="function"?e:Jn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Np(){return null}function ra(e,t){var o=typeof e=="function"?e:Jn(e),n=t==null?Np:typeof t=="function"?t:Gt(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function wp(){var e=this.parentNode;e&&e.removeChild(this)}function ia(){return this.each(wp)}function Ip(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ap(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sa(e){return this.select(e?Ap:Ip)}function aa(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Cp(e){return function(t){e.call(this,t,this.__data__)}}function Sp(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 Mp(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 Pp(e,t,o){return function(){var n=this.__on,r,i=Cp(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 la(e,t,o){var n=Sp(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?Pp:Mp,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function ca(e,t,o){var n=er(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 Lp(e,t){return function(){return ca(this,e,t)}}function kp(e,t){return function(){return ca(this,e,t.apply(this,arguments))}}function da(e,t){return this.each((typeof t=="function"?kp:Lp)(e,t))}function*ua(){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 Dp=[null];function le(e,t){this._groups=e,this._parents=t}function pa(){return new le([[document.documentElement]],Dp)}function Rp(){return this}le.prototype=pa.prototype={constructor:le,select:Is,selectAll:As,selectChild:Cs,selectChildren:Ss,filter:Ms,data:ks,enter:Ps,exit:Ds,join:Rs,merge:Vs,selection:Rp,order:Os,sort:Hs,call:Gs,nodes:Bs,node:zs,size:Fs,empty:Ws,each:Ys,attr:Us,style:$s,property:Xs,classed:Qs,text:js,html:ea,raise:ta,lower:oa,append:na,insert:ra,remove:ia,clone:sa,datum:aa,on:la,dispatch:da,[Symbol.iterator]:ua};var ct=pa;function tr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Ti(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function cn(){}var an=.7,rr=1/an,bo="\\s*([+-]?\\d+)\\s*",ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vp=/^#([0-9a-f]{3,8})$/,Op=new RegExp(`^rgb\\(${bo},${bo},${bo}\\)$`),Hp=new RegExp(`^rgb\\(${qe},${qe},${qe}\\)$`),Gp=new RegExp(`^rgba\\(${bo},${bo},${bo},${ln}\\)$`),Bp=new RegExp(`^rgba\\(${qe},${qe},${qe},${ln}\\)$`),zp=new RegExp(`^hsl\\(${ln},${qe},${qe}\\)$`),Fp=new RegExp(`^hsla\\(${ln},${qe},${qe},${ln}\\)$`),fa={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};tr(cn,Tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ma,formatHex:ma,formatHex8:Wp,formatHsl:Yp,formatRgb:ga,toString:ga});function ma(){return this.rgb().formatHex()}function Wp(){return this.rgb().formatHex8()}function Yp(){return _a(this).formatHsl()}function ga(){return this.rgb().formatRgb()}function Tt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Vp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ha(t):o===3?new ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?or(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?or(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=Op.exec(e))?new ve(t[1],t[2],t[3],1):(t=Hp.exec(e))?new ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Gp.exec(e))?or(t[1],t[2],t[3],t[4]):(t=Bp.exec(e))?or(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zp.exec(e))?Ea(t[1],t[2]/100,t[3]/100,1):(t=Fp.exec(e))?Ea(t[1],t[2]/100,t[3]/100,t[4]):fa.hasOwnProperty(e)?ha(fa[e]):e==="transparent"?new ve(NaN,NaN,NaN,0):null}function ha(e){return new ve(e>>16&255,e>>8&255,e&255,1)}function or(e,t,o,n){return n<=0&&(e=t=o=NaN),new ve(e,t,o,n)}function Up(e){return e instanceof cn||(e=Tt(e)),e?(e=e.rgb(),new ve(e.r,e.g,e.b,e.opacity)):new ve}function _o(e,t,o,n){return arguments.length===1?Up(e):new ve(e,t,o,n==null?1:n)}function ve(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}tr(ve,_o,Ti(cn,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?an:Math.pow(an,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ve(zt(this.r),zt(this.g),zt(this.b),ir(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:ya,formatHex:ya,formatHex8:$p,formatRgb:xa,toString:xa}));function ya(){return`#${Bt(this.r)}${Bt(this.g)}${Bt(this.b)}`}function $p(){return`#${Bt(this.r)}${Bt(this.g)}${Bt(this.b)}${Bt((isNaN(this.opacity)?1:this.opacity)*255)}`}function xa(){let e=ir(this.opacity);return`${e===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${e===1?")":`, ${e})`}`}function ir(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Bt(e){return e=zt(e),(e<16?"0":"")+e.toString(16)}function Ea(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new We(e,t,o,n)}function _a(e){if(e instanceof We)return new We(e.h,e.s,e.l,e.opacity);if(e instanceof cn||(e=Tt(e)),!e)return new We;if(e instanceof We)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 We(a,s,l,e.opacity)}function Ta(e,t,o,n){return arguments.length===1?_a(e):new We(e,t,o,n==null?1:n)}function We(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}tr(We,Ta,Ti(cn,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new We(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?an:Math.pow(an,e),new We(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 ve(vi(e>=240?e-240:e+120,r,n),vi(e,r,n),vi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new We(ba(this.h),nr(this.s),nr(this.l),ir(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=ir(this.opacity);return`${e===1?"hsl(":"hsla("}${ba(this.h)}, ${nr(this.s)*100}%, ${nr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ba(e){return e=(e||0)%360,e<0?e+360:e}function nr(e){return Math.max(0,Math.min(1,e||0))}function vi(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 Ni(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 Ni((o-n/t)*t,a,r,i,s)}}function Na(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 Ni((o-n/t)*t,r,i,a,s)}}var wi=e=>()=>e;function Xp(e,t){return function(o){return e+o*t}}function Kp(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 wa(e){return(e=+e)==1?sr:function(t,o){return o-t?Kp(t,o,e):wi(isNaN(t)?o:t)}}function sr(e,t){var o=t-e;return o?Xp(e,o):wi(isNaN(e)?t:e)}var ar=function e(t){var o=wa(t);function n(r,i){var a=o((r=_o(r)).r,(i=_o(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=sr(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 Ia(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=_o(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 qp=Ia(va),Zp=Ia(Na);function Ve(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Ai=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ii=new RegExp(Ai.source,"g");function Jp(e){return function(){return e}}function Qp(e){return function(t){return e(t)+""}}function Ci(e,t){var o=Ai.lastIndex=Ii.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=Ai.exec(e))&&(r=Ii.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:Ve(n,r)})),o=Ii.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?Qp(l[0].x):Jp(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 Aa=180/Math.PI,lr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Si(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)*Aa,skewX:Math.atan(l)*Aa,scaleX:a,scaleY:s}}var cr;function Ca(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?lr:Si(t.a,t.b,t.c,t.d,t.e,t.f)}function Sa(e){return e==null?lr:(cr||(cr=document.createElementNS("http://www.w3.org/2000/svg","g")),cr.setAttribute("transform",e),(e=cr.transform.baseVal.consolidate())?(e=e.matrix,Si(e.a,e.b,e.c,e.d,e.e,e.f)):lr)}function Ma(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,p,f,y){if(c!==u||d!==p){var g=f.push("translate(",null,t,null,o);y.push({i:g-4,x:Ve(c,u)},{i:g-2,x:Ve(d,p)})}else(u||p)&&f.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:Ve(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:Ve(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,p,f,y){if(c!==u||d!==p){var g=f.push(r(f)+"scale(",null,",",null,")");y.push({i:g-4,x:Ve(c,u)},{i:g-2,x:Ve(d,p)})}else(u!==1||p!==1)&&f.push(r(f)+"scale("+u+","+p+")")}return function(c,d){var u=[],p=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,p),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(f){for(var y=-1,g=p.length,m;++y<g;)u[(m=p[y]).i]=m.x(f);return u.join("")}}}var Mi=Ma(Ca,"px, ","px)","deg)"),Pi=Ma(Sa,", ",")",")");var To=0,un=0,dn=0,La=1e3,dr,pn,ur=0,Ft=0,pr=0,fn=typeof performance=="object"&&performance.now?performance:Date,ka=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gn(){return Ft||(ka(jp),Ft=fn.now()+pr)}function jp(){Ft=0}function mn(){this._call=this._time=this._next=null}mn.prototype=fr.prototype={constructor:mn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?gn():+o)+(t==null?0:+t),!this._next&&pn!==this&&(pn?pn._next=this:dr=this,pn=this),this._call=e,this._time=o,Li()},stop:function(){this._call&&(this._call=null,this._time=1/0,Li())}};function fr(e,t,o){var n=new mn;return n.restart(e,t,o),n}function Da(){gn(),++To;for(var e=dr,t;e;)(t=Ft-e._time)>=0&&e._call.call(void 0,t),e=e._next;--To}function Pa(){Ft=(ur=fn.now())+pr,To=un=0;try{Da()}finally{To=0,tf(),Ft=0}}function ef(){var e=fn.now(),t=e-ur;t>La&&(pr-=t,ur=e)}function tf(){for(var e,t=dr,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:dr=o);pn=e,Li(n)}function Li(e){if(!To){un&&(un=clearTimeout(un));var t=e-Ft;t>24?(e<1/0&&(un=setTimeout(Pa,e-fn.now()-pr)),dn&&(dn=clearInterval(dn))):(dn||(ur=fn.now(),dn=setInterval(ef,La)),To=1,ka(Pa))}}function mr(e,t,o){var n=new mn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var of=xi("start","end","cancel","interrupt"),nf=[],Oa=0,Ra=1,hr=2,gr=3,Va=4,yr=5,hn=6;function vt(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;rf(e,o,{name:t,index:n,group:r,on:of,tween:nf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Oa})}function yn(e,t){var o=ce(e,t);if(o.state>Oa)throw new Error("too late; already scheduled");return o}function ue(e,t){var o=ce(e,t);if(o.state>gr)throw new Error("too late; already running");return o}function ce(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function rf(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=fr(i,0,o.time);function i(c){o.state=Ra,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,u,p,f;if(o.state!==Ra)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===gr)return mr(a);f.state===Va?(f.state=hn,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=hn,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(mr(function(){o.state===gr&&(o.state=Va,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=hr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===hr){for(o.state=gr,r=new Array(p=o.tween.length),d=0,u=-1;d<p;++d)(f=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=f);r.length=u+1}}function s(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=yr,1),u=-1,p=r.length;++u<p;)r[u].call(e,d);o.state===yr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=hn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function ki(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>hr&&n.state<yr,n.state=hn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function Ha(e){return this.each(function(){ki(this,e)})}function sf(e,t){var o,n;return function(){var r=ue(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 af(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=ue(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 Ga(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=ce(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?sf:af)(o,e,t))}function vo(e,t,o){var n=e._id;return e.each(function(){var r=ue(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return ce(r,n).value[t]}}function xr(e,t){var o;return(typeof t=="number"?Ve:t instanceof Tt?ar:(o=Tt(t))?(t=o,ar):Ci)(e,t)}function lf(e){return function(){this.removeAttribute(e)}}function cf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function df(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 uf(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 pf(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 ff(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 Ba(e,t){var o=lt(e),n=o==="transform"?Pi:xr;return this.attrTween(e,typeof t=="function"?(o.local?ff:pf)(o,n,vo(this,"attr."+e,t)):t==null?(o.local?cf:lf)(o):(o.local?uf:df)(o,n,t))}function mf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function gf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function hf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&gf(e,i)),o}return r._value=t,r}function yf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&mf(e,i)),o}return r._value=t,r}function za(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=lt(e);return this.tween(o,(n.local?hf:yf)(n,t))}function xf(e,t){return function(){yn(this,e).delay=+t.apply(this,arguments)}}function Ef(e,t){return t=+t,function(){yn(this,e).delay=t}}function Fa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xf:Ef)(t,e)):ce(this.node(),t).delay}function bf(e,t){return function(){ue(this,e).duration=+t.apply(this,arguments)}}function _f(e,t){return t=+t,function(){ue(this,e).duration=t}}function Wa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bf:_f)(t,e)):ce(this.node(),t).duration}function Tf(e,t){if(typeof t!="function")throw new Error;return function(){ue(this,e).ease=t}}function Ya(e){var t=this._id;return arguments.length?this.each(Tf(t,e)):ce(this.node(),t).ease}function vf(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ue(this,e).ease=o}}function Ua(e){if(typeof e!="function")throw new Error;return this.each(vf(this._id,e))}function $a(e){typeof e!="function"&&(e=rn(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 Ee(n,this._parents,this._name,this._id)}function Xa(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,f=0;f<d;++f)(p=l[f]||c[f])&&(u[f]=p);for(;s<n;++s)a[s]=t[s];return new Ee(a,this._parents,this._name,this._id)}function Nf(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 wf(e,t,o){var n,r,i=Nf(t)?yn:ue;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function Ka(e,t){var o=this._id;return arguments.length<2?ce(this.node(),o).on.on(e):this.each(wf(o,e,t))}function If(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function qa(){return this.on("end.remove",If(this._id))}function Za(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Gt(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,vt(c[p],t,o,p,c,ce(d,o)));return new Ee(i,this._parents,t,o)}function Ja(e){var t=this._name,o=this._id;typeof e!="function"&&(e=nn(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),f,y=ce(d,o),g=0,m=p.length;g<m;++g)(f=p[g])&&vt(f,t,o,g,p,y);i.push(p),a.push(d)}return new Ee(i,a,t,o)}var Af=ct.prototype.constructor;function Qa(){return new Af(this._groups,this._parents)}function Cf(e,t){var o,n,r;return function(){var i=_t(this,e),a=(this.style.removeProperty(e),_t(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function ja(e){return function(){this.style.removeProperty(e)}}function Sf(e,t,o){var n,r=o+"",i;return function(){var a=_t(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function Mf(e,t,o){var n,r,i;return function(){var a=_t(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),_t(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function Pf(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=ue(this,e),c=l.on,d=l.value[i]==null?s||(s=ja(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function el(e,t,o){var n=(e+="")=="transform"?Mi:xr;return t==null?this.styleTween(e,Cf(e,n)).on("end.style."+e,ja(e)):typeof t=="function"?this.styleTween(e,Mf(e,n,vo(this,"style."+e,t))).each(Pf(this._id,e)):this.styleTween(e,Sf(e,n,t),o).on("end.style."+e,null)}function Lf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function kf(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Lf(e,a,o)),n}return i._value=t,i}function tl(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,kf(e,t,o==null?"":o))}function Df(e){return function(){this.textContent=e}}function Rf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function ol(e){return this.tween("text",typeof e=="function"?Rf(vo(this,"text",e)):Df(e==null?"":e+""))}function Vf(e){return function(t){this.textContent=e.call(this,t)}}function Of(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Vf(r)),t}return n._value=e,n}function nl(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,Of(e))}function rl(){for(var e=this._name,t=this._id,o=Er(),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=ce(l,t);vt(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ee(n,this._parents,e,o)}function il(){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=ue(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 Hf=0;function Ee(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function sl(e){return ct().transition(e)}function Er(){return++Hf}var dt=ct.prototype;Ee.prototype=sl.prototype={constructor:Ee,select:Za,selectAll:Ja,selectChild:dt.selectChild,selectChildren:dt.selectChildren,filter:$a,merge:Xa,selection:Qa,transition:rl,call:dt.call,nodes:dt.nodes,node:dt.node,size:dt.size,empty:dt.empty,each:dt.each,on:Ka,attr:Ba,attrTween:za,style:el,styleTween:tl,text:ol,textTween:nl,remove:qa,tween:Ga,delay:Fa,duration:Wa,ease:Ya,easeVarying:Ua,end:il,[Symbol.iterator]:dt[Symbol.iterator]};function br(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Gf={time:null,delay:0,duration:250,ease:br};function Bf(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 al(e){var t,o;e instanceof Ee?(t=e._id,e=e._name):(t=Er(),(o=Gf).time=gn(),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])&&vt(l,e,t,c,a,o||Bf(l,t));return new Ee(n,this._parents,e,t)}ct.prototype.interrupt=Ha;ct.prototype.transition=al;function Nt(e,t,o){this.k=e,this.x=t,this.y=o}Nt.prototype={constructor:Nt,scale:function(e){return e===1?this:new Nt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Nt(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 _r=new Nt(1,0,0);Tr.prototype=Nt.prototype;function Tr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return _r;return e.__zoom}var Ff=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var ll;(function(e){e.Strict="strict",e.Loose="loose"})(ll||(ll={}));var cl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(cl||(cl={}));var dl;(function(e){e.Partial="partial",e.Full="full"})(dl||(dl={}));var ul;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ul||(ul={}));var pl;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(pl||(pl={}));var Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));var uE={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};var Wf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Yf=(e,t=[0,0])=>{var s;let{width:o,height:n}=Uf(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 Se=(e,t=[0,0])=>{var r,i,a,s,l,c,d,u;let{x:o,y:n}=Wf(e)?e.internals.positionAbsolute:Yf(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 Uf(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 pE={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}};var $f={nodeOrigin:[0,0],nodeExtent:Ff,elevateNodesOnSelect:!0,defaults:{}},fE=v(E({},$f),{checkEquality:!0});var fl;(function(e){e.Line="line",e.Handle="handle"})(fl||(fl={}));var Xf={width:0,height:0,x:0,y:0},mE=v(E({},Xf),{pointerX:0,pointerY:0,aspectRatio:1});var Me=require("react"),yl=require("zustand/shallow");var Kf=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function qf(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 Zf(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||!Kf(p.nodeBox,r))continue;let f=Math.abs(p.position-o);if(f>Nr)continue;let g=qf(p.nodeBox,Se(n))>0?0:Zf(p.nodeBox,Se(n));l.push({line:p,lineDist:f,nodeDist:g})}let c=.5,d=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((p,f)=>{if(d){if(p.line===d&&f.line!==d)return-1;if(f.line===d&&p.line!==d)return 1}return Math.abs(p.lineDist-f.lineDist)<=c?p.nodeDist-f.nodeDist:p.lineDist-f.lineDist});let u=l.length>0?l[0].line:void 0;return u&&(t==="horizontal"?this.lastHorizontalLine=u:this.lastVerticalLine=u),u}};function ml(e,t=Wt,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=Se(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 gl(e,t,o,n,r=Object.keys(Wt)){let i=[];for(let s of r){let l=Wt[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 hl(e,t,o,n,r,i,a,s){var u,p,f,y,g,m,h,x;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+((y=(f=e.measured)==null?void 0:f.height)!=null?y:0)};if(a){let T=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(T)<=Nr){if(o.position.y-=T,r!=null&&r.dimensions)if(n){let _=t.internals.positionAbsolute.y+((m=(g=e.measured)==null?void 0:g.height)!=null?m:0);r.dimensions.height=_-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)<=Nr){if(o.position.x-=T,r!=null&&r.dimensions)if(n){let _=t.internals.positionAbsolute.x+((x=(h=e.measured)==null?void 0:h.width)!=null?x:0);r.dimensions.width=_-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 Nr=10,Wt={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 xl=require("react/jsx-runtime"),Jf=new vr;function wo(){let[e,t]=(0,Me.useState)(void 0),[o,n]=(0,Me.useState)(void 0),{width:r,height:i}=(0,No.useStore)(m=>({width:m.width,height:m.height}),yl.shallow),a=(0,No.useNodesInitialized)(),s=(0,Me.useRef)(Jf),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,No.useReactFlow)(),u=(0,Me.useCallback)(()=>{t(void 0),n(void 0)},[]),p=(0,Me.useCallback)(m=>{let h=m!=null?m:d();u();let x=ml(h,Wt,c);s.current.initialize(x)},[c,u,d]),f=(0,Me.useCallback)(()=>{setTimeout(()=>{p()},100)},[p]);(0,Me.useEffect)(()=>{a&&p(d())},[a,p,d]);let y=(0,Me.useCallback)((m,h)=>{var Z,D,H,F,W;if(!s.current||m.length===0||m.length>2)return m;u();let x,b,T=Object.keys(Wt);m.length===1?m[0].type==="position"?x=m[0]:m[0].type==="dimensions"&&(b=m[0],T=["right","bottom"]):m[0].type==="position"&&m[1].type==="dimensions"&&m[1].dimensions&&(x=m[0],b=m[1],T=["top","left"]);let _=h.find(Y=>Y.id===m[0].id);if(!_)return m;let N=c(_.id);if(!N)throw new Error(`Node with id ${_.id} not found in internal nodes`);let w=c((Z=N.parentId)!=null?Z:""),S=Se(N);b!=null&&b.dimensions&&(S.x2=S.x+b.dimensions.width,S.y2=S.y+b.dimensions.height);let{x:P,y:L}=l({x:0,y:0}),{x:C,y:I}=l({x:r,y:i}),M={x:P,y:L,x2:C,y2:I},{horizontal:A,vertical:k}=gl(s.current,M,_,S,T),V={id:_.id,type:"position",position:{x:N.internals.positionAbsolute.x,y:N.internals.positionAbsolute.y},dragging:!1};x!=null&&x.position&&V.position&&(w?(V.position.x=x.position.x+((H=(D=w==null?void 0:w.position)==null?void 0:D.x)!=null?H:0),V.position.y=x.position.y+((W=(F=w==null?void 0:w.position)==null?void 0:F.y)!=null?W:0)):(V.position.x=x.position.x,V.position.y=x.position.y));let{snappedX:O,snappedY:B}=hl(_,N,V,x,b,w,A,k);if(O||B){if((b!=null&&b.resizing||x!=null&&x.dragging)&&(O&&n(k==null?void 0:k.line),B&&t(A==null?void 0:A.line)),b&&x)return[V,b];if(x)return[V];if(b)return[b]}return m},[l,c,r,i,t,n,u]),g=(0,Me.useCallback)(()=>(0,xl.jsx)(El,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:p,forceRebuildIndex:f,updateHelperLines:y,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var Qr=require("@xyflow/react"),ot=require("react");var Io=e=>new Map(e.map(t=>[t.id,t])),xn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),bl=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),wr=e=>e.some(t=>t.type==="START_EVENT"),_l=(e,t,o,n,r)=>{let i=Io(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:xn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Tl=(e,t,o,n,r)=>{let i=Io(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:bl(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Ir=(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:xn(e,o,n).length>=2},vl=(e,t,o)=>{var a,s,l,c;let n=Io(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"},Ar=(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"},Cr=(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"},Sr=(e,t,o,n)=>{let r=Io(t),i=r.get(e);return!i||i.type!=="TASK"?!1:bl(e,o,n).some(s=>{let l=r.get(s.source);return(l==null?void 0:l.type)==="START_EVENT"})},Mr=(e,t,o,n)=>{let r=Io(t),i=r.get(e);return!i||i.type!=="TASK"?!1:xn(e,o,n).some(s=>{let l=r.get(s.target);return(l==null?void 0:l.type)==="END_EVENT"})},Pr=(e,t,o)=>xn(e,t,o).length>0,Lr=(e,t,o,n,r)=>{let i=Io(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:xn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var Qf=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!_l(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!Tl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!Ir(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!Lr(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:!(Ar(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(Cr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Sr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(Mr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(Pr(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"})],Di=e=>{for(let t of Qf){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var jf=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:Ir(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:wr(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Ar(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Cr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Sr(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Mr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Pr(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Lr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Nl=e=>{let t=jf.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 Ye=require("@xyflow/react");var Ao=require("@xyflow/react");function wl(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:_.height)!=null?N:0)/2,p=(d-l)/(2*a)-(u-c)/(2*s),f=(d-l)/(2*a)+(u-c)/(2*s),y=1/(Math.abs(p)+Math.abs(f)||1),g=y*p,m=y*f,h=a*(g+m)+l,x=s*(-g+m)+c;return{x:h,y:x}}function Il(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?Ao.Position.Left:s>=i+n-1?Ao.Position.Right:l<=a+1?Ao.Position.Top:l>=a+r-1?Ao.Position.Bottom:Ao.Position.Top}function Ze(e,t){let o=wl(e,t),n=wl(t,e),r=Il(e,o),i=Il(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var Je=require("lecom-ui"),Cl=require("lucide-react");var Oe=require("@xyflow/react");var Al=require("@xyflow/react");var wt=()=>{let{getNodes:e,setNodes:t,getEdges:o,setEdges:n}=(0,Al.useReactFlow)();return{selectElements:a=>{let s=e().map(c=>v(E({},c),{selected:a.includes(c.id)})),l=o().map(c=>v(E({},c),{selected:a.includes(c.id)}));return t(s),n(l),!0},clearSelection:async()=>{let a=e().map(l=>v(E({},l),{selected:!1})),s=o().map(l=>v(E({},l),{selected:!1}));return t(a),n(s),await Wn(),!0}}};var kr=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,Oe.useReactFlow)(),{selectElements:r}=wt(),i=m=>{let h=o(),x=n(),b=(0,Oe.getIncomers)(m,h,x),T=(0,Oe.getOutgoers)(m,h,x),_=b.some(w=>w.type==="START_EVENT"),N=T.some(w=>w.type==="END_EVENT");return _?"start":N?"end":"between"},a=(m,h,x)=>{var _,N,w,S;if(!m)return;let b={type:m.type,variant:(_=m.data)==null?void 0:_.variant,attribute:(N=m.data)==null?void 0:N.attribute},T={id:m.id,position:i(m),label:(w=m.data)==null?void 0:w.label,node:b};return m.type==="TASK"&&((S=m.data)==null?void 0:S.variant)==="SUBPROCESS"?v(E({},T),{type:"sub_process"}):m.type==="GATEWAY"?v(E({},T),{type:"gateway",variant:s(m,h,x)}):v(E({},T),{type:"activity"})},s=(m,h,x)=>{if(m.type!=="GATEWAY")return;let b=(0,Oe.getIncomers)(m,h,x),T=!1,_=!1;if(b.forEach(N=>{var w,S;N.type==="TASK"&&(((w=N.data)==null?void 0:w.variant)==="SCRIPT"&&(T=!0),((S=N.data)==null?void 0:S.attribute)==="LOOP"&&(_=!0))}),T&&_)return"script_loop";if(T)return"script";if(_)return"loop"},l=(m,h,x)=>{var w,S,P,L;let b=e(m.source),T=e(m.target);if(!b||!T)return"simple";if((0,Oe.getOutgoers)(b,h,x).some(C=>C.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 C=(S=b.data)==null?void 0:S.variant,I=(P=b.data)==null?void 0:P.attribute;if(T.type==="TASK"&&((L=T.data)==null?void 0:L.variant)==="SUBPROCESS")return"to_sub_process";let M=C==="SCRIPT",A=I==="LOOP";return M&&A?"script_loop":M?"script":A?"loop":"simple"}return"simple"},c=(m,h,x)=>{let b=[];function T(N,w,S=0){let P=a(N,h,x);if(P.depth=S,w.push(P),N.type==="TASK"){b.push([...w]),w.pop();return}let L=(0,Oe.getIncomers)(N,h,x);if(L.length)for(let C of L)T(C,w,S+1);w.pop()}let _=(0,Oe.getIncomers)(m,h,x);for(let N of _)T(N,[]);return b},d=(m,h,x)=>{let b=[];function T(N,w,S=0){let P=a(N,h,x);if(P.depth=S,w.push(P),N.type==="TASK"){b.push([...w]),w.pop();return}let L=(0,Oe.getOutgoers)(N,h,x);if(L.length)for(let C of L)T(C,w,S+1);w.pop()}let _=(0,Oe.getOutgoers)(m,h,x);for(let N of _)T(N,[]);return b},u=(m,h,x)=>{x=x.filter(T=>T.source===m.id);let b=x.map(T=>{var w;let _=e(T.target),N;return _&&(N=a(_,h,x)),{id:T.id,type:"routing",variant:l(T,h,x),label:(w=T.data)==null?void 0:w.label,target:N}});return console.log(b),b},p=m=>{let h=e(m);if(!h)return;let x=o(),b=n(),T=a(h,x,b);return T.sources=c(h,x,b),T.targets=d(h,x,b),T.edgeTargets=u(h,x,b),h.type==="GATEWAY"&&(T.variant=s(h,x,b)),T},f=m=>{let h=t(m);if(!h)return;let x=o(),b=n(),T=l(h,x,b),N={id:h.id,type:"routing",variant:T,gatewayVariant:void 0},w=e(h.source);if(w){let P=a(w,x,b),L=c(w,x,b),C=s(w,x,b);N.source=P,N.sources=L.length?L:[[P]],N.gatewayVariant=C}let S=e(h.target);if(S){let P=a(S,x,b),L=d(S,x,b);N.target=P,N.targets=L.length?L:[[P]]}return N},y=m=>{let h=e(m);if(h)return p(h.id);let x=t(m);if(x)return f(x.id)};return{configureElement:m=>{let h=y(m);if(h)return r([m]),h},getConfigureElement:y,getNodeConfigure:p,getEdgeConfigure:f}};var Yt=require("react/jsx-runtime"),It=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Je.useTranslation)(),{onConfigureElement:n}=G(),{getConfigureElement:r}=kr();return(0,Yt.jsxs)(Je.Tooltip,{children:[(0,Yt.jsx)(Je.TooltipTrigger,{asChild:!0,children:(0,Yt.jsx)(Je.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,Yt.jsx)(Cl.Settings,{size:16})})}),(0,Yt.jsx)(Je.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Sl=require("@xyflow/react"),Qe=require("lecom-ui"),Ml=require("lucide-react"),Ut=require("react/jsx-runtime"),Dr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Qe.useTranslation)(),{deleteElements:n}=(0,Sl.useReactFlow)();return(0,Ut.jsxs)(Qe.Tooltip,{children:[(0,Ut.jsx)(Qe.TooltipTrigger,{asChild:!0,children:(0,Ut.jsx)(Qe.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ut.jsx)(Ml.TrashIcon,{size:16})})}),(0,Ut.jsx)(Qe.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var je=require("lecom-ui"),Pl=require("lucide-react"),Ll=require("react"),$t=require("react/jsx-runtime"),En=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,je.useTranslation)(),r=(0,Ll.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,$t.jsxs)(je.Tooltip,{children:[(0,$t.jsx)(je.TooltipTrigger,{asChild:!0,children:(0,$t.jsx)(je.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,$t.jsx)(Pl.MoveUpRightIcon,{size:16})})}),(0,$t.jsx)(je.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var Co=require("react/jsx-runtime"),So=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=Ke(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=G(),l=(o==null?void 0:o.type)==="START_EVENT",c=(n==null?void 0:n.type)==="END_EVENT",d=(o==null?void 0:o.type)==="GATEWAY"&&(n==null?void 0:n.type)==="GATEWAY",u=(o==null?void 0:o.type)==="TASK"&&(n==null?void 0:n.type)==="GATEWAY",p=!l&&!c&&!d&&!u,f=[{component:(0,Co.jsx)(Dr,{elementId:e,elementType:"edge"})}],y=()=>s==="view"?p?[{component:(0,Co.jsx)(It,{elementId:e,elementType:"edge"})}]:[]:p?[{component:(0,Co.jsx)(It,{elementId:e,elementType:"edge"})},...f]:f,m=(h=>{switch(h){case"SEQUENCE_EDGE":return y();case"MESSAGE_EDGE":return s==="view"?[]:[...f];case"ANNOTATION_EDGE":return s==="view"?[]:[...f];default:return[]}})(t);if(!(m.length===0||s==="view"))return(0,Co.jsx)("div",v(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:m.map((h,x)=>(0,Co.jsx)("div",{children:h.component},x))}))};var Xt=require("react/jsx-runtime"),Mo={type:"ANNOTATION_EDGE",reconnectable:!0},kl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,Ye.useViewport)(),{isMultipleSelection:a}=G(),s=(0,Ye.useInternalNode)(t),l=(0,Ye.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:u,ty:p}=Ze(s,l),[f,y,g]=(0,Ye.getStraightPath)({sourceX:c,sourceY:d,targetX:u,targetY:p}),m=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected),h=1/i;return(0,Xt.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":m}),children:[(0,Xt.jsx)(Ye.BaseEdge,{id:e,path:f,strokeDasharray:4,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":m&&!(r!=null&&r.hasError)})}),(0,Xt.jsx)(Ye.EdgeLabelRenderer,{children:(0,Xt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${g}px)`},children:n&&!a&&(0,Xt.jsx)(So,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${h})`}})})})]})};var we=require("react"),fe=require("@xyflow/react");var Kt=require("react");var Ri=require("react/jsx-runtime"),me=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s})=>{let l=(0,Kt.useRef)(null),[c,d]=(0,Kt.useState)(!1);(0,Kt.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,Kt.useEffect)(()=>{if(c&&l.current){l.current.focus();let g=document.createRange();g.selectNodeContents(l.current);let m=window.getSelection();m&&(m.removeAllRanges(),m.addRange(g))}},[c]);let u=g=>{g.stopPropagation(),c||d(!0)},p=g=>{let m=g.currentTarget.innerText.trim(),h=t&&m.length>=t,x=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],b=g.ctrlKey||g.metaKey,T=b&&g.key==="a",_=b&&g.key==="c",N=b&&g.key==="x",w=b&&g.key==="v";function S(L){return/\w/.test(L)}if(m.length===0&&!S(g.key)&&!x.includes(g.key)&&!b){g.preventDefault();return}h&&(x.includes(g.key)||T||_||N||w||g.preventDefault())},f=g=>{if(!t)return;g.preventDefault();let m=g.clipboardData.getData("text/plain"),h=g.currentTarget.innerText,x=window.getSelection();if(!x||x.rangeCount===0)return;let b=x.getRangeAt(0);if((h.substring(0,b.startOffset)+m+h.substring(b.endOffset)).length>t){let _=t-(h.length-(b.endOffset-b.startOffset)),N=m.substring(0,Math.max(0,_));N&&(b.deleteContents(),b.insertNode(document.createTextNode(N)),b.setStartAfter(b.endContainer),b.collapse(!0),x.removeAllRanges(),x.addRange(b))}else b.deleteContents(),b.insertNode(document.createTextNode(m)),b.setStartAfter(b.endContainer),b.collapse(!0),x.removeAllRanges(),x.addRange(b)},y=g=>{d(!1);let m=g.currentTarget.innerText.trim();t&&m.length>t&&(m=m.substring(0,t)),g.currentTarget.innerText=m,s==null||s(),m!==e&&(a==null||a(m))};return(0,Ri.jsx)("div",{className:R("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,Ri.jsx)("div",{ref:l,className:R("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:p,onPaste:f,onBlur:y,children:e})})};var _n=require("@xyflow/react"),Rr=e=>e===_n.Position.Left||e===_n.Position.Right,Vi=(e,t=30)=>e===_n.Position.Right||e===_n.Position.Bottom?t:-t,Oi=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,Vr=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Or=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var qt={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15};function em(e,t,o,n,r,i){let a=Vi(r,qt.OFFSET),s=Vi(i,qt.OFFSET),l=Rr(r),c=Rr(i),d={x:e,y:t},u={x:o,y:n};if(l&&c){let p=(t+n)/2;return[d,{x:e+a,y:t},{x:e+a,y:p},{x:o+s,y:p},{x:o+s,y:n},u]}if(!l&&!c){let p=(e+o)/2;return[d,{x:e,y:t+a},{x:p,y:t+a},{x:p,y:n+s},{x:o,y:n+s},u]}return l?[d,{x:e+a,y:t},{x:e+a,y:n+s},{x:o,y:n+s},u]:[d,{x:e,y:t+a},{x:o+s,y:t+a},{x:o+s,y:n},u]}function Hi(e,t,o,n,r,i,a){let s=em(e,t,o,n,r,i);if(!(a!=null&&a.length)||a.length!==s.length-2)return s;let l=[{x:e,y:t},...a,{x:o,y:n}],c=Rr(r);for(let d=0;d<l.length-1;d++){let u=l[d],p=l[d+1];if(Math.abs(p.x-u.x)>qt.TOLERANCE&&Math.abs(p.y-u.y)>qt.TOLERANCE){let y=d%2===0===c;l[d+1]=y?{x:p.x,y:u.y}:{x:u.x,y:p.y}}}return l}var Dl=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 pe=require("react"),Hr=require("@xyflow/react");var Rl=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:a,getNodes:s,screenToFlowPosition:l}=(0,Hr.useReactFlow)(),c=(0,Hr.useStore)(S=>S.isValidConnection),[d,u]=(0,pe.useState)(null),[p,f]=(0,pe.useState)(null),[y,g]=(0,pe.useState)(null),[m,h]=(0,pe.useState)(!1),x=(0,pe.useRef)(null),b=(0,pe.useRef)(t),T=(0,pe.useRef)(o);(0,pe.useEffect)(()=>{b.current=t,T.current=o},[t,o]),(0,pe.useEffect)(()=>{x.current=d},[d]);let _=(0,pe.useCallback)(S=>{var A;let P=x.current;if(!P)return;let L=l({x:S.clientX,y:S.clientY});f(L);let I=document.elementFromPoint(S.clientX,S.clientY),M=null;for(;I&&I!==document.body;){let k=I.getAttribute("data-id");if(k&&s().some(V=>V.id===k)){M=k;break}I=I.parentElement}if(g(M),M){let k={source:P==="source"?M:b.current,target:P==="target"?M:T.current,sourceHandle:null,targetHandle:null},V=(A=c==null?void 0:c(k))!=null?A:!0;h(V)}else h(!1)},[s,l,c]),N=(0,pe.useCallback)(S=>{var k;let P=x.current;if(!P)return;let L=s(),C=document.elementFromPoint(S.clientX,S.clientY),I=null,M=C;for(;M&&M!==document.body;){let V=M.getAttribute("data-id");if(V&&L.some(O=>O.id===V)){I=V;break}M=M.parentElement}if(I){let V={source:P==="source"?I:b.current,target:P==="target"?I:T.current,sourceHandle:null,targetHandle:null};if((k=c==null?void 0:c(V))==null||k){let O=a(V.source),B=a(V.target);O&&B&&i(Z=>Z.map(D=>D.id===e?v(E({},D),{source:V.source,target:V.target,data:v(E({},D.data),{points:void 0})}):D))}}u(null),f(null),g(null),h(!1),document.removeEventListener("mouseup",N),document.removeEventListener("mousemove",_);let A=et.get(n);A==null||A.clearReconnectingEdge()},[e,s,a,i,n,_,c]),w=(0,pe.useCallback)((S,P)=>{if(r||P.button!==0)return;P.stopPropagation(),P.preventDefault(),u(S);let L=et.get(n);L==null||L.setReconnectingEdge(e),document.addEventListener("mousemove",_),document.addEventListener("mouseup",N)},[r,e,n,_,N]);return(0,pe.useEffect)(()=>()=>{if(x.current){document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",N);let S=et.get(n);S==null||S.clearReconnectingEdge()}},[n,_,N]),{reconnectingHandle:d,cursorPosition:p,hoveredNodeId:y,isValidReconnection:m,handleReconnectStart:w}};var X=require("react/jsx-runtime"),Ue={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:fe.MarkerType.ArrowClosed},markerEnd:{type:fe.MarkerType.Arrow},data:{label:""}},{TOLERANCE:Vl,MOVE_THRESHOLD:Gr,MIN_SEGMENT_LENGTH:tm}=qt,Ol=({id:e,source:t,target:o,data:n,selected:r})=>{var Z;let{zoom:i}=(0,fe.useViewport)(),{updateEdgeData:a}=(0,fe.useReactFlow)(),{isMultipleSelection:s,mode:l,instanceId:c}=G(),[d,u]=(0,we.useState)(!1),[p,f]=(0,we.useState)(null),y=(0,we.useRef)(null),g=(0,we.useRef)(null),m=l==="readonly",{reconnectingHandle:h,cursorPosition:x,hoveredNodeId:b,isValidReconnection:T,handleReconnectStart:_}=Rl({edgeId:e,source:t,target:o,instanceId:c,isReadOnly:m}),N=(0,fe.useInternalNode)(t),w=(0,fe.useInternalNode)(o),{sx:S,sy:P,tx:L,ty:C,sourcePos:I,targetPos:M}=(0,we.useMemo)(()=>N&&w?Ze(N,w):{sx:0,sy:0,tx:0,ty:0,sourcePos:fe.Position.Right,targetPos:fe.Position.Left},[N,w]);(0,we.useEffect)(()=>{var F;if(!g.current){g.current={sx:S,sy:P,tx:L,ty:C,sourcePos:I,targetPos:M};return}let D=g.current;(Math.abs(S-D.sx)>Gr||Math.abs(P-D.sy)>Gr||Math.abs(L-D.tx)>Gr||Math.abs(C-D.ty)>Gr||D.sourcePos!==I||D.targetPos!==M)&&((F=n==null?void 0:n.points)!=null&&F.length)&&a(e,v(E({},n),{points:void 0})),g.current={sx:S,sy:P,tx:L,ty:C,sourcePos:I,targetPos:M}},[S,P,L,C,I,M,n,e,a]);let A=(0,we.useMemo)(()=>{var D;if((D=n==null?void 0:n.points)!=null&&D.length&&N&&w){let H=n.points[0],F=n.points[n.points.length-1],Y=Ze(N,{internals:{positionAbsolute:H},measured:{width:1,height:1}}),ie=Ze({internals:{positionAbsolute:F},measured:{width:1,height:1}},w);return Hi(Y.sx,Y.sy,ie.tx,ie.ty,Y.sourcePos,ie.targetPos,n.points)}return Hi(S,P,L,C,I,M,n==null?void 0:n.points)},[S,P,L,C,I,M,n==null?void 0:n.points,N,w]),k=(0,we.useMemo)(()=>{if(A.length<2)return Or({x:S,y:P},{x:L,y:C});let D=0;for(let W=0;W<A.length-1;W++)D+=Vr(A[W],A[W+1]);let H=D/2,F=0;for(let W=0;W<A.length-1;W++){let Y=Vr(A[W],A[W+1]);if(F+Y>=H){let de=(H-F)/Y,ie=A[W],xe=A[W+1];return{x:ie.x+(xe.x-ie.x)*de,y:ie.y+(xe.y-ie.y)*de}}F+=Y}return Or({x:S,y:P},{x:L,y:C})},[A,S,P,L,C]),V=(0,we.useCallback)((D,H)=>{if(l!=="edit"||H.button!==0)return;H.stopPropagation(),H.preventDefault();let F=A[D],W=A[D+1],Y=Oi(F,W,"y"),de=Y?F.y:F.x;f(D);let ie=Rt=>{let ze=de+(Y?Rt.clientY-H.clientY:Rt.clientX-H.clientX)/i;y.current=Y?{x:(F.x+W.x)/2,y:ze}:{x:ze,y:(F.y+W.y)/2};let Jo=A.map((st,co)=>co===0||co===A.length-1?st:(Y?Math.abs(st.y-de)<Vl:Math.abs(st.x-de)<Vl)?Y?v(E({},st),{y:ze}):v(E({},st),{x:ze}):st);a(e,v(E({},n),{points:Jo.slice(1,-1)}))},xe=()=>{f(null),y.current=null,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",xe)};document.addEventListener("mousemove",ie),document.addEventListener("mouseup",xe)},[l,A,i,n,e,a]);if(!N||!w)return null;let O=Dl(A),B=r||N.selected||w.selected;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":B}),onBlur:()=>u(!1),onDoubleClick:()=>u(!0),children:[(0,X.jsx)(fe.BaseEdge,{id:e,path:O,markerEnd:`url(#${B?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":B&&!(n!=null&&n.hasError)})}),h&&x&&(0,X.jsx)("line",{x1:h==="source"?A[0].x:A[A.length-1].x,y1:h==="source"?A[0].y:A[A.length-1].y,x2:x.x,y2:x.y,stroke:b?T?"#10b981":"#ef4444":"#3b82f6",strokeWidth:3,strokeDasharray:"8 4",opacity:.6,className:"pointer-events-none"}),r&&!s&&!m&&(0,X.jsx)("g",{children:A.slice(0,-1).map((D,H)=>{let F=A[H+1];if(H===0||H===A.length-2||Vr(D,F)<tm)return null;let W=Oi(D,F,"y"),Y=p===H,de=Y&&y.current?y.current:Or(D,F);return(0,X.jsxs)("g",{children:[(0,X.jsx)("line",{x1:D.x,y1:D.y,x2:F.x,y2:F.y,stroke:"transparent",strokeWidth:20/i,className:R("cursor-pointer",{"cursor-ns-resize":W,"cursor-ew-resize":!W}),onMouseDown:ie=>V(H,ie)}),(0,X.jsx)("circle",{cx:de.x,cy:de.y,r:4/i,fill:Y?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/i,className:"pointer-events-none"}),(0,X.jsx)("circle",{cx:de.x,cy:de.y,r:6/i,fill:"none",stroke:"#3b82f6",strokeWidth:1/i,opacity:Y?.6:.3,className:"pointer-events-none"})]},H)})})]}),(0,X.jsxs)(fe.EdgeLabelRenderer,{children:[(0,X.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${k.x}px, ${k.y}px)`},children:[r&&!s&&(0,X.jsx)(So,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:N,targetNode:w,style:{transform:`scale(${1/i})`}}),(d||((Z=n==null?void 0:n.label)==null?void 0:Z.trim()))&&(0,X.jsx)(me,{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:d,onChange:D=>a(e,{label:D.trim()})})]}),r&&!s&&!m&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A[0].x}px, ${A[0].y}px)`},children:(0,X.jsxs)("svg",{width:12/i,height:12/i,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:4/i,fill:h==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/i,className:"pointer-events-none"}),(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:6/i,fill:"none",stroke:"#3b82f6",strokeWidth:1/i,opacity:h==="source"?.6:.3,className:"pointer-events-none"}),(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:8/i,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!h||h!=="source","cursor-not-allowed":h==="source"&&b&&!T,"cursor-grabbing":h==="source"&&(!b||T)}),onMouseDown:D=>_("source",D.nativeEvent)})]})}),(0,X.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A[A.length-1].x}px, ${A[A.length-1].y}px)`},children:(0,X.jsxs)("svg",{width:12/i,height:12/i,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:4/i,fill:h==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/i,className:"pointer-events-none"}),(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:6/i,fill:"none",stroke:"#3b82f6",strokeWidth:1/i,opacity:h==="target"?.6:.3,className:"pointer-events-none"}),(0,X.jsx)("circle",{cx:6/i,cy:6/i,r:8/i,fill:"transparent",className:R("pointer-events-auto",{"cursor-move":!h||h!=="target","cursor-not-allowed":h==="target"&&b&&!T,"cursor-grabbing":h==="target"&&(!b||T)}),onMouseDown:D=>_("target",D.nativeEvent)})]})})]})]})]})};var Zc=require("use-debounce");var qc=require("@xyflow/react"),Xi=require("react");var Tn=(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))(Tn||{});var Br=require("xml-js");var Hl={compact:!0,spaces:4},om=e=>e.replaceAll(`
|
|
2
|
+
`,"
");function zr(e,t=Hl){if(e)return JSON.parse((0,Br.xml2json)(e,v(E({},t),{attributeValueFn:om})))}function Gl(e,t=Hl){return e?(0,Br.json2xml)(e,t):""}var nm={MIN_WIDTH:36,MIN_HEIGHT:36},rm={MIN_WIDTH:36,MIN_HEIGHT:36},im={MIN_WIDTH:56,MIN_HEIGHT:56},Fr={MIN_WIDTH:176,MIN_HEIGHT:96},Wr={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},te={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Yr={MIN_WIDTH:176,MIN_HEIGHT:64},sm={MIN_WIDTH:128,MIN_HEIGHT:64},U={START_EVENT:nm,END_EVENT:rm,GATEWAY:im,TASK:Fr,LANE:te,ANNOTATION:Yr,UNSUPPORTED:sm};var Bl={"attribute-loop":"LOOP"},zl={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Fl={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Wl={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Yl={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var Po=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=Et(Number(n),t),a=Et(Number(r),o);return{width:i,height:a,measured:{width:i,height:a}}},Lo=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},lm=e=>{let{mxGeometry:t}=e,o=Lo(e),n=Po(t,U.START_EVENT.MIN_WIDTH,U.START_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"START_EVENT"})},cm=e=>{let{mxGeometry:t}=e,o=Lo(e),n=Po(t,U.END_EVENT.MIN_WIDTH,U.END_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"END_EVENT"})},Gi=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=Lo(e),i=Po(n,U.TASK.MIN_WIDTH,U.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=Bl[l];c&&(r.data.attribute=c)}let s=zl[o.style];return s&&(r.data.variant=s),v(E(E({},r),i),{type:"TASK"})},Bi=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=Lo(e),i=Po(o,U.GATEWAY.MIN_WIDTH,U.GATEWAY.MIN_HEIGHT);return r.data.variant=Fl[n],v(E(E({},r),i),{type:"GATEWAY"})},dm=e=>{let{mxGeometry:t}=e,o=Lo(e),n=Po(t,U.ANNOTATION.MIN_WIDTH,U.ANNOTATION.MIN_HEIGHT);return v(E(E({},o),n),{type:"ANNOTATION"})},um=e=>{let{mxGeometry:t}=e,o=Lo(e),n=Po(t,U.LANE.MIN_WIDTH,U.LANE.MIN_HEIGHT);return v(E(E({},o),n),{type:"LANE"})},Ul={task:Gi,"task-script":Gi,"subprocess-collapsed":Gi,"start-event":lm,"end-event-terminate":cm,"gateway-parallel":Bi,"gateway-exclusive":Bi,"gateway-complex":Bi,annotation:dm,lane:um},$l=e=>{var d;let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:a,style:s}=t,l=(d=o==null?void 0:o.Array)==null?void 0:d.map(u=>({x:Number(u._attributes.x),y:Number(u._attributes.y)})),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({},Mo),c):E(E({},Ue),c)},Xl=(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}}}},pm=e=>{let{variant:t}=e.data,o=ko(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Wl[t]||"task"})})},fm=e=>{let t=ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"start-event"})})},mm=e=>{let t=ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"end-event-terminate"})})},gm=e=>{let{variant:t}=e.data,o=ko(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Yl[t]})})},hm=e=>{let t=ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"lane"})})},ym=e=>{let t=ko(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"annotation"})})},Kl={TASK:pm,START_EVENT:fm,END_EVENT:mm,GATEWAY:gm,ANNOTATION:ym,LANE:hm},ql=(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 zi=ku(require("@dagrejs/dagre"),1),jl=require("@xyflow/react");var ec=require("lodash");var Zl=require("lodash");var ut=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}},pt=e=>(0,Zl.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Jl=(e,t)=>{let{x:o,y:n}=ut(e),{x:r,y:i}=ut(t);return{x:o-r,y:n-i}};var Do=({parentId:e,nodes:t,includeTypes:o=[...Object.values(z)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),xm=(e,t)=>{let{x:o,y:n}=ut(e),{x:r,y:i}=ut(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},Em=(e,t)=>{let{x:o,y:n,w:r,h:i}=ut(e),{x:a,y:s,w:l,h:c}=ut(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},vn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Em(e,r)){let i=xm(e,r);i<n&&(n=i,o=r)}return o},Ql=(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 tc=(e=[],t=[],o="LR")=>{let n=new zi.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)),zi.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}},Nn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Zt(n.id,o)}),o},Zt=(e,t)=>{var f,y;let o=[...t],n=o.find(g=>g.id===e);if(!n)return o;let r=o.filter(g=>g.parentId===e&&g.type==="LANE");if(r.length===0)return o;let i=(0,ec.orderBy)(r,["position.y"]),a=Math.max((y=(f=n.measured)==null?void 0:f.width)!=null?y:0,Wr.MIN_WIDTH),s=Ql(e,i)||te.MIN_WIDTH,l=Math.max(a,s),c=a-te.HEADER_WIDTH>=s,d=0,u=0;i.forEach(g=>{var m,h,x,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+=(h=(m=g.measured)==null?void 0:m.height)!=null?h:0,u+=(b=(x=g.measured)==null?void 0:x.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=Zt(p.parentId,o)),o},oc=(e,t,o)=>{if(e.type==="LANE")return o;let n=Se(t),r=Se(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},nc=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},bm=50,rc=(e,t=bm)=>{let o=(0,jl.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var _m=e=>{let t=Object.values(Tn),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=Ul[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},Tm=(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=$l(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=Kl)[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=ql(n,t);o.push(l)}}),o},Nm=(e,t)=>{let o=[];return e.forEach(n=>{let r=Xl(n,t);o.push(r)}),o},ic=(e=[],t=[],o)=>{let n=vm(e,o),r=Nm(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return Gl(JSON.stringify(i),{compact:!0,spaces:0})},sc=async e=>{var a,s;let t=await zr(e),o=((s=(a=t==null?void 0:t.mxGraphModel)==null?void 0:a.root)==null?void 0:s.mxCell)||[],n=_m(o),r=Tm(o,n);return{nodes:pt(Nn(n)),edges:r}};var Ho=require("@xyflow/react");var wn=require("@xyflow/react");var Fi=require("react/jsx-runtime"),ge=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=Ke(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,Fi.jsx)(wn.Handle,E({type:e,position:t,className:R("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!s},o)},r))},Ro=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=Ke(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,wn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let f=c();if(t==="TASK")return f.filter(g=>g.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return f.filter(g=>g.source===e).length>=2;if(t==="START_EVENT"){let y=d();return f.filter(m=>{if(m.source!==e)return!1;let h=y.find(x=>x.id===m.target);return(h==null?void 0:h.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,Fi.jsx)(wn.Handle,E({type:n,position:r,className:R("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":p,"hover:border-grey-500":!p},i),style:{pointerEvents:p?"none":"auto"}},a))};var Ur=require("@xyflow/react"),ac=require("lodash");var lc=require("react/jsx-runtime"),Vo=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=Ke(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,Ur.useReactFlow)(),{isMultipleSelection:l}=G(),c=({width:u,height:p})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let y=[...a()],g=!f.parentId,m=g?f.id:f.parentId,h=y.filter(T=>T.type==="LANE"&&T.parentId===m);if(!h.length)return;let x=(0,ac.orderBy)(h,["position.y"]),b=0;x.forEach((T,_)=>{var S,P;let N=_===x.length-1,w=(P=(S=T.measured)==null?void 0:S.height)!=null?P:0;y=y.map(L=>{if(L.id===T.id){let C=g?u-te.HEADER_WIDTH:u,I=v(E({},L),{width:C,measured:v(E({},L.measured),{width:C}),position:v(E({},L.position),{y:b})});return N&&g&&(I.height=p-b),I}return L}),b+=w}),y=y.map(T=>{if(T.id===m){let _=g?u:u+te.HEADER_WIDTH;return v(E({},T),{width:_,height:g?p:b,measured:{width:_,height:g?p:b}})}return T}),s(y)};return(0,lc.jsx)(Ur.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 Kr=require("@xyflow/react"),tt=require("lecom-ui"),Qt=require("react");var cc=require("zustand"),Oo=(0,cc.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var $r=require("react"),dc=(e,t=!1)=>{let[o,n]=(0,$r.useState)({width:0,height:0});return(0,$r.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var At=require("@xyflow/react"),uc=require("react"),wm=120,Im=12,pc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,At.useReactFlow)(),{instanceId:i}=G();return(0,uc.useMemo)(()=>{var f,y;if(!t)return{position:At.Position.Right,align:"start"};let a=n(e);if(!a)return{position:At.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((f=a.measured)==null?void 0:f.width)||a.width||100)*s.zoom,d=(y=document.getElementById(`modeler-${i}`))==null?void 0:y.clientWidth;if(!d)return{position:At.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||wm;return{position:l+c+u+Im>d?At.Position.Left:At.Position.Right}},[i,e,t,o,n,r])};var Xr=require("@xyflow/react"),K=require("lecom-ui"),fc=require("lucide-react");var j=require("react/jsx-runtime"),mc=({nodeId:e})=>{let{t}=(0,K.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Xr.useReactFlow)(),i=(0,Xr.useNodesData)(e),s=n().filter(f=>f.source===e).some(f=>{let y=r(f.target);return(y==null?void 0:y.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=u=>{o(e,{variant:(i==null?void 0:i.data.variant)===u?"":u})},d=u=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===u?"":u})};return(0,j.jsxs)(K.DropdownMenu,{children:[(0,j.jsxs)(K.Tooltip,{children:[(0,j.jsx)(K.TooltipTrigger,{asChild:!0,children:(0,j.jsx)(K.DropdownMenuTrigger,{asChild:!0,children:(0,j.jsx)(K.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,j.jsx)(fc.WrenchIcon,{})})})}),(0,j.jsx)(K.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,j.jsxs)(K.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,j.jsxs)(K.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,j.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,j.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Xn).map(([u,p])=>{let f=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,j.jsxs)(K.Tooltip,{children:[(0,j.jsx)(K.TooltipTrigger,{asChild:!0,children:(0,j.jsx)(K.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:R({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":f}),onClick:f?void 0:()=>d(u),children:(0,j.jsx)(p.icon,{className:"stroke-inherit"})})}),g&&(0,j.jsx)(K.TooltipContent,{color:"black",children:g})]},u)})})]}),(0,j.jsx)(K.DropdownMenuGroup,{children:(0,j.jsxs)(K.Tooltip,{children:[(0,j.jsx)(K.TooltipTrigger,{asChild:!0,children:(0,j.jsxs)(K.DropdownMenuItem,{className:R({"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,j.jsx)($n.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),s&&(0,j.jsx)(K.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var oe=require("react/jsx-runtime"),Jt={START_EVENT:{type:"START_EVENT",icon:on,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:uo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:on,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:Fn,label:"bpmn.annotation.variant.default"}},Am={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:mo,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:ho,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:po,label:"bpmn.gateway.variant.complex"}},Ie=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,Qt.useRef)(null),a=(0,Qt.useRef)(null),{t:s}=(0,tt.useTranslation)(),{setDraggableNode:l}=Oo(),{getEdges:c,getNodes:d}=(0,Kr.useReactFlow)(),{setIsDragging:u,mode:p}=G(),{dimensions:f}=dc(i,r),{position:y}=pc(e,r,f),[g,m]=(0,Qt.useState)(void 0),h=d(),x=c(),b=o==="SUBPROCESS",T=(0,Qt.useCallback)((k,V)=>{l({type:V.type,variant:V.variant,attribute:V.attribute,icon:V.icon}),V.icon&&m((0,oe.jsx)(V.icon,{})),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("sourceId",e),a.current&&k.dataTransfer.setDragImage(a.current,10,10),setTimeout(()=>{u(!0)},100)},[e,l,u]),_=[{component:(0,oe.jsx)(Dr,{elementId:e})}],N=()=>{if(p==="view")return[];let k=!x.some(V=>{var O;return V.source===e&&((O=h.find(B=>B.id===V.target))==null?void 0:O.type)!=="ANNOTATION"});return[{component:(0,oe.jsx)(En,{nodeId:e,disabled:!k,tooltipMessage:k?void 0:s("editor.toolbar.start_event_limit_reached")})},Jt.TASK,Jt.ANNOTATION,..._]},w=()=>p==="view"?[{component:(0,oe.jsx)(It,{elementId:e})}]:[{component:(0,oe.jsx)(It,{elementId:e})},...b?[]:[{component:(0,oe.jsx)(mc,{nodeId:e})}],{component:(0,oe.jsx)(En,{nodeId:e})},Jt.TASK,...Object.values(Am),..._],S=()=>p==="view"?[{component:(0,oe.jsx)(It,{elementId:e})}]:[{component:(0,oe.jsx)(It,{elementId:e})},{component:(0,oe.jsx)(En,{nodeId:e})},Jt.TASK,Jt.ANNOTATION,..._],P=()=>p==="view"?[]:[{component:(0,oe.jsx)(En,{nodeId:e})},Jt.ANNOTATION,..._],L=()=>p==="view"?[]:[...n?[]:[Jt.ANNOTATION],..._],C=()=>p==="view"?[]:[..._],I=()=>p==="view"?[]:[..._],A=(k=>{switch(k){case"START_EVENT":return N();case"TASK":return w();case"GATEWAY":return S();case"END_EVENT":return P();case"LANE":return L();case"ANNOTATION":return C();case"UNSUPPORTED":return I();default:return[]}})(t);if(!(A.length===0||p==="readonly"))return(0,oe.jsxs)(Kr.NodeToolbar,{position:y,align:"start",className:"-top-8",isVisible:r,children:[(0,oe.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:A.map((k,V)=>{if(k.component)return(0,oe.jsx)("div",{children:k.component},V);let O={sourceNodeType:t,targetNodeType:k.type,sourceNodeId:e,nodes:h,edges:x},B=Nl(O),Z={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")},D=B.shouldDisable&&B.reason?Z[B.reason]||s(k.label):s(k.label)||"";return(0,oe.jsxs)(tt.Tooltip,{children:[(0,oe.jsx)(tt.TooltipTrigger,{asChild:!0,children:(0,oe.jsx)(tt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!B.shouldDisable,disabled:B.shouldDisable,className:B.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:B.shouldDisable?void 0:H=>T(H,k),children:k.icon&&(0,oe.jsx)(k.icon,{size:16})})}),(0,oe.jsx)(tt.TooltipContent,{color:"black",children:D})]},V)})}),(0,oe.jsx)("div",{ref:a,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:g})]})};var jt=require("react/jsx-runtime"),gc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ho.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Ho.useConnection)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=G(),u=i&&(a==null?void 0:a.id)!==e,p=y=>{r(e,{label:y})},f=!l&&!c&&!d;return(0,jt.jsxs)("div",{className:R("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:[(0,jt.jsx)(me,{value:t.label,className:"m-1 text-grey-600",onChange:p}),f&&(0,jt.jsx)(Ie,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),s==="edit"&&(0,jt.jsx)(Vo,{minWidth:Yr.MIN_WIDTH,minHeight:Yr.MIN_HEIGHT,isVisible:!n&&o}),(!i||u)&&(0,jt.jsx)(ge,{type:"target",position:Ho.Position.Left,className:R({"annotation-handle":u})})]})};var eo=require("@xyflow/react"),hc=require("react");var ft=require("react/jsx-runtime"),yc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,eo.useReactFlow)(),{inProgress:i,fromNode:a}=(0,eo.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c}=G(),[d,u]=(0,hc.useState)(!1),p=i&&(a==null?void 0:a.id)!==e,f=h=>{r(e,{label:h})},y=()=>{u(!0)},g=()=>{u(!1)},m=!s&&!l&&!c;return(0,ft.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:y,children:[(0,ft.jsx)(uo,{className:R("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ft.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ft.jsx)(me,{value:t.label,isEditing:d,onChange:f})}),m&&(0,ft.jsx)(Ie,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||p)&&(0,ft.jsx)(ge,{type:"target",position:eo.Position.Left,className:R({"event-handle":p})}),!i&&(0,ft.jsx)(ge,{type:"source",position:eo.Position.Right})]})};var to=require("@xyflow/react"),qr=require("react");var mt=require("react/jsx-runtime"),xc=({id:e,data:t,selected:o,dragging:n})=>{let r=yi[t.variant].icon,{updateNodeData:i}=(0,to.useReactFlow)(),{inProgress:a,fromNode:s}=(0,to.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d}=G(),[u,p]=(0,qr.useState)(!1),f=a&&(s==null?void 0:s.id)!==e,y=(0,qr.useCallback)(x=>{i(e,{label:x})},[e,i]),g=()=>{p(!0)},m=()=>{p(!1)},h=!l&&!c&&!d;return(0,mt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:g,children:[(0,mt.jsx)(r,{className:R("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,mt.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,mt.jsx)(me,{value:t.label,isEditing:u,onChange:y})}),h&&(0,mt.jsx)(Ie,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!a||f)&&(0,mt.jsx)(ge,{type:"target",position:to.Position.Left,className:R({"gateway-handle":f})}),!a&&(0,mt.jsx)(Ro,{type:"source",position:to.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var Ec=require("@xyflow/react"),$e=require("lecom-ui"),Cm=require("lucide-react");var bc=require("react/jsx-runtime");var oo=require("@xyflow/react"),_c=require("react");var gt=require("react/jsx-runtime"),Tc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,oo.useReactFlow)(),{inProgress:i,fromNode:a}=(0,oo.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c}=G(),[d,u]=(0,_c.useState)(!1),p=i&&(a==null?void 0:a.id)!==e,f=h=>{r(e,{label:h})},y=()=>{u(!0)},g=()=>{u(!1)},m=!s&&!l&&!c;return(0,gt.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:y,children:[(0,gt.jsx)(Un,{className:R("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,gt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,gt.jsx)(me,{value:t.label,isEditing:d,onChange:f})}),m&&(0,gt.jsx)(Ie,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||p)&&(0,gt.jsx)(ge,{type:"target",position:oo.Position.Left,className:R({"event-handle":p})}),!i&&(0,gt.jsx)(Ro,{type:"source",position:oo.Position.Right,nodeId:e,nodeType:"START_EVENT"})]})};var no=require("@xyflow/react"),Ic=require("lecom-ui"),Ac=require("react");var Zr=(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}`},Go=(e,t)=>{let n=t.filter(s=>s.type==="TASK").map(s=>{var l;return(l=s.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),i=n.filter(s=>s===r||s.startsWith(`${r} (`)).map(s=>{if(s===r)return 1;let l=s.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(s=>s>0),a=2;for(;i.includes(a);)a++;return`${r} (${a})`};var In=require("react/jsx-runtime"),vc=e=>(0,In.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,In.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,In.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var Wi=require("react/jsx-runtime"),Nc=e=>(0,Wi.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,Wi.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 An=require("react/jsx-runtime"),wc=e=>(0,An.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,An.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,An.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var be=require("react/jsx-runtime"),Sm={APROVADO:vc,EM_ANDAMENTO:Nc,REJEITADO:wc},Yi={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)]"},Cc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,Ic.useTranslation)(),{updateNodeData:i,getNodes:a}=(0,no.useReactFlow)(),{inProgress:s,fromNode:l}=(0,no.useConnection)(),{mode:c,isConnecting:d,isDragging:u,isMultipleSelection:p,onSubprocessValidationClick:f}=G(),{getTaskStatus:y}=Ht(),g=s&&(l==null?void 0:l.id)!==e,m=(0,Ac.useCallback)(C=>{let I=C.trim(),M=t.label||"";if(I===M)return;let A=a(),k=I;I||(k=Zr(A,r("bpmn.task.label.prefix")));let V=Go(k,A);V!==M&&i(e,{label:V})},[t.label,a,e,r,i]),h=y(e),x=h?Sm[h]:null,b=t.variant?$n[t.variant].icon:null,T=t.attribute?Xn[t.attribute].icon:null,_=t.variant==="SUBPROCESS",N=b&&!_,w=T||_,S=()=>t.hasError?Yi.error:h?Yi[h]:Yi.default,P=()=>{f==null||f({id:e,type:"sub_process",label:t.label})},L=!d&&!u&&!p;return(0,be.jsxs)("div",{className:R("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md hover:shadow-md transition-colors duration-75",S(),{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,be.jsx)(me,{value:t.label,maxLength:60,className:R("m-1",{"py-6":N||w}),onChange:m}),b&&(0,be.jsx)("div",{className:R("absolute flex items-center p-1",_?"bottom-0":"top-0 left-0"),children:(0,be.jsx)(b,{size:16,className:R(t.hasError?"text-red-500":"text-grey-500",_&&"cursor-pointer"),onClick:_?P:void 0})}),T&&(0,be.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,be.jsx)("div",{className:R("flex items-center w-16 p-1",_?"justify-between":"justify-center"),children:(0,be.jsx)(T,{size:16,className:R(t.hasError?"text-red-500":"text-grey-500")})})}),x&&(0,be.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,be.jsx)(x,{})}),L&&(0,be.jsx)(Ie,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),c==="edit"&&(0,be.jsx)(Vo,{minWidth:Fr.MIN_WIDTH,minHeight:Fr.MIN_HEIGHT,isVisible:!n&&o}),(!s||g)&&(0,be.jsx)(ge,{type:"target",position:no.Position.Left,className:R({"task-handle":g})}),!s&&(0,be.jsx)(Ro,{type:"source",position:no.Position.Right,nodeId:e,nodeType:"TASK"})]})};var Ui=require("@xyflow/react");var ht=require("react/jsx-runtime"),Sc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:a}=G(),s=!r&&!i&&!a;return(0,ht.jsxs)(ht.Fragment,{children:[(0,ht.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,ht.jsx)(Ie,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,ht.jsx)(ge,{type:"source",position:Ui.Position.Right}),(0,ht.jsx)(ge,{type:"target",position:Ui.Position.Left})]})};var _e=require("@xyflow/react"),Mc=require("react");var Ct=require("react/jsx-runtime"),vN={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:_e.MarkerType.Arrow},data:{label:""}},Pc=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,_e.useViewport)(),{updateEdgeData:a}=(0,_e.useReactFlow)(),{isMultipleSelection:s}=G(),[l,c]=(0,Mc.useState)(!1),d=(0,_e.useInternalNode)(t),u=(0,_e.useInternalNode)(o);if(!d||!u)return null;let{sx:p,sy:f,tx:y,ty:g,sourcePos:m,targetPos:h}=Ze(d,u),[x,b,T]=(0,_e.getSmoothStepPath)({sourceX:p,sourceY:f,targetX:y,targetY:g,sourcePosition:m,targetPosition:h}),_=r||(d==null?void 0:d.selected)||(u==null?void 0:u.selected),N=_?"sequence-edge-marker-highlighted":"sequence-edge-marker",w=l||(n==null?void 0:n.label.trim().length)>0,S=1/i,P=()=>{c(!0)},L=()=>{c(!1)},C=I=>{a(e,{label:I.trim()})};return(0,Ct.jsxs)("g",{className:R("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":_}),onBlur:L,onDoubleClick:P,children:[(0,Ct.jsx)(_e.BaseEdge,{id:e,path:x,markerEnd:`url(#${N})`,strokeDasharray:4,className:R("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":_&&!(n!=null&&n.hasError)})}),(0,Ct.jsx)(_e.EdgeLabelRenderer,{children:(0,Ct.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${b}px, ${T}px)`},children:[r&&!s&&(0,Ct.jsx)(So,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${S})`}}),w&&(0,Ct.jsx)(me,{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:l,onChange:C})]})})]})};var Lc=require("@xyflow/react"),Cn=require("react/jsx-runtime"),kc=({toX:e,toY:t,fromPosition:o,toPosition:n,fromNode:r})=>{if(!r)return null;let i={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:a,sy:s,tx:l,ty:c,sourcePos:d,targetPos:u}=Ze(r,i),[p]=(0,Lc.getBezierPath)({sourceX:a,sourceY:s,sourcePosition:d||o,targetPosition:u||n,targetX:l||e,targetY:c||t});return(0,Cn.jsxs)("g",{children:[(0,Cn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:p}),(0,Cn.jsx)("circle",{cx:l||e,cy:c||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Jr=require("@xyflow/react"),Dc=require("lodash"),Sn=require("react");var Pe=require("react/jsx-runtime"),Rc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,Jr.useReactFlow)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=G(),[u,p]=(0,Sn.useState)(!1),f=a(),y=!r,g=(0,Sn.useMemo)(()=>(0,Dc.orderBy)([...f.filter(N=>N.parentId===e&&N.type==="LANE")],"position.y","asc"),[f,e]),m=y?Wr.MIN_WIDTH:te.MIN_WIDTH,h=(0,Sn.useMemo)(()=>{if(y&&g.length>1){let N=[...g];return N.pop(),N.reduce((S,P)=>{var L,C;return S+((C=(L=P.measured)==null?void 0:L.height)!=null?C:0)},0)+te.MIN_HEIGHT}return te.MIN_HEIGHT},[y,g]),x=N=>{i(e,{label:N})},b=()=>{p(!0)},T=()=>{p(!1)},_=!l&&!c&&!d;return(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsxs)("div",{className:R("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,Pe.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:T,onDoubleClick:b,children:(0,Pe.jsx)("div",{className:R("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!u}),children:(0,Pe.jsx)(me,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:R({"whitespace-nowrap":u}),isEditing:u,onChange:x})})}),(0,Pe.jsx)("div",{className:"flex-1"})]}),_&&(0,Pe.jsx)(Ie,{nodeId:e,nodeType:"LANE",isChild:!y,isVisible:!n&&o}),s==="edit"&&(0,Pe.jsx)(Vo,{nodeId:e,minWidth:m,minHeight:h,isVisible:!n&&o}),y&&(0,Pe.jsx)(ge,{type:"source",position:Jr.Position.Right})]})};var Vc={START_EVENT:Tc,END_EVENT:yc,TASK:Cc,GATEWAY:xc,ANNOTATION:gc,LANE:Rc,UNSUPPORTED:Sc},Oc={SEQUENCE_EDGE:Ol,MESSAGE_EDGE:Pc,ANNOTATION_EDGE:kl},Hc="#fafafa",Gc="#bebebe",Bc=1,zc=10,Fc="bottom-left",Wc=.2,Yc=5,Bo=.5,zo=.4,Fo=1,Uc={x:0,y:0,zoom:.75},Mm=1,Pm=2,$c=[Mm,Pm];var Kc=require("@xyflow/react");var Lm=1,Xc=()=>`<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>`,ki=(e,t)=>{if(!e.length&&!t.length)return wm;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var Ve=()=>{let{getEdges:e,getNodes:t}=(0,Hc.useReactFlow)();return{getLastId:()=>ki(t(),e()),getNextId:()=>{let n=t(),r=e();return ki(n,r)+1}}};var Po=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,Gc.useReactFlow)(),{getLastId:i}=Ve(),s=(0,Ri.useCallback)(async(l="")=>{let{nodes:c,edges:d}=await Zl(l);o(c),n(d),r({padding:Mo})},[o,n,r]),a=(0,Ri.useCallback)((l,c)=>{let d=l||e()||[],p=c||t()||[],u=i();return ql(d,p,u)},[e,t,i]);return{importFromMxGraph:s,exportToMxGraph:a}};var Vi=require("react"),Am=500,Lo=()=>{let{isInitialized:e,onElementChanges:t}=V(),{exportToMxGraph:o}=Po(),n=(0,Bc.useDebouncedCallback)(()=>{if(!e)return;let s=o();t==null||t(s)},Am),r=(0,Vi.useCallback)(s=>{s.every(c=>c.type==="select")||s.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Vi.useCallback)(s=>{s.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var Fc=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,zc.useReactFlow)(),{emitElementChanges:r}=Lo(),{getNextId:i}=Ve(),s=(0,Oi.useCallback)(l=>{let c=t(l.source),d=t(l.target);if(!c||!d)return!1;let p={sourceNodeId:c.id,targetNodeId:d.id,sourceNodeType:c.type,targetNodeType:d.type,nodes:n(),edges:o()};return ml(p).isValid},[t,o,n]),a=(0,Oi.useCallback)(l=>{let c=i(),d=t(l.target),p=(d==null?void 0:d.type)==="ANNOTATION"?_o:Be,u=v(b(b({},l),p),{id:String(c)});e(f=>f.concat(u)),r()},[t,i,e,r]);return{isValidConnection:s,onConnect:a}};var Jc=require("@xyflow/react"),Qc=require("lecom-ui"),Jt=require("react");var bn=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Zt=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Nt=(e=[])=>e.filter(t=>t.type==="TASK")||[],Wc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Yc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Fr=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Uc=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),Se=(e,t=[])=>t.filter(o=>o.source===e),_n=(e,t=[])=>t.filter(o=>o.target===e),$c=(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"},Xc=(e,t)=>{let o=Se(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},Kc=e=>e?/\w/g.test(e.trim()):!1,$=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:[]}},Ze=(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)}},qc=(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 Tn=[{id:"start_event_not_found",validate:e=>{let t=bn(e.nodes);return $({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Zt(e.nodes);return $({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=bn(e.nodes),o=t.length===1;if(t.length===0)return $({isValid:!0});if(!o)return $({isValid:!1,nodeIds:t.map(i=>i.id)});let n=Se(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(s=>s.id),...n.map(s=>s.target)];return $({isValid:!1,nodeIds:[...new Set(i)]})}return $({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Nt(e.nodes),o=Ze(t,n=>Se(n.id,e.edges).length<=2);return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Nt(e.nodes),o=Ze(t,n=>!!n.label&&n.label.trim()!=="");return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Nt(e.nodes),n=Ze(o,r=>!r.label||r.label.length<=60);return $({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Nt(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 $({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Fr(e.nodes),o=[],n=[];for(let r of t){let i=Se(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return $({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...bn(e.nodes),...Zt(e.nodes)],o=[],n=[];for(let r of t){let i=Se(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&(a.type==="START_EVENT"||a.type==="END_EVENT")&&(o.push(r.id,a.id),n.push(s.id))}}return $({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Zt(e.nodes),o=[],n=[];for(let r of t){let i=_n(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.source);if(a&&a.type==="TASK"){let l=Se(a.id,e.edges);l.length>1&&(o.push(a.id),l.forEach(c=>n.push(c.id)))}}}return $({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Uc(e.nodes),o=Ze(t,r=>Se(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>Se(r,e.edges).map(i=>i.id));return $({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=Nt(e.nodes),o=Ze(t,n=>!n.label||Kc(n.label));return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,a;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((a=e==null?void 0:e.edges)!=null&&a.length))return $({isValid:!0});let t=Zt(e.nodes)[0];if(!t)return $({isValid:!0});let o=_n(t.id,e.edges);if(!o.length)return $({isValid:!0});let r=Nt(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Ze(r,l=>!$c(l.id,e));return $({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Nt(e.nodes),o=Zt(e.nodes)[0];if(!o)return $({isValid:!0});let n=t.filter(l=>{let c=_n(l.id,e.edges),d=Se(l.id,e.edges),p=c.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.source))==null?void 0:y.type)==="START_EVENT"}),u=d.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.target))==null?void 0:y.type)==="END_EVENT"});return p&&u}),r=_n(o.id,e.edges),i=r.length>1,s=r.map(l=>l.source),a={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?s:[]]};return $(a)}},{id:"gateway_flow_to_event",validate:e=>{let t=Fr(e.nodes),o=[],n=[];for(let r of t){let i=Se(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="END_EVENT"&&(o.push(r.id,a.id),n.push(s.id))}}return $({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Fr(e.nodes),o=Ze(t,n=>Se(n.id,e.edges).length>=1);return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...bn(e.nodes),...Zt(e.nodes)],o=[],n=[];for(let r of t){let i=Se(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return $({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Wc(e.nodes),o=Ze(t,n=>!Xc(n.id,e));return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Yc(e.nodes),o=Ze(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 $({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Zc=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Tn){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 jc=()=>{let{t:e}=(0,Qc.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,Jc.useReactFlow)(),[i,s]=(0,Jt.useState)(null),[a,l]=(0,Jt.useState)(!1),c=(0,Jt.useCallback)(u=>{let f=qc(u.nodes,u.edges),y=Zc(f),g=y.errors.map(m=>v(b({},m),{message:e(`validation.errors.${m.id}`)}));return a||l(!0),{isValid:y.isValid,errors:g}},[a,e]),d=(0,Jt.useCallback)(u=>{if(s(u),!u)return;let f=[],y=[];u.errors.forEach(x=>{x.nodeIds&&x.nodeIds.length>0&&x.nodeIds.forEach(I=>f.push(I)),x.edgeIds&&x.edgeIds.length>0&&x.edgeIds.forEach(I=>y.push(I))});let g=[...new Set(f)];t(x=>x.map(I=>v(b({},I),{data:v(b({},I.data),{hasError:!1})}))),o(x=>x.map(I=>v(b({},I),{data:v(b({},I.data),{hasError:!1})})));let m=n(),_=r(),h=new Set(g),E=new Set;u.errors.forEach(x=>{var k,A;let I=Tn.find(S=>S.id===x.id);(I==null?void 0:I.highlightRelatedEdges)!==!1&&((k=x.edgeIds)==null||k.forEach(S=>E.add(S)),(A=x.nodeIds)==null||A.forEach(S=>{_.forEach(P=>{(P.source===S||P.target===S)&&E.add(P.id)})}))});let T=new Set,N=new Set,w=new Set;m.forEach(x=>{x.type==="START_EVENT"?T.add(x.id):x.type==="END_EVENT"&&N.add(x.id)}),_.forEach(x=>{T.has(x.source)&&w.add(x.target),N.has(x.target)&&w.add(x.source)}),w.forEach(x=>{var I,R;if(h.has(x)){let k=(I=u.errors.find(S=>{var P;return(P=S.nodeIds)==null?void 0:P.includes(x)}))==null?void 0:I.id;((R=Tn.find(S=>S.id===k))==null?void 0:R.highlightRelatedEdges)!==!1&&_.forEach(S=>{S.source===x&&N.has(S.target)&&(h.add(S.target),E.add(S.id)),S.target===x&&T.has(S.source)&&(h.add(S.source),E.add(S.id))})}}),h.size>0&&t(x=>x.map(I=>v(b({},I),{data:v(b({},I.data),{hasError:h.has(I.id)})}))),E.size>0&&o(x=>x.map(I=>v(b({},I),{data:v(b({},I.data),{hasError:E.has(I.id)})})))},[r,n,o,t]),p=(0,Jt.useCallback)(()=>{s(null),l(!1),t(u=>u.map(f=>v(b({},f),{data:v(b({},f.data),{hasError:!1})}))),o(u=>u.map(f=>v(b({},f),{data:v(b({},f.data),{hasError:!1})})))},[o,t]);return{validationResult:i,validateDiagram:c,handleValidationComplete:d,clearValidation:p,isAutoValidationEnabled:a}};var od=require("@xyflow/react"),nd=require("lecom-ui"),rd=require("react");var Im=15,ed="bpmn:selection",Cm=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},td=e=>{if(!Cm(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},id=({offset:e=Im}={})=>{let{t}=(0,nd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,od.useReactFlow)(),{getNextId:s}=Ve();(0,rd.useEffect)(()=>{let a=c=>{var m,_;if(!td(c))return;let d=o(),p=r(),u=d.filter(h=>h.selected);if(!u.length)return;c.preventDefault(),c.stopPropagation();let f=p.filter(h=>u.some(E=>E.id===h.source)&&u.some(E=>E.id===h.target)),g=JSON.stringify({nodes:u,edges:f});(m=c.clipboardData)==null||m.setData(ed,g),(_=c.clipboardData)==null||_.setData("text/plain",`BPMN Selection: ${u.length} nodes`)},l=c=>{var N,w;if(!td(c))return;let d=(N=c.clipboardData)==null?void 0:N.getData(ed);if(!d)return;c.preventDefault(),c.stopPropagation();let p;try{p=JSON.parse(d)}catch(x){return}if(!((w=p.nodes)!=null&&w.length))return;let u=new Map,f=o(),y=[],g=f.some(x=>x.type==="START_EVENT"),m=p.nodes.filter(x=>x.type==="START_EVENT"),_=p.nodes;if(g&&m.length>0&&(_=p.nodes.filter(x=>x.type!=="START_EVENT"),_.length===0))return;let h=s(),E=_.map(x=>{var k;let I=String(h++);u.set(x.id,I);let R=v(b({},x),{id:I,selected:!0,position:{x:x.position.x+e,y:x.position.y+e}});if(x.type==="TASK"){let A=(k=x.data)==null?void 0:k.label,S=So(A||t("bpmn.task.label.prefix"),[...f,...y]);R.data=v(b({},x.data),{label:S})}return y.push(R),R}),T=p.edges.map(x=>v(b({},x),{id:String(h++),selected:!0,source:u.get(x.source)||x.source,target:u.get(x.target)||x.target}));n(x=>[...x.map(I=>v(b({},I),{selected:!1})),...E]),i(x=>[...x.map(I=>v(b({},I),{selected:!1})),...T])};return document.addEventListener("copy",a,!0),document.addEventListener("paste",l,!0),()=>{document.removeEventListener("copy",a,!0),document.removeEventListener("paste",l,!0)}},[o,n,r,i,s,e,t])};var Wr=require("@xyflow/react");var sd=require("lecom-ui"),ad=require("react");var ld=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,Wr.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=Io(),{t:s}=(0,sd.useTranslation)(),{getInternalNode:a,screenToFlowPosition:l}=(0,Wr.useReactFlow)(),{getNextId:c}=Ve(),{setIsDragging:d}=V(),{rebuildIndex:p,forceRebuildIndex:u}=yo(),[f,y]=(0,ad.useState)(null),g=(A,S=!1)=>{let P=S?"[&>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(C=>C.map(M=>v(b({},M),{className:M.id===A?P:""})))},m=()=>{let{nodeLookup:A}=n.getState();return Array.from(A.values())},_=A=>{let S=a(A.id),P=m();if(A.type==="LANE"){if(wo({parentId:A.id,nodes:e,includeTypes:["LANE"]})){g();return}let W=P.filter(J=>J.id!==A.id&&J.type==="LANE"&&!J.parentId),B=fn(S,W);if(!B){g();return}if(wo({parentId:B.id,nodes:e,excludeTypes:["LANE"]})){g(B.id,!0);return}g(B.id);return}let M=P.filter(H=>H.id!==A.id&&H.type==="LANE"),L=fn(S,M);if(!L){g();return}if(wo({parentId:L.id,nodes:e,includeTypes:["LANE"]})){g();return}g(L.id)},h=A=>A.map(S=>v(b({},S),{className:void 0})),E=A=>A.some(P=>P.dragging)?A.map(P=>P.dragging?v(b({},P),{dragging:!1}):P):A,T=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},N=(A,S)=>{A.preventDefault(),_(S)},w=(A,S,P)=>{var H,W;let C=[...P];if(A.parentId===S.id)return C=$l(A,S,C),C=mn(C),h(C);if(A.type==="LANE"){if(wo({parentId:S.id,nodes:C,excludeTypes:["LANE"]})){let X=Ae(S),ut=50,je=50;return C.map(We=>{var zo,to;return We.id===A.id?v(b({},We),{position:{x:(zo=f==null?void 0:f.x)!=null?zo:X.x+ut,y:(to=f==null?void 0:f.y)!=null?to:X.y2+je}}):We})}let J=C.filter(X=>X.parentId===S.id).reduce((X,ut)=>{var je,We;return X+((We=(je=ut.measured)==null?void 0:je.height)!=null?We:0)},0),ne={x:j.HEADER_WIDTH,y:J};return C=C.map(X=>X.id===A.id?v(b({},X),{parentId:S.id,position:ne,className:void 0}):v(b({},X),{className:void 0})),C=Ft(S.id,C),C}if(wo({parentId:S.id,nodes:C,includeTypes:["LANE"]})){let B;if(A.parentId){let F=a(A.parentId),{x:J,y:ne}=it(F);B={x:J+((H=A.position.x)!=null?H:0),y:ne+((W=A.position.y)!=null?W:0)}}return C=C.map(F=>F.id===A.id?v(b({},F),{position:B!=null?B:F.position,parentId:void 0,className:void 0}):v(b({},F),{className:void 0})),C}let z=zl(A,S);return C=C.map(B=>{if(B.id===A.id){let F=Ae(A),J=Ae(S);return F.y<J.y&&(z.y=0),F.x<J.x+j.HEADER_WIDTH&&(z.x=j.HEADER_WIDTH),v(b({},B),{parentId:S.id,position:z,className:void 0})}return v(b({},B),{className:void 0})}),C=mn(C),C},x=A=>{if(A.preventDefault(),!(r!=null&&r.type))return;let S=l({x:A.clientX,y:A.clientY}),P={width:G[r.type].MIN_WIDTH,height:G[r.type].MIN_HEIGHT},C=c(),M={id:String(C),type:r.type,position:S,measured:P,data:{label:r.type==="TASK"?Br(e,s("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},L=v(b({},M),{internals:{positionAbsolute:S}}),z=m(),H=r.type==="LANE",W=z.filter(ne=>H?ne.type==="LANE"&&!ne.parentId:ne.type==="LANE"),B=fn(L,W),F=[...e.map(ne=>v(b({},ne),{selected:!1})),M];B&&(F=w(L,B,F)),F=st(F),t(F),u();let J=A.dataTransfer.getData("sourceId");if(J){let ne={id:String(C+1),source:J,target:M.id};if(r.type==="ANNOTATION"){o(X=>X.concat(b(b({},ne),_o)));return}o(X=>X.concat(b(b({},ne),Be)))}d(!1),i(null)},I=async(A,S,P)=>{let C=[...e];P.forEach(M=>{let L=m(),z=a(M.id),H=M.type==="LANE",W=L.filter(F=>F.id!==M.id&&(H?F.type==="LANE"&&!F.parentId:F.type==="LANE")),B=fn(z,W);if(B){C=w(z,B,C);return}M.parentId&&(C=k(M,C))}),C=E(C),C=st(C),C=h(C),t(C),p(C),y(null)},R=(A,S)=>{y({x:S.position.x,y:S.position.y})},k=(A,S)=>{var z,H;let P=a(A.parentId),{x:C,y:M}=it(P),L={x:C+((z=A.position.x)!=null?z:0),y:M+((H=A.position.y)!=null?H:0)};return S=S.map(W=>W.id===A.id?v(b({},W),{position:L,parentId:void 0}):W),S=Ft(A.parentId,S),S};return{onDragOver:T,onDrop:x,onNodeDrag:N,onNodeDragStart:R,onNodeDragStop:I}};var cd=require("@xyflow/react"),dd=require("lecom-ui"),ud=require("react");var Sm=30,Mm=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},Pm=e=>!Mm(e.target),pd=({offset:e=Sm}={})=>{let{t}=(0,dd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,cd.useReactFlow)(),{getNextId:s}=Ve();(0,ud.useEffect)(()=>{let a=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&Pm(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),p=c.filter(N=>N.selected);if(!p.length)return;let u=new Map,f=[],y=c.some(N=>N.type==="START_EVENT"),g=p.filter(N=>N.type==="START_EVENT"),m=p;if(y&&g.length>0&&(m=p.filter(N=>N.type!=="START_EVENT"),m.length===0))return;let _=d.filter(N=>m.some(w=>w.id===N.source)&&m.some(w=>w.id===N.target)),h=s(),E=m.map(N=>{var I;let w=String(h++);u.set(N.id,w);let x=v(b({},N),{id:w,selected:!0,position:{x:N.position.x+e,y:N.position.y+e}});if(N.type==="TASK"){let R=(I=N.data)==null?void 0:I.label,k=So(R||t("bpmn.task.label.prefix"),[...c,...f]);x.data=v(b({},N.data),{label:k})}return f.push(x),x}),T=_.map(N=>v(b({},N),{id:String(h++),selected:!0,source:u.get(N.source)||N.source,target:u.get(N.target)||N.target}));n(N=>[...N.map(w=>v(b({},w),{selected:!1})),...E]),i(N=>[...N.map(w=>v(b({},w),{selected:!1})),...T])}};return document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("keydown",a,!0)}},[o,n,r,i,s,e,t])};var yd=require("@xyflow/react");var md={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},gd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},fd=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],s="",a="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",a=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",a=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),s||(s="task",a=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:a}),{step:e,type:s,label:a,edgeLabel:l}},Lm=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
|
|
37
|
-
`),i=encodeURI(r);
|
|
35
|
+
</mxGraphModel>`,$i=(e,t)=>{if(!e.length&&!t.length)return Lm;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var He=()=>{let{getEdges:e,getNodes:t}=(0,Kc.useReactFlow)();return{getLastId:()=>$i(t(),e()),getNextId:()=>{let n=t(),r=e();return $i(n,r)+1}}};var Wo=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,qc.useReactFlow)(),{getLastId:i}=He(),a=(0,Xi.useCallback)(async(l="")=>{let{nodes:c,edges:d}=await sc(l);o(c),n(d),r({padding:Bo,minZoom:zo,maxZoom:Fo})},[o,n,r]),s=(0,Xi.useCallback)((l,c)=>{let d=l||e()||[],u=c||t()||[],p=i();return ic(d,u,p)},[e,t,i]);return{importFromMxGraph:a,exportToMxGraph:s}};var Ki=require("react"),km=500,Yo=()=>{let{isInitialized:e,onElementChanges:t}=G(),{exportToMxGraph:o}=Wo(),n=(0,Zc.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},km),r=(0,Ki.useCallback)(a=>{a.every(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Ki.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var Jc=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,Qr.useReactFlow)(),{emitElementChanges:r}=Yo(),i=(0,ot.useRef)(null),{getNextId:a}=He(),s=(0,ot.useCallback)(y=>{var b;let g=t(y.source),m=t(y.target);if(!g||!m)return!1;let h={sourceNodeId:g.id,targetNodeId:m.id,sourceNodeType:g.type,targetNodeType:m.type,nodes:n(),edges:o(),reconnectingEdgeId:(b=i.current)!=null?b:void 0};return Di(h).isValid},[t,o,n]),l=(0,ot.useCallback)(y=>{let g=a(),m=t(y.target),h=(m==null?void 0:m.type)==="ANNOTATION"?Mo:Ue,x=v(E(E({},y),h),{id:String(g)});e(b=>b.concat(x)),r()},[t,a,e,r]),c=(0,ot.useCallback)((y,g)=>{i.current=g.id},[]),d=(0,ot.useCallback)(()=>{i.current=null},[]),u=(0,ot.useCallback)((y,g)=>{let m=t(g.source),h=t(g.target);if(!m||!h){i.current=null;return}let x={sourceNodeId:m.id,targetNodeId:h.id,sourceNodeType:m.type,targetNodeType:h.type,nodes:n(),edges:o(),reconnectingEdgeId:y.id};if(!Di(x).isValid){i.current=null;return}e(T=>(0,Qr.reconnectEdge)(y,g,T).map(N=>N.id===y.id?v(E({},N),{data:v(E({},N.data),{points:void 0})}):N)),i.current=null,r()},[t,n,o,e,r]),p=(0,ot.useCallback)(y=>{i.current=y},[]),f=(0,ot.useCallback)(()=>{i.current=null},[]);return{isValidConnection:s,onConnect:l,onReconnect:u,onReconnectStart:c,onReconnectEnd:d,setReconnectingEdge:p,clearReconnectingEdge:f}};var sd=require("@xyflow/react"),ad=require("lecom-ui"),Ge=require("react");var Mn=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ro=(e=[])=>e.filter(t=>t.type==="END_EVENT"),St=(e=[])=>e.filter(t=>t.type==="TASK")||[],Qc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),jc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),jr=(e=[])=>e.filter(t=>t.type==="GATEWAY"),ed=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),Le=(e,t=[])=>t.filter(o=>o.source===e),Pn=(e,t=[])=>t.filter(o=>o.target===e),td=(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"},od=(e,t)=>{let o=Le(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},nd=e=>e?/\w/g.test(e.trim()):!1,J=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:[]}},nt=(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)}},rd=(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 Ln=[{id:"start_event_not_found",validate:e=>{let t=Mn(e.nodes);return J({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ro(e.nodes);return J({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Mn(e.nodes),o=t.length===1;if(t.length===0)return J({isValid:!0});if(!o)return J({isValid:!1,nodeIds:t.map(i=>i.id)});let n=Le(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return J({isValid:!1,nodeIds:[...new Set(i)]})}return J({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=St(e.nodes),o=nt(t,n=>Le(n.id,e.edges).length<=2);return J({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=St(e.nodes),o=nt(t,n=>!!n.label&&n.label.trim()!=="");return J({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=St(e.nodes),n=nt(o,r=>!r.label||r.label.length<=60);return J({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=St(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 J({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=jr(e.nodes),o=[],n=[];for(let r of t){let i=Le(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 J({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Mn(e.nodes),...ro(e.nodes)],o=[],n=[];for(let r of t){let i=Le(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 J({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ro(e.nodes),o=[],n=[];for(let r of t){let i=Pn(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=Le(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return J({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=ed(e.nodes),o=nt(t,r=>Le(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>Le(r,e.edges).map(i=>i.id));return J({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=St(e.nodes),o=nt(t,n=>!n.label||nd(n.label));return J({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 J({isValid:!0});let t=ro(e.nodes)[0];if(!t)return J({isValid:!0});let o=Pn(t.id,e.edges);if(!o.length)return J({isValid:!0});let r=St(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=nt(r,l=>!td(l.id,e));return J({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=St(e.nodes),o=ro(e.nodes)[0];if(!o)return J({isValid:!0});let n=t.filter(l=>{let c=Pn(l.id,e.edges),d=Le(l.id,e.edges),u=c.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.source))==null?void 0:y.type)==="START_EVENT"}),p=d.some(f=>{var y;return((y=e.nodes.find(g=>g.id===f.target))==null?void 0:y.type)==="END_EVENT"});return u&&p}),r=Pn(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 J(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=jr(e.nodes),o=[],n=[];for(let r of t){let i=Le(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 J({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=jr(e.nodes),o=nt(t,n=>Le(n.id,e.edges).length>=1);return J({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Mn(e.nodes),...ro(e.nodes)],o=[],n=[];for(let r of t){let i=Le(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 J({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Qc(e.nodes),o=nt(t,n=>!od(n.id,e));return J({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=jc(e.nodes),o=nt(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 J({isValid:o.isValid,nodeIds:o.invalidIds})}}];var id=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Ln){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 ld=()=>{let{t:e}=(0,ad.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,sd.useReactFlow)(),[i,a]=(0,Ge.useState)(null),[s,l]=(0,Ge.useState)(!1),c=(0,Ge.useRef)(!1),d=(0,Ge.useRef)(!1),u=(0,Ge.useCallback)(m=>{let h=rd(m.nodes,m.edges),x=id(h),b=x.errors.map(T=>v(E({},T),{message:e(`validation.errors.${T.id}`)}));return s||l(!0),{isValid:x.isValid,errors:b}},[s,e]),p=(0,Ge.useCallback)((m,h=!0)=>{if(h&&a(m),!m)return;c.current=!0,d.current=!0;let x=[],b=[];m.errors.forEach(I=>{I.nodeIds&&I.nodeIds.length>0&&I.nodeIds.forEach(M=>x.push(M)),I.edgeIds&&I.edgeIds.length>0&&I.edgeIds.forEach(M=>b.push(M))});let T=[...new Set(x)];t(I=>I.map(M=>v(E({},M),{data:v(E({},M.data),{hasError:!1})}))),o(I=>I.map(M=>v(E({},M),{data:v(E({},M.data),{hasError:!1})})));let _=n(),N=r(),w=new Set(T),S=new Set;m.errors.forEach(I=>{var k,V;let M=Ln.find(O=>O.id===I.id);(M==null?void 0:M.highlightRelatedEdges)!==!1&&((k=I.edgeIds)==null||k.forEach(O=>S.add(O)),(V=I.nodeIds)==null||V.forEach(O=>{N.forEach(B=>{(B.source===O||B.target===O)&&S.add(B.id)})}))});let P=new Set,L=new Set,C=new Set;_.forEach(I=>{I.type==="START_EVENT"?P.add(I.id):I.type==="END_EVENT"&&L.add(I.id)}),N.forEach(I=>{P.has(I.source)&&C.add(I.target),L.has(I.target)&&C.add(I.source)}),C.forEach(I=>{var M,A;if(w.has(I)){let k=(M=m.errors.find(O=>{var B;return(B=O.nodeIds)==null?void 0:B.includes(I)}))==null?void 0:M.id;((A=Ln.find(O=>O.id===k))==null?void 0:A.highlightRelatedEdges)!==!1&&N.forEach(O=>{O.source===I&&L.has(O.target)&&(w.add(O.target),S.add(O.id)),O.target===I&&P.has(O.source)&&(w.add(O.source),S.add(O.id))})}}),w.size>0&&t(I=>I.map(M=>v(E({},M),{data:v(E({},M.data),{hasError:w.has(M.id)})}))),S.size>0&&o(I=>I.map(M=>v(E({},M),{data:v(E({},M.data),{hasError:S.has(M.id)})}))),setTimeout(()=>{c.current=!1},0)},[r,n,o,t]),f=(0,Ge.useCallback)(()=>{a(null),l(!1),d.current=!1,t(m=>m.map(h=>v(E({},h),{data:v(E({},h.data),{hasError:!1})}))),o(m=>m.map(h=>v(E({},h),{data:v(E({},h.data),{hasError:!1})})))},[o,t]),y=(0,Ge.useCallback)(()=>{d.current&&(a(null),c.current=!0,d.current=!1,t(m=>m.map(h=>v(E({},h),{data:v(E({},h.data),{hasError:!1})}))),o(m=>m.map(h=>v(E({},h),{data:v(E({},h.data),{hasError:!1})}))),setTimeout(()=>{c.current=!1},0))},[o,t]),g=(0,Ge.useCallback)(()=>c.current,[]);return{validationResult:i,validateDiagram:u,handleValidationComplete:p,clearValidation:f,dismissValidationPanel:y,isAutoValidationEnabled:s,getIsClearingValidation:g}};var ud=require("@xyflow/react"),pd=require("lecom-ui"),fd=require("react");var Dm=15,cd="bpmn:selection",Rm=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},dd=e=>{if(!Rm(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=Dm}={})=>{let{t}=(0,pd.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,ud.useReactFlow)(),{getNextId:a}=He();(0,fd.useEffect)(()=>{let s=c=>{var m,h;if(!dd(c))return;let d=o(),u=r(),p=d.filter(x=>x.selected);if(!p.length)return;c.preventDefault(),c.stopPropagation();let f=u.filter(x=>p.some(b=>b.id===x.source)&&p.some(b=>b.id===x.target)),g=JSON.stringify({nodes:p,edges:f});(m=c.clipboardData)==null||m.setData(cd,g),(h=c.clipboardData)==null||h.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},l=c=>{var _,N;if(!dd(c))return;let d=(_=c.clipboardData)==null?void 0:_.getData(cd);if(!d)return;c.preventDefault(),c.stopPropagation();let u;try{u=JSON.parse(d)}catch(w){return}if(!((N=u.nodes)!=null&&N.length))return;let p=new Map,f=o(),y=[],g=f.some(w=>w.type==="START_EVENT"),m=u.nodes.filter(w=>w.type==="START_EVENT"),h=u.nodes;if(g&&m.length>0&&(h=u.nodes.filter(w=>w.type!=="START_EVENT"),h.length===0))return;let x=a(),b=h.map(w=>{var L;let S=String(x++);p.set(w.id,S);let P=v(E({},w),{id:S,selected:!0,position:{x:w.position.x+e,y:w.position.y+e}});if(w.type==="TASK"){let C=(L=w.data)==null?void 0:L.label,I=Go(C||t("bpmn.task.label.prefix"),[...f,...y]);P.data=v(E({},w.data),{label:I})}return y.push(P),P}),T=u.edges.map(w=>v(E({},w),{id:String(x++),selected:!0,source:p.get(w.source)||w.source,target:p.get(w.target)||w.target}));n(w=>[...w.map(S=>v(E({},S),{selected:!1})),...b]),i(w=>[...w.map(S=>v(E({},S),{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 ei=require("@xyflow/react");var gd=require("lecom-ui"),hd=require("react");var yd=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,ei.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=Oo(),{t:a}=(0,gd.useTranslation)(),{getInternalNode:s,screenToFlowPosition:l}=(0,ei.useReactFlow)(),{getNextId:c}=He(),{setIsDragging:d}=G(),{rebuildIndex:u,forceRebuildIndex:p}=wo(),[f,y]=(0,hd.useState)(null),g=(C,I=!1)=>{let M=I?"[&>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(A=>A.map(k=>v(E({},k),{className:k.id===C?M:""})))},m=()=>{let{nodeLookup:C}=n.getState();return Array.from(C.values())},h=C=>{let I=s(C.id),M=m();if(C.type==="LANE"){if(Do({parentId:C.id,nodes:e,includeTypes:["LANE"]})){g();return}let Z=M.filter(F=>F.id!==C.id&&F.type==="LANE"&&!F.parentId),D=vn(I,Z);if(!D){g();return}if(Do({parentId:D.id,nodes:e,excludeTypes:["LANE"]})){g(D.id,!0);return}g(D.id);return}let k=M.filter(B=>B.id!==C.id&&B.type==="LANE"),V=vn(I,k);if(!V){g();return}if(Do({parentId:V.id,nodes:e,includeTypes:["LANE"]})){g();return}g(V.id)},x=C=>C.map(I=>v(E({},I),{className:void 0})),b=C=>C.some(M=>M.dragging)?C.map(M=>M.dragging?v(E({},M),{dragging:!1}):M):C,T=C=>{C.preventDefault(),C.dataTransfer.dropEffect="move"},_=(C,I)=>{C.preventDefault(),h(I)},N=(C,I,M)=>{var B,Z;let A=[...M];if(C.parentId===I.id)return A=oc(C,I,A),A=Nn(A),x(A);if(C.type==="LANE"){if(Do({parentId:I.id,nodes:A,excludeTypes:["LANE"]})){let Y=Se(I),de=50,ie=50;return A.map(xe=>{var Rt,ze;return xe.id===C.id?v(E({},xe),{position:{x:(Rt=f==null?void 0:f.x)!=null?Rt:Y.x+de,y:(ze=f==null?void 0:f.y)!=null?ze:Y.y2+ie}}):xe})}let F=A.filter(Y=>Y.parentId===I.id).reduce((Y,de)=>{var ie,xe;return Y+((xe=(ie=de.measured)==null?void 0:ie.height)!=null?xe:0)},0),W={x:te.HEADER_WIDTH,y:F};return A=A.map(Y=>Y.id===C.id?v(E({},Y),{parentId:I.id,position:W,className:void 0}):v(E({},Y),{className:void 0})),A=Zt(I.id,A),A}if(Do({parentId:I.id,nodes:A,includeTypes:["LANE"]})){let D;if(C.parentId){let H=s(C.parentId),{x:F,y:W}=ut(H);D={x:F+((B=C.position.x)!=null?B:0),y:W+((Z=C.position.y)!=null?Z:0)}}return A=A.map(H=>H.id===C.id?v(E({},H),{position:D!=null?D:H.position,parentId:void 0,className:void 0}):v(E({},H),{className:void 0})),A}let O=Jl(C,I);return A=A.map(D=>{if(D.id===C.id){let H=Se(C),F=Se(I);return H.y<F.y&&(O.y=0),H.x<F.x+te.HEADER_WIDTH&&(O.x=te.HEADER_WIDTH),v(E({},D),{parentId:I.id,position:O,className:void 0})}return v(E({},D),{className:void 0})}),A=Nn(A),A},w=C=>{if(C.preventDefault(),!(r!=null&&r.type))return;let I=l({x:C.clientX,y:C.clientY}),M={width:U[r.type].MIN_WIDTH,height:U[r.type].MIN_HEIGHT},A=c(),k={id:String(A),type:r.type,position:I,measured:M,data:{label:r.type==="TASK"?Zr(e,a("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},V=v(E({},k),{internals:{positionAbsolute:I}}),O=m(),B=r.type==="LANE",Z=O.filter(W=>B?W.type==="LANE"&&!W.parentId:W.type==="LANE"),D=vn(V,Z),H=[...e.map(W=>v(E({},W),{selected:!1})),k];D&&(H=N(V,D,H)),H=pt(H),t(H),p();let F=C.dataTransfer.getData("sourceId");if(F){let W={id:String(A+1),source:F,target:k.id};if(r.type==="ANNOTATION"){o(Y=>Y.concat(E(E({},W),Mo)));return}o(Y=>Y.concat(E(E({},W),Ue)))}d(!1),i(null)},S=async(C,I,M)=>{let A=[...e];M.forEach(k=>{let V=m(),O=s(k.id),B=k.type==="LANE",Z=V.filter(H=>H.id!==k.id&&(B?H.type==="LANE"&&!H.parentId:H.type==="LANE")),D=vn(O,Z);if(D){A=N(O,D,A);return}k.parentId&&(A=L(k,A))}),A=b(A),A=pt(A),A=x(A),t(A),u(A),y(null)},P=(C,I)=>{y({x:I.position.x,y:I.position.y})},L=(C,I)=>{var O,B;let M=s(C.parentId),{x:A,y:k}=ut(M),V={x:A+((O=C.position.x)!=null?O:0),y:k+((B=C.position.y)!=null?B:0)};return I=I.map(Z=>Z.id===C.id?v(E({},Z),{position:V,parentId:void 0}):Z),I=Zt(C.parentId,I),I};return{onDragOver:T,onDrop:w,onNodeDrag:_,onNodeDragStart:P,onNodeDragStop:S}};var xd=require("@xyflow/react"),Ed=require("lecom-ui"),bd=require("react");var Vm=30,Om=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},Hm=e=>!Om(e.target),_d=({offset:e=Vm}={})=>{let{t}=(0,Ed.useTranslation)(),{getNodes:o,setNodes:n,getEdges:r,setEdges:i}=(0,xd.useReactFlow)(),{getNextId:a}=He();(0,bd.useEffect)(()=>{let s=l=>{if(l.ctrlKey&&l.key.toLowerCase()==="d"&&Hm(l)){l.preventDefault(),l.stopPropagation();let c=o(),d=r(),u=c.filter(_=>_.selected);if(!u.length)return;let p=new Map,f=[],y=c.some(_=>_.type==="START_EVENT"),g=u.filter(_=>_.type==="START_EVENT"),m=u;if(y&&g.length>0&&(m=u.filter(_=>_.type!=="START_EVENT"),m.length===0))return;let h=d.filter(_=>m.some(N=>N.id===_.source)&&m.some(N=>N.id===_.target)),x=a(),b=m.map(_=>{var S;let N=String(x++);p.set(_.id,N);let w=v(E({},_),{id:N,selected:!0,position:{x:_.position.x+e,y:_.position.y+e}});if(_.type==="TASK"){let P=(S=_.data)==null?void 0:S.label,L=Go(P||t("bpmn.task.label.prefix"),[...c,...f]);w.data=v(E({},_.data),{label:L})}return f.push(w),w}),T=h.map(_=>v(E({},_),{id:String(x++),selected:!0,source:p.get(_.source)||_.source,target:p.get(_.target)||_.target}));n(_=>[..._.map(N=>v(E({},N),{selected:!1})),...b]),i(_=>[..._.map(N=>v(E({},N),{selected:!1})),...T])}};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[o,n,r,i,a,e,t])};var Id=require("@xyflow/react");var vd={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Nd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Td=(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}},Gm=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=Td(i[0],o),s=Td(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},wd=e=>{let{components:t,connections:o}=Gm(e);return{nodes:t,edges:o}};var Ad=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Id.useReactFlow)(),{getNextId:n}=He();return{importFromLia:i=>{let a=typeof i=="string"?i:i.diagramXml||"",{nodes:s,edges:l}=wd(a),c=[],d=new Map,u=!1,p=n();for(let[m,h]of Object.entries(s)){let x=String(p++),b=vd[h.type],T=Nd[h.type];b==="START_EVENT"&&(u=!0),d.set(m,x);let _=U[b].MIN_WIDTH,N=U[b].MIN_HEIGHT;c.push({id:x,type:b,data:{label:h.label||"",variant:T,attribute:""},position:{x:0,y:0},width:_,height:N,measured:{width:_,height:N}})}let f=[];for(let m of l){let h=v(E({},Ue),{id:String(p++),source:d.get(m.sourceId)||m.sourceId,target:d.get(m.targetId)||m.targetId});f.push(h)}if(!u&&c.length>0){let m=String(p++),h={id:m,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:U.START_EVENT.MIN_WIDTH,height:U.START_EVENT.MIN_HEIGHT,measured:{width:U.START_EVENT.MIN_WIDTH,height:U.START_EVENT.MIN_HEIGHT}};c.unshift(h);let x=c[1];if(x){let b=v(E({},Ue),{id:String(p++),source:m,target:x.id});f.unshift(b)}}let{nodes:y,edges:g}=tc(c,f);e(y),t(g),o({padding:Bo,minZoom:zo,maxZoom:Fo})}}};var ti=require("react"),Bm={origin:"*",debug:!1};function Cd(e,t=Bm){let{origin:o,debug:n}=t,r=(0,ti.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,ti.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||!(s!=null&&s.data))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 Sd=require("@xyflow/react"),qi=require("react");var Md=()=>{let e=(0,Sd.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=G(),{importFromMxGraph:n}=Wo();(0,qi.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,qi.useEffect)(()=>{if(!e)return;(async()=>{await Wn(),o(!0)})()},[e,o])};var Zi=require("react"),Pd=require("@xyflow/react");function Ld(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Ht(),{getEdges:n}=(0,Pd.useReactFlow)(),r=Kn(),i=(0,Zi.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,Zi.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var Rd=require("@xyflow/react"),Be=require("react"),Vd=require("use-debounce");var kd=[{nodes:[],edges:[]}],zm=500,Dd=100,Od=(e=kd)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Rd.useReactFlow)(),[i,a]=(0,Be.useState)(e),[s,l]=(0,Be.useState)(0),c=i[s],d=s>0,u=s<i.length-1,p=(0,Be.useCallback)(T=>{n(i[T].nodes),r(i[T].edges)},[i,n,r]),f=(0,Be.useCallback)(()=>{if(s>0){let T=s-1;l(T),p(T)}},[s,p]),y=(0,Be.useCallback)(()=>{if(s<i.length-1){let T=s+1;l(T),p(T)}},[i,s,p]),g=T=>{let N=[...i.slice(0,s+1),T],w=N.length>Dd?N.slice(N.length-Dd):N;a(w),l(w.length-1)},m=(0,Vd.useDebouncedCallback)(()=>{let T=t(),_=o(),N=T.map(P=>v(E({},P),{selected:!1,className:""})),w={nodes:pt(N),edges:_};JSON.stringify(c)!==JSON.stringify(w)&&g(w)},zm),h=(0,Be.useCallback)(T=>{if(T==="forceSave"){m();return}T.some(w=>w.type==="select")||T.some(w=>w.type==="position"&&w.dragging)||m()},[m]),x=(0,Be.useCallback)(T=>{a(T||kd),l(0)},[]),b=(0,Be.useCallback)(()=>{a([]),l(0)},[]);return(0,Be.useEffect)(()=>{let T=_=>{(_.ctrlKey||_.metaKey)&&(_.shiftKey&&_.key.toLowerCase()==="z"?(_.preventDefault(),y()):_.key.toLowerCase()==="z"&&(_.preventDefault(),f()))};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[f,y]),{history:i,undo:f,redo:y,canUndo:d,canRedo:u,saveHistory:h,resetHistory:x,clearHistory:b}};var Hd=()=>{let[e,t,o]=(0,Uo.useNodesState)([]),[n,r,i]=(0,Uo.useEdgesState)([]),[a,s]=(0,yt.useState)(null),{instanceId:l,setIsConnecting:c,setIsMultipleSelection:d}=G(),{updateHelperLines:u,HelperLines:p}=wo(),{undo:f,redo:y,canUndo:g,canRedo:m,saveHistory:h}=Od(),{onNodeDrag:x,onDrop:b,onDragOver:T,onNodeDragStop:_,onNodeDragStart:N}=yd({nodes:e,setNodes:t,setEdges:r}),{isValidConnection:w,onConnect:S,onReconnect:P,onReconnectStart:L,onReconnectEnd:C,setReconnectingEdge:I,clearReconnectingEdge:M}=Jc({setEdges:r}),{validationResult:A,handleValidationComplete:k,clearValidation:V,dismissValidationPanel:O,validateDiagram:B,getIsClearingValidation:Z}=ld(),{importFromLia:D}=Ad(),{handleTasksStatus:H,handleClearTaskStatus:F}=Ld(),{clearPathEdges:W}=Ht(),Y=Kn(),{emitElementChanges:de,handleNodeChanges:ie,handleEdgeChanges:xe}=Yo();md(),_d(),Md();let Rt=(0,yt.useCallback)(()=>{t([]),r([]),W(),setTimeout(()=>{Y()},0)},[t,r,W,Y]);Cd({LIA_CREATE_DIAGRAM:D,CLEAR_DIAGRAM:Rt,TASKS_STATUS:H,CLEAR_TASKS_STATUS:F});let{selectElements:ze,clearSelection:Jo}=wt(),{importFromMxGraph:st,exportToMxGraph:co}=Wo(),{configureElement:ui,getConfigureElement:ns}=kr();(0,yt.useEffect)(()=>(et.set(l,{importFromMxGraph:st,exportToMxGraph:co,selectElements:ze,clearSelection:Jo,configureElement:ui,getConfigureElement:ns,setReconnectingEdge:I,clearReconnectingEdge:M}),()=>{et.delete(l)}),[l,st,co,ze,Jo,ui,ns,I,M]);let vu=(0,yt.useCallback)(Fe=>{let Qo=u(Fe,e);o(Qo),h(Fe),Z()||O(),ie(Fe)},[e,o,h,Z,O,u,ie]),Nu=(0,yt.useCallback)(Fe=>{i(Fe),h(Fe),Z()||O(),xe(Fe)},[i,h,Z,O,xe]);(0,Uo.useOnSelectionChange)({onChange:({nodes:Fe,edges:Qo})=>{d(Fe.length+Qo.length>1)}});let wu=(0,yt.useCallback)(async({nodes:Fe,edges:Qo})=>(s({nodes:Fe,edges:Qo}),!1),[s]);return{nodes:e,setNodes:t,edges:n,setEdges:r,events:{isValidConnection:w,onConnect:S,onReconnect:P,onReconnectStart:L,onReconnectEnd:C,onDrop:b,onDragOver:T,onNodeDrag:x,onNodeDragStop:_,onNodeDragStart:N,onDropCapture:()=>{h("forceSave"),de(),O()},onConnectStart:()=>{c(!0)},onConnectEnd:()=>{c(!1),O()},onBeforeDelete:wu,onNodesChange:vu,onEdgesChange:Nu},ui:{pendingDelete:a,setPendingDelete:s,validationResult:A,handleCloseValidationPanel:V},controls:{undo:f,redo:y,canUndo:g,canRedo:m},components:{HelperLines:p},actions:{saveHistory:h,selectElements:ze,clearSelection:Jo,exportToMxGraph:co,validateDiagram:B,handleValidationComplete:k,setReconnectingEdge:I,clearReconnectingEdge:M}}};var Ji=require("react/jsx-runtime"),Qi=({id:e,className:t})=>(0,Ji.jsx)("marker",{id:e,className:R("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Ji.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var $o=require("react/jsx-runtime"),Gd=()=>(0,$o.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,$o.jsxs)("defs",{children:[(0,$o.jsx)(Qi,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,$o.jsx)(Qi,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Rn=require("@xyflow/react"),ne=require("lecom-ui"),Pt=require("lucide-react"),lo=require("react");var rt=require("lecom-ui");var kn=(x=>(x.START_EVENT="START_EVENT",x.END_EVENT="END_EVENT",x.TASK="TASK",x.SUBPROCESS="SUBPROCESS",x.GATEWAY="GATEWAY",x.LANE="LANE",x.ANNOTATION="ANNOTATION",x.CONNECTION="CONNECTION",x.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",x.ACTIVITY="ACTIVITY",x.PROCESS_INTERFACE="PROCESS_INTERFACE",x.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",x.VARIANT_ACTIVITY="VARIANT_ACTIVITY",x.AUTO_ACTIVITY="AUTO_ACTIVITY",x.DATA_STORE="DATA_STORE",x.DATA_OBJECT="DATA_OBJECT",x.DATA_OUTPUT="DATA_OUTPUT",x.DATA_INPUT="DATA_INPUT",x))(kn||{});var qd=require("@xyflow/react"),Xo=require("lecom-ui");var Bd=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 zd({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);oi(i,`${o}.csv`)}var oi=(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 Fd(e){return e==null?void 0:e.replaceAll("
"," ")}var gI={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Wd={script:"SCRIPT",subprocess:"SUBPROCESS"},Yd={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var io=({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}}},Wm=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=U.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=U.START_EVENT.MIN_HEIGHT,{node:io({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Ym=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=U.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=U.END_EVENT.MIN_HEIGHT,{node:io({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Um=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Wd[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Et(e.mxGeometry._attributes.width||0,U.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Et(e.mxGeometry._attributes.height||0,U.TASK.MIN_HEIGHT),{node:io({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},$m=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=Yd[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=U.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=U.GATEWAY.MIN_HEIGHT,{node:io({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Xm=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:io({cell:e,type:"LANE"}),status:"imported",originalType:t}},Km=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Et(e.mxGeometry._attributes.width||0,U.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Et(e.mxGeometry._attributes.height||0,U.ANNOTATION.MIN_HEIGHT),{node:io({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Ud=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=U.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=U.UNSUPPORTED.MIN_HEIGHT,{node:io({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},$d=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(E({},Ue),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},Xd={TASK:Um,GATEWAY:$m,START_EVENT:Wm,END_EVENT:Ym,LANE:Xm,ANNOTATION:Km};var qm=e=>{let t=new Map,o=Object.values(kn),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=Xd[s]||Ud,{node:c,status:d,originalType:u}=l(a);i.push(c),r.push({originalType:u,type:c.type,variant:c.data.variant,value:Fd(c.data.label),status:d})}return{nodes:i,governanceIdToNodeIdMap:t,summary:r}},Zm=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>$d(r,t)),Jm=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=qm(t.root.mxCell),i=Zm(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Qm=async e=>{let t=await Bd(e),o=zr(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}},Kd=async e=>{try{let t=await Qm(e),{nodes:o,edges:n,summary:r}=Jm(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Jd=require("react/jsx-runtime"),Zd=()=>{let{t:e}=(0,Xo.useTranslation)(),{toast:t}=(0,Xo.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,qd.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,Jd.jsx)(Xo.Button,{size:"small",variant:"ghost",onClick:()=>zd({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 Kd(s);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r({padding:Bo,minZoom:zo,maxZoom:Fo}),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 Qd=require("lecom-ui"),jd=require("react");var so=require("react/jsx-runtime"),eu=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=Ke(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,jd.useRef)(null),d=p=>{let f=p.target.files;f!=null&&f.length&&i(f),c.current&&(c.current.value="")};return(0,so.jsxs)(so.Fragment,{children:[(0,so.jsx)(Qd.Button,v(E({onClick:p=>{var f;(f=c.current)==null||f.click(),r==null||r(p)}},a),{children:e})),(0,so.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var ao=require("react/jsx-runtime"),tu=({disabled:e=!1})=>{let{t}=(0,rt.useTranslation)(),{toast:o}=(0,rt.useNotificationToast)(),{importFromGovernance:n}=Zd(),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,ao.jsxs)(rt.Tooltip,{children:[(0,ao.jsx)(rt.TooltipTrigger,{asChild:!0,children:(0,ao.jsx)(eu,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,ao.jsx)(fs,{})})}),(0,ao.jsx)(rt.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var ou=require("react/jsx-runtime"),ji=({shortcut:e})=>(0,ou.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 q=require("lecom-ui"),Mt=require("lucide-react"),su=require("react");var nu=require("@xyflow/react"),Dn=require("html-to-image"),ni=require("lecom-ui"),ru=require("react");var jm=3,es="diagram",iu=()=>{let{t:e}=(0,ni.useTranslation)(),{getNodes:t}=(0,nu.useReactFlow)(),{clearSelection:o}=wt(),[n,r]=(0,ru.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:d,y:u,width:p,height:f}=rc(t());return{width:p,height:f,style:{width:`${p}px`,height:`${f}px`,transform:`translate(${-d}px, ${-u}px)`}}},a=async(d,u)=>{r(v(E({},n),{[u]:!0})),await o();try{let p=nc();if(!p)throw new Error("Flow element not found");let f=i();return await d(p,f)}catch(p){(0,ni.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(v(E({},n),{[u]:!1}))}};return{exportAsPng:async(d=es)=>{await a(async(u,p)=>{let f=await(0,Dn.toPng)(u,v(E({},p),{backgroundColor:"#fcfcfc"}));oi(f,`${d}.png`)},"png")},exportAsHtml:async(d=es)=>{await a(async(u,p)=>{let f=await(0,Dn.toSvg)(u,v(E({},p),{backgroundColor:"#fcfcfc"})),y=`
|
|
38
38
|
<!DOCTYPE html>
|
|
39
39
|
<html>
|
|
40
40
|
<head>
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<img src="${f}" alt="Diagram" />
|
|
49
49
|
</body>
|
|
50
50
|
</html>
|
|
51
|
-
`,g=new Blob([y],{type:"text/html"}),m=URL.createObjectURL(g);
|
|
51
|
+
`,g=new Blob([y],{type:"text/html"}),m=URL.createObjectURL(g);oi(m,`${d}.html`),setTimeout(()=>URL.revokeObjectURL(m),100)},"html")},printDiagram:async(d=es)=>{await a(async(u,p)=>{let f=await(0,Dn.toPng)(u,v(E({},p),{pixelRatio:jm})),y=window.open("","_blank");if(!y)throw new Error("Failed to open print window.");let g=y.document;g.open(),g.write(`
|
|
52
52
|
<!DOCTYPE html>
|
|
53
53
|
<html>
|
|
54
54
|
<head>
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
<img src="${f}" 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 K=require("react/jsx-runtime");function jd(){let{t:e}=(0,U.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:s}=Jd(),[a,l]=(0,Qd.useState)(!1);return(0,K.jsxs)(U.DropdownMenu,{modal:!1,open:a,onOpenChange:l,children:[(0,K.jsx)(U.DropdownMenuTrigger,{asChild:!0,children:(0,K.jsx)("div",{children:(0,K.jsxs)(U.Tooltip,{children:[(0,K.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,K.jsx)(wt.FolderOutputIcon,{})})}),!a&&(0,K.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,K.jsxs)(U.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,K.jsxs)(U.Tooltip,{children:[(0,K.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,K.jsx)(wt.FileImageIcon,{})})}),(0,K.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,K.jsxs)(U.Tooltip,{children:[(0,K.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,K.jsx)(wt.FileCodeIcon,{})})}),(0,K.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,K.jsxs)(U.Tooltip,{children:[(0,K.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,K.jsx)(wt.PrinterIcon,{})})}),(0,K.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var q=require("react/jsx-runtime"),eu=({nodes:e})=>{let{t}=(0,ae.useTranslation)(),{clearSelection:o}=Et(),{mode:n,isMinimapOpen:r,setIsMinimapOpen:i,isMoveTool:s,isHandTool:a,setIsMoveTool:l,setIsHandTool:c}=V(),d=(0,Yi.useKeyPress)(["v","V"]),p=(0,Yi.useKeyPress)(["h","H"]),u=(0,Vo.useCallback)(()=>{o(),c(!0),l(!1)},[o,c,l]),f=(0,Vo.useCallback)(()=>{l(!0),c(!1)},[l,c]);return(0,Vo.useEffect)(()=>{d&&!s&&n==="edit"&&f()},[d,f,s,n]),(0,Vo.useEffect)(()=>{p&&!a&&n==="edit"&&u()},[p,u,a,n]),(0,q.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[n==="edit"&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(ae.Tooltip,{children:[(0,q.jsx)(ae.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(ae.Button,{size:"small",variant:"ghost",color:"grey",className:D(s&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,q.jsx)(Oo.MousePointerIcon,{})})}),(0,q.jsxs)(ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.move_tool"),(0,q.jsx)(Fi,{shortcut:"V"})]})]}),(0,q.jsxs)(ae.Tooltip,{children:[(0,q.jsx)(ae.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(ae.Button,{size:"small",variant:"ghost",color:"grey",className:D(a&&"bg-grey-400"),iconButton:!0,onClick:u,children:(0,q.jsx)(Oo.HandIcon,{})})}),(0,q.jsxs)(ae.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.hand_tool")," ",(0,q.jsx)(Fi,{shortcut:"H"})]})]})]}),(0,q.jsx)(jd,{}),n==="edit"&&(0,q.jsx)(Xd,{disabled:e.length>0}),(0,q.jsxs)(ae.Tooltip,{children:[(0,q.jsx)(ae.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(ae.Button,{size:"small",variant:"ghost",color:"grey",className:D(r&&"bg-grey-400"),iconButton:!0,onClick:()=>i(!r),children:(0,q.jsx)(Oo.MapIcon,{})})}),(0,q.jsx)(ae.TooltipContent,{color:"black",children:t(r?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Ne=require("lecom-ui"),Xr=require("lucide-react"),Pe=require("react/jsx-runtime"),tu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Ne.useTranslation)();return(0,Pe.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Pe.jsxs)(Ne.Tooltip,{children:[(0,Pe.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Pe.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,Pe.jsx)(Xr.UndoIcon,{})})}),(0,Pe.jsx)(Ne.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,Pe.jsxs)(Ne.Tooltip,{children:[(0,Pe.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Pe.jsx)(Ne.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,Pe.jsx)(Xr.RedoIcon,{})})}),(0,Pe.jsx)(Ne.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var ou=require("@xyflow/react"),te=require("lecom-ui"),Ho=require("lucide-react");var Q=require("react/jsx-runtime"),nu=()=>{let{t:e}=(0,te.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,ou.useReactFlow)();return(0,Q.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Q.jsxs)(te.Tooltip,{children:[(0,Q.jsx)(te.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(te.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,Q.jsx)(Ho.ScanIcon,{})})}),(0,Q.jsx)(te.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Q.jsxs)(te.Tooltip,{children:[(0,Q.jsx)(te.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(te.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,Q.jsx)(Ho.ZoomOut,{})})}),(0,Q.jsx)(te.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Q.jsxs)(te.Tooltip,{children:[(0,Q.jsx)(te.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(te.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,Q.jsx)(cs,{})})}),(0,Q.jsx)(te.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Q.jsxs)(te.Tooltip,{children:[(0,Q.jsx)(te.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(te.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,Q.jsx)(Ho.ZoomIn,{})})}),(0,Q.jsx)(te.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var oe=require("lecom-ui");var xe=require("react/jsx-runtime"),ru=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:s}=(0,oe.useTranslation)(),{forceRebuildIndex:a}=yo(),{emitElementChanges:l}=Lo(),c=!!e,d=()=>{let{nodes:y}=e||{};if(y!=null&&y.length){let g=o.filter(m=>!y.some(_=>_.id===m.id));y.forEach(m=>{(m==null?void 0:m.type)==="LANE"&&(m!=null&&m.parentId)&&(g=Ft(m.parentId,g))}),n(st(g))}},p=()=>{let{edges:y}=e||{};y!=null&&y.length&&r(g=>g.filter(m=>!y.some(_=>_.id===m.id)))},u=()=>{d(),p(),i("forceSave"),a(),l(),t(null)},f=()=>{t(null)};return(0,xe.jsx)(oe.Dialog,{open:c,onOpenChange:f,children:(0,xe.jsxs)(oe.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,xe.jsx)(oe.DialogHeader,{children:(0,xe.jsx)(oe.DialogTitle,{children:(0,xe.jsx)(oe.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:s("editor.modals.delete_elements.title")})})}),(0,xe.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,xe.jsx)("div",{className:"py-2",children:(0,xe.jsx)(oe.Notification,{type:"callout",variant:"warning",content:s("editor.modals.delete_elements.callout")})}),(0,xe.jsx)(oe.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:s("editor.modals.delete_elements.content")})]}),(0,xe.jsxs)(oe.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,xe.jsx)(oe.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:f,children:(0,xe.jsx)(oe.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:s("editor.modals.delete_elements.cancel")})}),(0,xe.jsx)(oe.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:u,children:s("editor.modals.delete_elements.confirm")})]})]})})};var iu=require("@xyflow/react"),Qe=require("lecom-ui"),Kr=require("react");var Fe=require("react/jsx-runtime"),su=()=>{let e=(0,Kr.useRef)(null),{t}=(0,Qe.useTranslation)(),{setDraggableNode:o}=Io(),{getNodes:n}=(0,iu.useReactFlow)(),{setIsDragging:r}=V(),[i,s]=(0,Kr.useState)(void 0),a=n(),l=gr(a),c=[{type:"START_EVENT",icon:Rn,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:oo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:$o,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ps,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:us,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ds,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:io,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:ao,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:no,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:ls,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ln,label:t("bpmn.annotation.variant.default")}],d=(p,u)=>{o({type:u.type,variant:u.variant,attribute:u.attribute,icon:u.icon}),s((0,Fe.jsx)(u.icon,{})),p.dataTransfer.effectAllowed="move",e.current&&p.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Fe.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Fe.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:c.map((p,u)=>{let f=l&&p.type==="START_EVENT",y=f?t("editor.toolbar.start_event_already_exists"):p.label;return(0,Fe.jsxs)(Qe.Tooltip,{children:[(0,Fe.jsx)(Qe.TooltipTrigger,{asChild:!0,children:(0,Fe.jsx)(Qe.Button,{className:D("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":f}),size:"small",variant:"ghost",color:"grey",draggable:!f,disabled:f,iconButton:!0,onDragStart:f?void 0:g=>d(g,p),children:(0,Fe.jsx)(p.icon,{})},u)}),(0,Fe.jsx)(Qe.TooltipContent,{color:"black",side:"right",children:y})]},u)})}),(0,Fe.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var qr=require("lecom-ui"),Go=require("lucide-react"),Zr=require("react"),fe=require("react/jsx-runtime"),au=({validationResult:e,onClose:t})=>{let{t:o}=(0,qr.useTranslation)(),[n,r]=(0,Zr.useState)(!1);if((0,Zr.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:s}=e;return(0,fe.jsxs)("div",{className:D("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,fe.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,fe.jsx)("div",{className:"flex-shrink-0",children:i?(0,fe.jsx)(Go.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,fe.jsx)(Go.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,fe.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,fe.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,fe.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,fe.jsx)(qr.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,fe.jsx)(Go.XIcon,{})})]}),(0,fe.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,fe.jsx)("p",{children:o("validation.success.message")}):(0,fe.jsx)("div",{className:"list-disc list-inside",children:s.map(a=>(0,fe.jsx)("li",{className:"mb-1",children:a.message},a.id))})})]})};var me=require("react/jsx-runtime"),Ui=(0,Jr.forwardRef)((e,t)=>{let{instanceId:o,mode:n,isMinimapOpen:r,isMoveTool:i,isHandTool:s}=V(),{nodes:a,setNodes:l,edges:c,setEdges:d,ui:p,actions:u,events:f,components:y,controls:g}=Md();(0,Jr.useImperativeHandle)(t,()=>({selectElements:u.selectElements,clearSelection:u.clearSelection}));let m={nodes:a,edges:c};return(0,me.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,me.jsx)(su,{}),(0,me.jsx)(Pd,{}),(0,me.jsxs)(At.ReactFlow,v(b({},f),{id:`modeler-${o}`,edges:c,nodes:a,nodeTypes:Ac,edgeTypes:Ic,minZoom:Dc,maxZoom:kc,panOnDrag:s||n!=="edit"?!0:Vc,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:Nc,selectionMode:At.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Rc,connectOnClick:!1,proOptions:{hideAttribution:!0},children:[(0,me.jsx)(At.Background,{gap:Pc,size:Mc,color:Sc,bgColor:Cc}),r&&(0,me.jsx)(At.MiniMap,{pannable:!0,zoomable:!0,position:Lc,className:"shadow-md rounded-md"}),(0,me.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,me.jsx)(tu,b({},g)),(0,me.jsx)(eu,{nodes:a,diagram:m,onValidateDiagram:u.validateDiagram,onValidationComplete:u.handleValidationComplete}),(0,me.jsx)(nu,{})]}),(0,me.jsx)(y.HelperLines,{}),p.validationResult&&(0,me.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,me.jsx)(au,{validationResult:p.validationResult,onClose:p.handleCloseValidationPanel})})]})),(0,me.jsx)(ru,{pendingDelete:p.pendingDelete,setPendingDelete:p.setPendingDelete,nodes:a,setNodes:l,setEdges:d,saveHistory:u.saveHistory})]})});Ui.displayName="Editor";var lu=require("@xyflow/react"),Qr=require("react"),cu=require("react/jsx-runtime"),Km=e=>({width:e.width,height:e.height,transform:e.transform}),$i="rgba(51, 103, 217, 0.4)",ul=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,lu.useStore)(Km),i=(0,Qr.useRef)(null);return(0,Qr.useEffect)(()=>{let s=i.current,a=s==null?void 0:s.getContext("2d");if(!a||!s)return;let l=window.devicePixelRatio;s.width=o*l,s.height=n*l,a.clearRect(0,0,o,n),a.scale(l,l),a.strokeStyle=$i,t&&(a.beginPath(),a.strokeStyle=t.color||$i,a.moveTo(t.position*r[2]+r[0],0),a.lineTo(t.position*r[2]+r[0],n),a.stroke()),e&&(a.beginPath(),a.strokeStyle=e.color||$i,a.moveTo(0,e.position*r[2]+r[1]),a.lineTo(o,e.position*r[2]+r[1]),a.stroke())},[o,n,r,e,t]),(0,cu.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var Bo=require("lecom-ui"),It=require("react");var wn=require("react/jsx-runtime"),Do=new Map,du=(0,It.createContext)(null),jr=()=>{let e=(0,It.useContext)(du);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},uu=({locale:e,defaultMode:t="view",showNotification:o=!0,children:n})=>{let[r,i]=(0,It.useState)(e||"pt_BR");(0,It.useEffect)(()=>{e&&(i(e),Bo.i18n.changeLanguage(e))},[e]);let s=f=>{let y=Do.size;if(y===0)throw new Error("No modeler instances found");if(y===1||!f){let[m]=Do.values();return m}let g=Do.get(f);if(!g)throw new Error(`Modeler instance with ID "${f}" not found`);return g},a=(f,y)=>{let g=s(y);return g==null?void 0:g.selectElements(f)},l=async f=>{let y=s(f);return y==null?void 0:y.clearSelection()},c=(f,y)=>{let g=s(y);return g==null?void 0:g.configureElement(f)},d=(f,y)=>{let g=s(y);return g==null?void 0:g.getConfigureElement(f)},p=async(f,y)=>{let g=s(y);await(g==null?void 0:g.importFromMxGraph(f))},u=f=>{let y=s(f);return y==null?void 0:y.exportToMxGraph()};return(0,wn.jsx)(du.Provider,{value:{defaultMode:t,locale:r,selectElements:a,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:p,exportDiagram:u},children:(0,wn.jsxs)(Bo.TooltipProvider,{children:[o&&(0,wn.jsx)(Bo.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var ei=require("react/jsx-runtime"),fu=(0,re.createContext)(null),V=()=>{let e=(0,re.useContext)(fu);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},mu=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:s})=>{let{defaultMode:a}=jr(),l=(0,re.useId)(),[c]=(0,re.useState)(o||l),[d,p]=(0,re.useState)(n||a||"edit"),[u,f]=(0,re.useState)(!1),[y,g]=(0,re.useState)(!0),[m,_]=(0,re.useState)(!1),[h,E]=(0,re.useState)(!1),[T,N]=(0,re.useState)(!1),[w,x]=(0,re.useState)(!1),[I,R]=(0,re.useState)(!1);(0,re.useEffect)(()=>{n&&p(n)},[n]);let k=(0,re.useMemo)(()=>t||Oc(),[t]),A={instanceId:c,initialDiagram:k,mode:d,isInitialized:u,setIsInitialized:f,isMinimapOpen:h,isMoveTool:y,isHandTool:m,isDragging:T,isMultipleSelection:I,isConnecting:w,setIsMinimapOpen:E,setIsMoveTool:g,setIsHandTool:_,setIsDragging:N,setIsConnecting:x,setIsMultipleSelection:R,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:s};return(0,ei.jsx)(pu.ReactFlowProvider,{children:(0,ei.jsx)(fu.Provider,{value:A,children:(0,ei.jsx)(Ui,{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 Q=require("react/jsx-runtime");function au(){let{t:e}=(0,q.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=iu(),[s,l]=(0,su.useState)(!1);return(0,Q.jsxs)(q.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,Q.jsx)(q.DropdownMenuTrigger,{asChild:!0,children:(0,Q.jsx)("div",{children:(0,Q.jsxs)(q.Tooltip,{children:[(0,Q.jsx)(q.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(q.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,Q.jsx)(Mt.FolderOutputIcon,{})})}),!s&&(0,Q.jsx)(q.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,Q.jsxs)(q.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,Q.jsxs)(q.Tooltip,{children:[(0,Q.jsx)(q.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(q.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,Q.jsx)(Mt.FileImageIcon,{})})}),(0,Q.jsx)(q.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,Q.jsxs)(q.Tooltip,{children:[(0,Q.jsx)(q.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(q.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,Q.jsx)(Mt.FileCodeIcon,{})})}),(0,Q.jsx)(q.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,Q.jsxs)(q.Tooltip,{children:[(0,Q.jsx)(q.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(q.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,Q.jsx)(Mt.PrinterIcon,{})})}),(0,Q.jsx)(q.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var $=require("react/jsx-runtime"),lu=({nodes:e,validateDiagram:t,handleValidationComplete:o})=>{let{t:n}=(0,ne.useTranslation)(),{clearSelection:r}=wt(),{mode:i,isMinimapOpen:a,setIsMinimapOpen:s,isMoveTool:l,isHandTool:c,setIsMoveTool:d,setIsHandTool:u}=G(),{getNodes:p,getEdges:f}=(0,Rn.useReactFlow)(),y=(0,Rn.useKeyPress)(["v","V"]),g=(0,Rn.useKeyPress)(["h","H"]),m=(0,lo.useCallback)(()=>{r(),u(!0),d(!1)},[r,u,d]),h=(0,lo.useCallback)(()=>{d(!0),u(!1)},[d,u]),x=(0,lo.useCallback)(()=>{let b=p(),T=f(),_=t({nodes:b,edges:T});o(_)},[p,f,t,o]);return(0,lo.useEffect)(()=>{y&&!l&&i==="edit"&&h()},[y,h,l,i]),(0,lo.useEffect)(()=>{g&&!c&&i==="edit"&&m()},[g,m,c,i]),(0,$.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[i==="edit"&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ne.Tooltip,{children:[(0,$.jsx)(ne.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(ne.Button,{size:"small",variant:"ghost",color:"grey",className:R(l&&"bg-grey-400"),iconButton:!0,onClick:h,children:(0,$.jsx)(Pt.MousePointerIcon,{})})}),(0,$.jsxs)(ne.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.move_tool"),(0,$.jsx)(ji,{shortcut:"V"})]})]}),(0,$.jsxs)(ne.Tooltip,{children:[(0,$.jsx)(ne.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(ne.Button,{size:"small",variant:"ghost",color:"grey",className:R(c&&"bg-grey-400"),iconButton:!0,onClick:m,children:(0,$.jsx)(Pt.HandIcon,{})})}),(0,$.jsxs)(ne.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[n("editor.controls.actions.hand_tool")," ",(0,$.jsx)(ji,{shortcut:"H"})]})]})]}),(0,$.jsx)(au,{}),i==="edit"&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ne.Tooltip,{children:[(0,$.jsx)(ne.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(ne.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:x,children:(0,$.jsx)(Pt.ListCheckIcon,{})})}),(0,$.jsx)(ne.TooltipContent,{color:"black",children:n("editor.controls.actions.check")})]}),(0,$.jsx)(tu,{disabled:e.length>0})]}),(0,$.jsxs)(ne.Tooltip,{children:[(0,$.jsx)(ne.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(ne.Button,{size:"small",variant:"ghost",color:"grey",className:R(a&&"bg-grey-400"),iconButton:!0,onClick:()=>s(!a),children:(0,$.jsx)(Pt.MapIcon,{})})}),(0,$.jsx)(ne.TooltipContent,{color:"black",children:n(a?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Ae=require("lecom-ui"),ri=require("lucide-react"),ke=require("react/jsx-runtime"),cu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Ae.useTranslation)();return(0,ke.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ke.jsxs)(Ae.Tooltip,{children:[(0,ke.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ke.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ke.jsx)(ri.UndoIcon,{})})}),(0,ke.jsx)(Ae.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,ke.jsxs)(Ae.Tooltip,{children:[(0,ke.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,ke.jsx)(Ae.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,ke.jsx)(ri.RedoIcon,{})})}),(0,ke.jsx)(Ae.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var du=require("@xyflow/react"),re=require("lecom-ui"),Ko=require("lucide-react");var ee=require("react/jsx-runtime"),uu=()=>{let{t:e}=(0,re.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,du.useReactFlow)();return(0,ee.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ee.jsxs)(re.Tooltip,{children:[(0,ee.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,ee.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,ee.jsx)(Ko.ScanIcon,{})})}),(0,ee.jsx)(re.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,ee.jsxs)(re.Tooltip,{children:[(0,ee.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,ee.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,ee.jsx)(Ko.ZoomOut,{})})}),(0,ee.jsx)(re.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,ee.jsxs)(re.Tooltip,{children:[(0,ee.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,ee.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,ee.jsx)(ys,{})})}),(0,ee.jsx)(re.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,ee.jsxs)(re.Tooltip,{children:[(0,ee.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,ee.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,ee.jsx)(Ko.ZoomIn,{})})}),(0,ee.jsx)(re.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var se=require("lecom-ui");var Te=require("react/jsx-runtime"),pu=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:a}=(0,se.useTranslation)(),{forceRebuildIndex:s}=wo(),{emitElementChanges:l}=Yo(),c=!!e,d=()=>{let{nodes:y}=e||{};if(y!=null&&y.length){let g=o.filter(m=>!y.some(h=>h.id===m.id));y.forEach(m=>{(m==null?void 0:m.type)==="LANE"&&(m!=null&&m.parentId)&&(g=Zt(m.parentId,g))}),n(pt(g))}},u=()=>{let{edges:y}=e||{};y!=null&&y.length&&r(g=>g.filter(m=>!y.some(h=>h.id===m.id)))},p=()=>{d(),u(),i("forceSave"),s(),l(),t(null)},f=()=>{t(null)};return(0,Te.jsx)(se.Dialog,{open:c,onOpenChange:f,children:(0,Te.jsxs)(se.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,Te.jsx)(se.DialogHeader,{children:(0,Te.jsx)(se.DialogTitle,{children:(0,Te.jsx)(se.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:a("editor.modals.delete_elements.title")})})}),(0,Te.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,Te.jsx)("div",{className:"py-2",children:(0,Te.jsx)(se.Notification,{type:"callout",variant:"warning",content:a("editor.modals.delete_elements.callout")})}),(0,Te.jsx)(se.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:a("editor.modals.delete_elements.content")})]}),(0,Te.jsxs)(se.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,Te.jsx)(se.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:f,children:(0,Te.jsx)(se.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:a("editor.modals.delete_elements.cancel")})}),(0,Te.jsx)(se.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:p,children:a("editor.modals.delete_elements.confirm")})]})]})})};var fu=require("@xyflow/react"),it=require("lecom-ui"),ii=require("react");var Xe=require("react/jsx-runtime"),mu=()=>{let e=(0,ii.useRef)(null),{t}=(0,it.useTranslation)(),{setDraggableNode:o}=Oo(),{getNodes:n}=(0,fu.useReactFlow)(),{setIsDragging:r}=G(),[i,a]=(0,ii.useState)(void 0),s=n(),l=wr(s),c=[{type:"START_EVENT",icon:Un,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:uo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:on,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:bs,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Es,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:xs,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:mo,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:ho,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:po,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:hs,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Fn,label:t("bpmn.annotation.variant.default")}],d=(u,p)=>{o({type:p.type,variant:p.variant,attribute:p.attribute,icon:p.icon}),a((0,Xe.jsx)(p.icon,{})),u.dataTransfer.effectAllowed="move",e.current&&u.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Xe.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Xe.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:c.map((u,p)=>{let f=l&&u.type==="START_EVENT",y=f?t("editor.toolbar.start_event_already_exists"):u.label;return(0,Xe.jsxs)(it.Tooltip,{children:[(0,Xe.jsx)(it.TooltipTrigger,{asChild:!0,children:(0,Xe.jsx)(it.Button,{className:R("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":f}),size:"small",variant:"ghost",color:"grey",draggable:!f,disabled:f,iconButton:!0,onDragStart:f?void 0:g=>d(g,u),children:(0,Xe.jsx)(u.icon,{})},p)}),(0,Xe.jsx)(it.TooltipContent,{color:"black",side:"right",children:y})]},p)})}),(0,Xe.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var si=require("lecom-ui"),qo=require("lucide-react"),Lt=require("react"),he=require("react/jsx-runtime"),eg=5e3,gu=({validationResult:e,onClose:t})=>{let{t:o}=(0,si.useTranslation)(),[n,r]=(0,Lt.useState)(!1),[i,a]=(0,Lt.useState)(!1),s=(0,Lt.useRef)(null);(0,Lt.useEffect)(()=>{e&&r(!0)},[e]),(0,Lt.useEffect)(()=>(n&&!i&&(s.current=setTimeout(()=>{r(!1),t()},eg)),()=>{s.current&&(clearTimeout(s.current),s.current=null)}),[n,i,t]);let l=()=>{a(!0),s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{a(!1)};if(!n||!e)return null;let{isValid:d,errors:u}=e;return(0,he.jsxs)("div",{className:R("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":d,"bg-red-100":!d}),onMouseEnter:l,onMouseLeave:c,children:[(0,he.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,he.jsx)("div",{className:"flex-shrink-0",children:d?(0,he.jsx)(qo.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,he.jsx)(qo.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,he.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,he.jsx)("div",{children:o(d?"validation.success.title":"validation.errors.title")}),!d&&(0,he.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,he.jsx)(si.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,he.jsx)(qo.XIcon,{})})]}),(0,he.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:d?(0,he.jsx)("p",{children:o("validation.success.message")}):(0,he.jsx)("div",{className:"list-disc list-inside",children:u.map(p=>(0,he.jsx)("li",{className:"mb-1",children:p.message},p.id))})})]})};var ye=require("react/jsx-runtime"),ts=(0,ai.forwardRef)((e,t)=>{let{instanceId:o,mode:n,isMinimapOpen:r,isMoveTool:i,isHandTool:a}=G(),{nodes:s,setNodes:l,edges:c,setEdges:d,ui:u,actions:p,events:f,components:y,controls:g}=Hd();return(0,ai.useImperativeHandle)(t,()=>({selectElements:p.selectElements,clearSelection:p.clearSelection})),(0,ye.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,ye.jsx)(mu,{}),(0,ye.jsx)(Gd,{}),(0,ye.jsxs)(kt.ReactFlow,v(E({},f),{id:`modeler-${o}`,edges:c,nodes:s,nodeTypes:Vc,edgeTypes:Oc,minZoom:Wc,maxZoom:Yc,panOnDrag:a||n!=="edit"?!0:$c,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:kc,selectionMode:kt.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Uc,connectOnClick:!1,proOptions:{hideAttribution:!0},children:[(0,ye.jsx)(kt.Background,{gap:zc,size:Bc,color:Gc,bgColor:Hc}),r&&(0,ye.jsx)(kt.MiniMap,{pannable:!0,zoomable:!0,position:Fc,className:"shadow-md rounded-md"}),(0,ye.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,ye.jsx)(cu,E({},g)),(0,ye.jsx)(lu,{nodes:s,validateDiagram:p.validateDiagram,handleValidationComplete:p.handleValidationComplete}),(0,ye.jsx)(uu,{})]}),(0,ye.jsx)(y.HelperLines,{}),u.validationResult&&(0,ye.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,ye.jsx)(gu,{validationResult:u.validationResult,onClose:u.handleCloseValidationPanel})})]})),(0,ye.jsx)(pu,{pendingDelete:u.pendingDelete,setPendingDelete:u.setPendingDelete,nodes:s,setNodes:l,setEdges:d,saveHistory:p.saveHistory})]})});ts.displayName="Editor";var hu=require("@xyflow/react"),li=require("react"),yu=require("react/jsx-runtime"),tg=e=>({width:e.width,height:e.height,transform:e.transform}),os="rgba(51, 103, 217, 0.4)",El=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,hu.useStore)(tg),i=(0,li.useRef)(null);return(0,li.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=os,t&&(s.beginPath(),s.strokeStyle=t.color||os,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||os,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,yu.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var Zo=require("lecom-ui"),Dt=require("react");var Vn=require("react/jsx-runtime"),et=new Map,xu=(0,Dt.createContext)(null),ci=()=>{let e=(0,Dt.useContext)(xu);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Eu=({locale:e,defaultMode:t="view",showNotification:o=!0,children:n})=>{let[r,i]=(0,Dt.useState)(e||"pt_BR");(0,Dt.useEffect)(()=>{e&&(i(e),Zo.i18n.changeLanguage(e))},[e]);let a=f=>{let y=et.size;if(y===0)throw new Error("No modeler instances found");if(y===1||!f){let[m]=et.values();return m}let g=et.get(f);if(!g)throw new Error(`Modeler instance with ID "${f}" not found`);return g},s=(f,y)=>{let g=a(y);return g==null?void 0:g.selectElements(f)},l=async f=>{let y=a(f);return y==null?void 0:y.clearSelection()},c=(f,y)=>{let g=a(y);return g==null?void 0:g.configureElement(f)},d=(f,y)=>{let g=a(y);return g==null?void 0:g.getConfigureElement(f)},u=async(f,y)=>{let g=a(y);await(g==null?void 0:g.importFromMxGraph(f))},p=f=>{let y=a(f);return y==null?void 0:y.exportToMxGraph()};return(0,Vn.jsx)(xu.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:p},children:(0,Vn.jsxs)(Zo.TooltipProvider,{children:[o&&(0,Vn.jsx)(Zo.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var di=require("react/jsx-runtime"),_u=(0,ae.createContext)(null),G=()=>{let e=(0,ae.useContext)(_u);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},Tu=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:a})=>{let{defaultMode:s}=ci(),l=(0,ae.useId)(),[c]=(0,ae.useState)(o||l),[d,u]=(0,ae.useState)(n||s||"edit"),[p,f]=(0,ae.useState)(!1),[y,g]=(0,ae.useState)(!0),[m,h]=(0,ae.useState)(!1),[x,b]=(0,ae.useState)(!1),[T,_]=(0,ae.useState)(!1),[N,w]=(0,ae.useState)(!1),[S,P]=(0,ae.useState)(!1);(0,ae.useEffect)(()=>{n&&u(n)},[n]);let L=(0,ae.useMemo)(()=>t||Xc(),[t]),C={instanceId:c,initialDiagram:L,mode:d,isInitialized:p,setIsInitialized:f,isMinimapOpen:x,isMoveTool:y,isHandTool:m,isDragging:T,isMultipleSelection:S,isConnecting:N,setIsMinimapOpen:b,setIsMoveTool:g,setIsHandTool:h,setIsDragging:_,setIsConnecting:w,setIsMultipleSelection:P,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:a};return(0,di.jsx)(bu.ReactFlowProvider,{children:(0,di.jsx)(_u.Provider,{value:C,children:(0,di.jsx)(ts,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
|