lecom-modeler 0.1.4 → 0.1.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 +5 -5
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -6
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Va=Object.create;var ht=Object.defineProperty,Oa=Object.defineProperties,Ga=Object.getOwnPropertyDescriptor,Ha=Object.getOwnPropertyDescriptors,Ba=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,za=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable;var Zo=(e,t,o)=>t in e?ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))_o.call(t,o)&&Zo(e,o,t[o]);if(Ot)for(var o of Ot(t))$o.call(t,o)&&Zo(e,o,t[o]);return e},y=(e,t)=>Oa(e,Ha(t));var et=(e,t)=>{var o={};for(var r in e)_o.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ot)for(var r of Ot(e))t.indexOf(r)<0&&$o.call(e,r)&&(o[r]=e[r]);return o};var Fa=(e,t)=>{for(var o in t)ht(e,o,{get:t[o],enumerable:!0})},Xo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ba(t))!_o.call(e,n)&&n!==o&&ht(e,n,{get:()=>t[n],enumerable:!(r=Ga(t,n))||r.enumerable});return e};var Ua=(e,t,o)=>(o=e!=null?Va(za(e)):{},Xo(t||!e||!e.__esModule?ht(o,"default",{value:e,enumerable:!0}):o,e)),Wa=e=>Xo(ht({},"__esModule",{value:!0}),e);var _i={};Fa(_i,{ActivityVariant:()=>zt,ElementType:()=>Bt,GatewayVariant:()=>Ce,Modeler:()=>xi,RoutingVariant:()=>Ft});module.exports=Wa(_i);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function qo({children:e}){return(0,Ht.jsxs)(Gt.TooltipProvider,{children:[(0,Ht.jsx)(Gt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var W=require("@xyflow/react"),Ea=require("lecom-ui"),be=require("react"),ba=require("use-debounce");var Bt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(Bt||{}),zt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(zt||{}),Ft=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Ft||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Ut=({size:e=24,className:t})=>(0,Ue.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Ue.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Ue.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Ue.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Ue.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var wo=require("react/jsx-runtime"),tt=({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:"#f87171",stroke:"#ef4444",strokeWidth:3,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 Pe=require("react/jsx-runtime"),Wt=({size:e=24,className:t})=>(0,Pe.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,Pe.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,Pe.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var ot=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,ot.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,ot.jsx)("path",{d:"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,ot.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),Yt=({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:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),jo=({size:e=24,className:t})=>(0,at.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,at.jsxs)("g",{children:[(0,at.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,at.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Jo=require("clsx"),Qo=require("tailwind-merge");function C(...e){return(0,Qo.twMerge)((0,Jo.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),er=({size:e=24,className:t})=>(0,Nt.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:C("stroke-2",t),children:[(0,Nt.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,Nt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Kt=require("react/jsx-runtime"),tr=({size:e=24,className:t})=>(0,Kt.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Kt.jsx)("g",{children:(0,Kt.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 Co=require("react/jsx-runtime"),Zt=({size:e=24,className:t})=>(0,Co.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,Co.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 Io=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,Io.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:C("stroke-2",t),children:(0,Io.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var it=require("react/jsx-runtime"),or=({size:e=24,className:t})=>(0,it.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,it.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"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,it.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var De=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,De.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,De.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,De.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,De.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,De.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,De.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),nr=({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 R=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(R||{});var $t={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Xt={LOOP:{icon:st.RotateCcw}},Ce=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ce||{}),qt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Yt},COMPLEX:{icon:Wt}};var Ao=Ua(require("@dagrejs/dagre"),1),lr=require("@xyflow/react"),dr=require("lodash");var Ya={MIN_WIDTH:36,MIN_HEIGHT:36},Ka={MIN_WIDTH:36,MIN_HEIGHT:36},Za={MIN_WIDTH:56,MIN_HEIGHT:56},jt={MIN_WIDTH:176,MIN_HEIGHT:96},Jt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Qt={MIN_WIDTH:176,MIN_HEIGHT:64},$a={MIN_WIDTH:128,MIN_HEIGHT:64},Y={START_EVENT:Ya,END_EVENT:Ka,GATEWAY:Za,TASK:jt,LANE:oe,ANNOTATION:Qt,UNSUPPORTED:$a};var ar=require("lodash");var Ie=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},Ae=e=>(0,ar.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),ir=(e,t)=>{let{x:o,y:r}=Ie(e),{x:n,y:a}=Ie(t);return{x:o-n,y:r-a}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(R)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),Xa=(e,t)=>{let{x:o,y:r}=Ie(e),{x:n,y:a}=Ie(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},qa=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ie(e),{x:i,y:s,w:l,h:d}=Ie(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&qa(e,n)){let a=Xa(e,n);a<r&&(r=a,o=n)}return o},sr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var cr=(e=[],t=[],o="LR")=>{let r=new Ao.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),Ao.default.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(N({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var u,b;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let a=(0,dr.orderBy)(n,["position.y"]),i=Math.max((b=(u=r.measured)==null?void 0:u.width)!=null?b:0,Jt.MIN_WIDTH),s=sr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),d=0,f=0;a.forEach(E=>{var h,c,p,m;o=o.map(x=>x.id===E.id?y(N({},x),{width:l-oe.HEADER_WIDTH,measured:y(N({},x.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:d}}):x),d+=(c=(h=E.measured)==null?void 0:h.height)!=null?c:0,f+=(m=(p=E.measured)==null?void 0:p.height)!=null?m:0}),o=o.map(E=>E.id===e?y(N({},E),{height:f,width:l,measured:y(N({},E.measured),{height:f,width:l})}):E);let g=o.find(E=>E.id===e);return g!=null&&g.parentId&&(o=Ye(g.parentId,o)),o},pr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ja=50,mr=(e,t=ja)=>{let o=(0,lr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var ur=require("zustand"),$=(0,ur.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 wt=require("@xyflow/react");var Ne=require("@xyflow/react");var ke=require("@xyflow/react"),he=require("lecom-ui"),br=require("lucide-react");var eo=require("react"),fr=(0,eo.createContext)(null),gr=fr.Provider,Er=()=>{let e=(0,eo.useContext)(fr);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),xt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,he.useTranslation)(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=(0,ke.useReactFlow)(),{onConfigureElement:s}=Er(),l=h=>{let c=a(),p=i(),m=(0,ke.getIncomers)(h,c,p),x=(0,ke.getOutgoers)(h,c,p),_=m.some(L=>L.type==="START_EVENT"),A=x.some(L=>L.type==="END_EVENT");return _?"start":A?"end":"between"},d=h=>{var L,v,T;let c=a(),p=i(),m=r(h.source),x=r(h.target);if(!m||!x)return"simple";if((0,ke.getOutgoers)(m,c,p).some(k=>k.type==="END_EVENT"))return"final";if(m.type==="GATEWAY")switch((L=m.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(m.type==="TASK"){let k=(v=m.data)==null?void 0:v.variant,I=(T=m.data)==null?void 0:T.attribute;return k==="SCRIPT"?"script":I==="LOOP"?"loop":"simple"}return"simple"},f=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="COMPLEX")return;let p=a(),m=i(),x=(0,ke.getIncomers)(c,p,m),_=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(_=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),_&&A)return"script_loop";if(_)return"script";if(A)return"loop"},g=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let p=a(),m=i(),x=(0,ke.getIncomers)(c,p,m),_=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(_=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),_)return"script";if(A)return"loop"},u=()=>{var c,p,m,x,_;let h=r(e);h&&(h.type==="GATEWAY"?(s==null||s({id:h.id,type:"gateway",variant:((c=h.data)==null?void 0:c.variant)||"EXCLUSIVE",label:(p=h.data)==null?void 0:p.label}),console.log({id:h.id,type:"gateway",variant:((m=h.data)==null?void 0:m.variant)||"EXCLUSIVE",label:(x=h.data)==null?void 0:x.label})):s==null||s({id:h.id,type:"activity",variant:l(h),label:(_=h.data)==null?void 0:_.label}))},b=()=>{let h=n(e);if(h){let c=d(h),p;c==="complex"?p=f(h):c==="exclusive"&&(p=g(h)),s==null||s({id:h.id,type:"routing",variant:c,subVariant:p})}};return(0,Ke.jsxs)(he.Tooltip,{children:[(0,Ke.jsx)(he.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(he.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":u();break;case"edge":b();break}},children:(0,Ke.jsx)(br.PencilIcon,{size:16})})}),(0,Ke.jsx)(he.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var hr=require("@xyflow/react"),ve=require("lecom-ui"),vr=require("lucide-react"),Ze=require("react/jsx-runtime"),oo=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{deleteElements:r}=(0,hr.useReactFlow)();return(0,Ze.jsxs)(ve.Tooltip,{children:[(0,Ze.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(ve.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(vr.TrashIcon,{size:16})})}),(0,Ze.jsx)(ve.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var _t=require("react/jsx-runtime"),dt=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let a=[{component:(0,_t.jsx)(oo,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:(0,_t.jsx)(xt,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,_t.jsx)("div",y(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>(0,_t.jsx)("div",{children:l.component},d))}))};var $e=require("react/jsx-runtime"),no={type:"ANNOTATION_EDGE",zIndex:2e3},Nr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=(0,Ne.useNodes)(),{zoom:f}=(0,Ne.useViewport)(),g=d.find(m=>m.id===t),u=d.find(m=>m.id===o),[b,E,h]=(0,Ne.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),c=s||(g==null?void 0:g.selected)||(u==null?void 0:u.selected),p=1/f;return(0,$e.jsxs)("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":c}),children:[(0,$e.jsx)(Ne.BaseEdge,{id:e,path:b,strokeDasharray:4,className:C("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)]":c&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(Ne.EdgeLabelRenderer,{children:(0,$e.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${h}px)`},children:s&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};var re=require("@xyflow/react"),yr=require("react");var Xe=require("react");var ko=require("react/jsx-runtime"),Q=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=(0,Xe.useRef)(null),[l,d]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{d(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let b=document.createRange();b.selectNodeContents(s.current),b.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(b))}},[l]);let f=b=>{b.stopPropagation(),d(!0)},g=b=>{let E=b.currentTarget.innerText;t&&E.length>=t&&b.preventDefault()},u=b=>{d(!1),n==null||n(),o==null||o(b.currentTarget.innerText)};return(0,ko.jsx)("div",{className:C("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:i,onDoubleClick:f,children:(0,ko.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:u,children:e})})};var Me=require("react/jsx-runtime"),Re={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:re.MarkerType.ArrowClosed},markerEnd:{type:re.MarkerType.Arrow},data:{label:""}},Tr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=(0,re.useNodes)(),{zoom:u}=(0,re.useViewport)(),{updateEdgeData:b}=(0,re.useReactFlow)(),[E,h]=(0,yr.useState)(!1),c=g.find(w=>w.id===t),p=g.find(w=>w.id===o),[m,x,_]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},I=()=>{h(!1)},P=w=>{b(e,{label:w.trim()})};return(0,Me.jsxs)("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:I,onDoubleClick:k,children:[(0,Me.jsx)(re.BaseEdge,{id:e,path:m,markerEnd:`url(#${L})`,className:C("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Me.jsx)(re.EdgeLabelRenderer,{children:(0,Me.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${x}px, ${_}px)`},children:[f&&(0,Me.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),v&&(0,Me.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:P})]})})]})};var xr=({setEdges:e})=>{let{getNode:t}=(0,wt.useReactFlow)();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?(0,wt.addEdge)(N(N({},n),no),a):(0,wt.addEdge)(N(N({},n),Re),a)})}}};var Lo=require("react"),Pr=require("lecom-ui"),Dr=require("@xyflow/react");var Ct=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ve=(e=[])=>e.filter(t=>t.type==="TASK")||[],_r=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),wr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ao=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Cr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),pe=(e,t=[])=>t.filter(o=>o.source===e),It=(e,t=[])=>t.filter(o=>o.target===e),Ir=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Ar=(e,t)=>{let o=pe(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},kr=e=>e?/\w/g.test(e.trim()):!1,M=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},ye=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Lr=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.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 At=[{id:"start_event_not_found",validate:e=>{let t=Ct(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=Ct(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 r=pe(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return M({isValid:!1,nodeIds:[...new Set(a)]})}return M({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ve(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length<=2);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=ye(t,r=>!!r.label&&r.label.trim()!=="");return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ve(e.nodes),r=ye(o,n=>!n.label||n.label.length<=60);return M({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return M({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ao(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Ct(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],r=[];for(let n of t){let a=It(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=pe(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return M({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Cr(e.nodes),o=ye(t,n=>pe(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>pe(n,e.edges).map(a=>a.id));return M({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Ve(e.nodes),o=ye(t,r=>!r.label||kr(r.label));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return M({isValid:!0});let t=qe(e.nodes)[0];if(!t)return M({isValid:!0});let o=It(t.id,e.edges);if(!o.length)return M({isValid:!0});let n=Ve(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=ye(n,l=>!Ir(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=Ve(e.nodes),o=qe(e.nodes)[0];if(!o)return M({isValid:!0});let r=t.filter(l=>{let d=It(l.id,e.edges),f=pe(l.id,e.edges),g=d.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.source))==null?void 0:E.type)==="START_EVENT"}),u=f.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.target))==null?void 0:E.type)==="END_EVENT"});return g&&u}),n=It(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return M(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ao(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ao(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length>=1);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Ct(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=_r(e.nodes),o=ye(t,r=>!Ar(r.id,e));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=wr(e.nodes),o=ye(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return M({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Sr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of At){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Mr=()=>{let{t:e}=(0,Pr.useTranslation)(),[t,o]=(0,Lo.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Dr.useReactFlow)(),[s,l]=(0,Lo.useState)(!1);return{validationResult:t,validateDiagram:u=>{let b=Lr(u.nodes,u.edges),E=Sr(b),h=E.errors.map(c=>y(N({},c),{message:e(`validation.errors.${c.id}`)}));return s||l(!0),{isValid:E.isValid,errors:h}},handleValidationComplete:u=>{if(o(u),!u)return;let b=[],E=[];u.errors.forEach(v=>{v.nodeIds&&v.nodeIds.length>0&&v.nodeIds.forEach(T=>b.push(T)),v.edgeIds&&v.edgeIds.length>0&&v.edgeIds.forEach(T=>E.push(T))});let h=[...new Set(b)];r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})}))),n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})})));let c=a(),p=i(),m=new Set(h),x=new Set;u.errors.forEach(v=>{var I,P;let T=At.find(w=>w.id===v.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((I=v.edgeIds)==null||I.forEach(w=>x.add(w)),(P=v.nodeIds)==null||P.forEach(w=>{p.forEach(j=>{(j.source===w||j.target===w)&&x.add(j.id)})}))});let _=new Set,A=new Set,L=new Set;c.forEach(v=>{v.type==="START_EVENT"?_.add(v.id):v.type==="END_EVENT"&&A.add(v.id)}),p.forEach(v=>{_.has(v.source)&&L.add(v.target),A.has(v.target)&&L.add(v.source)}),L.forEach(v=>{var T,k;if(m.has(v)){let I=(T=u.errors.find(w=>{var j;return(j=w.nodeIds)==null?void 0:j.includes(v)}))==null?void 0:T.id;((k=At.find(w=>w.id===I))==null?void 0:k.highlightRelatedEdges)!==!1&&p.forEach(w=>{w.source===v&&A.has(w.target)&&(m.add(w.target),x.add(w.id)),w.target===v&&_.has(w.source)&&(m.add(w.source),x.add(w.id))})}}),m.size>0&&r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:m.has(T.id)})}))),x.size>0&&n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:x.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})}))),n(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Vr=require("@xyflow/react"),Or=require("react"),So=require("uuid");var Qa=15,Rr="bpmn:selection",Gr=({offset:e=Qa}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Vr.useReactFlow)();(0,Or.useEffect)(()=>{let a=s=>{var b;s.preventDefault();let l=t(),d=r(),f=l.filter(E=>E.selected);if(!f.length)return;let g=d.filter(E=>f.some(h=>h.id===E.source)&&f.some(h=>h.id===E.target)),u={nodes:f,edges:g};(b=s.clipboardData)==null||b.setData(Rr,JSON.stringify(u))},i=s=>{var u,b;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Rr))||"{}");if(!((b=l.nodes)!=null&&b.length))return;let d=new Map,f=l.nodes.map(E=>{let h=(0,So.v7)();return d.set(E.id,h),y(N({},E),{id:h,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),g=l.edges.map(E=>y(N({},E),{id:(0,So.v7)(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(h=>y(N({},h),{selected:!1})),...f]),n(E=>[...E.map(h=>y(N({},h),{selected:!1})),...g])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};var io=require("@xyflow/react"),Po=require("uuid");var Hr=require("zustand"),ct=(0,Hr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Br=require("react");var Oe=require("react/jsx-runtime"),Il={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},zr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=(0,se.useNodes)(),{zoom:u}=(0,se.useViewport)(),{updateEdgeData:b}=(0,se.useReactFlow)(),[E,h]=(0,Br.useState)(!1),c=g.find(w=>w.id===t),p=g.find(w=>w.id===o),[m,x,_]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},I=()=>{h(!1)},P=w=>{b(e,{label:w.trim()})};return(0,Oe.jsxs)("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:I,onDoubleClick:k,children:[(0,Oe.jsx)(se.BaseEdge,{id:e,path:m,markerEnd:`url(#${L})`,strokeDasharray:4,className:C("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Oe.jsx)(se.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(${x}px, ${_}px)`},children:[f&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),v&&(0,Oe.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:P})]})})]})};var kt=require("react/jsx-runtime"),Fr=({fromX:e,fromY:t,toX:o,toY:r})=>(0,kt.jsxs)("g",{children:[(0,kt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),(0,kt.jsx)("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Ur=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,io.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=ct(),{getInternalNode:i,screenToFlowPosition:s}=(0,io.useReactFlow)(),l=c=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(m=>m.map(x=>y(N({},x),{className:x.id===c?p:""})))},d=()=>{let{nodeLookup:c}=r.getState();return Array.from(c.values())},f=c=>{let p=i(c.id),m=d();if(c.type==="LANE"){if(lt({parentId:c.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=m.filter(P=>P.id!==c.id&&P.type==="LANE"&&!P.parentId),k=Tt(p,T);if(!k){l();return}if(lt({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let _=m.filter(v=>v.id!==c.id&&v.type==="LANE"),A=Tt(p,_);if(!A){l();return}if(lt({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},g=c=>{c.preventDefault(),c.dataTransfer.dropEffect="move"},u=(c,p)=>{c.preventDefault(),f(p)},b=(c,p,m)=>{var T,k;let x=I=>I.map(P=>y(N({},P),{className:void 0}));if(c.parentId===p.id){let I=Ye(p.id,m);t(Ae(x(I)));return}if(c.type==="LANE"){if(lt({parentId:p.id,nodes:m,excludeTypes:["LANE"]}))return;let w=m.filter(Z=>Z.parentId===p.id).reduce((Z,Qe)=>{var ze,Fe;return Z+((Fe=(ze=Qe.measured)==null?void 0:ze.height)!=null?Fe:0)},0),j={x:oe.HEADER_WIDTH,y:w},ie=m.map(Z=>Z.id===c.id?y(N({},Z),{parentId:p.id,position:j,className:void 0}):y(N({},Z),{className:void 0}));ie=Ye(p.id,ie),t(Ae(ie));return}if(lt({parentId:p.id,nodes:m,includeTypes:["LANE"]})){let I;if(c.parentId){let w=i(c.parentId),{x:j,y:ie}=Ie(w);I={x:j+((T=c.position.x)!=null?T:0),y:ie+((k=c.position.y)!=null?k:0)}}let P=m.map(w=>w.id===c.id?y(N({},w),{position:I!=null?I:w.position,parentId:void 0,className:void 0}):y(N({},w),{className:void 0}));t(Ae(P));return}let L=ir(c,p),v=m.map(I=>I.id===c.id?y(N({},I),{parentId:p.id,position:L,className:void 0}):y(N({},I),{className:void 0}));t(Ae(v))};return{onDragOver:g,onDrop:c=>{if(c.preventDefault(),!(n!=null&&n.type))return;let p=s({x:c.clientX,y:c.clientY}),m={width:Y[n.type].MIN_WIDTH,height:Y[n.type].MIN_HEIGHT},x={id:(0,Po.v7)(),type:n.type,position:p,measured:m,data:{label:"",variant:n.variant,attribute:n.attribute}},_=y(N({},x),{internals:{positionAbsolute:p}}),A=d(),L=n.type==="LANE",v=A.filter(I=>L?I.type==="LANE"&&!I.parentId:I.type==="LANE"),T=Tt(_,v);T?b(_,T,[...A,_]):t(I=>{let P=I.concat(x);return Ae(P)});let k=c.dataTransfer.getData("sourceId");if(k){let I={id:(0,Po.v7)(),source:k,target:x.id};if(n.type==="ANNOTATION"){o(P=>P.concat(N(N({},I),no)));return}o(P=>P.concat(N(N({},I),Re)))}a(null)},onNodeDrag:u,onNodeDragStop:async(c,p)=>{var T,k;let{nodeLookup:m}=r.getState(),x=i(p.id),_=Array.from(m.values()),A=p.type==="LANE",L=_.filter(I=>I.id!==p.id&&(A?I.type==="LANE"&&!I.parentId:I.type==="LANE")),v=Tt(x,L);if(v){b(x,v,_);return}if(p.parentId){let I=i(p.parentId),{x:P,y:w}=Ie(I),j={x:P+((T=p.position.x)!=null?T:0),y:w+((k=p.position.y)!=null?k:0)},ie=e.map(Z=>Z.id===p.id?y(N({},Z),{position:j,parentId:void 0}):Z);ie=Ye(p.parentId,ie),t(Ae(ie))}}}};var Yr=require("@xyflow/react"),Lt=require("react");function Wr(e,t,o=5){var l,d,f,g,u,b,E,h;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(c=>c.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((g=(f=n.measured)==null?void 0:f.height)!=null?g:0),width:(b=(u=n.measured)==null?void 0:u.width)!=null?b:0,height:(h=(E=n.measured)==null?void 0:E.height)!=null?h:0},i=o,s=o;return t.filter(c=>c.id!==n.id).reduce((c,p)=>{var P,w,j,ie,Z,Qe,ze,Fe;let m={left:p.position.x,right:p.position.x+((w=(P=p.measured)==null?void 0:P.width)!=null?w:0),top:p.position.y,bottom:p.position.y+((ie=(j=p.measured)==null?void 0:j.height)!=null?ie:0),width:(Qe=(Z=p.measured)==null?void 0:Z.width)!=null?Qe:0,height:(Fe=(ze=p.measured)==null?void 0:ze.height)!=null?Fe:0},x=Math.abs(a.left-m.left);x<s&&(c.snapPosition.x=m.left,c.vertical=m.left,s=x);let _=Math.abs(a.right-m.right);_<s&&(c.snapPosition.x=m.right-a.width,c.vertical=m.right,s=_);let A=Math.abs(a.left-m.right);A<s&&(c.snapPosition.x=m.right,c.vertical=m.right,s=A);let L=Math.abs(a.right-m.left);L<s&&(c.snapPosition.x=m.left-a.width,c.vertical=m.left,s=L);let v=Math.abs(a.top-m.top);v<i&&(c.snapPosition.y=m.top,c.horizontal=m.top,i=v);let T=Math.abs(a.bottom-m.top);T<i&&(c.snapPosition.y=m.top-a.height,c.horizontal=m.top,i=T);let k=Math.abs(a.bottom-m.bottom);k<i&&(c.snapPosition.y=m.bottom-a.height,c.horizontal=m.bottom,i=k);let I=Math.abs(a.top-m.bottom);return I<i&&(c.snapPosition.y=m.bottom,c.horizontal=m.bottom,i=I),c},r)}var Kr=()=>{let[e,t]=(0,Lt.useState)(void 0),[o,r]=(0,Lt.useState)(void 0),n=(0,Lt.useCallback)((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Wr(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return(0,Yr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var jr=require("@xyflow/react"),Do=require("uuid");var $r={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Xr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Zr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},ei=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
-
`),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Zr(a[0],o),s=Zr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},qr=e=>{let{components:t,connections:o}=ei(e);return{nodes:t,edges:o}};var Jr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,jr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=qr(n),s=[],l=new Map;for(let[u,b]of Object.entries(a)){let E=(0,Do.v7)(),
|
|
1
|
+
"use strict";var Va=Object.create;var ht=Object.defineProperty,Oa=Object.defineProperties,Ga=Object.getOwnPropertyDescriptor,Ha=Object.getOwnPropertyDescriptors,Ba=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,za=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable;var Zo=(e,t,o)=>t in e?ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))_o.call(t,o)&&Zo(e,o,t[o]);if(Ot)for(var o of Ot(t))$o.call(t,o)&&Zo(e,o,t[o]);return e},_=(e,t)=>Oa(e,Ha(t));var et=(e,t)=>{var o={};for(var r in e)_o.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ot)for(var r of Ot(e))t.indexOf(r)<0&&$o.call(e,r)&&(o[r]=e[r]);return o};var Fa=(e,t)=>{for(var o in t)ht(e,o,{get:t[o],enumerable:!0})},Xo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ba(t))!_o.call(e,n)&&n!==o&&ht(e,n,{get:()=>t[n],enumerable:!(r=Ga(t,n))||r.enumerable});return e};var Ua=(e,t,o)=>(o=e!=null?Va(za(e)):{},Xo(t||!e||!e.__esModule?ht(o,"default",{value:e,enumerable:!0}):o,e)),Wa=e=>Xo(ht({},"__esModule",{value:!0}),e);var _i={};Fa(_i,{ActivityVariant:()=>zt,ElementType:()=>Bt,GatewayVariant:()=>Ie,Modeler:()=>xi,RoutingVariant:()=>Ft});module.exports=Wa(_i);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function qo({children:e}){return(0,Ht.jsxs)(Gt.TooltipProvider,{children:[(0,Ht.jsx)(Gt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var W=require("@xyflow/react"),Ea=require("lecom-ui"),be=require("react"),ba=require("use-debounce");var Bt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(Bt||{}),zt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(zt||{}),Ft=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Ft||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Ut=({size:e=24,className:t})=>(0,Ue.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Ue.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Ue.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Ue.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Ue.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var wo=require("react/jsx-runtime"),tt=({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:"#f87171",stroke:"#ef4444",strokeWidth:3,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 Pe=require("react/jsx-runtime"),Wt=({size:e=24,className:t})=>(0,Pe.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,Pe.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,Pe.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var ot=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,ot.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,ot.jsx)("path",{d:"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,ot.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),Yt=({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:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),jo=({size:e=24,className:t})=>(0,at.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,at.jsxs)("g",{children:[(0,at.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,at.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Jo=require("clsx"),Qo=require("tailwind-merge");function A(...e){return(0,Qo.twMerge)((0,Jo.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),er=({size:e=24,className:t})=>(0,Nt.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:A("stroke-2",t),children:[(0,Nt.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,Nt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Kt=require("react/jsx-runtime"),tr=({size:e=24,className:t})=>(0,Kt.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Kt.jsx)("g",{children:(0,Kt.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 Co=require("react/jsx-runtime"),Zt=({size:e=24,className:t})=>(0,Co.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,Co.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 Io=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,Io.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:A("stroke-2",t),children:(0,Io.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var it=require("react/jsx-runtime"),or=({size:e=24,className:t})=>(0,it.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,it.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"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,it.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var De=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,De.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,De.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,De.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,De.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,De.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,De.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),nr=({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 M=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(M||{});var $t={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Xt={LOOP:{icon:st.RotateCcw}},Ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ie||{}),qt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Yt},COMPLEX:{icon:Wt}};var Ao=Ua(require("@dagrejs/dagre"),1),lr=require("@xyflow/react"),dr=require("lodash");var Ya={MIN_WIDTH:36,MIN_HEIGHT:36},Ka={MIN_WIDTH:36,MIN_HEIGHT:36},Za={MIN_WIDTH:56,MIN_HEIGHT:56},jt={MIN_WIDTH:176,MIN_HEIGHT:96},Jt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Qt={MIN_WIDTH:176,MIN_HEIGHT:64},$a={MIN_WIDTH:128,MIN_HEIGHT:64},Y={START_EVENT:Ya,END_EVENT:Ka,GATEWAY:Za,TASK:jt,LANE:oe,ANNOTATION:Qt,UNSUPPORTED:$a};var ar=require("lodash");var Ae=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ke=e=>(0,ar.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),ir=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t);return{x:o-n,y:r-a}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(M)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),Xa=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},qa=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ae(e),{x:i,y:s,w:l,h:d}=Ae(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&qa(e,n)){let a=Xa(e,n);a<r&&(r=a,o=n)}return o},sr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var cr=(e=[],t=[],o="LR")=>{let r=new Ao.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),Ao.default.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return _(v({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var u,b;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let a=(0,dr.orderBy)(n,["position.y"]),i=Math.max((b=(u=r.measured)==null?void 0:u.width)!=null?b:0,Jt.MIN_WIDTH),s=sr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),d=0,f=0;a.forEach(E=>{var y,c,p,m;o=o.map(T=>T.id===E.id?_(v({},T),{width:l-oe.HEADER_WIDTH,measured:_(v({},T.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:d}}):T),d+=(c=(y=E.measured)==null?void 0:y.height)!=null?c:0,f+=(m=(p=E.measured)==null?void 0:p.height)!=null?m:0}),o=o.map(E=>E.id===e?_(v({},E),{height:f,width:l,measured:_(v({},E.measured),{height:f,width:l})}):E);let g=o.find(E=>E.id===e);return g!=null&&g.parentId&&(o=Ye(g.parentId,o)),o},pr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ja=50,mr=(e,t=ja)=>{let o=(0,lr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var ur=require("zustand"),$=(0,ur.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 wt=require("@xyflow/react");var ye=require("@xyflow/react");var he=require("@xyflow/react"),ve=require("lecom-ui"),br=require("lucide-react");var eo=require("react"),fr=(0,eo.createContext)(null),gr=fr.Provider,Er=()=>{let e=(0,eo.useContext)(fr);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),xt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=(0,he.useReactFlow)(),{onConfigureElement:s}=Er(),l=c=>{let p=a(),m=i(),T=(0,he.getIncomers)(c,p,m),C=(0,he.getOutgoers)(c,p,m),w=T.some(h=>h.type==="START_EVENT"),L=C.some(h=>h.type==="END_EVENT");return w?"start":L?"end":"between"},d=c=>{var h,N,k;let p=a(),m=i(),T=r(c.source),C=r(c.target);if(!T||!C)return"simple";if((0,he.getOutgoers)(T,p,m).some(x=>x.type==="END_EVENT"))return"final";if(T.type==="GATEWAY")switch((h=T.data)==null?void 0:h.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(T.type==="TASK"){let x=(N=T.data)==null?void 0:N.variant,S=(k=T.data)==null?void 0:k.attribute;return x==="SCRIPT"?"script":S==="LOOP"?"loop":"simple"}return"simple"},f=c=>{var h;let p=r(c.source);if(!p||p.type!=="GATEWAY"||((h=p.data)==null?void 0:h.variant)!=="COMPLEX")return;let m=a(),T=i(),C=(0,he.getIncomers)(p,m,T),w=!1,L=!1;if(C.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(w=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(L=!0))}),w&&L)return"script_loop";if(w)return"script";if(L)return"loop"},g=c=>{var h;let p=r(c.source);if(!p||p.type!=="GATEWAY"||((h=p.data)==null?void 0:h.variant)!=="EXCLUSIVE")return;let m=a(),T=i(),C=(0,he.getIncomers)(p,m,T),w=!1,L=!1;if(C.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(w=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(L=!0))}),w)return"script";if(L)return"loop"},u=c=>{var L,h;if(c.type!=="GATEWAY")return;let p=a(),m=i(),T=(0,he.getIncomers)(c,p,m),C=!1,w=!1;if(T.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(C=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(w=!0))}),((L=c.data)==null?void 0:L.variant)==="COMPLEX"){if(C&&w)return"script_loop";if(C)return"script";if(w)return"loop"}else if(((h=c.data)==null?void 0:h.variant)==="EXCLUSIVE"){if(C)return"script";if(w)return"loop"}},b=()=>{var p,m,T,C,w;let c=r(e);c&&(c.type==="GATEWAY"?(s==null||s({id:c.id,type:"gateway",variant:((p=c.data)==null?void 0:p.variant)||"EXCLUSIVE",label:(m=c.data)==null?void 0:m.label,subVariant:u(c)}),console.log({id:c.id,type:"gateway",variant:((T=c.data)==null?void 0:T.variant)||"EXCLUSIVE",label:(C=c.data)==null?void 0:C.label,subVariant:u(c)})):s==null||s({id:c.id,type:"activity",variant:l(c),label:(w=c.data)==null?void 0:w.label}))},E=()=>{let c=n(e);if(c){let p=d(c),m;p==="complex"?m=f(c):p==="exclusive"&&(m=g(c)),s==null||s({id:c.id,type:"routing",variant:p,subVariant:m})}};return(0,Ke.jsxs)(ve.Tooltip,{children:[(0,Ke.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(ve.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":b();break;case"edge":E();break}},children:(0,Ke.jsx)(br.PencilIcon,{size:16})})}),(0,Ke.jsx)(ve.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var hr=require("@xyflow/react"),Ne=require("lecom-ui"),vr=require("lucide-react"),Ze=require("react/jsx-runtime"),oo=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{deleteElements:r}=(0,hr.useReactFlow)();return(0,Ze.jsxs)(Ne.Tooltip,{children:[(0,Ze.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(Ne.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(vr.TrashIcon,{size:16})})}),(0,Ze.jsx)(Ne.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var _t=require("react/jsx-runtime"),dt=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let a=[{component:(0,_t.jsx)(oo,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:(0,_t.jsx)(xt,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,_t.jsx)("div",_(v({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>(0,_t.jsx)("div",{children:l.component},d))}))};var $e=require("react/jsx-runtime"),no={type:"ANNOTATION_EDGE",zIndex:2e3},Nr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=(0,ye.useNodes)(),{zoom:f}=(0,ye.useViewport)(),g=d.find(m=>m.id===t),u=d.find(m=>m.id===o),[b,E,y]=(0,ye.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),c=s||(g==null?void 0:g.selected)||(u==null?void 0:u.selected),p=1/f;return(0,$e.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":c}),children:[(0,$e.jsx)(ye.BaseEdge,{id:e,path:b,strokeDasharray:4,className:A("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)]":c&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(ye.EdgeLabelRenderer,{children:(0,$e.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${y}px)`},children:s&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};var re=require("@xyflow/react"),yr=require("react");var Xe=require("react");var ko=require("react/jsx-runtime"),Q=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=(0,Xe.useRef)(null),[l,d]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{d(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let b=document.createRange();b.selectNodeContents(s.current),b.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(b))}},[l]);let f=b=>{b.stopPropagation(),d(!0)},g=b=>{let E=b.currentTarget.innerText;t&&E.length>=t&&b.preventDefault()},u=b=>{d(!1),n==null||n(),o==null||o(b.currentTarget.innerText)};return(0,ko.jsx)("div",{className:A("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:i,onDoubleClick:f,children:(0,ko.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:u,children:e})})};var Re=require("react/jsx-runtime"),Me={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:re.MarkerType.ArrowClosed},markerEnd:{type:re.MarkerType.Arrow},data:{label:""}},Tr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=(0,re.useNodes)(),{zoom:u}=(0,re.useViewport)(),{updateEdgeData:b}=(0,re.useReactFlow)(),[E,y]=(0,yr.useState)(!1),c=g.find(I=>I.id===t),p=g.find(I=>I.id===o),[m,T,C]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),w=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=w?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,N=1/u,k=()=>{y(!0)},x=()=>{y(!1)},S=I=>{b(e,{label:I.trim()})};return(0,Re.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":w}),onBlur:x,onDoubleClick:k,children:[(0,Re.jsx)(re.BaseEdge,{id:e,path:m,markerEnd:`url(#${L})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":w&&!(d!=null&&d.hasError)})}),(0,Re.jsx)(re.EdgeLabelRenderer,{children:(0,Re.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${C}px)`},children:[f&&(0,Re.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${N})`}}),h&&(0,Re.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var xr=({setEdges:e})=>{let{getNode:t}=(0,wt.useReactFlow)();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?(0,wt.addEdge)(v(v({},n),no),a):(0,wt.addEdge)(v(v({},n),Me),a)})}}};var Lo=require("react"),Pr=require("lecom-ui"),Dr=require("@xyflow/react");var Ct=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ve=(e=[])=>e.filter(t=>t.type==="TASK")||[],_r=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),wr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ao=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Cr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),pe=(e,t=[])=>t.filter(o=>o.source===e),It=(e,t=[])=>t.filter(o=>o.target===e),Ir=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Ar=(e,t)=>{let o=pe(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},kr=e=>e?/\w/g.test(e.trim()):!1,R=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Te=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Lr=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.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 At=[{id:"start_event_not_found",validate:e=>{let t=Ct(e.nodes);return R({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=qe(e.nodes);return R({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Ct(e.nodes),o=t.length===1;if(t.length===0)return R({isValid:!0});if(!o)return R({isValid:!1,nodeIds:t.map(a=>a.id)});let r=pe(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return R({isValid:!1,nodeIds:[...new Set(a)]})}return R({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>pe(r.id,e.edges).length<=2);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!!r.label&&r.label.trim()!=="");return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ve(e.nodes),r=Te(o,n=>!n.label||n.label.length<=60);return R({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return R({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ao(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Ct(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],r=[];for(let n of t){let a=It(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=pe(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return R({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Cr(e.nodes),o=Te(t,n=>pe(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>pe(n,e.edges).map(a=>a.id));return R({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!r.label||kr(r.label));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return R({isValid:!0});let t=qe(e.nodes)[0];if(!t)return R({isValid:!0});let o=It(t.id,e.edges);if(!o.length)return R({isValid:!0});let n=Ve(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Te(n,l=>!Ir(l.id,e));return R({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ve(e.nodes),o=qe(e.nodes)[0];if(!o)return R({isValid:!0});let r=t.filter(l=>{let d=It(l.id,e.edges),f=pe(l.id,e.edges),g=d.some(b=>{var E;return((E=e.nodes.find(y=>y.id===b.source))==null?void 0:E.type)==="START_EVENT"}),u=f.some(b=>{var E;return((E=e.nodes.find(y=>y.id===b.target))==null?void 0:E.type)==="END_EVENT"});return g&&u}),n=It(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return R(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ao(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ao(e.nodes),o=Te(t,r=>pe(r.id,e.edges).length>=1);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Ct(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=_r(e.nodes),o=Te(t,r=>!Ar(r.id,e));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=wr(e.nodes),o=Te(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return R({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Sr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of At){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Rr=()=>{let{t:e}=(0,Pr.useTranslation)(),[t,o]=(0,Lo.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Dr.useReactFlow)(),[s,l]=(0,Lo.useState)(!1);return{validationResult:t,validateDiagram:u=>{let b=Lr(u.nodes,u.edges),E=Sr(b),y=E.errors.map(c=>_(v({},c),{message:e(`validation.errors.${c.id}`)}));return s||l(!0),{isValid:E.isValid,errors:y}},handleValidationComplete:u=>{if(o(u),!u)return;let b=[],E=[];u.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(N=>b.push(N)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(N=>E.push(N))});let y=[...new Set(b)];r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:!1})}))),n(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:!1})})));let c=a(),p=i(),m=new Set(y),T=new Set;u.errors.forEach(h=>{var x,S;let N=At.find(I=>I.id===h.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((x=h.edgeIds)==null||x.forEach(I=>T.add(I)),(S=h.nodeIds)==null||S.forEach(I=>{p.forEach(j=>{(j.source===I||j.target===I)&&T.add(j.id)})}))});let C=new Set,w=new Set,L=new Set;c.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&w.add(h.id)}),p.forEach(h=>{C.has(h.source)&&L.add(h.target),w.has(h.target)&&L.add(h.source)}),L.forEach(h=>{var N,k;if(m.has(h)){let x=(N=u.errors.find(I=>{var j;return(j=I.nodeIds)==null?void 0:j.includes(h)}))==null?void 0:N.id;((k=At.find(I=>I.id===x))==null?void 0:k.highlightRelatedEdges)!==!1&&p.forEach(I=>{I.source===h&&w.has(I.target)&&(m.add(I.target),T.add(I.id)),I.target===h&&C.has(I.source)&&(m.add(I.source),T.add(I.id))})}}),m.size>0&&r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:m.has(N.id)})}))),T.size>0&&n(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:T.has(N.id)})})))},clearValidation:()=>{o(null),l(!1),r(u=>u.map(b=>_(v({},b),{data:_(v({},b.data),{hasError:!1})}))),n(u=>u.map(b=>_(v({},b),{data:_(v({},b.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Vr=require("@xyflow/react"),Or=require("react"),So=require("uuid");var Qa=15,Mr="bpmn:selection",Gr=({offset:e=Qa}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Vr.useReactFlow)();(0,Or.useEffect)(()=>{let a=s=>{var b;s.preventDefault();let l=t(),d=r(),f=l.filter(E=>E.selected);if(!f.length)return;let g=d.filter(E=>f.some(y=>y.id===E.source)&&f.some(y=>y.id===E.target)),u={nodes:f,edges:g};(b=s.clipboardData)==null||b.setData(Mr,JSON.stringify(u))},i=s=>{var u,b;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Mr))||"{}");if(!((b=l.nodes)!=null&&b.length))return;let d=new Map,f=l.nodes.map(E=>{let y=(0,So.v7)();return d.set(E.id,y),_(v({},E),{id:y,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),g=l.edges.map(E=>_(v({},E),{id:(0,So.v7)(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(y=>_(v({},y),{selected:!1})),...f]),n(E=>[...E.map(y=>_(v({},y),{selected:!1})),...g])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};var io=require("@xyflow/react"),Po=require("uuid");var Hr=require("zustand"),ct=(0,Hr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Br=require("react");var Oe=require("react/jsx-runtime"),Il={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},zr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=(0,se.useNodes)(),{zoom:u}=(0,se.useViewport)(),{updateEdgeData:b}=(0,se.useReactFlow)(),[E,y]=(0,Br.useState)(!1),c=g.find(I=>I.id===t),p=g.find(I=>I.id===o),[m,T,C]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),w=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=w?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,N=1/u,k=()=>{y(!0)},x=()=>{y(!1)},S=I=>{b(e,{label:I.trim()})};return(0,Oe.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":w}),onBlur:x,onDoubleClick:k,children:[(0,Oe.jsx)(se.BaseEdge,{id:e,path:m,markerEnd:`url(#${L})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":w&&!(d!=null&&d.hasError)})}),(0,Oe.jsx)(se.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(${T}px, ${C}px)`},children:[f&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${N})`}}),h&&(0,Oe.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var kt=require("react/jsx-runtime"),Fr=({fromX:e,fromY:t,toX:o,toY:r})=>(0,kt.jsxs)("g",{children:[(0,kt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),(0,kt.jsx)("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Ur=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,io.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=ct(),{getInternalNode:i,screenToFlowPosition:s}=(0,io.useReactFlow)(),l=c=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(m=>m.map(T=>_(v({},T),{className:T.id===c?p:""})))},d=()=>{let{nodeLookup:c}=r.getState();return Array.from(c.values())},f=c=>{let p=i(c.id),m=d();if(c.type==="LANE"){if(lt({parentId:c.id,nodes:e,includeTypes:["LANE"]})){l();return}let N=m.filter(S=>S.id!==c.id&&S.type==="LANE"&&!S.parentId),k=Tt(p,N);if(!k){l();return}if(lt({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=m.filter(h=>h.id!==c.id&&h.type==="LANE"),w=Tt(p,C);if(!w){l();return}if(lt({parentId:w.id,nodes:e,includeTypes:["LANE"]})){l();return}l(w.id)},g=c=>{c.preventDefault(),c.dataTransfer.dropEffect="move"},u=(c,p)=>{c.preventDefault(),f(p)},b=(c,p,m)=>{var N,k;let T=x=>x.map(S=>_(v({},S),{className:void 0}));if(c.parentId===p.id){let x=Ye(p.id,m);t(ke(T(x)));return}if(c.type==="LANE"){if(lt({parentId:p.id,nodes:m,excludeTypes:["LANE"]}))return;let I=m.filter(Z=>Z.parentId===p.id).reduce((Z,Qe)=>{var ze,Fe;return Z+((Fe=(ze=Qe.measured)==null?void 0:ze.height)!=null?Fe:0)},0),j={x:oe.HEADER_WIDTH,y:I},ie=m.map(Z=>Z.id===c.id?_(v({},Z),{parentId:p.id,position:j,className:void 0}):_(v({},Z),{className:void 0}));ie=Ye(p.id,ie),t(ke(ie));return}if(lt({parentId:p.id,nodes:m,includeTypes:["LANE"]})){let x;if(c.parentId){let I=i(c.parentId),{x:j,y:ie}=Ae(I);x={x:j+((N=c.position.x)!=null?N:0),y:ie+((k=c.position.y)!=null?k:0)}}let S=m.map(I=>I.id===c.id?_(v({},I),{position:x!=null?x:I.position,parentId:void 0,className:void 0}):_(v({},I),{className:void 0}));t(ke(S));return}let L=ir(c,p),h=m.map(x=>x.id===c.id?_(v({},x),{parentId:p.id,position:L,className:void 0}):_(v({},x),{className:void 0}));t(ke(h))};return{onDragOver:g,onDrop:c=>{if(c.preventDefault(),!(n!=null&&n.type))return;let p=s({x:c.clientX,y:c.clientY}),m={width:Y[n.type].MIN_WIDTH,height:Y[n.type].MIN_HEIGHT},T={id:(0,Po.v7)(),type:n.type,position:p,measured:m,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(v({},T),{internals:{positionAbsolute:p}}),w=d(),L=n.type==="LANE",h=w.filter(x=>L?x.type==="LANE"&&!x.parentId:x.type==="LANE"),N=Tt(C,h);N?b(C,N,[...w,C]):t(x=>{let S=x.concat(T);return ke(S)});let k=c.dataTransfer.getData("sourceId");if(k){let x={id:(0,Po.v7)(),source:k,target:T.id};if(n.type==="ANNOTATION"){o(S=>S.concat(v(v({},x),no)));return}o(S=>S.concat(v(v({},x),Me)))}a(null)},onNodeDrag:u,onNodeDragStop:async(c,p)=>{var N,k;let{nodeLookup:m}=r.getState(),T=i(p.id),C=Array.from(m.values()),w=p.type==="LANE",L=C.filter(x=>x.id!==p.id&&(w?x.type==="LANE"&&!x.parentId:x.type==="LANE")),h=Tt(T,L);if(h){b(T,h,C);return}if(p.parentId){let x=i(p.parentId),{x:S,y:I}=Ae(x),j={x:S+((N=p.position.x)!=null?N:0),y:I+((k=p.position.y)!=null?k:0)},ie=e.map(Z=>Z.id===p.id?_(v({},Z),{position:j,parentId:void 0}):Z);ie=Ye(p.parentId,ie),t(ke(ie))}}}};var Yr=require("@xyflow/react"),Lt=require("react");function Wr(e,t,o=5){var l,d,f,g,u,b,E,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(c=>c.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((g=(f=n.measured)==null?void 0:f.height)!=null?g:0),width:(b=(u=n.measured)==null?void 0:u.width)!=null?b:0,height:(y=(E=n.measured)==null?void 0:E.height)!=null?y:0},i=o,s=o;return t.filter(c=>c.id!==n.id).reduce((c,p)=>{var S,I,j,ie,Z,Qe,ze,Fe;let m={left:p.position.x,right:p.position.x+((I=(S=p.measured)==null?void 0:S.width)!=null?I:0),top:p.position.y,bottom:p.position.y+((ie=(j=p.measured)==null?void 0:j.height)!=null?ie:0),width:(Qe=(Z=p.measured)==null?void 0:Z.width)!=null?Qe:0,height:(Fe=(ze=p.measured)==null?void 0:ze.height)!=null?Fe:0},T=Math.abs(a.left-m.left);T<s&&(c.snapPosition.x=m.left,c.vertical=m.left,s=T);let C=Math.abs(a.right-m.right);C<s&&(c.snapPosition.x=m.right-a.width,c.vertical=m.right,s=C);let w=Math.abs(a.left-m.right);w<s&&(c.snapPosition.x=m.right,c.vertical=m.right,s=w);let L=Math.abs(a.right-m.left);L<s&&(c.snapPosition.x=m.left-a.width,c.vertical=m.left,s=L);let h=Math.abs(a.top-m.top);h<i&&(c.snapPosition.y=m.top,c.horizontal=m.top,i=h);let N=Math.abs(a.bottom-m.top);N<i&&(c.snapPosition.y=m.top-a.height,c.horizontal=m.top,i=N);let k=Math.abs(a.bottom-m.bottom);k<i&&(c.snapPosition.y=m.bottom-a.height,c.horizontal=m.bottom,i=k);let x=Math.abs(a.top-m.bottom);return x<i&&(c.snapPosition.y=m.bottom,c.horizontal=m.bottom,i=x),c},r)}var Kr=()=>{let[e,t]=(0,Lt.useState)(void 0),[o,r]=(0,Lt.useState)(void 0),n=(0,Lt.useCallback)((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Wr(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return(0,Yr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var jr=require("@xyflow/react"),Do=require("uuid");var $r={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Xr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Zr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},ei=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
+
`),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Zr(a[0],o),s=Zr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},qr=e=>{let{components:t,connections:o}=ei(e);return{nodes:t,edges:o}};var Jr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,jr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=qr(n),s=[],l=new Map;for(let[u,b]of Object.entries(a)){let E=(0,Do.v7)(),y=$r[b.type],c=Xr[b.type];l.set(u,E);let p=Y[y].MIN_WIDTH,m=Y[y].MIN_HEIGHT;s.push({id:E,type:y,data:{label:b.label||"",variant:c,attribute:""},position:{x:0,y:0},width:p,height:m,measured:{width:p,height:m}})}let d=[];for(let u of i){let b=_(v({},Me),{id:(0,Do.v7)(),source:l.get(u.sourceId)||u.sourceId,target:l.get(u.targetId)||u.targetId});d.push(b)}let{nodes:f,edges:g}=cr(s,d);e(f),t(g),o()}}};var so=require("react"),ti={origin:"*",debug:!1};function Qr(e,t=ti){let{origin:o,debug:r}=t,n=(0,so.useCallback)((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return(0,so.useEffect)(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}var tn=require("@xyflow/react"),Le=require("react"),on=require("use-debounce"),oi={nodes:[],edges:[]},ri=500,en=10,rn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=(0,tn.useReactFlow)(),[n,a]=(0,Le.useState)([oi]),[i,s]=(0,Le.useState)(0),l=n[i],d=i>0,f=i<n.length-1,g=(0,Le.useCallback)(m=>{o(n[m].nodes),r(n[m].edges)},[n,o,r]),u=(0,Le.useCallback)(()=>{if(i>0){let m=i-1;s(m),g(m)}},[i,g]),b=(0,Le.useCallback)(()=>{if(i<n.length-1){let m=i+1;s(m),g(m)}},[n,i,g]),E=m=>{let C=[...n.slice(0,i+1),m],w=C.length>en?C.slice(C.length-en):C;a(w),s(w.length-1)},y=(0,on.useDebouncedCallback)(()=>{let m=e(),T=t(),C={nodes:m,edges:T};JSON.stringify(l)!==JSON.stringify(C)&&E(C)},ri),c=(0,Le.useCallback)(m=>{if(m==="forceSave"){y();return}m.some(C=>C.type!=="select")&&y()},[y]),p=(0,Le.useCallback)(()=>{a([]),s(0)},[]);return{undo:u,redo:b,saveHistory:c,canUndo:d,canRedo:f,clearHistory:p}};var Ro=require("react/jsx-runtime"),Mo=({id:e,className:t})=>(0,Ro.jsx)("marker",{id:e,className:A("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,Ro.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var pt=require("react/jsx-runtime"),nn=()=>(0,pt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,pt.jsxs)("defs",{children:[(0,pt.jsx)(Mo,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,pt.jsx)(Mo,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Go=require("@xyflow/react"),H=require("lecom-ui"),He=require("lucide-react"),Dt=require("react");var an=require("@xyflow/react"),ni=e=>({unselectAll:e.unselectNodesAndEdges}),lo=()=>{let{unselectAll:e}=(0,an.useStore)(ni);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var xe=require("lecom-ui");var St=(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))(St||{});var vn=require("@xyflow/react"),ut=require("lecom-ui");var sn=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function ln({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
|
|
3
3
|
`),a=encodeURI(n);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 bn=require("uuid");var Vo=require("xml-js");var ai={compact:!0,spaces:4},ii=e=>e.replaceAll(`
|
|
4
|
-
`,"
");function dn(e,t=ai){if(e)return JSON.parse((0,Vo.xml2json)(e,
|
|
4
|
+
`,"
");function dn(e,t=ai){if(e)return JSON.parse((0,Vo.xml2json)(e,_(v({},t),{attributeValueFn:ii})))}function cn(e){return e==null?void 0:e.replaceAll("
"," ")}var un=require("uuid");var xd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},pn={script:"SCRIPT",subprocess:"SUBPROCESS"},mn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var mt=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},li=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.START_EVENT.MIN_HEIGHT,{node:mt({cell:e,type:"START_EVENT"}),status:r,originalType:o}},di=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.END_EVENT.MIN_HEIGHT,{node:mt({cell:e,type:"END_EVENT"}),status:r,originalType:o}},ci=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=pn[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,Y.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,Y.TASK.MIN_HEIGHT),{node:mt({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},pi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=mn[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=Y.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=Y.GATEWAY.MIN_HEIGHT,{node:mt({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},mi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,Y.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,Y.ANNOTATION.MIN_HEIGHT),{node:mt({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},fn=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Y.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=Y.UNSUPPORTED.MIN_HEIGHT,{node:mt({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},gn=(e,t)=>{let{source:o,target:r}=e._attributes;return _(v({},Me),{id:(0,un.v7)(),source:t.get(o)||o,target:t.get(r)||r})},En={TASK:ci,GATEWAY:pi,START_EVENT:li,END_EVENT:di,ANNOTATION:mi};var ui=e=>{var i;let t=new Map,o=Object.values(St),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=(0,bn.v7)(),{type:d}=s._attributes,f=En[d]||fn;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:g,status:u,originalType:b}=f(s);n.push(g),a.push({originalType:b,type:g.type,variant:g.data.variant,value:cn(g.data.label),status:u})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},fi=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>gn(n,t)),gi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=ui(t.root.mxCell),a=fi(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Ei=async e=>{let t=await sn(e),o=dn(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},hn=async e=>{try{let t=await Ei(e),{nodes:o,edges:r,summary:n}=gi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};var yn=require("react/jsx-runtime"),Nn=()=>{let{t:e}=(0,ut.useTranslation)(),{toast:t}=(0,ut.useNotificationToast)(),{setNodes:o,setEdges:r,fitView:n}=(0,vn.useReactFlow)(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(f=>[f.originalType,f.value,e(`adapter.governance.report.status.${f.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,yn.jsx)(ut.Button,{size:"small",variant:"ghost",onClick:()=>ln({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:f}=await hn(s);if(o(u=>u.concat(l)),r(u=>u.concat(d)),n(),f.some(u=>u.status==="unsupported")){a(f);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};var Tn=require("lecom-ui"),xn=require("react");var je=require("react/jsx-runtime"),_n=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=et(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=(0,xn.useRef)(null),f=u=>{let b=u.target.files;b!=null&&b.length&&a(b),d.current&&(d.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(Tn.Button,_(v({onClick:u=>{var b;(b=d.current)==null||b.click(),n==null||n(u)}},i),{children:e})),(0,je.jsx)("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:f})]})};var Je=require("react/jsx-runtime"),wn=({disabled:e=!1})=>{let{t}=(0,xe.useTranslation)(),{toast:o}=(0,xe.useNotificationToast)(),{createDiagram:r}=Nn(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return(0,Je.jsxs)(xe.Tooltip,{children:[(0,Je.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(_n,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:(0,Je.jsx)(jo,{})})}),(0,Je.jsx)(xe.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var D=require("lecom-ui"),Ge=require("lucide-react"),kn=require("react");var Cn=require("@xyflow/react"),Pt=require("html-to-image"),po=require("lecom-ui"),In=require("react");var bi=3,Oo="diagram",An=()=>{let{t:e}=(0,po.useTranslation)(),{getNodes:t}=(0,Cn.useReactFlow)(),{deselectAll:o}=lo(),[r,n]=(0,In.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:f,y:g,width:u,height:b}=mr(t());return{width:u,height:b,style:{width:`${u}px`,height:`${b}px`,transform:`translate(${-f}px, ${-g}px)`}}},i=async(f,g)=>{n(_(v({},r),{[g]:!0})),await o();try{let u=pr();if(!u)throw new Error("Flow element not found");let b=a();return await f(u,b)}catch(u){(0,po.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(_(v({},r),{[g]:!1}))}};return{exportAsPng:async(f=Oo)=>{await i(async(g,u)=>{let b=await(0,Pt.toPng)(g,_(v({},u),{backgroundColor:"#fcfcfc"}));co(b,`${f}.png`)},"png")},exportAsHtml:async(f=Oo)=>{await i(async(g,u)=>{let b=await(0,Pt.toSvg)(g,_(v({},u),{backgroundColor:"#fcfcfc"})),E=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<img src="${b}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,
|
|
18
|
+
`,y=new Blob([E],{type:"text/html"}),c=URL.createObjectURL(y);co(c,`${f}.html`),setTimeout(()=>URL.revokeObjectURL(c),100)},"html")},printDiagram:async(f=Oo)=>{await i(async(g,u)=>{let b=await(0,Pt.toPng)(g,_(v({},u),{pixelRatio:bi})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let y=E.document;y.open(),y.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
<img src="${b}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),h.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function Ln(){let{t:e}=(0,D.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=An(),[s,l]=(0,kn.useState)(!1);return(0,V.jsxs)(D.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,V.jsx)(D.DropdownMenuTrigger,{asChild:!0,children:(0,V.jsx)("div",{children:(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,V.jsx)(Ge.FolderOutputIcon,{})})}),!s&&(0,V.jsx)(D.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,V.jsxs)(D.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,V.jsx)(Ge.FileImageIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>o(),children:(0,V.jsx)(Ge.FileCodeIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,V.jsx)(Ge.PrinterIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var S=require("react/jsx-runtime"),Sn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,H.useTranslation)(),{deselectAll:i}=lo(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:f,isMinimapOpen:g,setIsMinimapOpen:u}=$(),b=(0,Go.useKeyPress)(["v","V"]),E=(0,Go.useKeyPress)(["h","H"]),h=(0,Dt.useCallback)(()=>{i(),f()},[i,f]),c=()=>{i();let p=n(o);r&&r(p)};return(0,Dt.useEffect)(()=>{b&&!s&&!t&&d()},[b,d,s,t]),(0,Dt.useEffect)(()=>{E&&!l&&!t&&h()},[E,h,l,t]),(0,S.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(H.Tooltip,{children:[(0,S.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,S.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:C(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:(0,S.jsx)(He.MousePointerIcon,{})})}),(0,S.jsxs)(H.TooltipContent,{color:"black",children:[a("editor.controls.actions.move_tool"),(0,S.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,S.jsxs)(H.Tooltip,{children:[(0,S.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,S.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:C(l&&"bg-grey-400"),iconButton:!0,onClick:h,children:(0,S.jsx)(He.HandIcon,{})})}),(0,S.jsxs)(H.TooltipContent,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",(0,S.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,S.jsxs)(H.Tooltip,{children:[(0,S.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,S.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:c,children:(0,S.jsx)(He.ListCheckIcon,{})})}),(0,S.jsx)(H.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,S.jsx)(Ln,{}),!t&&(0,S.jsx)(wn,{disabled:e.length>0}),(0,S.jsxs)(H.Tooltip,{children:[(0,S.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,S.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:C(g&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!g),children:(0,S.jsx)(He.MapIcon,{})})}),(0,S.jsx)(H.TooltipContent,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var le=require("lecom-ui"),mo=require("lucide-react"),me=require("react/jsx-runtime"),Pn=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,le.useTranslation)();return(0,me.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,me.jsx)(mo.UndoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,me.jsx)(mo.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Dn=require("@xyflow/react"),B=require("lecom-ui"),ft=require("lucide-react");var O=require("react/jsx-runtime"),Mn=()=>{let{t:e}=(0,B.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Dn.useReactFlow)();return(0,O.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:(0,O.jsx)(ft.ScanIcon,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,O.jsx)(ft.ZoomOut,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:(0,O.jsx)(tr,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,O.jsx)(ft.ZoomIn,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var bo=require("@xyflow/react");var Rn=require("@xyflow/react");var Vn=require("react/jsx-runtime"),X=({type:e,position:t,className:o})=>(0,Vn.jsx)(Rn.Handle,{type:e,position:t,className:C("size-2.5 border border-grey-400 bg-white",o)});var uo=require("@xyflow/react"),On=require("lodash");var Gn=require("react/jsx-runtime"),gt=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,uo.useReactFlow)(),s=({width:l,height:d})=>{if(!e)return;let f=n(e);if((f==null?void 0:f.type)!=="LANE")return;let g=[...a()],u=!f.parentId,b=u?f.id:f.parentId,E=g.filter(p=>p.type==="LANE"&&p.parentId===b);if(!E.length)return;let h=(0,On.orderBy)(E,["position.y"]),c=0;h.forEach((p,m)=>{var A,L;let x=m===h.length-1,_=(L=(A=p.measured)==null?void 0:A.height)!=null?L:0;g=g.map(v=>{if(v.id===p.id){let T=u?l-oe.HEADER_WIDTH:l,k=y(N({},v),{width:T,measured:y(N({},v.measured),{width:T}),position:y(N({},v.position),{y:c})});return x&&u&&(k.height=d-c),k}return v}),c+=_}),g=g.map(p=>{if(p.id===b){let m=u?l:l+oe.HEADER_WIDTH;return y(N({},p),{width:m,height:u?d:c,measured:{width:m,height:u?d:c}})}return p}),i(g)};return(0,Gn.jsx)(uo.NodeResizer,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};var Eo=require("@xyflow/react"),xe=require("lecom-ui");var fo=require("@xyflow/react"),z=require("lecom-ui"),Hn=require("lucide-react");var ne=require("react/jsx-runtime"),Bn=({nodeId:e})=>{let{t}=(0,z.useTranslation)(),{updateNodeData:o}=(0,fo.useReactFlow)(),r=(0,fo.useNodesData)(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return(0,ne.jsxs)(z.DropdownMenu,{children:[(0,ne.jsxs)(z.Tooltip,{children:[(0,ne.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,ne.jsx)(z.DropdownMenuTrigger,{asChild:!0,children:(0,ne.jsx)(z.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ne.jsx)(Hn.WrenchIcon,{})})})}),(0,ne.jsx)(z.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ne.jsxs)(z.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ne.jsx)(z.DropdownMenuLabel,{className:"flex items-center",children:(0,ne.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,ne.jsx)(z.DropdownMenuGroup,{children:Object.entries(qt).map(([a,i])=>(0,ne.jsxs)(z.DropdownMenuItem,{className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,ne.jsx)(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var go=require("@xyflow/react"),G=require("lecom-ui"),zn=require("lucide-react");var q=require("react/jsx-runtime"),Fn=({nodeId:e})=>{let{t}=(0,G.useTranslation)(),{updateNodeData:o}=(0,go.useReactFlow)(),r=(0,go.useNodesData)(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return(0,q.jsxs)(G.DropdownMenu,{children:[(0,q.jsxs)(G.Tooltip,{children:[(0,q.jsx)(G.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(G.DropdownMenuTrigger,{asChild:!0,children:(0,q.jsx)(G.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,q.jsx)(zn.WrenchIcon,{})})})}),(0,q.jsx)(G.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,q.jsxs)(G.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,q.jsxs)(G.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,q.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,q.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Xt).map(([i,s])=>(0,q.jsx)(G.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:(0,q.jsx)(s.icon,{className:"stroke-inherit"})},i))})]}),(0,q.jsx)(G.DropdownMenuGroup,{children:Object.entries($t).map(([i,s])=>(0,q.jsxs)(G.DropdownMenuItem,{className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,q.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};var de=require("react/jsx-runtime"),ce=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var f;let{t:n}=(0,xe.useTranslation)(),{setDraggableNode:a}=ct(),i=({event:g,type:u,variant:b})=>{a({type:u,variant:b}),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:yt,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:tt,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:yt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ut,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(oo,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Fn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Bn,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return(0,de.jsx)(Eo.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:Eo.Position.Right,align:"start",isVisible:r,children:(f=d[t])==null?void 0:f.map((g,u)=>g.component?(0,de.jsx)("div",{children:g.component},u):(0,de.jsxs)(xe.Tooltip,{children:[(0,de.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,de.jsx)(xe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:b=>i({event:b,type:g.type,variant:g.variant}),children:g.icon&&(0,de.jsx)(g.icon,{size:16})})}),(0,de.jsx)(xe.TooltipContent,{color:"black",children:g.label})]},u))})};var _e=require("react/jsx-runtime"),Un=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,bo.useReactFlow)(),{isMultipleSelection:a}=$(),i=s=>{n(e,{label:s})};return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("div",{className:C("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,_e.jsx)(Q,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),(0,_e.jsx)(ce,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),(0,_e.jsx)(gt,{isVisible:!r&&!a&&o,minWidth:Qt.MIN_WIDTH,minHeight:Qt.MIN_HEIGHT}),(0,_e.jsx)(X,{type:"target",position:bo.Position.Left})]})};var Mt=require("@xyflow/react"),Wn=require("react");var fe=require("react/jsx-runtime"),Yn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Mt.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Wn.useState)(!1),l=g=>{n(e,{label:g})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,fe.jsx)(tt,{className:C("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,fe.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,fe.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,fe.jsx)(ce,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),(0,fe.jsx)(X,{type:"source",position:Mt.Position.Right}),(0,fe.jsx)(X,{type:"target",position:Mt.Position.Left})]})};var Rt=require("@xyflow/react"),Kn=require("react");var ge=require("react/jsx-runtime"),Zn=({id:e,data:t,selected:o,dragging:r})=>{let n=qt[t.variant].icon,{updateNodeData:a}=(0,Rt.useReactFlow)(),{isMultipleSelection:i}=$(),[s,l]=(0,Kn.useState)(!1),d=u=>{a(e,{label:u})};return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,ge.jsx)(n,{className:C("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,ge.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ge.jsx)(Q,{value:t.label,isEditing:s,onChange:d})})]}),(0,ge.jsx)(ce,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),(0,ge.jsx)(X,{type:"target",position:Rt.Position.Left}),(0,ge.jsx)(X,{type:"source",position:Rt.Position.Right})]})};var ho=require("@xyflow/react"),$n=require("react");var Ee=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,ho.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,$n.useState)(!1),l=g=>{n(e,{label:g})};return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,Ee.jsx)(Zt,{className:C("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,Ee.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ee.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,Ee.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,Ee.jsx)(X,{type:"source",position:ho.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=$(),i=u=>{n(e,{label:u})},s=t.variant?$t[t.variant].icon:null,l=t.attribute?Xt[t.attribute].icon:null,d=t.variant==="SUBPROCESS",f=s&&!d,g=l||d;return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:C("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,ee.jsx)(Q,{value:t.label,className:C("m-1",{"py-6":f||g}),onChange:i}),s&&(0,ee.jsx)("div",{className:C("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:(0,ee.jsx)(s,{size:16,className:C(t.hasError?"text-red-500":"text-grey-500")})}),l&&(0,ee.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ee.jsx)("div",{className:C("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:(0,ee.jsx)(l,{size:16,className:C(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,ee.jsx)(ce,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),(0,ee.jsx)(gt,{isVisible:!r&&!a&&o,minWidth:jt.MIN_WIDTH,minHeight:jt.MIN_HEIGHT}),(0,ee.jsx)(X,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(X,{type:"target",position:Vt.Position.Left})]})};var Ho=require("@xyflow/react");var Se=require("react/jsx-runtime"),jn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=$();return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.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,Se.jsx)(ce,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Se.jsx)(X,{type:"source",position:Ho.Position.Right}),(0,Se.jsx)(X,{type:"target",position:Ho.Position.Left})]})};var vo=require("@xyflow/react"),Jn=require("lodash"),Bo=require("react");var ue=require("react/jsx-runtime"),Qn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,vo.useReactFlow)(),{isMultipleSelection:s}=$(),l=i(),d=!n,f=(0,Bo.useMemo)(()=>(0,Jn.orderBy)([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),g=d?Jt.MIN_WIDTH:oe.MIN_WIDTH,u=(0,Bo.useMemo)(()=>{if(d&&f.length>1){let E=[...f];return E.pop(),E.reduce((c,p)=>{var m,x;return c+((x=(m=p.measured)==null?void 0:m.height)!=null?x:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[d,f]),b=E=>{a(e,{label:E})};return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("div",{className:C("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,ue.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,ue.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,ue.jsx)(Q,{value:t.label,className:"w-full h-full",onChange:b})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),(0,ue.jsx)(gt,{nodeId:e,minWidth:g,minHeight:u,isVisible:!r&&!s&&o}),d&&(0,ue.jsx)(X,{type:"source",position:vo.Position.Right})]})};var ea={START_EVENT:Xn,END_EVENT:Yn,TASK:qn,GATEWAY:Zn,ANNOTATION:Un,LANE:Qn,UNSUPPORTED:jn},ta={SEQUENCE_EDGE:Tr,MESSAGE_EDGE:zr,ANNOTATION_EDGE:Nr},oa="#fafafa",ra="#bebebe",na=1,aa=10,ia="bottom-left",sa=.5,la=4,da={x:0,y:0,zoom:.75};var ca=require("@xyflow/react"),No=require("react"),ma=require("react/jsx-runtime"),hi=e=>({width:e.width,height:e.height,transform:e.transform}),pa=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,ca.useStore)(hi),s=(0,No.useRef)(null);return(0,No.useEffect)(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let f=window.devicePixelRatio;l.width=n*f,l.height=a*f,d.scale(f,f),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),(0,ma.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var U=require("lecom-ui"),ae=require("react/jsx-runtime"),ua=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,U.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(f=>f.filter(g=>!l.some(u=>u.id===g.id))),d!=null&&d.length&&r(f=>f.filter(g=>!d.some(u=>u.id===g.id))),t(null)},s=()=>{t(null)};return(0,ae.jsx)(U.Dialog,{open:a,onOpenChange:s,children:(0,ae.jsxs)(U.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ae.jsx)(U.DialogHeader,{children:(0,ae.jsx)(U.DialogTitle,{children:(0,ae.jsx)(U.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),(0,ae.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ae.jsx)("div",{className:"py-2",children:(0,ae.jsx)(U.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ae.jsx)(U.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ae.jsxs)(U.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ae.jsx)(U.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ae.jsx)(U.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ae.jsx)(U.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};var we=require("lecom-ui");var Be=require("react/jsx-runtime"),fa=()=>{let{t:e}=(0,we.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:Zt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:yt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:nr,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:rr,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:or,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Yt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Wt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:er,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ut,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return(0,Be.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:o.map((n,a)=>(0,Be.jsxs)(we.Tooltip,{children:[(0,Be.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,Be.jsx)(we.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:(0,Be.jsx)(n.icon,{})},a)}),(0,Be.jsx)(we.TooltipContent,{color:"black",side:"right",children:n.label})]},a))})};var yo=require("lecom-ui"),Et=require("lucide-react"),To=require("react"),te=require("react/jsx-runtime"),ga=({validationResult:e,onClose:t})=>{let{t:o}=(0,yo.useTranslation)(),[r,n]=(0,To.useState)(!1);if((0,To.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return(0,te.jsxs)("div",{className:C("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,te.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,te.jsx)("div",{className:"flex-shrink-0",children:a?(0,te.jsx)(Et.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,te.jsx)(Et.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,te.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,te.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,te.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,te.jsx)(yo.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:(0,te.jsx)(Et.XIcon,{})})]}),(0,te.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,te.jsx)("p",{children:o("validation.success.message")}):(0,te.jsx)("div",{className:"list-disc list-inside",children:i.map(s=>(0,te.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var K=require("react/jsx-runtime"),vi=[],Ni=({mode:e="edit"})=>{let t=(0,be.useRef)(!1),[o,r]=(0,W.useNodesState)([]),[n,a]=(0,W.useEdgesState)([]),[i,s]=(0,be.useState)(null),{isMoveTool:l,isHandTool:d,isReadOnly:f,setIsReadOnly:g,setIsMultipleSelection:u,isMinimapOpen:b}=$(),{validationResult:E,handleValidationComplete:h,clearValidation:c,isAutoValidationEnabled:p,validateDiagram:m}=Mr(),{getNode:x,getNodes:_,getEdges:A}=(0,W.useReactFlow)(),{onNodeDrag:L,onDrop:v,onDragOver:T,onNodeDragStop:k}=Ur({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:I,onConnect:P}=xr({setEdges:a});Gr();let{createDiagram:w}=Jr(),{undo:j,redo:ie,saveHistory:Z,canUndo:Qe,canRedo:ze}=rn(),{helperLineHorizontal:Fe,helperLineVertical:_a,customApplyNodeChanges:wa}=Kr();Qr({LIA_CREATE_DIAGRAM:w,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,be.useEffect)(()=>{g(e==="readonly")},[e,g]);let Ca=()=>{c()},Ia=(0,be.useCallback)(({nodes:J,edges:F})=>{let bt=J.length+F.length>1;u(bt)},[u]);(0,W.useOnSelectionChange)({onChange:Ia});let Aa=J=>{let F=x(J.id);if(F!=null&&F.parentId&&(F==null?void 0:F.type)==="LANE"){let bt=Ye(F.parentId,o.filter(Ko=>Ko.id!==F.id&&Ko.type==="LANE"));r(Ae(bt))}},ka=J=>{J.forEach(F=>{switch(F.type){case"remove":Aa(F);break}})},La=(0,be.useCallback)(()=>{if(!p){t.current=!1;return}let J=_(),F=A(),bt=m({nodes:J,edges:F});h(bt),t.current=!1},[p,_,A,m,h]),Wo=(0,ba.useDebouncedCallback)(La,300),Yo=(0,be.useCallback)(()=>{p&&!t.current&&(t.current=!0,Wo())},[p,Wo]),Sa=J=>{r(F=>wa(J,F)),Z(J),Yo(),ka(J)},Pa=J=>{a(F=>(0,W.applyEdgeChanges)(J,F)),Z(J),Yo()},Da=()=>{Z("forceSave")},Ma=async({nodes:J,edges:F})=>(s({nodes:J,edges:F}),!1),Ra={nodes:o,edges:n};return(0,K.jsxs)("div",{className:"w-full h-full",children:[!f&&(0,K.jsx)(fa,{}),(0,K.jsx)(nn,{}),(0,K.jsxs)(W.ReactFlow,{edges:n,nodes:o,nodeTypes:ea,edgeTypes:ta,minZoom:sa,maxZoom:la,panOnDrag:d||f?!0:vi,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&l,nodesConnectable:!f&&l,nodesDraggable:!f&&l,isValidConnection:I,connectionLineComponent:Fr,onConnect:P,onDrop:v,onDropCapture:Da,onDragOver:T,onNodesChange:Sa,onEdgesChange:Pa,onNodeDrag:L,onNodeDragStop:k,onBeforeDelete:Ma,selectionMode:W.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:da,connectOnClick:!1,children:[b&&(0,K.jsx)(W.MiniMap,{pannable:!0,zoomable:!0,position:ia,className:"shadow-md rounded-md"}),(0,K.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&(0,K.jsx)(Pn,{canUndo:Qe,canRedo:ze,undo:j,redo:ie}),(0,K.jsx)(Sn,{nodes:o,isReadOnly:f,diagram:Ra,onValidationComplete:h,onValidateDiagram:m}),(0,K.jsx)(Mn,{})]}),(0,K.jsx)(pa,{horizontal:Fe,vertical:_a}),(0,K.jsx)(W.Background,{gap:aa,size:na,color:ra,bgColor:oa}),E&&(0,K.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,K.jsx)(ga,{validationResult:E,onClose:Ca})})]}),(0,K.jsx)(ua,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},yi=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>((0,be.useEffect)(()=>{t&&Ea.i18n.changeLanguage(t)},[t]),(0,K.jsx)(W.ReactFlowProvider,{children:(0,K.jsx)(gr,{value:{onConfigureElement:o},children:(0,K.jsx)(Ni,{mode:e})})})),zo=yi;var Fo=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 xo=require("lecom-ui");var ha={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},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"}}},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"}},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 va={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},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"}}},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"}},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 Na={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},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"}}},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"}},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 ya={pt_BR:Na,en_US:ha,es_ES:va};var Ta,xa,Ti=(xa=(Ta=Fo("LecomUserLanguage"))!=null?Ta:Fo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?xa:xo.Translations.PT_BR;(0,xo.initializeI18n)({lng:Ti,resources:ya});var Uo=require("react/jsx-runtime"),xi=e=>(0,Uo.jsx)(qo,{children:(0,Uo.jsx)(zo,N({},e))});0&&(module.exports={ActivityVariant,ElementType,GatewayVariant,Modeler,RoutingVariant});
|
|
34
|
+
`),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function Ln(){let{t:e}=(0,D.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=An(),[s,l]=(0,kn.useState)(!1);return(0,V.jsxs)(D.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,V.jsx)(D.DropdownMenuTrigger,{asChild:!0,children:(0,V.jsx)("div",{children:(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,V.jsx)(Ge.FolderOutputIcon,{})})}),!s&&(0,V.jsx)(D.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,V.jsxs)(D.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,V.jsx)(Ge.FileImageIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>o(),children:(0,V.jsx)(Ge.FileCodeIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,V.jsxs)(D.Tooltip,{children:[(0,V.jsx)(D.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(D.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,V.jsx)(Ge.PrinterIcon,{})})}),(0,V.jsx)(D.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var P=require("react/jsx-runtime"),Sn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,H.useTranslation)(),{deselectAll:i}=lo(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:f,isMinimapOpen:g,setIsMinimapOpen:u}=$(),b=(0,Go.useKeyPress)(["v","V"]),E=(0,Go.useKeyPress)(["h","H"]),y=(0,Dt.useCallback)(()=>{i(),f()},[i,f]),c=()=>{i();let p=n(o);r&&r(p)};return(0,Dt.useEffect)(()=>{b&&!s&&!t&&d()},[b,d,s,t]),(0,Dt.useEffect)(()=>{E&&!l&&!t&&y()},[E,y,l,t]),(0,P.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(H.Tooltip,{children:[(0,P.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,P.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:A(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:(0,P.jsx)(He.MousePointerIcon,{})})}),(0,P.jsxs)(H.TooltipContent,{color:"black",children:[a("editor.controls.actions.move_tool"),(0,P.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,P.jsxs)(H.Tooltip,{children:[(0,P.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,P.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:A(l&&"bg-grey-400"),iconButton:!0,onClick:y,children:(0,P.jsx)(He.HandIcon,{})})}),(0,P.jsxs)(H.TooltipContent,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",(0,P.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,P.jsxs)(H.Tooltip,{children:[(0,P.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,P.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:c,children:(0,P.jsx)(He.ListCheckIcon,{})})}),(0,P.jsx)(H.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,P.jsx)(Ln,{}),!t&&(0,P.jsx)(wn,{disabled:e.length>0}),(0,P.jsxs)(H.Tooltip,{children:[(0,P.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,P.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",className:A(g&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!g),children:(0,P.jsx)(He.MapIcon,{})})}),(0,P.jsx)(H.TooltipContent,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var le=require("lecom-ui"),mo=require("lucide-react"),me=require("react/jsx-runtime"),Pn=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,le.useTranslation)();return(0,me.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,me.jsx)(mo.UndoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,me.jsx)(mo.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Dn=require("@xyflow/react"),B=require("lecom-ui"),ft=require("lucide-react");var O=require("react/jsx-runtime"),Rn=()=>{let{t:e}=(0,B.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Dn.useReactFlow)();return(0,O.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:(0,O.jsx)(ft.ScanIcon,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,O.jsx)(ft.ZoomOut,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:(0,O.jsx)(tr,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,O.jsxs)(B.Tooltip,{children:[(0,O.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(B.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,O.jsx)(ft.ZoomIn,{})})}),(0,O.jsx)(B.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var bo=require("@xyflow/react");var Mn=require("@xyflow/react");var Vn=require("react/jsx-runtime"),X=({type:e,position:t,className:o})=>(0,Vn.jsx)(Mn.Handle,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});var uo=require("@xyflow/react"),On=require("lodash");var Gn=require("react/jsx-runtime"),gt=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,uo.useReactFlow)(),s=({width:l,height:d})=>{if(!e)return;let f=n(e);if((f==null?void 0:f.type)!=="LANE")return;let g=[...a()],u=!f.parentId,b=u?f.id:f.parentId,E=g.filter(p=>p.type==="LANE"&&p.parentId===b);if(!E.length)return;let y=(0,On.orderBy)(E,["position.y"]),c=0;y.forEach((p,m)=>{var w,L;let T=m===y.length-1,C=(L=(w=p.measured)==null?void 0:w.height)!=null?L:0;g=g.map(h=>{if(h.id===p.id){let N=u?l-oe.HEADER_WIDTH:l,k=_(v({},h),{width:N,measured:_(v({},h.measured),{width:N}),position:_(v({},h.position),{y:c})});return T&&u&&(k.height=d-c),k}return h}),c+=C}),g=g.map(p=>{if(p.id===b){let m=u?l:l+oe.HEADER_WIDTH;return _(v({},p),{width:m,height:u?d:c,measured:{width:m,height:u?d:c}})}return p}),i(g)};return(0,Gn.jsx)(uo.NodeResizer,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};var Eo=require("@xyflow/react"),_e=require("lecom-ui");var fo=require("@xyflow/react"),z=require("lecom-ui"),Hn=require("lucide-react");var ne=require("react/jsx-runtime"),Bn=({nodeId:e})=>{let{t}=(0,z.useTranslation)(),{updateNodeData:o}=(0,fo.useReactFlow)(),r=(0,fo.useNodesData)(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return(0,ne.jsxs)(z.DropdownMenu,{children:[(0,ne.jsxs)(z.Tooltip,{children:[(0,ne.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,ne.jsx)(z.DropdownMenuTrigger,{asChild:!0,children:(0,ne.jsx)(z.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ne.jsx)(Hn.WrenchIcon,{})})})}),(0,ne.jsx)(z.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ne.jsxs)(z.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ne.jsx)(z.DropdownMenuLabel,{className:"flex items-center",children:(0,ne.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,ne.jsx)(z.DropdownMenuGroup,{children:Object.entries(qt).map(([a,i])=>(0,ne.jsxs)(z.DropdownMenuItem,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,ne.jsx)(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var go=require("@xyflow/react"),G=require("lecom-ui"),zn=require("lucide-react");var q=require("react/jsx-runtime"),Fn=({nodeId:e})=>{let{t}=(0,G.useTranslation)(),{updateNodeData:o}=(0,go.useReactFlow)(),r=(0,go.useNodesData)(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return(0,q.jsxs)(G.DropdownMenu,{children:[(0,q.jsxs)(G.Tooltip,{children:[(0,q.jsx)(G.TooltipTrigger,{asChild:!0,children:(0,q.jsx)(G.DropdownMenuTrigger,{asChild:!0,children:(0,q.jsx)(G.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,q.jsx)(zn.WrenchIcon,{})})})}),(0,q.jsx)(G.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,q.jsxs)(G.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,q.jsxs)(G.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,q.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,q.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Xt).map(([i,s])=>(0,q.jsx)(G.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:(0,q.jsx)(s.icon,{className:"stroke-inherit"})},i))})]}),(0,q.jsx)(G.DropdownMenuGroup,{children:Object.entries($t).map(([i,s])=>(0,q.jsxs)(G.DropdownMenuItem,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,q.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};var de=require("react/jsx-runtime"),ce=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var f;let{t:n}=(0,_e.useTranslation)(),{setDraggableNode:a}=ct(),i=({event:g,type:u,variant:b})=>{a({type:u,variant:b}),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:yt,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:tt,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:yt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ut,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(oo,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Fn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Bn,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return(0,de.jsx)(Eo.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:Eo.Position.Right,align:"start",isVisible:r,children:(f=d[t])==null?void 0:f.map((g,u)=>g.component?(0,de.jsx)("div",{children:g.component},u):(0,de.jsxs)(_e.Tooltip,{children:[(0,de.jsx)(_e.TooltipTrigger,{asChild:!0,children:(0,de.jsx)(_e.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:b=>i({event:b,type:g.type,variant:g.variant}),children:g.icon&&(0,de.jsx)(g.icon,{size:16})})}),(0,de.jsx)(_e.TooltipContent,{color:"black",children:g.label})]},u))})};var we=require("react/jsx-runtime"),Un=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,bo.useReactFlow)(),{isMultipleSelection:a}=$(),i=s=>{n(e,{label:s})};return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)("div",{className:A("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,we.jsx)(Q,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),(0,we.jsx)(ce,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),(0,we.jsx)(gt,{isVisible:!r&&!a&&o,minWidth:Qt.MIN_WIDTH,minHeight:Qt.MIN_HEIGHT}),(0,we.jsx)(X,{type:"target",position:bo.Position.Left})]})};var Rt=require("@xyflow/react"),Wn=require("react");var fe=require("react/jsx-runtime"),Yn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Rt.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Wn.useState)(!1),l=g=>{n(e,{label:g})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,fe.jsx)(tt,{className:A("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,fe.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,fe.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,fe.jsx)(ce,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),(0,fe.jsx)(X,{type:"source",position:Rt.Position.Right}),(0,fe.jsx)(X,{type:"target",position:Rt.Position.Left})]})};var Mt=require("@xyflow/react"),Kn=require("react");var ge=require("react/jsx-runtime"),Zn=({id:e,data:t,selected:o,dragging:r})=>{let n=qt[t.variant].icon,{updateNodeData:a}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=$(),[s,l]=(0,Kn.useState)(!1),d=u=>{a(e,{label:u})};return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,ge.jsx)(n,{className:A("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,ge.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ge.jsx)(Q,{value:t.label,isEditing:s,onChange:d})})]}),(0,ge.jsx)(ce,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),(0,ge.jsx)(X,{type:"target",position:Mt.Position.Left}),(0,ge.jsx)(X,{type:"source",position:Mt.Position.Right})]})};var ho=require("@xyflow/react"),$n=require("react");var Ee=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,ho.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,$n.useState)(!1),l=g=>{n(e,{label:g})};return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,Ee.jsx)(Zt,{className:A("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,Ee.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ee.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,Ee.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,Ee.jsx)(X,{type:"source",position:ho.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=$(),i=u=>{n(e,{label:u})},s=t.variant?$t[t.variant].icon:null,l=t.attribute?Xt[t.attribute].icon:null,d=t.variant==="SUBPROCESS",f=s&&!d,g=l||d;return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:A("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,ee.jsx)(Q,{value:t.label,className:A("m-1",{"py-6":f||g}),onChange:i}),s&&(0,ee.jsx)("div",{className:A("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:(0,ee.jsx)(s,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})}),l&&(0,ee.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ee.jsx)("div",{className:A("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:(0,ee.jsx)(l,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,ee.jsx)(ce,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),(0,ee.jsx)(gt,{isVisible:!r&&!a&&o,minWidth:jt.MIN_WIDTH,minHeight:jt.MIN_HEIGHT}),(0,ee.jsx)(X,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(X,{type:"target",position:Vt.Position.Left})]})};var Ho=require("@xyflow/react");var Se=require("react/jsx-runtime"),jn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=$();return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.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,Se.jsx)(ce,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Se.jsx)(X,{type:"source",position:Ho.Position.Right}),(0,Se.jsx)(X,{type:"target",position:Ho.Position.Left})]})};var vo=require("@xyflow/react"),Jn=require("lodash"),Bo=require("react");var ue=require("react/jsx-runtime"),Qn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,vo.useReactFlow)(),{isMultipleSelection:s}=$(),l=i(),d=!n,f=(0,Bo.useMemo)(()=>(0,Jn.orderBy)([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),g=d?Jt.MIN_WIDTH:oe.MIN_WIDTH,u=(0,Bo.useMemo)(()=>{if(d&&f.length>1){let E=[...f];return E.pop(),E.reduce((c,p)=>{var m,T;return c+((T=(m=p.measured)==null?void 0:m.height)!=null?T:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[d,f]),b=E=>{a(e,{label:E})};return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("div",{className:A("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,ue.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,ue.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,ue.jsx)(Q,{value:t.label,className:"w-full h-full",onChange:b})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),(0,ue.jsx)(gt,{nodeId:e,minWidth:g,minHeight:u,isVisible:!r&&!s&&o}),d&&(0,ue.jsx)(X,{type:"source",position:vo.Position.Right})]})};var ea={START_EVENT:Xn,END_EVENT:Yn,TASK:qn,GATEWAY:Zn,ANNOTATION:Un,LANE:Qn,UNSUPPORTED:jn},ta={SEQUENCE_EDGE:Tr,MESSAGE_EDGE:zr,ANNOTATION_EDGE:Nr},oa="#fafafa",ra="#bebebe",na=1,aa=10,ia="bottom-left",sa=.5,la=4,da={x:0,y:0,zoom:.75};var ca=require("@xyflow/react"),No=require("react"),ma=require("react/jsx-runtime"),hi=e=>({width:e.width,height:e.height,transform:e.transform}),pa=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,ca.useStore)(hi),s=(0,No.useRef)(null);return(0,No.useEffect)(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let f=window.devicePixelRatio;l.width=n*f,l.height=a*f,d.scale(f,f),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),(0,ma.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var U=require("lecom-ui"),ae=require("react/jsx-runtime"),ua=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,U.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(f=>f.filter(g=>!l.some(u=>u.id===g.id))),d!=null&&d.length&&r(f=>f.filter(g=>!d.some(u=>u.id===g.id))),t(null)},s=()=>{t(null)};return(0,ae.jsx)(U.Dialog,{open:a,onOpenChange:s,children:(0,ae.jsxs)(U.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ae.jsx)(U.DialogHeader,{children:(0,ae.jsx)(U.DialogTitle,{children:(0,ae.jsx)(U.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),(0,ae.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ae.jsx)("div",{className:"py-2",children:(0,ae.jsx)(U.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ae.jsx)(U.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ae.jsxs)(U.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ae.jsx)(U.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ae.jsx)(U.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ae.jsx)(U.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};var Ce=require("lecom-ui");var Be=require("react/jsx-runtime"),fa=()=>{let{t:e}=(0,Ce.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:Zt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:yt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:nr,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:rr,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:or,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Yt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Wt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:er,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ut,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return(0,Be.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:o.map((n,a)=>(0,Be.jsxs)(Ce.Tooltip,{children:[(0,Be.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,Be.jsx)(Ce.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:(0,Be.jsx)(n.icon,{})},a)}),(0,Be.jsx)(Ce.TooltipContent,{color:"black",side:"right",children:n.label})]},a))})};var yo=require("lecom-ui"),Et=require("lucide-react"),To=require("react"),te=require("react/jsx-runtime"),ga=({validationResult:e,onClose:t})=>{let{t:o}=(0,yo.useTranslation)(),[r,n]=(0,To.useState)(!1);if((0,To.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return(0,te.jsxs)("div",{className:A("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,te.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,te.jsx)("div",{className:"flex-shrink-0",children:a?(0,te.jsx)(Et.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,te.jsx)(Et.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,te.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,te.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,te.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,te.jsx)(yo.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:(0,te.jsx)(Et.XIcon,{})})]}),(0,te.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,te.jsx)("p",{children:o("validation.success.message")}):(0,te.jsx)("div",{className:"list-disc list-inside",children:i.map(s=>(0,te.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var K=require("react/jsx-runtime"),vi=[],Ni=({mode:e="edit"})=>{let t=(0,be.useRef)(!1),[o,r]=(0,W.useNodesState)([]),[n,a]=(0,W.useEdgesState)([]),[i,s]=(0,be.useState)(null),{isMoveTool:l,isHandTool:d,isReadOnly:f,setIsReadOnly:g,setIsMultipleSelection:u,isMinimapOpen:b}=$(),{validationResult:E,handleValidationComplete:y,clearValidation:c,isAutoValidationEnabled:p,validateDiagram:m}=Rr(),{getNode:T,getNodes:C,getEdges:w}=(0,W.useReactFlow)(),{onNodeDrag:L,onDrop:h,onDragOver:N,onNodeDragStop:k}=Ur({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:S}=xr({setEdges:a});Gr();let{createDiagram:I}=Jr(),{undo:j,redo:ie,saveHistory:Z,canUndo:Qe,canRedo:ze}=rn(),{helperLineHorizontal:Fe,helperLineVertical:_a,customApplyNodeChanges:wa}=Kr();Qr({LIA_CREATE_DIAGRAM:I,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,be.useEffect)(()=>{g(e==="readonly")},[e,g]);let Ca=()=>{c()},Ia=(0,be.useCallback)(({nodes:J,edges:F})=>{let bt=J.length+F.length>1;u(bt)},[u]);(0,W.useOnSelectionChange)({onChange:Ia});let Aa=J=>{let F=T(J.id);if(F!=null&&F.parentId&&(F==null?void 0:F.type)==="LANE"){let bt=Ye(F.parentId,o.filter(Ko=>Ko.id!==F.id&&Ko.type==="LANE"));r(ke(bt))}},ka=J=>{J.forEach(F=>{switch(F.type){case"remove":Aa(F);break}})},La=(0,be.useCallback)(()=>{if(!p){t.current=!1;return}let J=C(),F=w(),bt=m({nodes:J,edges:F});y(bt),t.current=!1},[p,C,w,m,y]),Wo=(0,ba.useDebouncedCallback)(La,300),Yo=(0,be.useCallback)(()=>{p&&!t.current&&(t.current=!0,Wo())},[p,Wo]),Sa=J=>{r(F=>wa(J,F)),Z(J),Yo(),ka(J)},Pa=J=>{a(F=>(0,W.applyEdgeChanges)(J,F)),Z(J),Yo()},Da=()=>{Z("forceSave")},Ra=async({nodes:J,edges:F})=>(s({nodes:J,edges:F}),!1),Ma={nodes:o,edges:n};return(0,K.jsxs)("div",{className:"w-full h-full",children:[!f&&(0,K.jsx)(fa,{}),(0,K.jsx)(nn,{}),(0,K.jsxs)(W.ReactFlow,{edges:n,nodes:o,nodeTypes:ea,edgeTypes:ta,minZoom:sa,maxZoom:la,panOnDrag:d||f?!0:vi,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&l,nodesConnectable:!f&&l,nodesDraggable:!f&&l,isValidConnection:x,connectionLineComponent:Fr,onConnect:S,onDrop:h,onDropCapture:Da,onDragOver:N,onNodesChange:Sa,onEdgesChange:Pa,onNodeDrag:L,onNodeDragStop:k,onBeforeDelete:Ra,selectionMode:W.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:da,connectOnClick:!1,children:[b&&(0,K.jsx)(W.MiniMap,{pannable:!0,zoomable:!0,position:ia,className:"shadow-md rounded-md"}),(0,K.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&(0,K.jsx)(Pn,{canUndo:Qe,canRedo:ze,undo:j,redo:ie}),(0,K.jsx)(Sn,{nodes:o,isReadOnly:f,diagram:Ma,onValidationComplete:y,onValidateDiagram:m}),(0,K.jsx)(Rn,{})]}),(0,K.jsx)(pa,{horizontal:Fe,vertical:_a}),(0,K.jsx)(W.Background,{gap:aa,size:na,color:ra,bgColor:oa}),E&&(0,K.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,K.jsx)(ga,{validationResult:E,onClose:Ca})})]}),(0,K.jsx)(ua,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},yi=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>((0,be.useEffect)(()=>{t&&Ea.i18n.changeLanguage(t)},[t]),(0,K.jsx)(W.ReactFlowProvider,{children:(0,K.jsx)(gr,{value:{onConfigureElement:o},children:(0,K.jsx)(Ni,{mode:e})})})),zo=yi;var Fo=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 xo=require("lecom-ui");var ha={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},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"}}},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"}},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 va={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},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"}}},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"}},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 Na={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},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"}}},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"}},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 ya={pt_BR:Na,en_US:ha,es_ES:va};var Ta,xa,Ti=(xa=(Ta=Fo("LecomUserLanguage"))!=null?Ta:Fo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?xa:xo.Translations.PT_BR;(0,xo.initializeI18n)({lng:Ti,resources:ya});var Uo=require("react/jsx-runtime"),xi=e=>(0,Uo.jsx)(qo,{children:(0,Uo.jsx)(zo,v({},e))});0&&(module.exports={ActivityVariant,ElementType,GatewayVariant,Modeler,RoutingVariant});
|
package/lib/index.d.cts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var to=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var eo=(e,t,o)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))to.call(t,o)&&eo(e,o,t[o]);if(We)for(var o of We(t))oo.call(t,o)&&eo(e,o,t[o]);return e},y=(e,t)=>Fn(e,Un(t));var Ee=(e,t)=>{var o={};for(var r in e)to.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&oo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Wn,Notification as Yn}from"lecom-ui";import{jsx as Kn,jsxs as Zn}from"react/jsx-runtime";function ro({children:e}){return Zn(Wn,{children:[Kn(Yn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as hd,Background as vd,MiniMap as Nd,ReactFlow as yd,ReactFlowProvider as Td,SelectionMode as xd,useEdgesState as _d,useNodesState as wd,useOnSelectionChange as Cd,useReactFlow as Id}from"@xyflow/react";import{i18n as Ad}from"lecom-ui";import{useCallback as Zt,useEffect as yn,useRef as kd,useState as Ld}from"react";import{useDebouncedCallback as Sd}from"use-debounce";var Lt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(Lt||{}),St=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(St||{}),Pt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Pt||{});import{RotateCcw as aa,ScrollText as ia,SquarePlus as sa}from"lucide-react";import{jsx as Ye,jsxs as $n}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>$n("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as no}from"react/jsx-runtime";var be=({size:e=24,className:t})=>no("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:no("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"})});import{jsx as Ae,jsxs as Xn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Xn("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:[Ae("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"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Dt,jsxs as qn}from"react/jsx-runtime";var he=({size:e=24,className:t})=>qn("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:[Dt("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"}),Dt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Dt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt,jsxs as jn}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>jn("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:[Mt("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"}),Mt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Rt,jsxs as Jn}from"react/jsx-runtime";var ao=({size:e=24,className:t})=>Rt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:Jn("g",{children:[Rt("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"}),Rt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as Qn}from"clsx";import{twMerge as ea}from"tailwind-merge";function C(...e){return ea(Qn(e))}var ke=(e,t)=>e<t?t:e;import{jsx as io,jsxs as ta}from"react/jsx-runtime";var so=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:C("stroke-2",t),children:[io("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"}),io("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Vt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Vt("g",{children:Vt("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"})})});import{jsx as co}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>co("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:co("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"})});import{jsx as po}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>po("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:C("stroke-2",t),children:po("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"})});import{jsx as Ot,jsxs as oa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>oa("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:[Ot("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"}),Ot("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"}),Ot("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as ra}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>ra("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:[Se("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"}),Se("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"}),Se("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"}),Se("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as qe,jsxs as na}from"react/jsx-runtime";var fo=({size:e=24,className:t})=>na("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:[qe("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"}),qe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),qe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(D||{});var je={SCRIPT:{icon:ia},SUBPROCESS:{icon:sa}};var Je={LOOP:{icon:aa}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),Qe={EXCLUSIVE:{icon:he},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import bo from"@dagrejs/dagre";import{getNodesBounds as ga}from"@xyflow/react";import{orderBy as Ea}from"lodash";var la={MIN_WIDTH:36,MIN_HEIGHT:36},da={MIN_WIDTH:36,MIN_HEIGHT:36},ca={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},pa={MIN_WIDTH:128,MIN_HEIGHT:64},R={START_EVENT:la,END_EVENT:da,GATEWAY:ca,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:pa};import{orderBy as ma}from"lodash";var oe=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},re=e=>ma(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),go=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t);return{x:o-n,y:r-a}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ua=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},fa=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:d}=oe(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&fa(e,n)){let a=ua(e,n);a<r&&(r=a,o=n)}return o},Eo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var ho=(e=[],t=[],o="LR")=>{let r=new bo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),bo.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(N({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},me=(e,t)=>{var u,b;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let a=Ea(n,["position.y"]),i=Math.max((b=(u=r.measured)==null?void 0:u.width)!=null?b:0,tt.MIN_WIDTH),s=Eo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,f=0;a.forEach(E=>{var h,c,p,m;o=o.map(x=>x.id===E.id?y(N({},x),{width:l-Y.HEADER_WIDTH,measured:y(N({},x.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):x),d+=(c=(h=E.measured)==null?void 0:h.height)!=null?c:0,f+=(m=(p=E.measured)==null?void 0:p.height)!=null?m:0}),o=o.map(E=>E.id===e?y(N({},E),{height:f,width:l,measured:y(N({},E.measured),{height:f,width:l})}):E);let g=o.find(E=>E.id===e);return g!=null&&g.parentId&&(o=me(g.parentId,o)),o},vo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ba=50,No=(e,t=ba)=>{let o=ga(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as ha}from"zustand";var O=ha(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})}}));import{addEdge as So,useReactFlow as Qa}from"@xyflow/react";import{BaseEdge as Ga,EdgeLabelRenderer as Ha,getStraightPath as Ba,useNodes as za,useViewport as Fa}from"@xyflow/react";import{getIncomers as Gt,getOutgoers as _o,useReactFlow as Ta}from"@xyflow/react";import{Button as xa,Tooltip as _a,TooltipContent as wa,TooltipTrigger as Ca,useTranslation as Ia}from"lecom-ui";import{PencilIcon as Aa}from"lucide-react";import{createContext as va,useContext as Na}from"react";var yo=va(null),To=yo.Provider,xo=()=>{let e=Na(yo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as rt,jsxs as ka}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Ia(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Ta(),{onConfigureElement:s}=xo(),l=h=>{let c=a(),p=i(),m=Gt(h,c,p),x=_o(h,c,p),_=m.some(L=>L.type==="START_EVENT"),A=x.some(L=>L.type==="END_EVENT");return _?"start":A?"end":"between"},d=h=>{var L,v,T;let c=a(),p=i(),m=r(h.source),x=r(h.target);if(!m||!x)return"simple";if(_o(m,c,p).some(k=>k.type==="END_EVENT"))return"final";if(m.type==="GATEWAY")switch((L=m.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(m.type==="TASK"){let k=(v=m.data)==null?void 0:v.variant,I=(T=m.data)==null?void 0:T.attribute;return k==="SCRIPT"?"script":I==="LOOP"?"loop":"simple"}return"simple"},f=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="COMPLEX")return;let p=a(),m=i(),x=Gt(c,p,m),_=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(_=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),_&&A)return"script_loop";if(_)return"script";if(A)return"loop"},g=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let p=a(),m=i(),x=Gt(c,p,m),_=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(_=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),_)return"script";if(A)return"loop"},u=()=>{var c,p,m,x,_;let h=r(e);h&&(h.type==="GATEWAY"?(s==null||s({id:h.id,type:"gateway",variant:((c=h.data)==null?void 0:c.variant)||"EXCLUSIVE",label:(p=h.data)==null?void 0:p.label}),console.log({id:h.id,type:"gateway",variant:((m=h.data)==null?void 0:m.variant)||"EXCLUSIVE",label:(x=h.data)==null?void 0:x.label})):s==null||s({id:h.id,type:"activity",variant:l(h),label:(_=h.data)==null?void 0:_.label}))},b=()=>{let h=n(e);if(h){let c=d(h),p;c==="complex"?p=f(h):c==="exclusive"&&(p=g(h)),s==null||s({id:h.id,type:"routing",variant:c,subVariant:p})}};return ka(_a,{children:[rt(Ca,{asChild:!0,children:rt(xa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":u();break;case"edge":b();break}},children:rt(Aa,{size:16})})}),rt(wa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as La}from"@xyflow/react";import{Button as Sa,Tooltip as Pa,TooltipContent as Da,TooltipTrigger as Ma,useTranslation as Ra}from"lecom-ui";import{TrashIcon as Va}from"lucide-react";import{jsx as at,jsxs as Oa}from"react/jsx-runtime";var it=({elementId:e,elementType:t="node"})=>{let{t:o}=Ra(),{deleteElements:r}=La();return Oa(Pa,{children:[at(Ma,{asChild:!0,children:at(Sa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:at(Va,{size:16})})}),at(Da,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as st}from"react/jsx-runtime";var Ne=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=Ee(n,["edgeId","edgeType"]);var s;let a=[{component:st(it,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:st(De,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return st("div",y(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>st("div",{children:l.component},d))}))};import{jsx as dt,jsxs as Ua}from"react/jsx-runtime";var ct={type:"ANNOTATION_EDGE",zIndex:2e3},wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=za(),{zoom:f}=Fa(),g=d.find(m=>m.id===t),u=d.find(m=>m.id===o),[b,E,h]=Ba({sourceX:r,sourceY:n,targetX:a,targetY:i}),c=s||(g==null?void 0:g.selected)||(u==null?void 0:u.selected),p=1/f;return Ua("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":c}),children:[dt(Ga,{id:e,path:b,strokeDasharray:4,className:C("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)]":c&&!(l!=null&&l.hasError)})}),dt(Ha,{children:dt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${h}px)`},children:s&&dt(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Ka,EdgeLabelRenderer as Za,getSmoothStepPath as $a,MarkerType as Ao,useNodes as Xa,useReactFlow as qa,useViewport as ja}from"@xyflow/react";import{useState as Ja}from"react";import{useEffect as Co,useRef as Wa,useState as Ya}from"react";import{jsx as Io}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Wa(null),[l,d]=Ya(!1);Co(()=>{d(r!=null?r:!1)},[r]),Co(()=>{if(l&&s.current){s.current.focus();let b=document.createRange();b.selectNodeContents(s.current),b.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(b))}},[l]);let f=b=>{b.stopPropagation(),d(!0)},g=b=>{let E=b.currentTarget.innerText;t&&E.length>=t&&b.preventDefault()},u=b=>{d(!1),n==null||n(),o==null||o(b.currentTarget.innerText)};return Io("div",{className:C("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:i,onDoubleClick:f,children:Io("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:u,children:e})})};import{jsx as pt,jsxs as ko}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Ao.ArrowClosed},markerEnd:{type:Ao.Arrow},data:{label:""}},Lo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=Xa(),{zoom:u}=ja(),{updateEdgeData:b}=qa(),[E,h]=Ja(!1),c=g.find(w=>w.id===t),p=g.find(w=>w.id===o),[m,x,_]=$a({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},I=()=>{h(!1)},S=w=>{b(e,{label:w.trim()})};return ko("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:I,onDoubleClick:k,children:[pt(Ka,{id:e,path:m,markerEnd:`url(#${L})`,className:C("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),pt(Za,{children:ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${x}px, ${_}px)`},children:[f&&pt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),v&&pt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var Po=({setEdges:e})=>{let{getNode:t}=Qa();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?So(N(N({},n),ct),a):So(N(N({},n),ie),a)})}}};import{useState as zo}from"react";import{useTranslation as ei}from"lecom-ui";import{useReactFlow as ti}from"@xyflow/react";var Me=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ue=(e=[])=>e.filter(t=>t.type==="END_EVENT"),se=(e=[])=>e.filter(t=>t.type==="TASK")||[],Do=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Mo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),mt=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Ro=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Re=(e,t=[])=>t.filter(o=>o.target===e),Vo=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Oo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Go=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Ho=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.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 Ve=[{id:"start_event_not_found",validate:e=>{let t=Me(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ue(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Me(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(a=>a.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return P({isValid:!1,nodeIds:[...new Set(a)]})}return P({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=se(e.nodes),o=Q(t,r=>X(r.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=se(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=se(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return P({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=se(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return P({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=mt(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Me(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ue(e.nodes),o=[],r=[];for(let n of t){let a=Re(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=X(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Ro(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(a=>a.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=se(e.nodes),o=Q(t,r=>!r.label||Go(r.label));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return P({isValid:!0});let t=ue(e.nodes)[0];if(!t)return P({isValid:!0});let o=Re(t.id,e.edges);if(!o.length)return P({isValid:!0});let n=se(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Vo(l.id,e));return P({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=se(e.nodes),o=ue(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Re(l.id,e.edges),f=X(l.id,e.edges),g=d.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.source))==null?void 0:E.type)==="START_EVENT"}),u=f.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.target))==null?void 0:E.type)==="END_EVENT"});return g&&u}),n=Re(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=mt(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=mt(e.nodes),o=Q(t,r=>X(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Me(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Do(e.nodes),o=Q(t,r=>!Oo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Mo(e.nodes),o=Q(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Bo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Fo=()=>{let{t:e}=ei(),[t,o]=zo(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ti(),[s,l]=zo(!1);return{validationResult:t,validateDiagram:u=>{let b=Ho(u.nodes,u.edges),E=Bo(b),h=E.errors.map(c=>y(N({},c),{message:e(`validation.errors.${c.id}`)}));return s||l(!0),{isValid:E.isValid,errors:h}},handleValidationComplete:u=>{if(o(u),!u)return;let b=[],E=[];u.errors.forEach(v=>{v.nodeIds&&v.nodeIds.length>0&&v.nodeIds.forEach(T=>b.push(T)),v.edgeIds&&v.edgeIds.length>0&&v.edgeIds.forEach(T=>E.push(T))});let h=[...new Set(b)];r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})}))),n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})})));let c=a(),p=i(),m=new Set(h),x=new Set;u.errors.forEach(v=>{var I,S;let T=Ve.find(w=>w.id===v.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((I=v.edgeIds)==null||I.forEach(w=>x.add(w)),(S=v.nodeIds)==null||S.forEach(w=>{p.forEach(z=>{(z.source===w||z.target===w)&&x.add(z.id)})}))});let _=new Set,A=new Set,L=new Set;c.forEach(v=>{v.type==="START_EVENT"?_.add(v.id):v.type==="END_EVENT"&&A.add(v.id)}),p.forEach(v=>{_.has(v.source)&&L.add(v.target),A.has(v.target)&&L.add(v.source)}),L.forEach(v=>{var T,k;if(m.has(v)){let I=(T=u.errors.find(w=>{var z;return(z=w.nodeIds)==null?void 0:z.includes(v)}))==null?void 0:T.id;((k=Ve.find(w=>w.id===I))==null?void 0:k.highlightRelatedEdges)!==!1&&p.forEach(w=>{w.source===v&&A.has(w.target)&&(m.add(w.target),x.add(w.id)),w.target===v&&_.has(w.source)&&(m.add(w.source),x.add(w.id))})}}),m.size>0&&r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:m.has(T.id)})}))),x.size>0&&n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:x.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})}))),n(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as oi}from"@xyflow/react";import{useEffect as ri}from"react";import{v7 as Uo}from"uuid";var ni=15,Wo="bpmn:selection",Yo=({offset:e=ni}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=oi();ri(()=>{let a=s=>{var b;s.preventDefault();let l=t(),d=r(),f=l.filter(E=>E.selected);if(!f.length)return;let g=d.filter(E=>f.some(h=>h.id===E.source)&&f.some(h=>h.id===E.target)),u={nodes:f,edges:g};(b=s.clipboardData)==null||b.setData(Wo,JSON.stringify(u))},i=s=>{var u,b;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Wo))||"{}");if(!((b=l.nodes)!=null&&b.length))return;let d=new Map,f=l.nodes.map(E=>{let h=Uo();return d.set(E.id,h),y(N({},E),{id:h,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),g=l.edges.map(E=>y(N({},E),{id:Uo(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(h=>y(N({},h),{selected:!1})),...f]),n(E=>[...E.map(h=>y(N({},h),{selected:!1})),...g])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};import{useReactFlow as gi,useStoreApi as Ei}from"@xyflow/react";import{v7 as qo}from"uuid";import{create as ai}from"zustand";var ye=ai(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ii,EdgeLabelRenderer as si,getSmoothStepPath as li,MarkerType as di,useNodes as ci,useReactFlow as pi,useViewport as mi}from"@xyflow/react";import{useState as ui}from"react";import{jsx as ut,jsxs as Ko}from"react/jsx-runtime";var Vm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:di.Arrow},data:{label:""}},Zo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=ci(),{zoom:u}=mi(),{updateEdgeData:b}=pi(),[E,h]=ui(!1),c=g.find(w=>w.id===t),p=g.find(w=>w.id===o),[m,x,_]=li({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},I=()=>{h(!1)},S=w=>{b(e,{label:w.trim()})};return Ko("g",{className:C("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:I,onDoubleClick:k,children:[ut(ii,{id:e,path:m,markerEnd:`url(#${L})`,strokeDasharray:4,className:C("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),ut(si,{children:Ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${x}px, ${_}px)`},children:[f&&ut(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),v&&ut(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};import{jsx as $o,jsxs as fi}from"react/jsx-runtime";var Xo=({fromX:e,fromY:t,toX:o,toY:r})=>fi("g",{children:[$o("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),$o("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var jo=({nodes:e,setNodes:t,setEdges:o})=>{let r=Ei(),{draggableNode:n,setDraggableNode:a}=ye(),{getInternalNode:i,screenToFlowPosition:s}=gi(),l=c=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(m=>m.map(x=>y(N({},x),{className:x.id===c?p:""})))},d=()=>{let{nodeLookup:c}=r.getState();return Array.from(c.values())},f=c=>{let p=i(c.id),m=d();if(c.type==="LANE"){if(ve({parentId:c.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=m.filter(S=>S.id!==c.id&&S.type==="LANE"&&!S.parentId),k=Pe(p,T);if(!k){l();return}if(ve({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let _=m.filter(v=>v.id!==c.id&&v.type==="LANE"),A=Pe(p,_);if(!A){l();return}if(ve({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},g=c=>{c.preventDefault(),c.dataTransfer.dropEffect="move"},u=(c,p)=>{c.preventDefault(),f(p)},b=(c,p,m)=>{var T,k;let x=I=>I.map(S=>y(N({},S),{className:void 0}));if(c.parentId===p.id){let I=me(p.id,m);t(re(x(I)));return}if(c.type==="LANE"){if(ve({parentId:p.id,nodes:m,excludeTypes:["LANE"]}))return;let w=m.filter(V=>V.parentId===p.id).reduce((V,ge)=>{var ce,pe;return V+((pe=(ce=ge.measured)==null?void 0:ce.height)!=null?pe:0)},0),z={x:Y.HEADER_WIDTH,y:w},K=m.map(V=>V.id===c.id?y(N({},V),{parentId:p.id,position:z,className:void 0}):y(N({},V),{className:void 0}));K=me(p.id,K),t(re(K));return}if(ve({parentId:p.id,nodes:m,includeTypes:["LANE"]})){let I;if(c.parentId){let w=i(c.parentId),{x:z,y:K}=oe(w);I={x:z+((T=c.position.x)!=null?T:0),y:K+((k=c.position.y)!=null?k:0)}}let S=m.map(w=>w.id===c.id?y(N({},w),{position:I!=null?I:w.position,parentId:void 0,className:void 0}):y(N({},w),{className:void 0}));t(re(S));return}let L=go(c,p),v=m.map(I=>I.id===c.id?y(N({},I),{parentId:p.id,position:L,className:void 0}):y(N({},I),{className:void 0}));t(re(v))};return{onDragOver:g,onDrop:c=>{if(c.preventDefault(),!(n!=null&&n.type))return;let p=s({x:c.clientX,y:c.clientY}),m={width:R[n.type].MIN_WIDTH,height:R[n.type].MIN_HEIGHT},x={id:qo(),type:n.type,position:p,measured:m,data:{label:"",variant:n.variant,attribute:n.attribute}},_=y(N({},x),{internals:{positionAbsolute:p}}),A=d(),L=n.type==="LANE",v=A.filter(I=>L?I.type==="LANE"&&!I.parentId:I.type==="LANE"),T=Pe(_,v);T?b(_,T,[...A,_]):t(I=>{let S=I.concat(x);return re(S)});let k=c.dataTransfer.getData("sourceId");if(k){let I={id:qo(),source:k,target:x.id};if(n.type==="ANNOTATION"){o(S=>S.concat(N(N({},I),ct)));return}o(S=>S.concat(N(N({},I),ie)))}a(null)},onNodeDrag:u,onNodeDragStop:async(c,p)=>{var T,k;let{nodeLookup:m}=r.getState(),x=i(p.id),_=Array.from(m.values()),A=p.type==="LANE",L=_.filter(I=>I.id!==p.id&&(A?I.type==="LANE"&&!I.parentId:I.type==="LANE")),v=Pe(x,L);if(v){b(x,v,_);return}if(p.parentId){let I=i(p.parentId),{x:S,y:w}=oe(I),z={x:S+((T=p.position.x)!=null?T:0),y:w+((k=p.position.y)!=null?k:0)},K=e.map(V=>V.id===p.id?y(N({},V),{position:z,parentId:void 0}):V);K=me(p.parentId,K),t(re(K))}}}};import{applyNodeChanges as bi}from"@xyflow/react";import{useCallback as hi,useState as Qo}from"react";function Jo(e,t,o=5){var l,d,f,g,u,b,E,h;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(c=>c.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((g=(f=n.measured)==null?void 0:f.height)!=null?g:0),width:(b=(u=n.measured)==null?void 0:u.width)!=null?b:0,height:(h=(E=n.measured)==null?void 0:E.height)!=null?h:0},i=o,s=o;return t.filter(c=>c.id!==n.id).reduce((c,p)=>{var S,w,z,K,V,ge,ce,pe;let m={left:p.position.x,right:p.position.x+((w=(S=p.measured)==null?void 0:S.width)!=null?w:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(ge=(V=p.measured)==null?void 0:V.width)!=null?ge:0,height:(pe=(ce=p.measured)==null?void 0:ce.height)!=null?pe:0},x=Math.abs(a.left-m.left);x<s&&(c.snapPosition.x=m.left,c.vertical=m.left,s=x);let _=Math.abs(a.right-m.right);_<s&&(c.snapPosition.x=m.right-a.width,c.vertical=m.right,s=_);let A=Math.abs(a.left-m.right);A<s&&(c.snapPosition.x=m.right,c.vertical=m.right,s=A);let L=Math.abs(a.right-m.left);L<s&&(c.snapPosition.x=m.left-a.width,c.vertical=m.left,s=L);let v=Math.abs(a.top-m.top);v<i&&(c.snapPosition.y=m.top,c.horizontal=m.top,i=v);let T=Math.abs(a.bottom-m.top);T<i&&(c.snapPosition.y=m.top-a.height,c.horizontal=m.top,i=T);let k=Math.abs(a.bottom-m.bottom);k<i&&(c.snapPosition.y=m.bottom-a.height,c.horizontal=m.bottom,i=k);let I=Math.abs(a.top-m.bottom);return I<i&&(c.snapPosition.y=m.bottom,c.horizontal=m.bottom,i=I),c},r)}var er=()=>{let[e,t]=Qo(void 0),[o,r]=Qo(void 0),n=hi((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Jo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return bi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ni}from"@xyflow/react";import{v7 as ar}from"uuid";var or={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},rr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},tr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},vi=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
-
`),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=tr(a[0],o),s=tr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},nr=e=>{let{components:t,connections:o}=vi(e);return{nodes:t,edges:o}};var ir=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ni();return{createDiagram:n=>{let{nodes:a,edges:i}=nr(n),s=[],l=new Map;for(let[u,b]of Object.entries(a)){let E=ar(),
|
|
3
|
-
`),a=encodeURI(n);
|
|
4
|
-
`,"
");function gr(e,t=Pi){if(e)return JSON.parse(Si(e,
|
|
1
|
+
var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var to=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var eo=(e,t,o)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))to.call(t,o)&&eo(e,o,t[o]);if(We)for(var o of We(t))oo.call(t,o)&&eo(e,o,t[o]);return e},_=(e,t)=>Fn(e,Un(t));var Ee=(e,t)=>{var o={};for(var r in e)to.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&oo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Wn,Notification as Yn}from"lecom-ui";import{jsx as Kn,jsxs as Zn}from"react/jsx-runtime";function ro({children:e}){return Zn(Wn,{children:[Kn(Yn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as hd,Background as vd,MiniMap as Nd,ReactFlow as yd,ReactFlowProvider as Td,SelectionMode as xd,useEdgesState as _d,useNodesState as wd,useOnSelectionChange as Cd,useReactFlow as Id}from"@xyflow/react";import{i18n as Ad}from"lecom-ui";import{useCallback as Zt,useEffect as yn,useRef as kd,useState as Ld}from"react";import{useDebouncedCallback as Sd}from"use-debounce";var St=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(St||{}),Pt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Pt||{}),Dt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Dt||{});import{RotateCcw as aa,ScrollText as ia,SquarePlus as sa}from"lucide-react";import{jsx as Ye,jsxs as $n}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>$n("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as no}from"react/jsx-runtime";var be=({size:e=24,className:t})=>no("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:no("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"})});import{jsx as Ae,jsxs as Xn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Xn("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:[Ae("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"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Rt,jsxs as qn}from"react/jsx-runtime";var he=({size:e=24,className:t})=>qn("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:[Rt("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"}),Rt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Rt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt,jsxs as jn}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>jn("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:[Mt("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"}),Mt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt,jsxs as Jn}from"react/jsx-runtime";var ao=({size:e=24,className:t})=>Vt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:Jn("g",{children:[Vt("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"}),Vt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as Qn}from"clsx";import{twMerge as ea}from"tailwind-merge";function A(...e){return ea(Qn(e))}var ke=(e,t)=>e<t?t:e;import{jsx as io,jsxs as ta}from"react/jsx-runtime";var so=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:A("stroke-2",t),children:[io("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"}),io("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Ot("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ot("g",{children:Ot("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"})})});import{jsx as co}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>co("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:co("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"})});import{jsx as po}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>po("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:A("stroke-2",t),children:po("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"})});import{jsx as Gt,jsxs as oa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>oa("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:[Gt("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"}),Gt("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"}),Gt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as ra}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>ra("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:[Se("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"}),Se("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"}),Se("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"}),Se("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as qe,jsxs as na}from"react/jsx-runtime";var fo=({size:e=24,className:t})=>na("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:[qe("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"}),qe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),qe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(D||{});var je={SCRIPT:{icon:ia},SUBPROCESS:{icon:sa}};var Je={LOOP:{icon:aa}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),Qe={EXCLUSIVE:{icon:he},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import bo from"@dagrejs/dagre";import{getNodesBounds as ga}from"@xyflow/react";import{orderBy as Ea}from"lodash";var la={MIN_WIDTH:36,MIN_HEIGHT:36},da={MIN_WIDTH:36,MIN_HEIGHT:36},ca={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},pa={MIN_WIDTH:128,MIN_HEIGHT:64},M={START_EVENT:la,END_EVENT:da,GATEWAY:ca,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:pa};import{orderBy as ma}from"lodash";var oe=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},re=e=>ma(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),go=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t);return{x:o-n,y:r-a}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ua=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},fa=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:d}=oe(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&fa(e,n)){let a=ua(e,n);a<r&&(r=a,o=n)}return o},Eo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var ho=(e=[],t=[],o="LR")=>{let r=new bo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),bo.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return _(v({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},me=(e,t)=>{var u,b;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let a=Ea(n,["position.y"]),i=Math.max((b=(u=r.measured)==null?void 0:u.width)!=null?b:0,tt.MIN_WIDTH),s=Eo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,f=0;a.forEach(E=>{var y,c,p,m;o=o.map(T=>T.id===E.id?_(v({},T),{width:l-Y.HEADER_WIDTH,measured:_(v({},T.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):T),d+=(c=(y=E.measured)==null?void 0:y.height)!=null?c:0,f+=(m=(p=E.measured)==null?void 0:p.height)!=null?m:0}),o=o.map(E=>E.id===e?_(v({},E),{height:f,width:l,measured:_(v({},E.measured),{height:f,width:l})}):E);let g=o.find(E=>E.id===e);return g!=null&&g.parentId&&(o=me(g.parentId,o)),o},vo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ba=50,No=(e,t=ba)=>{let o=ga(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as ha}from"zustand";var O=ha(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})}}));import{addEdge as So,useReactFlow as Qa}from"@xyflow/react";import{BaseEdge as Ga,EdgeLabelRenderer as Ha,getStraightPath as Ba,useNodes as za,useViewport as Fa}from"@xyflow/react";import{getIncomers as rt,getOutgoers as _o,useReactFlow as Ta}from"@xyflow/react";import{Button as xa,Tooltip as _a,TooltipContent as wa,TooltipTrigger as Ca,useTranslation as Ia}from"lecom-ui";import{PencilIcon as Aa}from"lucide-react";import{createContext as va,useContext as Na}from"react";var yo=va(null),To=yo.Provider,xo=()=>{let e=Na(yo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as ka}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Ia(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Ta(),{onConfigureElement:s}=xo(),l=c=>{let p=a(),m=i(),T=rt(c,p,m),C=_o(c,p,m),w=T.some(h=>h.type==="START_EVENT"),L=C.some(h=>h.type==="END_EVENT");return w?"start":L?"end":"between"},d=c=>{var h,N,k;let p=a(),m=i(),T=r(c.source),C=r(c.target);if(!T||!C)return"simple";if(_o(T,p,m).some(x=>x.type==="END_EVENT"))return"final";if(T.type==="GATEWAY")switch((h=T.data)==null?void 0:h.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(T.type==="TASK"){let x=(N=T.data)==null?void 0:N.variant,S=(k=T.data)==null?void 0:k.attribute;return x==="SCRIPT"?"script":S==="LOOP"?"loop":"simple"}return"simple"},f=c=>{var h;let p=r(c.source);if(!p||p.type!=="GATEWAY"||((h=p.data)==null?void 0:h.variant)!=="COMPLEX")return;let m=a(),T=i(),C=rt(p,m,T),w=!1,L=!1;if(C.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(w=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(L=!0))}),w&&L)return"script_loop";if(w)return"script";if(L)return"loop"},g=c=>{var h;let p=r(c.source);if(!p||p.type!=="GATEWAY"||((h=p.data)==null?void 0:h.variant)!=="EXCLUSIVE")return;let m=a(),T=i(),C=rt(p,m,T),w=!1,L=!1;if(C.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(w=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(L=!0))}),w)return"script";if(L)return"loop"},u=c=>{var L,h;if(c.type!=="GATEWAY")return;let p=a(),m=i(),T=rt(c,p,m),C=!1,w=!1;if(T.forEach(N=>{var k,x;N.type==="TASK"&&(((k=N.data)==null?void 0:k.variant)==="SCRIPT"&&(C=!0),((x=N.data)==null?void 0:x.attribute)==="LOOP"&&(w=!0))}),((L=c.data)==null?void 0:L.variant)==="COMPLEX"){if(C&&w)return"script_loop";if(C)return"script";if(w)return"loop"}else if(((h=c.data)==null?void 0:h.variant)==="EXCLUSIVE"){if(C)return"script";if(w)return"loop"}},b=()=>{var p,m,T,C,w;let c=r(e);c&&(c.type==="GATEWAY"?(s==null||s({id:c.id,type:"gateway",variant:((p=c.data)==null?void 0:p.variant)||"EXCLUSIVE",label:(m=c.data)==null?void 0:m.label,subVariant:u(c)}),console.log({id:c.id,type:"gateway",variant:((T=c.data)==null?void 0:T.variant)||"EXCLUSIVE",label:(C=c.data)==null?void 0:C.label,subVariant:u(c)})):s==null||s({id:c.id,type:"activity",variant:l(c),label:(w=c.data)==null?void 0:w.label}))},E=()=>{let c=n(e);if(c){let p=d(c),m;p==="complex"?m=f(c):p==="exclusive"&&(m=g(c)),s==null||s({id:c.id,type:"routing",variant:p,subVariant:m})}};return ka(_a,{children:[nt(Ca,{asChild:!0,children:nt(xa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":b();break;case"edge":E();break}},children:nt(Aa,{size:16})})}),nt(wa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as La}from"@xyflow/react";import{Button as Sa,Tooltip as Pa,TooltipContent as Da,TooltipTrigger as Ra,useTranslation as Ma}from"lecom-ui";import{TrashIcon as Va}from"lucide-react";import{jsx as it,jsxs as Oa}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Ma(),{deleteElements:r}=La();return Oa(Pa,{children:[it(Ra,{asChild:!0,children:it(Sa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Va,{size:16})})}),it(Da,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as lt}from"react/jsx-runtime";var Ne=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=Ee(n,["edgeId","edgeType"]);var s;let a=[{component:lt(st,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:lt(De,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return lt("div",_(v({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>lt("div",{children:l.component},d))}))};import{jsx as ct,jsxs as Ua}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=za(),{zoom:f}=Fa(),g=d.find(m=>m.id===t),u=d.find(m=>m.id===o),[b,E,y]=Ba({sourceX:r,sourceY:n,targetX:a,targetY:i}),c=s||(g==null?void 0:g.selected)||(u==null?void 0:u.selected),p=1/f;return Ua("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":c}),children:[ct(Ga,{id:e,path:b,strokeDasharray:4,className:A("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)]":c&&!(l!=null&&l.hasError)})}),ct(Ha,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${y}px)`},children:s&&ct(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Ka,EdgeLabelRenderer as Za,getSmoothStepPath as $a,MarkerType as Ao,useNodes as Xa,useReactFlow as qa,useViewport as ja}from"@xyflow/react";import{useState as Ja}from"react";import{useEffect as Co,useRef as Wa,useState as Ya}from"react";import{jsx as Io}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Wa(null),[l,d]=Ya(!1);Co(()=>{d(r!=null?r:!1)},[r]),Co(()=>{if(l&&s.current){s.current.focus();let b=document.createRange();b.selectNodeContents(s.current),b.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(b))}},[l]);let f=b=>{b.stopPropagation(),d(!0)},g=b=>{let E=b.currentTarget.innerText;t&&E.length>=t&&b.preventDefault()},u=b=>{d(!1),n==null||n(),o==null||o(b.currentTarget.innerText)};return Io("div",{className:A("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:i,onDoubleClick:f,children:Io("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:u,children:e})})};import{jsx as mt,jsxs as ko}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Ao.ArrowClosed},markerEnd:{type:Ao.Arrow},data:{label:""}},Lo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=Xa(),{zoom:u}=ja(),{updateEdgeData:b}=qa(),[E,y]=Ja(!1),c=g.find(I=>I.id===t),p=g.find(I=>I.id===o),[m,T,C]=$a({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),w=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=w?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,N=1/u,k=()=>{y(!0)},x=()=>{y(!1)},S=I=>{b(e,{label:I.trim()})};return ko("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":w}),onBlur:x,onDoubleClick:k,children:[mt(Ka,{id:e,path:m,markerEnd:`url(#${L})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":w&&!(d!=null&&d.hasError)})}),mt(Za,{children:ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${C}px)`},children:[f&&mt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${N})`}}),h&&mt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var Po=({setEdges:e})=>{let{getNode:t}=Qa();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?So(v(v({},n),pt),a):So(v(v({},n),ie),a)})}}};import{useState as zo}from"react";import{useTranslation as ei}from"lecom-ui";import{useReactFlow as ti}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ue=(e=[])=>e.filter(t=>t.type==="END_EVENT"),se=(e=[])=>e.filter(t=>t.type==="TASK")||[],Do=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ro=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Mo=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Vo=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Oo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Go=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Ho=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.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 Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ue(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Re(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(a=>a.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return P({isValid:!1,nodeIds:[...new Set(a)]})}return P({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=se(e.nodes),o=Q(t,r=>X(r.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=se(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=se(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return P({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=se(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return P({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ue(e.nodes),o=[],r=[];for(let n of t){let a=Me(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=X(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Mo(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(a=>a.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=se(e.nodes),o=Q(t,r=>!r.label||Go(r.label));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return P({isValid:!0});let t=ue(e.nodes)[0];if(!t)return P({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return P({isValid:!0});let n=se(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Vo(l.id,e));return P({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=se(e.nodes),o=ue(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),f=X(l.id,e.edges),g=d.some(b=>{var E;return((E=e.nodes.find(y=>y.id===b.source))==null?void 0:E.type)==="START_EVENT"}),u=f.some(b=>{var E;return((E=e.nodes.find(y=>y.id===b.target))==null?void 0:E.type)==="END_EVENT"});return g&&u}),n=Me(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,r=>X(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Do(e.nodes),o=Q(t,r=>!Oo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ro(e.nodes),o=Q(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Bo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Fo=()=>{let{t:e}=ei(),[t,o]=zo(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ti(),[s,l]=zo(!1);return{validationResult:t,validateDiagram:u=>{let b=Ho(u.nodes,u.edges),E=Bo(b),y=E.errors.map(c=>_(v({},c),{message:e(`validation.errors.${c.id}`)}));return s||l(!0),{isValid:E.isValid,errors:y}},handleValidationComplete:u=>{if(o(u),!u)return;let b=[],E=[];u.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(N=>b.push(N)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(N=>E.push(N))});let y=[...new Set(b)];r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:!1})}))),n(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:!1})})));let c=a(),p=i(),m=new Set(y),T=new Set;u.errors.forEach(h=>{var x,S;let N=Ve.find(I=>I.id===h.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((x=h.edgeIds)==null||x.forEach(I=>T.add(I)),(S=h.nodeIds)==null||S.forEach(I=>{p.forEach(z=>{(z.source===I||z.target===I)&&T.add(z.id)})}))});let C=new Set,w=new Set,L=new Set;c.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&w.add(h.id)}),p.forEach(h=>{C.has(h.source)&&L.add(h.target),w.has(h.target)&&L.add(h.source)}),L.forEach(h=>{var N,k;if(m.has(h)){let x=(N=u.errors.find(I=>{var z;return(z=I.nodeIds)==null?void 0:z.includes(h)}))==null?void 0:N.id;((k=Ve.find(I=>I.id===x))==null?void 0:k.highlightRelatedEdges)!==!1&&p.forEach(I=>{I.source===h&&w.has(I.target)&&(m.add(I.target),T.add(I.id)),I.target===h&&C.has(I.source)&&(m.add(I.source),T.add(I.id))})}}),m.size>0&&r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:m.has(N.id)})}))),T.size>0&&n(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:T.has(N.id)})})))},clearValidation:()=>{o(null),l(!1),r(u=>u.map(b=>_(v({},b),{data:_(v({},b.data),{hasError:!1})}))),n(u=>u.map(b=>_(v({},b),{data:_(v({},b.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as oi}from"@xyflow/react";import{useEffect as ri}from"react";import{v7 as Uo}from"uuid";var ni=15,Wo="bpmn:selection",Yo=({offset:e=ni}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=oi();ri(()=>{let a=s=>{var b;s.preventDefault();let l=t(),d=r(),f=l.filter(E=>E.selected);if(!f.length)return;let g=d.filter(E=>f.some(y=>y.id===E.source)&&f.some(y=>y.id===E.target)),u={nodes:f,edges:g};(b=s.clipboardData)==null||b.setData(Wo,JSON.stringify(u))},i=s=>{var u,b;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Wo))||"{}");if(!((b=l.nodes)!=null&&b.length))return;let d=new Map,f=l.nodes.map(E=>{let y=Uo();return d.set(E.id,y),_(v({},E),{id:y,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),g=l.edges.map(E=>_(v({},E),{id:Uo(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(y=>_(v({},y),{selected:!1})),...f]),n(E=>[...E.map(y=>_(v({},y),{selected:!1})),...g])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};import{useReactFlow as gi,useStoreApi as Ei}from"@xyflow/react";import{v7 as qo}from"uuid";import{create as ai}from"zustand";var ye=ai(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ii,EdgeLabelRenderer as si,getSmoothStepPath as li,MarkerType as di,useNodes as ci,useReactFlow as pi,useViewport as mi}from"@xyflow/react";import{useState as ui}from"react";import{jsx as ft,jsxs as Ko}from"react/jsx-runtime";var Vm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:di.Arrow},data:{label:""}},Zo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=ci(),{zoom:u}=mi(),{updateEdgeData:b}=pi(),[E,y]=ui(!1),c=g.find(I=>I.id===t),p=g.find(I=>I.id===o),[m,T,C]=li({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),w=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=w?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,N=1/u,k=()=>{y(!0)},x=()=>{y(!1)},S=I=>{b(e,{label:I.trim()})};return Ko("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":w}),onBlur:x,onDoubleClick:k,children:[ft(ii,{id:e,path:m,markerEnd:`url(#${L})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":w&&!(d!=null&&d.hasError)})}),ft(si,{children:Ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${C}px)`},children:[f&&ft(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${N})`}}),h&&ft(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};import{jsx as $o,jsxs as fi}from"react/jsx-runtime";var Xo=({fromX:e,fromY:t,toX:o,toY:r})=>fi("g",{children:[$o("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),$o("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var jo=({nodes:e,setNodes:t,setEdges:o})=>{let r=Ei(),{draggableNode:n,setDraggableNode:a}=ye(),{getInternalNode:i,screenToFlowPosition:s}=gi(),l=c=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(m=>m.map(T=>_(v({},T),{className:T.id===c?p:""})))},d=()=>{let{nodeLookup:c}=r.getState();return Array.from(c.values())},f=c=>{let p=i(c.id),m=d();if(c.type==="LANE"){if(ve({parentId:c.id,nodes:e,includeTypes:["LANE"]})){l();return}let N=m.filter(S=>S.id!==c.id&&S.type==="LANE"&&!S.parentId),k=Pe(p,N);if(!k){l();return}if(ve({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=m.filter(h=>h.id!==c.id&&h.type==="LANE"),w=Pe(p,C);if(!w){l();return}if(ve({parentId:w.id,nodes:e,includeTypes:["LANE"]})){l();return}l(w.id)},g=c=>{c.preventDefault(),c.dataTransfer.dropEffect="move"},u=(c,p)=>{c.preventDefault(),f(p)},b=(c,p,m)=>{var N,k;let T=x=>x.map(S=>_(v({},S),{className:void 0}));if(c.parentId===p.id){let x=me(p.id,m);t(re(T(x)));return}if(c.type==="LANE"){if(ve({parentId:p.id,nodes:m,excludeTypes:["LANE"]}))return;let I=m.filter(V=>V.parentId===p.id).reduce((V,ge)=>{var ce,pe;return V+((pe=(ce=ge.measured)==null?void 0:ce.height)!=null?pe:0)},0),z={x:Y.HEADER_WIDTH,y:I},K=m.map(V=>V.id===c.id?_(v({},V),{parentId:p.id,position:z,className:void 0}):_(v({},V),{className:void 0}));K=me(p.id,K),t(re(K));return}if(ve({parentId:p.id,nodes:m,includeTypes:["LANE"]})){let x;if(c.parentId){let I=i(c.parentId),{x:z,y:K}=oe(I);x={x:z+((N=c.position.x)!=null?N:0),y:K+((k=c.position.y)!=null?k:0)}}let S=m.map(I=>I.id===c.id?_(v({},I),{position:x!=null?x:I.position,parentId:void 0,className:void 0}):_(v({},I),{className:void 0}));t(re(S));return}let L=go(c,p),h=m.map(x=>x.id===c.id?_(v({},x),{parentId:p.id,position:L,className:void 0}):_(v({},x),{className:void 0}));t(re(h))};return{onDragOver:g,onDrop:c=>{if(c.preventDefault(),!(n!=null&&n.type))return;let p=s({x:c.clientX,y:c.clientY}),m={width:M[n.type].MIN_WIDTH,height:M[n.type].MIN_HEIGHT},T={id:qo(),type:n.type,position:p,measured:m,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(v({},T),{internals:{positionAbsolute:p}}),w=d(),L=n.type==="LANE",h=w.filter(x=>L?x.type==="LANE"&&!x.parentId:x.type==="LANE"),N=Pe(C,h);N?b(C,N,[...w,C]):t(x=>{let S=x.concat(T);return re(S)});let k=c.dataTransfer.getData("sourceId");if(k){let x={id:qo(),source:k,target:T.id};if(n.type==="ANNOTATION"){o(S=>S.concat(v(v({},x),pt)));return}o(S=>S.concat(v(v({},x),ie)))}a(null)},onNodeDrag:u,onNodeDragStop:async(c,p)=>{var N,k;let{nodeLookup:m}=r.getState(),T=i(p.id),C=Array.from(m.values()),w=p.type==="LANE",L=C.filter(x=>x.id!==p.id&&(w?x.type==="LANE"&&!x.parentId:x.type==="LANE")),h=Pe(T,L);if(h){b(T,h,C);return}if(p.parentId){let x=i(p.parentId),{x:S,y:I}=oe(x),z={x:S+((N=p.position.x)!=null?N:0),y:I+((k=p.position.y)!=null?k:0)},K=e.map(V=>V.id===p.id?_(v({},V),{position:z,parentId:void 0}):V);K=me(p.parentId,K),t(re(K))}}}};import{applyNodeChanges as bi}from"@xyflow/react";import{useCallback as hi,useState as Qo}from"react";function Jo(e,t,o=5){var l,d,f,g,u,b,E,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(c=>c.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((g=(f=n.measured)==null?void 0:f.height)!=null?g:0),width:(b=(u=n.measured)==null?void 0:u.width)!=null?b:0,height:(y=(E=n.measured)==null?void 0:E.height)!=null?y:0},i=o,s=o;return t.filter(c=>c.id!==n.id).reduce((c,p)=>{var S,I,z,K,V,ge,ce,pe;let m={left:p.position.x,right:p.position.x+((I=(S=p.measured)==null?void 0:S.width)!=null?I:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(ge=(V=p.measured)==null?void 0:V.width)!=null?ge:0,height:(pe=(ce=p.measured)==null?void 0:ce.height)!=null?pe:0},T=Math.abs(a.left-m.left);T<s&&(c.snapPosition.x=m.left,c.vertical=m.left,s=T);let C=Math.abs(a.right-m.right);C<s&&(c.snapPosition.x=m.right-a.width,c.vertical=m.right,s=C);let w=Math.abs(a.left-m.right);w<s&&(c.snapPosition.x=m.right,c.vertical=m.right,s=w);let L=Math.abs(a.right-m.left);L<s&&(c.snapPosition.x=m.left-a.width,c.vertical=m.left,s=L);let h=Math.abs(a.top-m.top);h<i&&(c.snapPosition.y=m.top,c.horizontal=m.top,i=h);let N=Math.abs(a.bottom-m.top);N<i&&(c.snapPosition.y=m.top-a.height,c.horizontal=m.top,i=N);let k=Math.abs(a.bottom-m.bottom);k<i&&(c.snapPosition.y=m.bottom-a.height,c.horizontal=m.bottom,i=k);let x=Math.abs(a.top-m.bottom);return x<i&&(c.snapPosition.y=m.bottom,c.horizontal=m.bottom,i=x),c},r)}var er=()=>{let[e,t]=Qo(void 0),[o,r]=Qo(void 0),n=hi((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Jo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return bi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ni}from"@xyflow/react";import{v7 as ar}from"uuid";var or={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},rr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},tr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},vi=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
+
`),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=tr(a[0],o),s=tr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},nr=e=>{let{components:t,connections:o}=vi(e);return{nodes:t,edges:o}};var ir=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ni();return{createDiagram:n=>{let{nodes:a,edges:i}=nr(n),s=[],l=new Map;for(let[u,b]of Object.entries(a)){let E=ar(),y=or[b.type],c=rr[b.type];l.set(u,E);let p=M[y].MIN_WIDTH,m=M[y].MIN_HEIGHT;s.push({id:E,type:y,data:{label:b.label||"",variant:c,attribute:""},position:{x:0,y:0},width:p,height:m,measured:{width:p,height:m}})}let d=[];for(let u of i){let b=_(v({},ie),{id:ar(),source:l.get(u.sourceId)||u.sourceId,target:l.get(u.targetId)||u.targetId});d.push(b)}let{nodes:f,edges:g}=ho(s,d);e(f),t(g),o()}}};import{useEffect as yi,useCallback as Ti}from"react";var xi={origin:"*",debug:!1};function sr(e,t=xi){let{origin:o,debug:r}=t,n=Ti((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return yi(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}import{useReactFlow as _i}from"@xyflow/react";import{useCallback as Oe,useState as lr}from"react";import{useDebouncedCallback as wi}from"use-debounce";var Ci={nodes:[],edges:[]},Ii=500,dr=10,cr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=_i(),[n,a]=lr([Ci]),[i,s]=lr(0),l=n[i],d=i>0,f=i<n.length-1,g=Oe(m=>{o(n[m].nodes),r(n[m].edges)},[n,o,r]),u=Oe(()=>{if(i>0){let m=i-1;s(m),g(m)}},[i,g]),b=Oe(()=>{if(i<n.length-1){let m=i+1;s(m),g(m)}},[n,i,g]),E=m=>{let C=[...n.slice(0,i+1),m],w=C.length>dr?C.slice(C.length-dr):C;a(w),s(w.length-1)},y=wi(()=>{let m=e(),T=t(),C={nodes:m,edges:T};JSON.stringify(l)!==JSON.stringify(C)&&E(C)},Ii),c=Oe(m=>{if(m==="forceSave"){y();return}m.some(C=>C.type!=="select")&&y()},[y]),p=Oe(()=>{a([]),s(0)},[]);return{undo:u,redo:b,saveHistory:c,canUndo:d,canRedo:f,clearHistory:p}};import{jsx as pr}from"react/jsx-runtime";var Ht=({id:e,className:t})=>pr("marker",{id:e,className:A("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:pr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Bt,jsxs as Ai}from"react/jsx-runtime";var mr=()=>Bt("svg",{style:{position:"absolute",top:0,left:0},children:Ai("defs",{children:[Bt(Ht,{id:"sequence-edge-marker",className:"text-grey-400"}),Bt(Ht,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Lr}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as xs}from"lecom-ui";import{HandIcon as _s,ListCheckIcon as ws,MapIcon as Cs,MousePointerIcon as Is}from"lucide-react";import{useCallback as As,useEffect as Sr}from"react";import{useStore as ki}from"@xyflow/react";var Li=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=ki(Li);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as ts,TooltipContent as os,TooltipTrigger as rs,useNotificationToast as ns,useTranslation as as}from"lecom-ui";var Ge=(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))(Ge||{});import{useReactFlow as Ki}from"@xyflow/react";import{useNotificationToast as Zi,useTranslation as $i,Button as Xi}from"lecom-ui";var ur=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function fr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
|
|
3
|
+
`),a=encodeURI(n);Et(a,`${o}.csv`)}var Et=(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)};import{v7 as zi}from"uuid";import{xml2json as Si,json2xml as Uu}from"xml-js";var Pi={compact:!0,spaces:4},Di=e=>e.replaceAll(`
|
|
4
|
+
`,"
");function gr(e,t=Pi){if(e)return JSON.parse(Si(e,_(v({},t),{attributeValueFn:Di})))}function Er(e){return e==null?void 0:e.replaceAll("
"," ")}import{v7 as Mi}from"uuid";var Xu={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},br={script:"SCRIPT",subprocess:"SUBPROCESS"},hr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Te=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},Vi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=M.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=M.START_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Oi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=M.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=M.END_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Gi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=br[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,M.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,M.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Hi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=hr[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=M.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=M.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Bi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,M.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,M.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},vr=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=M.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=M.UNSUPPORTED.MIN_HEIGHT,{node:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Nr=(e,t)=>{let{source:o,target:r}=e._attributes;return _(v({},ie),{id:Mi(),source:t.get(o)||o,target:t.get(r)||r})},yr={TASK:Gi,GATEWAY:Hi,START_EVENT:Vi,END_EVENT:Oi,ANNOTATION:Bi};var Fi=e=>{var i;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=zi(),{type:d}=s._attributes,f=yr[d]||vr;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:g,status:u,originalType:b}=f(s);n.push(g),a.push({originalType:b,type:g.type,variant:g.data.variant,value:Er(g.data.label),status:u})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},Ui=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>Nr(n,t)),Wi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Fi(t.root.mxCell),a=Ui(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Yi=async e=>{let t=await ur(e),o=gr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Tr=async e=>{try{let t=await Yi(e),{nodes:o,edges:r,summary:n}=Wi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as qi}from"react/jsx-runtime";var xr=()=>{let{t:e}=$i(),{toast:t}=Zi(),{setNodes:o,setEdges:r,fitView:n}=Ki(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(f=>[f.originalType,f.value,e(`adapter.governance.report.status.${f.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:qi(Xi,{size:"small",variant:"ghost",onClick:()=>fr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:f}=await Tr(s);if(o(u=>u.concat(l)),r(u=>u.concat(d)),n(),f.some(u=>u.status==="unsupported")){a(f);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as ji}from"lecom-ui";import{useRef as Ji}from"react";import{Fragment as Qi,jsx as _r,jsxs as es}from"react/jsx-runtime";var wr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=Ee(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=Ji(null),f=u=>{let b=u.target.files;b!=null&&b.length&&a(b),d.current&&(d.current.value="")};return es(Qi,{children:[_r(ji,_(v({onClick:u=>{var b;(b=d.current)==null||b.click(),n==null||n(u)}},i),{children:e})),_r("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:f})]})};import{jsx as bt,jsxs as is}from"react/jsx-runtime";var Cr=({disabled:e=!1})=>{let{t}=as(),{toast:o}=ns(),{createDiagram:r}=xr(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return is(ts,{children:[bt(rs,{asChild:!0,children:bt(wr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:bt(ao,{})})}),bt(os,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as us,DropdownMenu as fs,DropdownMenuContent as gs,DropdownMenuItem as Ft,DropdownMenuTrigger as Es,Tooltip as ht,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as bs}from"lecom-ui";import{FileCodeIcon as hs,FileImageIcon as vs,FolderOutputIcon as Ns,PrinterIcon as ys}from"lucide-react";import{useState as Ts}from"react";import{useReactFlow as ss}from"@xyflow/react";import{toPng as Ir,toSvg as ls}from"html-to-image";import{toast as ds,useTranslation as cs}from"lecom-ui";import{useState as ps}from"react";var ms=3,zt="diagram",Ar=()=>{let{t:e}=cs(),{getNodes:t}=ss(),{deselectAll:o}=gt(),[r,n]=ps({png:!1,html:!1,print:!1}),a=()=>{let{x:f,y:g,width:u,height:b}=No(t());return{width:u,height:b,style:{width:`${u}px`,height:`${b}px`,transform:`translate(${-f}px, ${-g}px)`}}},i=async(f,g)=>{n(_(v({},r),{[g]:!0})),await o();try{let u=vo();if(!u)throw new Error("Flow element not found");let b=a();return await f(u,b)}catch(u){ds({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(_(v({},r),{[g]:!1}))}};return{exportAsPng:async(f=zt)=>{await i(async(g,u)=>{let b=await Ir(g,_(v({},u),{backgroundColor:"#fcfcfc"}));Et(b,`${f}.png`)},"png")},exportAsHtml:async(f=zt)=>{await i(async(g,u)=>{let b=await ls(g,_(v({},u),{backgroundColor:"#fcfcfc"})),E=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -15,7 +15,7 @@ var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnProp
|
|
|
15
15
|
<img src="${b}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,
|
|
18
|
+
`,y=new Blob([E],{type:"text/html"}),c=URL.createObjectURL(y);Et(c,`${f}.html`),setTimeout(()=>URL.revokeObjectURL(c),100)},"html")},printDiagram:async(f=zt)=>{await i(async(g,u)=>{let b=await Ir(g,_(v({},u),{pixelRatio:ms})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let y=E.document;y.open(),y.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
@@ -31,4 +31,4 @@ var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnProp
|
|
|
31
31
|
<img src="${b}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),h.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function kr(){let{t:e}=bs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Ar(),[s,l]=Ts(!1);return xe(fs,{modal:!1,open:s,onOpenChange:l,children:[G(Es,{asChild:!0,children:G("div",{children:xe(bt,{children:[G(vt,{asChild:!0,children:G(us,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Ns,{})})}),!s&&G(ht,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(gs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(vs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(hs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(ys,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as ks,jsx as H,jsxs as le}from"react/jsx-runtime";var Pr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=xs(),{deselectAll:i}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:f,isMinimapOpen:g,setIsMinimapOpen:u}=O(),b=Lr(["v","V"]),E=Lr(["h","H"]),h=As(()=>{i(),f()},[i,f]),c=()=>{i();let p=n(o);r&&r(p)};return Sr(()=>{b&&!s&&!t&&d()},[b,d,s,t]),Sr(()=>{E&&!l&&!t&&h()},[E,h,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(ks,{children:[le(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:C(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Is,{})})}),le(Tt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),le(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:C(l&&"bg-grey-400"),iconButton:!0,onClick:h,children:H(_s,{})})}),le(Tt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),le(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:c,children:H(ws,{})})}),H(Tt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(kr,{}),!t&&H(Cr,{disabled:e.length>0}),le(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:C(g&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!g),children:H(Cs,{})})}),H(Tt,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Dr,Tooltip as Mr,TooltipContent as Rr,TooltipTrigger as Vr,useTranslation as Ls}from"lecom-ui";import{RedoIcon as Ss,UndoIcon as Ps}from"lucide-react";import{jsx as de,jsxs as Ut}from"react/jsx-runtime";var Or=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ls();return Ut("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Ut(Mr,{children:[de(Vr,{asChild:!0,children:de(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Ps,{})})}),de(Rr,{color:"black",children:n("editor.controls.history.undo")})]}),Ut(Mr,{children:[de(Vr,{asChild:!0,children:de(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Ss,{})})}),de(Rr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ds}from"@xyflow/react";import{Button as _t,Tooltip as wt,TooltipContent as Ct,TooltipTrigger as It,useTranslation as Ms}from"lecom-ui";import{ScanIcon as Rs,ZoomIn as Vs,ZoomOut as Os}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Gr=()=>{let{t:e}=Ms(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ds();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Rs,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Os,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.out")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(lo,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Vs,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as wl,useReactFlow as Cl}from"@xyflow/react";import{Handle as Gs}from"@xyflow/react";import{jsx as Hs}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Hs(Gs,{type:e,position:t,className:C("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Bs,useReactFlow as zs}from"@xyflow/react";import{orderBy as Fs}from"lodash";import{jsx as Us}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=zs(),s=({width:l,height:d})=>{if(!e)return;let f=n(e);if((f==null?void 0:f.type)!=="LANE")return;let g=[...a()],u=!f.parentId,b=u?f.id:f.parentId,E=g.filter(p=>p.type==="LANE"&&p.parentId===b);if(!E.length)return;let h=Fs(E,["position.y"]),c=0;h.forEach((p,m)=>{var A,L;let x=m===h.length-1,_=(L=(A=p.measured)==null?void 0:A.height)!=null?L:0;g=g.map(v=>{if(v.id===p.id){let T=u?l-Y.HEADER_WIDTH:l,k=y(N({},v),{width:T,measured:y(N({},v.measured),{width:T}),position:y(N({},v.position),{y:c})});return x&&u&&(k.height=d-c),k}return v}),c+=_}),g=g.map(p=>{if(p.id===b){let m=u?l:l+Y.HEADER_WIDTH;return y(N({},p),{width:m,height:u?d:c,measured:{width:m,height:u?d:c}})}return p}),i(g)};return Us(Bs,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as bl,NodeToolbar as hl}from"@xyflow/react";import{Button as vl,Tooltip as Nl,TooltipContent as yl,TooltipTrigger as Tl,useTranslation as xl}from"lecom-ui";import{useNodesData as Ws,useReactFlow as Ys}from"@xyflow/react";import{Button as Ks,DropdownMenu as Zs,DropdownMenuContent as $s,DropdownMenuGroup as Xs,DropdownMenuItem as qs,DropdownMenuLabel as js,DropdownMenuTrigger as Js,Tooltip as Qs,TooltipContent as el,TooltipTrigger as tl,useTranslation as ol}from"lecom-ui";import{WrenchIcon as rl}from"lucide-react";import{jsx as ne,jsxs as At}from"react/jsx-runtime";var Hr=({nodeId:e})=>{let{t}=ol(),{updateNodeData:o}=Ys(),r=Ws(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return At(Zs,{children:[At(Qs,{children:[ne(tl,{asChild:!0,children:ne(Js,{asChild:!0,children:ne(Ks,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(rl,{})})})}),ne(el,{color:"black",children:t("bpmn.gateway.menu.title")})]}),At($s,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(js,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(Xs,{children:Object.entries(Qe).map(([a,i])=>At(qs,{className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[ne(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};import{useNodesData as nl,useReactFlow as al}from"@xyflow/react";import{Button as Br,DropdownMenu as il,DropdownMenuContent as sl,DropdownMenuGroup as ll,DropdownMenuItem as dl,DropdownMenuLabel as cl,DropdownMenuTrigger as pl,Tooltip as ml,TooltipContent as ul,TooltipTrigger as fl,useTranslation as gl}from"lecom-ui";import{WrenchIcon as El}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=gl(),{updateNodeData:o}=al(),r=nl(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return Be(il,{children:[Be(ml,{children:[q(fl,{asChild:!0,children:q(pl,{asChild:!0,children:q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(El,{})})})}),q(ul,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(sl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(cl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([i,s])=>q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:q(s.icon,{className:"stroke-inherit"})},i))})]}),q(ll,{children:Object.entries(je).map(([i,s])=>Be(dl,{className:C({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as _l}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var f;let{t:n}=xl(),{setDraggableNode:a}=ye(),i=({event:g,type:u,variant:b})=>{a({type:u,variant:b}),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Le,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:be,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Le,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(it,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(zr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Hr,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(hl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:bl.Right,align:"start",isVisible:r,children:(f=d[t])==null?void 0:f.map((g,u)=>g.component?j("div",{children:g.component},u):_l(Nl,{children:[j(Tl,{asChild:!0,children:j(vl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:b=>i({event:b,type:g.type,variant:g.variant}),children:g.icon&&j(g.icon,{size:16})})}),j(yl,{color:"black",children:g.label})]},u))})};import{Fragment as Il,jsx as ze,jsxs as Al}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Cl(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Al(Il,{children:[ze("div",{className:C("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:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),ze(_e,{isVisible:!r&&!a&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:wl.Left})]})};import{Position as Ur,useReactFlow as kl}from"@xyflow/react";import{useState as Ll}from"react";import{Fragment as Sl,jsx as we,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=kl(),{isMultipleSelection:a}=O(),[i,s]=Ll(!1),l=g=>{n(e,{label:g})};return Wr(Sl,{children:[Wr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(be,{className:C("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})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:i,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),we(B,{type:"source",position:Ur.Right}),we(B,{type:"target",position:Ur.Left})]})};import{Position as Kr,useReactFlow as Pl}from"@xyflow/react";import{useState as Dl}from"react";import{Fragment as Ml,jsx as Ce,jsxs as Zr}from"react/jsx-runtime";var $r=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Pl(),{isMultipleSelection:i}=O(),[s,l]=Dl(!1),d=u=>{a(e,{label:u})};return Zr(Ml,{children:[Zr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(n,{className:C("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})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:d})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ce(B,{type:"target",position:Kr.Left}),Ce(B,{type:"source",position:Kr.Right})]})};import{Position as Rl,useReactFlow as Vl}from"@xyflow/react";import{useState as Ol}from"react";import{Fragment as Gl,jsx as Fe,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Vl(),{isMultipleSelection:a}=O(),[i,s]=Ol(!1),l=g=>{n(e,{label:g})};return Xr(Gl,{children:[Xr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(Xe,{className:C("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})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:i,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),Fe(B,{type:"source",position:Rl.Right})]})};import{Position as jr,useReactFlow as Hl}from"@xyflow/react";import{Fragment as Bl,jsx as ee,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Hl(),{isMultipleSelection:a}=O(),i=u=>{n(e,{label:u})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",f=s&&!d,g=l||d;return Jr(Bl,{children:[Jr("div",{className:C("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:[ee(U,{value:t.label,className:C("m-1",{"py-6":f||g}),onChange:i}),s&&ee("div",{className:C("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:C(t.hasError?"text-red-500":"text-grey-500")})}),l&&ee("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:ee("div",{className:C("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:C(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(_e,{isVisible:!r&&!a&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:jr.Right}),ee(B,{type:"target",position:jr.Left})]})};import{Position as en}from"@xyflow/react";import{Fragment as zl,jsx as kt,jsxs as Fl}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Fl(zl,{children:[kt("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}),kt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),kt(B,{type:"source",position:en.Right}),kt(B,{type:"target",position:en.Left})]})};import{Position as Ul,useReactFlow as Wl}from"@xyflow/react";import{orderBy as Yl}from"lodash";import{useMemo as on}from"react";import{Fragment as Kl,jsx as fe,jsxs as rn}from"react/jsx-runtime";var nn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Wl(),{isMultipleSelection:s}=O(),l=i(),d=!n,f=on(()=>Yl([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),g=d?tt.MIN_WIDTH:Y.MIN_WIDTH,u=on(()=>{if(d&&f.length>1){let E=[...f];return E.pop(),E.reduce((c,p)=>{var m,x;return c+((x=(m=p.measured)==null?void 0:m.height)!=null?x:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,f]),b=E=>{a(e,{label:E})};return rn(Kl,{children:[rn("div",{className:C("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:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:b})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:g,minHeight:u,isVisible:!r&&!s&&o}),d&&fe(B,{type:"source",position:Ul.Right})]})};var an={START_EVENT:qr,END_EVENT:Yr,TASK:Qr,GATEWAY:$r,ANNOTATION:Fr,LANE:nn,UNSUPPORTED:tn},sn={SEQUENCE_EDGE:Lo,MESSAGE_EDGE:Zo,ANNOTATION_EDGE:wo},ln="#fafafa",dn="#bebebe",cn=1,pn=10,mn="bottom-left",un=.5,fn=4,gn={x:0,y:0,zoom:.75};import{useStore as Zl}from"@xyflow/react";import{useEffect as $l,useRef as Xl}from"react";import{jsx as jl}from"react/jsx-runtime";var ql=e=>({width:e.width,height:e.height,transform:e.transform}),En=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Zl(ql),s=Xl(null);return $l(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let f=window.devicePixelRatio;l.width=n*f,l.height=a*f,d.scale(f,f),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),jl("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as bn,Dialog as Jl,DialogContent as Ql,DialogFooter as ed,DialogHeader as td,DialogTitle as od,Notification as rd,Typography as Wt,useTranslation as nd}from"lecom-ui";import{jsx as te,jsxs as Yt}from"react/jsx-runtime";var hn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=nd(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(f=>f.filter(g=>!l.some(u=>u.id===g.id))),d!=null&&d.length&&r(f=>f.filter(g=>!d.some(u=>u.id===g.id))),t(null)},s=()=>{t(null)};return te(Jl,{open:a,onOpenChange:s,children:Yt(Ql,{className:"w-[488px] max-w-fit gap-2",children:[te(td,{children:te(od,{children:te(Wt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Yt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(rd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Wt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Yt(ed,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(bn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Wt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(bn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as ad,Tooltip as id,TooltipContent as sd,TooltipTrigger as ld,useTranslation as dd}from"lecom-ui";import{jsx as Ue,jsxs as cd}from"react/jsx-runtime";var vn=()=>{let{t:e}=dd(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:Xe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Le,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:fo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:uo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:mo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:so,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("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:o.map((n,a)=>cd(id,{children:[Ue(ld,{asChild:!0,children:Ue(ad,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Ue(n.icon,{})},a)}),Ue(sd,{color:"black",side:"right",children:n.label})]},a))})};import{Button as pd,useTranslation as md}from"lecom-ui";import{AlertCircleIcon as ud,CircleCheckIcon as fd,XIcon as gd}from"lucide-react";import{useEffect as Ed,useState as bd}from"react";import{jsx as J,jsxs as Kt}from"react/jsx-runtime";var Nn=({validationResult:e,onClose:t})=>{let{t:o}=md(),[r,n]=bd(!1);if(Ed(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Kt("div",{className:C("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Kt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(fd,{className:"text-green-500 size-5"}):J(ud,{className:"text-red-500 size-5"})}),Kt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&J("div",{children:o("validation.errors.subtitle")})]}),J(pd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(gd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:i.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as $t}from"react/jsx-runtime";var Pd=[],Dd=({mode:e="edit"})=>{let t=kd(!1),[o,r]=wd([]),[n,a]=_d([]),[i,s]=Ld(null),{isMoveTool:l,isHandTool:d,isReadOnly:f,setIsReadOnly:g,setIsMultipleSelection:u,isMinimapOpen:b}=O(),{validationResult:E,handleValidationComplete:h,clearValidation:c,isAutoValidationEnabled:p,validateDiagram:m}=Fo(),{getNode:x,getNodes:_,getEdges:A}=Id(),{onNodeDrag:L,onDrop:v,onDragOver:T,onNodeDragStop:k}=jo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:I,onConnect:S}=Po({setEdges:a});Yo();let{createDiagram:w}=ir(),{undo:z,redo:K,saveHistory:V,canUndo:ge,canRedo:ce}=cr(),{helperLineHorizontal:pe,helperLineVertical:kn,customApplyNodeChanges:Ln}=er();sr({LIA_CREATE_DIAGRAM:w,CLEAR_DIAGRAM:()=>{r([]),a([])}}),yn(()=>{g(e==="readonly")},[e,g]);let Sn=()=>{c()},Pn=Zt(({nodes:F,edges:M})=>{let Ie=F.length+M.length>1;u(Ie)},[u]);Cd({onChange:Pn});let Dn=F=>{let M=x(F.id);if(M!=null&&M.parentId&&(M==null?void 0:M.type)==="LANE"){let Ie=me(M.parentId,o.filter(Qt=>Qt.id!==M.id&&Qt.type==="LANE"));r(re(Ie))}},Mn=F=>{F.forEach(M=>{switch(M.type){case"remove":Dn(M);break}})},Rn=Zt(()=>{if(!p){t.current=!1;return}let F=_(),M=A(),Ie=m({nodes:F,edges:M});h(Ie),t.current=!1},[p,_,A,m,h]),jt=Sd(Rn,300),Jt=Zt(()=>{p&&!t.current&&(t.current=!0,jt())},[p,jt]),Vn=F=>{r(M=>Ln(F,M)),V(F),Jt(),Mn(F)},On=F=>{a(M=>hd(F,M)),V(F),Jt()},Gn=()=>{V("forceSave")},Hn=async({nodes:F,edges:M})=>(s({nodes:F,edges:M}),!1),Bn={nodes:o,edges:n};return $t("div",{className:"w-full h-full",children:[!f&&$(vn,{}),$(mr,{}),$t(yd,{edges:n,nodes:o,nodeTypes:an,edgeTypes:sn,minZoom:un,maxZoom:fn,panOnDrag:d||f?!0:Pd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&l,nodesConnectable:!f&&l,nodesDraggable:!f&&l,isValidConnection:I,connectionLineComponent:Xo,onConnect:S,onDrop:v,onDropCapture:Gn,onDragOver:T,onNodesChange:Vn,onEdgesChange:On,onNodeDrag:L,onNodeDragStop:k,onBeforeDelete:Hn,selectionMode:xd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:gn,connectOnClick:!1,children:[b&&$(Nd,{pannable:!0,zoomable:!0,position:mn,className:"shadow-md rounded-md"}),$t("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&$(Or,{canUndo:ge,canRedo:ce,undo:z,redo:K}),$(Pr,{nodes:o,isReadOnly:f,diagram:Bn,onValidationComplete:h,onValidateDiagram:m}),$(Gr,{})]}),$(En,{horizontal:pe,vertical:kn}),$(vd,{gap:pn,size:cn,color:dn,bgColor:ln}),E&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(Nn,{validationResult:E,onClose:Sn})})]}),$(hn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Md=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(yn(()=>{t&&Ad.changeLanguage(t)},[t]),$(Td,{children:$(To,{value:{onConfigureElement:o},children:$(Dd,{mode:e})})})),Xt=Md;var qt=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};import{initializeI18n as Rd,Translations as Vd}from"lecom-ui";var Tn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},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"}}},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"}},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 xn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},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"}}},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"}},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 _n={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},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"}}},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"}},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 wn={pt_BR:_n,en_US:Tn,es_ES:xn};var Cn,In,Od=(In=(Cn=qt("LecomUserLanguage"))!=null?Cn:qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?In:Vd.PT_BR;Rd({lng:Od,resources:wn});import{jsx as An}from"react/jsx-runtime";var XE=e=>An(ro,{children:An(Xt,N({},e))});export{St as ActivityVariant,Lt as ElementType,ae as GatewayVariant,XE as Modeler,Pt as RoutingVariant};
|
|
34
|
+
`),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function kr(){let{t:e}=bs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Ar(),[s,l]=Ts(!1);return xe(fs,{modal:!1,open:s,onOpenChange:l,children:[G(Es,{asChild:!0,children:G("div",{children:xe(ht,{children:[G(Nt,{asChild:!0,children:G(us,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Ns,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(gs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(ht,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(vs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(hs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(ys,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as ks,jsx as H,jsxs as le}from"react/jsx-runtime";var Pr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=xs(),{deselectAll:i}=gt(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:f,isMinimapOpen:g,setIsMinimapOpen:u}=O(),b=Lr(["v","V"]),E=Lr(["h","H"]),y=As(()=>{i(),f()},[i,f]),c=()=>{i();let p=n(o);r&&r(p)};return Sr(()=>{b&&!s&&!t&&d()},[b,d,s,t]),Sr(()=>{E&&!l&&!t&&y()},[E,y,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(ks,{children:[le(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Is,{})})}),le(xt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),le(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(l&&"bg-grey-400"),iconButton:!0,onClick:y,children:H(_s,{})})}),le(xt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),le(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:c,children:H(ws,{})})}),H(xt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(kr,{}),!t&&H(Cr,{disabled:e.length>0}),le(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(g&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!g),children:H(Cs,{})})}),H(xt,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Dr,Tooltip as Rr,TooltipContent as Mr,TooltipTrigger as Vr,useTranslation as Ls}from"lecom-ui";import{RedoIcon as Ss,UndoIcon as Ps}from"lucide-react";import{jsx as de,jsxs as Ut}from"react/jsx-runtime";var Or=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ls();return Ut("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Ut(Rr,{children:[de(Vr,{asChild:!0,children:de(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Ps,{})})}),de(Mr,{color:"black",children:n("editor.controls.history.undo")})]}),Ut(Rr,{children:[de(Vr,{asChild:!0,children:de(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Ss,{})})}),de(Mr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ds}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Rs}from"lecom-ui";import{ScanIcon as Ms,ZoomIn as Vs,ZoomOut as Os}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Gr=()=>{let{t:e}=Rs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ds();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Ms,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Os,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(lo,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Vs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as wl,useReactFlow as Cl}from"@xyflow/react";import{Handle as Gs}from"@xyflow/react";import{jsx as Hs}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Hs(Gs,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Bs,useReactFlow as zs}from"@xyflow/react";import{orderBy as Fs}from"lodash";import{jsx as Us}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=zs(),s=({width:l,height:d})=>{if(!e)return;let f=n(e);if((f==null?void 0:f.type)!=="LANE")return;let g=[...a()],u=!f.parentId,b=u?f.id:f.parentId,E=g.filter(p=>p.type==="LANE"&&p.parentId===b);if(!E.length)return;let y=Fs(E,["position.y"]),c=0;y.forEach((p,m)=>{var w,L;let T=m===y.length-1,C=(L=(w=p.measured)==null?void 0:w.height)!=null?L:0;g=g.map(h=>{if(h.id===p.id){let N=u?l-Y.HEADER_WIDTH:l,k=_(v({},h),{width:N,measured:_(v({},h.measured),{width:N}),position:_(v({},h.position),{y:c})});return T&&u&&(k.height=d-c),k}return h}),c+=C}),g=g.map(p=>{if(p.id===b){let m=u?l:l+Y.HEADER_WIDTH;return _(v({},p),{width:m,height:u?d:c,measured:{width:m,height:u?d:c}})}return p}),i(g)};return Us(Bs,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as bl,NodeToolbar as hl}from"@xyflow/react";import{Button as vl,Tooltip as Nl,TooltipContent as yl,TooltipTrigger as Tl,useTranslation as xl}from"lecom-ui";import{useNodesData as Ws,useReactFlow as Ys}from"@xyflow/react";import{Button as Ks,DropdownMenu as Zs,DropdownMenuContent as $s,DropdownMenuGroup as Xs,DropdownMenuItem as qs,DropdownMenuLabel as js,DropdownMenuTrigger as Js,Tooltip as Qs,TooltipContent as el,TooltipTrigger as tl,useTranslation as ol}from"lecom-ui";import{WrenchIcon as rl}from"lucide-react";import{jsx as ne,jsxs as kt}from"react/jsx-runtime";var Hr=({nodeId:e})=>{let{t}=ol(),{updateNodeData:o}=Ys(),r=Ws(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return kt(Zs,{children:[kt(Qs,{children:[ne(tl,{asChild:!0,children:ne(Js,{asChild:!0,children:ne(Ks,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(rl,{})})})}),ne(el,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt($s,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(js,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(Xs,{children:Object.entries(Qe).map(([a,i])=>kt(qs,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[ne(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};import{useNodesData as nl,useReactFlow as al}from"@xyflow/react";import{Button as Br,DropdownMenu as il,DropdownMenuContent as sl,DropdownMenuGroup as ll,DropdownMenuItem as dl,DropdownMenuLabel as cl,DropdownMenuTrigger as pl,Tooltip as ml,TooltipContent as ul,TooltipTrigger as fl,useTranslation as gl}from"lecom-ui";import{WrenchIcon as El}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=gl(),{updateNodeData:o}=al(),r=nl(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return Be(il,{children:[Be(ml,{children:[q(fl,{asChild:!0,children:q(pl,{asChild:!0,children:q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(El,{})})})}),q(ul,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(sl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(cl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([i,s])=>q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:q(s.icon,{className:"stroke-inherit"})},i))})]}),q(ll,{children:Object.entries(je).map(([i,s])=>Be(dl,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as _l}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var f;let{t:n}=xl(),{setDraggableNode:a}=ye(),i=({event:g,type:u,variant:b})=>{a({type:u,variant:b}),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Le,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:be,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Le,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(st,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(zr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Hr,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(hl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:bl.Right,align:"start",isVisible:r,children:(f=d[t])==null?void 0:f.map((g,u)=>g.component?j("div",{children:g.component},u):_l(Nl,{children:[j(Tl,{asChild:!0,children:j(vl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:b=>i({event:b,type:g.type,variant:g.variant}),children:g.icon&&j(g.icon,{size:16})})}),j(yl,{color:"black",children:g.label})]},u))})};import{Fragment as Il,jsx as ze,jsxs as Al}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Cl(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Al(Il,{children:[ze("div",{className:A("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:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),ze(_e,{isVisible:!r&&!a&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:wl.Left})]})};import{Position as Ur,useReactFlow as kl}from"@xyflow/react";import{useState as Ll}from"react";import{Fragment as Sl,jsx as we,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=kl(),{isMultipleSelection:a}=O(),[i,s]=Ll(!1),l=g=>{n(e,{label:g})};return Wr(Sl,{children:[Wr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(be,{className:A("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})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:i,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),we(B,{type:"source",position:Ur.Right}),we(B,{type:"target",position:Ur.Left})]})};import{Position as Kr,useReactFlow as Pl}from"@xyflow/react";import{useState as Dl}from"react";import{Fragment as Rl,jsx as Ce,jsxs as Zr}from"react/jsx-runtime";var $r=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Pl(),{isMultipleSelection:i}=O(),[s,l]=Dl(!1),d=u=>{a(e,{label:u})};return Zr(Rl,{children:[Zr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(n,{className:A("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})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:d})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ce(B,{type:"target",position:Kr.Left}),Ce(B,{type:"source",position:Kr.Right})]})};import{Position as Ml,useReactFlow as Vl}from"@xyflow/react";import{useState as Ol}from"react";import{Fragment as Gl,jsx as Fe,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Vl(),{isMultipleSelection:a}=O(),[i,s]=Ol(!1),l=g=>{n(e,{label:g})};return Xr(Gl,{children:[Xr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(Xe,{className:A("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})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:i,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),Fe(B,{type:"source",position:Ml.Right})]})};import{Position as jr,useReactFlow as Hl}from"@xyflow/react";import{Fragment as Bl,jsx as ee,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Hl(),{isMultipleSelection:a}=O(),i=u=>{n(e,{label:u})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",f=s&&!d,g=l||d;return Jr(Bl,{children:[Jr("div",{className:A("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:[ee(U,{value:t.label,className:A("m-1",{"py-6":f||g}),onChange:i}),s&&ee("div",{className:A("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})}),l&&ee("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:ee("div",{className:A("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(_e,{isVisible:!r&&!a&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:jr.Right}),ee(B,{type:"target",position:jr.Left})]})};import{Position as en}from"@xyflow/react";import{Fragment as zl,jsx as Lt,jsxs as Fl}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Fl(zl,{children:[Lt("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}),Lt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),Lt(B,{type:"source",position:en.Right}),Lt(B,{type:"target",position:en.Left})]})};import{Position as Ul,useReactFlow as Wl}from"@xyflow/react";import{orderBy as Yl}from"lodash";import{useMemo as on}from"react";import{Fragment as Kl,jsx as fe,jsxs as rn}from"react/jsx-runtime";var nn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Wl(),{isMultipleSelection:s}=O(),l=i(),d=!n,f=on(()=>Yl([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),g=d?tt.MIN_WIDTH:Y.MIN_WIDTH,u=on(()=>{if(d&&f.length>1){let E=[...f];return E.pop(),E.reduce((c,p)=>{var m,T;return c+((T=(m=p.measured)==null?void 0:m.height)!=null?T:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,f]),b=E=>{a(e,{label:E})};return rn(Kl,{children:[rn("div",{className:A("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:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:b})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:g,minHeight:u,isVisible:!r&&!s&&o}),d&&fe(B,{type:"source",position:Ul.Right})]})};var an={START_EVENT:qr,END_EVENT:Yr,TASK:Qr,GATEWAY:$r,ANNOTATION:Fr,LANE:nn,UNSUPPORTED:tn},sn={SEQUENCE_EDGE:Lo,MESSAGE_EDGE:Zo,ANNOTATION_EDGE:wo},ln="#fafafa",dn="#bebebe",cn=1,pn=10,mn="bottom-left",un=.5,fn=4,gn={x:0,y:0,zoom:.75};import{useStore as Zl}from"@xyflow/react";import{useEffect as $l,useRef as Xl}from"react";import{jsx as jl}from"react/jsx-runtime";var ql=e=>({width:e.width,height:e.height,transform:e.transform}),En=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Zl(ql),s=Xl(null);return $l(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let f=window.devicePixelRatio;l.width=n*f,l.height=a*f,d.scale(f,f),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),jl("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as bn,Dialog as Jl,DialogContent as Ql,DialogFooter as ed,DialogHeader as td,DialogTitle as od,Notification as rd,Typography as Wt,useTranslation as nd}from"lecom-ui";import{jsx as te,jsxs as Yt}from"react/jsx-runtime";var hn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=nd(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(f=>f.filter(g=>!l.some(u=>u.id===g.id))),d!=null&&d.length&&r(f=>f.filter(g=>!d.some(u=>u.id===g.id))),t(null)},s=()=>{t(null)};return te(Jl,{open:a,onOpenChange:s,children:Yt(Ql,{className:"w-[488px] max-w-fit gap-2",children:[te(td,{children:te(od,{children:te(Wt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Yt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(rd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Wt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Yt(ed,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(bn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Wt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(bn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as ad,Tooltip as id,TooltipContent as sd,TooltipTrigger as ld,useTranslation as dd}from"lecom-ui";import{jsx as Ue,jsxs as cd}from"react/jsx-runtime";var vn=()=>{let{t:e}=dd(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:Xe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Le,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:fo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:uo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:mo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:so,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("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:o.map((n,a)=>cd(id,{children:[Ue(ld,{asChild:!0,children:Ue(ad,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Ue(n.icon,{})},a)}),Ue(sd,{color:"black",side:"right",children:n.label})]},a))})};import{Button as pd,useTranslation as md}from"lecom-ui";import{AlertCircleIcon as ud,CircleCheckIcon as fd,XIcon as gd}from"lucide-react";import{useEffect as Ed,useState as bd}from"react";import{jsx as J,jsxs as Kt}from"react/jsx-runtime";var Nn=({validationResult:e,onClose:t})=>{let{t:o}=md(),[r,n]=bd(!1);if(Ed(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Kt("div",{className:A("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Kt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(fd,{className:"text-green-500 size-5"}):J(ud,{className:"text-red-500 size-5"})}),Kt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&J("div",{children:o("validation.errors.subtitle")})]}),J(pd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(gd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:i.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as $t}from"react/jsx-runtime";var Pd=[],Dd=({mode:e="edit"})=>{let t=kd(!1),[o,r]=wd([]),[n,a]=_d([]),[i,s]=Ld(null),{isMoveTool:l,isHandTool:d,isReadOnly:f,setIsReadOnly:g,setIsMultipleSelection:u,isMinimapOpen:b}=O(),{validationResult:E,handleValidationComplete:y,clearValidation:c,isAutoValidationEnabled:p,validateDiagram:m}=Fo(),{getNode:T,getNodes:C,getEdges:w}=Id(),{onNodeDrag:L,onDrop:h,onDragOver:N,onNodeDragStop:k}=jo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:S}=Po({setEdges:a});Yo();let{createDiagram:I}=ir(),{undo:z,redo:K,saveHistory:V,canUndo:ge,canRedo:ce}=cr(),{helperLineHorizontal:pe,helperLineVertical:kn,customApplyNodeChanges:Ln}=er();sr({LIA_CREATE_DIAGRAM:I,CLEAR_DIAGRAM:()=>{r([]),a([])}}),yn(()=>{g(e==="readonly")},[e,g]);let Sn=()=>{c()},Pn=Zt(({nodes:F,edges:R})=>{let Ie=F.length+R.length>1;u(Ie)},[u]);Cd({onChange:Pn});let Dn=F=>{let R=T(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ie=me(R.parentId,o.filter(Qt=>Qt.id!==R.id&&Qt.type==="LANE"));r(re(Ie))}},Rn=F=>{F.forEach(R=>{switch(R.type){case"remove":Dn(R);break}})},Mn=Zt(()=>{if(!p){t.current=!1;return}let F=C(),R=w(),Ie=m({nodes:F,edges:R});y(Ie),t.current=!1},[p,C,w,m,y]),jt=Sd(Mn,300),Jt=Zt(()=>{p&&!t.current&&(t.current=!0,jt())},[p,jt]),Vn=F=>{r(R=>Ln(F,R)),V(F),Jt(),Rn(F)},On=F=>{a(R=>hd(F,R)),V(F),Jt()},Gn=()=>{V("forceSave")},Hn=async({nodes:F,edges:R})=>(s({nodes:F,edges:R}),!1),Bn={nodes:o,edges:n};return $t("div",{className:"w-full h-full",children:[!f&&$(vn,{}),$(mr,{}),$t(yd,{edges:n,nodes:o,nodeTypes:an,edgeTypes:sn,minZoom:un,maxZoom:fn,panOnDrag:d||f?!0:Pd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&l,nodesConnectable:!f&&l,nodesDraggable:!f&&l,isValidConnection:x,connectionLineComponent:Xo,onConnect:S,onDrop:h,onDropCapture:Gn,onDragOver:N,onNodesChange:Vn,onEdgesChange:On,onNodeDrag:L,onNodeDragStop:k,onBeforeDelete:Hn,selectionMode:xd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:gn,connectOnClick:!1,children:[b&&$(Nd,{pannable:!0,zoomable:!0,position:mn,className:"shadow-md rounded-md"}),$t("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&$(Or,{canUndo:ge,canRedo:ce,undo:z,redo:K}),$(Pr,{nodes:o,isReadOnly:f,diagram:Bn,onValidationComplete:y,onValidateDiagram:m}),$(Gr,{})]}),$(En,{horizontal:pe,vertical:kn}),$(vd,{gap:pn,size:cn,color:dn,bgColor:ln}),E&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(Nn,{validationResult:E,onClose:Sn})})]}),$(hn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Rd=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(yn(()=>{t&&Ad.changeLanguage(t)},[t]),$(Td,{children:$(To,{value:{onConfigureElement:o},children:$(Dd,{mode:e})})})),Xt=Rd;var qt=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};import{initializeI18n as Md,Translations as Vd}from"lecom-ui";var Tn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},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"}}},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"}},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 xn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},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"}}},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"}},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 _n={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},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"}}},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"}},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 wn={pt_BR:_n,en_US:Tn,es_ES:xn};var Cn,In,Od=(In=(Cn=qt("LecomUserLanguage"))!=null?Cn:qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?In:Vd.PT_BR;Md({lng:Od,resources:wn});import{jsx as An}from"react/jsx-runtime";var XE=e=>An(ro,{children:An(Xt,v({},e))});export{Pt as ActivityVariant,St as ElementType,ae as GatewayVariant,XE as Modeler,Dt as RoutingVariant};
|