lecom-modeler 0.1.8 → 0.1.10
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 +5 -5
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Ga=Object.create;var ht=Object.defineProperty,Ha=Object.defineProperties,Ba=Object.getOwnPropertyDescriptor,za=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Ua=Object.getPrototypeOf,Co=Object.prototype.hasOwnProperty,qo=Object.prototype.propertyIsEnumerable;var Xo=(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={}))Co.call(t,o)&&Xo(e,o,t[o]);if(Ot)for(var o of Ot(t))qo.call(t,o)&&Xo(e,o,t[o]);return e},_=(e,t)=>Ha(e,za(t));var et=(e,t)=>{var o={};for(var r in e)Co.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&&qo.call(e,r)&&(o[r]=e[r]);return o};var Wa=(e,t)=>{for(var o in t)ht(e,o,{get:t[o],enumerable:!0})},jo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Fa(t))!Co.call(e,n)&&n!==o&&ht(e,n,{get:()=>t[n],enumerable:!(r=Ba(t,n))||r.enumerable});return e};var Ya=(e,t,o)=>(o=e!=null?Ga(Ua(e)):{},jo(t||!e||!e.__esModule?ht(o,"default",{value:e,enumerable:!0}):o,e)),Ka=e=>jo(ht({},"__esModule",{value:!0}),e);var Ci={};Wa(Ci,{ActivityVariant:()=>zt,ComplexVariant:()=>Ut,ElementType:()=>Bt,ExclusiveVariant:()=>Wt,GatewayVariant:()=>Ie,Modeler:()=>wi,RoutingVariant:()=>Ft});module.exports=Ka(Ci);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function Jo({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"),ha=require("lecom-ui"),he=require("react"),va=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||{}),Ut=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Ut||{}),Wt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Wt||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Yt=({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 Io=require("react/jsx-runtime"),tt=({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:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,Io.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"),Kt=({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"),Zt=({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"),Qo=({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 er=require("clsx"),tr=require("tailwind-merge");function A(...e){return(0,tr.twMerge)((0,er.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),or=({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 $t=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,$t.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,$t.jsx)("g",{children:(0,$t.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 Ao=require("react/jsx-runtime"),Xt=({size:e=24,className:t})=>(0,Ao.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,Ao.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 ko=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,ko.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,ko.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"),nr=({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"),ar=({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"),ir=({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 qt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var jt={LOOP:{icon:st.RotateCcw}},Ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ie||{}),Jt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Zt},COMPLEX:{icon:Kt}};var Lo=Ya(require("@dagrejs/dagre"),1),cr=require("@xyflow/react"),pr=require("lodash");var Za={MIN_WIDTH:36,MIN_HEIGHT:36},$a={MIN_WIDTH:36,MIN_HEIGHT:36},Xa={MIN_WIDTH:56,MIN_HEIGHT:56},Qt={MIN_WIDTH:176,MIN_HEIGHT:96},eo={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},to={MIN_WIDTH:176,MIN_HEIGHT:64},qa={MIN_WIDTH:128,MIN_HEIGHT:64},Y={START_EVENT:Za,END_EVENT:$a,GATEWAY:Xa,TASK:Qt,LANE:oe,ANNOTATION:to,UNSUPPORTED:qa};var sr=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,sr.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),lr=(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)),ja=(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)},Ja=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ae(e),{x:i,y:s,w:l,h:c}=Ae(t);return o<i+l&&i<o+n&&r<s+c&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&Ja(e,n)){let a=ja(e,n);a<r&&(r=a,o=n)}return o},dr=(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 mr=(e=[],t=[],o="LR")=>{let r=new Lo.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)),Lo.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 m,E;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let a=(0,pr.orderBy)(n,["position.y"]),i=Math.max((E=(m=r.measured)==null?void 0:m.width)!=null?E:0,eo.MIN_WIDTH),s=dr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),c=0,u=0;a.forEach(g=>{var y,b,d,p;o=o.map(T=>T.id===g.id?_(v({},T),{width:l-oe.HEADER_WIDTH,measured:_(v({},T.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:c}}):T),c+=(b=(y=g.measured)==null?void 0:y.height)!=null?b:0,u+=(p=(d=g.measured)==null?void 0:d.height)!=null?p:0}),o=o.map(g=>g.id===e?_(v({},g),{height:u,width:l,measured:_(v({},g.measured),{height:u,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},ur=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Qa=50,fr=(e,t=Qa)=>{let o=(0,cr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var gr=require("zustand"),$=(0,gr.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 Ee=require("@xyflow/react"),ve=require("lecom-ui"),vr=require("lucide-react");var oo=require("react"),Er=(0,oo.createContext)(null),br=Er.Provider,hr=()=>{let e=(0,oo.useContext)(Er);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,Ee.useReactFlow)(),{onConfigureElement:s}=hr(),l=d=>{let p=a(),T=i(),x=(0,Ee.getIncomers)(d,p,T),C=(0,Ee.getOutgoers)(d,p,T),S=x.some(N=>N.type==="START_EVENT"),h=C.some(N=>N.type==="END_EVENT");return S?"start":h?"end":"between"},c=d=>{var N,k,w;let p=a(),T=i(),x=r(d.source),C=r(d.target);if(!x||!C)return"simple";if((0,Ee.getOutgoers)(x,p,T).some(L=>L.type==="END_EVENT"))return"final";if(x.type==="GATEWAY")switch((N=x.data)==null?void 0:N.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(x.type==="TASK"){let L=(k=x.data)==null?void 0:k.variant,I=(w=x.data)==null?void 0:w.attribute;return L==="SCRIPT"?"script":I==="LOOP"?"loop":"simple"}return"simple"},u=d=>{var N;let p=r(d.source);if(!p||p.type!=="GATEWAY"||((N=p.data)==null?void 0:N.variant)!=="COMPLEX")return;let T=a(),x=i(),C=(0,Ee.getIncomers)(p,T,x),S=!1,h=!1;if(C.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(S=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(h=!0))}),S&&h)return"script_loop";if(S)return"script";if(h)return"loop"},f=d=>{var N;let p=r(d.source);if(!p||p.type!=="GATEWAY"||((N=p.data)==null?void 0:N.variant)!=="EXCLUSIVE")return;let T=a(),x=i(),C=(0,Ee.getIncomers)(p,T,x),S=!1,h=!1;if(C.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(S=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(h=!0))}),S)return"script";if(h)return"loop"},m=d=>{var h,N;if(d.type!=="GATEWAY")return;let p=a(),T=i(),x=(0,Ee.getIncomers)(d,p,T),C=!1,S=!1;if(x.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(C=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(S=!0))}),((h=d.data)==null?void 0:h.variant)==="COMPLEX"){if(C&&S)return"script_loop";if(C)return"script";if(S)return"loop"}else if(((N=d.data)==null?void 0:N.variant)==="EXCLUSIVE"){if(C)return"script";if(S)return"loop"}},E=d=>(0,Ee.getOutgoers)(d,a(),i()).map(x=>{var C,S;return{id:x.id,type:x.type,variant:(C=x.data)==null?void 0:C.variant,label:(S=x.data)==null?void 0:S.label}}),g=()=>{var p,T,x;let d=r(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(p=d.data)==null?void 0:p.label,targets:E(d)});return}s==null||s({id:d.id,type:"gateway",variant:((T=d.data)==null?void 0:T.variant)||"EXCLUSIVE",label:(x=d.data)==null?void 0:x.label,subVariant:m(d),targets:E(d)})}},y=()=>{let d=n(e);if(d){let p=c(d),T;p==="complex"?T=u(d):p==="exclusive"&&(T=f(d)),s==null||s({id:d.id,type:"routing",variant:p,subVariant:T})}};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":g();break;case"edge":y();break}},children:(0,Ke.jsx)(vr.PencilIcon,{size:16})})}),(0,Ke.jsx)(ve.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Nr=require("@xyflow/react"),Ne=require("lecom-ui"),yr=require("lucide-react"),Ze=require("react/jsx-runtime"),no=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{deleteElements:r}=(0,Nr.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)(yr.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)(no,{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,c)=>(0,_t.jsx)("div",{children:l.component},c))}))};var $e=require("react/jsx-runtime"),io={type:"ANNOTATION_EDGE",zIndex:2e3},Tr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let c=(0,ye.useNodes)(),{zoom:u}=(0,ye.useViewport)(),f=c.find(p=>p.id===t),m=c.find(p=>p.id===o),[E,g,y]=(0,ye.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),b=s||(f==null?void 0:f.selected)||(m==null?void 0:m.selected),d=1/u;return(0,$e.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),children:[(0,$e.jsx)(ye.BaseEdge,{id:e,path:E,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)]":b&&!(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(${g}px, ${y}px)`},children:s&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};var re=require("@xyflow/react"),xr=require("react");var Xe=require("react");var So=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,c]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{c(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let E=document.createRange();E.selectNodeContents(s.current),E.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(E))}},[l]);let u=E=>{E.stopPropagation(),c(!0)},f=E=>{let g=E.currentTarget.innerText;t&&g.length>=t&&E.preventDefault()},m=E=>{c(!1),n==null||n(),o==null||o(E.currentTarget.innerText)};return(0,So.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:u,children:(0,So.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,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:""}},_r=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let f=(0,re.useNodes)(),{zoom:m}=(0,re.useViewport)(),{updateEdgeData:E}=(0,re.useReactFlow)(),[g,y]=(0,xr.useState)(!1),b=f.find(I=>I.id===t),d=f.find(I=>I.id===o),[p,T,x]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),C=u||(b==null?void 0:b.selected)||(d==null?void 0:d.selected),S=C?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(c==null?void 0:c.label.trim().length)>0,N=1/m,k=()=>{y(!0)},w=()=>{y(!1)},L=I=>{E(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":C}),onBlur:w,onDoubleClick:k,children:[(0,Re.jsx)(re.BaseEdge,{id:e,path:p,markerEnd:`url(#${S})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":C&&!(c!=null&&c.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, ${x}px)`},children:[u&&(0,Re.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${N})`}}),h&&(0,Re.jsx)(Q,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};var wr=({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),io),a):(0,wt.addEdge)(v(v({},n),Me),a)})}}};var Po=require("react"),Rr=require("lecom-ui"),Mr=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")||[],Cr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ir=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),so=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Ar=(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),kr=(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"},Lr=(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},Sr=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)}},Pr=(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=so(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(c=>r.push(c.id)))}}}return R({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Ar(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||Sr(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(c=>c.source===l.id)),a=Te(n,l=>!kr(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 c=It(l.id,e.edges),u=pe(l.id,e.edges),f=c.some(E=>{var g;return((g=e.nodes.find(y=>y.id===E.source))==null?void 0:g.type)==="START_EVENT"}),m=u.some(E=>{var g;return((g=e.nodes.find(y=>y.id===E.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),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=so(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=so(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=Cr(e.nodes),o=Te(t,r=>!Lr(r.id,e));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ir(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 Dr=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 Vr=()=>{let{t:e}=(0,Rr.useTranslation)(),[t,o]=(0,Po.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Mr.useReactFlow)(),[s,l]=(0,Po.useState)(!1);return{validationResult:t,validateDiagram:m=>{let E=Pr(m.nodes,m.edges),g=Dr(E),y=g.errors.map(b=>_(v({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:y}},handleValidationComplete:m=>{if(o(m),!m)return;let E=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(N=>E.push(N)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(N=>g.push(N))});let y=[...new Set(E)];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 b=a(),d=i(),p=new Set(y),T=new Set;m.errors.forEach(h=>{var w,L;let N=At.find(I=>I.id===h.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>T.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{d.forEach(j=>{(j.source===I||j.target===I)&&T.add(j.id)})}))});let x=new Set,C=new Set,S=new Set;b.forEach(h=>{h.type==="START_EVENT"?x.add(h.id):h.type==="END_EVENT"&&C.add(h.id)}),d.forEach(h=>{x.has(h.source)&&S.add(h.target),C.has(h.target)&&S.add(h.source)}),S.forEach(h=>{var N,k;if(p.has(h)){let w=(N=m.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===w))==null?void 0:k.highlightRelatedEdges)!==!1&&d.forEach(I=>{I.source===h&&C.has(I.target)&&(p.add(I.target),T.add(I.id)),I.target===h&&x.has(I.source)&&(p.add(I.source),T.add(I.id))})}}),p.size>0&&r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:p.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(m=>m.map(E=>_(v({},E),{data:_(v({},E.data),{hasError:!1})}))),n(m=>m.map(E=>_(v({},E),{data:_(v({},E.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Gr=require("@xyflow/react"),Hr=require("react"),Do=require("uuid");var ti=15,Or="bpmn:selection",Br=({offset:e=ti}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Gr.useReactFlow)();(0,Hr.useEffect)(()=>{let a=s=>{var E;s.preventDefault();let l=t(),c=r(),u=l.filter(g=>g.selected);if(!u.length)return;let f=c.filter(g=>u.some(y=>y.id===g.source)&&u.some(y=>y.id===g.target)),m={nodes:u,edges:f};(E=s.clipboardData)==null||E.setData(Or,JSON.stringify(m))},i=s=>{var m,E;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Or))||"{}");if(!((E=l.nodes)!=null&&E.length))return;let c=new Map,u=l.nodes.map(g=>{let y=(0,Do.v7)();return c.set(g.id,y),_(v({},g),{id:y,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(v({},g),{id:(0,Do.v7)(),selected:!0,source:c.get(g.source)||g.source,target:c.get(g.target)||g.target}));o(g=>[...g.map(y=>_(v({},y),{selected:!1})),...u]),n(g=>[...g.map(y=>_(v({},y),{selected:!1})),...f])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};var lo=require("@xyflow/react"),Ro=require("uuid");var zr=require("zustand"),ct=(0,zr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Fr=require("react");var Oe=require("react/jsx-runtime"),Il={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},Ur=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let f=(0,se.useNodes)(),{zoom:m}=(0,se.useViewport)(),{updateEdgeData:E}=(0,se.useReactFlow)(),[g,y]=(0,Fr.useState)(!1),b=f.find(I=>I.id===t),d=f.find(I=>I.id===o),[p,T,x]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),C=u||(b==null?void 0:b.selected)||(d==null?void 0:d.selected),S=C?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(c==null?void 0:c.label.trim().length)>0,N=1/m,k=()=>{y(!0)},w=()=>{y(!1)},L=I=>{E(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":C}),onBlur:w,onDoubleClick:k,children:[(0,Oe.jsx)(se.BaseEdge,{id:e,path:p,markerEnd:`url(#${S})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":C&&!(c!=null&&c.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, ${x}px)`},children:[u&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${N})`}}),h&&(0,Oe.jsx)(Q,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};var kt=require("react/jsx-runtime"),Wr=({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 Yr=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,lo.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=ct(),{getInternalNode:i,screenToFlowPosition:s}=(0,lo.useReactFlow)(),l=b=>{let d="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(p=>p.map(T=>_(v({},T),{className:T.id===b?d:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},u=b=>{let d=i(b.id),p=c();if(b.type==="LANE"){if(lt({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let N=p.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=Tt(d,N);if(!k){l();return}if(lt({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let x=p.filter(h=>h.id!==b.id&&h.type==="LANE"),C=Tt(d,x);if(!C){l();return}if(lt({parentId:C.id,nodes:e,includeTypes:["LANE"]})){l();return}l(C.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,d)=>{b.preventDefault(),u(d)},E=(b,d,p)=>{var N,k;let T=w=>w.map(L=>_(v({},L),{className:void 0}));if(b.parentId===d.id){let w=Ye(d.id,p);t(ke(T(w)));return}if(b.type==="LANE"){if(lt({parentId:d.id,nodes:p,excludeTypes:["LANE"]}))return;let I=p.filter(Z=>Z.parentId===d.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=p.map(Z=>Z.id===b.id?_(v({},Z),{parentId:d.id,position:j,className:void 0}):_(v({},Z),{className:void 0}));ie=Ye(d.id,ie),t(ke(ie));return}if(lt({parentId:d.id,nodes:p,includeTypes:["LANE"]})){let w;if(b.parentId){let I=i(b.parentId),{x:j,y:ie}=Ae(I);w={x:j+((N=b.position.x)!=null?N:0),y:ie+((k=b.position.y)!=null?k:0)}}let L=p.map(I=>I.id===b.id?_(v({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(v({},I),{className:void 0}));t(ke(L));return}let S=lr(b,d),h=p.map(w=>w.id===b.id?_(v({},w),{parentId:d.id,position:S,className:void 0}):_(v({},w),{className:void 0}));t(ke(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let d=s({x:b.clientX,y:b.clientY}),p={width:Y[n.type].MIN_WIDTH,height:Y[n.type].MIN_HEIGHT},T={id:(0,Ro.v7)(),type:n.type,position:d,measured:p,data:{label:"",variant:n.variant,attribute:n.attribute}},x=_(v({},T),{internals:{positionAbsolute:d}}),C=c(),S=n.type==="LANE",h=C.filter(w=>S?w.type==="LANE"&&!w.parentId:w.type==="LANE"),N=Tt(x,h);N?E(x,N,[...C,x]):t(w=>{let L=w.concat(T);return ke(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:(0,Ro.v7)(),source:k,target:T.id};if(n.type==="ANNOTATION"){o(L=>L.concat(v(v({},w),io)));return}o(L=>L.concat(v(v({},w),Me)))}a(null)},onNodeDrag:m,onNodeDragStop:async(b,d)=>{var N,k;let{nodeLookup:p}=r.getState(),T=i(d.id),x=Array.from(p.values()),C=d.type==="LANE",S=x.filter(w=>w.id!==d.id&&(C?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Tt(T,S);if(h){E(T,h,x);return}if(d.parentId){let w=i(d.parentId),{x:L,y:I}=Ae(w),j={x:L+((N=d.position.x)!=null?N:0),y:I+((k=d.position.y)!=null?k:0)},ie=e.map(Z=>Z.id===d.id?_(v({},Z),{position:j,parentId:void 0}):Z);ie=Ye(d.parentId,ie),t(ke(ie))}}}};var Zr=require("@xyflow/react"),Lt=require("react");function Kr(e,t,o=5){var l,c,u,f,m,E,g,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(u=n.measured)==null?void 0:u.height)!=null?f:0),width:(E=(m=n.measured)==null?void 0:m.width)!=null?E:0,height:(y=(g=n.measured)==null?void 0:g.height)!=null?y:0},i=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,d)=>{var L,I,j,ie,Z,Qe,ze,Fe;let p={left:d.position.x,right:d.position.x+((I=(L=d.measured)==null?void 0:L.width)!=null?I:0),top:d.position.y,bottom:d.position.y+((ie=(j=d.measured)==null?void 0:j.height)!=null?ie:0),width:(Qe=(Z=d.measured)==null?void 0:Z.width)!=null?Qe:0,height:(Fe=(ze=d.measured)==null?void 0:ze.height)!=null?Fe:0},T=Math.abs(a.left-p.left);T<s&&(b.snapPosition.x=p.left,b.vertical=p.left,s=T);let x=Math.abs(a.right-p.right);x<s&&(b.snapPosition.x=p.right-a.width,b.vertical=p.right,s=x);let C=Math.abs(a.left-p.right);C<s&&(b.snapPosition.x=p.right,b.vertical=p.right,s=C);let S=Math.abs(a.right-p.left);S<s&&(b.snapPosition.x=p.left-a.width,b.vertical=p.left,s=S);let h=Math.abs(a.top-p.top);h<i&&(b.snapPosition.y=p.top,b.horizontal=p.top,i=h);let N=Math.abs(a.bottom-p.top);N<i&&(b.snapPosition.y=p.top-a.height,b.horizontal=p.top,i=N);let k=Math.abs(a.bottom-p.bottom);k<i&&(b.snapPosition.y=p.bottom-a.height,b.horizontal=p.bottom,i=k);let w=Math.abs(a.top-p.bottom);return w<i&&(b.snapPosition.y=p.bottom,b.horizontal=p.bottom,i=w),b},r)}var $r=()=>{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 c=Kr(a[0],i);a[0].position.x=(s=c.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),r(c.vertical)}return(0,Zr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var Qr=require("@xyflow/react"),Mo=require("uuid");var qr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},jr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Xr=(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}},oi=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=Xr(a[0],o),s=Xr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},Jr=e=>{let{components:t,connections:o}=oi(e);return{nodes:t,edges:o}};var en=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Qr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=Jr(n),s=[],l=new Map;for(let[
|
|
1
|
+
"use strict";var Ga=Object.create;var ht=Object.defineProperty,Ha=Object.defineProperties,Ba=Object.getOwnPropertyDescriptor,za=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Ua=Object.getPrototypeOf,Co=Object.prototype.hasOwnProperty,qo=Object.prototype.propertyIsEnumerable;var Xo=(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={}))Co.call(t,o)&&Xo(e,o,t[o]);if(Ot)for(var o of Ot(t))qo.call(t,o)&&Xo(e,o,t[o]);return e},C=(e,t)=>Ha(e,za(t));var et=(e,t)=>{var o={};for(var r in e)Co.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&&qo.call(e,r)&&(o[r]=e[r]);return o};var Wa=(e,t)=>{for(var o in t)ht(e,o,{get:t[o],enumerable:!0})},jo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Fa(t))!Co.call(e,n)&&n!==o&&ht(e,n,{get:()=>t[n],enumerable:!(r=Ba(t,n))||r.enumerable});return e};var Ya=(e,t,o)=>(o=e!=null?Ga(Ua(e)):{},jo(t||!e||!e.__esModule?ht(o,"default",{value:e,enumerable:!0}):o,e)),Ka=e=>jo(ht({},"__esModule",{value:!0}),e);var Ci={};Wa(Ci,{ActivityVariant:()=>zt,ComplexVariant:()=>Ut,ElementType:()=>Bt,ExclusiveVariant:()=>Wt,GatewayVariant:()=>Ie,Modeler:()=>wi,RoutingVariant:()=>Ft});module.exports=Ka(Ci);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function Jo({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"),ha=require("lecom-ui"),he=require("react"),va=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||{}),Ut=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Ut||{}),Wt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Wt||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Yt=({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 Io=require("react/jsx-runtime"),tt=({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:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,Io.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"),Kt=({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"),Zt=({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"),Qo=({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 er=require("clsx"),tr=require("tailwind-merge");function A(...e){return(0,tr.twMerge)((0,er.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),or=({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 $t=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,$t.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,$t.jsx)("g",{children:(0,$t.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 Ao=require("react/jsx-runtime"),Xt=({size:e=24,className:t})=>(0,Ao.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,Ao.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 ko=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,ko.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,ko.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"),nr=({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"),ar=({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"),ir=({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 qt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var jt={LOOP:{icon:st.RotateCcw}},Ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ie||{}),Jt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Zt},COMPLEX:{icon:Kt}};var Lo=Ya(require("@dagrejs/dagre"),1),cr=require("@xyflow/react"),pr=require("lodash");var Za={MIN_WIDTH:36,MIN_HEIGHT:36},$a={MIN_WIDTH:36,MIN_HEIGHT:36},Xa={MIN_WIDTH:56,MIN_HEIGHT:56},Qt={MIN_WIDTH:176,MIN_HEIGHT:96},eo={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},to={MIN_WIDTH:176,MIN_HEIGHT:64},qa={MIN_WIDTH:128,MIN_HEIGHT:64},K={START_EVENT:Za,END_EVENT:$a,GATEWAY:Xa,TASK:Qt,LANE:oe,ANNOTATION:to,UNSUPPORTED:qa};var sr=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,sr.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),lr=(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)),ja=(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)},Ja=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ae(e),{x:i,y:s,w:l,h:c}=Ae(t);return o<i+l&&i<o+n&&r<s+c&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&Ja(e,n)){let a=ja(e,n);a<r&&(r=a,o=n)}return o},dr=(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 mr=(e=[],t=[],o="LR")=>{let r=new Lo.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)),Lo.default.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return C(v({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var p,E;let o=[...t],r=o.find(f=>f.id===e);if(!r)return o;let n=o.filter(f=>f.parentId===e&&f.type==="LANE");if(n.length===0)return o;let a=(0,pr.orderBy)(n,["position.y"]),i=Math.max((E=(p=r.measured)==null?void 0:p.width)!=null?E:0,eo.MIN_WIDTH),s=dr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),c=0,u=0;a.forEach(f=>{var T,b,m,d;o=o.map(N=>N.id===f.id?C(v({},N),{width:l-oe.HEADER_WIDTH,measured:C(v({},N.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:c}}):N),c+=(b=(T=f.measured)==null?void 0:T.height)!=null?b:0,u+=(d=(m=f.measured)==null?void 0:m.height)!=null?d:0}),o=o.map(f=>f.id===e?C(v({},f),{height:u,width:l,measured:C(v({},f.measured),{height:u,width:l})}):f);let g=o.find(f=>f.id===e);return g!=null&&g.parentId&&(o=Ye(g.parentId,o)),o},ur=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Qa=50,fr=(e,t=Qa)=>{let o=(0,cr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var gr=require("zustand"),X=(0,gr.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 Ee=require("@xyflow/react"),ve=require("lecom-ui"),vr=require("lucide-react");var oo=require("react"),Er=(0,oo.createContext)(null),br=Er.Provider,hr=()=>{let e=(0,oo.useContext)(Er);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,Ee.useReactFlow)(),{onConfigureElement:s}=hr(),l=d=>{let N=a(),I=i(),y=(0,Ee.getIncomers)(d,N,I),k=(0,Ee.getOutgoers)(d,N,I),h=y.some(L=>L.type==="START_EVENT"),_=k.some(L=>L.type==="END_EVENT");return h?"start":_?"end":"between"},c=d=>{var L,w,S;let N=a(),I=i(),y=r(d.source),k=r(d.target);if(!y||!k)return"simple";if((0,Ee.getOutgoers)(y,N,I).some(x=>x.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((L=y.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let x=(w=y.data)==null?void 0:w.variant,Y=(S=y.data)==null?void 0:S.attribute;return x==="SCRIPT"?"script":Y==="LOOP"?"loop":"simple"}return"simple"},u=d=>{var L;let N=r(d.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="COMPLEX")return;let I=a(),y=i(),k=(0,Ee.getIncomers)(N,I,y),h=!1,_=!1;if(k.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h&&_)return"script_loop";if(h)return"script";if(_)return"loop"},g=d=>{var L;let N=r(d.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let I=a(),y=i(),k=(0,Ee.getIncomers)(N,I,y),h=!1,_=!1;if(k.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h)return"script";if(_)return"loop"},p=d=>{var _,L;if(d.type!=="GATEWAY")return;let N=a(),I=i(),y=(0,Ee.getIncomers)(d,N,I),k=!1,h=!1;if(y.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(k=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(h=!0))}),((_=d.data)==null?void 0:_.variant)==="COMPLEX"){if(k&&h)return"script_loop";if(k)return"script";if(h)return"loop"}else if(((L=d.data)==null?void 0:L.variant)==="EXCLUSIVE"){if(k)return"script";if(h)return"loop"}},E=d=>(0,Ee.getOutgoers)(d,a(),i()).map(y=>{var k,h;return{id:y.id,type:y.type,variant:(k=y.data)==null?void 0:k.variant,label:(h=y.data)==null?void 0:h.label}}),f=d=>i().filter(y=>y.source===d.id).map(y=>{var k;return{id:y.id,type:"routing",variant:c(y),label:(k=y.data)==null?void 0:k.label}}),T=()=>{var N,I,y,k;let d=r(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(N=d.data)==null?void 0:N.label,targets:E(d),edgeTargets:f(d)}),console.log({id:d.id,type:"activity",variant:l(d),label:(I=d.data)==null?void 0:I.label,targets:E(d),edgeTargets:f(d)});return}s==null||s({id:d.id,type:"gateway",variant:((y=d.data)==null?void 0:y.variant)||"EXCLUSIVE",label:(k=d.data)==null?void 0:k.label,subVariant:p(d),targets:E(d)})}},b=()=>{let d=n(e);if(d){let N=c(d),I;N==="complex"?I=u(d):N==="exclusive"&&(I=g(d)),s==null||s({id:d.id,type:"routing",variant:N,subVariant:I})}};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":T();break;case"edge":b();break}},children:(0,Ke.jsx)(vr.PencilIcon,{size:16})})}),(0,Ke.jsx)(ve.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Nr=require("@xyflow/react"),Ne=require("lecom-ui"),yr=require("lucide-react"),Ze=require("react/jsx-runtime"),no=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{deleteElements:r}=(0,Nr.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)(yr.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)(no,{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",C(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,c)=>(0,_t.jsx)("div",{children:l.component},c))}))};var $e=require("react/jsx-runtime"),io={type:"ANNOTATION_EDGE",zIndex:2e3},Tr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let c=(0,ye.useNodes)(),{zoom:u}=(0,ye.useViewport)(),g=c.find(d=>d.id===t),p=c.find(d=>d.id===o),[E,f,T]=(0,ye.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),b=s||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),m=1/u;return(0,$e.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),children:[(0,$e.jsx)(ye.BaseEdge,{id:e,path:E,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)]":b&&!(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(${f}px, ${T}px)`},children:s&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${m})`}})})})]})};var re=require("@xyflow/react"),xr=require("react");var Xe=require("react");var So=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,c]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{c(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let E=document.createRange();E.selectNodeContents(s.current),E.collapse(!1);let f=window.getSelection();f&&(f.removeAllRanges(),f.addRange(E))}},[l]);let u=E=>{E.stopPropagation(),c(!0)},g=E=>{let f=E.currentTarget.innerText;t&&f.length>=t&&E.preventDefault()},p=E=>{c(!1),n==null||n(),o==null||o(E.currentTarget.innerText)};return(0,So.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:u,children:(0,So.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:p,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:""}},_r=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let g=(0,re.useNodes)(),{zoom:p}=(0,re.useViewport)(),{updateEdgeData:E}=(0,re.useReactFlow)(),[f,T]=(0,xr.useState)(!1),b=g.find(x=>x.id===t),m=g.find(x=>x.id===o),[d,N,I]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),y=u||(b==null?void 0:b.selected)||(m==null?void 0:m.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=f||(c==null?void 0:c.label.trim().length)>0,_=1/p,L=()=>{T(!0)},w=()=>{T(!1)},S=x=>{E(e,{label:x.trim()})};return(0,Re.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:w,onDoubleClick:L,children:[(0,Re.jsx)(re.BaseEdge,{id:e,path:d,markerEnd:`url(#${k})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.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(${N}px, ${I}px)`},children:[u&&(0,Re.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${_})`}}),h&&(0,Re.jsx)(Q,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:f,onChange:S})]})})]})};var wr=({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),io),a):(0,wt.addEdge)(v(v({},n),Me),a)})}}};var Po=require("react"),Rr=require("lecom-ui"),Mr=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")||[],Cr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ir=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),so=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Ar=(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),kr=(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"},Lr=(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},Sr=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)}},Pr=(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=so(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(c=>r.push(c.id)))}}}return R({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Ar(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||Sr(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(c=>c.source===l.id)),a=Te(n,l=>!kr(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 c=It(l.id,e.edges),u=pe(l.id,e.edges),g=c.some(E=>{var f;return((f=e.nodes.find(T=>T.id===E.source))==null?void 0:f.type)==="START_EVENT"}),p=u.some(E=>{var f;return((f=e.nodes.find(T=>T.id===E.target))==null?void 0:f.type)==="END_EVENT"});return g&&p}),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=so(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=so(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=Cr(e.nodes),o=Te(t,r=>!Lr(r.id,e));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ir(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 Dr=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 Vr=()=>{let{t:e}=(0,Rr.useTranslation)(),[t,o]=(0,Po.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Mr.useReactFlow)(),[s,l]=(0,Po.useState)(!1);return{validationResult:t,validateDiagram:p=>{let E=Pr(p.nodes,p.edges),f=Dr(E),T=f.errors.map(b=>C(v({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:f.isValid,errors:T}},handleValidationComplete:p=>{if(o(p),!p)return;let E=[],f=[];p.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(_=>E.push(_)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(_=>f.push(_))});let T=[...new Set(E)];r(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:!1})}))),n(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:!1})})));let b=a(),m=i(),d=new Set(T),N=new Set;p.errors.forEach(h=>{var w,S;let _=At.find(x=>x.id===h.id);(_==null?void 0:_.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(x=>N.add(x)),(S=h.nodeIds)==null||S.forEach(x=>{m.forEach(Y=>{(Y.source===x||Y.target===x)&&N.add(Y.id)})}))});let I=new Set,y=new Set,k=new Set;b.forEach(h=>{h.type==="START_EVENT"?I.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),m.forEach(h=>{I.has(h.source)&&k.add(h.target),y.has(h.target)&&k.add(h.source)}),k.forEach(h=>{var _,L;if(d.has(h)){let w=(_=p.errors.find(x=>{var Y;return(Y=x.nodeIds)==null?void 0:Y.includes(h)}))==null?void 0:_.id;((L=At.find(x=>x.id===w))==null?void 0:L.highlightRelatedEdges)!==!1&&m.forEach(x=>{x.source===h&&y.has(x.target)&&(d.add(x.target),N.add(x.id)),x.target===h&&I.has(x.source)&&(d.add(x.source),N.add(x.id))})}}),d.size>0&&r(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:d.has(_.id)})}))),N.size>0&&n(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:N.has(_.id)})})))},clearValidation:()=>{o(null),l(!1),r(p=>p.map(E=>C(v({},E),{data:C(v({},E.data),{hasError:!1})}))),n(p=>p.map(E=>C(v({},E),{data:C(v({},E.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Gr=require("@xyflow/react"),Hr=require("react"),Do=require("uuid");var ti=15,Or="bpmn:selection",Br=({offset:e=ti}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Gr.useReactFlow)();(0,Hr.useEffect)(()=>{let a=s=>{var E;s.preventDefault();let l=t(),c=r(),u=l.filter(f=>f.selected);if(!u.length)return;let g=c.filter(f=>u.some(T=>T.id===f.source)&&u.some(T=>T.id===f.target)),p={nodes:u,edges:g};(E=s.clipboardData)==null||E.setData(Or,JSON.stringify(p))},i=s=>{var p,E;s.preventDefault();let l=JSON.parse(((p=s.clipboardData)==null?void 0:p.getData(Or))||"{}");if(!((E=l.nodes)!=null&&E.length))return;let c=new Map,u=l.nodes.map(f=>{let T=(0,Do.v7)();return c.set(f.id,T),C(v({},f),{id:T,selected:!0,position:{x:f.position.x+e,y:f.position.y+e}})}),g=l.edges.map(f=>C(v({},f),{id:(0,Do.v7)(),selected:!0,source:c.get(f.source)||f.source,target:c.get(f.target)||f.target}));o(f=>[...f.map(T=>C(v({},T),{selected:!1})),...u]),n(f=>[...f.map(T=>C(v({},T),{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 lo=require("@xyflow/react"),Ro=require("uuid");var zr=require("zustand"),ct=(0,zr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Fr=require("react");var Oe=require("react/jsx-runtime"),Il={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},Ur=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let g=(0,se.useNodes)(),{zoom:p}=(0,se.useViewport)(),{updateEdgeData:E}=(0,se.useReactFlow)(),[f,T]=(0,Fr.useState)(!1),b=g.find(x=>x.id===t),m=g.find(x=>x.id===o),[d,N,I]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),y=u||(b==null?void 0:b.selected)||(m==null?void 0:m.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=f||(c==null?void 0:c.label.trim().length)>0,_=1/p,L=()=>{T(!0)},w=()=>{T(!1)},S=x=>{E(e,{label:x.trim()})};return(0,Oe.jsxs)("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:w,onDoubleClick:L,children:[(0,Oe.jsx)(se.BaseEdge,{id:e,path:d,markerEnd:`url(#${k})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.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(${N}px, ${I}px)`},children:[u&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${_})`}}),h&&(0,Oe.jsx)(Q,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:f,onChange:S})]})})]})};var kt=require("react/jsx-runtime"),Wr=({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 Yr=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,lo.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=ct(),{getInternalNode:i,screenToFlowPosition:s}=(0,lo.useReactFlow)(),l=b=>{let m="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(N=>C(v({},N),{className:N.id===b?m:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},u=b=>{let m=i(b.id),d=c();if(b.type==="LANE"){if(lt({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let _=d.filter(S=>S.id!==b.id&&S.type==="LANE"&&!S.parentId),L=Tt(m,_);if(!L){l();return}if(lt({parentId:L.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(L.id);return}let I=d.filter(h=>h.id!==b.id&&h.type==="LANE"),y=Tt(m,I);if(!y){l();return}if(lt({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},g=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},p=(b,m)=>{b.preventDefault(),u(m)},E=(b,m,d)=>{var _,L;let N=w=>w.map(S=>C(v({},S),{className:void 0}));if(b.parentId===m.id){let w=Ye(m.id,d);t(ke(N(w)));return}if(b.type==="LANE"){if(lt({parentId:m.id,nodes:d,excludeTypes:["LANE"]}))return;let x=d.filter($=>$.parentId===m.id).reduce(($,Qe)=>{var ze,Fe;return $+((Fe=(ze=Qe.measured)==null?void 0:ze.height)!=null?Fe:0)},0),Y={x:oe.HEADER_WIDTH,y:x},ie=d.map($=>$.id===b.id?C(v({},$),{parentId:m.id,position:Y,className:void 0}):C(v({},$),{className:void 0}));ie=Ye(m.id,ie),t(ke(ie));return}if(lt({parentId:m.id,nodes:d,includeTypes:["LANE"]})){let w;if(b.parentId){let x=i(b.parentId),{x:Y,y:ie}=Ae(x);w={x:Y+((_=b.position.x)!=null?_:0),y:ie+((L=b.position.y)!=null?L:0)}}let S=d.map(x=>x.id===b.id?C(v({},x),{position:w!=null?w:x.position,parentId:void 0,className:void 0}):C(v({},x),{className:void 0}));t(ke(S));return}let k=lr(b,m),h=d.map(w=>w.id===b.id?C(v({},w),{parentId:m.id,position:k,className:void 0}):C(v({},w),{className:void 0}));t(ke(h))};return{onDragOver:g,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let m=s({x:b.clientX,y:b.clientY}),d={width:K[n.type].MIN_WIDTH,height:K[n.type].MIN_HEIGHT},N={id:(0,Ro.v7)(),type:n.type,position:m,measured:d,data:{label:"",variant:n.variant,attribute:n.attribute}},I=C(v({},N),{internals:{positionAbsolute:m}}),y=c(),k=n.type==="LANE",h=y.filter(w=>k?w.type==="LANE"&&!w.parentId:w.type==="LANE"),_=Tt(I,h);_?E(I,_,[...y,I]):t(w=>{let S=w.concat(N);return ke(S)});let L=b.dataTransfer.getData("sourceId");if(L){let w={id:(0,Ro.v7)(),source:L,target:N.id};if(n.type==="ANNOTATION"){o(S=>S.concat(v(v({},w),io)));return}o(S=>S.concat(v(v({},w),Me)))}a(null)},onNodeDrag:p,onNodeDragStop:async(b,m)=>{var _,L;let{nodeLookup:d}=r.getState(),N=i(m.id),I=Array.from(d.values()),y=m.type==="LANE",k=I.filter(w=>w.id!==m.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Tt(N,k);if(h){E(N,h,I);return}if(m.parentId){let w=i(m.parentId),{x:S,y:x}=Ae(w),Y={x:S+((_=m.position.x)!=null?_:0),y:x+((L=m.position.y)!=null?L:0)},ie=e.map($=>$.id===m.id?C(v({},$),{position:Y,parentId:void 0}):$);ie=Ye(m.parentId,ie),t(ke(ie))}}}};var Zr=require("@xyflow/react"),Lt=require("react");function Kr(e,t,o=5){var l,c,u,g,p,E,f,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((g=(u=n.measured)==null?void 0:u.height)!=null?g:0),width:(E=(p=n.measured)==null?void 0:p.width)!=null?E:0,height:(T=(f=n.measured)==null?void 0:f.height)!=null?T:0},i=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,m)=>{var S,x,Y,ie,$,Qe,ze,Fe;let d={left:m.position.x,right:m.position.x+((x=(S=m.measured)==null?void 0:S.width)!=null?x:0),top:m.position.y,bottom:m.position.y+((ie=(Y=m.measured)==null?void 0:Y.height)!=null?ie:0),width:(Qe=($=m.measured)==null?void 0:$.width)!=null?Qe:0,height:(Fe=(ze=m.measured)==null?void 0:ze.height)!=null?Fe:0},N=Math.abs(a.left-d.left);N<s&&(b.snapPosition.x=d.left,b.vertical=d.left,s=N);let I=Math.abs(a.right-d.right);I<s&&(b.snapPosition.x=d.right-a.width,b.vertical=d.right,s=I);let y=Math.abs(a.left-d.right);y<s&&(b.snapPosition.x=d.right,b.vertical=d.right,s=y);let k=Math.abs(a.right-d.left);k<s&&(b.snapPosition.x=d.left-a.width,b.vertical=d.left,s=k);let h=Math.abs(a.top-d.top);h<i&&(b.snapPosition.y=d.top,b.horizontal=d.top,i=h);let _=Math.abs(a.bottom-d.top);_<i&&(b.snapPosition.y=d.top-a.height,b.horizontal=d.top,i=_);let L=Math.abs(a.bottom-d.bottom);L<i&&(b.snapPosition.y=d.bottom-a.height,b.horizontal=d.bottom,i=L);let w=Math.abs(a.top-d.bottom);return w<i&&(b.snapPosition.y=d.bottom,b.horizontal=d.bottom,i=w),b},r)}var $r=()=>{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 c=Kr(a[0],i);a[0].position.x=(s=c.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),r(c.vertical)}return(0,Zr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var Qr=require("@xyflow/react"),Mo=require("uuid");var qr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},jr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Xr=(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}},oi=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=Xr(a[0],o),s=Xr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},Jr=e=>{let{components:t,connections:o}=oi(e);return{nodes:t,edges:o}};var en=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Qr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=Jr(n),s=[],l=new Map;for(let[p,E]of Object.entries(a)){let f=(0,Mo.v7)(),T=qr[E.type],b=jr[E.type];l.set(p,f);let m=K[T].MIN_WIDTH,d=K[T].MIN_HEIGHT;s.push({id:f,type:T,data:{label:E.label||"",variant:b,attribute:""},position:{x:0,y:0},width:m,height:d,measured:{width:m,height:d}})}let c=[];for(let p of i){let E=C(v({},Me),{id:(0,Mo.v7)(),source:l.get(p.sourceId)||p.sourceId,target:l.get(p.targetId)||p.targetId});c.push(E)}let{nodes:u,edges:g}=mr(s,c);e(u),t(g),o()}}};var co=require("react"),ri={origin:"*",debug:!1};function tn(e,t=ri){let{origin:o,debug:r}=t,n=(0,co.useCallback)((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return(0,co.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 rn=require("@xyflow/react"),Le=require("react"),nn=require("use-debounce"),ni={nodes:[],edges:[]},ai=500,on=10,an=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=(0,rn.useReactFlow)(),[n,a]=(0,Le.useState)([ni]),[i,s]=(0,Le.useState)(0),l=n[i],c=i>0,u=i<n.length-1,g=(0,Le.useCallback)(d=>{o(n[d].nodes),r(n[d].edges)},[n,o,r]),p=(0,Le.useCallback)(()=>{if(i>0){let d=i-1;s(d),g(d)}},[i,g]),E=(0,Le.useCallback)(()=>{if(i<n.length-1){let d=i+1;s(d),g(d)}},[n,i,g]),f=d=>{let I=[...n.slice(0,i+1),d],y=I.length>on?I.slice(I.length-on):I;a(y),s(y.length-1)},T=(0,nn.useDebouncedCallback)(()=>{let d=e(),N=t(),I={nodes:d,edges:N};JSON.stringify(l)!==JSON.stringify(I)&&f(I)},ai),b=(0,Le.useCallback)(d=>{if(d==="forceSave"){T();return}d.some(I=>I.type!=="select")&&T()},[T]),m=(0,Le.useCallback)(()=>{a([]),s(0)},[]);return{undo:p,redo:E,saveHistory:b,canUndo:c,canRedo:u,clearHistory:m}};var Vo=require("react/jsx-runtime"),Oo=({id:e,className:t})=>(0,Vo.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,Vo.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var pt=require("react/jsx-runtime"),sn=()=>(0,pt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,pt.jsxs)("defs",{children:[(0,pt.jsx)(Oo,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,pt.jsx)(Oo,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Bo=require("@xyflow/react"),H=require("lecom-ui"),He=require("lucide-react"),Dt=require("react");var ln=require("@xyflow/react"),ii=e=>({unselectAll:e.unselectNodesAndEdges}),po=()=>{let{unselectAll:e}=(0,ln.useStore)(ii);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var xe=require("lecom-ui");var St=(m=>(m.START_EVENT="START_EVENT",m.END_EVENT="END_EVENT",m.TASK="TASK",m.SUBPROCESS="SUBPROCESS",m.GATEWAY="GATEWAY",m.ANNOTATION="ANNOTATION",m.CONNECTION="CONNECTION",m.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",m.ACTIVITY="ACTIVITY",m.PROCESS_INTERFACE="PROCESS_INTERFACE",m.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",m.VARIANT_ACTIVITY="VARIANT_ACTIVITY",m.AUTO_ACTIVITY="AUTO_ACTIVITY",m.DATA_STORE="DATA_STORE",m.DATA_OBJECT="DATA_OBJECT",m.DATA_OUTPUT="DATA_OUTPUT",m.DATA_INPUT="DATA_INPUT",m))(St||{});var yn=require("@xyflow/react"),ut=require("lecom-ui");var dn=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 cn({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);mo(a,`${o}.csv`)}var mo=(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 vn=require("uuid");var Go=require("xml-js");var si={compact:!0,spaces:4},li=e=>e.replaceAll(`
|
|
4
|
-
`,"
");function pn(e,t=si){if(e)return JSON.parse((0,Go.xml2json)(e,
|
|
4
|
+
`,"
");function pn(e,t=si){if(e)return JSON.parse((0,Go.xml2json)(e,C(v({},t),{attributeValueFn:li})))}function mn(e){return e==null?void 0:e.replaceAll("
"," ")}var gn=require("uuid");var xd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},un={script:"SCRIPT",subprocess:"SUBPROCESS"},fn={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}}},ci=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.START_EVENT.MIN_HEIGHT,{node:mt({cell:e,type:"START_EVENT"}),status:r,originalType:o}},pi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.END_EVENT.MIN_HEIGHT,{node:mt({cell:e,type:"END_EVENT"}),status:r,originalType:o}},mi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=un[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.TASK.MIN_HEIGHT),{node:mt({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},ui=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=fn[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=K.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=K.GATEWAY.MIN_HEIGHT,{node:mt({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},fi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.ANNOTATION.MIN_HEIGHT),{node:mt({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},En=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=K.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=K.UNSUPPORTED.MIN_HEIGHT,{node:mt({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},bn=(e,t)=>{let{source:o,target:r}=e._attributes;return C(v({},Me),{id:(0,gn.v7)(),source:t.get(o)||o,target:t.get(r)||r})},hn={TASK:mi,GATEWAY:ui,START_EVENT:ci,END_EVENT:pi,ANNOTATION:fi};var gi=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,vn.v7)(),{type:c}=s._attributes,u=hn[c]||En;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:g,status:p,originalType:E}=u(s);n.push(g),a.push({originalType:E,type:g.type,variant:g.data.variant,value:mn(g.data.label),status:p})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},Ei=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>bn(n,t)),bi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=gi(t.root.mxCell),a=Ei(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},hi=async e=>{let t=await dn(e),o=pn(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}},Nn=async e=>{try{let t=await hi(e),{nodes:o,edges:r,summary:n}=bi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};var xn=require("react/jsx-runtime"),Tn=()=>{let{t:e}=(0,ut.useTranslation)(),{toast:t}=(0,ut.useNotificationToast)(),{setNodes:o,setEdges:r,fitView:n}=(0,yn.useReactFlow)(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(u=>[u.originalType,u.value,e(`adapter.governance.report.status.${u.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,xn.jsx)(ut.Button,{size:"small",variant:"ghost",onClick:()=>cn({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:u}=await Nn(s);if(o(p=>p.concat(l)),r(p=>p.concat(c)),n(),u.some(p=>p.status==="unsupported")){a(u);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};var _n=require("lecom-ui"),wn=require("react");var je=require("react/jsx-runtime"),Cn=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 c=(0,wn.useRef)(null),u=p=>{let E=p.target.files;E!=null&&E.length&&a(E),c.current&&(c.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(_n.Button,C(v({onClick:p=>{var E;(E=c.current)==null||E.click(),n==null||n(p)}},i),{children:e})),(0,je.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:u})]})};var Je=require("react/jsx-runtime"),In=({disabled:e=!1})=>{let{t}=(0,xe.useTranslation)(),{toast:o}=(0,xe.useNotificationToast)(),{createDiagram:r}=Tn(),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)(Cn,{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)(Qo,{})})}),(0,Je.jsx)(xe.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var D=require("lecom-ui"),Ge=require("lucide-react"),Sn=require("react");var An=require("@xyflow/react"),Pt=require("html-to-image"),uo=require("lecom-ui"),kn=require("react");var vi=3,Ho="diagram",Ln=()=>{let{t:e}=(0,uo.useTranslation)(),{getNodes:t}=(0,An.useReactFlow)(),{deselectAll:o}=po(),[r,n]=(0,kn.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:u,y:g,width:p,height:E}=fr(t());return{width:p,height:E,style:{width:`${p}px`,height:`${E}px`,transform:`translate(${-u}px, ${-g}px)`}}},i=async(u,g)=>{n(C(v({},r),{[g]:!0})),await o();try{let p=ur();if(!p)throw new Error("Flow element not found");let E=a();return await u(p,E)}catch(p){(0,uo.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(C(v({},r),{[g]:!1}))}};return{exportAsPng:async(u=Ho)=>{await i(async(g,p)=>{let E=await(0,Pt.toPng)(g,C(v({},p),{backgroundColor:"#fcfcfc"}));mo(E,`${u}.png`)},"png")},exportAsHtml:async(u=Ho)=>{await i(async(g,p)=>{let E=await(0,Pt.toSvg)(g,C(v({},p),{backgroundColor:"#fcfcfc"})),f=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<img src="${E}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,
|
|
18
|
+
`,T=new Blob([f],{type:"text/html"}),b=URL.createObjectURL(T);mo(b,`${u}.html`),setTimeout(()=>URL.revokeObjectURL(b),100)},"html")},printDiagram:async(u=Ho)=>{await i(async(g,p)=>{let E=await(0,Pt.toPng)(g,C(v({},p),{pixelRatio:vi})),f=window.open("","_blank");if(!f)throw new Error("Failed to open print window.");let T=f.document;T.open(),T.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
<img src="${E}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function Pn(){let{t:e}=(0,D.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Ln(),[s,l]=(0,Sn.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"),Dn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,H.useTranslation)(),{deselectAll:i}=po(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:u,isMinimapOpen:f,setIsMinimapOpen:m}=$(),E=(0,Bo.useKeyPress)(["v","V"]),g=(0,Bo.useKeyPress)(["h","H"]),y=(0,Dt.useCallback)(()=>{i(),u()},[i,u]),b=()=>{i();let d=n(o);r&&r(d)};return(0,Dt.useEffect)(()=>{E&&!s&&!t&&c()},[E,c,s,t]),(0,Dt.useEffect)(()=>{g&&!l&&!t&&y()},[g,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:c,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:b,children:(0,P.jsx)(He.ListCheckIcon,{})})}),(0,P.jsx)(H.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,P.jsx)(Pn,{}),!t&&(0,P.jsx)(In,{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(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:(0,P.jsx)(He.MapIcon,{})})}),(0,P.jsx)(H.TooltipContent,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var le=require("lecom-ui"),fo=require("lucide-react"),me=require("react/jsx-runtime"),Rn=({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)(fo.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)(fo.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Mn=require("@xyflow/react"),B=require("lecom-ui"),ft=require("lucide-react");var O=require("react/jsx-runtime"),Vn=()=>{let{t:e}=(0,B.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Mn.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)(rr,{})})}),(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 vo=require("@xyflow/react");var On=require("@xyflow/react");var Gn=require("react/jsx-runtime"),X=({type:e,position:t,className:o})=>(0,Gn.jsx)(On.Handle,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});var go=require("@xyflow/react"),Hn=require("lodash");var Bn=require("react/jsx-runtime"),gt=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,go.useReactFlow)(),s=({width:l,height:c})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let f=[...a()],m=!u.parentId,E=m?u.id:u.parentId,g=f.filter(d=>d.type==="LANE"&&d.parentId===E);if(!g.length)return;let y=(0,Hn.orderBy)(g,["position.y"]),b=0;y.forEach((d,p)=>{var C,S;let T=p===y.length-1,x=(S=(C=d.measured)==null?void 0:C.height)!=null?S:0;f=f.map(h=>{if(h.id===d.id){let N=m?l-oe.HEADER_WIDTH:l,k=_(v({},h),{width:N,measured:_(v({},h.measured),{width:N}),position:_(v({},h.position),{y:b})});return T&&m&&(k.height=c-b),k}return h}),b+=x}),f=f.map(d=>{if(d.id===E){let p=m?l:l+oe.HEADER_WIDTH;return _(v({},d),{width:p,height:m?c:b,measured:{width:p,height:m?c:b}})}return d}),i(f)};return(0,Bn.jsx)(go.NodeResizer,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};var ho=require("@xyflow/react"),_e=require("lecom-ui");var Eo=require("@xyflow/react"),z=require("lecom-ui"),zn=require("lucide-react");var ne=require("react/jsx-runtime"),Fn=({nodeId:e})=>{let{t}=(0,z.useTranslation)(),{updateNodeData:o}=(0,Eo.useReactFlow)(),r=(0,Eo.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)(zn.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(Jt).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 bo=require("@xyflow/react"),G=require("lecom-ui"),Un=require("lucide-react");var q=require("react/jsx-runtime"),Wn=({nodeId:e})=>{let{t}=(0,G.useTranslation)(),{updateNodeData:o}=(0,bo.useReactFlow)(),r=(0,bo.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)(Un.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(jt).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(qt).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 u;let{t:n}=(0,_e.useTranslation)(),{setDraggableNode:a}=ct(),i=({event:f,type:m,variant:E})=>{a({type:m,variant:E}),f.dataTransfer.effectAllowed="move",f.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:Yt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(no,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Wn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Fn,{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)(ho.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:ho.Position.Right,align:"start",isVisible:r,children:(u=c[t])==null?void 0:u.map((f,m)=>f.component?(0,de.jsx)("div",{children:f.component},m):(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:E=>i({event:E,type:f.type,variant:f.variant}),children:f.icon&&(0,de.jsx)(f.icon,{size:16})})}),(0,de.jsx)(_e.TooltipContent,{color:"black",children:f.label})]},m))})};var we=require("react/jsx-runtime"),Yn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,vo.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:to.MIN_WIDTH,minHeight:to.MIN_HEIGHT}),(0,we.jsx)(X,{type:"target",position:vo.Position.Left})]})};var Rt=require("@xyflow/react"),Kn=require("react");var fe=require("react/jsx-runtime"),Zn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Rt.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Kn.useState)(!1),l=f=>{n(e,{label:f})};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"),$n=require("react");var ge=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let n=Jt[t.variant].icon,{updateNodeData:a}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=$(),[s,l]=(0,$n.useState)(!1),c=m=>{a(e,{label:m})};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:c})})]}),(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 No=require("@xyflow/react"),qn=require("react");var be=require("react/jsx-runtime"),jn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,No.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,qn.useState)(!1),l=f=>{n(e,{label:f})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,be.jsx)(Xt,{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,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,be.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,be.jsx)(X,{type:"source",position:No.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),Jn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=$(),i=m=>{n(e,{label:m})},s=t.variant?qt[t.variant].icon:null,l=t.attribute?jt[t.attribute].icon:null,c=t.variant==="SUBPROCESS",u=s&&!c,f=l||c;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":u||f}),onChange:i}),s&&(0,ee.jsx)("div",{className:A("absolute flex items-center p-1",c?"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",c?"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:Qt.MIN_WIDTH,minHeight:Qt.MIN_HEIGHT}),(0,ee.jsx)(X,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(X,{type:"target",position:Vt.Position.Left})]})};var zo=require("@xyflow/react");var Se=require("react/jsx-runtime"),Qn=({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:zo.Position.Right}),(0,Se.jsx)(X,{type:"target",position:zo.Position.Left})]})};var yo=require("@xyflow/react"),ea=require("lodash"),Fo=require("react");var ue=require("react/jsx-runtime"),ta=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,yo.useReactFlow)(),{isMultipleSelection:s}=$(),l=i(),c=!n,u=(0,Fo.useMemo)(()=>(0,ea.orderBy)([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=c?eo.MIN_WIDTH:oe.MIN_WIDTH,m=(0,Fo.useMemo)(()=>{if(c&&u.length>1){let g=[...u];return g.pop(),g.reduce((b,d)=>{var p,T;return b+((T=(p=d.measured)==null?void 0:p.height)!=null?T:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[c,u]),E=g=>{a(e,{label:g})};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:E})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),(0,ue.jsx)(gt,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),c&&(0,ue.jsx)(X,{type:"source",position:yo.Position.Right})]})};var oa={START_EVENT:jn,END_EVENT:Zn,TASK:Jn,GATEWAY:Xn,ANNOTATION:Yn,LANE:ta,UNSUPPORTED:Qn},ra={SEQUENCE_EDGE:_r,MESSAGE_EDGE:Ur,ANNOTATION_EDGE:Tr},na="#fafafa",aa="#bebebe",ia=1,sa=10,la="bottom-left",da=.5,ca=4,pa={x:0,y:0,zoom:.75};var ma=require("@xyflow/react"),To=require("react"),fa=require("react/jsx-runtime"),Ni=e=>({width:e.width,height:e.height,transform:e.transform}),ua=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,ma.useStore)(Ni),s=(0,To.useRef)(null);return(0,To.useEffect)(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let u=window.devicePixelRatio;l.width=n*u,l.height=a*u,c.scale(u,u),c.clearRect(0,0,n,a),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*i[2]+i[0],0),c.lineTo(t*i[2]+i[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*i[2]+i[1]),c.lineTo(n,e*i[2]+i[1]),c.stroke())},[n,a,i,e,t,o,r]),(0,fa.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"),ga=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,U.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(u=>u.filter(f=>!l.some(m=>m.id===f.id))),c!=null&&c.length&&r(u=>u.filter(f=>!c.some(m=>m.id===f.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"),Ea=()=>{let{t:e}=(0,Ce.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:Xt,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:ir,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ar,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:nr,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Zt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Kt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:or,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Yt,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 xo=require("lecom-ui"),Et=require("lucide-react"),_o=require("react"),te=require("react/jsx-runtime"),ba=({validationResult:e,onClose:t})=>{let{t:o}=(0,xo.useTranslation)(),[r,n]=(0,_o.useState)(!1);if((0,_o.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)(xo.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"),yi=[],Ti=({mode:e="edit"})=>{let t=(0,he.useRef)(!1),[o,r]=(0,W.useNodesState)([]),[n,a]=(0,W.useEdgesState)([]),[i,s]=(0,he.useState)(null),{isMoveTool:l,isHandTool:c,isReadOnly:u,setIsReadOnly:f,setIsMultipleSelection:m,isMinimapOpen:E}=$(),{validationResult:g,handleValidationComplete:y,clearValidation:b,isAutoValidationEnabled:d,validateDiagram:p}=Vr(),{getNode:T,getNodes:x,getEdges:C}=(0,W.useReactFlow)(),{onNodeDrag:S,onDrop:h,onDragOver:N,onNodeDragStop:k}=Yr({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:w,onConnect:L}=wr({setEdges:a});Br();let{createDiagram:I}=en(),{undo:j,redo:ie,saveHistory:Z,canUndo:Qe,canRedo:ze}=an(),{helperLineHorizontal:Fe,helperLineVertical:Ca,customApplyNodeChanges:Ia}=$r();tn({LIA_CREATE_DIAGRAM:I,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,he.useEffect)(()=>{f(e==="readonly")},[e,f]);let Aa=()=>{b()},ka=(0,he.useCallback)(({nodes:J,edges:F})=>{let bt=J.length+F.length>1;m(bt)},[m]);(0,W.useOnSelectionChange)({onChange:ka});let La=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($o=>$o.id!==F.id&&$o.type==="LANE"));r(ke(bt))}},Sa=J=>{J.forEach(F=>{switch(F.type){case"remove":La(F);break}})},Pa=(0,he.useCallback)(()=>{if(!d){t.current=!1;return}let J=x(),F=C(),bt=p({nodes:J,edges:F});y(bt),t.current=!1},[d,x,C,p,y]),Ko=(0,va.useDebouncedCallback)(Pa,300),Zo=(0,he.useCallback)(()=>{d&&!t.current&&(t.current=!0,Ko())},[d,Ko]),Da=J=>{r(F=>Ia(J,F)),Z(J),Zo(),Sa(J)},Ra=J=>{a(F=>(0,W.applyEdgeChanges)(J,F)),Z(J),Zo()},Ma=()=>{Z("forceSave")},Va=async({nodes:J,edges:F})=>(s({nodes:J,edges:F}),!1),Oa={nodes:o,edges:n};return(0,K.jsxs)("div",{className:"w-full h-full",children:[!u&&(0,K.jsx)(Ea,{}),(0,K.jsx)(sn,{}),(0,K.jsxs)(W.ReactFlow,{edges:n,nodes:o,nodeTypes:oa,edgeTypes:ra,minZoom:da,maxZoom:ca,panOnDrag:c||u?!0:yi,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!u&&l,nodesConnectable:!u&&l,nodesDraggable:!u&&l,isValidConnection:w,connectionLineComponent:Wr,onConnect:L,onDrop:h,onDropCapture:Ma,onDragOver:N,onNodesChange:Da,onEdgesChange:Ra,onNodeDrag:S,onNodeDragStop:k,onBeforeDelete:Va,selectionMode:W.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:pa,connectOnClick:!1,children:[E&&(0,K.jsx)(W.MiniMap,{pannable:!0,zoomable:!0,position:la,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:[!u&&(0,K.jsx)(Rn,{canUndo:Qe,canRedo:ze,undo:j,redo:ie}),(0,K.jsx)(Dn,{nodes:o,isReadOnly:u,diagram:Oa,onValidationComplete:y,onValidateDiagram:p}),(0,K.jsx)(Vn,{})]}),(0,K.jsx)(ua,{horizontal:Fe,vertical:Ca}),(0,K.jsx)(W.Background,{gap:sa,size:ia,color:aa,bgColor:na}),g&&(0,K.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,K.jsx)(ba,{validationResult:g,onClose:Aa})})]}),(0,K.jsx)(ga,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},xi=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>((0,he.useEffect)(()=>{t&&ha.i18n.changeLanguage(t)},[t]),(0,K.jsx)(W.ReactFlowProvider,{children:(0,K.jsx)(br,{value:{onConfigureElement:o},children:(0,K.jsx)(Ti,{mode:e})})})),Uo=xi;var Wo=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 wo=require("lecom-ui");var Na={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 ya={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 Ta={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 xa={pt_BR:Ta,en_US:Na,es_ES:ya};var _a,wa,_i=(wa=(_a=Wo("LecomUserLanguage"))!=null?_a:Wo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?wa:wo.Translations.PT_BR;(0,wo.initializeI18n)({lng:_i,resources:xa});var Yo=require("react/jsx-runtime"),wi=e=>(0,Yo.jsx)(Jo,{children:(0,Yo.jsx)(Uo,v({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,RoutingVariant});
|
|
34
|
+
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function Pn(){let{t:e}=(0,D.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Ln(),[s,l]=(0,Sn.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"),Dn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,H.useTranslation)(),{deselectAll:i}=po(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:u,isMinimapOpen:g,setIsMinimapOpen:p}=X(),E=(0,Bo.useKeyPress)(["v","V"]),f=(0,Bo.useKeyPress)(["h","H"]),T=(0,Dt.useCallback)(()=>{i(),u()},[i,u]),b=()=>{i();let m=n(o);r&&r(m)};return(0,Dt.useEffect)(()=>{E&&!s&&!t&&c()},[E,c,s,t]),(0,Dt.useEffect)(()=>{f&&!l&&!t&&T()},[f,T,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:c,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:T,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:b,children:(0,P.jsx)(He.ListCheckIcon,{})})}),(0,P.jsx)(H.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,P.jsx)(Pn,{}),!t&&(0,P.jsx)(In,{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:()=>p(!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"),fo=require("lucide-react"),me=require("react/jsx-runtime"),Rn=({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)(fo.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)(fo.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Mn=require("@xyflow/react"),B=require("lecom-ui"),ft=require("lucide-react");var O=require("react/jsx-runtime"),Vn=()=>{let{t:e}=(0,B.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Mn.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)(rr,{})})}),(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 vo=require("@xyflow/react");var On=require("@xyflow/react");var Gn=require("react/jsx-runtime"),q=({type:e,position:t,className:o})=>(0,Gn.jsx)(On.Handle,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});var go=require("@xyflow/react"),Hn=require("lodash");var Bn=require("react/jsx-runtime"),gt=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,go.useReactFlow)(),s=({width:l,height:c})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let g=[...a()],p=!u.parentId,E=p?u.id:u.parentId,f=g.filter(m=>m.type==="LANE"&&m.parentId===E);if(!f.length)return;let T=(0,Hn.orderBy)(f,["position.y"]),b=0;T.forEach((m,d)=>{var y,k;let N=d===T.length-1,I=(k=(y=m.measured)==null?void 0:y.height)!=null?k:0;g=g.map(h=>{if(h.id===m.id){let _=p?l-oe.HEADER_WIDTH:l,L=C(v({},h),{width:_,measured:C(v({},h.measured),{width:_}),position:C(v({},h.position),{y:b})});return N&&p&&(L.height=c-b),L}return h}),b+=I}),g=g.map(m=>{if(m.id===E){let d=p?l:l+oe.HEADER_WIDTH;return C(v({},m),{width:d,height:p?c:b,measured:{width:d,height:p?c:b}})}return m}),i(g)};return(0,Bn.jsx)(go.NodeResizer,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};var ho=require("@xyflow/react"),_e=require("lecom-ui");var Eo=require("@xyflow/react"),z=require("lecom-ui"),zn=require("lucide-react");var ne=require("react/jsx-runtime"),Fn=({nodeId:e})=>{let{t}=(0,z.useTranslation)(),{updateNodeData:o}=(0,Eo.useReactFlow)(),r=(0,Eo.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)(zn.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(Jt).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 bo=require("@xyflow/react"),G=require("lecom-ui"),Un=require("lucide-react");var j=require("react/jsx-runtime"),Wn=({nodeId:e})=>{let{t}=(0,G.useTranslation)(),{updateNodeData:o}=(0,bo.useReactFlow)(),r=(0,bo.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,j.jsxs)(G.DropdownMenu,{children:[(0,j.jsxs)(G.Tooltip,{children:[(0,j.jsx)(G.TooltipTrigger,{asChild:!0,children:(0,j.jsx)(G.DropdownMenuTrigger,{asChild:!0,children:(0,j.jsx)(G.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,j.jsx)(Un.WrenchIcon,{})})})}),(0,j.jsx)(G.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,j.jsxs)(G.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,j.jsxs)(G.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,j.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,j.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(jt).map(([i,s])=>(0,j.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,j.jsx)(s.icon,{className:"stroke-inherit"})},i))})]}),(0,j.jsx)(G.DropdownMenuGroup,{children:Object.entries(qt).map(([i,s])=>(0,j.jsxs)(G.DropdownMenuItem,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,j.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 u;let{t:n}=(0,_e.useTranslation)(),{setDraggableNode:a}=ct(),i=({event:g,type:p,variant:E})=>{a({type:p,variant:E}),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:Yt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(no,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Wn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Fn,{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)(ho.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:ho.Position.Right,align:"start",isVisible:r,children:(u=c[t])==null?void 0:u.map((g,p)=>g.component?(0,de.jsx)("div",{children:g.component},p):(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:E=>i({event:E,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})]},p))})};var we=require("react/jsx-runtime"),Yn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,vo.useReactFlow)(),{isMultipleSelection:a}=X(),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:to.MIN_WIDTH,minHeight:to.MIN_HEIGHT}),(0,we.jsx)(q,{type:"target",position:vo.Position.Left})]})};var Rt=require("@xyflow/react"),Kn=require("react");var fe=require("react/jsx-runtime"),Zn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Rt.useReactFlow)(),{isMultipleSelection:a}=X(),[i,s]=(0,Kn.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)(q,{type:"source",position:Rt.Position.Right}),(0,fe.jsx)(q,{type:"target",position:Rt.Position.Left})]})};var Mt=require("@xyflow/react"),$n=require("react");var ge=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let n=Jt[t.variant].icon,{updateNodeData:a}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=X(),[s,l]=(0,$n.useState)(!1),c=p=>{a(e,{label:p})};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:c})})]}),(0,ge.jsx)(ce,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),(0,ge.jsx)(q,{type:"target",position:Mt.Position.Left}),(0,ge.jsx)(q,{type:"source",position:Mt.Position.Right})]})};var No=require("@xyflow/react"),qn=require("react");var be=require("react/jsx-runtime"),jn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,No.useReactFlow)(),{isMultipleSelection:a}=X(),[i,s]=(0,qn.useState)(!1),l=g=>{n(e,{label:g})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,be.jsx)(Xt,{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,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,be.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,be.jsx)(q,{type:"source",position:No.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),Jn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=X(),i=p=>{n(e,{label:p})},s=t.variant?qt[t.variant].icon:null,l=t.attribute?jt[t.attribute].icon:null,c=t.variant==="SUBPROCESS",u=s&&!c,g=l||c;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":u||g}),onChange:i}),s&&(0,ee.jsx)("div",{className:A("absolute flex items-center p-1",c?"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",c?"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:Qt.MIN_WIDTH,minHeight:Qt.MIN_HEIGHT}),(0,ee.jsx)(q,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(q,{type:"target",position:Vt.Position.Left})]})};var zo=require("@xyflow/react");var Se=require("react/jsx-runtime"),Qn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=X();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)(q,{type:"source",position:zo.Position.Right}),(0,Se.jsx)(q,{type:"target",position:zo.Position.Left})]})};var yo=require("@xyflow/react"),ea=require("lodash"),Fo=require("react");var ue=require("react/jsx-runtime"),ta=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,yo.useReactFlow)(),{isMultipleSelection:s}=X(),l=i(),c=!n,u=(0,Fo.useMemo)(()=>(0,ea.orderBy)([...l.filter(f=>f.parentId===e&&f.type==="LANE")],"position.y","asc"),[l,e]),g=c?eo.MIN_WIDTH:oe.MIN_WIDTH,p=(0,Fo.useMemo)(()=>{if(c&&u.length>1){let f=[...u];return f.pop(),f.reduce((b,m)=>{var d,N;return b+((N=(d=m.measured)==null?void 0:d.height)!=null?N:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[c,u]),E=f=>{a(e,{label:f})};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:E})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),(0,ue.jsx)(gt,{nodeId:e,minWidth:g,minHeight:p,isVisible:!r&&!s&&o}),c&&(0,ue.jsx)(q,{type:"source",position:yo.Position.Right})]})};var oa={START_EVENT:jn,END_EVENT:Zn,TASK:Jn,GATEWAY:Xn,ANNOTATION:Yn,LANE:ta,UNSUPPORTED:Qn},ra={SEQUENCE_EDGE:_r,MESSAGE_EDGE:Ur,ANNOTATION_EDGE:Tr},na="#fafafa",aa="#bebebe",ia=1,sa=10,la="bottom-left",da=.5,ca=4,pa={x:0,y:0,zoom:.75};var ma=require("@xyflow/react"),To=require("react"),fa=require("react/jsx-runtime"),Ni=e=>({width:e.width,height:e.height,transform:e.transform}),ua=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,ma.useStore)(Ni),s=(0,To.useRef)(null);return(0,To.useEffect)(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let u=window.devicePixelRatio;l.width=n*u,l.height=a*u,c.scale(u,u),c.clearRect(0,0,n,a),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*i[2]+i[0],0),c.lineTo(t*i[2]+i[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*i[2]+i[1]),c.lineTo(n,e*i[2]+i[1]),c.stroke())},[n,a,i,e,t,o,r]),(0,fa.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"),ga=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,U.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(u=>u.filter(g=>!l.some(p=>p.id===g.id))),c!=null&&c.length&&r(u=>u.filter(g=>!c.some(p=>p.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"),Ea=()=>{let{t:e}=(0,Ce.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:Xt,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:ir,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ar,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:nr,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Zt,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Kt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:or,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Yt,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 xo=require("lecom-ui"),Et=require("lucide-react"),_o=require("react"),te=require("react/jsx-runtime"),ba=({validationResult:e,onClose:t})=>{let{t:o}=(0,xo.useTranslation)(),[r,n]=(0,_o.useState)(!1);if((0,_o.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)(xo.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 Z=require("react/jsx-runtime"),yi=[],Ti=({mode:e="edit"})=>{let t=(0,he.useRef)(!1),[o,r]=(0,W.useNodesState)([]),[n,a]=(0,W.useEdgesState)([]),[i,s]=(0,he.useState)(null),{isMoveTool:l,isHandTool:c,isReadOnly:u,setIsReadOnly:g,setIsMultipleSelection:p,isMinimapOpen:E}=X(),{validationResult:f,handleValidationComplete:T,clearValidation:b,isAutoValidationEnabled:m,validateDiagram:d}=Vr(),{getNode:N,getNodes:I,getEdges:y}=(0,W.useReactFlow)(),{onNodeDrag:k,onDrop:h,onDragOver:_,onNodeDragStop:L}=Yr({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:w,onConnect:S}=wr({setEdges:a});Br();let{createDiagram:x}=en(),{undo:Y,redo:ie,saveHistory:$,canUndo:Qe,canRedo:ze}=an(),{helperLineHorizontal:Fe,helperLineVertical:Ca,customApplyNodeChanges:Ia}=$r();tn({LIA_CREATE_DIAGRAM:x,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,he.useEffect)(()=>{g(e==="readonly")},[e,g]);let Aa=()=>{b()},ka=(0,he.useCallback)(({nodes:J,edges:F})=>{let bt=J.length+F.length>1;p(bt)},[p]);(0,W.useOnSelectionChange)({onChange:ka});let La=J=>{let F=N(J.id);if(F!=null&&F.parentId&&(F==null?void 0:F.type)==="LANE"){let bt=Ye(F.parentId,o.filter($o=>$o.id!==F.id&&$o.type==="LANE"));r(ke(bt))}},Sa=J=>{J.forEach(F=>{switch(F.type){case"remove":La(F);break}})},Pa=(0,he.useCallback)(()=>{if(!m){t.current=!1;return}let J=I(),F=y(),bt=d({nodes:J,edges:F});T(bt),t.current=!1},[m,I,y,d,T]),Ko=(0,va.useDebouncedCallback)(Pa,300),Zo=(0,he.useCallback)(()=>{m&&!t.current&&(t.current=!0,Ko())},[m,Ko]),Da=J=>{r(F=>Ia(J,F)),$(J),Zo(),Sa(J)},Ra=J=>{a(F=>(0,W.applyEdgeChanges)(J,F)),$(J),Zo()},Ma=()=>{$("forceSave")},Va=async({nodes:J,edges:F})=>(s({nodes:J,edges:F}),!1),Oa={nodes:o,edges:n};return(0,Z.jsxs)("div",{className:"w-full h-full",children:[!u&&(0,Z.jsx)(Ea,{}),(0,Z.jsx)(sn,{}),(0,Z.jsxs)(W.ReactFlow,{edges:n,nodes:o,nodeTypes:oa,edgeTypes:ra,minZoom:da,maxZoom:ca,panOnDrag:c||u?!0:yi,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!u&&l,nodesConnectable:!u&&l,nodesDraggable:!u&&l,isValidConnection:w,connectionLineComponent:Wr,onConnect:S,onDrop:h,onDropCapture:Ma,onDragOver:_,onNodesChange:Da,onEdgesChange:Ra,onNodeDrag:k,onNodeDragStop:L,onBeforeDelete:Va,selectionMode:W.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:pa,connectOnClick:!1,children:[E&&(0,Z.jsx)(W.MiniMap,{pannable:!0,zoomable:!0,position:la,className:"shadow-md rounded-md"}),(0,Z.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!u&&(0,Z.jsx)(Rn,{canUndo:Qe,canRedo:ze,undo:Y,redo:ie}),(0,Z.jsx)(Dn,{nodes:o,isReadOnly:u,diagram:Oa,onValidationComplete:T,onValidateDiagram:d}),(0,Z.jsx)(Vn,{})]}),(0,Z.jsx)(ua,{horizontal:Fe,vertical:Ca}),(0,Z.jsx)(W.Background,{gap:sa,size:ia,color:aa,bgColor:na}),f&&(0,Z.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,Z.jsx)(ba,{validationResult:f,onClose:Aa})})]}),(0,Z.jsx)(ga,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},xi=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>((0,he.useEffect)(()=>{t&&ha.i18n.changeLanguage(t)},[t]),(0,Z.jsx)(W.ReactFlowProvider,{children:(0,Z.jsx)(br,{value:{onConfigureElement:o},children:(0,Z.jsx)(Ti,{mode:e})})})),Uo=xi;var Wo=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 wo=require("lecom-ui");var Na={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 ya={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 Ta={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 xa={pt_BR:Ta,en_US:Na,es_ES:ya};var _a,wa,_i=(wa=(_a=Wo("LecomUserLanguage"))!=null?_a:Wo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?wa:wo.Translations.PT_BR;(0,wo.initializeI18n)({lng:_i,resources:xa});var Yo=require("react/jsx-runtime"),wi=e=>(0,Yo.jsx)(Jo,{children:(0,Yo.jsx)(Uo,v({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,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 Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var no=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable;var ro=(e,t,o)=>t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))no.call(t,o)&&ro(e,o,t[o]);if(We)for(var o of We(t))ao.call(t,o)&&ro(e,o,t[o]);return e},_=(e,t)=>Wn(e,Yn(t));var Ee=(e,t)=>{var o={};for(var r in e)no.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&&ao.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Kn,Notification as Zn}from"lecom-ui";import{jsx as $n,jsxs as Xn}from"react/jsx-runtime";function io({children:e}){return Xn(Kn,{children:[$n(Zn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as Nd,Background as yd,MiniMap as Td,ReactFlow as xd,ReactFlowProvider as _d,SelectionMode as wd,useEdgesState as Cd,useNodesState as Id,useOnSelectionChange as Ad,useReactFlow as kd}from"@xyflow/react";import{i18n as Ld}from"lecom-ui";import{useCallback as qt,useEffect as xn,useRef as Sd,useState as Pd}from"react";import{useDebouncedCallback as Dd}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||{}),Rt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Rt||{}),Mt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Mt||{});import{RotateCcw as sa,ScrollText as la,SquarePlus as da}from"lucide-react";import{jsx as Ye,jsxs as qn}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>qn("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 so}from"react/jsx-runtime";var be=({size:e=24,className:t})=>so("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:so("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 jn}from"react/jsx-runtime";var Ze=({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:[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 Vt,jsxs as Jn}from"react/jsx-runtime";var he=({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:[Vt("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"}),Vt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot,jsxs as Qn}from"react/jsx-runtime";var $e=({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:[Ot("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"}),Ot("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as ea}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Gt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:ea("g",{children:[Gt("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"}),Gt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as ta}from"clsx";import{twMerge as oa}from"tailwind-merge";function A(...e){return oa(ta(e))}var ke=(e,t)=>e<t?t:e;import{jsx as co,jsxs as ra}from"react/jsx-runtime";var po=({size:e=24,className:t})=>ra("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:[co("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"}),co("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ht("g",{children:Ht("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 uo}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>uo("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:uo("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 fo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>fo("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:fo("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 Bt,jsxs as na}from"react/jsx-runtime";var go=({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:[Bt("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"}),Bt("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"}),Bt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as aa}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>aa("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 ia}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>ia("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:la},SUBPROCESS:{icon:da}};var Je={LOOP:{icon:sa}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),Qe={EXCLUSIVE:{icon:he},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import No from"@dagrejs/dagre";import{getNodesBounds as ba}from"@xyflow/react";import{orderBy as ha}from"lodash";var ca={MIN_WIDTH:36,MIN_HEIGHT:36},pa={MIN_WIDTH:36,MIN_HEIGHT:36},ma={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},ua={MIN_WIDTH:128,MIN_HEIGHT:64},M={START_EVENT:ca,END_EVENT:pa,GATEWAY:ma,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:ua};import{orderBy as fa}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=>fa(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),ho=(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)),ga=(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)},Ea=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:c}=oe(t);return o<i+l&&i<o+n&&r<s+c&&s<r+a},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&Ea(e,n)){let a=ga(e,n);a<r&&(r=a,o=n)}return o},vo=(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 yo=(e=[],t=[],o="LR")=>{let r=new No.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)),No.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 m,E;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let a=ha(n,["position.y"]),i=Math.max((E=(m=r.measured)==null?void 0:m.width)!=null?E:0,tt.MIN_WIDTH),s=vo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),c=0,u=0;a.forEach(g=>{var y,b,d,p;o=o.map(T=>T.id===g.id?_(v({},T),{width:l-Y.HEADER_WIDTH,measured:_(v({},T.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:c}}):T),c+=(b=(y=g.measured)==null?void 0:y.height)!=null?b:0,u+=(p=(d=g.measured)==null?void 0:d.height)!=null?p:0}),o=o.map(g=>g.id===e?_(v({},g),{height:u,width:l,measured:_(v({},g.measured),{height:u,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=me(f.parentId,o)),o},To=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},va=50,xo=(e,t=va)=>{let o=ba(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as Na}from"zustand";var O=Na(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 Do,useReactFlow as ti}from"@xyflow/react";import{BaseEdge as Ba,EdgeLabelRenderer as za,getStraightPath as Fa,useNodes as Ua,useViewport as Wa}from"@xyflow/react";import{getIncomers as rt,getOutgoers as zt,useReactFlow as _a}from"@xyflow/react";import{Button as wa,Tooltip as Ca,TooltipContent as Ia,TooltipTrigger as Aa,useTranslation as ka}from"lecom-ui";import{PencilIcon as La}from"lucide-react";import{createContext as ya,useContext as Ta}from"react";var _o=ya(null),wo=_o.Provider,Co=()=>{let e=Ta(_o);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as Sa}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=ka(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=_a(),{onConfigureElement:s}=Co(),l=d=>{let p=a(),T=i(),x=rt(d,p,T),C=zt(d,p,T),S=x.some(N=>N.type==="START_EVENT"),h=C.some(N=>N.type==="END_EVENT");return S?"start":h?"end":"between"},c=d=>{var N,k,w;let p=a(),T=i(),x=r(d.source),C=r(d.target);if(!x||!C)return"simple";if(zt(x,p,T).some(L=>L.type==="END_EVENT"))return"final";if(x.type==="GATEWAY")switch((N=x.data)==null?void 0:N.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(x.type==="TASK"){let L=(k=x.data)==null?void 0:k.variant,I=(w=x.data)==null?void 0:w.attribute;return L==="SCRIPT"?"script":I==="LOOP"?"loop":"simple"}return"simple"},u=d=>{var N;let p=r(d.source);if(!p||p.type!=="GATEWAY"||((N=p.data)==null?void 0:N.variant)!=="COMPLEX")return;let T=a(),x=i(),C=rt(p,T,x),S=!1,h=!1;if(C.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(S=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(h=!0))}),S&&h)return"script_loop";if(S)return"script";if(h)return"loop"},f=d=>{var N;let p=r(d.source);if(!p||p.type!=="GATEWAY"||((N=p.data)==null?void 0:N.variant)!=="EXCLUSIVE")return;let T=a(),x=i(),C=rt(p,T,x),S=!1,h=!1;if(C.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(S=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(h=!0))}),S)return"script";if(h)return"loop"},m=d=>{var h,N;if(d.type!=="GATEWAY")return;let p=a(),T=i(),x=rt(d,p,T),C=!1,S=!1;if(x.forEach(k=>{var w,L;k.type==="TASK"&&(((w=k.data)==null?void 0:w.variant)==="SCRIPT"&&(C=!0),((L=k.data)==null?void 0:L.attribute)==="LOOP"&&(S=!0))}),((h=d.data)==null?void 0:h.variant)==="COMPLEX"){if(C&&S)return"script_loop";if(C)return"script";if(S)return"loop"}else if(((N=d.data)==null?void 0:N.variant)==="EXCLUSIVE"){if(C)return"script";if(S)return"loop"}},E=d=>zt(d,a(),i()).map(x=>{var C,S;return{id:x.id,type:x.type,variant:(C=x.data)==null?void 0:C.variant,label:(S=x.data)==null?void 0:S.label}}),g=()=>{var p,T,x;let d=r(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(p=d.data)==null?void 0:p.label,targets:E(d)});return}s==null||s({id:d.id,type:"gateway",variant:((T=d.data)==null?void 0:T.variant)||"EXCLUSIVE",label:(x=d.data)==null?void 0:x.label,subVariant:m(d),targets:E(d)})}},y=()=>{let d=n(e);if(d){let p=c(d),T;p==="complex"?T=u(d):p==="exclusive"&&(T=f(d)),s==null||s({id:d.id,type:"routing",variant:p,subVariant:T})}};return Sa(Ca,{children:[nt(Aa,{asChild:!0,children:nt(wa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":g();break;case"edge":y();break}},children:nt(La,{size:16})})}),nt(Ia,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Pa}from"@xyflow/react";import{Button as Da,Tooltip as Ra,TooltipContent as Ma,TooltipTrigger as Va,useTranslation as Oa}from"lecom-ui";import{TrashIcon as Ga}from"lucide-react";import{jsx as it,jsxs as Ha}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Oa(),{deleteElements:r}=Pa();return Ha(Ra,{children:[it(Va,{asChild:!0,children:it(Da,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Ga,{size:16})})}),it(Ma,{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,c)=>lt("div",{children:l.component},c))}))};import{jsx as ct,jsxs as Ya}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},Io=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let c=Ua(),{zoom:u}=Wa(),f=c.find(p=>p.id===t),m=c.find(p=>p.id===o),[E,g,y]=Fa({sourceX:r,sourceY:n,targetX:a,targetY:i}),b=s||(f==null?void 0:f.selected)||(m==null?void 0:m.selected),d=1/u;return Ya("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),children:[ct(Ba,{id:e,path:E,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)]":b&&!(l!=null&&l.hasError)})}),ct(za,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${g}px, ${y}px)`},children:s&&ct(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};import{BaseEdge as $a,EdgeLabelRenderer as Xa,getSmoothStepPath as qa,MarkerType as Lo,useNodes as ja,useReactFlow as Ja,useViewport as Qa}from"@xyflow/react";import{useState as ei}from"react";import{useEffect as Ao,useRef as Ka,useState as Za}from"react";import{jsx as ko}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Ka(null),[l,c]=Za(!1);Ao(()=>{c(r!=null?r:!1)},[r]),Ao(()=>{if(l&&s.current){s.current.focus();let E=document.createRange();E.selectNodeContents(s.current),E.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(E))}},[l]);let u=E=>{E.stopPropagation(),c(!0)},f=E=>{let g=E.currentTarget.innerText;t&&g.length>=t&&E.preventDefault()},m=E=>{c(!1),n==null||n(),o==null||o(E.currentTarget.innerText)};return ko("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:u,children:ko("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,children:e})})};import{jsx as mt,jsxs as So}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Lo.ArrowClosed},markerEnd:{type:Lo.Arrow},data:{label:""}},Po=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let f=ja(),{zoom:m}=Qa(),{updateEdgeData:E}=Ja(),[g,y]=ei(!1),b=f.find(I=>I.id===t),d=f.find(I=>I.id===o),[p,T,x]=qa({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),C=u||(b==null?void 0:b.selected)||(d==null?void 0:d.selected),S=C?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(c==null?void 0:c.label.trim().length)>0,N=1/m,k=()=>{y(!0)},w=()=>{y(!1)},L=I=>{E(e,{label:I.trim()})};return So("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":C}),onBlur:w,onDoubleClick:k,children:[mt($a,{id:e,path:p,markerEnd:`url(#${S})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":C&&!(c!=null&&c.hasError)})}),mt(Xa,{children:So("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${x}px)`},children:[u&&mt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${N})`}}),h&&mt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};var Ro=({setEdges:e})=>{let{getNode:t}=ti();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"?Do(v(v({},n),pt),a):Do(v(v({},n),ie),a)})}}};import{useState as Uo}from"react";import{useTranslation as oi}from"lecom-ui";import{useReactFlow as ri}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")||[],Mo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Vo=(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"),Oo=(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),Go=(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"},Ho=(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},Bo=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)}},zo=(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(c=>r.push(c.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Oo(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||Bo(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(c=>c.source===l.id)),a=Q(n,l=>!Go(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 c=Me(l.id,e.edges),u=X(l.id,e.edges),f=c.some(E=>{var g;return((g=e.nodes.find(y=>y.id===E.source))==null?void 0:g.type)==="START_EVENT"}),m=u.some(E=>{var g;return((g=e.nodes.find(y=>y.id===E.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),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=Mo(e.nodes),o=Q(t,r=>!Ho(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Vo(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 Fo=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 Wo=()=>{let{t:e}=oi(),[t,o]=Uo(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ri(),[s,l]=Uo(!1);return{validationResult:t,validateDiagram:m=>{let E=zo(m.nodes,m.edges),g=Fo(E),y=g.errors.map(b=>_(v({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:y}},handleValidationComplete:m=>{if(o(m),!m)return;let E=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(N=>E.push(N)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(N=>g.push(N))});let y=[...new Set(E)];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 b=a(),d=i(),p=new Set(y),T=new Set;m.errors.forEach(h=>{var w,L;let N=Ve.find(I=>I.id===h.id);(N==null?void 0:N.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>T.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{d.forEach(z=>{(z.source===I||z.target===I)&&T.add(z.id)})}))});let x=new Set,C=new Set,S=new Set;b.forEach(h=>{h.type==="START_EVENT"?x.add(h.id):h.type==="END_EVENT"&&C.add(h.id)}),d.forEach(h=>{x.has(h.source)&&S.add(h.target),C.has(h.target)&&S.add(h.source)}),S.forEach(h=>{var N,k;if(p.has(h)){let w=(N=m.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===w))==null?void 0:k.highlightRelatedEdges)!==!1&&d.forEach(I=>{I.source===h&&C.has(I.target)&&(p.add(I.target),T.add(I.id)),I.target===h&&x.has(I.source)&&(p.add(I.source),T.add(I.id))})}}),p.size>0&&r(h=>h.map(N=>_(v({},N),{data:_(v({},N.data),{hasError:p.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(m=>m.map(E=>_(v({},E),{data:_(v({},E.data),{hasError:!1})}))),n(m=>m.map(E=>_(v({},E),{data:_(v({},E.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ni}from"@xyflow/react";import{useEffect as ai}from"react";import{v7 as Yo}from"uuid";var ii=15,Ko="bpmn:selection",Zo=({offset:e=ii}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=ni();ai(()=>{let a=s=>{var E;s.preventDefault();let l=t(),c=r(),u=l.filter(g=>g.selected);if(!u.length)return;let f=c.filter(g=>u.some(y=>y.id===g.source)&&u.some(y=>y.id===g.target)),m={nodes:u,edges:f};(E=s.clipboardData)==null||E.setData(Ko,JSON.stringify(m))},i=s=>{var m,E;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Ko))||"{}");if(!((E=l.nodes)!=null&&E.length))return;let c=new Map,u=l.nodes.map(g=>{let y=Yo();return c.set(g.id,y),_(v({},g),{id:y,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(v({},g),{id:Yo(),selected:!0,source:c.get(g.source)||g.source,target:c.get(g.target)||g.target}));o(g=>[...g.map(y=>_(v({},y),{selected:!1})),...u]),n(g=>[...g.map(y=>_(v({},y),{selected:!1})),...f])};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 bi,useStoreApi as hi}from"@xyflow/react";import{v7 as Jo}from"uuid";import{create as si}from"zustand";var ye=si(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as li,EdgeLabelRenderer as di,getSmoothStepPath as ci,MarkerType as pi,useNodes as mi,useReactFlow as ui,useViewport as fi}from"@xyflow/react";import{useState as gi}from"react";import{jsx as ft,jsxs as $o}from"react/jsx-runtime";var Vm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:pi.Arrow},data:{label:""}},Xo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let f=mi(),{zoom:m}=fi(),{updateEdgeData:E}=ui(),[g,y]=gi(!1),b=f.find(I=>I.id===t),d=f.find(I=>I.id===o),[p,T,x]=ci({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),C=u||(b==null?void 0:b.selected)||(d==null?void 0:d.selected),S=C?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(c==null?void 0:c.label.trim().length)>0,N=1/m,k=()=>{y(!0)},w=()=>{y(!1)},L=I=>{E(e,{label:I.trim()})};return $o("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":C}),onBlur:w,onDoubleClick:k,children:[ft(li,{id:e,path:p,markerEnd:`url(#${S})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":C&&!(c!=null&&c.hasError)})}),ft(di,{children:$o("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${x}px)`},children:[u&&ft(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${N})`}}),h&&ft(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};import{jsx as qo,jsxs as Ei}from"react/jsx-runtime";var jo=({fromX:e,fromY:t,toX:o,toY:r})=>Ei("g",{children:[qo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),qo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Qo=({nodes:e,setNodes:t,setEdges:o})=>{let r=hi(),{draggableNode:n,setDraggableNode:a}=ye(),{getInternalNode:i,screenToFlowPosition:s}=bi(),l=b=>{let d="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(p=>p.map(T=>_(v({},T),{className:T.id===b?d:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},u=b=>{let d=i(b.id),p=c();if(b.type==="LANE"){if(ve({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let N=p.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=Pe(d,N);if(!k){l();return}if(ve({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let x=p.filter(h=>h.id!==b.id&&h.type==="LANE"),C=Pe(d,x);if(!C){l();return}if(ve({parentId:C.id,nodes:e,includeTypes:["LANE"]})){l();return}l(C.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,d)=>{b.preventDefault(),u(d)},E=(b,d,p)=>{var N,k;let T=w=>w.map(L=>_(v({},L),{className:void 0}));if(b.parentId===d.id){let w=me(d.id,p);t(re(T(w)));return}if(b.type==="LANE"){if(ve({parentId:d.id,nodes:p,excludeTypes:["LANE"]}))return;let I=p.filter(V=>V.parentId===d.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=p.map(V=>V.id===b.id?_(v({},V),{parentId:d.id,position:z,className:void 0}):_(v({},V),{className:void 0}));K=me(d.id,K),t(re(K));return}if(ve({parentId:d.id,nodes:p,includeTypes:["LANE"]})){let w;if(b.parentId){let I=i(b.parentId),{x:z,y:K}=oe(I);w={x:z+((N=b.position.x)!=null?N:0),y:K+((k=b.position.y)!=null?k:0)}}let L=p.map(I=>I.id===b.id?_(v({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(v({},I),{className:void 0}));t(re(L));return}let S=ho(b,d),h=p.map(w=>w.id===b.id?_(v({},w),{parentId:d.id,position:S,className:void 0}):_(v({},w),{className:void 0}));t(re(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let d=s({x:b.clientX,y:b.clientY}),p={width:M[n.type].MIN_WIDTH,height:M[n.type].MIN_HEIGHT},T={id:Jo(),type:n.type,position:d,measured:p,data:{label:"",variant:n.variant,attribute:n.attribute}},x=_(v({},T),{internals:{positionAbsolute:d}}),C=c(),S=n.type==="LANE",h=C.filter(w=>S?w.type==="LANE"&&!w.parentId:w.type==="LANE"),N=Pe(x,h);N?E(x,N,[...C,x]):t(w=>{let L=w.concat(T);return re(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:Jo(),source:k,target:T.id};if(n.type==="ANNOTATION"){o(L=>L.concat(v(v({},w),pt)));return}o(L=>L.concat(v(v({},w),ie)))}a(null)},onNodeDrag:m,onNodeDragStop:async(b,d)=>{var N,k;let{nodeLookup:p}=r.getState(),T=i(d.id),x=Array.from(p.values()),C=d.type==="LANE",S=x.filter(w=>w.id!==d.id&&(C?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Pe(T,S);if(h){E(T,h,x);return}if(d.parentId){let w=i(d.parentId),{x:L,y:I}=oe(w),z={x:L+((N=d.position.x)!=null?N:0),y:I+((k=d.position.y)!=null?k:0)},K=e.map(V=>V.id===d.id?_(v({},V),{position:z,parentId:void 0}):V);K=me(d.parentId,K),t(re(K))}}}};import{applyNodeChanges as vi}from"@xyflow/react";import{useCallback as Ni,useState as tr}from"react";function er(e,t,o=5){var l,c,u,f,m,E,g,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(u=n.measured)==null?void 0:u.height)!=null?f:0),width:(E=(m=n.measured)==null?void 0:m.width)!=null?E:0,height:(y=(g=n.measured)==null?void 0:g.height)!=null?y:0},i=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,d)=>{var L,I,z,K,V,ge,ce,pe;let p={left:d.position.x,right:d.position.x+((I=(L=d.measured)==null?void 0:L.width)!=null?I:0),top:d.position.y,bottom:d.position.y+((K=(z=d.measured)==null?void 0:z.height)!=null?K:0),width:(ge=(V=d.measured)==null?void 0:V.width)!=null?ge:0,height:(pe=(ce=d.measured)==null?void 0:ce.height)!=null?pe:0},T=Math.abs(a.left-p.left);T<s&&(b.snapPosition.x=p.left,b.vertical=p.left,s=T);let x=Math.abs(a.right-p.right);x<s&&(b.snapPosition.x=p.right-a.width,b.vertical=p.right,s=x);let C=Math.abs(a.left-p.right);C<s&&(b.snapPosition.x=p.right,b.vertical=p.right,s=C);let S=Math.abs(a.right-p.left);S<s&&(b.snapPosition.x=p.left-a.width,b.vertical=p.left,s=S);let h=Math.abs(a.top-p.top);h<i&&(b.snapPosition.y=p.top,b.horizontal=p.top,i=h);let N=Math.abs(a.bottom-p.top);N<i&&(b.snapPosition.y=p.top-a.height,b.horizontal=p.top,i=N);let k=Math.abs(a.bottom-p.bottom);k<i&&(b.snapPosition.y=p.bottom-a.height,b.horizontal=p.bottom,i=k);let w=Math.abs(a.top-p.bottom);return w<i&&(b.snapPosition.y=p.bottom,b.horizontal=p.bottom,i=w),b},r)}var or=()=>{let[e,t]=tr(void 0),[o,r]=tr(void 0),n=Ni((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 c=er(a[0],i);a[0].position.x=(s=c.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),r(c.vertical)}return vi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ti}from"@xyflow/react";import{v7 as sr}from"uuid";var nr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ar={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},rr=(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}},yi=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=rr(a[0],o),s=rr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},ir=e=>{let{components:t,connections:o}=yi(e);return{nodes:t,edges:o}};var lr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ti();return{createDiagram:n=>{let{nodes:a,edges:i}=ir(n),s=[],l=new Map;for(let[
|
|
1
|
+
var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var no=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable;var ro=(e,t,o)=>t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))no.call(t,o)&&ro(e,o,t[o]);if(We)for(var o of We(t))ao.call(t,o)&&ro(e,o,t[o]);return e},C=(e,t)=>Wn(e,Yn(t));var Ee=(e,t)=>{var o={};for(var r in e)no.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&&ao.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Kn,Notification as Zn}from"lecom-ui";import{jsx as $n,jsxs as Xn}from"react/jsx-runtime";function io({children:e}){return Xn(Kn,{children:[$n(Zn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as Nd,Background as yd,MiniMap as Td,ReactFlow as xd,ReactFlowProvider as _d,SelectionMode as wd,useEdgesState as Cd,useNodesState as Id,useOnSelectionChange as Ad,useReactFlow as kd}from"@xyflow/react";import{i18n as Ld}from"lecom-ui";import{useCallback as qt,useEffect as xn,useRef as Sd,useState as Pd}from"react";import{useDebouncedCallback as Dd}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||{}),Rt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Rt||{}),Mt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Mt||{});import{RotateCcw as sa,ScrollText as la,SquarePlus as da}from"lucide-react";import{jsx as Ye,jsxs as qn}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>qn("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 so}from"react/jsx-runtime";var be=({size:e=24,className:t})=>so("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:so("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 jn}from"react/jsx-runtime";var Ze=({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:[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 Vt,jsxs as Jn}from"react/jsx-runtime";var he=({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:[Vt("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"}),Vt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot,jsxs as Qn}from"react/jsx-runtime";var $e=({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:[Ot("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"}),Ot("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as ea}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Gt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:ea("g",{children:[Gt("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"}),Gt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as ta}from"clsx";import{twMerge as oa}from"tailwind-merge";function A(...e){return oa(ta(e))}var ke=(e,t)=>e<t?t:e;import{jsx as co,jsxs as ra}from"react/jsx-runtime";var po=({size:e=24,className:t})=>ra("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:[co("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"}),co("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ht("g",{children:Ht("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 uo}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>uo("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:uo("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 fo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>fo("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:fo("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 Bt,jsxs as na}from"react/jsx-runtime";var go=({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:[Bt("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"}),Bt("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"}),Bt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as aa}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>aa("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 ia}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>ia("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:la},SUBPROCESS:{icon:da}};var Je={LOOP:{icon:sa}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),Qe={EXCLUSIVE:{icon:he},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import No from"@dagrejs/dagre";import{getNodesBounds as ba}from"@xyflow/react";import{orderBy as ha}from"lodash";var ca={MIN_WIDTH:36,MIN_HEIGHT:36},pa={MIN_WIDTH:36,MIN_HEIGHT:36},ma={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},ua={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:ca,END_EVENT:pa,GATEWAY:ma,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:ua};import{orderBy as fa}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=>fa(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),ho=(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)),ga=(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)},Ea=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:c}=oe(t);return o<i+l&&i<o+n&&r<s+c&&s<r+a},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&Ea(e,n)){let a=ga(e,n);a<r&&(r=a,o=n)}return o},vo=(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 yo=(e=[],t=[],o="LR")=>{let r=new No.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)),No.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return C(v({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},me=(e,t)=>{var p,E;let o=[...t],r=o.find(f=>f.id===e);if(!r)return o;let n=o.filter(f=>f.parentId===e&&f.type==="LANE");if(n.length===0)return o;let a=ha(n,["position.y"]),i=Math.max((E=(p=r.measured)==null?void 0:p.width)!=null?E:0,tt.MIN_WIDTH),s=vo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),c=0,u=0;a.forEach(f=>{var T,b,m,d;o=o.map(N=>N.id===f.id?C(v({},N),{width:l-Y.HEADER_WIDTH,measured:C(v({},N.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:c}}):N),c+=(b=(T=f.measured)==null?void 0:T.height)!=null?b:0,u+=(d=(m=f.measured)==null?void 0:m.height)!=null?d:0}),o=o.map(f=>f.id===e?C(v({},f),{height:u,width:l,measured:C(v({},f.measured),{height:u,width:l})}):f);let g=o.find(f=>f.id===e);return g!=null&&g.parentId&&(o=me(g.parentId,o)),o},To=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},va=50,xo=(e,t=va)=>{let o=ba(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as Na}from"zustand";var G=Na(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 Do,useReactFlow as ti}from"@xyflow/react";import{BaseEdge as Ba,EdgeLabelRenderer as za,getStraightPath as Fa,useNodes as Ua,useViewport as Wa}from"@xyflow/react";import{getIncomers as rt,getOutgoers as zt,useReactFlow as _a}from"@xyflow/react";import{Button as wa,Tooltip as Ca,TooltipContent as Ia,TooltipTrigger as Aa,useTranslation as ka}from"lecom-ui";import{PencilIcon as La}from"lucide-react";import{createContext as ya,useContext as Ta}from"react";var _o=ya(null),wo=_o.Provider,Co=()=>{let e=Ta(_o);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as Sa}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=ka(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=_a(),{onConfigureElement:s}=Co(),l=d=>{let N=a(),I=i(),y=rt(d,N,I),k=zt(d,N,I),h=y.some(L=>L.type==="START_EVENT"),_=k.some(L=>L.type==="END_EVENT");return h?"start":_?"end":"between"},c=d=>{var L,w,S;let N=a(),I=i(),y=r(d.source),k=r(d.target);if(!y||!k)return"simple";if(zt(y,N,I).some(x=>x.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((L=y.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let x=(w=y.data)==null?void 0:w.variant,M=(S=y.data)==null?void 0:S.attribute;return x==="SCRIPT"?"script":M==="LOOP"?"loop":"simple"}return"simple"},u=d=>{var L;let N=r(d.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="COMPLEX")return;let I=a(),y=i(),k=rt(N,I,y),h=!1,_=!1;if(k.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h&&_)return"script_loop";if(h)return"script";if(_)return"loop"},g=d=>{var L;let N=r(d.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let I=a(),y=i(),k=rt(N,I,y),h=!1,_=!1;if(k.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h)return"script";if(_)return"loop"},p=d=>{var _,L;if(d.type!=="GATEWAY")return;let N=a(),I=i(),y=rt(d,N,I),k=!1,h=!1;if(y.forEach(w=>{var S,x;w.type==="TASK"&&(((S=w.data)==null?void 0:S.variant)==="SCRIPT"&&(k=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(h=!0))}),((_=d.data)==null?void 0:_.variant)==="COMPLEX"){if(k&&h)return"script_loop";if(k)return"script";if(h)return"loop"}else if(((L=d.data)==null?void 0:L.variant)==="EXCLUSIVE"){if(k)return"script";if(h)return"loop"}},E=d=>zt(d,a(),i()).map(y=>{var k,h;return{id:y.id,type:y.type,variant:(k=y.data)==null?void 0:k.variant,label:(h=y.data)==null?void 0:h.label}}),f=d=>i().filter(y=>y.source===d.id).map(y=>{var k;return{id:y.id,type:"routing",variant:c(y),label:(k=y.data)==null?void 0:k.label}}),T=()=>{var N,I,y,k;let d=r(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(N=d.data)==null?void 0:N.label,targets:E(d),edgeTargets:f(d)}),console.log({id:d.id,type:"activity",variant:l(d),label:(I=d.data)==null?void 0:I.label,targets:E(d),edgeTargets:f(d)});return}s==null||s({id:d.id,type:"gateway",variant:((y=d.data)==null?void 0:y.variant)||"EXCLUSIVE",label:(k=d.data)==null?void 0:k.label,subVariant:p(d),targets:E(d)})}},b=()=>{let d=n(e);if(d){let N=c(d),I;N==="complex"?I=u(d):N==="exclusive"&&(I=g(d)),s==null||s({id:d.id,type:"routing",variant:N,subVariant:I})}};return Sa(Ca,{children:[nt(Aa,{asChild:!0,children:nt(wa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":T();break;case"edge":b();break}},children:nt(La,{size:16})})}),nt(Ia,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Pa}from"@xyflow/react";import{Button as Da,Tooltip as Ra,TooltipContent as Ma,TooltipTrigger as Va,useTranslation as Oa}from"lecom-ui";import{TrashIcon as Ga}from"lucide-react";import{jsx as it,jsxs as Ha}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Oa(),{deleteElements:r}=Pa();return Ha(Ra,{children:[it(Va,{asChild:!0,children:it(Da,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Ga,{size:16})})}),it(Ma,{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",C(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,c)=>lt("div",{children:l.component},c))}))};import{jsx as ct,jsxs as Ya}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},Io=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let c=Ua(),{zoom:u}=Wa(),g=c.find(d=>d.id===t),p=c.find(d=>d.id===o),[E,f,T]=Fa({sourceX:r,sourceY:n,targetX:a,targetY:i}),b=s||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),m=1/u;return Ya("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),children:[ct(Ba,{id:e,path:E,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)]":b&&!(l!=null&&l.hasError)})}),ct(za,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${f}px, ${T}px)`},children:s&&ct(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${m})`}})})})]})};import{BaseEdge as $a,EdgeLabelRenderer as Xa,getSmoothStepPath as qa,MarkerType as Lo,useNodes as ja,useReactFlow as Ja,useViewport as Qa}from"@xyflow/react";import{useState as ei}from"react";import{useEffect as Ao,useRef as Ka,useState as Za}from"react";import{jsx as ko}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Ka(null),[l,c]=Za(!1);Ao(()=>{c(r!=null?r:!1)},[r]),Ao(()=>{if(l&&s.current){s.current.focus();let E=document.createRange();E.selectNodeContents(s.current),E.collapse(!1);let f=window.getSelection();f&&(f.removeAllRanges(),f.addRange(E))}},[l]);let u=E=>{E.stopPropagation(),c(!0)},g=E=>{let f=E.currentTarget.innerText;t&&f.length>=t&&E.preventDefault()},p=E=>{c(!1),n==null||n(),o==null||o(E.currentTarget.innerText)};return ko("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:u,children:ko("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:p,children:e})})};import{jsx as mt,jsxs as So}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Lo.ArrowClosed},markerEnd:{type:Lo.Arrow},data:{label:""}},Po=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let g=ja(),{zoom:p}=Qa(),{updateEdgeData:E}=Ja(),[f,T]=ei(!1),b=g.find(x=>x.id===t),m=g.find(x=>x.id===o),[d,N,I]=qa({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),y=u||(b==null?void 0:b.selected)||(m==null?void 0:m.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=f||(c==null?void 0:c.label.trim().length)>0,_=1/p,L=()=>{T(!0)},w=()=>{T(!1)},S=x=>{E(e,{label:x.trim()})};return So("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:w,onDoubleClick:L,children:[mt($a,{id:e,path:d,markerEnd:`url(#${k})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.hasError)})}),mt(Xa,{children:So("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[u&&mt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${_})`}}),h&&mt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:f,onChange:S})]})})]})};var Ro=({setEdges:e})=>{let{getNode:t}=ti();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"?Do(v(v({},n),pt),a):Do(v(v({},n),ie),a)})}}};import{useState as Uo}from"react";import{useTranslation as oi}from"lecom-ui";import{useReactFlow as ri}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")||[],Mo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Vo=(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"),Oo=(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),Go=(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"},Ho=(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},Bo=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)}},zo=(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(c=>r.push(c.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Oo(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||Bo(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(c=>c.source===l.id)),a=Q(n,l=>!Go(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 c=Me(l.id,e.edges),u=X(l.id,e.edges),g=c.some(E=>{var f;return((f=e.nodes.find(T=>T.id===E.source))==null?void 0:f.type)==="START_EVENT"}),p=u.some(E=>{var f;return((f=e.nodes.find(T=>T.id===E.target))==null?void 0:f.type)==="END_EVENT"});return g&&p}),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=Mo(e.nodes),o=Q(t,r=>!Ho(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Vo(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 Fo=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 Wo=()=>{let{t:e}=oi(),[t,o]=Uo(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ri(),[s,l]=Uo(!1);return{validationResult:t,validateDiagram:p=>{let E=zo(p.nodes,p.edges),f=Fo(E),T=f.errors.map(b=>C(v({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:f.isValid,errors:T}},handleValidationComplete:p=>{if(o(p),!p)return;let E=[],f=[];p.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(_=>E.push(_)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(_=>f.push(_))});let T=[...new Set(E)];r(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:!1})}))),n(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:!1})})));let b=a(),m=i(),d=new Set(T),N=new Set;p.errors.forEach(h=>{var w,S;let _=Ve.find(x=>x.id===h.id);(_==null?void 0:_.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(x=>N.add(x)),(S=h.nodeIds)==null||S.forEach(x=>{m.forEach(M=>{(M.source===x||M.target===x)&&N.add(M.id)})}))});let I=new Set,y=new Set,k=new Set;b.forEach(h=>{h.type==="START_EVENT"?I.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),m.forEach(h=>{I.has(h.source)&&k.add(h.target),y.has(h.target)&&k.add(h.source)}),k.forEach(h=>{var _,L;if(d.has(h)){let w=(_=p.errors.find(x=>{var M;return(M=x.nodeIds)==null?void 0:M.includes(h)}))==null?void 0:_.id;((L=Ve.find(x=>x.id===w))==null?void 0:L.highlightRelatedEdges)!==!1&&m.forEach(x=>{x.source===h&&y.has(x.target)&&(d.add(x.target),N.add(x.id)),x.target===h&&I.has(x.source)&&(d.add(x.source),N.add(x.id))})}}),d.size>0&&r(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:d.has(_.id)})}))),N.size>0&&n(h=>h.map(_=>C(v({},_),{data:C(v({},_.data),{hasError:N.has(_.id)})})))},clearValidation:()=>{o(null),l(!1),r(p=>p.map(E=>C(v({},E),{data:C(v({},E.data),{hasError:!1})}))),n(p=>p.map(E=>C(v({},E),{data:C(v({},E.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ni}from"@xyflow/react";import{useEffect as ai}from"react";import{v7 as Yo}from"uuid";var ii=15,Ko="bpmn:selection",Zo=({offset:e=ii}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=ni();ai(()=>{let a=s=>{var E;s.preventDefault();let l=t(),c=r(),u=l.filter(f=>f.selected);if(!u.length)return;let g=c.filter(f=>u.some(T=>T.id===f.source)&&u.some(T=>T.id===f.target)),p={nodes:u,edges:g};(E=s.clipboardData)==null||E.setData(Ko,JSON.stringify(p))},i=s=>{var p,E;s.preventDefault();let l=JSON.parse(((p=s.clipboardData)==null?void 0:p.getData(Ko))||"{}");if(!((E=l.nodes)!=null&&E.length))return;let c=new Map,u=l.nodes.map(f=>{let T=Yo();return c.set(f.id,T),C(v({},f),{id:T,selected:!0,position:{x:f.position.x+e,y:f.position.y+e}})}),g=l.edges.map(f=>C(v({},f),{id:Yo(),selected:!0,source:c.get(f.source)||f.source,target:c.get(f.target)||f.target}));o(f=>[...f.map(T=>C(v({},T),{selected:!1})),...u]),n(f=>[...f.map(T=>C(v({},T),{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 bi,useStoreApi as hi}from"@xyflow/react";import{v7 as Jo}from"uuid";import{create as si}from"zustand";var ye=si(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as li,EdgeLabelRenderer as di,getSmoothStepPath as ci,MarkerType as pi,useNodes as mi,useReactFlow as ui,useViewport as fi}from"@xyflow/react";import{useState as gi}from"react";import{jsx as ft,jsxs as $o}from"react/jsx-runtime";var Vm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:pi.Arrow},data:{label:""}},Xo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:c,selected:u})=>{let g=mi(),{zoom:p}=fi(),{updateEdgeData:E}=ui(),[f,T]=gi(!1),b=g.find(x=>x.id===t),m=g.find(x=>x.id===o),[d,N,I]=ci({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),y=u||(b==null?void 0:b.selected)||(m==null?void 0:m.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=f||(c==null?void 0:c.label.trim().length)>0,_=1/p,L=()=>{T(!0)},w=()=>{T(!1)},S=x=>{E(e,{label:x.trim()})};return $o("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:w,onDoubleClick:L,children:[ft(li,{id:e,path:d,markerEnd:`url(#${k})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.hasError)})}),ft(di,{children:$o("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[u&&ft(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${_})`}}),h&&ft(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:f,onChange:S})]})})]})};import{jsx as qo,jsxs as Ei}from"react/jsx-runtime";var jo=({fromX:e,fromY:t,toX:o,toY:r})=>Ei("g",{children:[qo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),qo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Qo=({nodes:e,setNodes:t,setEdges:o})=>{let r=hi(),{draggableNode:n,setDraggableNode:a}=ye(),{getInternalNode:i,screenToFlowPosition:s}=bi(),l=b=>{let m="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(N=>C(v({},N),{className:N.id===b?m:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},u=b=>{let m=i(b.id),d=c();if(b.type==="LANE"){if(ve({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let _=d.filter(S=>S.id!==b.id&&S.type==="LANE"&&!S.parentId),L=Pe(m,_);if(!L){l();return}if(ve({parentId:L.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(L.id);return}let I=d.filter(h=>h.id!==b.id&&h.type==="LANE"),y=Pe(m,I);if(!y){l();return}if(ve({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},g=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},p=(b,m)=>{b.preventDefault(),u(m)},E=(b,m,d)=>{var _,L;let N=w=>w.map(S=>C(v({},S),{className:void 0}));if(b.parentId===m.id){let w=me(m.id,d);t(re(N(w)));return}if(b.type==="LANE"){if(ve({parentId:m.id,nodes:d,excludeTypes:["LANE"]}))return;let x=d.filter(O=>O.parentId===m.id).reduce((O,ge)=>{var ce,pe;return O+((pe=(ce=ge.measured)==null?void 0:ce.height)!=null?pe:0)},0),M={x:Y.HEADER_WIDTH,y:x},K=d.map(O=>O.id===b.id?C(v({},O),{parentId:m.id,position:M,className:void 0}):C(v({},O),{className:void 0}));K=me(m.id,K),t(re(K));return}if(ve({parentId:m.id,nodes:d,includeTypes:["LANE"]})){let w;if(b.parentId){let x=i(b.parentId),{x:M,y:K}=oe(x);w={x:M+((_=b.position.x)!=null?_:0),y:K+((L=b.position.y)!=null?L:0)}}let S=d.map(x=>x.id===b.id?C(v({},x),{position:w!=null?w:x.position,parentId:void 0,className:void 0}):C(v({},x),{className:void 0}));t(re(S));return}let k=ho(b,m),h=d.map(w=>w.id===b.id?C(v({},w),{parentId:m.id,position:k,className:void 0}):C(v({},w),{className:void 0}));t(re(h))};return{onDragOver:g,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let m=s({x:b.clientX,y:b.clientY}),d={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},N={id:Jo(),type:n.type,position:m,measured:d,data:{label:"",variant:n.variant,attribute:n.attribute}},I=C(v({},N),{internals:{positionAbsolute:m}}),y=c(),k=n.type==="LANE",h=y.filter(w=>k?w.type==="LANE"&&!w.parentId:w.type==="LANE"),_=Pe(I,h);_?E(I,_,[...y,I]):t(w=>{let S=w.concat(N);return re(S)});let L=b.dataTransfer.getData("sourceId");if(L){let w={id:Jo(),source:L,target:N.id};if(n.type==="ANNOTATION"){o(S=>S.concat(v(v({},w),pt)));return}o(S=>S.concat(v(v({},w),ie)))}a(null)},onNodeDrag:p,onNodeDragStop:async(b,m)=>{var _,L;let{nodeLookup:d}=r.getState(),N=i(m.id),I=Array.from(d.values()),y=m.type==="LANE",k=I.filter(w=>w.id!==m.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Pe(N,k);if(h){E(N,h,I);return}if(m.parentId){let w=i(m.parentId),{x:S,y:x}=oe(w),M={x:S+((_=m.position.x)!=null?_:0),y:x+((L=m.position.y)!=null?L:0)},K=e.map(O=>O.id===m.id?C(v({},O),{position:M,parentId:void 0}):O);K=me(m.parentId,K),t(re(K))}}}};import{applyNodeChanges as vi}from"@xyflow/react";import{useCallback as Ni,useState as tr}from"react";function er(e,t,o=5){var l,c,u,g,p,E,f,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((g=(u=n.measured)==null?void 0:u.height)!=null?g:0),width:(E=(p=n.measured)==null?void 0:p.width)!=null?E:0,height:(T=(f=n.measured)==null?void 0:f.height)!=null?T:0},i=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,m)=>{var S,x,M,K,O,ge,ce,pe;let d={left:m.position.x,right:m.position.x+((x=(S=m.measured)==null?void 0:S.width)!=null?x:0),top:m.position.y,bottom:m.position.y+((K=(M=m.measured)==null?void 0:M.height)!=null?K:0),width:(ge=(O=m.measured)==null?void 0:O.width)!=null?ge:0,height:(pe=(ce=m.measured)==null?void 0:ce.height)!=null?pe:0},N=Math.abs(a.left-d.left);N<s&&(b.snapPosition.x=d.left,b.vertical=d.left,s=N);let I=Math.abs(a.right-d.right);I<s&&(b.snapPosition.x=d.right-a.width,b.vertical=d.right,s=I);let y=Math.abs(a.left-d.right);y<s&&(b.snapPosition.x=d.right,b.vertical=d.right,s=y);let k=Math.abs(a.right-d.left);k<s&&(b.snapPosition.x=d.left-a.width,b.vertical=d.left,s=k);let h=Math.abs(a.top-d.top);h<i&&(b.snapPosition.y=d.top,b.horizontal=d.top,i=h);let _=Math.abs(a.bottom-d.top);_<i&&(b.snapPosition.y=d.top-a.height,b.horizontal=d.top,i=_);let L=Math.abs(a.bottom-d.bottom);L<i&&(b.snapPosition.y=d.bottom-a.height,b.horizontal=d.bottom,i=L);let w=Math.abs(a.top-d.bottom);return w<i&&(b.snapPosition.y=d.bottom,b.horizontal=d.bottom,i=w),b},r)}var or=()=>{let[e,t]=tr(void 0),[o,r]=tr(void 0),n=Ni((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 c=er(a[0],i);a[0].position.x=(s=c.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=c.snapPosition.y)!=null?l:a[0].position.y,t(c.horizontal),r(c.vertical)}return vi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ti}from"@xyflow/react";import{v7 as sr}from"uuid";var nr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ar={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},rr=(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}},yi=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=rr(a[0],o),s=rr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},ir=e=>{let{components:t,connections:o}=yi(e);return{nodes:t,edges:o}};var lr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ti();return{createDiagram:n=>{let{nodes:a,edges:i}=ir(n),s=[],l=new Map;for(let[p,E]of Object.entries(a)){let f=sr(),T=nr[E.type],b=ar[E.type];l.set(p,f);let m=V[T].MIN_WIDTH,d=V[T].MIN_HEIGHT;s.push({id:f,type:T,data:{label:E.label||"",variant:b,attribute:""},position:{x:0,y:0},width:m,height:d,measured:{width:m,height:d}})}let c=[];for(let p of i){let E=C(v({},ie),{id:sr(),source:l.get(p.sourceId)||p.sourceId,target:l.get(p.targetId)||p.targetId});c.push(E)}let{nodes:u,edges:g}=yo(s,c);e(u),t(g),o()}}};import{useEffect as xi,useCallback as _i}from"react";var wi={origin:"*",debug:!1};function dr(e,t=wi){let{origin:o,debug:r}=t,n=_i((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return xi(()=>{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 Ci}from"@xyflow/react";import{useCallback as Oe,useState as cr}from"react";import{useDebouncedCallback as Ii}from"use-debounce";var Ai={nodes:[],edges:[]},ki=500,pr=10,mr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=Ci(),[n,a]=cr([Ai]),[i,s]=cr(0),l=n[i],c=i>0,u=i<n.length-1,g=Oe(d=>{o(n[d].nodes),r(n[d].edges)},[n,o,r]),p=Oe(()=>{if(i>0){let d=i-1;s(d),g(d)}},[i,g]),E=Oe(()=>{if(i<n.length-1){let d=i+1;s(d),g(d)}},[n,i,g]),f=d=>{let I=[...n.slice(0,i+1),d],y=I.length>pr?I.slice(I.length-pr):I;a(y),s(y.length-1)},T=Ii(()=>{let d=e(),N=t(),I={nodes:d,edges:N};JSON.stringify(l)!==JSON.stringify(I)&&f(I)},ki),b=Oe(d=>{if(d==="forceSave"){T();return}d.some(I=>I.type!=="select")&&T()},[T]),m=Oe(()=>{a([]),s(0)},[]);return{undo:p,redo:E,saveHistory:b,canUndo:c,canRedo:u,clearHistory:m}};import{jsx as ur}from"react/jsx-runtime";var Ft=({id:e,className:t})=>ur("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:ur("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Ut,jsxs as Li}from"react/jsx-runtime";var fr=()=>Ut("svg",{style:{position:"absolute",top:0,left:0},children:Li("defs",{children:[Ut(Ft,{id:"sequence-edge-marker",className:"text-grey-400"}),Ut(Ft,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Pr}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as ws}from"lecom-ui";import{HandIcon as Cs,ListCheckIcon as Is,MapIcon as As,MousePointerIcon as ks}from"lucide-react";import{useCallback as Ls,useEffect as Dr}from"react";import{useStore as Si}from"@xyflow/react";var Pi=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=Si(Pi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as rs,TooltipContent as ns,TooltipTrigger as as,useNotificationToast as is,useTranslation as ss}from"lecom-ui";var Ge=(m=>(m.START_EVENT="START_EVENT",m.END_EVENT="END_EVENT",m.TASK="TASK",m.SUBPROCESS="SUBPROCESS",m.GATEWAY="GATEWAY",m.ANNOTATION="ANNOTATION",m.CONNECTION="CONNECTION",m.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",m.ACTIVITY="ACTIVITY",m.PROCESS_INTERFACE="PROCESS_INTERFACE",m.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",m.VARIANT_ACTIVITY="VARIANT_ACTIVITY",m.AUTO_ACTIVITY="AUTO_ACTIVITY",m.DATA_STORE="DATA_STORE",m.DATA_OBJECT="DATA_OBJECT",m.DATA_OUTPUT="DATA_OUTPUT",m.DATA_INPUT="DATA_INPUT",m))(Ge||{});import{useReactFlow as $i}from"@xyflow/react";import{useNotificationToast as Xi,useTranslation as qi,Button as ji}from"lecom-ui";var gr=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 Er({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);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 Ui}from"uuid";import{xml2json as Di,json2xml as Uu}from"xml-js";var Ri={compact:!0,spaces:4},Mi=e=>e.replaceAll(`
|
|
4
|
-
`,"
");function br(e,t=Ri){if(e)return JSON.parse(Di(e,
|
|
4
|
+
`,"
");function br(e,t=Ri){if(e)return JSON.parse(Di(e,C(v({},t),{attributeValueFn:Mi})))}function hr(e){return e==null?void 0:e.replaceAll("
"," ")}import{v7 as Oi}from"uuid";var Xu={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},vr={script:"SCRIPT",subprocess:"SUBPROCESS"},Nr={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}}},Gi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.START_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Hi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.END_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Bi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=vr[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},zi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=Nr[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Fi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},yr=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=V.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=V.UNSUPPORTED.MIN_HEIGHT,{node:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Tr=(e,t)=>{let{source:o,target:r}=e._attributes;return C(v({},ie),{id:Oi(),source:t.get(o)||o,target:t.get(r)||r})},xr={TASK:Bi,GATEWAY:zi,START_EVENT:Gi,END_EVENT:Hi,ANNOTATION:Fi};var Wi=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=Ui(),{type:c}=s._attributes,u=xr[c]||yr;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:g,status:p,originalType:E}=u(s);n.push(g),a.push({originalType:E,type:g.type,variant:g.data.variant,value:hr(g.data.label),status:p})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},Yi=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>Tr(n,t)),Ki=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Wi(t.root.mxCell),a=Yi(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Zi=async e=>{let t=await gr(e),o=br(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}},_r=async e=>{try{let t=await Zi(e),{nodes:o,edges:r,summary:n}=Ki(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as Ji}from"react/jsx-runtime";var wr=()=>{let{t:e}=qi(),{toast:t}=Xi(),{setNodes:o,setEdges:r,fitView:n}=$i(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(u=>[u.originalType,u.value,e(`adapter.governance.report.status.${u.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:Ji(ji,{size:"small",variant:"ghost",onClick:()=>Er({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:u}=await _r(s);if(o(p=>p.concat(l)),r(p=>p.concat(c)),n(),u.some(p=>p.status==="unsupported")){a(u);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};import{Button as Qi}from"lecom-ui";import{useRef as es}from"react";import{Fragment as ts,jsx as Cr,jsxs as os}from"react/jsx-runtime";var Ir=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 c=es(null),u=p=>{let E=p.target.files;E!=null&&E.length&&a(E),c.current&&(c.current.value="")};return os(ts,{children:[Cr(Qi,C(v({onClick:p=>{var E;(E=c.current)==null||E.click(),n==null||n(p)}},i),{children:e})),Cr("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:u})]})};import{jsx as bt,jsxs as ls}from"react/jsx-runtime";var Ar=({disabled:e=!1})=>{let{t}=ss(),{toast:o}=is(),{createDiagram:r}=wr(),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 ls(rs,{children:[bt(as,{asChild:!0,children:bt(Ir,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:bt(lo,{})})}),bt(ns,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as gs,DropdownMenu as Es,DropdownMenuContent as bs,DropdownMenuItem as Yt,DropdownMenuTrigger as hs,Tooltip as ht,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as vs}from"lecom-ui";import{FileCodeIcon as Ns,FileImageIcon as ys,FolderOutputIcon as Ts,PrinterIcon as xs}from"lucide-react";import{useState as _s}from"react";import{useReactFlow as ds}from"@xyflow/react";import{toPng as kr,toSvg as cs}from"html-to-image";import{toast as ps,useTranslation as ms}from"lecom-ui";import{useState as us}from"react";var fs=3,Wt="diagram",Lr=()=>{let{t:e}=ms(),{getNodes:t}=ds(),{deselectAll:o}=gt(),[r,n]=us({png:!1,html:!1,print:!1}),a=()=>{let{x:u,y:g,width:p,height:E}=xo(t());return{width:p,height:E,style:{width:`${p}px`,height:`${E}px`,transform:`translate(${-u}px, ${-g}px)`}}},i=async(u,g)=>{n(C(v({},r),{[g]:!0})),await o();try{let p=To();if(!p)throw new Error("Flow element not found");let E=a();return await u(p,E)}catch(p){ps({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(C(v({},r),{[g]:!1}))}};return{exportAsPng:async(u=Wt)=>{await i(async(g,p)=>{let E=await kr(g,C(v({},p),{backgroundColor:"#fcfcfc"}));Et(E,`${u}.png`)},"png")},exportAsHtml:async(u=Wt)=>{await i(async(g,p)=>{let E=await cs(g,C(v({},p),{backgroundColor:"#fcfcfc"})),f=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -15,7 +15,7 @@ var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnProp
|
|
|
15
15
|
<img src="${E}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,
|
|
18
|
+
`,T=new Blob([f],{type:"text/html"}),b=URL.createObjectURL(T);Et(b,`${u}.html`),setTimeout(()=>URL.revokeObjectURL(b),100)},"html")},printDiagram:async(u=Wt)=>{await i(async(g,p)=>{let E=await kr(g,C(v({},p),{pixelRatio:fs})),f=window.open("","_blank");if(!f)throw new Error("Failed to open print window.");let T=f.document;T.open(),T.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
@@ -31,4 +31,4 @@ var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnProp
|
|
|
31
31
|
<img src="${E}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
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 Sr(){let{t:e}=vs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Lr(),[s,l]=_s(!1);return xe(Es,{modal:!1,open:s,onOpenChange:l,children:[G(hs,{asChild:!0,children:G("div",{children:xe(ht,{children:[G(Nt,{asChild:!0,children:G(gs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Ts,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(bs,{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(Yt,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(ys,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(Ns,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(xs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Ss,jsx as H,jsxs as le}from"react/jsx-runtime";var Rr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=ws(),{deselectAll:i}=gt(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:u,isMinimapOpen:f,setIsMinimapOpen:m}=O(),E=Pr(["v","V"]),g=Pr(["h","H"]),y=Ls(()=>{i(),u()},[i,u]),b=()=>{i();let d=n(o);r&&r(d)};return Dr(()=>{E&&!s&&!t&&c()},[E,c,s,t]),Dr(()=>{g&&!l&&!t&&y()},[g,y,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(Ss,{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:c,children:H(ks,{})})}),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(Cs,{})})}),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:b,children:H(Is,{})})}),H(xt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(Sr,{}),!t&&H(Ar,{disabled:e.length>0}),le(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:H(As,{})})}),H(xt,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Mr,Tooltip as Vr,TooltipContent as Or,TooltipTrigger as Gr,useTranslation as Ps}from"lecom-ui";import{RedoIcon as Ds,UndoIcon as Rs}from"lucide-react";import{jsx as de,jsxs as Kt}from"react/jsx-runtime";var Hr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ps();return Kt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Kt(Vr,{children:[de(Gr,{asChild:!0,children:de(Mr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Rs,{})})}),de(Or,{color:"black",children:n("editor.controls.history.undo")})]}),Kt(Vr,{children:[de(Gr,{asChild:!0,children:de(Mr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Ds,{})})}),de(Or,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ms}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Vs}from"lecom-ui";import{ScanIcon as Os,ZoomIn as Gs,ZoomOut as Hs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Br=()=>{let{t:e}=Vs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ms();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(Os,{})})}),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(Hs,{})})}),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(mo,{})})}),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(Gs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Il,useReactFlow as Al}from"@xyflow/react";import{Handle as Bs}from"@xyflow/react";import{jsx as zs}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>zs(Bs,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Fs,useReactFlow as Us}from"@xyflow/react";import{orderBy as Ws}from"lodash";import{jsx as Ys}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=Us(),s=({width:l,height:c})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let f=[...a()],m=!u.parentId,E=m?u.id:u.parentId,g=f.filter(d=>d.type==="LANE"&&d.parentId===E);if(!g.length)return;let y=Ws(g,["position.y"]),b=0;y.forEach((d,p)=>{var C,S;let T=p===y.length-1,x=(S=(C=d.measured)==null?void 0:C.height)!=null?S:0;f=f.map(h=>{if(h.id===d.id){let N=m?l-Y.HEADER_WIDTH:l,k=_(v({},h),{width:N,measured:_(v({},h.measured),{width:N}),position:_(v({},h.position),{y:b})});return T&&m&&(k.height=c-b),k}return h}),b+=x}),f=f.map(d=>{if(d.id===E){let p=m?l:l+Y.HEADER_WIDTH;return _(v({},d),{width:p,height:m?c:b,measured:{width:p,height:m?c:b}})}return d}),i(f)};return Ys(Fs,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};import{Position as vl,NodeToolbar as Nl}from"@xyflow/react";import{Button as yl,Tooltip as Tl,TooltipContent as xl,TooltipTrigger as _l,useTranslation as wl}from"lecom-ui";import{useNodesData as Ks,useReactFlow as Zs}from"@xyflow/react";import{Button as $s,DropdownMenu as Xs,DropdownMenuContent as qs,DropdownMenuGroup as js,DropdownMenuItem as Js,DropdownMenuLabel as Qs,DropdownMenuTrigger as el,Tooltip as tl,TooltipContent as ol,TooltipTrigger as rl,useTranslation as nl}from"lecom-ui";import{WrenchIcon as al}from"lucide-react";import{jsx as ne,jsxs as kt}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=nl(),{updateNodeData:o}=Zs(),r=Ks(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return kt(Xs,{children:[kt(tl,{children:[ne(rl,{asChild:!0,children:ne(el,{asChild:!0,children:ne($s,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(al,{})})})}),ne(ol,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(qs,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(Qs,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(js,{children:Object.entries(Qe).map(([a,i])=>kt(Js,{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 il,useReactFlow as sl}from"@xyflow/react";import{Button as Fr,DropdownMenu as ll,DropdownMenuContent as dl,DropdownMenuGroup as cl,DropdownMenuItem as pl,DropdownMenuLabel as ml,DropdownMenuTrigger as ul,Tooltip as fl,TooltipContent as gl,TooltipTrigger as El,useTranslation as bl}from"lecom-ui";import{WrenchIcon as hl}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var Ur=({nodeId:e})=>{let{t}=bl(),{updateNodeData:o}=sl(),r=il(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(ll,{children:[Be(fl,{children:[q(El,{asChild:!0,children:q(ul,{asChild:!0,children:q(Fr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(hl,{})})})}),q(gl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(dl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(ml,{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(Fr,{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(cl,{children:Object.entries(je).map(([i,s])=>Be(pl,{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 Cl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var u;let{t:n}=wl(),{setDraggableNode:a}=ye(),i=({event:f,type:m,variant:E})=>{a({type:m,variant:E}),f.dataTransfer.effectAllowed="move",f.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})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Ur,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(zr,{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(Nl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:vl.Right,align:"start",isVisible:r,children:(u=c[t])==null?void 0:u.map((f,m)=>f.component?j("div",{children:f.component},m):Cl(Tl,{children:[j(_l,{asChild:!0,children:j(yl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:E=>i({event:E,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(xl,{color:"black",children:f.label})]},m))})};import{Fragment as kl,jsx as ze,jsxs as Ll}from"react/jsx-runtime";var Wr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Al(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Ll(kl,{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:Il.Left})]})};import{Position as Yr,useReactFlow as Sl}from"@xyflow/react";import{useState as Pl}from"react";import{Fragment as Dl,jsx as we,jsxs as Kr}from"react/jsx-runtime";var Zr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Sl(),{isMultipleSelection:a}=O(),[i,s]=Pl(!1),l=f=>{n(e,{label:f})};return Kr(Dl,{children:[Kr("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:Yr.Right}),we(B,{type:"target",position:Yr.Left})]})};import{Position as $r,useReactFlow as Rl}from"@xyflow/react";import{useState as Ml}from"react";import{Fragment as Vl,jsx as Ce,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Rl(),{isMultipleSelection:i}=O(),[s,l]=Ml(!1),c=m=>{a(e,{label:m})};return Xr(Vl,{children:[Xr("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:c})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ce(B,{type:"target",position:$r.Left}),Ce(B,{type:"source",position:$r.Right})]})};import{Position as Ol,useReactFlow as Gl}from"@xyflow/react";import{useState as Hl}from"react";import{Fragment as Bl,jsx as Fe,jsxs as jr}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Gl(),{isMultipleSelection:a}=O(),[i,s]=Hl(!1),l=f=>{n(e,{label:f})};return jr(Bl,{children:[jr("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:Ol.Right})]})};import{Position as Qr,useReactFlow as zl}from"@xyflow/react";import{Fragment as Fl,jsx as ee,jsxs as en}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=zl(),{isMultipleSelection:a}=O(),i=m=>{n(e,{label:m})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,c=t.variant==="SUBPROCESS",u=s&&!c,f=l||c;return en(Fl,{children:[en("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":u||f}),onChange:i}),s&&ee("div",{className:A("absolute flex items-center p-1",c?"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",c?"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:Qr.Right}),ee(B,{type:"target",position:Qr.Left})]})};import{Position as on}from"@xyflow/react";import{Fragment as Ul,jsx as Lt,jsxs as Wl}from"react/jsx-runtime";var rn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Wl(Ul,{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:on.Right}),Lt(B,{type:"target",position:on.Left})]})};import{Position as Yl,useReactFlow as Kl}from"@xyflow/react";import{orderBy as Zl}from"lodash";import{useMemo as nn}from"react";import{Fragment as $l,jsx as fe,jsxs as an}from"react/jsx-runtime";var sn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Kl(),{isMultipleSelection:s}=O(),l=i(),c=!n,u=nn(()=>Zl([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=c?tt.MIN_WIDTH:Y.MIN_WIDTH,m=nn(()=>{if(c&&u.length>1){let g=[...u];return g.pop(),g.reduce((b,d)=>{var p,T;return b+((T=(p=d.measured)==null?void 0:p.height)!=null?T:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[c,u]),E=g=>{a(e,{label:g})};return an($l,{children:[an("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:E})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),c&&fe(B,{type:"source",position:Yl.Right})]})};var ln={START_EVENT:Jr,END_EVENT:Zr,TASK:tn,GATEWAY:qr,ANNOTATION:Wr,LANE:sn,UNSUPPORTED:rn},dn={SEQUENCE_EDGE:Po,MESSAGE_EDGE:Xo,ANNOTATION_EDGE:Io},cn="#fafafa",pn="#bebebe",mn=1,un=10,fn="bottom-left",gn=.5,En=4,bn={x:0,y:0,zoom:.75};import{useStore as Xl}from"@xyflow/react";import{useEffect as ql,useRef as jl}from"react";import{jsx as Ql}from"react/jsx-runtime";var Jl=e=>({width:e.width,height:e.height,transform:e.transform}),hn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Xl(Jl),s=jl(null);return ql(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let u=window.devicePixelRatio;l.width=n*u,l.height=a*u,c.scale(u,u),c.clearRect(0,0,n,a),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*i[2]+i[0],0),c.lineTo(t*i[2]+i[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*i[2]+i[1]),c.lineTo(n,e*i[2]+i[1]),c.stroke())},[n,a,i,e,t,o,r]),Ql("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as vn,Dialog as ed,DialogContent as td,DialogFooter as od,DialogHeader as rd,DialogTitle as nd,Notification as ad,Typography as Zt,useTranslation as id}from"lecom-ui";import{jsx as te,jsxs as $t}from"react/jsx-runtime";var Nn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=id(),a=!!e,i=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(u=>u.filter(f=>!l.some(m=>m.id===f.id))),c!=null&&c.length&&r(u=>u.filter(f=>!c.some(m=>m.id===f.id))),t(null)},s=()=>{t(null)};return te(ed,{open:a,onOpenChange:s,children:$t(td,{className:"w-[488px] max-w-fit gap-2",children:[te(rd,{children:te(nd,{children:te(Zt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),$t("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(ad,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Zt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),$t(od,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(vn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Zt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(vn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as sd,Tooltip as ld,TooltipContent as dd,TooltipTrigger as cd,useTranslation as pd}from"lecom-ui";import{jsx as Ue,jsxs as md}from"react/jsx-runtime";var yn=()=>{let{t:e}=pd(),{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:bo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Eo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:go,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:po,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)=>md(ld,{children:[Ue(cd,{asChild:!0,children:Ue(sd,{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(dd,{color:"black",side:"right",children:n.label})]},a))})};import{Button as ud,useTranslation as fd}from"lecom-ui";import{AlertCircleIcon as gd,CircleCheckIcon as Ed,XIcon as bd}from"lucide-react";import{useEffect as hd,useState as vd}from"react";import{jsx as J,jsxs as Xt}from"react/jsx-runtime";var Tn=({validationResult:e,onClose:t})=>{let{t:o}=fd(),[r,n]=vd(!1);if(hd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Xt("div",{className:A("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Xt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(Ed,{className:"text-green-500 size-5"}):J(gd,{className:"text-red-500 size-5"})}),Xt("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(ud,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(bd,{})})]}),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 jt}from"react/jsx-runtime";var Rd=[],Md=({mode:e="edit"})=>{let t=Sd(!1),[o,r]=Id([]),[n,a]=Cd([]),[i,s]=Pd(null),{isMoveTool:l,isHandTool:c,isReadOnly:u,setIsReadOnly:f,setIsMultipleSelection:m,isMinimapOpen:E}=O(),{validationResult:g,handleValidationComplete:y,clearValidation:b,isAutoValidationEnabled:d,validateDiagram:p}=Wo(),{getNode:T,getNodes:x,getEdges:C}=kd(),{onNodeDrag:S,onDrop:h,onDragOver:N,onNodeDragStop:k}=Qo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:w,onConnect:L}=Ro({setEdges:a});Zo();let{createDiagram:I}=lr(),{undo:z,redo:K,saveHistory:V,canUndo:ge,canRedo:ce}=mr(),{helperLineHorizontal:pe,helperLineVertical:Sn,customApplyNodeChanges:Pn}=or();dr({LIA_CREATE_DIAGRAM:I,CLEAR_DIAGRAM:()=>{r([]),a([])}}),xn(()=>{f(e==="readonly")},[e,f]);let Dn=()=>{b()},Rn=qt(({nodes:F,edges:R})=>{let Ie=F.length+R.length>1;m(Ie)},[m]);Ad({onChange:Rn});let Mn=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(oo=>oo.id!==R.id&&oo.type==="LANE"));r(re(Ie))}},Vn=F=>{F.forEach(R=>{switch(R.type){case"remove":Mn(R);break}})},On=qt(()=>{if(!d){t.current=!1;return}let F=x(),R=C(),Ie=p({nodes:F,edges:R});y(Ie),t.current=!1},[d,x,C,p,y]),eo=Dd(On,300),to=qt(()=>{d&&!t.current&&(t.current=!0,eo())},[d,eo]),Gn=F=>{r(R=>Pn(F,R)),V(F),to(),Vn(F)},Hn=F=>{a(R=>Nd(F,R)),V(F),to()},Bn=()=>{V("forceSave")},zn=async({nodes:F,edges:R})=>(s({nodes:F,edges:R}),!1),Fn={nodes:o,edges:n};return jt("div",{className:"w-full h-full",children:[!u&&$(yn,{}),$(fr,{}),jt(xd,{edges:n,nodes:o,nodeTypes:ln,edgeTypes:dn,minZoom:gn,maxZoom:En,panOnDrag:c||u?!0:Rd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!u&&l,nodesConnectable:!u&&l,nodesDraggable:!u&&l,isValidConnection:w,connectionLineComponent:jo,onConnect:L,onDrop:h,onDropCapture:Bn,onDragOver:N,onNodesChange:Gn,onEdgesChange:Hn,onNodeDrag:S,onNodeDragStop:k,onBeforeDelete:zn,selectionMode:wd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:bn,connectOnClick:!1,children:[E&&$(Td,{pannable:!0,zoomable:!0,position:fn,className:"shadow-md rounded-md"}),jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!u&&$(Hr,{canUndo:ge,canRedo:ce,undo:z,redo:K}),$(Rr,{nodes:o,isReadOnly:u,diagram:Fn,onValidationComplete:y,onValidateDiagram:p}),$(Br,{})]}),$(hn,{horizontal:pe,vertical:Sn}),$(yd,{gap:un,size:mn,color:pn,bgColor:cn}),g&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(Tn,{validationResult:g,onClose:Dn})})]}),$(Nn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Vd=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(xn(()=>{t&&Ld.changeLanguage(t)},[t]),$(_d,{children:$(wo,{value:{onConfigureElement:o},children:$(Md,{mode:e})})})),Jt=Vd;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 Od,Translations as Gd}from"lecom-ui";var _n={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 wn={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 Cn={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 In={pt_BR:Cn,en_US:_n,es_ES:wn};var An,kn,Hd=(kn=(An=Qt("LecomUserLanguage"))!=null?An:Qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?kn:Gd.PT_BR;Od({lng:Hd,resources:In});import{jsx as Ln}from"react/jsx-runtime";var XE=e=>Ln(io,{children:Ln(Jt,v({},e))});export{Pt as ActivityVariant,Rt as ComplexVariant,St as ElementType,Mt as ExclusiveVariant,ae as GatewayVariant,XE as Modeler,Dt as RoutingVariant};
|
|
34
|
+
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as H,jsxs as xe}from"react/jsx-runtime";function Sr(){let{t:e}=vs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Lr(),[s,l]=_s(!1);return xe(Es,{modal:!1,open:s,onOpenChange:l,children:[H(hs,{asChild:!0,children:H("div",{children:xe(ht,{children:[H(Nt,{asChild:!0,children:H(gs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:H(Ts,{})})}),!s&&H(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(bs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:a,onClick:()=>t(),children:H(ys,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:i,onClick:()=>o(),children:H(Ns,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:H(xs,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Ss,jsx as B,jsxs as le}from"react/jsx-runtime";var Rr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=ws(),{deselectAll:i}=gt(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:u,isMinimapOpen:g,setIsMinimapOpen:p}=G(),E=Pr(["v","V"]),f=Pr(["h","H"]),T=Ls(()=>{i(),u()},[i,u]),b=()=>{i();let m=n(o);r&&r(m)};return Dr(()=>{E&&!s&&!t&&c()},[E,c,s,t]),Dr(()=>{f&&!l&&!t&&T()},[f,T,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(Ss,{children:[le(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(s&&"bg-grey-400"),iconButton:!0,onClick:c,children:B(ks,{})})}),le(xt,{color:"black",children:[a("editor.controls.actions.move_tool"),B("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),le(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(l&&"bg-grey-400"),iconButton:!0,onClick:T,children:B(Cs,{})})}),le(xt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",B("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),le(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:b,children:B(Is,{})})}),B(xt,{color:"black",children:a("editor.controls.actions.check")})]})]}),B(Sr,{}),!t&&B(Ar,{disabled:e.length>0}),le(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(g&&"bg-grey-400"),iconButton:!0,onClick:()=>p(!g),children:B(As,{})})}),B(xt,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Mr,Tooltip as Vr,TooltipContent as Or,TooltipTrigger as Gr,useTranslation as Ps}from"lecom-ui";import{RedoIcon as Ds,UndoIcon as Rs}from"lucide-react";import{jsx as de,jsxs as Kt}from"react/jsx-runtime";var Hr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ps();return Kt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Kt(Vr,{children:[de(Gr,{asChild:!0,children:de(Mr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Rs,{})})}),de(Or,{color:"black",children:n("editor.controls.history.undo")})]}),Kt(Vr,{children:[de(Gr,{asChild:!0,children:de(Mr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Ds,{})})}),de(Or,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ms}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Vs}from"lecom-ui";import{ScanIcon as Os,ZoomIn as Gs,ZoomOut as Hs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Br=()=>{let{t:e}=Vs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ms();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(Os,{})})}),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(Hs,{})})}),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(mo,{})})}),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(Gs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Il,useReactFlow as Al}from"@xyflow/react";import{Handle as Bs}from"@xyflow/react";import{jsx as zs}from"react/jsx-runtime";var z=({type:e,position:t,className:o})=>zs(Bs,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Fs,useReactFlow as Us}from"@xyflow/react";import{orderBy as Ws}from"lodash";import{jsx as Ys}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=Us(),s=({width:l,height:c})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let g=[...a()],p=!u.parentId,E=p?u.id:u.parentId,f=g.filter(m=>m.type==="LANE"&&m.parentId===E);if(!f.length)return;let T=Ws(f,["position.y"]),b=0;T.forEach((m,d)=>{var y,k;let N=d===T.length-1,I=(k=(y=m.measured)==null?void 0:y.height)!=null?k:0;g=g.map(h=>{if(h.id===m.id){let _=p?l-Y.HEADER_WIDTH:l,L=C(v({},h),{width:_,measured:C(v({},h.measured),{width:_}),position:C(v({},h.position),{y:b})});return N&&p&&(L.height=c-b),L}return h}),b+=I}),g=g.map(m=>{if(m.id===E){let d=p?l:l+Y.HEADER_WIDTH;return C(v({},m),{width:d,height:p?c:b,measured:{width:d,height:p?c:b}})}return m}),i(g)};return Ys(Fs,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};import{Position as vl,NodeToolbar as Nl}from"@xyflow/react";import{Button as yl,Tooltip as Tl,TooltipContent as xl,TooltipTrigger as _l,useTranslation as wl}from"lecom-ui";import{useNodesData as Ks,useReactFlow as Zs}from"@xyflow/react";import{Button as $s,DropdownMenu as Xs,DropdownMenuContent as qs,DropdownMenuGroup as js,DropdownMenuItem as Js,DropdownMenuLabel as Qs,DropdownMenuTrigger as el,Tooltip as tl,TooltipContent as ol,TooltipTrigger as rl,useTranslation as nl}from"lecom-ui";import{WrenchIcon as al}from"lucide-react";import{jsx as ne,jsxs as kt}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=nl(),{updateNodeData:o}=Zs(),r=Ks(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return kt(Xs,{children:[kt(tl,{children:[ne(rl,{asChild:!0,children:ne(el,{asChild:!0,children:ne($s,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(al,{})})})}),ne(ol,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(qs,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(Qs,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(js,{children:Object.entries(Qe).map(([a,i])=>kt(Js,{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 il,useReactFlow as sl}from"@xyflow/react";import{Button as Fr,DropdownMenu as ll,DropdownMenuContent as dl,DropdownMenuGroup as cl,DropdownMenuItem as pl,DropdownMenuLabel as ml,DropdownMenuTrigger as ul,Tooltip as fl,TooltipContent as gl,TooltipTrigger as El,useTranslation as bl}from"lecom-ui";import{WrenchIcon as hl}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var Ur=({nodeId:e})=>{let{t}=bl(),{updateNodeData:o}=sl(),r=il(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(ll,{children:[Be(fl,{children:[q(El,{asChild:!0,children:q(ul,{asChild:!0,children:q(Fr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(hl,{})})})}),q(gl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(dl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(ml,{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(Fr,{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(cl,{children:Object.entries(je).map(([i,s])=>Be(pl,{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 Cl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var u;let{t:n}=wl(),{setDraggableNode:a}=ye(),i=({event:g,type:p,variant:E})=>{a({type:p,variant:E}),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})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Ur,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(zr,{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(Nl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:vl.Right,align:"start",isVisible:r,children:(u=c[t])==null?void 0:u.map((g,p)=>g.component?j("div",{children:g.component},p):Cl(Tl,{children:[j(_l,{asChild:!0,children:j(yl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:E=>i({event:E,type:g.type,variant:g.variant}),children:g.icon&&j(g.icon,{size:16})})}),j(xl,{color:"black",children:g.label})]},p))})};import{Fragment as kl,jsx as ze,jsxs as Ll}from"react/jsx-runtime";var Wr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Al(),{isMultipleSelection:a}=G(),i=s=>{n(e,{label:s})};return Ll(kl,{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(z,{type:"target",position:Il.Left})]})};import{Position as Yr,useReactFlow as Sl}from"@xyflow/react";import{useState as Pl}from"react";import{Fragment as Dl,jsx as we,jsxs as Kr}from"react/jsx-runtime";var Zr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Sl(),{isMultipleSelection:a}=G(),[i,s]=Pl(!1),l=g=>{n(e,{label:g})};return Kr(Dl,{children:[Kr("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(z,{type:"source",position:Yr.Right}),we(z,{type:"target",position:Yr.Left})]})};import{Position as $r,useReactFlow as Rl}from"@xyflow/react";import{useState as Ml}from"react";import{Fragment as Vl,jsx as Ce,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Rl(),{isMultipleSelection:i}=G(),[s,l]=Ml(!1),c=p=>{a(e,{label:p})};return Xr(Vl,{children:[Xr("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:c})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ce(z,{type:"target",position:$r.Left}),Ce(z,{type:"source",position:$r.Right})]})};import{Position as Ol,useReactFlow as Gl}from"@xyflow/react";import{useState as Hl}from"react";import{Fragment as Bl,jsx as Fe,jsxs as jr}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Gl(),{isMultipleSelection:a}=G(),[i,s]=Hl(!1),l=g=>{n(e,{label:g})};return jr(Bl,{children:[jr("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(z,{type:"source",position:Ol.Right})]})};import{Position as Qr,useReactFlow as zl}from"@xyflow/react";import{Fragment as Fl,jsx as ee,jsxs as en}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=zl(),{isMultipleSelection:a}=G(),i=p=>{n(e,{label:p})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,c=t.variant==="SUBPROCESS",u=s&&!c,g=l||c;return en(Fl,{children:[en("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":u||g}),onChange:i}),s&&ee("div",{className:A("absolute flex items-center p-1",c?"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",c?"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(z,{type:"source",position:Qr.Right}),ee(z,{type:"target",position:Qr.Left})]})};import{Position as on}from"@xyflow/react";import{Fragment as Ul,jsx as Lt,jsxs as Wl}from"react/jsx-runtime";var rn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=G();return Wl(Ul,{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(z,{type:"source",position:on.Right}),Lt(z,{type:"target",position:on.Left})]})};import{Position as Yl,useReactFlow as Kl}from"@xyflow/react";import{orderBy as Zl}from"lodash";import{useMemo as nn}from"react";import{Fragment as $l,jsx as fe,jsxs as an}from"react/jsx-runtime";var sn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Kl(),{isMultipleSelection:s}=G(),l=i(),c=!n,u=nn(()=>Zl([...l.filter(f=>f.parentId===e&&f.type==="LANE")],"position.y","asc"),[l,e]),g=c?tt.MIN_WIDTH:Y.MIN_WIDTH,p=nn(()=>{if(c&&u.length>1){let f=[...u];return f.pop(),f.reduce((b,m)=>{var d,N;return b+((N=(d=m.measured)==null?void 0:d.height)!=null?N:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[c,u]),E=f=>{a(e,{label:f})};return an($l,{children:[an("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:E})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:g,minHeight:p,isVisible:!r&&!s&&o}),c&&fe(z,{type:"source",position:Yl.Right})]})};var ln={START_EVENT:Jr,END_EVENT:Zr,TASK:tn,GATEWAY:qr,ANNOTATION:Wr,LANE:sn,UNSUPPORTED:rn},dn={SEQUENCE_EDGE:Po,MESSAGE_EDGE:Xo,ANNOTATION_EDGE:Io},cn="#fafafa",pn="#bebebe",mn=1,un=10,fn="bottom-left",gn=.5,En=4,bn={x:0,y:0,zoom:.75};import{useStore as Xl}from"@xyflow/react";import{useEffect as ql,useRef as jl}from"react";import{jsx as Ql}from"react/jsx-runtime";var Jl=e=>({width:e.width,height:e.height,transform:e.transform}),hn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Xl(Jl),s=jl(null);return ql(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let u=window.devicePixelRatio;l.width=n*u,l.height=a*u,c.scale(u,u),c.clearRect(0,0,n,a),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*i[2]+i[0],0),c.lineTo(t*i[2]+i[0],a),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*i[2]+i[1]),c.lineTo(n,e*i[2]+i[1]),c.stroke())},[n,a,i,e,t,o,r]),Ql("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as vn,Dialog as ed,DialogContent as td,DialogFooter as od,DialogHeader as rd,DialogTitle as nd,Notification as ad,Typography as Zt,useTranslation as id}from"lecom-ui";import{jsx as te,jsxs as $t}from"react/jsx-runtime";var Nn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=id(),a=!!e,i=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(u=>u.filter(g=>!l.some(p=>p.id===g.id))),c!=null&&c.length&&r(u=>u.filter(g=>!c.some(p=>p.id===g.id))),t(null)},s=()=>{t(null)};return te(ed,{open:a,onOpenChange:s,children:$t(td,{className:"w-[488px] max-w-fit gap-2",children:[te(rd,{children:te(nd,{children:te(Zt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),$t("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(ad,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Zt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),$t(od,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(vn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Zt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(vn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as sd,Tooltip as ld,TooltipContent as dd,TooltipTrigger as cd,useTranslation as pd}from"lecom-ui";import{jsx as Ue,jsxs as md}from"react/jsx-runtime";var yn=()=>{let{t:e}=pd(),{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:bo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Eo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:go,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:po,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)=>md(ld,{children:[Ue(cd,{asChild:!0,children:Ue(sd,{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(dd,{color:"black",side:"right",children:n.label})]},a))})};import{Button as ud,useTranslation as fd}from"lecom-ui";import{AlertCircleIcon as gd,CircleCheckIcon as Ed,XIcon as bd}from"lucide-react";import{useEffect as hd,useState as vd}from"react";import{jsx as J,jsxs as Xt}from"react/jsx-runtime";var Tn=({validationResult:e,onClose:t})=>{let{t:o}=fd(),[r,n]=vd(!1);if(hd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Xt("div",{className:A("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Xt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(Ed,{className:"text-green-500 size-5"}):J(gd,{className:"text-red-500 size-5"})}),Xt("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(ud,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(bd,{})})]}),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 jt}from"react/jsx-runtime";var Rd=[],Md=({mode:e="edit"})=>{let t=Sd(!1),[o,r]=Id([]),[n,a]=Cd([]),[i,s]=Pd(null),{isMoveTool:l,isHandTool:c,isReadOnly:u,setIsReadOnly:g,setIsMultipleSelection:p,isMinimapOpen:E}=G(),{validationResult:f,handleValidationComplete:T,clearValidation:b,isAutoValidationEnabled:m,validateDiagram:d}=Wo(),{getNode:N,getNodes:I,getEdges:y}=kd(),{onNodeDrag:k,onDrop:h,onDragOver:_,onNodeDragStop:L}=Qo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:w,onConnect:S}=Ro({setEdges:a});Zo();let{createDiagram:x}=lr(),{undo:M,redo:K,saveHistory:O,canUndo:ge,canRedo:ce}=mr(),{helperLineHorizontal:pe,helperLineVertical:Sn,customApplyNodeChanges:Pn}=or();dr({LIA_CREATE_DIAGRAM:x,CLEAR_DIAGRAM:()=>{r([]),a([])}}),xn(()=>{g(e==="readonly")},[e,g]);let Dn=()=>{b()},Rn=qt(({nodes:F,edges:R})=>{let Ie=F.length+R.length>1;p(Ie)},[p]);Ad({onChange:Rn});let Mn=F=>{let R=N(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ie=me(R.parentId,o.filter(oo=>oo.id!==R.id&&oo.type==="LANE"));r(re(Ie))}},Vn=F=>{F.forEach(R=>{switch(R.type){case"remove":Mn(R);break}})},On=qt(()=>{if(!m){t.current=!1;return}let F=I(),R=y(),Ie=d({nodes:F,edges:R});T(Ie),t.current=!1},[m,I,y,d,T]),eo=Dd(On,300),to=qt(()=>{m&&!t.current&&(t.current=!0,eo())},[m,eo]),Gn=F=>{r(R=>Pn(F,R)),O(F),to(),Vn(F)},Hn=F=>{a(R=>Nd(F,R)),O(F),to()},Bn=()=>{O("forceSave")},zn=async({nodes:F,edges:R})=>(s({nodes:F,edges:R}),!1),Fn={nodes:o,edges:n};return jt("div",{className:"w-full h-full",children:[!u&&$(yn,{}),$(fr,{}),jt(xd,{edges:n,nodes:o,nodeTypes:ln,edgeTypes:dn,minZoom:gn,maxZoom:En,panOnDrag:c||u?!0:Rd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!u&&l,nodesConnectable:!u&&l,nodesDraggable:!u&&l,isValidConnection:w,connectionLineComponent:jo,onConnect:S,onDrop:h,onDropCapture:Bn,onDragOver:_,onNodesChange:Gn,onEdgesChange:Hn,onNodeDrag:k,onNodeDragStop:L,onBeforeDelete:zn,selectionMode:wd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:bn,connectOnClick:!1,children:[E&&$(Td,{pannable:!0,zoomable:!0,position:fn,className:"shadow-md rounded-md"}),jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!u&&$(Hr,{canUndo:ge,canRedo:ce,undo:M,redo:K}),$(Rr,{nodes:o,isReadOnly:u,diagram:Fn,onValidationComplete:T,onValidateDiagram:d}),$(Br,{})]}),$(hn,{horizontal:pe,vertical:Sn}),$(yd,{gap:un,size:mn,color:pn,bgColor:cn}),f&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(Tn,{validationResult:f,onClose:Dn})})]}),$(Nn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Vd=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(xn(()=>{t&&Ld.changeLanguage(t)},[t]),$(_d,{children:$(wo,{value:{onConfigureElement:o},children:$(Md,{mode:e})})})),Jt=Vd;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 Od,Translations as Gd}from"lecom-ui";var _n={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 wn={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 Cn={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 In={pt_BR:Cn,en_US:_n,es_ES:wn};var An,kn,Hd=(kn=(An=Qt("LecomUserLanguage"))!=null?An:Qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?kn:Gd.PT_BR;Od({lng:Hd,resources:In});import{jsx as Ln}from"react/jsx-runtime";var XE=e=>Ln(io,{children:Ln(Jt,v({},e))});export{Pt as ActivityVariant,Rt as ComplexVariant,St as ElementType,Mt as ExclusiveVariant,ae as GatewayVariant,XE as Modeler,Dt as RoutingVariant};
|