lecom-modeler 0.8.0 → 0.8.1
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 -9
- package/lib/index.d.cts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +7 -9
- package/lib/style.min.css +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var fu=Object.create;var Go=Object.defineProperty,mu=Object.defineProperties,gu=Object.getOwnPropertyDescriptor,hu=Object.getOwnPropertyDescriptors,yu=Object.getOwnPropertyNames,vn=Object.getOwnPropertySymbols,xu=Object.getPrototypeOf,Jr=Object.prototype.hasOwnProperty,Xi=Object.prototype.propertyIsEnumerable;var $i=(e,t,o)=>t in e?Go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))Jr.call(t,o)&&$i(e,o,t[o]);if(vn)for(var o of vn(t))Xi.call(t,o)&&$i(e,o,t[o]);return e},v=(e,t)=>mu(e,hu(t));var Be=(e,t)=>{var o={};for(var n in e)Jr.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&vn)for(var n of vn(e))t.indexOf(n)<0&&Xi.call(e,n)&&(o[n]=e[n]);return o};var Eu=(e,t)=>{for(var o in t)Go(e,o,{get:t[o],enumerable:!0})},Ki=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of yu(t))!Jr.call(e,r)&&r!==o&&Go(e,r,{get:()=>t[r],enumerable:!(n=gu(t,r))||n.enumerable});return e};var _u=(e,t,o)=>(o=e!=null?fu(xu(e)):{},Ki(t||!e||!e.__esModule?Go(o,"default",{value:e,enumerable:!0}):o,e)),bu=e=>Ki(Go({},"__esModule",{value:!0}),e);var zm={};Eu(zm,{EditorMode:()=>Ce,ElementPosition:()=>wn,ElementType:()=>Bo,GatewayElementVariant:()=>An,GatewayVariant:()=>Me,Modeler:()=>lu,ModelerProvider:()=>iu,NodeAttribute:()=>qe,NodeType:()=>D,NodeVariant:()=>Se,RoutingVariant:()=>In,useModeler:()=>Kr});module.exports=bu(zm);var Qr=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 Nn=require("lecom-ui");var qi={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 Zi={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 Ji={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 Qi={pt_BR:Ji,en_US:qi,es_ES:Zi};var ji,es,Tu=(es=(ji=Qr("LecomUserLanguage"))!=null?ji:Qr("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?es:Nn.Translations.PT_BR;(0,Nn.initializeI18n)({lng:Tu,resources:Qi});var Ce=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Ce||{});var Bo=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Bo||{}),wn=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(wn||{}),An=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(An||{}),In=(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))(In||{});var so=require("lucide-react");var Nt=require("react/jsx-runtime"),Cn=({size:e=24,className:t})=>(0,Nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Nt.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Nt.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Nt.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Nt.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var jr=require("react/jsx-runtime"),Qt=({size:e=24,className:t})=>(0,jr.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,jr.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 st=require("react/jsx-runtime"),jt=({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:"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,st.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var eo=require("react/jsx-runtime"),to=({size:e=24,className:t})=>(0,eo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,eo.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,eo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,eo.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var oo=require("react/jsx-runtime"),no=({size:e=24,className:t})=>(0,oo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,oo.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,oo.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oo.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var ro=require("react/jsx-runtime"),ts=({size:e=24,className:t})=>(0,ro.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,ro.jsxs)("g",{children:[(0,ro.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,ro.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var os=require("clsx"),ns=require("tailwind-merge");function P(...e){return(0,ns.twMerge)((0,os.clsx)(e))}var at=(e=0,t=0)=>e<t?t:e,Sn=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var zo=require("react/jsx-runtime"),rs=({size:e=24,className:t})=>(0,zo.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:P("stroke-2",t),children:[(0,zo.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,zo.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Mn=require("react/jsx-runtime"),is=({size:e=24,className:t})=>(0,Mn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Mn.jsx)("g",{children:(0,Mn.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 ei=require("react/jsx-runtime"),Pn=({size:e=24,className:t})=>(0,ei.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,ei.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 ti=require("react/jsx-runtime"),Fo=({size:e=24,className:t})=>(0,ti.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:P("stroke-2",t),children:(0,ti.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 io=require("react/jsx-runtime"),ss=({size:e=24,className:t})=>(0,io.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,io.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,io.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,io.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var lt=require("react/jsx-runtime"),as=({size:e=24,className:t})=>(0,lt.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,lt.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,lt.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,lt.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,lt.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,lt.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var wt=require("react/jsx-runtime"),ls=({size:e=24,className:t})=>(0,wt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,wt.jsx)("path",{d:"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,wt.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,wt.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,wt.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(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))(D||{}),Se=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(Se||{}),Ln={SCRIPT:{icon:so.ScrollText},SUBPROCESS:{icon:so.SquarePlus}},qe=(t=>(t.LOOP="LOOP",t))(qe||{}),kn={LOOP:{icon:so.RotateCcw}},Me=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(Me||{}),oi={EXCLUSIVE:{icon:to},PARALLEL:{icon:no},COMPLEX:{icon:jt}};var su=require("@xyflow/react"),te=require("react");var Tt=require("@xyflow/react"),Yr=require("react");var _t=require("@xyflow/react"),we=require("react"),_d=require("use-debounce");var cs=require("zustand"),ds=require("@xyflow/react"),us=require("react");var Dn=()=>{let{setEdges:e}=(0,ds.useReactFlow)();return(0,us.useCallback)(()=>{let o=At.getState().pathEdgeIds;e(n=>n.map(r=>v(E({},r),{selected:o.includes(r.id)})))},[e])},At=(0,cs.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,p)=>{let u=[],f=new Set;for(u.push({node:d,path:[]}),f.add(d);u.length>0;){let{node:h,path:m}=u.shift();if(h===p)return m;let g=a[h]||[];for(let{targetId:b,edgeId:x}of g)f.has(b)||(f.add(b),u.push({node:b,path:[...m,x]}))}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 po=require("@xyflow/react");var vu={value:()=>{}};function fs(){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 Rn(o)}function Rn(e){this._=e}function Nu(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}})}Rn.prototype=fs.prototype={constructor:Rn,on:function(e,t){var o=this._,n=Nu(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=wu(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]=ps(o[r],e.name,t);else if(t==null)for(r in o)o[r]=ps(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 Rn(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 wu(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function ps(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 ni=fs;var Vn="http://www.w3.org/1999/xhtml",ri={svg:"http://www.w3.org/2000/svg",xhtml:Vn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ze(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ri.hasOwnProperty(t)?{space:ri[t],local:e}:e}function Au(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Vn&&t.documentElement.namespaceURI===Vn?t.createElement(e):t.createElementNS(o,e)}}function Iu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function On(e){var t=Ze(e);return(t.local?Iu:Au)(t)}function Cu(){}function It(e){return e==null?Cu:function(){return this.querySelector(e)}}function ms(e){typeof e!="function"&&(e=It(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 oe(n,this._parents)}function ii(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Su(){return[]}function Wo(e){return e==null?Su:function(){return this.querySelectorAll(e)}}function Mu(e){return function(){return ii(e.apply(this,arguments))}}function gs(e){typeof e=="function"?e=Mu(e):e=Wo(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 oe(n,r)}function Uo(e){return function(){return this.matches(e)}}function Hn(e){return function(t){return t.matches(e)}}var Pu=Array.prototype.find;function Lu(e){return function(){return Pu.call(this.children,e)}}function ku(){return this.firstElementChild}function hs(e){return this.select(e==null?ku:Lu(typeof e=="function"?e:Hn(e)))}var Du=Array.prototype.filter;function Ru(){return Array.from(this.children)}function Vu(e){return function(){return Du.call(this.children,e)}}function ys(e){return this.selectAll(e==null?Ru:Vu(typeof e=="function"?e:Hn(e)))}function xs(e){typeof e!="function"&&(e=Uo(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 oe(n,this._parents)}function Gn(e){return new Array(e.length)}function Es(){return new oe(this._enter||this._groups.map(Gn),this._parents)}function Yo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yo.prototype={constructor:Yo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function _s(e){return function(){return e}}function Ou(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 Yo(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function Hu(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,p=i.length,u=new Array(d),f;for(s=0;s<d;++s)(l=t[s])&&(u[s]=f=a.call(l,l.__data__,s,t)+"",c.has(f)?r[s]=l:c.set(f,l));for(s=0;s<p;++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 Yo(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(u[s])===l&&(r[s]=l)}function Gu(e){return e.__data__}function bs(e,t){if(!arguments.length)return Array.from(this,Gu);var o=t?Hu:Ou,n=this._parents,r=this._groups;typeof e!="function"&&(e=_s(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],p=r[c],u=p.length,f=Bu(e.call(d,d&&d.__data__,c,n)),h=f.length,m=s[c]=new Array(h),g=a[c]=new Array(h),b=l[c]=new Array(u);o(d,p,m,g,b,f,t);for(var x=0,y=0,_,T;x<h;++x)if(_=m[x]){for(x>=y&&(y=x+1);!(T=g[y])&&++y<h;);_._next=T||null}}return a=new oe(a,n),a._enter=s,a._exit=l,a}function Bu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ts(){return new oe(this._exit||this._groups.map(Gn),this._parents)}function vs(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 Ns(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],p=c.length,u=s[l]=new Array(p),f,h=0;h<p;++h)(f=c[h]||d[h])&&(u[h]=f);for(;l<r;++l)s[l]=o[l];return new oe(s,this._parents)}function ws(){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 As(e){e||(e=zu);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 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 oe(r,this._parents).order()}function zu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Is(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Cs(){return Array.from(this)}function Ss(){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 Ms(){let e=0;for(let t of this)++e;return e}function Ps(){return!this.node()}function Ls(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 Fu(e){return function(){this.removeAttribute(e)}}function Wu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Uu(e,t){return function(){this.setAttribute(e,t)}}function Yu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $u(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Xu(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 ks(e,t){var o=Ze(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?Wu:Fu:typeof t=="function"?o.local?Xu:$u:o.local?Yu:Uu)(o,t))}function Bn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ku(e){return function(){this.style.removeProperty(e)}}function qu(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Zu(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Ds(e,t,o){return arguments.length>1?this.each((t==null?Ku:typeof t=="function"?Zu:qu)(e,t,o==null?"":o)):ct(this.node(),e)}function ct(e,t){return e.style.getPropertyValue(t)||Bn(e).getComputedStyle(e,null).getPropertyValue(t)}function Ju(e){return function(){delete this[e]}}function Qu(e,t){return function(){this[e]=t}}function ju(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Rs(e,t){return arguments.length>1?this.each((t==null?Ju:typeof t=="function"?ju:Qu)(e,t)):this.node()[e]}function Vs(e){return e.trim().split(/^|\s+/)}function si(e){return e.classList||new Os(e)}function Os(e){this._node=e,this._names=Vs(e.getAttribute("class")||"")}Os.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 Hs(e,t){for(var o=si(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Gs(e,t){for(var o=si(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function ep(e){return function(){Hs(this,e)}}function tp(e){return function(){Gs(this,e)}}function op(e,t){return function(){(t.apply(this,arguments)?Hs:Gs)(this,e)}}function Bs(e,t){var o=Vs(e+"");if(arguments.length<2){for(var n=si(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?op:t?ep:tp)(o,t))}function np(){this.textContent=""}function rp(e){return function(){this.textContent=e}}function ip(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function zs(e){return arguments.length?this.each(e==null?np:(typeof e=="function"?ip:rp)(e)):this.node().textContent}function sp(){this.innerHTML=""}function ap(e){return function(){this.innerHTML=e}}function lp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Fs(e){return arguments.length?this.each(e==null?sp:(typeof e=="function"?lp:ap)(e)):this.node().innerHTML}function cp(){this.nextSibling&&this.parentNode.appendChild(this)}function Ws(){return this.each(cp)}function dp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Us(){return this.each(dp)}function Ys(e){var t=typeof e=="function"?e:On(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function up(){return null}function $s(e,t){var o=typeof e=="function"?e:On(e),n=t==null?up:typeof t=="function"?t:It(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function pp(){var e=this.parentNode;e&&e.removeChild(this)}function Xs(){return this.each(pp)}function fp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ks(e){return this.select(e?mp:fp)}function qs(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gp(e){return function(t){e.call(this,t,this.__data__)}}function hp(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 yp(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 xp(e,t,o){return function(){var n=this.__on,r,i=gp(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 Zs(e,t,o){var n=hp(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?xp:yp,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function Js(e,t,o){var n=Bn(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 Ep(e,t){return function(){return Js(this,e,t)}}function _p(e,t){return function(){return Js(this,e,t.apply(this,arguments))}}function Qs(e,t){return this.each((typeof t=="function"?_p:Ep)(e,t))}function*js(){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 bp=[null];function oe(e,t){this._groups=e,this._parents=t}function ea(){return new oe([[document.documentElement]],bp)}function Tp(){return this}oe.prototype=ea.prototype={constructor:oe,select:ms,selectAll:gs,selectChild:hs,selectChildren:ys,filter:xs,data:bs,enter:Es,exit:Ts,join:vs,merge:Ns,selection:Tp,order:ws,sort:As,call:Is,nodes:Cs,node:Ss,size:Ms,empty:Ps,each:Ls,attr:ks,style:Ds,property:Rs,classed:Bs,text:zs,html:Fs,raise:Ws,lower:Us,append:Ys,insert:$s,remove:Xs,clone:Ks,datum:qs,on:Zs,dispatch:Qs,[Symbol.iterator]:js};var Je=ea;function zn(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function ai(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Ko(){}var $o=.7,Un=1/$o,ao="\\s*([+-]?\\d+)\\s*",Xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vp=/^#([0-9a-f]{3,8})$/,Np=new RegExp(`^rgb\\(${ao},${ao},${ao}\\)$`),wp=new RegExp(`^rgb\\(${ze},${ze},${ze}\\)$`),Ap=new RegExp(`^rgba\\(${ao},${ao},${ao},${Xo}\\)$`),Ip=new RegExp(`^rgba\\(${ze},${ze},${ze},${Xo}\\)$`),Cp=new RegExp(`^hsl\\(${Xo},${ze},${ze}\\)$`),Sp=new RegExp(`^hsla\\(${Xo},${ze},${ze},${Xo}\\)$`),ta={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};zn(Ko,dt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:oa,formatHex:oa,formatHex8:Mp,formatHsl:Pp,formatRgb:na,toString:na});function oa(){return this.rgb().formatHex()}function Mp(){return this.rgb().formatHex8()}function Pp(){return ca(this).formatHsl()}function na(){return this.rgb().formatRgb()}function dt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=vp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ra(t):o===3?new he(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Fn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Fn(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=Np.exec(e))?new he(t[1],t[2],t[3],1):(t=wp.exec(e))?new he(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ap.exec(e))?Fn(t[1],t[2],t[3],t[4]):(t=Ip.exec(e))?Fn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cp.exec(e))?aa(t[1],t[2]/100,t[3]/100,1):(t=Sp.exec(e))?aa(t[1],t[2]/100,t[3]/100,t[4]):ta.hasOwnProperty(e)?ra(ta[e]):e==="transparent"?new he(NaN,NaN,NaN,0):null}function ra(e){return new he(e>>16&255,e>>8&255,e&255,1)}function Fn(e,t,o,n){return n<=0&&(e=t=o=NaN),new he(e,t,o,n)}function Lp(e){return e instanceof Ko||(e=dt(e)),e?(e=e.rgb(),new he(e.r,e.g,e.b,e.opacity)):new he}function lo(e,t,o,n){return arguments.length===1?Lp(e):new he(e,t,o,n==null?1:n)}function he(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}zn(he,lo,ai(Ko,{brighter(e){return e=e==null?Un:Math.pow(Un,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$o:Math.pow($o,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new he(St(this.r),St(this.g),St(this.b),Yn(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:ia,formatHex:ia,formatHex8:kp,formatRgb:sa,toString:sa}));function ia(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}`}function kp(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}${Ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function sa(){let e=Yn(this.opacity);return`${e===1?"rgb(":"rgba("}${St(this.r)}, ${St(this.g)}, ${St(this.b)}${e===1?")":`, ${e})`}`}function Yn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function St(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ct(e){return e=St(e),(e<16?"0":"")+e.toString(16)}function aa(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new De(e,t,o,n)}function ca(e){if(e instanceof De)return new De(e.h,e.s,e.l,e.opacity);if(e instanceof Ko||(e=dt(e)),!e)return new De;if(e instanceof De)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 De(a,s,l,e.opacity)}function da(e,t,o,n){return arguments.length===1?ca(e):new De(e,t,o,n==null?1:n)}function De(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}zn(De,da,ai(Ko,{brighter(e){return e=e==null?Un:Math.pow(Un,e),new De(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$o:Math.pow($o,e),new De(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 he(li(e>=240?e-240:e+120,r,n),li(e,r,n),li(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new De(la(this.h),Wn(this.s),Wn(this.l),Yn(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=Yn(this.opacity);return`${e===1?"hsl(":"hsla("}${la(this.h)}, ${Wn(this.s)*100}%, ${Wn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function la(e){return e=(e||0)%360,e<0?e+360:e}function Wn(e){return Math.max(0,Math.min(1,e||0))}function li(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 ci(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 ua(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 ci((o-n/t)*t,a,r,i,s)}}function pa(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 ci((o-n/t)*t,r,i,a,s)}}var di=e=>()=>e;function Dp(e,t){return function(o){return e+o*t}}function Rp(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 fa(e){return(e=+e)==1?$n:function(t,o){return o-t?Rp(t,o,e):di(isNaN(t)?o:t)}}function $n(e,t){var o=t-e;return o?Dp(e,o):di(isNaN(e)?t:e)}var Xn=function e(t){var o=fa(t);function n(r,i){var a=o((r=lo(r)).r,(i=lo(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=$n(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 ma(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=lo(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 Vp=ma(ua),Op=ma(pa);function Pe(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var pi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ui=new RegExp(pi.source,"g");function Hp(e){return function(){return e}}function Gp(e){return function(t){return e(t)+""}}function fi(e,t){var o=pi.lastIndex=ui.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=pi.exec(e))&&(r=ui.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:Pe(n,r)})),o=ui.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?Gp(l[0].x):Hp(t):(t=l.length,function(c){for(var d=0,p;d<t;++d)s[(p=l[d]).i]=p.x(c);return s.join("")})}var ga=180/Math.PI,Kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mi(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)*ga,skewX:Math.atan(l)*ga,scaleX:a,scaleY:s}}var qn;function ha(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kn:mi(t.a,t.b,t.c,t.d,t.e,t.f)}function ya(e){return e==null?Kn:(qn||(qn=document.createElementNS("http://www.w3.org/2000/svg","g")),qn.setAttribute("transform",e),(e=qn.transform.baseVal.consolidate())?(e=e.matrix,mi(e.a,e.b,e.c,e.d,e.e,e.f)):Kn)}function xa(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,p,u,f,h){if(c!==p||d!==u){var m=f.push("translate(",null,t,null,o);h.push({i:m-4,x:Pe(c,p)},{i:m-2,x:Pe(d,u)})}else(p||u)&&f.push("translate("+p+t+u+o)}function a(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:Pe(c,d)})):d&&p.push(r(p)+"rotate("+d+n)}function s(c,d,p,u){c!==d?u.push({i:p.push(r(p)+"skewX(",null,n)-2,x:Pe(c,d)}):d&&p.push(r(p)+"skewX("+d+n)}function l(c,d,p,u,f,h){if(c!==p||d!==u){var m=f.push(r(f)+"scale(",null,",",null,")");h.push({i:m-4,x:Pe(c,p)},{i:m-2,x:Pe(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),a(c.rotate,d.rotate,p,u),s(c.skewX,d.skewX,p,u),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,p,u),c=d=null,function(f){for(var h=-1,m=u.length,g;++h<m;)p[(g=u[h]).i]=g.x(f);return p.join("")}}}var gi=xa(ha,"px, ","px)","deg)"),hi=xa(ya,", ",")",")");var co=0,Zo=0,qo=0,_a=1e3,Zn,Jo,Jn=0,Mt=0,Qn=0,Qo=typeof performance=="object"&&performance.now?performance:Date,ba=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function en(){return Mt||(ba(Bp),Mt=Qo.now()+Qn)}function Bp(){Mt=0}function jo(){this._call=this._time=this._next=null}jo.prototype=jn.prototype={constructor:jo,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?en():+o)+(t==null?0:+t),!this._next&&Jo!==this&&(Jo?Jo._next=this:Zn=this,Jo=this),this._call=e,this._time=o,yi()},stop:function(){this._call&&(this._call=null,this._time=1/0,yi())}};function jn(e,t,o){var n=new jo;return n.restart(e,t,o),n}function Ta(){en(),++co;for(var e=Zn,t;e;)(t=Mt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--co}function Ea(){Mt=(Jn=Qo.now())+Qn,co=Zo=0;try{Ta()}finally{co=0,Fp(),Mt=0}}function zp(){var e=Qo.now(),t=e-Jn;t>_a&&(Qn-=t,Jn=e)}function Fp(){for(var e,t=Zn,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:Zn=o);Jo=e,yi(n)}function yi(e){if(!co){Zo&&(Zo=clearTimeout(Zo));var t=e-Mt;t>24?(e<1/0&&(Zo=setTimeout(Ea,e-Qo.now()-Qn)),qo&&(qo=clearInterval(qo))):(qo||(Jn=Qo.now(),qo=setInterval(zp,_a)),co=1,ba(Ea))}}function er(e,t,o){var n=new jo;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var Wp=ni("start","end","cancel","interrupt"),Up=[],wa=0,va=1,or=2,tr=3,Na=4,nr=5,tn=6;function ut(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;Yp(e,o,{name:t,index:n,group:r,on:Wp,tween:Up,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:wa})}function on(e,t){var o=ne(e,t);if(o.state>wa)throw new Error("too late; already scheduled");return o}function ie(e,t){var o=ne(e,t);if(o.state>tr)throw new Error("too late; already running");return o}function ne(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Yp(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=jn(i,0,o.time);function i(c){o.state=va,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,p,u,f;if(o.state!==va)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===tr)return er(a);f.state===Na?(f.state=tn,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=tn,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(er(function(){o.state===tr&&(o.state=Na,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=or,o.on.call("start",e,e.__data__,o.index,o.group),o.state===or){for(o.state=tr,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 s(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=nr,1),p=-1,u=r.length;++p<u;)r[p].call(e,d);o.state===nr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=tn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function xi(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>or&&n.state<nr,n.state=tn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function Aa(e){return this.each(function(){xi(this,e)})}function $p(e,t){var o,n;return function(){var r=ie(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 Xp(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=ie(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 Ia(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=ne(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?$p:Xp)(o,e,t))}function uo(e,t,o){var n=e._id;return e.each(function(){var r=ie(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return ne(r,n).value[t]}}function rr(e,t){var o;return(typeof t=="number"?Pe:t instanceof dt?Xn:(o=dt(t))?(t=o,Xn):fi)(e,t)}function Kp(e){return function(){this.removeAttribute(e)}}function qp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zp(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 Jp(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 Qp(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 jp(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 Ca(e,t){var o=Ze(e),n=o==="transform"?hi:rr;return this.attrTween(e,typeof t=="function"?(o.local?jp:Qp)(o,n,uo(this,"attr."+e,t)):t==null?(o.local?qp:Kp)(o):(o.local?Jp:Zp)(o,n,t))}function ef(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function tf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function of(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&tf(e,i)),o}return r._value=t,r}function nf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&ef(e,i)),o}return r._value=t,r}function Sa(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=Ze(e);return this.tween(o,(n.local?of:nf)(n,t))}function rf(e,t){return function(){on(this,e).delay=+t.apply(this,arguments)}}function sf(e,t){return t=+t,function(){on(this,e).delay=t}}function Ma(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rf:sf)(t,e)):ne(this.node(),t).delay}function af(e,t){return function(){ie(this,e).duration=+t.apply(this,arguments)}}function lf(e,t){return t=+t,function(){ie(this,e).duration=t}}function Pa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?af:lf)(t,e)):ne(this.node(),t).duration}function cf(e,t){if(typeof t!="function")throw new Error;return function(){ie(this,e).ease=t}}function La(e){var t=this._id;return arguments.length?this.each(cf(t,e)):ne(this.node(),t).ease}function df(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ie(this,e).ease=o}}function ka(e){if(typeof e!="function")throw new Error;return this.each(df(this._id,e))}function Da(e){typeof e!="function"&&(e=Uo(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new pe(n,this._parents,this._name,this._id)}function Ra(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,p=a[s]=new Array(d),u,f=0;f<d;++f)(u=l[f]||c[f])&&(p[f]=u);for(;s<n;++s)a[s]=t[s];return new pe(a,this._parents,this._name,this._id)}function uf(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 pf(e,t,o){var n,r,i=uf(t)?on:ie;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function Va(e,t){var o=this._id;return arguments.length<2?ne(this.node(),o).on.on(e):this.each(pf(o,e,t))}function ff(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Oa(){return this.on("end.remove",ff(this._id))}function Ha(e){var t=this._name,o=this._id;typeof e!="function"&&(e=It(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,p,u=0;u<l;++u)(d=s[u])&&(p=e.call(d,d.__data__,u,s))&&("__data__"in d&&(p.__data__=d.__data__),c[u]=p,ut(c[u],t,o,u,c,ne(d,o)));return new pe(i,this._parents,t,o)}function Ga(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Wo(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,p=0;p<c;++p)if(d=l[p]){for(var u=e.call(d,d.__data__,p,l),f,h=ne(d,o),m=0,g=u.length;m<g;++m)(f=u[m])&&ut(f,t,o,m,u,h);i.push(u),a.push(d)}return new pe(i,a,t,o)}var mf=Je.prototype.constructor;function Ba(){return new mf(this._groups,this._parents)}function gf(e,t){var o,n,r;return function(){var i=ct(this,e),a=(this.style.removeProperty(e),ct(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function za(e){return function(){this.style.removeProperty(e)}}function hf(e,t,o){var n,r=o+"",i;return function(){var a=ct(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function yf(e,t,o){var n,r,i;return function(){var a=ct(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),ct(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function xf(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=ie(this,e),c=l.on,d=l.value[i]==null?s||(s=za(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function Fa(e,t,o){var n=(e+="")=="transform"?gi:rr;return t==null?this.styleTween(e,gf(e,n)).on("end.style."+e,za(e)):typeof t=="function"?this.styleTween(e,yf(e,n,uo(this,"style."+e,t))).each(xf(this._id,e)):this.styleTween(e,hf(e,n,t),o).on("end.style."+e,null)}function Ef(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function _f(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Ef(e,a,o)),n}return i._value=t,i}function Wa(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,_f(e,t,o==null?"":o))}function bf(e){return function(){this.textContent=e}}function Tf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Ua(e){return this.tween("text",typeof e=="function"?Tf(uo(this,"text",e)):bf(e==null?"":e+""))}function vf(e){return function(t){this.textContent=e.call(this,t)}}function Nf(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 Ya(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,Nf(e))}function $a(){for(var e=this._name,t=this._id,o=ir(),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=ne(l,t);ut(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new pe(n,this._parents,e,o)}function Xa(){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=ie(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 wf=0;function pe(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Ka(e){return Je().transition(e)}function ir(){return++wf}var Qe=Je.prototype;pe.prototype=Ka.prototype={constructor:pe,select:Ha,selectAll:Ga,selectChild:Qe.selectChild,selectChildren:Qe.selectChildren,filter:Da,merge:Ra,selection:Ba,transition:$a,call:Qe.call,nodes:Qe.nodes,node:Qe.node,size:Qe.size,empty:Qe.empty,each:Qe.each,on:Va,attr:Ca,attrTween:Sa,style:Fa,styleTween:Wa,text:Ua,textTween:Ya,remove:Oa,tween:Ia,delay:Ma,duration:Pa,ease:La,easeVarying:ka,end:Xa,[Symbol.iterator]:Qe[Symbol.iterator]};function sr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Af={time:null,delay:0,duration:250,ease:sr};function If(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 qa(e){var t,o;e instanceof pe?(t=e._id,e=e._name):(t=ir(),(o=Af).time=en(),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])&&ut(l,e,t,c,a,o||If(l,t));return new pe(n,this._parents,e,t)}Je.prototype.interrupt=Aa;Je.prototype.transition=qa;function pt(e,t,o){this.k=e,this.x=t,this.y=o}pt.prototype={constructor:pt,scale:function(e){return e===1?this:new pt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new pt(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 ar=new pt(1,0,0);lr.prototype=pt.prototype;function lr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ar;return e.__zoom}var Sf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Za;(function(e){e.Strict="strict",e.Loose="loose"})(Za||(Za={}));var Ja;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ja||(Ja={}));var Qa;(function(e){e.Partial="partial",e.Full="full"})(Qa||(Qa={}));var ja;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ja||(ja={}));var el;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(el||(el={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));var Zx={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};var Mf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Pf=(e,t=[0,0])=>{var s;let{width:o,height:n}=Lf(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 be=(e,t=[0,0])=>{var r,i,a,s,l,c,d,p;let{x:o,y:n}=Mf(e)?e.internals.positionAbsolute:Pf(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+((p=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?p:0)}};function Lf(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 Jx={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}};var kf={nodeOrigin:[0,0],nodeExtent:Sf,elevateNodesOnSelect:!0,defaults:{}},Qx=v(E({},kf),{checkEquality:!0});var tl;(function(e){e.Line="line",e.Handle="handle"})(tl||(tl={}));var Df={width:0,height:0,x:0,y:0},jx=v(E({},Df),{pointerX:0,pointerY:0,aspectRatio:1});var Te=require("react"),il=require("zustand/shallow");var Rf=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Vf(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 Of(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 cr=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 u of i){if(u.position<a)continue;if(u.position>s)break;if(u.node.id===n.id||u.node.parentId===n.id||!Rf(u.nodeBox,r))continue;let f=Math.abs(u.position-o);if(f>dr)continue;let m=Vf(u.nodeBox,be(n))>0?0:Of(u.nodeBox,be(n));l.push({line:u,lineDist:f,nodeDist:m})}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 ol(e,t=Pt,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=be(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 nl(e,t,o,n,r=Object.keys(Pt)){let i=[];for(let s of r){let l=Pt[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 rl(e,t,o,n,r,i,a,s){var p,u,f,h,m,g,b,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+((u=(p=e.measured)==null?void 0:p.width)!=null?u:0),y2:o.position.y+((h=(f=e.measured)==null?void 0:f.height)!=null?h:0)};if(a){let _=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(_)<=dr){if(o.position.y-=_,r!=null&&r.dimensions)if(n){let T=t.internals.positionAbsolute.y+((g=(m=e.measured)==null?void 0:m.height)!=null?g:0);r.dimensions.height=T-a.line.position}else r.dimensions.height=a.line.position-t.internals.positionAbsolute.y;c=!0}}if(s){let _=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(_)<=dr){if(o.position.x-=_,r!=null&&r.dimensions)if(n){let T=t.internals.positionAbsolute.x+((x=(b=e.measured)==null?void 0:b.width)!=null?x:0);r.dimensions.width=T-s.line.position}else r.dimensions.width=s.line.position-t.internals.positionAbsolute.x;l=!0}}return i&&(l||c)&&(o.position.x-=i.position.x,o.position.y-=i.position.y),{snappedX:l,snappedY:c}}var dr=10,Pt={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 sl=require("react/jsx-runtime"),Hf=new cr;function fo(){let[e,t]=(0,Te.useState)(void 0),[o,n]=(0,Te.useState)(void 0),{width:r,height:i}=(0,po.useStore)(g=>({width:g.width,height:g.height}),il.shallow),a=(0,po.useNodesInitialized)(),s=(0,Te.useRef)(Hf),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,po.useReactFlow)(),p=(0,Te.useCallback)(()=>{t(void 0),n(void 0)},[]),u=(0,Te.useCallback)(g=>{let b=g!=null?g:d();p();let x=ol(b,Pt,c);s.current.initialize(x)},[c,p,d]),f=(0,Te.useCallback)(()=>{setTimeout(()=>{u()},100)},[u]);(0,Te.useEffect)(()=>{a&&u(d())},[a,u,d]);let h=(0,Te.useCallback)((g,b)=>{var G,F,W,Ie,ae;if(!s.current||g.length===0||g.length>2)return g;p();let x,y,_=Object.keys(Pt);g.length===1?g[0].type==="position"?x=g[0]:g[0].type==="dimensions"&&(y=g[0],_=["right","bottom"]):g[0].type==="position"&&g[1].type==="dimensions"&&g[1].dimensions&&(x=g[0],y=g[1],_=["top","left"]);let T=b.find(it=>it.id===g[0].id);if(!T)return g;let A=c(T.id);if(!A)throw new Error(`Node with id ${T.id} not found in internal nodes`);let N=c((G=A.parentId)!=null?G:""),I=be(A);y!=null&&y.dimensions&&(I.x2=I.x+y.dimensions.width,I.y2=I.y+y.dimensions.height);let{x:L,y:w}=l({x:0,y:0}),{x:C,y:M}=l({x:r,y:i}),S={x:L,y:w,x2:C,y2:M},{horizontal:H,vertical:R}=nl(s.current,S,T,I,_),V={id:T.id,type:"position",position:{x:A.internals.positionAbsolute.x,y:A.internals.positionAbsolute.y},dragging:!1};x!=null&&x.position&&V.position&&(N?(V.position.x=x.position.x+((W=(F=N==null?void 0:N.position)==null?void 0:F.x)!=null?W:0),V.position.y=x.position.y+((ae=(Ie=N==null?void 0:N.position)==null?void 0:Ie.y)!=null?ae:0)):(V.position.x=x.position.x,V.position.y=x.position.y));let{snappedX:ee,snappedY:Y}=rl(T,A,V,x,y,N,H,R);if(ee||Y){if((y!=null&&y.resizing||x!=null&&x.dragging)&&(ee&&n(R==null?void 0:R.line),Y&&t(H==null?void 0:H.line)),y&&x)return[V,y];if(x)return[V];if(y)return[y]}return g},[l,c,r,i,t,n,p]),m=(0,Te.useCallback)(()=>(0,sl.jsx)(al,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:u,forceRebuildIndex:f,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:m}}var Rr=require("@xyflow/react"),Mi=require("react");var Re=require("@xyflow/react");var mo=require("@xyflow/react");function ll(e,t){var y,_,T,A;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+((_=(y=t==null?void 0:t.measured)==null?void 0:y.width)!=null?_:0)/2,p=i.y+((A=(T=t==null?void 0:t.measured)==null?void 0:T.height)!=null?A:0)/2,u=(d-l)/(2*a)-(p-c)/(2*s),f=(d-l)/(2*a)+(p-c)/(2*s),h=1/(Math.abs(u)+Math.abs(f)||1),m=h*u,g=h*f,b=a*(m+g)+l,x=s*(-m+g)+c;return{x:b,y:x}}function cl(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),a=Math.round(o.y),s=Math.round(t.x),l=Math.round(t.y);return s<=i+1?mo.Position.Left:s>=i+n-1?mo.Position.Right:l<=a+1?mo.Position.Top:l>=a+r-1?mo.Position.Bottom:mo.Position.Top}function ft(e,t){let o=ll(e,t),n=ll(t,e),r=cl(e,o),i=cl(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var Fe=require("lecom-ui"),ul=require("lucide-react");var Le=require("@xyflow/react");var dl=require("@xyflow/react");var mt=()=>{let{getNodes:e,setNodes:t,getEdges:o,setEdges:n}=(0,dl.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 Sn(),!0}}};var ur=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,Le.useReactFlow)(),{selectElements:r}=mt(),i=g=>{let b=o(),x=n(),y=(0,Le.getIncomers)(g,b,x),_=(0,Le.getOutgoers)(g,b,x),T=y.some(N=>N.type==="START_EVENT"),A=_.some(N=>N.type==="END_EVENT");return T?"start":A?"end":"between"},a=(g,b,x)=>{var T,A,N,I;if(!g)return;let y={type:g.type,variant:(T=g.data)==null?void 0:T.variant,attribute:(A=g.data)==null?void 0:A.attribute},_={id:g.id,position:i(g),label:(N=g.data)==null?void 0:N.label,node:y};return g.type==="TASK"&&((I=g.data)==null?void 0:I.variant)==="SUBPROCESS"?v(E({},_),{type:"sub_process"}):g.type==="GATEWAY"?v(E({},_),{type:"gateway",variant:s(g,b,x)}):v(E({},_),{type:"activity"})},s=(g,b,x)=>{if(g.type!=="GATEWAY")return;let y=(0,Le.getIncomers)(g,b,x),_=!1,T=!1;if(y.forEach(A=>{var N,I;A.type==="TASK"&&(((N=A.data)==null?void 0:N.variant)==="SCRIPT"&&(_=!0),((I=A.data)==null?void 0:I.attribute)==="LOOP"&&(T=!0))}),_&&T)return"script_loop";if(_)return"script";if(T)return"loop"},l=(g,b,x)=>{var N,I,L,w;let y=e(g.source),_=e(g.target);if(!y||!_)return"simple";if((0,Le.getOutgoers)(y,b,x).some(C=>C.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((N=y.data)==null?void 0:N.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let C=(I=y.data)==null?void 0:I.variant,M=(L=y.data)==null?void 0:L.attribute;if(_.type==="TASK"&&((w=_.data)==null?void 0:w.variant)==="SUBPROCESS")return"to_sub_process";let S=C==="SCRIPT",H=M==="LOOP";return S&&H?"script_loop":S?"script":H?"loop":"simple"}return"simple"},c=(g,b,x)=>{let y=[];function _(A,N,I=0){let L=a(A,b,x);if(L.depth=I,N.push(L),A.type==="TASK"){y.push([...N]),N.pop();return}let w=(0,Le.getIncomers)(A,b,x);if(w.length)for(let C of w)_(C,N,I+1);N.pop()}let T=(0,Le.getIncomers)(g,b,x);for(let A of T)_(A,[]);return y},d=(g,b,x)=>{let y=[];function _(A,N,I=0){let L=a(A,b,x);if(L.depth=I,N.push(L),A.type==="TASK"){y.push([...N]),N.pop();return}let w=(0,Le.getOutgoers)(A,b,x);if(w.length)for(let C of w)_(C,N,I+1);N.pop()}let T=(0,Le.getOutgoers)(g,b,x);for(let A of T)_(A,[]);return y},p=(g,b,x)=>{x=x.filter(_=>_.source===g.id);let y=x.map(_=>{var N;let T=e(_.target),A;return T&&(A=a(T,b,x)),{id:_.id,type:"routing",variant:l(_,b,x),label:(N=_.data)==null?void 0:N.label,target:A}});return console.log(y),y},u=g=>{let b=e(g);if(!b)return;let x=o(),y=n(),_=a(b,x,y);return _.sources=c(b,x,y),_.targets=d(b,x,y),_.edgeTargets=p(b,x,y),b.type==="GATEWAY"&&(_.variant=s(b,x,y)),_},f=g=>{let b=t(g);if(!b)return;let x=o(),y=n(),_=l(b,x,y),A={id:b.id,type:"routing",variant:_,gatewayVariant:void 0},N=e(b.source);if(N){let L=a(N,x,y),w=c(N,x,y),C=s(N,x,y);A.source=L,A.sources=w.length?w:[[L]],A.gatewayVariant=C}let I=e(b.target);if(I){let L=a(I,x,y),w=d(I,x,y);A.target=L,A.targets=w.length?w:[[L]]}return A},h=g=>{let b=e(g);if(b)return u(b.id);let x=t(g);if(x)return f(x.id)};return{configureElement:g=>{let b=h(g);if(b)return r([g]),b},getConfigureElement:h,getNodeConfigure:u,getEdgeConfigure:f}};var Lt=require("react/jsx-runtime"),gt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Fe.useTranslation)(),{onConfigureElement:n}=k(),{getConfigureElement:r}=ur();return(0,Lt.jsxs)(Fe.Tooltip,{children:[(0,Lt.jsx)(Fe.TooltipTrigger,{asChild:!0,children:(0,Lt.jsx)(Fe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,Lt.jsx)(ul.Settings,{size:16})})}),(0,Lt.jsx)(Fe.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var pl=require("@xyflow/react"),We=require("lecom-ui"),fl=require("lucide-react"),kt=require("react/jsx-runtime"),pr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,We.useTranslation)(),{deleteElements:n}=(0,pl.useReactFlow)();return(0,kt.jsxs)(We.Tooltip,{children:[(0,kt.jsx)(We.TooltipTrigger,{asChild:!0,children:(0,kt.jsx)(We.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,kt.jsx)(fl.TrashIcon,{size:16})})}),(0,kt.jsx)(We.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Ue=require("lecom-ui"),ml=require("lucide-react"),gl=require("react"),Dt=require("react/jsx-runtime"),nn=({nodeId:e})=>{let{t}=(0,Ue.useTranslation)(),o=(0,gl.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 a=i.getBoundingClientRect(),s=a.left+a.width/2,l=a.top+a.height/2,c=new MouseEvent("mousedown",{clientX:s,clientY:l,bubbles:!0,cancelable:!0});i.dispatchEvent(c)},[e]);return(0,Dt.jsxs)(Ue.Tooltip,{children:[(0,Dt.jsx)(Ue.TooltipTrigger,{asChild:!0,children:(0,Dt.jsx)(Ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onMouseDown:o,children:(0,Dt.jsx)(ml.MoveUpRightIcon,{size:16})})}),(0,Dt.jsx)(Ue.TooltipContent,{color:"black",children:t("editor.toolbar.connect_node")})]})};var go=require("react/jsx-runtime"),ho=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=Be(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=k(),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,go.jsx)(pr,{elementId:e,elementType:"edge"})}],h=()=>s==="view"?u?[{component:(0,go.jsx)(gt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,go.jsx)(gt,{elementId:e,elementType:"edge"})},...f]:f,g=(b=>{switch(b){case"SEQUENCE_EDGE":return h();case"MESSAGE_EDGE":return s==="view"?[]:[...f];case"ANNOTATION_EDGE":return s==="view"?[]:[...f];default:return[]}})(t);if(!(g.length===0||s==="view"))return(0,go.jsx)("div",v(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:g.map((b,x)=>(0,go.jsx)("div",{children:b.component},x))}))};var Rt=require("react/jsx-runtime"),yo={type:"ANNOTATION_EDGE",reconnectable:!0},hl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,Re.useViewport)(),{isMultipleSelection:a}=k(),s=(0,Re.useInternalNode)(t),l=(0,Re.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:p,ty:u}=ft(s,l),[f,h,m]=(0,Re.getStraightPath)({sourceX:c,sourceY:d,targetX:p,targetY:u}),g=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected),b=1/i;return(0,Rt.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,Rt.jsx)(Re.BaseEdge,{id:e,path:f,strokeDasharray:4,className:P("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(r!=null&&r.hasError)})}),(0,Rt.jsx)(Re.EdgeLabelRenderer,{children:(0,Rt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${m}px)`},children:n&&!a&&(0,Rt.jsx)(ho,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${b})`}})})})]})};var ce=require("@xyflow/react"),fr=require("react");var Vt=require("react");var Ei=require("react/jsx-runtime"),le=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s})=>{let l=(0,Vt.useRef)(null),[c,d]=(0,Vt.useState)(!1);(0,Vt.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,Vt.useEffect)(()=>{if(c&&l.current){l.current.focus();let m=document.createRange();m.selectNodeContents(l.current);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(m))}},[c]);let p=m=>{m.stopPropagation(),c||d(!0)},u=m=>{let g=m.currentTarget.innerText.trim(),b=t&&g.length>=t,x=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],y=m.ctrlKey||m.metaKey,_=y&&m.key==="a",T=y&&m.key==="c",A=y&&m.key==="x",N=y&&m.key==="v";function I(w){return/\w/.test(w)}if(g.length===0&&!I(m.key)&&!x.includes(m.key)&&!y){m.preventDefault();return}b&&(x.includes(m.key)||_||T||A||N||m.preventDefault())},f=m=>{if(!t)return;m.preventDefault();let g=m.clipboardData.getData("text/plain"),b=m.currentTarget.innerText,x=window.getSelection();if(!x||x.rangeCount===0)return;let y=x.getRangeAt(0);if((b.substring(0,y.startOffset)+g+b.substring(y.endOffset)).length>t){let T=t-(b.length-(y.endOffset-y.startOffset)),A=g.substring(0,Math.max(0,T));A&&(y.deleteContents(),y.insertNode(document.createTextNode(A)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y))}else y.deleteContents(),y.insertNode(document.createTextNode(g)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y)},h=m=>{d(!1);let g=m.currentTarget.innerText.trim();t&&g.length>t&&(g=g.substring(0,t)),m.currentTarget.innerText=g,s==null||s(),g!==e&&(a==null||a(g))};return(0,Ei.jsx)("div",{className:P("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,Ei.jsx)("div",{ref:l,className:P("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:u,onPaste:f,onBlur:h,children:e})})};var ht=require("react/jsx-runtime"),Ve={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:ce.MarkerType.ArrowClosed},markerEnd:{type:ce.MarkerType.Arrow},data:{label:""}},yl=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,ce.useViewport)(),{updateEdgeData:a}=(0,ce.useReactFlow)(),{isMultipleSelection:s}=k(),[l,c]=(0,fr.useState)(!1),d=(0,fr.useCallback)(M=>{a(e,{label:M.trim()})},[e,a]),p=(0,ce.useInternalNode)(t),u=(0,ce.useInternalNode)(o);if(!p||!u)return null;let{sx:f,sy:h,tx:m,ty:g,sourcePos:b,targetPos:x}=ft(p,u),[y,_,T]=(0,ce.getSmoothStepPath)({sourceX:f,sourceY:h,targetX:m,targetY:g,sourcePosition:b,targetPosition:x}),A=r||(p==null?void 0:p.selected)||(u==null?void 0:u.selected),N=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",I=l||(n==null?void 0:n.label.trim().length)>0,L=1/i,w=()=>{c(!0)},C=()=>{c(!1)};return(0,ht.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:w,children:[(0,ht.jsx)(ce.BaseEdge,{id:e,path:y,markerEnd:`url(#${N})`,className:P("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)})}),(0,ht.jsx)(ce.EdgeLabelRenderer,{children:(0,ht.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${_}px, ${T}px)`},children:[r&&!s&&(0,ht.jsx)(ho,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:p,targetNode:u,style:{transform:`scale(${L})`}}),I&&(0,ht.jsx)(le,{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:d})]})})]})};var sn=e=>new Map(e.map(t=>[t.id,t])),mr=e=>e.some(t=>t.type==="START_EVENT"),xl=(e,t,o,n)=>{let r=sn(o),i=r.get(e);if(!i||i.type!=="START_EVENT")return!1;let a=r.get(t);return(a==null?void 0:a.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},gr=(e,t,o)=>{var i;let n=t.find(a=>a.id===e);return!n||n.type!=="GATEWAY"||((i=n.data)==null?void 0:i.variant)!=="EXCLUSIVE"?!1:o.filter(a=>a.source===e).length>=2},El=(e,t,o)=>{var a,s,l,c;let n=sn(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"},hr=(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"},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.attribute)==="LOOP"},xr=(e,t,o)=>{let n=sn(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(a=>a.target===e).some(a=>{let s=n.get(a.source);return(s==null?void 0:s.type)==="START_EVENT"})},Er=(e,t,o)=>{let n=sn(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(a=>a.source===e).some(a=>{let s=n.get(a.target);return(s==null?void 0:s.type)==="END_EVENT"})},_r=(e,t)=>t.filter(n=>n.source===e).length>0,br=(e,t,o,n)=>{let r=sn(o),i=r.get(e);if(!i||i.type!=="TASK")return!1;let a=t?r.get(t):null;return(a==null?void 0:a.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 Gf=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!xl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"start_event_limit_reached"}),e=>({isValid:!gr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!br(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:El(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:!(hr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(yr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(xr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(Er(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"})],_l=e=>{for(let t of Gf){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Bf=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:gr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:mr(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:hr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:yr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:xr(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Er(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:br(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],bl=e=>{let t=Bf.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 Lc=require("use-debounce");var Pc=require("@xyflow/react"),Ci=require("react");var an=(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))(an||{});var Tr=require("xml-js");var Tl={compact:!0,spaces:4},zf=e=>e.replaceAll(`
|
|
2
|
-
`,"
");function vr(e,t=Tl){if(e)return JSON.parse((0,Tr.xml2json)(e,v(E({},t),{attributeValueFn:zf})))}function vl(e,t=Tl){return e?(0,Tr.json2xml)(e,t):""}var Ti=require("uuid");var Ff={MIN_WIDTH:36,MIN_HEIGHT:36},Wf={MIN_WIDTH:36,MIN_HEIGHT:36},Uf={MIN_WIDTH:56,MIN_HEIGHT:56},Nr={MIN_WIDTH:176,MIN_HEIGHT:96},wr={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Z={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Ar={MIN_WIDTH:176,MIN_HEIGHT:64},Yf={MIN_WIDTH:128,MIN_HEIGHT:64},O={START_EVENT:Ff,END_EVENT:Wf,GATEWAY:Uf,TASK:Nr,LANE:Z,ANNOTATION:Ar,UNSUPPORTED:Yf};var Nl={"attribute-loop":"LOOP"},wl={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Al={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Il={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Cl={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var xo=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=at(Number(n),t),a=at(Number(r),o);return{width:i,height:a,measured:{width:i,height:a}}},Eo=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},Xf=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,O.START_EVENT.MIN_WIDTH,O.START_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"START_EVENT"})},Kf=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,O.END_EVENT.MIN_WIDTH,O.END_EVENT.MIN_HEIGHT);return v(E(E({},o),n),{type:"END_EVENT"})},_i=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=Eo(e),i=xo(n,O.TASK.MIN_WIDTH,O.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=Nl[l];c&&(r.data.attribute=c)}let s=wl[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=Eo(e),i=xo(o,O.GATEWAY.MIN_WIDTH,O.GATEWAY.MIN_HEIGHT);return r.data.variant=Al[n],v(E(E({},r),i),{type:"GATEWAY"})},qf=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,O.ANNOTATION.MIN_WIDTH,O.ANNOTATION.MIN_HEIGHT);return v(E(E({},o),n),{type:"ANNOTATION"})},Zf=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,O.LANE.MIN_WIDTH,O.LANE.MIN_HEIGHT);return v(E(E({},o),n),{type:"LANE"})},Sl={task:_i,"task-script":_i,"subprocess-collapsed":_i,"start-event":Xf,"end-event-terminate":Kf,"gateway-parallel":bi,"gateway-exclusive":bi,"gateway-complex":bi,annotation:qf,lane:Zf},Ml=e=>{let{_attributes:t}=e,{source:o,target:n,value:r,style:i}=t,a={id:(0,Ti.v7)(),source:o,target:n,data:{label:r||""}};return i.includes("association")&&i.includes('endArrow=""')?E(E({},yo),a):E(E({},Ve),a)},Pl=(e,t)=>{let{id:o,type:n,source:r,target:i,data:a}=e,s=t==null?void 0:t.find(d=>d.id===r),l="";return n==="ANNOTATION_EDGE"&&(l='association;endArrow=""'),{_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:{_attributes:{as:"geometry",relative:"1"}}}},_o=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}}}},Jf=e=>{let{variant:t}=e.data,o=_o(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Il[t]||"task"})})},Qf=e=>{let t=_o(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"start-event"})})},jf=e=>{let t=_o(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"end-event-terminate"})})},em=e=>{let{variant:t}=e.data,o=_o(e);return v(E({},o),{_attributes:v(E({},o._attributes),{style:Cl[t]})})},tm=e=>{let t=_o(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"lane"})})},om=e=>{let t=_o(e);return v(E({},t),{_attributes:v(E({},t._attributes),{style:"annotation"})})},Ll={TASK:Jf,START_EVENT:Qf,END_EVENT:jf,GATEWAY:em,ANNOTATION:om,LANE:tm},kl=e=>{var i,a;let n=((i=e.measured)==null?void 0:i.width)||0,r=((a=e.measured)==null?void 0:a.height)||0;return{_attributes:{id:(0,Ti.v7)(),parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:n/2-22/2,y:r-22,width:22,height:22}}}};var vi=_u(require("@dagrejs/dagre"),1),Ol=require("@xyflow/react");var Hl=require("lodash");var Dl=require("lodash");var je=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}},et=e=>(0,Dl.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Rl=(e,t)=>{let{x:o,y:n}=je(e),{x:r,y:i}=je(t);return{x:o-r,y:n-i}};var bo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),nm=(e,t)=>{let{x:o,y:n}=je(e),{x:r,y:i}=je(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},rm=(e,t)=>{let{x:o,y:n,w:r,h:i}=je(e),{x:a,y:s,w:l,h:c}=je(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},ln=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&rm(e,r)){let i=nm(e,r);i<n&&(n=i,o=r)}return o},Vl=(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 Gl=(e=[],t=[],o="LR")=>{let n=new vi.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)),vi.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}},cn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Ot(n.id,o)}),o},Ot=(e,t)=>{var f,h;let o=[...t],n=o.find(m=>m.id===e);if(!n)return o;let r=o.filter(m=>m.parentId===e&&m.type==="LANE");if(r.length===0)return o;let i=(0,Hl.orderBy)(r,["position.y"]),a=Math.max((h=(f=n.measured)==null?void 0:f.width)!=null?h:0,wr.MIN_WIDTH),s=Vl(e,i)||Z.MIN_WIDTH,l=Math.max(a,s),c=a-Z.HEADER_WIDTH>=s,d=0,p=0;i.forEach(m=>{var g,b,x,y;o=o.map(_=>_.id===m.id?v(E({},_),{width:c?l-Z.HEADER_WIDTH:l,measured:v(E({},_.measured),{width:c?l-Z.HEADER_WIDTH:l}),position:{x:Z.HEADER_WIDTH,y:d}}):_),d+=(b=(g=m.measured)==null?void 0:g.height)!=null?b:0,p+=(y=(x=m.measured)==null?void 0:x.height)!=null?y:0}),o=o.map(m=>m.id===e?v(E({},m),{height:p,width:c?l:l+Z.HEADER_WIDTH,measured:v(E({},m.measured),{height:p,width:c?l:l+Z.HEADER_WIDTH})}):m);let u=o.find(m=>m.id===e);return u!=null&&u.parentId&&(o=Ot(u.parentId,o)),o},Bl=(e,t,o)=>{if(e.type==="LANE")return o;let n=be(t),r=be(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+Z.HEADER_WIDTH&&(e.position.x=Z.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},zl=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},im=50,Fl=(e,t=im)=>{let o=(0,Ol.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var sm=e=>{let t=Object.values(an),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=Sl[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},am=(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=Ml(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},lm=e=>{let t=[];return e.forEach(o=>{var i,a;let n=(a=(i=Ll)[o.type])==null?void 0:a.call(i,o);if(!n){console.warn(`Node ${o.type} not supported`);return}if(t.push(n),o.type==="TASK"&&o.data.attribute==="LOOP"){let s=kl(o);t.push(s)}}),t},cm=(e,t)=>{let o=[];return e.forEach(n=>{let r=Pl(n,t);o.push(r)}),o},Wl=(e=[],t=[])=>{let o=lm(e),n=cm(t,e),r={mxGraphModel:{root:{_attributes:{version:"1.1"},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...o,...n]}}};return vl(JSON.stringify(r))},Ul=async e=>{var a,s;let t=await vr(e),o=((s=(a=t==null?void 0:t.mxGraphModel)==null?void 0:a.root)==null?void 0:s.mxCell)||[],n=sm(o),r=am(o,n);return{nodes:et(cn(n)),edges:r}};var No=require("@xyflow/react");var dn=require("@xyflow/react");var Ni=require("react/jsx-runtime"),se=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=Be(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,Ni.jsx)(dn.Handle,E({type:e,position:t,className:P("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))},Ir=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=Be(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,dn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let u=c();return t==="TASK"?u.filter(h=>h.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?u.filter(h=>h.source===e).length>=2:!1})();return(0,Ni.jsx)(dn.Handle,E({type:n,position:r,className:P("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 Cr=require("@xyflow/react"),Yl=require("lodash");var $l=require("react/jsx-runtime"),To=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=Be(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,Cr.useReactFlow)(),{isMultipleSelection:l}=k(),c=({width:p,height:u})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let h=[...a()],m=!f.parentId,g=m?f.id:f.parentId,b=h.filter(_=>_.type==="LANE"&&_.parentId===g);if(!b.length)return;let x=(0,Yl.orderBy)(b,["position.y"]),y=0;x.forEach((_,T)=>{var I,L;let A=T===x.length-1,N=(L=(I=_.measured)==null?void 0:I.height)!=null?L:0;h=h.map(w=>{if(w.id===_.id){let C=m?p-Z.HEADER_WIDTH:p,M=v(E({},w),{width:C,measured:v(E({},w.measured),{width:C}),position:v(E({},w.position),{y})});return A&&m&&(M.height=u-y),M}return w}),y+=N}),h=h.map(_=>{if(_.id===g){let T=m?p:p+Z.HEADER_WIDTH;return v(E({},_),{width:T,height:m?u:y,measured:{width:T,height:m?u:y}})}return _}),s(h)};return(0,$l.jsx)(Cr.NodeResizer,E({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 Pr=require("@xyflow/react"),Ye=require("lecom-ui"),Gt=require("react");var Xl=require("zustand"),vo=(0,Xl.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var Sr=require("react"),Kl=(e,t=!1)=>{let[o,n]=(0,Sr.useState)({width:0,height:0});return(0,Sr.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var yt=require("@xyflow/react"),ql=require("react"),dm=120,um=12,Zl=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,yt.useReactFlow)(),{instanceId:i}=k();return(0,ql.useMemo)(()=>{var f,h;if(!t)return{position:yt.Position.Right,align:"start"};let a=n(e);if(!a)return{position:yt.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((f=a.measured)==null?void 0:f.width)||a.width||100)*s.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:yt.Position.Right,align:"start"};let p=(o==null?void 0:o.width)||dm;return{position:l+c+p+um>d?yt.Position.Left:yt.Position.Right}},[i,e,t,o,n,r])};var Mr=require("@xyflow/react"),B=require("lecom-ui"),Jl=require("lucide-react");var K=require("react/jsx-runtime"),Ql=({nodeId:e})=>{let{t}=(0,B.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Mr.useReactFlow)(),i=(0,Mr.useNodesData)(e),s=n().filter(f=>f.source===e).some(f=>{let h=r(f.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=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,K.jsxs)(B.DropdownMenu,{children:[(0,K.jsxs)(B.Tooltip,{children:[(0,K.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(B.DropdownMenuTrigger,{asChild:!0,children:(0,K.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,K.jsx)(Jl.WrenchIcon,{})})})}),(0,K.jsx)(B.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,K.jsxs)(B.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,K.jsxs)(B.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,K.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,K.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(kn).map(([p,u])=>{let f=p==="LOOP"&&(s||l),m=(()=>{if(p==="LOOP"&&s)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,K.jsxs)(B.Tooltip,{children:[(0,K.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:P({"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,K.jsx)(u.icon,{className:"stroke-inherit"})})}),m&&(0,K.jsx)(B.TooltipContent,{color:"black",children:m})]},p)})})]}),(0,K.jsx)(B.DropdownMenuGroup,{children:(0,K.jsxs)(B.Tooltip,{children:[(0,K.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,K.jsxs)(B.DropdownMenuItem,{className:P({"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,K.jsx)(Ln.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),s&&(0,K.jsx)(B.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var J=require("react/jsx-runtime"),Ht={START_EVENT:{type:"START_EVENT",icon:Fo,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Qt,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:Fo,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:Cn,label:"bpmn.annotation.variant.default"}},pm={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:to,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:no,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:jt,label:"bpmn.gateway.variant.complex"}},xe=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,Gt.useRef)(null),a=(0,Gt.useRef)(null),{t:s}=(0,Ye.useTranslation)(),{setDraggableNode:l}=vo(),{getEdges:c,getNodes:d}=(0,Pr.useReactFlow)(),{setIsDragging:p,mode:u}=k(),{dimensions:f}=Kl(i,r),{position:h}=Zl(e,r,f),[m,g]=(0,Gt.useState)(void 0),b=d(),x=c(),y=o==="SUBPROCESS",_=(0,Gt.useCallback)((R,V)=>{l({type:V.type,variant:V.variant,attribute:V.attribute,icon:V.icon}),V.icon&&g((0,J.jsx)(V.icon,{})),R.dataTransfer.effectAllowed="move",R.dataTransfer.setData("sourceId",e),a.current&&R.dataTransfer.setDragImage(a.current,10,10),setTimeout(()=>{p(!0)},100)},[e,l,p]),T=[{component:(0,J.jsx)(pr,{elementId:e})}],A=()=>u==="view"?[]:[{component:(0,J.jsx)(nn,{nodeId:e})},Ht.TASK,Ht.ANNOTATION,...T],N=()=>u==="view"?[{component:(0,J.jsx)(gt,{elementId:e})}]:[{component:(0,J.jsx)(gt,{elementId:e})},...y?[]:[{component:(0,J.jsx)(Ql,{nodeId:e})}],{component:(0,J.jsx)(nn,{nodeId:e})},Ht.TASK,...Object.values(pm),...T],I=()=>u==="view"?[{component:(0,J.jsx)(gt,{elementId:e})}]:[{component:(0,J.jsx)(gt,{elementId:e})},{component:(0,J.jsx)(nn,{nodeId:e})},Ht.TASK,Ht.ANNOTATION,...T],L=()=>u==="view"?[]:[{component:(0,J.jsx)(nn,{nodeId:e})},Ht.ANNOTATION,...T],w=()=>u==="view"?[]:[...n?[]:[Ht.ANNOTATION],...T],C=()=>u==="view"?[]:[...T],M=()=>u==="view"?[]:[...T],H=(R=>{switch(R){case"START_EVENT":return A();case"TASK":return N();case"GATEWAY":return I();case"END_EVENT":return L();case"LANE":return w();case"ANNOTATION":return C();case"UNSUPPORTED":return M();default:return[]}})(t);if(!(H.length===0||u==="readonly"))return(0,J.jsxs)(Pr.NodeToolbar,{position:h,align:"start",className:"-top-8",isVisible:r,children:[(0,J.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:H.map((R,V)=>{if(R.component)return(0,J.jsx)("div",{children:R.component},V);let ee={sourceNodeType:t,targetNodeType:R.type,sourceNodeId:e,nodes:b,edges:x},Y=bl(ee),G={gateway_limit_reached:s("editor.toolbar.gateway_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")},F=Y.shouldDisable&&Y.reason?G[Y.reason]||s(R.label):s(R.label)||"";return(0,J.jsxs)(Ye.Tooltip,{children:[(0,J.jsx)(Ye.TooltipTrigger,{asChild:!0,children:(0,J.jsx)(Ye.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!Y.shouldDisable,disabled:Y.shouldDisable,className:Y.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:Y.shouldDisable?void 0:W=>_(W,R),children:R.icon&&(0,J.jsx)(R.icon,{size:16})})}),(0,J.jsx)(Ye.TooltipContent,{color:"black",children:F})]},V)})}),(0,J.jsx)("div",{ref:a,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:m})]})};var Bt=require("react/jsx-runtime"),jl=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,No.useReactFlow)(),{inProgress:i,fromNode:a}=(0,No.useConnection)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=k(),p=i&&(a==null?void 0:a.id)!==e,u=h=>{r(e,{label:h})},f=!l&&!c&&!d;return(0,Bt.jsxs)("div",{className:P("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,Bt.jsx)(le,{value:t.label,className:"m-1 text-grey-600",onChange:u}),f&&(0,Bt.jsx)(xe,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),s==="edit"&&(0,Bt.jsx)(To,{minWidth:Ar.MIN_WIDTH,minHeight:Ar.MIN_HEIGHT,isVisible:!n&&o}),(!i||p)&&(0,Bt.jsx)(se,{type:"target",position:No.Position.Left,className:P({"annotation-handle":p})})]})};var zt=require("@xyflow/react"),ec=require("react");var tt=require("react/jsx-runtime"),tc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,zt.useReactFlow)(),{inProgress:i,fromNode:a}=(0,zt.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c}=k(),[d,p]=(0,ec.useState)(!1),u=i&&(a==null?void 0:a.id)!==e,f=b=>{r(e,{label:b})},h=()=>{p(!0)},m=()=>{p(!1)},g=!s&&!l&&!c;return(0,tt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,tt.jsx)(Qt,{className:P("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,tt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,tt.jsx)(le,{value:t.label,isEditing:d,onChange:f})}),g&&(0,tt.jsx)(xe,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||u)&&(0,tt.jsx)(se,{type:"target",position:zt.Position.Left,className:P({"event-handle":u})}),!i&&(0,tt.jsx)(se,{type:"source",position:zt.Position.Right})]})};var Ft=require("@xyflow/react"),Lr=require("react");var ot=require("react/jsx-runtime"),oc=({id:e,data:t,selected:o,dragging:n})=>{let r=oi[t.variant].icon,{updateNodeData:i}=(0,Ft.useReactFlow)(),{inProgress:a,fromNode:s}=(0,Ft.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d}=k(),[p,u]=(0,Lr.useState)(!1),f=a&&(s==null?void 0:s.id)!==e,h=(0,Lr.useCallback)(x=>{i(e,{label:x})},[e,i]),m=()=>{u(!0)},g=()=>{u(!1)},b=!l&&!c&&!d;return(0,ot.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:m,children:[(0,ot.jsx)(r,{className:P("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,ot.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ot.jsx)(le,{value:t.label,isEditing:p,onChange:h})}),b&&(0,ot.jsx)(xe,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!a||f)&&(0,ot.jsx)(se,{type:"target",position:Ft.Position.Left,className:P({"gateway-handle":f})}),!a&&(0,ot.jsx)(Ir,{type:"source",position:Ft.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var nc=require("@xyflow/react"),Oe=require("lecom-ui"),fm=require("lucide-react");var rc=require("react/jsx-runtime");var Wt=require("@xyflow/react"),ic=require("react");var nt=require("react/jsx-runtime"),sc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Wt.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Wt.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:c}=k(),[d,p]=(0,ic.useState)(!1),u=i&&(a==null?void 0:a.id)!==e,f=b=>{r(e,{label:b})},h=()=>{p(!0)},m=()=>{p(!1)},g=!s&&!l&&!c;return(0,nt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,nt.jsx)(Pn,{className:P("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,nt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,nt.jsx)(le,{value:t.label,isEditing:d,onChange:f})}),g&&(0,nt.jsx)(xe,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||u)&&(0,nt.jsx)(se,{type:"target",position:Wt.Position.Left,className:P({"event-handle":u})}),!i&&(0,nt.jsx)(se,{type:"source",position:Wt.Position.Right})]})};var Ut=require("@xyflow/react"),dc=require("lecom-ui"),uc=require("react");var kr=(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}`},wo=(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 un=require("react/jsx-runtime"),ac=e=>(0,un.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,un.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,un.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var wi=require("react/jsx-runtime"),lc=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 pn=require("react/jsx-runtime"),cc=e=>(0,pn.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,pn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,pn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var fe=require("react/jsx-runtime"),mm={APROVADO:ac,EM_ANDAMENTO:lc,REJEITADO:cc},Ai={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)]"},pc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,dc.useTranslation)(),{updateNodeData:i,getNodes:a}=(0,Ut.useReactFlow)(),{inProgress:s,fromNode:l}=(0,Ut.useConnection)(),{mode:c,isConnecting:d,isDragging:p,isMultipleSelection:u,onSubprocessValidationClick:f}=k(),{getTaskStatus:h}=At(),m=s&&(l==null?void 0:l.id)!==e,g=(0,uc.useCallback)(C=>{let M=C.trim(),S=t.label||"";if(M===S)return;let H=a(),R=M;M||(R=kr(H,r("bpmn.task.label.prefix")));let V=wo(R,H);V!==S&&i(e,{label:V})},[t.label,a,e,r,i]),b=h(e),x=b?mm[b]:null,y=t.variant?Ln[t.variant].icon:null,_=t.attribute?kn[t.attribute].icon:null,T=t.variant==="SUBPROCESS",A=y&&!T,N=_||T,I=()=>t.hasError?Ai.error:b?Ai[b]:Ai.default,L=()=>{f==null||f({id:e,type:"sub_process",label:t.label})},w=!d&&!p&&!u;return(0,fe.jsxs)("div",{className:P("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,fe.jsx)(le,{value:t.label,maxLength:60,className:P("m-1",{"py-6":A||N}),onChange:g}),y&&(0,fe.jsx)("div",{className:P("absolute flex items-center p-1",T?"bottom-0":"top-0 left-0"),children:(0,fe.jsx)(y,{size:16,className:P(t.hasError?"text-red-500":"text-grey-500",T&&"cursor-pointer"),onClick:T?L:void 0})}),_&&(0,fe.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,fe.jsx)("div",{className:P("flex items-center w-16 p-1",T?"justify-between":"justify-center"),children:(0,fe.jsx)(_,{size:16,className:P(t.hasError?"text-red-500":"text-grey-500")})})}),x&&(0,fe.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,fe.jsx)(x,{})}),w&&(0,fe.jsx)(xe,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),c==="edit"&&(0,fe.jsx)(To,{minWidth:Nr.MIN_WIDTH,minHeight:Nr.MIN_HEIGHT,isVisible:!n&&o}),(!s||m)&&(0,fe.jsx)(se,{type:"target",position:Ut.Position.Left,className:P({"task-handle":m})}),!s&&(0,fe.jsx)(Ir,{type:"source",position:Ut.Position.Right,nodeId:e,nodeType:"TASK"})]})};var Ii=require("@xyflow/react");var rt=require("react/jsx-runtime"),fc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:a}=k(),s=!r&&!i&&!a;return(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.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,rt.jsx)(xe,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,rt.jsx)(se,{type:"source",position:Ii.Position.Right}),(0,rt.jsx)(se,{type:"target",position:Ii.Position.Left})]})};var me=require("@xyflow/react"),mc=require("react");var xt=require("react/jsx-runtime"),Kv={type:"MESSAGE_EDGE",markerEnd:{type:me.MarkerType.Arrow},data:{label:""}},gc=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,me.useViewport)(),{updateEdgeData:a}=(0,me.useReactFlow)(),{isMultipleSelection:s}=k(),[l,c]=(0,mc.useState)(!1),d=(0,me.useInternalNode)(t),p=(0,me.useInternalNode)(o);if(!d||!p)return null;let{sx:u,sy:f,tx:h,ty:m,sourcePos:g,targetPos:b}=ft(d,p),[x,y,_]=(0,me.getSmoothStepPath)({sourceX:u,sourceY:f,targetX:h,targetY:m,sourcePosition:g,targetPosition:b}),T=r||(d==null?void 0:d.selected)||(p==null?void 0:p.selected),A=T?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=l||(n==null?void 0:n.label.trim().length)>0,I=1/i,L=()=>{c(!0)},w=()=>{c(!1)},C=M=>{a(e,{label:M.trim()})};return(0,xt.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":T}),onBlur:w,onDoubleClick:L,children:[(0,xt.jsx)(me.BaseEdge,{id:e,path:x,markerEnd:`url(#${A})`,strokeDasharray:4,className:P("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)]":T&&!(n!=null&&n.hasError)})}),(0,xt.jsx)(me.EdgeLabelRenderer,{children:(0,xt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${_}px)`},children:[r&&!s&&(0,xt.jsx)(ho,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${I})`}}),N&&(0,xt.jsx)(le,{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 hc=require("@xyflow/react"),fn=require("react/jsx-runtime"),yc=({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:p}=ft(r,i),[u]=(0,hc.getBezierPath)({sourceX:a,sourceY:s,sourcePosition:d||o,targetPosition:p||n,targetX:l||e,targetY:c||t});return(0,fn.jsxs)("g",{children:[(0,fn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:u}),(0,fn.jsx)("circle",{cx:l||e,cy:c||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Dr=require("@xyflow/react"),xc=require("lodash"),mn=require("react");var ve=require("react/jsx-runtime"),Ec=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,Dr.useReactFlow)(),{mode:s,isConnecting:l,isDragging:c,isMultipleSelection:d}=k(),[p,u]=(0,mn.useState)(!1),f=a(),h=!r,m=(0,mn.useMemo)(()=>(0,xc.orderBy)([...f.filter(A=>A.parentId===e&&A.type==="LANE")],"position.y","asc"),[f,e]),g=h?wr.MIN_WIDTH:Z.MIN_WIDTH,b=(0,mn.useMemo)(()=>{if(h&&m.length>1){let A=[...m];return A.pop(),A.reduce((I,L)=>{var w,C;return I+((C=(w=L.measured)==null?void 0:w.height)!=null?C:0)},0)+Z.MIN_HEIGHT}return Z.MIN_HEIGHT},[h,m]),x=A=>{i(e,{label:A})},y=()=>{u(!0)},_=()=>{u(!1)},T=!l&&!c&&!d;return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsxs)("div",{className:P("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,ve.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:_,onDoubleClick:y,children:(0,ve.jsx)("div",{className:P("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!p}),children:(0,ve.jsx)(le,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:P({"whitespace-nowrap":p}),isEditing:p,onChange:x})})}),(0,ve.jsx)("div",{className:"flex-1"})]}),T&&(0,ve.jsx)(xe,{nodeId:e,nodeType:"LANE",isChild:!h,isVisible:!n&&o}),s==="edit"&&(0,ve.jsx)(To,{nodeId:e,minWidth:g,minHeight:b,isVisible:!n&&o}),h&&(0,ve.jsx)(se,{type:"source",position:Dr.Position.Right})]})};var _c={START_EVENT:sc,END_EVENT:tc,TASK:pc,GATEWAY:oc,ANNOTATION:jl,LANE:Ec,UNSUPPORTED:fc},bc={SEQUENCE_EDGE:yl,MESSAGE_EDGE:gc,ANNOTATION_EDGE:hl},Tc="#fafafa",vc="#bebebe",Nc=1,wc=10,Ac="bottom-left",Ic=.2,Cc=5,Ao=.5,Sc={x:0,y:0,zoom:.75},gm=1,hm=2,Mc=[gm,hm];var Io=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,Pc.useReactFlow)(),i=(0,Ci.useCallback)(async(s="")=>{let{nodes:l,edges:c}=await Ul(s);o(l),n(c),r({padding:Ao})},[o,n,r]),a=(0,Ci.useCallback)((s,l)=>{let c=s||e()||[],d=l||t()||[];return Wl(c,d)},[e,t]);return{importFromMxGraph:i,exportToMxGraph:a}};var Si=require("react"),ym=500,Co=()=>{let{isInitialized:e,onElementChanges:t}=k(),{exportToMxGraph:o}=Io(),n=(0,Lc.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},ym),r=(0,Si.useCallback)(a=>{a.some(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Si.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var kc=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,Rr.useReactFlow)(),{emitElementChanges:r}=Co(),i=(0,Mi.useCallback)(s=>{let l=t(s.source),c=t(s.target);if(!l||!c)return!1;let d={sourceNodeId:l.id,targetNodeId:c.id,sourceNodeType:l.type,targetNodeType:c.type,nodes:n(),edges:o()};return _l(d).isValid},[t,o,n]),a=(0,Mi.useCallback)(s=>{e(l=>{let c=t(s.target),d=(c==null?void 0:c.type)==="ANNOTATION"?yo:Ve;return(0,Rr.addEdge)(E(E({},s),d),l)}),r()},[t,e,r]);return{isValidConnection:i,onConnect:a}};var Fc=require("@xyflow/react"),Wc=require("lecom-ui"),$t=require("react");var gn=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Yt=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Et=(e=[])=>e.filter(t=>t.type==="TASK")||[],Dc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Rc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Vr=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Vc=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),Ne=(e,t=[])=>t.filter(o=>o.source===e),hn=(e,t=[])=>t.filter(o=>o.target===e),Oc=(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"},Hc=(e,t)=>{let o=Ne(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},Gc=e=>e?/\w/g.test(e.trim()):!1,U=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:[]}},$e=(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)}},Bc=(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 yn=[{id:"start_event_not_found",validate:e=>{let t=gn(e.nodes);return U({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Yt(e.nodes);return U({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=gn(e.nodes),o=t.length===1;if(t.length===0)return U({isValid:!0});if(!o)return U({isValid:!1,nodeIds:t.map(i=>i.id)});let n=Ne(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return U({isValid:!1,nodeIds:[...new Set(i)]})}return U({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Et(e.nodes),o=$e(t,n=>Ne(n.id,e.edges).length<=2);return U({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Et(e.nodes),o=$e(t,n=>!!n.label&&n.label.trim()!=="");return U({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Et(e.nodes),n=$e(o,r=>!r.label||r.label.length<=60);return U({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Et(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 U({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Vr(e.nodes),o=[],n=[];for(let r of t){let i=Ne(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 U({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...gn(e.nodes),...Yt(e.nodes)],o=[],n=[];for(let r of t){let i=Ne(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 U({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Yt(e.nodes),o=[],n=[];for(let r of t){let i=hn(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=Ne(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return U({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Vc(e.nodes),o=$e(t,r=>Ne(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>Ne(r,e.edges).map(i=>i.id));return U({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=Et(e.nodes),o=$e(t,n=>!n.label||Gc(n.label));return U({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 U({isValid:!0});let t=Yt(e.nodes)[0];if(!t)return U({isValid:!0});let o=hn(t.id,e.edges);if(!o.length)return U({isValid:!0});let r=Et(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=$e(r,l=>!Oc(l.id,e));return U({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Et(e.nodes),o=Yt(e.nodes)[0];if(!o)return U({isValid:!0});let n=t.filter(l=>{let c=hn(l.id,e.edges),d=Ne(l.id,e.edges),p=c.some(f=>{var h;return((h=e.nodes.find(m=>m.id===f.source))==null?void 0:h.type)==="START_EVENT"}),u=d.some(f=>{var h;return((h=e.nodes.find(m=>m.id===f.target))==null?void 0:h.type)==="END_EVENT"});return p&&u}),r=hn(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 U(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=Vr(e.nodes),o=[],n=[];for(let r of t){let i=Ne(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 U({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Vr(e.nodes),o=$e(t,n=>Ne(n.id,e.edges).length>=1);return U({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...gn(e.nodes),...Yt(e.nodes)],o=[],n=[];for(let r of t){let i=Ne(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 U({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Dc(e.nodes),o=$e(t,n=>!Hc(n.id,e));return U({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Rc(e.nodes),o=$e(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 U({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 yn){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 Uc=()=>{let{t:e}=(0,Wc.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,Fc.useReactFlow)(),[i,a]=(0,$t.useState)(null),[s,l]=(0,$t.useState)(!1),c=(0,$t.useCallback)(u=>{let f=Bc(u.nodes,u.edges),h=zc(f),m=h.errors.map(g=>v(E({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:h.isValid,errors:m}},[s,e]),d=(0,$t.useCallback)(u=>{if(a(u),!u)return;let f=[],h=[];u.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(I=>f.push(I)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(I=>h.push(I))});let m=[...new Set(f)];t(N=>N.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:!1})}))),o(N=>N.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:!1})})));let g=n(),b=r(),x=new Set(m),y=new Set;u.errors.forEach(N=>{var w,C;let I=yn.find(M=>M.id===N.id);(I==null?void 0:I.highlightRelatedEdges)!==!1&&((w=N.edgeIds)==null||w.forEach(M=>y.add(M)),(C=N.nodeIds)==null||C.forEach(M=>{b.forEach(S=>{(S.source===M||S.target===M)&&y.add(S.id)})}))});let _=new Set,T=new Set,A=new Set;g.forEach(N=>{N.type==="START_EVENT"?_.add(N.id):N.type==="END_EVENT"&&T.add(N.id)}),b.forEach(N=>{_.has(N.source)&&A.add(N.target),T.has(N.target)&&A.add(N.source)}),A.forEach(N=>{var I,L;if(x.has(N)){let w=(I=u.errors.find(M=>{var S;return(S=M.nodeIds)==null?void 0:S.includes(N)}))==null?void 0:I.id;((L=yn.find(M=>M.id===w))==null?void 0:L.highlightRelatedEdges)!==!1&&b.forEach(M=>{M.source===N&&T.has(M.target)&&(x.add(M.target),y.add(M.id)),M.target===N&&_.has(M.source)&&(x.add(M.source),y.add(M.id))})}}),x.size>0&&t(N=>N.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:x.has(I.id)})}))),y.size>0&&o(N=>N.map(I=>v(E({},I),{data:v(E({},I.data),{hasError:y.has(I.id)})})))},[r,n,o,t]),p=(0,$t.useCallback)(()=>{a(null),l(!1),t(u=>u.map(f=>v(E({},f),{data:v(E({},f.data),{hasError:!1})}))),o(u=>u.map(f=>v(E({},f),{data:v(E({},f.data),{hasError:!1})})))},[o,t]);return{validationResult:i,validateDiagram:c,handleValidationComplete:d,clearValidation:p,isAutoValidationEnabled:s}};var Xc=require("@xyflow/react"),Kc=require("lecom-ui"),qc=require("react"),Pi=require("uuid");var xm=15,Yc="bpmn:selection",Em=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},$c=e=>{if(!Em(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},Zc=({offset:e=xm}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,Xc.useReactFlow)(),{t:i}=(0,Kc.useTranslation)();(0,qc.useEffect)(()=>{let a=l=>{var m,g;if(!$c(l))return;let c=t(),d=n(),p=c.filter(b=>b.selected);if(!p.length)return;l.preventDefault(),l.stopPropagation();let u=d.filter(b=>p.some(x=>x.id===b.source)&&p.some(x=>x.id===b.target)),h=JSON.stringify({nodes:p,edges:u});(m=l.clipboardData)==null||m.setData(Yc,h),(g=l.clipboardData)==null||g.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},s=l=>{var y,_;if(!$c(l))return;let c=(y=l.clipboardData)==null?void 0:y.getData(Yc);if(!c)return;l.preventDefault(),l.stopPropagation();let d;try{d=JSON.parse(c)}catch(T){return}if(!((_=d.nodes)!=null&&_.length))return;let p=new Map,u=t(),f=[],h=u.some(T=>T.type==="START_EVENT"),m=d.nodes.filter(T=>T.type==="START_EVENT"),g=d.nodes;if(h&&m.length>0&&(g=d.nodes.filter(T=>T.type!=="START_EVENT"),g.length===0))return;let b=g.map(T=>{var I;let A=(0,Pi.v7)();p.set(T.id,A);let N=v(E({},T),{id:A,selected:!0,position:{x:T.position.x+e,y:T.position.y+e}});if(T.type==="TASK"){let L=(I=T.data)==null?void 0:I.label,w=wo(L||i("bpmn.task.label.prefix"),[...u,...f]);N.data=v(E({},T.data),{label:w})}return f.push(N),N}),x=d.edges.map(T=>v(E({},T),{id:(0,Pi.v7)(),selected:!0,source:p.get(T.source)||T.source,target:p.get(T.target)||T.target}));o(T=>[...T.map(A=>v(E({},A),{selected:!1})),...b]),r(T=>[...T.map(A=>v(E({},A),{selected:!1})),...x])};return document.addEventListener("copy",a,!0),document.addEventListener("paste",s,!0),()=>{document.removeEventListener("copy",a,!0),document.removeEventListener("paste",s,!0)}},[t,o,n,r,e,i])};var Or=require("@xyflow/react");var Jc=require("lecom-ui"),Qc=require("react"),Li=require("uuid");var jc=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,Or.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=vo(),{t:a}=(0,Jc.useTranslation)(),{getInternalNode:s,screenToFlowPosition:l}=(0,Or.useReactFlow)(),{setIsDragging:c}=k(),{rebuildIndex:d,forceRebuildIndex:p}=fo(),[u,f]=(0,Qc.useState)(null),h=(w,C=!1)=>{let M=C?"[&>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(S=>S.map(H=>v(E({},H),{className:H.id===w?M:""})))},m=()=>{let{nodeLookup:w}=n.getState();return Array.from(w.values())},g=w=>{let C=s(w.id),M=m();if(w.type==="LANE"){if(bo({parentId:w.id,nodes:e,includeTypes:["LANE"]})){h();return}let Y=M.filter(W=>W.id!==w.id&&W.type==="LANE"&&!W.parentId),G=ln(C,Y);if(!G){h();return}if(bo({parentId:G.id,nodes:e,excludeTypes:["LANE"]})){h(G.id,!0);return}h(G.id);return}let H=M.filter(ee=>ee.id!==w.id&&ee.type==="LANE"),R=ln(C,H);if(!R){h();return}if(bo({parentId:R.id,nodes:e,includeTypes:["LANE"]})){h();return}h(R.id)},b=w=>w.map(C=>v(E({},C),{className:void 0})),x=w=>w.some(M=>M.dragging)?w.map(M=>M.dragging?v(E({},M),{dragging:!1}):M):w,y=w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},_=(w,C)=>{w.preventDefault(),g(C)},T=(w,C,M)=>{var ee,Y;let S=[...M];if(w.parentId===C.id)return S=Bl(w,C,S),S=cn(S),b(S);if(w.type==="LANE"){if(bo({parentId:C.id,nodes:S,excludeTypes:["LANE"]})){let ae=be(C),it=50,Zt=50;return S.map(Ge=>{var Jt,Oo;return Ge.id===w.id?v(E({},Ge),{position:{x:(Jt=u==null?void 0:u.x)!=null?Jt:ae.x+it,y:(Oo=u==null?void 0:u.y)!=null?Oo:ae.y2+Zt}}):Ge})}let W=S.filter(ae=>ae.parentId===C.id).reduce((ae,it)=>{var Zt,Ge;return ae+((Ge=(Zt=it.measured)==null?void 0:Zt.height)!=null?Ge:0)},0),Ie={x:Z.HEADER_WIDTH,y:W};return S=S.map(ae=>ae.id===w.id?v(E({},ae),{parentId:C.id,position:Ie,className:void 0}):v(E({},ae),{className:void 0})),S=Ot(C.id,S),S}if(bo({parentId:C.id,nodes:S,includeTypes:["LANE"]})){let G;if(w.parentId){let F=s(w.parentId),{x:W,y:Ie}=je(F);G={x:W+((ee=w.position.x)!=null?ee:0),y:Ie+((Y=w.position.y)!=null?Y:0)}}return S=S.map(F=>F.id===w.id?v(E({},F),{position:G!=null?G:F.position,parentId:void 0,className:void 0}):v(E({},F),{className:void 0})),S}let V=Rl(w,C);return S=S.map(G=>{if(G.id===w.id){let F=be(w),W=be(C);return F.y<W.y&&(V.y=0),F.x<W.x+Z.HEADER_WIDTH&&(V.x=Z.HEADER_WIDTH),v(E({},G),{parentId:C.id,position:V,className:void 0})}return v(E({},G),{className:void 0})}),S=cn(S),S},A=w=>{if(w.preventDefault(),!(r!=null&&r.type))return;let C=l({x:w.clientX,y:w.clientY}),M={width:O[r.type].MIN_WIDTH,height:O[r.type].MIN_HEIGHT},S={id:(0,Li.v7)(),type:r.type,position:C,measured:M,data:{label:r.type==="TASK"?kr(e,a("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},H=v(E({},S),{internals:{positionAbsolute:C}}),R=m(),V=r.type==="LANE",ee=R.filter(W=>V?W.type==="LANE"&&!W.parentId:W.type==="LANE"),Y=ln(H,ee),G=[...e.map(W=>v(E({},W),{selected:!1})),S];Y&&(G=T(H,Y,G)),G=et(G),t(G),p();let F=w.dataTransfer.getData("sourceId");if(F){let W={id:(0,Li.v7)(),source:F,target:S.id};if(r.type==="ANNOTATION"){o(Ie=>Ie.concat(E(E({},W),yo)));return}o(Ie=>Ie.concat(E(E({},W),Ve)))}c(!1),i(null)},N=async(w,C,M)=>{let S=[...e];M.forEach(H=>{let R=m(),V=s(H.id),ee=H.type==="LANE",Y=R.filter(F=>F.id!==H.id&&(ee?F.type==="LANE"&&!F.parentId:F.type==="LANE")),G=ln(V,Y);if(G){S=T(V,G,S);return}H.parentId&&(S=L(H,S))}),S=x(S),S=et(S),S=b(S),t(S),d(S),f(null)},I=(w,C)=>{f({x:C.position.x,y:C.position.y})},L=(w,C)=>{var V,ee;let M=s(w.parentId),{x:S,y:H}=je(M),R={x:S+((V=w.position.x)!=null?V:0),y:H+((ee=w.position.y)!=null?ee:0)};return C=C.map(Y=>Y.id===w.id?v(E({},Y),{position:R,parentId:void 0}):Y),C=Ot(w.parentId,C),C};return{onDragOver:y,onDrop:A,onNodeDrag:_,onNodeDragStart:I,onNodeDragStop:N}};var ed=require("@xyflow/react"),td=require("lecom-ui"),od=require("react"),ki=require("uuid");var _m=30,bm=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},Tm=e=>!bm(e.target),nd=({offset:e=_m}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,ed.useReactFlow)(),{t:i}=(0,td.useTranslation)();(0,od.useEffect)(()=>{let a=s=>{if(s.ctrlKey&&s.key.toLowerCase()==="d"&&Tm(s)){s.preventDefault(),s.stopPropagation();let l=t(),c=n(),d=l.filter(y=>y.selected);if(!d.length)return;let p=new Map,u=[],f=l.some(y=>y.type==="START_EVENT"),h=d.filter(y=>y.type==="START_EVENT"),m=d;if(f&&h.length>0&&(m=d.filter(y=>y.type!=="START_EVENT"),m.length===0))return;let g=c.filter(y=>m.some(_=>_.id===y.source)&&m.some(_=>_.id===y.target)),b=m.map(y=>{var A;let _=(0,ki.v7)();p.set(y.id,_);let T=v(E({},y),{id:_,selected:!0,position:{x:y.position.x+e,y:y.position.y+e}});if(y.type==="TASK"){let N=(A=y.data)==null?void 0:A.label,I=wo(N||i("bpmn.task.label.prefix"),[...l,...u]);T.data=v(E({},y.data),{label:I})}return u.push(T),T}),x=g.map(y=>v(E({},y),{id:(0,ki.v7)(),selected:!0,source:p.get(y.source)||y.source,target:p.get(y.target)||y.target}));o(y=>[...y.map(_=>v(E({},_),{selected:!1})),...b]),r(y=>[...y.map(_=>v(E({},_),{selected:!1})),...x])}};return document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("keydown",a,!0)}},[t,o,n,r,e,i])};var ld=require("@xyflow/react"),xn=require("uuid");var id={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},sd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},rd=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a||(a="task",s=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},vm=e=>{e=e||"";let t=e.trim().split(`
|
|
3
|
-
`),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
|
|
4
|
-
`),i=encodeURI(r);
|
|
1
|
+
"use strict";var Nu=Object.create;var zo=Object.defineProperty,wu=Object.defineProperties,Au=Object.getOwnPropertyDescriptor,Iu=Object.getOwnPropertyDescriptors,Cu=Object.getOwnPropertyNames,An=Object.getOwnPropertySymbols,Su=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty,os=Object.prototype.propertyIsEnumerable;var ts=(e,t,o)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))ni.call(t,o)&&ts(e,o,t[o]);if(An)for(var o of An(t))os.call(t,o)&&ts(e,o,t[o]);return e},N=(e,t)=>wu(e,Iu(t));var We=(e,t)=>{var o={};for(var n in e)ni.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&An)for(var n of An(e))t.indexOf(n)<0&&os.call(e,n)&&(o[n]=e[n]);return o};var Mu=(e,t)=>{for(var o in t)zo(e,o,{get:t[o],enumerable:!0})},ns=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Cu(t))!ni.call(e,r)&&r!==o&&zo(e,r,{get:()=>t[r],enumerable:!(n=Au(t,r))||n.enumerable});return e};var Pu=(e,t,o)=>(o=e!=null?Nu(Su(e)):{},ns(t||!e||!e.__esModule?zo(o,"default",{value:e,enumerable:!0}):o,e)),Lu=e=>ns(zo({},"__esModule",{value:!0}),e);var eg={};Mu(eg,{EditorMode:()=>we,ElementPosition:()=>Cn,ElementType:()=>Fo,GatewayElementVariant:()=>Sn,GatewayVariant:()=>De,Modeler:()=>Eu,ModelerProvider:()=>hu,NodeAttribute:()=>je,NodeType:()=>H,NodeVariant:()=>Le,RoutingVariant:()=>Mn,useModeler:()=>ei});module.exports=Lu(eg);var ri=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 In=require("lecom-ui");var rs={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 is={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 ss={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 as={pt_BR:ss,en_US:rs,es_ES:is};var ls,cs,Du=(cs=(ls=ri("LecomUserLanguage"))!=null?ls:ri("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?cs:In.Translations.PT_BR;(0,In.initializeI18n)({lng:Du,resources:as});var we=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(we||{});var Fo=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Fo||{}),Cn=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Cn||{}),Sn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Sn||{}),Mn=(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))(Mn||{});var lo=require("lucide-react");var At=require("react/jsx-runtime"),Pn=({size:e=24,className:t})=>(0,At.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,At.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,At.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,At.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,At.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var ii=require("react/jsx-runtime"),eo=({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:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,ii.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var dt=require("react/jsx-runtime"),to=({size:e=24,className:t})=>(0,dt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,dt.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,dt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,dt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,dt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,dt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var oo=require("react/jsx-runtime"),no=({size:e=24,className:t})=>(0,oo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,oo.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,oo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oo.jsx)("path",{d:"M9.17139 9.17188L14.8282 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:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ro.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var so=require("react/jsx-runtime"),ds=({size:e=24,className:t})=>(0,so.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,so.jsxs)("g",{children:[(0,so.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,so.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var us=require("clsx"),ps=require("tailwind-merge");function D(...e){return(0,ps.twMerge)((0,us.clsx)(e))}var ut=(e=0,t=0)=>e<t?t:e,Ln=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Wo=require("react/jsx-runtime"),fs=({size:e=24,className:t})=>(0,Wo.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,Wo.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,Wo.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Dn=require("react/jsx-runtime"),ms=({size:e=24,className:t})=>(0,Dn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Dn.jsx)("g",{children:(0,Dn.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 si=require("react/jsx-runtime"),kn=({size:e=24,className:t})=>(0,si.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,si.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 ai=require("react/jsx-runtime"),Yo=({size:e=24,className:t})=>(0,ai.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,ai.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 ao=require("react/jsx-runtime"),gs=({size:e=24,className:t})=>(0,ao.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,ao.jsx)("path",{d:"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,ao.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,ao.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var pt=require("react/jsx-runtime"),hs=({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:"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,pt.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,pt.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,pt.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,pt.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var It=require("react/jsx-runtime"),ys=({size:e=24,className:t})=>(0,It.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,It.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,It.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,It.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,It.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var H=(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))(H||{}),Le=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(Le||{}),Rn={SCRIPT:{icon:lo.ScrollText},SUBPROCESS:{icon:lo.SquarePlus}},je=(t=>(t.LOOP="LOOP",t))(je||{}),Vn={LOOP:{icon:lo.RotateCcw}},De=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(De||{}),li={EXCLUSIVE:{icon:no},PARALLEL:{icon:io},COMPLEX:{icon:to}};var yu=require("@xyflow/react"),te=require("react");var Nt=require("@xyflow/react"),Jr=require("react");var Tt=require("@xyflow/react"),Me=require("react"),Pd=require("use-debounce");var xs=require("zustand"),Es=require("@xyflow/react"),bs=require("react");var On=()=>{let{setEdges:e}=(0,Es.useReactFlow)();return(0,bs.useCallback)(()=>{let o=Ct.getState().pathEdgeIds;e(n=>n.map(r=>N(E({},r),{selected:o.includes(r.id)})))},[e])},Ct=(0,xs.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=E({},n.statusByNodeId),i=E({},n.statusData),s=!1;return o.forEach(a=>{let l=`${a.diagramId}-${a.activityId}`;r[a.diagramId]!==a.status&&(r[a.diagramId]=a.status,i[l]=a,s=!0)}),s?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],s={};o.forEach(d=>{s[d.source]||(s[d.source]=[]),s[d.source].push({targetId:d.target,edgeId:d.id})});let a=r[0],l=r[r.length-1];o.forEach(d=>{d.target===a&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,p)=>{let u=[],f=new Set;for(u.push({node:d,path:[]}),f.add(d);u.length>0;){let{node:h,path:m}=u.shift();if(h===p)return m;let g=s[h]||[];for(let{targetId:_,edgeId:x}of g)f.has(_)||(f.add(_),u.push({node:_,path:[...m,x]}))}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 mo=require("@xyflow/react");var ku={value:()=>{}};function Ts(){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 Hn(o)}function Hn(e){this._=e}function Ru(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}})}Hn.prototype=Ts.prototype={constructor:Hn,on:function(e,t){var o=this._,n=Ru(e+"",o),r,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((r=(e=n[i]).type)&&(r=Vu(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]=_s(o[r],e.name,t);else if(t==null)for(r in o)o[r]=_s(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 Hn(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 Vu(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function _s(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=ku,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var ci=Ts;var Gn="http://www.w3.org/1999/xhtml",di={svg:"http://www.w3.org/2000/svg",xhtml:Gn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function et(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),di.hasOwnProperty(t)?{space:di[t],local:e}:e}function Ou(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Gn&&t.documentElement.namespaceURI===Gn?t.createElement(e):t.createElementNS(o,e)}}function Hu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bn(e){var t=et(e);return(t.local?Hu:Ou)(t)}function Gu(){}function St(e){return e==null?Gu:function(){return this.querySelector(e)}}function vs(e){typeof e!="function"&&(e=St(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new oe(n,this._parents)}function ui(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bu(){return[]}function Uo(e){return e==null?Bu:function(){return this.querySelectorAll(e)}}function zu(e){return function(){return ui(e.apply(this,arguments))}}function Ns(e){typeof e=="function"?e=zu(e):e=Uo(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),r.push(l));return new oe(n,r)}function $o(e){return function(){return this.matches(e)}}function zn(e){return function(t){return t.matches(e)}}var Fu=Array.prototype.find;function Wu(e){return function(){return Fu.call(this.children,e)}}function Yu(){return this.firstElementChild}function ws(e){return this.select(e==null?Yu:Wu(typeof e=="function"?e:zn(e)))}var Uu=Array.prototype.filter;function $u(){return Array.from(this.children)}function Xu(e){return function(){return Uu.call(this.children,e)}}function As(e){return this.selectAll(e==null?$u:Xu(typeof e=="function"?e:zn(e)))}function Is(e){typeof e!="function"&&(e=$o(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new oe(n,this._parents)}function Fn(e){return new Array(e.length)}function Cs(){return new oe(this._enter||this._groups.map(Fn),this._parents)}function Xo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xo.prototype={constructor:Xo,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 Ss(e){return function(){return e}}function Ku(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 Xo(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function qu(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 Xo(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function Zu(e){return e.__data__}function Ms(e,t){if(!arguments.length)return Array.from(this,Zu);var o=t?qu:Ku,n=this._parents,r=this._groups;typeof e!="function"&&(e=Ss(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=Ju(e.call(d,d&&d.__data__,c,n)),h=f.length,m=a[c]=new Array(h),g=s[c]=new Array(h),_=l[c]=new Array(u);o(d,p,m,g,_,f,t);for(var x=0,y=0,b,v;x<h;++x)if(b=m[x]){for(x>=y&&(y=x+1);!(v=g[y])&&++y<h;);b._next=v||null}}return s=new oe(s,n),s._enter=a,s._exit=l,s}function Ju(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ps(){return new oe(this._exit||this._groups.map(Fn),this._parents)}function Ls(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 Ds(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,h=0;h<p;++h)(f=c[h]||d[h])&&(u[h]=f);for(;l<r;++l)a[l]=o[l];return new oe(a,this._parents)}function ks(){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 Rs(e){e||(e=Qu);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 oe(r,this._parents).order()}function Qu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Vs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Os(){return Array.from(this)}function Hs(){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 Gs(){let e=0;for(let t of this)++e;return e}function Bs(){return!this.node()}function zs(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 ju(e){return function(){this.removeAttribute(e)}}function ep(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tp(e,t){return function(){this.setAttribute(e,t)}}function op(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function np(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function rp(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 Fs(e,t){var o=et(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?ep:ju:typeof t=="function"?o.local?rp:np:o.local?op:tp)(o,t))}function Wn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ip(e){return function(){this.style.removeProperty(e)}}function sp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ap(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Ws(e,t,o){return arguments.length>1?this.each((t==null?ip:typeof t=="function"?ap:sp)(e,t,o==null?"":o)):ft(this.node(),e)}function ft(e,t){return e.style.getPropertyValue(t)||Wn(e).getComputedStyle(e,null).getPropertyValue(t)}function lp(e){return function(){delete this[e]}}function cp(e,t){return function(){this[e]=t}}function dp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ys(e,t){return arguments.length>1?this.each((t==null?lp:typeof t=="function"?dp:cp)(e,t)):this.node()[e]}function Us(e){return e.trim().split(/^|\s+/)}function pi(e){return e.classList||new $s(e)}function $s(e){this._node=e,this._names=Us(e.getAttribute("class")||"")}$s.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 Xs(e,t){for(var o=pi(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Ks(e,t){for(var o=pi(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function up(e){return function(){Xs(this,e)}}function pp(e){return function(){Ks(this,e)}}function fp(e,t){return function(){(t.apply(this,arguments)?Xs:Ks)(this,e)}}function qs(e,t){var o=Us(e+"");if(arguments.length<2){for(var n=pi(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?fp:t?up:pp)(o,t))}function mp(){this.textContent=""}function gp(e){return function(){this.textContent=e}}function hp(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Zs(e){return arguments.length?this.each(e==null?mp:(typeof e=="function"?hp:gp)(e)):this.node().textContent}function yp(){this.innerHTML=""}function xp(e){return function(){this.innerHTML=e}}function Ep(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Js(e){return arguments.length?this.each(e==null?yp:(typeof e=="function"?Ep:xp)(e)):this.node().innerHTML}function bp(){this.nextSibling&&this.parentNode.appendChild(this)}function Qs(){return this.each(bp)}function _p(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function js(){return this.each(_p)}function ea(e){var t=typeof e=="function"?e:Bn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Tp(){return null}function ta(e,t){var o=typeof e=="function"?e:Bn(e),n=t==null?Tp:typeof t=="function"?t:St(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function vp(){var e=this.parentNode;e&&e.removeChild(this)}function oa(){return this.each(vp)}function Np(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function wp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function na(e){return this.select(e?wp:Np)}function ra(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ap(e){return function(t){e.call(this,t,this.__data__)}}function Ip(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 Cp(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 Sp(e,t,o){return function(){var n=this.__on,r,i=Ap(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 ia(e,t,o){var n=Ip(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?Sp:Cp,r=0;r<i;++r)this.each(a(n[r],t,o));return this}function sa(e,t,o){var n=Wn(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 Mp(e,t){return function(){return sa(this,e,t)}}function Pp(e,t){return function(){return sa(this,e,t.apply(this,arguments))}}function aa(e,t){return this.each((typeof t=="function"?Pp:Mp)(e,t))}function*la(){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 Lp=[null];function oe(e,t){this._groups=e,this._parents=t}function ca(){return new oe([[document.documentElement]],Lp)}function Dp(){return this}oe.prototype=ca.prototype={constructor:oe,select:vs,selectAll:Ns,selectChild:ws,selectChildren:As,filter:Is,data:Ms,enter:Cs,exit:Ps,join:Ls,merge:Ds,selection:Dp,order:ks,sort:Rs,call:Vs,nodes:Os,node:Hs,size:Gs,empty:Bs,each:zs,attr:Fs,style:Ws,property:Ys,classed:qs,text:Zs,html:Js,raise:Qs,lower:js,append:ea,insert:ta,remove:oa,clone:na,datum:ra,on:ia,dispatch:aa,[Symbol.iterator]:la};var tt=ca;function Yn(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function fi(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Zo(){}var Ko=.7,Xn=1/Ko,co="\\s*([+-]?\\d+)\\s*",qo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kp=/^#([0-9a-f]{3,8})$/,Rp=new RegExp(`^rgb\\(${co},${co},${co}\\)$`),Vp=new RegExp(`^rgb\\(${Ye},${Ye},${Ye}\\)$`),Op=new RegExp(`^rgba\\(${co},${co},${co},${qo}\\)$`),Hp=new RegExp(`^rgba\\(${Ye},${Ye},${Ye},${qo}\\)$`),Gp=new RegExp(`^hsl\\(${qo},${Ye},${Ye}\\)$`),Bp=new RegExp(`^hsla\\(${qo},${Ye},${Ye},${qo}\\)$`),da={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};Yn(Zo,mt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ua,formatHex:ua,formatHex8:zp,formatHsl:Fp,formatRgb:pa,toString:pa});function ua(){return this.rgb().formatHex()}function zp(){return this.rgb().formatHex8()}function Fp(){return xa(this).formatHsl()}function pa(){return this.rgb().formatRgb()}function mt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=kp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?fa(t):o===3?new Ee(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Un(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Un(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=Rp.exec(e))?new Ee(t[1],t[2],t[3],1):(t=Vp.exec(e))?new Ee(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Op.exec(e))?Un(t[1],t[2],t[3],t[4]):(t=Hp.exec(e))?Un(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Gp.exec(e))?ha(t[1],t[2]/100,t[3]/100,1):(t=Bp.exec(e))?ha(t[1],t[2]/100,t[3]/100,t[4]):da.hasOwnProperty(e)?fa(da[e]):e==="transparent"?new Ee(NaN,NaN,NaN,0):null}function fa(e){return new Ee(e>>16&255,e>>8&255,e&255,1)}function Un(e,t,o,n){return n<=0&&(e=t=o=NaN),new Ee(e,t,o,n)}function Wp(e){return e instanceof Zo||(e=mt(e)),e?(e=e.rgb(),new Ee(e.r,e.g,e.b,e.opacity)):new Ee}function uo(e,t,o,n){return arguments.length===1?Wp(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}Yn(Ee,uo,fi(Zo,{brighter(e){return e=e==null?Xn:Math.pow(Xn,e),new Ee(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,e),new Ee(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ee(Pt(this.r),Pt(this.g),Pt(this.b),Kn(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:ma,formatHex:ma,formatHex8:Yp,formatRgb:ga,toString:ga}));function ma(){return`#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}`}function Yp(){return`#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}${Mt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ga(){let e=Kn(this.opacity);return`${e===1?"rgb(":"rgba("}${Pt(this.r)}, ${Pt(this.g)}, ${Pt(this.b)}${e===1?")":`, ${e})`}`}function Kn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mt(e){return e=Pt(e),(e<16?"0":"")+e.toString(16)}function ha(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 xa(e){if(e instanceof He)return new He(e.h,e.s,e.l,e.opacity);if(e instanceof Zo||(e=mt(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 Ea(e,t,o,n){return arguments.length===1?xa(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}Yn(He,Ea,fi(Zo,{brighter(e){return e=e==null?Xn:Math.pow(Xn,e),new He(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,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(mi(e>=240?e-240:e+120,r,n),mi(e,r,n),mi(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new He(ya(this.h),$n(this.s),$n(this.l),Kn(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=Kn(this.opacity);return`${e===1?"hsl(":"hsla("}${ya(this.h)}, ${$n(this.s)*100}%, ${$n(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ya(e){return e=(e||0)%360,e<0?e+360:e}function $n(e){return Math.max(0,Math.min(1,e||0))}function mi(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 gi(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 ba(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 gi((o-n/t)*t,s,r,i,a)}}function _a(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 gi((o-n/t)*t,r,i,s,a)}}var hi=e=>()=>e;function Up(e,t){return function(o){return e+o*t}}function $p(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 Ta(e){return(e=+e)==1?qn:function(t,o){return o-t?$p(t,o,e):hi(isNaN(t)?o:t)}}function qn(e,t){var o=t-e;return o?Up(e,o):hi(isNaN(e)?t:e)}var Zn=function e(t){var o=Ta(t);function n(r,i){var s=o((r=uo(r)).r,(i=uo(i)).r),a=o(r.g,i.g),l=o(r.b,i.b),c=qn(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 va(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=uo(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 Xp=va(ba),Kp=va(_a);function ke(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var xi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yi=new RegExp(xi.source,"g");function qp(e){return function(){return e}}function Zp(e){return function(t){return e(t)+""}}function Ei(e,t){var o=xi.lastIndex=yi.lastIndex=0,n,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(n=xi.exec(e))&&(r=yi.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=yi.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Zp(l[0].x):qp(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 Na=180/Math.PI,Jn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bi(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)*Na,skewX:Math.atan(l)*Na,scaleX:s,scaleY:a}}var Qn;function wa(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Jn:bi(t.a,t.b,t.c,t.d,t.e,t.f)}function Aa(e){return e==null?Jn:(Qn||(Qn=document.createElementNS("http://www.w3.org/2000/svg","g")),Qn.setAttribute("transform",e),(e=Qn.transform.baseVal.consolidate())?(e=e.matrix,bi(e.a,e.b,e.c,e.d,e.e,e.f)):Jn)}function Ia(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,p,u,f,h){if(c!==p||d!==u){var m=f.push("translate(",null,t,null,o);h.push({i:m-4,x:ke(c,p)},{i:m-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,h){if(c!==p||d!==u){var m=f.push(r(f)+"scale(",null,",",null,")");h.push({i:m-4,x:ke(c,p)},{i:m-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 h=-1,m=u.length,g;++h<m;)p[(g=u[h]).i]=g.x(f);return p.join("")}}}var _i=Ia(wa,"px, ","px)","deg)"),Ti=Ia(Aa,", ",")",")");var po=0,Qo=0,Jo=0,Sa=1e3,jn,jo,er=0,Lt=0,tr=0,en=typeof performance=="object"&&performance.now?performance:Date,Ma=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function on(){return Lt||(Ma(Jp),Lt=en.now()+tr)}function Jp(){Lt=0}function tn(){this._call=this._time=this._next=null}tn.prototype=or.prototype={constructor:tn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?on():+o)+(t==null?0:+t),!this._next&&jo!==this&&(jo?jo._next=this:jn=this,jo=this),this._call=e,this._time=o,vi()},stop:function(){this._call&&(this._call=null,this._time=1/0,vi())}};function or(e,t,o){var n=new tn;return n.restart(e,t,o),n}function Pa(){on(),++po;for(var e=jn,t;e;)(t=Lt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--po}function Ca(){Lt=(er=en.now())+tr,po=Qo=0;try{Pa()}finally{po=0,jp(),Lt=0}}function Qp(){var e=en.now(),t=e-er;t>Sa&&(tr-=t,er=e)}function jp(){for(var e,t=jn,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:jn=o);jo=e,vi(n)}function vi(e){if(!po){Qo&&(Qo=clearTimeout(Qo));var t=e-Lt;t>24?(e<1/0&&(Qo=setTimeout(Ca,e-en.now()-tr)),Jo&&(Jo=clearInterval(Jo))):(Jo||(er=en.now(),Jo=setInterval(Qp,Sa)),po=1,Ma(Ca))}}function nr(e,t,o){var n=new tn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var ef=ci("start","end","cancel","interrupt"),tf=[],ka=0,La=1,ir=2,rr=3,Da=4,sr=5,nn=6;function gt(e,t,o,n,r,i){var s=e.__transition;if(!s)e.__transition={};else if(o in s)return;of(e,o,{name:t,index:n,group:r,on:ef,tween:tf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ka})}function rn(e,t){var o=ne(e,t);if(o.state>ka)throw new Error("too late; already scheduled");return o}function ae(e,t){var o=ne(e,t);if(o.state>rr)throw new Error("too late; already running");return o}function ne(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function of(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=or(i,0,o.time);function i(c){o.state=La,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!==La)return l();for(d in n)if(f=n[d],f.name===o.name){if(f.state===rr)return nr(s);f.state===Da?(f.state=nn,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[d]):+d<t&&(f.state=nn,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[d])}if(nr(function(){o.state===rr&&(o.state=Da,o.timer.restart(a,o.delay,o.time),a(c))}),o.state=ir,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ir){for(o.state=rr,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=sr,1),p=-1,u=r.length;++p<u;)r[p].call(e,d);o.state===sr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=nn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function Ni(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>ir&&n.state<sr,n.state=nn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[s]}i&&delete e.__transition}}function Ra(e){return this.each(function(){Ni(this,e)})}function nf(e,t){var o,n;return function(){var r=ae(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 rf(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=ae(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 Va(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=ne(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?nf:rf)(o,e,t))}function fo(e,t,o){var n=e._id;return e.each(function(){var r=ae(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return ne(r,n).value[t]}}function ar(e,t){var o;return(typeof t=="number"?ke:t instanceof mt?Zn:(o=mt(t))?(t=o,Zn):Ei)(e,t)}function sf(e){return function(){this.removeAttribute(e)}}function af(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lf(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 cf(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 df(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 uf(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 Oa(e,t){var o=et(e),n=o==="transform"?Ti:ar;return this.attrTween(e,typeof t=="function"?(o.local?uf:df)(o,n,fo(this,"attr."+e,t)):t==null?(o.local?af:sf)(o):(o.local?cf:lf)(o,n,t))}function pf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ff(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function mf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&ff(e,i)),o}return r._value=t,r}function gf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&pf(e,i)),o}return r._value=t,r}function Ha(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=et(e);return this.tween(o,(n.local?mf:gf)(n,t))}function hf(e,t){return function(){rn(this,e).delay=+t.apply(this,arguments)}}function yf(e,t){return t=+t,function(){rn(this,e).delay=t}}function Ga(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hf:yf)(t,e)):ne(this.node(),t).delay}function xf(e,t){return function(){ae(this,e).duration=+t.apply(this,arguments)}}function Ef(e,t){return t=+t,function(){ae(this,e).duration=t}}function Ba(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xf:Ef)(t,e)):ne(this.node(),t).duration}function bf(e,t){if(typeof t!="function")throw new Error;return function(){ae(this,e).ease=t}}function za(e){var t=this._id;return arguments.length?this.each(bf(t,e)):ne(this.node(),t).ease}function _f(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ae(this,e).ease=o}}function Fa(e){if(typeof e!="function")throw new Error;return this.each(_f(this._id,e))}function Wa(e){typeof e!="function"&&(e=$o(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 Ya(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 Tf(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 vf(e,t,o){var n,r,i=Tf(t)?rn:ae;return function(){var s=i(this,e),a=s.on;a!==n&&(r=(n=a).copy()).on(t,o),s.on=r}}function Ua(e,t){var o=this._id;return arguments.length<2?ne(this.node(),o).on.on(e):this.each(vf(o,e,t))}function Nf(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function $a(){return this.on("end.remove",Nf(this._id))}function Xa(e){var t=this._name,o=this._id;typeof e!="function"&&(e=St(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,gt(c[u],t,o,u,c,ne(d,o)));return new ge(i,this._parents,t,o)}function Ka(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Uo(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,h=ne(d,o),m=0,g=u.length;m<g;++m)(f=u[m])&>(f,t,o,m,u,h);i.push(u),s.push(d)}return new ge(i,s,t,o)}var wf=tt.prototype.constructor;function qa(){return new wf(this._groups,this._parents)}function Af(e,t){var o,n,r;return function(){var i=ft(this,e),s=(this.style.removeProperty(e),ft(this,e));return i===s?null:i===o&&s===n?r:r=t(o=i,n=s)}}function Za(e){return function(){this.style.removeProperty(e)}}function If(e,t,o){var n,r=o+"",i;return function(){var s=ft(this,e);return s===r?null:s===n?i:i=t(n=s,o)}}function Cf(e,t,o){var n,r,i;return function(){var s=ft(this,e),a=o(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),ft(this,e))),s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a))}}function Sf(e,t){var o,n,r,i="style."+t,s="end."+i,a;return function(){var l=ae(this,e),c=l.on,d=l.value[i]==null?a||(a=Za(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(s,r=d),l.on=n}}function Ja(e,t,o){var n=(e+="")=="transform"?_i:ar;return t==null?this.styleTween(e,Af(e,n)).on("end.style."+e,Za(e)):typeof t=="function"?this.styleTween(e,Cf(e,n,fo(this,"style."+e,t))).each(Sf(this._id,e)):this.styleTween(e,If(e,n,t),o).on("end.style."+e,null)}function Mf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function Pf(e,t,o){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Mf(e,s,o)),n}return i._value=t,i}function Qa(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,Pf(e,t,o==null?"":o))}function Lf(e){return function(){this.textContent=e}}function Df(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function ja(e){return this.tween("text",typeof e=="function"?Df(fo(this,"text",e)):Lf(e==null?"":e+""))}function kf(e){return function(t){this.textContent=e.call(this,t)}}function Rf(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&kf(r)),t}return n._value=e,n}function el(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,Rf(e))}function tl(){for(var e=this._name,t=this._id,o=lr(),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=ne(l,t);gt(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 ol(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};o.each(function(){var c=ae(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 Vf=0;function ge(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function nl(e){return tt().transition(e)}function lr(){return++Vf}var ot=tt.prototype;ge.prototype=nl.prototype={constructor:ge,select:Xa,selectAll:Ka,selectChild:ot.selectChild,selectChildren:ot.selectChildren,filter:Wa,merge:Ya,selection:qa,transition:tl,call:ot.call,nodes:ot.nodes,node:ot.node,size:ot.size,empty:ot.empty,each:ot.each,on:Ua,attr:Oa,attrTween:Ha,style:Ja,styleTween:Qa,text:ja,textTween:el,remove:$a,tween:Va,delay:Ga,duration:Ba,ease:za,easeVarying:Fa,end:ol,[Symbol.iterator]:ot[Symbol.iterator]};function cr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Of={time:null,delay:0,duration:250,ease:cr};function Hf(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 rl(e){var t,o;e instanceof ge?(t=e._id,e=e._name):(t=lr(),(o=Of).time=on(),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])&>(l,e,t,c,s,o||Hf(l,t));return new ge(n,this._parents,e,t)}tt.prototype.interrupt=Ra;tt.prototype.transition=rl;function ht(e,t,o){this.k=e,this.x=t,this.y=o}ht.prototype={constructor:ht,scale:function(e){return e===1?this:new ht(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ht(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 dr=new ht(1,0,0);ur.prototype=ht.prototype;function ur(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dr;return e.__zoom}var Bf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var il;(function(e){e.Strict="strict",e.Loose="loose"})(il||(il={}));var sl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(sl||(sl={}));var al;(function(e){e.Partial="partial",e.Full="full"})(al||(al={}));var ll;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ll||(ll={}));var cl;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cl||(cl={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));var cE={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};var zf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ff=(e,t=[0,0])=>{var a;let{width:o,height:n}=Wf(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}=zf(e)?e.internals.positionAbsolute:Ff(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 Wf(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 dE={[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 Yf={nodeOrigin:[0,0],nodeExtent:Bf,elevateNodesOnSelect:!0,defaults:{}},uE=N(E({},Yf),{checkEquality:!0});var dl;(function(e){e.Line="line",e.Handle="handle"})(dl||(dl={}));var Uf={width:0,height:0,x:0,y:0},pE=N(E({},Uf),{pointerX:0,pointerY:0,aspectRatio:1});var Ie=require("react"),ml=require("zustand/shallow");var $f=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Xf(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 Kf(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 pr=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||!$f(u.nodeBox,r))continue;let f=Math.abs(u.position-o);if(f>fr)continue;let m=Xf(u.nodeBox,Ae(n))>0?0:Kf(u.nodeBox,Ae(n));l.push({line:u,lineDist:f,nodeDist:m})}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 ul(e,t=Dt,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 pl(e,t,o,n,r=Object.keys(Dt)){let i=[];for(let a of r){let l=Dt[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 fl(e,t,o,n,r,i,s,a){var p,u,f,h,m,g,_,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+((u=(p=e.measured)==null?void 0:p.width)!=null?u:0),y2:o.position.y+((h=(f=e.measured)==null?void 0:f.height)!=null?h:0)};if(s){let b=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(b)<=fr){if(o.position.y-=b,r!=null&&r.dimensions)if(n){let v=t.internals.positionAbsolute.y+((g=(m=e.measured)==null?void 0:m.height)!=null?g:0);r.dimensions.height=v-s.line.position}else r.dimensions.height=s.line.position-t.internals.positionAbsolute.y;c=!0}}if(a){let b=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(b)<=fr){if(o.position.x-=b,r!=null&&r.dimensions)if(n){let v=t.internals.positionAbsolute.x+((x=(_=e.measured)==null?void 0:_.width)!=null?x:0);r.dimensions.width=v-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 fr=10,Dt={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 gl=require("react/jsx-runtime"),qf=new pr;function go(){let[e,t]=(0,Ie.useState)(void 0),[o,n]=(0,Ie.useState)(void 0),{width:r,height:i}=(0,mo.useStore)(g=>({width:g.width,height:g.height}),ml.shallow),s=(0,mo.useNodesInitialized)(),a=(0,Ie.useRef)(qf),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,mo.useReactFlow)(),p=(0,Ie.useCallback)(()=>{t(void 0),n(void 0)},[]),u=(0,Ie.useCallback)(g=>{let _=g!=null?g:d();p();let x=ul(_,Dt,c);a.current.initialize(x)},[c,p,d]),f=(0,Ie.useCallback)(()=>{setTimeout(()=>{u()},100)},[u]);(0,Ie.useEffect)(()=>{s&&u(d())},[s,u,d]);let h=(0,Ie.useCallback)((g,_)=>{var O,F,W,se,re;if(!a.current||g.length===0||g.length>2)return g;p();let x,y,b=Object.keys(Dt);g.length===1?g[0].type==="position"?x=g[0]:g[0].type==="dimensions"&&(y=g[0],b=["right","bottom"]):g[0].type==="position"&&g[1].type==="dimensions"&&g[1].dimensions&&(x=g[0],y=g[1],b=["top","left"]);let v=_.find(me=>me.id===g[0].id);if(!v)return g;let w=c(v.id);if(!w)throw new Error(`Node with id ${v.id} not found in internal nodes`);let T=c((O=w.parentId)!=null?O:""),C=Ae(w);y!=null&&y.dimensions&&(C.x2=C.x+y.dimensions.width,C.y2=C.y+y.dimensions.height);let{x:R,y:A}=l({x:0,y:0}),{x:S,y:L}=l({x:r,y:i}),I={x:R,y:A,x2:S,y2:L},{horizontal:k,vertical:P}=pl(a.current,I,v,C,b),M={id:v.id,type:"position",position:{x:w.internals.positionAbsolute.x,y:w.internals.positionAbsolute.y},dragging:!1};x!=null&&x.position&&M.position&&(T?(M.position.x=x.position.x+((W=(F=T==null?void 0:T.position)==null?void 0:F.x)!=null?W:0),M.position.y=x.position.y+((re=(se=T==null?void 0:T.position)==null?void 0:se.y)!=null?re:0)):(M.position.x=x.position.x,M.position.y=x.position.y));let{snappedX:z,snappedY:G}=fl(v,w,M,x,y,T,k,P);if(z||G){if((y!=null&&y.resizing||x!=null&&x.dragging)&&(z&&n(P==null?void 0:P.line),G&&t(k==null?void 0:k.line)),y&&x)return[M,y];if(x)return[M];if(y)return[y]}return g},[l,c,r,i,t,n,p]),m=(0,Ie.useCallback)(()=>(0,gl.jsx)(hl,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:u,forceRebuildIndex:f,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:m}}var zr=require("@xyflow/react"),Gi=require("react");var Ge=require("@xyflow/react");var ho=require("@xyflow/react");function yl(e,t){var y,b,v,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+((b=(y=t==null?void 0:t.measured)==null?void 0:y.width)!=null?b:0)/2,p=i.y+((w=(v=t==null?void 0:t.measured)==null?void 0:v.height)!=null?w:0)/2,u=(d-l)/(2*s)-(p-c)/(2*a),f=(d-l)/(2*s)+(p-c)/(2*a),h=1/(Math.abs(u)+Math.abs(f)||1),m=h*u,g=h*f,_=s*(m+g)+l,x=a*(-m+g)+c;return{x:_,y:x}}function xl(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?ho.Position.Left:a>=i+n-1?ho.Position.Right:l<=s+1?ho.Position.Top:l>=s+r-1?ho.Position.Bottom:ho.Position.Top}function nt(e,t){let o=yl(e,t),n=yl(t,e),r=xl(e,o),i=xl(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var Ue=require("lecom-ui"),bl=require("lucide-react");var Re=require("@xyflow/react");var El=require("@xyflow/react");var yt=()=>{let{getNodes:e,setNodes:t,getEdges:o,setEdges:n}=(0,El.useReactFlow)();return{selectElements:s=>{let a=e().map(c=>N(E({},c),{selected:s.includes(c.id)})),l=o().map(c=>N(E({},c),{selected:s.includes(c.id)}));return t(a),n(l),!0},clearSelection:async()=>{let s=e().map(l=>N(E({},l),{selected:!1})),a=o().map(l=>N(E({},l),{selected:!1}));return t(s),n(a),await Ln(),!0}}};var mr=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,Re.useReactFlow)(),{selectElements:r}=yt(),i=g=>{let _=o(),x=n(),y=(0,Re.getIncomers)(g,_,x),b=(0,Re.getOutgoers)(g,_,x),v=y.some(T=>T.type==="START_EVENT"),w=b.some(T=>T.type==="END_EVENT");return v?"start":w?"end":"between"},s=(g,_,x)=>{var v,w,T,C;if(!g)return;let y={type:g.type,variant:(v=g.data)==null?void 0:v.variant,attribute:(w=g.data)==null?void 0:w.attribute},b={id:g.id,position:i(g),label:(T=g.data)==null?void 0:T.label,node:y};return g.type==="TASK"&&((C=g.data)==null?void 0:C.variant)==="SUBPROCESS"?N(E({},b),{type:"sub_process"}):g.type==="GATEWAY"?N(E({},b),{type:"gateway",variant:a(g,_,x)}):N(E({},b),{type:"activity"})},a=(g,_,x)=>{if(g.type!=="GATEWAY")return;let y=(0,Re.getIncomers)(g,_,x),b=!1,v=!1;if(y.forEach(w=>{var T,C;w.type==="TASK"&&(((T=w.data)==null?void 0:T.variant)==="SCRIPT"&&(b=!0),((C=w.data)==null?void 0:C.attribute)==="LOOP"&&(v=!0))}),b&&v)return"script_loop";if(b)return"script";if(v)return"loop"},l=(g,_,x)=>{var T,C,R,A;let y=e(g.source),b=e(g.target);if(!y||!b)return"simple";if((0,Re.getOutgoers)(y,_,x).some(S=>S.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((T=y.data)==null?void 0:T.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let S=(C=y.data)==null?void 0:C.variant,L=(R=y.data)==null?void 0:R.attribute;if(b.type==="TASK"&&((A=b.data)==null?void 0:A.variant)==="SUBPROCESS")return"to_sub_process";let I=S==="SCRIPT",k=L==="LOOP";return I&&k?"script_loop":I?"script":k?"loop":"simple"}return"simple"},c=(g,_,x)=>{let y=[];function b(w,T,C=0){let R=s(w,_,x);if(R.depth=C,T.push(R),w.type==="TASK"){y.push([...T]),T.pop();return}let A=(0,Re.getIncomers)(w,_,x);if(A.length)for(let S of A)b(S,T,C+1);T.pop()}let v=(0,Re.getIncomers)(g,_,x);for(let w of v)b(w,[]);return y},d=(g,_,x)=>{let y=[];function b(w,T,C=0){let R=s(w,_,x);if(R.depth=C,T.push(R),w.type==="TASK"){y.push([...T]),T.pop();return}let A=(0,Re.getOutgoers)(w,_,x);if(A.length)for(let S of A)b(S,T,C+1);T.pop()}let v=(0,Re.getOutgoers)(g,_,x);for(let w of v)b(w,[]);return y},p=(g,_,x)=>{x=x.filter(b=>b.source===g.id);let y=x.map(b=>{var T;let v=e(b.target),w;return v&&(w=s(v,_,x)),{id:b.id,type:"routing",variant:l(b,_,x),label:(T=b.data)==null?void 0:T.label,target:w}});return console.log(y),y},u=g=>{let _=e(g);if(!_)return;let x=o(),y=n(),b=s(_,x,y);return b.sources=c(_,x,y),b.targets=d(_,x,y),b.edgeTargets=p(_,x,y),_.type==="GATEWAY"&&(b.variant=a(_,x,y)),b},f=g=>{let _=t(g);if(!_)return;let x=o(),y=n(),b=l(_,x,y),w={id:_.id,type:"routing",variant:b,gatewayVariant:void 0},T=e(_.source);if(T){let R=s(T,x,y),A=c(T,x,y),S=a(T,x,y);w.source=R,w.sources=A.length?A:[[R]],w.gatewayVariant=S}let C=e(_.target);if(C){let R=s(C,x,y),A=d(C,x,y);w.target=R,w.targets=A.length?A:[[R]]}return w},h=g=>{let _=e(g);if(_)return u(_.id);let x=t(g);if(x)return f(x.id)};return{configureElement:g=>{let _=h(g);if(_)return r([g]),_},getConfigureElement:h,getNodeConfigure:u,getEdgeConfigure:f}};var kt=require("react/jsx-runtime"),xt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ue.useTranslation)(),{onConfigureElement:n}=V(),{getConfigureElement:r}=mr();return(0,kt.jsxs)(Ue.Tooltip,{children:[(0,kt.jsx)(Ue.TooltipTrigger,{asChild:!0,children:(0,kt.jsx)(Ue.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let s=r(e);s&&(n==null||n(s))},children:(0,kt.jsx)(bl.Settings,{size:16})})}),(0,kt.jsx)(Ue.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var _l=require("@xyflow/react"),$e=require("lecom-ui"),Tl=require("lucide-react"),Rt=require("react/jsx-runtime"),gr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,$e.useTranslation)(),{deleteElements:n}=(0,_l.useReactFlow)();return(0,Rt.jsxs)($e.Tooltip,{children:[(0,Rt.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,Rt.jsx)($e.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Rt.jsx)(Tl.TrashIcon,{size:16})})}),(0,Rt.jsx)($e.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Xe=require("lecom-ui"),vl=require("lucide-react"),Nl=require("react"),Vt=require("react/jsx-runtime"),sn=({nodeId:e})=>{let{t}=(0,Xe.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,Vt.jsxs)(Xe.Tooltip,{children:[(0,Vt.jsx)(Xe.TooltipTrigger,{asChild:!0,children:(0,Vt.jsx)(Xe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onMouseDown:o,children:(0,Vt.jsx)(vl.MoveUpRightIcon,{size:16})})}),(0,Vt.jsx)(Xe.TooltipContent,{color:"black",children:t("editor.toolbar.connect_node")})]})};var yo=require("react/jsx-runtime"),xo=i=>{var s=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=s,r=We(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,yo.jsx)(gr,{elementId:e,elementType:"edge"})}],h=()=>a==="view"?u?[{component:(0,yo.jsx)(xt,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,yo.jsx)(xt,{elementId:e,elementType:"edge"})},...f]:f,g=(_=>{switch(_){case"SEQUENCE_EDGE":return h();case"MESSAGE_EDGE":return a==="view"?[]:[...f];case"ANNOTATION_EDGE":return a==="view"?[]:[...f];default:return[]}})(t);if(!(g.length===0||a==="view"))return(0,yo.jsx)("div",N(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:g.map((_,x)=>(0,yo.jsx)("div",{children:_.component},x))}))};var Ot=require("react/jsx-runtime"),Eo={type:"ANNOTATION_EDGE",reconnectable:!0},wl=({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}=nt(a,l),[f,h,m]=(0,Ge.getStraightPath)({sourceX:c,sourceY:d,targetX:p,targetY:u}),g=n||(a==null?void 0:a.selected)||(l==null?void 0:l.selected),_=1/i;return(0,Ot.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,Ot.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)]":g&&!(r!=null&&r.hasError)})}),(0,Ot.jsx)(Ge.EdgeLabelRenderer,{children:(0,Ot.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${m}px)`},children:n&&!s&&(0,Ot.jsx)(xo,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${_})`}})})})]})};var _e=require("react"),le=require("@xyflow/react");var Ht=require("react");var wi=require("react/jsx-runtime"),de=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:s,onBlur:a})=>{let l=(0,Ht.useRef)(null),[c,d]=(0,Ht.useState)(!1);(0,Ht.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,Ht.useEffect)(()=>{if(c&&l.current){l.current.focus();let m=document.createRange();m.selectNodeContents(l.current);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(m))}},[c]);let p=m=>{m.stopPropagation(),c||d(!0)},u=m=>{let g=m.currentTarget.innerText.trim(),_=t&&g.length>=t,x=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],y=m.ctrlKey||m.metaKey,b=y&&m.key==="a",v=y&&m.key==="c",w=y&&m.key==="x",T=y&&m.key==="v";function C(A){return/\w/.test(A)}if(g.length===0&&!C(m.key)&&!x.includes(m.key)&&!y){m.preventDefault();return}_&&(x.includes(m.key)||b||v||w||T||m.preventDefault())},f=m=>{if(!t)return;m.preventDefault();let g=m.clipboardData.getData("text/plain"),_=m.currentTarget.innerText,x=window.getSelection();if(!x||x.rangeCount===0)return;let y=x.getRangeAt(0);if((_.substring(0,y.startOffset)+g+_.substring(y.endOffset)).length>t){let v=t-(_.length-(y.endOffset-y.startOffset)),w=g.substring(0,Math.max(0,v));w&&(y.deleteContents(),y.insertNode(document.createTextNode(w)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y))}else y.deleteContents(),y.insertNode(document.createTextNode(g)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y)},h=m=>{d(!1);let g=m.currentTarget.innerText.trim();t&&g.length>t&&(g=g.substring(0,t)),m.currentTarget.innerText=g,a==null||a(),g!==e&&(s==null||s(g))};return(0,wi.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,wi.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:h,children:e})})};var ln=require("@xyflow/react"),hr=e=>e===ln.Position.Left||e===ln.Position.Right,Ai=(e,t=30)=>e===ln.Position.Right||e===ln.Position.Bottom?t:-t,Ii=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,yr=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),xr=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Gt={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15};function Zf(e,t,o,n,r,i){let s=Ai(r,Gt.OFFSET),a=Ai(i,Gt.OFFSET),l=hr(r),c=hr(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 Ci(e,t,o,n,r,i,s){let a=Zf(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=hr(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)>Gt.TOLERANCE&&Math.abs(u.y-p.y)>Gt.TOLERANCE){let h=d%2===0===c;l[d+1]=h?{x:u.x,y:p.y}:{x:p.x,y:u.y}}}return l}var Al=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 ue=require("react/jsx-runtime"),Be={type:"SEQUENCE_EDGE",zIndex:0,reconnectable:!0,markerStart:{type:le.MarkerType.ArrowClosed},markerEnd:{type:le.MarkerType.Arrow},data:{label:""}},{TOLERANCE:Il,MOVE_THRESHOLD:Er,MIN_SEGMENT_LENGTH:Jf}=Gt,Cl=({id:e,source:t,target:o,data:n,selected:r})=>{var L;let{zoom:i}=(0,le.useViewport)(),{updateEdgeData:s}=(0,le.useReactFlow)(),{isMultipleSelection:a,mode:l}=V(),[c,d]=(0,_e.useState)(!1),[p,u]=(0,_e.useState)(null),f=(0,_e.useRef)(null),h=(0,_e.useRef)(null),m=(0,le.useInternalNode)(t),g=(0,le.useInternalNode)(o),{sx:_,sy:x,tx:y,ty:b,sourcePos:v,targetPos:w}=(0,_e.useMemo)(()=>m&&g?nt(m,g):{sx:0,sy:0,tx:0,ty:0,sourcePos:le.Position.Right,targetPos:le.Position.Left},[m,g]);(0,_e.useEffect)(()=>{var P;if(!h.current){h.current={sx:_,sy:x,tx:y,ty:b,sourcePos:v,targetPos:w};return}let I=h.current;(Math.abs(_-I.sx)>Er||Math.abs(x-I.sy)>Er||Math.abs(y-I.tx)>Er||Math.abs(b-I.ty)>Er||I.sourcePos!==v||I.targetPos!==w)&&((P=n==null?void 0:n.points)!=null&&P.length)&&s(e,N(E({},n),{points:void 0})),h.current={sx:_,sy:x,tx:y,ty:b,sourcePos:v,targetPos:w}},[_,x,y,b,v,w,n,e,s]);let T=(0,_e.useMemo)(()=>{var I;if((I=n==null?void 0:n.points)!=null&&I.length&&g){let P={internals:{positionAbsolute:n.points[n.points.length-1]},measured:{width:1,height:1}},M=nt(P,g);return Ci(_,x,M.tx,M.ty,v,M.targetPos,n.points)}return Ci(_,x,y,b,v,w,n==null?void 0:n.points)},[_,x,y,b,v,w,n==null?void 0:n.points,g]),C=(0,_e.useMemo)(()=>{if(T.length<2)return xr({x:_,y:x},{x:y,y:b});let I=0;for(let M=0;M<T.length-1;M++)I+=yr(T[M],T[M+1]);let k=I/2,P=0;for(let M=0;M<T.length-1;M++){let z=yr(T[M],T[M+1]);if(P+z>=k){let G=(k-P)/z,O=T[M],F=T[M+1];return{x:O.x+(F.x-O.x)*G,y:O.y+(F.y-O.y)*G}}P+=z}return xr({x:_,y:x},{x:y,y:b})},[T,_,x,y,b]),R=(0,_e.useCallback)((I,k)=>{if(l!=="edit"||k.button!==0)return;k.stopPropagation(),k.preventDefault();let P=T[I],M=T[I+1],z=Ii(P,M,"y"),G=z?P.y:P.x;u(I);let O=W=>{let se=G+(z?W.clientY-k.clientY:W.clientX-k.clientX)/i;f.current=z?{x:(P.x+M.x)/2,y:se}:{x:se,y:(P.y+M.y)/2};let re=T.map((me,Qe)=>Qe===0||Qe===T.length-1?me:(z?Math.abs(me.y-G)<Il:Math.abs(me.x-G)<Il)?z?N(E({},me),{y:se}):N(E({},me),{x:se}):me);s(e,N(E({},n),{points:re.slice(1,-1)}))},F=()=>{u(null),f.current=null,document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",F)},[l,T,i,n,e,s]);if(!m||!g)return null;let A=Al(T),S=r||m.selected||g.selected;return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":S}),onBlur:()=>d(!1),onDoubleClick:()=>d(!0),children:[(0,ue.jsx)(le.BaseEdge,{id:e,path:A,markerEnd:`url(#${S?"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)]":S&&!(n!=null&&n.hasError)})}),r&&!a&&l==="edit"&&(0,ue.jsx)("g",{children:T.slice(0,-1).map((I,k)=>{let P=T[k+1];if(k===0||k===T.length-2||yr(I,P)<Jf)return null;let M=Ii(I,P,"y"),z=p===k,G=z&&f.current?f.current:xr(I,P);return(0,ue.jsxs)("g",{children:[(0,ue.jsx)("line",{x1:I.x,y1:I.y,x2:P.x,y2:P.y,stroke:"transparent",strokeWidth:20/i,className:D("cursor-pointer",{"cursor-ns-resize":M,"cursor-ew-resize":!M}),onMouseDown:O=>R(k,O)}),(0,ue.jsx)("circle",{cx:G.x,cy:G.y,r:4/i,fill:z?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/i,className:"pointer-events-none"}),(0,ue.jsx)("circle",{cx:G.x,cy:G.y,r:6/i,fill:"none",stroke:"#3b82f6",strokeWidth:1/i,opacity:z?.6:.3,className:"pointer-events-none"})]},k)})})]}),(0,ue.jsx)(le.EdgeLabelRenderer,{children:(0,ue.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C.x}px, ${C.y}px)`},children:[r&&!a&&(0,ue.jsx)(xo,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:m,targetNode:g,style:{transform:`scale(${1/i})`}}),(c||((L=n==null?void 0:n.label)==null?void 0:L.trim()))&&(0,ue.jsx)(de,{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:I=>s(e,{label:I.trim()})})]})})]})};var cn=e=>new Map(e.map(t=>[t.id,t])),br=e=>e.some(t=>t.type==="START_EVENT"),Sl=(e,t,o,n)=>{let r=cn(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},_r=(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},Ml=(e,t,o)=>{var s,a,l,c;let n=cn(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"},Tr=(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"},vr=(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"},Nr=(e,t,o)=>{let n=cn(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"})},wr=(e,t,o)=>{let n=cn(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"})},Ar=(e,t)=>t.filter(n=>n.source===e).length>0,Ir=(e,t,o,n)=>{let r=cn(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 Qf=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!Sl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"start_event_limit_reached"}),e=>({isValid:!_r(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!Ir(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:Ml(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:!(Tr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(vr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Nr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(wr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(Ar(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"})],Pl=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:_r(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:br(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Tr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:vr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Nr(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:wr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Ar(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:Ir(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Ll=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 Wc=require("use-debounce");var Fc=require("@xyflow/react"),Oi=require("react");var dn=(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))(dn||{});var Cr=require("xml-js");var Dl={compact:!0,spaces:4},em=e=>e.replaceAll(`
|
|
2
|
+
`,"
");function Sr(e,t=Dl){if(e)return JSON.parse((0,Cr.xml2json)(e,N(E({},t),{attributeValueFn:em})))}function kl(e,t=Dl){return e?(0,Cr.json2xml)(e,t):""}var Pi=require("uuid");var tm={MIN_WIDTH:36,MIN_HEIGHT:36},om={MIN_WIDTH:36,MIN_HEIGHT:36},nm={MIN_WIDTH:56,MIN_HEIGHT:56},Mr={MIN_WIDTH:176,MIN_HEIGHT:96},Pr={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},J={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Lr={MIN_WIDTH:176,MIN_HEIGHT:64},rm={MIN_WIDTH:128,MIN_HEIGHT:64},B={START_EVENT:tm,END_EVENT:om,GATEWAY:nm,TASK:Mr,LANE:J,ANNOTATION:Lr,UNSUPPORTED:rm};var Rl={"attribute-loop":"LOOP"},Vl={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Ol={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Hl={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Gl={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var bo=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=ut(Number(n),t),s=ut(Number(r),o);return{width:i,height:s,measured:{width:i,height:s}}},_o=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},sm=e=>{let{mxGeometry:t}=e,o=_o(e),n=bo(t,B.START_EVENT.MIN_WIDTH,B.START_EVENT.MIN_HEIGHT);return N(E(E({},o),n),{type:"START_EVENT"})},am=e=>{let{mxGeometry:t}=e,o=_o(e),n=bo(t,B.END_EVENT.MIN_WIDTH,B.END_EVENT.MIN_HEIGHT);return N(E(E({},o),n),{type:"END_EVENT"})},Si=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=_o(e),i=bo(n,B.TASK.MIN_WIDTH,B.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=Rl[l];c&&(r.data.attribute=c)}let a=Vl[o.style];return a&&(r.data.variant=a),N(E(E({},r),i),{type:"TASK"})},Mi=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=_o(e),i=bo(o,B.GATEWAY.MIN_WIDTH,B.GATEWAY.MIN_HEIGHT);return r.data.variant=Ol[n],N(E(E({},r),i),{type:"GATEWAY"})},lm=e=>{let{mxGeometry:t}=e,o=_o(e),n=bo(t,B.ANNOTATION.MIN_WIDTH,B.ANNOTATION.MIN_HEIGHT);return N(E(E({},o),n),{type:"ANNOTATION"})},cm=e=>{let{mxGeometry:t}=e,o=_o(e),n=bo(t,B.LANE.MIN_WIDTH,B.LANE.MIN_HEIGHT);return N(E(E({},o),n),{type:"LANE"})},Bl={task:Si,"task-script":Si,"subprocess-collapsed":Si,"start-event":sm,"end-event-terminate":am,"gateway-parallel":Mi,"gateway-exclusive":Mi,"gateway-complex":Mi,annotation:lm,lane:cm},zl=e=>{var c;let{_attributes:t,mxGeometry:o}=e,{source:n,target:r,value:i,style:s}=t,a=(c=o==null?void 0:o.Array)==null?void 0:c.map(d=>({x:Number(d._attributes.x),y:Number(d._attributes.y)})),l={id:(0,Pi.v7)(),source:n,target:r,data:E({label:i||""},a&&a.length>0?{points:a}:{})};return s.includes("association")&&s.includes('endArrow=""')?E(E({},Eo),l):E(E({},Be),l)},Fl=(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}},To=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}}}},dm=e=>{let{variant:t}=e.data,o=To(e);return N(E({},o),{_attributes:N(E({},o._attributes),{style:Hl[t]||"task"})})},um=e=>{let t=To(e);return N(E({},t),{_attributes:N(E({},t._attributes),{style:"start-event"})})},pm=e=>{let t=To(e);return N(E({},t),{_attributes:N(E({},t._attributes),{style:"end-event-terminate"})})},fm=e=>{let{variant:t}=e.data,o=To(e);return N(E({},o),{_attributes:N(E({},o._attributes),{style:Gl[t]})})},mm=e=>{let t=To(e);return N(E({},t),{_attributes:N(E({},t._attributes),{style:"lane"})})},gm=e=>{let t=To(e);return N(E({},t),{_attributes:N(E({},t._attributes),{style:"annotation"})})},Wl={TASK:dm,START_EVENT:um,END_EVENT:pm,GATEWAY:fm,ANNOTATION:gm,LANE:mm},Yl=e=>{var i,s;let n=((i=e.measured)==null?void 0:i.width)||0,r=((s=e.measured)==null?void 0:s.height)||0;return{_attributes:{id:(0,Pi.v7)(),parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:n/2-22/2,y:r-22,width:22,height:22}}}};var Li=Pu(require("@dagrejs/dagre"),1),Kl=require("@xyflow/react");var ql=require("lodash");var Ul=require("lodash");var rt=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}},it=e=>(0,Ul.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),$l=(e,t)=>{let{x:o,y:n}=rt(e),{x:r,y:i}=rt(t);return{x:o-r,y:n-i}};var vo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(H)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),hm=(e,t)=>{let{x:o,y:n}=rt(e),{x:r,y:i}=rt(t),s=o-r,a=n-i;return Math.sqrt(s*s+a*a)},ym=(e,t)=>{let{x:o,y:n,w:r,h:i}=rt(e),{x:s,y:a,w:l,h:c}=rt(t);return o<s+l&&s<o+r&&n<a+c&&a<n+i},un=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&ym(e,r)){let i=hm(e,r);i<n&&(n=i,o=r)}return o},Xl=(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 Zl=(e=[],t=[],o="LR")=>{let n=new Li.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)),Li.default.layout(n),{nodes:e.map(i=>{let s=n.node(i.id);return N(E({},i),{position:{x:s.x-i.width/2,y:s.y-i.height/2}})}),edges:t}},pn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Bt(n.id,o)}),o},Bt=(e,t)=>{var f,h;let o=[...t],n=o.find(m=>m.id===e);if(!n)return o;let r=o.filter(m=>m.parentId===e&&m.type==="LANE");if(r.length===0)return o;let i=(0,ql.orderBy)(r,["position.y"]),s=Math.max((h=(f=n.measured)==null?void 0:f.width)!=null?h:0,Pr.MIN_WIDTH),a=Xl(e,i)||J.MIN_WIDTH,l=Math.max(s,a),c=s-J.HEADER_WIDTH>=a,d=0,p=0;i.forEach(m=>{var g,_,x,y;o=o.map(b=>b.id===m.id?N(E({},b),{width:c?l-J.HEADER_WIDTH:l,measured:N(E({},b.measured),{width:c?l-J.HEADER_WIDTH:l}),position:{x:J.HEADER_WIDTH,y:d}}):b),d+=(_=(g=m.measured)==null?void 0:g.height)!=null?_:0,p+=(y=(x=m.measured)==null?void 0:x.height)!=null?y:0}),o=o.map(m=>m.id===e?N(E({},m),{height:p,width:c?l:l+J.HEADER_WIDTH,measured:N(E({},m.measured),{height:p,width:c?l:l+J.HEADER_WIDTH})}):m);let u=o.find(m=>m.id===e);return u!=null&&u.parentId&&(o=Bt(u.parentId,o)),o},Jl=(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?N(E({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?N(E({},i),{position:e.position}):i),o},Ql=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},xm=50,jl=(e,t=xm)=>{let o=(0,Kl.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Em=e=>{let t=Object.values(dn),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=Bl[s],l=a==null?void 0:a(i,n);if(!l){console.warn(`Node ${s} not supported`);continue}r.push(l)}return r},bm=(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=zl(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},_m=e=>{let t=[];return e.forEach(o=>{var i,s;let n=(s=(i=Wl)[o.type])==null?void 0:s.call(i,o);if(!n){console.warn(`Node ${o.type} not supported`);return}if(t.push(n),o.type==="TASK"&&o.data.attribute==="LOOP"){let a=Yl(o);t.push(a)}}),t},Tm=(e,t)=>{let o=[];return e.forEach(n=>{let r=Fl(n,t);o.push(r)}),o},ec=(e=[],t=[])=>{let o=_m(e),n=Tm(t,e),r={mxGraphModel:{root:{_attributes:{version:"1.1"},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...o,...n]}}};return kl(JSON.stringify(r))},tc=async e=>{var s,a;let t=await Sr(e),o=((a=(s=t==null?void 0:t.mxGraphModel)==null?void 0:s.root)==null?void 0:a.mxCell)||[],n=Em(o),r=bm(o,n);return{nodes:it(pn(n)),edges:r}};var Ao=require("@xyflow/react");var fn=require("@xyflow/react");var Di=require("react/jsx-runtime"),ce=i=>{var s=i,{type:e,position:t,className:o,nodeType:n}=s,r=We(s,["type","position","className","nodeType"]);let a=n==="TASK";return(0,Di.jsx)(fn.Handle,E({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))},Dr=a=>{var l=a,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,s=We(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,fn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let u=c();return t==="TASK"?u.filter(h=>h.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?u.filter(h=>h.source===e).length>=2:!1})();return(0,Di.jsx)(fn.Handle,E({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 kr=require("@xyflow/react"),oc=require("lodash");var nc=require("react/jsx-runtime"),No=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=We(r,["nodeId","isVisible"]);let{getNode:i,getNodes:s,setNodes:a}=(0,kr.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 h=[...s()],m=!f.parentId,g=m?f.id:f.parentId,_=h.filter(b=>b.type==="LANE"&&b.parentId===g);if(!_.length)return;let x=(0,oc.orderBy)(_,["position.y"]),y=0;x.forEach((b,v)=>{var C,R;let w=v===x.length-1,T=(R=(C=b.measured)==null?void 0:C.height)!=null?R:0;h=h.map(A=>{if(A.id===b.id){let S=m?p-J.HEADER_WIDTH:p,L=N(E({},A),{width:S,measured:N(E({},A.measured),{width:S}),position:N(E({},A.position),{y})});return w&&m&&(L.height=u-y),L}return A}),y+=T}),h=h.map(b=>{if(b.id===g){let v=m?p:p+J.HEADER_WIDTH;return N(E({},b),{width:v,height:m?u:y,measured:{width:v,height:m?u:y}})}return b}),a(h)};return(0,nc.jsx)(kr.NodeResizer,E({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 Or=require("@xyflow/react"),Ke=require("lecom-ui"),Ft=require("react");var rc=require("zustand"),wo=(0,rc.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var Rr=require("react"),ic=(e,t=!1)=>{let[o,n]=(0,Rr.useState)({width:0,height:0});return(0,Rr.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var Et=require("@xyflow/react"),sc=require("react"),vm=120,Nm=12,ac=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,Et.useReactFlow)(),{instanceId:i}=V();return(0,sc.useMemo)(()=>{var f,h;if(!t)return{position:Et.Position.Right,align:"start"};let s=n(e);if(!s)return{position:Et.Position.Right,align:"start"};let a=r(),l=s.position.x*a.zoom+a.x,c=(((f=s.measured)==null?void 0:f.width)||s.width||100)*a.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:Et.Position.Right,align:"start"};let p=(o==null?void 0:o.width)||vm;return{position:l+c+p+Nm>d?Et.Position.Left:Et.Position.Right}},[i,e,t,o,n,r])};var Vr=require("@xyflow/react"),Y=require("lecom-ui"),lc=require("lucide-react");var q=require("react/jsx-runtime"),cc=({nodeId:e})=>{let{t}=(0,Y.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Vr.useReactFlow)(),i=(0,Vr.useNodesData)(e),a=n().filter(f=>f.source===e).some(f=>{let h=r(f.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=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,q.jsxs)(Y.DropdownMenu,{children:[(0,q.jsxs)(Y.Tooltip,{children:[(0,q.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(Y.DropdownMenuTrigger,{asChild:!0,children:(0,q.jsx)(Y.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,q.jsx)(lc.WrenchIcon,{})})})}),(0,q.jsx)(Y.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,q.jsxs)(Y.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,q.jsxs)(Y.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,q.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,q.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Vn).map(([p,u])=>{let f=p==="LOOP"&&(a||l),m=(()=>{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,q.jsxs)(Y.Tooltip,{children:[(0,q.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,q.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,q.jsx)(u.icon,{className:"stroke-inherit"})})}),m&&(0,q.jsx)(Y.TooltipContent,{color:"black",children:m})]},p)})})]}),(0,q.jsx)(Y.DropdownMenuGroup,{children:(0,q.jsxs)(Y.Tooltip,{children:[(0,q.jsx)(Y.TooltipTrigger,{asChild:!0,children:(0,q.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,q.jsx)(Rn.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),a&&(0,q.jsx)(Y.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var Q=require("react/jsx-runtime"),zt={START_EVENT:{type:"START_EVENT",icon:Yo,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:eo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:Yo,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:Pn,label:"bpmn.annotation.variant.default"}},wm={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:no,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:io,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:to,label:"bpmn.gateway.variant.complex"}},Te=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{let i=(0,Ft.useRef)(null),s=(0,Ft.useRef)(null),{t:a}=(0,Ke.useTranslation)(),{setDraggableNode:l}=wo(),{getEdges:c,getNodes:d}=(0,Or.useReactFlow)(),{setIsDragging:p,mode:u}=V(),{dimensions:f}=ic(i,r),{position:h}=ac(e,r,f),[m,g]=(0,Ft.useState)(void 0),_=d(),x=c(),y=o==="SUBPROCESS",b=(0,Ft.useCallback)((P,M)=>{l({type:M.type,variant:M.variant,attribute:M.attribute,icon:M.icon}),M.icon&&g((0,Q.jsx)(M.icon,{})),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("sourceId",e),s.current&&P.dataTransfer.setDragImage(s.current,10,10),setTimeout(()=>{p(!0)},100)},[e,l,p]),v=[{component:(0,Q.jsx)(gr,{elementId:e})}],w=()=>u==="view"?[]:[{component:(0,Q.jsx)(sn,{nodeId:e})},zt.TASK,zt.ANNOTATION,...v],T=()=>u==="view"?[{component:(0,Q.jsx)(xt,{elementId:e})}]:[{component:(0,Q.jsx)(xt,{elementId:e})},...y?[]:[{component:(0,Q.jsx)(cc,{nodeId:e})}],{component:(0,Q.jsx)(sn,{nodeId:e})},zt.TASK,...Object.values(wm),...v],C=()=>u==="view"?[{component:(0,Q.jsx)(xt,{elementId:e})}]:[{component:(0,Q.jsx)(xt,{elementId:e})},{component:(0,Q.jsx)(sn,{nodeId:e})},zt.TASK,zt.ANNOTATION,...v],R=()=>u==="view"?[]:[{component:(0,Q.jsx)(sn,{nodeId:e})},zt.ANNOTATION,...v],A=()=>u==="view"?[]:[...n?[]:[zt.ANNOTATION],...v],S=()=>u==="view"?[]:[...v],L=()=>u==="view"?[]:[...v],k=(P=>{switch(P){case"START_EVENT":return w();case"TASK":return T();case"GATEWAY":return C();case"END_EVENT":return R();case"LANE":return A();case"ANNOTATION":return S();case"UNSUPPORTED":return L();default:return[]}})(t);if(!(k.length===0||u==="readonly"))return(0,Q.jsxs)(Or.NodeToolbar,{position:h,align:"start",className:"-top-8",isVisible:r,children:[(0,Q.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:k.map((P,M)=>{if(P.component)return(0,Q.jsx)("div",{children:P.component},M);let z={sourceNodeType:t,targetNodeType:P.type,sourceNodeId:e,nodes:_,edges:x},G=Ll(z),O={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")},F=G.shouldDisable&&G.reason?O[G.reason]||a(P.label):a(P.label)||"";return(0,Q.jsxs)(Ke.Tooltip,{children:[(0,Q.jsx)(Ke.TooltipTrigger,{asChild:!0,children:(0,Q.jsx)(Ke.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!G.shouldDisable,disabled:G.shouldDisable,className:G.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:G.shouldDisable?void 0:W=>b(W,P),children:P.icon&&(0,Q.jsx)(P.icon,{size:16})})}),(0,Q.jsx)(Ke.TooltipContent,{color:"black",children:F})]},M)})}),(0,Q.jsx)("div",{ref:s,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:m})]})};var Wt=require("react/jsx-runtime"),dc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ao.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Ao.useConnection)(),{mode:a,isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),p=i&&(s==null?void 0:s.id)!==e,u=h=>{r(e,{label:h})},f=!l&&!c&&!d;return(0,Wt.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,Wt.jsx)(de,{value:t.label,className:"m-1 text-grey-600",onChange:u}),f&&(0,Wt.jsx)(Te,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),a==="edit"&&(0,Wt.jsx)(No,{minWidth:Lr.MIN_WIDTH,minHeight:Lr.MIN_HEIGHT,isVisible:!n&&o}),(!i||p)&&(0,Wt.jsx)(ce,{type:"target",position:Ao.Position.Left,className:D({"annotation-handle":p})})]})};var Yt=require("@xyflow/react"),uc=require("react");var st=require("react/jsx-runtime"),pc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Yt.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Yt.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:_})},h=()=>{p(!0)},m=()=>{p(!1)},g=!a&&!l&&!c;return(0,st.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,st.jsx)(eo,{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,st.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,st.jsx)(de,{value:t.label,isEditing:d,onChange:f})}),g&&(0,st.jsx)(Te,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||u)&&(0,st.jsx)(ce,{type:"target",position:Yt.Position.Left,className:D({"event-handle":u})}),!i&&(0,st.jsx)(ce,{type:"source",position:Yt.Position.Right})]})};var Ut=require("@xyflow/react"),Hr=require("react");var at=require("react/jsx-runtime"),fc=({id:e,data:t,selected:o,dragging:n})=>{let r=li[t.variant].icon,{updateNodeData:i}=(0,Ut.useReactFlow)(),{inProgress:s,fromNode:a}=(0,Ut.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),[p,u]=(0,Hr.useState)(!1),f=s&&(a==null?void 0:a.id)!==e,h=(0,Hr.useCallback)(x=>{i(e,{label:x})},[e,i]),m=()=>{u(!0)},g=()=>{u(!1)},_=!l&&!c&&!d;return(0,at.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:m,children:[(0,at.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,at.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,at.jsx)(de,{value:t.label,isEditing:p,onChange:h})}),_&&(0,at.jsx)(Te,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!s||f)&&(0,at.jsx)(ce,{type:"target",position:Ut.Position.Left,className:D({"gateway-handle":f})}),!s&&(0,at.jsx)(Dr,{type:"source",position:Ut.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var mc=require("@xyflow/react"),ze=require("lecom-ui"),Am=require("lucide-react");var gc=require("react/jsx-runtime");var $t=require("@xyflow/react"),hc=require("react");var lt=require("react/jsx-runtime"),yc=({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,hc.useState)(!1),u=i&&(s==null?void 0:s.id)!==e,f=_=>{r(e,{label:_})},h=()=>{p(!0)},m=()=>{p(!1)},g=!a&&!l&&!c;return(0,lt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,lt.jsx)(kn,{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,lt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,lt.jsx)(de,{value:t.label,isEditing:d,onChange:f})}),g&&(0,lt.jsx)(Te,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||u)&&(0,lt.jsx)(ce,{type:"target",position:$t.Position.Left,className:D({"event-handle":u})}),!i&&(0,lt.jsx)(ce,{type:"source",position:$t.Position.Right})]})};var Xt=require("@xyflow/react"),_c=require("lecom-ui"),Tc=require("react");var Gr=(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}`},Io=(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 mn=require("react/jsx-runtime"),xc=e=>(0,mn.jsxs)("svg",N(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,mn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,mn.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ki=require("react/jsx-runtime"),Ec=e=>(0,ki.jsx)("svg",N(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,ki.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 gn=require("react/jsx-runtime"),bc=e=>(0,gn.jsxs)("svg",N(E({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,gn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,gn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var he=require("react/jsx-runtime"),Im={APROVADO:xc,EM_ANDAMENTO:Ec,REJEITADO:bc},Ri={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)]"},vc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,_c.useTranslation)(),{updateNodeData:i,getNodes:s}=(0,Xt.useReactFlow)(),{inProgress:a,fromNode:l}=(0,Xt.useConnection)(),{mode:c,isConnecting:d,isDragging:p,isMultipleSelection:u,onSubprocessValidationClick:f}=V(),{getTaskStatus:h}=Ct(),m=a&&(l==null?void 0:l.id)!==e,g=(0,Tc.useCallback)(S=>{let L=S.trim(),I=t.label||"";if(L===I)return;let k=s(),P=L;L||(P=Gr(k,r("bpmn.task.label.prefix")));let M=Io(P,k);M!==I&&i(e,{label:M})},[t.label,s,e,r,i]),_=h(e),x=_?Im[_]:null,y=t.variant?Rn[t.variant].icon:null,b=t.attribute?Vn[t.attribute].icon:null,v=t.variant==="SUBPROCESS",w=y&&!v,T=b||v,C=()=>t.hasError?Ri.error:_?Ri[_]:Ri.default,R=()=>{f==null||f({id:e,type:"sub_process",label:t.label})},A=!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",C(),{"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)(de,{value:t.label,maxLength:60,className:D("m-1",{"py-6":w||T}),onChange:g}),y&&(0,he.jsx)("div",{className:D("absolute flex items-center p-1",v?"bottom-0":"top-0 left-0"),children:(0,he.jsx)(y,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500",v&&"cursor-pointer"),onClick:v?R:void 0})}),b&&(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",v?"justify-between":"justify-center"),children:(0,he.jsx)(b,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500")})})}),x&&(0,he.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,he.jsx)(x,{})}),A&&(0,he.jsx)(Te,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),c==="edit"&&(0,he.jsx)(No,{minWidth:Mr.MIN_WIDTH,minHeight:Mr.MIN_HEIGHT,isVisible:!n&&o}),(!a||m)&&(0,he.jsx)(ce,{type:"target",position:Xt.Position.Left,className:D({"task-handle":m})}),!a&&(0,he.jsx)(Dr,{type:"source",position:Xt.Position.Right,nodeId:e,nodeType:"TASK"})]})};var Vi=require("@xyflow/react");var ct=require("react/jsx-runtime"),Nc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:s}=V(),a=!r&&!i&&!s;return(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.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,ct.jsx)(Te,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,ct.jsx)(ce,{type:"source",position:Vi.Position.Right}),(0,ct.jsx)(ce,{type:"target",position:Vi.Position.Left})]})};var ye=require("@xyflow/react"),wc=require("react");var bt=require("react/jsx-runtime"),yN={type:"MESSAGE_EDGE",markerEnd:{type:ye.MarkerType.Arrow},data:{label:""}},Ac=({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,wc.useState)(!1),d=(0,ye.useInternalNode)(t),p=(0,ye.useInternalNode)(o);if(!d||!p)return null;let{sx:u,sy:f,tx:h,ty:m,sourcePos:g,targetPos:_}=nt(d,p),[x,y,b]=(0,ye.getSmoothStepPath)({sourceX:u,sourceY:f,targetX:h,targetY:m,sourcePosition:g,targetPosition:_}),v=r||(d==null?void 0:d.selected)||(p==null?void 0:p.selected),w=v?"sequence-edge-marker-highlighted":"sequence-edge-marker",T=l||(n==null?void 0:n.label.trim().length)>0,C=1/i,R=()=>{c(!0)},A=()=>{c(!1)},S=L=>{s(e,{label:L.trim()})};return(0,bt.jsxs)("g",{className:D("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":v}),onBlur:A,onDoubleClick:R,children:[(0,bt.jsx)(ye.BaseEdge,{id:e,path:x,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)]":v&&!(n!=null&&n.hasError)})}),(0,bt.jsx)(ye.EdgeLabelRenderer,{children:(0,bt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${b}px)`},children:[r&&!a&&(0,bt.jsx)(xo,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${C})`}}),T&&(0,bt.jsx)(de,{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:S})]})})]})};var Ic=require("@xyflow/react"),hn=require("react/jsx-runtime"),Cc=({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}=nt(r,i),[u]=(0,Ic.getBezierPath)({sourceX:s,sourceY:a,sourcePosition:d||o,targetPosition:p||n,targetX:l||e,targetY:c||t});return(0,hn.jsxs)("g",{children:[(0,hn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:u}),(0,hn.jsx)("circle",{cx:l||e,cy:c||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Br=require("@xyflow/react"),Sc=require("lodash"),yn=require("react");var Ce=require("react/jsx-runtime"),Mc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:s}=(0,Br.useReactFlow)(),{mode:a,isConnecting:l,isDragging:c,isMultipleSelection:d}=V(),[p,u]=(0,yn.useState)(!1),f=s(),h=!r,m=(0,yn.useMemo)(()=>(0,Sc.orderBy)([...f.filter(w=>w.parentId===e&&w.type==="LANE")],"position.y","asc"),[f,e]),g=h?Pr.MIN_WIDTH:J.MIN_WIDTH,_=(0,yn.useMemo)(()=>{if(h&&m.length>1){let w=[...m];return w.pop(),w.reduce((C,R)=>{var A,S;return C+((S=(A=R.measured)==null?void 0:A.height)!=null?S:0)},0)+J.MIN_HEIGHT}return J.MIN_HEIGHT},[h,m]),x=w=>{i(e,{label:w})},y=()=>{u(!0)},b=()=>{u(!1)},v=!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:b,onDoubleClick:y,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)(de,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:D({"whitespace-nowrap":p}),isEditing:p,onChange:x})})}),(0,Ce.jsx)("div",{className:"flex-1"})]}),v&&(0,Ce.jsx)(Te,{nodeId:e,nodeType:"LANE",isChild:!h,isVisible:!n&&o}),a==="edit"&&(0,Ce.jsx)(No,{nodeId:e,minWidth:g,minHeight:_,isVisible:!n&&o}),h&&(0,Ce.jsx)(ce,{type:"source",position:Br.Position.Right})]})};var Pc={START_EVENT:yc,END_EVENT:pc,TASK:vc,GATEWAY:fc,ANNOTATION:dc,LANE:Mc,UNSUPPORTED:Nc},Lc={SEQUENCE_EDGE:Cl,MESSAGE_EDGE:Ac,ANNOTATION_EDGE:wl},Dc="#fafafa",kc="#bebebe",Rc=1,Vc=10,Oc="bottom-left",Hc=.2,Gc=5,Co=.5,Bc={x:0,y:0,zoom:.75},Cm=1,Sm=2,zc=[Cm,Sm];var So=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,Fc.useReactFlow)(),i=(0,Oi.useCallback)(async(a="")=>{let{nodes:l,edges:c}=await tc(a);o(l),n(c),r({padding:Co})},[o,n,r]),s=(0,Oi.useCallback)((a,l)=>{let c=a||e()||[],d=l||t()||[];return ec(c,d)},[e,t]);return{importFromMxGraph:i,exportToMxGraph:s}};var Hi=require("react"),Mm=500,Mo=()=>{let{isInitialized:e,onElementChanges:t}=V(),{exportToMxGraph:o}=So(),n=(0,Wc.useDebouncedCallback)(()=>{if(!e)return;let s=o();t==null||t(s)},Mm),r=(0,Hi.useCallback)(s=>{s.every(c=>c.type==="select")||s.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Hi.useCallback)(s=>{s.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var Yc=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,zr.useReactFlow)(),{emitElementChanges:r}=Mo(),i=(0,Gi.useCallback)(a=>{let l=t(a.source),c=t(a.target);if(!l||!c)return!1;let d={sourceNodeId:l.id,targetNodeId:c.id,sourceNodeType:l.type,targetNodeType:c.type,nodes:n(),edges:o()};return Pl(d).isValid},[t,o,n]),s=(0,Gi.useCallback)(a=>{e(l=>{let c=t(a.target),d=(c==null?void 0:c.type)==="ANNOTATION"?Eo:Be;return(0,zr.addEdge)(E(E({},a),d),l)}),r()},[t,e,r]);return{isValidConnection:i,onConnect:s}};var jc=require("@xyflow/react"),ed=require("lecom-ui"),qt=require("react");var xn=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Kt=(e=[])=>e.filter(t=>t.type==="END_EVENT"),_t=(e=[])=>e.filter(t=>t.type==="TASK")||[],Uc=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),$c=(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"),Xc=(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),En=(e,t=[])=>t.filter(o=>o.target===e),Kc=(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"},qc=(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},Zc=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:[]}},qe=(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)}},Jc=(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 bn=[{id:"start_event_not_found",validate:e=>{let t=xn(e.nodes);return $({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Kt(e.nodes);return $({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=xn(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=_t(e.nodes),o=qe(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=_t(e.nodes),o=qe(t,n=>!!n.label&&n.label.trim()!=="");return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=_t(e.nodes),n=qe(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=_t(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return $({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=[...xn(e.nodes),...Kt(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=Kt(e.nodes),o=[],n=[];for(let r of t){let i=En(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=Xc(e.nodes),o=qe(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=_t(e.nodes),o=qe(t,n=>!n.label||Zc(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=Kt(e.nodes)[0];if(!t)return $({isValid:!0});let o=En(t.id,e.edges);if(!o.length)return $({isValid:!0});let r=_t(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=qe(r,l=>!Kc(l.id,e));return $({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=_t(e.nodes),o=Kt(e.nodes)[0];if(!o)return $({isValid:!0});let n=t.filter(l=>{let c=En(l.id,e.edges),d=Se(l.id,e.edges),p=c.some(f=>{var h;return((h=e.nodes.find(m=>m.id===f.source))==null?void 0:h.type)==="START_EVENT"}),u=d.some(f=>{var h;return((h=e.nodes.find(m=>m.id===f.target))==null?void 0:h.type)==="END_EVENT"});return p&&u}),r=En(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=qe(t,n=>Se(n.id,e.edges).length>=1);return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...xn(e.nodes),...Kt(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=Uc(e.nodes),o=qe(t,n=>!qc(n.id,e));return $({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=$c(e.nodes),o=qe(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 Qc=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of bn){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 td=()=>{let{t:e}=(0,ed.useTranslation)(),{setNodes:t,setEdges:o,getNodes:n,getEdges:r}=(0,jc.useReactFlow)(),[i,s]=(0,qt.useState)(null),[a,l]=(0,qt.useState)(!1),c=(0,qt.useCallback)(u=>{let f=Jc(u.nodes,u.edges),h=Qc(f),m=h.errors.map(g=>N(E({},g),{message:e(`validation.errors.${g.id}`)}));return a||l(!0),{isValid:h.isValid,errors:m}},[a,e]),d=(0,qt.useCallback)(u=>{if(s(u),!u)return;let f=[],h=[];u.errors.forEach(T=>{T.nodeIds&&T.nodeIds.length>0&&T.nodeIds.forEach(C=>f.push(C)),T.edgeIds&&T.edgeIds.length>0&&T.edgeIds.forEach(C=>h.push(C))});let m=[...new Set(f)];t(T=>T.map(C=>N(E({},C),{data:N(E({},C.data),{hasError:!1})}))),o(T=>T.map(C=>N(E({},C),{data:N(E({},C.data),{hasError:!1})})));let g=n(),_=r(),x=new Set(m),y=new Set;u.errors.forEach(T=>{var A,S;let C=bn.find(L=>L.id===T.id);(C==null?void 0:C.highlightRelatedEdges)!==!1&&((A=T.edgeIds)==null||A.forEach(L=>y.add(L)),(S=T.nodeIds)==null||S.forEach(L=>{_.forEach(I=>{(I.source===L||I.target===L)&&y.add(I.id)})}))});let b=new Set,v=new Set,w=new Set;g.forEach(T=>{T.type==="START_EVENT"?b.add(T.id):T.type==="END_EVENT"&&v.add(T.id)}),_.forEach(T=>{b.has(T.source)&&w.add(T.target),v.has(T.target)&&w.add(T.source)}),w.forEach(T=>{var C,R;if(x.has(T)){let A=(C=u.errors.find(L=>{var I;return(I=L.nodeIds)==null?void 0:I.includes(T)}))==null?void 0:C.id;((R=bn.find(L=>L.id===A))==null?void 0:R.highlightRelatedEdges)!==!1&&_.forEach(L=>{L.source===T&&v.has(L.target)&&(x.add(L.target),y.add(L.id)),L.target===T&&b.has(L.source)&&(x.add(L.source),y.add(L.id))})}}),x.size>0&&t(T=>T.map(C=>N(E({},C),{data:N(E({},C.data),{hasError:x.has(C.id)})}))),y.size>0&&o(T=>T.map(C=>N(E({},C),{data:N(E({},C.data),{hasError:y.has(C.id)})})))},[r,n,o,t]),p=(0,qt.useCallback)(()=>{s(null),l(!1),t(u=>u.map(f=>N(E({},f),{data:N(E({},f.data),{hasError:!1})}))),o(u=>u.map(f=>N(E({},f),{data:N(E({},f.data),{hasError:!1})})))},[o,t]);return{validationResult:i,validateDiagram:c,handleValidationComplete:d,clearValidation:p,isAutoValidationEnabled:a}};var rd=require("@xyflow/react"),id=require("lecom-ui"),sd=require("react"),Bi=require("uuid");var Pm=15,od="bpmn:selection",Lm=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},nd=e=>{if(!Lm(e.target))return!0;let t=window.getSelection(),o=t&&t.toString().length>0;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement){let n=e.target;return n.selectionStart===n.selectionEnd&&!o}return!o},ad=({offset:e=Pm}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,rd.useReactFlow)(),{t:i}=(0,id.useTranslation)();(0,sd.useEffect)(()=>{let s=l=>{var m,g;if(!nd(l))return;let c=t(),d=n(),p=c.filter(_=>_.selected);if(!p.length)return;l.preventDefault(),l.stopPropagation();let u=d.filter(_=>p.some(x=>x.id===_.source)&&p.some(x=>x.id===_.target)),h=JSON.stringify({nodes:p,edges:u});(m=l.clipboardData)==null||m.setData(od,h),(g=l.clipboardData)==null||g.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},a=l=>{var y,b;if(!nd(l))return;let c=(y=l.clipboardData)==null?void 0:y.getData(od);if(!c)return;l.preventDefault(),l.stopPropagation();let d;try{d=JSON.parse(c)}catch(v){return}if(!((b=d.nodes)!=null&&b.length))return;let p=new Map,u=t(),f=[],h=u.some(v=>v.type==="START_EVENT"),m=d.nodes.filter(v=>v.type==="START_EVENT"),g=d.nodes;if(h&&m.length>0&&(g=d.nodes.filter(v=>v.type!=="START_EVENT"),g.length===0))return;let _=g.map(v=>{var C;let w=(0,Bi.v7)();p.set(v.id,w);let T=N(E({},v),{id:w,selected:!0,position:{x:v.position.x+e,y:v.position.y+e}});if(v.type==="TASK"){let R=(C=v.data)==null?void 0:C.label,A=Io(R||i("bpmn.task.label.prefix"),[...u,...f]);T.data=N(E({},v.data),{label:A})}return f.push(T),T}),x=d.edges.map(v=>N(E({},v),{id:(0,Bi.v7)(),selected:!0,source:p.get(v.source)||v.source,target:p.get(v.target)||v.target}));o(v=>[...v.map(w=>N(E({},w),{selected:!1})),..._]),r(v=>[...v.map(w=>N(E({},w),{selected:!1})),...x])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",a,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",a,!0)}},[t,o,n,r,e,i])};var Wr=require("@xyflow/react");var ld=require("lecom-ui"),cd=require("react"),zi=require("uuid");var dd=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,Wr.useStoreApi)(),{draggableNode:r,setDraggableNode:i}=wo(),{t:s}=(0,ld.useTranslation)(),{getInternalNode:a,screenToFlowPosition:l}=(0,Wr.useReactFlow)(),{setIsDragging:c}=V(),{rebuildIndex:d,forceRebuildIndex:p}=go(),[u,f]=(0,cd.useState)(null),h=(A,S=!1)=>{let L=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(I=>I.map(k=>N(E({},k),{className:k.id===A?L:""})))},m=()=>{let{nodeLookup:A}=n.getState();return Array.from(A.values())},g=A=>{let S=a(A.id),L=m();if(A.type==="LANE"){if(vo({parentId:A.id,nodes:e,includeTypes:["LANE"]})){h();return}let G=L.filter(W=>W.id!==A.id&&W.type==="LANE"&&!W.parentId),O=un(S,G);if(!O){h();return}if(vo({parentId:O.id,nodes:e,excludeTypes:["LANE"]})){h(O.id,!0);return}h(O.id);return}let k=L.filter(z=>z.id!==A.id&&z.type==="LANE"),P=un(S,k);if(!P){h();return}if(vo({parentId:P.id,nodes:e,includeTypes:["LANE"]})){h();return}h(P.id)},_=A=>A.map(S=>N(E({},S),{className:void 0})),x=A=>A.some(L=>L.dragging)?A.map(L=>L.dragging?N(E({},L),{dragging:!1}):L):A,y=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},b=(A,S)=>{A.preventDefault(),g(S)},v=(A,S,L)=>{var z,G;let I=[...L];if(A.parentId===S.id)return I=Jl(A,S,I),I=pn(I),_(I);if(A.type==="LANE"){if(vo({parentId:S.id,nodes:I,excludeTypes:["LANE"]})){let re=Ae(S),me=50,Qe=50;return I.map(Oe=>{var jt,Go;return Oe.id===A.id?N(E({},Oe),{position:{x:(jt=u==null?void 0:u.x)!=null?jt:re.x+me,y:(Go=u==null?void 0:u.y)!=null?Go:re.y2+Qe}}):Oe})}let W=I.filter(re=>re.parentId===S.id).reduce((re,me)=>{var Qe,Oe;return re+((Oe=(Qe=me.measured)==null?void 0:Qe.height)!=null?Oe:0)},0),se={x:J.HEADER_WIDTH,y:W};return I=I.map(re=>re.id===A.id?N(E({},re),{parentId:S.id,position:se,className:void 0}):N(E({},re),{className:void 0})),I=Bt(S.id,I),I}if(vo({parentId:S.id,nodes:I,includeTypes:["LANE"]})){let O;if(A.parentId){let F=a(A.parentId),{x:W,y:se}=rt(F);O={x:W+((z=A.position.x)!=null?z:0),y:se+((G=A.position.y)!=null?G:0)}}return I=I.map(F=>F.id===A.id?N(E({},F),{position:O!=null?O:F.position,parentId:void 0,className:void 0}):N(E({},F),{className:void 0})),I}let M=$l(A,S);return I=I.map(O=>{if(O.id===A.id){let F=Ae(A),W=Ae(S);return F.y<W.y&&(M.y=0),F.x<W.x+J.HEADER_WIDTH&&(M.x=J.HEADER_WIDTH),N(E({},O),{parentId:S.id,position:M,className:void 0})}return N(E({},O),{className:void 0})}),I=pn(I),I},w=A=>{if(A.preventDefault(),!(r!=null&&r.type))return;let S=l({x:A.clientX,y:A.clientY}),L={width:B[r.type].MIN_WIDTH,height:B[r.type].MIN_HEIGHT},I={id:(0,zi.v7)(),type:r.type,position:S,measured:L,data:{label:r.type==="TASK"?Gr(e,s("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},k=N(E({},I),{internals:{positionAbsolute:S}}),P=m(),M=r.type==="LANE",z=P.filter(W=>M?W.type==="LANE"&&!W.parentId:W.type==="LANE"),G=un(k,z),O=[...e.map(W=>N(E({},W),{selected:!1})),I];G&&(O=v(k,G,O)),O=it(O),t(O),p();let F=A.dataTransfer.getData("sourceId");if(F){let W={id:(0,zi.v7)(),source:F,target:I.id};if(r.type==="ANNOTATION"){o(se=>se.concat(E(E({},W),Eo)));return}o(se=>se.concat(E(E({},W),Be)))}c(!1),i(null)},T=async(A,S,L)=>{let I=[...e];L.forEach(k=>{let P=m(),M=a(k.id),z=k.type==="LANE",G=P.filter(F=>F.id!==k.id&&(z?F.type==="LANE"&&!F.parentId:F.type==="LANE")),O=un(M,G);if(O){I=v(M,O,I);return}k.parentId&&(I=R(k,I))}),I=x(I),I=it(I),I=_(I),t(I),d(I),f(null)},C=(A,S)=>{f({x:S.position.x,y:S.position.y})},R=(A,S)=>{var M,z;let L=a(A.parentId),{x:I,y:k}=rt(L),P={x:I+((M=A.position.x)!=null?M:0),y:k+((z=A.position.y)!=null?z:0)};return S=S.map(G=>G.id===A.id?N(E({},G),{position:P,parentId:void 0}):G),S=Bt(A.parentId,S),S};return{onDragOver:y,onDrop:w,onNodeDrag:b,onNodeDragStart:C,onNodeDragStop:T}};var ud=require("@xyflow/react"),pd=require("lecom-ui"),fd=require("react"),Fi=require("uuid");var Dm=30,km=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},Rm=e=>!km(e.target),md=({offset:e=Dm}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,ud.useReactFlow)(),{t:i}=(0,pd.useTranslation)();(0,fd.useEffect)(()=>{let s=a=>{if(a.ctrlKey&&a.key.toLowerCase()==="d"&&Rm(a)){a.preventDefault(),a.stopPropagation();let l=t(),c=n(),d=l.filter(y=>y.selected);if(!d.length)return;let p=new Map,u=[],f=l.some(y=>y.type==="START_EVENT"),h=d.filter(y=>y.type==="START_EVENT"),m=d;if(f&&h.length>0&&(m=d.filter(y=>y.type!=="START_EVENT"),m.length===0))return;let g=c.filter(y=>m.some(b=>b.id===y.source)&&m.some(b=>b.id===y.target)),_=m.map(y=>{var w;let b=(0,Fi.v7)();p.set(y.id,b);let v=N(E({},y),{id:b,selected:!0,position:{x:y.position.x+e,y:y.position.y+e}});if(y.type==="TASK"){let T=(w=y.data)==null?void 0:w.label,C=Io(T||i("bpmn.task.label.prefix"),[...l,...u]);v.data=N(E({},y.data),{label:C})}return u.push(v),v}),x=g.map(y=>N(E({},y),{id:(0,Fi.v7)(),selected:!0,source:p.get(y.source)||y.source,target:p.get(y.target)||y.target}));o(y=>[...y.map(b=>N(E({},b),{selected:!1})),..._]),r(y=>[...y.map(b=>N(E({},b),{selected:!1})),...x])}};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[t,o,n,r,e,i])};var Ed=require("@xyflow/react"),_n=require("uuid");var hd={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},yd={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},gd=(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}},Vm=e=>{e=e||"";let t=e.trim().split(`
|
|
3
|
+
`),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let s=gd(i[0],o),a=gd(i[1],o);s&&a&&n.push({sourceId:s.step,targetId:a.step,label:s.edgeLabel||a.edgeLabel||""})}),{components:o,connections:n}},xd=e=>{let{components:t,connections:o}=Vm(e);return{nodes:t,edges:o}};var bd=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Ed.useReactFlow)();return{importFromLia:r=>{let i=typeof r=="string"?r:r.diagramXml||"",{nodes:s,edges:a}=xd(i),l=[],c=new Map,d=!1;for(let[h,m]of Object.entries(s)){let g=(0,_n.v7)(),_=hd[m.type],x=yd[m.type];_==="START_EVENT"&&(d=!0),c.set(h,g);let y=B[_].MIN_WIDTH,b=B[_].MIN_HEIGHT;l.push({id:g,type:_,data:{label:m.label||"",variant:x,attribute:""},position:{x:0,y:0},width:y,height:b,measured:{width:y,height:b}})}let p=[];for(let h of a){let m=N(E({},Be),{id:(0,_n.v7)(),source:c.get(h.sourceId)||h.sourceId,target:c.get(h.targetId)||h.targetId});p.push(m)}if(!d&&l.length>0){let h=(0,_n.v7)(),m={id:h,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:B.START_EVENT.MIN_WIDTH,height:B.START_EVENT.MIN_HEIGHT,measured:{width:B.START_EVENT.MIN_WIDTH,height:B.START_EVENT.MIN_HEIGHT}};l.unshift(m);let g=l[1];if(g){let _=N(E({},Be),{id:(0,_n.v7)(),source:h,target:g.id});p.unshift(_)}}let{nodes:u,edges:f}=Zl(l,p);e(u),t(f),o({padding:Co})}}};var Yr=require("react"),Om={origin:"*",debug:!1};function _d(e,t=Om){let{origin:o,debug:n}=t,r=(0,Yr.useCallback)((i,s)=>{let a={event:i,data:[i,{event:i,data:s}]};window.parent.postMessage(a,o||"*")},[o]);return(0,Yr.useEffect)(()=>{let i=s=>{let a=s.data;if(!(a!=null&&a.event)||!(a!=null&&a.data))return;let{event:l,data:c}=a,d;if(Array.isArray(c)){let[,p]=c;d=p.data}else d=c;n&&(console.debug("[postMessage] received:",a),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var Td=require("@xyflow/react"),Wi=require("react");var vd=()=>{let e=(0,Td.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=V(),{importFromMxGraph:n}=So();(0,Wi.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,Wi.useEffect)(()=>{if(!e)return;(async()=>{await Ln(),o(!0)})()},[e,o])};var Yi=require("react"),Nd=require("@xyflow/react");function wd(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Ct(),{getEdges:n}=(0,Nd.useReactFlow)(),r=On(),i=(0,Yi.useCallback)(a=>{if(!(a!=null&&a.activities))return;e(a.activities);let l=a.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),s=(0,Yi.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:s}}var Cd=require("@xyflow/react"),Ve=require("react"),Sd=require("use-debounce");var Ad=[{nodes:[],edges:[]}],Hm=500,Id=100,Md=(e=Ad)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Cd.useReactFlow)(),[i,s]=(0,Ve.useState)(e),[a,l]=(0,Ve.useState)(0),c=i[a],d=a>0,p=a<i.length-1,u=(0,Ve.useCallback)(b=>{n(i[b].nodes),r(i[b].edges)},[i,n,r]),f=(0,Ve.useCallback)(()=>{if(a>0){let b=a-1;l(b),u(b)}},[a,u]),h=(0,Ve.useCallback)(()=>{if(a<i.length-1){let b=a+1;l(b),u(b)}},[i,a,u]),m=b=>{let w=[...i.slice(0,a+1),b],T=w.length>Id?w.slice(w.length-Id):w;s(T),l(T.length-1)},g=(0,Sd.useDebouncedCallback)(()=>{let b=t(),v=o(),w=b.map(R=>N(E({},R),{selected:!1,className:""})),T={nodes:it(w),edges:v};JSON.stringify(c)!==JSON.stringify(T)&&m(T)},Hm),_=(0,Ve.useCallback)(b=>{if(b==="forceSave"){g();return}b.some(T=>T.type==="select")||b.some(T=>T.type==="position"&&T.dragging)||g()},[g]),x=(0,Ve.useCallback)(b=>{s(b||Ad),l(0)},[]),y=(0,Ve.useCallback)(()=>{s([]),l(0)},[]);return(0,Ve.useEffect)(()=>{let b=v=>{(v.ctrlKey||v.metaKey)&&(v.shiftKey&&v.key.toLowerCase()==="z"?(v.preventDefault(),h()):v.key.toLowerCase()==="z"&&(v.preventDefault(),f()))};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[f,h]),{history:i,undo:f,redo:h,canUndo:d,canRedo:p,saveHistory:_,resetHistory:x,clearHistory:y}};var Gm=500,Ld=()=>{let e=(0,Me.useRef)(!1),[t,o,n]=(0,Tt.useNodesState)([]),[r,i,s]=(0,Tt.useEdgesState)([]),[a,l]=(0,Me.useState)(null),{getNodes:c,getEdges:d}=(0,Tt.useReactFlow)(),{instanceId:p,setIsConnecting:u,setIsMultipleSelection:f}=V(),{updateHelperLines:h,HelperLines:m}=go(),{undo:g,redo:_,canUndo:x,canRedo:y,saveHistory:b}=Md(),{onNodeDrag:v,onDrop:w,onDragOver:T,onNodeDragStop:C,onNodeDragStart:R}=dd({nodes:t,setNodes:o,setEdges:i}),{isValidConnection:A,onConnect:S}=Yc({setEdges:i}),{validationResult:L,handleValidationComplete:I,clearValidation:k,isAutoValidationEnabled:P,validateDiagram:M}=td(),{importFromLia:z}=bd(),{handleTasksStatus:G,handleClearTaskStatus:O}=wd(),{clearPathEdges:F}=Ct(),W=On(),{emitElementChanges:se,handleNodeChanges:re,handleEdgeChanges:me}=Mo();ad(),md(),vd();let Qe=(0,Me.useCallback)(()=>{o([]),i([]),F(),setTimeout(()=>{W()},0)},[o,i,F,W]);_d({LIA_CREATE_DIAGRAM:z,CLEAR_DIAGRAM:Qe,TASKS_STATUS:G,CLEAR_TASKS_STATUS:O});let{selectElements:Oe,clearSelection:jt}=yt(),{importFromMxGraph:Go,exportToMxGraph:oi}=So(),{configureElement:Qi,getConfigureElement:ji}=mr();(0,Me.useEffect)(()=>(Po.set(p,{importFromMxGraph:Go,exportToMxGraph:oi,selectElements:Oe,clearSelection:jt,configureElement:Qi,getConfigureElement:ji}),()=>{Po.delete(p)}),[p,Go,oi,Oe,jt,Qi,ji]);let bu=(0,Me.useCallback)(()=>{if(!P){e.current=!1;return}let Ne=M({nodes:c(),edges:d()});I(Ne),e.current=!1},[P,c,d,M,I]),es=(0,Pd.useDebouncedCallback)(bu,Gm),wn=(0,Me.useCallback)(()=>{P&&!e.current&&(e.current=!0,es())},[P,es]),_u=(0,Me.useCallback)(Ne=>{let Bo=h(Ne,t);n(Bo),b(Ne),wn(),re(Ne)},[t,n,b,wn,h,re]),Tu=(0,Me.useCallback)(Ne=>{s(Ne),b(Ne),wn(),me(Ne)},[s,b,wn,me]);(0,Tt.useOnSelectionChange)({onChange:({nodes:Ne,edges:Bo})=>{f(Ne.length+Bo.length>1)}});let vu=(0,Me.useCallback)(async({nodes:Ne,edges:Bo})=>(l({nodes:Ne,edges:Bo}),!1),[l]);return{nodes:t,setNodes:o,edges:r,setEdges:i,events:{isValidConnection:A,onConnect:S,onDrop:w,onDragOver:T,onNodeDrag:v,onNodeDragStop:C,onNodeDragStart:R,onDropCapture:()=>{b("forceSave"),se()},onConnectStart:()=>{u(!0)},onConnectEnd:()=>{u(!1)},onBeforeDelete:vu,onNodesChange:_u,onEdgesChange:Tu},ui:{pendingDelete:a,setPendingDelete:l,validationResult:L,handleCloseValidationPanel:k},controls:{undo:g,redo:_,canUndo:x,canRedo:y},components:{HelperLines:m},actions:{saveHistory:b,selectElements:Oe,clearSelection:jt,exportToMxGraph:oi,validateDiagram:M,handleValidationComplete:I}}};var Ui=require("react/jsx-runtime"),$i=({id:e,className:t})=>(0,Ui.jsx)("marker",{id:e,className:D("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,Ui.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var Lo=require("react/jsx-runtime"),Dd=()=>(0,Lo.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,Lo.jsxs)("defs",{children:[(0,Lo.jsx)($i,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,Lo.jsx)($i,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var qi=require("@xyflow/react"),ie=require("lecom-ui"),Ro=require("lucide-react"),ko=require("react");var Ze=require("lecom-ui");var Tn=(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))(Tn||{});var Ud=require("@xyflow/react"),Do=require("lecom-ui");var kd=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 Rd({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
|
|
4
|
+
`),i=encodeURI(r);Ur(i,`${o}.csv`)}var Ur=(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)};var Wd=require("uuid");function Vd(e){return e==null?void 0:e.replaceAll("
"," ")}var Gd=require("uuid");var eA={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Od={script:"SCRIPT",subprocess:"SUBPROCESS"},Hd={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Zt=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i,parent:s}=n,a=Number(r._attributes.width),l=Number(r._attributes.height),c=s==="1"?void 0:s;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:a,height:l,measured:{width:a,height:l}}},zm=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=B.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=B.START_EVENT.MIN_HEIGHT,{node:Zt({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Fm=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=B.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=B.END_EVENT.MIN_HEIGHT,{node:Zt({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Wm=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Od[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=ut(e.mxGeometry._attributes.width||0,B.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ut(e.mxGeometry._attributes.height||0,B.TASK.MIN_HEIGHT),{node:Zt({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Ym=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=Hd[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=B.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=B.GATEWAY.MIN_HEIGHT,{node:Zt({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Um=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:Zt({cell:e,type:"LANE"}),status:"imported",originalType:t}},$m=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ut(e.mxGeometry._attributes.width||0,B.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ut(e.mxGeometry._attributes.height||0,B.ANNOTATION.MIN_HEIGHT),{node:Zt({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Bd=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=B.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=B.UNSUPPORTED.MIN_HEIGHT,{node:Zt({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},zd=(e,t)=>{let{source:o,target:n,value:r}=e._attributes;return N(E({},Be),{id:(0,Gd.v7)(),source:t.get(o)||o,target:t.get(n)||n,data:{label:r||""}})},Fd={TASK:Wm,GATEWAY:Ym,START_EVENT:zm,END_EVENT:Fm,LANE:Um,ANNOTATION:$m};var Xm=(e,t)=>{let o=e.filter(n=>n.parentId);for(let n of o){let r=t.get(n.parentId);r&&(n.parentId=r)}return e},Km=e=>{var s;let t=new Map,o=Object.values(Tn),n=e.filter(a=>{var c;let l=(c=a._attributes)==null?void 0:c.type;return o.includes(l)}),r=[],i=[];for(let a of n){let l=(0,Wd.v7)(),{type:c}=a._attributes,d=Fd[c]||Bd;t.set((s=a._attributes)==null?void 0:s.id,l),a._attributes.id=l;let{node:p,status:u,originalType:f}=d(a);i.push(p),r.push({originalType:f,type:p.type,variant:p.data.variant,value:Vd(p.data.label),status:u})}return i=Xm(i,t),{nodes:i,governanceIdToNodeIdMap:t,summary:r}},qm=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>zd(r,t)),Zm=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Km(t.root.mxCell),i=qm(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Jm=async e=>{let t=await kd(e),o=Sr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!i||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},Yd=async e=>{try{let t=await Jm(e),{nodes:o,edges:n,summary:r}=Zm(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Xd=require("react/jsx-runtime"),$d=()=>{let{t:e}=(0,Do.useTranslation)(),{toast:t}=(0,Do.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,Ud.useReactFlow)(),i=a=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=a.map(d=>[d.originalType,d.value,e(`adapter.governance.report.status.${d.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Xd.jsx)(Do.Button,{size:"small",variant:"ghost",onClick:()=>Rd({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async a=>{try{let{nodes:l,edges:c,summary:d}=await Yd(a);if(o(u=>u.concat(l)),n(u=>u.concat(c)),r({padding:Co}),d.some(u=>u.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 Kd=require("lecom-ui"),qd=require("react");var Jt=require("react/jsx-runtime"),Zd=a=>{var l=a,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,s=We(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,qd.useRef)(null),d=u=>{let f=u.target.files;f!=null&&f.length&&i(f),c.current&&(c.current.value="")};return(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(Kd.Button,N(E({onClick:u=>{var f;(f=c.current)==null||f.click(),r==null||r(u)}},s),{children:e})),(0,Jt.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var Qt=require("react/jsx-runtime"),Jd=({disabled:e=!1})=>{let{t}=(0,Ze.useTranslation)(),{toast:o}=(0,Ze.useNotificationToast)(),{importFromGovernance:n}=$d(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=s=>{let a=s[0];if(!a){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(a)};return(0,Qt.jsxs)(Ze.Tooltip,{children:[(0,Qt.jsx)(Ze.TooltipTrigger,{asChild:!0,children:(0,Qt.jsx)(Zd,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Qt.jsx)(ds,{})})}),(0,Qt.jsx)(Ze.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var Qd=require("react/jsx-runtime"),Xi=({shortcut:e})=>(0,Qd.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 U=require("lecom-ui"),vt=require("lucide-react"),ou=require("react");var jd=require("@xyflow/react"),vn=require("html-to-image"),$r=require("lecom-ui"),eu=require("react");var Qm=3,Ki="diagram",tu=()=>{let{t:e}=(0,$r.useTranslation)(),{getNodes:t}=(0,jd.useReactFlow)(),{clearSelection:o}=yt(),[n,r]=(0,eu.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:d,y:p,width:u,height:f}=jl(t());return{width:u,height:f,style:{width:`${u}px`,height:`${f}px`,transform:`translate(${-d}px, ${-p}px)`}}},s=async(d,p)=>{r(N(E({},n),{[p]:!0})),await o();try{let u=Ql();if(!u)throw new Error("Flow element not found");let f=i();return await d(u,f)}catch(u){(0,$r.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(N(E({},n),{[p]:!1}))}};return{exportAsPng:async(d=Ki)=>{await s(async(p,u)=>{let f=await(0,vn.toPng)(p,N(E({},u),{backgroundColor:"#fcfcfc"}));Ur(f,`${d}.png`)},"png")},exportAsHtml:async(d=Ki)=>{await s(async(p,u)=>{let f=await(0,vn.toSvg)(p,N(E({},u),{backgroundColor:"#fcfcfc"})),h=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<img src="${f}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,m=new Blob([h],{type:"text/html"}),g=URL.createObjectURL(m);
|
|
18
|
+
`,m=new Blob([h],{type:"text/html"}),g=URL.createObjectURL(m);Ur(g,`${d}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(d=Ki)=>{await s(async(p,u)=>{let f=await(0,vn.toPng)(p,N(E({},u),{pixelRatio:Qm})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let m=h.document;m.open(),m.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
<img src="${f}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),m.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var $=require("react/jsx-runtime");function $d(){let{t:e}=(0,z.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=Ud(),[s,l]=(0,Yd.useState)(!1);return(0,$.jsxs)(z.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,$.jsx)(z.DropdownMenuTrigger,{asChild:!0,children:(0,$.jsx)("div",{children:(0,$.jsxs)(z.Tooltip,{children:[(0,$.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,$.jsx)(bt.FolderOutputIcon,{})})}),!s&&(0,$.jsx)(z.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,$.jsxs)(z.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,$.jsxs)(z.Tooltip,{children:[(0,$.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(z.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,$.jsx)(bt.FileImageIcon,{})})}),(0,$.jsx)(z.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,$.jsxs)(z.Tooltip,{children:[(0,$.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(z.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,$.jsx)(bt.FileCodeIcon,{})})}),(0,$.jsx)(z.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,$.jsxs)(z.Tooltip,{children:[(0,$.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(z.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,$.jsx)(bt.PrinterIcon,{})})}),(0,$.jsx)(z.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var X=require("react/jsx-runtime"),Xd=({nodes:e})=>{let{t}=(0,re.useTranslation)(),{clearSelection:o}=mt(),{mode:n,isMinimapOpen:r,setIsMinimapOpen:i,isMoveTool:a,isHandTool:s,setIsMoveTool:l,setIsHandTool:c}=k(),d=(0,Bi.useKeyPress)(["v","V"]),p=(0,Bi.useKeyPress)(["h","H"]),u=(0,Lo.useCallback)(()=>{o(),c(!0),l(!1)},[o,c,l]),f=(0,Lo.useCallback)(()=>{l(!0),c(!1)},[l,c]);return(0,Lo.useEffect)(()=>{d&&!a&&n==="edit"&&f()},[d,f,a,n]),(0,Lo.useEffect)(()=>{p&&!s&&n==="edit"&&u()},[p,u,s,n]),(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[n==="edit"&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(re.Tooltip,{children:[(0,X.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(a&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,X.jsx)(ko.MousePointerIcon,{})})}),(0,X.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.move_tool"),(0,X.jsx)(Hi,{shortcut:"V"})]})]}),(0,X.jsxs)(re.Tooltip,{children:[(0,X.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(s&&"bg-grey-400"),iconButton:!0,onClick:u,children:(0,X.jsx)(ko.HandIcon,{})})}),(0,X.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.hand_tool")," ",(0,X.jsx)(Hi,{shortcut:"H"})]})]})]}),(0,X.jsx)($d,{}),n==="edit"&&(0,X.jsx)(Bd,{disabled:e.length>0}),(0,X.jsxs)(re.Tooltip,{children:[(0,X.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(r&&"bg-grey-400"),iconButton:!0,onClick:()=>i(!r),children:(0,X.jsx)(ko.MapIcon,{})})}),(0,X.jsx)(re.TooltipContent,{color:"black",children:t(r?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var Ee=require("lecom-ui"),zr=require("lucide-react"),Ae=require("react/jsx-runtime"),Kd=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,Ee.useTranslation)();return(0,Ae.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ae.jsxs)(Ee.Tooltip,{children:[(0,Ae.jsx)(Ee.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Ee.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,Ae.jsx)(zr.UndoIcon,{})})}),(0,Ae.jsx)(Ee.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,Ae.jsxs)(Ee.Tooltip,{children:[(0,Ae.jsx)(Ee.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Ee.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,Ae.jsx)(zr.RedoIcon,{})})}),(0,Ae.jsx)(Ee.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var qd=require("@xyflow/react"),Q=require("lecom-ui"),Do=require("lucide-react");var q=require("react/jsx-runtime"),Zd=()=>{let{t:e}=(0,Q.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,qd.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)(Q.Tooltip,{children:[(0,q.jsx)(Q.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(Q.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,q.jsx)(Do.ScanIcon,{})})}),(0,q.jsx)(Q.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(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,onClick:()=>o(),children:(0,q.jsx)(Do.ZoomOut,{})})}),(0,q.jsx)(Q.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(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,onClick:()=>n(1),children:(0,q.jsx)(is,{})})}),(0,q.jsx)(Q.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(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,onClick:()=>t(),children:(0,q.jsx)(Do.ZoomIn,{})})}),(0,q.jsx)(Q.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var j=require("lecom-ui");var ge=require("react/jsx-runtime"),Jd=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:a}=(0,j.useTranslation)(),{forceRebuildIndex:s}=fo(),{emitElementChanges:l}=Co(),c=!!e,d=()=>{let{nodes:h}=e||{};if(h!=null&&h.length){let m=o.filter(g=>!h.some(b=>b.id===g.id));h.forEach(g=>{(g==null?void 0:g.type)==="LANE"&&(g!=null&&g.parentId)&&(m=Ot(g.parentId,m))}),n(et(m))}},p=()=>{let{edges:h}=e||{};h!=null&&h.length&&r(m=>m.filter(g=>!h.some(b=>b.id===g.id)))},u=()=>{d(),p(),i("forceSave"),s(),l(),t(null)},f=()=>{t(null)};return(0,ge.jsx)(j.Dialog,{open:c,onOpenChange:f,children:(0,ge.jsxs)(j.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ge.jsx)(j.DialogHeader,{children:(0,ge.jsx)(j.DialogTitle,{children:(0,ge.jsx)(j.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:a("editor.modals.delete_elements.title")})})}),(0,ge.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ge.jsx)("div",{className:"py-2",children:(0,ge.jsx)(j.Notification,{type:"callout",variant:"warning",content:a("editor.modals.delete_elements.callout")})}),(0,ge.jsx)(j.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:a("editor.modals.delete_elements.content")})]}),(0,ge.jsxs)(j.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ge.jsx)(j.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:f,children:(0,ge.jsx)(j.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:a("editor.modals.delete_elements.cancel")})}),(0,ge.jsx)(j.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:u,children:a("editor.modals.delete_elements.confirm")})]})]})})};var Qd=require("@xyflow/react"),Ke=require("lecom-ui"),Fr=require("react");var He=require("react/jsx-runtime"),jd=()=>{let e=(0,Fr.useRef)(null),{t}=(0,Ke.useTranslation)(),{setDraggableNode:o}=vo(),{getNodes:n}=(0,Qd.useReactFlow)(),{setIsDragging:r}=k(),[i,a]=(0,Fr.useState)(void 0),s=n(),l=mr(s),c=[{type:"START_EVENT",icon:Pn,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Qt,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Fo,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ls,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:as,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ss,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:to,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:no,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:jt,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:rs,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Cn,label:t("bpmn.annotation.variant.default")}],d=(p,u)=>{o({type:u.type,variant:u.variant,attribute:u.attribute,icon:u.icon}),a((0,He.jsx)(u.icon,{})),p.dataTransfer.effectAllowed="move",e.current&&p.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,He.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,He.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",h=f?t("editor.toolbar.start_event_already_exists"):p.label;return(0,He.jsxs)(Ke.Tooltip,{children:[(0,He.jsx)(Ke.TooltipTrigger,{asChild:!0,children:(0,He.jsx)(Ke.Button,{className:P("[&>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:m=>d(m,p),children:(0,He.jsx)(p.icon,{})},u)}),(0,He.jsx)(Ke.TooltipContent,{color:"black",side:"right",children:h})]},u)})}),(0,He.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Wr=require("lecom-ui"),Ro=require("lucide-react"),Ur=require("react"),de=require("react/jsx-runtime"),eu=({validationResult:e,onClose:t})=>{let{t:o}=(0,Wr.useTranslation)(),[n,r]=(0,Ur.useState)(!1);if((0,Ur.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:a}=e;return(0,de.jsxs)("div",{className:P("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,de.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,de.jsx)("div",{className:"flex-shrink-0",children:i?(0,de.jsx)(Ro.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,de.jsx)(Ro.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,de.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,de.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,de.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,de.jsx)(Wr.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,de.jsx)(Ro.XIcon,{})})]}),(0,de.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,de.jsx)("p",{children:o("validation.success.message")}):(0,de.jsx)("div",{className:"list-disc list-inside",children:a.map(s=>(0,de.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var ue=require("react/jsx-runtime"),zi=(0,Yr.forwardRef)((e,t)=>{let{instanceId:o,mode:n,isMinimapOpen:r,isMoveTool:i,isHandTool:a}=k(),{nodes:s,setNodes:l,edges:c,setEdges:d,ui:p,actions:u,events:f,components:h,controls:m}=bd();(0,Yr.useImperativeHandle)(t,()=>({selectElements:u.selectElements,clearSelection:u.clearSelection}));let g={nodes:s,edges:c};return(0,ue.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,ue.jsx)(jd,{}),(0,ue.jsx)(Td,{}),(0,ue.jsxs)(Tt.ReactFlow,v(E({},f),{id:`modeler-${o}`,edges:c,nodes:s,nodeTypes:_c,edgeTypes:bc,minZoom:Ic,maxZoom:Cc,panOnDrag:a||n!=="edit"?!0:Mc,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:yc,selectionMode:Tt.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Sc,connectOnClick:!1,proOptions:{hideAttribution:!0},children:[(0,ue.jsx)(Tt.Background,{gap:wc,size:Nc,color:vc,bgColor:Tc}),r&&(0,ue.jsx)(Tt.MiniMap,{pannable:!0,zoomable:!0,position:Ac,className:"shadow-md rounded-md"}),(0,ue.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,ue.jsx)(Kd,E({},m)),(0,ue.jsx)(Xd,{nodes:s,diagram:g,onValidateDiagram:u.validateDiagram,onValidationComplete:u.handleValidationComplete}),(0,ue.jsx)(Zd,{})]}),(0,ue.jsx)(h.HelperLines,{}),p.validationResult&&(0,ue.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,ue.jsx)(eu,{validationResult:p.validationResult,onClose:p.handleCloseValidationPanel})})]})),(0,ue.jsx)(Jd,{pendingDelete:p.pendingDelete,setPendingDelete:p.setPendingDelete,nodes:s,setNodes:l,setEdges:d,saveHistory:u.saveHistory})]})});zi.displayName="Editor";var tu=require("@xyflow/react"),$r=require("react"),ou=require("react/jsx-runtime"),Bm=e=>({width:e.width,height:e.height,transform:e.transform}),Fi="rgba(51, 103, 217, 0.4)",al=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,tu.useStore)(Bm),i=(0,$r.useRef)(null);return(0,$r.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=Fi,t&&(s.beginPath(),s.strokeStyle=t.color||Fi,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||Fi,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,ou.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var Xr=require("uuid"),nu=()=>{let e=(0,Xr.v7)(),t=(0,Xr.v7)(),o=(0,Xr.v7)();return`
|
|
35
|
-
<mxGraphModel>
|
|
34
|
+
`),m.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var X=require("react/jsx-runtime");function nu(){let{t:e}=(0,U.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:s}=tu(),[a,l]=(0,ou.useState)(!1);return(0,X.jsxs)(U.DropdownMenu,{modal:!1,open:a,onOpenChange:l,children:[(0,X.jsx)(U.DropdownMenuTrigger,{asChild:!0,children:(0,X.jsx)("div",{children:(0,X.jsxs)(U.Tooltip,{children:[(0,X.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,X.jsx)(vt.FolderOutputIcon,{})})}),!a&&(0,X.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,X.jsxs)(U.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,X.jsxs)(U.Tooltip,{children:[(0,X.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,X.jsx)(vt.FileImageIcon,{})})}),(0,X.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,X.jsxs)(U.Tooltip,{children:[(0,X.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,X.jsx)(vt.FileCodeIcon,{})})}),(0,X.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,X.jsxs)(U.Tooltip,{children:[(0,X.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(U.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,X.jsx)(vt.PrinterIcon,{})})}),(0,X.jsx)(U.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var K=require("react/jsx-runtime"),ru=({nodes:e})=>{let{t}=(0,ie.useTranslation)(),{clearSelection:o}=yt(),{mode:n,isMinimapOpen:r,setIsMinimapOpen:i,isMoveTool:s,isHandTool:a,setIsMoveTool:l,setIsHandTool:c}=V(),d=(0,qi.useKeyPress)(["v","V"]),p=(0,qi.useKeyPress)(["h","H"]),u=(0,ko.useCallback)(()=>{o(),c(!0),l(!1)},[o,c,l]),f=(0,ko.useCallback)(()=>{l(!0),c(!1)},[l,c]);return(0,ko.useEffect)(()=>{d&&!s&&n==="edit"&&f()},[d,f,s,n]),(0,ko.useEffect)(()=>{p&&!a&&n==="edit"&&u()},[p,u,a,n]),(0,K.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[n==="edit"&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(ie.Tooltip,{children:[(0,K.jsx)(ie.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(ie.Button,{size:"small",variant:"ghost",color:"grey",className:D(s&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,K.jsx)(Ro.MousePointerIcon,{})})}),(0,K.jsxs)(ie.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.move_tool"),(0,K.jsx)(Xi,{shortcut:"V"})]})]}),(0,K.jsxs)(ie.Tooltip,{children:[(0,K.jsx)(ie.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(ie.Button,{size:"small",variant:"ghost",color:"grey",className:D(a&&"bg-grey-400"),iconButton:!0,onClick:u,children:(0,K.jsx)(Ro.HandIcon,{})})}),(0,K.jsxs)(ie.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[t("editor.controls.actions.hand_tool")," ",(0,K.jsx)(Xi,{shortcut:"H"})]})]})]}),(0,K.jsx)(nu,{}),n==="edit"&&(0,K.jsx)(Jd,{disabled:e.length>0}),(0,K.jsxs)(ie.Tooltip,{children:[(0,K.jsx)(ie.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(ie.Button,{size:"small",variant:"ghost",color:"grey",className:D(r&&"bg-grey-400"),iconButton:!0,onClick:()=>i(!r),children:(0,K.jsx)(Ro.MapIcon,{})})}),(0,K.jsx)(ie.TooltipContent,{color:"black",children:t(r?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var ve=require("lecom-ui"),Xr=require("lucide-react"),Pe=require("react/jsx-runtime"),iu=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,ve.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)(ve.Tooltip,{children:[(0,Pe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Pe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,Pe.jsx)(Xr.UndoIcon,{})})}),(0,Pe.jsx)(ve.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,Pe.jsxs)(ve.Tooltip,{children:[(0,Pe.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Pe.jsx)(ve.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,Pe.jsx)(Xr.RedoIcon,{})})}),(0,Pe.jsx)(ve.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var su=require("@xyflow/react"),j=require("lecom-ui"),Vo=require("lucide-react");var Z=require("react/jsx-runtime"),au=()=>{let{t:e}=(0,j.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,su.useReactFlow)();return(0,Z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Z.jsxs)(j.Tooltip,{children:[(0,Z.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,Z.jsx)(Vo.ScanIcon,{})})}),(0,Z.jsx)(j.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Z.jsxs)(j.Tooltip,{children:[(0,Z.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,Z.jsx)(Vo.ZoomOut,{})})}),(0,Z.jsx)(j.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Z.jsxs)(j.Tooltip,{children:[(0,Z.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,Z.jsx)(ms,{})})}),(0,Z.jsx)(j.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Z.jsxs)(j.Tooltip,{children:[(0,Z.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,Z.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,Z.jsx)(Vo.ZoomIn,{})})}),(0,Z.jsx)(j.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var ee=require("lecom-ui");var xe=require("react/jsx-runtime"),lu=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:s}=(0,ee.useTranslation)(),{forceRebuildIndex:a}=go(),{emitElementChanges:l}=Mo(),c=!!e,d=()=>{let{nodes:h}=e||{};if(h!=null&&h.length){let m=o.filter(g=>!h.some(_=>_.id===g.id));h.forEach(g=>{(g==null?void 0:g.type)==="LANE"&&(g!=null&&g.parentId)&&(m=Bt(g.parentId,m))}),n(it(m))}},p=()=>{let{edges:h}=e||{};h!=null&&h.length&&r(m=>m.filter(g=>!h.some(_=>_.id===g.id)))},u=()=>{d(),p(),i("forceSave"),a(),l(),t(null)},f=()=>{t(null)};return(0,xe.jsx)(ee.Dialog,{open:c,onOpenChange:f,children:(0,xe.jsxs)(ee.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,xe.jsx)(ee.DialogHeader,{children:(0,xe.jsx)(ee.DialogTitle,{children:(0,xe.jsx)(ee.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)(ee.Notification,{type:"callout",variant:"warning",content:s("editor.modals.delete_elements.callout")})}),(0,xe.jsx)(ee.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:s("editor.modals.delete_elements.content")})]}),(0,xe.jsxs)(ee.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,xe.jsx)(ee.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:f,children:(0,xe.jsx)(ee.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:s("editor.modals.delete_elements.cancel")})}),(0,xe.jsx)(ee.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:u,children:s("editor.modals.delete_elements.confirm")})]})]})})};var cu=require("@xyflow/react"),Je=require("lecom-ui"),Kr=require("react");var Fe=require("react/jsx-runtime"),du=()=>{let e=(0,Kr.useRef)(null),{t}=(0,Je.useTranslation)(),{setDraggableNode:o}=wo(),{getNodes:n}=(0,cu.useReactFlow)(),{setIsDragging:r}=V(),[i,s]=(0,Kr.useState)(void 0),a=n(),l=br(a),c=[{type:"START_EVENT",icon:kn,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:eo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Yo,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ys,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:hs,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:gs,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:no,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:io,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:to,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:fs,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Pn,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",h=f?t("editor.toolbar.start_event_already_exists"):p.label;return(0,Fe.jsxs)(Je.Tooltip,{children:[(0,Fe.jsx)(Je.TooltipTrigger,{asChild:!0,children:(0,Fe.jsx)(Je.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:m=>d(m,p),children:(0,Fe.jsx)(p.icon,{})},u)}),(0,Fe.jsx)(Je.TooltipContent,{color:"black",side:"right",children:h})]},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"),Oo=require("lucide-react"),Zr=require("react"),pe=require("react/jsx-runtime"),uu=({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,pe.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,pe.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,pe.jsx)("div",{className:"flex-shrink-0",children:i?(0,pe.jsx)(Oo.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,pe.jsx)(Oo.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,pe.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,pe.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,pe.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,pe.jsx)(qr.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,pe.jsx)(Oo.XIcon,{})})]}),(0,pe.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,pe.jsx)("p",{children:o("validation.success.message")}):(0,pe.jsx)("div",{className:"list-disc list-inside",children:s.map(a=>(0,pe.jsx)("li",{className:"mb-1",children:a.message},a.id))})})]})};var fe=require("react/jsx-runtime"),Zi=(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:h,controls:m}=Ld();(0,Jr.useImperativeHandle)(t,()=>({selectElements:u.selectElements,clearSelection:u.clearSelection}));let g={nodes:a,edges:c};return(0,fe.jsxs)("div",{className:"w-full h-full",children:[n==="edit"&&(0,fe.jsx)(du,{}),(0,fe.jsx)(Dd,{}),(0,fe.jsxs)(Nt.ReactFlow,N(E({},f),{id:`modeler-${o}`,edges:c,nodes:a,nodeTypes:Pc,edgeTypes:Lc,minZoom:Hc,maxZoom:Gc,panOnDrag:s||n!=="edit"?!0:zc,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:n!=="readonly"&&i,nodesConnectable:n==="edit"&&i,nodesDraggable:n==="edit"&&i,connectionLineComponent:Cc,selectionMode:Nt.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Bc,connectOnClick:!1,proOptions:{hideAttribution:!0},children:[(0,fe.jsx)(Nt.Background,{gap:Vc,size:Rc,color:kc,bgColor:Dc}),r&&(0,fe.jsx)(Nt.MiniMap,{pannable:!0,zoomable:!0,position:Oc,className:"shadow-md rounded-md"}),(0,fe.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[n==="edit"&&(0,fe.jsx)(iu,E({},m)),(0,fe.jsx)(ru,{nodes:a,diagram:g,onValidateDiagram:u.validateDiagram,onValidationComplete:u.handleValidationComplete}),(0,fe.jsx)(au,{})]}),(0,fe.jsx)(h.HelperLines,{}),p.validationResult&&(0,fe.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,fe.jsx)(uu,{validationResult:p.validationResult,onClose:p.handleCloseValidationPanel})})]})),(0,fe.jsx)(lu,{pendingDelete:p.pendingDelete,setPendingDelete:p.setPendingDelete,nodes:a,setNodes:l,setEdges:d,saveHistory:u.saveHistory})]})});Zi.displayName="Editor";var pu=require("@xyflow/react"),Qr=require("react"),fu=require("react/jsx-runtime"),jm=e=>({width:e.width,height:e.height,transform:e.transform}),Ji="rgba(51, 103, 217, 0.4)",hl=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,pu.useStore)(jm),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=Ji,t&&(a.beginPath(),a.strokeStyle=t.color||Ji,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||Ji,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,fu.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var jr=require("uuid"),mu=()=>{let e=(0,jr.v7)(),t=(0,jr.v7)(),o=(0,jr.v7)();return`<mxGraphModel>
|
|
36
35
|
<root version="1.1">
|
|
37
36
|
<mxCell id="0" />
|
|
38
37
|
<mxCell id="1" parent="0" />
|
|
@@ -65,5 +64,4 @@
|
|
|
65
64
|
<mxGeometry as="geometry" relative="1" />
|
|
66
65
|
</mxCell>
|
|
67
66
|
</root>
|
|
68
|
-
</mxGraphModel
|
|
69
|
-
`};var Vo=require("lecom-ui"),vt=require("react");var bn=require("react/jsx-runtime"),So=new Map,ru=(0,vt.createContext)(null),Kr=()=>{let e=(0,vt.useContext)(ru);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},iu=({locale:e,defaultMode:t="view",showTooltip:o=!0,children:n})=>{let[r,i]=(0,vt.useState)(e||"pt_BR");(0,vt.useEffect)(()=>{e&&(i(e),Vo.i18n.changeLanguage(e))},[e]);let a=f=>{let h=So.size;if(h===0)throw new Error("No modeler instances found");if(h===1||!f){let[g]=So.values();return g}let m=So.get(f);if(!m)throw new Error(`Modeler instance with ID "${f}" not found`);return m},s=(f,h)=>{let m=a(h);return m==null?void 0:m.selectElements(f)},l=async f=>{let h=a(f);return h==null?void 0:h.clearSelection()},c=(f,h)=>{let m=a(h);return m==null?void 0:m.configureElement(f)},d=(f,h)=>{let m=a(h);return m==null?void 0:m.getConfigureElement(f)},p=async(f,h)=>{let m=a(h);await(m==null?void 0:m.importFromMxGraph(f))},u=f=>{let h=a(f);return h==null?void 0:h.exportToMxGraph()};return(0,bn.jsx)(ru.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:p,exportDiagram:u},children:o?(0,bn.jsxs)(Vo.TooltipProvider,{children:[(0,bn.jsx)(Vo.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]}):n})};var qr=require("react/jsx-runtime"),au=(0,te.createContext)(null),k=()=>{let e=(0,te.useContext)(au);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},lu=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:a})=>{let{defaultMode:s}=Kr(),l=(0,te.useId)(),[c]=(0,te.useState)(o||l),[d,p]=(0,te.useState)(n||s||"edit"),[u,f]=(0,te.useState)(!1),[h,m]=(0,te.useState)(!0),[g,b]=(0,te.useState)(!1),[x,y]=(0,te.useState)(!1),[_,T]=(0,te.useState)(!1),[A,N]=(0,te.useState)(!1),[I,L]=(0,te.useState)(!1);(0,te.useEffect)(()=>{n&&p(n)},[n]);let w=(0,te.useMemo)(()=>t||nu(),[t]),C={instanceId:c,initialDiagram:w,mode:d,isInitialized:u,setIsInitialized:f,isMinimapOpen:x,isMoveTool:h,isHandTool:g,isDragging:_,isMultipleSelection:I,isConnecting:A,setIsMinimapOpen:y,setIsMoveTool:m,setIsHandTool:b,setIsDragging:T,setIsConnecting:N,setIsMultipleSelection:L,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:a};return(0,qr.jsx)(su.ReactFlowProvider,{children:(0,qr.jsx)(au.Provider,{value:C,children:(0,qr.jsx)(zi,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
|
|
67
|
+
</mxGraphModel>`};var Ho=require("lecom-ui"),wt=require("react");var Nn=require("react/jsx-runtime"),Po=new Map,gu=(0,wt.createContext)(null),ei=()=>{let e=(0,wt.useContext)(gu);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},hu=({locale:e,defaultMode:t="view",showNotification:o=!0,children:n})=>{let[r,i]=(0,wt.useState)(e||"pt_BR");(0,wt.useEffect)(()=>{e&&(i(e),Ho.i18n.changeLanguage(e))},[e]);let s=f=>{let h=Po.size;if(h===0)throw new Error("No modeler instances found");if(h===1||!f){let[g]=Po.values();return g}let m=Po.get(f);if(!m)throw new Error(`Modeler instance with ID "${f}" not found`);return m},a=(f,h)=>{let m=s(h);return m==null?void 0:m.selectElements(f)},l=async f=>{let h=s(f);return h==null?void 0:h.clearSelection()},c=(f,h)=>{let m=s(h);return m==null?void 0:m.configureElement(f)},d=(f,h)=>{let m=s(h);return m==null?void 0:m.getConfigureElement(f)},p=async(f,h)=>{let m=s(h);await(m==null?void 0:m.importFromMxGraph(f))},u=f=>{let h=s(f);return h==null?void 0:h.exportToMxGraph()};return(0,Nn.jsx)(gu.Provider,{value:{defaultMode:t,locale:r,selectElements:a,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:p,exportDiagram:u},children:(0,Nn.jsxs)(Ho.TooltipProvider,{children:[o&&(0,Nn.jsx)(Ho.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var ti=require("react/jsx-runtime"),xu=(0,te.createContext)(null),V=()=>{let e=(0,te.useContext)(xu);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},Eu=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:s})=>{let{defaultMode:a}=ei(),l=(0,te.useId)(),[c]=(0,te.useState)(o||l),[d,p]=(0,te.useState)(n||a||"edit"),[u,f]=(0,te.useState)(!1),[h,m]=(0,te.useState)(!0),[g,_]=(0,te.useState)(!1),[x,y]=(0,te.useState)(!1),[b,v]=(0,te.useState)(!1),[w,T]=(0,te.useState)(!1),[C,R]=(0,te.useState)(!1);(0,te.useEffect)(()=>{n&&p(n)},[n]);let A=(0,te.useMemo)(()=>t||mu(),[t]),S={instanceId:c,initialDiagram:A,mode:d,isInitialized:u,setIsInitialized:f,isMinimapOpen:x,isMoveTool:h,isHandTool:g,isDragging:b,isMultipleSelection:C,isConnecting:w,setIsMinimapOpen:y,setIsMoveTool:m,setIsHandTool:_,setIsDragging:v,setIsConnecting:T,setIsMultipleSelection:R,onElementChanges:r,onConfigureElement:i,onSubprocessValidationClick:s};return(0,ti.jsx)(yu.ReactFlowProvider,{children:(0,ti.jsx)(xu.Provider,{value:S,children:(0,ti.jsx)(Zi,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
|