lecom-modeler 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var bi=Object.create;var Tt=Object.defineProperty,yi=Object.defineProperties,hi=Object.getOwnPropertyDescriptor,vi=Object.getOwnPropertyDescriptors,Ni=Object.getOwnPropertyNames,Ft=Object.getOwnPropertySymbols,_i=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable;var fn=(e,t,o)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_=(e,t)=>{for(var o in t||(t={}))zo.call(t,o)&&fn(e,o,t[o]);if(Ft)for(var o of Ft(t))En.call(t,o)&&fn(e,o,t[o]);return e},w=(e,t)=>yi(e,vi(t));var ke=(e,t)=>{var o={};for(var n in e)zo.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Ft)for(var n of Ft(e))t.indexOf(n)<0&&En.call(e,n)&&(o[n]=e[n]);return o};var Ti=(e,t)=>{for(var o in t)Tt(e,o,{get:t[o],enumerable:!0})},bn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ni(t))!zo.call(e,r)&&r!==o&&Tt(e,r,{get:()=>t[r],enumerable:!(n=hi(t,r))||n.enumerable});return e};var xi=(e,t,o)=>(o=e!=null?bi(_i(e)):{},bn(t||!e||!e.__esModule?Tt(o,"default",{value:e,enumerable:!0}):o,e)),wi=e=>bn(Tt({},"__esModule",{value:!0}),e);var is={};Ti(is,{ActivityVariant:()=>$t,ComplexVariant:()=>Xt,ElementType:()=>Kt,ExclusiveVariant:()=>qt,GatewayVariant:()=>he,Modeler:()=>as,RoutingVariant:()=>Zt,useSelectionUtils:()=>gt});module.exports=wi(is);var Wt=require("lecom-ui"),Yt=require("react/jsx-runtime");function yn({children:e}){return(0,Yt.jsxs)(Wt.TooltipProvider,{children:[(0,Yt.jsx)(Wt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var J=require("@xyflow/react"),ln=require("lecom-ui"),re=require("react"),Ya=require("use-debounce"),Ho=require("uuid");var Kt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Kt||{}),$t=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))($t||{}),Zt=(l=>(l.SIMPLE="simple",l.LOOP="loop",l.SCRIPT="script",l.COMPLEX="complex",l.EXCLUSIVE="exclusive",l.PARALLEL="parallel",l.FINAL="final",l.TO_SUB_PROCESS="to_sub_process",l))(Zt||{}),Xt=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Xt||{}),qt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(qt||{});var lt=require("lucide-react");var Fe=require("react/jsx-runtime"),jt=({size:e=24,className:t})=>(0,Fe.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Fe.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Fe.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Fe.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Fe.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Uo=require("react/jsx-runtime"),ot=({size:e=24,className:t})=>(0,Uo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,Uo.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 Ve=require("react/jsx-runtime"),Jt=({size:e=24,className:t})=>(0,Ve.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,Ve.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,Ve.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,nt.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,nt.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),Qt=({size:e=24,className:t})=>(0,at.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,at.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,at.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,at.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var it=require("react/jsx-runtime"),hn=({size:e=24,className:t})=>(0,it.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,it.jsxs)("g",{children:[(0,it.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,it.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var vn=require("clsx"),Nn=require("tailwind-merge");function k(...e){return(0,Nn.twMerge)((0,vn.clsx)(e))}var xt=(e,t)=>e<t?t:e;var wt=require("react/jsx-runtime"),_n=({size:e=24,className:t})=>(0,wt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:k("stroke-2",t),children:[(0,wt.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,wt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var eo=require("react/jsx-runtime"),Tn=({size:e=24,className:t})=>(0,eo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,eo.jsx)("g",{children:(0,eo.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 Fo=require("react/jsx-runtime"),to=({size:e=24,className:t})=>(0,Fo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:(0,Fo.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 Wo=require("react/jsx-runtime"),Ct=({size:e=24,className:t})=>(0,Wo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:k("stroke-2",t),children:(0,Wo.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 st=require("react/jsx-runtime"),xn=({size:e=24,className:t})=>(0,st.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,st.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"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,st.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Me=require("react/jsx-runtime"),wn=({size:e=24,className:t})=>(0,Me.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,Me.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,Me.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,Me.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,Me.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Me.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),Cn=({size:e=24,className:t})=>(0,We.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,We.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,We.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,We.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(i=>(i.START_EVENT="START_EVENT",i.END_EVENT="END_EVENT",i.TASK="TASK",i.LANE="LANE",i.GATEWAY="GATEWAY",i.ANNOTATION="ANNOTATION",i.UNSUPPORTED="UNSUPPORTED",i))(D||{});var oo={SCRIPT:{icon:lt.ScrollText},SUBPROCESS:{icon:lt.SquarePlus}};var no={LOOP:{icon:lt.RotateCcw}},he=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(he||{}),ro={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Qt},COMPLEX:{icon:Jt}};var Yo=xi(require("@dagrejs/dagre"),1),kn=require("@xyflow/react"),Ln=require("lodash");var Ci={MIN_WIDTH:36,MIN_HEIGHT:36},Ai={MIN_WIDTH:36,MIN_HEIGHT:36},Ii={MIN_WIDTH:56,MIN_HEIGHT:56},ao={MIN_WIDTH:176,MIN_HEIGHT:96},io={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},ae={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},so={MIN_WIDTH:176,MIN_HEIGHT:64},Si={MIN_WIDTH:128,MIN_HEIGHT:64},$={START_EVENT:Ci,END_EVENT:Ai,GATEWAY:Ii,TASK:ao,LANE:ae,ANNOTATION:so,UNSUPPORTED:Si};var An=require("lodash");var Le=e=>{var t,o,n,r,a,s,i,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(a=e.measured)==null?void 0:a.width)!=null?s:0,h:(l=(i=e.measured)==null?void 0:i.height)!=null?l:0}},Pe=e=>(0,An.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),In=(e,t)=>{let{x:o,y:n}=Le(e),{x:r,y:a}=Le(t);return{x:o-r,y:n-a}};var dt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),ki=(e,t)=>{let{x:o,y:n}=Le(e),{x:r,y:a}=Le(t),s=o-r,i=n-a;return Math.sqrt(s*s+i*i)},Li=(e,t)=>{let{x:o,y:n,w:r,h:a}=Le(e),{x:s,y:i,w:l,h:c}=Le(t);return o<s+l&&s<o+r&&n<i+c&&i<n+a},At=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Li(e,r)){let a=ki(e,r);a<n&&(n=a,o=r)}return o},Sn=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,a;return Math.max(o,(a=(r=n.measured)==null?void 0:r.width)!=null?a:0)},0);var Pn=(e=[],t=[],o="LR")=>{let n=new Yo.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:a,width:s,height:i})=>n.setNode(a,{width:s,height:i})),t.forEach(a=>n.setEdge(a.source,a.target)),Yo.default.layout(n),{nodes:e.map(a=>{let s=n.node(a.id);return w(_({},a),{position:{x:s.x-a.width/2,y:s.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var m,y;let o=[...t],n=o.find(E=>E.id===e);if(!n)return o;let r=o.filter(E=>E.parentId===e&&E.type==="LANE");if(r.length===0)return o;let a=(0,Ln.orderBy)(r,["position.y"]),s=Math.max((y=(m=n.measured)==null?void 0:m.width)!=null?y:0,io.MIN_WIDTH),i=Sn(e,a)||ae.MIN_WIDTH,l=Math.max(s,i),c=0,g=0;a.forEach(E=>{var h,v,p,d;o=o.map(x=>x.id===E.id?w(_({},x),{width:l-ae.HEADER_WIDTH,measured:w(_({},x.measured),{width:l-ae.HEADER_WIDTH}),position:{x:ae.HEADER_WIDTH,y:c}}):x),c+=(v=(h=E.measured)==null?void 0:h.height)!=null?v:0,g+=(d=(p=E.measured)==null?void 0:p.height)!=null?d:0}),o=o.map(E=>E.id===e?w(_({},E),{height:g,width:l,measured:w(_({},E.measured),{height:g,width:l})}):E);let f=o.find(E=>E.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},Dn=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Pi=50,Rn=(e,t=Pi)=>{let o=(0,kn.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Vn=require("zustand"),H=(0,Vn.create)(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));var kt=require("@xyflow/react");var Te=require("@xyflow/react");var Ee=require("@xyflow/react"),Ne=require("lecom-ui"),Hn=require("lucide-react");var lo=require("react"),Mn=(0,lo.createContext)(null),On=Mn.Provider,Gn=()=>{let e=(0,lo.useContext)(Mn);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),It=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{getNode:n,getEdge:r,getNodes:a,getEdges:s}=(0,Ee.useReactFlow)(),{onConfigureElement:i}=Gn(),l=u=>{var T,I,b,N,S;return u?u.type==="TASK"&&((T=u.data)==null?void 0:T.variant)==="SUBPROCESS"?{id:u.id,type:"sub_process",variant:g(u),label:(I=u.data)==null?void 0:I.label}:u.type==="GATEWAY"?{id:u.id,type:"gateway",variant:((b=u.data)==null?void 0:b.variant)||"EXCLUSIVE",label:(N=u.data)==null?void 0:N.label}:{id:u.id,type:"activity",variant:g(u),label:(S=u.data)==null?void 0:S.label}:null},c=u=>{let T=a(),I=s(),b=(0,Ee.getIncomers)(u,T,I);if(b.length===0)return;let N=b[0];return l(N)||void 0},g=u=>{let T=a(),I=s(),b=(0,Ee.getIncomers)(u,T,I),N=(0,Ee.getOutgoers)(u,T,I),S=b.some(C=>C.type==="START_EVENT"),P=N.some(C=>C.type==="END_EVENT");return S?"start":P?"end":"between"},f=u=>{var C,A,L,U;let T=a(),I=s(),b=n(u.source),N=n(u.target);if(!b||!N)return"simple";if((0,Ee.getOutgoers)(b,T,I).some(K=>K.type==="END_EVENT"))return"final";if(b.type==="GATEWAY")switch((C=b.data)==null?void 0:C.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(b.type==="TASK"){let K=(A=b.data)==null?void 0:A.variant,X=(L=b.data)==null?void 0:L.attribute;return N.type==="TASK"&&((U=N.data)==null?void 0:U.variant)==="SUBPROCESS"?"to_sub_process":K==="SCRIPT"?"script":X==="LOOP"?"loop":"simple"}return"simple"},m=u=>{var C;let T=n(u.source);if(!T||T.type!=="GATEWAY"||((C=T.data)==null?void 0:C.variant)!=="COMPLEX")return;let I=a(),b=s(),N=(0,Ee.getIncomers)(T,I,b),S=!1,P=!1;if(N.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(S=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(P=!0))}),S&&P)return"script_loop";if(S)return"script";if(P)return"loop"},y=u=>{var C;let T=n(u.source);if(!T||T.type!=="GATEWAY"||((C=T.data)==null?void 0:C.variant)!=="EXCLUSIVE")return;let I=a(),b=s(),N=(0,Ee.getIncomers)(T,I,b),S=!1,P=!1;if(N.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(S=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(P=!0))}),S)return"script";if(P)return"loop"},E=u=>{var P,C;if(u.type!=="GATEWAY")return;let T=a(),I=s(),b=(0,Ee.getIncomers)(u,T,I),N=!1,S=!1;if(b.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(N=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(S=!0))}),((P=u.data)==null?void 0:P.variant)==="COMPLEX"){if(N&&S)return"script_loop";if(N)return"script";if(S)return"loop"}else if(((C=u.data)==null?void 0:C.variant)==="EXCLUSIVE"){if(N)return"script";if(S)return"loop"}},h=u=>(0,Ee.getOutgoers)(u,a(),s()).map(b=>{var N,S;return{id:b.id,type:b.type,variant:(N=b.data)==null?void 0:N.variant,label:(S=b.data)==null?void 0:S.label}}),v=u=>s().filter(b=>b.source===u.id).map(b=>{var N;return{id:b.id,type:"routing",variant:f(b),label:(N=b.data)==null?void 0:N.label,target:n(b.target)}}),p=()=>{var I,b,N,S,P,C;let u=n(e);if(!u)return;let T=c(u);if(u.type==="TASK"&&((I=u.data)==null?void 0:I.variant)==="SUBPROCESS"){i==null||i({id:u.id,type:"sub_process",variant:g(u),label:(b=u.data)==null?void 0:b.label,origin:T,targets:h(u),edgeTargets:v(u)}),console.log({id:u.id,type:"sub_process",variant:g(u),label:(N=u.data)==null?void 0:N.label,origin:T,targets:h(u),edgeTargets:v(u)});return}if(u.type!=="GATEWAY"){i==null||i({id:u.id,type:"activity",variant:g(u),label:(S=u.data)==null?void 0:S.label,origin:T,targets:h(u),edgeTargets:v(u)});return}i==null||i({id:u.id,type:"gateway",variant:((P=u.data)==null?void 0:P.variant)||"EXCLUSIVE",label:(C=u.data)==null?void 0:C.label,origin:T,subVariant:E(u),targets:h(u)})},d=()=>{let u=r(e);if(u){let T=f(u),I;T==="complex"?I=m(u):T==="exclusive"&&(I=y(u));let b=n(u.source),N=b&&l(b)||void 0;i==null||i({id:u.id,type:"routing",variant:T,subVariant:I,origin:N,target:n(u.target)}),console.log({id:u.id,type:"routing",variant:T,subVariant:I,origin:N,target:n(u.target)})}};return(0,Ke.jsxs)(Ne.Tooltip,{children:[(0,Ke.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(Ne.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":p();break;case"edge":d();break}},children:(0,Ke.jsx)(Hn.Settings,{size:16})})}),(0,Ke.jsx)(Ne.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Bn=require("@xyflow/react"),_e=require("lecom-ui"),zn=require("lucide-react"),$e=require("react/jsx-runtime"),co=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,_e.useTranslation)(),{deleteElements:n}=(0,Bn.useReactFlow)();return(0,$e.jsxs)(_e.Tooltip,{children:[(0,$e.jsx)(_e.TooltipTrigger,{asChild:!0,children:(0,$e.jsx)(_e.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,$e.jsx)(zn.TrashIcon,{size:16})})}),(0,$e.jsx)(_e.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var St=require("react/jsx-runtime"),pt=n=>{var r=n,{edgeId:e,edgeType:t}=r,o=ke(r,["edgeId","edgeType"]);var i;let a=[{component:(0,St.jsx)(co,{elementId:e,elementType:"edge"})}],s={SEQUENCE_EDGE:[{component:(0,St.jsx)(It,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,St.jsx)("div",w(_({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(i=s[t])==null?void 0:i.map((l,c)=>(0,St.jsx)("div",{children:l.component},c))}))};var Ze=require("react/jsx-runtime"),uo={type:"ANNOTATION_EDGE",zIndex:2e3},Un=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,selected:i,data:l})=>{let c=(0,Te.useNodes)(),{zoom:g}=(0,Te.useViewport)(),{isMultipleSelection:f}=H(),m=c.find(x=>x.id===t),y=c.find(x=>x.id===o),[E,h,v]=(0,Te.getStraightPath)({sourceX:n,sourceY:r,targetX:a,targetY:s}),p=i||(m==null?void 0:m.selected)||(y==null?void 0:y.selected),d=1/g;return(0,Ze.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":p}),children:[(0,Ze.jsx)(Te.BaseEdge,{id:e,path:E,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":p&&!(l!=null&&l.hasError)})}),(0,Ze.jsx)(Te.EdgeLabelRenderer,{children:(0,Ze.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${v}px)`},children:i&&!f&&(0,Ze.jsx)(pt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};var ie=require("@xyflow/react"),Fn=require("react");var Xe=require("react");var $o=require("react/jsx-runtime"),ee=({value:e,maxLength:t,onChange:o,isEditing:n,onBlur:r,className:a,style:s})=>{let i=(0,Xe.useRef)(null),[l,c]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{c(n!=null?n:!1)},[n]),(0,Xe.useEffect)(()=>{if(l&&i.current){i.current.focus();let E=document.createRange();E.selectNodeContents(i.current),E.collapse(!1);let h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(E))}},[l]);let g=E=>{if(E.stopPropagation(),!l){c(!0);return}if(!i.current)return;let h=document.createRange();h.selectNodeContents(i.current);let v=window.getSelection();v&&(v.removeAllRanges(),v.addRange(h))},f=E=>{let h=E.currentTarget.innerText.trim(),v=t&&h.length>=t,p=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],d=E.ctrlKey||E.metaKey,x=d&&E.key==="a",u=d&&E.key==="c",T=d&&E.key==="x",I=d&&E.key==="v";function b(S){return/\w/.test(S)}if(h.length===0&&!b(E.key)&&!p.includes(E.key)&&!d){E.preventDefault();return}v&&(p.includes(E.key)||x||u||T||I||E.preventDefault())},m=E=>{if(!t)return;E.preventDefault();let h=E.clipboardData.getData("text/plain"),v=E.currentTarget.innerText,p=window.getSelection();if(!p||p.rangeCount===0)return;let d=p.getRangeAt(0);if((v.substring(0,d.startOffset)+h+v.substring(d.endOffset)).length>t){let u=t-(v.length-(d.endOffset-d.startOffset)),T=h.substring(0,Math.max(0,u));T&&(d.deleteContents(),d.insertNode(document.createTextNode(T)),d.setStartAfter(d.endContainer),d.collapse(!0),p.removeAllRanges(),p.addRange(d))}else d.deleteContents(),d.insertNode(document.createTextNode(h)),d.setStartAfter(d.endContainer),d.collapse(!0),p.removeAllRanges(),p.addRange(d)},y=E=>{c(!1);let h=E.currentTarget.innerText.trim();t&&h.length>t&&(h=h.substring(0,t)),E.currentTarget.innerText=h,r==null||r(),h!==e&&(o==null||o(h))};return(0,$o.jsx)("div",{className:k("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:s,onDoubleClick:g,children:(0,$o.jsx)("div",{ref:i,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onPaste:m,onBlur:y,children:e})})};var Oe=require("react/jsx-runtime"),xe={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:ie.MarkerType.ArrowClosed},markerEnd:{type:ie.MarkerType.Arrow},data:{label:""}},Wn=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:i,targetPosition:l,data:c,selected:g})=>{let f=(0,ie.useNodes)(),{zoom:m}=(0,ie.useViewport)(),{updateEdgeData:y}=(0,ie.useReactFlow)(),{isMultipleSelection:E}=H(),[h,v]=(0,Fn.useState)(!1),p=f.find(L=>L.id===t),d=f.find(L=>L.id===o),[x,u,T]=(0,ie.getSmoothStepPath)({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:s,targetPosition:l}),I=g||(p==null?void 0:p.selected)||(d==null?void 0:d.selected),b=I?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=h||(c==null?void 0:c.label.trim().length)>0,S=1/m,P=()=>{v(!0)},C=()=>{v(!1)},A=L=>{y(e,{label:L.trim()})};return(0,Oe.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":I}),onBlur:C,onDoubleClick:P,children:[(0,Oe.jsx)(ie.BaseEdge,{id:e,path:x,markerEnd:`url(#${b})`,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":I&&!(c!=null&&c.hasError)})}),(0,Oe.jsx)(ie.EdgeLabelRenderer,{children:(0,Oe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${T}px)`},children:[g&&!E&&(0,Oe.jsx)(pt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${S})`}}),N&&(0,Oe.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:A})]})})]})};var mo=e=>e.some(t=>t.type==="START_EVENT"),go=(e,t,o)=>{var a;let n=t.find(s=>s.id===e);return!n||n.type!=="GATEWAY"||((a=n.data)==null?void 0:a.variant)!=="EXCLUSIVE"?!1:o.filter(s=>s.source===e).length>=2},fo=(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"},Eo=(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"},bo=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.target===e).some(a=>{let s=t.find(i=>i.id===a.source);return(s==null?void 0:s.type)==="START_EVENT"})},yo=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.source===e).some(a=>{let s=t.find(i=>i.id===a.target);return(s==null?void 0:s.type)==="END_EVENT"})},ho=(e,t)=>t.filter(n=>n.source===e).length>0,vo=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.source===e).length>=2};var Di=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!go(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!vo(e.sourceNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="GATEWAY"),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(fo(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(Eo(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(bo(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(yo(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(ho(e.sourceNodeId,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION"],LANE:["ANNOTATION"],ANNOTATION:[],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],Yn=e=>{for(let t of Di){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Ri=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:go(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:mo(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:fo(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Eo(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:bo(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:yo(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ho(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:vo(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Kn=e=>{let t=Ri.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 $n=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,kt.useReactFlow)();return{isValidConnection:s=>{let i=t(s.source),l=t(s.target);if(!i||!l)return!1;let c={sourceNodeId:i.id,targetNodeId:l.id,sourceNodeType:i.type,targetNodeType:l.type,nodes:n(),edges:o()};return Yn(c).isValid},onConnect:s=>{e(i=>{let l=t(s.target);return(l==null?void 0:l.type)==="ANNOTATION"?(0,kt.addEdge)(_(_({},s),uo),i):(0,kt.addEdge)(_(_({},s),xe),i)})}}};var Zo=require("react"),or=require("lecom-ui"),nr=require("@xyflow/react");var Lt=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ge=(e=[])=>e.filter(t=>t.type==="TASK")||[],Zn=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Xn=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),No=(e=[])=>e.filter(t=>t.type==="GATEWAY"),qn=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),me=(e,t=[])=>t.filter(o=>o.source===e),Pt=(e,t=[])=>t.filter(o=>o.target===e),jn=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(a=>a.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Jn=(e,t)=>{let o=me(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(a=>a.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},Qn=e=>e?/\w/g.test(e.trim()):!1,M=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:[]}},we=(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)}},er=(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 Dt=[{id:"start_event_not_found",validate:e=>{let t=Lt(e.nodes);return M({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=qe(e.nodes);return M({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Lt(e.nodes),o=t.length===1;if(t.length===0)return M({isValid:!0});if(!o)return M({isValid:!1,nodeIds:t.map(a=>a.id)});let n=me(t[0].id,e.edges);if(!(n.length<=1)){let a=[...t.map(s=>s.id),...n.map(s=>s.target)];return M({isValid:!1,nodeIds:[...new Set(a)]})}return M({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ge(e.nodes),o=we(t,n=>me(n.id,e.edges).length<=2);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ge(e.nodes),o=we(t,n=>!!n.label&&n.label.trim()!=="");return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ge(e.nodes),n=we(o,r=>!r.label||r.label.length<=60);return M({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ge(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let a=r.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(a=>n.push(a.id));return M({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=No(e.nodes),o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="GATEWAY"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Lt(e.nodes),...qe(e.nodes)],o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&(i.type==="START_EVENT"||i.type==="END_EVENT")&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],n=[];for(let r of t){let a=Pt(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.source);if(i&&i.type==="TASK"){let l=me(i.id,e.edges);l.length>1&&(o.push(i.id),l.forEach(c=>n.push(c.id)))}}}return M({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=qn(e.nodes),o=we(t,r=>me(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>me(r,e.edges).map(a=>a.id));return M({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=Ge(e.nodes),o=we(t,n=>!n.label||Qn(n.label));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,i;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((i=e==null?void 0:e.edges)!=null&&i.length))return M({isValid:!0});let t=qe(e.nodes)[0];if(!t)return M({isValid:!0});let o=Pt(t.id,e.edges);if(!o.length)return M({isValid:!0});let r=Ge(e.nodes).filter(l=>o.some(c=>c.source===l.id)),a=we(r,l=>!jn(l.id,e));return M({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ge(e.nodes),o=qe(e.nodes)[0];if(!o)return M({isValid:!0});let n=t.filter(l=>{let c=Pt(l.id,e.edges),g=me(l.id,e.edges),f=c.some(y=>{var E;return((E=e.nodes.find(h=>h.id===y.source))==null?void 0:E.type)==="START_EVENT"}),m=g.some(y=>{var E;return((E=e.nodes.find(h=>h.id===y.target))==null?void 0:E.type)==="END_EVENT"});return f&&m}),r=Pt(o.id,e.edges),a=r.length>1,s=r.map(l=>l.source),i={isValid:n.length===0&&!a,nodeIds:[...n.map(l=>l.id),...a?s:[]]};return M(i)}},{id:"gateway_flow_to_event",validate:e=>{let t=No(e.nodes),o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="END_EVENT"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=No(e.nodes),o=we(t,n=>me(n.id,e.edges).length>=1);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Lt(e.nodes),...qe(e.nodes)],o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="GATEWAY"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Zn(e.nodes),o=we(t,n=>!Jn(n.id,e));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Xn(e.nodes),o=we(t,n=>{var r,a;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((a=n.properties)==null?void 0:a.subprocessRef)!==""});return M({isValid:o.isValid,nodeIds:o.invalidIds})}}];var tr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Dt){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 rr=()=>{let{t:e}=(0,or.useTranslation)(),[t,o]=(0,Zo.useState)(null),{setNodes:n,setEdges:r,getNodes:a,getEdges:s}=(0,nr.useReactFlow)(),[i,l]=(0,Zo.useState)(!1);return{validationResult:t,validateDiagram:m=>{let y=er(m.nodes,m.edges),E=tr(y),h=E.errors.map(v=>w(_({},v),{message:e(`validation.errors.${v.id}`)}));return i||l(!0),{isValid:E.isValid,errors:h}},handleValidationComplete:m=>{if(o(m),!m)return;let y=[],E=[];m.errors.forEach(b=>{b.nodeIds&&b.nodeIds.length>0&&b.nodeIds.forEach(N=>y.push(N)),b.edgeIds&&b.edgeIds.length>0&&b.edgeIds.forEach(N=>E.push(N))});let h=[...new Set(y)];n(b=>b.map(N=>w(_({},N),{data:w(_({},N.data),{hasError:!1})}))),r(b=>b.map(N=>w(_({},N),{data:w(_({},N.data),{hasError:!1})})));let v=a(),p=s(),d=new Set(h),x=new Set;m.errors.forEach(b=>{var P,C;let N=Dt.find(A=>A.id===b.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((P=b.edgeIds)==null||P.forEach(A=>x.add(A)),(C=b.nodeIds)==null||C.forEach(A=>{p.forEach(L=>{(L.source===A||L.target===A)&&x.add(L.id)})}))});let u=new Set,T=new Set,I=new Set;v.forEach(b=>{b.type==="START_EVENT"?u.add(b.id):b.type==="END_EVENT"&&T.add(b.id)}),p.forEach(b=>{u.has(b.source)&&I.add(b.target),T.has(b.target)&&I.add(b.source)}),I.forEach(b=>{var N,S;if(d.has(b)){let P=(N=m.errors.find(A=>{var L;return(L=A.nodeIds)==null?void 0:L.includes(b)}))==null?void 0:N.id;((S=Dt.find(A=>A.id===P))==null?void 0:S.highlightRelatedEdges)!==!1&&p.forEach(A=>{A.source===b&&T.has(A.target)&&(d.add(A.target),x.add(A.id)),A.target===b&&u.has(A.source)&&(d.add(A.source),x.add(A.id))})}}),d.size>0&&n(b=>b.map(N=>w(_({},N),{data:w(_({},N.data),{hasError:d.has(N.id)})}))),x.size>0&&r(b=>b.map(N=>w(_({},N),{data:w(_({},N.data),{hasError:x.has(N.id)})})))},clearValidation:()=>{o(null),l(!1),n(m=>m.map(y=>w(_({},y),{data:w(_({},y.data),{hasError:!1})}))),r(m=>m.map(y=>w(_({},y),{data:w(_({},y.data),{hasError:!1})})))},isAutoValidationEnabled:i}};var sr=require("@xyflow/react"),lr=require("lecom-ui"),dr=require("react"),Xo=require("uuid");var _o=(e,t)=>{let n=e.filter(a=>a.type==="TASK").map(a=>{var i;let s=(i=a.data)==null?void 0:i.label;if(s&&s.startsWith(`${t} `)){let l=s.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(a=>a>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},To=(e,t)=>{let n=t.filter(i=>i.type==="TASK").map(i=>{var l;return(l=i.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),a=n.filter(i=>i===r||i.startsWith(`${r} (`)).map(i=>{if(i===r)return 1;let l=i.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(i=>i>0),s=2;for(;a.includes(s);)s++;return`${r} (${s})`};var Vi=15,ar="bpmn:selection",Mi=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",a=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||a},ir=e=>{if(!Mi(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},cr=({offset:e=Vi}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,sr.useReactFlow)(),{t:a}=(0,lr.useTranslation)();(0,dr.useEffect)(()=>{let s=l=>{var h,v;if(!ir(l))return;let c=t(),g=n(),f=c.filter(p=>p.selected);if(!f.length)return;l.preventDefault(),l.stopPropagation();let m=g.filter(p=>f.some(d=>d.id===p.source)&&f.some(d=>d.id===p.target)),E=JSON.stringify({nodes:f,edges:m});(h=l.clipboardData)==null||h.setData(ar,E),(v=l.clipboardData)==null||v.setData("text/plain",`BPMN Selection: ${f.length} nodes`)},i=l=>{var v,p;if(!ir(l))return;let c=(v=l.clipboardData)==null?void 0:v.getData(ar);if(!c)return;l.preventDefault(),l.stopPropagation();let g;try{g=JSON.parse(c)}catch(d){return}if(!((p=g.nodes)!=null&&p.length))return;let f=new Map,m=t(),y=[],E=g.nodes.map(d=>{var T;let x=(0,Xo.v7)();f.set(d.id,x);let u=w(_({},d),{id:x,selected:!0,position:{x:d.position.x+e,y:d.position.y+e}});if(d.type==="TASK"){let I=(T=d.data)==null?void 0:T.label,b=To(I||a("bpmn.task.label.prefix"),[...m,...y]);u.data=w(_({},d.data),{label:b})}return y.push(u),u}),h=g.edges.map(d=>w(_({},d),{id:(0,Xo.v7)(),selected:!0,source:f.get(d.source)||d.source,target:f.get(d.target)||d.target}));o(d=>[...d.map(x=>w(_({},x),{selected:!1})),...E]),r(d=>[...d.map(x=>w(_({},x),{selected:!1})),...h])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",i,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",i,!0)}},[t,o,n,r,e,a])};var xo=require("@xyflow/react"),fr=require("lecom-ui"),qo=require("uuid");var pr=require("zustand"),ut=(0,pr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var de=require("@xyflow/react"),ur=require("react");var He=require("react/jsx-runtime"),Id={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:de.MarkerType.Arrow},data:{label:""}},mr=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:i,targetPosition:l,data:c,selected:g})=>{let f=(0,de.useNodes)(),{zoom:m}=(0,de.useViewport)(),{updateEdgeData:y}=(0,de.useReactFlow)(),{isMultipleSelection:E}=H(),[h,v]=(0,ur.useState)(!1),p=f.find(L=>L.id===t),d=f.find(L=>L.id===o),[x,u,T]=(0,de.getSmoothStepPath)({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:s,targetPosition:l}),I=g||(p==null?void 0:p.selected)||(d==null?void 0:d.selected),b=I?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=h||(c==null?void 0:c.label.trim().length)>0,S=1/m,P=()=>{v(!0)},C=()=>{v(!1)},A=L=>{y(e,{label:L.trim()})};return(0,He.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":I}),onBlur:C,onDoubleClick:P,children:[(0,He.jsx)(de.BaseEdge,{id:e,path:x,markerEnd:`url(#${b})`,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":I&&!(c!=null&&c.hasError)})}),(0,He.jsx)(de.EdgeLabelRenderer,{children:(0,He.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${T}px)`},children:[g&&!E&&(0,He.jsx)(pt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${S})`}}),N&&(0,He.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:A})]})})]})};var Rt=require("react/jsx-runtime"),gr=({fromX:e,fromY:t,toX:o,toY:n})=>(0,Rt.jsxs)("g",{children:[(0,Rt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${n} ${e} ${n} ${o},${n}`}),(0,Rt.jsx)("circle",{cx:o,cy:n,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Er=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,xo.useStoreApi)(),{draggableNode:r,setDraggableNode:a}=ut(),{getInternalNode:s,screenToFlowPosition:i}=(0,xo.useReactFlow)(),{t:l}=(0,fr.useTranslation)(),c=p=>{let d="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(x=>x.map(u=>w(_({},u),{className:u.id===p?d:""})))},g=()=>{let{nodeLookup:p}=n.getState();return Array.from(p.values())},f=p=>{let d=s(p.id),x=g();if(p.type==="LANE"){if(dt({parentId:p.id,nodes:e,includeTypes:["LANE"]})){c();return}let S=x.filter(A=>A.id!==p.id&&A.type==="LANE"&&!A.parentId),P=At(d,S);if(!P){c();return}if(dt({parentId:P.id,nodes:e,excludeTypes:["LANE"]})){c();return}c(P.id);return}let T=x.filter(N=>N.id!==p.id&&N.type==="LANE"),I=At(d,T);if(!I){c();return}if(dt({parentId:I.id,nodes:e,includeTypes:["LANE"]})){c();return}c(I.id)},m=p=>{p.preventDefault(),p.dataTransfer.dropEffect="move"},y=(p,d)=>{p.preventDefault(),f(d)},E=(p,d,x)=>{var S,P;let u=C=>C.map(A=>w(_({},A),{className:void 0}));if(p.parentId===d.id){let C=Ye(d.id,x);t(Pe(u(C)));return}if(p.type==="LANE"){if(dt({parentId:d.id,nodes:x,excludeTypes:["LANE"]}))return;let L=x.filter(X=>X.parentId===d.id).reduce((X,Qe)=>{var Ue,et;return X+((et=(Ue=Qe.measured)==null?void 0:Ue.height)!=null?et:0)},0),U={x:ae.HEADER_WIDTH,y:L},K=x.map(X=>X.id===p.id?w(_({},X),{parentId:d.id,position:U,className:void 0}):w(_({},X),{className:void 0}));K=Ye(d.id,K),t(Pe(K));return}if(dt({parentId:d.id,nodes:x,includeTypes:["LANE"]})){let C;if(p.parentId){let L=s(p.parentId),{x:U,y:K}=Le(L);C={x:U+((S=p.position.x)!=null?S:0),y:K+((P=p.position.y)!=null?P:0)}}let A=x.map(L=>L.id===p.id?w(_({},L),{position:C!=null?C:L.position,parentId:void 0,className:void 0}):w(_({},L),{className:void 0}));t(Pe(A));return}let b=In(p,d),N=x.map(C=>C.id===p.id?w(_({},C),{parentId:d.id,position:b,className:void 0}):w(_({},C),{className:void 0}));t(Pe(N))};return{onDragOver:m,onDrop:p=>{if(p.preventDefault(),!(r!=null&&r.type))return;let d=i({x:p.clientX,y:p.clientY}),x={width:$[r.type].MIN_WIDTH,height:$[r.type].MIN_HEIGHT},u={id:(0,qo.v7)(),type:r.type,position:d,measured:x,data:{label:r.type==="TASK"?_o(e,l("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute}},T=w(_({},u),{internals:{positionAbsolute:d}}),I=g(),b=r.type==="LANE",N=I.filter(C=>b?C.type==="LANE"&&!C.parentId:C.type==="LANE"),S=At(T,N);S?E(T,S,[...I,T]):t(C=>{let A=C.concat(u);return Pe(A)});let P=p.dataTransfer.getData("sourceId");if(P){let C={id:(0,qo.v7)(),source:P,target:u.id};if(r.type==="ANNOTATION"){o(A=>A.concat(_(_({},C),uo)));return}o(A=>A.concat(_(_({},C),xe)))}a(null)},onNodeDrag:y,onNodeDragStop:async(p,d)=>{var S,P;let{nodeLookup:x}=n.getState(),u=s(d.id),T=Array.from(x.values()),I=d.type==="LANE",b=T.filter(C=>C.id!==d.id&&(I?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=At(u,b);if(N){E(u,N,T);return}if(d.parentId){let C=s(d.parentId),{x:A,y:L}=Le(C),U={x:A+((S=d.position.x)!=null?S:0),y:L+((P=d.position.y)!=null?P:0)},K=e.map(X=>X.id===d.id?w(_({},X),{position:U,parentId:void 0}):X);K=Ye(d.parentId,K),t(Pe(K))}}}};var yr=require("@xyflow/react"),Vt=require("react");function br(e,t,o=5){var l,c,g,f,m,y,E,h;let n={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},r=t.find(v=>v.id===e.id);if(!r||!e.position)return n;let a={left:e.position.x,right:e.position.x+((c=(l=r.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(g=r.measured)==null?void 0:g.height)!=null?f:0),width:(y=(m=r.measured)==null?void 0:m.width)!=null?y:0,height:(h=(E=r.measured)==null?void 0:E.height)!=null?h:0},s=o,i=o;return t.filter(v=>v.id!==r.id).reduce((v,p)=>{var C,A,L,U,K,X,Qe,Ue;let d={left:p.position.x,right:p.position.x+((A=(C=p.measured)==null?void 0:C.width)!=null?A:0),top:p.position.y,bottom:p.position.y+((U=(L=p.measured)==null?void 0:L.height)!=null?U:0),width:(X=(K=p.measured)==null?void 0:K.width)!=null?X:0,height:(Ue=(Qe=p.measured)==null?void 0:Qe.height)!=null?Ue:0},x=Math.abs(a.left-d.left);x<i&&(v.snapPosition.x=d.left,v.vertical=d.left,i=x);let u=Math.abs(a.right-d.right);u<i&&(v.snapPosition.x=d.right-a.width,v.vertical=d.right,i=u);let T=Math.abs(a.left-d.right);T<i&&(v.snapPosition.x=d.right,v.vertical=d.right,i=T);let I=Math.abs(a.right-d.left);I<i&&(v.snapPosition.x=d.left-a.width,v.vertical=d.left,i=I);let b=Math.abs(a.top-d.top);b<s&&(v.snapPosition.y=d.top,v.horizontal=d.top,s=b);let N=Math.abs(a.bottom-d.top);N<s&&(v.snapPosition.y=d.top-a.height,v.horizontal=d.top,s=N);let S=Math.abs(a.bottom-d.bottom);S<s&&(v.snapPosition.y=d.bottom-a.height,v.horizontal=d.bottom,s=S);let P=Math.abs(a.top-d.bottom);return P<s&&(v.snapPosition.y=d.bottom,v.horizontal=d.bottom,s=P),v},n)}var hr=()=>{let[e,t]=(0,Vt.useState)(void 0),[o,n]=(0,Vt.useState)(void 0),r=(0,Vt.useCallback)((a,s)=>{var i,l;if(t(void 0),n(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let c=br(a[0],s);a[0].position.x=(i=c.snapPosition.x)!=null?i:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),n(c.vertical)}return(0,yr.applyNodeChanges)(a,s)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:r}};var xr=require("@xyflow/react"),jo=require("uuid");var Nr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},_r={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},vr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],s="",i="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",i=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",i=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:i}),{step:e,type:s,label:i,edgeLabel:l}},Oi=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},n=[];return t.forEach(r=>{r=r||"";let a=r.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let s=vr(a[0],o),i=vr(a[1],o);s&&i&&n.push({sourceId:s.step,targetId:i.step,label:s.edgeLabel||i.edgeLabel||""})}),{components:o,connections:n}},Tr=e=>{let{components:t,connections:o}=Oi(e);return{nodes:t,edges:o}};var wr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,xr.useReactFlow)();return{createDiagram:r=>{let{nodes:a,edges:s}=Tr(r),i=[],l=new Map;for(let[m,y]of Object.entries(a)){let E=(0,jo.v7)(),h=Nr[y.type],v=_r[y.type];l.set(m,E);let p=$[h].MIN_WIDTH,d=$[h].MIN_HEIGHT;i.push({id:E,type:h,data:{label:y.label||"",variant:v,attribute:""},position:{x:0,y:0},width:p,height:d,measured:{width:p,height:d}})}let c=[];for(let m of s){let y=w(_({},xe),{id:(0,jo.v7)(),source:l.get(m.sourceId)||m.sourceId,target:l.get(m.targetId)||m.targetId});c.push(y)}let{nodes:g,edges:f}=Pn(i,c);e(g),t(f),o()}}};var wo=require("react"),Gi={origin:"*",debug:!1};function Cr(e,t=Gi){let{origin:o,debug:n}=t,r=(0,wo.useCallback)((a,s)=>{n&&console.debug("[postMessage] sending:",{type:a,payload:s}),window.parent.postMessage({type:a,payload:s},o||"*")},[o,n]);return(0,wo.useEffect)(()=>{let a=s=>{let{type:i,data:l}=s.data||{};n&&console.debug("[postMessage] received:",s.data),i&&e[i]&&e[i](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,n]),{sendMessage:r}}var Ar=require("@xyflow/react");var Ir=(e,t)=>{let{getNodes:o,getEdges:n}=(0,Ar.useReactFlow)();return{selectElement:s=>{let i=o().map(c=>w(_({},c),{selected:c.id===s})),l=n().map(c=>w(_({},c),{selected:c.id===s}));return e(i),t(l),!0},isReady:()=>!0}};var kr=require("@xyflow/react"),De=require("react"),Lr=require("use-debounce"),Hi={nodes:[],edges:[]},Bi=500,Sr=10,Pr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n}=(0,kr.useReactFlow)(),[r,a]=(0,De.useState)([Hi]),[s,i]=(0,De.useState)(0),l=r[s],c=s>0,g=s<r.length-1,f=(0,De.useCallback)(d=>{o(r[d].nodes),n(r[d].edges)},[r,o,n]),m=(0,De.useCallback)(()=>{if(s>0){let d=s-1;i(d),f(d)}},[s,f]),y=(0,De.useCallback)(()=>{if(s<r.length-1){let d=s+1;i(d),f(d)}},[r,s,f]),E=d=>{let u=[...r.slice(0,s+1),d],T=u.length>Sr?u.slice(u.length-Sr):u;a(T),i(T.length-1)},h=(0,Lr.useDebouncedCallback)(()=>{let d=e(),x=t(),u={nodes:d,edges:x};JSON.stringify(l)!==JSON.stringify(u)&&E(u)},Bi),v=(0,De.useCallback)(d=>{if(d==="forceSave"){h();return}d.some(u=>u.type!=="select")&&h()},[h]),p=(0,De.useCallback)(()=>{a([]),i(0)},[]);return{undo:m,redo:y,saveHistory:v,canUndo:c,canRedo:g,clearHistory:p}};var Jo=require("react/jsx-runtime"),Qo=({id:e,className:t})=>(0,Jo.jsx)("marker",{id:e,className:k("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Jo.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var mt=require("react/jsx-runtime"),Dr=()=>(0,mt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,mt.jsxs)("defs",{children:[(0,mt.jsx)(Qo,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,mt.jsx)(Qo,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var nn=require("@xyflow/react"),j=require("lecom-ui"),bt=require("lucide-react"),Gt=require("react");var Rr=require("@xyflow/react"),zi=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=(0,Rr.useStore)(zi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var Ce=require("lecom-ui");var Mt=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Mt||{});var $r=require("@xyflow/react"),Et=require("lecom-ui");var Vr=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var a;t((a=r.target)==null?void 0:a.result)},n.onerror=r=>{var a;o((a=r.target)==null?void 0:a.error)},n.readAsText(e)});function Mr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
3
- `),a=encodeURI(r);Co(a,`${o}.csv`)}var Co=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};var Yr=require("uuid");var en=require("xml-js");var Ui={compact:!0,spaces:4},Fi=e=>e.replaceAll(`
4
- `,"&#xA;");function Or(e,t=Ui){if(e)return JSON.parse((0,en.xml2json)(e,w(_({},t),{attributeValueFn:Fi})))}function Gr(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var zr=require("uuid");var Ac={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Hr={script:"SCRIPT",subprocess:"SUBPROCESS"},Br={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ft=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:a}=n,s=Number(r._attributes.width),i=Number(r._attributes.height);return{id:n.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(r._attributes.x),y:Number(r._attributes.y)},width:s,height:i,measured:{width:s,height:i}}},Yi=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=$.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=$.START_EVENT.MIN_HEIGHT,{node:ft({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Ki=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=$.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=$.END_EVENT.MIN_HEIGHT,{node:ft({cell:e,type:"END_EVENT"}),status:n,originalType:o}},$i=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Hr[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=xt(e.mxGeometry._attributes.width,$.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=xt(e.mxGeometry._attributes.height,$.TASK.MIN_HEIGHT),{node:ft({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Zi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=Br[o],r=["none","inclusive","event-based"],a="imported";return r.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=$.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=$.GATEWAY.MIN_HEIGHT,{node:ft({cell:e,type:"GATEWAY",variant:n}),status:a,originalType:t}},Xi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=xt(e.mxGeometry._attributes.width,$.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=xt(e.mxGeometry._attributes.height,$.ANNOTATION.MIN_HEIGHT),{node:ft({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Ur=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=$.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=$.UNSUPPORTED.MIN_HEIGHT,{node:ft({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Fr=(e,t)=>{let{source:o,target:n}=e._attributes;return w(_({},xe),{id:(0,zr.v7)(),source:t.get(o)||o,target:t.get(n)||n})},Wr={TASK:$i,GATEWAY:Zi,START_EVENT:Yi,END_EVENT:Ki,ANNOTATION:Xi};var qi=e=>{var s;let t=new Map,o=Object.values(Mt),n=e.filter(i=>{var l;return o.includes((l=i._attributes)==null?void 0:l.type)}),r=[],a=[];for(let i of n){let l=(0,Yr.v7)(),{type:c}=i._attributes,g=Wr[c]||Ur;t.set((s=i._attributes)==null?void 0:s.id,l),i._attributes.id=l;let{node:f,status:m,originalType:y}=g(i);r.push(f),a.push({originalType:y,type:f.type,variant:f.data.variant,value:Gr(f.data.label),status:m})}return{nodes:r,governanceIdToNodeIdMap:t,summary:a}},ji=(e,t)=>e.filter(r=>{var a;return(a=r._attributes)==null?void 0:a.edge}).map(r=>Fr(r,t)),Ji=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=qi(t.root.mxCell),a=ji(t.root.mxCell,n);return{nodes:o,edges:a,summary:r}},Qi=async e=>{let t=await Vr(e),o=Or(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},a=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!a||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},Kr=async e=>{try{let t=await Qi(e),{nodes:o,edges:n,summary:r}=Ji(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Xr=require("react/jsx-runtime"),Zr=()=>{let{t:e}=(0,Et.useTranslation)(),{toast:t}=(0,Et.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,$r.useReactFlow)(),a=i=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=i.map(g=>[g.originalType,g.value,e(`adapter.governance.report.status.${g.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Xr.jsx)(Et.Button,{size:"small",variant:"ghost",onClick:()=>Mr({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async i=>{try{let{nodes:l,edges:c,summary:g}=await Kr(i);if(o(m=>m.concat(l)),n(m=>m.concat(c)),r(),g.some(m=>m.status==="unsupported")){a(g);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 qr=require("lecom-ui"),jr=require("react");var je=require("react/jsx-runtime"),Jr=i=>{var l=i,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:a}=l,s=ke(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,jr.useRef)(null),g=m=>{let y=m.target.files;y!=null&&y.length&&a(y),c.current&&(c.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(qr.Button,w(_({onClick:m=>{var y;(y=c.current)==null||y.click(),r==null||r(m)}},s),{children:e})),(0,je.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:g})]})};var Je=require("react/jsx-runtime"),Qr=({disabled:e=!1})=>{let{t}=(0,Ce.useTranslation)(),{toast:o}=(0,Ce.useNotificationToast)(),{createDiagram:n}=Zr(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=s=>{let i=s[0];if(!i){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(i)};return(0,Je.jsxs)(Ce.Tooltip,{children:[(0,Je.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(Jr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:a,children:(0,Je.jsx)(hn,{})})}),(0,Je.jsx)(Ce.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var ea=require("react/jsx-runtime"),tn=({shortcut:e})=>(0,ea.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 R=require("lecom-ui"),Be=require("lucide-react"),ra=require("react");var ta=require("@xyflow/react"),Ot=require("html-to-image"),Ao=require("lecom-ui"),oa=require("react");var es=3,on="diagram",na=()=>{let{t:e}=(0,Ao.useTranslation)(),{getNodes:t}=(0,ta.useReactFlow)(),{deselectAll:o}=gt(),[n,r]=(0,oa.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:g,y:f,width:m,height:y}=Rn(t());return{width:m,height:y,style:{width:`${m}px`,height:`${y}px`,transform:`translate(${-g}px, ${-f}px)`}}},s=async(g,f)=>{r(w(_({},n),{[f]:!0})),await o();try{let m=Dn();if(!m)throw new Error("Flow element not found");let y=a();return await g(m,y)}catch(m){(0,Ao.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(w(_({},n),{[f]:!1}))}};return{exportAsPng:async(g=on)=>{await s(async(f,m)=>{let y=await(0,Ot.toPng)(f,w(_({},m),{backgroundColor:"#fcfcfc"}));Co(y,`${g}.png`)},"png")},exportAsHtml:async(g=on)=>{await s(async(f,m)=>{let y=await(0,Ot.toSvg)(f,w(_({},m),{backgroundColor:"#fcfcfc"})),E=`
1
+ "use strict";var bi=Object.create;var Tt=Object.defineProperty,yi=Object.defineProperties,hi=Object.getOwnPropertyDescriptor,vi=Object.getOwnPropertyDescriptors,Ni=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,_i=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable;var En=(e,t,o)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,T=(e,t)=>{for(var o in t||(t={}))Uo.call(t,o)&&En(e,o,t[o]);if(Wt)for(var o of Wt(t))bn.call(t,o)&&En(e,o,t[o]);return e},w=(e,t)=>yi(e,vi(t));var ke=(e,t)=>{var o={};for(var n in e)Uo.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Wt)for(var n of Wt(e))t.indexOf(n)<0&&bn.call(e,n)&&(o[n]=e[n]);return o};var Ti=(e,t)=>{for(var o in t)Tt(e,o,{get:t[o],enumerable:!0})},yn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ni(t))!Uo.call(e,r)&&r!==o&&Tt(e,r,{get:()=>t[r],enumerable:!(n=hi(t,r))||n.enumerable});return e};var xi=(e,t,o)=>(o=e!=null?bi(_i(e)):{},yn(t||!e||!e.__esModule?Tt(o,"default",{value:e,enumerable:!0}):o,e)),wi=e=>yn(Tt({},"__esModule",{value:!0}),e);var is={};Ti(is,{ActivityVariant:()=>$t,ComplexVariant:()=>Xt,ElementType:()=>xt,ExclusiveVariant:()=>qt,GatewayVariant:()=>he,Modeler:()=>as,RoutingVariant:()=>Zt,useSelectionUtils:()=>gt});module.exports=wi(is);var Yt=require("lecom-ui"),Kt=require("react/jsx-runtime");function hn({children:e}){return(0,Kt.jsxs)(Yt.TooltipProvider,{children:[(0,Kt.jsx)(Yt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var J=require("@xyflow/react"),dn=require("lecom-ui"),re=require("react"),Ya=require("use-debounce"),Bo=require("uuid");var xt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(xt||{}),$t=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))($t||{}),Zt=(l=>(l.SIMPLE="simple",l.LOOP="loop",l.SCRIPT="script",l.COMPLEX="complex",l.EXCLUSIVE="exclusive",l.PARALLEL="parallel",l.FINAL="final",l.TO_SUB_PROCESS="to_sub_process",l))(Zt||{}),Xt=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Xt||{}),qt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(qt||{});var lt=require("lucide-react");var Fe=require("react/jsx-runtime"),jt=({size:e=24,className:t})=>(0,Fe.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Fe.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Fe.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Fe.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Fe.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Fo=require("react/jsx-runtime"),ot=({size:e=24,className:t})=>(0,Fo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,Fo.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 Ve=require("react/jsx-runtime"),Jt=({size:e=24,className:t})=>(0,Ve.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,Ve.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,Ve.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ve.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,nt.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,nt.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),Qt=({size:e=24,className:t})=>(0,at.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,at.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,at.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,at.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var it=require("react/jsx-runtime"),vn=({size:e=24,className:t})=>(0,it.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,it.jsxs)("g",{children:[(0,it.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,it.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Nn=require("clsx"),_n=require("tailwind-merge");function k(...e){return(0,_n.twMerge)((0,Nn.clsx)(e))}var wt=(e,t)=>e<t?t:e;var Ct=require("react/jsx-runtime"),Tn=({size:e=24,className:t})=>(0,Ct.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:k("stroke-2",t),children:[(0,Ct.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,Ct.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var eo=require("react/jsx-runtime"),xn=({size:e=24,className:t})=>(0,eo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,eo.jsx)("g",{children:(0,eo.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 Wo=require("react/jsx-runtime"),to=({size:e=24,className:t})=>(0,Wo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:(0,Wo.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 Yo=require("react/jsx-runtime"),At=({size:e=24,className:t})=>(0,Yo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:k("stroke-2",t),children:(0,Yo.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 st=require("react/jsx-runtime"),wn=({size:e=24,className:t})=>(0,st.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,st.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"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,st.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Me=require("react/jsx-runtime"),Cn=({size:e=24,className:t})=>(0,Me.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,Me.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,Me.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,Me.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,Me.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Me.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),An=({size:e=24,className:t})=>(0,We.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,We.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,We.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,We.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(i=>(i.START_EVENT="START_EVENT",i.END_EVENT="END_EVENT",i.TASK="TASK",i.LANE="LANE",i.GATEWAY="GATEWAY",i.ANNOTATION="ANNOTATION",i.UNSUPPORTED="UNSUPPORTED",i))(D||{});var oo={SCRIPT:{icon:lt.ScrollText},SUBPROCESS:{icon:lt.SquarePlus}};var no={LOOP:{icon:lt.RotateCcw}},he=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(he||{}),ro={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Qt},COMPLEX:{icon:Jt}};var Ko=xi(require("@dagrejs/dagre"),1),Ln=require("@xyflow/react"),Pn=require("lodash");var Ci={MIN_WIDTH:36,MIN_HEIGHT:36},Ai={MIN_WIDTH:36,MIN_HEIGHT:36},Ii={MIN_WIDTH:56,MIN_HEIGHT:56},ao={MIN_WIDTH:176,MIN_HEIGHT:96},io={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},ae={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},so={MIN_WIDTH:176,MIN_HEIGHT:64},Si={MIN_WIDTH:128,MIN_HEIGHT:64},$={START_EVENT:Ci,END_EVENT:Ai,GATEWAY:Ii,TASK:ao,LANE:ae,ANNOTATION:so,UNSUPPORTED:Si};var In=require("lodash");var Le=e=>{var t,o,n,r,a,s,i,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(a=e.measured)==null?void 0:a.width)!=null?s:0,h:(l=(i=e.measured)==null?void 0:i.height)!=null?l:0}},Pe=e=>(0,In.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),Sn=(e,t)=>{let{x:o,y:n}=Le(e),{x:r,y:a}=Le(t);return{x:o-r,y:n-a}};var dt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),ki=(e,t)=>{let{x:o,y:n}=Le(e),{x:r,y:a}=Le(t),s=o-r,i=n-a;return Math.sqrt(s*s+i*i)},Li=(e,t)=>{let{x:o,y:n,w:r,h:a}=Le(e),{x:s,y:i,w:l,h:c}=Le(t);return o<s+l&&s<o+r&&n<i+c&&i<n+a},It=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Li(e,r)){let a=ki(e,r);a<n&&(n=a,o=r)}return o},kn=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,a;return Math.max(o,(a=(r=n.measured)==null?void 0:r.width)!=null?a:0)},0);var Dn=(e=[],t=[],o="LR")=>{let n=new Ko.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:a,width:s,height:i})=>n.setNode(a,{width:s,height:i})),t.forEach(a=>n.setEdge(a.source,a.target)),Ko.default.layout(n),{nodes:e.map(a=>{let s=n.node(a.id);return w(T({},a),{position:{x:s.x-a.width/2,y:s.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var p,y;let o=[...t],n=o.find(E=>E.id===e);if(!n)return o;let r=o.filter(E=>E.parentId===e&&E.type==="LANE");if(r.length===0)return o;let a=(0,Pn.orderBy)(r,["position.y"]),s=Math.max((y=(p=n.measured)==null?void 0:p.width)!=null?y:0,io.MIN_WIDTH),i=kn(e,a)||ae.MIN_WIDTH,l=Math.max(s,i),c=0,g=0;a.forEach(E=>{var h,v,u,d;o=o.map(x=>x.id===E.id?w(T({},x),{width:l-ae.HEADER_WIDTH,measured:w(T({},x.measured),{width:l-ae.HEADER_WIDTH}),position:{x:ae.HEADER_WIDTH,y:c}}):x),c+=(v=(h=E.measured)==null?void 0:h.height)!=null?v:0,g+=(d=(u=E.measured)==null?void 0:u.height)!=null?d:0}),o=o.map(E=>E.id===e?w(T({},E),{height:g,width:l,measured:w(T({},E.measured),{height:g,width:l})}):E);let f=o.find(E=>E.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},Rn=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Pi=50,Vn=(e,t=Pi)=>{let o=(0,Ln.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Mn=require("zustand"),H=(0,Mn.create)(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));var Lt=require("@xyflow/react");var Te=require("@xyflow/react");var Ee=require("@xyflow/react"),Ne=require("lecom-ui"),Hn=require("lucide-react");var lo=require("react"),On=(0,lo.createContext)(null),Gn=On.Provider,co=()=>{let e=(0,lo.useContext)(On);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),St=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{getNode:n,getEdge:r,getNodes:a,getEdges:s}=(0,Ee.useReactFlow)(),{onConfigureElement:i}=co(),l=m=>{var _,I,b,N,S;return m?m.type==="TASK"&&((_=m.data)==null?void 0:_.variant)==="SUBPROCESS"?{id:m.id,type:"sub_process",variant:g(m),label:(I=m.data)==null?void 0:I.label}:m.type==="GATEWAY"?{id:m.id,type:"gateway",variant:((b=m.data)==null?void 0:b.variant)||"EXCLUSIVE",label:(N=m.data)==null?void 0:N.label}:{id:m.id,type:"activity",variant:g(m),label:(S=m.data)==null?void 0:S.label}:null},c=m=>{let _=a(),I=s(),b=(0,Ee.getIncomers)(m,_,I);if(b.length===0)return;let N=b[0];return l(N)||void 0},g=m=>{let _=a(),I=s(),b=(0,Ee.getIncomers)(m,_,I),N=(0,Ee.getOutgoers)(m,_,I),S=b.some(C=>C.type==="START_EVENT"),P=N.some(C=>C.type==="END_EVENT");return S?"start":P?"end":"between"},f=m=>{var C,A,L,U;let _=a(),I=s(),b=n(m.source),N=n(m.target);if(!b||!N)return"simple";if((0,Ee.getOutgoers)(b,_,I).some(K=>K.type==="END_EVENT"))return"final";if(b.type==="GATEWAY")switch((C=b.data)==null?void 0:C.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(b.type==="TASK"){let K=(A=b.data)==null?void 0:A.variant,X=(L=b.data)==null?void 0:L.attribute;return N.type==="TASK"&&((U=N.data)==null?void 0:U.variant)==="SUBPROCESS"?"to_sub_process":K==="SCRIPT"?"script":X==="LOOP"?"loop":"simple"}return"simple"},p=m=>{var C;let _=n(m.source);if(!_||_.type!=="GATEWAY"||((C=_.data)==null?void 0:C.variant)!=="COMPLEX")return;let I=a(),b=s(),N=(0,Ee.getIncomers)(_,I,b),S=!1,P=!1;if(N.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(S=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(P=!0))}),S&&P)return"script_loop";if(S)return"script";if(P)return"loop"},y=m=>{var C;let _=n(m.source);if(!_||_.type!=="GATEWAY"||((C=_.data)==null?void 0:C.variant)!=="EXCLUSIVE")return;let I=a(),b=s(),N=(0,Ee.getIncomers)(_,I,b),S=!1,P=!1;if(N.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(S=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(P=!0))}),S)return"script";if(P)return"loop"},E=m=>{var P,C;if(m.type!=="GATEWAY")return;let _=a(),I=s(),b=(0,Ee.getIncomers)(m,_,I),N=!1,S=!1;if(b.forEach(A=>{var L,U;A.type==="TASK"&&(((L=A.data)==null?void 0:L.variant)==="SCRIPT"&&(N=!0),((U=A.data)==null?void 0:U.attribute)==="LOOP"&&(S=!0))}),((P=m.data)==null?void 0:P.variant)==="COMPLEX"){if(N&&S)return"script_loop";if(N)return"script";if(S)return"loop"}else if(((C=m.data)==null?void 0:C.variant)==="EXCLUSIVE"){if(N)return"script";if(S)return"loop"}},h=m=>(0,Ee.getOutgoers)(m,a(),s()).map(b=>{var N,S;return{id:b.id,type:b.type,variant:(N=b.data)==null?void 0:N.variant,label:(S=b.data)==null?void 0:S.label}}),v=m=>s().filter(b=>b.source===m.id).map(b=>{var N;return{id:b.id,type:"routing",variant:f(b),label:(N=b.data)==null?void 0:N.label,target:n(b.target)}}),u=()=>{var I,b,N,S,P,C;let m=n(e);if(!m)return;let _=c(m);if(m.type==="TASK"&&((I=m.data)==null?void 0:I.variant)==="SUBPROCESS"){i==null||i({id:m.id,type:"sub_process",variant:g(m),label:(b=m.data)==null?void 0:b.label,origin:_,targets:h(m),edgeTargets:v(m)}),console.log({id:m.id,type:"sub_process",variant:g(m),label:(N=m.data)==null?void 0:N.label,origin:_,targets:h(m),edgeTargets:v(m)});return}if(m.type!=="GATEWAY"){i==null||i({id:m.id,type:"activity",variant:g(m),label:(S=m.data)==null?void 0:S.label,origin:_,targets:h(m),edgeTargets:v(m)});return}i==null||i({id:m.id,type:"gateway",variant:((P=m.data)==null?void 0:P.variant)||"EXCLUSIVE",label:(C=m.data)==null?void 0:C.label,origin:_,subVariant:E(m),targets:h(m)})},d=()=>{let m=r(e);if(m){let _=f(m),I;_==="complex"?I=p(m):_==="exclusive"&&(I=y(m));let b=n(m.source),N=b&&l(b)||void 0;i==null||i({id:m.id,type:"routing",variant:_,subVariant:I,origin:N,target:n(m.target)}),console.log({id:m.id,type:"routing",variant:_,subVariant:I,origin:N,target:n(m.target)})}};return(0,Ke.jsxs)(Ne.Tooltip,{children:[(0,Ke.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(Ne.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":u();break;case"edge":d();break}},children:(0,Ke.jsx)(Hn.Settings,{size:16})})}),(0,Ke.jsx)(Ne.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Bn=require("@xyflow/react"),_e=require("lecom-ui"),zn=require("lucide-react"),$e=require("react/jsx-runtime"),po=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,_e.useTranslation)(),{deleteElements:n}=(0,Bn.useReactFlow)();return(0,$e.jsxs)(_e.Tooltip,{children:[(0,$e.jsx)(_e.TooltipTrigger,{asChild:!0,children:(0,$e.jsx)(_e.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,$e.jsx)(zn.TrashIcon,{size:16})})}),(0,$e.jsx)(_e.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var kt=require("react/jsx-runtime"),pt=n=>{var r=n,{edgeId:e,edgeType:t}=r,o=ke(r,["edgeId","edgeType"]);var i;let a=[{component:(0,kt.jsx)(po,{elementId:e,elementType:"edge"})}],s={SEQUENCE_EDGE:[{component:(0,kt.jsx)(St,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,kt.jsx)("div",w(T({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(i=s[t])==null?void 0:i.map((l,c)=>(0,kt.jsx)("div",{children:l.component},c))}))};var Ze=require("react/jsx-runtime"),mo={type:"ANNOTATION_EDGE",zIndex:2e3},Un=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,selected:i,data:l})=>{let c=(0,Te.useNodes)(),{zoom:g}=(0,Te.useViewport)(),{isMultipleSelection:f}=H(),p=c.find(x=>x.id===t),y=c.find(x=>x.id===o),[E,h,v]=(0,Te.getStraightPath)({sourceX:n,sourceY:r,targetX:a,targetY:s}),u=i||(p==null?void 0:p.selected)||(y==null?void 0:y.selected),d=1/g;return(0,Ze.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[(0,Ze.jsx)(Te.BaseEdge,{id:e,path:E,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":u&&!(l!=null&&l.hasError)})}),(0,Ze.jsx)(Te.EdgeLabelRenderer,{children:(0,Ze.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${v}px)`},children:i&&!f&&(0,Ze.jsx)(pt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};var ie=require("@xyflow/react"),Fn=require("react");var Xe=require("react");var Zo=require("react/jsx-runtime"),ee=({value:e,maxLength:t,onChange:o,isEditing:n,onBlur:r,className:a,style:s})=>{let i=(0,Xe.useRef)(null),[l,c]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{c(n!=null?n:!1)},[n]),(0,Xe.useEffect)(()=>{if(l&&i.current){i.current.focus();let E=document.createRange();E.selectNodeContents(i.current),E.collapse(!1);let h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(E))}},[l]);let g=E=>{if(E.stopPropagation(),!l){c(!0);return}if(!i.current)return;let h=document.createRange();h.selectNodeContents(i.current);let v=window.getSelection();v&&(v.removeAllRanges(),v.addRange(h))},f=E=>{let h=E.currentTarget.innerText.trim(),v=t&&h.length>=t,u=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],d=E.ctrlKey||E.metaKey,x=d&&E.key==="a",m=d&&E.key==="c",_=d&&E.key==="x",I=d&&E.key==="v";function b(S){return/\w/.test(S)}if(h.length===0&&!b(E.key)&&!u.includes(E.key)&&!d){E.preventDefault();return}v&&(u.includes(E.key)||x||m||_||I||E.preventDefault())},p=E=>{if(!t)return;E.preventDefault();let h=E.clipboardData.getData("text/plain"),v=E.currentTarget.innerText,u=window.getSelection();if(!u||u.rangeCount===0)return;let d=u.getRangeAt(0);if((v.substring(0,d.startOffset)+h+v.substring(d.endOffset)).length>t){let m=t-(v.length-(d.endOffset-d.startOffset)),_=h.substring(0,Math.max(0,m));_&&(d.deleteContents(),d.insertNode(document.createTextNode(_)),d.setStartAfter(d.endContainer),d.collapse(!0),u.removeAllRanges(),u.addRange(d))}else d.deleteContents(),d.insertNode(document.createTextNode(h)),d.setStartAfter(d.endContainer),d.collapse(!0),u.removeAllRanges(),u.addRange(d)},y=E=>{c(!1);let h=E.currentTarget.innerText.trim();t&&h.length>t&&(h=h.substring(0,t)),E.currentTarget.innerText=h,r==null||r(),h!==e&&(o==null||o(h))};return(0,Zo.jsx)("div",{className:k("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:s,onDoubleClick:g,children:(0,Zo.jsx)("div",{ref:i,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onPaste:p,onBlur:y,children:e})})};var Oe=require("react/jsx-runtime"),xe={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:ie.MarkerType.ArrowClosed},markerEnd:{type:ie.MarkerType.Arrow},data:{label:""}},Wn=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:i,targetPosition:l,data:c,selected:g})=>{let f=(0,ie.useNodes)(),{zoom:p}=(0,ie.useViewport)(),{updateEdgeData:y}=(0,ie.useReactFlow)(),{isMultipleSelection:E}=H(),[h,v]=(0,Fn.useState)(!1),u=f.find(L=>L.id===t),d=f.find(L=>L.id===o),[x,m,_]=(0,ie.getSmoothStepPath)({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:s,targetPosition:l}),I=g||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),b=I?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=h||(c==null?void 0:c.label.trim().length)>0,S=1/p,P=()=>{v(!0)},C=()=>{v(!1)},A=L=>{y(e,{label:L.trim()})};return(0,Oe.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":I}),onBlur:C,onDoubleClick:P,children:[(0,Oe.jsx)(ie.BaseEdge,{id:e,path:x,markerEnd:`url(#${b})`,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":I&&!(c!=null&&c.hasError)})}),(0,Oe.jsx)(ie.EdgeLabelRenderer,{children:(0,Oe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${m}px, ${_}px)`},children:[g&&!E&&(0,Oe.jsx)(pt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${S})`}}),N&&(0,Oe.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:A})]})})]})};var go=e=>e.some(t=>t.type==="START_EVENT"),fo=(e,t,o)=>{var a;let n=t.find(s=>s.id===e);return!n||n.type!=="GATEWAY"||((a=n.data)==null?void 0:a.variant)!=="EXCLUSIVE"?!1:o.filter(s=>s.source===e).length>=2},Eo=(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"},bo=(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"},yo=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.target===e).some(a=>{let s=t.find(i=>i.id===a.source);return(s==null?void 0:s.type)==="START_EVENT"})},ho=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.source===e).some(a=>{let s=t.find(i=>i.id===a.target);return(s==null?void 0:s.type)==="END_EVENT"})},vo=(e,t)=>t.filter(n=>n.source===e).length>0,No=(e,t,o)=>{let n=t.find(a=>a.id===e);return!n||n.type!=="TASK"?!1:o.filter(a=>a.source===e).length>=2};var Di=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!fo(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!No(e.sourceNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="GATEWAY"),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(Eo(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(bo(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(yo(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(ho(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(vo(e.sourceNodeId,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION"],LANE:["ANNOTATION"],ANNOTATION:[],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],Yn=e=>{for(let t of Di){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Ri=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:fo(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:go(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:Eo(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:bo(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:yo(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:ho(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:vo(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:No(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],Kn=e=>{let t=Ri.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 $n=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,Lt.useReactFlow)();return{isValidConnection:s=>{let i=t(s.source),l=t(s.target);if(!i||!l)return!1;let c={sourceNodeId:i.id,targetNodeId:l.id,sourceNodeType:i.type,targetNodeType:l.type,nodes:n(),edges:o()};return Yn(c).isValid},onConnect:s=>{e(i=>{let l=t(s.target);return(l==null?void 0:l.type)==="ANNOTATION"?(0,Lt.addEdge)(T(T({},s),mo),i):(0,Lt.addEdge)(T(T({},s),xe),i)})}}};var Xo=require("react"),or=require("lecom-ui"),nr=require("@xyflow/react");var Pt=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ge=(e=[])=>e.filter(t=>t.type==="TASK")||[],Zn=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Xn=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),_o=(e=[])=>e.filter(t=>t.type==="GATEWAY"),qn=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),me=(e,t=[])=>t.filter(o=>o.source===e),Dt=(e,t=[])=>t.filter(o=>o.target===e),jn=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(a=>a.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Jn=(e,t)=>{let o=me(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(a=>a.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},Qn=e=>e?/\w/g.test(e.trim()):!1,M=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:[]}},we=(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)}},er=(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 Rt=[{id:"start_event_not_found",validate:e=>{let t=Pt(e.nodes);return M({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=qe(e.nodes);return M({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Pt(e.nodes),o=t.length===1;if(t.length===0)return M({isValid:!0});if(!o)return M({isValid:!1,nodeIds:t.map(a=>a.id)});let n=me(t[0].id,e.edges);if(!(n.length<=1)){let a=[...t.map(s=>s.id),...n.map(s=>s.target)];return M({isValid:!1,nodeIds:[...new Set(a)]})}return M({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ge(e.nodes),o=we(t,n=>me(n.id,e.edges).length<=2);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ge(e.nodes),o=we(t,n=>!!n.label&&n.label.trim()!=="");return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ge(e.nodes),n=we(o,r=>!r.label||r.label.length<=60);return M({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ge(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let a=r.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(a=>n.push(a.id));return M({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=_o(e.nodes),o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="GATEWAY"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Pt(e.nodes),...qe(e.nodes)],o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&(i.type==="START_EVENT"||i.type==="END_EVENT")&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],n=[];for(let r of t){let a=Dt(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.source);if(i&&i.type==="TASK"){let l=me(i.id,e.edges);l.length>1&&(o.push(i.id),l.forEach(c=>n.push(c.id)))}}}return M({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=qn(e.nodes),o=we(t,r=>me(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>me(r,e.edges).map(a=>a.id));return M({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=Ge(e.nodes),o=we(t,n=>!n.label||Qn(n.label));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,i;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((i=e==null?void 0:e.edges)!=null&&i.length))return M({isValid:!0});let t=qe(e.nodes)[0];if(!t)return M({isValid:!0});let o=Dt(t.id,e.edges);if(!o.length)return M({isValid:!0});let r=Ge(e.nodes).filter(l=>o.some(c=>c.source===l.id)),a=we(r,l=>!jn(l.id,e));return M({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ge(e.nodes),o=qe(e.nodes)[0];if(!o)return M({isValid:!0});let n=t.filter(l=>{let c=Dt(l.id,e.edges),g=me(l.id,e.edges),f=c.some(y=>{var E;return((E=e.nodes.find(h=>h.id===y.source))==null?void 0:E.type)==="START_EVENT"}),p=g.some(y=>{var E;return((E=e.nodes.find(h=>h.id===y.target))==null?void 0:E.type)==="END_EVENT"});return f&&p}),r=Dt(o.id,e.edges),a=r.length>1,s=r.map(l=>l.source),i={isValid:n.length===0&&!a,nodeIds:[...n.map(l=>l.id),...a?s:[]]};return M(i)}},{id:"gateway_flow_to_event",validate:e=>{let t=_o(e.nodes),o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="END_EVENT"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=_o(e.nodes),o=we(t,n=>me(n.id,e.edges).length>=1);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Pt(e.nodes),...qe(e.nodes)],o=[],n=[];for(let r of t){let a=me(r.id,e.edges);for(let s of a){let i=e.nodes.find(l=>l.id===s.target);i&&i.type==="GATEWAY"&&(o.push(r.id,i.id),n.push(s.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Zn(e.nodes),o=we(t,n=>!Jn(n.id,e));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Xn(e.nodes),o=we(t,n=>{var r,a;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((a=n.properties)==null?void 0:a.subprocessRef)!==""});return M({isValid:o.isValid,nodeIds:o.invalidIds})}}];var tr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Rt){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 rr=()=>{let{t:e}=(0,or.useTranslation)(),[t,o]=(0,Xo.useState)(null),{setNodes:n,setEdges:r,getNodes:a,getEdges:s}=(0,nr.useReactFlow)(),[i,l]=(0,Xo.useState)(!1);return{validationResult:t,validateDiagram:p=>{let y=er(p.nodes,p.edges),E=tr(y),h=E.errors.map(v=>w(T({},v),{message:e(`validation.errors.${v.id}`)}));return i||l(!0),{isValid:E.isValid,errors:h}},handleValidationComplete:p=>{if(o(p),!p)return;let y=[],E=[];p.errors.forEach(b=>{b.nodeIds&&b.nodeIds.length>0&&b.nodeIds.forEach(N=>y.push(N)),b.edgeIds&&b.edgeIds.length>0&&b.edgeIds.forEach(N=>E.push(N))});let h=[...new Set(y)];n(b=>b.map(N=>w(T({},N),{data:w(T({},N.data),{hasError:!1})}))),r(b=>b.map(N=>w(T({},N),{data:w(T({},N.data),{hasError:!1})})));let v=a(),u=s(),d=new Set(h),x=new Set;p.errors.forEach(b=>{var P,C;let N=Rt.find(A=>A.id===b.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((P=b.edgeIds)==null||P.forEach(A=>x.add(A)),(C=b.nodeIds)==null||C.forEach(A=>{u.forEach(L=>{(L.source===A||L.target===A)&&x.add(L.id)})}))});let m=new Set,_=new Set,I=new Set;v.forEach(b=>{b.type==="START_EVENT"?m.add(b.id):b.type==="END_EVENT"&&_.add(b.id)}),u.forEach(b=>{m.has(b.source)&&I.add(b.target),_.has(b.target)&&I.add(b.source)}),I.forEach(b=>{var N,S;if(d.has(b)){let P=(N=p.errors.find(A=>{var L;return(L=A.nodeIds)==null?void 0:L.includes(b)}))==null?void 0:N.id;((S=Rt.find(A=>A.id===P))==null?void 0:S.highlightRelatedEdges)!==!1&&u.forEach(A=>{A.source===b&&_.has(A.target)&&(d.add(A.target),x.add(A.id)),A.target===b&&m.has(A.source)&&(d.add(A.source),x.add(A.id))})}}),d.size>0&&n(b=>b.map(N=>w(T({},N),{data:w(T({},N.data),{hasError:d.has(N.id)})}))),x.size>0&&r(b=>b.map(N=>w(T({},N),{data:w(T({},N.data),{hasError:x.has(N.id)})})))},clearValidation:()=>{o(null),l(!1),n(p=>p.map(y=>w(T({},y),{data:w(T({},y.data),{hasError:!1})}))),r(p=>p.map(y=>w(T({},y),{data:w(T({},y.data),{hasError:!1})})))},isAutoValidationEnabled:i}};var sr=require("@xyflow/react"),lr=require("lecom-ui"),dr=require("react"),qo=require("uuid");var To=(e,t)=>{let n=e.filter(a=>a.type==="TASK").map(a=>{var i;let s=(i=a.data)==null?void 0:i.label;if(s&&s.startsWith(`${t} `)){let l=s.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(a=>a>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},xo=(e,t)=>{let n=t.filter(i=>i.type==="TASK").map(i=>{var l;return(l=i.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),a=n.filter(i=>i===r||i.startsWith(`${r} (`)).map(i=>{if(i===r)return 1;let l=i.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(i=>i>0),s=2;for(;a.includes(s);)s++;return`${r} (${s})`};var Vi=15,ar="bpmn:selection",Mi=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",a=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||a},ir=e=>{if(!Mi(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},cr=({offset:e=Vi}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,sr.useReactFlow)(),{t:a}=(0,lr.useTranslation)();(0,dr.useEffect)(()=>{let s=l=>{var h,v;if(!ir(l))return;let c=t(),g=n(),f=c.filter(u=>u.selected);if(!f.length)return;l.preventDefault(),l.stopPropagation();let p=g.filter(u=>f.some(d=>d.id===u.source)&&f.some(d=>d.id===u.target)),E=JSON.stringify({nodes:f,edges:p});(h=l.clipboardData)==null||h.setData(ar,E),(v=l.clipboardData)==null||v.setData("text/plain",`BPMN Selection: ${f.length} nodes`)},i=l=>{var v,u;if(!ir(l))return;let c=(v=l.clipboardData)==null?void 0:v.getData(ar);if(!c)return;l.preventDefault(),l.stopPropagation();let g;try{g=JSON.parse(c)}catch(d){return}if(!((u=g.nodes)!=null&&u.length))return;let f=new Map,p=t(),y=[],E=g.nodes.map(d=>{var _;let x=(0,qo.v7)();f.set(d.id,x);let m=w(T({},d),{id:x,selected:!0,position:{x:d.position.x+e,y:d.position.y+e}});if(d.type==="TASK"){let I=(_=d.data)==null?void 0:_.label,b=xo(I||a("bpmn.task.label.prefix"),[...p,...y]);m.data=w(T({},d.data),{label:b})}return y.push(m),m}),h=g.edges.map(d=>w(T({},d),{id:(0,qo.v7)(),selected:!0,source:f.get(d.source)||d.source,target:f.get(d.target)||d.target}));o(d=>[...d.map(x=>w(T({},x),{selected:!1})),...E]),r(d=>[...d.map(x=>w(T({},x),{selected:!1})),...h])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",i,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",i,!0)}},[t,o,n,r,e,a])};var wo=require("@xyflow/react"),fr=require("lecom-ui"),jo=require("uuid");var pr=require("zustand"),ut=(0,pr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var de=require("@xyflow/react"),ur=require("react");var He=require("react/jsx-runtime"),Id={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:de.MarkerType.Arrow},data:{label:""}},mr=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:i,targetPosition:l,data:c,selected:g})=>{let f=(0,de.useNodes)(),{zoom:p}=(0,de.useViewport)(),{updateEdgeData:y}=(0,de.useReactFlow)(),{isMultipleSelection:E}=H(),[h,v]=(0,ur.useState)(!1),u=f.find(L=>L.id===t),d=f.find(L=>L.id===o),[x,m,_]=(0,de.getSmoothStepPath)({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:s,targetPosition:l}),I=g||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),b=I?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=h||(c==null?void 0:c.label.trim().length)>0,S=1/p,P=()=>{v(!0)},C=()=>{v(!1)},A=L=>{y(e,{label:L.trim()})};return(0,He.jsxs)("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":I}),onBlur:C,onDoubleClick:P,children:[(0,He.jsx)(de.BaseEdge,{id:e,path:x,markerEnd:`url(#${b})`,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":I&&!(c!=null&&c.hasError)})}),(0,He.jsx)(de.EdgeLabelRenderer,{children:(0,He.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${m}px, ${_}px)`},children:[g&&!E&&(0,He.jsx)(pt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${S})`}}),N&&(0,He.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:A})]})})]})};var Vt=require("react/jsx-runtime"),gr=({fromX:e,fromY:t,toX:o,toY:n})=>(0,Vt.jsxs)("g",{children:[(0,Vt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${n} ${e} ${n} ${o},${n}`}),(0,Vt.jsx)("circle",{cx:o,cy:n,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Er=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,wo.useStoreApi)(),{draggableNode:r,setDraggableNode:a}=ut(),{getInternalNode:s,screenToFlowPosition:i}=(0,wo.useReactFlow)(),{t:l}=(0,fr.useTranslation)(),c=u=>{let d="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(x=>x.map(m=>w(T({},m),{className:m.id===u?d:""})))},g=()=>{let{nodeLookup:u}=n.getState();return Array.from(u.values())},f=u=>{let d=s(u.id),x=g();if(u.type==="LANE"){if(dt({parentId:u.id,nodes:e,includeTypes:["LANE"]})){c();return}let S=x.filter(A=>A.id!==u.id&&A.type==="LANE"&&!A.parentId),P=It(d,S);if(!P){c();return}if(dt({parentId:P.id,nodes:e,excludeTypes:["LANE"]})){c();return}c(P.id);return}let _=x.filter(N=>N.id!==u.id&&N.type==="LANE"),I=It(d,_);if(!I){c();return}if(dt({parentId:I.id,nodes:e,includeTypes:["LANE"]})){c();return}c(I.id)},p=u=>{u.preventDefault(),u.dataTransfer.dropEffect="move"},y=(u,d)=>{u.preventDefault(),f(d)},E=(u,d,x)=>{var S,P;let m=C=>C.map(A=>w(T({},A),{className:void 0}));if(u.parentId===d.id){let C=Ye(d.id,x);t(Pe(m(C)));return}if(u.type==="LANE"){if(dt({parentId:d.id,nodes:x,excludeTypes:["LANE"]}))return;let L=x.filter(X=>X.parentId===d.id).reduce((X,Qe)=>{var Ue,et;return X+((et=(Ue=Qe.measured)==null?void 0:Ue.height)!=null?et:0)},0),U={x:ae.HEADER_WIDTH,y:L},K=x.map(X=>X.id===u.id?w(T({},X),{parentId:d.id,position:U,className:void 0}):w(T({},X),{className:void 0}));K=Ye(d.id,K),t(Pe(K));return}if(dt({parentId:d.id,nodes:x,includeTypes:["LANE"]})){let C;if(u.parentId){let L=s(u.parentId),{x:U,y:K}=Le(L);C={x:U+((S=u.position.x)!=null?S:0),y:K+((P=u.position.y)!=null?P:0)}}let A=x.map(L=>L.id===u.id?w(T({},L),{position:C!=null?C:L.position,parentId:void 0,className:void 0}):w(T({},L),{className:void 0}));t(Pe(A));return}let b=Sn(u,d),N=x.map(C=>C.id===u.id?w(T({},C),{parentId:d.id,position:b,className:void 0}):w(T({},C),{className:void 0}));t(Pe(N))};return{onDragOver:p,onDrop:u=>{if(u.preventDefault(),!(r!=null&&r.type))return;let d=i({x:u.clientX,y:u.clientY}),x={width:$[r.type].MIN_WIDTH,height:$[r.type].MIN_HEIGHT},m={id:(0,jo.v7)(),type:r.type,position:d,measured:x,data:{label:r.type==="TASK"?To(e,l("bpmn.task.label.prefix")):"",variant:r.variant,attribute:r.attribute}},_=w(T({},m),{internals:{positionAbsolute:d}}),I=g(),b=r.type==="LANE",N=I.filter(C=>b?C.type==="LANE"&&!C.parentId:C.type==="LANE"),S=It(_,N);S?E(_,S,[...I,_]):t(C=>{let A=C.concat(m);return Pe(A)});let P=u.dataTransfer.getData("sourceId");if(P){let C={id:(0,jo.v7)(),source:P,target:m.id};if(r.type==="ANNOTATION"){o(A=>A.concat(T(T({},C),mo)));return}o(A=>A.concat(T(T({},C),xe)))}a(null)},onNodeDrag:y,onNodeDragStop:async(u,d)=>{var S,P;let{nodeLookup:x}=n.getState(),m=s(d.id),_=Array.from(x.values()),I=d.type==="LANE",b=_.filter(C=>C.id!==d.id&&(I?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=It(m,b);if(N){E(m,N,_);return}if(d.parentId){let C=s(d.parentId),{x:A,y:L}=Le(C),U={x:A+((S=d.position.x)!=null?S:0),y:L+((P=d.position.y)!=null?P:0)},K=e.map(X=>X.id===d.id?w(T({},X),{position:U,parentId:void 0}):X);K=Ye(d.parentId,K),t(Pe(K))}}}};var yr=require("@xyflow/react"),Mt=require("react");function br(e,t,o=5){var l,c,g,f,p,y,E,h;let n={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},r=t.find(v=>v.id===e.id);if(!r||!e.position)return n;let a={left:e.position.x,right:e.position.x+((c=(l=r.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(g=r.measured)==null?void 0:g.height)!=null?f:0),width:(y=(p=r.measured)==null?void 0:p.width)!=null?y:0,height:(h=(E=r.measured)==null?void 0:E.height)!=null?h:0},s=o,i=o;return t.filter(v=>v.id!==r.id).reduce((v,u)=>{var C,A,L,U,K,X,Qe,Ue;let d={left:u.position.x,right:u.position.x+((A=(C=u.measured)==null?void 0:C.width)!=null?A:0),top:u.position.y,bottom:u.position.y+((U=(L=u.measured)==null?void 0:L.height)!=null?U:0),width:(X=(K=u.measured)==null?void 0:K.width)!=null?X:0,height:(Ue=(Qe=u.measured)==null?void 0:Qe.height)!=null?Ue:0},x=Math.abs(a.left-d.left);x<i&&(v.snapPosition.x=d.left,v.vertical=d.left,i=x);let m=Math.abs(a.right-d.right);m<i&&(v.snapPosition.x=d.right-a.width,v.vertical=d.right,i=m);let _=Math.abs(a.left-d.right);_<i&&(v.snapPosition.x=d.right,v.vertical=d.right,i=_);let I=Math.abs(a.right-d.left);I<i&&(v.snapPosition.x=d.left-a.width,v.vertical=d.left,i=I);let b=Math.abs(a.top-d.top);b<s&&(v.snapPosition.y=d.top,v.horizontal=d.top,s=b);let N=Math.abs(a.bottom-d.top);N<s&&(v.snapPosition.y=d.top-a.height,v.horizontal=d.top,s=N);let S=Math.abs(a.bottom-d.bottom);S<s&&(v.snapPosition.y=d.bottom-a.height,v.horizontal=d.bottom,s=S);let P=Math.abs(a.top-d.bottom);return P<s&&(v.snapPosition.y=d.bottom,v.horizontal=d.bottom,s=P),v},n)}var hr=()=>{let[e,t]=(0,Mt.useState)(void 0),[o,n]=(0,Mt.useState)(void 0),r=(0,Mt.useCallback)((a,s)=>{var i,l;if(t(void 0),n(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let c=br(a[0],s);a[0].position.x=(i=c.snapPosition.x)!=null?i:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),n(c.vertical)}return(0,yr.applyNodeChanges)(a,s)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:r}};var xr=require("@xyflow/react"),Jo=require("uuid");var Nr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},_r={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},vr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],s="",i="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",i=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",i=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:i}),{step:e,type:s,label:i,edgeLabel:l}},Oi=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},n=[];return t.forEach(r=>{r=r||"";let a=r.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let s=vr(a[0],o),i=vr(a[1],o);s&&i&&n.push({sourceId:s.step,targetId:i.step,label:s.edgeLabel||i.edgeLabel||""})}),{components:o,connections:n}},Tr=e=>{let{components:t,connections:o}=Oi(e);return{nodes:t,edges:o}};var wr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,xr.useReactFlow)();return{createDiagram:r=>{let{nodes:a,edges:s}=Tr(r),i=[],l=new Map;for(let[p,y]of Object.entries(a)){let E=(0,Jo.v7)(),h=Nr[y.type],v=_r[y.type];l.set(p,E);let u=$[h].MIN_WIDTH,d=$[h].MIN_HEIGHT;i.push({id:E,type:h,data:{label:y.label||"",variant:v,attribute:""},position:{x:0,y:0},width:u,height:d,measured:{width:u,height:d}})}let c=[];for(let p of s){let y=w(T({},xe),{id:(0,Jo.v7)(),source:l.get(p.sourceId)||p.sourceId,target:l.get(p.targetId)||p.targetId});c.push(y)}let{nodes:g,edges:f}=Dn(i,c);e(g),t(f),o()}}};var Co=require("react"),Gi={origin:"*",debug:!1};function Cr(e,t=Gi){let{origin:o,debug:n}=t,r=(0,Co.useCallback)((a,s)=>{n&&console.debug("[postMessage] sending:",{type:a,payload:s}),window.parent.postMessage({type:a,payload:s},o||"*")},[o,n]);return(0,Co.useEffect)(()=>{let a=s=>{let{type:i,data:l}=s.data||{};n&&console.debug("[postMessage] received:",s.data),i&&e[i]&&e[i](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,n]),{sendMessage:r}}var Ar=require("@xyflow/react");var Ir=(e,t)=>{let{getNodes:o,getEdges:n}=(0,Ar.useReactFlow)();return{selectElement:s=>{let i=o().map(c=>w(T({},c),{selected:c.id===s})),l=n().map(c=>w(T({},c),{selected:c.id===s}));return e(i),t(l),!0},isReady:()=>!0}};var kr=require("@xyflow/react"),De=require("react"),Lr=require("use-debounce"),Hi={nodes:[],edges:[]},Bi=500,Sr=10,Pr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n}=(0,kr.useReactFlow)(),[r,a]=(0,De.useState)([Hi]),[s,i]=(0,De.useState)(0),l=r[s],c=s>0,g=s<r.length-1,f=(0,De.useCallback)(d=>{o(r[d].nodes),n(r[d].edges)},[r,o,n]),p=(0,De.useCallback)(()=>{if(s>0){let d=s-1;i(d),f(d)}},[s,f]),y=(0,De.useCallback)(()=>{if(s<r.length-1){let d=s+1;i(d),f(d)}},[r,s,f]),E=d=>{let m=[...r.slice(0,s+1),d],_=m.length>Sr?m.slice(m.length-Sr):m;a(_),i(_.length-1)},h=(0,Lr.useDebouncedCallback)(()=>{let d=e(),x=t(),m={nodes:d,edges:x};JSON.stringify(l)!==JSON.stringify(m)&&E(m)},Bi),v=(0,De.useCallback)(d=>{if(d==="forceSave"){h();return}d.some(m=>m.type!=="select")&&h()},[h]),u=(0,De.useCallback)(()=>{a([]),i(0)},[]);return{undo:p,redo:y,saveHistory:v,canUndo:c,canRedo:g,clearHistory:u}};var Qo=require("react/jsx-runtime"),en=({id:e,className:t})=>(0,Qo.jsx)("marker",{id:e,className:k("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Qo.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var mt=require("react/jsx-runtime"),Dr=()=>(0,mt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,mt.jsxs)("defs",{children:[(0,mt.jsx)(en,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,mt.jsx)(en,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var rn=require("@xyflow/react"),j=require("lecom-ui"),bt=require("lucide-react"),Ht=require("react");var Rr=require("@xyflow/react"),zi=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=(0,Rr.useStore)(zi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var Ce=require("lecom-ui");var Ot=(u=>(u.START_EVENT="START_EVENT",u.END_EVENT="END_EVENT",u.TASK="TASK",u.SUBPROCESS="SUBPROCESS",u.GATEWAY="GATEWAY",u.ANNOTATION="ANNOTATION",u.CONNECTION="CONNECTION",u.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",u.ACTIVITY="ACTIVITY",u.PROCESS_INTERFACE="PROCESS_INTERFACE",u.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",u.VARIANT_ACTIVITY="VARIANT_ACTIVITY",u.AUTO_ACTIVITY="AUTO_ACTIVITY",u.DATA_STORE="DATA_STORE",u.DATA_OBJECT="DATA_OBJECT",u.DATA_OUTPUT="DATA_OUTPUT",u.DATA_INPUT="DATA_INPUT",u))(Ot||{});var $r=require("@xyflow/react"),Et=require("lecom-ui");var Vr=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var a;t((a=r.target)==null?void 0:a.result)},n.onerror=r=>{var a;o((a=r.target)==null?void 0:a.error)},n.readAsText(e)});function Mr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
3
+ `),a=encodeURI(r);Ao(a,`${o}.csv`)}var Ao=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};var Yr=require("uuid");var tn=require("xml-js");var Ui={compact:!0,spaces:4},Fi=e=>e.replaceAll(`
4
+ `,"&#xA;");function Or(e,t=Ui){if(e)return JSON.parse((0,tn.xml2json)(e,w(T({},t),{attributeValueFn:Fi})))}function Gr(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var zr=require("uuid");var Ac={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Hr={script:"SCRIPT",subprocess:"SUBPROCESS"},Br={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ft=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:a}=n,s=Number(r._attributes.width),i=Number(r._attributes.height);return{id:n.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(r._attributes.x),y:Number(r._attributes.y)},width:s,height:i,measured:{width:s,height:i}}},Yi=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=$.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=$.START_EVENT.MIN_HEIGHT,{node:ft({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Ki=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=$.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=$.END_EVENT.MIN_HEIGHT,{node:ft({cell:e,type:"END_EVENT"}),status:n,originalType:o}},$i=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Hr[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=wt(e.mxGeometry._attributes.width,$.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=wt(e.mxGeometry._attributes.height,$.TASK.MIN_HEIGHT),{node:ft({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Zi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=Br[o],r=["none","inclusive","event-based"],a="imported";return r.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=$.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=$.GATEWAY.MIN_HEIGHT,{node:ft({cell:e,type:"GATEWAY",variant:n}),status:a,originalType:t}},Xi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=wt(e.mxGeometry._attributes.width,$.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=wt(e.mxGeometry._attributes.height,$.ANNOTATION.MIN_HEIGHT),{node:ft({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},Ur=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=$.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=$.UNSUPPORTED.MIN_HEIGHT,{node:ft({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Fr=(e,t)=>{let{source:o,target:n}=e._attributes;return w(T({},xe),{id:(0,zr.v7)(),source:t.get(o)||o,target:t.get(n)||n})},Wr={TASK:$i,GATEWAY:Zi,START_EVENT:Yi,END_EVENT:Ki,ANNOTATION:Xi};var qi=e=>{var s;let t=new Map,o=Object.values(Ot),n=e.filter(i=>{var l;return o.includes((l=i._attributes)==null?void 0:l.type)}),r=[],a=[];for(let i of n){let l=(0,Yr.v7)(),{type:c}=i._attributes,g=Wr[c]||Ur;t.set((s=i._attributes)==null?void 0:s.id,l),i._attributes.id=l;let{node:f,status:p,originalType:y}=g(i);r.push(f),a.push({originalType:y,type:f.type,variant:f.data.variant,value:Gr(f.data.label),status:p})}return{nodes:r,governanceIdToNodeIdMap:t,summary:a}},ji=(e,t)=>e.filter(r=>{var a;return(a=r._attributes)==null?void 0:a.edge}).map(r=>Fr(r,t)),Ji=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=qi(t.root.mxCell),a=ji(t.root.mxCell,n);return{nodes:o,edges:a,summary:r}},Qi=async e=>{let t=await Vr(e),o=Or(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},a=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!a||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},Kr=async e=>{try{let t=await Qi(e),{nodes:o,edges:n,summary:r}=Ji(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Xr=require("react/jsx-runtime"),Zr=()=>{let{t:e}=(0,Et.useTranslation)(),{toast:t}=(0,Et.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,$r.useReactFlow)(),a=i=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=i.map(g=>[g.originalType,g.value,e(`adapter.governance.report.status.${g.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Xr.jsx)(Et.Button,{size:"small",variant:"ghost",onClick:()=>Mr({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async i=>{try{let{nodes:l,edges:c,summary:g}=await Kr(i);if(o(p=>p.concat(l)),n(p=>p.concat(c)),r(),g.some(p=>p.status==="unsupported")){a(g);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 qr=require("lecom-ui"),jr=require("react");var je=require("react/jsx-runtime"),Jr=i=>{var l=i,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:a}=l,s=ke(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,jr.useRef)(null),g=p=>{let y=p.target.files;y!=null&&y.length&&a(y),c.current&&(c.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(qr.Button,w(T({onClick:p=>{var y;(y=c.current)==null||y.click(),r==null||r(p)}},s),{children:e})),(0,je.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:g})]})};var Je=require("react/jsx-runtime"),Qr=({disabled:e=!1})=>{let{t}=(0,Ce.useTranslation)(),{toast:o}=(0,Ce.useNotificationToast)(),{createDiagram:n}=Zr(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=s=>{let i=s[0];if(!i){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(i)};return(0,Je.jsxs)(Ce.Tooltip,{children:[(0,Je.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(Jr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:a,children:(0,Je.jsx)(vn,{})})}),(0,Je.jsx)(Ce.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var ea=require("react/jsx-runtime"),on=({shortcut:e})=>(0,ea.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 R=require("lecom-ui"),Be=require("lucide-react"),ra=require("react");var ta=require("@xyflow/react"),Gt=require("html-to-image"),Io=require("lecom-ui"),oa=require("react");var es=3,nn="diagram",na=()=>{let{t:e}=(0,Io.useTranslation)(),{getNodes:t}=(0,ta.useReactFlow)(),{deselectAll:o}=gt(),[n,r]=(0,oa.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:g,y:f,width:p,height:y}=Vn(t());return{width:p,height:y,style:{width:`${p}px`,height:`${y}px`,transform:`translate(${-g}px, ${-f}px)`}}},s=async(g,f)=>{r(w(T({},n),{[f]:!0})),await o();try{let p=Rn();if(!p)throw new Error("Flow element not found");let y=a();return await g(p,y)}catch(p){(0,Io.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(w(T({},n),{[f]:!1}))}};return{exportAsPng:async(g=nn)=>{await s(async(f,p)=>{let y=await(0,Gt.toPng)(f,w(T({},p),{backgroundColor:"#fcfcfc"}));Ao(y,`${g}.png`)},"png")},exportAsHtml:async(g=nn)=>{await s(async(f,p)=>{let y=await(0,Gt.toSvg)(f,w(T({},p),{backgroundColor:"#fcfcfc"})),E=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
@@ -15,7 +15,7 @@
15
15
  <img src="${y}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,h=new Blob([E],{type:"text/html"}),v=URL.createObjectURL(h);Co(v,`${g}.html`),setTimeout(()=>URL.revokeObjectURL(v),100)},"html")},printDiagram:async(g=on)=>{await s(async(f,m)=>{let y=await(0,Ot.toPng)(f,w(_({},m),{pixelRatio:es})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let h=E.document;h.open(),h.write(`
18
+ `,h=new Blob([E],{type:"text/html"}),v=URL.createObjectURL(h);Ao(v,`${g}.html`),setTimeout(()=>URL.revokeObjectURL(v),100)},"html")},printDiagram:async(g=nn)=>{await s(async(f,p)=>{let y=await(0,Gt.toPng)(f,w(T({},p),{pixelRatio:es})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let h=E.document;h.open(),h.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
@@ -31,4 +31,4 @@
31
31
  <img src="${y}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),h.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var O=require("react/jsx-runtime");function aa(){let{t:e}=(0,R.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:a,isPrintingHtml:s}=na(),[i,l]=(0,ra.useState)(!1);return(0,O.jsxs)(R.DropdownMenu,{modal:!1,open:i,onOpenChange:l,children:[(0,O.jsx)(R.DropdownMenuTrigger,{asChild:!0,children:(0,O.jsx)("div",{children:(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,O.jsx)(Be.FolderOutputIcon,{})})}),!i&&(0,O.jsx)(R.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,O.jsxs)(R.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,O.jsx)(Be.FileImageIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,O.jsx)(Be.FileCodeIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,O.jsx)(Be.PrinterIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var G=require("react/jsx-runtime"),ia=({nodes:e,isReadOnly:t})=>{let{t:o}=(0,j.useTranslation)(),{deselectAll:n}=gt(),{isMoveTool:r,isHandTool:a,activeMoveTool:s,activeHandTool:i,isMinimapOpen:l,setIsMinimapOpen:c}=H(),g=(0,nn.useKeyPress)(["v","V"]),f=(0,nn.useKeyPress)(["h","H"]),m=(0,Gt.useCallback)(()=>{n(),i()},[n,i]);return(0,Gt.useEffect)(()=>{g&&!r&&!t&&s()},[g,s,r,t]),(0,Gt.useEffect)(()=>{f&&!a&&!t&&m()},[f,m,a,t]),(0,G.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(r&&"bg-grey-400"),iconButton:!0,onClick:s,children:(0,G.jsx)(bt.MousePointerIcon,{})})}),(0,G.jsxs)(j.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.move_tool"),(0,G.jsx)(tn,{shortcut:"V"})]})]}),(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(a&&"bg-grey-400"),iconButton:!0,onClick:m,children:(0,G.jsx)(bt.HandIcon,{})})}),(0,G.jsxs)(j.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.hand_tool")," ",(0,G.jsx)(tn,{shortcut:"H"})]})]})]}),(0,G.jsx)(aa,{}),!t&&(0,G.jsx)(Qr,{disabled:e.length>0}),(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(l&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!l),children:(0,G.jsx)(bt.MapIcon,{})})}),(0,G.jsx)(j.TooltipContent,{color:"black",children:o(l?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var ce=require("lecom-ui"),Io=require("lucide-react"),ge=require("react/jsx-runtime"),sa=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,ce.useTranslation)();return(0,ge.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ge.jsxs)(ce.Tooltip,{children:[(0,ge.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ge.jsx)(Io.UndoIcon,{})})}),(0,ge.jsx)(ce.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,ge.jsxs)(ce.Tooltip,{children:[(0,ge.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,ge.jsx)(Io.RedoIcon,{})})}),(0,ge.jsx)(ce.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var la=require("@xyflow/react"),F=require("lecom-ui"),yt=require("lucide-react");var z=require("react/jsx-runtime"),da=()=>{let{t:e}=(0,F.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,la.useReactFlow)();return(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,z.jsx)(yt.ScanIcon,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,z.jsx)(yt.ZoomOut,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,z.jsx)(Tn,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,z.jsx)(yt.ZoomIn,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Do=require("@xyflow/react");var Ht=require("@xyflow/react");var rn=require("react/jsx-runtime"),te=r=>{var a=r,{type:e,position:t,className:o}=a,n=ke(a,["type","position","className"]);return(0,rn.jsx)(Ht.Handle,_({type:e,position:t,className:k("size-2.5 border border-grey-400 bg-white",o)},n))},So=i=>{var l=i,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:a}=l,s=ke(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,Ht.useReactFlow)(),f=(()=>{if(n!=="source")return!1;let m=c();return t==="TASK"?m.filter(E=>E.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?m.filter(E=>E.source===e).length>=2:!1})();return(0,rn.jsx)(Ht.Handle,_({type:n,position:r,className:k("size-2.5 border border-grey-400 bg-white transition-all duration-200",{"opacity-50 cursor-not-allowed pointer-events-none":f,"hover:border-grey-500":!f},a),style:{pointerEvents:f?"none":"auto"}},s))};var ko=require("@xyflow/react"),ca=require("lodash");var pa=require("react/jsx-runtime"),ht=o=>{var n=o,{nodeId:e}=n,t=ke(n,["nodeId"]);let{getNode:r,getNodes:a,setNodes:s}=(0,ko.useReactFlow)(),i=({width:l,height:c})=>{if(!e)return;let g=r(e);if((g==null?void 0:g.type)!=="LANE")return;let f=[...a()],m=!g.parentId,y=m?g.id:g.parentId,E=f.filter(p=>p.type==="LANE"&&p.parentId===y);if(!E.length)return;let h=(0,ca.orderBy)(E,["position.y"]),v=0;h.forEach((p,d)=>{var T,I;let x=d===h.length-1,u=(I=(T=p.measured)==null?void 0:T.height)!=null?I:0;f=f.map(b=>{if(b.id===p.id){let N=m?l-ae.HEADER_WIDTH:l,S=w(_({},b),{width:N,measured:w(_({},b.measured),{width:N}),position:w(_({},b.position),{y:v})});return x&&m&&(S.height=c-v),S}return b}),v+=u}),f=f.map(p=>{if(p.id===y){let d=m?l:l+ae.HEADER_WIDTH;return w(_({},p),{width:d,height:m?c:v,measured:{width:d,height:m?c:v}})}return p}),s(f)};return(0,pa.jsx)(ko.NodeResizer,_({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>i(c)},t))};var vt=require("@xyflow/react"),Ae=require("lecom-ui");var Lo=require("@xyflow/react"),W=require("lecom-ui"),ua=require("lucide-react");var se=require("react/jsx-runtime"),ma=({nodeId:e})=>{let{t}=(0,W.useTranslation)(),{updateNodeData:o}=(0,Lo.useReactFlow)(),n=(0,Lo.useNodesData)(e),r=a=>{(n==null?void 0:n.data.variant)!==a&&o(e,{variant:a})};return(0,se.jsxs)(W.DropdownMenu,{children:[(0,se.jsxs)(W.Tooltip,{children:[(0,se.jsx)(W.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(W.DropdownMenuTrigger,{asChild:!0,children:(0,se.jsx)(W.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,se.jsx)(ua.WrenchIcon,{})})})}),(0,se.jsx)(W.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,se.jsxs)(W.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,se.jsx)(W.DropdownMenuLabel,{className:"flex items-center",children:(0,se.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,se.jsx)(W.DropdownMenuGroup,{children:Object.entries(ro).map(([a,s])=>(0,se.jsxs)(W.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===a}),onClick:()=>r(a),children:[(0,se.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var Po=require("@xyflow/react"),V=require("lecom-ui"),ga=require("lucide-react");var B=require("react/jsx-runtime"),fa=({nodeId:e})=>{let{t}=(0,V.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Po.useReactFlow)(),a=(0,Po.useNodesData)(e),i=n().filter(m=>m.source===e).some(m=>{let y=r(m.target);return(y==null?void 0:y.type)==="END_EVENT"}),l=g=>{o(e,{variant:(a==null?void 0:a.data.variant)===g?"":g})},c=g=>{o(e,{attribute:(a==null?void 0:a.data.attribute)===g?"":g})};return(0,B.jsxs)(V.DropdownMenu,{children:[(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsx)(V.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(V.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,B.jsx)(ga.WrenchIcon,{})})})}),(0,B.jsx)(V.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,B.jsxs)(V.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,B.jsxs)(V.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,B.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,B.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(no).map(([g,f])=>{let m=g==="LOOP"&&i,y=m?t("editor.task_menu.loop_not_allowed_when_connected_to_end"):void 0;return(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsx)(V.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:m,className:k({"bg-grey-100 text-blue-500":(a==null?void 0:a.data.attribute)===g,"opacity-50 cursor-not-allowed":m}),onClick:m?void 0:()=>c(g),children:(0,B.jsx)(f.icon,{className:"stroke-inherit"})})}),y&&(0,B.jsx)(V.TooltipContent,{color:"black",children:y})]},g)})})]}),(0,B.jsx)(V.DropdownMenuGroup,{children:Object.entries(oo).map(([g,f])=>{let m=g==="SCRIPT"&&i;return(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsxs)(V.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(a==null?void 0:a.data.variant)===g,"opacity-50 cursor-not-allowed":m}),disabled:m,onClick:m?void 0:()=>l(g),children:[(0,B.jsx)(f.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${g.toLowerCase()}`)]})}),m&&(0,B.jsx)(V.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]},g)})})]})]})};var pe=require("react/jsx-runtime"),ue=({nodeId:e,nodeType:t,isChild:o,isVisible:n})=>{var E;let{t:r}=(0,Ae.useTranslation)(),{setDraggableNode:a}=ut(),{getEdges:s,getNodes:i}=(0,vt.useReactFlow)(),l=i(),c=s(),g=({event:h,type:v,variant:p})=>{a({type:v,variant:p}),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("sourceId",e)},f={START_EVENT:{type:"START_EVENT",icon:Ct,label:r("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:ot,label:r("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Ct,label:r("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:r("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:jt,label:r("bpmn.annotation.variant.default")}},m=[{component:(0,pe.jsx)(co,{elementId:e})}],y={START_EVENT:[f.TASK,f.ANNOTATION,...m],TASK:[{component:(0,pe.jsx)(It,{elementId:e})},{component:(0,pe.jsx)(fa,{nodeId:e})},f.TASK,f.GATEWAY,f.END_EVENT,f.ANNOTATION,...m],GATEWAY:[{component:(0,pe.jsx)(It,{elementId:e})},{component:(0,pe.jsx)(ma,{nodeId:e})},f.TASK,f.ANNOTATION,...m],END_EVENT:[f.ANNOTATION,...m],LANE:[...o?[]:[f.ANNOTATION],...m],ANNOTATION:[...m],UNSUPPORTED:[...m]};return(0,pe.jsx)(vt.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:vt.Position.Right,align:"start",isVisible:n,children:(E=y[t])==null?void 0:E.map((h,v)=>{if(h.component)return(0,pe.jsx)("div",{children:h.component},v);let p={sourceNodeType:t,targetNodeType:h.type,sourceNodeId:e,nodes:l,edges:c},d=Kn(p),x={gateway_limit_reached:r("editor.toolbar.gateway_limit_reached"),start_event_already_exists:r("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:r("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:r("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:r("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:r("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:r("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:r("editor.toolbar.task_limit_reached")},u=d.shouldDisable&&d.reason?x[d.reason]||h.label:h.label||"";return(0,pe.jsxs)(Ae.Tooltip,{children:[(0,pe.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(Ae.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!d.shouldDisable,disabled:d.shouldDisable,className:d.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:d.shouldDisable?void 0:T=>g({event:T,type:h.type,variant:h.variant}),children:h.icon&&(0,pe.jsx)(h.icon,{size:16})})}),(0,pe.jsx)(Ae.TooltipContent,{color:"black",children:u})]},v)})})};var Ie=require("react/jsx-runtime"),Ea=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Do.useReactFlow)(),{isMultipleSelection:a}=H(),s=i=>{r(e,{label:i})};return(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)("div",{className:k("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden 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,Ie.jsx)(ee,{value:t.label,className:"m-1 text-grey-600",onChange:s})}),(0,Ie.jsx)(ue,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&!a&&o}),(0,Ie.jsx)(ht,{isVisible:!n&&!a&&o,minWidth:so.MIN_WIDTH,minHeight:so.MIN_HEIGHT}),(0,Ie.jsx)(te,{type:"target",position:Do.Position.Left})]})};var Bt=require("@xyflow/react"),ba=require("react");var be=require("react/jsx-runtime"),ya=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Bt.useReactFlow)(),{isMultipleSelection:a}=H(),[s,i]=(0,ba.useState)(!1),l=f=>{r(e,{label:f})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{i(!1)},onDoubleClick:()=>{i(!0)},children:[(0,be.jsx)(ot,{className:k("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(ee,{value:t.label,isEditing:s,onChange:l})})]}),(0,be.jsx)(ue,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&!a&&o}),(0,be.jsx)(te,{type:"source",position:Bt.Position.Right}),(0,be.jsx)(te,{type:"target",position:Bt.Position.Left})]})};var zt=require("@xyflow/react"),ha=require("react");var ye=require("react/jsx-runtime"),va=({id:e,data:t,selected:o,dragging:n})=>{let r=ro[t.variant].icon,{updateNodeData:a}=(0,zt.useReactFlow)(),{isMultipleSelection:s}=H(),[i,l]=(0,ha.useState)(!1),c=m=>{a(e,{label:m})};return(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,ye.jsx)(r,{className:k("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,ye.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ye.jsx)(ee,{value:t.label,isEditing:i,onChange:c})})]}),(0,ye.jsx)(ue,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&!s&&o}),(0,ye.jsx)(te,{type:"target",position:zt.Position.Left}),(0,ye.jsx)(So,{type:"source",position:zt.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var Ro=require("@xyflow/react"),Na=require("react");var ve=require("react/jsx-runtime"),_a=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ro.useReactFlow)(),{isMultipleSelection:a}=H(),[s,i]=(0,Na.useState)(!1),l=f=>{r(e,{label:f})};return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsxs)("div",{className:"relative",onBlur:()=>{i(!1)},onDoubleClick:()=>{i(!0)},children:[(0,ve.jsx)(to,{className:k("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ve.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ve.jsx)(ee,{value:t.label,isEditing:s,onChange:l})})]}),(0,ve.jsx)(ue,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&!a&&o}),(0,ve.jsx)(te,{type:"source",position:Ro.Position.Right})]})};var Ut=require("@xyflow/react"),Ta=require("lecom-ui");var oe=require("react/jsx-runtime"),xa=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r,getNodes:a}=(0,Ut.useReactFlow)(),{isMultipleSelection:s}=H(),{t:i}=(0,Ta.useTranslation)(),l=E=>{let h=E.trim(),v=t.label||"";if(h===v)return;let p=a(),d=h;h||(d=_o(p,i("bpmn.task.label.prefix")));let x=To(d,p);x!==v&&r(e,{label:x})},c=t.variant?oo[t.variant].icon:null,g=t.attribute?no[t.attribute].icon:null,f=t.variant==="SUBPROCESS",m=c&&!f,y=g||f;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("div",{className:k("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"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,oe.jsx)(ee,{value:t.label,maxLength:60,className:k("m-1",{"py-6":m||y}),onChange:l}),c&&(0,oe.jsx)("div",{className:k("absolute flex items-center p-1",f?"bottom-0":"top-0 left-0"),children:(0,oe.jsx)(c,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})}),g&&(0,oe.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,oe.jsx)("div",{className:k("flex items-center w-16 p-1",f?"justify-between":"justify-center"),children:(0,oe.jsx)(g,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,oe.jsx)(ue,{nodeId:e,nodeType:"TASK",isVisible:!n&&!s&&o}),(0,oe.jsx)(ht,{isVisible:!n&&!s&&o,minWidth:ao.MIN_WIDTH,minHeight:ao.MIN_HEIGHT}),(0,oe.jsx)(So,{type:"source",position:Ut.Position.Right,nodeId:e,nodeType:"TASK"}),(0,oe.jsx)(te,{type:"target",position:Ut.Position.Left})]})};var an=require("@xyflow/react");var Re=require("react/jsx-runtime"),wa=({id:e,data:t,selected:o,dragging:n})=>{let{isMultipleSelection:r}=H();return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.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,Re.jsx)(ue,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&!r&&o}),(0,Re.jsx)(te,{type:"source",position:an.Position.Right}),(0,Re.jsx)(te,{type:"target",position:an.Position.Left})]})};var Vo=require("@xyflow/react"),Ca=require("lodash"),sn=require("react");var fe=require("react/jsx-runtime"),Aa=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:a,getNodes:s}=(0,Vo.useReactFlow)(),{isMultipleSelection:i}=H(),l=s(),c=!r,g=(0,sn.useMemo)(()=>(0,Ca.orderBy)([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),f=c?io.MIN_WIDTH:ae.MIN_WIDTH,m=(0,sn.useMemo)(()=>{if(c&&g.length>1){let E=[...g];return E.pop(),E.reduce((v,p)=>{var d,x;return v+((x=(d=p.measured)==null?void 0:d.height)!=null?x:0)},0)+ae.MIN_HEIGHT}return ae.MIN_HEIGHT},[c,g]),y=E=>{a(e,{label:E})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:k("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,fe.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,fe.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,fe.jsx)(ee,{value:t.label,className:"w-full h-full",onChange:y})})}),(0,fe.jsx)("div",{className:"flex-1"})]}),(0,fe.jsx)(ue,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!n&&!i&&o}),(0,fe.jsx)(ht,{nodeId:e,minWidth:f,minHeight:m,isVisible:!n&&!i&&o}),c&&(0,fe.jsx)(te,{type:"source",position:Vo.Position.Right})]})};var Ia={START_EVENT:_a,END_EVENT:ya,TASK:xa,GATEWAY:va,ANNOTATION:Ea,LANE:Aa,UNSUPPORTED:wa},Sa={SEQUENCE_EDGE:Wn,MESSAGE_EDGE:mr,ANNOTATION_EDGE:Un},ka="#fafafa",La="#bebebe",Pa=1,Da=10,Ra="bottom-left",Va=.5,Ma=4,Oa={x:0,y:0,zoom:.75};var Ga=require("@xyflow/react"),Mo=require("react"),Ba=require("react/jsx-runtime"),ts=e=>({width:e.width,height:e.height,transform:e.transform}),Ha=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:n=[6,6]})=>{let{width:r,height:a,transform:s}=(0,Ga.useStore)(ts),i=(0,Mo.useRef)(null);return(0,Mo.useEffect)(()=>{let l=i.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let g=window.devicePixelRatio;l.width=r*g,l.height=a*g,c.scale(g,g),c.clearRect(0,0,r,a),c.strokeStyle=o,c.setLineDash(n),typeof t=="number"&&(c.moveTo(t*s[2]+s[0],0),c.lineTo(t*s[2]+s[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*s[2]+s[1]),c.lineTo(r,e*s[2]+s[1]),c.stroke())},[r,a,s,e,t,o,n]),(0,Ba.jsx)("canvas",{ref:i,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var Y=require("lecom-ui"),le=require("react/jsx-runtime"),za=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:n})=>{let{t:r}=(0,Y.useTranslation)(),a=!!e,s=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(g=>g.filter(f=>!l.some(m=>m.id===f.id))),c!=null&&c.length&&n(g=>g.filter(f=>!c.some(m=>m.id===f.id))),t(null)},i=()=>{t(null)};return(0,le.jsx)(Y.Dialog,{open:a,onOpenChange:i,children:(0,le.jsxs)(Y.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,le.jsx)(Y.DialogHeader,{children:(0,le.jsx)(Y.DialogTitle,{children:(0,le.jsx)(Y.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:r("editor.modals.delete_elements.title")})})}),(0,le.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,le.jsx)("div",{className:"py-2",children:(0,le.jsx)(Y.Notification,{type:"callout",variant:"warning",content:r("editor.modals.delete_elements.callout")})}),(0,le.jsx)(Y.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:r("editor.modals.delete_elements.content")})]}),(0,le.jsxs)(Y.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,le.jsx)(Y.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:i,children:(0,le.jsx)(Y.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:r("editor.modals.delete_elements.cancel")})}),(0,le.jsx)(Y.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:s,children:r("editor.modals.delete_elements.confirm")})]})]})})};var Ua=require("@xyflow/react"),Se=require("lecom-ui");var ze=require("react/jsx-runtime"),Fa=()=>{let{t:e}=(0,Se.useTranslation)(),{setDraggableNode:t}=ut(),{getNodes:o}=(0,Ua.useReactFlow)(),n=o(),r=mo(n),a=[{type:"START_EVENT",icon:to,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:ot,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Ct,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Cn,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:wn,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:xn,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Qt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Jt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:_n,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:jt,label:e("bpmn.annotation.variant.default")}],s=(i,l)=>{t({type:l.type,variant:l.variant,attribute:l.attribute}),i.dataTransfer.effectAllowed="move"};return(0,ze.jsx)("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:a.map((i,l)=>{let c=r&&i.type==="START_EVENT",g=c?e("editor.toolbar.start_event_already_exists"):i.label;return(0,ze.jsxs)(Se.Tooltip,{children:[(0,ze.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,ze.jsx)(Se.Button,{className:`[&>svg]:size-6 ${c?"opacity-50 cursor-not-allowed":""}`,size:"small",variant:"ghost",color:"grey",draggable:!c,disabled:c,iconButton:!0,onDragStart:c?void 0:f=>s(f,i),children:(0,ze.jsx)(i.icon,{})},l)}),(0,ze.jsx)(Se.TooltipContent,{color:"black",side:"right",children:g})]},l)})})};var Oo=require("lecom-ui"),Nt=require("lucide-react"),Go=require("react"),ne=require("react/jsx-runtime"),Wa=({validationResult:e,onClose:t})=>{let{t:o}=(0,Oo.useTranslation)(),[n,r]=(0,Go.useState)(!1);if((0,Go.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:a,errors:s}=e;return(0,ne.jsxs)("div",{className:k("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,ne.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,ne.jsx)("div",{className:"flex-shrink-0",children:a?(0,ne.jsx)(Nt.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,ne.jsx)(Nt.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,ne.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,ne.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,ne.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,ne.jsx)(Oo.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,ne.jsx)(Nt.XIcon,{})})]}),(0,ne.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,ne.jsx)("p",{children:o("validation.success.message")}):(0,ne.jsx)("div",{className:"list-disc list-inside",children:s.map(i=>(0,ne.jsx)("li",{className:"mb-1",children:i.message},i.id))})})]})};var Z=require("react/jsx-runtime"),os=[],Ka=(0,re.forwardRef)(({mode:e="edit"},t)=>{let o=(0,re.useRef)(!1),[n,r,a]=(0,J.useNodesState)([]),[s,i,l]=(0,J.useEdgesState)([]),[c,g]=(0,re.useState)(null),{isMoveTool:f,isHandTool:m,isReadOnly:y,setIsReadOnly:E,setIsMultipleSelection:h,isMinimapOpen:v}=H(),{validationResult:p,handleValidationComplete:d,clearValidation:x,isAutoValidationEnabled:u,validateDiagram:T}=rr(),{getNode:I,getNodes:b,getEdges:N}=(0,J.useReactFlow)(),S=Ir(r,i);(0,re.useImperativeHandle)(t,()=>S);let{onNodeDrag:P,onDrop:C,onDragOver:A,onNodeDragStop:L}=Er({nodes:n,setNodes:r,setEdges:i}),{isValidConnection:U,onConnect:K}=$n({setEdges:i});cr();let{createDiagram:X}=wr(),{undo:Qe,redo:Ue,saveHistory:et,canUndo:Qa,canRedo:ei}=Pr(),{helperLineHorizontal:ti,helperLineVertical:oi}=hr();Cr({LIA_CREATE_DIAGRAM:X,CLEAR_DIAGRAM:()=>{r([]),i([])}}),(0,re.useEffect)(()=>{E(e==="readonly")},[e,E]),(0,re.useEffect)(()=>{if(n.length===0&&s.length===0&&e!=="readonly"){let _t=(0,Ho.v7)(),mi={id:_t,type:"START_EVENT",position:{x:200,y:300},data:{}},gn=(0,Ho.v7)(),gi={id:gn,type:"TASK",position:{x:400,y:270},data:{label:ln.i18n.t("editor.toolbar.initial_task")}},fi=(0,Ho.v7)(),Ei=w(_({},xe),{id:fi,source:_t,target:gn});r([mi,gi]),i([Ei])}},[n.length,s.length,e,r,i]);let ni=()=>{x()},ri=(0,re.useCallback)(({nodes:Q,edges:q})=>{let tt=Q.length+q.length>1;h(tt)},[h]);(0,J.useOnSelectionChange)({onChange:ri});let ai=Q=>{let q=I(Q.id);if(q!=null&&q.parentId&&(q==null?void 0:q.type)==="LANE"){let tt=Ye(q.parentId,n.filter(_t=>_t.id!==q.id&&_t.type==="LANE"));r(Pe(tt))}},ii=Q=>{Q.forEach(q=>{switch(q.type){case"remove":ai(q);break}})},si=(0,re.useCallback)(()=>{if(!u){o.current=!1;return}let Q=b(),q=N(),tt=T({nodes:Q,edges:q});d(tt),o.current=!1},[u,b,N,T,d]),un=(0,Ya.useDebouncedCallback)(si,300),mn=(0,re.useCallback)(()=>{u&&!o.current&&(o.current=!0,un())},[u,un]),li=Q=>{a(Q),et(Q),mn(),ii(Q)},di=Q=>{l(Q),et(Q),mn()},ci=()=>{et("forceSave")},pi=async({nodes:Q,edges:q})=>(g({nodes:Q,edges:q}),!1),ui={nodes:n,edges:s};return(0,Z.jsxs)("div",{className:"w-full h-full",children:[!y&&(0,Z.jsx)(Fa,{}),(0,Z.jsx)(Dr,{}),(0,Z.jsxs)(J.ReactFlow,{edges:s,nodes:n,nodeTypes:Ia,edgeTypes:Sa,minZoom:Va,maxZoom:Ma,panOnDrag:m||y?!0:os,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!y&&f,nodesConnectable:!y&&f,nodesDraggable:!y&&f,isValidConnection:U,connectionLineComponent:gr,onConnect:K,onDrop:C,onDropCapture:ci,onDragOver:A,onNodesChange:li,onEdgesChange:di,onNodeDrag:P,onNodeDragStop:L,onBeforeDelete:pi,selectionMode:J.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:Oa,connectOnClick:!1,children:[v&&(0,Z.jsx)(J.MiniMap,{pannable:!0,zoomable:!0,position:Ra,className:"shadow-md rounded-md"}),(0,Z.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!y&&(0,Z.jsx)(sa,{canUndo:Qa,canRedo:ei,undo:Qe,redo:Ue}),(0,Z.jsx)(ia,{nodes:n,isReadOnly:y,diagram:ui,onValidationComplete:d,onValidateDiagram:T}),(0,Z.jsx)(da,{})]}),(0,Z.jsx)(Ha,{horizontal:ti,vertical:oi}),(0,Z.jsx)(J.Background,{gap:Da,size:Pa,color:La,bgColor:ka}),p&&(0,Z.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,Z.jsx)(Wa,{validationResult:p,onClose:ni})})]}),(0,Z.jsx)(za,{pendingDelete:c,setPendingDelete:g,setNodes:r,setEdges:i})]})});Ka.displayName="Editor";var ns=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:n})=>((0,re.useEffect)(()=>{t&&ln.i18n.changeLanguage(t)},[t]),(0,Z.jsx)(J.ReactFlowProvider,{children:(0,Z.jsx)(On,{value:{onConfigureElement:o},children:(0,Z.jsx)(Ka,{mode:e,ref:n})})})),dn=ns;var cn=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 Bo=require("lecom-ui");var $a={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"}},lane:{variant:{default:"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 Za={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"}},lane:{variant:{default:"Lane"}},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 Xa={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"},label:{prefix:"Atividade"}},lane:{variant:{default:"Lane"}},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 qa={pt_BR:Xa,en_US:$a,es_ES:Za};var ja,Ja,rs=(Ja=(ja=cn("LecomUserLanguage"))!=null?ja:cn("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Ja:Bo.Translations.PT_BR;(0,Bo.initializeI18n)({lng:rs,resources:qa});var pn=require("react/jsx-runtime"),as=e=>(0,pn.jsx)(yn,{children:(0,pn.jsx)(dn,_({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,RoutingVariant,useSelectionUtils});
34
+ `),h.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var O=require("react/jsx-runtime");function aa(){let{t:e}=(0,R.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:a,isPrintingHtml:s}=na(),[i,l]=(0,ra.useState)(!1);return(0,O.jsxs)(R.DropdownMenu,{modal:!1,open:i,onOpenChange:l,children:[(0,O.jsx)(R.DropdownMenuTrigger,{asChild:!0,children:(0,O.jsx)("div",{children:(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,O.jsx)(Be.FolderOutputIcon,{})})}),!i&&(0,O.jsx)(R.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,O.jsxs)(R.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,O.jsx)(Be.FileImageIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,O.jsx)(Be.FileCodeIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,O.jsx)(Be.PrinterIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var G=require("react/jsx-runtime"),ia=({nodes:e,isReadOnly:t})=>{let{t:o}=(0,j.useTranslation)(),{deselectAll:n}=gt(),{isMoveTool:r,isHandTool:a,activeMoveTool:s,activeHandTool:i,isMinimapOpen:l,setIsMinimapOpen:c}=H(),g=(0,rn.useKeyPress)(["v","V"]),f=(0,rn.useKeyPress)(["h","H"]),p=(0,Ht.useCallback)(()=>{n(),i()},[n,i]);return(0,Ht.useEffect)(()=>{g&&!r&&!t&&s()},[g,s,r,t]),(0,Ht.useEffect)(()=>{f&&!a&&!t&&p()},[f,p,a,t]),(0,G.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(r&&"bg-grey-400"),iconButton:!0,onClick:s,children:(0,G.jsx)(bt.MousePointerIcon,{})})}),(0,G.jsxs)(j.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.move_tool"),(0,G.jsx)(on,{shortcut:"V"})]})]}),(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(a&&"bg-grey-400"),iconButton:!0,onClick:p,children:(0,G.jsx)(bt.HandIcon,{})})}),(0,G.jsxs)(j.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.hand_tool")," ",(0,G.jsx)(on,{shortcut:"H"})]})]})]}),(0,G.jsx)(aa,{}),!t&&(0,G.jsx)(Qr,{disabled:e.length>0}),(0,G.jsxs)(j.Tooltip,{children:[(0,G.jsx)(j.TooltipTrigger,{asChild:!0,children:(0,G.jsx)(j.Button,{size:"small",variant:"ghost",color:"grey",className:k(l&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!l),children:(0,G.jsx)(bt.MapIcon,{})})}),(0,G.jsx)(j.TooltipContent,{color:"black",children:o(l?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var ce=require("lecom-ui"),So=require("lucide-react"),ge=require("react/jsx-runtime"),sa=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,ce.useTranslation)();return(0,ge.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ge.jsxs)(ce.Tooltip,{children:[(0,ge.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ge.jsx)(So.UndoIcon,{})})}),(0,ge.jsx)(ce.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,ge.jsxs)(ce.Tooltip,{children:[(0,ge.jsx)(ce.TooltipTrigger,{asChild:!0,children:(0,ge.jsx)(ce.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,ge.jsx)(So.RedoIcon,{})})}),(0,ge.jsx)(ce.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var la=require("@xyflow/react"),F=require("lecom-ui"),yt=require("lucide-react");var z=require("react/jsx-runtime"),da=()=>{let{t:e}=(0,F.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,la.useReactFlow)();return(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,z.jsx)(yt.ScanIcon,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,z.jsx)(yt.ZoomOut,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,z.jsx)(xn,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,z.jsxs)(F.Tooltip,{children:[(0,z.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,z.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,z.jsx)(yt.ZoomIn,{})})}),(0,z.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Ro=require("@xyflow/react");var Bt=require("@xyflow/react");var an=require("react/jsx-runtime"),te=r=>{var a=r,{type:e,position:t,className:o}=a,n=ke(a,["type","position","className"]);return(0,an.jsx)(Bt.Handle,T({type:e,position:t,className:k("size-2.5 border border-grey-400 bg-white relative","before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent ",o)},n))},ko=i=>{var l=i,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:a}=l,s=ke(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,Bt.useReactFlow)(),f=(()=>{if(n!=="source")return!1;let p=c();return t==="TASK"?p.filter(E=>E.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?p.filter(E=>E.source===e).length>=2:!1})();return(0,an.jsx)(Bt.Handle,T({type:n,position:r,className:k("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative","before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent",{"opacity-50 cursor-not-allowed pointer-events-none":f,"hover:border-grey-500":!f},a),style:{pointerEvents:f?"none":"auto"}},s))};var Lo=require("@xyflow/react"),ca=require("lodash");var pa=require("react/jsx-runtime"),ht=o=>{var n=o,{nodeId:e}=n,t=ke(n,["nodeId"]);let{getNode:r,getNodes:a,setNodes:s}=(0,Lo.useReactFlow)(),i=({width:l,height:c})=>{if(!e)return;let g=r(e);if((g==null?void 0:g.type)!=="LANE")return;let f=[...a()],p=!g.parentId,y=p?g.id:g.parentId,E=f.filter(u=>u.type==="LANE"&&u.parentId===y);if(!E.length)return;let h=(0,ca.orderBy)(E,["position.y"]),v=0;h.forEach((u,d)=>{var _,I;let x=d===h.length-1,m=(I=(_=u.measured)==null?void 0:_.height)!=null?I:0;f=f.map(b=>{if(b.id===u.id){let N=p?l-ae.HEADER_WIDTH:l,S=w(T({},b),{width:N,measured:w(T({},b.measured),{width:N}),position:w(T({},b.position),{y:v})});return x&&p&&(S.height=c-v),S}return b}),v+=m}),f=f.map(u=>{if(u.id===y){let d=p?l:l+ae.HEADER_WIDTH;return w(T({},u),{width:d,height:p?c:v,measured:{width:d,height:p?c:v}})}return u}),s(f)};return(0,pa.jsx)(Lo.NodeResizer,T({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>i(c)},t))};var vt=require("@xyflow/react"),Ae=require("lecom-ui");var Po=require("@xyflow/react"),W=require("lecom-ui"),ua=require("lucide-react");var se=require("react/jsx-runtime"),ma=({nodeId:e})=>{let{t}=(0,W.useTranslation)(),{updateNodeData:o}=(0,Po.useReactFlow)(),n=(0,Po.useNodesData)(e),r=a=>{(n==null?void 0:n.data.variant)!==a&&o(e,{variant:a})};return(0,se.jsxs)(W.DropdownMenu,{children:[(0,se.jsxs)(W.Tooltip,{children:[(0,se.jsx)(W.TooltipTrigger,{asChild:!0,children:(0,se.jsx)(W.DropdownMenuTrigger,{asChild:!0,children:(0,se.jsx)(W.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,se.jsx)(ua.WrenchIcon,{})})})}),(0,se.jsx)(W.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,se.jsxs)(W.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,se.jsx)(W.DropdownMenuLabel,{className:"flex items-center",children:(0,se.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,se.jsx)(W.DropdownMenuGroup,{children:Object.entries(ro).map(([a,s])=>(0,se.jsxs)(W.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===a}),onClick:()=>r(a),children:[(0,se.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var Do=require("@xyflow/react"),V=require("lecom-ui"),ga=require("lucide-react");var B=require("react/jsx-runtime"),fa=({nodeId:e})=>{let{t}=(0,V.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,Do.useReactFlow)(),a=(0,Do.useNodesData)(e),i=n().filter(p=>p.source===e).some(p=>{let y=r(p.target);return(y==null?void 0:y.type)==="END_EVENT"}),l=g=>{o(e,{variant:(a==null?void 0:a.data.variant)===g?"":g})},c=g=>{o(e,{attribute:(a==null?void 0:a.data.attribute)===g?"":g})};return(0,B.jsxs)(V.DropdownMenu,{children:[(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsx)(V.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(V.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,B.jsx)(ga.WrenchIcon,{})})})}),(0,B.jsx)(V.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,B.jsxs)(V.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,B.jsxs)(V.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,B.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,B.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(no).map(([g,f])=>{let p=g==="LOOP"&&i,y=p?t("editor.task_menu.loop_not_allowed_when_connected_to_end"):void 0;return(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsx)(V.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:p,className:k({"bg-grey-100 text-blue-500":(a==null?void 0:a.data.attribute)===g,"opacity-50 cursor-not-allowed":p}),onClick:p?void 0:()=>c(g),children:(0,B.jsx)(f.icon,{className:"stroke-inherit"})})}),y&&(0,B.jsx)(V.TooltipContent,{color:"black",children:y})]},g)})})]}),(0,B.jsx)(V.DropdownMenuGroup,{children:Object.entries(oo).map(([g,f])=>{let p=g==="SCRIPT"&&i;return(0,B.jsxs)(V.Tooltip,{children:[(0,B.jsx)(V.TooltipTrigger,{asChild:!0,children:(0,B.jsxs)(V.DropdownMenuItem,{className:k({"bg-grey-100 text-blue-500":(a==null?void 0:a.data.variant)===g,"opacity-50 cursor-not-allowed":p}),disabled:p,onClick:p?void 0:()=>l(g),children:[(0,B.jsx)(f.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${g.toLowerCase()}`)]})}),p&&(0,B.jsx)(V.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]},g)})})]})]})};var pe=require("react/jsx-runtime"),ue=({nodeId:e,nodeType:t,isChild:o,isVisible:n})=>{var E;let{t:r}=(0,Ae.useTranslation)(),{setDraggableNode:a}=ut(),{getEdges:s,getNodes:i}=(0,vt.useReactFlow)(),l=i(),c=s(),g=({event:h,type:v,variant:u})=>{a({type:v,variant:u}),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("sourceId",e)},f={START_EVENT:{type:"START_EVENT",icon:At,label:r("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:ot,label:r("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:At,label:r("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:r("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:jt,label:r("bpmn.annotation.variant.default")}},p=[{component:(0,pe.jsx)(po,{elementId:e})}],y={START_EVENT:[f.TASK,f.ANNOTATION,...p],TASK:[{component:(0,pe.jsx)(St,{elementId:e})},{component:(0,pe.jsx)(fa,{nodeId:e})},f.TASK,f.GATEWAY,f.END_EVENT,f.ANNOTATION,...p],GATEWAY:[{component:(0,pe.jsx)(St,{elementId:e})},{component:(0,pe.jsx)(ma,{nodeId:e})},f.TASK,f.ANNOTATION,...p],END_EVENT:[f.ANNOTATION,...p],LANE:[...o?[]:[f.ANNOTATION],...p],ANNOTATION:[...p],UNSUPPORTED:[...p]};return(0,pe.jsx)(vt.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:vt.Position.Right,align:"start",isVisible:n,children:(E=y[t])==null?void 0:E.map((h,v)=>{if(h.component)return(0,pe.jsx)("div",{children:h.component},v);let u={sourceNodeType:t,targetNodeType:h.type,sourceNodeId:e,nodes:l,edges:c},d=Kn(u),x={gateway_limit_reached:r("editor.toolbar.gateway_limit_reached"),start_event_already_exists:r("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:r("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:r("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:r("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:r("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:r("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:r("editor.toolbar.task_limit_reached")},m=d.shouldDisable&&d.reason?x[d.reason]||h.label:h.label||"";return(0,pe.jsxs)(Ae.Tooltip,{children:[(0,pe.jsx)(Ae.TooltipTrigger,{asChild:!0,children:(0,pe.jsx)(Ae.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!d.shouldDisable,disabled:d.shouldDisable,className:d.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:d.shouldDisable?void 0:_=>g({event:_,type:h.type,variant:h.variant}),children:h.icon&&(0,pe.jsx)(h.icon,{size:16})})}),(0,pe.jsx)(Ae.TooltipContent,{color:"black",children:m})]},v)})})};var Ie=require("react/jsx-runtime"),Ea=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ro.useReactFlow)(),{isMultipleSelection:a}=H(),s=i=>{r(e,{label:i})};return(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)("div",{className:k("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden 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,Ie.jsx)(ee,{value:t.label,className:"m-1 text-grey-600",onChange:s})}),(0,Ie.jsx)(ue,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&!a&&o}),(0,Ie.jsx)(ht,{isVisible:!n&&!a&&o,minWidth:so.MIN_WIDTH,minHeight:so.MIN_HEIGHT}),(0,Ie.jsx)(te,{type:"target",position:Ro.Position.Left})]})};var zt=require("@xyflow/react"),ba=require("react");var be=require("react/jsx-runtime"),ya=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,zt.useReactFlow)(),{isMultipleSelection:a}=H(),[s,i]=(0,ba.useState)(!1),l=f=>{r(e,{label:f})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{i(!1)},onDoubleClick:()=>{i(!0)},children:[(0,be.jsx)(ot,{className:k("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(ee,{value:t.label,isEditing:s,onChange:l})})]}),(0,be.jsx)(ue,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&!a&&o}),(0,be.jsx)(te,{type:"source",position:zt.Position.Right}),(0,be.jsx)(te,{type:"target",position:zt.Position.Left})]})};var Ut=require("@xyflow/react"),ha=require("react");var ye=require("react/jsx-runtime"),va=({id:e,data:t,selected:o,dragging:n})=>{let r=ro[t.variant].icon,{updateNodeData:a}=(0,Ut.useReactFlow)(),{isMultipleSelection:s}=H(),[i,l]=(0,ha.useState)(!1),c=p=>{a(e,{label:p})};return(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,ye.jsx)(r,{className:k("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,ye.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ye.jsx)(ee,{value:t.label,isEditing:i,onChange:c})})]}),(0,ye.jsx)(ue,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&!s&&o}),(0,ye.jsx)(te,{type:"target",position:Ut.Position.Left}),(0,ye.jsx)(ko,{type:"source",position:Ut.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var Vo=require("@xyflow/react"),Na=require("react");var ve=require("react/jsx-runtime"),_a=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Vo.useReactFlow)(),{isMultipleSelection:a}=H(),[s,i]=(0,Na.useState)(!1),l=f=>{r(e,{label:f})};return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsxs)("div",{className:"relative",onBlur:()=>{i(!1)},onDoubleClick:()=>{i(!0)},children:[(0,ve.jsx)(to,{className:k("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ve.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ve.jsx)(ee,{value:t.label,isEditing:s,onChange:l})})]}),(0,ve.jsx)(ue,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&!a&&o}),(0,ve.jsx)(te,{type:"source",position:Vo.Position.Right})]})};var Ft=require("@xyflow/react"),Ta=require("lecom-ui");var oe=require("react/jsx-runtime"),xa=({id:e,data:t,selected:o,dragging:n})=>{let{onSubprocessValidationClick:r}=co(),{updateNodeData:a,getNodes:s}=(0,Ft.useReactFlow)(),{isMultipleSelection:i}=H(),{t:l}=(0,Ta.useTranslation)(),c=v=>{let u=v.trim(),d=t.label||"";if(u===d)return;let x=s(),m=u;u||(m=To(x,l("bpmn.task.label.prefix")));let _=xo(m,x);_!==d&&a(e,{label:_})},g=t.variant?oo[t.variant].icon:null,f=t.attribute?no[t.attribute].icon:null,p=t.variant==="SUBPROCESS",y=g&&!p,E=f||p,h=()=>{r==null||r({id:e,type:"sub_process",label:t.label})};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("div",{className:k("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"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,oe.jsx)(ee,{value:t.label,maxLength:60,className:k("m-1",{"py-6":y||E}),onChange:c}),g&&(0,oe.jsx)("div",{className:k("absolute flex items-center p-1",p?"bottom-0":"top-0 left-0"),children:(0,oe.jsx)(g,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500",p&&"cursor-pointer"),onClick:p?h:void 0})}),f&&(0,oe.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,oe.jsx)("div",{className:k("flex items-center w-16 p-1",p?"justify-between":"justify-center"),children:(0,oe.jsx)(f,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,oe.jsx)(ue,{nodeId:e,nodeType:"TASK",isVisible:!n&&!i&&o}),(0,oe.jsx)(ht,{isVisible:!n&&!i&&o,minWidth:ao.MIN_WIDTH,minHeight:ao.MIN_HEIGHT}),(0,oe.jsx)(ko,{type:"source",position:Ft.Position.Right,nodeId:e,nodeType:"TASK"}),(0,oe.jsx)(te,{type:"target",position:Ft.Position.Left})]})};var sn=require("@xyflow/react");var Re=require("react/jsx-runtime"),wa=({id:e,data:t,selected:o,dragging:n})=>{let{isMultipleSelection:r}=H();return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.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,Re.jsx)(ue,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&!r&&o}),(0,Re.jsx)(te,{type:"source",position:sn.Position.Right}),(0,Re.jsx)(te,{type:"target",position:sn.Position.Left})]})};var Mo=require("@xyflow/react"),Ca=require("lodash"),ln=require("react");var fe=require("react/jsx-runtime"),Aa=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:a,getNodes:s}=(0,Mo.useReactFlow)(),{isMultipleSelection:i}=H(),l=s(),c=!r,g=(0,ln.useMemo)(()=>(0,Ca.orderBy)([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),f=c?io.MIN_WIDTH:ae.MIN_WIDTH,p=(0,ln.useMemo)(()=>{if(c&&g.length>1){let E=[...g];return E.pop(),E.reduce((v,u)=>{var d,x;return v+((x=(d=u.measured)==null?void 0:d.height)!=null?x:0)},0)+ae.MIN_HEIGHT}return ae.MIN_HEIGHT},[c,g]),y=E=>{a(e,{label:E})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:k("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,fe.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,fe.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,fe.jsx)(ee,{value:t.label,className:"w-full h-full",onChange:y})})}),(0,fe.jsx)("div",{className:"flex-1"})]}),(0,fe.jsx)(ue,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!n&&!i&&o}),(0,fe.jsx)(ht,{nodeId:e,minWidth:f,minHeight:p,isVisible:!n&&!i&&o}),c&&(0,fe.jsx)(te,{type:"source",position:Mo.Position.Right})]})};var Ia={START_EVENT:_a,END_EVENT:ya,TASK:xa,GATEWAY:va,ANNOTATION:Ea,LANE:Aa,UNSUPPORTED:wa},Sa={SEQUENCE_EDGE:Wn,MESSAGE_EDGE:mr,ANNOTATION_EDGE:Un},ka="#fafafa",La="#bebebe",Pa=1,Da=10,Ra="bottom-left",Va=.5,Ma=4,Oa={x:0,y:0,zoom:.75};var Ga=require("@xyflow/react"),Oo=require("react"),Ba=require("react/jsx-runtime"),ts=e=>({width:e.width,height:e.height,transform:e.transform}),Ha=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:n=[6,6]})=>{let{width:r,height:a,transform:s}=(0,Ga.useStore)(ts),i=(0,Oo.useRef)(null);return(0,Oo.useEffect)(()=>{let l=i.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let g=window.devicePixelRatio;l.width=r*g,l.height=a*g,c.scale(g,g),c.clearRect(0,0,r,a),c.strokeStyle=o,c.setLineDash(n),typeof t=="number"&&(c.moveTo(t*s[2]+s[0],0),c.lineTo(t*s[2]+s[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*s[2]+s[1]),c.lineTo(r,e*s[2]+s[1]),c.stroke())},[r,a,s,e,t,o,n]),(0,Ba.jsx)("canvas",{ref:i,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var Y=require("lecom-ui"),le=require("react/jsx-runtime"),za=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:n})=>{let{t:r}=(0,Y.useTranslation)(),a=!!e,s=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(g=>g.filter(f=>!l.some(p=>p.id===f.id))),c!=null&&c.length&&n(g=>g.filter(f=>!c.some(p=>p.id===f.id))),t(null)},i=()=>{t(null)};return(0,le.jsx)(Y.Dialog,{open:a,onOpenChange:i,children:(0,le.jsxs)(Y.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,le.jsx)(Y.DialogHeader,{children:(0,le.jsx)(Y.DialogTitle,{children:(0,le.jsx)(Y.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:r("editor.modals.delete_elements.title")})})}),(0,le.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,le.jsx)("div",{className:"py-2",children:(0,le.jsx)(Y.Notification,{type:"callout",variant:"warning",content:r("editor.modals.delete_elements.callout")})}),(0,le.jsx)(Y.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:r("editor.modals.delete_elements.content")})]}),(0,le.jsxs)(Y.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,le.jsx)(Y.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:i,children:(0,le.jsx)(Y.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:r("editor.modals.delete_elements.cancel")})}),(0,le.jsx)(Y.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:s,children:r("editor.modals.delete_elements.confirm")})]})]})})};var Ua=require("@xyflow/react"),Se=require("lecom-ui");var ze=require("react/jsx-runtime"),Fa=()=>{let{t:e}=(0,Se.useTranslation)(),{setDraggableNode:t}=ut(),{getNodes:o}=(0,Ua.useReactFlow)(),n=o(),r=go(n),a=[{type:"START_EVENT",icon:to,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:ot,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:At,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:An,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Cn,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:wn,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Qt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Jt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:Tn,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:jt,label:e("bpmn.annotation.variant.default")}],s=(i,l)=>{t({type:l.type,variant:l.variant,attribute:l.attribute}),i.dataTransfer.effectAllowed="move"};return(0,ze.jsx)("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:a.map((i,l)=>{let c=r&&i.type==="START_EVENT",g=c?e("editor.toolbar.start_event_already_exists"):i.label;return(0,ze.jsxs)(Se.Tooltip,{children:[(0,ze.jsx)(Se.TooltipTrigger,{asChild:!0,children:(0,ze.jsx)(Se.Button,{className:`[&>svg]:size-6 ${c?"opacity-50 cursor-not-allowed":""}`,size:"small",variant:"ghost",color:"grey",draggable:!c,disabled:c,iconButton:!0,onDragStart:c?void 0:f=>s(f,i),children:(0,ze.jsx)(i.icon,{})},l)}),(0,ze.jsx)(Se.TooltipContent,{color:"black",side:"right",children:g})]},l)})})};var Go=require("lecom-ui"),Nt=require("lucide-react"),Ho=require("react"),ne=require("react/jsx-runtime"),Wa=({validationResult:e,onClose:t})=>{let{t:o}=(0,Go.useTranslation)(),[n,r]=(0,Ho.useState)(!1);if((0,Ho.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:a,errors:s}=e;return(0,ne.jsxs)("div",{className:k("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,ne.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,ne.jsx)("div",{className:"flex-shrink-0",children:a?(0,ne.jsx)(Nt.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,ne.jsx)(Nt.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,ne.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,ne.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,ne.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,ne.jsx)(Go.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,ne.jsx)(Nt.XIcon,{})})]}),(0,ne.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,ne.jsx)("p",{children:o("validation.success.message")}):(0,ne.jsx)("div",{className:"list-disc list-inside",children:s.map(i=>(0,ne.jsx)("li",{className:"mb-1",children:i.message},i.id))})})]})};var Z=require("react/jsx-runtime"),os=[],Ka=(0,re.forwardRef)(({mode:e="edit"},t)=>{let o=(0,re.useRef)(!1),[n,r,a]=(0,J.useNodesState)([]),[s,i,l]=(0,J.useEdgesState)([]),[c,g]=(0,re.useState)(null),{isMoveTool:f,isHandTool:p,isReadOnly:y,setIsReadOnly:E,setIsMultipleSelection:h,isMinimapOpen:v}=H(),{validationResult:u,handleValidationComplete:d,clearValidation:x,isAutoValidationEnabled:m,validateDiagram:_}=rr(),{getNode:I,getNodes:b,getEdges:N}=(0,J.useReactFlow)(),S=Ir(r,i);(0,re.useImperativeHandle)(t,()=>S);let{onNodeDrag:P,onDrop:C,onDragOver:A,onNodeDragStop:L}=Er({nodes:n,setNodes:r,setEdges:i}),{isValidConnection:U,onConnect:K}=$n({setEdges:i});cr();let{createDiagram:X}=wr(),{undo:Qe,redo:Ue,saveHistory:et,canUndo:Qa,canRedo:ei}=Pr(),{helperLineHorizontal:ti,helperLineVertical:oi}=hr();Cr({LIA_CREATE_DIAGRAM:X,CLEAR_DIAGRAM:()=>{r([]),i([])}}),(0,re.useEffect)(()=>{E(e==="readonly")},[e,E]),(0,re.useEffect)(()=>{if(n.length===0&&s.length===0&&e!=="readonly"){let _t=(0,Bo.v7)(),mi={id:_t,type:"START_EVENT",position:{x:200,y:300},data:{}},fn=(0,Bo.v7)(),gi={id:fn,type:"TASK",position:{x:400,y:270},data:{label:dn.i18n.t("editor.toolbar.initial_task")}},fi=(0,Bo.v7)(),Ei=w(T({},xe),{id:fi,source:_t,target:fn});r([mi,gi]),i([Ei])}},[n.length,s.length,e,r,i]);let ni=()=>{x()},ri=(0,re.useCallback)(({nodes:Q,edges:q})=>{let tt=Q.length+q.length>1;h(tt)},[h]);(0,J.useOnSelectionChange)({onChange:ri});let ai=Q=>{let q=I(Q.id);if(q!=null&&q.parentId&&(q==null?void 0:q.type)==="LANE"){let tt=Ye(q.parentId,n.filter(_t=>_t.id!==q.id&&_t.type==="LANE"));r(Pe(tt))}},ii=Q=>{Q.forEach(q=>{switch(q.type){case"remove":ai(q);break}})},si=(0,re.useCallback)(()=>{if(!m){o.current=!1;return}let Q=b(),q=N(),tt=_({nodes:Q,edges:q});d(tt),o.current=!1},[m,b,N,_,d]),mn=(0,Ya.useDebouncedCallback)(si,300),gn=(0,re.useCallback)(()=>{m&&!o.current&&(o.current=!0,mn())},[m,mn]),li=Q=>{a(Q),et(Q),gn(),ii(Q)},di=Q=>{l(Q),et(Q),gn()},ci=()=>{et("forceSave")},pi=async({nodes:Q,edges:q})=>(g({nodes:Q,edges:q}),!1),ui={nodes:n,edges:s};return(0,Z.jsxs)("div",{className:"w-full h-full",children:[!y&&(0,Z.jsx)(Fa,{}),(0,Z.jsx)(Dr,{}),(0,Z.jsxs)(J.ReactFlow,{edges:s,nodes:n,nodeTypes:Ia,edgeTypes:Sa,minZoom:Va,maxZoom:Ma,panOnDrag:p||y?!0:os,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!y&&f,nodesConnectable:!y&&f,nodesDraggable:!y&&f,isValidConnection:U,connectionLineComponent:gr,onConnect:K,onDrop:C,onDropCapture:ci,onDragOver:A,onNodesChange:li,onEdgesChange:di,onNodeDrag:P,onNodeDragStop:L,onBeforeDelete:pi,selectionMode:J.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:Oa,connectOnClick:!1,children:[v&&(0,Z.jsx)(J.MiniMap,{pannable:!0,zoomable:!0,position:Ra,className:"shadow-md rounded-md"}),(0,Z.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!y&&(0,Z.jsx)(sa,{canUndo:Qa,canRedo:ei,undo:Qe,redo:Ue}),(0,Z.jsx)(ia,{nodes:n,isReadOnly:y,diagram:ui,onValidationComplete:d,onValidateDiagram:_}),(0,Z.jsx)(da,{})]}),(0,Z.jsx)(Ha,{horizontal:ti,vertical:oi}),(0,Z.jsx)(J.Background,{gap:Da,size:Pa,color:La,bgColor:ka}),u&&(0,Z.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,Z.jsx)(Wa,{validationResult:u,onClose:ni})})]}),(0,Z.jsx)(za,{pendingDelete:c,setPendingDelete:g,setNodes:r,setEdges:i})]})});Ka.displayName="Editor";var ns=({mode:e,locale:t="pt_BR",onConfigureElement:o,onSubprocessValidationClick:n,selectorRef:r})=>((0,re.useEffect)(()=>{t&&dn.i18n.changeLanguage(t)},[t]),(0,Z.jsx)(J.ReactFlowProvider,{children:(0,Z.jsx)(Gn,{value:{onConfigureElement:o,onSubprocessValidationClick:n},children:(0,Z.jsx)(Ka,{mode:e,ref:r})})})),cn=ns;var pn=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 zo=require("lecom-ui");var $a={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event"}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"},label:{prefix:"Activity"}},lane:{variant:{default:"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 Za={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final"}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"},label:{prefix:"Actividad"}},lane:{variant:{default:"Lane"}},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 Xa={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final"}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"},label:{prefix:"Atividade"}},lane:{variant:{default:"Lane"}},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 qa={pt_BR:Xa,en_US:$a,es_ES:Za};var ja,Ja,rs=(Ja=(ja=pn("LecomUserLanguage"))!=null?ja:pn("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Ja:zo.Translations.PT_BR;(0,zo.initializeI18n)({lng:rs,resources:qa});var un=require("react/jsx-runtime"),as=e=>(0,un.jsx)(hn,{children:(0,un.jsx)(cn,T({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,RoutingVariant,useSelectionUtils});