lecom-modeler 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +12 -12
- package/lib/index.css +1 -1
- package/lib/index.js +12 -12
- package/lib/style.min.css +1 -1
- package/package.json +3 -3
package/lib/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var Tp=Object.create;var In=Object.defineProperty,Np=Object.defineProperties,vp=Object.getOwnPropertyDescriptor,wp=Object.getOwnPropertyDescriptors,Ap=Object.getOwnPropertyNames,hr=Object.getOwnPropertySymbols,Ip=Object.getPrototypeOf,Ki=Object.prototype.hasOwnProperty,Fs=Object.prototype.propertyIsEnumerable;var Ys=(e,t,o)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,T=(e,t)=>{for(var o in t||(t={}))Ki.call(t,o)&&Ys(e,o,t[o]);if(hr)for(var o of hr(t))Fs.call(t,o)&&Ys(e,o,t[o]);return e},v=(e,t)=>Np(e,wp(t));var Mt=(e,t)=>{var o={};for(var n in e)Ki.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&hr)for(var n of hr(e))t.indexOf(n)<0&&Fs.call(e,n)&&(o[n]=e[n]);return o};var Cp=(e,t)=>{for(var o in t)In(e,o,{get:t[o],enumerable:!0})},Ws=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ap(t))!Ki.call(e,r)&&r!==o&&In(e,r,{get:()=>t[r],enumerable:!(n=vp(t,r))||n.enumerable});return e};var Sp=(e,t,o)=>(o=e!=null?Tp(Ip(e)):{},Ws(t||!e||!e.__esModule?In(o,"default",{value:e,enumerable:!0}):o,e)),Mp=e=>Ws(In({},"__esModule",{value:!0}),e);var mh={};Cp(mh,{EditorMode:()=>Ue,ElementPosition:()=>xr,ElementType:()=>Cn,GatewayElementVariant:()=>Er,GatewayVariant:()=>mt,Modeler:()=>xp,ModelerProvider:()=>mp,NodeAttribute:()=>bt,NodeType:()=>oe,NodeVariant:()=>ft,RoutingVariant:()=>br,useModeler:()=>on});module.exports=Mp(mh);var qi=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 yr=require("@produto-lecom/lecom-ui");var Xs={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",start_event_limit_reached:"Start event can only connect to a single element",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",concurrent_initial_and_final_activity:"An activity cannot be connected to both start and end events",duplicate_connection_not_allowed:"A connection already exists between these elements",connect_node:"Connect element",connecting:"Connecting...",delete_pool_lane_error:"Cannot delete the pool or lane while there are elements inside it."},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{empty:"Cannot export an empty diagram",error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{label:"Minimap",open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess",loop:"Activity with loop"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"},feedback:{label_empty:{prefix:"Activity name was automatically set to"},label_already_exists:{prefix:"The name",middle:"already exists. The name was changed to"},invalid_first_character:"Activity name must start with a letter or number"}},lane:{variant:{default:"Pool / Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var Us={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",start_event_limit_reached:"Evento inicial solo puede conectarse a un \xFAnico elemento",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",concurrent_initial_and_final_activity:"Una actividad no puede estar conectada al evento inicial y final al mismo tiempo",duplicate_connection_not_allowed:"Ya existe una conexi\xF3n entre estos elementos",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"No se puede eliminar la piscina o carril mientras haya elementos dentro."},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{empty:"No es posible exportar un diagrama vac\xEDo",error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso",loop:"Actividad con loop"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"},feedback:{label_empty:{prefix:"El nombre de la actividad se estableci\xF3 autom\xE1ticamente como"},label_already_exists:{prefix:"El nombre",middle:"ya existe. El nombre fue cambiado a"},invalid_first_character:"El nombre de la actividad debe comenzar con una letra o n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var $s={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",start_event_limit_reached:"Evento inicial s\xF3 pode se conectar a um \xFAnico elemento",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",concurrent_initial_and_final_activity:"Uma atividade n\xE3o pode estar conectada ao evento inicial e final ao mesmo tempo",duplicate_connection_not_allowed:"J\xE1 existe uma conex\xE3o entre esses elementos",start_event_to_subprocess_not_allowed:"Evento inicial n\xE3o pode se conectar a um subprocesso",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"N\xE3o \xE9 poss\xEDvel excluir a piscina ou raia enquanto houver elementos dentro dela."},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{empty:"N\xE3o \xE9 poss\xEDvel exportar um diagrama vazio",error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso",loop:"Atividade com loop"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de Atividade"},variant:{default:"Atividade",script:"Atividade de script",subprocess:"Subprocesso"},attribute:{loop:"Atividade com loop"},label:{prefix:"Atividade"},feedback:{label_empty:{prefix:"O nome da atividade foi definido automaticamente como"},label_already_exists:{prefix:"O nome",middle:"j\xE1 existe. O nome foi alterado para"},invalid_first_character:"O nome da atividade deve come\xE7ar com uma letra ou n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var Ks={pt_BR:$s,en_US:Xs,es_ES:Us};var qs,Zs,Pp=(Zs=(qs=qi("LecomUserLanguage"))!=null?qs:qi("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Zs:yr.Translations.PT_BR;(0,yr.initializeI18n)({lng:Pp,resources:Ks});var Ue=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Ue||{});var Cn=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Cn||{}),xr=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(xr||{}),Er=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Er||{}),br=(d=>(d.SIMPLE="simple",d.LOOP="loop",d.SCRIPT="script",d.SCRIPT_LOOP="script_loop",d.COMPLEX="complex",d.EXCLUSIVE="exclusive",d.PARALLEL="parallel",d.FINAL="final",d.TO_SUB_PROCESS="to_sub_process",d.FROM_SUB_PROCESS="from_sub_process",d))(br||{});var Ko=require("lucide-react");var yo=require("react/jsx-runtime"),_r=({size:e=24,className:t})=>(0,yo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,yo.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,yo.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,yo.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,yo.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Zi=require("react/jsx-runtime"),Bo=({size:e=24,className:t})=>(0,Zi.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,Zi.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Qt=require("react/jsx-runtime"),zo=({size:e=24,className:t})=>(0,Qt.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,Qt.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,Qt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Qt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Qt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Qt.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Yo=require("react/jsx-runtime"),Fo=({size:e=24,className:t})=>(0,Yo.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,Yo.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,Yo.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Yo.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Wo=require("react/jsx-runtime"),Xo=({size:e=24,className:t})=>(0,Wo.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,Wo.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,Wo.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Wo.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var Uo=require("react/jsx-runtime"),Js=({size:e=24,className:t})=>(0,Uo.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,Uo.jsxs)("g",{children:[(0,Uo.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,Uo.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Qs=require("clsx"),js=require("tailwind-merge");function D(...e){return(0,js.twMerge)((0,Qs.clsx)(e))}var jt=(e=0,t=0)=>e<t?t:e,Tr=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Sn=require("react/jsx-runtime"),ea=({size:e=24,className:t})=>(0,Sn.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,Sn.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,Sn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Nr=require("react/jsx-runtime"),ta=({size:e=24,className:t})=>(0,Nr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Nr.jsx)("g",{children:(0,Nr.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 Ji=require("react/jsx-runtime"),vr=({size:e=24,className:t})=>(0,Ji.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,Ji.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 Qi=require("react/jsx-runtime"),Mn=({size:e=24,className:t})=>(0,Qi.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,Qi.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 $o=require("react/jsx-runtime"),oa=({size:e=24,className:t})=>(0,$o.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,$o.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,$o.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,$o.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var eo=require("react/jsx-runtime"),na=({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:"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,eo.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,eo.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,eo.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,eo.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var xo=require("react/jsx-runtime"),ra=({size:e=24,className:t})=>(0,xo.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,xo.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,xo.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,xo.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,xo.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var oe=(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))(oe||{}),ft=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(ft||{}),wr={SCRIPT:{icon:Ko.ScrollText},SUBPROCESS:{icon:Ko.SquarePlus}},bt=(t=>(t.LOOP="LOOP",t))(bt||{}),Ar={LOOP:{icon:Ko.RotateCcw}},mt=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(mt||{}),ji={EXCLUSIVE:{icon:Fo},PARALLEL:{icon:Xo},COMPLEX:{icon:zo}};var gp=require("@xyflow/react"),Me=require("react");var Ft=require("@xyflow/react"),Ct=require("react");var Lu=require("@produto-lecom/lecom-ui"),zt=require("@xyflow/react"),At=require("react");var qo=require("@xyflow/react");function ia(e,t){var E,w,b,x;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+((w=(E=t==null?void 0:t.measured)==null?void 0:E.width)!=null?w:0)/2,u=i.y+((x=(b=t==null?void 0:t.measured)==null?void 0:b.height)!=null?x:0)/2,f=(d-l)/(2*a)-(u-c)/(2*s),p=(d-l)/(2*a)+(u-c)/(2*s),g=1/(Math.abs(f)+Math.abs(p)||1),y=g*f,m=g*p,_=a*(y+m)+l,h=s*(-y+m)+c;return{x:_,y:h}}function sa(e,t){var c,d,u,f;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(f=(u=e.measured)==null?void 0:u.height)!=null?f: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?qo.Position.Left:s>=i+n-1?qo.Position.Right:l<=a+1?qo.Position.Top:l>=a+r-1?qo.Position.Bottom:qo.Position.Top}function Zo(e,t){let o=ia(e,t),n=ia(t,e),r=sa(e,o),i=sa(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function Ir(e,t){return{isFromStartEvent:(e==null?void 0:e.type)==="START_EVENT",isGatewayToGateway:(e==null?void 0:e.type)==="GATEWAY"&&(t==null?void 0:t.type)==="GATEWAY",isActiviyToAndGateway:(e==null?void 0:e.type)==="TASK"&&(t==null?void 0:t.type)==="GATEWAY"}}var aa=require("zustand"),la=require("@xyflow/react"),ca=require("react");var Cr=()=>{let{setEdges:e}=(0,la.useReactFlow)();return(0,ca.useCallback)(()=>{let o=Eo.getState().pathEdgeIds;e(n=>n.map(r=>v(T({},r),{selected:o.includes(r.id)})))},[e])},Eo=(0,aa.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=T({},n.statusByNodeId),i=T({},n.statusData),a=!1;return o.forEach(s=>{let l=`${s.diagramId}-${s.activityId}`;r[s.diagramId]!==s.status&&(r[s.diagramId]=s.status,i[l]=s,a=!0)}),a?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],a={};o.forEach(d=>{a[d.source]||(a[d.source]=[]),a[d.source].push({targetId:d.target,edgeId:d.id})});let s=r[0],l=r[r.length-1];o.forEach(d=>{d.target===s&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let f=[],p=new Set;for(f.push({node:d,path:[]}),p.add(d);f.length>0;){let{node:g,path:y}=f.shift();if(g===u)return y;let m=a[g]||[];for(let{targetId:_,edgeId:h}of m)p.has(_)||(p.add(_),f.push({node:_,path:[...y,h]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],f=r[d+1],p=c(u,f);p.length>0&&i.push(...p)}i.length>0&&e({pathEdgeIds:i})}}));var tn=require("@xyflow/react"),nt=require("react"),nc=require("zustand/shallow");var Lp={value:()=>{}};function ua(){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 Sr(o)}function Sr(e){this._=e}function kp(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}})}Sr.prototype=ua.prototype={constructor:Sr,on:function(e,t){var o=this._,n=kp(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=Rp(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]=da(o[r],e.name,t);else if(t==null)for(r in o)o[r]=da(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 Sr(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 Rp(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function da(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=Lp,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var es=ua;var Mr="http://www.w3.org/1999/xhtml",ts={svg:"http://www.w3.org/2000/svg",xhtml:Mr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Wt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ts.hasOwnProperty(t)?{space:ts[t],local:e}:e}function Dp(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Mr&&t.documentElement.namespaceURI===Mr?t.createElement(e):t.createElementNS(o,e)}}function Op(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pr(e){var t=Wt(e);return(t.local?Op:Dp)(t)}function Vp(){}function bo(e){return e==null?Vp:function(){return this.querySelector(e)}}function pa(e){typeof e!="function"&&(e=bo(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 He(n,this._parents)}function os(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Hp(){return[]}function Pn(e){return e==null?Hp:function(){return this.querySelectorAll(e)}}function Gp(e){return function(){return os(e.apply(this,arguments))}}function fa(e){typeof e=="function"?e=Gp(e):e=Pn(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 He(n,r)}function Ln(e){return function(){return this.matches(e)}}function Lr(e){return function(t){return t.matches(e)}}var Bp=Array.prototype.find;function zp(e){return function(){return Bp.call(this.children,e)}}function Yp(){return this.firstElementChild}function ma(e){return this.select(e==null?Yp:zp(typeof e=="function"?e:Lr(e)))}var Fp=Array.prototype.filter;function Wp(){return Array.from(this.children)}function Xp(e){return function(){return Fp.call(this.children,e)}}function ga(e){return this.selectAll(e==null?Wp:Xp(typeof e=="function"?e:Lr(e)))}function ha(e){typeof e!="function"&&(e=Ln(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 He(n,this._parents)}function kr(e){return new Array(e.length)}function ya(){return new He(this._enter||this._groups.map(kr),this._parents)}function kn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}kn.prototype={constructor:kn,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 xa(e){return function(){return e}}function Up(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 kn(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function $p(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,u=i.length,f=new Array(d),p;for(s=0;s<d;++s)(l=t[s])&&(f[s]=p=a.call(l,l.__data__,s,t)+"",c.has(p)?r[s]=l:c.set(p,l));for(s=0;s<u;++s)p=a.call(e,i[s],s,i)+"",(l=c.get(p))?(n[s]=l,l.__data__=i[s],c.delete(p)):o[s]=new kn(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(f[s])===l&&(r[s]=l)}function Kp(e){return e.__data__}function Ea(e,t){if(!arguments.length)return Array.from(this,Kp);var o=t?$p:Up,n=this._parents,r=this._groups;typeof e!="function"&&(e=xa(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],f=u.length,p=qp(e.call(d,d&&d.__data__,c,n)),g=p.length,y=s[c]=new Array(g),m=a[c]=new Array(g),_=l[c]=new Array(f);o(d,u,y,m,_,p,t);for(var h=0,E=0,w,b;h<g;++h)if(w=y[h]){for(h>=E&&(E=h+1);!(b=m[E])&&++E<g;);w._next=b||null}}return a=new He(a,n),a._enter=s,a._exit=l,a}function qp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ba(){return new He(this._exit||this._groups.map(kr),this._parents)}function _a(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 Ta(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c=o[l],d=n[l],u=c.length,f=s[l]=new Array(u),p,g=0;g<u;++g)(p=c[g]||d[g])&&(f[g]=p);for(;l<r;++l)s[l]=o[l];return new He(s,this._parents)}function Na(){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 va(e){e||(e=Zp);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}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 He(r,this._parents).order()}function Zp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function wa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Aa(){return Array.from(this)}function Ia(){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 Ca(){let e=0;for(let t of this)++e;return e}function Sa(){return!this.node()}function Ma(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 Jp(e){return function(){this.removeAttribute(e)}}function Qp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jp(e,t){return function(){this.setAttribute(e,t)}}function ef(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tf(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function of(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 Pa(e,t){var o=Wt(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?Qp:Jp:typeof t=="function"?o.local?of:tf:o.local?ef:jp)(o,t))}function Rr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nf(e){return function(){this.style.removeProperty(e)}}function rf(e,t,o){return function(){this.style.setProperty(e,t,o)}}function sf(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function La(e,t,o){return arguments.length>1?this.each((t==null?nf:typeof t=="function"?sf:rf)(e,t,o==null?"":o)):to(this.node(),e)}function to(e,t){return e.style.getPropertyValue(t)||Rr(e).getComputedStyle(e,null).getPropertyValue(t)}function af(e){return function(){delete this[e]}}function lf(e,t){return function(){this[e]=t}}function cf(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ka(e,t){return arguments.length>1?this.each((t==null?af:typeof t=="function"?cf:lf)(e,t)):this.node()[e]}function Ra(e){return e.trim().split(/^|\s+/)}function ns(e){return e.classList||new Da(e)}function Da(e){this._node=e,this._names=Ra(e.getAttribute("class")||"")}Da.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 Oa(e,t){for(var o=ns(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Va(e,t){for(var o=ns(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function df(e){return function(){Oa(this,e)}}function uf(e){return function(){Va(this,e)}}function pf(e,t){return function(){(t.apply(this,arguments)?Oa:Va)(this,e)}}function Ha(e,t){var o=Ra(e+"");if(arguments.length<2){for(var n=ns(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?pf:t?df:uf)(o,t))}function ff(){this.textContent=""}function mf(e){return function(){this.textContent=e}}function gf(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ga(e){return arguments.length?this.each(e==null?ff:(typeof e=="function"?gf:mf)(e)):this.node().textContent}function hf(){this.innerHTML=""}function yf(e){return function(){this.innerHTML=e}}function xf(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Ba(e){return arguments.length?this.each(e==null?hf:(typeof e=="function"?xf:yf)(e)):this.node().innerHTML}function Ef(){this.nextSibling&&this.parentNode.appendChild(this)}function za(){return this.each(Ef)}function bf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ya(){return this.each(bf)}function Fa(e){var t=typeof e=="function"?e:Pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _f(){return null}function Wa(e,t){var o=typeof e=="function"?e:Pr(e),n=t==null?_f:typeof t=="function"?t:bo(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function Tf(){var e=this.parentNode;e&&e.removeChild(this)}function Xa(){return this.each(Tf)}function Nf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vf(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ua(e){return this.select(e?vf:Nf)}function $a(e){return arguments.length?this.property("__data__",e):this.node().__data__}function wf(e){return function(t){e.call(this,t,this.__data__)}}function Af(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 If(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 Cf(e,t,o){return function(){var n=this.__on,r,i=wf(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 Ka(e,t,o){var n=Af(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?Cf:If,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function qa(e,t,o){var n=Rr(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 Sf(e,t){return function(){return qa(this,e,t)}}function Mf(e,t){return function(){return qa(this,e,t.apply(this,arguments))}}function Za(e,t){return this.each((typeof t=="function"?Mf:Sf)(e,t))}function*Ja(){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 Pf=[null];function He(e,t){this._groups=e,this._parents=t}function Qa(){return new He([[document.documentElement]],Pf)}function Lf(){return this}He.prototype=Qa.prototype={constructor:He,select:pa,selectAll:fa,selectChild:ma,selectChildren:ga,filter:ha,data:Ea,enter:ya,exit:ba,join:_a,merge:Ta,selection:Lf,order:Na,sort:va,call:wa,nodes:Aa,node:Ia,size:Ca,empty:Sa,each:Ma,attr:Pa,style:La,property:ka,classed:Ha,text:Ga,html:Ba,raise:za,lower:Ya,append:Fa,insert:Wa,remove:Xa,clone:Ua,datum:$a,on:Ka,dispatch:Za,[Symbol.iterator]:Ja};var Xt=Qa;function Dr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function rs(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function On(){}var Rn=.7,Hr=1/Rn,Jo="\\s*([+-]?\\d+)\\s*",Dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kf=/^#([0-9a-f]{3,8})$/,Rf=new RegExp(`^rgb\\(${Jo},${Jo},${Jo}\\)$`),Df=new RegExp(`^rgb\\(${Pt},${Pt},${Pt}\\)$`),Of=new RegExp(`^rgba\\(${Jo},${Jo},${Jo},${Dn}\\)$`),Vf=new RegExp(`^rgba\\(${Pt},${Pt},${Pt},${Dn}\\)$`),Hf=new RegExp(`^hsl\\(${Dn},${Pt},${Pt}\\)$`),Gf=new RegExp(`^hsla\\(${Dn},${Pt},${Pt},${Dn}\\)$`),ja={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};Dr(On,oo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:el,formatHex:el,formatHex8:Bf,formatHsl:zf,formatRgb:tl,toString:tl});function el(){return this.rgb().formatHex()}function Bf(){return this.rgb().formatHex8()}function zf(){return al(this).formatHsl()}function tl(){return this.rgb().formatRgb()}function oo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=kf.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ol(t):o===3?new Je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Or(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Or(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Rf.exec(e))?new Je(t[1],t[2],t[3],1):(t=Df.exec(e))?new Je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Of.exec(e))?Or(t[1],t[2],t[3],t[4]):(t=Vf.exec(e))?Or(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hf.exec(e))?il(t[1],t[2]/100,t[3]/100,1):(t=Gf.exec(e))?il(t[1],t[2]/100,t[3]/100,t[4]):ja.hasOwnProperty(e)?ol(ja[e]):e==="transparent"?new Je(NaN,NaN,NaN,0):null}function ol(e){return new Je(e>>16&255,e>>8&255,e&255,1)}function Or(e,t,o,n){return n<=0&&(e=t=o=NaN),new Je(e,t,o,n)}function Yf(e){return e instanceof On||(e=oo(e)),e?(e=e.rgb(),new Je(e.r,e.g,e.b,e.opacity)):new Je}function Qo(e,t,o,n){return arguments.length===1?Yf(e):new Je(e,t,o,n==null?1:n)}function Je(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Dr(Je,Qo,rs(On,{brighter(e){return e=e==null?Hr:Math.pow(Hr,e),new Je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rn:Math.pow(Rn,e),new Je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Je(To(this.r),To(this.g),To(this.b),Gr(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:nl,formatHex:nl,formatHex8:Ff,formatRgb:rl,toString:rl}));function nl(){return`#${_o(this.r)}${_o(this.g)}${_o(this.b)}`}function Ff(){return`#${_o(this.r)}${_o(this.g)}${_o(this.b)}${_o((isNaN(this.opacity)?1:this.opacity)*255)}`}function rl(){let e=Gr(this.opacity);return`${e===1?"rgb(":"rgba("}${To(this.r)}, ${To(this.g)}, ${To(this.b)}${e===1?")":`, ${e})`}`}function Gr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function To(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _o(e){return e=To(e),(e<16?"0":"")+e.toString(16)}function il(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new _t(e,t,o,n)}function al(e){if(e instanceof _t)return new _t(e.h,e.s,e.l,e.opacity);if(e instanceof On||(e=oo(e)),!e)return new _t;if(e instanceof _t)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 _t(a,s,l,e.opacity)}function ll(e,t,o,n){return arguments.length===1?al(e):new _t(e,t,o,n==null?1:n)}function _t(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Dr(_t,ll,rs(On,{brighter(e){return e=e==null?Hr:Math.pow(Hr,e),new _t(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rn:Math.pow(Rn,e),new _t(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 Je(is(e>=240?e-240:e+120,r,n),is(e,r,n),is(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new _t(sl(this.h),Vr(this.s),Vr(this.l),Gr(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=Gr(this.opacity);return`${e===1?"hsl(":"hsla("}${sl(this.h)}, ${Vr(this.s)*100}%, ${Vr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function sl(e){return e=(e||0)%360,e<0?e+360:e}function Vr(e){return Math.max(0,Math.min(1,e||0))}function is(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 ss(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 cl(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 ss((o-n/t)*t,a,r,i,s)}}function dl(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 ss((o-n/t)*t,r,i,a,s)}}var as=e=>()=>e;function Wf(e,t){return function(o){return e+o*t}}function Xf(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 ul(e){return(e=+e)==1?Br:function(t,o){return o-t?Xf(t,o,e):as(isNaN(t)?o:t)}}function Br(e,t){var o=t-e;return o?Wf(e,o):as(isNaN(e)?t:e)}var zr=function e(t){var o=ul(t);function n(r,i){var a=o((r=Qo(r)).r,(i=Qo(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=Br(r.opacity,i.opacity);return function(d){return r.r=a(d),r.g=s(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function pl(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=Qo(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 Uf=pl(cl),$f=pl(dl);function gt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var cs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ls=new RegExp(cs.source,"g");function Kf(e){return function(){return e}}function qf(e){return function(t){return e(t)+""}}function ds(e,t){var o=cs.lastIndex=ls.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=cs.exec(e))&&(r=ls.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:gt(n,r)})),o=ls.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?qf(l[0].x):Kf(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)s[(u=l[d]).i]=u.x(c);return s.join("")})}var fl=180/Math.PI,Yr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function us(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)*fl,skewX:Math.atan(l)*fl,scaleX:a,scaleY:s}}var Fr;function ml(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yr:us(t.a,t.b,t.c,t.d,t.e,t.f)}function gl(e){return e==null?Yr:(Fr||(Fr=document.createElementNS("http://www.w3.org/2000/svg","g")),Fr.setAttribute("transform",e),(e=Fr.transform.baseVal.consolidate())?(e=e.matrix,us(e.a,e.b,e.c,e.d,e.e,e.f)):Yr)}function hl(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,f,p,g){if(c!==u||d!==f){var y=p.push("translate(",null,t,null,o);g.push({i:y-4,x:gt(c,u)},{i:y-2,x:gt(d,f)})}else(u||f)&&p.push("translate("+u+t+f+o)}function a(c,d,u,f){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),f.push({i:u.push(r(u)+"rotate(",null,n)-2,x:gt(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function s(c,d,u,f){c!==d?f.push({i:u.push(r(u)+"skewX(",null,n)-2,x:gt(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,f,p,g){if(c!==u||d!==f){var y=p.push(r(p)+"scale(",null,",",null,")");g.push({i:y-4,x:gt(c,u)},{i:y-2,x:gt(d,f)})}else(u!==1||f!==1)&&p.push(r(p)+"scale("+u+","+f+")")}return function(c,d){var u=[],f=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,f),a(c.rotate,d.rotate,u,f),s(c.skewX,d.skewX,u,f),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,f),c=d=null,function(p){for(var g=-1,y=f.length,m;++g<y;)u[(m=f[g]).i]=m.x(p);return u.join("")}}}var ps=hl(ml,"px, ","px)","deg)"),fs=hl(gl,", ",")",")");var jo=0,Hn=0,Vn=0,xl=1e3,Wr,Gn,Xr=0,No=0,Ur=0,Bn=typeof performance=="object"&&performance.now?performance:Date,El=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yn(){return No||(El(Zf),No=Bn.now()+Ur)}function Zf(){No=0}function zn(){this._call=this._time=this._next=null}zn.prototype=$r.prototype={constructor:zn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Yn():+o)+(t==null?0:+t),!this._next&&Gn!==this&&(Gn?Gn._next=this:Wr=this,Gn=this),this._call=e,this._time=o,ms()},stop:function(){this._call&&(this._call=null,this._time=1/0,ms())}};function $r(e,t,o){var n=new zn;return n.restart(e,t,o),n}function bl(){Yn(),++jo;for(var e=Wr,t;e;)(t=No-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jo}function yl(){No=(Xr=Bn.now())+Ur,jo=Hn=0;try{bl()}finally{jo=0,Qf(),No=0}}function Jf(){var e=Bn.now(),t=e-Xr;t>xl&&(Ur-=t,Xr=e)}function Qf(){for(var e,t=Wr,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:Wr=o);Gn=e,ms(n)}function ms(e){if(!jo){Hn&&(Hn=clearTimeout(Hn));var t=e-No;t>24?(e<1/0&&(Hn=setTimeout(yl,e-Bn.now()-Ur)),Vn&&(Vn=clearInterval(Vn))):(Vn||(Xr=Bn.now(),Vn=setInterval(Jf,xl)),jo=1,El(yl))}}function Kr(e,t,o){var n=new zn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var jf=es("start","end","cancel","interrupt"),em=[],Nl=0,_l=1,Zr=2,qr=3,Tl=4,Jr=5,Fn=6;function no(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;tm(e,o,{name:t,index:n,group:r,on:jf,tween:em,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Nl})}function Wn(e,t){var o=Ge(e,t);if(o.state>Nl)throw new Error("too late; already scheduled");return o}function Ye(e,t){var o=Ge(e,t);if(o.state>qr)throw new Error("too late; already running");return o}function Ge(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function tm(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=$r(i,0,o.time);function i(c){o.state=_l,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,u,f,p;if(o.state!==_l)return l();for(d in n)if(p=n[d],p.name===o.name){if(p.state===qr)return Kr(a);p.state===Tl?(p.state=Fn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[d]):+d<t&&(p.state=Fn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete n[d])}if(Kr(function(){o.state===qr&&(o.state=Tl,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=Zr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Zr){for(o.state=qr,r=new Array(f=o.tween.length),d=0,u=-1;d<f;++d)(p=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=p);r.length=u+1}}function s(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=Jr,1),u=-1,f=r.length;++u<f;)r[u].call(e,d);o.state===Jr&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=Fn,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function gs(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>Zr&&n.state<Jr,n.state=Fn,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function vl(e){return this.each(function(){gs(this,e)})}function om(e,t){var o,n;return function(){var r=Ye(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 nm(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=Ye(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 wl(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=Ge(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?om:nm)(o,e,t))}function en(e,t,o){var n=e._id;return e.each(function(){var r=Ye(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return Ge(r,n).value[t]}}function Qr(e,t){var o;return(typeof t=="number"?gt:t instanceof oo?zr:(o=oo(t))?(t=o,zr):ds)(e,t)}function rm(e){return function(){this.removeAttribute(e)}}function im(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sm(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 am(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 lm(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 cm(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 Al(e,t){var o=Wt(e),n=o==="transform"?fs:Qr;return this.attrTween(e,typeof t=="function"?(o.local?cm:lm)(o,n,en(this,"attr."+e,t)):t==null?(o.local?im:rm)(o):(o.local?am:sm)(o,n,t))}function dm(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function um(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function pm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&um(e,i)),o}return r._value=t,r}function fm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&dm(e,i)),o}return r._value=t,r}function Il(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=Wt(e);return this.tween(o,(n.local?pm:fm)(n,t))}function mm(e,t){return function(){Wn(this,e).delay=+t.apply(this,arguments)}}function gm(e,t){return t=+t,function(){Wn(this,e).delay=t}}function Cl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mm:gm)(t,e)):Ge(this.node(),t).delay}function hm(e,t){return function(){Ye(this,e).duration=+t.apply(this,arguments)}}function ym(e,t){return t=+t,function(){Ye(this,e).duration=t}}function Sl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hm:ym)(t,e)):Ge(this.node(),t).duration}function xm(e,t){if(typeof t!="function")throw new Error;return function(){Ye(this,e).ease=t}}function Ml(e){var t=this._id;return arguments.length?this.each(xm(t,e)):Ge(this.node(),t).ease}function Em(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Ye(this,e).ease=o}}function Pl(e){if(typeof e!="function")throw new Error;return this.each(Em(this._id,e))}function Ll(e){typeof e!="function"&&(e=Ln(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 $e(n,this._parents,this._name,this._id)}function kl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),a=new Array(n),s=0;s<i;++s)for(var l=t[s],c=o[s],d=l.length,u=a[s]=new Array(d),f,p=0;p<d;++p)(f=l[p]||c[p])&&(u[p]=f);for(;s<n;++s)a[s]=t[s];return new $e(a,this._parents,this._name,this._id)}function bm(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 _m(e,t,o){var n,r,i=bm(t)?Wn:Ye;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function Rl(e,t){var o=this._id;return arguments.length<2?Ge(this.node(),o).on.on(e):this.each(_m(o,e,t))}function Tm(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Dl(){return this.on("end.remove",Tm(this._id))}function Ol(e){var t=this._name,o=this._id;typeof e!="function"&&(e=bo(e));for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a)for(var s=n[a],l=s.length,c=i[a]=new Array(l),d,u,f=0;f<l;++f)(d=s[f])&&(u=e.call(d,d.__data__,f,s))&&("__data__"in d&&(u.__data__=d.__data__),c[f]=u,no(c[f],t,o,f,c,Ge(d,o)));return new $e(i,this._parents,t,o)}function Vl(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Pn(e));for(var n=this._groups,r=n.length,i=[],a=[],s=0;s<r;++s)for(var l=n[s],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var f=e.call(d,d.__data__,u,l),p,g=Ge(d,o),y=0,m=f.length;y<m;++y)(p=f[y])&&no(p,t,o,y,f,g);i.push(f),a.push(d)}return new $e(i,a,t,o)}var Nm=Xt.prototype.constructor;function Hl(){return new Nm(this._groups,this._parents)}function vm(e,t){var o,n,r;return function(){var i=to(this,e),a=(this.style.removeProperty(e),to(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function Gl(e){return function(){this.style.removeProperty(e)}}function wm(e,t,o){var n,r=o+"",i;return function(){var a=to(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function Am(e,t,o){var n,r,i;return function(){var a=to(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),to(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function Im(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=Ye(this,e),c=l.on,d=l.value[i]==null?s||(s=Gl(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function Bl(e,t,o){var n=(e+="")=="transform"?ps:Qr;return t==null?this.styleTween(e,vm(e,n)).on("end.style."+e,Gl(e)):typeof t=="function"?this.styleTween(e,Am(e,n,en(this,"style."+e,t))).each(Im(this._id,e)):this.styleTween(e,wm(e,n,t),o).on("end.style."+e,null)}function Cm(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function Sm(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Cm(e,a,o)),n}return i._value=t,i}function zl(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,Sm(e,t,o==null?"":o))}function Mm(e){return function(){this.textContent=e}}function Pm(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Yl(e){return this.tween("text",typeof e=="function"?Pm(en(this,"text",e)):Mm(e==null?"":e+""))}function Lm(e){return function(t){this.textContent=e.call(this,t)}}function km(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Lm(r)),t}return n._value=e,n}function Fl(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,km(e))}function Wl(){for(var e=this._name,t=this._id,o=jr(),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=Ge(l,t);no(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new $e(n,this._parents,e,o)}function Xl(){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=Ye(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 Rm=0;function $e(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Ul(e){return Xt().transition(e)}function jr(){return++Rm}var Ut=Xt.prototype;$e.prototype=Ul.prototype={constructor:$e,select:Ol,selectAll:Vl,selectChild:Ut.selectChild,selectChildren:Ut.selectChildren,filter:Ll,merge:kl,selection:Hl,transition:Wl,call:Ut.call,nodes:Ut.nodes,node:Ut.node,size:Ut.size,empty:Ut.empty,each:Ut.each,on:Rl,attr:Al,attrTween:Il,style:Bl,styleTween:zl,text:Yl,textTween:Fl,remove:Dl,tween:wl,delay:Cl,duration:Sl,ease:Ml,easeVarying:Pl,end:Xl,[Symbol.iterator]:Ut[Symbol.iterator]};function ei(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dm={time:null,delay:0,duration:250,ease:ei};function Om(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function $l(e){var t,o;e instanceof $e?(t=e._id,e=e._name):(t=jr(),(o=Dm).time=Yn(),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])&&no(l,e,t,c,a,o||Om(l,t));return new $e(n,this._parents,e,t)}Xt.prototype.interrupt=vl;Xt.prototype.transition=$l;function ro(e,t,o){this.k=e,this.x=t,this.y=o}ro.prototype={constructor:ro,scale:function(e){return e===1?this:new ro(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ro(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 ti=new ro(1,0,0);oi.prototype=ro.prototype;function oi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ti;return e.__zoom}var Hm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Kl;(function(e){e.Strict="strict",e.Loose="loose"})(Kl||(Kl={}));var ql;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ql||(ql={}));var Zl;(function(e){e.Partial="partial",e.Full="full"})(Zl||(Zl={}));var Jl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Jl||(Jl={}));var Ql;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ql||(Ql={}));var Qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Qe||(Qe={}));var vb={[Qe.Left]:Qe.Right,[Qe.Right]:Qe.Left,[Qe.Top]:Qe.Bottom,[Qe.Bottom]:Qe.Top};var Gm=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Bm=(e,t=[0,0])=>{var s;let{width:o,height:n}=zm(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 $t=(e,t=[0,0])=>{var r,i,a,s,l,c,d,u;let{x:o,y:n}=Gm(e)?e.internals.positionAbsolute:Bm(e,t);return{x:o,y:n,x2:o+((s=(a=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?a:e.initialWidth)!=null?s:0),y2:n+((u=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?u:0)}};function zm(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 wb={[Qe.Left]:{x:-1,y:0},[Qe.Right]:{x:1,y:0},[Qe.Top]:{x:0,y:-1},[Qe.Bottom]:{x:0,y:1}};var Ym={nodeOrigin:[0,0],nodeExtent:Hm,elevateNodesOnSelect:!0,defaults:{}},Ab=v(T({},Ym),{checkEquality:!0});var jl;(function(e){e.Line="line",e.Handle="handle"})(jl||(jl={}));var Fm={width:0,height:0,x:0,y:0},Ib=v(T({},Fm),{pointerX:0,pointerY:0,aspectRatio:1});var Wm=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Xm(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 Um(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 ni=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r,i){let a=t==="horizontal"?this.yLines:this.xLines,[s,l]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],c=[];for(let p of a){if(p.position<s)continue;if(p.position>l)break;if(i.has(p.node.id)||p.node.parentId&&i.has(p.node.parentId)||!Wm(p.nodeBox,r))continue;let g=Math.abs(p.position-o);if(g>ri)continue;let m=Xm(p.nodeBox,n)>0?0:Um(p.nodeBox,n);c.push({line:p,lineDist:g,nodeDist:m})}let d=.5,u=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;c.sort((p,g)=>{if(u){if(p.line===u&&g.line!==u)return-1;if(g.line===u&&p.line!==u)return 1}return Math.abs(p.lineDist-g.lineDist)<=d?p.nodeDist-g.nodeDist:p.lineDist-g.lineDist});let f=c.length>0?c[0].line:void 0;return f&&(t==="horizontal"?this.lastHorizontalLine=f:this.lastVerticalLine=f),f}};function ec(e,t=vo,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=$t(i);Object.entries(t).forEach(([s,l])=>{var c;n.push({position:l.resolve(r,a),color:(c=r.style)==null?void 0:c.backgroundColor,orientation:l.orientation,anchorName:s,nodeBox:a,node:r})})}),n}function tc(e,t,o,n,r=Object.keys(vo)){let i=[];for(let s of r){let l=vo[s],c=l.resolve(null,o),d=e.search(l.orientation,c,o,t,n);d&&i.push({sourcePosition:c,anchorName:s,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 oc(e,t,o){let n=0,r=0,i=!1,a=!1;if(t){let l=t.anchor.resolve(null,e)-t.line.position;Math.abs(l)<=ri&&(r=l,a=!0)}if(o){let l=o.anchor.resolve(null,e)-o.line.position;Math.abs(l)<=ri&&(n=l,i=!0)}return{deltaX:n,deltaY:r,snappedX:i,snappedY:a}}var ri=10,vo={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 rc=require("react/jsx-runtime"),$m=new ni;function ii(){let[e,t]=(0,nt.useState)(void 0),[o,n]=(0,nt.useState)(void 0),{width:r,height:i}=(0,tn.useStore)(m=>({width:m.width,height:m.height}),nc.shallow),a=(0,tn.useNodesInitialized)(),s=(0,nt.useRef)($m),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,tn.useReactFlow)(),u=(0,nt.useCallback)(()=>{t(void 0),n(void 0)},[]),f=(0,nt.useCallback)(m=>{let _=m!=null?m:d();u();let h=ec(_,vo,c);s.current.initialize(h)},[c,u,d]),p=(0,nt.useCallback)(()=>{setTimeout(()=>{f()},100)},[f]);(0,nt.useEffect)(()=>{a&&f(d())},[a,f,d]);let g=(0,nt.useCallback)((m,_)=>{var K,L,H,F,Y,O,J,U,X,z;if(!s.current||m.length===0)return m;u();let h=m.filter(W=>W.type==="position"&&!!W.position),E=m.find(W=>W.type==="dimensions");if(h.length===0&&!E)return m;let w=Object.keys(vo),b=new Set,x=1/0,N=1/0,I=-1/0,A=-1/0;if(h.length>0)h.forEach(W=>{var Le,ve,ce,se,ze,Ze;let Z=_.find(Jt=>Jt.id===W.id);if(!Z)return;b.add(Z.id);let ee=c(Z.id);if(!ee)return;let ue=ee.parentId?c(ee.parentId):void 0,pe=W.position.x+((Le=ue==null?void 0:ue.internals.positionAbsolute.x)!=null?Le:0),ge=W.position.y+((ve=ue==null?void 0:ue.internals.positionAbsolute.y)!=null?ve:0),he=(se=(ce=Z.measured)==null?void 0:ce.width)!=null?se:0,Pe=(Ze=(ze=Z.measured)==null?void 0:ze.height)!=null?Ze:0;x=Math.min(x,pe),N=Math.min(N,ge),I=Math.max(I,pe+he),A=Math.max(A,ge+Pe)}),E&&(w=["top","left"]);else if(E){let W=_.find(he=>he.id===E.id);if(!W)return m;b.add(W.id);let Z=c(W.id);if(!Z)return m;let ee=Z.internals.positionAbsolute.x,ue=Z.internals.positionAbsolute.y,pe=(F=(H=(K=E.dimensions)==null?void 0:K.width)!=null?H:(L=W.measured)==null?void 0:L.width)!=null?F:0,ge=(U=(J=(Y=E.dimensions)==null?void 0:Y.height)!=null?J:(O=W.measured)==null?void 0:O.height)!=null?U:0;x=ee,N=ue,I=ee+pe,A=ue+ge,w=["right","bottom"]}if(x===1/0)return m;let M={x,y:N,x2:I,y2:A},{x:S,y:k}=l({x:0,y:0}),{x:B,y:q}=l({x:r,y:i}),j={x:S,y:k,x2:B,y2:q},{horizontal:C,vertical:P}=tc(s.current,j,M,b,w),{deltaX:$,deltaY:V,snappedX:R,snappedY:G}=oc(M,C,P);if(R||G){let W=h.some(ee=>ee.dragging),Z=!!(E!=null&&E.resizing);(W||Z)&&(R&&n(P==null?void 0:P.line),G&&t(C==null?void 0:C.line)),R&&(h.forEach(ee=>{ee.position&&(ee.position.x-=$)}),(E==null?void 0:E.id)===((X=h[0])==null?void 0:X.id)?E.dimensions&&(E.dimensions.width+=$):E&&!h.length&&E.dimensions&&(E.dimensions.width-=$)),G&&(h.forEach(ee=>{ee.position&&(ee.position.y-=V)}),(E==null?void 0:E.id)===((z=h[0])==null?void 0:z.id)?E.dimensions&&(E.dimensions.height+=V):E&&!h.length&&E.dimensions&&(E.dimensions.height-=V))}return m},[l,c,r,i,t,n,u]),y=(0,nt.useCallback)(()=>(0,rc.jsx)(ic,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:f,forceRebuildIndex:p,updateHelperLines:g,helperLineHorizontal:e,helperLineVertical:o,HelperLines:y}}var Oi=require("@xyflow/react"),Gt=require("react");var Kt=e=>new Map(e.map(t=>[t.id,t])),Xn=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),sc=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),hs=e=>e.some(t=>t.type==="START_EVENT"),io=(e,t)=>e==="START_EVENT"?!hs(t):!0,ac=(e,t,o,n,r)=>{let i=Kt(o),a=i.get(e);if(!a||a.type!=="START_EVENT")return!1;let s=i.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Xn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},lc=(e,t,o,n,r)=>{let i=Kt(o),a=i.get(t);if(!a||a.type!=="END_EVENT")return!1;let s=i.get(e);return(s==null?void 0:s.type)==="ANNOTATION"?!1:sc(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},si=(e,t,o,n,r)=>{var c;let i=Kt(o),a=i.get(e);if(!a||a.type!=="GATEWAY"||((c=a.data)==null?void 0:c.variant)!=="EXCLUSIVE")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:Xn(e,n,r).filter(d=>{let u=i.get(d.target);return(u==null?void 0:u.type)!=="ANNOTATION"}).length>=2},cc=(e,t,o)=>{var a,s,l,c;let n=Kt(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"},ai=(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"},dc=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SUBPROCESS"},li=(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"},Un=(e,t,o,n)=>{let r=Kt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:sc(e,o,n).some(s=>{let l=r.get(s.source);return(l==null?void 0:l.type)==="START_EVENT"})},$n=(e,t,o,n)=>{let r=Kt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Xn(e,o,n).some(s=>{let l=r.get(s.target);return(l==null?void 0:l.type)==="END_EVENT"})},uc=(e,t,o,n,r)=>{let i=Kt(o),a=i.get(e),s=i.get(t);return(a==null?void 0:a.type)==="START_EVENT"&&(s==null?void 0:s.type)==="TASK"?$n(t,o,n,r):(s==null?void 0:s.type)==="END_EVENT"&&(a==null?void 0:a.type)==="TASK"?Un(e,o,n,r):!1},ci=(e,t,o)=>Xn(e,t,o).length>0,di=(e,t,o,n,r)=>{let i=Kt(o),a=i.get(e);if(!a||a.type!=="TASK")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:Xn(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var pc=(e,t,o,n,r)=>{var s,l;let i=Kt(n),a=((s=i.get(e))==null?void 0:s.type)==="ANNOTATION"||((l=i.get(t))==null?void 0:l.type)==="ANNOTATION";return o.some(c=>r&&c.id===r?!1:!!(c.source===e&&c.target===t||a&&c.source===t&&c.target===e))};var Km=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!pc(e.sourceNodeId,e.targetNodeId,e.edges,e.nodes,e.reconnectingEdgeId),reason:"duplicate_connection_not_allowed"}),e=>({isValid:!ac(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!lc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!si(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!di(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:cc(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&dc(e.targetNodeId,e.nodes)),reason:"start_event_to_subprocess_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(ai(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(li(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(Un(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!uc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"concurrent_initial_and_final_activity"}),e=>({isValid:!($n(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(ci(e.sourceNodeId,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:["START_EVENT","END_EVENT","TASK","GATEWAY","LANE"],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],ys=e=>{for(let t of Km){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var qm=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:si(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"gateway_limit_reached"})},{sourceTypes:["START_EVENT"],validate:e=>({shouldDisable:e.edges.some(o=>{if(o.source!==e.sourceNodeId)return!1;let n=e.nodes.find(r=>r.id===o.target);return(n==null?void 0:n.type)!=="ANNOTATION"})&&e.targetNodeType!=="ANNOTATION",reason:"start_event_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:hs(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ai(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:li(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Un(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:$n(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ci(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:di(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],fc=e=>{let t=qm.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 Tt=require("@xyflow/react");var Lt=require("@produto-lecom/lecom-ui"),gc=require("lucide-react");var ht=require("@xyflow/react");var mc=require("@xyflow/react"),so=()=>{let e=(0,mc.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:a,triggerNodeChanges:s}=e.getState(),l=i.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]),c=r.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]);return s(l),a(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await Tr(),!0}}};var ui=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,ht.useReactFlow)(),{selectElements:r}=so(),i=m=>{let _=o(),h=n(),E=(0,ht.getIncomers)(m,_,h),w=(0,ht.getOutgoers)(m,_,h),b=E.some(N=>N.type==="START_EVENT"),x=w.some(N=>N.type==="END_EVENT");return b?"start":x?"end":"between"},a=(m,_,h)=>{var b,x,N,I;if(!m)return;let E={type:m.type,variant:(b=m.data)==null?void 0:b.variant,attribute:(x=m.data)==null?void 0:x.attribute},w={id:m.id,position:i(m),label:(N=m.data)==null?void 0:N.label,node:E};return m.type==="TASK"&&((I=m.data)==null?void 0:I.variant)==="SUBPROCESS"?v(T({},w),{type:"sub_process"}):m.type==="GATEWAY"?v(T({},w),{type:"gateway",variant:s(m,_,h)}):v(T({},w),{type:"activity"})},s=(m,_,h)=>{if(m.type!=="GATEWAY")return;let E=(0,ht.getIncomers)(m,_,h),w=!1,b=!1;if(E.forEach(x=>{var N,I;x.type==="TASK"&&(((N=x.data)==null?void 0:N.variant)==="SCRIPT"&&(w=!0),((I=x.data)==null?void 0:I.attribute)==="LOOP"&&(b=!0))}),w&&b)return"script_loop";if(w)return"script";if(b)return"loop"},l=(m,_,h)=>{var N,I,A,M;let E=e(m.source),w=e(m.target);if(!E||!w)return"simple";if((0,ht.getOutgoers)(E,_,h).some(S=>S.type==="END_EVENT"))return"final";if(E.type==="GATEWAY")switch((N=E.data)==null?void 0:N.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(E.type==="TASK"){let S=(I=E.data)==null?void 0:I.variant,k=(A=E.data)==null?void 0:A.attribute;if(S==="SUBPROCESS")return"from_sub_process";if(w.type==="TASK"&&((M=w.data)==null?void 0:M.variant)==="SUBPROCESS")return"to_sub_process";let B=S==="SCRIPT",q=k==="LOOP";return B&&q?"script_loop":B?"script":q?"loop":"simple"}return"simple"},c=(m,_,h)=>{let E=[];function w(x,N,I=0){let A=a(x,_,h);if(A.depth=I,N.push(A),x.type==="TASK"){E.push([...N]),N.pop();return}let M=(0,ht.getIncomers)(x,_,h);if(M.length)for(let S of M)w(S,N,I+1);N.pop()}let b=(0,ht.getIncomers)(m,_,h);for(let x of b)w(x,[]);return E},d=(m,_,h)=>{let E=[];function w(x,N,I=0){let A=a(x,_,h);if(A.depth=I,N.push(A),x.type==="TASK"){E.push([...N]),N.pop();return}let M=(0,ht.getOutgoers)(x,_,h);if(M.length)for(let S of M)w(S,N,I+1);N.pop()}let b=(0,ht.getOutgoers)(m,_,h);for(let x of b)w(x,[]);return E},u=(m,_,h)=>(h=h.filter(w=>w.source===m.id),h.map(w=>{var N;let b=e(w.target),x;return b&&(x=a(b,_,h)),{id:w.id,type:"routing",variant:l(w,_,h),label:(N=w.data)==null?void 0:N.label,target:x}})),f=m=>{let _=e(m);if(!_)return;let h=o(),E=n(),w=a(_,h,E);return w.sources=c(_,h,E),w.targets=d(_,h,E),w.edgeTargets=u(_,h,E),_.type==="GATEWAY"&&(w.variant=s(_,h,E)),w},p=m=>{let _=t(m);if(!_)return;let h=o(),E=n(),w=l(_,h,E),x={id:_.id,type:"routing",variant:w,gatewayVariant:void 0},N=e(_.source);if(N){let A=a(N,h,E);x.source=A;let M=s(N,h,E);if(x.gatewayVariant=M,N.type==="TASK")x.sources=[[A]];else{let S=c(N,h,E);x.sources=S.length?S:[[A]]}}let I=e(_.target);if(I){let A=a(I,h,E);if(x.target=A,I.type==="TASK")x.targets=[[A]];else{let M=d(I,h,E);x.targets=M.length?M:[[A]]}}return x},g=m=>{let _=e(m);if(_)return f(_.id);let h=t(m);if(h)return p(h.id)};return{configureElement:m=>{let _=g(m);if(_)return r([m]),_},getConfigureElement:g,getNodeConfigure:f,getEdgeConfigure:p}};var wo=require("react/jsx-runtime"),ao=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Lt.useTranslation)(),{onConfigureElement:n}=Q(),{getConfigureElement:r}=ui();return(0,wo.jsxs)(Lt.Tooltip,{children:[(0,wo.jsx)(Lt.TooltipTrigger,{asChild:!0,children:(0,wo.jsx)(Lt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,wo.jsx)(gc.Settings,{size:16})})}),(0,wo.jsx)(Lt.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var kt=require("@produto-lecom/lecom-ui"),yc=require("@xyflow/react"),xc=require("lucide-react");var hc=require("@produto-lecom/lecom-ui");function je(){let{toast:e}=on(),{toast:t}=(0,hc.useNotificationToast)();return{toast:e||t}}var Ao=require("react/jsx-runtime"),pi=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,kt.useTranslation)(),{toast:n}=je(),{deleteElements:r,getNodes:i}=(0,yc.useReactFlow)();return(0,Ao.jsxs)(kt.Tooltip,{children:[(0,Ao.jsx)(kt.TooltipTrigger,{asChild:!0,children:(0,Ao.jsx)(kt.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{if(t==="node"){let s=i(),l=s.find(c=>c.id===e);if((l==null?void 0:l.type)==="LANE"&&s.some(d=>d.parentId===e)){n({variant:"error",title:o("validation.errors.title"),content:o("editor.toolbar.delete_pool_lane_error")});return}r({nodes:[{id:e}]})}else r({edges:[{id:e}]})},children:(0,Ao.jsx)(xc.TrashIcon,{size:16})})}),(0,Ao.jsx)(kt.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Rt=require("@produto-lecom/lecom-ui"),Ec=require("lucide-react"),bc=require("react"),Io=require("react/jsx-runtime"),Co=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,Rt.useTranslation)(),r=(0,bc.useCallback)(i=>{i.stopPropagation();let a=document.querySelectorAll(`.react-flow__handle.source[data-nodeid="${e}"]`);if(a.length===0)return;let s=Array.from(a).reduce((f,p)=>{let g=f.getBoundingClientRect(),y=p.getBoundingClientRect(),m=Math.hypot(i.clientX-(g.left+g.width/2),i.clientY-(g.top+g.height/2));return Math.hypot(i.clientX-(y.left+y.width/2),i.clientY-(y.top+y.height/2))<m?p:f}),l=s.getBoundingClientRect(),c=l.left+l.width/2,d=l.top+l.height/2,u=new MouseEvent("mousedown",{clientX:c,clientY:d,bubbles:!0,cancelable:!0});s.dispatchEvent(u)},[e]);return(0,Io.jsxs)(Rt.Tooltip,{children:[(0,Io.jsx)(Rt.TooltipTrigger,{asChild:!0,children:(0,Io.jsx)(Rt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:t,className:t?"opacity-50 cursor-not-allowed":"",onMouseDown:t?void 0:r,children:(0,Io.jsx)(Ec.MoveUpRightIcon,{size:16})})}),(0,Io.jsx)(Rt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var nn=require("react/jsx-runtime"),sn=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=Mt(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=Q(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d}=Ir(o,n),u=!l&&!c&&!d,f=[{component:(0,nn.jsx)(pi,{elementId:e,elementType:"edge"})}],p=()=>s==="view"?u?[{component:(0,nn.jsx)(ao,{elementId:e,elementType:"edge"})}]:[]:u?[{component:(0,nn.jsx)(ao,{elementId:e,elementType:"edge"})},...f]:f,y=(m=>{switch(m){case"SEQUENCE_EDGE":return p();case"MESSAGE_EDGE":return s==="view"?[]:[...f];case"ANNOTATION_EDGE":return s==="view"?[]:[...f];default:return[]}})(t);if(!(y.length===0||s==="view"))return(0,nn.jsx)("div",v(T({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:y.map((m,_)=>(0,nn.jsx)("div",{children:m.component},_))}))};var _c=require("@xyflow/react"),Tc=require("react");var xs=require("react/jsx-runtime"),Dt=12,an=({sx:e,sy:t,tx:o,ty:n,hasLabel:r=!1,children:i})=>{let{zoom:a}=(0,_c.useViewport)(),s=1/a,l=(0,Tc.useMemo)(()=>t===n?{bottom:`${Dt}px`,transform:"translateX(-50%)"}:e===o?{left:`${Dt}px`,transform:r?"translateY(-100%)":"translateY(-50%)"}:n>t&&o>e?{left:`${Dt}px`,bottom:`${Dt}px`}:n>t&&o<e?{right:`${Dt}px`,bottom:`${Dt}px`}:t>n&&o>e?{right:`${Dt}px`,bottom:`${Dt}px`}:{left:`${Dt}px`,bottom:`${Dt}px`},[e,t,o,n,r]);return(0,xs.jsx)("div",{style:{transform:`scale(${s})`},children:(0,xs.jsx)("div",{className:"absolute pointer-events-auto",style:T({},l),children:i})})};var yt=require("react/jsx-runtime"),ln={type:"ANNOTATION_EDGE",reconnectable:!0},Nc=({id:e,source:t,target:o,selected:n,data:r})=>{let{isMultipleSelection:i}=Q(),{zoom:a}=(0,Tt.useViewport)(),s=(0,Tt.useInternalNode)(t),l=(0,Tt.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:u,ty:f}=Zo(s,l),[p,g,y]=(0,Tt.getStraightPath)({sourceX:c,sourceY:d,targetX:u,targetY:f}),m=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected);return(0,yt.jsxs)(yt.Fragment,{children:[(0,yt.jsx)("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/a),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,yt.jsxs)("g",{className:D("text-grey-500 hover:text-grey-600",{"text-blue-500 hover:text-blue-600":m}),children:[(0,yt.jsx)(Tt.BaseEdge,{id:e,path:p,interactionWidth:0,strokeDasharray:4,className:D("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":m&&!(r!=null&&r.hasError)})}),(0,yt.jsx)(Tt.EdgeLabelRenderer,{children:(0,yt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${g}px, ${y}px)`},children:n&&!i&&(0,yt.jsx)(an,{sx:c,sy:d,tx:u,ty:f,children:(0,yt.jsx)(sn,{edgeId:e,edgeType:"ANNOTATION_EDGE"})})})})]})]})};var et=require("react"),we=require("@xyflow/react");var Nt=require("react");var bs=require("react/jsx-runtime"),Es=/[a-zA-Z0-9À-ÖØ-öø-ÿ]/,vc=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Escape","Shift"],Xe=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s,onInput:l,onInvalidFirstCharacter:c,skipFirstCharValidation:d})=>{let u=(0,Nt.useRef)(null),f=(0,Nt.useRef)(null),[p,g]=(0,Nt.useState)(!1);(0,Nt.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]),(0,Nt.useEffect)(()=>{g(i!=null?i:!1)},[i]),(0,Nt.useEffect)(()=>{if(p&&u.current){u.current.focus();let b=document.createRange();b.selectNodeContents(u.current);let x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(b))}},[p]);let y=(0,Nt.useCallback)(()=>{f.current||(c==null||c(),f.current=setTimeout(()=>{f.current=null},500))},[c]),m=b=>{b.stopPropagation(),p||g(!0)},_=b=>{let x=b.currentTarget.innerText.replace(/\n$/,""),N=t&&x.length>=t,I=window.getSelection(),A=(I==null?void 0:I.toString())||"",M=A.length>0,S=(b.ctrlKey||b.metaKey)&&!b.altKey,k=S&&b.key==="a",B=S&&b.key==="c",q=S&&b.key==="x",j=S&&b.key==="v",C=x.length===0||M&&A.length===x.length;if(!d&&C&&!Es.test(b.key)&&!vc.includes(b.key)&&!S){b.preventDefault(),y();return}N&&!M&&(vc.includes(b.key)||k||B||q||j||b.preventDefault())},h=b=>{b.preventDefault();let x=b.clipboardData.getData("text/plain").replace(/\r\n/g,`
|
|
1
|
+
"use strict";var Yp=Object.create;var Hn=Object.defineProperty,Wp=Object.defineProperties,Fp=Object.getOwnPropertyDescriptor,Xp=Object.getOwnPropertyDescriptors,Up=Object.getOwnPropertyNames,Ar=Object.getOwnPropertySymbols,$p=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var sa=(e,t,o)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_=(e,t)=>{for(var o in t||(t={}))cs.call(t,o)&&sa(e,o,t[o]);if(Ar)for(var o of Ar(t))aa.call(t,o)&&sa(e,o,t[o]);return e},v=(e,t)=>Wp(e,Xp(t));var Dt=(e,t)=>{var o={};for(var n in e)cs.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Ar)for(var n of Ar(e))t.indexOf(n)<0&&aa.call(e,n)&&(o[n]=e[n]);return o};var Kp=(e,t)=>{for(var o in t)Hn(e,o,{get:t[o],enumerable:!0})},la=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Up(t))!cs.call(e,r)&&r!==o&&Hn(e,r,{get:()=>t[r],enumerable:!(n=Fp(t,r))||n.enumerable});return e};var qp=(e,t,o)=>(o=e!=null?Yp($p(e)):{},la(t||!e||!e.__esModule?Hn(o,"default",{value:e,enumerable:!0}):o,e)),Zp=e=>la(Hn({},"__esModule",{value:!0}),e);var Vh={};Kp(Vh,{EditorMode:()=>Ye,ElementPosition:()=>Sr,ElementType:()=>Vn,GatewayElementVariant:()=>Mr,GatewayVariant:()=>yt,Modeler:()=>zp,ModelerProvider:()=>Hp,NodeAttribute:()=>It,NodeType:()=>ie,NodeVariant:()=>ht,RoutingVariant:()=>Pr,useModeler:()=>yn});module.exports=Zp(Vh);var ds=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 Cr=require("@produto-lecom/lecom-ui");var ca={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",start_event_limit_reached:"Start event can only connect to a single element",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",concurrent_initial_and_final_activity:"An activity cannot be connected to both start and end events",duplicate_connection_not_allowed:"A connection already exists between these elements",connect_node:"Connect element",connecting:"Connecting...",delete_pool_lane_error:"Cannot delete the pool or lane while there are elements inside it."},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{empty:"Cannot export an empty diagram",error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{label:"Minimap",open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess",loop:"Activity with loop"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"},feedback:{label_empty:{prefix:"Activity name was automatically set to"},label_already_exists:{prefix:"The name",middle:"already exists. The name was changed to"},invalid_first_character:"Activity name must start with a letter or number"}},lane:{variant:{default:"Pool / Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var da={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",start_event_limit_reached:"Evento inicial solo puede conectarse a un \xFAnico elemento",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",concurrent_initial_and_final_activity:"Una actividad no puede estar conectada al evento inicial y final al mismo tiempo",duplicate_connection_not_allowed:"Ya existe una conexi\xF3n entre estos elementos",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"No se puede eliminar la piscina o carril mientras haya elementos dentro."},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{empty:"No es posible exportar un diagrama vac\xEDo",error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso",loop:"Actividad con loop"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"},feedback:{label_empty:{prefix:"El nombre de la actividad se estableci\xF3 autom\xE1ticamente como"},label_already_exists:{prefix:"El nombre",middle:"ya existe. El nombre fue cambiado a"},invalid_first_character:"El nombre de la actividad debe comenzar con una letra o n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var ua={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",start_event_limit_reached:"Evento inicial s\xF3 pode se conectar a um \xFAnico elemento",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",concurrent_initial_and_final_activity:"Uma atividade n\xE3o pode estar conectada ao evento inicial e final ao mesmo tempo",duplicate_connection_not_allowed:"J\xE1 existe uma conex\xE3o entre esses elementos",start_event_to_subprocess_not_allowed:"Evento inicial n\xE3o pode se conectar a um subprocesso",connect_node:"Conectar elemento",connecting:"Conectando...",delete_pool_lane_error:"N\xE3o \xE9 poss\xEDvel excluir a piscina ou raia enquanto houver elementos dentro dela."},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Validar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{empty:"N\xE3o \xE9 poss\xEDvel exportar um diagrama vazio",error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{label:"Minimapa",open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso",loop:"Atividade com loop"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de Atividade"},variant:{default:"Atividade",script:"Atividade de script",subprocess:"Subprocesso"},attribute:{loop:"Atividade com loop"},label:{prefix:"Atividade"},feedback:{label_empty:{prefix:"O nome da atividade foi definido automaticamente como"},label_already_exists:{prefix:"O nome",middle:"j\xE1 existe. O nome foi alterado para"},invalid_first_character:"O nome da atividade deve come\xE7ar com uma letra ou n\xFAmero"}},lane:{variant:{default:"Piscina / Raia"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var pa={pt_BR:ua,en_US:ca,es_ES:da};var fa,ma,Jp=(ma=(fa=ds("LecomUserLanguage"))!=null?fa:ds("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?ma:Cr.Translations.PT_BR;(0,Cr.initializeI18n)({lng:Jp,resources:pa});var Ye=(n=>(n.EDIT="edit",n.VIEW="view",n.READONLY="readonly",n))(Ye||{});var Vn=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Vn||{}),Sr=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Sr||{}),Mr=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Mr||{}),Pr=(d=>(d.SIMPLE="simple",d.LOOP="loop",d.SCRIPT="script",d.SCRIPT_LOOP="script_loop",d.COMPLEX="complex",d.EXCLUSIVE="exclusive",d.PARALLEL="parallel",d.FINAL="final",d.TO_SUB_PROCESS="to_sub_process",d.FROM_SUB_PROCESS="from_sub_process",d))(Pr||{});var an=require("lucide-react");var Io=require("react/jsx-runtime"),Lr=({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:"#6b7280",className:t,children:[(0,Io.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Io.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Io.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Io.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var us=require("react/jsx-runtime"),Qo=({size:e=24,className:t})=>(0,us.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,us.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 ro=require("react/jsx-runtime"),jo=({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"}),(0,ro.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ro.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var en=require("react/jsx-runtime"),tn=({size:e=24,className:t})=>(0,en.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,en.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,en.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,en.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var on=require("react/jsx-runtime"),nn=({size:e=24,className:t})=>(0,on.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,on.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,on.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,on.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var rn=require("react/jsx-runtime"),ga=({size:e=24,className:t})=>(0,rn.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,rn.jsxs)("g",{children:[(0,rn.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,rn.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var ha=require("clsx"),ya=require("tailwind-merge");function V(...e){return(0,ya.twMerge)((0,ha.clsx)(e))}var io=(e=0,t=0)=>e<t?t:e,kr=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Gn=require("react/jsx-runtime"),xa=({size:e=24,className:t})=>(0,Gn.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:V("stroke-2",t),children:[(0,Gn.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,Gn.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Rr=require("react/jsx-runtime"),Ea=({size:e=24,className:t})=>(0,Rr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Rr.jsx)("g",{children:(0,Rr.jsx)("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});var ps=require("react/jsx-runtime"),Dr=({size:e=24,className:t})=>(0,ps.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,ps.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 fs=require("react/jsx-runtime"),Bn=({size:e=24,className:t})=>(0,fs.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:V("stroke-2",t),children:(0,fs.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 sn=require("react/jsx-runtime"),ba=({size:e=24,className:t})=>(0,sn.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,sn.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,sn.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,sn.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var so=require("react/jsx-runtime"),_a=({size:e=24,className:t})=>(0,so.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,so.jsx)("path",{d:"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,so.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,so.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,so.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,so.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ao=require("react/jsx-runtime"),Ta=({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:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,Ao.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ao.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var ie=(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))(ie||{}),ht=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(ht||{}),Or={SCRIPT:{icon:an.ScrollText},SUBPROCESS:{icon:an.SquarePlus}},It=(t=>(t.LOOP="LOOP",t))(It||{}),Hr={LOOP:{icon:an.RotateCcw}},yt=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(yt||{}),ms={EXCLUSIVE:{icon:tn},PARALLEL:{icon:nn},COMPLEX:{icon:jo}};var Vp=require("@xyflow/react"),ke=require("react");var Kt=require("@xyflow/react"),kt=require("react");var tp=require("@produto-lecom/lecom-ui"),Ut=require("@xyflow/react"),vt=require("react");var ln=require("@xyflow/react");function Na(e,t){var E,N,b,g;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,a=o/2,s=n/2,l=r.x+a,c=r.y+s,d=i.x+((N=(E=t==null?void 0:t.measured)==null?void 0:E.width)!=null?N:0)/2,u=i.y+((g=(b=t==null?void 0:t.measured)==null?void 0:b.height)!=null?g:0)/2,f=(d-l)/(2*a)-(u-c)/(2*s),p=(d-l)/(2*a)+(u-c)/(2*s),h=1/(Math.abs(f)+Math.abs(p)||1),y=h*f,m=h*p,x=a*(y+m)+l,T=s*(-y+m)+c;return{x,y:T}}function va(e,t){var c,d,u,f;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(f=(u=e.measured)==null?void 0:u.height)!=null?f: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?ln.Position.Left:s>=i+n-1?ln.Position.Right:l<=a+1?ln.Position.Top:l>=a+r-1?ln.Position.Bottom:ln.Position.Top}function cn(e,t){let o=Na(e,t),n=Na(t,e),r=va(e,o),i=va(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}function Vr(e,t){return{isFromStartEvent:(e==null?void 0:e.type)==="START_EVENT",isGatewayToGateway:(e==null?void 0:e.type)==="GATEWAY"&&(t==null?void 0:t.type)==="GATEWAY",isActiviyToAndGateway:(e==null?void 0:e.type)==="TASK"&&(t==null?void 0:t.type)==="GATEWAY",isToEndEvent:(t==null?void 0:t.type)==="END_EVENT"}}var Gr={MIN_WIDTH:36,MIN_HEIGHT:36},Br={MIN_WIDTH:36,MIN_HEIGHT:36},zr={MIN_WIDTH:56,MIN_HEIGHT:56},dn={MIN_WIDTH:176,MIN_HEIGHT:96},wa={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},re={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},un={MIN_WIDTH:176,MIN_HEIGHT:64},Qp={MIN_WIDTH:128,MIN_HEIGHT:64},ae={START_EVENT:Gr,END_EVENT:Br,GATEWAY:zr,TASK:dn,LANE:re,ANNOTATION:un,UNSUPPORTED:Qp};var Ia=require("lodash");var Aa=e=>new Map(e.map(t=>[t.id,t])),Ca=(e,t)=>e.map(o=>{var n;return(n=t.get(o.id))!=null?n:o}),xt=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}},Co=e=>(0,Ia.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Sa=(e,t)=>{let{x:o,y:n}=xt(e),{x:r,y:i}=xt(t);return{x:o-r,y:n-i}};var So=({parentId:e,nodes:t,includeTypes:o=[...Object.values(ie)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),jp=(e,t)=>{let{x:o,y:n}=xt(e),{x:r,y:i}=xt(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},ef=(e,t)=>{let{x:o,y:n,w:r,h:i}=xt(e),{x:a,y:s,w:l,h:c}=xt(t),d=o+r/2,u=n+i/2;return d>=a&&d<=a+l&&u>=s&&u<=s+c},zn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&ef(e,r)){let i=jp(e,r);i<n&&(n=i,o=r)}return o},Ma=(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),Pa=(e,t)=>{let o=e.filter(c=>!c.parentId);if(o.length===0)return{nodes:e,edges:t};let n=o.filter(c=>c.type==="LANE"),r=n.length>0?n:o,i=Math.min(...r.map(c=>c.position.x||0)),a=Math.min(...r.map(c=>c.position.y||0)),s=e.map(c=>c.parentId?c:v(_({},c),{position:{x:c.position.x-i,y:c.position.y-a}})),l=t.map(c=>{let d=c.data;return d!=null&&d.points?v(_({},c),{data:v(_({},d),{points:d.points.map(u=>({x:u.x-i,y:u.y-a}))})}):c});return{nodes:s,edges:l}},La=e=>{var l,c;let t=e.filter(d=>!d.parentId),o=t.filter(d=>d.type==="LANE"),n=o.length>0?o:t;if(n.length===0)return null;let r=1/0,i=1/0,a=-1/0,s=-1/0;for(let d of n){let u=d.position.x+((l=d.width)!=null?l:0),f=d.position.y+((c=d.height)!=null?c:0);d.position.x<r&&(r=d.position.x),d.position.y<i&&(i=d.position.y),u>a&&(a=u),f>s&&(s=f)}return{x:r,y:i,width:a-r,height:s-i}};var gs=(e,t)=>{let o=t.find(a=>a.id===e);if(!o||o.type!=="LANE"||o.parentId)return!1;let n=xt(o),r=n.x+n.w,i=n.y+n.h;return t.some(a=>{if(a.id===e||a.parentId||a.type==="LANE")return!1;let s=xt(a);return s.x<r&&s.x+s.w>n.x&&s.y<i&&s.y+s.h>n.y})};var tf=50,Mo=(e,t)=>{var f,p,h,y,m,x,T,E,N,b,g,w,A,I,D,S;let o=t.find(L=>L.id===e);if(!o)return t;let n=(p=(f=o.position)==null?void 0:f.x)!=null?p:0,r=(y=(h=o.position)==null?void 0:h.y)!=null?y:0,i=(x=(m=o.measured)==null?void 0:m.width)!=null?x:0,a=(E=(T=o.measured)==null?void 0:T.height)!=null?E:0,s=r+a,l=n+i,c=new Set,d=1/0;for(let L of t){if(L.id===e||L.parentId)continue;let z=(b=(N=L.position)==null?void 0:N.y)!=null?b:0,q=(w=(g=L.position)==null?void 0:g.x)!=null?w:0,Q=(I=(A=L.measured)==null?void 0:A.width)!=null?I:0,U=(S=(D=L.measured)==null?void 0:D.height)!=null?S:0;q<l&&q+Q>n&&z<s&&z+U>r&&(c.add(L.id),d=Math.min(d,z))}if(c.size===0)return t;let u=s+tf-d;return t.map(L=>{var q,Q,U;if(!c.has(L.id))return L;let z=(Q=(q=L.position)==null?void 0:q.y)!=null?Q:0;return v(_({},L),{position:v(_({},(U=L.position)!=null?U:{x:0,y:0}),{y:z+u})})})},Se=15,Po=e=>[...e].sort((t,o)=>t.position.y-o.position.y),of=e=>{var t,o,n;return e.position.x+((n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:0)},nf=e=>{var t,o,n;return e.position.y+((n=(o=(t=e.measured)==null?void 0:t.height)!=null?o:e.height)!=null?n:0)},hs=(e,t,o)=>{var d,u,f,p,h,y,m,x,T,E,N,b,g,w,A;if(t.length===0)return e;let n=(f=(u=e.width)!=null?u:(d=e.measured)==null?void 0:d.width)!=null?f:0,r=(y=(h=e.height)!=null?h:(p=e.measured)==null?void 0:p.height)!=null?y:0,i=0,a=0;for(let I of t){let D=of(I),S=nf(I);if(((x=(m=I.position)==null?void 0:m.y)!=null?x:0)<Se&&(o.set(I.id,v(_({},I),{position:v(_({},I.position),{y:Se})})),S=Se+((E=(T=I.measured)==null?void 0:T.height)!=null?E:0)),((b=(N=I.position)==null?void 0:N.x)!=null?b:0)<re.HEADER_WIDTH+Se){let L=(g=o.get(I.id))!=null?g:I;o.set(I.id,v(_({},L),{position:v(_({},L.position),{x:re.HEADER_WIDTH+Se})})),D=re.HEADER_WIDTH+Se+((A=(w=I.measured)==null?void 0:w.width)!=null?A:0)}i=Math.max(i,D),a=Math.max(a,S)}let s=Math.max(n,re.MIN_WIDTH),l=Math.max(r,re.MIN_HEIGHT);i+Se>s&&(s=i+Se),a+Se>l&&(l=a+Se);let c=v(_({},e),{width:s,height:l,measured:v(_({},e.measured),{width:s,height:l})});return o.set(e.id,c),c},ka=(e,t,o)=>{var a,s;let n=Po(e),r=new Map;for(let l of o)l.parentId&&(r.has(l.parentId)||r.set(l.parentId,[]),r.get(l.parentId).push(l));let i=0;for(let l of n){let c=(a=r.get(l.id))!=null?a:[],d=hs(l,c,t);t.set(d.id,v(_({},d),{position:{x:re.HEADER_WIDTH,y:i}})),i+=(s=d.height)!=null?s:0}},Ra=(e,t)=>{var h,y,m,x;let o=[];for(let T of t.values())T.parentId===e.id&&o.push(T);let n=Po(o),r=((y=(h=e.measured)==null?void 0:h.width)!=null?y:0)-re.HEADER_WIDTH,i=Ma(e.id,o)||re.MIN_WIDTH,a=o.reduce((T,E)=>{var N;return T+((N=E.height)!=null?N:re.MIN_HEIGHT)},0),s=Math.max(r,i),l=a,c=r>i,d=c?s:s+re.HEADER_WIDTH,u=c?s-re.HEADER_WIDTH:s,f=0;for(let T=0;T<n.length;T++){let E=n[T],N=Math.max(re.MIN_HEIGHT,(m=E.height)!=null?m:re.MIN_HEIGHT),b=v(_({},E),{width:u,height:N,measured:v(_({},E.measured),{width:u,height:N}),position:{x:re.HEADER_WIDTH,y:f}});if(T===o.length-1){let g=Math.max(re.MIN_HEIGHT,l-f);b=v(_({},b),{height:g,measured:v(_({},E.measured),{width:u,height:g})})}t.set(E.id,b),f+=(x=b.height)!=null?x:0}let p=Math.max(l,f);t.set(e.id,v(_({},e),{width:d,height:p,measured:v(_({},e.measured),{width:d,height:p})}))},Da=(e,t,o,n,r)=>{var h,y;let i=!e.parentId,a=i?e.id:e.parentId,s=n.filter(m=>m.type==="LANE"&&m.parentId===a);if(!s.length)return n;let l=Po(s),c=l.findIndex(m=>m.id===e.id),d=(y=(h=e.position)==null?void 0:h.y)!=null?y:0,u=!i&&r!==void 0&&c>0&&Math.abs(r-d)>.5,f=0,p=[...n];return l.forEach((m,x)=>{var g,w;let T=x===l.length-1,E=m.id===e.id,b=(w=(g=m.measured)==null?void 0:g.height)!=null?w:0;E?b=o:u&&x===c-1&&(b=Math.max(re.MIN_HEIGHT,r-f)),T&&i&&(b=Math.max(re.MIN_HEIGHT,o-f)),p=p.map(A=>{if(A.id===m.id){let I=i?t-re.HEADER_WIDTH:t;return v(_({},A),{width:I,height:b,measured:v(_({},A.measured),{width:I,height:b}),position:{x:re.HEADER_WIDTH,y:f}})}return A}),E&&u?f=r+o:f+=b}),p=p.map(m=>{if(m.id===a){let x=i?t:t+re.HEADER_WIDTH;return v(_({},m),{width:x,height:i?o:f,measured:{width:x,height:i?o:f}})}return m}),p};var ys=(e,t,o)=>{var s,l,c,d,u,f,p,h;if(e.type==="LANE")return o;let n=(l=(s=t.measured)==null?void 0:s.width)!=null?l:0,r=(d=(c=t.measured)==null?void 0:c.height)!=null?d:0;e.position.y<Se&&(e.position.y=Se),e.position.x<re.HEADER_WIDTH+Se&&(e.position.x=re.HEADER_WIDTH+Se);let i=e.position.x+((f=(u=e.measured)==null?void 0:u.width)!=null?f:0),a=e.position.y+((h=(p=e.measured)==null?void 0:p.height)!=null?h:0);return i+Se>n&&(t.width=i+Se,t.measured.width=i+Se),a+Se>r&&(t.height=a+Se,t.measured.height=a+Se),o=o.map(y=>y.id===t.id?v(_({},y),{height:t.height,width:t.width,measured:t.measured}):y.id===e.id?v(_({},y),{position:e.position}):y),o};var Oa=require("zustand"),Ha=require("@xyflow/react"),Va=require("react");var Yr=()=>{let{setEdges:e}=(0,Ha.useReactFlow)();return(0,Va.useCallback)(()=>{let o=Lo.getState().pathEdgeIds;e(n=>n.map(r=>v(_({},r),{selected:o.includes(r.id)})))},[e])},Lo=(0,Oa.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=_({},n.statusByNodeId),i=_({},n.statusData),a=!1;return o.forEach(s=>{let l=`${s.diagramId}-${s.activityId}`;r[s.diagramId]!==s.status&&(r[s.diagramId]=s.status,i[l]=s,a=!0)}),a?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],a={};o.forEach(d=>{a[d.source]||(a[d.source]=[]),a[d.source].push({targetId:d.target,edgeId:d.id})});let s=r[0],l=r[r.length-1];o.forEach(d=>{d.target===s&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,u)=>{let f=[],p=new Set;for(f.push({node:d,path:[]}),p.add(d);f.length>0;){let{node:h,path:y}=f.shift();if(h===u)return y;let m=a[h]||[];for(let{targetId:x,edgeId:T}of m)p.has(x)||(p.add(x),f.push({node:x,path:[...y,T]}))}return[]};for(let d=0;d<r.length-1;d++){let u=r[d],f=r[d+1],p=c(u,f);p.length>0&&i.push(...p)}i.length>0&&e({pathEdgeIds:i})}}));var hn=require("@xyflow/react"),it=require("react"),Lc=require("zustand/shallow");var rf={value:()=>{}};function Ba(){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 Wr(o)}function Wr(e){this._=e}function sf(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}})}Wr.prototype=Ba.prototype={constructor:Wr,on:function(e,t){var o=this._,n=sf(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=af(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]=Ga(o[r],e.name,t);else if(t==null)for(r in o)o[r]=Ga(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 Wr(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 af(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function Ga(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=rf,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var xs=Ba;var Fr="http://www.w3.org/1999/xhtml",Es={svg:"http://www.w3.org/2000/svg",xhtml:Fr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zt(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Es.hasOwnProperty(t)?{space:Es[t],local:e}:e}function lf(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Fr&&t.documentElement.namespaceURI===Fr?t.createElement(e):t.createElementNS(o,e)}}function cf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xr(e){var t=Zt(e);return(t.local?cf:lf)(t)}function df(){}function ko(e){return e==null?df:function(){return this.querySelector(e)}}function za(e){typeof e!="function"&&(e=ko(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],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 Ve(n,this._parents)}function bs(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function uf(){return[]}function Yn(e){return e==null?uf:function(){return this.querySelectorAll(e)}}function pf(e){return function(){return bs(e.apply(this,arguments))}}function Ya(e){typeof e=="function"?e=pf(e):e=Yn(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 Ve(n,r)}function Wn(e){return function(){return this.matches(e)}}function Ur(e){return function(t){return t.matches(e)}}var ff=Array.prototype.find;function mf(e){return function(){return ff.call(this.children,e)}}function gf(){return this.firstElementChild}function Wa(e){return this.select(e==null?gf:mf(typeof e=="function"?e:Ur(e)))}var hf=Array.prototype.filter;function yf(){return Array.from(this.children)}function xf(e){return function(){return hf.call(this.children,e)}}function Fa(e){return this.selectAll(e==null?yf:xf(typeof e=="function"?e:Ur(e)))}function Xa(e){typeof e!="function"&&(e=Wn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],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 Ve(n,this._parents)}function $r(e){return new Array(e.length)}function Ua(){return new Ve(this._enter||this._groups.map($r),this._parents)}function Fn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Fn.prototype={constructor:Fn,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 $a(e){return function(){return e}}function Ef(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 Fn(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function bf(e,t,o,n,r,i,a){var s,l,c=new Map,d=t.length,u=i.length,f=new Array(d),p;for(s=0;s<d;++s)(l=t[s])&&(f[s]=p=a.call(l,l.__data__,s,t)+"",c.has(p)?r[s]=l:c.set(p,l));for(s=0;s<u;++s)p=a.call(e,i[s],s,i)+"",(l=c.get(p))?(n[s]=l,l.__data__=i[s],c.delete(p)):o[s]=new Fn(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(f[s])===l&&(r[s]=l)}function _f(e){return e.__data__}function Ka(e,t){if(!arguments.length)return Array.from(this,_f);var o=t?bf:Ef,n=this._parents,r=this._groups;typeof e!="function"&&(e=$a(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],u=r[c],f=u.length,p=Tf(e.call(d,d&&d.__data__,c,n)),h=p.length,y=s[c]=new Array(h),m=a[c]=new Array(h),x=l[c]=new Array(f);o(d,u,y,m,x,p,t);for(var T=0,E=0,N,b;T<h;++T)if(N=y[T]){for(T>=E&&(E=T+1);!(b=m[E])&&++E<h;);N._next=b||null}}return a=new Ve(a,n),a._enter=s,a._exit=l,a}function Tf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qa(){return new Ve(this._exit||this._groups.map($r),this._parents)}function Za(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 Ja(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c=o[l],d=n[l],u=c.length,f=s[l]=new Array(u),p,h=0;h<u;++h)(p=c[h]||d[h])&&(f[h]=p);for(;l<r;++l)s[l]=o[l];return new Ve(s,this._parents)}function Qa(){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 ja(e){e||(e=Nf);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}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 Ve(r,this._parents).order()}function Nf(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function el(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tl(){return Array.from(this)}function ol(){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 nl(){let e=0;for(let t of this)++e;return e}function rl(){return!this.node()}function il(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 vf(e){return function(){this.removeAttribute(e)}}function wf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function If(e,t){return function(){this.setAttribute(e,t)}}function Af(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Cf(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Sf(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 sl(e,t){var o=Zt(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?wf:vf:typeof t=="function"?o.local?Sf:Cf:o.local?Af:If)(o,t))}function Kr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mf(e){return function(){this.style.removeProperty(e)}}function Pf(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Lf(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function al(e,t,o){return arguments.length>1?this.each((t==null?Mf:typeof t=="function"?Lf:Pf)(e,t,o==null?"":o)):ao(this.node(),e)}function ao(e,t){return e.style.getPropertyValue(t)||Kr(e).getComputedStyle(e,null).getPropertyValue(t)}function kf(e){return function(){delete this[e]}}function Rf(e,t){return function(){this[e]=t}}function Df(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ll(e,t){return arguments.length>1?this.each((t==null?kf:typeof t=="function"?Df:Rf)(e,t)):this.node()[e]}function cl(e){return e.trim().split(/^|\s+/)}function _s(e){return e.classList||new dl(e)}function dl(e){this._node=e,this._names=cl(e.getAttribute("class")||"")}dl.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 ul(e,t){for(var o=_s(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function pl(e,t){for(var o=_s(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function Of(e){return function(){ul(this,e)}}function Hf(e){return function(){pl(this,e)}}function Vf(e,t){return function(){(t.apply(this,arguments)?ul:pl)(this,e)}}function fl(e,t){var o=cl(e+"");if(arguments.length<2){for(var n=_s(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?Vf:t?Of:Hf)(o,t))}function Gf(){this.textContent=""}function Bf(e){return function(){this.textContent=e}}function zf(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function ml(e){return arguments.length?this.each(e==null?Gf:(typeof e=="function"?zf:Bf)(e)):this.node().textContent}function Yf(){this.innerHTML=""}function Wf(e){return function(){this.innerHTML=e}}function Ff(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function gl(e){return arguments.length?this.each(e==null?Yf:(typeof e=="function"?Ff:Wf)(e)):this.node().innerHTML}function Xf(){this.nextSibling&&this.parentNode.appendChild(this)}function hl(){return this.each(Xf)}function Uf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yl(){return this.each(Uf)}function xl(e){var t=typeof e=="function"?e:Xr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function $f(){return null}function El(e,t){var o=typeof e=="function"?e:Xr(e),n=t==null?$f:typeof t=="function"?t:ko(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function Kf(){var e=this.parentNode;e&&e.removeChild(this)}function bl(){return this.each(Kf)}function qf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Zf(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _l(e){return this.select(e?Zf:qf)}function Tl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Jf(e){return function(t){e.call(this,t,this.__data__)}}function Qf(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 jf(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 em(e,t,o){return function(){var n=this.__on,r,i=Jf(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 Nl(e,t,o){var n=Qf(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?em:jf,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function vl(e,t,o){var n=Kr(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 tm(e,t){return function(){return vl(this,e,t)}}function om(e,t){return function(){return vl(this,e,t.apply(this,arguments))}}function wl(e,t){return this.each((typeof t=="function"?om:tm)(e,t))}function*Il(){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 nm=[null];function Ve(e,t){this._groups=e,this._parents=t}function Al(){return new Ve([[document.documentElement]],nm)}function rm(){return this}Ve.prototype=Al.prototype={constructor:Ve,select:za,selectAll:Ya,selectChild:Wa,selectChildren:Fa,filter:Xa,data:Ka,enter:Ua,exit:qa,join:Za,merge:Ja,selection:rm,order:Qa,sort:ja,call:el,nodes:tl,node:ol,size:nl,empty:rl,each:il,attr:sl,style:al,property:ll,classed:fl,text:ml,html:gl,raise:hl,lower:yl,append:xl,insert:El,remove:bl,clone:_l,datum:Tl,on:Nl,dispatch:wl,[Symbol.iterator]:Il};var Jt=Al;function qr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Ts(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function $n(){}var Xn=.7,Qr=1/Xn,pn="\\s*([+-]?\\d+)\\s*",Un="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ot="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",im=/^#([0-9a-f]{3,8})$/,sm=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),am=new RegExp(`^rgb\\(${Ot},${Ot},${Ot}\\)$`),lm=new RegExp(`^rgba\\(${pn},${pn},${pn},${Un}\\)$`),cm=new RegExp(`^rgba\\(${Ot},${Ot},${Ot},${Un}\\)$`),dm=new RegExp(`^hsl\\(${Un},${Ot},${Ot}\\)$`),um=new RegExp(`^hsla\\(${Un},${Ot},${Ot},${Un}\\)$`),Cl={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};qr($n,lo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sl,formatHex:Sl,formatHex8:pm,formatHsl:fm,formatRgb:Ml,toString:Ml});function Sl(){return this.rgb().formatHex()}function pm(){return this.rgb().formatHex8()}function fm(){return Ol(this).formatHsl()}function Ml(){return this.rgb().formatRgb()}function lo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=im.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Pl(t):o===3?new je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Zr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Zr(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=sm.exec(e))?new je(t[1],t[2],t[3],1):(t=am.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lm.exec(e))?Zr(t[1],t[2],t[3],t[4]):(t=cm.exec(e))?Zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dm.exec(e))?Rl(t[1],t[2]/100,t[3]/100,1):(t=um.exec(e))?Rl(t[1],t[2]/100,t[3]/100,t[4]):Cl.hasOwnProperty(e)?Pl(Cl[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function Pl(e){return new je(e>>16&255,e>>8&255,e&255,1)}function Zr(e,t,o,n){return n<=0&&(e=t=o=NaN),new je(e,t,o,n)}function mm(e){return e instanceof $n||(e=lo(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function fn(e,t,o,n){return arguments.length===1?mm(e):new je(e,t,o,n==null?1:n)}function je(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}qr(je,fn,Ts($n,{brighter(e){return e=e==null?Qr:Math.pow(Qr,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xn:Math.pow(Xn,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(Do(this.r),Do(this.g),Do(this.b),jr(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:Ll,formatHex:Ll,formatHex8:gm,formatRgb:kl,toString:kl}));function Ll(){return`#${Ro(this.r)}${Ro(this.g)}${Ro(this.b)}`}function gm(){return`#${Ro(this.r)}${Ro(this.g)}${Ro(this.b)}${Ro((isNaN(this.opacity)?1:this.opacity)*255)}`}function kl(){let e=jr(this.opacity);return`${e===1?"rgb(":"rgba("}${Do(this.r)}, ${Do(this.g)}, ${Do(this.b)}${e===1?")":`, ${e})`}`}function jr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Do(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ro(e){return e=Do(e),(e<16?"0":"")+e.toString(16)}function Rl(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new At(e,t,o,n)}function Ol(e){if(e instanceof At)return new At(e.h,e.s,e.l,e.opacity);if(e instanceof $n||(e=lo(e)),!e)return new At;if(e instanceof At)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 At(a,s,l,e.opacity)}function Hl(e,t,o,n){return arguments.length===1?Ol(e):new At(e,t,o,n==null?1:n)}function At(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}qr(At,Hl,Ts($n,{brighter(e){return e=e==null?Qr:Math.pow(Qr,e),new At(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xn:Math.pow(Xn,e),new At(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 je(Ns(e>=240?e-240:e+120,r,n),Ns(e,r,n),Ns(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new At(Dl(this.h),Jr(this.s),Jr(this.l),jr(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=jr(this.opacity);return`${e===1?"hsl(":"hsla("}${Dl(this.h)}, ${Jr(this.s)*100}%, ${Jr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dl(e){return e=(e||0)%360,e<0?e+360:e}function Jr(e){return Math.max(0,Math.min(1,e||0))}function Ns(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 vs(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 Vl(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 vs((o-n/t)*t,a,r,i,s)}}function Gl(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 vs((o-n/t)*t,r,i,a,s)}}var ws=e=>()=>e;function hm(e,t){return function(o){return e+o*t}}function ym(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 Bl(e){return(e=+e)==1?ei:function(t,o){return o-t?ym(t,o,e):ws(isNaN(t)?o:t)}}function ei(e,t){var o=t-e;return o?hm(e,o):ws(isNaN(e)?t:e)}var ti=function e(t){var o=Bl(t);function n(r,i){var a=o((r=fn(r)).r,(i=fn(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),c=ei(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 zl(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=fn(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 xm=zl(Vl),Em=zl(Gl);function Et(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var As=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Is=new RegExp(As.source,"g");function bm(e){return function(){return e}}function _m(e){return function(t){return e(t)+""}}function Cs(e,t){var o=As.lastIndex=Is.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=As.exec(e))&&(r=Is.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:Et(n,r)})),o=Is.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?_m(l[0].x):bm(t):(t=l.length,function(c){for(var d=0,u;d<t;++d)s[(u=l[d]).i]=u.x(c);return s.join("")})}var Yl=180/Math.PI,oi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ss(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)*Yl,skewX:Math.atan(l)*Yl,scaleX:a,scaleY:s}}var ni;function Wl(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?oi:Ss(t.a,t.b,t.c,t.d,t.e,t.f)}function Fl(e){return e==null?oi:(ni||(ni=document.createElementNS("http://www.w3.org/2000/svg","g")),ni.setAttribute("transform",e),(e=ni.transform.baseVal.consolidate())?(e=e.matrix,Ss(e.a,e.b,e.c,e.d,e.e,e.f)):oi)}function Xl(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,f,p,h){if(c!==u||d!==f){var y=p.push("translate(",null,t,null,o);h.push({i:y-4,x:Et(c,u)},{i:y-2,x:Et(d,f)})}else(u||f)&&p.push("translate("+u+t+f+o)}function a(c,d,u,f){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),f.push({i:u.push(r(u)+"rotate(",null,n)-2,x:Et(c,d)})):d&&u.push(r(u)+"rotate("+d+n)}function s(c,d,u,f){c!==d?f.push({i:u.push(r(u)+"skewX(",null,n)-2,x:Et(c,d)}):d&&u.push(r(u)+"skewX("+d+n)}function l(c,d,u,f,p,h){if(c!==u||d!==f){var y=p.push(r(p)+"scale(",null,",",null,")");h.push({i:y-4,x:Et(c,u)},{i:y-2,x:Et(d,f)})}else(u!==1||f!==1)&&p.push(r(p)+"scale("+u+","+f+")")}return function(c,d){var u=[],f=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,f),a(c.rotate,d.rotate,u,f),s(c.skewX,d.skewX,u,f),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,f),c=d=null,function(p){for(var h=-1,y=f.length,m;++h<y;)u[(m=f[h]).i]=m.x(p);return u.join("")}}}var Ms=Xl(Wl,"px, ","px)","deg)"),Ps=Xl(Fl,", ",")",")");var mn=0,qn=0,Kn=0,$l=1e3,ri,Zn,ii=0,Oo=0,si=0,Jn=typeof performance=="object"&&performance.now?performance:Date,Kl=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jn(){return Oo||(Kl(Tm),Oo=Jn.now()+si)}function Tm(){Oo=0}function Qn(){this._call=this._time=this._next=null}Qn.prototype=ai.prototype={constructor:Qn,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?jn():+o)+(t==null?0:+t),!this._next&&Zn!==this&&(Zn?Zn._next=this:ri=this,Zn=this),this._call=e,this._time=o,Ls()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ls())}};function ai(e,t,o){var n=new Qn;return n.restart(e,t,o),n}function ql(){jn(),++mn;for(var e=ri,t;e;)(t=Oo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mn}function Ul(){Oo=(ii=Jn.now())+si,mn=qn=0;try{ql()}finally{mn=0,vm(),Oo=0}}function Nm(){var e=Jn.now(),t=e-ii;t>$l&&(si-=t,ii=e)}function vm(){for(var e,t=ri,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:ri=o);Zn=e,Ls(n)}function Ls(e){if(!mn){qn&&(qn=clearTimeout(qn));var t=e-Oo;t>24?(e<1/0&&(qn=setTimeout(Ul,e-Jn.now()-si)),Kn&&(Kn=clearInterval(Kn))):(Kn||(ii=Jn.now(),Kn=setInterval(Nm,$l)),mn=1,Kl(Ul))}}function li(e,t,o){var n=new Qn;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var wm=xs("start","end","cancel","interrupt"),Im=[],Ql=0,Zl=1,di=2,ci=3,Jl=4,ui=5,er=6;function co(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;Am(e,o,{name:t,index:n,group:r,on:wm,tween:Im,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ql})}function tr(e,t){var o=Ge(e,t);if(o.state>Ql)throw new Error("too late; already scheduled");return o}function Fe(e,t){var o=Ge(e,t);if(o.state>ci)throw new Error("too late; already running");return o}function Ge(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Am(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=ai(i,0,o.time);function i(c){o.state=Zl,o.timer.restart(a,o.delay,o.time),o.delay<=c&&a(c-o.delay)}function a(c){var d,u,f,p;if(o.state!==Zl)return l();for(d in n)if(p=n[d],p.name===o.name){if(p.state===ci)return li(a);p.state===Jl?(p.state=er,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[d]):+d<t&&(p.state=er,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete n[d])}if(li(function(){o.state===ci&&(o.state=Jl,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=di,o.on.call("start",e,e.__data__,o.index,o.group),o.state===di){for(o.state=ci,r=new Array(f=o.tween.length),d=0,u=-1;d<f;++d)(p=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++u]=p);r.length=u+1}}function s(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=ui,1),u=-1,f=r.length;++u<f;)r[u].call(e,d);o.state===ui&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=er,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function ks(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>di&&n.state<ui,n.state=er,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function jl(e){return this.each(function(){ks(this,e)})}function Cm(e,t){var o,n;return function(){var r=Fe(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 Sm(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=Fe(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 ec(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=Ge(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?Cm:Sm)(o,e,t))}function gn(e,t,o){var n=e._id;return e.each(function(){var r=Fe(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return Ge(r,n).value[t]}}function pi(e,t){var o;return(typeof t=="number"?Et:t instanceof lo?ti:(o=lo(t))?(t=o,ti):Cs)(e,t)}function Mm(e){return function(){this.removeAttribute(e)}}function Pm(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lm(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 km(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 Rm(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 Dm(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 tc(e,t){var o=Zt(e),n=o==="transform"?Ps:pi;return this.attrTween(e,typeof t=="function"?(o.local?Dm:Rm)(o,n,gn(this,"attr."+e,t)):t==null?(o.local?Pm:Mm)(o):(o.local?km:Lm)(o,n,t))}function Om(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Hm(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Vm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&Hm(e,i)),o}return r._value=t,r}function Gm(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&Om(e,i)),o}return r._value=t,r}function oc(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=Zt(e);return this.tween(o,(n.local?Vm:Gm)(n,t))}function Bm(e,t){return function(){tr(this,e).delay=+t.apply(this,arguments)}}function zm(e,t){return t=+t,function(){tr(this,e).delay=t}}function nc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Bm:zm)(t,e)):Ge(this.node(),t).delay}function Ym(e,t){return function(){Fe(this,e).duration=+t.apply(this,arguments)}}function Wm(e,t){return t=+t,function(){Fe(this,e).duration=t}}function rc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ym:Wm)(t,e)):Ge(this.node(),t).duration}function Fm(e,t){if(typeof t!="function")throw new Error;return function(){Fe(this,e).ease=t}}function ic(e){var t=this._id;return arguments.length?this.each(Fm(t,e)):Ge(this.node(),t).ease}function Xm(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Fe(this,e).ease=o}}function sc(e){if(typeof e!="function")throw new Error;return this.each(Xm(this._id,e))}function ac(e){typeof e!="function"&&(e=Wn(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],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 qe(n,this._parents,this._name,this._id)}function lc(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),a=new Array(n),s=0;s<i;++s)for(var l=t[s],c=o[s],d=l.length,u=a[s]=new Array(d),f,p=0;p<d;++p)(f=l[p]||c[p])&&(u[p]=f);for(;s<n;++s)a[s]=t[s];return new qe(a,this._parents,this._name,this._id)}function Um(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 $m(e,t,o){var n,r,i=Um(t)?tr:Fe;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function cc(e,t){var o=this._id;return arguments.length<2?Ge(this.node(),o).on.on(e):this.each($m(o,e,t))}function Km(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function dc(){return this.on("end.remove",Km(this._id))}function uc(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ko(e));for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a)for(var s=n[a],l=s.length,c=i[a]=new Array(l),d,u,f=0;f<l;++f)(d=s[f])&&(u=e.call(d,d.__data__,f,s))&&("__data__"in d&&(u.__data__=d.__data__),c[f]=u,co(c[f],t,o,f,c,Ge(d,o)));return new qe(i,this._parents,t,o)}function pc(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Yn(e));for(var n=this._groups,r=n.length,i=[],a=[],s=0;s<r;++s)for(var l=n[s],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var f=e.call(d,d.__data__,u,l),p,h=Ge(d,o),y=0,m=f.length;y<m;++y)(p=f[y])&&co(p,t,o,y,f,h);i.push(f),a.push(d)}return new qe(i,a,t,o)}var qm=Jt.prototype.constructor;function fc(){return new qm(this._groups,this._parents)}function Zm(e,t){var o,n,r;return function(){var i=ao(this,e),a=(this.style.removeProperty(e),ao(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function mc(e){return function(){this.style.removeProperty(e)}}function Jm(e,t,o){var n,r=o+"",i;return function(){var a=ao(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function Qm(e,t,o){var n,r,i;return function(){var a=ao(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),ao(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function jm(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=Fe(this,e),c=l.on,d=l.value[i]==null?s||(s=mc(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(a,r=d),l.on=n}}function gc(e,t,o){var n=(e+="")=="transform"?Ms:pi;return t==null?this.styleTween(e,Zm(e,n)).on("end.style."+e,mc(e)):typeof t=="function"?this.styleTween(e,Qm(e,n,gn(this,"style."+e,t))).each(jm(this._id,e)):this.styleTween(e,Jm(e,n,t),o).on("end.style."+e,null)}function eg(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function tg(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&eg(e,a,o)),n}return i._value=t,i}function hc(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,tg(e,t,o==null?"":o))}function og(e){return function(){this.textContent=e}}function ng(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function yc(e){return this.tween("text",typeof e=="function"?ng(gn(this,"text",e)):og(e==null?"":e+""))}function rg(e){return function(t){this.textContent=e.call(this,t)}}function ig(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&rg(r)),t}return n._value=e,n}function xc(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,ig(e))}function Ec(){for(var e=this._name,t=this._id,o=fi(),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=Ge(l,t);co(l,e,o,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new qe(n,this._parents,e,o)}function bc(){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=Fe(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 sg=0;function qe(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function _c(e){return Jt().transition(e)}function fi(){return++sg}var Qt=Jt.prototype;qe.prototype=_c.prototype={constructor:qe,select:uc,selectAll:pc,selectChild:Qt.selectChild,selectChildren:Qt.selectChildren,filter:ac,merge:lc,selection:fc,transition:Ec,call:Qt.call,nodes:Qt.nodes,node:Qt.node,size:Qt.size,empty:Qt.empty,each:Qt.each,on:cc,attr:tc,attrTween:oc,style:gc,styleTween:hc,text:yc,textTween:xc,remove:dc,tween:ec,delay:nc,duration:rc,ease:ic,easeVarying:sc,end:bc,[Symbol.iterator]:Qt[Symbol.iterator]};function mi(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ag={time:null,delay:0,duration:250,ease:mi};function lg(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 Tc(e){var t,o;e instanceof qe?(t=e._id,e=e._name):(t=fi(),(o=ag).time=jn(),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])&&co(l,e,t,c,a,o||lg(l,t));return new qe(n,this._parents,e,t)}Jt.prototype.interrupt=jl;Jt.prototype.transition=Tc;function uo(e,t,o){this.k=e,this.x=t,this.y=o}uo.prototype={constructor:uo,scale:function(e){return e===1?this:new uo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new uo(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 gi=new uo(1,0,0);hi.prototype=uo.prototype;function hi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return gi;return e.__zoom}var dg=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Nc;(function(e){e.Strict="strict",e.Loose="loose"})(Nc||(Nc={}));var vc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(vc||(vc={}));var wc;(function(e){e.Partial="partial",e.Full="full"})(wc||(wc={}));var Ic;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ic||(Ic={}));var Ac;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ac||(Ac={}));var et;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(et||(et={}));var n_={[et.Left]:et.Right,[et.Right]:et.Left,[et.Top]:et.Bottom,[et.Bottom]:et.Top};var ug=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var pg=(e,t=[0,0])=>{var s;let{width:o,height:n}=fg(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 yi=(e,t=[0,0])=>{var r,i,a,s,l,c,d,u;let{x:o,y:n}=ug(e)?e.internals.positionAbsolute:pg(e,t);return{x:o,y:n,x2:o+((s=(a=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?a:e.initialWidth)!=null?s:0),y2:n+((u=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?u:0)}};function fg(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 r_={[et.Left]:{x:-1,y:0},[et.Right]:{x:1,y:0},[et.Top]:{x:0,y:-1},[et.Bottom]:{x:0,y:1}};var mg={nodeOrigin:[0,0],nodeExtent:dg,elevateNodesOnSelect:!0,defaults:{}},i_=v(_({},mg),{checkEquality:!0});var Cc;(function(e){e.Line="line",e.Handle="handle"})(Cc||(Cc={}));var gg={width:0,height:0,x:0,y:0},s_=v(_({},gg),{pointerX:0,pointerY:0,aspectRatio:1});var hg=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function yg(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 xg(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 xi=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r,i){let a=t==="horizontal"?this.yLines:this.xLines,[s,l]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],c=[];for(let p of a){if(p.position<s)continue;if(p.position>l)break;if(i.has(p.node.id)||p.node.parentId&&i.has(p.node.parentId)||!hg(p.nodeBox,r))continue;let h=Math.abs(p.position-o);if(h>Ei)continue;let m=yg(p.nodeBox,n)>0?0:xg(p.nodeBox,n);c.push({line:p,lineDist:h,nodeDist:m})}let d=.5,u=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;c.sort((p,h)=>{if(u){if(p.line===u&&h.line!==u)return-1;if(h.line===u&&p.line!==u)return 1}return Math.abs(p.lineDist-h.lineDist)<=d?p.nodeDist-h.nodeDist:p.lineDist-h.lineDist});let f=c.length>0?c[0].line:void 0;return f&&(t==="horizontal"?this.lastHorizontalLine=f:this.lastVerticalLine=f),f}};function Sc(e,t=Ho,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=yi(i);Object.entries(t).forEach(([s,l])=>{var c;n.push({position:l.resolve(r,a),color:(c=r.style)==null?void 0:c.backgroundColor,orientation:l.orientation,anchorName:s,nodeBox:a,node:r})})}),n}function Mc(e,t,o,n,r=Object.keys(Ho)){let i=[];for(let s of r){let l=Ho[s],c=l.resolve(null,o),d=e.search(l.orientation,c,o,t,n);d&&i.push({sourcePosition:c,anchorName:s,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 Pc(e,t,o){let n=0,r=0,i=!1,a=!1;if(t){let l=t.anchor.resolve(null,e)-t.line.position;Math.abs(l)<=Ei&&(r=l,a=!0)}if(o){let l=o.anchor.resolve(null,e)-o.line.position;Math.abs(l)<=Ei&&(n=l,i=!0)}return{deltaX:n,deltaY:r,snappedX:i,snappedY:a}}var Ei=10,Ho={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 kc=require("react/jsx-runtime"),Eg=new xi;function bi(){let[e,t]=(0,it.useState)(void 0),[o,n]=(0,it.useState)(void 0),{width:r,height:i}=(0,hn.useStore)(m=>({width:m.width,height:m.height}),Lc.shallow),a=(0,hn.useNodesInitialized)(),s=(0,it.useRef)(Eg),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,hn.useReactFlow)(),u=(0,it.useCallback)(()=>{t(void 0),n(void 0)},[]),f=(0,it.useCallback)(m=>{let x=m!=null?m:d();u();let T=Sc(x,Ho,c);s.current.initialize(T)},[c,u,d]),p=(0,it.useCallback)(()=>{setTimeout(()=>{f()},100)},[f]);(0,it.useEffect)(()=>{a&&f(d())},[a,f,d]);let h=(0,it.useCallback)((m,x)=>{var R,H,k,G,B,K,W,X,Z,j;if(!s.current||m.length===0||m.filter(Y=>Y.type==="dimensions").length>1)return m;u();let E=m.filter(Y=>Y.type==="position"&&!!Y.position),N=m.find(Y=>Y.type==="dimensions");if(E.length===0&&!N)return m;let b=Object.keys(Ho),g=new Set,w=1/0,A=1/0,I=-1/0,D=-1/0;if(E.length>0)E.forEach(Y=>{var we,he,de,We,Qe,Rt;let te=x.find(qt=>qt.id===Y.id);if(!te)return;g.add(te.id);let ne=c(te.id);if(!ne)return;let J=ne.parentId?c(ne.parentId):void 0,le=Y.position.x+((we=J==null?void 0:J.internals.positionAbsolute.x)!=null?we:0),fe=Y.position.y+((he=J==null?void 0:J.internals.positionAbsolute.y)!=null?he:0),me=(We=(de=te.measured)==null?void 0:de.width)!=null?We:0,He=(Rt=(Qe=te.measured)==null?void 0:Qe.height)!=null?Rt:0;w=Math.min(w,le),A=Math.min(A,fe),I=Math.max(I,le+me),D=Math.max(D,fe+He)}),N&&(b=["top","left"]);else if(N){let Y=x.find(me=>me.id===N.id);if(!Y)return m;g.add(Y.id);let te=c(Y.id);if(!te)return m;let ne=te.internals.positionAbsolute.x,J=te.internals.positionAbsolute.y,le=(G=(k=(R=N.dimensions)==null?void 0:R.width)!=null?k:(H=Y.measured)==null?void 0:H.width)!=null?G:0,fe=(X=(W=(B=N.dimensions)==null?void 0:B.height)!=null?W:(K=Y.measured)==null?void 0:K.height)!=null?X:0;w=ne,A=J,I=ne+le,D=J+fe,b=["right","bottom"]}if(w===1/0)return m;let S={x:w,y:A,x2:I,y2:D},{x:L,y:z}=l({x:0,y:0}),{x:q,y:Q}=l({x:r,y:i}),U={x:L,y:z,x2:q,y2:Q},{horizontal:$,vertical:M}=Mc(s.current,U,S,g,b),{deltaX:O,deltaY:P,snappedX:C,snappedY:F}=Pc(S,$,M);if(C||F){let Y=E.some(ne=>ne.dragging),te=!!(N!=null&&N.resizing);(Y||te)&&(C&&n(M==null?void 0:M.line),F&&t($==null?void 0:$.line)),C&&(E.forEach(ne=>{ne.position&&(ne.position.x-=O)}),(N==null?void 0:N.id)===((Z=E[0])==null?void 0:Z.id)?N.dimensions&&(N.dimensions.width+=O):N&&!E.length&&N.dimensions&&(N.dimensions.width-=O)),F&&(E.forEach(ne=>{ne.position&&(ne.position.y-=P)}),(N==null?void 0:N.id)===((j=E[0])==null?void 0:j.id)?N.dimensions&&(N.dimensions.height+=P):N&&!E.length&&N.dimensions&&(N.dimensions.height-=P))}return m},[l,c,r,i,t,n,u]),y=(0,it.useCallback)(()=>(0,kc.jsx)(Rc,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:f,forceRebuildIndex:p,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:y}}var Ji=require("@xyflow/react"),Ft=require("react");var jt=e=>new Map(e.map(t=>[t.id,t])),or=(e,t,o)=>t.filter(n=>!(n.source!==e||o&&n.id===o)),Dc=(e,t,o)=>t.filter(n=>!(n.target!==e||o&&n.id===o)),Rs=e=>e.some(t=>t.type==="START_EVENT"),po=(e,t)=>e==="START_EVENT"?!Rs(t):!0,Oc=(e,t,o,n,r)=>{let i=jt(o),a=i.get(e);if(!a||a.type!=="START_EVENT")return!1;let s=i.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:or(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},Hc=(e,t,o,n,r)=>{let i=jt(o),a=i.get(t);if(!a||a.type!=="END_EVENT")return!1;let s=i.get(e);return(s==null?void 0:s.type)==="ANNOTATION"?!1:Dc(t,n,r).filter(c=>{let d=i.get(c.source);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},_i=(e,t,o,n,r)=>{var c;let i=jt(o),a=i.get(e);if(!a||a.type!=="GATEWAY"||((c=a.data)==null?void 0:c.variant)!=="EXCLUSIVE")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:or(e,n,r).filter(d=>{let u=i.get(d.target);return(u==null?void 0:u.type)!=="ANNOTATION"}).length>=2},Vc=(e,t,o)=>{var a,s,l,c;let n=jt(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"},Ti=(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"},Gc=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SUBPROCESS"},Ni=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.attribute)==="LOOP"},nr=(e,t,o,n)=>{let r=jt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:Dc(e,o,n).some(s=>{let l=r.get(s.source);return(l==null?void 0:l.type)==="START_EVENT"})},rr=(e,t,o,n)=>{let r=jt(t),i=r.get(e);return!i||i.type!=="TASK"?!1:or(e,o,n).some(s=>{let l=r.get(s.target);return(l==null?void 0:l.type)==="END_EVENT"})},Bc=(e,t,o,n,r)=>{let i=jt(o),a=i.get(e),s=i.get(t);return(a==null?void 0:a.type)==="START_EVENT"&&(s==null?void 0:s.type)==="TASK"?rr(t,o,n,r):(s==null?void 0:s.type)==="END_EVENT"&&(a==null?void 0:a.type)==="TASK"?nr(e,o,n,r):!1},vi=(e,t,o)=>or(e,t,o).length>0,wi=(e,t,o,n,r)=>{let i=jt(o),a=i.get(e);if(!a||a.type!=="TASK")return!1;let s=t?i.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:or(e,n,r).filter(c=>{let d=i.get(c.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var zc=(e,t,o,n,r)=>{var s,l;let i=jt(n),a=((s=i.get(e))==null?void 0:s.type)==="ANNOTATION"||((l=i.get(t))==null?void 0:l.type)==="ANNOTATION";return o.some(c=>r&&c.id===r?!1:!!(c.source===e&&c.target===t||a&&c.source===t&&c.target===e))};var bg=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!zc(e.sourceNodeId,e.targetNodeId,e.edges,e.nodes,e.reconnectingEdgeId),reason:"duplicate_connection_not_allowed"}),e=>({isValid:!Oc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"start_event_limit_reached"}),e=>({isValid:!Hc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"end_event_limit_reached"}),e=>({isValid:!_i(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"gateway_limit_reached"}),e=>({isValid:!wi(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"task_limit_reached"}),e=>({isValid:Vc(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&Gc(e.targetNodeId,e.nodes)),reason:"start_event_to_subprocess_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(Ti(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(Ni(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(nr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!Bc(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges,e.reconnectingEdgeId),reason:"concurrent_initial_and_final_activity"}),e=>({isValid:!(rr(e.sourceNodeId,e.nodes,e.edges,e.reconnectingEdgeId)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(vi(e.sourceNodeId,e.edges,e.reconnectingEdgeId)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:["START_EVENT","END_EVENT","TASK","GATEWAY","LANE"],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],Ds=e=>{for(let t of bg){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var _g=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:_i(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"gateway_limit_reached"})},{sourceTypes:["START_EVENT"],validate:e=>({shouldDisable:e.edges.some(o=>{if(o.source!==e.sourceNodeId)return!1;let n=e.nodes.find(r=>r.id===o.target);return(n==null?void 0:n.type)!=="ANNOTATION"})&&e.targetNodeType!=="ANNOTATION",reason:"start_event_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:Rs(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Ti(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Ni(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:nr(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:rr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:vi(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:wi(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Yc=e=>{let t=_g.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 Ct=require("@xyflow/react");var Ht=require("@produto-lecom/lecom-ui"),Fc=require("lucide-react");var bt=require("@xyflow/react");var Wc=require("@xyflow/react"),fo=()=>{let e=(0,Wc.useStoreApi)();return{selectElements:n=>{let{edges:r,nodes:i,triggerEdgeChanges:a,triggerNodeChanges:s}=e.getState(),l=i.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]),c=r.reduce((d,u)=>[...d,{id:u.id,type:"select",selected:n.includes(u.id)}],[]);return s(l),a(c),!0},clearSelection:async()=>{let{unselectNodesAndEdges:n}=e.getState();return n(),await kr(),!0}}};var Ii=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,bt.useReactFlow)(),{selectElements:r}=fo(),i=m=>{let x=o(),T=n(),E=(0,bt.getIncomers)(m,x,T),N=(0,bt.getOutgoers)(m,x,T),b=E.some(w=>w.type==="START_EVENT"),g=N.some(w=>w.type==="END_EVENT");return b?"start":g?"end":"between"},a=(m,x,T)=>{var b,g,w,A;if(!m)return;let E={type:m.type,variant:(b=m.data)==null?void 0:b.variant,attribute:(g=m.data)==null?void 0:g.attribute},N={id:m.id,position:i(m),label:(w=m.data)==null?void 0:w.label,node:E};return m.type==="TASK"&&((A=m.data)==null?void 0:A.variant)==="SUBPROCESS"?v(_({},N),{type:"sub_process"}):m.type==="GATEWAY"?v(_({},N),{type:"gateway",variant:s(m,x,T)}):v(_({},N),{type:"activity"})},s=(m,x,T)=>{if(m.type!=="GATEWAY")return;let E=(0,bt.getIncomers)(m,x,T),N=!1,b=!1;if(E.forEach(g=>{var w,A;g.type==="TASK"&&(((w=g.data)==null?void 0:w.variant)==="SCRIPT"&&(N=!0),((A=g.data)==null?void 0:A.attribute)==="LOOP"&&(b=!0))}),N&&b)return"script_loop";if(N)return"script";if(b)return"loop"},l=(m,x,T)=>{var w,A,I,D;let E=e(m.source),N=e(m.target);if(!E||!N)return"simple";if((0,bt.getOutgoers)(E,x,T).some(S=>S.type==="END_EVENT"))return"final";if(E.type==="GATEWAY")switch((w=E.data)==null?void 0:w.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(E.type==="TASK"){let S=(A=E.data)==null?void 0:A.variant,L=(I=E.data)==null?void 0:I.attribute;if(S==="SUBPROCESS")return"from_sub_process";if(N.type==="TASK"&&((D=N.data)==null?void 0:D.variant)==="SUBPROCESS")return"to_sub_process";let z=S==="SCRIPT",q=L==="LOOP";return z&&q?"script_loop":z?"script":q?"loop":"simple"}return"simple"},c=(m,x,T)=>{let E=[];function N(g,w,A=0){let I=a(g,x,T);if(I.depth=A,w.push(I),g.type==="TASK"){E.push([...w]),w.pop();return}let D=(0,bt.getIncomers)(g,x,T);if(D.length)for(let S of D)N(S,w,A+1);w.pop()}let b=(0,bt.getIncomers)(m,x,T);for(let g of b)N(g,[]);return E},d=(m,x,T)=>{let E=[];function N(g,w,A=0){let I=a(g,x,T);if(I.depth=A,w.push(I),g.type==="TASK"){E.push([...w]),w.pop();return}let D=(0,bt.getOutgoers)(g,x,T);if(D.length)for(let S of D)N(S,w,A+1);w.pop()}let b=(0,bt.getOutgoers)(m,x,T);for(let g of b)N(g,[]);return E},u=(m,x,T)=>(T=T.filter(N=>N.source===m.id),T.map(N=>{var w;let b=e(N.target),g;return b&&(g=a(b,x,T)),{id:N.id,type:"routing",variant:l(N,x,T),label:(w=N.data)==null?void 0:w.label,target:g}})),f=m=>{let x=e(m);if(!x)return;let T=o(),E=n(),N=a(x,T,E);return N.sources=c(x,T,E),N.targets=d(x,T,E),N.edgeTargets=u(x,T,E),x.type==="GATEWAY"&&(N.variant=s(x,T,E)),N},p=m=>{let x=t(m);if(!x)return;let T=o(),E=n(),N=l(x,T,E),g={id:x.id,type:"routing",variant:N,gatewayVariant:void 0},w=e(x.source);if(w){let I=a(w,T,E);g.source=I;let D=s(w,T,E);if(g.gatewayVariant=D,w.type==="TASK")g.sources=[[I]];else{let S=c(w,T,E);g.sources=S.length?S:[[I]]}}let A=e(x.target);if(A){let I=a(A,T,E);if(g.target=I,A.type==="TASK")g.targets=[[I]];else{let D=d(A,T,E);g.targets=D.length?D:[[I]]}}return g},h=m=>{let x=e(m);if(x)return f(x.id);let T=t(m);if(T)return p(T.id)};return{configureElement:m=>{let x=h(m);if(x)return r([m]),x},getConfigureElement:h,getNodeConfigure:f,getEdgeConfigure:p}};var Vo=require("react/jsx-runtime"),mo=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ht.useTranslation)(),{onConfigureElement:n}=ee(),{getConfigureElement:r}=Ii();return(0,Vo.jsxs)(Ht.Tooltip,{children:[(0,Vo.jsx)(Ht.TooltipTrigger,{asChild:!0,children:(0,Vo.jsx)(Ht.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let a=r(e);a&&(n==null||n(a))},children:(0,Vo.jsx)(Fc.Settings,{size:16})})}),(0,Vo.jsx)(Ht.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Vt=require("@produto-lecom/lecom-ui"),Uc=require("@xyflow/react"),$c=require("lucide-react");var Xc=require("@produto-lecom/lecom-ui");function tt(){let{toast:e}=yn(),{toast:t}=(0,Xc.useNotificationToast)();return{toast:e||t}}var Go=require("react/jsx-runtime"),Ai=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Vt.useTranslation)(),{toast:n}=tt(),{deleteElements:r,getNodes:i}=(0,Uc.useReactFlow)();return(0,Go.jsxs)(Vt.Tooltip,{children:[(0,Go.jsx)(Vt.TooltipTrigger,{asChild:!0,children:(0,Go.jsx)(Vt.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{if(t==="node"){let s=i(),l=s.find(c=>c.id===e);if((l==null?void 0:l.type)==="LANE"&&s.some(d=>d.parentId===e)){n({variant:"error",title:o("validation.errors.title"),content:o("editor.toolbar.delete_pool_lane_error")});return}r({nodes:[{id:e}]})}else r({edges:[{id:e}]})},children:(0,Go.jsx)($c.TrashIcon,{size:16})})}),(0,Go.jsx)(Vt.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Gt=require("@produto-lecom/lecom-ui"),Kc=require("lucide-react"),qc=require("react"),Bo=require("react/jsx-runtime"),xn=({nodeId:e,disabled:t=!1,tooltipMessage:o})=>{let{t:n}=(0,Gt.useTranslation)(),r=(0,qc.useCallback)(i=>{i.stopPropagation();let a=document.querySelectorAll(`.react-flow__handle.source[data-nodeid="${e}"]`);if(a.length===0)return;let s=Array.from(a).reduce((f,p)=>{let h=f.getBoundingClientRect(),y=p.getBoundingClientRect(),m=Math.hypot(i.clientX-(h.left+h.width/2),i.clientY-(h.top+h.height/2));return Math.hypot(i.clientX-(y.left+y.width/2),i.clientY-(y.top+y.height/2))<m?p:f}),l=s.getBoundingClientRect(),c=l.left+l.width/2,d=l.top+l.height/2,u=new MouseEvent("mousedown",{clientX:c,clientY:d,bubbles:!0,cancelable:!0});s.dispatchEvent(u)},[e]);return(0,Bo.jsxs)(Gt.Tooltip,{children:[(0,Bo.jsx)(Gt.TooltipTrigger,{asChild:!0,children:(0,Bo.jsx)(Gt.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:t,className:t?"opacity-50 cursor-not-allowed":"",onMouseDown:t?void 0:r,children:(0,Bo.jsx)(Kc.MoveUpRightIcon,{size:16})})}),(0,Bo.jsx)(Gt.TooltipContent,{color:"black",children:o||n("editor.toolbar.connect_node")})]})};var En=require("react/jsx-runtime"),_n=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=Dt(a,["edgeId","edgeType","sourceNode","targetNode"]);let{mode:s}=ee(),{isFromStartEvent:l,isGatewayToGateway:c,isActiviyToAndGateway:d,isToEndEvent:u}=Vr(o,n),f=!l&&!c&&!d&&!u,p=[{component:(0,En.jsx)(Ai,{elementId:e,elementType:"edge"})}],h=()=>s==="view"?f?[{component:(0,En.jsx)(mo,{elementId:e,elementType:"edge"})}]:[]:f?[{component:(0,En.jsx)(mo,{elementId:e,elementType:"edge"})},...p]:p,m=(x=>{switch(x){case"SEQUENCE_EDGE":return h();case"MESSAGE_EDGE":return s==="view"?[]:[...p];case"ANNOTATION_EDGE":return s==="view"?[]:[...p];default:return[]}})(t);if(!(m.length===0||s==="view"))return(0,En.jsx)("div",v(_({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:m.map((x,T)=>(0,En.jsx)("div",{children:x.component},T))}))};var Zc=require("@xyflow/react"),Jc=require("react");var Os=require("react/jsx-runtime"),Bt=12,Tn=({sx:e,sy:t,tx:o,ty:n,hasLabel:r=!1,children:i})=>{let{zoom:a}=(0,Zc.useViewport)(),s=1/a,l=(0,Jc.useMemo)(()=>t===n?{bottom:`${Bt}px`,transform:"translateX(-50%)"}:e===o?{left:`${Bt}px`,transform:r?"translateY(-100%)":"translateY(-50%)"}:n>t&&o>e?{left:`${Bt}px`,bottom:`${Bt}px`}:n>t&&o<e?{right:`${Bt}px`,bottom:`${Bt}px`}:t>n&&o>e?{right:`${Bt}px`,bottom:`${Bt}px`}:{left:`${Bt}px`,bottom:`${Bt}px`},[e,t,o,n,r]);return(0,Os.jsx)("div",{style:{transform:`scale(${s})`},children:(0,Os.jsx)("div",{className:"absolute pointer-events-auto",style:_({},l),children:i})})};var st=require("react/jsx-runtime"),Nn={type:"ANNOTATION_EDGE",reconnectable:!0},Qc=({id:e,source:t,target:o,selected:n,data:r})=>{let{isMultipleSelection:i}=ee(),{zoom:a}=(0,Ct.useViewport)(),s=(0,Ct.useInternalNode)(t),l=(0,Ct.useInternalNode)(o);if(!s||!l)return null;let{sx:c,sy:d,tx:u,ty:f}=cn(s,l),[p,h,y]=(0,Ct.getStraightPath)({sourceX:c,sourceY:d,targetX:u,targetY:f}),m=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected);return(0,st.jsx)(st.Fragment,{children:(0,st.jsxs)("g",{className:V("group bpmn-edge",{"is-highlighted":m}),children:[(0,st.jsx)("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/a),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,st.jsxs)("g",{className:V("text-grey-500 transition-colors duration-75 group-hover:text-grey-800",{"text-blue-500 group-hover:text-blue-600":m}),children:[(0,st.jsx)(Ct.BaseEdge,{id:e,path:p,interactionWidth:0,strokeDasharray:4,className:V("stroke-2 stroke-current transition-[stroke,filter] duration-75 group-hover:drop-shadow-[0_0_3px_rgba(0,0,0,0.2)]",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":m&&!(r!=null&&r.hasError)})}),(0,st.jsx)(Ct.EdgeLabelRenderer,{children:(0,st.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${y}px)`},children:n&&!i&&(0,st.jsx)(Tn,{sx:c,sy:d,tx:u,ty:f,children:(0,st.jsx)(_n,{edgeId:e,edgeType:"ANNOTATION_EDGE"})})})})]})]})})};var ot=require("react"),Ie=require("@xyflow/react");var St=require("react");var Vs=require("react/jsx-runtime"),Hs=/[a-zA-Z0-9À-ÖØ-öø-ÿ]/,jc=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Escape","Shift"],Ke=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s,onInput:l,onInvalidFirstCharacter:c,skipFirstCharValidation:d})=>{let u=(0,St.useRef)(null),f=(0,St.useRef)(null),[p,h]=(0,St.useState)(!1);(0,St.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]),(0,St.useEffect)(()=>{h(i!=null?i:!1)},[i]),(0,St.useEffect)(()=>{if(p&&u.current){u.current.focus();let b=document.createRange();b.selectNodeContents(u.current);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(b))}},[p]);let y=(0,St.useCallback)(()=>{f.current||(c==null||c(),f.current=setTimeout(()=>{f.current=null},500))},[c]),m=b=>{b.stopPropagation(),p||h(!0)},x=b=>{let g=b.currentTarget.innerText.replace(/\n$/,""),w=t&&g.length>=t,A=window.getSelection(),I=(A==null?void 0:A.toString())||"",D=I.length>0,S=(b.ctrlKey||b.metaKey)&&!b.altKey,L=S&&b.key==="a",z=S&&b.key==="c",q=S&&b.key==="x",Q=S&&b.key==="v",U=g.length===0||D&&I.length===g.length;if(!d&&U&&!Hs.test(b.key)&&!jc.includes(b.key)&&!S){b.preventDefault(),y();return}w&&!D&&(jc.includes(b.key)||L||z||q||Q||b.preventDefault())},T=b=>{b.preventDefault();let g=b.clipboardData.getData("text/plain").replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
|
-
`),
|
|
3
|
+
`),w=b.currentTarget.innerText.replace(/\n$/,""),A=window.getSelection();if(!A||A.rangeCount===0)return;let I=A.toString(),D=w.length-I.length,S=t?Math.max(0,t-D):1/0;if(S<=0&&I.length===0)return;let L=g;if(L.length>S&&(L=L.substring(0,S)),!L&&I.length===0)return;let z=A.getRangeAt(0),q=z.startOffset===0&&(z.startContainer===b.currentTarget||z.startContainer.parentNode===b.currentTarget);if(!d&&q&&L.length>0&&!Hs.test(L[0])){y();return}z.deleteContents();let Q=document.createTextNode(L);z.insertNode(Q),z.setStartAfter(Q),z.collapse(!0),A.removeAllRanges(),A.addRange(z),l==null||l(b.currentTarget.innerText.replace(/\n$/,""))},E=b=>{let g=b.currentTarget,w=g.innerText.replace(/\n$/,"");if(!d&&w.length>0&&!Hs.test(w[0])){let A=w.slice(1);if(g.innerText=A,A.length>0&&g.firstChild){let I=document.createRange(),D=window.getSelection();I.setStart(g.firstChild,0),I.collapse(!0),D==null||D.removeAllRanges(),D==null||D.addRange(I)}y(),l==null||l(A);return}l==null||l(w)},N=b=>{h(!1);let g=b.currentTarget.innerText.replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
5
|
-
`).trim();t&&x.length>t&&(x=x.substring(0,t)),b.currentTarget.innerText=x,s==null||s(),x!==e&&(a==null||a(x))};return(0,bs.jsx)("div",{className:D("flex-1 p-2 self-stretch flex items-center justify-center border border-transparent overflow-hidden text-ellipsis body-medium-400 text-center rounded-sm",{"border border-dashed border-grey-400 bg-white shadow-md":p,"bg-white":e.length>0},n),style:o,onDoubleClick:m,children:(0,bs.jsx)("div",{ref:u,className:D("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":p}),contentEditable:p,suppressContentEditableWarning:!0,onKeyDown:_,onPaste:h,onInput:E,onBlur:w,children:e})})};var Zm=require("@xyflow/react");var de=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,fi=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),mi=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var Kn=require("@xyflow/react");var lo={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};var{TOLERANCE:ne}=lo;function Jm(e,t,o){return de(e,t,"x",ne)&&de(t,o,"x",ne)&&de(e,o,"x",ne)}function Qm(e,t,o){return de(e,t,"y",ne)&&de(t,o,"y",ne)&&de(e,o,"y",ne)}function jm(e,t,o){if(!Jm(e,t,o))return!1;let n=t.y-e.y,r=o.y-t.y;return Math.abs(n)<ne||Math.abs(r)<ne?!1:n*r<0}function eg(e,t,o){if(!Qm(e,t,o))return!1;let n=t.x-e.x,r=o.x-t.x;return Math.abs(n)<ne||Math.abs(r)<ne?!1:n*r<0}function tg(e,t,o,n){let r=t.x!==0,i=t.x===-n.x&&t.y===-n.y,a=t.x===n.x&&t.y===n.y,s=120;if(i)if(r){if((o.x-e.x)*t.x>=0)return[{x:(e.x+o.x)/2,y:e.y},{x:(e.x+o.x)/2,y:o.y}];{let l=(e.y+o.y)/2,c=Math.abs(e.y-o.y)<s?Math.max(e.y,o.y)+s:l;return[{x:e.x,y:c},{x:o.x,y:c}]}}else{if((o.y-e.y)*t.y>=0)return[{x:e.x,y:(e.y+o.y)/2},{x:o.x,y:(e.y+o.y)/2}];{let l=(e.x+o.x)/2,c=Math.abs(e.x-o.x)<s?Math.max(e.x,o.x)+s:l;return[{x:c,y:e.y},{x:c,y:o.y}]}}else if(a)if(r)if((o.x-e.x)*t.x>0&&Math.abs(e.y-o.y)<s){let l=Math.max(e.y,o.y)+s,c=o.x+t.x*(s/2);return[{x:e.x,y:l},{x:c,y:l},{x:c,y:o.y}]}else{let l=t.x>0?Math.max(e.x,o.x):Math.min(e.x,o.x);return[{x:l,y:e.y},{x:l,y:o.y}]}else if((o.y-e.y)*t.y>0&&Math.abs(e.x-o.x)<s){let l=Math.max(e.x,o.x)+s,c=o.y+t.y*(s/2);return[{x:l,y:e.y},{x:l,y:c},{x:o.x,y:c}]}else{let l=t.y>0?Math.max(e.y,o.y):Math.min(e.y,o.y);return[{x:e.x,y:l},{x:o.x,y:l}]}else{let l=t.x!==0?o.x:e.x,c=t.y!==0?o.y:e.y,d=t.x!==0?(l-e.x)*t.x:(c-e.y)*t.y,u=n.x!==0?(l-o.x)*n.x:(c-o.y)*n.y;return d>=0&&u>=0?[{x:l,y:c}]:r?[{x:e.x,y:o.y}]:[{x:o.x,y:e.y}]}}function wc(e){if(e.length<=2)return e;let t=[e[0]];for(let o=1;o<e.length-1;o++){let n=t[t.length-1],r=e[o],i=e[o+1];de(n,r,"x",ne)&&de(r,i,"x",ne)||de(n,r,"y",ne)&&de(r,i,"y",ne)||t.push(r)}return t.push(e[e.length-1]),t}function gi(e){let t=[];for(let o of e){let n=t[t.length-1];(!n||Math.abs(n.x-o.x)>=ne||Math.abs(n.y-o.y)>=ne)&&t.push(o)}return t}function og(e){let t=[...e],o=!0;for(;o;){o=!1;for(let n=1;n<t.length-1;n++){let r=t[n-1],i=t[n],a=t[n+1];if(jm(r,i,a)||eg(r,i,a)){t.splice(n,1),o=!0;break}}}return t}function Ac(e){let t=gi(wc([...e]));return t=og(t),gi(wc(t))}function hi(e){switch(e){case Kn.Position.Left:return{x:-1,y:0};case Kn.Position.Right:return{x:1,y:0};case Kn.Position.Top:return{x:0,y:-1};case Kn.Position.Bottom:return{x:0,y:1};default:return{x:0,y:0}}}function Ic(e,t,o,n){let r=lo.OFFSET,i=lo.OFFSET;if(t.x===-n.x&&t.y===-n.y)if(t.x!==0){let a=(o.x-e.x)*t.x;a>0&&a<2*lo.OFFSET&&(r=a/2,i=a/2)}else{let a=(o.y-e.y)*t.y;a>0&&a<2*lo.OFFSET&&(r=a/2,i=a/2)}return{sourceOffset:r,targetOffset:i}}function ng(e,t,o,n,r,i,a=0){let s=hi(r),l=hi(i),c=s.x===0?a:0,d=s.y===0?a:0,u=l.x===0?a:0,f=l.y===0?a:0,p={x:e+c,y:t+d},g={x:o+u,y:n+f},{sourceOffset:y,targetOffset:m}=Ic(p,s,g,l),_={x:p.x+s.x*y,y:p.y+s.y*y},h={x:g.x+l.x*m,y:g.y+l.y*m},E=tg(_,s,h,l),w=[p,_,...E,h,g],b=Ac(w);if(b.length===2&&yi(p,g)>ne){let x=de(p,_,"x",ne)&&de(_,h,"x",ne)&&de(h,g,"x",ne),N=de(p,_,"y",ne)&&de(_,h,"y",ne)&&de(h,g,"y",ne);if(x||N){let I=N&&(h.x-_.x)*s.x<0,A=x&&(h.y-_.y)*s.y<0;if(!I&&!A)return gi([p,_,h,g])}}return b}function xi(e,t,o,n,r,i,a,s=0){if(!(a!=null&&a.length))return ng(e,t,o,n,r,i,s);let l=hi(r),c=hi(i),d=l.x===0?s:0,u=l.y===0?s:0,f=c.x===0?s:0,p=c.y===0?s:0,g={x:e+d,y:t+u},y={x:o+f,y:n+p},{sourceOffset:m,targetOffset:_}=Ic(g,l,y,c),h={x:g.x+l.x*m,y:g.y+l.y*m},E={x:y.x+c.x*_,y:y.y+c.y*_},w=[...a],b=w[0],x=l.y===0;x&&Math.abs(g.y-b.y)>ne?w.unshift({x:b.x,y:g.y}):!x&&Math.abs(g.x-b.x)>ne&&w.unshift({x:g.x,y:b.y});let N=w[w.length-1],I=c.y===0,A=[];(Math.abs(N.x-E.x)>ne||Math.abs(N.y-E.y)>ne)&&(I?A.push({x:E.x,y:N.y}):A.push({x:N.x,y:E.y})),A.push(E);let M=[g,...w,...A,y],S=Ac(M);if(S.length===2&&yi(g,y)>ne){let k=de(g,h,"x",ne)&&de(h,E,"x",ne)&&de(E,y,"x",ne),B=de(g,h,"y",ne)&&de(h,E,"y",ne)&&de(E,y,"y",ne);if(k||B){let q=B&&(E.x-h.x)*l.x<0,j=k&&(E.y-h.y)*l.y<0;if(!q&&!j)return gi([g,h,E,y])}}return S}var yi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function rg(e,t,o){return de(e,t,"x",ne)&&de(t,o,"x",ne)||de(e,t,"y",ne)&&de(t,o,"y",ne)}function ig(e,t,o,n){if(rg(e,t,o))return`L${t.x} ${t.y}`;let r=yi(e,t),i=yi(t,o),a=Math.min(r/2,i/2,n);if(a<1)return`L${t.x} ${t.y}`;let s=e.x-t.x,l=e.y-t.y,c=o.x-t.x,d=o.y-t.y,u={x:s/r,y:l/r},f={x:c/i,y:d/i},p={x:t.x+u.x*a,y:t.y+u.y*a},g={x:t.x+f.x*a,y:t.y+f.y*a},y=-u.x,m=-u.y,_=f.x,h=f.y,w=y*h-m*_>0?1:0;return`L${p.x} ${p.y}A${a} ${a} 0 0 ${w} ${g.x} ${g.y}`}var Cc=(e,t=5)=>e.length<2?"":e.reduce((o,n,r)=>{let i="";return r>0&&r<e.length-1?i=ig(e[r-1],n,e[r+1],t):i=`${r===0?"M":"L"}${n.x} ${n.y}`,o+=i,o},"");var be=require("react"),Ei=require("@xyflow/react");var sg=50,Sc=.1,ag=.6,bi=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:a,getNodes:s,getEdge:l,screenToFlowPosition:c}=(0,Ei.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=Q(),f=(0,Ei.useStore)(R=>R.isValidConnection),[p,g]=(0,be.useState)(null),[y,m]=(0,be.useState)(null),[_,h]=(0,be.useState)(null),[E,w]=(0,be.useState)(null),[b,x]=(0,be.useState)(null),[N,I]=(0,be.useState)(!1),A=(0,be.useRef)(null),M=(0,be.useRef)(null),S=(0,be.useRef)(null),k=(0,be.useRef)(t),B=(0,be.useRef)(o);(0,be.useEffect)(()=>{k.current=t,B.current=o},[t,o]),(0,be.useEffect)(()=>{A.current=p},[p]),(0,be.useEffect)(()=>{M.current=b},[b]);let q=(0,be.useCallback)(R=>{let G=s(),K=G.find(Y=>Y.id===R);if(!K)return{x:0,y:0};let L=K.position.x,H=K.position.y,F=K.parentId;for(;F;){let Y=G.find(O=>O.id===F);if(!Y)break;L+=Y.position.x,H+=Y.position.y,F=Y.parentId}return{x:L,y:H}},[s]),j=(0,be.useCallback)(R=>{var F,Y,O,J,U,X;let G=s(),K=null,L=sg,H=G.filter(z=>z.type!=="LANE"&&z.type!=="ANNOTATION");for(let z of H){if(z.id===e)continue;let W=q(z.id),Z=(O=(Y=(F=z.measured)==null?void 0:F.width)!=null?Y:z.width)!=null?O:0,ee=(X=(U=(J=z.measured)==null?void 0:J.height)!=null?U:z.height)!=null?X:0;if(R.x>=W.x&&R.x<=W.x+Z&&R.y>=W.y&&R.y<=W.y+ee)return z.id;let pe=Math.max(W.x-R.x,0,R.x-(W.x+Z)),ge=Math.max(W.y-R.y,0,R.y-(W.y+ee)),he=Math.sqrt(pe*pe+ge*ge);he<L&&(L=he,K=z.id)}return K},[s,q,e]),C=(0,be.useCallback)((R,G)=>{var pe,ge,he,Pe,Le,ve;let K=a(R);if(!K)return null;let L=q(R),H=(he=(ge=(pe=K.measured)==null?void 0:pe.width)!=null?ge:K.width)!=null?he:0,F=(ve=(Le=(Pe=K.measured)==null?void 0:Pe.height)!=null?Le:K.height)!=null?ve:0,Y=Math.abs(L.x+H-G.x),O=Math.abs(G.x-L.x),J=Math.abs(L.y+F-G.y),U=Math.abs(G.y-L.y),X={right:Y,left:O,bottom:J,top:U},z=Object.entries(X).reduce((ce,[se,ze])=>ze<ce[1]?[se,ze]:ce,["right",X.right])[0],W=S.current;if(W&&W!==z){let ce=X[z],se=X[W],ze=Math.abs(se-ce),Ze=Math.min(Math.abs(se),Math.abs(ce));ze<Ze*ag&&(z=W)}let Z=z,ee,ue;if(Z==="right"||Z==="left"){let se=(Math.max(L.y,Math.min(L.y+F,G.y))-L.y)/(F||1);Math.abs(se-.5)<Sc&&(se=.5),ue=se,ee={x:Z==="right"?L.x+H:L.x,y:L.y+ue*F}}else{let se=(Math.max(L.x,Math.min(L.x+H,G.x))-L.x)/(H||1);Math.abs(se-.5)<Sc&&(se=.5),ue=se,ee={x:L.x+ue*H,y:Z==="bottom"?L.y+F:L.y}}return{side:Z,snapPosition:ee,offset:ue}},[a,q]),P=(0,be.useCallback)(R=>{var O,J,U;let G=A.current;if(!G)return;let K=c({x:R.clientX,y:R.clientY}),L=j(K);h(L);let H=K,F=null,Y=null;if(L){let X=C(L,K);X&&(F=X.side,H=X.snapPosition,Y=X.offset,S.current=F);let z=l(e),W={source:G==="source"?L:k.current,target:G==="target"?L:B.current,sourceHandle:G==="source"?F:(O=z==null?void 0:z.sourceHandle)!=null?O:null,targetHandle:G==="target"?F:(J=z==null?void 0:z.targetHandle)!=null?J:null},Z=(U=f==null?void 0:f(W))!=null?U:!0;I(Z)}else S.current=null,I(!1);w(F),x(Y),m(H)},[j,C,l,e,c,f]),$=(0,be.useCallback)(R=>{var F,Y,O,J,U;let G=A.current;if(!G)return;let K=c({x:R.clientX,y:R.clientY}),L=j(K);if(L){let X=C(L,K),z=(F=X==null?void 0:X.side)!=null?F:null,W=(Y=X==null?void 0:X.offset)!=null?Y:.5,Z=l(e),ee={source:G==="source"?L:k.current,target:G==="target"?L:B.current,sourceHandle:G==="source"?z:(O=Z==null?void 0:Z.sourceHandle)!=null?O:null,targetHandle:G==="target"?z:(J=Z==null?void 0:Z.targetHandle)!=null?J:null};((U=f==null?void 0:f(ee))==null||U)&&i(ue=>ue.map(pe=>{var ge,he;return pe.id===e?v(T({},pe),{source:ee.source,target:ee.target,sourceHandle:ee.sourceHandle,targetHandle:ee.targetHandle,data:v(T({},pe.data),{points:void 0,sourceOffset:G==="source"?W:(ge=pe.data)==null?void 0:ge.sourceOffset,targetOffset:G==="target"?W:(he=pe.data)==null?void 0:he.targetOffset})}):pe}))}g(null),m(null),h(null),w(null),x(null),d(!1),I(!1),u(null),S.current=null,document.removeEventListener("mouseup",$),document.removeEventListener("mousemove",P);let H=Ot.get(n);H==null||H.clearReconnectingEdge()},[e,j,C,l,i,n,P,f,c,d,u]),V=(0,be.useCallback)((R,G)=>{if(r||G.button!==0)return;G.stopPropagation(),G.preventDefault(),i(L=>L.map(H=>H.id===e?v(T({},H),{data:v(T({},H.data),{points:void 0})}):H)),g(R),u(e);let K=Ot.get(n);K==null||K.setReconnectingEdge(e),document.addEventListener("mousemove",P),document.addEventListener("mouseup",$)},[r,e,n,P,$,u,i]);return(0,be.useEffect)(()=>()=>{if(A.current){document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",$),u(null);let R=Ot.get(n);R==null||R.clearReconnectingEdge()}},[n,P,$,u]),{reconnectingHandle:p,cursorPosition:y,hoveredNodeId:_,reconnectingSide:E,reconnectingOffset:b,isValidReconnection:N,handleReconnectStart:V}};var le=require("react/jsx-runtime"),xt={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:we.MarkerType.ArrowClosed},markerEnd:{type:we.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:_i,MIN_SEGMENT_LENGTH:lg,PARALLEL_OFFSET:Mc}=lo;function cg(e,t,o,n){let r=n.filter(s=>s.source===t&&s.target===o||s.source===o&&s.target===t);if(r.length<=1){let s=n.filter(d=>d.source===t);if(s.length<=1)return 0;let l=s.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(s.length-1)/2;return(l-c)*Mc}let i=r.findIndex(s=>s.id===e),a=(r.length-1)/2;return(i-a)*Mc}var Pc=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var F,Y;let{zoom:c}=(0,we.useViewport)(),{updateEdgeData:d}=(0,we.useReactFlow)(),u=(0,we.useEdges)(),{isMultipleSelection:f,mode:p,instanceId:g}=Q(),[y,m]=(0,et.useState)(!1),[_,h]=(0,et.useState)(null),E=(0,et.useRef)(null),w=(0,et.useRef)(null),b=p!=="edit",{reconnectingHandle:x,cursorPosition:N,hoveredNodeId:I,reconnectingSide:A,isValidReconnection:M,handleReconnectStart:S}=bi({edgeId:e,source:t,target:o,instanceId:g,isReadOnly:b}),k=(0,we.useInternalNode)(t),B=(0,we.useInternalNode)(o),{sx:q,sy:j,tx:C,ty:P,sourcePos:$,targetPos:V}=(0,et.useMemo)(()=>{var ge,he;let O=k&&B?Zo(k,B):{sx:0,sy:0,tx:0,ty:0,sourcePos:we.Position.Right,targetPos:we.Position.Left},J=s?i:O.sourcePos,U=l?a:O.targetPos,X=(Pe,Le,ve)=>{var Jt,Ho,Go,Ve,We,St;let{x:ce,y:se}=Pe.internals.positionAbsolute,ze=(Go=(Ho=(Jt=Pe.measured)==null?void 0:Jt.width)!=null?Ho:Pe.width)!=null?Go:0,Ze=(St=(We=(Ve=Pe.measured)==null?void 0:Ve.height)!=null?We:Pe.height)!=null?St:0;switch(Le){case we.Position.Top:return{x:ce+ze*ve,y:se};case we.Position.Bottom:return{x:ce+ze*ve,y:se+Ze};case we.Position.Left:return{x:ce,y:se+Ze*ve};case we.Position.Right:return{x:ce+ze,y:se+Ze*ve};default:return{x:ce+ze/2,y:se+Ze/2}}},z=(ge=n==null?void 0:n.sourceOffset)!=null?ge:.5,W=(he=n==null?void 0:n.targetOffset)!=null?he:.5,Z=k?X(k,J,z).x:O.sx,ee=k?X(k,J,z).y:O.sy,ue=B?X(B,U,W).x:O.tx,pe=B?X(B,U,W).y:O.ty;return x==="source"&&N?(Z=N.x,ee=N.y,A&&(J=A)):x==="target"&&N&&(ue=N.x,pe=N.y,A&&(U=A)),{sx:Z,sy:ee,tx:ue,ty:pe,sourcePos:J,targetPos:U}},[k,B,s,l,i,a,x,N,A,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,et.useEffect)(()=>{var U;if(!w.current){w.current={sx:q,sy:j,tx:C,ty:P,sourcePos:$,targetPos:V};return}let O=w.current;(Math.abs(q-O.sx)>_i||Math.abs(j-O.sy)>_i||Math.abs(C-O.tx)>_i||Math.abs(P-O.ty)>_i||O.sourcePos!==$||O.targetPos!==V)&&((U=n==null?void 0:n.points)!=null&&U.length)&&d(e,v(T({},n),{points:void 0})),w.current={sx:q,sy:j,tx:C,ty:P,sourcePos:$,targetPos:V}},[q,j,C,P,$,V,n,e,d,x]);let R=(0,et.useMemo)(()=>{let O=cg(e,t,o,u);return xi(q,j,C,P,$,V,n==null?void 0:n.points,O)},[q,j,C,P,$,V,n==null?void 0:n.points,u,e,t,o]),G=(0,et.useMemo)(()=>{if(R.length<2)return mi({x:q,y:j},{x:C,y:P});let O=0;for(let X=0;X<R.length-1;X++)O+=fi(R[X],R[X+1]);let J=O/2,U=0;for(let X=0;X<R.length-1;X++){let z=fi(R[X],R[X+1]);if(U+z>=J){let W=(J-U)/z,Z=R[X],ee=R[X+1];return{x:Z.x+(ee.x-Z.x)*W,y:Z.y+(ee.y-Z.y)*W}}U+=z}return mi({x:q,y:j},{x:C,y:P})},[R,q,j,C,P]),K=(0,et.useCallback)((O,J)=>{if(p!=="edit"||J.button!==0)return;J.stopPropagation(),J.preventDefault();let U=R[O],X=R[O+1],z=de(U,X,"y"),W=z?U.y:U.x,Z=[...R],ee=Z.length,ue=O,pe=O+1;h(O);let ge=Pe=>{let Le=W+(z?Pe.clientY-J.clientY:Pe.clientX-J.clientX)/c;E.current=z?{x:(U.x+X.x)/2,y:Le}:{x:Le,y:(U.y+X.y)/2};let ve=[];for(let ce=1;ce<ee-1;ce++){let se=Z[ce];ce===ue||ce===pe?z?ve.push({x:se.x,y:Le}):ve.push({x:Le,y:se.y}):ve.push(T({},se))}d(e,v(T({},n),{points:ve}))},he=()=>{h(null),E.current=null,document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",he)};document.addEventListener("mousemove",ge),document.addEventListener("mouseup",he)},[p,R,c,n,e,d]);if(!k||!B)return null;let L=Cc(R),H=r||k.selected||B.selected;return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("g",{onDoubleClick:()=>m(!0),children:[(0,le.jsx)("path",{d:L,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/c),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,le.jsxs)("g",{className:D("text-grey-500 hover:text-grey-600",{"text-blue-500 hover:text-blue-600":H}),children:[(0,le.jsx)(we.BaseEdge,{id:e,path:L,interactionWidth:0,markerEnd:`url(#${H?"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)||x&&I&&!M,"stroke-green-500":x&&I&&M,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":H&&!(n!=null&&n.hasError)&&!x})}),r&&!f&&!b&&(0,le.jsx)("g",{children:R.slice(0,-1).map((O,J)=>{let U=R[J+1];if(J===0||J===R.length-2||fi(O,U)<lg)return null;let X=de(O,U,"y"),z=_===J,W=z&&E.current?E.current:mi(O,U);return(0,le.jsxs)("g",{children:[(0,le.jsx)("line",{x1:O.x,y1:O.y,x2:U.x,y2:U.y,stroke:"transparent",strokeWidth:20/c,className:D("cursor-pointer",{"cursor-ns-resize":X,"cursor-ew-resize":!X}),onMouseDown:Z=>K(J,Z)}),(0,le.jsx)("circle",{cx:W.x,cy:W.y,r:4/c,fill:z?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:W.x,cy:W.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:z?.6:.3,className:"pointer-events-none"})]},J)})})]})]}),(0,le.jsxs)(we.EdgeLabelRenderer,{children:[(0,le.jsxs)("div",{className:"absolute z-[3000] pointer-events-none flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${G.x}px, ${G.y}px)`},children:[r&&!f&&(0,le.jsx)(an,{sx:q,sy:j,tx:C,ty:P,hasLabel:!!((F=n==null?void 0:n.label)!=null&&F.trim()),children:(0,le.jsx)(sn,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:k,targetNode:B})}),(y||((Y=n==null?void 0:n.label)==null?void 0:Y.trim()))&&(0,le.jsx)(Xe,{value:n==null?void 0:n.label,className:D("min-w-8 max-w-56 px-2 py-1 body-small-400",{"pointer-events-auto":y,"pointer-events-none":!y}),isEditing:y,onBlur:()=>m(!1),onChange:O=>d(e,{label:O.trim()})})]}),r&&!f&&!b&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${R[0].x}px, ${R[0].y}px)`},children:(0,le.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="source"?.6:.3,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:D("pointer-events-auto",{"cursor-move":!x||x!=="source","cursor-not-allowed":x==="source"&&I&&!M,"cursor-grabbing":x==="source"&&(!I||M)}),onMouseDown:O=>S("source",O.nativeEvent)})]})}),(0,le.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${R[R.length-1].x}px, ${R[R.length-1].y}px)`},children:(0,le.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="target"?.6:.3,className:"pointer-events-none"}),(0,le.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:D("pointer-events-auto",{"cursor-move":!x||x!=="target","cursor-not-allowed":x==="target"&&I&&!M,"cursor-grabbing":x==="target"&&(!I||M)}),onMouseDown:O=>S("target",O.nativeEvent)})]})})]})]})]})};var Vt=require("@xyflow/react"),dg={right:Vt.Position.Right,left:Vt.Position.Left,top:Vt.Position.Top,bottom:Vt.Position.Bottom},Ti=e=>{var t;return(t=dg[e!=null?e:""])!=null?t:Vt.Position.Right},_s=(e,t,o=.5)=>{var l,c,d,u;let{x:n,y:r}=e.internals.positionAbsolute,i=(c=(l=e.measured)==null?void 0:l.width)!=null?c:0,a=(u=(d=e.measured)==null?void 0:d.height)!=null?u:0;switch(Ti(t)){case Vt.Position.Right:return{x:n+i,y:r+a*o};case Vt.Position.Left:return{x:n,y:r+a*o};case Vt.Position.Top:return{x:n+i*o,y:r};case Vt.Position.Bottom:return{x:n+i*o,y:r+a};default:return{x:n+i/2,y:r+a/2}}},Lc=(e,t,o)=>{var d,u;let{position:{x:n,y:r},measured:i}=e,a=(d=i.width)!=null?d:0,s=(u=i.height)!=null?u:0;return[{id:"left",x:n,y:r+s/2},{id:"right",x:n+a,y:r+s/2},{id:"top",x:n+a/2,y:r},{id:"bottom",x:n+a/2,y:r+s}].reduce((f,p)=>{let g=Math.hypot(t-f.x,o-f.y);return Math.hypot(t-p.x,o-p.y)<g?p:f}).id};var Fd=require("use-debounce");var _n=require("@xyflow/react"),Ps=require("react");var qn=(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))(qn||{});var Ni=require("xml-js");var kc={compact:!0,spaces:4},ug=e=>e.replace(/\n/g,"
");function vi(e,t=kc){if(e)return JSON.parse((0,Ni.xml2json)(e,t))}function Rc(e,t=kc){return e?(0,Ni.json2xml)(e,v(T({},t),{attributeValueFn:ug})):""}var pg={MIN_WIDTH:36,MIN_HEIGHT:36},fg={MIN_WIDTH:36,MIN_HEIGHT:36},mg={MIN_WIDTH:56,MIN_HEIGHT:56},cn={MIN_WIDTH:176,MIN_HEIGHT:96},wi={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},ke={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},dn={MIN_WIDTH:176,MIN_HEIGHT:64},gg={MIN_WIDTH:128,MIN_HEIGHT:64},re={START_EVENT:pg,END_EVENT:fg,GATEWAY:mg,TASK:cn,LANE:ke,ANNOTATION:dn,UNSUPPORTED:gg};var Dc={"attribute-loop":"LOOP"},Oc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Vc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Hc={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Gc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var un=(e,t,o,n,r,i)=>{let a=e._attributes.width||0,s=e._attributes.height||0,l=0,c=0;if(n&&r!==void 0&&i!==void 0){let g=n.split(`
|
|
6
|
-
`),y=
|
|
5
|
+
`).trim();t&&g.length>t&&(g=g.substring(0,t)),b.currentTarget.innerText=g,s==null||s(),g!==e&&(a==null||a(g))};return(0,Vs.jsx)("div",{className:V("flex-1 p-2 self-stretch flex items-center justify-center border border-transparent overflow-hidden text-ellipsis body-medium-400 text-center rounded-sm",{"border border-dashed border-grey-400 bg-white shadow-md":p,"bg-white":e.length>0},n),style:o,onDoubleClick:m,children:(0,Vs.jsx)("div",{ref:u,className:V("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":p}),contentEditable:p,suppressContentEditableWarning:!0,onKeyDown:x,onPaste:T,onInput:E,onBlur:N,children:e})})};var Tg=require("@xyflow/react");var ge=(e,t,o,n=1)=>Math.abs(e[o]-t[o])<n,Ci=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Si=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});var ir=require("@xyflow/react");var go={OFFSET:30,TOLERANCE:1,MOVE_THRESHOLD:5,MIN_SEGMENT_LENGTH:15,PARALLEL_OFFSET:15};var{TOLERANCE:se}=go;function Ng(e,t,o){return ge(e,t,"x",se)&&ge(t,o,"x",se)&&ge(e,o,"x",se)}function vg(e,t,o){return ge(e,t,"y",se)&&ge(t,o,"y",se)&&ge(e,o,"y",se)}function wg(e,t,o){if(!Ng(e,t,o))return!1;let n=t.y-e.y,r=o.y-t.y;return Math.abs(n)<se||Math.abs(r)<se?!1:n*r<0}function Ig(e,t,o){if(!vg(e,t,o))return!1;let n=t.x-e.x,r=o.x-t.x;return Math.abs(n)<se||Math.abs(r)<se?!1:n*r<0}function Ag(e,t,o,n){let r=t.x!==0,i=t.x===-n.x&&t.y===-n.y,a=t.x===n.x&&t.y===n.y,s=120;if(i)if(r){if((o.x-e.x)*t.x>=0)return[{x:(e.x+o.x)/2,y:e.y},{x:(e.x+o.x)/2,y:o.y}];{let l=(e.y+o.y)/2,c=Math.abs(e.y-o.y)<s?Math.max(e.y,o.y)+s:l;return[{x:e.x,y:c},{x:o.x,y:c}]}}else{if((o.y-e.y)*t.y>=0)return[{x:e.x,y:(e.y+o.y)/2},{x:o.x,y:(e.y+o.y)/2}];{let l=(e.x+o.x)/2,c=Math.abs(e.x-o.x)<s?Math.max(e.x,o.x)+s:l;return[{x:c,y:e.y},{x:c,y:o.y}]}}else if(a)if(r)if((o.x-e.x)*t.x>0&&Math.abs(e.y-o.y)<s){let l=Math.max(e.y,o.y)+s,c=o.x+t.x*(s/2);return[{x:e.x,y:l},{x:c,y:l},{x:c,y:o.y}]}else{let l=t.x>0?Math.max(e.x,o.x):Math.min(e.x,o.x);return[{x:l,y:e.y},{x:l,y:o.y}]}else if((o.y-e.y)*t.y>0&&Math.abs(e.x-o.x)<s){let l=Math.max(e.x,o.x)+s,c=o.y+t.y*(s/2);return[{x:l,y:e.y},{x:l,y:c},{x:o.x,y:c}]}else{let l=t.y>0?Math.max(e.y,o.y):Math.min(e.y,o.y);return[{x:e.x,y:l},{x:o.x,y:l}]}else{let l=t.x!==0?o.x:e.x,c=t.y!==0?o.y:e.y,d=t.x!==0?(l-e.x)*t.x:(c-e.y)*t.y,u=n.x!==0?(l-o.x)*n.x:(c-o.y)*n.y;return d>=0&&u>=0?[{x:l,y:c}]:r?[{x:e.x,y:o.y}]:[{x:o.x,y:e.y}]}}function ed(e){if(e.length<=2)return e;let t=[e[0]];for(let o=1;o<e.length-1;o++){let n=t[t.length-1],r=e[o],i=e[o+1];ge(n,r,"x",se)&&ge(r,i,"x",se)||ge(n,r,"y",se)&&ge(r,i,"y",se)||t.push(r)}return t.push(e[e.length-1]),t}function Mi(e){let t=[];for(let o of e){let n=t[t.length-1];(!n||Math.abs(n.x-o.x)>=se||Math.abs(n.y-o.y)>=se)&&t.push(o)}return t}function Cg(e){let t=[...e],o=!0;for(;o;){o=!1;for(let n=1;n<t.length-1;n++){let r=t[n-1],i=t[n],a=t[n+1];if(wg(r,i,a)||Ig(r,i,a)){t.splice(n,1),o=!0;break}}}return t}function td(e){let t=Mi(ed([...e]));return t=Cg(t),Mi(ed(t))}function Pi(e){switch(e){case ir.Position.Left:return{x:-1,y:0};case ir.Position.Right:return{x:1,y:0};case ir.Position.Top:return{x:0,y:-1};case ir.Position.Bottom:return{x:0,y:1};default:return{x:0,y:0}}}function od(e,t,o,n){let r=go.OFFSET,i=go.OFFSET;if(t.x===-n.x&&t.y===-n.y)if(t.x!==0){let a=(o.x-e.x)*t.x;a>0&&a<2*go.OFFSET&&(r=a/2,i=a/2)}else{let a=(o.y-e.y)*t.y;a>0&&a<2*go.OFFSET&&(r=a/2,i=a/2)}return{sourceOffset:r,targetOffset:i}}function Sg(e,t,o,n,r,i,a=0){let s=Pi(r),l=Pi(i),c=s.x===0?a:0,d=s.y===0?a:0,u=l.x===0?a:0,f=l.y===0?a:0,p={x:e+c,y:t+d},h={x:o+u,y:n+f},{sourceOffset:y,targetOffset:m}=od(p,s,h,l),x={x:p.x+s.x*y,y:p.y+s.y*y},T={x:h.x+l.x*m,y:h.y+l.y*m},E=Ag(x,s,T,l),N=[p,x,...E,T,h],b=td(N);if(b.length===2&&Li(p,h)>se){let g=ge(p,x,"x",se)&&ge(x,T,"x",se)&&ge(T,h,"x",se),w=ge(p,x,"y",se)&&ge(x,T,"y",se)&&ge(T,h,"y",se);if(g||w){let A=w&&(T.x-x.x)*s.x<0,I=g&&(T.y-x.y)*s.y<0;if(!A&&!I)return Mi([p,x,T,h])}}return b}function ki(e,t,o,n,r,i,a,s=0){if(!(a!=null&&a.length))return Sg(e,t,o,n,r,i,s);let l=Pi(r),c=Pi(i),d=l.x===0?s:0,u=l.y===0?s:0,f=c.x===0?s:0,p=c.y===0?s:0,h={x:e+d,y:t+u},y={x:o+f,y:n+p},{sourceOffset:m,targetOffset:x}=od(h,l,y,c),T={x:h.x+l.x*m,y:h.y+l.y*m},E={x:y.x+c.x*x,y:y.y+c.y*x},N=[...a],b=N[0],g=l.y===0;g&&Math.abs(h.y-b.y)>se?N.unshift({x:b.x,y:h.y}):!g&&Math.abs(h.x-b.x)>se&&N.unshift({x:h.x,y:b.y});let w=N[N.length-1],A=c.y===0,I=[];(Math.abs(w.x-E.x)>se||Math.abs(w.y-E.y)>se)&&(A?I.push({x:E.x,y:w.y}):I.push({x:w.x,y:E.y})),I.push(E);let D=[h,...N,...I,y],S=td(D);if(S.length===2&&Li(h,y)>se){let L=ge(h,T,"x",se)&&ge(T,E,"x",se)&&ge(E,y,"x",se),z=ge(h,T,"y",se)&&ge(T,E,"y",se)&&ge(E,y,"y",se);if(L||z){let q=z&&(E.x-T.x)*l.x<0,Q=L&&(E.y-T.y)*l.y<0;if(!q&&!Q)return Mi([h,T,E,y])}}return S}var Li=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Mg(e,t,o){return ge(e,t,"x",se)&&ge(t,o,"x",se)||ge(e,t,"y",se)&&ge(t,o,"y",se)}function Pg(e,t,o,n){if(Mg(e,t,o))return`L${t.x} ${t.y}`;let r=Li(e,t),i=Li(t,o),a=Math.min(r/2,i/2,n);if(a<1)return`L${t.x} ${t.y}`;let s=e.x-t.x,l=e.y-t.y,c=o.x-t.x,d=o.y-t.y,u={x:s/r,y:l/r},f={x:c/i,y:d/i},p={x:t.x+u.x*a,y:t.y+u.y*a},h={x:t.x+f.x*a,y:t.y+f.y*a},y=-u.x,m=-u.y,x=f.x,T=f.y,N=y*T-m*x>0?1:0;return`L${p.x} ${p.y}A${a} ${a} 0 0 ${N} ${h.x} ${h.y}`}var nd=(e,t=5)=>e.length<2?"":e.reduce((o,n,r)=>{let i="";return r>0&&r<e.length-1?i=Pg(e[r-1],n,e[r+1],t):i=`${r===0?"M":"L"}${n.x} ${n.y}`,o+=i,o},"");var Te=require("react"),Ri=require("@xyflow/react");var Lg=50,rd=.1,kg=.6,Di=({edgeId:e,source:t,target:o,instanceId:n,isReadOnly:r})=>{let{setEdges:i,getNode:a,getNodes:s,getEdge:l,screenToFlowPosition:c}=(0,Ri.useReactFlow)(),{setIsDragging:d,setReconnectingEdgeId:u}=ee(),f=(0,Ri.useStore)(P=>P.isValidConnection),[p,h]=(0,Te.useState)(null),[y,m]=(0,Te.useState)(null),[x,T]=(0,Te.useState)(null),[E,N]=(0,Te.useState)(null),[b,g]=(0,Te.useState)(null),[w,A]=(0,Te.useState)(!1),I=(0,Te.useRef)(null),D=(0,Te.useRef)(null),S=(0,Te.useRef)(null),L=(0,Te.useRef)(t),z=(0,Te.useRef)(o);(0,Te.useEffect)(()=>{L.current=t,z.current=o},[t,o]),(0,Te.useEffect)(()=>{I.current=p},[p]),(0,Te.useEffect)(()=>{D.current=b},[b]);let q=(0,Te.useCallback)(P=>{let C=s(),F=C.find(G=>G.id===P);if(!F)return{x:0,y:0};let R=F.position.x,H=F.position.y,k=F.parentId;for(;k;){let G=C.find(B=>B.id===k);if(!G)break;R+=G.position.x,H+=G.position.y,k=G.parentId}return{x:R,y:H}},[s]),Q=(0,Te.useCallback)(P=>{var k,G,B,K,W,X;let C=s(),F=null,R=Lg,H=C.filter(Z=>Z.type!=="LANE"&&Z.type!=="ANNOTATION");for(let Z of H){if(Z.id===e)continue;let j=q(Z.id),Y=(B=(G=(k=Z.measured)==null?void 0:k.width)!=null?G:Z.width)!=null?B:0,te=(X=(W=(K=Z.measured)==null?void 0:K.height)!=null?W:Z.height)!=null?X:0;if(P.x>=j.x&&P.x<=j.x+Y&&P.y>=j.y&&P.y<=j.y+te)return Z.id;let J=Math.max(j.x-P.x,0,P.x-(j.x+Y)),le=Math.max(j.y-P.y,0,P.y-(j.y+te)),fe=Math.sqrt(J*J+le*le);fe<R&&(R=fe,F=Z.id)}return F},[s,q,e]),U=(0,Te.useCallback)((P,C)=>{var J,le,fe,me,He,we;let F=a(P);if(!F)return null;let R=q(P),H=(fe=(le=(J=F.measured)==null?void 0:J.width)!=null?le:F.width)!=null?fe:0,k=(we=(He=(me=F.measured)==null?void 0:me.height)!=null?He:F.height)!=null?we:0,G=Math.abs(R.x+H-C.x),B=Math.abs(C.x-R.x),K=Math.abs(R.y+k-C.y),W=Math.abs(C.y-R.y),X={right:G,left:B,bottom:K,top:W},Z=Object.entries(X).reduce((he,[de,We])=>We<he[1]?[de,We]:he,["right",X.right])[0],j=S.current;if(j&&j!==Z){let he=X[Z],de=X[j],We=Math.abs(de-he),Qe=Math.min(Math.abs(de),Math.abs(he));We<Qe*kg&&(Z=j)}let Y=Z,te,ne;if(Y==="right"||Y==="left"){let de=(Math.max(R.y,Math.min(R.y+k,C.y))-R.y)/(k||1);Math.abs(de-.5)<rd&&(de=.5),ne=de,te={x:Y==="right"?R.x+H:R.x,y:R.y+ne*k}}else{let de=(Math.max(R.x,Math.min(R.x+H,C.x))-R.x)/(H||1);Math.abs(de-.5)<rd&&(de=.5),ne=de,te={x:R.x+ne*H,y:Y==="bottom"?R.y+k:R.y}}return{side:Y,snapPosition:te,offset:ne}},[a,q]),$=(0,Te.useCallback)(P=>{var B,K,W;let C=I.current;if(!C)return;let F=c({x:P.clientX,y:P.clientY}),R=Q(F);T(R);let H=F,k=null,G=null;if(R){let X=U(R,F);X&&(k=X.side,H=X.snapPosition,G=X.offset,S.current=k);let Z=l(e),j={source:C==="source"?R:L.current,target:C==="target"?R:z.current,sourceHandle:C==="source"?k:(B=Z==null?void 0:Z.sourceHandle)!=null?B:null,targetHandle:C==="target"?k:(K=Z==null?void 0:Z.targetHandle)!=null?K:null},Y=(W=f==null?void 0:f(j))!=null?W:!0;A(Y)}else S.current=null,A(!1);N(k),g(G),m(H)},[Q,U,l,e,c,f]),M=(0,Te.useCallback)(P=>{var k,G,B,K,W;let C=I.current;if(!C)return;let F=c({x:P.clientX,y:P.clientY}),R=Q(F);if(R){let X=U(R,F),Z=(k=X==null?void 0:X.side)!=null?k:null,j=(G=X==null?void 0:X.offset)!=null?G:.5,Y=l(e),te={source:C==="source"?R:L.current,target:C==="target"?R:z.current,sourceHandle:C==="source"?Z:(B=Y==null?void 0:Y.sourceHandle)!=null?B:null,targetHandle:C==="target"?Z:(K=Y==null?void 0:Y.targetHandle)!=null?K:null};((W=f==null?void 0:f(te))==null||W)&&i(ne=>ne.map(J=>{var le,fe;return J.id===e?v(_({},J),{source:te.source,target:te.target,sourceHandle:te.sourceHandle,targetHandle:te.targetHandle,data:v(_({},J.data),{points:void 0,sourceOffset:C==="source"?j:(le=J.data)==null?void 0:le.sourceOffset,targetOffset:C==="target"?j:(fe=J.data)==null?void 0:fe.targetOffset})}):J}))}h(null),m(null),T(null),N(null),g(null),d(!1),A(!1),u(null),S.current=null,document.removeEventListener("mouseup",M),document.removeEventListener("mousemove",$);let H=zt.get(n);H==null||H.clearReconnectingEdge()},[e,Q,U,l,i,n,$,f,c,d,u]),O=(0,Te.useCallback)((P,C)=>{if(r||C.button!==0)return;C.stopPropagation(),C.preventDefault(),i(R=>R.map(H=>H.id===e?v(_({},H),{data:v(_({},H.data),{points:void 0})}):H)),h(P),u(e);let F=zt.get(n);F==null||F.setReconnectingEdge(e),document.addEventListener("mousemove",$),document.addEventListener("mouseup",M)},[r,e,n,$,M,u,i]);return(0,Te.useEffect)(()=>()=>{if(I.current){document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",M),u(null);let P=zt.get(n);P==null||P.clearReconnectingEdge()}},[n,$,M,u]),{reconnectingHandle:p,cursorPosition:y,hoveredNodeId:x,reconnectingSide:E,reconnectingOffset:b,isValidReconnection:w,handleReconnectStart:O}};var pe=require("react/jsx-runtime"),_t={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:Ie.MarkerType.ArrowClosed},markerEnd:{type:Ie.MarkerType.Arrow},data:{label:""}},{MOVE_THRESHOLD:Oi,MIN_SEGMENT_LENGTH:Rg,PARALLEL_OFFSET:id}=go;function Dg(e,t,o,n){let r=n.filter(s=>s.source===t&&s.target===o||s.source===o&&s.target===t);if(r.length<=1){let s=n.filter(d=>d.source===t);if(s.length<=1)return 0;let l=s.findIndex(d=>d.id===e);if(l<=0)return 0;let c=(s.length-1)/2;return(l-c)*id}let i=r.findIndex(s=>s.id===e),a=(r.length-1)/2;return(i-a)*id}var sd=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var k,G;let{zoom:c}=(0,Ie.useViewport)(),{updateEdgeData:d}=(0,Ie.useReactFlow)(),u=(0,Ie.useEdges)(),{isMultipleSelection:f,mode:p,instanceId:h}=ee(),[y,m]=(0,ot.useState)(!1),[x,T]=(0,ot.useState)(null),E=(0,ot.useRef)(null),N=(0,ot.useRef)(null),b=p!=="edit",{reconnectingHandle:g,cursorPosition:w,hoveredNodeId:A,reconnectingSide:I,isValidReconnection:D,handleReconnectStart:S}=Di({edgeId:e,source:t,target:o,instanceId:h,isReadOnly:b}),L=(0,Ie.useInternalNode)(t),z=(0,Ie.useInternalNode)(o),{sx:q,sy:Q,tx:U,ty:$,sourcePos:M,targetPos:O}=(0,ot.useMemo)(()=>{var le,fe;let B=L&&z?cn(L,z):{sx:0,sy:0,tx:0,ty:0,sourcePos:Ie.Position.Right,targetPos:Ie.Position.Left},K=s?i:B.sourcePos,W=l?a:B.targetPos,X=(me,He,we)=>{var Rt,qt,No,vo,vr,ze;let{x:he,y:de}=me.internals.positionAbsolute,We=(No=(qt=(Rt=me.measured)==null?void 0:Rt.width)!=null?qt:me.width)!=null?No:0,Qe=(ze=(vr=(vo=me.measured)==null?void 0:vo.height)!=null?vr:me.height)!=null?ze:0;switch(He){case Ie.Position.Top:return{x:he+We*we,y:de};case Ie.Position.Bottom:return{x:he+We*we,y:de+Qe};case Ie.Position.Left:return{x:he,y:de+Qe*we};case Ie.Position.Right:return{x:he+We,y:de+Qe*we};default:return{x:he+We/2,y:de+Qe/2}}},Z=(le=n==null?void 0:n.sourceOffset)!=null?le:.5,j=(fe=n==null?void 0:n.targetOffset)!=null?fe:.5,Y=L?X(L,K,Z).x:B.sx,te=L?X(L,K,Z).y:B.sy,ne=z?X(z,W,j).x:B.tx,J=z?X(z,W,j).y:B.ty;return g==="source"&&w?(Y=w.x,te=w.y,I&&(K=I)):g==="target"&&w&&(ne=w.x,J=w.y,I&&(W=I)),{sx:Y,sy:te,tx:ne,ty:J,sourcePos:K,targetPos:W}},[L,z,s,l,i,a,g,w,I,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);(0,ot.useEffect)(()=>{var W;if(!N.current){N.current={sx:q,sy:Q,tx:U,ty:$,sourcePos:M,targetPos:O};return}let B=N.current;(Math.abs(q-B.sx)>Oi||Math.abs(Q-B.sy)>Oi||Math.abs(U-B.tx)>Oi||Math.abs($-B.ty)>Oi||B.sourcePos!==M||B.targetPos!==O)&&((W=n==null?void 0:n.points)!=null&&W.length)&&d(e,v(_({},n),{points:void 0})),N.current={sx:q,sy:Q,tx:U,ty:$,sourcePos:M,targetPos:O}},[q,Q,U,$,M,O,n,e,d,g]);let P=(0,ot.useMemo)(()=>{let B=Dg(e,t,o,u);return ki(q,Q,U,$,M,O,n==null?void 0:n.points,B)},[q,Q,U,$,M,O,n==null?void 0:n.points,u,e,t,o]),C=(0,ot.useMemo)(()=>{if(P.length<2)return Si({x:q,y:Q},{x:U,y:$});let B=0;for(let X=0;X<P.length-1;X++)B+=Ci(P[X],P[X+1]);let K=B/2,W=0;for(let X=0;X<P.length-1;X++){let Z=Ci(P[X],P[X+1]);if(W+Z>=K){let j=(K-W)/Z,Y=P[X],te=P[X+1];return{x:Y.x+(te.x-Y.x)*j,y:Y.y+(te.y-Y.y)*j}}W+=Z}return Si({x:q,y:Q},{x:U,y:$})},[P,q,Q,U,$]),F=(0,ot.useCallback)((B,K)=>{if(p!=="edit"||K.button!==0)return;K.stopPropagation(),K.preventDefault();let W=P[B],X=P[B+1],Z=ge(W,X,"y"),j=Z?W.y:W.x,Y=[...P],te=Y.length,ne=B,J=B+1;T(B);let le=me=>{let He=j+(Z?me.clientY-K.clientY:me.clientX-K.clientX)/c;E.current=Z?{x:(W.x+X.x)/2,y:He}:{x:He,y:(W.y+X.y)/2};let we=[];for(let he=1;he<te-1;he++){let de=Y[he];he===ne||he===J?Z?we.push({x:de.x,y:He}):we.push({x:He,y:de.y}):we.push(_({},de))}d(e,v(_({},n),{points:we}))},fe=()=>{T(null),E.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",fe)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",fe)},[p,P,c,n,e,d]);if(!L||!z)return null;let R=nd(P),H=r||L.selected||z.selected;return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)("g",{className:V("group bpmn-arrow-edge",{"is-highlighted":H}),onDoubleClick:()=>m(!0),children:[(0,pe.jsx)("path",{d:R,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/c),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,pe.jsxs)("g",{className:V("text-grey-500 transition-colors duration-75 group-hover:text-grey-800",{"text-blue-500 group-hover:text-blue-600":H}),children:[(0,pe.jsx)(Ie.BaseEdge,{id:e,path:R,interactionWidth:0,markerEnd:`url(#${H?"sequence-edge-marker-highlighted":"sequence-edge-marker"})`,className:V("stroke-2 stroke-current transition-[stroke,filter] duration-75 group-hover:drop-shadow-[0_0_3px_rgba(0,0,0,0.2)]",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||g&&A&&!D,"stroke-green-500":g&&A&&D,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":H&&!(n!=null&&n.hasError)&&!g})}),r&&!f&&!b&&(0,pe.jsx)("g",{children:P.slice(0,-1).map((B,K)=>{let W=P[K+1];if(K===0||K===P.length-2||Ci(B,W)<Rg)return null;let X=ge(B,W,"y"),Z=x===K,j=Z&&E.current?E.current:Si(B,W);return(0,pe.jsxs)("g",{children:[(0,pe.jsx)("line",{x1:B.x,y1:B.y,x2:W.x,y2:W.y,stroke:"transparent",strokeWidth:20/c,className:V("cursor-pointer",{"cursor-ns-resize":X,"cursor-ew-resize":!X}),onMouseDown:Y=>F(K,Y)}),(0,pe.jsx)("circle",{cx:j.x,cy:j.y,r:4/c,fill:Z?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:j.x,cy:j.y,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:Z?.6:.3,className:"pointer-events-none"})]},K)})})]})]}),(0,pe.jsxs)(Ie.EdgeLabelRenderer,{children:[(0,pe.jsxs)("div",{className:"absolute z-[3000] pointer-events-none flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C.x}px, ${C.y}px)`},children:[r&&!f&&(0,pe.jsx)(Tn,{sx:q,sy:Q,tx:U,ty:$,hasLabel:!!((k=n==null?void 0:n.label)!=null&&k.trim()),children:(0,pe.jsx)(_n,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:L,targetNode:z})}),(y||((G=n==null?void 0:n.label)==null?void 0:G.trim()))&&(0,pe.jsx)(Ke,{value:n==null?void 0:n.label,className:V("min-w-8 max-w-56 px-2 py-1 body-small-400",{"pointer-events-auto":y,"pointer-events-none":!y}),isEditing:y,onBlur:()=>m(!1),onChange:B=>d(e,{label:B.trim()})})]}),r&&!f&&!b&&(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${P[0].x}px, ${P[0].y}px)`},children:(0,pe.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:g==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:g==="source"?.6:.3,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:V("pointer-events-auto",{"cursor-move":!g||g!=="source","cursor-not-allowed":g==="source"&&A&&!D,"cursor-grabbing":g==="source"&&(!A||D)}),onMouseDown:B=>S("source",B.nativeEvent)})]})}),(0,pe.jsx)("div",{className:"absolute z-[10000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${P[P.length-1].x}px, ${P[P.length-1].y}px)`},children:(0,pe.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:g==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:g==="target"?.6:.3,className:"pointer-events-none"}),(0,pe.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:V("pointer-events-auto",{"cursor-move":!g||g!=="target","cursor-not-allowed":g==="target"&&A&&!D,"cursor-grabbing":g==="target"&&(!A||D)}),onMouseDown:B=>S("target",B.nativeEvent)})]})})]})]})]})};var Yt=require("@xyflow/react"),Og={right:Yt.Position.Right,left:Yt.Position.Left,top:Yt.Position.Top,bottom:Yt.Position.Bottom},Hi=e=>{var t;return(t=Og[e!=null?e:""])!=null?t:Yt.Position.Right},Gs=(e,t,o=.5)=>{var l,c,d,u;let{x:n,y:r}=e.internals.positionAbsolute,i=(c=(l=e.measured)==null?void 0:l.width)!=null?c:0,a=(u=(d=e.measured)==null?void 0:d.height)!=null?u:0;switch(Hi(t)){case Yt.Position.Right:return{x:n+i,y:r+a*o};case Yt.Position.Left:return{x:n,y:r+a*o};case Yt.Position.Top:return{x:n+i*o,y:r};case Yt.Position.Bottom:return{x:n+i*o,y:r+a};default:return{x:n+i/2,y:r+a/2}}},ad=(e,t,o)=>{var d,u;let{position:{x:n,y:r},measured:i}=e,a=(d=i.width)!=null?d:0,s=(u=i.height)!=null?u:0;return[{id:"left",x:n,y:r+s/2},{id:"right",x:n+a,y:r+s/2},{id:"top",x:n+a/2,y:r},{id:"bottom",x:n+a/2,y:r+s}].reduce((f,p)=>{let h=Math.hypot(t-f.x,o-f.y);return Math.hypot(t-p.x,o-p.y)<h?p:f}).id};var uu=require("use-debounce");var Ln=require("@xyflow/react"),Js=require("react");var sr=(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))(sr||{});var Vi=require("xml-js");var ld={compact:!0,spaces:4},Hg=e=>e.replace(/\n/g,"
");function Gi(e,t=ld){if(e)return JSON.parse((0,Vi.xml2json)(e,t))}function cd(e,t=ld){return e?(0,Vi.json2xml)(e,v(_({},t),{attributeValueFn:Hg})):""}var dd={"attribute-loop":"LOOP"},ud={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},pd={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},fd={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},md={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var vn=(e,t,o,n,r,i)=>{let a=e._attributes.width||0,s=e._attributes.height||0,l=0,c=0;if(n&&r!==void 0&&i!==void 0){let h=n.split(`
|
|
6
|
+
`),y=h.length;l=h.reduce((x,T)=>Math.max(x,T.length),0)*7+r,c=y*20+i}let d=Math.max(io(Number(a),t),l),u=Math.max(io(Number(s),o),c);return{width:d,height:u,measured:{width:d,height:u}}},wn=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},Gg=e=>{let{mxGeometry:t}=e,o=wn(e),n=vn(t,ae.START_EVENT.MIN_WIDTH,ae.START_EVENT.MIN_HEIGHT);return v(_(_({},o),n),{type:"START_EVENT"})},Bg=e=>{let{mxGeometry:t}=e,o=wn(e),n=vn(t,ae.END_EVENT.MIN_WIDTH,ae.END_EVENT.MIN_HEIGHT);return v(_(_({},o),n),{type:"END_EVENT"})},Bs=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=wn(e),s=vn(n,ae.TASK.MIN_WIDTH,ae.TASK.MIN_HEIGHT,r.data.label,48,24),l=t==null?void 0:t.find(d=>{let{parent:u}=d._attributes;return u===e._attributes.id});if(l){let{style:d}=l._attributes,u=dd[d];u&&(r.data.attribute=u)}let c=ud[o.style];return c&&(r.data.variant=c),v(_(_({},r),s),{type:"TASK"})},zs=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=wn(e),i=vn(o,ae.GATEWAY.MIN_WIDTH,ae.GATEWAY.MIN_HEIGHT);return r.data.variant=pd[n],v(_(_({},r),i),{type:"GATEWAY"})},zg=e=>{let{mxGeometry:t}=e,o=wn(e),i=vn(t,ae.ANNOTATION.MIN_WIDTH,ae.ANNOTATION.MIN_HEIGHT,o.data.label,32,24);return v(_(_({},o),i),{type:"ANNOTATION"})},Yg=e=>{let{mxGeometry:t}=e,o=wn(e),n=vn(t,ae.LANE.MIN_WIDTH,ae.LANE.MIN_HEIGHT);return v(_(_({},o),n),{type:"LANE"})},gd={task:Bs,"task-script":Bs,"subprocess-collapsed":Bs,"start-event":Gg,"end-event-terminate":Bg,"gateway-parallel":zs,"gateway-exclusive":zs,"gateway-complex":zs,annotation:zg,lane:Yg},Wg=e=>{if(e&&Array.isArray(e))return e.map(t=>({x:Number(t._attributes.x),y:Number(t._attributes.y)}))},hd=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,source:r,target:i,value:a,style:s,sourceHandle:l,targetHandle:c,sourceOffset:d,targetOffset:u}=t,f=Wg(o==null?void 0:o.Array),p=d!==void 0?Number(d):void 0,h=u!==void 0?Number(u):void 0,y=v(_(_({id:n,source:r,target:i},l?{sourceHandle:l}:{}),c?{targetHandle:c}:{}),{data:_(_(_({label:a||""},f&&f.length>0?{points:f}:{}),p!==void 0?{sourceOffset:p}:{}),h!==void 0?{targetOffset:h}:{})});return s.includes("association")&&s.includes('endArrow=""')?_(_({},Nn),y):_(_({},_t),y)},yd=(e,t)=>{let{id:o,type:n,source:r,target:i,sourceHandle:a,targetHandle:s,data:l}=e,c=t==null?void 0:t.find(p=>p.id===r),d="";n==="ANNOTATION_EDGE"&&(d='association;endArrow=""');let u={_attributes:{as:"geometry",relative:"1"}};return l!=null&&l.points&&Array.isArray(l.points)&&l.points.length>0&&(u.Array=l.points.map(p=>({_attributes:{as:"mxPoint",x:p.x,y:p.y}}))),{_attributes:{id:o,parent:(c==null?void 0:c.parentId)||"1",edge:"1",style:d,source:r,target:i,value:(l==null?void 0:l.label)||"",sourceHandle:a!=null?a:void 0,targetHandle:s!=null?s:void 0,sourceOffset:(l==null?void 0:l.sourceOffset)!==void 0?String(l.sourceOffset):void 0,targetOffset:(l==null?void 0:l.targetOffset)!==void 0?String(l.targetOffset):void 0},mxGeometry:u}},In=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}}}},Fg=e=>{let{variant:t}=e.data,o=In(e);return v(_({},o),{_attributes:v(_({},o._attributes),{style:fd[t]||"task"})})},Xg=e=>{let t=In(e);return v(_({},t),{_attributes:v(_({},t._attributes),{style:"start-event"})})},Ug=e=>{let t=In(e);return v(_({},t),{_attributes:v(_({},t._attributes),{style:"end-event-terminate"})})},$g=e=>{let{variant:t}=e.data,o=In(e);return v(_({},o),{_attributes:v(_({},o._attributes),{style:md[t]})})},Kg=e=>{let t=In(e);return v(_({},t),{_attributes:v(_({},t._attributes),{style:"lane"})})},qg=e=>{let t=In(e);return v(_({},t),{_attributes:v(_({},t._attributes),{style:"annotation"})})},xd={TASK:Fg,START_EVENT:Xg,END_EVENT:Ug,GATEWAY:$g,ANNOTATION:qg,LANE:Kg},Ed=(e,t)=>{var a,s;let r=((a=e.measured)==null?void 0:a.width)||0,i=((s=e.measured)==null?void 0:s.height)||0;return{_attributes:{id:`${t+1}`,parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:r/2-22/2,y:i-22,width:22,height:22}}}};var Ys=qp(require("@dagrejs/dagre"),1),Zg=require("@xyflow/react");var bd=(e=[],t=[],o="LR")=>{let n=new Ys.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)),Ys.default.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return v(_({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},eo=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId);if(t.length===0)return e;let o=Aa(e);for(let n of t){let r=[...o.values()],i=r.filter(s=>s.parentId===n.id);if(i.length===0)continue;let a=i.filter(s=>s.type==="LANE");if(a.length>0){ka(a,o,r),Ra(n,o);continue}hs(n,i,o)}return Ca(e,o)},_d=eo,Td=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)};var Jg=e=>e.type==="LANE"&&!e.parentId,Ws=e=>{var i;let t=e.filter(Jg);if(t.length===0)return e;let o=new Map;for(let a of e){if(!a.parentId)continue;let s=(i=o.get(a.parentId))!=null?i:[];s.push(a.id),o.set(a.parentId,s)}let n=new Set,r=t.map(a=>a.id);for(;r.length>0;){let a=r.pop();if(!a||n.has(a))continue;n.add(a);let s=o.get(a);if(s)for(let l of s)n.has(l)||r.push(l)}return e.filter(a=>n.has(a.id))};var ar=1,Nd=e=>`<mxGraphModel>
|
|
7
7
|
<root version="1.1">
|
|
8
8
|
<mxCell id="0" />
|
|
9
9
|
<mxCell id="1" parent="0" />
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
<mxGeometry as="geometry" relative="1" />
|
|
37
37
|
</mxCell>
|
|
38
38
|
</root>
|
|
39
|
-
</mxGraphModel>`,td=(e,t)=>{if(!e.length&&!t.length)return jn;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var Pg=e=>{let t=Object.values(qn),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=Bc[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},Lg=(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=zc(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},kg=(e,t)=>{let o=[];return e.forEach(n=>{var a,s;let r=(s=(a=Fc)[n.type])==null?void 0:s.call(a,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=Wc(n,t);o.push(l)}}),o},Rg=(e,t)=>{let o=[];return e.forEach(n=>{let r=Yc(n,t);o.push(r)}),o},od=(e=[],t=[],o)=>{let n=kg(e,o),r=Rg(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return Rc(JSON.stringify(i),{compact:!0,spaces:0})},nd=async e=>{var c,d,u,f,p;let t=await vi(e),o=((d=(c=t==null?void 0:t.mxGraphModel)==null?void 0:c.root)==null?void 0:d.mxCell)||[],n=Number(((p=(f=(u=t==null?void 0:t.mxGraphModel)==null?void 0:u.root)==null?void 0:f._attributes)==null?void 0:p.lastId)||jn),r=Pg(o),i=Lg(o,r),a=Jn(r),{nodes:s,edges:l}=Kc(a,i);return{lastElementId:n,edges:l,nodes:So(s)}};var it=require("@xyflow/react"),Mi=require("react");var er=require("@xyflow/react");var As=require("react/jsx-runtime"),te=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=Mt(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,As.jsx)(er.Handle,T({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 before:pointer-events-none":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent before:pointer-events-none":!s},o)},r))},Ke=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=Mt(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,er.useReactFlow)(),f=(()=>{if(n!=="source")return!1;let p=c();if(t==="TASK")return p.filter(y=>y.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return p.filter(y=>y.source===e).length>=2;if(t==="START_EVENT"){let g=d();return p.filter(m=>{if(m.source!==e)return!1;let _=g.find(h=>h.id===m.target);return(_==null?void 0:_.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,As.jsx)(er.Handle,T({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 before:pointer-events-none":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent before:pointer-events-none":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":f,"hover:border-grey-500":!f},i),style:{pointerEvents:f?"none":"auto"}},a))};var Ai=require("@xyflow/react"),rd=require("lodash");var id=require("react/jsx-runtime"),gn=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=Mt(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,Ai.useReactFlow)(),{isMultipleSelection:l}=Q(),c=({width:u,height:f})=>{if(!e)return;let p=i(e);if((p==null?void 0:p.type)!=="LANE")return;let g=[...a()],y=!p.parentId,m=y?p.id:p.parentId,_=g.filter(w=>w.type==="LANE"&&w.parentId===m);if(!_.length)return;let h=(0,rd.orderBy)(_,["position.y"]),E=0;h.forEach((w,b)=>{var I,A;let x=b===h.length-1,N=(A=(I=w.measured)==null?void 0:I.height)!=null?A:0;g=g.map(M=>{if(M.id===w.id){let S=y?u-ke.HEADER_WIDTH:u,k=v(T({},M),{width:S,measured:v(T({},M.measured),{width:S}),position:v(T({},M.position),{y:E})});return x&&y&&(k.height=f-E),k}return M}),E+=N}),g=g.map(w=>{if(w.id===m){let b=y?u:u+ke.HEADER_WIDTH;return v(T({},w),{width:b,height:y?f:E,measured:{width:b,height:y?f:E}})}return w}),s(g)};return(0,id.jsx)(Ai.NodeResizer,T({nodeId:e,handleClassName:"size-1.5 bg-blue-400 relative before:content-[''] before:absolute before:w-5 before:h-5 before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:cursor-[inherit]",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(u,f)=>c(f)},o))};var Si=require("@xyflow/react"),Ht=require("@produto-lecom/lecom-ui"),rt=require("react");var sd=require("zustand"),hn=(0,sd.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var Ii=require("react"),ad=(e,t=!1)=>{let[o,n]=(0,Ii.useState)({width:0,height:0});return(0,Ii.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var co=require("@xyflow/react"),ld=require("react"),Dg=120,Og=12,cd=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,co.useReactFlow)(),{instanceId:i}=Q();return(0,ld.useMemo)(()=>{var p,g;if(!t)return{position:co.Position.Right,align:"start"};let a=n(e);if(!a)return{position:co.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((p=a.measured)==null?void 0:p.width)||a.width||100)*s.zoom,d=(g=document.getElementById(`modeler-${i}`))==null?void 0:g.clientWidth;if(!d)return{position:co.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||Dg;return{position:l+c+u+Og>d?co.Position.Left:co.Position.Right}},[i,e,t,o,n,r])};var Ci=require("@xyflow/react"),fe=require("@produto-lecom/lecom-ui"),dd=require("lucide-react");var _e=require("react/jsx-runtime"),ud=({nodeId:e})=>{let{t}=(0,fe.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Ci.useReactFlow)(),i=(0,Ci.useNodesData)(e),s=n().filter(p=>p.source===e).some(p=>{let g=r(p.target);return(g==null?void 0:g.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=u=>{o(e,{variant:(i==null?void 0:i.data.variant)===u?"":u})},d=u=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===u?"":u})};return(0,_e.jsxs)(fe.DropdownMenu,{children:[(0,_e.jsxs)(fe.Tooltip,{children:[(0,_e.jsx)(fe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(fe.DropdownMenuTrigger,{asChild:!0,children:(0,_e.jsx)(fe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,_e.jsx)(dd.WrenchIcon,{})})})}),(0,_e.jsx)(fe.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,_e.jsxs)(fe.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,_e.jsxs)(fe.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,_e.jsx)("div",{className:"flex-1 body-medium-500",children:t("bpmn.task.menu.title")}),(0,_e.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Ar).map(([u,f])=>{let p=u==="LOOP"&&(s||l),y=(()=>{if(u==="LOOP"&&s)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(u==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess");if(u==="LOOP")return t("editor.task_menu.loop")})();return(0,_e.jsxs)(fe.Tooltip,{children:[(0,_e.jsx)(fe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(fe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:p,className:D({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":p}),onClick:p?void 0:()=>d(u),children:(0,_e.jsx)(f.icon,{className:"stroke-inherit"})})}),y&&(0,_e.jsx)(fe.TooltipContent,{color:"black",children:y})]},u)})})]}),(0,_e.jsx)(fe.DropdownMenuGroup,{children:(0,_e.jsxs)(fe.Tooltip,{children:[(0,_e.jsx)(fe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)("div",{className:D({"cursor-not-allowed":s}),children:(0,_e.jsxs)(fe.DropdownMenuItem,{className:D({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50":s}),disabled:s,onClick:()=>c("SCRIPT"),children:[(0,_e.jsx)(wr.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})})}),s&&(0,_e.jsx)(fe.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var Te=require("react/jsx-runtime"),Mo={START_EVENT:{type:"START_EVENT",icon:Mn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Bo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:Mn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:_r,label:"bpmn.annotation.variant.default"}},Vg={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Fo,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Xo,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:zo,label:"bpmn.gateway.variant.complex"}},tt=({nodeId:e,nodeType:t,nodeVariant:o})=>{let n=(0,rt.useRef)(null),r=(0,rt.useRef)(null),{t:i}=(0,Ht.useTranslation)(),{setDraggableNode:a}=hn(),{getEdges:s,getNodes:l,getNode:c}=(0,Si.useReactFlow)(),{setIsDragging:d,mode:u,isConnecting:f,isDragging:p,isMultipleSelection:g}=Q(),y=c(e),m=!!(y!=null&&y.selected)&&!y.dragging&&!f&&!p&&!g,{dimensions:_}=ad(n,m),{position:h}=cd(e,m,_),[E,w]=(0,rt.useState)(void 0),b=l(),x=s(),N=o==="SUBPROCESS",I=(0,rt.useRef)(null),A=(0,rt.useRef)(!1),M=(0,rt.useCallback)(()=>{I.current!==null&&(clearTimeout(I.current),I.current=null),A.current=!1,d(!1),a(null),w(void 0)},[d,a]);(0,rt.useEffect)(()=>{let L=H=>{A.current&&H.buttons===0&&M()};return document.addEventListener("dragend",M),document.addEventListener("mousemove",L),()=>{document.removeEventListener("dragend",M),document.removeEventListener("mousemove",L)}},[M]);let S=(0,rt.useCallback)((L,H)=>{A.current=!0,d(!1),a({type:H.type,variant:H.variant,attribute:H.attribute,icon:H.icon}),H.icon&&w((0,Te.jsx)(H.icon,{})),L.dataTransfer.effectAllowed="move",L.dataTransfer.setData("sourceId",e),r.current&&L.dataTransfer.setDragImage(r.current,10,10),I.current=setTimeout(()=>{I.current=null,d(!0)},100)},[e,a,d]),k=(0,rt.useCallback)(()=>{M()},[M]),B=[{component:(0,Te.jsx)(pi,{elementId:e})}],q=()=>{if(u==="view")return[];let L=!x.some(H=>{var F;return H.source===e&&((F=b.find(Y=>Y.id===H.target))==null?void 0:F.type)!=="ANNOTATION"});return[{component:(0,Te.jsx)(Co,{nodeId:e,disabled:!L,tooltipMessage:L?void 0:i("editor.toolbar.start_event_limit_reached")})},Mo.TASK,Mo.ANNOTATION,...B]},j=()=>u==="view"?[{component:(0,Te.jsx)(ao,{elementId:e})}]:[{component:(0,Te.jsx)(ao,{elementId:e})},...N?[]:[{component:(0,Te.jsx)(ud,{nodeId:e})}],{component:(0,Te.jsx)(Co,{nodeId:e})},Mo.TASK,...Object.values(Vg),...B],C=()=>u==="view"?[{component:(0,Te.jsx)(ao,{elementId:e})}]:[{component:(0,Te.jsx)(ao,{elementId:e})},{component:(0,Te.jsx)(Co,{nodeId:e})},Mo.TASK,Mo.ANNOTATION,...B],P=()=>u==="view"?[]:[{component:(0,Te.jsx)(Co,{nodeId:e})},Mo.ANNOTATION,...B],$=()=>u==="view"?[]:[{component:(0,Te.jsx)(Co,{nodeId:e})},Mo.ANNOTATION,...B],V=()=>u==="view"?[]:[{component:(0,Te.jsx)(Co,{nodeId:e})},...B],R=()=>u==="view"?[]:[...B],K=(L=>{switch(L){case"START_EVENT":return q();case"TASK":return j();case"GATEWAY":return C();case"END_EVENT":return P();case"LANE":return $();case"ANNOTATION":return V();case"UNSUPPORTED":return R();default:return[]}})(t);if(!(K.length===0||u==="readonly"))return(0,Te.jsxs)(Si.NodeToolbar,{position:h,align:"start",className:"-top-8",isVisible:m,children:[(0,Te.jsx)("div",{ref:n,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:K.map((L,H)=>{if(L.component)return(0,Te.jsx)("div",{children:L.component},H);let F={sourceNodeType:t,targetNodeType:L.type,sourceNodeId:e,nodes:b,edges:x},Y=fc(F),O={gateway_limit_reached:i("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:i("editor.toolbar.start_event_limit_reached"),start_event_already_exists:i("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:i("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:i("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:i("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:i("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:i("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:i("editor.toolbar.task_limit_reached")},J=Y.shouldDisable&&Y.reason?O[Y.reason]||i(L.label):i(L.label)||"";return(0,Te.jsxs)(Ht.Tooltip,{children:[(0,Te.jsx)(Ht.TooltipTrigger,{asChild:!0,children:(0,Te.jsx)(Ht.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:U=>S(U,L),onDragEnd:Y.shouldDisable?void 0:k,children:L.icon&&(0,Te.jsx)(L.icon,{size:16})})}),(0,Te.jsx)(Ht.TooltipContent,{color:"black",children:J})]},H)})}),(0,Te.jsx)("div",{ref:r,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:E})]})};var Be=require("react/jsx-runtime"),pd=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r,setNodes:i}=(0,it.useReactFlow)(),{inProgress:a,fromNode:s}=(0,it.useConnection)(),{mode:l}=Q(),c=a&&(s==null?void 0:s.id)!==e,d=(0,Mi.useCallback)(p=>{let h=p.split(`
|
|
40
|
-
`),E=h.reduce((N,I)=>Math.max(N,I.length),0),w=h.length,b=Math.max(dn.MIN_WIDTH,E*7+32),x=Math.max(dn.MIN_HEIGHT,w*20+24);i(N=>N.map(I=>I.id===e?v(T({},I),{width:b,height:x,style:v(T({},I.style),{width:b,height:x})}):I))},[e,i]),u=(0,Mi.useCallback)(p=>{r(e,{label:p}),d(p)},[e,r,d]),f=(0,Mi.useCallback)(p=>{d(p)},[d]);return(0,Be.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,Be.jsx)(Xe,{value:t.label,className:"m-1 text-grey-600 text-left",onChange:u,onInput:f,skipFirstCharValidation:!0}),(0,Be.jsx)(tt,{nodeId:e,nodeType:"ANNOTATION"}),l==="edit"&&(0,Be.jsx)(gn,{minWidth:dn.MIN_WIDTH,minHeight:dn.MIN_HEIGHT,isVisible:!n&&o}),!a&&(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(te,{type:"source",position:it.Position.Left,id:"left"}),(0,Be.jsx)(te,{type:"source",position:it.Position.Right,id:"right"}),(0,Be.jsx)(te,{type:"source",position:it.Position.Top,id:"top"}),(0,Be.jsx)(te,{type:"source",position:it.Position.Bottom,id:"bottom"})]}),(!a||c)&&(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(te,{type:"target",position:it.Position.Left,id:"left",className:D({"annotation-handle":c})}),(0,Be.jsx)(te,{type:"target",position:it.Position.Right,id:"right",className:D({"annotation-handle":c})}),(0,Be.jsx)(te,{type:"target",position:it.Position.Top,id:"top",className:D({"annotation-handle":c})}),(0,Be.jsx)(te,{type:"target",position:it.Position.Bottom,id:"bottom",className:D({"annotation-handle":c})})]})]})};var st=require("@xyflow/react"),fd=require("react");var Re=require("react/jsx-runtime"),md=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,st.useReactFlow)(),{inProgress:r,fromNode:i}=(0,st.useConnection)(),{reconnectingEdgeId:a}=Q(),[s,l]=(0,fd.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!a,d=p=>{n(e,{label:p})},u=()=>{l(!0)},f=()=>{l(!1)};return(0,Re.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,Re.jsx)(Bo,{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,Re.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Re.jsx)(Xe,{value:t.label,isEditing:s,onBlur:f,onChange:d})}),(0,Re.jsx)(tt,{nodeId:e,nodeType:"END_EVENT"}),(!r||c)&&(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(te,{type:"target",position:st.Position.Left,id:"left",className:D({"event-handle":c})}),(0,Re.jsx)(te,{type:"target",position:st.Position.Right,id:"right",className:D({"event-handle":c})}),(0,Re.jsx)(te,{type:"target",position:st.Position.Top,id:"top",className:D({"event-handle":c})}),(0,Re.jsx)(te,{type:"target",position:st.Position.Bottom,id:"bottom",className:D({"event-handle":c})})]}),!r&&(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(te,{type:"source",position:st.Position.Left,id:"left"}),(0,Re.jsx)(te,{type:"source",position:st.Position.Right,id:"right"}),(0,Re.jsx)(te,{type:"source",position:st.Position.Top,id:"top"}),(0,Re.jsx)(te,{type:"source",position:st.Position.Bottom,id:"bottom"})]})]})};var at=require("@xyflow/react"),Pi=require("react");var De=require("react/jsx-runtime"),gd=({id:e,data:t,selected:o})=>{let n=ji[t.variant].icon,{updateNodeData:r}=(0,at.useReactFlow)(),{inProgress:i,fromNode:a}=(0,at.useConnection)(),{reconnectingEdgeId:s}=Q(),[l,c]=(0,Pi.useState)(!1),d=i&&(a==null?void 0:a.id)!==e||!!s,u=(0,Pi.useCallback)(g=>{r(e,{label:g})},[e,r]),f=()=>{c(!0)},p=()=>{c(!1)};return(0,De.jsxs)("div",{className:"relative",onDoubleClick:f,children:[(0,De.jsx)(n,{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,De.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,De.jsx)(Xe,{value:t.label,isEditing:l,onBlur:p,onChange:u})}),(0,De.jsx)(tt,{nodeId:e,nodeType:"GATEWAY"}),(!i||d)&&(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(te,{type:"target",position:at.Position.Left,id:"left",className:D({"gateway-handle":d})}),(0,De.jsx)(te,{type:"target",position:at.Position.Right,id:"right",className:D({"gateway-handle":d})}),(0,De.jsx)(te,{type:"target",position:at.Position.Top,id:"top",className:D({"gateway-handle":d})}),(0,De.jsx)(te,{type:"target",position:at.Position.Bottom,id:"bottom",className:D({"gateway-handle":d})})]}),!i&&(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(Ke,{type:"source",position:at.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ke,{type:"source",position:at.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ke,{type:"source",position:at.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ke,{type:"source",position:at.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var hd=require("@xyflow/react"),vt=require("@produto-lecom/lecom-ui"),Hg=require("lucide-react");var yd=require("react/jsx-runtime");var lt=require("@xyflow/react"),xd=require("react");var Oe=require("react/jsx-runtime"),Ed=({id:e,data:t,selected:o})=>{let{updateNodeData:n}=(0,lt.useReactFlow)(),{inProgress:r,fromNode:i}=(0,lt.useConnection)(),{reconnectingEdgeId:a}=Q(),[s,l]=(0,xd.useState)(!1),c=r&&(i==null?void 0:i.id)!==e||!!a,d=p=>{n(e,{label:p})},u=()=>{l(!0)},f=()=>{l(!1)};return(0,Oe.jsxs)("div",{className:"relative",onDoubleClick:u,children:[(0,Oe.jsx)(vr,{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,Oe.jsx)("div",{className:"absolute top-10 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Oe.jsx)(Xe,{value:t.label,isEditing:s,onBlur:f,onChange:d})}),(0,Oe.jsx)(tt,{nodeId:e,nodeType:"START_EVENT"}),(!r||c)&&(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(te,{type:"target",position:lt.Position.Left,id:"left",className:D({"event-handle":c})}),(0,Oe.jsx)(te,{type:"target",position:lt.Position.Right,id:"right",className:D({"event-handle":c})}),(0,Oe.jsx)(te,{type:"target",position:lt.Position.Top,id:"top",className:D({"event-handle":c})}),(0,Oe.jsx)(te,{type:"target",position:lt.Position.Bottom,id:"bottom",className:D({"event-handle":c})})]}),!r&&(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Ke,{type:"source",position:lt.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ke,{type:"source",position:lt.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ke,{type:"source",position:lt.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ke,{type:"source",position:lt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var Nd=require("@produto-lecom/lecom-ui"),ct=require("@xyflow/react"),rr=require("react");var tr=60,Li=(e,t)=>{var a;let o=[],n=`${t} `;for(let s of e){if(!(s.type==="TASK"))continue;let c=(a=s.data)==null?void 0:a.label;if(c&&c.startsWith(n)){let d=c.substring(n.length);/^\d{1,15}$/.test(d)&&o.push(parseInt(d,10))}}let r=o.length>0?Math.max(...o)+1:1,i=`${t} ${r}`;return i.length<=tr?i:i.substring(0,tr).trim()},yn=(e,t)=>{var s;let o=new Set;for(let l of t)l.type==="TASK"&&((s=l.data)!=null&&s.label)&&o.add(l.data.label);let n=e;if(n.length>tr&&(n=n.substring(0,tr).trim()),!o.has(n))return n;let r=n.replace(/\s+\(\d+\)$/,""),i=2,a=o.size+2;for(;i<=a;){let l=` (${i})`,c=tr-l.length,u=`${r.substring(0,c).trim()}${l}`;if(!o.has(u))return u;i++}return n};var or=require("react/jsx-runtime"),bd=e=>(0,or.jsxs)("svg",v(T({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,or.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,or.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var Is=require("react/jsx-runtime"),_d=e=>(0,Is.jsx)("svg",v(T({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,Is.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z",fill:"#38bdf8"})}));var nr=require("react/jsx-runtime"),Td=e=>(0,nr.jsxs)("svg",v(T({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,nr.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,nr.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ie=require("react/jsx-runtime"),Gg={APROVADO:bd,EM_ANDAMENTO:_d,REJEITADO:Td},Cs={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)]"},vd=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,Nd.useTranslation)(),{toast:i}=je(),{updateNodeData:a,getNodes:s,setNodes:l}=(0,ct.useReactFlow)(),{inProgress:c,fromNode:d}=(0,ct.useConnection)(),{mode:u,onSubprocessValidationClick:f,reconnectingEdgeId:p}=Q(),{getTaskStatus:g}=Eo(),y=c&&(d==null?void 0:d.id)!==e||!!p,m=g(e),_=t.variant==="SUBPROCESS",h=!!t.variant&&!_||!!m,E=!!t.attribute||_,w=(0,rr.useCallback)(B=>{let P=h||E?80:40,$=B.split(`
|
|
41
|
-
`),V=$.reduce((L,H)=>Math.max(L,H.length),0),R=$.length,G=Math.max(cn.MIN_WIDTH,V*7+64),K=Math.max(cn.MIN_HEIGHT,R*24+P);l(L=>L.map(H=>H.id===e?v(T({},H),{width:G,height:K,style:v(T({},H.style),{width:G,height:K})}):H))},[e,l,h,E]),b=(0,rr.useCallback)(B=>{let q=B.trim(),j=t.label||"";if(q===j)return;let C=q,P=s();if(!(q&&q!=="")){C=Li(P,r("bpmn.task.label.prefix")),a(e,{label:C}),w(C),i({variant:"warning",content:(0,ie.jsxs)(ie.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,ie.jsx)("strong",{children:C})]})});return}let V=yn(C,P);V===j||(a(e,{label:V}),w(V),V!==C&&i({variant:"warning",content:(0,ie.jsxs)(ie.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,ie.jsx)("strong",{children:q})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,ie.jsx)("strong",{children:V})]})}))},[t.label,s,e,r,a,w,i]),x=(0,rr.useCallback)(B=>{w(B)},[w]),N=(0,rr.useCallback)(()=>{i({variant:"error",content:r("bpmn.task.feedback.invalid_first_character")})},[r,i]),I=m?Gg[m]:null,A=t.variant?wr[t.variant].icon:null,M=t.attribute?Ar[t.attribute].icon:null,S=()=>t.hasError?Cs.error:m?Cs[m]:Cs.default,k=()=>{f==null||f({id:e,type:"sub_process",label:t.label})};return(0,ie.jsxs)("div",{className:D("relative w-full h-full min-w-44 min-h-24 flex flex-col items-stretch justify-stretch bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md hover:shadow-md transition-colors duration-75",S(),{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ie.jsx)("div",{className:"flex-1 flex items-stretch justify-stretch overflow-hidden",children:(0,ie.jsx)(Xe,{value:t.label,maxLength:60,className:D({"py-10 px-8":h||E}),onChange:b,onInput:x,onInvalidFirstCharacter:N})}),A&&(0,ie.jsx)("div",{className:D("absolute flex items-center p-1",_?"bottom-0 left-1/2 -translate-x-1/2":"top-0 left-0"),children:(0,ie.jsx)(A,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500",_&&"cursor-pointer"),onClick:_?k:void 0})}),M&&(0,ie.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ie.jsx)("div",{className:D("flex items-center w-16 p-1",_?"justify-between":"justify-center"),children:(0,ie.jsx)(M,{size:16,className:D(t.hasError?"text-red-500":"text-grey-500")})})}),I&&(0,ie.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,ie.jsx)(I,{})}),(0,ie.jsx)(tt,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant}),u==="edit"&&(0,ie.jsx)(gn,{minWidth:cn.MIN_WIDTH,minHeight:cn.MIN_HEIGHT,isVisible:!n&&o}),(!c||y)&&(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(te,{type:"target",position:ct.Position.Left,id:"left",className:D({"task-handle":y})}),(0,ie.jsx)(te,{type:"target",position:ct.Position.Right,id:"right",className:D({"task-handle":y})}),(0,ie.jsx)(te,{type:"target",position:ct.Position.Top,id:"top",className:D({"task-handle":y})}),(0,ie.jsx)(te,{type:"target",position:ct.Position.Bottom,id:"bottom",className:D({"task-handle":y})})]}),!c&&(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(Ke,{type:"source",position:ct.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,ie.jsx)(Ke,{type:"source",position:ct.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,ie.jsx)(Ke,{type:"source",position:ct.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,ie.jsx)(Ke,{type:"source",position:ct.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var Ss=require("@xyflow/react");var Zt=require("react/jsx-runtime"),wd=({id:e,data:t})=>(0,Zt.jsxs)(Zt.Fragment,{children:[(0,Zt.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,Zt.jsx)(tt,{nodeId:e,nodeType:"UNSUPPORTED"}),(0,Zt.jsx)(te,{type:"source",position:Ss.Position.Right}),(0,Zt.jsx)(te,{type:"target",position:Ss.Position.Left})]});var Ie=require("@xyflow/react"),ki=require("react");var xe=require("react/jsx-runtime"),Jw={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:Ie.MarkerType.Arrow},data:{label:""}},Ad=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var H;let{zoom:c}=(0,Ie.useViewport)(),{updateEdgeData:d}=(0,Ie.useReactFlow)(),{isMultipleSelection:u,mode:f,instanceId:p}=Q(),g=f!=="edit",[y,m]=(0,ki.useState)(!1),{reconnectingHandle:_,cursorPosition:h,hoveredNodeId:E,reconnectingSide:w,isValidReconnection:b,handleReconnectStart:x}=bi({edgeId:e,source:t,target:o,instanceId:p,isReadOnly:g}),N=(0,Ie.useInternalNode)(t),I=(0,Ie.useInternalNode)(o),{sx:A,sy:M,tx:S,ty:k,sourcePos:B,targetPos:q}=(0,ki.useMemo)(()=>{var ue,pe;if(!N||!I)return{sx:0,sy:0,tx:0,ty:0,sourcePos:Ie.Position.Left,targetPos:Ie.Position.Right};let F=Zo(N,I),Y=s?i:F.sourcePos,O=l?a:F.targetPos,J=(ge,he,Pe)=>{var ze,Ze,Jt,Ho,Go,Ve;let{x:Le,y:ve}=ge.internals.positionAbsolute,ce=(Jt=(Ze=(ze=ge.measured)==null?void 0:ze.width)!=null?Ze:ge.width)!=null?Jt:0,se=(Ve=(Go=(Ho=ge.measured)==null?void 0:Ho.height)!=null?Go:ge.height)!=null?Ve:0;switch(he){case Ie.Position.Top:return{x:Le+ce*Pe,y:ve};case Ie.Position.Bottom:return{x:Le+ce*Pe,y:ve+se};case Ie.Position.Left:return{x:Le,y:ve+se*Pe};case Ie.Position.Right:return{x:Le+ce,y:ve+se*Pe};default:return{x:Le+ce/2,y:ve+se/2}}},U=(ue=n==null?void 0:n.sourceOffset)!=null?ue:.5,X=(pe=n==null?void 0:n.targetOffset)!=null?pe:.5,z=N?J(N,Y,U).x:F.sx,W=N?J(N,Y,U).y:F.sy,Z=I?J(I,O,X).x:F.tx,ee=I?J(I,O,X).y:F.ty;return _==="source"&&h?(z=h.x,W=h.y,w&&(Y=w)):_==="target"&&h&&(Z=h.x,ee=h.y,w&&(O=w)),{sx:z,sy:W,tx:Z,ty:ee,sourcePos:Y,targetPos:O}},[N,I,s,l,i,a,_,h,w,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!N||!I)return null;let[j,C,P]=(0,Ie.getSmoothStepPath)({sourceX:A,sourceY:M,targetX:S,targetY:k,sourcePosition:B,targetPosition:q}),$=r||(N==null?void 0:N.selected)||(I==null?void 0:I.selected),V=$?"sequence-edge-marker-highlighted":"sequence-edge-marker",R=y||(n==null?void 0:n.label.trim().length)>0,G=()=>{m(!0)},K=()=>{m(!1)},L=F=>{d(e,{label:F.trim()})};return(0,xe.jsx)(xe.Fragment,{children:(0,xe.jsxs)("g",{onDoubleClick:G,children:[(0,xe.jsx)("path",{d:j,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/c),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,xe.jsxs)("g",{className:D("text-grey-500 hover:text-grey-600",{"text-blue-500 hover:text-blue-600":$}),children:[(0,xe.jsx)(Ie.BaseEdge,{id:e,path:j,interactionWidth:0,markerEnd:`url(#${V})`,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)||_&&E&&!b,"stroke-green-500":_&&E&&b,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":$&&!(n!=null&&n.hasError)&&!_})}),(0,xe.jsxs)(Ie.EdgeLabelRenderer,{children:[(0,xe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${P}px)`},children:[r&&!u&&(0,xe.jsx)(an,{sx:A,sy:M,tx:S,ty:k,hasLabel:!!((H=n==null?void 0:n.label)!=null&&H.trim()),children:(0,xe.jsx)(sn,{edgeId:e,edgeType:"MESSAGE_EDGE"})}),R&&(0,xe.jsx)(Xe,{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:y,onBlur:K,onChange:L})]}),r&&!u&&!g&&(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${A}px, ${M}px)`},children:(0,xe.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="source"?.6:.3,className:"pointer-events-none"}),(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:D("pointer-events-auto",{"cursor-move":!_||_!=="source","cursor-not-allowed":_==="source"&&E&&!b,"cursor-grabbing":_==="source"&&(!E||b)}),onMouseDown:F=>x("source",F.nativeEvent)})]})}),(0,xe.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${S}px, ${k}px)`},children:(0,xe.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:_==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:_==="target"?.6:.3,className:"pointer-events-none"}),(0,xe.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:D("pointer-events-auto",{"cursor-move":!_||_!=="target","cursor-not-allowed":_==="target"&&E&&!b,"cursor-grabbing":_==="target"&&(!E||b)}),onMouseDown:F=>x("target",F.nativeEvent)})]})})]})]})]})]})})};var Po=require("@xyflow/react"),ir=require("react/jsx-runtime"),Id=({toX:e,toY:t,fromNode:o})=>{var u,f;if(!o)return null;let{internals:{positionAbsolute:{x:n,y:r}},measured:i}=o,a=(u=i.width)!=null?u:0,s=(f=i.height)!=null?f:0,c=[{x:n,y:r+s/2,pos:Po.Position.Left},{x:n+a,y:r+s/2,pos:Po.Position.Right},{x:n+a/2,y:r,pos:Po.Position.Top},{x:n+a/2,y:r+s,pos:Po.Position.Bottom}].reduce((p,g)=>{let y=Math.hypot(e-p.x,t-p.y);return Math.hypot(e-g.x,t-g.y)<y?g:p}),[d]=(0,Po.getStraightPath)({sourceX:c.x,sourceY:c.y,targetX:e,targetY:t});return(0,ir.jsxs)("g",{children:[(0,ir.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-500 animated",d}),(0,ir.jsx)("circle",{cx:e,cy:t,fill:"none",r:4,className:"stroke-2 stroke-grey-600"})]})};var dt=require("@xyflow/react"),Cd=require("lodash"),sr=require("react");var Ne=require("react/jsx-runtime"),Sd=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,dt.useReactFlow)(),{mode:s}=Q(),{inProgress:l,fromNode:c}=(0,dt.useConnection)(),d=l&&(c==null?void 0:c.id)!==e,[u,f]=(0,sr.useState)(!1),p=a(),g=!r,y=(0,sr.useMemo)(()=>(0,Cd.orderBy)([...p.filter(b=>b.parentId===e&&b.type==="LANE")],"position.y","asc"),[p,e]),m=g?wi.MIN_WIDTH:ke.MIN_WIDTH,_=(0,sr.useMemo)(()=>{if(g&&y.length>1){let b=[...y];return b.pop(),b.reduce((N,I)=>{var A,M;return N+((M=(A=I.measured)==null?void 0:A.height)!=null?M:0)},0)+ke.MIN_HEIGHT}return ke.MIN_HEIGHT},[g,y]),h=b=>{i(e,{label:b})},E=()=>{f(!0)},w=()=>{f(!1)};return(0,Ne.jsxs)(Ne.Fragment,{children:[(0,Ne.jsxs)("div",{className:D("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-1 outline-grey-300",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,Ne.jsx)("div",{className:"flex align-items justify-center w-10 border-r border-grey-300",onDoubleClick:E,children:(0,Ne.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,Ne.jsx)(Xe,{value:t.label,className:"w-full h-full self-auto",contentClassName:D({"whitespace-nowrap":u}),isEditing:u,onBlur:w,onChange:h})})}),(0,Ne.jsx)("div",{className:"flex-1"})]}),(0,Ne.jsx)(tt,{nodeId:e,nodeType:"LANE",isChild:!g}),s==="edit"&&(0,Ne.jsx)(gn,{nodeId:e,minWidth:m,minHeight:_,isVisible:!n&&o}),!l&&(0,Ne.jsxs)(Ne.Fragment,{children:[(0,Ne.jsx)(te,{type:"source",position:dt.Position.Left,id:"left"}),(0,Ne.jsx)(te,{type:"source",position:dt.Position.Right,id:"right"}),(0,Ne.jsx)(te,{type:"source",position:dt.Position.Top,id:"top"}),(0,Ne.jsx)(te,{type:"source",position:dt.Position.Bottom,id:"bottom"})]}),(!l||d)&&(0,Ne.jsxs)(Ne.Fragment,{children:[(0,Ne.jsx)(te,{type:"target",position:dt.Position.Left,id:"left",className:D({"annotation-handle":d})}),(0,Ne.jsx)(te,{type:"target",position:dt.Position.Right,id:"right",className:D({"annotation-handle":d})}),(0,Ne.jsx)(te,{type:"target",position:dt.Position.Top,id:"top",className:D({"annotation-handle":d})}),(0,Ne.jsx)(te,{type:"target",position:dt.Position.Bottom,id:"bottom",className:D({"annotation-handle":d})})]})]})};var Md={START_EVENT:Ed,END_EVENT:md,TASK:vd,GATEWAY:gd,ANNOTATION:pd,LANE:Sd,UNSUPPORTED:wd},Pd={SEQUENCE_EDGE:Pc,MESSAGE_EDGE:Ad,ANNOTATION_EDGE:Nc},Ld="#fafafa",kd="#bebebe",Rd=1,Dd=10,Od="bottom-left",Ms=.05,Vd=5,xn=.5,En=Ms,bn=1,Hd={x:0,y:0,zoom:.75},Gd=1,Bd=2,Bg={[Gd]:4,[Bd]:2},Ri=[Gd,Bd],zd=Ri.reduce((e,t)=>e|Bg[t],0);var Yd=require("@xyflow/react");var Et=()=>{let{getEdges:e,getNodes:t}=(0,Yd.useReactFlow)(),{lastElementId:o}=Q(),n=()=>{let i=t(),a=e(),s=td(i,a);return Math.max(s,o)};return{getLastId:n,getNextId:()=>n()+1}};var Tn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,setViewport:r}=(0,_n.useReactFlow)(),{getLastId:i}=Et(),a=(0,_n.useStoreApi)(),{setLastElementId:s}=Q(),l=(0,Ps.useCallback)(async(d="")=>{let{nodes:u,edges:f,lastElementId:p}=await nd(d),{width:g,height:y}=a.getState();if(g>0&&y>0){let m=qc(u);m&&r((0,_n.getViewportForBounds)(m,g,y,En,bn,xn))}o(u),n(f),s(p)},[o,n,s,a,r]),c=(0,Ps.useCallback)(()=>{let d=e(),u=t(),f=i();return od(d,u,f)},[e,t,i]);return{importFromMxGraph:l,exportToMxGraph:c}};var Ls=require("react"),zg=500,Di=()=>{let{isInitialized:e,onElementChanges:t}=Q(),{exportToMxGraph:o}=Tn(),n=(0,Fd.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},zg),r=(0,Ls.useCallback)(a=>{a.every(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Ls.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var Wd=({setEdges:e,saveHistory:t})=>{let{getNode:o,getEdges:n,getNodes:r,getInternalNode:i}=(0,Oi.useReactFlow)(),{emitElementChanges:a}=Di(),s=(0,Gt.useRef)(null),{getNextId:l}=Et(),c=(0,Gt.useCallback)(m=>{var b;let _=o(m.source),h=o(m.target);if(!_||!h)return!1;let E={sourceNodeId:_.id,targetNodeId:h.id,sourceNodeType:_.type,targetNodeType:h.type,nodes:r(),edges:n(),reconnectingEdgeId:(b=s.current)!=null?b:void 0};return ys(E).isValid},[o,n,r]),d=(0,Gt.useCallback)(m=>{var E,w;let _=l(),h=i(m.source);if(h){let b=i(m.target),x=b?b.internals.positionAbsolute.x+((E=b.measured.width)!=null?E:0)/2:0,N=b?b.internals.positionAbsolute.y+((w=b.measured.height)!=null?w:0)/2:0,I=Lc(h,x,N),A=(b==null?void 0:b.type)==="ANNOTATION"||(h==null?void 0:h.type)==="ANNOTATION",M=A?ln:xt,S;if(!A&&b&&m.targetHandle){let q=Ti(I),j=Ti(m.targetHandle),{x:C,y:P}=_s(h,I),{x:$,y:V}=_s(b,m.targetHandle),G=xi(C,P,$,V,q,j).slice(1,-1);G.length>0&&(S=G)}let k=v(T(T({},m),M),{id:String(_),sourceHandle:I,data:T(T({},A?{}:xt.data),S?{points:S}:{})}),B=n().concat(k);e(B),t("forceSave",{nodes:r(),edges:B}),a()}},[l,e,a,i,n,r,t]),u=(0,Gt.useCallback)((m,_)=>{s.current=_.id},[]),f=(0,Gt.useCallback)(()=>{s.current=null},[]),p=(0,Gt.useCallback)((m,_)=>{let h=o(_.source),E=o(_.target);if(!h||!E){s.current=null;return}let w={sourceNodeId:h.id,targetNodeId:E.id,sourceNodeType:h.type,targetNodeType:E.type,nodes:r(),edges:n(),reconnectingEdgeId:m.id};if(!ys(w).isValid){s.current=null;return}let x=(0,Oi.reconnectEdge)(m,_,n()).map(N=>N.id===m.id?v(T({},N),{data:v(T({},N.data),{points:void 0})}):N);e(x),t("forceSave",{nodes:r(),edges:x}),s.current=null,a()},[o,r,n,e,a,t]),g=(0,Gt.useCallback)(m=>{s.current=m},[]),y=(0,Gt.useCallback)(()=>{s.current=null},[]);return{isValidConnection:c,onConnect:d,onReconnect:p,onReconnectStart:u,onReconnectEnd:f,setReconnectingEdge:g,clearReconnectingEdge:y}};var jd=require("@produto-lecom/lecom-ui"),eu=require("@xyflow/react"),wt=require("react");var ar=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Lo=(e=[])=>e.filter(t=>t.type==="END_EVENT"),uo=(e=[])=>e.filter(t=>t.type==="TASK")||[],Xd=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ud=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Vi=(e=[])=>e.filter(t=>t.type==="GATEWAY"),$d=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),ut=(e,t=[])=>t.filter(o=>o.source===e),lr=(e,t=[])=>t.filter(o=>o.target===e),Kd=(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"},qd=(e,t)=>{let o=ut(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},Zd=e=>e?/[^\s]/.test(e.trim()):!1,ye=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:[]}},Bt=(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)}},Jd=(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 cr=[{id:"start_event_not_found",validate:e=>{let t=ar(e.nodes);return ye({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Lo(e.nodes);return ye({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=ar(e.nodes),o=t.length===1;if(t.length===0)return ye({isValid:!0});if(!o)return ye({isValid:!1,nodeIds:t.map(i=>i.id)});let n=ut(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return ye({isValid:!1,nodeIds:[...new Set(i)]})}return ye({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=uo(e.nodes),o=Bt(t,n=>ut(n.id,e.edges).length<=2);return ye({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=uo(e.nodes),o=Bt(t,n=>!!n.label&&n.label.trim()!=="");return ye({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=uo(e.nodes),n=Bt(o,r=>!r.label||r.label.length<=60);return ye({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=uo(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 ye({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Vi(e.nodes),o=[],n=[];for(let r of t){let i=ut(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 ye({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...ar(e.nodes),...Lo(e.nodes)],o=[],n=[];for(let r of t){let i=ut(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 ye({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Lo(e.nodes),o=[],n=[];for(let r of t){let i=lr(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=ut(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return ye({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=$d(e.nodes),o=Bt(t,r=>ut(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>ut(r,e.edges).map(i=>i.id));return ye({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=uo(e.nodes),o=Bt(t,n=>!n.label||Zd(n.label));return ye({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 ye({isValid:!0});let t=Lo(e.nodes)[0];if(!t)return ye({isValid:!0});let o=lr(t.id,e.edges);if(!o.length)return ye({isValid:!0});let r=uo(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Bt(r,l=>!Kd(l.id,e));return ye({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=uo(e.nodes),o=Lo(e.nodes)[0];if(!o)return ye({isValid:!0});let n=t.filter(l=>{let c=lr(l.id,e.edges),d=ut(l.id,e.edges),u=c.some(p=>{var g;return((g=e.nodes.find(y=>y.id===p.source))==null?void 0:g.type)==="START_EVENT"}),f=d.some(p=>{var g;return((g=e.nodes.find(y=>y.id===p.target))==null?void 0:g.type)==="END_EVENT"});return u&&f}),r=lr(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 ye(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=Vi(e.nodes),o=[],n=[];for(let r of t){let i=ut(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 ye({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Vi(e.nodes),o=Bt(t,n=>ut(n.id,e.edges).length>=1);return ye({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...ar(e.nodes),...Lo(e.nodes)],o=[],n=[];for(let r of t){let i=ut(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 ye({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Xd(e.nodes),o=Bt(t,n=>!qd(n.id,e));return ye({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ud(e.nodes),o=Bt(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 ye({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Qd=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of cr){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 ko=require("react/jsx-runtime"),tu=()=>{let{t:e}=(0,jd.useTranslation)(),{toast:t}=je(),{setNodes:o,setEdges:n,getNodes:r,getEdges:i}=(0,eu.useReactFlow)(),[a,s]=(0,wt.useState)(!1),l=(0,wt.useRef)(!1),c=(0,wt.useRef)(!1),d=(0,wt.useCallback)(y=>{let m=Jd(y.nodes,y.edges),_=Qd(m),h=_.errors.map(E=>v(T({},E),{message:e(`validation.errors.${E.id}`)}));return a||s(!0),{isValid:_.isValid,errors:h}},[a,e]),u=(0,wt.useCallback)((y,m=!0)=>{if(m&&y&&t({variant:y.isValid?"success":"error",duration:5e3,title:y.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,ko.jsxs)("div",{className:"flex flex-col gap-1",children:[!y.isValid&&(0,ko.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,ko.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:y.isValid?(0,ko.jsx)("li",{children:e("validation.success.message")}):y.errors.map(S=>(0,ko.jsx)("li",{className:"text-xs",children:S.message},S.id))})]})}),!y)return;l.current=!0,c.current=!0;let _=[],h=[];y.errors.forEach(S=>{S.nodeIds&&S.nodeIds.length>0&&S.nodeIds.forEach(k=>_.push(k)),S.edgeIds&&S.edgeIds.length>0&&S.edgeIds.forEach(k=>h.push(k))});let E=[...new Set(_)];o(S=>S.map(k=>v(T({},k),{data:v(T({},k.data),{hasError:!1})}))),n(S=>S.map(k=>v(T({},k),{data:v(T({},k.data),{hasError:!1})})));let w=r(),b=i(),x=new Set(E),N=new Set;y.errors.forEach(S=>{var q,j;let k=cr.find(C=>C.id===S.id);(k==null?void 0:k.highlightRelatedEdges)!==!1&&((q=S.edgeIds)==null||q.forEach(C=>N.add(C)),(j=S.nodeIds)==null||j.forEach(C=>{b.forEach(P=>{(P.source===C||P.target===C)&&N.add(P.id)})}))});let I=new Set,A=new Set,M=new Set;w.forEach(S=>{S.type==="START_EVENT"?I.add(S.id):S.type==="END_EVENT"&&A.add(S.id)}),b.forEach(S=>{I.has(S.source)&&M.add(S.target),A.has(S.target)&&M.add(S.source)}),M.forEach(S=>{var k,B;if(x.has(S)){let q=(k=y.errors.find(C=>{var P;return(P=C.nodeIds)==null?void 0:P.includes(S)}))==null?void 0:k.id;((B=cr.find(C=>C.id===q))==null?void 0:B.highlightRelatedEdges)!==!1&&b.forEach(C=>{C.source===S&&A.has(C.target)&&(x.add(C.target),N.add(C.id)),C.target===S&&I.has(C.source)&&(x.add(C.source),N.add(C.id))})}}),x.size>0&&o(S=>S.map(k=>v(T({},k),{data:v(T({},k.data),{hasError:x.has(k.id)})}))),N.size>0&&n(S=>S.map(k=>v(T({},k),{data:v(T({},k.data),{hasError:N.has(k.id)})}))),setTimeout(()=>{l.current=!1},0)},[e,i,r,n,o,t]),f=(0,wt.useCallback)(()=>{s(!1),c.current=!1,o(y=>y.map(m=>v(T({},m),{data:v(T({},m.data),{hasError:!1})}))),n(y=>y.map(m=>v(T({},m),{data:v(T({},m.data),{hasError:!1})})))},[n,o]),p=(0,wt.useCallback)(()=>{c.current&&(l.current=!0,c.current=!1,o(y=>y.map(m=>v(T({},m),{data:v(T({},m.data),{hasError:!1})}))),n(y=>y.map(m=>v(T({},m),{data:v(T({},m.data),{hasError:!1})}))),setTimeout(()=>{l.current=!1},0))},[n,o]),g=(0,wt.useCallback)(()=>l.current,[]);return{validateDiagram:d,handleValidationComplete:u,clearValidation:f,dismissValidationPanel:p,isAutoValidationEnabled:a,getIsClearingValidation:g}};var ru=require("@xyflow/react"),iu=require("@produto-lecom/lecom-ui"),su=require("react");var Yg=15,ou="bpmn:selection",Fg=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},nu=e=>{if(!Fg(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},au=({offset:e=Yg,saveHistory:t})=>{let{t:o}=(0,iu.useTranslation)(),{getNodes:n,setNodes:r,getEdges:i,setEdges:a}=(0,ru.useReactFlow)(),{getNextId:s}=Et();(0,su.useEffect)(()=>{let l=d=>{var _,h;if(!nu(d))return;let u=n(),f=i(),p=u.filter(E=>E.selected);if(!p.length)return;d.preventDefault(),d.stopPropagation();let g=f.filter(E=>p.some(w=>w.id===E.source)&&p.some(w=>w.id===E.target)),m=JSON.stringify({nodes:p,edges:g});(_=d.clipboardData)==null||_.setData(ou,m),(h=d.clipboardData)==null||h.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},c=d=>{var N,I;if(!nu(d))return;let u=(N=d.clipboardData)==null?void 0:N.getData(ou);if(!u)return;d.preventDefault(),d.stopPropagation();let f;try{f=JSON.parse(u)}catch(A){return}if(!((I=f.nodes)!=null&&I.length))return;let p=new Map,g=n(),y=[],m=f.nodes.filter(A=>io(A.type,g));if(m.length===0)return;let _=s(),h=m.map(A=>{var k;let M=String(_++);p.set(A.id,M);let S=v(T({},A),{id:M,selected:!0,position:{x:A.position.x+e,y:A.position.y+e}});if(A.type==="TASK"){let B=(k=A.data)==null?void 0:k.label,q=yn(B||o("bpmn.task.label.prefix"),[...g,...y]);S.data=v(T({},A.data),{label:q})}return y.push(S),S}),E=f.edges.map(A=>v(T({},A),{id:String(_++),selected:!0,source:p.get(A.source)||A.source,target:p.get(A.target)||A.target})),w=[...g.map(A=>v(T({},A),{selected:!1})),...h],x=[...i().map(A=>v(T({},A),{selected:!1})),...E];r(w),a(x),t("forceSave",{nodes:w,edges:x})};return document.addEventListener("copy",l,!0),document.addEventListener("paste",c,!0),()=>{document.removeEventListener("copy",l,!0),document.removeEventListener("paste",c,!0)}},[n,r,i,a,s,e,o,t])};var Hi=require("@xyflow/react");var lu=require("@produto-lecom/lecom-ui"),cu=require("react");var du=({nodes:e,setNodes:t,setEdges:o,saveHistory:n})=>{let r=(0,Hi.useStoreApi)(),{draggableNode:i,setDraggableNode:a}=hn(),{t:s}=(0,lu.useTranslation)(),{getInternalNode:l,getNodes:c,getEdges:d,screenToFlowPosition:u}=(0,Hi.useReactFlow)(),{getNextId:f}=Et(),{setIsDragging:p}=Q(),{rebuildIndex:g,forceRebuildIndex:y}=ii(),[m,_]=(0,cu.useState)(null),h=(C,P=!1)=>{let $=P?"node-drop-target-error":"node-drop-target",V=P?"node-drop-target-lane-error":"node-drop-target-lane";t(R=>R.map(G=>G.id===C?v(T({},G),{className:$}):C!==void 0&&G.parentId===C&&G.type==="LANE"?v(T({},G),{className:V}):v(T({},G),{className:""})))},E=()=>{let{nodeLookup:C}=r.getState();return Array.from(C.values())},w=(C,P)=>{let $=E();if(C.type==="LANE"){if(P){h();return}let L=$.filter(Y=>Y.id!==C.id&&Y.type==="LANE"&&!Y.parentId),H=Zn(C,L);if(!H){h();return}if(mn({parentId:H.id,nodes:e,excludeTypes:["LANE"]})){h(H.id,!0);return}h(H.id);return}let R=$.filter(L=>L.id!==C.id&&L.type==="LANE"),G=Zn(C,R);if(!G){h();return}if(mn({parentId:G.id,nodes:e,includeTypes:["LANE"]})){h();return}h(G.id)},b=C=>{let P=l(C.id),$=C.type==="LANE"&&mn({parentId:C.id,nodes:e,includeTypes:["LANE"]});w(P,$)},x=C=>C.map(P=>v(T({},P),{className:void 0})),N=C=>C.some($=>$.dragging)?C.map($=>$.dragging?v(T({},$),{dragging:!1}):$):C,I=C=>{if(C.preventDefault(),C.dataTransfer.dropEffect="move",!(i!=null&&i.type))return;let P=u({x:C.clientX,y:C.clientY}),$={id:"__sidebar_drag__",type:i.type,position:P,measured:{width:1,height:1},internals:{positionAbsolute:P}};w($,!1)},A=C=>{let P=C.relatedTarget;(!P||!C.currentTarget.contains(P))&&h()},M=(C,P)=>{C.preventDefault(),b(P)},S=(C,P,$)=>{var L,H;let V=[...$];if(C.parentId===P.id)return V=Qc(C,P,V),V=Jn(V),x(V);if(C.type==="LANE"){if(mn({parentId:P.id,nodes:V,excludeTypes:["LANE"]})){let U=$t(P),X=50,z=50;return V.map(W=>{var Z,ee;return W.id===C.id?v(T({},W),{position:{x:(Z=m==null?void 0:m.x)!=null?Z:U.x+X,y:(ee=m==null?void 0:m.y)!=null?ee:U.y2+z}}):W})}let O=V.filter(U=>U.parentId===P.id).reduce((U,X)=>{var z,W;return U+((W=(z=X.measured)==null?void 0:z.height)!=null?W:0)},0),J={x:ke.HEADER_WIDTH,y:O};return V=V.map(U=>U.id===C.id?v(T({},U),{parentId:P.id,position:J,className:void 0}):v(T({},U),{className:void 0})),V=Qn(P.id,V),V}if(mn({parentId:P.id,nodes:V,includeTypes:["LANE"]})){let F;if(C.parentId){let Y=l(C.parentId),{x:O,y:J}=qt(Y);F={x:O+((L=C.position.x)!=null?L:0),y:J+((H=C.position.y)!=null?H:0)}}return V=V.map(Y=>Y.id===C.id?v(T({},Y),{position:F!=null?F:Y.position,parentId:void 0,className:void 0}):v(T({},Y),{className:void 0})),V}let K=Uc(C,P);return V=V.map(F=>{if(F.id===C.id){let Y=$t(C),O=$t(P);return Y.y<O.y&&(K.y=0),Y.x<O.x+ke.HEADER_WIDTH&&(K.x=ke.HEADER_WIDTH),v(T({},F),{parentId:P.id,position:K,className:void 0})}return v(T({},F),{className:void 0})}),V=Jn(V),V},k=C=>{if(C.preventDefault(),!(i!=null&&i.type))return;if(!io(i.type,c())){p(!1),a(null);return}let P=u({x:C.clientX,y:C.clientY}),$={width:re[i.type].MIN_WIDTH,height:re[i.type].MIN_HEIGHT},V=f(),R={id:String(V),type:i.type,position:P,measured:$,data:{label:i.type==="TASK"?Li(e,s("bpmn.task.label.prefix")):"",variant:i.variant,attribute:i.attribute},selected:!0},G=v(T({},R),{internals:{positionAbsolute:P}}),K=v(T({},G),{measured:{width:1,height:1}}),L=E(),H=i.type==="LANE",F=L.filter(z=>H?z.type==="LANE"&&!z.parentId:z.type==="LANE"),Y=Zn(K,F),O=[...e.map(z=>v(T({},z),{selected:!1})),R];Y&&(O=S(G,Y,O)),O=So(O),O=x(O),t(O),y();let J=C.dataTransfer.getData("sourceId"),U=d(),X=U;if(J){let z={id:String(V+1),source:J,target:R.id},W=i.type==="ANNOTATION"?T(T({},z),ln):T(T({},z),xt);X=U.concat(W),o(X)}n("forceSave",{nodes:O,edges:X}),p(!1),a(null)},B=async(C,P,$)=>{let V=[...e];$.forEach(R=>{let G=E(),K=l(R.id),L=R.type==="LANE",H=G.filter(Y=>Y.id!==R.id&&(L?Y.type==="LANE"&&!Y.parentId:Y.type==="LANE")),F=Zn(K,H);if(F){V=S(K,F,V);return}R.parentId&&(V=j(R,V))}),V=N(V),V=So(V),V=x(V),t(V),g(V),_(null)},q=(C,P)=>{_({x:P.position.x,y:P.position.y})},j=(C,P)=>{var K,L;let $=l(C.parentId),{x:V,y:R}=qt($),G={x:V+((K=C.position.x)!=null?K:0),y:R+((L=C.position.y)!=null?L:0)};return P=P.map(H=>H.id===C.id?v(T({},H),{position:G,parentId:void 0}):H),P=Qn(C.parentId,P),P};return{onDragOver:I,onDragLeave:A,onDrop:k,onNodeDrag:M,onNodeDragStart:q,onNodeDragStop:B}};var uu=require("@xyflow/react"),pu=require("@produto-lecom/lecom-ui"),fu=require("react");var Wg=30,Xg=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},Ug=e=>!Xg(e.target),mu=({offset:e=Wg,saveHistory:t})=>{let{t:o}=(0,pu.useTranslation)(),{getNodes:n,setNodes:r,getEdges:i,setEdges:a}=(0,uu.useReactFlow)(),{getNextId:s}=Et();(0,fu.useEffect)(()=>{let l=c=>{if(c.ctrlKey&&c.key.toLowerCase()==="d"&&Ug(c)){c.preventDefault(),c.stopPropagation();let d=n(),u=i(),f=d.filter(x=>x.selected);if(!f.length)return;let p=new Map,g=[],y=f.filter(x=>io(x.type,d));if(y.length===0)return;let m=u.filter(x=>y.some(N=>N.id===x.source)&&y.some(N=>N.id===x.target)),_=s(),h=y.map(x=>{var A;let N=String(_++);p.set(x.id,N);let I=v(T({},x),{id:N,selected:!0,position:{x:x.position.x+e,y:x.position.y+e}});if(x.type==="TASK"){let M=(A=x.data)==null?void 0:A.label,S=yn(M||o("bpmn.task.label.prefix"),[...d,...g]);I.data=v(T({},x.data),{label:S})}return g.push(I),I}),E=m.map(x=>v(T({},x),{id:String(_++),selected:!0,source:p.get(x.source)||x.source,target:p.get(x.target)||x.target})),w=[...d.map(x=>v(T({},x),{selected:!1})),...h],b=[...u.map(x=>v(T({},x),{selected:!1})),...E];r(w),a(b),t("forceSave",{nodes:w,edges:b})}};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0)}},[n,r,i,a,s,e,o,t])};var ur=require("react"),gu=require("@xyflow/react");var $g=20,Kg=50,dr={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},qg=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},hu=e=>{let{getNodes:t}=(0,gu.useReactFlow)(),{mode:o,isMoveTool:n}=Q(),r=(0,ur.useRef)(0),i=(0,ur.useRef)(new Map);(0,ur.useEffect)(()=>{let a=s=>{if(o!=="edit"||!n||qg(s.target)||!Object.values(dr).includes(s.key))return;let u=t().filter(h=>h.selected);if(u.length===0){i.current.clear();return}s.preventDefault();let f=Date.now(),p=f-r.current<500;r.current=f;let g=s.shiftKey?Kg:$g,y=0,m=0;switch(s.key){case dr.UP:m=-g;break;case dr.DOWN:m=g;break;case dr.LEFT:y=-g;break;case dr.RIGHT:y=g;break}let _=u.map(h=>{let E=i.current.get(h.id);(!p||!E)&&(E={x:h.position.x,y:h.position.y});let w={x:E.x+y,y:E.y+m};return i.current.set(h.id,w),{id:h.id,dragging:!0,type:"position",position:w}});e&&e(_)};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,e,o,n])};var _u=require("@xyflow/react");var xu={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Eu={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},yu=(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}},Zg=e=>{e=e||"";let t=e.trim().split(`
|
|
42
|
-
`),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=yu(i[0],o),s=yu(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},bu=e=>{let{components:t,connections:o}=Zg(e);return{nodes:t,edges:o}};var Tu=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,_u.useReactFlow)(),{getNextId:n}=Et();return{importFromLia:i=>{let a=typeof i=="string"?i:i.diagramXml||"",{nodes:s,edges:l}=bu(a),c=[],d=new Map,u=!1,f=n();for(let[m,_]of Object.entries(s)){let h=String(f++),E=xu[_.type],w=Eu[_.type];E==="START_EVENT"&&(u=!0),d.set(m,h);let b=re[E].MIN_WIDTH,x=re[E].MIN_HEIGHT;c.push({id:h,type:E,data:{label:_.label||"",variant:w,attribute:""},position:{x:0,y:0},width:b,height:x,measured:{width:b,height:x}})}let p=[];for(let m of l){let _=v(T({},xt),{id:String(f++),source:d.get(m.sourceId)||m.sourceId,target:d.get(m.targetId)||m.targetId});p.push(_)}if(!u&&c.length>0){let m=String(f++),_={id:m,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:re.START_EVENT.MIN_WIDTH,height:re.START_EVENT.MIN_HEIGHT,measured:{width:re.START_EVENT.MIN_WIDTH,height:re.START_EVENT.MIN_HEIGHT}};c.unshift(_);let h=c[1];if(h){let E=v(T({},xt),{id:String(f++),source:m,target:h.id});p.unshift(E)}}let{nodes:g,edges:y}=Jc(c,p);e(g),t(y),o({padding:xn,minZoom:En,maxZoom:bn})}}};var Gi=require("react"),Jg={origin:"*",debug:!1};function Nu(e,t=Jg){let{origin:o,debug:n}=t,r=(0,Gi.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,Gi.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||(s==null?void 0:s.data)===void 0)return;let{event:l,data:c}=s,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",s),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var vu=require("@xyflow/react"),ks=require("react");var wu=()=>{let e=(0,vu.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=Q(),{importFromMxGraph:n}=Tn();(0,ks.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,ks.useEffect)(()=>{if(!e)return;(async()=>{await Tr(),o(!0)})()},[e,o])};var Rs=require("react"),Au=require("@xyflow/react");function Iu(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Eo(),{getEdges:n}=(0,Au.useReactFlow)(),r=Cr(),i=(0,Rs.useCallback)(s=>{if(!(s!=null&&s.activities))return;e(s.activities);let l=s.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),a=(0,Rs.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var Su=require("@xyflow/react"),qe=require("react"),Mu=require("use-debounce");var Qg=500,Cu=100,Pu=(e=!1)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Su.useReactFlow)(),[i,a]=(0,qe.useState)({history:[],currentStep:0}),{history:s,currentStep:l}=i,c=l>0,d=l<s.length-1,u=(0,qe.useCallback)((b,x)=>{n(b[x].nodes),r(b[x].edges)},[n,r]),f=(0,qe.useCallback)(()=>{if(l>0){let b=l-1;a(x=>v(T({},x),{currentStep:b})),u(s,b)}},[l,s,u]),p=(0,qe.useCallback)(()=>{if(l<s.length-1){let b=l+1;a(x=>v(T({},x),{currentStep:b})),u(s,b)}},[s,l,u]),g=(0,qe.useCallback)(b=>{a(x=>{let N=x.history[x.currentStep];if(N&&JSON.stringify(N)===JSON.stringify(b))return x;let M=[...x.history.slice(0,x.currentStep+1),b],S=M.length>Cu?M.slice(M.length-Cu):M;return{history:S,currentStep:S.length-1}})},[]),y=(0,qe.useCallback)((b,x)=>{let N=b.map(A=>v(T({},A),{selected:!1,className:"",data:v(T({},A.data),{hasError:!1})})),I=x.map(A=>v(T({},A),{data:v(T({},A.data),{hasError:!1})}));return{nodes:So(N),edges:I}},[]),m=(0,qe.useCallback)(()=>y(t(),o()),[t,o,y]),_=(0,Mu.useDebouncedCallback)(()=>{let b=m();g(b)},Qg),h=(0,qe.useCallback)((b,x)=>{if(!e)return;if(s.length===0){let A=m();a({history:[A],currentStep:0})}if(b==="forceSave"){if(x){g(y(x.nodes,x.edges));return}_();return}b.some(A=>A.type==="select")||b.some(A=>A.type==="position"&&A.dragging)||_()},[e,_,s.length,m,g,y]);(0,qe.useEffect)(()=>{if(e&&s.length===0){let b=m();a({history:[b],currentStep:0})}},[e,s.length,m]);let E=(0,qe.useCallback)(b=>{a({history:b||[],currentStep:0})},[]),w=(0,qe.useCallback)(()=>{a({history:[],currentStep:0})},[]);return(0,qe.useEffect)(()=>{let b=x=>{(x.ctrlKey||x.metaKey)&&(x.shiftKey&&x.key.toLowerCase()==="z"?(x.preventDefault(),p()):x.key.toLowerCase()==="z"&&(x.preventDefault(),f()))};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[f,p]),{history:s,undo:f,redo:p,canUndo:c,canRedo:d,saveHistory:h,resetHistory:E,clearHistory:w}};var ku=()=>{let{t:e}=(0,Lu.useTranslation)(),[t,o,n]=(0,zt.useNodesState)([]),[r,i,a]=(0,zt.useEdgesState)([]),{getNode:s}=(0,zt.useReactFlow)(),{toast:l}=je(),c=(0,zt.useStoreApi)(),{instanceId:d,isInitialized:u,setIsConnecting:f,setIsMultipleSelection:p,onElementClick:g}=Q(),{updateHelperLines:y,HelperLines:m}=ii(),{undo:_,redo:h,canUndo:E,canRedo:w,saveHistory:b}=Pu(u),{onNodeDrag:x,onDrop:N,onDragOver:I,onDragLeave:A,onNodeDragStop:M,onNodeDragStart:S}=du({nodes:t,setNodes:o,setEdges:i,saveHistory:b}),{isValidConnection:k,onConnect:B,onReconnect:q,onReconnectStart:j,onReconnectEnd:C,setReconnectingEdge:P,clearReconnectingEdge:$}=Wd({setEdges:i,saveHistory:b}),{handleValidationComplete:V,clearValidation:R,dismissValidationPanel:G,validateDiagram:K,getIsClearingValidation:L}=tu(),{importFromLia:H}=Tu(),{handleTasksStatus:F,handleClearTaskStatus:Y}=Iu(),{clearPathEdges:O}=Eo(),{emitElementChanges:J,handleNodeChanges:U,handleEdgeChanges:X}=Di(),z=Cr();au({saveHistory:b}),mu({saveHistory:b}),wu();let W=(0,At.useCallback)(()=>{o([]),i([]),O(),setTimeout(z,0)},[o,i,O,z]);Nu({LIA_CREATE_DIAGRAM:H,CLEAR_DIAGRAM:W,TASKS_STATUS:F,CLEAR_TASKS_STATUS:Y});let{selectElements:Z,clearSelection:ee}=so(),{importFromMxGraph:ue,exportToMxGraph:pe}=Tn(),{configureElement:ge,getConfigureElement:he}=ui(),Pe=(0,At.useCallback)(()=>t.length+r.length,[t,r]);(0,At.useEffect)(()=>(Ot.set(d,{importFromMxGraph:ue,exportToMxGraph:pe,selectElements:Z,clearSelection:ee,configureElement:ge,getConfigureElement:he,getElementsCount:Pe,setReconnectingEdge:P,clearReconnectingEdge:$}),()=>{Ot.delete(d)}),[d,ue,pe,Z,ee,ge,he,Pe,P,$]);let Le=(0,At.useCallback)((Ve,We)=>{if(We.type!=="TASK"&&We.type!=="GATEWAY")return;let St=he(We.id);St&&(g==null||g(St))},[he,g]),ve=(0,At.useCallback)((Ve,We)=>{if(We.type!=="SEQUENCE_EDGE")return;let St=s(We.source),$i=s(We.target),{isFromStartEvent:Ep,isGatewayToGateway:bp,isActiviyToAndGateway:_p}=Ir(St,$i);if(!(!Ep&&!bp&&!_p))return;let zs=he(We.id);zs&&(g==null||g(zs))},[he,s,g]),ce=(0,At.useCallback)(Ve=>{let We=y(Ve,t);n(We),b(Ve),L()||G(),U(Ve)},[t,n,b,L,G,y,U]),se=(0,At.useCallback)(Ve=>{a(Ve),b(Ve),L()||G(),X(Ve)},[a,b,L,G,X]);hu(ce);let ze=(0,At.useCallback)(({nodes:Ve,edges:We})=>{p(Ve.length+We.length>=2)},[p]);(0,zt.useOnSelectionChange)({onChange:ze});let Ze=(0,At.useCallback)(async({nodes:Ve})=>Ve.some(St=>St.type==="LANE"&&t.some($i=>$i.parentId===St.id))?(l({variant:"error",title:e("validation.errors.title"),content:e("editor.toolbar.delete_pool_lane_error")}),!1):!0,[t,e,l]);return{nodes:t,setNodes:o,edges:r,setEdges:i,events:{isValidConnection:k,onConnect:B,onReconnect:q,onReconnectStart:j,onReconnectEnd:C,onDrop:N,onDragOver:I,onDragLeave:A,onNodeDrag:x,onNodeDragStop:M,onNodeDragStart:S,onNodeClick:Le,onEdgeClick:ve,onDropCapture:()=>{b("forceSave"),J(),G()},onConnectStart:()=>{f(!0)},onConnectEnd:()=>{f(!1),G()},onSelectionEnd:()=>setTimeout(()=>c.setState({nodesSelectionActive:!1}),0),onNodesChange:ce,onEdgesChange:se,onBeforeDelete:Ze},ui:{handleCloseValidationPanel:R},controls:{undo:_,redo:h,canUndo:E,canRedo:w},components:{HelperLines:m},actions:{saveHistory:b,selectElements:Z,clearSelection:ee,exportToMxGraph:pe,validateDiagram:K,handleValidationComplete:V,setReconnectingEdge:P,clearReconnectingEdge:$}}};var Ds=require("react/jsx-runtime"),Os=({id:e,className:t})=>(0,Ds.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,Ds.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var Nn=require("react/jsx-runtime"),Ru=()=>(0,Nn.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,Nn.jsxs)("defs",{children:[(0,Nn.jsx)(Os,{id:"sequence-edge-marker",className:"text-grey-500"}),(0,Nn.jsx)(Os,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var go=require("@produto-lecom/lecom-ui");var mr=require("@xyflow/react"),Ce=require("@produto-lecom/lecom-ui"),mo=require("lucide-react"),Vo=require("react");var po=require("@produto-lecom/lecom-ui");var pr=(E=>(E.START_EVENT="START_EVENT",E.END_EVENT="END_EVENT",E.TASK="TASK",E.SUBPROCESS="SUBPROCESS",E.GATEWAY="GATEWAY",E.LANE="LANE",E.ANNOTATION="ANNOTATION",E.CONNECTION="CONNECTION",E.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",E.ACTIVITY="ACTIVITY",E.PROCESS_INTERFACE="PROCESS_INTERFACE",E.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",E.VARIANT_ACTIVITY="VARIANT_ACTIVITY",E.AUTO_ACTIVITY="AUTO_ACTIVITY",E.DATA_STORE="DATA_STORE",E.DATA_OBJECT="DATA_OBJECT",E.DATA_OUTPUT="DATA_OUTPUT",E.DATA_INPUT="DATA_INPUT",E.MARKER="MARKER",E))(pr||{});var zi=require("@produto-lecom/lecom-ui"),Xu=require("@xyflow/react");var Du=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function Ou({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
|
|
43
|
-
`),i=encodeURI(r);
|
|
39
|
+
</mxGraphModel>`,vd=(e,t)=>{if(!e.length&&!t.length)return ar;let o=[...e.map(r=>r.id),...t.map(r=>r.id)];return Math.max(...o.map(r=>Number(r)))};var Qg=e=>{let t=Object.values(sr),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=gd[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},jg=(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=hd(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},eh=(e,t)=>{let o=[];return e.forEach(n=>{var a,s;let r=(s=(a=xd)[n.type])==null?void 0:s.call(a,n);if(!r){console.warn(`Node ${n.type} not supported`);return}if(o.push(r),n.type==="TASK"&&n.data.attribute==="LOOP"){let l=Ed(n,t);o.push(l)}}),o},th=(e,t)=>{let o=[];return e.forEach(n=>{let r=yd(n,t);o.push(r)}),o},wd=(e=[],t=[],o)=>{let n=eh(e,o),r=th(t,e),i={mxGraphModel:{root:{_attributes:{version:"1.1",lastId:o},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...n,...r]}}};return cd(JSON.stringify(i),{compact:!0,spaces:0})},Id=async e=>{var c,d,u,f,p;let t=await Gi(e),o=((d=(c=t==null?void 0:t.mxGraphModel)==null?void 0:c.root)==null?void 0:d.mxCell)||[],n=Number(((p=(f=(u=t==null?void 0:t.mxGraphModel)==null?void 0:u.root)==null?void 0:f._attributes)==null?void 0:p.lastId)||ar),r=Qg(o),i=jg(o,r),a=_d(r),{nodes:s,edges:l}=Pa(a,i);return{lastElementId:n,edges:l,nodes:Co(s)}};var lt=require("@xyflow/react"),Xi=require("react");var lr=require("@xyflow/react");var Fs=require("react/jsx-runtime"),oe=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=Dt(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,Fs.jsx)(lr.Handle,_({type:e,position:t,className:V("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent before:pointer-events-none":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent before:pointer-events-none":!s},o)},r))},Ze=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=Dt(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c,getNodes:d}=(0,lr.useReactFlow)(),f=(()=>{if(n!=="source")return!1;let p=c();if(t==="TASK")return p.filter(y=>y.source===e).length>=2;if(t==="GATEWAY"&&o==="EXCLUSIVE")return p.filter(y=>y.source===e).length>=2;if(t==="START_EVENT"){let h=d();return p.filter(m=>{if(m.source!==e)return!1;let x=h.find(T=>T.id===m.target);return(x==null?void 0:x.type)!=="ANNOTATION"}).length>=1}return!1})();return(0,Fs.jsx)(lr.Handle,_({type:n,position:r,className:V("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent before:pointer-events-none":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent before:pointer-events-none":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":f,"hover:border-grey-500":!f},i),style:{pointerEvents:f?"none":"auto"}},a))};var Xs=require("react"),to=require("@xyflow/react");var Ad=require("@xyflow/react"),Bi=()=>{let e=(0,Ad.useStoreApi)();return{getInternalNodes:()=>{let{nodeLookup:o}=e.getState();return Array.from(o.values())}}};var zi=require("react/jsx-runtime"),Us=require("react"),oh=["top","right","bottom","left"],nh=["top-left","top-middle","top-right","right-middle","bottom-left","left-middle","bottom-right","bottom-middle"],Tt=r=>{var i=r,{nodeId:e,isVisible:t,offset:o=8}=i,n=Dt(i,["nodeId","isVisible","offset"]);let{getInternalNode:a,setNodes:s}=(0,to.useReactFlow)(),{getInternalNodes:l}=Bi(),{isMultipleSelection:c}=ee(),d=(0,to.useStoreApi)(),u=(0,Xs.useRef)(0),f=(0,Xs.useRef)([]),p=({y:x,width:T,height:E})=>{cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{var Q,U;if(!e)return;let{nodeLookup:N,onNodesChange:b}=d.getState(),g=N.get(e);if(!g||g.type!=="LANE")return;let w=!g.parentId,A=w?g.id:g.parentId;if(!A)return;let I=Array.from(N.values()).filter($=>$.type==="LANE"&&$.parentId===A);if(!I.length)return;f.current.length===0&&(f.current=Po(I).map($=>$.id));let D=f.current.map($=>I.find(M=>M.id===$)).filter(Boolean),S=[],L=0,z=D.findIndex($=>$.id===g.id),q=!w&&z>0&&Math.abs(x-g.position.y)>.5;for(let $=0;$<D.length;$++){let M=D[$],O=M.id===g.id,P=$===D.length-1;if(O){L=q?x+E:L+E;continue}let C=(U=(Q=M.measured)==null?void 0:Q.height)!=null?U:0,F=w?T-re.HEADER_WIDTH:T,R=C;w&&P&&(R=Math.max(re.MIN_HEIGHT,E-L)),q&&$===z-1&&(R=Math.max(re.MIN_HEIGHT,x-L)),S.push({id:M.id,type:"dimensions",dimensions:{width:F,height:R},setAttributes:!0}),S.push({id:M.id,type:"position",position:{x:re.HEADER_WIDTH,y:L}}),L+=R}w?S.push({id:A,type:"dimensions",dimensions:{width:T,height:E},setAttributes:!0}):S.push({id:A,type:"dimensions",dimensions:{width:T+re.HEADER_WIDTH,height:L},setAttributes:!0}),b==null||b(S)})},h=({y:x,width:T,height:E})=>{var g;if(cancelAnimationFrame(u.current),f.current=[],!e)return;let N=a(e);if(!N||N.type!=="LANE"&&!N.parentId)return;let b=[...l()];if(N.type!=="LANE"){b=b.map(w=>w.id===e?v(_({},w),{width:T,height:E,measured:{width:T,height:E}}):w),b=eo(b),s(b);return}b=Da(N,T,E,b,x),b=eo(b),b=Mo((g=N.parentId)!=null?g:N.id,b),s(b)};if(!(!c&&t))return null;let m={"--resize-offset":`${o}px`};return(0,zi.jsxs)(zi.Fragment,{children:[oh.map(x=>(0,Us.createElement)(to.NodeResizeControl,v(_({},n),{key:x,nodeId:e,position:x,variant:to.ResizeControlVariant.Line,className:"border-blue-400/90 border-dashed",style:m,onResize:(T,E)=>p(E),onResizeEnd:(T,E)=>h(E)}))),nh.map(x=>(0,Us.createElement)(to.NodeResizeControl,v(_({},n),{key:x,nodeId:e,position:x,className:"size-1.5 bg-blue-400 relative before:content-[''] before:absolute before:w-5 before:h-5 before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:cursor-[inherit]",style:m,onResize:(T,E)=>p(E),onResizeEnd:(T,E)=>h(E)})))]})};var Fi=require("@xyflow/react"),Wt=require("@produto-lecom/lecom-ui"),at=require("react");var Cd=require("zustand"),An=(0,Cd.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var Yi=require("react"),Sd=(e,t=!1)=>{let[o,n]=(0,Yi.useState)({width:0,height:0});return(0,Yi.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var ho=require("@xyflow/react"),Md=require("react"),rh=120,ih=12,Pd=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,ho.useReactFlow)(),{instanceId:i}=ee();return(0,Md.useMemo)(()=>{var p,h;if(!t)return{position:ho.Position.Right,align:"start"};let a=n(e);if(!a)return{position:ho.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,c=(((p=a.measured)==null?void 0:p.width)||a.width||100)*s.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:ho.Position.Right,align:"start"};let u=(o==null?void 0:o.width)||rh;return{position:l+c+u+ih>d?ho.Position.Left:ho.Position.Right}},[i,e,t,o,n,r])};var Wi=require("@xyflow/react"),ye=require("@produto-lecom/lecom-ui"),Ld=require("lucide-react");var Ne=require("react/jsx-runtime"),kd=({nodeId:e})=>{let{t}=(0,ye.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Wi.useReactFlow)(),i=(0,Wi.useNodesData)(e),s=n().filter(p=>p.source===e).some(p=>{let h=r(p.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=u=>{o(e,{variant:(i==null?void 0:i.data.variant)===u?"":u})},d=u=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===u?"":u})};return(0,Ne.jsxs)(ye.DropdownMenu,{children:[(0,Ne.jsxs)(ye.Tooltip,{children:[(0,Ne.jsx)(ye.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(ye.DropdownMenuTrigger,{asChild:!0,children:(0,Ne.jsx)(ye.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,Ne.jsx)(Ld.WrenchIcon,{})})})}),(0,Ne.jsx)(ye.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,Ne.jsxs)(ye.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,Ne.jsxs)(ye.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,Ne.jsx)("div",{className:"flex-1 body-medium-500",children:t("bpmn.task.menu.title")}),(0,Ne.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Hr).map(([u,f])=>{let p=u==="LOOP"&&(s||l),y=(()=>{if(u==="LOOP"&&s)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(u==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess");if(u==="LOOP")return t("editor.task_menu.loop")})();return(0,Ne.jsxs)(ye.Tooltip,{children:[(0,Ne.jsx)(ye.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)(ye.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:p,className:V({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===u,"opacity-50 cursor-not-allowed":p}),onClick:p?void 0:()=>d(u),children:(0,Ne.jsx)(f.icon,{className:"stroke-inherit"})})}),y&&(0,Ne.jsx)(ye.TooltipContent,{color:"black",children:y})]},u)})})]}),(0,Ne.jsx)(ye.DropdownMenuGroup,{children:(0,Ne.jsxs)(ye.Tooltip,{children:[(0,Ne.jsx)(ye.TooltipTrigger,{asChild:!0,children:(0,Ne.jsx)("div",{className:V({"cursor-not-allowed":s}),children:(0,Ne.jsxs)(ye.DropdownMenuItem,{className:V({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50":s}),disabled:s,onClick:()=>c("SCRIPT"),children:[(0,Ne.jsx)(Or.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})})}),s&&(0,Ne.jsx)(ye.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var Ae=require("react/jsx-runtime"),zo={START_EVENT:{type:"START_EVENT",icon:Bn,label:"bpmn.start_event.variant.default"},END_EVENT:{type:"END_EVENT",icon:Qo,label:"bpmn.end_event.variant.default"},TASK:{type:"TASK",icon:Bn,label:"bpmn.task.variant.default"},ANNOTATION:{type:"ANNOTATION",icon:Lr,label:"bpmn.annotation.variant.default"}},sh={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:tn,label:"bpmn.gateway.variant.exclusive"},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:nn,label:"bpmn.gateway.variant.parallel"},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:jo,label:"bpmn.gateway.variant.complex"}},nt=({nodeId:e,nodeType:t,nodeVariant:o})=>{let n=(0,at.useRef)(null),r=(0,at.useRef)(null),{t:i}=(0,Wt.useTranslation)(),{setDraggableNode:a}=An(),{getEdges:s,getNodes:l,getNode:c}=(0,Fi.useReactFlow)(),{setIsDragging:d,mode:u,isConnecting:f,isDragging:p,isMultipleSelection:h}=ee(),y=c(e),m=!!(y!=null&&y.selected)&&!y.dragging&&!f&&!p&&!h,{dimensions:x}=Sd(n,m),{position:T}=Pd(e,m,x),[E,N]=(0,at.useState)(void 0),b=l(),g=s(),w=o==="SUBPROCESS",A=(0,at.useRef)(null),I=(0,at.useRef)(!1),D=(0,at.useCallback)(()=>{A.current!==null&&(clearTimeout(A.current),A.current=null),I.current=!1,d(!1),a(null),N(void 0)},[d,a]);(0,at.useEffect)(()=>{let R=H=>{I.current&&H.buttons===0&&D()};return document.addEventListener("dragend",D),document.addEventListener("mousemove",R),()=>{document.removeEventListener("dragend",D),document.removeEventListener("mousemove",R)}},[D]);let S=(0,at.useCallback)((R,H)=>{I.current=!0,d(!1),a({type:H.type,variant:H.variant,attribute:H.attribute,icon:H.icon}),H.icon&&N((0,Ae.jsx)(H.icon,{})),R.dataTransfer.effectAllowed="move",R.dataTransfer.setData("sourceId",e),r.current&&R.dataTransfer.setDragImage(r.current,10,10),A.current=setTimeout(()=>{A.current=null,d(!0)},100)},[e,a,d]),L=(0,at.useCallback)(()=>{D()},[D]),z=[{component:(0,Ae.jsx)(Ai,{elementId:e})}],q=()=>{if(u==="view")return[];let R=!g.some(H=>{var k;return H.source===e&&((k=b.find(G=>G.id===H.target))==null?void 0:k.type)!=="ANNOTATION"});return[{component:(0,Ae.jsx)(xn,{nodeId:e,disabled:!R,tooltipMessage:R?void 0:i("editor.toolbar.start_event_limit_reached")})},zo.TASK,zo.ANNOTATION,...z]},Q=()=>u==="view"?[{component:(0,Ae.jsx)(mo,{elementId:e})}]:[{component:(0,Ae.jsx)(mo,{elementId:e})},...w?[]:[{component:(0,Ae.jsx)(kd,{nodeId:e})}],{component:(0,Ae.jsx)(xn,{nodeId:e})},zo.TASK,...Object.values(sh),...z],U=()=>u==="view"?[{component:(0,Ae.jsx)(mo,{elementId:e})}]:[{component:(0,Ae.jsx)(mo,{elementId:e})},{component:(0,Ae.jsx)(xn,{nodeId:e})},zo.TASK,zo.ANNOTATION,...z],$=()=>u==="view"?[]:[zo.ANNOTATION,...z],M=()=>u==="view"?[]:[{component:(0,Ae.jsx)(xn,{nodeId:e})},zo.ANNOTATION,...z],O=()=>u==="view"?[]:[{component:(0,Ae.jsx)(xn,{nodeId:e})},...z],P=()=>u==="view"?[]:[...z],F=(R=>{switch(R){case"START_EVENT":return q();case"TASK":return Q();case"GATEWAY":return U();case"END_EVENT":return $();case"LANE":return M();case"ANNOTATION":return O();case"UNSUPPORTED":return P();default:return[]}})(t);if(!(F.length===0||u==="readonly"))return(0,Ae.jsxs)(Fi.NodeToolbar,{position:T,align:"start",className:"-top-8",isVisible:m,children:[(0,Ae.jsx)("div",{ref:n,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:F.map((R,H)=>{if(R.component)return(0,Ae.jsx)("div",{children:R.component},H);let k={sourceNodeType:t,targetNodeType:R.type,sourceNodeId:e,nodes:b,edges:g},G=Yc(k),B={gateway_limit_reached:i("editor.toolbar.gateway_limit_reached"),start_event_limit_reached:i("editor.toolbar.start_event_limit_reached"),start_event_already_exists:i("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:i("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:i("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:i("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:i("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:i("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:i("editor.toolbar.task_limit_reached")},K=G.shouldDisable&&G.reason?B[G.reason]||i(R.label):i(R.label)||"";return(0,Ae.jsxs)(Wt.Tooltip,{children:[(0,Ae.jsx)(Wt.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Wt.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=>S(W,R),onDragEnd:G.shouldDisable?void 0:L,children:R.icon&&(0,Ae.jsx)(R.icon,{size:16})})}),(0,Ae.jsx)(Wt.TooltipContent,{color:"black",children:K})]},H)})}),(0,Ae.jsx)("div",{ref:r,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:E})]})};var Be=require("react/jsx-runtime"),Rd=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r,setNodes:i}=(0,lt.useReactFlow)(),{inProgress:a,fromNode:s}=(0,lt.useConnection)(),{mode:l}=ee(),c=a&&(s==null?void 0:s.id)!==e,d=(0,Xi.useCallback)(p=>{let T=p.split(`
|
|
40
|
+
`),E=T.reduce((w,A)=>Math.max(w,A.length),0),N=T.length,b=Math.max(un.MIN_WIDTH,E*7+32),g=Math.max(un.MIN_HEIGHT,N*20+24);i(w=>w.map(A=>A.id===e?v(_({},A),{width:b,height:g,style:v(_({},A.style),{width:b,height:g})}):A))},[e,i]),u=(0,Xi.useCallback)(p=>{r(e,{label:p}),d(p)},[e,r,d]),f=(0,Xi.useCallback)(p=>{d(p)},[d]);return(0,Be.jsxs)("div",{className:V("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,Be.jsx)(Ke,{value:t.label,className:"m-1 text-grey-600 text-left",onChange:u,onInput:f,skipFirstCharValidation:!0}),(0,Be.jsx)(nt,{nodeId:e,nodeType:"ANNOTATION"}),l==="edit"&&(0,Be.jsx)(Tt,{nodeId:e,minWidth:un.MIN_WIDTH,minHeight:un.MIN_HEIGHT,isVisible:!n&&o}),!a&&(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(oe,{type:"source",position:lt.Position.Left,id:"left"}),(0,Be.jsx)(oe,{type:"source",position:lt.Position.Right,id:"right"}),(0,Be.jsx)(oe,{type:"source",position:lt.Position.Top,id:"top"}),(0,Be.jsx)(oe,{type:"source",position:lt.Position.Bottom,id:"bottom"})]}),(!a||c)&&(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(oe,{type:"target",position:lt.Position.Left,id:"left",className:V({"annotation-handle":c})}),(0,Be.jsx)(oe,{type:"target",position:lt.Position.Right,id:"right",className:V({"annotation-handle":c})}),(0,Be.jsx)(oe,{type:"target",position:lt.Position.Top,id:"top",className:V({"annotation-handle":c})}),(0,Be.jsx)(oe,{type:"target",position:lt.Position.Bottom,id:"bottom",className:V({"annotation-handle":c})})]})]})};var ct=require("@xyflow/react"),Dd=require("react");var Re=require("react/jsx-runtime"),Od=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,ct.useReactFlow)(),{inProgress:i,fromNode:a}=(0,ct.useConnection)(),{mode:s,reconnectingEdgeId:l}=ee(),[c,d]=(0,Dd.useState)(!1),u=i&&(a==null?void 0:a.id)!==e||!!l,f=y=>{r(e,{label:y})},p=()=>{d(!0)},h=()=>{d(!1)};return(0,Re.jsxs)("div",{className:"relative",onDoubleClick:p,children:[(0,Re.jsx)(Qo,{className:V("w-full h-full min-w-9 min-h-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,Re.jsx)("div",{className:"absolute mt-2 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Re.jsx)(Ke,{value:t.label,isEditing:c,onBlur:h,onChange:f})}),(0,Re.jsx)(nt,{nodeId:e,nodeType:"END_EVENT"}),s==="edit"&&(0,Re.jsx)(Tt,{nodeId:e,isVisible:!n&&o,minWidth:Br.MIN_WIDTH,minHeight:Br.MIN_HEIGHT,offset:4,keepAspectRatio:!0}),(!i||u)&&(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(oe,{type:"target",position:ct.Position.Left,id:"left",className:V({"event-handle":u})}),(0,Re.jsx)(oe,{type:"target",position:ct.Position.Right,id:"right",className:V({"event-handle":u})}),(0,Re.jsx)(oe,{type:"target",position:ct.Position.Top,id:"top",className:V({"event-handle":u})}),(0,Re.jsx)(oe,{type:"target",position:ct.Position.Bottom,id:"bottom",className:V({"event-handle":u})})]}),!i&&(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(oe,{type:"source",position:ct.Position.Left,id:"left"}),(0,Re.jsx)(oe,{type:"source",position:ct.Position.Right,id:"right"}),(0,Re.jsx)(oe,{type:"source",position:ct.Position.Top,id:"top"}),(0,Re.jsx)(oe,{type:"source",position:ct.Position.Bottom,id:"bottom"})]})]})};var dt=require("@xyflow/react"),Ui=require("react");var De=require("react/jsx-runtime"),Hd=({id:e,data:t,selected:o,dragging:n})=>{let r=ms[t.variant].icon,{updateNodeData:i}=(0,dt.useReactFlow)(),{inProgress:a,fromNode:s}=(0,dt.useConnection)(),{mode:l,reconnectingEdgeId:c}=ee(),[d,u]=(0,Ui.useState)(!1),f=a&&(s==null?void 0:s.id)!==e||!!c,p=(0,Ui.useCallback)(m=>{i(e,{label:m})},[e,i]),h=()=>{u(!0)},y=()=>{u(!1)};return(0,De.jsxs)("div",{className:"relative",onDoubleClick:h,children:[(0,De.jsx)(r,{className:V("w-full h-full min-w-14 min-h-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,De.jsx)("div",{className:"absolute mt-2 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,De.jsx)(Ke,{value:t.label,isEditing:d,onBlur:y,onChange:p})}),(0,De.jsx)(nt,{nodeId:e,nodeType:"GATEWAY"}),l==="edit"&&(0,De.jsx)(Tt,{nodeId:e,isVisible:!n&&o,minWidth:zr.MIN_WIDTH,minHeight:zr.MIN_HEIGHT,offset:2,keepAspectRatio:!0}),(!a||f)&&(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(oe,{type:"target",position:dt.Position.Left,id:"left",className:V({"gateway-handle":f})}),(0,De.jsx)(oe,{type:"target",position:dt.Position.Right,id:"right",className:V({"gateway-handle":f})}),(0,De.jsx)(oe,{type:"target",position:dt.Position.Top,id:"top",className:V({"gateway-handle":f})}),(0,De.jsx)(oe,{type:"target",position:dt.Position.Bottom,id:"bottom",className:V({"gateway-handle":f})})]}),!a&&(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(Ze,{type:"source",position:dt.Position.Left,id:"left",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ze,{type:"source",position:dt.Position.Right,id:"right",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ze,{type:"source",position:dt.Position.Top,id:"top",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant}),(0,De.jsx)(Ze,{type:"source",position:dt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})]})};var Vd=require("@xyflow/react"),Mt=require("@produto-lecom/lecom-ui"),ah=require("lucide-react");var Gd=require("react/jsx-runtime");var ut=require("@xyflow/react"),Bd=require("react");var Oe=require("react/jsx-runtime"),zd=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,ut.useReactFlow)(),{inProgress:i,fromNode:a}=(0,ut.useConnection)(),{mode:s,reconnectingEdgeId:l}=ee(),[c,d]=(0,Bd.useState)(!1),u=i&&(a==null?void 0:a.id)!==e||!!l,f=y=>{r(e,{label:y})},p=()=>{d(!0)},h=()=>{d(!1)};return(0,Oe.jsxs)("div",{className:"relative",onDoubleClick:p,children:[(0,Oe.jsx)(Dr,{className:V("w-full h-full min-w-9 min-h-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,Oe.jsx)("div",{className:"absolute mt-2 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Oe.jsx)(Ke,{value:t.label,isEditing:c,onBlur:h,onChange:f})}),(0,Oe.jsx)(nt,{nodeId:e,nodeType:"START_EVENT"}),s==="edit"&&(0,Oe.jsx)(Tt,{nodeId:e,isVisible:!n&&o,minWidth:Gr.MIN_WIDTH,minHeight:Gr.MIN_HEIGHT,offset:4,keepAspectRatio:!0}),(!i||u)&&(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(oe,{type:"target",position:ut.Position.Left,id:"left",className:V({"event-handle":u})}),(0,Oe.jsx)(oe,{type:"target",position:ut.Position.Right,id:"right",className:V({"event-handle":u})}),(0,Oe.jsx)(oe,{type:"target",position:ut.Position.Top,id:"top",className:V({"event-handle":u})}),(0,Oe.jsx)(oe,{type:"target",position:ut.Position.Bottom,id:"bottom",className:V({"event-handle":u})})]}),!i&&(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Ze,{type:"source",position:ut.Position.Left,id:"left",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ze,{type:"source",position:ut.Position.Right,id:"right",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ze,{type:"source",position:ut.Position.Top,id:"top",nodeId:e,nodeType:"START_EVENT"}),(0,Oe.jsx)(Ze,{type:"source",position:ut.Position.Bottom,id:"bottom",nodeId:e,nodeType:"START_EVENT"})]})]})};var Xd=require("@produto-lecom/lecom-ui"),pt=require("@xyflow/react"),pr=require("react");var cr=60,$i=(e,t)=>{var a;let o=[],n=`${t} `;for(let s of e){if(!(s.type==="TASK"))continue;let c=(a=s.data)==null?void 0:a.label;if(c&&c.startsWith(n)){let d=c.substring(n.length);/^\d{1,15}$/.test(d)&&o.push(parseInt(d,10))}}let r=o.length>0?Math.max(...o)+1:1,i=`${t} ${r}`;return i.length<=cr?i:i.substring(0,cr).trim()},Cn=(e,t)=>{var s;let o=new Set;for(let l of t)l.type==="TASK"&&((s=l.data)!=null&&s.label)&&o.add(l.data.label);let n=e;if(n.length>cr&&(n=n.substring(0,cr).trim()),!o.has(n))return n;let r=n.replace(/\s+\(\d+\)$/,""),i=2,a=o.size+2;for(;i<=a;){let l=` (${i})`,c=cr-l.length,u=`${r.substring(0,c).trim()}${l}`;if(!o.has(u))return u;i++}return n};var dr=require("react/jsx-runtime"),Yd=e=>(0,dr.jsxs)("svg",v(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,dr.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,dr.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var $s=require("react/jsx-runtime"),Wd=e=>(0,$s.jsx)("svg",v(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,$s.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 ur=require("react/jsx-runtime"),Fd=e=>(0,ur.jsxs)("svg",v(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,ur.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,ur.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var ce=require("react/jsx-runtime"),lh={APROVADO:Yd,EM_ANDAMENTO:Wd,REJEITADO:Fd},Ks={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)]"},Ud=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,Xd.useTranslation)(),{toast:i}=tt(),{updateNodeData:a,getNodes:s,setNodes:l}=(0,pt.useReactFlow)(),{inProgress:c,fromNode:d}=(0,pt.useConnection)(),{mode:u,onSubprocessValidationClick:f,reconnectingEdgeId:p}=ee(),{getTaskStatus:h}=Lo(),y=c&&(d==null?void 0:d.id)!==e||!!p,m=h(e),x=t.variant==="SUBPROCESS",T=!!t.variant&&!x||!!m,E=!!t.attribute||x,N=(0,pr.useCallback)(z=>{let $=T||E?80:40,M=z.split(`
|
|
41
|
+
`),O=M.reduce((R,H)=>Math.max(R,H.length),0),P=M.length,C=Math.max(dn.MIN_WIDTH,O*7+64),F=Math.max(dn.MIN_HEIGHT,P*24+$);l(R=>R.map(H=>H.id===e?v(_({},H),{width:C,height:F,style:v(_({},H.style),{width:C,height:F})}):H))},[e,l,T,E]),b=(0,pr.useCallback)(z=>{let q=z.trim(),Q=t.label||"";if(q===Q)return;let U=q,$=s();if(!(q&&q!=="")){U=$i($,r("bpmn.task.label.prefix")),a(e,{label:U}),N(U),i({variant:"warning",content:(0,ce.jsxs)(ce.Fragment,{children:[r("bpmn.task.feedback.label_empty.prefix")," ",(0,ce.jsx)("strong",{children:U})]})});return}let O=Cn(U,$);O===Q||(a(e,{label:O}),N(O),O!==U&&i({variant:"warning",content:(0,ce.jsxs)(ce.Fragment,{children:[r("bpmn.task.feedback.label_already_exists.prefix")," ",(0,ce.jsx)("strong",{children:q})," ",r("bpmn.task.feedback.label_already_exists.middle")," ",(0,ce.jsx)("strong",{children:O})]})}))},[t.label,s,e,r,a,N,i]),g=(0,pr.useCallback)(z=>{N(z)},[N]),w=(0,pr.useCallback)(()=>{i({variant:"error",content:r("bpmn.task.feedback.invalid_first_character")})},[r,i]),A=m?lh[m]:null,I=t.variant?Or[t.variant].icon:null,D=t.attribute?Hr[t.attribute].icon:null,S=()=>t.hasError?Ks.error:m?Ks[m]:Ks.default,L=()=>{f==null||f({id:e,type:"sub_process",label:t.label})};return(0,ce.jsxs)("div",{className:V("relative w-full h-full min-w-44 min-h-24 flex flex-col items-stretch justify-stretch bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md hover:shadow-md transition-colors duration-75",S(),{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ce.jsx)("div",{className:"flex-1 flex items-stretch justify-stretch overflow-hidden",children:(0,ce.jsx)(Ke,{value:t.label,maxLength:60,className:V({"py-10 px-8":T||E}),onChange:b,onInput:g,onInvalidFirstCharacter:w})}),I&&(0,ce.jsx)("div",{className:V("absolute flex items-center p-1",x?"bottom-0 left-1/2 -translate-x-1/2":"top-0 left-0"),children:(0,ce.jsx)(I,{size:16,className:V(t.hasError?"text-red-500":"text-grey-500",x&&"cursor-pointer"),onClick:x?L:void 0})}),D&&(0,ce.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ce.jsx)("div",{className:V("flex items-center w-16 p-1",x?"justify-between":"justify-center"),children:(0,ce.jsx)(D,{size:16,className:V(t.hasError?"text-red-500":"text-grey-500")})})}),A&&(0,ce.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,ce.jsx)(A,{})}),(0,ce.jsx)(nt,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant}),u==="edit"&&(0,ce.jsx)(Tt,{nodeId:e,isVisible:!n&&o,minWidth:dn.MIN_WIDTH,minHeight:dn.MIN_HEIGHT}),(!c||y)&&(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(oe,{type:"target",position:pt.Position.Left,id:"left",className:V({"task-handle":y})}),(0,ce.jsx)(oe,{type:"target",position:pt.Position.Right,id:"right",className:V({"task-handle":y})}),(0,ce.jsx)(oe,{type:"target",position:pt.Position.Top,id:"top",className:V({"task-handle":y})}),(0,ce.jsx)(oe,{type:"target",position:pt.Position.Bottom,id:"bottom",className:V({"task-handle":y})})]}),!c&&(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(Ze,{type:"source",position:pt.Position.Left,id:"left",nodeId:e,nodeType:"TASK"}),(0,ce.jsx)(Ze,{type:"source",position:pt.Position.Right,id:"right",nodeId:e,nodeType:"TASK"}),(0,ce.jsx)(Ze,{type:"source",position:pt.Position.Top,id:"top",nodeId:e,nodeType:"TASK"}),(0,ce.jsx)(Ze,{type:"source",position:pt.Position.Bottom,id:"bottom",nodeId:e,nodeType:"TASK"})]})]})};var qs=require("@xyflow/react");var oo=require("react/jsx-runtime"),$d=({id:e,data:t})=>(0,oo.jsxs)(oo.Fragment,{children:[(0,oo.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,oo.jsx)(nt,{nodeId:e,nodeType:"UNSUPPORTED"}),(0,oo.jsx)(oe,{type:"source",position:qs.Position.Right}),(0,oo.jsx)(oe,{type:"target",position:qs.Position.Left})]});var Me=require("@xyflow/react"),Ki=require("react");var be=require("react/jsx-runtime"),Y2={type:"MESSAGE_EDGE",reconnectable:!0,markerEnd:{type:Me.MarkerType.Arrow},data:{label:""}},Kd=({id:e,source:t,target:o,data:n,selected:r,sourcePosition:i,targetPosition:a,sourceHandleId:s,targetHandleId:l})=>{var H;let{zoom:c}=(0,Me.useViewport)(),{updateEdgeData:d}=(0,Me.useReactFlow)(),{isMultipleSelection:u,mode:f,instanceId:p}=ee(),h=f!=="edit",[y,m]=(0,Ki.useState)(!1),{reconnectingHandle:x,cursorPosition:T,hoveredNodeId:E,reconnectingSide:N,isValidReconnection:b,handleReconnectStart:g}=Di({edgeId:e,source:t,target:o,instanceId:p,isReadOnly:h}),w=(0,Me.useInternalNode)(t),A=(0,Me.useInternalNode)(o),{sx:I,sy:D,tx:S,ty:L,sourcePos:z,targetPos:q}=(0,Ki.useMemo)(()=>{var ne,J;if(!w||!A)return{sx:0,sy:0,tx:0,ty:0,sourcePos:Me.Position.Left,targetPos:Me.Position.Right};let k=cn(w,A),G=s?i:k.sourcePos,B=l?a:k.targetPos,K=(le,fe,me)=>{var We,Qe,Rt,qt,No,vo;let{x:He,y:we}=le.internals.positionAbsolute,he=(Rt=(Qe=(We=le.measured)==null?void 0:We.width)!=null?Qe:le.width)!=null?Rt:0,de=(vo=(No=(qt=le.measured)==null?void 0:qt.height)!=null?No:le.height)!=null?vo:0;switch(fe){case Me.Position.Top:return{x:He+he*me,y:we};case Me.Position.Bottom:return{x:He+he*me,y:we+de};case Me.Position.Left:return{x:He,y:we+de*me};case Me.Position.Right:return{x:He+he,y:we+de*me};default:return{x:He+he/2,y:we+de/2}}},W=(ne=n==null?void 0:n.sourceOffset)!=null?ne:.5,X=(J=n==null?void 0:n.targetOffset)!=null?J:.5,Z=w?K(w,G,W).x:k.sx,j=w?K(w,G,W).y:k.sy,Y=A?K(A,B,X).x:k.tx,te=A?K(A,B,X).y:k.ty;return x==="source"&&T?(Z=T.x,j=T.y,N&&(G=N)):x==="target"&&T&&(Y=T.x,te=T.y,N&&(B=N)),{sx:Z,sy:j,tx:Y,ty:te,sourcePos:G,targetPos:B}},[w,A,s,l,i,a,x,T,N,n==null?void 0:n.sourceOffset,n==null?void 0:n.targetOffset]);if(!w||!A)return null;let[Q,U,$]=(0,Me.getSmoothStepPath)({sourceX:I,sourceY:D,targetX:S,targetY:L,sourcePosition:z,targetPosition:q}),M=r||(w==null?void 0:w.selected)||(A==null?void 0:A.selected),O=M?"sequence-edge-marker-highlighted":"sequence-edge-marker",P=y||(n==null?void 0:n.label.trim().length)>0,C=()=>{m(!0)},F=()=>{m(!1)},R=k=>{d(e,{label:k.trim()})};return(0,be.jsx)(be.Fragment,{children:(0,be.jsxs)("g",{className:V("group bpmn-arrow-edge",{"is-highlighted":M}),onDoubleClick:C,children:[(0,be.jsx)("path",{d:Q,fill:"none",stroke:"transparent",strokeWidth:Math.max(12,12/c),style:{pointerEvents:"stroke",cursor:"pointer"}}),(0,be.jsxs)("g",{className:V("text-grey-500 transition-colors duration-75 group-hover:text-grey-800",{"text-blue-500 group-hover:text-blue-600":M}),children:[(0,be.jsx)(Me.BaseEdge,{id:e,path:Q,interactionWidth:0,markerEnd:`url(#${O})`,strokeDasharray:4,className:V("stroke-2 stroke-current transition-[stroke,filter] duration-75 group-hover:drop-shadow-[0_0_3px_rgba(0,0,0,0.2)]",{"stroke-red-500 hover:stroke-red-600":(n==null?void 0:n.hasError)||x&&E&&!b,"stroke-green-500":x&&E&&b,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":M&&!(n!=null&&n.hasError)&&!x})}),(0,be.jsxs)(Me.EdgeLabelRenderer,{children:[(0,be.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${U}px, ${$}px)`},children:[r&&!u&&(0,be.jsx)(Tn,{sx:I,sy:D,tx:S,ty:L,hasLabel:!!((H=n==null?void 0:n.label)!=null&&H.trim()),children:(0,be.jsx)(_n,{edgeId:e,edgeType:"MESSAGE_EDGE"})}),P&&(0,be.jsx)(Ke,{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:y,onBlur:F,onChange:R})]}),r&&!u&&!h&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${I}px, ${D}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="source"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="source"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:V("pointer-events-auto",{"cursor-move":!x||x!=="source","cursor-not-allowed":x==="source"&&E&&!b,"cursor-grabbing":x==="source"&&(!E||b)}),onMouseDown:k=>g("source",k.nativeEvent)})]})}),(0,be.jsx)("div",{className:"absolute z-[1000] pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${S}px, ${L}px)`},children:(0,be.jsxs)("svg",{width:12/c,height:12/c,style:{overflow:"visible",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:[(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:4/c,fill:x==="target"?"#3b82f6":"#fff",stroke:"#3b82f6",strokeWidth:2/c,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:6/c,fill:"none",stroke:"#3b82f6",strokeWidth:1/c,opacity:x==="target"?.6:.3,className:"pointer-events-none"}),(0,be.jsx)("circle",{cx:6/c,cy:6/c,r:8/c,fill:"transparent",className:V("pointer-events-auto",{"cursor-move":!x||x!=="target","cursor-not-allowed":x==="target"&&E&&!b,"cursor-grabbing":x==="target"&&(!E||b)}),onMouseDown:k=>g("target",k.nativeEvent)})]})})]})]})]})]})})};var Yo=require("@xyflow/react"),fr=require("react/jsx-runtime"),qd=({toX:e,toY:t,fromNode:o})=>{var u,f;if(!o)return null;let{internals:{positionAbsolute:{x:n,y:r}},measured:i}=o,a=(u=i.width)!=null?u:0,s=(f=i.height)!=null?f:0,c=[{x:n,y:r+s/2,pos:Yo.Position.Left},{x:n+a,y:r+s/2,pos:Yo.Position.Right},{x:n+a/2,y:r,pos:Yo.Position.Top},{x:n+a/2,y:r+s,pos:Yo.Position.Bottom}].reduce((p,h)=>{let y=Math.hypot(e-p.x,t-p.y);return Math.hypot(e-h.x,t-h.y)<y?h:p}),[d]=(0,Yo.getStraightPath)({sourceX:c.x,sourceY:c.y,targetX:e,targetY:t});return(0,fr.jsxs)("g",{className:"group",children:[(0,fr.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-500 animated transition-[stroke,filter] duration-75",d}),(0,fr.jsx)("circle",{cx:e,cy:t,fill:"none",r:4,className:"stroke-2 stroke-grey-600"})]})};var ft=require("@xyflow/react"),Zd=require("lodash"),mr=require("react");var ve=require("react/jsx-runtime"),Jd=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,ft.useReactFlow)(),{mode:s}=ee(),{inProgress:l,fromNode:c}=(0,ft.useConnection)(),d=l&&(c==null?void 0:c.id)!==e,[u,f]=(0,mr.useState)(!1),p=a(),h=!r,y=(0,mr.useMemo)(()=>(0,Zd.orderBy)([...p.filter(b=>b.parentId===e&&b.type==="LANE")],"position.y","asc"),[p,e]),m=h?wa.MIN_WIDTH:re.MIN_WIDTH,x=(0,mr.useMemo)(()=>{if(h&&y.length>1){let b=[...y];return b.pop(),b.reduce((w,A)=>{var I,D;return w+((D=(I=A.measured)==null?void 0:I.height)!=null?D:0)},0)+re.MIN_HEIGHT}return re.MIN_HEIGHT},[h,y]),T=b=>{i(e,{label:b})},E=()=>{f(!0)},N=()=>{f(!1)};return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsxs)("div",{className:V("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-1 outline-grey-300",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,ve.jsx)("div",{className:"flex align-items justify-center w-10 border-r border-grey-300",onDoubleClick:E,children:(0,ve.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,ve.jsx)(Ke,{value:t.label,className:"w-full h-full self-auto",contentClassName:V({"whitespace-nowrap":u}),isEditing:u,onBlur:N,onChange:T})})}),(0,ve.jsx)("div",{className:"flex-1"})]}),(0,ve.jsx)(nt,{nodeId:e,nodeType:"LANE",isChild:!h}),s==="edit"&&(0,ve.jsx)(Tt,{nodeId:e,isVisible:!n&&o,minWidth:m,minHeight:x,offset:10}),!l&&(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(oe,{type:"source",position:ft.Position.Left,id:"left"}),(0,ve.jsx)(oe,{type:"source",position:ft.Position.Right,id:"right"}),(0,ve.jsx)(oe,{type:"source",position:ft.Position.Top,id:"top"}),(0,ve.jsx)(oe,{type:"source",position:ft.Position.Bottom,id:"bottom"})]}),(!l||d)&&(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(oe,{type:"target",position:ft.Position.Left,id:"left",className:V({"annotation-handle":d})}),(0,ve.jsx)(oe,{type:"target",position:ft.Position.Right,id:"right",className:V({"annotation-handle":d})}),(0,ve.jsx)(oe,{type:"target",position:ft.Position.Top,id:"top",className:V({"annotation-handle":d})}),(0,ve.jsx)(oe,{type:"target",position:ft.Position.Bottom,id:"bottom",className:V({"annotation-handle":d})})]})]})};var Qd={START_EVENT:zd,END_EVENT:Od,TASK:Ud,GATEWAY:Hd,ANNOTATION:Rd,LANE:Jd,UNSUPPORTED:$d},jd={SEQUENCE_EDGE:sd,MESSAGE_EDGE:Kd,ANNOTATION_EDGE:Qc},eu="#fafafa",tu="#bebebe",ou=1,nu=10,ru="bottom-left",Zs=.05,iu=5,Sn=.5,Mn=Zs,Pn=1,su={x:0,y:0,zoom:.75},au=1,lu=2,ch={[au]:4,[lu]:2},qi=[au,lu],cu=qi.reduce((e,t)=>e|ch[t],0);var du=require("@xyflow/react");var Nt=()=>{let{getEdges:e,getNodes:t}=(0,du.useReactFlow)(),{lastElementId:o}=ee(),n=()=>{let i=t(),a=e(),s=vd(i,a);return Math.max(s,o)};return{getLastId:n,getNextId:()=>n()+1}};var kn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,setViewport:r}=(0,Ln.useReactFlow)(),{getLastId:i}=Nt(),a=(0,Ln.useStoreApi)(),{setLastElementId:s}=ee(),l=(0,Js.useCallback)(async(d="")=>{let{nodes:u,edges:f,lastElementId:p}=await Id(d),{width:h,height:y}=a.getState();if(h>0&&y>0){let m=La(u);m&&r((0,Ln.getViewportForBounds)(m,h,y,Mn,Pn,Sn))}o(u),n(f),s(p)},[o,n,s,a,r]),c=(0,Js.useCallback)(()=>{let d=e(),u=t(),f=i();return wd(d,u,f)},[e,t,i]);return{importFromMxGraph:l,exportToMxGraph:c}};var Qs=require("react"),dh=500,Zi=()=>{let{isInitialized:e,onElementChanges:t}=ee(),{exportToMxGraph:o}=kn(),n=(0,uu.useDebouncedCallback)(()=>{if(!e)return;let a=o();t==null||t(a)},dh),r=(0,Qs.useCallback)(a=>{a.every(c=>c.type==="select")||a.some(c=>c.type==="position"&&c.dragging)||n()},[n]),i=(0,Qs.useCallback)(a=>{a.some(l=>l.type==="select")||n()},[n]);return{emitElementChanges:n,handleNodeChanges:r,handleEdgeChanges:i}};var pu=({setEdges:e,saveHistory:t})=>{let{getNode:o,getEdges:n,getNodes:r,getInternalNode:i}=(0,Ji.useReactFlow)(),{emitElementChanges:a}=Zi(),s=(0,Ft.useRef)(null),{getNextId:l}=Nt(),c=(0,Ft.useCallback)(m=>{var b;let x=o(m.source),T=o(m.target);if(!x||!T)return!1;let E={sourceNodeId:x.id,targetNodeId:T.id,sourceNodeType:x.type,targetNodeType:T.type,nodes:r(),edges:n(),reconnectingEdgeId:(b=s.current)!=null?b:void 0};return Ds(E).isValid},[o,n,r]),d=(0,Ft.useCallback)(m=>{var E,N;let x=l(),T=i(m.source);if(T){let b=i(m.target),g=b?b.internals.positionAbsolute.x+((E=b.measured.width)!=null?E:0)/2:0,w=b?b.internals.positionAbsolute.y+((N=b.measured.height)!=null?N:0)/2:0,A=ad(T,g,w),I=(b==null?void 0:b.type)==="ANNOTATION"||(T==null?void 0:T.type)==="ANNOTATION",D=I?Nn:_t,S;if(!I&&b&&m.targetHandle){let q=Hi(A),Q=Hi(m.targetHandle),{x:U,y:$}=Gs(T,A),{x:M,y:O}=Gs(b,m.targetHandle),C=ki(U,$,M,O,q,Q).slice(1,-1);C.length>0&&(S=C)}let L=v(_(_({},m),D),{id:String(x),sourceHandle:A,data:_(_({},I?{}:_t.data),S?{points:S}:{})}),z=n().concat(L);e(z),t("forceSave",{nodes:r(),edges:z}),a()}},[l,e,a,i,n,r,t]),u=(0,Ft.useCallback)((m,x)=>{s.current=x.id},[]),f=(0,Ft.useCallback)(()=>{s.current=null},[]),p=(0,Ft.useCallback)((m,x)=>{let T=o(x.source),E=o(x.target);if(!T||!E){s.current=null;return}let N={sourceNodeId:T.id,targetNodeId:E.id,sourceNodeType:T.type,targetNodeType:E.type,nodes:r(),edges:n(),reconnectingEdgeId:m.id};if(!Ds(N).isValid){s.current=null;return}let g=(0,Ji.reconnectEdge)(m,x,n()).map(w=>w.id===m.id?v(_({},w),{data:v(_({},w.data),{points:void 0})}):w);e(g),t("forceSave",{nodes:r(),edges:g}),s.current=null,a()},[o,r,n,e,a,t]),h=(0,Ft.useCallback)(m=>{s.current=m},[]),y=(0,Ft.useCallback)(()=>{s.current=null},[]);return{isValidConnection:c,onConnect:d,onReconnect:p,onReconnectStart:u,onReconnectEnd:f,setReconnectingEdge:h,clearReconnectingEdge:y}};var _u=require("@produto-lecom/lecom-ui"),Tu=require("@xyflow/react"),Pt=require("react");var gr=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Wo=(e=[])=>e.filter(t=>t.type==="END_EVENT"),yo=(e=[])=>e.filter(t=>t.type==="TASK")||[],fu=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),mu=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),Qi=(e=[])=>e.filter(t=>t.type==="GATEWAY"),gu=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),mt=(e,t=[])=>t.filter(o=>o.source===e),hr=(e,t=[])=>t.filter(o=>o.target===e),hu=(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"},yu=(e,t)=>{let o=mt(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},xu=e=>e?/[^\s]/.test(e.trim()):!1,Ee=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:[]}},Xt=(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)}},Eu=(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 yr=[{id:"start_event_not_found",validate:e=>{let t=gr(e.nodes);return Ee({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Wo(e.nodes);return Ee({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=gr(e.nodes),o=t.length===1;if(t.length===0)return Ee({isValid:!0});if(!o)return Ee({isValid:!1,nodeIds:t.map(i=>i.id)});let n=mt(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return Ee({isValid:!1,nodeIds:[...new Set(i)]})}return Ee({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=yo(e.nodes),o=Xt(t,n=>mt(n.id,e.edges).length<=2);return Ee({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=yo(e.nodes),o=Xt(t,n=>!!n.label&&n.label.trim()!=="");return Ee({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=yo(e.nodes),n=Xt(o,r=>!r.label||r.label.length<=60);return Ee({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=yo(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 Ee({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=Qi(e.nodes),o=[],n=[];for(let r of t){let i=mt(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 Ee({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...gr(e.nodes),...Wo(e.nodes)],o=[],n=[];for(let r of t){let i=mt(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 Ee({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Wo(e.nodes),o=[],n=[];for(let r of t){let i=hr(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=mt(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return Ee({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=gu(e.nodes),o=Xt(t,r=>mt(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>mt(r,e.edges).map(i=>i.id));return Ee({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=yo(e.nodes),o=Xt(t,n=>!n.label||xu(n.label));return Ee({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 Ee({isValid:!0});let t=Wo(e.nodes)[0];if(!t)return Ee({isValid:!0});let o=hr(t.id,e.edges);if(!o.length)return Ee({isValid:!0});let r=yo(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Xt(r,l=>!hu(l.id,e));return Ee({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=yo(e.nodes),o=Wo(e.nodes)[0];if(!o)return Ee({isValid:!0});let n=t.filter(l=>{let c=hr(l.id,e.edges),d=mt(l.id,e.edges),u=c.some(p=>{var h;return((h=e.nodes.find(y=>y.id===p.source))==null?void 0:h.type)==="START_EVENT"}),f=d.some(p=>{var h;return((h=e.nodes.find(y=>y.id===p.target))==null?void 0:h.type)==="END_EVENT"});return u&&f}),r=hr(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 Ee(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=Qi(e.nodes),o=[],n=[];for(let r of t){let i=mt(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 Ee({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=Qi(e.nodes),o=Xt(t,n=>mt(n.id,e.edges).length>=1);return Ee({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...gr(e.nodes),...Wo(e.nodes)],o=[],n=[];for(let r of t){let i=mt(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 Ee({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=fu(e.nodes),o=Xt(t,n=>!yu(n.id,e));return Ee({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=mu(e.nodes),o=Xt(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 Ee({isValid:o.isValid,nodeIds:o.invalidIds})}}];var bu=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of yr){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 Fo=require("react/jsx-runtime"),Nu=()=>{let{t:e}=(0,_u.useTranslation)(),{toast:t}=tt(),{setNodes:o,setEdges:n,getNodes:r,getEdges:i}=(0,Tu.useReactFlow)(),[a,s]=(0,Pt.useState)(!1),l=(0,Pt.useRef)(!1),c=(0,Pt.useRef)(!1),d=(0,Pt.useCallback)(y=>{let m=Eu(y.nodes,y.edges),x=bu(m),T=x.errors.map(E=>v(_({},E),{message:e(`validation.errors.${E.id}`)}));return a||s(!0),{isValid:x.isValid,errors:T}},[a,e]),u=(0,Pt.useCallback)((y,m=!0)=>{if(m&&y&&t({variant:y.isValid?"success":"error",duration:5e3,title:y.isValid?e("validation.success.title"):e("validation.errors.title"),content:(0,Fo.jsxs)("div",{className:"flex flex-col gap-1",children:[!y.isValid&&(0,Fo.jsx)("span",{className:"body-small-500",children:e("validation.errors.subtitle")}),(0,Fo.jsx)("ul",{className:"list-disc list-inside max-h-40 overflow-y-auto",children:y.isValid?(0,Fo.jsx)("li",{children:e("validation.success.message")}):y.errors.map(S=>(0,Fo.jsx)("li",{className:"text-xs",children:S.message},S.id))})]})}),!y)return;l.current=!0,c.current=!0;let x=[],T=[];y.errors.forEach(S=>{S.nodeIds&&S.nodeIds.length>0&&S.nodeIds.forEach(L=>x.push(L)),S.edgeIds&&S.edgeIds.length>0&&S.edgeIds.forEach(L=>T.push(L))});let E=[...new Set(x)];o(S=>S.map(L=>v(_({},L),{data:v(_({},L.data),{hasError:!1})}))),n(S=>S.map(L=>v(_({},L),{data:v(_({},L.data),{hasError:!1})})));let N=r(),b=i(),g=new Set(E),w=new Set;y.errors.forEach(S=>{var q,Q;let L=yr.find(U=>U.id===S.id);(L==null?void 0:L.highlightRelatedEdges)!==!1&&((q=S.edgeIds)==null||q.forEach(U=>w.add(U)),(Q=S.nodeIds)==null||Q.forEach(U=>{b.forEach($=>{($.source===U||$.target===U)&&w.add($.id)})}))});let A=new Set,I=new Set,D=new Set;N.forEach(S=>{S.type==="START_EVENT"?A.add(S.id):S.type==="END_EVENT"&&I.add(S.id)}),b.forEach(S=>{A.has(S.source)&&D.add(S.target),I.has(S.target)&&D.add(S.source)}),D.forEach(S=>{var L,z;if(g.has(S)){let q=(L=y.errors.find(U=>{var $;return($=U.nodeIds)==null?void 0:$.includes(S)}))==null?void 0:L.id;((z=yr.find(U=>U.id===q))==null?void 0:z.highlightRelatedEdges)!==!1&&b.forEach(U=>{U.source===S&&I.has(U.target)&&(g.add(U.target),w.add(U.id)),U.target===S&&A.has(U.source)&&(g.add(U.source),w.add(U.id))})}}),g.size>0&&o(S=>S.map(L=>v(_({},L),{data:v(_({},L.data),{hasError:g.has(L.id)})}))),w.size>0&&n(S=>S.map(L=>v(_({},L),{data:v(_({},L.data),{hasError:w.has(L.id)})}))),setTimeout(()=>{l.current=!1},0)},[e,i,r,n,o,t]),f=(0,Pt.useCallback)(()=>{s(!1),c.current=!1,o(y=>y.map(m=>v(_({},m),{data:v(_({},m.data),{hasError:!1})}))),n(y=>y.map(m=>v(_({},m),{data:v(_({},m.data),{hasError:!1})})))},[n,o]),p=(0,Pt.useCallback)(()=>{c.current&&(l.current=!0,c.current=!1,o(y=>y.map(m=>v(_({},m),{data:v(_({},m.data),{hasError:!1})}))),n(y=>y.map(m=>v(_({},m),{data:v(_({},m.data),{hasError:!1})}))),setTimeout(()=>{l.current=!1},0))},[n,o]),h=(0,Pt.useCallback)(()=>l.current,[]);return{validateDiagram:d,handleValidationComplete:u,clearValidation:f,dismissValidationPanel:p,isAutoValidationEnabled:a,getIsClearingValidation:h}};var Iu=require("@xyflow/react"),Au=require("@produto-lecom/lecom-ui"),Cu=require("react");var uh=15,vu="bpmn:selection",ph=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},wu=e=>{if(!ph(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},Su=({offset:e=uh,saveHistory:t})=>{let{t:o}=(0,Au.useTranslation)(),{getNodes:n,setNodes:r,getEdges:i,setEdges:a}=(0,Iu.useReactFlow)(),{getNextId:s}=Nt();(0,Cu.useEffect)(()=>{let l=d=>{var x,T;if(!wu(d))return;let u=n(),f=i(),p=u.filter(E=>E.selected);if(!p.length)return;d.preventDefault(),d.stopPropagation();let h=f.filter(E=>p.some(N=>N.id===E.source)&&p.some(N=>N.id===E.target)),m=JSON.stringify({nodes:p,edges:h});(x=d.clipboardData)==null||x.setData(vu,m),(T=d.clipboardData)==null||T.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},c=d=>{var w,A;if(!wu(d))return;let u=(w=d.clipboardData)==null?void 0:w.getData(vu);if(!u)return;d.preventDefault(),d.stopPropagation();let f;try{f=JSON.parse(u)}catch(I){return}if(!((A=f.nodes)!=null&&A.length))return;let p=new Map,h=n(),y=[],m=f.nodes.filter(I=>po(I.type,h));if(m.length===0)return;let x=s(),T=m.map(I=>{var L;let D=String(x++);p.set(I.id,D);let S=v(_({},I),{id:D,selected:!0,position:{x:I.position.x+e,y:I.position.y+e}});if(I.type==="TASK"){let z=(L=I.data)==null?void 0:L.label,q=Cn(z||o("bpmn.task.label.prefix"),[...h,...y]);S.data=v(_({},I.data),{label:q})}return y.push(S),S}),E=f.edges.map(I=>v(_({},I),{id:String(x++),selected:!0,source:p.get(I.source)||I.source,target:p.get(I.target)||I.target})),N=[...h.map(I=>v(_({},I),{selected:!1})),...T],g=[...i().map(I=>v(_({},I),{selected:!1})),...E];r(N),a(g),t("forceSave",{nodes:N,edges:g})};return document.addEventListener("copy",l,!0),document.addEventListener("paste",c,!0),()=>{document.removeEventListener("copy",l,!0),document.removeEventListener("paste",c,!0)}},[n,r,i,a,s,e,o,t])};var Mu=require("@produto-lecom/lecom-ui"),Pu=require("@xyflow/react");var Lu=require("react");var fh=50,ku=({nodes:e,setNodes:t,setEdges:o,saveHistory:n})=>{let{draggableNode:r,setDraggableNode:i}=An(),{t:a}=(0,Mu.useTranslation)(),{getInternalNode:s,getNodes:l,getEdges:c,screenToFlowPosition:d}=(0,Pu.useReactFlow)(),{getNextId:u}=Nt(),{setIsDragging:f}=ee(),{getInternalNodes:p}=Bi(),{rebuildIndex:h,forceRebuildIndex:y}=bi(),[m,x]=(0,Lu.useState)(null),T=(M,O,P)=>{var H;if(M.parentId!==O)return null;let C=P.filter(k=>k.id!==M.id&&k.parentId===O&&k.type==="LANE").sort((k,G)=>k.position.y-G.position.y);if(C.length===0)return null;let F=(H=P.find(k=>k.id===M.id))!=null?H:M,R=C.find(k=>F.position.y<k.position.y);return R?{draggedLaneId:M.id,beforeLaneId:R.id}:{draggedLaneId:M.id,afterLaneId:C[C.length-1].id}},E=(M,O=!1,P)=>{let C=O?"node-drop-target-error":"node-drop-target",F=O?"node-drop-target-lane-error":"node-drop-target-lane";t(R=>{var k;let H=(k=P==null?void 0:P(R))!=null?k:null;return R.map(G=>{let B=[];return G.id===M&&B.push(C),M!==void 0&&G.parentId===M&&G.type==="LANE"&&G.id!==(H==null?void 0:H.draggedLaneId)&&B.push(F),G.id===(H==null?void 0:H.draggedLaneId)&&B.push("lane-reorder-dragging"),G.id===(H==null?void 0:H.beforeLaneId)&&B.push("lane-reorder-before"),G.id===(H==null?void 0:H.afterLaneId)&&B.push("lane-reorder-after"),v(_({},G),{className:B.join(" ")})})})},N=(M,O)=>{let P=p();if(M.type==="LANE"){if(O){E();return}let k=P.filter(K=>K.id!==M.id&&K.type==="LANE"&&!K.parentId),G=zn(M,k);if(!G){E();return}if(So({parentId:G.id,nodes:e,excludeTypes:["LANE"]})){E(G.id,!0);return}E(G.id,!1,K=>T(M,G.id,K));return}let F=P.filter(k=>k.id!==M.id&&k.type==="LANE"),R=zn(M,F);if(!R){E();return}if(So({parentId:R.id,nodes:e,includeTypes:["LANE"]})){E();return}E(R.id)},b=M=>{let O=s(M.id),P=M.type==="LANE"&&So({parentId:M.id,nodes:e,includeTypes:["LANE"]});N(O,P)},g=M=>M.map(O=>v(_({},O),{className:void 0})),w=M=>M.some(P=>P.dragging)?M.map(P=>P.dragging?v(_({},P),{dragging:!1}):P):M,A=(M,O)=>{let P=0;for(let C of O){if(C.id===M||C.parentId||C.type==="LANE")continue;let F=xt(C),R=F.y+F.h;P=Math.max(P,R)}return P+fh},I=(M,O)=>{if(!gs(M,O))return O;let P=A(M,O);return O.map(C=>C.id===M?v(_({},C),{position:v(_({},C.position),{y:P})}):C)},D=M=>{if(M.preventDefault(),M.dataTransfer.dropEffect="move",!(r!=null&&r.type))return;let O=d({x:M.clientX,y:M.clientY}),P={id:"__sidebar_drag__",type:r.type,position:O,measured:{width:1,height:1},internals:{positionAbsolute:O}};N(P,!1)},S=M=>{let O=M.relatedTarget;(!O||!M.currentTarget.contains(O))&&E()},L=(M,O)=>{M.preventDefault(),b(O)},z=(M,O,P)=>{var B,K;let C=[...P],F=O.parentId?O.parentId:O.id;if(M.parentId===O.id)return C=ys(M,O,C),C=eo(C),C=Mo(F,C),g(C);if(M.type==="LANE"){if(So({parentId:O.id,nodes:C,excludeTypes:["LANE"]})){let Y=yi(O),te=50,ne=50;return C.map(J=>{var le,fe;return J.id===M.id?v(_({},J),{position:{x:(le=m==null?void 0:m.x)!=null?le:Y.x+te,y:(fe=m==null?void 0:m.y)!=null?fe:Y.y2+ne}}):J})}let Z=C.filter(Y=>Y.parentId===O.id).reduce((Y,te)=>{var ne,J;return Y+((J=(ne=te.measured)==null?void 0:ne.height)!=null?J:0)},0),j={x:re.HEADER_WIDTH,y:Z};return C=C.map(Y=>Y.id===M.id?v(_({},Y),{parentId:O.id,position:j,className:void 0}):v(_({},Y),{className:void 0})),C=eo(C),C=I(F,C),C}if(So({parentId:O.id,nodes:C,includeTypes:["LANE"]})){let W;if(M.parentId){let X=s(M.parentId),{x:Z,y:j}=xt(X);W={x:Z+((B=M.position.x)!=null?B:0),y:j+((K=M.position.y)!=null?K:0)}}return C=C.map(X=>X.id===M.id?v(_({},X),{position:W!=null?W:X.position,parentId:void 0,className:void 0}):v(_({},X),{className:void 0})),C=Mo(F,C),C}let k=Sa(M,O);C=C.map(W=>W.id===M.id?v(_({},W),{parentId:O.id,position:k,className:void 0}):v(_({},W),{className:void 0}));let G=C.find(W=>W.id===M.id);return C=ys(G,O,C),C=eo(C),C=Mo(F,C),C},q=M=>{if(M.preventDefault(),!(r!=null&&r.type))return;if(!po(r.type,l())){f(!1),i(null);return}let O=d({x:M.clientX,y:M.clientY}),P={width:ae[r.type].MIN_WIDTH,height:ae[r.type].MIN_HEIGHT},C=u(),F={id:String(C),type:r.type,position:O,measured:P,data:{label:r.type==="TASK"?$i(e,a("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute},selected:!0},R=v(_({},F),{internals:{positionAbsolute:O}}),H=v(_({},R),{measured:{width:1,height:1}}),k=p(),G=r.type==="LANE",B=k.filter(Y=>G?Y.type==="LANE"&&!Y.parentId:Y.type==="LANE"),K=zn(H,B),W=[...k.map(Y=>v(_({},Y),{selected:!1})),R];K&&(W=z(R,K,W)),W=Co(W),G&&!K&&(W=I(R.id,W)),W=g(W),t(W),y();let X=M.dataTransfer.getData("sourceId"),Z=c(),j=Z;if(X){let Y={id:String(C+1),source:X,target:F.id},te=r.type==="ANNOTATION"?_(_({},Y),Nn):_(_({},Y),_t);j=Z.concat(te),o(j)}n("forceSave",{nodes:W,edges:j}),f(!1),i(null)},Q=async(M,O,P)=>{let C=[...p()],F=new Set;P.forEach(k=>{let G=s(k.id),B=k.type==="LANE",K=C.filter(X=>X.id!==k.id&&(B?X.type==="LANE"&&!X.parentId:X.type==="LANE")),W=zn(G,K);if(W){if(B&&So({parentId:k.id,nodes:C,includeTypes:["LANE"]})){k.parentId&&(C=$(k,C),F.add(k.id));return}C=z(G,W,C);return}k.parentId&&(C=$(k,C),k.type==="LANE"&&F.add(k.id))}),C=w(C);let R=P.filter(k=>k.type==="LANE"&&!k.parentId).map(k=>k.id);for(let k of R)gs(k,C)&&m&&(C=C.map(G=>G.id===k?v(_({},G),{position:_({},m)}):G));for(let k of F)C=I(k,C);if(P.some(k=>k.type!=="LANE"&&!k.parentId)){let k=C.filter(G=>G.type==="LANE"&&!G.parentId).map(G=>G.id);for(let G of k)C=Mo(G,C)}C=Co(C),C=g(C),t(C),h(C),x(null)},U=(M,O)=>{x({x:O.position.x,y:O.position.y})},$=(M,O)=>{var K,W,X,Z,j,Y,te,ne;let P=s(M.parentId);if(!P)return O;let C=M.type==="LANE",F=O.filter(J=>J.parentId===P.id&&J.id!==M.id),R=F.filter(J=>J.type==="LANE"),H;if(C&&R.length===0)H=re.MIN_HEIGHT;else if(C){let J=(W=(K=M.measured)==null?void 0:K.height)!=null?W:re.MIN_HEIGHT;H=((Z=(X=P.measured)==null?void 0:X.height)!=null?Z:re.MIN_HEIGHT)-J,H=Math.max(re.MIN_HEIGHT,H)}else H=F.length>0?F.reduce((J,le)=>{var fe,me;return J+((me=(fe=le.measured)==null?void 0:fe.height)!=null?me:0)},0)+Se:Math.max(re.MIN_HEIGHT,(Y=(j=P.measured)==null?void 0:j.height)!=null?Y:0);let{x:k,y:G}=xt(P),B={x:k+((te=M.position.x)!=null?te:0),y:G+((ne=M.position.y)!=null?ne:0)};return O=O.map(J=>J.id===M.id?v(_({},J),{position:B,parentId:void 0}):J.id===P.id?v(_({},J),{height:H,measured:v(_({},J.measured),{height:H})}):J),O=eo(O),O};return{onDragOver:D,onDragLeave:S,onDrop:q,onNodeDrag:L,onNodeDragStart:U,onNodeDragStop:Q}};var Ru=require("@xyflow/react"),Du=require("@produto-lecom/lecom-ui"),Ou=require("react");var mh=30,gh=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},hh=e=>!gh(e.target),Hu=({offset:e=mh,saveHistory:t})=>{let{t:o}=(0,Du.useTranslation)(),{getNodes:n,setNodes:r,getEdges:i,setEdges:a}=(0,Ru.useReactFlow)(),{getNextId:s}=Nt();(0,Ou.useEffect)(()=>{let l=c=>{if(c.ctrlKey&&c.key.toLowerCase()==="d"&&hh(c)){c.preventDefault(),c.stopPropagation();let d=n(),u=i(),f=d.filter(g=>g.selected);if(!f.length)return;let p=new Map,h=[],y=f.filter(g=>po(g.type,d));if(y.length===0)return;let m=u.filter(g=>y.some(w=>w.id===g.source)&&y.some(w=>w.id===g.target)),x=s(),T=y.map(g=>{var I;let w=String(x++);p.set(g.id,w);let A=v(_({},g),{id:w,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}});if(g.type==="TASK"){let D=(I=g.data)==null?void 0:I.label,S=Cn(D||o("bpmn.task.label.prefix"),[...d,...h]);A.data=v(_({},g.data),{label:S})}return h.push(A),A}),E=m.map(g=>v(_({},g),{id:String(x++),selected:!0,source:p.get(g.source)||g.source,target:p.get(g.target)||g.target})),N=[...d.map(g=>v(_({},g),{selected:!1})),...T],b=[...u.map(g=>v(_({},g),{selected:!1})),...E];r(N),a(b),t("forceSave",{nodes:N,edges:b})}};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0)}},[n,r,i,a,s,e,o,t])};var Er=require("react"),Vu=require("@xyflow/react");var yh=20,xh=50,xr={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},Eh=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},Gu=e=>{let{getNodes:t}=(0,Vu.useReactFlow)(),{mode:o,isMoveTool:n}=ee(),r=(0,Er.useRef)(0),i=(0,Er.useRef)(new Map);(0,Er.useEffect)(()=>{let a=s=>{if(o!=="edit"||!n||Eh(s.target)||!Object.values(xr).includes(s.key))return;let u=t().filter(T=>T.selected);if(u.length===0){i.current.clear();return}s.preventDefault();let f=Date.now(),p=f-r.current<500;r.current=f;let h=s.shiftKey?xh:yh,y=0,m=0;switch(s.key){case xr.UP:m=-h;break;case xr.DOWN:m=h;break;case xr.LEFT:y=-h;break;case xr.RIGHT:y=h;break}let x=u.map(T=>{let E=i.current.get(T.id);(!p||!E)&&(E={x:T.position.x,y:T.position.y});let N={x:E.x+y,y:E.y+m};return i.current.set(T.id,N),{id:T.id,dragging:!0,type:"position",position:N}});e&&e(x)};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,e,o,n])};var Fu=require("@xyflow/react");var zu={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Yu={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Bu=(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}},bh=e=>{e=e||"";let t=e.trim().split(`
|
|
42
|
+
`),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=Bu(i[0],o),s=Bu(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},Wu=e=>{let{components:t,connections:o}=bh(e);return{nodes:t,edges:o}};var Xu=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Fu.useReactFlow)(),{getNextId:n}=Nt();return{importFromLia:i=>{let a=typeof i=="string"?i:i.diagramXml||"",{nodes:s,edges:l}=Wu(a),c=[],d=new Map,u=!1,f=n();for(let[m,x]of Object.entries(s)){let T=String(f++),E=zu[x.type],N=Yu[x.type];E==="START_EVENT"&&(u=!0),d.set(m,T);let b=ae[E].MIN_WIDTH,g=ae[E].MIN_HEIGHT;c.push({id:T,type:E,data:{label:x.label||"",variant:N,attribute:""},position:{x:0,y:0},width:b,height:g,measured:{width:b,height:g}})}let p=[];for(let m of l){let x=v(_({},_t),{id:String(f++),source:d.get(m.sourceId)||m.sourceId,target:d.get(m.targetId)||m.targetId});p.push(x)}if(!u&&c.length>0){let m=String(f++),x={id:m,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:ae.START_EVENT.MIN_WIDTH,height:ae.START_EVENT.MIN_HEIGHT,measured:{width:ae.START_EVENT.MIN_WIDTH,height:ae.START_EVENT.MIN_HEIGHT}};c.unshift(x);let T=c[1];if(T){let E=v(_({},_t),{id:String(f++),source:m,target:T.id});p.unshift(E)}}let{nodes:h,edges:y}=bd(c,p);e(h),t(y),o({padding:Sn,minZoom:Mn,maxZoom:Pn})}}};var ji=require("react"),_h={origin:"*",debug:!1};function Uu(e,t=_h){let{origin:o,debug:n}=t,r=(0,ji.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,ji.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||(s==null?void 0:s.data)===void 0)return;let{event:l,data:c}=s,d;if(Array.isArray(c)){let[,u]=c;d=u.data}else d=c;n&&(console.debug("[postMessage] received:",s),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var $u=require("@xyflow/react"),js=require("react");var Ku=()=>{let e=(0,$u.useNodesInitialized)(),{initialDiagram:t,setIsInitialized:o}=ee(),{importFromMxGraph:n}=kn();(0,js.useEffect)(()=>{t&&n(t)},[t,n,o]),(0,js.useEffect)(()=>{if(!e)return;(async()=>{await kr(),o(!0)})()},[e,o])};var ea=require("react"),qu=require("@xyflow/react");function Zu(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Lo(),{getEdges:n}=(0,qu.useReactFlow)(),r=Yr(),i=(0,ea.useCallback)(s=>{if(!(s!=null&&s.activities))return;e(s.activities);let l=s.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),a=(0,ea.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var Qu=require("@xyflow/react"),Je=require("react"),ju=require("use-debounce");var Th=500,Ju=100,ep=(e=!1)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,Qu.useReactFlow)(),[i,a]=(0,Je.useState)({history:[],currentStep:0}),{history:s,currentStep:l}=i,c=l>0,d=l<s.length-1,u=(0,Je.useCallback)((b,g)=>{n(b[g].nodes),r(b[g].edges)},[n,r]),f=(0,Je.useCallback)(()=>{if(l>0){let b=l-1;a(g=>v(_({},g),{currentStep:b})),u(s,b)}},[l,s,u]),p=(0,Je.useCallback)(()=>{if(l<s.length-1){let b=l+1;a(g=>v(_({},g),{currentStep:b})),u(s,b)}},[s,l,u]),h=(0,Je.useCallback)(b=>{a(g=>{let w=g.history[g.currentStep];if(w&&JSON.stringify(w)===JSON.stringify(b))return g;let D=[...g.history.slice(0,g.currentStep+1),b],S=D.length>Ju?D.slice(D.length-Ju):D;return{history:S,currentStep:S.length-1}})},[]),y=(0,Je.useCallback)((b,g)=>{let w=b.map(I=>v(_({},I),{selected:!1,className:"",data:v(_({},I.data),{hasError:!1})})),A=g.map(I=>v(_({},I),{data:v(_({},I.data),{hasError:!1})}));return{nodes:Co(w),edges:A}},[]),m=(0,Je.useCallback)(()=>y(t(),o()),[t,o,y]),x=(0,ju.useDebouncedCallback)(()=>{let b=m();h(b)},Th),T=(0,Je.useCallback)((b,g)=>{if(!e)return;if(s.length===0){let I=m();a({history:[I],currentStep:0})}if(b==="forceSave"){if(g){h(y(g.nodes,g.edges));return}x();return}b.some(I=>I.type==="select")||b.some(I=>I.type==="position"&&I.dragging)||x()},[e,x,s.length,m,h,y]);(0,Je.useEffect)(()=>{if(e&&s.length===0){let b=m();a({history:[b],currentStep:0})}},[e,s.length,m]);let E=(0,Je.useCallback)(b=>{a({history:b||[],currentStep:0})},[]),N=(0,Je.useCallback)(()=>{a({history:[],currentStep:0})},[]);return(0,Je.useEffect)(()=>{let b=g=>{(g.ctrlKey||g.metaKey)&&(g.shiftKey&&g.key.toLowerCase()==="z"?(g.preventDefault(),p()):g.key.toLowerCase()==="z"&&(g.preventDefault(),f()))};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[f,p]),{history:s,undo:f,redo:p,canUndo:c,canRedo:d,saveHistory:T,resetHistory:E,clearHistory:N}};var op=()=>{let{t:e}=(0,tp.useTranslation)(),[t,o,n]=(0,Ut.useNodesState)([]),[r,i,a]=(0,Ut.useEdgesState)([]),{getNodes:s,getNode:l}=(0,Ut.useReactFlow)(),{toast:c}=tt(),d=(0,Ut.useStoreApi)(),{instanceId:u,isInitialized:f,setIsConnecting:p,setIsMultipleSelection:h,onElementClick:y}=ee(),{updateHelperLines:m,HelperLines:x}=bi(),{undo:T,redo:E,canUndo:N,canRedo:b,saveHistory:g}=ep(f),{onNodeDrag:w,onDrop:A,onDragOver:I,onDragLeave:D,onNodeDragStop:S,onNodeDragStart:L}=ku({nodes:t,setNodes:o,setEdges:i,saveHistory:g}),{isValidConnection:z,onConnect:q,onReconnect:Q,onReconnectStart:U,onReconnectEnd:$,setReconnectingEdge:M,clearReconnectingEdge:O}=pu({setEdges:i,saveHistory:g}),{handleValidationComplete:P,clearValidation:C,dismissValidationPanel:F,validateDiagram:R,getIsClearingValidation:H}=Nu(),{importFromLia:k}=Xu(),{handleTasksStatus:G,handleClearTaskStatus:B}=Zu(),{clearPathEdges:K}=Lo(),{emitElementChanges:W,handleNodeChanges:X,handleEdgeChanges:Z}=Zi(),j=Yr();Su({saveHistory:g}),Hu({saveHistory:g}),Ku();let Y=(0,vt.useCallback)(()=>{o([]),i([]),K(),setTimeout(j,0)},[o,i,K,j]);Uu({LIA_CREATE_DIAGRAM:k,CLEAR_DIAGRAM:Y,TASKS_STATUS:G,CLEAR_TASKS_STATUS:B});let{selectElements:te,clearSelection:ne}=fo(),{importFromMxGraph:J,exportToMxGraph:le}=kn(),{configureElement:fe,getConfigureElement:me}=Ii(),He=(0,vt.useCallback)(()=>t.length+r.length,[t,r]);(0,vt.useEffect)(()=>(zt.set(u,{importFromMxGraph:J,exportToMxGraph:le,selectElements:te,clearSelection:ne,configureElement:fe,getConfigureElement:me,getElementsCount:He,setReconnectingEdge:M,clearReconnectingEdge:O}),()=>{zt.delete(u)}),[u,J,le,te,ne,fe,me,He,M,O]);let we=(0,vt.useCallback)((ze,Ue)=>{if(Ue.type!=="TASK"&&Ue.type!=="GATEWAY")return;let $e=me(Ue.id);$e&&(y==null||y($e))},[me,y]),he=(0,vt.useCallback)((ze,Ue)=>{if(Ue.type!=="SEQUENCE_EDGE")return;let $e=l(Ue.source),no=l(Ue.target),{isFromStartEvent:wr,isGatewayToGateway:Ir,isActiviyToAndGateway:wt}=Vr($e,no);if(!(!wr&&!Ir&&!wt))return;let wo=me(Ue.id);wo&&(y==null||y(wo))},[me,l,y]),de=(0,vt.useCallback)(ze=>{let Ue=m(ze,t);n(Ue),g(ze),H()||F(),X(ze)},[t,n,g,H,F,m,X]),We=(0,vt.useCallback)(ze=>{a(ze),g(ze),H()||F(),Z(ze)},[a,g,H,F,Z]);Gu(de);let Qe=(0,vt.useCallback)(({nodes:ze,edges:Ue})=>{h(ze.length+Ue.length>=2)},[h]);(0,Ut.useOnSelectionChange)({onChange:Qe});let Rt=(0,vt.useCallback)(async({nodes:ze})=>ze.some($e=>$e.type==="LANE"&&t.some(no=>no.parentId===$e.id))?(c({variant:"error",title:e("validation.errors.title"),content:e("editor.toolbar.delete_pool_lane_error")}),!1):!0,[t,e,c]),qt=()=>{g("forceSave"),W(),F()},No=()=>{p(!0)},vo=()=>{p(!1),F()},vr=(0,vt.useCallback)(ze=>{let Ue=new Set(ze.filter($e=>$e.type==="LANE"&&!!$e.parentId).map($e=>$e.parentId));Ue.size!==0&&setTimeout(()=>{var wr,Ir;let $e=s(),no=new Map($e.map(wt=>[wt.id,wt]));for(let wt of Ue){let Zo=Po($e.filter(Jo=>Jo.type==="LANE"&&Jo.parentId===wt));if(Zo.length===0)continue;let wo=0;for(let Jo of Zo)no.set(Jo.id,v(_({},Jo),{position:{x:re.HEADER_WIDTH,y:wo}})),wo+=(Ir=(wr=Jo.measured)==null?void 0:wr.height)!=null?Ir:0;let ls=no.get(wt);ls&&no.set(wt,v(_({},ls),{height:wo,measured:v(_({},ls.measured),{height:wo})}))}o($e.map(wt=>{var Zo;return(Zo=no.get(wt.id))!=null?Zo:wt}))},0)},[s,o]);return{nodes:t,setNodes:o,edges:r,setEdges:i,events:{isValidConnection:z,onConnect:q,onReconnect:Q,onReconnectStart:U,onReconnectEnd:$,onDrop:A,onDragOver:I,onDragLeave:D,onNodeDrag:w,onNodeDragStop:S,onNodeDragStart:L,onNodeClick:we,onEdgeClick:he,onDropCapture:qt,onConnectStart:No,onConnectEnd:vo,onSelectionEnd:()=>setTimeout(()=>d.setState({nodesSelectionActive:!1}),0),onNodesChange:de,onEdgesChange:We,onBeforeDelete:Rt,onNodesDelete:vr},ui:{handleCloseValidationPanel:C},controls:{undo:T,redo:E,canUndo:N,canRedo:b},components:{HelperLines:x},actions:{saveHistory:g,selectElements:te,clearSelection:ne,exportToMxGraph:le,validateDiagram:R,handleValidationComplete:P,setReconnectingEdge:M,clearReconnectingEdge:O}}};var ta=require("react/jsx-runtime"),es=({id:e,className:t})=>(0,ta.jsx)("marker",{id:e,className:V("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,ta.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var Xo=require("react/jsx-runtime"),np=()=>(0,Xo.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,Xo.jsxs)("defs",{children:[(0,Xo.jsx)(es,{id:"sequence-edge-marker",className:"text-grey-500"}),(0,Xo.jsx)(es,{id:"sequence-edge-marker-hovered",className:"text-grey-800"}),(0,Xo.jsx)(es,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var _o=require("@produto-lecom/lecom-ui");var Tr=require("@xyflow/react"),Pe=require("@produto-lecom/lecom-ui"),bo=require("lucide-react"),qo=require("react");var xo=require("@produto-lecom/lecom-ui");var br=(E=>(E.START_EVENT="START_EVENT",E.END_EVENT="END_EVENT",E.TASK="TASK",E.SUBPROCESS="SUBPROCESS",E.GATEWAY="GATEWAY",E.LANE="LANE",E.ANNOTATION="ANNOTATION",E.CONNECTION="CONNECTION",E.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",E.ACTIVITY="ACTIVITY",E.PROCESS_INTERFACE="PROCESS_INTERFACE",E.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",E.VARIANT_ACTIVITY="VARIANT_ACTIVITY",E.AUTO_ACTIVITY="AUTO_ACTIVITY",E.DATA_STORE="DATA_STORE",E.DATA_OBJECT="DATA_OBJECT",E.DATA_OUTPUT="DATA_OUTPUT",E.DATA_INPUT="DATA_INPUT",E.MARKER="MARKER",E))(br||{});var os=require("@produto-lecom/lecom-ui"),mp=require("@xyflow/react");var rp=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 ip({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
|
|
43
|
+
`),i=encodeURI(r);ts(i,`${o}.csv`)}var ts=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};function sp(e){return e==null?void 0:e.replaceAll("
"," ")}var nS={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},ap={script:"SCRIPT",subprocess:"SUBPROCESS"},lp={"marker-loop":"LOOP"},cp={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL",inclusive:"EXCLUSIVE"};var Uo=({cell:e,type:t,variant:o="",attribute:n=""})=>{let{_attributes:r,mxGeometry:i}=e,{value:a,parent:s}=r,l=Number(i._attributes.width),c=Number(i._attributes.height),d=s==="1"?void 0:s;return{id:r.id,parentId:d,type:t,data:{label:a||"",variant:o,attribute:n},position:{x:Number(i._attributes.x)||0,y:Number(i._attributes.y)||0},width:l,height:c,measured:{width:l,height:c}}},vh=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ae.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=ae.START_EVENT.MIN_HEIGHT,{node:Uo({cell:e,type:"START_EVENT"}),status:n,originalType:o}},wh=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ae.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=ae.END_EVENT.MIN_HEIGHT,{node:Uo({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Ih=(e,t)=>{let{id:o,subType:n,style:r}=e==null?void 0:e._attributes,i=ap[n],a=t.get(o)||"",s=lp[a]||"",l=s==="LOOP",c="imported";return!["script","none"].includes(n)&&!l&&(c="adapted"),e.mxGeometry._attributes.width=io(e.mxGeometry._attributes.width||0,ae.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=io(e.mxGeometry._attributes.height||0,ae.TASK.MIN_HEIGHT),{node:Uo({cell:e,type:"TASK",variant:i,attribute:s}),status:c,originalType:r}},Ah=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=cp[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=ae.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=ae.GATEWAY.MIN_HEIGHT,{node:Uo({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Ch=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:Uo({cell:e,type:"LANE"}),status:"imported",originalType:t}},Sh=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=io(e.mxGeometry._attributes.width||0,ae.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=io(e.mxGeometry._attributes.height||0,ae.ANNOTATION.MIN_HEIGHT),{node:Uo({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},dp=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ae.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=ae.UNSUPPORTED.MIN_HEIGHT,{node:Uo({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},up=(e,t)=>{let{id:o,source:n,target:r,value:i}=e._attributes;return v(_({},_t),{id:o,source:t.get(n)||n,target:t.get(r)||r,data:{label:i||""}})},pp={TASK:Ih,GATEWAY:Ah,START_EVENT:vh,END_EVENT:wh,LANE:Ch,ANNOTATION:Sh};var Mh=e=>{let t=new Map,o=Object.values(br),n=[],r=new Map;e.forEach(s=>{var c;let l=(c=s._attributes)==null?void 0:c.type;if(l==="MARKER"){r.set(s._attributes.parent,s._attributes.style);return}if(o.includes(l)){n.push(s);return}});let i=[],a=[];for(let s of n){let{type:l}=s._attributes,c=pp[l]||dp,{node:d,status:u,originalType:f}=c(s,r);a.push(d),i.push({originalType:f,type:d.type,variant:d.data.variant,value:sp(d.data.label),status:u})}return{nodes:a,governanceIdToNodeIdMap:t,summary:i}},Ph=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>up(r,t)),Lh=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Mh(t.root.mxCell),i=Ph(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},kh=async e=>{let t=await rp(e),o=Gi(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},fp=async e=>{try{let t=await kh(e),{nodes:o,edges:n,summary:r}=Lh(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var hp=require("react/jsx-runtime"),gp=()=>{let{t:e}=(0,os.useTranslation)(),{toast:t}=tt(),{setNodes:o,setEdges:n,fitView:r}=(0,mp.useReactFlow)(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(d=>[d.originalType,d.value,e(`adapter.governance.report.status.${d.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,hp.jsx)(os.Button,{size:"small",variant:"ghost",onClick:()=>ip({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async s=>{try{let{nodes:l,edges:c,summary:d}=await fp(s);if(o(f=>f.concat(l)),n(f=>f.concat(c)),r({padding:Sn,minZoom:Mn,maxZoom:Pn}),d.some(f=>f.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 yp=require("@produto-lecom/lecom-ui"),xp=require("react");var $o=require("react/jsx-runtime"),Ep=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=Dt(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,xp.useRef)(null),d=f=>{let p=f.target.files;p!=null&&p.length&&i(p),c.current&&(c.current.value="")};return(0,$o.jsxs)($o.Fragment,{children:[(0,$o.jsx)(yp.Button,v(_({disabled:n,onClick:f=>{var p;(p=c.current)==null||p.click(),r==null||r(f)}},a),{children:e})),(0,$o.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var Ko=require("react/jsx-runtime"),bp=({disabled:e=!1})=>{let{t}=(0,xo.useTranslation)(),{toast:o}=tt(),{importFromGovernance:n}=gp(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(s)};return(0,Ko.jsxs)(xo.Tooltip,{children:[(0,Ko.jsx)(xo.TooltipTrigger,{asChild:!0,children:(0,Ko.jsx)(Ep,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Ko.jsx)(ga,{})})}),(0,Ko.jsx)(xo.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var _p=require("react/jsx-runtime"),oa=({shortcut:e})=>(0,_p.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 xe=require("@produto-lecom/lecom-ui"),Eo=require("lucide-react"),Ap=require("react");var Np=require("@produto-lecom/lecom-ui"),vp=require("@xyflow/react"),_r=require("html-to-image"),wp=require("react");var Rh=3,na="diagram",ns=50,Dh=96,Oh=25.4,Tp=e=>e*Oh/Dh,Ip=()=>{let{t:e}=(0,Np.useTranslation)(),{toast:t}=tt(),{getNodes:o,getNodesBounds:n}=(0,vp.useReactFlow)(),{clearSelection:r}=fo(),[i,a]=(0,wp.useState)({png:!1,html:!1,print:!1}),s=()=>{let f=Ws(o()),p=n(f),h=p.width+ns*2,y=p.height+ns*2,m=ns-p.x,x=ns-p.y;return{width:h,height:y,style:{width:`${h}px`,height:`${y}px`,transform:`translate(${m}px, ${x}px)`,transformOrigin:"top left"}}},l=async(f,p)=>{a(h=>v(_({},h),{[p]:!0})),await r();try{if(Ws(o()).length===0){t({content:e("editor.controls.actions.export.feedback.empty"),variant:"warning"});return}let y=Td();if(!y)throw new Error("Flow element not found");let m=s();return await f(y,m)}catch(h){console.error("Diagram export failed",h),t({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{a(h=>v(_({},h),{[p]:!1}))}};return{exportAsPng:async(f=na)=>{await l(async(p,h)=>{let y=await(0,_r.toPng)(p,v(_({},h),{backgroundColor:"#fcfcfc",skipFonts:!0}));ts(y,`${f}.png`)},"png")},exportAsHtml:async(f=na)=>{await l(async(p,h)=>{let y=await(0,_r.toSvg)(p,v(_({},h),{backgroundColor:"#fcfcfc",skipFonts:!0})),m=`
|
|
44
44
|
<!DOCTYPE html>
|
|
45
45
|
<html>
|
|
46
46
|
<head>
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
<body>
|
|
68
68
|
<img src="${y}" alt="${f}" />
|
|
69
69
|
</body>
|
|
70
|
-
</html>`,
|
|
70
|
+
</html>`,x=new Blob([m],{type:"text/html"}),T=URL.createObjectURL(x);ts(T,`${f}.html`),window.setTimeout(()=>URL.revokeObjectURL(T),1e4)},"html")},printDiagram:async(f=na)=>{await l(async(p,h)=>{var A;let y=await(0,_r.toPng)(p,v(_({},h),{backgroundColor:"#fcfcfc",pixelRatio:Rh,skipFonts:!0})),m=document.createElement("iframe");m.style.position="fixed",m.style.right="0",m.style.bottom="0",m.style.width="0",m.style.height="0",m.style.border="0",document.body.appendChild(m);let x=(A=m.contentWindow)==null?void 0:A.document;if(!x)throw document.body.removeChild(m),new Error("Unable to access print iframe document");let T=Tp(h.width).toFixed(2),E=Tp(h.height).toFixed(2),N=x.createElement("style");N.textContent=`
|
|
71
71
|
@page {
|
|
72
|
-
size: ${
|
|
72
|
+
size: ${T}mm ${E}mm;
|
|
73
73
|
margin: 0;
|
|
74
74
|
}
|
|
75
75
|
html, body {
|
|
@@ -83,4 +83,4 @@
|
|
|
83
83
|
height: 100%;
|
|
84
84
|
object-fit: contain;
|
|
85
85
|
}
|
|
86
|
-
`,_.head.appendChild(w),_.title=f;let b=_.createElement("img");b.alt="Diagram",_.body.appendChild(b),await new Promise((A,M)=>{let S=!1,k=B=>{S||(S=!0,B?M(B):A())};b.onload=()=>k(),b.onerror=()=>k(new Error("Failed to load print image")),b.src=y,b.complete&&b.naturalWidth>0&&k()});let x=m.contentWindow;if(!x)throw document.body.removeChild(m),new Error("Unable to access print iframe window");let N=()=>{m.parentNode&&document.body.removeChild(m)};x.addEventListener("afterprint",N,{once:!0}),window.setTimeout(N,6e4),x.focus(),x.print()},"print")},isPrintingPng:i.png,isPrintingHtml:i.html,isPrinting:i.print}};var Ee=require("react/jsx-runtime");function ip(){let{t:e}=(0,me.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=np(),[s,l]=(0,rp.useState)(!1);return(0,Ee.jsxs)(me.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,Ee.jsx)(me.DropdownMenuTrigger,{asChild:!0,children:(0,Ee.jsx)("div",{children:(0,Ee.jsxs)(me.Tooltip,{children:[(0,Ee.jsx)(me.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(me.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,Ee.jsx)(fo.FolderOutputIcon,{})})}),!s&&(0,Ee.jsx)(me.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,Ee.jsxs)(me.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,Ee.jsxs)(me.Tooltip,{children:[(0,Ee.jsx)(me.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(me.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,Ee.jsx)(fo.FileImageIcon,{})})}),(0,Ee.jsx)(me.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,Ee.jsxs)(me.Tooltip,{children:[(0,Ee.jsx)(me.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(me.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,Ee.jsx)(fo.FileCodeIcon,{})})}),(0,Ee.jsx)(me.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,Ee.jsxs)(me.Tooltip,{children:[(0,Ee.jsx)(me.TooltipTrigger,{asChild:!0,children:(0,Ee.jsx)(me.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,Ee.jsx)(fo.PrinterIcon,{})})}),(0,Ee.jsx)(me.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var ae=require("react/jsx-runtime"),sp=({nodes:e,edges:t,validateDiagram:o,handleValidationComplete:n})=>{let{t:r}=(0,Ce.useTranslation)(),{clearSelection:i}=so(),{mode:a,isMinimapOpen:s,setIsMinimapOpen:l,isMoveTool:c,isHandTool:d,setIsMoveTool:u,setIsHandTool:f}=Q(),{getNodes:p,getEdges:g}=(0,mr.useReactFlow)(),y=(0,mr.useKeyPress)(["v","V"]),m=(0,mr.useKeyPress)(["h","H"]),_=(0,Vo.useCallback)(()=>{i(),f(!0),u(!1)},[i,f,u]),h=(0,Vo.useCallback)(()=>{u(!0),f(!1)},[u,f]),E=(0,Vo.useCallback)(()=>{let w=p(),b=g(),x=o({nodes:w,edges:b});n(x)},[p,g,o,n]);return(0,Vo.useEffect)(()=>{y&&!c&&a==="edit"&&h()},[y,h,c,a]),(0,Vo.useEffect)(()=>{m&&!d&&a==="edit"&&_()},[m,_,d,a]),(0,ae.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[a==="edit"&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(Ce.Tooltip,{children:[(0,ae.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ce.Button,{size:"small",variant:"ghost",color:"grey",className:D(c&&"bg-grey-400"),iconButton:!0,onClick:h,children:(0,ae.jsx)(mo.MousePointerIcon,{})})}),(0,ae.jsxs)(Ce.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.move_tool"),(0,ae.jsx)(Vs,{shortcut:"V"})]})]}),(0,ae.jsxs)(Ce.Tooltip,{children:[(0,ae.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ce.Button,{size:"small",variant:"ghost",color:"grey",className:D(d&&"bg-grey-400"),iconButton:!0,onClick:_,children:(0,ae.jsx)(mo.HandIcon,{})})}),(0,ae.jsxs)(Ce.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.hand_tool")," ",(0,ae.jsx)(Vs,{shortcut:"H"})]})]})]}),(0,ae.jsx)(ip,{}),a==="edit"&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(Ce.Tooltip,{children:[(0,ae.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:E,children:(0,ae.jsx)(mo.ListCheckIcon,{})})}),(0,ae.jsx)(Ce.TooltipContent,{color:"black",children:r("editor.controls.actions.check")})]}),(0,ae.jsx)(Ju,{disabled:e.length>0||t.length>0})]}),(0,ae.jsxs)(Ce.Tooltip,{children:[(0,ae.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(Ce.Button,{size:"small",variant:"ghost",color:"grey",className:D(s&&"bg-grey-400"),iconButton:!0,onClick:()=>l(!s),children:(0,ae.jsx)(mo.MapIcon,{})})}),(0,ae.jsx)(Ce.TooltipContent,{color:"black",children:r(s?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var ot=require("@produto-lecom/lecom-ui"),Fi=require("lucide-react"),pt=require("react/jsx-runtime"),ap=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,ot.useTranslation)();return(0,pt.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,pt.jsxs)(ot.Tooltip,{children:[(0,pt.jsx)(ot.TooltipTrigger,{asChild:!0,children:(0,pt.jsx)(ot.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,pt.jsx)(Fi.UndoIcon,{})})}),(0,pt.jsx)(ot.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,pt.jsxs)(ot.Tooltip,{children:[(0,pt.jsx)(ot.TooltipTrigger,{asChild:!0,children:(0,pt.jsx)(ot.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,pt.jsx)(Fi.RedoIcon,{})})}),(0,pt.jsx)(ot.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var vn=require("@xyflow/react"),Se=require("@produto-lecom/lecom-ui"),wn=require("lucide-react");var Ae=require("react/jsx-runtime"),lp=()=>{let{t:e}=(0,Se.useTranslation)(),t=(0,vn.useNodes)(),o=(0,vn.useEdges)(),{zoomIn:n,zoomOut:r,zoomTo:i,fitView:a}=(0,vn.useReactFlow)(),s=t.length===0&&o.length===0;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)(Se.Tooltip,{children:[(0,Ae.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Se.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>a(),children:(0,Ae.jsx)(wn.ScanIcon,{})})}),(0,Ae.jsx)(Se.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Ae.jsxs)(Se.Tooltip,{children:[(0,Ae.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Se.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>r(),children:(0,Ae.jsx)(wn.ZoomOut,{})})}),(0,Ae.jsx)(Se.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Ae.jsxs)(Se.Tooltip,{children:[(0,Ae.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Se.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>i(1),children:(0,Ae.jsx)(ta,{})})}),(0,Ae.jsx)(Se.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Ae.jsxs)(Se.Tooltip,{children:[(0,Ae.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,Ae.jsx)(Se.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>n(),children:(0,Ae.jsx)(wn.ZoomIn,{})})}),(0,Ae.jsx)(Se.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var cp=require("@xyflow/react"),Yt=require("@produto-lecom/lecom-ui"),Wi=require("react");var It=require("react/jsx-runtime"),dp=()=>{let e=(0,Wi.useRef)(null),{t}=(0,Yt.useTranslation)(),{setDraggableNode:o}=hn(),n=(0,cp.useNodes)(),{setIsDragging:r}=Q(),[i,a]=(0,Wi.useState)(void 0),s=[{type:"START_EVENT",icon:vr,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Bo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Mn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ra,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:na,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:oa,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Fo,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Xo,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:zo,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:ea,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:_r,label:t("bpmn.annotation.variant.default")}],l=(c,d)=>{o({type:d.type,variant:d.variant,attribute:d.attribute,icon:d.icon}),a((0,It.jsx)(d.icon,{})),c.dataTransfer.effectAllowed="move",e.current&&c.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,It.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,It.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:s.map((c,d)=>{let u=!io(c.type,n),f=u?t("editor.toolbar.start_event_already_exists"):c.label;return(0,It.jsxs)(Yt.Tooltip,{children:[(0,It.jsx)(Yt.TooltipTrigger,{asChild:!0,children:(0,It.jsx)(Yt.Button,{className:D("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":u}),size:"small",variant:"ghost",color:"grey",draggable:!u,disabled:u,iconButton:!0,onDragStart:u?void 0:p=>l(p,c),children:(0,It.jsx)(c.icon,{})},d)}),(0,It.jsx)(Yt.TooltipContent,{color:"black",side:"right",children:f})]},d)})}),(0,It.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Fe=require("react/jsx-runtime"),Gs=(0,Ct.forwardRef)((e,t)=>{let o=(0,Ft.useKeyPress)("Space"),{instanceId:n,mode:r,isMinimapOpen:i,isMoveTool:a,isHandTool:s}=Q(),[l,c]=(0,Ct.useState)(!1),d=(0,Ct.useRef)(null),{nodes:u,edges:f,actions:p,events:g,components:y,controls:m}=ku(),{t:_}=(0,go.useTranslation)();(0,Ct.useImperativeHandle)(t,()=>({selectElements:p.selectElements,clearSelection:p.clearSelection})),(0,Ct.useEffect)(()=>{let x=d.current;if(!x)return;let N=A=>{s||o||r==="edit"&&Ri.some(M=>M===A.button)&&c(!0)},I=A=>{(A.buttons&zd)===0&&c(!1)};return x.addEventListener("pointerdown",N),window.addEventListener("pointerup",I),()=>{x.removeEventListener("pointerdown",N),window.removeEventListener("pointerup",I)}},[s,o,r]),(0,Ct.useEffect)(()=>{let x=d.current;if(!x)return;let N=x.querySelector(".react-flow__pane");if(!N)return;let I=A=>A.preventDefault();return N.addEventListener("contextmenu",I),()=>N.removeEventListener("contextmenu",I)},[]);let h=s||o||r!=="edit"?!0:Ri,E=r!=="readonly"&&a&&!o,w=r==="edit"&&a&&!o,b=r==="edit"&&a&&!o;return(0,Fe.jsxs)("div",{ref:d,className:"w-full h-full",children:[r==="edit"&&(0,Fe.jsx)(dp,{}),(0,Fe.jsx)(Ru,{}),(0,Fe.jsxs)(Ft.ReactFlow,v(T({},g),{id:`modeler-${n}`,className:D({"is-hand-tool":s||o||l}),edges:f,nodes:u,nodeTypes:Md,edgeTypes:Pd,minZoom:Ms,maxZoom:Vd,panOnDrag:h,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!1,elementsSelectable:E,nodesConnectable:w,nodesDraggable:b,connectionLineComponent:Id,selectionMode:Ft.SelectionMode.Partial,multiSelectionKeyCode:["Control","Meta"],deleteKeyCode:"Delete",selectionKeyCode:null,defaultViewport:Hd,connectOnClick:!1,connectionRadius:50,proOptions:{hideAttribution:!0},children:[(0,Fe.jsx)(Ft.Background,{gap:Dd,size:Rd,color:kd,bgColor:Ld}),i&&(0,Fe.jsxs)(go.Tooltip,{children:[(0,Fe.jsx)(go.TooltipTrigger,{asChild:!0,children:(0,Fe.jsx)("div",{className:"absolute bottom-[0px] left-[0px] z-[5]",children:(0,Fe.jsx)(Ft.MiniMap,{pannable:!0,zoomable:!0,position:Od,className:"shadow-md rounded-md",ariaLabel:"",style:{pointerEvents:"all",position:"relative"}})})}),(0,Fe.jsx)(go.TooltipContent,{color:"black",children:_("editor.controls.actions.minimap.label")})]}),(0,Fe.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[r==="edit"&&(0,Fe.jsx)(ap,T({},m)),(0,Fe.jsx)(sp,{nodes:u,edges:f,validateDiagram:p.validateDiagram,handleValidationComplete:p.handleValidationComplete}),(0,Fe.jsx)(lp,{})]}),(0,Fe.jsx)(y.HelperLines,{})]}))]})});Gs.displayName="Editor";var up=require("@xyflow/react"),Xi=require("react"),pp=require("react/jsx-runtime"),fh=e=>({width:e.width,height:e.height,transform:e.transform}),Bs="rgba(51, 103, 217, 0.4)",ic=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,up.useStore)(fh),i=(0,Xi.useRef)(null);return(0,Xi.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=Bs,t&&(s.beginPath(),s.strokeStyle=t.color||Bs,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||Bs,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,pp.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var An=require("@produto-lecom/lecom-ui"),ho=require("react");var gr=require("react/jsx-runtime"),Ot=new Map,fp=(0,ho.createContext)(null),on=()=>{let e=(0,ho.useContext)(fp);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},mp=({locale:e,defaultMode:t="view",toast:o,children:n})=>{let[r,i]=(0,ho.useState)(e||"pt_BR");(0,ho.useEffect)(()=>{e&&(i(e),An.i18n.changeLanguage(e))},[e]);let a=g=>{let y=Ot.size;if(y===0)throw new Error("No modeler instances found");if(y===1||!g){let[_]=Ot.values();return _}let m=Ot.get(g);if(!m)throw new Error(`Modeler instance with ID "${g}" not found`);return m},s=(g,y)=>{let m=a(y);return m==null?void 0:m.selectElements(g)},l=async g=>{let y=a(g);return y==null?void 0:y.clearSelection()},c=(g,y)=>{let m=a(y);return m==null?void 0:m.configureElement(g)},d=(g,y)=>{let m=a(y);return m==null?void 0:m.getConfigureElement(g)},u=async(g,y)=>{let m=a(y);await(m==null?void 0:m.importFromMxGraph(g))},f=g=>{let y=a(g);return y==null?void 0:y.exportToMxGraph()},p=g=>{let y=a(g);return(y==null?void 0:y.getElementsCount())||0};return(0,gr.jsx)(fp.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:f,getElementsCount:p,toast:o},children:(0,gr.jsxs)(An.TooltipProvider,{children:[!o&&(0,gr.jsx)(An.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var hp=require("@produto-lecom/lecom-ui"),Ui=require("react/jsx-runtime"),yp=(0,Me.createContext)(null),Q=()=>{let e=(0,Me.useContext)(yp);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},xp=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s})=>{let{t:l}=(0,hp.useTranslation)(),{defaultMode:c}=on(),d=(0,Me.useId)(),[u]=(0,Me.useState)(o||d),[f,p]=(0,Me.useState)(n||c||"edit"),[g,y]=(0,Me.useState)(jn),[m,_]=(0,Me.useState)(!1),[h,E]=(0,Me.useState)(!0),[w,b]=(0,Me.useState)(!1),[x,N]=(0,Me.useState)(!1),[I,A]=(0,Me.useState)(!1),[M,S]=(0,Me.useState)(!1),[k,B]=(0,Me.useState)(!1),[q,j]=(0,Me.useState)(null);(0,Me.useEffect)(()=>{n&&p(n)},[n]);let C=(0,Me.useMemo)(()=>t||ed(l),[t,l]),P={instanceId:u,initialDiagram:C,mode:f,lastElementId:g,isInitialized:m,isMinimapOpen:x,isMoveTool:h,isHandTool:w,isDragging:I,isMultipleSelection:k,isConnecting:M,setLastElementId:y,setIsInitialized:_,reconnectingEdgeId:q,setIsMinimapOpen:N,setIsMoveTool:E,setIsHandTool:b,setIsDragging:A,setIsConnecting:S,setIsMultipleSelection:B,setReconnectingEdgeId:j,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s};return(0,Ui.jsx)(gp.ReactFlowProvider,{children:(0,Ui.jsx)(yp.Provider,{value:P,children:(0,Ui.jsx)(Gs,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
|
|
86
|
+
`,x.head.appendChild(N),x.title=f;let b=x.createElement("img");b.alt="Diagram",x.body.appendChild(b),await new Promise((I,D)=>{let S=!1,L=z=>{S||(S=!0,z?D(z):I())};b.onload=()=>L(),b.onerror=()=>L(new Error("Failed to load print image")),b.src=y,b.complete&&b.naturalWidth>0&&L()});let g=m.contentWindow;if(!g)throw document.body.removeChild(m),new Error("Unable to access print iframe window");let w=()=>{m.parentNode&&document.body.removeChild(m)};g.addEventListener("afterprint",w,{once:!0}),window.setTimeout(w,6e4),g.focus(),g.print()},"print")},isPrintingPng:i.png,isPrintingHtml:i.html,isPrinting:i.print}};var _e=require("react/jsx-runtime");function Cp(){let{t:e}=(0,xe.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=Ip(),[s,l]=(0,Ap.useState)(!1);return(0,_e.jsxs)(xe.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,_e.jsx)(xe.DropdownMenuTrigger,{asChild:!0,children:(0,_e.jsx)("div",{children:(0,_e.jsxs)(xe.Tooltip,{children:[(0,_e.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(xe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,_e.jsx)(Eo.FolderOutputIcon,{})})}),!s&&(0,_e.jsx)(xe.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,_e.jsxs)(xe.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,_e.jsxs)(xe.Tooltip,{children:[(0,_e.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(xe.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,_e.jsx)(Eo.FileImageIcon,{})})}),(0,_e.jsx)(xe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,_e.jsxs)(xe.Tooltip,{children:[(0,_e.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(xe.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,_e.jsx)(Eo.FileCodeIcon,{})})}),(0,_e.jsx)(xe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,_e.jsxs)(xe.Tooltip,{children:[(0,_e.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,_e.jsx)(xe.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,_e.jsx)(Eo.PrinterIcon,{})})}),(0,_e.jsx)(xe.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var ue=require("react/jsx-runtime"),Sp=({nodes:e,edges:t,validateDiagram:o,handleValidationComplete:n})=>{let{t:r}=(0,Pe.useTranslation)(),{clearSelection:i}=fo(),{mode:a,isMinimapOpen:s,setIsMinimapOpen:l,isMoveTool:c,isHandTool:d,setIsMoveTool:u,setIsHandTool:f}=ee(),{getNodes:p,getEdges:h}=(0,Tr.useReactFlow)(),y=(0,Tr.useKeyPress)(["v","V"]),m=(0,Tr.useKeyPress)(["h","H"]),x=(0,qo.useCallback)(()=>{i(),f(!0),u(!1)},[i,f,u]),T=(0,qo.useCallback)(()=>{u(!0),f(!1)},[u,f]),E=(0,qo.useCallback)(()=>{let N=p(),b=h(),g=o({nodes:N,edges:b});n(g)},[p,h,o,n]);return(0,qo.useEffect)(()=>{y&&!c&&a==="edit"&&T()},[y,T,c,a]),(0,qo.useEffect)(()=>{m&&!d&&a==="edit"&&x()},[m,x,d,a]),(0,ue.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[a==="edit"&&(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)(Pe.Tooltip,{children:[(0,ue.jsx)(Pe.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(Pe.Button,{size:"small",variant:"ghost",color:"grey",className:V(c&&"bg-grey-400"),iconButton:!0,onClick:T,children:(0,ue.jsx)(bo.MousePointerIcon,{})})}),(0,ue.jsxs)(Pe.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.move_tool"),(0,ue.jsx)(oa,{shortcut:"V"})]})]}),(0,ue.jsxs)(Pe.Tooltip,{children:[(0,ue.jsx)(Pe.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(Pe.Button,{size:"small",variant:"ghost",color:"grey",className:V(d&&"bg-grey-400"),iconButton:!0,onClick:x,children:(0,ue.jsx)(bo.HandIcon,{})})}),(0,ue.jsxs)(Pe.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[r("editor.controls.actions.hand_tool")," ",(0,ue.jsx)(oa,{shortcut:"H"})]})]})]}),(0,ue.jsx)(Cp,{}),a==="edit"&&(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)(Pe.Tooltip,{children:[(0,ue.jsx)(Pe.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(Pe.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:E,children:(0,ue.jsx)(bo.ListCheckIcon,{})})}),(0,ue.jsx)(Pe.TooltipContent,{color:"black",children:r("editor.controls.actions.check")})]}),(0,ue.jsx)(bp,{disabled:e.length>0||t.length>0})]}),(0,ue.jsxs)(Pe.Tooltip,{children:[(0,ue.jsx)(Pe.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(Pe.Button,{size:"small",variant:"ghost",color:"grey",className:V(s&&"bg-grey-400"),iconButton:!0,onClick:()=>l(!s),children:(0,ue.jsx)(bo.MapIcon,{})})}),(0,ue.jsx)(Pe.TooltipContent,{color:"black",children:r(s?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var rt=require("@produto-lecom/lecom-ui"),rs=require("lucide-react"),gt=require("react/jsx-runtime"),Mp=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,rt.useTranslation)();return(0,gt.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,gt.jsxs)(rt.Tooltip,{children:[(0,gt.jsx)(rt.TooltipTrigger,{asChild:!0,children:(0,gt.jsx)(rt.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,gt.jsx)(rs.UndoIcon,{})})}),(0,gt.jsx)(rt.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,gt.jsxs)(rt.Tooltip,{children:[(0,gt.jsx)(rt.TooltipTrigger,{asChild:!0,children:(0,gt.jsx)(rt.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,gt.jsx)(rs.RedoIcon,{})})}),(0,gt.jsx)(rt.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var Rn=require("@xyflow/react"),Le=require("@produto-lecom/lecom-ui"),Dn=require("lucide-react");var Ce=require("react/jsx-runtime"),Pp=()=>{let{t:e}=(0,Le.useTranslation)(),t=(0,Rn.useNodes)(),o=(0,Rn.useEdges)(),{zoomIn:n,zoomOut:r,zoomTo:i,fitView:a}=(0,Rn.useReactFlow)(),s=t.length===0&&o.length===0;return(0,Ce.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ce.jsxs)(Le.Tooltip,{children:[(0,Ce.jsx)(Le.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(Le.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>a(),children:(0,Ce.jsx)(Dn.ScanIcon,{})})}),(0,Ce.jsx)(Le.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,Ce.jsxs)(Le.Tooltip,{children:[(0,Ce.jsx)(Le.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(Le.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>r(),children:(0,Ce.jsx)(Dn.ZoomOut,{})})}),(0,Ce.jsx)(Le.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,Ce.jsxs)(Le.Tooltip,{children:[(0,Ce.jsx)(Le.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(Le.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>i(1),children:(0,Ce.jsx)(Ea,{})})}),(0,Ce.jsx)(Le.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,Ce.jsxs)(Le.Tooltip,{children:[(0,Ce.jsx)(Le.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(Le.Button,{iconButton:!0,size:"small",color:"grey",variant:"ghost",disabled:s,onClick:()=>n(),children:(0,Ce.jsx)(Dn.ZoomIn,{})})}),(0,Ce.jsx)(Le.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Lp=require("@xyflow/react"),$t=require("@produto-lecom/lecom-ui"),is=require("react");var Lt=require("react/jsx-runtime"),kp=()=>{let e=(0,is.useRef)(null),{t}=(0,$t.useTranslation)(),{setDraggableNode:o}=An(),n=(0,Lp.useNodes)(),{setIsDragging:r}=ee(),[i,a]=(0,is.useState)(void 0),s=[{type:"START_EVENT",icon:Dr,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Qo,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Bn,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Ta,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:_a,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ba,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:tn,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:nn,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:jo,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:xa,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Lr,label:t("bpmn.annotation.variant.default")}],l=(c,d)=>{o({type:d.type,variant:d.variant,attribute:d.attribute,icon:d.icon}),a((0,Lt.jsx)(d.icon,{})),c.dataTransfer.effectAllowed="move",e.current&&c.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Lt.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Lt.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:s.map((c,d)=>{let u=!po(c.type,n),f=u?t("editor.toolbar.start_event_already_exists"):c.label;return(0,Lt.jsxs)($t.Tooltip,{children:[(0,Lt.jsx)($t.TooltipTrigger,{asChild:!0,children:(0,Lt.jsx)($t.Button,{className:V("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":u}),size:"small",variant:"ghost",color:"grey",draggable:!u,disabled:u,iconButton:!0,onDragStart:u?void 0:p=>l(p,c),children:(0,Lt.jsx)(c.icon,{})},d)}),(0,Lt.jsx)($t.TooltipContent,{color:"black",side:"right",children:f})]},d)})}),(0,Lt.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Xe=require("react/jsx-runtime"),ra=(0,kt.forwardRef)((e,t)=>{let o=(0,Kt.useKeyPress)("Space"),{instanceId:n,mode:r,isMinimapOpen:i,isMoveTool:a,isHandTool:s}=ee(),[l,c]=(0,kt.useState)(!1),d=(0,kt.useRef)(null),{nodes:u,edges:f,actions:p,events:h,components:y,controls:m}=op(),{t:x}=(0,_o.useTranslation)();(0,kt.useImperativeHandle)(t,()=>({selectElements:p.selectElements,clearSelection:p.clearSelection})),(0,kt.useEffect)(()=>{let g=d.current;if(!g)return;let w=I=>{s||o||r==="edit"&&qi.some(D=>D===I.button)&&c(!0)},A=I=>{(I.buttons&cu)===0&&c(!1)};return g.addEventListener("pointerdown",w),window.addEventListener("pointerup",A),()=>{g.removeEventListener("pointerdown",w),window.removeEventListener("pointerup",A)}},[s,o,r]),(0,kt.useEffect)(()=>{let g=d.current;if(!g)return;let w=g.querySelector(".react-flow__pane");if(!w)return;let A=I=>I.preventDefault();return w.addEventListener("contextmenu",A),()=>w.removeEventListener("contextmenu",A)},[]);let T=s||o||r!=="edit"?!0:qi,E=r!=="readonly"&&a&&!o,N=r==="edit"&&a&&!o,b=r==="edit"&&a&&!o;return(0,Xe.jsxs)("div",{ref:d,className:"w-full h-full",children:[r==="edit"&&(0,Xe.jsx)(kp,{}),(0,Xe.jsx)(np,{}),(0,Xe.jsxs)(Kt.ReactFlow,v(_({},h),{id:`modeler-${n}`,className:V({"is-hand-tool":s||o||l}),edges:f,nodes:u,nodeTypes:Qd,edgeTypes:jd,minZoom:Zs,maxZoom:iu,panOnDrag:T,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:E,nodesConnectable:N,nodesDraggable:b,connectionLineComponent:qd,selectionMode:Kt.SelectionMode.Partial,multiSelectionKeyCode:["Control","Meta"],deleteKeyCode:"Delete",selectionKeyCode:null,defaultViewport:su,connectOnClick:!1,connectionRadius:50,proOptions:{hideAttribution:!0},children:[(0,Xe.jsx)(Kt.Background,{gap:nu,size:ou,color:tu,bgColor:eu}),i&&(0,Xe.jsxs)(_o.Tooltip,{children:[(0,Xe.jsx)(_o.TooltipTrigger,{asChild:!0,children:(0,Xe.jsx)("div",{className:"absolute bottom-[0px] left-[0px] z-[5]",children:(0,Xe.jsx)(Kt.MiniMap,{pannable:!0,zoomable:!0,position:ru,className:"shadow-md rounded-md",ariaLabel:"",style:{pointerEvents:"all",position:"relative"}})})}),(0,Xe.jsx)(_o.TooltipContent,{color:"black",children:x("editor.controls.actions.minimap.label")})]}),(0,Xe.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[r==="edit"&&(0,Xe.jsx)(Mp,_({},m)),(0,Xe.jsx)(Sp,{nodes:u,edges:f,validateDiagram:p.validateDiagram,handleValidationComplete:p.handleValidationComplete}),(0,Xe.jsx)(Pp,{})]}),(0,Xe.jsx)(y.HelperLines,{})]}))]})});ra.displayName="Editor";var Rp=require("@xyflow/react"),ss=require("react"),Dp=require("react/jsx-runtime"),Hh=e=>({width:e.width,height:e.height,transform:e.transform}),ia="rgba(51, 103, 217, 0.4)",Rc=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,Rp.useStore)(Hh),i=(0,ss.useRef)(null);return(0,ss.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=ia,t&&(s.beginPath(),s.strokeStyle=t.color||ia,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||ia,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,Dp.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var On=require("@produto-lecom/lecom-ui"),To=require("react");var Nr=require("react/jsx-runtime"),zt=new Map,Op=(0,To.createContext)(null),yn=()=>{let e=(0,To.useContext)(Op);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Hp=({locale:e,defaultMode:t="view",toast:o,children:n})=>{let[r,i]=(0,To.useState)(e||"pt_BR");(0,To.useEffect)(()=>{e&&(i(e),On.i18n.changeLanguage(e))},[e]);let a=h=>{let y=zt.size;if(y===0)throw new Error("No modeler instances found");if(y===1||!h){let[x]=zt.values();return x}let m=zt.get(h);if(!m)throw new Error(`Modeler instance with ID "${h}" not found`);return m},s=(h,y)=>{let m=a(y);return m==null?void 0:m.selectElements(h)},l=async h=>{let y=a(h);return y==null?void 0:y.clearSelection()},c=(h,y)=>{let m=a(y);return m==null?void 0:m.configureElement(h)},d=(h,y)=>{let m=a(y);return m==null?void 0:m.getConfigureElement(h)},u=async(h,y)=>{let m=a(y);await(m==null?void 0:m.importFromMxGraph(h))},f=h=>{let y=a(h);return y==null?void 0:y.exportToMxGraph()},p=h=>{let y=a(h);return(y==null?void 0:y.getElementsCount())||0};return(0,Nr.jsx)(Op.Provider,{value:{defaultMode:t,locale:r,selectElements:s,clearSelection:l,configureElement:c,getConfigureElement:d,importDiagram:u,exportDiagram:f,getElementsCount:p,toast:o},children:(0,Nr.jsxs)(On.TooltipProvider,{children:[!o&&(0,Nr.jsx)(On.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),n]})})};var Gp=require("@produto-lecom/lecom-ui"),as=require("react/jsx-runtime"),Bp=(0,ke.createContext)(null),ee=()=>{let e=(0,ke.useContext)(Bp);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},zp=({selectorRef:e,initialDiagram:t,instanceId:o,mode:n,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s})=>{let{t:l}=(0,Gp.useTranslation)(),{defaultMode:c}=yn(),d=(0,ke.useId)(),[u]=(0,ke.useState)(o||d),[f,p]=(0,ke.useState)(n||c||"edit"),[h,y]=(0,ke.useState)(ar),[m,x]=(0,ke.useState)(!1),[T,E]=(0,ke.useState)(!0),[N,b]=(0,ke.useState)(!1),[g,w]=(0,ke.useState)(!1),[A,I]=(0,ke.useState)(!1),[D,S]=(0,ke.useState)(!1),[L,z]=(0,ke.useState)(!1),[q,Q]=(0,ke.useState)(null);(0,ke.useEffect)(()=>{n&&p(n)},[n]);let U=(0,ke.useMemo)(()=>t||Nd(l),[t,l]),$={instanceId:u,initialDiagram:U,mode:f,lastElementId:h,isInitialized:m,isMinimapOpen:g,isMoveTool:T,isHandTool:N,isDragging:A,isMultipleSelection:L,isConnecting:D,setLastElementId:y,setIsInitialized:x,reconnectingEdgeId:q,setIsMinimapOpen:w,setIsMoveTool:E,setIsHandTool:b,setIsDragging:I,setIsConnecting:S,setIsMultipleSelection:z,setReconnectingEdgeId:Q,onElementChanges:r,onConfigureElement:i,onElementClick:a,onSubprocessValidationClick:s};return(0,as.jsx)(Vp.ReactFlowProvider,{children:(0,as.jsx)(Bp.Provider,{value:$,children:(0,as.jsx)(ra,{ref:e})})})};0&&(module.exports={EditorMode,ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});
|