lecom-modeler 0.1.2 → 0.1.3
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 +10 -10
- package/lib/index.d.cts +31 -5
- package/lib/index.d.ts +31 -5
- package/lib/index.js +10 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var Gn=Object.defineProperty,Hn=Object.defineProperties;var Bn=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var Jt=(e,t,o)=>t in e?Gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))Qt.call(t,o)&&Jt(e,o,t[o]);if(Ue)for(var o of Ue(t))eo.call(t,o)&&Jt(e,o,t[o]);return e},y=(e,t)=>Hn(e,Bn(t));var fe=(e,t)=>{var o={};for(var r in e)Qt.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ue)for(var r of Ue(e))t.indexOf(r)<0&&eo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as zn,Notification as Fn}from"lecom-ui";import{jsx as Un,jsxs as Wn}from"react/jsx-runtime";function to({children:e}){return Wn(zn,{children:[Un(Fn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as bd,Background as hd,MiniMap as Ed,ReactFlow as vd,ReactFlowProvider as Nd,SelectionMode as yd,useEdgesState as Td,useNodesState as xd,useOnSelectionChange as _d,useReactFlow as wd}from"@xyflow/react";import{i18n as Cd}from"lecom-ui";import{useCallback as Yt,useEffect as En,useRef as Id,useState as Ad}from"react";import{useDebouncedCallback as kd}from"use-debounce";var kt=(o=>(o.ACTIVITY="activity",o.ROUTING="routing",o))(kt||{}),St=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(St||{});import{RotateCcw as oa,ScrollText as ra,SquarePlus as na}from"lucide-react";import{jsx as We,jsxs as Yn}from"react/jsx-runtime";var Ye=({size:e=24,className:t})=>Yn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[We("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),We("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),We("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),We("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as oo}from"react/jsx-runtime";var be=({size:e=24,className:t})=>oo("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:oo("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 Ie,jsxs as Kn}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>Kn("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:[Ie("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"}),Ie("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Lt,jsxs as Zn}from"react/jsx-runtime";var he=({size:e=24,className:t})=>Zn("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:[Lt("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"}),Lt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Lt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Dt,jsxs as $n}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>$n("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Dt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Dt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Dt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Pt,jsxs as qn}from"react/jsx-runtime";var ro=({size:e=24,className:t})=>Pt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:qn("g",{children:[Pt("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"}),Pt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as Xn}from"clsx";import{twMerge as jn}from"tailwind-merge";function _(...e){return jn(Xn(e))}var Ae=(e,t)=>e<t?t:e;import{jsx as no,jsxs as Jn}from"react/jsx-runtime";var ao=({size:e=24,className:t})=>Jn("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:_("stroke-2",t),children:[no("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"}),no("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt}from"react/jsx-runtime";var io=({size:e=24,className:t})=>Mt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Mt("g",{children:Mt("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 so}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>so("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: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 lo}from"react/jsx-runtime";var ke=({size:e=24,className:t})=>lo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:_("stroke-2",t),children:lo("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 Rt,jsxs as Qn}from"react/jsx-runtime";var co=({size:e=24,className:t})=>Qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Rt("path",{d:"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"}),Rt("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"}),Rt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as ea}from"react/jsx-runtime";var po=({size:e=24,className:t})=>ea("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 ta}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>ta("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 Xe={SCRIPT:{icon:ra},SUBPROCESS:{icon:na}};var je={LOOP:{icon:oa}};var Je={EXCLUSIVE:{icon:he},PARALLEL:{icon:Ze},COMPLEX:{icon:Ke}};import fo from"@dagrejs/dagre";import{getNodesBounds as ma}from"@xyflow/react";import{orderBy as ua}from"lodash";var aa={MIN_WIDTH:36,MIN_HEIGHT:36},ia={MIN_WIDTH:36,MIN_HEIGHT:36},sa={MIN_WIDTH:56,MIN_HEIGHT:56},Qe={MIN_WIDTH:176,MIN_HEIGHT:96},et={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},tt={MIN_WIDTH:176,MIN_HEIGHT:64},la={MIN_WIDTH:128,MIN_HEIGHT:64},R={START_EVENT:aa,END_EVENT:ia,GATEWAY:sa,TASK:Qe,LANE:Y,ANNOTATION:tt,UNSUPPORTED:la};import{orderBy as da}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=>da(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),uo=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t);return{x:o-n,y:r-a}};var Ee=({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)),ca=(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)},pa=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:d}=oe(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Le=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&pa(e,n)){let a=ca(e,n);a<r&&(r=a,o=n)}return o},go=(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 bo=(e=[],t=[],o="LR")=>{let r=new fo.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)),fo.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(E({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},pe=(e,t)=>{var c,m;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=ua(n,["position.y"]),i=Math.max((m=(c=r.measured)==null?void 0:c.width)!=null?m:0,et.MIN_WIDTH),s=go(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,u=0;a.forEach(g=>{var v,f,p,h;o=o.map(w=>w.id===g.id?y(E({},w),{width:l-Y.HEADER_WIDTH,measured:y(E({},w.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):w),d+=(f=(v=g.measured)==null?void 0:v.height)!=null?f:0,u+=(h=(p=g.measured)==null?void 0:p.height)!=null?h:0}),o=o.map(g=>g.id===e?y(E({},g),{height:u,width:l,measured:y(E({},g.measured),{height:u,width:l})}):g);let b=o.find(g=>g.id===e);return b!=null&&b.parentId&&(o=pe(b.parentId,o)),o},ho=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ga=50,Eo=(e,t=ga)=>{let o=ma(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as fa}from"zustand";var O=fa(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 Ao,useReactFlow as ja}from"@xyflow/react";import{BaseEdge as Va,EdgeLabelRenderer as Oa,getStraightPath as Ga,useNodes as Ha,useViewport as Ba}from"@xyflow/react";import{getIncomers as Ea,getOutgoers as va,useReactFlow as Na}from"@xyflow/react";import{Button as ya,Tooltip as Ta,TooltipContent as xa,TooltipTrigger as _a,useTranslation as wa}from"lecom-ui";import{PencilIcon as Ca}from"lucide-react";import{createContext as ba,useContext as ha}from"react";var vo=ba(null),No=vo.Provider,yo=()=>{let e=ha(vo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as ot,jsxs as Ia}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=wa(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Na(),{onConfigureElement:s}=yo(),l=c=>{let m=a(),g=i(),v=Ea(c,m,g),f=va(c,m,g),p=v.some(w=>w.type==="START_EVENT"),h=f.some(w=>w.type==="END_EVENT");return p?"start":h?"end":"between"},d=()=>{var m;let c=r(e);c&&(s==null||s({id:c.id,type:"activity",variant:l(c),label:(m=c.data)==null?void 0:m.label}))},u=()=>{var m;let c=n(e);c&&(s==null||s({id:c.id,type:"routing",label:(m=c.data)==null?void 0:m.label}))};return Ia(Ta,{children:[ot(_a,{asChild:!0,children:ot(ya,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":d();break;case"edge":u();break}},children:ot(Ca,{size:16})})}),ot(xa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Aa}from"@xyflow/react";import{Button as ka,Tooltip as Sa,TooltipContent as La,TooltipTrigger as Da,useTranslation as Pa}from"lecom-ui";import{TrashIcon as Ma}from"lucide-react";import{jsx as rt,jsxs as Ra}from"react/jsx-runtime";var nt=({elementId:e,elementType:t="node"})=>{let{t:o}=Pa(),{deleteElements:r}=Aa();return Ra(Sa,{children:[rt(Da,{asChild:!0,children:rt(ka,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:rt(Ma,{size:16})})}),rt(La,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as at}from"react/jsx-runtime";var ve=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=fe(n,["edgeId","edgeType"]);var s;let a=[{component:at(nt,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:at(De,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return at("div",y(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>at("div",{children:l.component},d))}))};import{jsx as st,jsxs as za}from"react/jsx-runtime";var lt={type:"ANNOTATION_EDGE",zIndex:2e3},To=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=Ha(),{zoom:u}=Ba(),b=d.find(h=>h.id===t),c=d.find(h=>h.id===o),[m,g,v]=Ga({sourceX:r,sourceY:n,targetX:a,targetY:i}),f=s||(b==null?void 0:b.selected)||(c==null?void 0:c.selected),p=1/u;return za("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":f}),children:[st(Va,{id:e,path:m,strokeDasharray:4,className:_("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)]":f&&!(l!=null&&l.hasError)})}),st(Oa,{children:st("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${g}px, ${v}px)`},children:s&&st(ve,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Wa,EdgeLabelRenderer as Ya,getSmoothStepPath as Ka,MarkerType as wo,useNodes as Za,useReactFlow as $a,useViewport as qa}from"@xyflow/react";import{useState as Xa}from"react";import{useEffect as xo,useRef as Fa,useState as Ua}from"react";import{jsx as _o}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Fa(null),[l,d]=Ua(!1);xo(()=>{d(r!=null?r:!1)},[r]),xo(()=>{if(l&&s.current){s.current.focus();let m=document.createRange();m.selectNodeContents(s.current),m.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(m))}},[l]);let u=m=>{m.stopPropagation(),d(!0)},b=m=>{let g=m.currentTarget.innerText;t&&g.length>=t&&m.preventDefault()},c=m=>{d(!1),n==null||n(),o==null||o(m.currentTarget.innerText)};return _o("div",{className:_("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:_o("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:b,onBlur:c,children:e})})};import{jsx as dt,jsxs as Co}from"react/jsx-runtime";var ae={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:wo.ArrowClosed},markerEnd:{type:wo.Arrow},data:{label:""}},Io=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:u})=>{let b=Za(),{zoom:c}=qa(),{updateEdgeData:m}=$a(),[g,v]=Xa(!1),f=b.find(x=>x.id===t),p=b.find(x=>x.id===o),[h,w,I]=Ka({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=u||(f==null?void 0:f.selected)||(p==null?void 0:p.selected),P=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=g||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{m(e,{label:x.trim()})};return Co("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[dt(Wa,{id:e,path:h,markerEnd:`url(#${P})`,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),dt(Ya,{children:Co("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[u&&dt(ve,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),N&&dt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:k})]})})]})};var ko=({setEdges:e})=>{let{getNode:t}=ja();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"?Ao(E(E({},n),lt),a):Ao(E(E({},n),ae),a)})}}};import{useState as Go}from"react";import{useTranslation as Ja}from"lecom-ui";import{useReactFlow as Qa}from"@xyflow/react";var Pe=(e=[])=>e.filter(t=>t.type==="START_EVENT"),me=(e=[])=>e.filter(t=>t.type==="END_EVENT"),ie=(e=[])=>e.filter(t=>t.type==="TASK")||[],So=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Lo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),pt=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Do=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),q=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Po=(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"},Mo=(e,t)=>{let o=q(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},Ro=e=>e?/\w/g.test(e.trim()):!1,L=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)}},Vo=(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 Re=[{id:"start_event_not_found",validate:e=>{let t=Pe(e.nodes);return L({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=me(e.nodes);return L({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Pe(e.nodes),o=t.length===1;if(t.length===0)return L({isValid:!0});if(!o)return L({isValid:!1,nodeIds:t.map(a=>a.id)});let r=q(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return L({isValid:!1,nodeIds:[...new Set(a)]})}return L({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=ie(e.nodes),o=Q(t,r=>q(r.id,e.edges).length<=2);return L({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=ie(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return L({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=ie(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return L({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=ie(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 L({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=pt(e.nodes),o=[],r=[];for(let n of t){let a=q(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 L({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Pe(e.nodes),...me(e.nodes)],o=[],r=[];for(let n of t){let a=q(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 L({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=me(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=q(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return L({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Do(e.nodes),o=Q(t,n=>q(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>q(n,e.edges).map(a=>a.id));return L({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=ie(e.nodes),o=Q(t,r=>!r.label||Ro(r.label));return L({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 L({isValid:!0});let t=me(e.nodes)[0];if(!t)return L({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return L({isValid:!0});let n=ie(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Po(l.id,e));return L({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=ie(e.nodes),o=me(e.nodes)[0];if(!o)return L({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),u=q(l.id,e.edges),b=d.some(m=>{var g;return((g=e.nodes.find(v=>v.id===m.source))==null?void 0:g.type)==="START_EVENT"}),c=u.some(m=>{var g;return((g=e.nodes.find(v=>v.id===m.target))==null?void 0:g.type)==="END_EVENT"});return b&&c}),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 L(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=pt(e.nodes),o=[],r=[];for(let n of t){let a=q(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 L({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=pt(e.nodes),o=Q(t,r=>q(r.id,e.edges).length>=1);return L({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Pe(e.nodes),...me(e.nodes)],o=[],r=[];for(let n of t){let a=q(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 L({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=So(e.nodes),o=Q(t,r=>!Mo(r.id,e));return L({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Lo(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 L({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Oo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Re){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 Ho=()=>{let{t:e}=Ja(),[t,o]=Go(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=Qa(),[s,l]=Go(!1);return{validationResult:t,validateDiagram:c=>{let m=Vo(c.nodes,c.edges),g=Oo(m),v=g.errors.map(f=>y(E({},f),{message:e(`validation.errors.${f.id}`)}));return s||l(!0),{isValid:g.isValid,errors:v}},handleValidationComplete:c=>{if(o(c),!c)return;let m=[],g=[];c.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(T=>m.push(T)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(T=>g.push(T))});let v=[...new Set(m)];r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})}))),n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})})));let f=a(),p=i(),h=new Set(v),w=new Set;c.errors.forEach(N=>{var C,k;let T=Re.find(x=>x.id===N.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(x=>w.add(x)),(k=N.nodeIds)==null||k.forEach(x=>{p.forEach(z=>{(z.source===x||z.target===x)&&w.add(z.id)})}))});let I=new Set,A=new Set,P=new Set;f.forEach(N=>{N.type==="START_EVENT"?I.add(N.id):N.type==="END_EVENT"&&A.add(N.id)}),p.forEach(N=>{I.has(N.source)&&P.add(N.target),A.has(N.target)&&P.add(N.source)}),P.forEach(N=>{var T,S;if(h.has(N)){let C=(T=c.errors.find(x=>{var z;return(z=x.nodeIds)==null?void 0:z.includes(N)}))==null?void 0:T.id;((S=Re.find(x=>x.id===C))==null?void 0:S.highlightRelatedEdges)!==!1&&p.forEach(x=>{x.source===N&&A.has(x.target)&&(h.add(x.target),w.add(x.id)),x.target===N&&I.has(x.source)&&(h.add(x.source),w.add(x.id))})}}),h.size>0&&r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:h.has(T.id)})}))),w.size>0&&n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:w.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(c=>c.map(m=>y(E({},m),{data:y(E({},m.data),{hasError:!1})}))),n(c=>c.map(m=>y(E({},m),{data:y(E({},m.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ei}from"@xyflow/react";import{useEffect as ti}from"react";import{v7 as Bo}from"uuid";var oi=15,zo="bpmn:selection",Fo=({offset:e=oi}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=ei();ti(()=>{let a=s=>{var m;s.preventDefault();let l=t(),d=r(),u=l.filter(g=>g.selected);if(!u.length)return;let b=d.filter(g=>u.some(v=>v.id===g.source)&&u.some(v=>v.id===g.target)),c={nodes:u,edges:b};(m=s.clipboardData)==null||m.setData(zo,JSON.stringify(c))},i=s=>{var c,m;s.preventDefault();let l=JSON.parse(((c=s.clipboardData)==null?void 0:c.getData(zo))||"{}");if(!((m=l.nodes)!=null&&m.length))return;let d=new Map,u=l.nodes.map(g=>{let v=Bo();return d.set(g.id,v),y(E({},g),{id:v,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),b=l.edges.map(g=>y(E({},g),{id:Bo(),selected:!0,source:d.get(g.source)||g.source,target:d.get(g.target)||g.target}));o(g=>[...g.map(v=>y(E({},v),{selected:!1})),...u]),n(g=>[...g.map(v=>y(E({},v),{selected:!1})),...b])};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 ui,useStoreApi as gi}from"@xyflow/react";import{v7 as Zo}from"uuid";import{create as ri}from"zustand";var Ne=ri(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ni,EdgeLabelRenderer as ai,getSmoothStepPath as ii,MarkerType as si,useNodes as li,useReactFlow as di,useViewport as ci}from"@xyflow/react";import{useState as pi}from"react";import{jsx as mt,jsxs as Uo}from"react/jsx-runtime";var Lm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:si.Arrow},data:{label:""}},Wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:u})=>{let b=li(),{zoom:c}=ci(),{updateEdgeData:m}=di(),[g,v]=pi(!1),f=b.find(x=>x.id===t),p=b.find(x=>x.id===o),[h,w,I]=ii({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=u||(f==null?void 0:f.selected)||(p==null?void 0:p.selected),P=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=g||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{m(e,{label:x.trim()})};return Uo("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[mt(ni,{id:e,path:h,markerEnd:`url(#${P})`,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),mt(ai,{children:Uo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[u&&mt(ve,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),N&&mt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:k})]})})]})};import{jsx as Yo,jsxs as mi}from"react/jsx-runtime";var Ko=({fromX:e,fromY:t,toX:o,toY:r})=>mi("g",{children:[Yo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),Yo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var $o=({nodes:e,setNodes:t,setEdges:o})=>{let r=gi(),{draggableNode:n,setDraggableNode:a}=Ne(),{getInternalNode:i,screenToFlowPosition:s}=ui(),l=f=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(h=>h.map(w=>y(E({},w),{className:w.id===f?p:""})))},d=()=>{let{nodeLookup:f}=r.getState();return Array.from(f.values())},u=f=>{let p=i(f.id),h=d();if(f.type==="LANE"){if(Ee({parentId:f.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=h.filter(k=>k.id!==f.id&&k.type==="LANE"&&!k.parentId),S=Le(p,T);if(!S){l();return}if(Ee({parentId:S.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(S.id);return}let I=h.filter(N=>N.id!==f.id&&N.type==="LANE"),A=Le(p,I);if(!A){l();return}if(Ee({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},b=f=>{f.preventDefault(),f.dataTransfer.dropEffect="move"},c=(f,p)=>{f.preventDefault(),u(p)},m=(f,p,h)=>{var T,S;let w=C=>C.map(k=>y(E({},k),{className:void 0}));if(f.parentId===p.id){let C=pe(p.id,h);t(re(w(C)));return}if(f.type==="LANE"){if(Ee({parentId:p.id,nodes:h,excludeTypes:["LANE"]}))return;let x=h.filter(V=>V.parentId===p.id).reduce((V,ge)=>{var de,ce;return V+((ce=(de=ge.measured)==null?void 0:de.height)!=null?ce:0)},0),z={x:Y.HEADER_WIDTH,y:x},K=h.map(V=>V.id===f.id?y(E({},V),{parentId:p.id,position:z,className:void 0}):y(E({},V),{className:void 0}));K=pe(p.id,K),t(re(K));return}if(Ee({parentId:p.id,nodes:h,includeTypes:["LANE"]})){let C;if(f.parentId){let x=i(f.parentId),{x:z,y:K}=oe(x);C={x:z+((T=f.position.x)!=null?T:0),y:K+((S=f.position.y)!=null?S:0)}}let k=h.map(x=>x.id===f.id?y(E({},x),{position:C!=null?C:x.position,parentId:void 0,className:void 0}):y(E({},x),{className:void 0}));t(re(k));return}let P=uo(f,p),N=h.map(C=>C.id===f.id?y(E({},C),{parentId:p.id,position:P,className:void 0}):y(E({},C),{className:void 0}));t(re(N))};return{onDragOver:b,onDrop:f=>{if(f.preventDefault(),!(n!=null&&n.type))return;let p=s({x:f.clientX,y:f.clientY}),h={width:R[n.type].MIN_WIDTH,height:R[n.type].MIN_HEIGHT},w={id:Zo(),type:n.type,position:p,measured:h,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(E({},w),{internals:{positionAbsolute:p}}),A=d(),P=n.type==="LANE",N=A.filter(C=>P?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=Le(I,N);T?m(I,T,[...A,I]):t(C=>{let k=C.concat(w);return re(k)});let S=f.dataTransfer.getData("sourceId");if(S){let C={id:Zo(),source:S,target:w.id};if(n.type==="ANNOTATION"){o(k=>k.concat(E(E({},C),lt)));return}o(k=>k.concat(E(E({},C),ae)))}a(null)},onNodeDrag:c,onNodeDragStop:async(f,p)=>{var T,S;let{nodeLookup:h}=r.getState(),w=i(p.id),I=Array.from(h.values()),A=p.type==="LANE",P=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=Le(w,P);if(N){m(w,N,I);return}if(p.parentId){let C=i(p.parentId),{x:k,y:x}=oe(C),z={x:k+((T=p.position.x)!=null?T:0),y:x+((S=p.position.y)!=null?S:0)},K=e.map(V=>V.id===p.id?y(E({},V),{position:z,parentId:void 0}):V);K=pe(p.parentId,K),t(re(K))}}}};import{applyNodeChanges as fi}from"@xyflow/react";import{useCallback as bi,useState as Xo}from"react";function qo(e,t,o=5){var l,d,u,b,c,m,g,v;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(f=>f.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((b=(u=n.measured)==null?void 0:u.height)!=null?b:0),width:(m=(c=n.measured)==null?void 0:c.width)!=null?m:0,height:(v=(g=n.measured)==null?void 0:g.height)!=null?v:0},i=o,s=o;return t.filter(f=>f.id!==n.id).reduce((f,p)=>{var k,x,z,K,V,ge,de,ce;let h={left:p.position.x,right:p.position.x+((x=(k=p.measured)==null?void 0:k.width)!=null?x:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(ge=(V=p.measured)==null?void 0:V.width)!=null?ge:0,height:(ce=(de=p.measured)==null?void 0:de.height)!=null?ce:0},w=Math.abs(a.left-h.left);w<s&&(f.snapPosition.x=h.left,f.vertical=h.left,s=w);let I=Math.abs(a.right-h.right);I<s&&(f.snapPosition.x=h.right-a.width,f.vertical=h.right,s=I);let A=Math.abs(a.left-h.right);A<s&&(f.snapPosition.x=h.right,f.vertical=h.right,s=A);let P=Math.abs(a.right-h.left);P<s&&(f.snapPosition.x=h.left-a.width,f.vertical=h.left,s=P);let N=Math.abs(a.top-h.top);N<i&&(f.snapPosition.y=h.top,f.horizontal=h.top,i=N);let T=Math.abs(a.bottom-h.top);T<i&&(f.snapPosition.y=h.top-a.height,f.horizontal=h.top,i=T);let S=Math.abs(a.bottom-h.bottom);S<i&&(f.snapPosition.y=h.bottom-a.height,f.horizontal=h.bottom,i=S);let C=Math.abs(a.top-h.bottom);return C<i&&(f.snapPosition.y=h.bottom,f.horizontal=h.bottom,i=C),f},r)}var jo=()=>{let[e,t]=Xo(void 0),[o,r]=Xo(void 0),n=bi((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=qo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return fi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ei}from"@xyflow/react";import{v7 as or}from"uuid";var Qo={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},er={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Jo=(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}},hi=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=
|
|
3
|
-
`),a=encodeURI(n);gt(a,`${o}.csv`)}var gt=(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
|
|
4
|
-
`,"
");function
|
|
1
|
+
var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var to=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var eo=(e,t,o)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))to.call(t,o)&&eo(e,o,t[o]);if(We)for(var o of We(t))oo.call(t,o)&&eo(e,o,t[o]);return e},y=(e,t)=>Fn(e,Un(t));var ge=(e,t)=>{var o={};for(var r in e)to.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&oo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Wn,Notification as Yn}from"lecom-ui";import{jsx as Kn,jsxs as Zn}from"react/jsx-runtime";function ro({children:e}){return Zn(Wn,{children:[Kn(Yn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as hd,Background as vd,MiniMap as Nd,ReactFlow as yd,ReactFlowProvider as Td,SelectionMode as xd,useEdgesState as _d,useNodesState as wd,useOnSelectionChange as Cd,useReactFlow as Id}from"@xyflow/react";import{i18n as Ad}from"lecom-ui";import{useCallback as Zt,useEffect as yn,useRef as kd,useState as Ld}from"react";import{useDebouncedCallback as Sd}from"use-debounce";var Lt=(o=>(o.ACTIVITY="activity",o.ROUTING="routing",o))(Lt||{}),St=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(St||{}),Pt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Pt||{});import{RotateCcw as aa,ScrollText as ia,SquarePlus as sa}from"lucide-react";import{jsx as Ye,jsxs as $n}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>$n("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as no}from"react/jsx-runtime";var Ee=({size:e=24,className:t})=>no("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:no("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ie,jsxs as Xn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Xn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Ie("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"}),Ie("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ie("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Dt,jsxs as qn}from"react/jsx-runtime";var be=({size:e=24,className:t})=>qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Dt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Dt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Dt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt,jsxs as jn}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Mt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Rt,jsxs as Jn}from"react/jsx-runtime";var ao=({size:e=24,className:t})=>Rt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:Jn("g",{children:[Rt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Rt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as Qn}from"clsx";import{twMerge as ea}from"tailwind-merge";function w(...e){return ea(Qn(e))}var Ae=(e,t)=>e<t?t:e;import{jsx as io,jsxs as ta}from"react/jsx-runtime";var so=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:w("stroke-2",t),children:[io("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),io("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Vt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Vt("g",{children:Vt("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});import{jsx as co}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>co("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:co("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as po}from"react/jsx-runtime";var ke=({size:e=24,className:t})=>po("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:w("stroke-2",t),children:po("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ot,jsxs as oa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>oa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Ot("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Le,jsxs as ra}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>ra("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Le("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"}),Le("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"}),Le("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"}),Le("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as qe,jsxs as na}from"react/jsx-runtime";var fo=({size:e=24,className:t})=>na("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[qe("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),qe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(D||{});var je={SCRIPT:{icon:ia},SUBPROCESS:{icon:sa}};var Je={LOOP:{icon:aa}};var Qe={EXCLUSIVE:{icon:be},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import bo from"@dagrejs/dagre";import{getNodesBounds as ga}from"@xyflow/react";import{orderBy as Ea}from"lodash";var la={MIN_WIDTH:36,MIN_HEIGHT:36},da={MIN_WIDTH:36,MIN_HEIGHT:36},ca={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},pa={MIN_WIDTH:128,MIN_HEIGHT:64},R={START_EVENT:la,END_EVENT:da,GATEWAY:ca,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:pa};import{orderBy as ma}from"lodash";var oe=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},re=e=>ma(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),go=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t);return{x:o-n,y:r-a}};var he=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ua=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:a}=oe(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},fa=(e,t)=>{let{x:o,y:r,w:n,h:a}=oe(e),{x:i,y:s,w:l,h:d}=oe(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Se=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&fa(e,n)){let a=ua(e,n);a<r&&(r=a,o=n)}return o},Eo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var ho=(e=[],t=[],o="LR")=>{let r=new bo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),bo.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(N({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},pe=(e,t)=>{var u,b;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let a=Ea(n,["position.y"]),i=Math.max((b=(u=r.measured)==null?void 0:u.width)!=null?b:0,tt.MIN_WIDTH),s=Eo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,f=0;a.forEach(E=>{var h,c,p,m;o=o.map(x=>x.id===E.id?y(N({},x),{width:l-Y.HEADER_WIDTH,measured:y(N({},x.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):x),d+=(c=(h=E.measured)==null?void 0:h.height)!=null?c:0,f+=(m=(p=E.measured)==null?void 0:p.height)!=null?m:0}),o=o.map(E=>E.id===e?y(N({},E),{height:f,width:l,measured:y(N({},E.measured),{height:f,width:l})}):E);let g=o.find(E=>E.id===e);return g!=null&&g.parentId&&(o=pe(g.parentId,o)),o},vo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ba=50,No=(e,t=ba)=>{let o=ga(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as ha}from"zustand";var O=ha(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));import{addEdge as So,useReactFlow as Qa}from"@xyflow/react";import{BaseEdge as Ga,EdgeLabelRenderer as Ha,getStraightPath as Ba,useNodes as za,useViewport as Fa}from"@xyflow/react";import{getIncomers as Gt,getOutgoers as _o,useReactFlow as Ta}from"@xyflow/react";import{Button as xa,Tooltip as _a,TooltipContent as wa,TooltipTrigger as Ca,useTranslation as Ia}from"lecom-ui";import{PencilIcon as Aa}from"lucide-react";import{createContext as va,useContext as Na}from"react";var yo=va(null),To=yo.Provider,xo=()=>{let e=Na(yo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as rt,jsxs as ka}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Ia(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Ta(),{onConfigureElement:s}=xo(),l=h=>{let c=a(),p=i(),m=Gt(h,c,p),x=_o(h,c,p),I=m.some(L=>L.type==="START_EVENT"),A=x.some(L=>L.type==="END_EVENT");return I?"start":A?"end":"between"},d=h=>{var L,v,T;let c=a(),p=i(),m=r(h.source),x=r(h.target);if(!m||!x)return"simple";if(_o(m,c,p).some(k=>k.type==="END_EVENT"))return"final";if(m.type==="GATEWAY")switch((L=m.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(m.type==="TASK"){let k=(v=m.data)==null?void 0:v.variant,C=(T=m.data)==null?void 0:T.attribute;return k==="SCRIPT"?"script":C==="LOOP"?"loop":"simple"}return"simple"},f=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="COMPLEX")return;let p=a(),m=i(),x=Gt(c,p,m),I=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(I=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),I&&A)return"script_loop";if(I)return"script";if(A)return"loop"},g=h=>{var L;let c=r(h.source);if(!c||c.type!=="GATEWAY"||((L=c.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let p=a(),m=i(),x=Gt(c,p,m),I=!1,A=!1;if(x.forEach(v=>{var T,k;v.type==="TASK"&&(((T=v.data)==null?void 0:T.variant)==="SCRIPT"&&(I=!0),((k=v.data)==null?void 0:k.attribute)==="LOOP"&&(A=!0))}),I)return"script";if(A)return"loop"},u=()=>{let h=r(e);h&&(s==null||s({id:h.id,type:"activity",variant:l(h)}))},b=()=>{let h=n(e);if(h){let c=d(h),p;c==="complex"?p=f(h):c==="exclusive"&&(p=g(h)),s==null||s({id:h.id,type:"routing",variant:c,subVariant:p})}};return ka(_a,{children:[rt(Ca,{asChild:!0,children:rt(xa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":u();break;case"edge":b();break}},children:rt(Aa,{size:16})})}),rt(wa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as La}from"@xyflow/react";import{Button as Sa,Tooltip as Pa,TooltipContent as Da,TooltipTrigger as Ma,useTranslation as Ra}from"lecom-ui";import{TrashIcon as Va}from"lucide-react";import{jsx as at,jsxs as Oa}from"react/jsx-runtime";var it=({elementId:e,elementType:t="node"})=>{let{t:o}=Ra(),{deleteElements:r}=La();return Oa(Pa,{children:[at(Ma,{asChild:!0,children:at(Sa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:at(Va,{size:16})})}),at(Da,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as st}from"react/jsx-runtime";var ve=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=ge(n,["edgeId","edgeType"]);var s;let a=[{component:st(it,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:st(De,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return st("div",y(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>st("div",{children:l.component},d))}))};import{jsx as dt,jsxs as Ua}from"react/jsx-runtime";var ct={type:"ANNOTATION_EDGE",zIndex:2e3},wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=za(),{zoom:f}=Fa(),g=d.find(m=>m.id===t),u=d.find(m=>m.id===o),[b,E,h]=Ba({sourceX:r,sourceY:n,targetX:a,targetY:i}),c=s||(g==null?void 0:g.selected)||(u==null?void 0:u.selected),p=1/f;return Ua("g",{className:w("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":c}),children:[dt(Ga,{id:e,path:b,strokeDasharray:4,className:w("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":c&&!(l!=null&&l.hasError)})}),dt(Ha,{children:dt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${h}px)`},children:s&&dt(ve,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Ka,EdgeLabelRenderer as Za,getSmoothStepPath as $a,MarkerType as Ao,useNodes as Xa,useReactFlow as qa,useViewport as ja}from"@xyflow/react";import{useState as Ja}from"react";import{useEffect as Co,useRef as Wa,useState as Ya}from"react";import{jsx as Io}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Wa(null),[l,d]=Ya(!1);Co(()=>{d(r!=null?r:!1)},[r]),Co(()=>{if(l&&s.current){s.current.focus();let b=document.createRange();b.selectNodeContents(s.current),b.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(b))}},[l]);let f=b=>{b.stopPropagation(),d(!0)},g=b=>{let E=b.currentTarget.innerText;t&&E.length>=t&&b.preventDefault()},u=b=>{d(!1),n==null||n(),o==null||o(b.currentTarget.innerText)};return Io("div",{className:w("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:i,onDoubleClick:f,children:Io("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:g,onBlur:u,children:e})})};import{jsx as pt,jsxs as ko}from"react/jsx-runtime";var ae={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Ao.ArrowClosed},markerEnd:{type:Ao.Arrow},data:{label:""}},Lo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=Xa(),{zoom:u}=ja(),{updateEdgeData:b}=qa(),[E,h]=Ja(!1),c=g.find(_=>_.id===t),p=g.find(_=>_.id===o),[m,x,I]=$a({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},C=()=>{h(!1)},S=_=>{b(e,{label:_.trim()})};return ko("g",{className:w("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:k,children:[pt(Ka,{id:e,path:m,markerEnd:`url(#${L})`,className:w("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),pt(Za,{children:ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${x}px, ${I}px)`},children:[f&&pt(ve,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),v&&pt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var Po=({setEdges:e})=>{let{getNode:t}=Qa();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?So(N(N({},n),ct),a):So(N(N({},n),ae),a)})}}};import{useState as zo}from"react";import{useTranslation as ei}from"lecom-ui";import{useReactFlow as ti}from"@xyflow/react";var Me=(e=[])=>e.filter(t=>t.type==="START_EVENT"),me=(e=[])=>e.filter(t=>t.type==="END_EVENT"),ie=(e=[])=>e.filter(t=>t.type==="TASK")||[],Do=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Mo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),mt=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Ro=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Re=(e,t=[])=>t.filter(o=>o.target===e),Vo=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Oo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Go=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Ho=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Me(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=me(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Me(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(a=>a.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return P({isValid:!1,nodeIds:[...new Set(a)]})}return P({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=ie(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=ie(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=ie(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=ie(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return P({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=mt(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Me(e.nodes),...me(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=me(e.nodes),o=[],r=[];for(let n of t){let a=Re(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=X(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Ro(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(a=>a.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=ie(e.nodes),o=Q(t,r=>!r.label||Go(r.label));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return P({isValid:!0});let t=me(e.nodes)[0];if(!t)return P({isValid:!0});let o=Re(t.id,e.edges);if(!o.length)return P({isValid:!0});let n=ie(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Vo(l.id,e));return P({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=ie(e.nodes),o=me(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Re(l.id,e.edges),f=X(l.id,e.edges),g=d.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.source))==null?void 0:E.type)==="START_EVENT"}),u=f.some(b=>{var E;return((E=e.nodes.find(h=>h.id===b.target))==null?void 0:E.type)==="END_EVENT"});return g&&u}),n=Re(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=mt(e.nodes),o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=mt(e.nodes),o=Q(t,r=>X(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Me(e.nodes),...me(e.nodes)],o=[],r=[];for(let n of t){let a=X(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Do(e.nodes),o=Q(t,r=>!Oo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Mo(e.nodes),o=Q(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Bo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Fo=()=>{let{t:e}=ei(),[t,o]=zo(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ti(),[s,l]=zo(!1);return{validationResult:t,validateDiagram:u=>{let b=Ho(u.nodes,u.edges),E=Bo(b),h=E.errors.map(c=>y(N({},c),{message:e(`validation.errors.${c.id}`)}));return s||l(!0),{isValid:E.isValid,errors:h}},handleValidationComplete:u=>{if(o(u),!u)return;let b=[],E=[];u.errors.forEach(v=>{v.nodeIds&&v.nodeIds.length>0&&v.nodeIds.forEach(T=>b.push(T)),v.edgeIds&&v.edgeIds.length>0&&v.edgeIds.forEach(T=>E.push(T))});let h=[...new Set(b)];r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})}))),n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:!1})})));let c=a(),p=i(),m=new Set(h),x=new Set;u.errors.forEach(v=>{var C,S;let T=Ve.find(_=>_.id===v.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=v.edgeIds)==null||C.forEach(_=>x.add(_)),(S=v.nodeIds)==null||S.forEach(_=>{p.forEach(z=>{(z.source===_||z.target===_)&&x.add(z.id)})}))});let I=new Set,A=new Set,L=new Set;c.forEach(v=>{v.type==="START_EVENT"?I.add(v.id):v.type==="END_EVENT"&&A.add(v.id)}),p.forEach(v=>{I.has(v.source)&&L.add(v.target),A.has(v.target)&&L.add(v.source)}),L.forEach(v=>{var T,k;if(m.has(v)){let C=(T=u.errors.find(_=>{var z;return(z=_.nodeIds)==null?void 0:z.includes(v)}))==null?void 0:T.id;((k=Ve.find(_=>_.id===C))==null?void 0:k.highlightRelatedEdges)!==!1&&p.forEach(_=>{_.source===v&&A.has(_.target)&&(m.add(_.target),x.add(_.id)),_.target===v&&I.has(_.source)&&(m.add(_.source),x.add(_.id))})}}),m.size>0&&r(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:m.has(T.id)})}))),x.size>0&&n(v=>v.map(T=>y(N({},T),{data:y(N({},T.data),{hasError:x.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})}))),n(u=>u.map(b=>y(N({},b),{data:y(N({},b.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as oi}from"@xyflow/react";import{useEffect as ri}from"react";import{v7 as Uo}from"uuid";var ni=15,Wo="bpmn:selection",Yo=({offset:e=ni}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=oi();ri(()=>{let a=s=>{var b;s.preventDefault();let l=t(),d=r(),f=l.filter(E=>E.selected);if(!f.length)return;let g=d.filter(E=>f.some(h=>h.id===E.source)&&f.some(h=>h.id===E.target)),u={nodes:f,edges:g};(b=s.clipboardData)==null||b.setData(Wo,JSON.stringify(u))},i=s=>{var u,b;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Wo))||"{}");if(!((b=l.nodes)!=null&&b.length))return;let d=new Map,f=l.nodes.map(E=>{let h=Uo();return d.set(E.id,h),y(N({},E),{id:h,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),g=l.edges.map(E=>y(N({},E),{id:Uo(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(h=>y(N({},h),{selected:!1})),...f]),n(E=>[...E.map(h=>y(N({},h),{selected:!1})),...g])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};import{useReactFlow as gi,useStoreApi as Ei}from"@xyflow/react";import{v7 as qo}from"uuid";import{create as ai}from"zustand";var Ne=ai(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ii,EdgeLabelRenderer as si,getSmoothStepPath as li,MarkerType as di,useNodes as ci,useReactFlow as pi,useViewport as mi}from"@xyflow/react";import{useState as ui}from"react";import{jsx as ut,jsxs as Ko}from"react/jsx-runtime";var Vm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:di.Arrow},data:{label:""}},Zo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:f})=>{let g=ci(),{zoom:u}=mi(),{updateEdgeData:b}=pi(),[E,h]=ui(!1),c=g.find(_=>_.id===t),p=g.find(_=>_.id===o),[m,x,I]=li({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=f||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),L=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=E||(d==null?void 0:d.label.trim().length)>0,T=1/u,k=()=>{h(!0)},C=()=>{h(!1)},S=_=>{b(e,{label:_.trim()})};return Ko("g",{className:w("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:k,children:[ut(ii,{id:e,path:m,markerEnd:`url(#${L})`,strokeDasharray:4,className:w("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),ut(si,{children:Ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${x}px, ${I}px)`},children:[f&&ut(ve,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),v&&ut(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};import{jsx as $o,jsxs as fi}from"react/jsx-runtime";var Xo=({fromX:e,fromY:t,toX:o,toY:r})=>fi("g",{children:[$o("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),$o("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var jo=({nodes:e,setNodes:t,setEdges:o})=>{let r=Ei(),{draggableNode:n,setDraggableNode:a}=Ne(),{getInternalNode:i,screenToFlowPosition:s}=gi(),l=c=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(m=>m.map(x=>y(N({},x),{className:x.id===c?p:""})))},d=()=>{let{nodeLookup:c}=r.getState();return Array.from(c.values())},f=c=>{let p=i(c.id),m=d();if(c.type==="LANE"){if(he({parentId:c.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=m.filter(S=>S.id!==c.id&&S.type==="LANE"&&!S.parentId),k=Se(p,T);if(!k){l();return}if(he({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let I=m.filter(v=>v.id!==c.id&&v.type==="LANE"),A=Se(p,I);if(!A){l();return}if(he({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},g=c=>{c.preventDefault(),c.dataTransfer.dropEffect="move"},u=(c,p)=>{c.preventDefault(),f(p)},b=(c,p,m)=>{var T,k;let x=C=>C.map(S=>y(N({},S),{className:void 0}));if(c.parentId===p.id){let C=pe(p.id,m);t(re(x(C)));return}if(c.type==="LANE"){if(he({parentId:p.id,nodes:m,excludeTypes:["LANE"]}))return;let _=m.filter(V=>V.parentId===p.id).reduce((V,fe)=>{var de,ce;return V+((ce=(de=fe.measured)==null?void 0:de.height)!=null?ce:0)},0),z={x:Y.HEADER_WIDTH,y:_},K=m.map(V=>V.id===c.id?y(N({},V),{parentId:p.id,position:z,className:void 0}):y(N({},V),{className:void 0}));K=pe(p.id,K),t(re(K));return}if(he({parentId:p.id,nodes:m,includeTypes:["LANE"]})){let C;if(c.parentId){let _=i(c.parentId),{x:z,y:K}=oe(_);C={x:z+((T=c.position.x)!=null?T:0),y:K+((k=c.position.y)!=null?k:0)}}let S=m.map(_=>_.id===c.id?y(N({},_),{position:C!=null?C:_.position,parentId:void 0,className:void 0}):y(N({},_),{className:void 0}));t(re(S));return}let L=go(c,p),v=m.map(C=>C.id===c.id?y(N({},C),{parentId:p.id,position:L,className:void 0}):y(N({},C),{className:void 0}));t(re(v))};return{onDragOver:g,onDrop:c=>{if(c.preventDefault(),!(n!=null&&n.type))return;let p=s({x:c.clientX,y:c.clientY}),m={width:R[n.type].MIN_WIDTH,height:R[n.type].MIN_HEIGHT},x={id:qo(),type:n.type,position:p,measured:m,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(N({},x),{internals:{positionAbsolute:p}}),A=d(),L=n.type==="LANE",v=A.filter(C=>L?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=Se(I,v);T?b(I,T,[...A,I]):t(C=>{let S=C.concat(x);return re(S)});let k=c.dataTransfer.getData("sourceId");if(k){let C={id:qo(),source:k,target:x.id};if(n.type==="ANNOTATION"){o(S=>S.concat(N(N({},C),ct)));return}o(S=>S.concat(N(N({},C),ae)))}a(null)},onNodeDrag:u,onNodeDragStop:async(c,p)=>{var T,k;let{nodeLookup:m}=r.getState(),x=i(p.id),I=Array.from(m.values()),A=p.type==="LANE",L=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),v=Se(x,L);if(v){b(x,v,I);return}if(p.parentId){let C=i(p.parentId),{x:S,y:_}=oe(C),z={x:S+((T=p.position.x)!=null?T:0),y:_+((k=p.position.y)!=null?k:0)},K=e.map(V=>V.id===p.id?y(N({},V),{position:z,parentId:void 0}):V);K=pe(p.parentId,K),t(re(K))}}}};import{applyNodeChanges as bi}from"@xyflow/react";import{useCallback as hi,useState as Qo}from"react";function Jo(e,t,o=5){var l,d,f,g,u,b,E,h;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(c=>c.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((g=(f=n.measured)==null?void 0:f.height)!=null?g:0),width:(b=(u=n.measured)==null?void 0:u.width)!=null?b:0,height:(h=(E=n.measured)==null?void 0:E.height)!=null?h:0},i=o,s=o;return t.filter(c=>c.id!==n.id).reduce((c,p)=>{var S,_,z,K,V,fe,de,ce;let m={left:p.position.x,right:p.position.x+((_=(S=p.measured)==null?void 0:S.width)!=null?_:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(fe=(V=p.measured)==null?void 0:V.width)!=null?fe:0,height:(ce=(de=p.measured)==null?void 0:de.height)!=null?ce:0},x=Math.abs(a.left-m.left);x<s&&(c.snapPosition.x=m.left,c.vertical=m.left,s=x);let I=Math.abs(a.right-m.right);I<s&&(c.snapPosition.x=m.right-a.width,c.vertical=m.right,s=I);let A=Math.abs(a.left-m.right);A<s&&(c.snapPosition.x=m.right,c.vertical=m.right,s=A);let L=Math.abs(a.right-m.left);L<s&&(c.snapPosition.x=m.left-a.width,c.vertical=m.left,s=L);let v=Math.abs(a.top-m.top);v<i&&(c.snapPosition.y=m.top,c.horizontal=m.top,i=v);let T=Math.abs(a.bottom-m.top);T<i&&(c.snapPosition.y=m.top-a.height,c.horizontal=m.top,i=T);let k=Math.abs(a.bottom-m.bottom);k<i&&(c.snapPosition.y=m.bottom-a.height,c.horizontal=m.bottom,i=k);let C=Math.abs(a.top-m.bottom);return C<i&&(c.snapPosition.y=m.bottom,c.horizontal=m.bottom,i=C),c},r)}var er=()=>{let[e,t]=Qo(void 0),[o,r]=Qo(void 0),n=hi((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Jo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return bi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ni}from"@xyflow/react";import{v7 as ar}from"uuid";var or={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},rr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},tr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},vi=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
+
`),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=tr(a[0],o),s=tr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},nr=e=>{let{components:t,connections:o}=vi(e);return{nodes:t,edges:o}};var ir=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ni();return{createDiagram:n=>{let{nodes:a,edges:i}=nr(n),s=[],l=new Map;for(let[u,b]of Object.entries(a)){let E=ar(),h=or[b.type],c=rr[b.type];l.set(u,E);let p=R[h].MIN_WIDTH,m=R[h].MIN_HEIGHT;s.push({id:E,type:h,data:{label:b.label||"",variant:c,attribute:""},position:{x:0,y:0},width:p,height:m,measured:{width:p,height:m}})}let d=[];for(let u of i){let b=y(N({},ae),{id:ar(),source:l.get(u.sourceId)||u.sourceId,target:l.get(u.targetId)||u.targetId});d.push(b)}let{nodes:f,edges:g}=ho(s,d);e(f),t(g),o()}}};import{useEffect as yi,useCallback as Ti}from"react";var xi={origin:"*",debug:!1};function sr(e,t=xi){let{origin:o,debug:r}=t,n=Ti((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return yi(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}import{useReactFlow as _i}from"@xyflow/react";import{useCallback as Oe,useState as lr}from"react";import{useDebouncedCallback as wi}from"use-debounce";var Ci={nodes:[],edges:[]},Ii=500,dr=10,cr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=_i(),[n,a]=lr([Ci]),[i,s]=lr(0),l=n[i],d=i>0,f=i<n.length-1,g=Oe(m=>{o(n[m].nodes),r(n[m].edges)},[n,o,r]),u=Oe(()=>{if(i>0){let m=i-1;s(m),g(m)}},[i,g]),b=Oe(()=>{if(i<n.length-1){let m=i+1;s(m),g(m)}},[n,i,g]),E=m=>{let I=[...n.slice(0,i+1),m],A=I.length>dr?I.slice(I.length-dr):I;a(A),s(A.length-1)},h=wi(()=>{let m=e(),x=t(),I={nodes:m,edges:x};JSON.stringify(l)!==JSON.stringify(I)&&E(I)},Ii),c=Oe(m=>{if(m==="forceSave"){h();return}m.some(I=>I.type!=="select")&&h()},[h]),p=Oe(()=>{a([]),s(0)},[]);return{undo:u,redo:b,saveHistory:c,canUndo:d,canRedo:f,clearHistory:p}};import{jsx as pr}from"react/jsx-runtime";var Ht=({id:e,className:t})=>pr("marker",{id:e,className:w("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:pr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Bt,jsxs as Ai}from"react/jsx-runtime";var mr=()=>Bt("svg",{style:{position:"absolute",top:0,left:0},children:Ai("defs",{children:[Bt(Ht,{id:"sequence-edge-marker",className:"text-grey-400"}),Bt(Ht,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Lr}from"@xyflow/react";import{Button as Nt,Tooltip as yt,TooltipContent as Tt,TooltipTrigger as xt,useTranslation as xs}from"lecom-ui";import{HandIcon as _s,ListCheckIcon as ws,MapIcon as Cs,MousePointerIcon as Is}from"lucide-react";import{useCallback as As,useEffect as Sr}from"react";import{useStore as ki}from"@xyflow/react";var Li=e=>({unselectAll:e.unselectNodesAndEdges}),ft=()=>{let{unselectAll:e}=ki(Li);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as ts,TooltipContent as os,TooltipTrigger as rs,useNotificationToast as ns,useTranslation as as}from"lecom-ui";var Ge=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Ge||{});import{useReactFlow as Ki}from"@xyflow/react";import{useNotificationToast as Zi,useTranslation as $i,Button as Xi}from"lecom-ui";var ur=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function fr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
|
|
3
|
+
`),a=encodeURI(n);gt(a,`${o}.csv`)}var gt=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};import{v7 as zi}from"uuid";import{xml2json as Si,json2xml as Uu}from"xml-js";var Pi={compact:!0,spaces:4},Di=e=>e.replaceAll(`
|
|
4
|
+
`,"
");function gr(e,t=Pi){if(e)return JSON.parse(Si(e,y(N({},t),{attributeValueFn:Di})))}function Er(e){return e==null?void 0:e.replaceAll("
"," ")}import{v7 as Ri}from"uuid";var Xu={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},br={script:"SCRIPT",subprocess:"SUBPROCESS"},hr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ye=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},Vi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=R.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=R.START_EVENT.MIN_HEIGHT,{node:ye({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Oi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=R.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=R.END_EVENT.MIN_HEIGHT,{node:ye({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Gi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=br[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=Ae(e.mxGeometry._attributes.width,R.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Ae(e.mxGeometry._attributes.height,R.TASK.MIN_HEIGHT),{node:ye({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Hi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=hr[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=R.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=R.GATEWAY.MIN_HEIGHT,{node:ye({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Bi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Ae(e.mxGeometry._attributes.width,R.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Ae(e.mxGeometry._attributes.height,R.ANNOTATION.MIN_HEIGHT),{node:ye({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},vr=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=R.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=R.UNSUPPORTED.MIN_HEIGHT,{node:ye({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Nr=(e,t)=>{let{source:o,target:r}=e._attributes;return y(N({},ae),{id:Ri(),source:t.get(o)||o,target:t.get(r)||r})},yr={TASK:Gi,GATEWAY:Hi,START_EVENT:Vi,END_EVENT:Oi,ANNOTATION:Bi};var Fi=e=>{var i;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=zi(),{type:d}=s._attributes,f=yr[d]||vr;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:g,status:u,originalType:b}=f(s);n.push(g),a.push({originalType:b,type:g.type,variant:g.data.variant,value:Er(g.data.label),status:u})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},Ui=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>Nr(n,t)),Wi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Fi(t.root.mxCell),a=Ui(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Yi=async e=>{let t=await ur(e),o=gr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Tr=async e=>{try{let t=await Yi(e),{nodes:o,edges:r,summary:n}=Wi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as qi}from"react/jsx-runtime";var xr=()=>{let{t:e}=$i(),{toast:t}=Zi(),{setNodes:o,setEdges:r,fitView:n}=Ki(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(f=>[f.originalType,f.value,e(`adapter.governance.report.status.${f.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:qi(Xi,{size:"small",variant:"ghost",onClick:()=>fr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:f}=await Tr(s);if(o(u=>u.concat(l)),r(u=>u.concat(d)),n(),f.some(u=>u.status==="unsupported")){a(f);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as ji}from"lecom-ui";import{useRef as Ji}from"react";import{Fragment as Qi,jsx as _r,jsxs as es}from"react/jsx-runtime";var wr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=ge(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=Ji(null),f=u=>{let b=u.target.files;b!=null&&b.length&&a(b),d.current&&(d.current.value="")};return es(Qi,{children:[_r(ji,y(N({onClick:u=>{var b;(b=d.current)==null||b.click(),n==null||n(u)}},i),{children:e})),_r("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:f})]})};import{jsx as Et,jsxs as is}from"react/jsx-runtime";var Cr=({disabled:e=!1})=>{let{t}=as(),{toast:o}=ns(),{createDiagram:r}=xr(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return is(ts,{children:[Et(rs,{asChild:!0,children:Et(wr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:Et(ao,{})})}),Et(os,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as us,DropdownMenu as fs,DropdownMenuContent as gs,DropdownMenuItem as Ft,DropdownMenuTrigger as Es,Tooltip as bt,TooltipContent as ht,TooltipTrigger as vt,useTranslation as bs}from"lecom-ui";import{FileCodeIcon as hs,FileImageIcon as vs,FolderOutputIcon as Ns,PrinterIcon as ys}from"lucide-react";import{useState as Ts}from"react";import{useReactFlow as ss}from"@xyflow/react";import{toPng as Ir,toSvg as ls}from"html-to-image";import{toast as ds,useTranslation as cs}from"lecom-ui";import{useState as ps}from"react";var ms=3,zt="diagram",Ar=()=>{let{t:e}=cs(),{getNodes:t}=ss(),{deselectAll:o}=ft(),[r,n]=ps({png:!1,html:!1,print:!1}),a=()=>{let{x:f,y:g,width:u,height:b}=No(t());return{width:u,height:b,style:{width:`${u}px`,height:`${b}px`,transform:`translate(${-f}px, ${-g}px)`}}},i=async(f,g)=>{n(y(N({},r),{[g]:!0})),await o();try{let u=vo();if(!u)throw new Error("Flow element not found");let b=a();return await f(u,b)}catch(u){ds({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(y(N({},r),{[g]:!1}))}};return{exportAsPng:async(f=zt)=>{await i(async(g,u)=>{let b=await Ir(g,y(N({},u),{backgroundColor:"#fcfcfc"}));gt(b,`${f}.png`)},"png")},exportAsHtml:async(f=zt)=>{await i(async(g,u)=>{let b=await ls(g,y(N({},u),{backgroundColor:"#fcfcfc"})),E=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>${
|
|
8
|
+
<title>${f}</title>
|
|
9
9
|
<style>
|
|
10
10
|
body { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #eee; }
|
|
11
11
|
img { max-width: 95%; max-height: 95vh; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
|
|
12
12
|
</style>
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
|
-
<img src="${
|
|
15
|
+
<img src="${b}" alt="Diagram" />
|
|
16
16
|
</body>
|
|
17
17
|
</html>
|
|
18
|
-
`,
|
|
18
|
+
`,h=new Blob([E],{type:"text/html"}),c=URL.createObjectURL(h);gt(c,`${f}.html`),setTimeout(()=>URL.revokeObjectURL(c),100)},"html")},printDiagram:async(f=zt)=>{await i(async(g,u)=>{let b=await Ir(g,y(N({},u),{pixelRatio:ms})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let h=E.document;h.open(),h.write(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html>
|
|
21
21
|
<head>
|
|
22
|
-
<title>${
|
|
22
|
+
<title>${f}</title>
|
|
23
23
|
<style>
|
|
24
24
|
@page { size: auto; margin: 0mm; }
|
|
25
25
|
@media print { body { margin: 0; } img { width: 100%; height: auto; vertical-align: middle; } }
|
|
@@ -28,7 +28,7 @@ var Gn=Object.defineProperty,Hn=Object.defineProperties;var Bn=Object.getOwnProp
|
|
|
28
28
|
</style>
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
|
-
<img src="${
|
|
31
|
+
<img src="${b}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),v.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as Te}from"react/jsx-runtime";function Cr(){let{t:e}=fs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=wr(),[s,l]=Ns(!1);return Te(ms,{modal:!1,open:s,onOpenChange:l,children:[G(gs,{asChild:!0,children:G("div",{children:Te(bt,{children:[G(Et,{asChild:!0,children:G(ps,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Es,{})})}),!s&&G(ht,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),Te(us,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[Te(bt,{children:[G(Et,{asChild:!0,children:G(Bt,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(hs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),Te(bt,{children:[G(Et,{asChild:!0,children:G(Bt,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(bs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),Te(bt,{children:[G(Et,{asChild:!0,children:G(Bt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(vs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Is,jsx as H,jsxs as se}from"react/jsx-runtime";var kr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=ys(),{deselectAll:i}=ut(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:u,isMinimapOpen:b,setIsMinimapOpen:c}=O(),m=Ir(["v","V"]),g=Ir(["h","H"]),v=Cs(()=>{i(),u()},[i,u]),f=()=>{i();let p=n(o);r&&r(p)};return Ar(()=>{m&&!s&&!t&&d()},[m,d,s,t]),Ar(()=>{g&&!l&&!t&&v()},[g,v,l,t]),se("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&se(Is,{children:[se(Nt,{children:[H(Tt,{asChild:!0,children:H(vt,{size:"small",variant:"ghost",color:"grey",className:_(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(ws,{})})}),se(yt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),se(Nt,{children:[H(Tt,{asChild:!0,children:H(vt,{size:"small",variant:"ghost",color:"grey",className:_(l&&"bg-grey-400"),iconButton:!0,onClick:v,children:H(Ts,{})})}),se(yt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),se(Nt,{children:[H(Tt,{asChild:!0,children:H(vt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:f,children:H(xs,{})})}),H(yt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(Cr,{}),!t&&H(xr,{disabled:e.length>0}),se(Nt,{children:[H(Tt,{asChild:!0,children:H(vt,{size:"small",variant:"ghost",color:"grey",className:_(b&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!b),children:H(_s,{})})}),H(yt,{color:"black",children:a(b?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Sr,Tooltip as Lr,TooltipContent as Dr,TooltipTrigger as Pr,useTranslation as As}from"lecom-ui";import{RedoIcon as ks,UndoIcon as Ss}from"lucide-react";import{jsx as le,jsxs as zt}from"react/jsx-runtime";var Mr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=As();return zt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[zt(Lr,{children:[le(Pr,{asChild:!0,children:le(Sr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:le(Ss,{})})}),le(Dr,{color:"black",children:n("editor.controls.history.undo")})]}),zt(Lr,{children:[le(Pr,{asChild:!0,children:le(Sr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:le(ks,{})})}),le(Dr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ls}from"@xyflow/react";import{Button as xt,Tooltip as _t,TooltipContent as wt,TooltipTrigger as Ct,useTranslation as Ds}from"lecom-ui";import{ScanIcon as Ps,ZoomIn as Ms,ZoomOut as Rs}from"lucide-react";import{jsx as W,jsxs as Ge}from"react/jsx-runtime";var Rr=()=>{let{t:e}=Ds(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ls();return Ge("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Ge(_t,{children:[W(Ct,{asChild:!0,children:W(xt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Ps,{})})}),W(wt,{color:"black",children:e("editor.controls.zoom.fit")})]}),Ge(_t,{children:[W(Ct,{asChild:!0,children:W(xt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Rs,{})})}),W(wt,{color:"black",children:e("editor.controls.zoom.out")})]}),Ge(_t,{children:[W(Ct,{asChild:!0,children:W(xt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(io,{})})}),W(wt,{color:"black",children:e("editor.controls.zoom.reset")})]}),Ge(_t,{children:[W(Ct,{asChild:!0,children:W(xt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Ms,{})})}),W(wt,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as xl,useReactFlow as _l}from"@xyflow/react";import{Handle as Vs}from"@xyflow/react";import{jsx as Os}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Os(Vs,{type:e,position:t,className:_("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Gs,useReactFlow as Hs}from"@xyflow/react";import{orderBy as Bs}from"lodash";import{jsx as zs}from"react/jsx-runtime";var xe=o=>{var r=o,{nodeId:e}=r,t=fe(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=Hs(),s=({width:l,height:d})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let b=[...a()],c=!u.parentId,m=c?u.id:u.parentId,g=b.filter(p=>p.type==="LANE"&&p.parentId===m);if(!g.length)return;let v=Bs(g,["position.y"]),f=0;v.forEach((p,h)=>{var A,P;let w=h===v.length-1,I=(P=(A=p.measured)==null?void 0:A.height)!=null?P:0;b=b.map(N=>{if(N.id===p.id){let T=c?l-Y.HEADER_WIDTH:l,S=y(E({},N),{width:T,measured:y(E({},N.measured),{width:T}),position:y(E({},N.position),{y:f})});return w&&c&&(S.height=d-f),S}return N}),f+=I}),b=b.map(p=>{if(p.id===m){let h=c?l:l+Y.HEADER_WIDTH;return y(E({},p),{width:h,height:c?d:f,measured:{width:h,height:c?d:f}})}return p}),i(b)};return zs(Gs,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as fl,NodeToolbar as bl}from"@xyflow/react";import{Button as hl,Tooltip as El,TooltipContent as vl,TooltipTrigger as Nl,useTranslation as yl}from"lecom-ui";import{useNodesData as Fs,useReactFlow as Us}from"@xyflow/react";import{Button as Ws,DropdownMenu as Ys,DropdownMenuContent as Ks,DropdownMenuGroup as Zs,DropdownMenuItem as $s,DropdownMenuLabel as qs,DropdownMenuTrigger as Xs,Tooltip as js,TooltipContent as Js,TooltipTrigger as Qs,useTranslation as el}from"lecom-ui";import{WrenchIcon as tl}from"lucide-react";import{jsx as ne,jsxs as It}from"react/jsx-runtime";var Vr=({nodeId:e})=>{let{t}=el(),{updateNodeData:o}=Us(),r=Fs(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return It(Ys,{children:[It(js,{children:[ne(Qs,{asChild:!0,children:ne(Xs,{asChild:!0,children:ne(Ws,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(tl,{})})})}),ne(Js,{color:"black",children:t("bpmn.gateway.menu.title")})]}),It(Ks,{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(Zs,{children:Object.entries(Je).map(([a,i])=>It($s,{className:_({"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 ol,useReactFlow as rl}from"@xyflow/react";import{Button as Or,DropdownMenu as nl,DropdownMenuContent as al,DropdownMenuGroup as il,DropdownMenuItem as sl,DropdownMenuLabel as ll,DropdownMenuTrigger as dl,Tooltip as cl,TooltipContent as pl,TooltipTrigger as ml,useTranslation as ul}from"lecom-ui";import{WrenchIcon as gl}from"lucide-react";import{jsx as X,jsxs as He}from"react/jsx-runtime";var Gr=({nodeId:e})=>{let{t}=ul(),{updateNodeData:o}=rl(),r=ol(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 He(nl,{children:[He(cl,{children:[X(ml,{asChild:!0,children:X(dl,{asChild:!0,children:X(Or,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:X(gl,{})})})}),X(pl,{color:"black",children:t("bpmn.task.menu.title")})]}),He(al,{align:"start",className:"w-60 bg-white text-grey-600",children:[He(ll,{className:"flex items-center gap-1",children:[X("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),X("div",{className:"flex items-center gap-1",children:Object.entries(je).map(([i,s])=>X(Or,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:X(s.icon,{className:"stroke-inherit"})},i))})]}),X(il,{children:Object.entries(Xe).map(([i,s])=>He(sl,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[X(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as Tl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var u;let{t:n}=yl(),{setDraggableNode:a}=Ne(),i=({event:b,type:c,variant:m})=>{a({type:c,variant:m}),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:ke,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:ke,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ye,label:n("bpmn.annotation.variant.default")}},l=[{component:j(nt,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Gr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Vr,{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(bl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:fl.Right,align:"start",isVisible:r,children:(u=d[t])==null?void 0:u.map((b,c)=>b.component?j("div",{children:b.component},c):Tl(El,{children:[j(Nl,{asChild:!0,children:j(hl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:m=>i({event:m,type:b.type,variant:b.variant}),children:b.icon&&j(b.icon,{size:16})})}),j(vl,{color:"black",children:b.label})]},c))})};import{Fragment as wl,jsx as Be,jsxs as Cl}from"react/jsx-runtime";var Hr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=_l(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Cl(wl,{children:[Be("div",{className:_("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:Be(U,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),Be(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),Be(xe,{isVisible:!r&&!a&&o,minWidth:tt.MIN_WIDTH,minHeight:tt.MIN_HEIGHT}),Be(B,{type:"target",position:xl.Left})]})};import{Position as Br,useReactFlow as Il}from"@xyflow/react";import{useState as Al}from"react";import{Fragment as kl,jsx as _e,jsxs as zr}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Il(),{isMultipleSelection:a}=O(),[i,s]=Al(!1),l=b=>{n(e,{label:b})};return zr(kl,{children:[zr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[_e(be,{className:_("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})}),_e("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:_e(U,{value:t.label,isEditing:i,onChange:l})})]}),_e(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),_e(B,{type:"source",position:Br.Right}),_e(B,{type:"target",position:Br.Left})]})};import{Position as Ur,useReactFlow as Sl}from"@xyflow/react";import{useState as Ll}from"react";import{Fragment as Dl,jsx as we,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let n=Je[t.variant].icon,{updateNodeData:a}=Sl(),{isMultipleSelection:i}=O(),[s,l]=Ll(!1),d=c=>{a(e,{label:c})};return Wr(Dl,{children:[Wr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[we(n,{className:_("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})}),we("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:s,onChange:d})})]}),we(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),we(B,{type:"target",position:Ur.Left}),we(B,{type:"source",position:Ur.Right})]})};import{Position as Pl,useReactFlow as Ml}from"@xyflow/react";import{useState as Rl}from"react";import{Fragment as Vl,jsx as ze,jsxs as Kr}from"react/jsx-runtime";var Zr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ml(),{isMultipleSelection:a}=O(),[i,s]=Rl(!1),l=b=>{n(e,{label:b})};return Kr(Vl,{children:[Kr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[ze($e,{className:_("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})}),ze("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:ze(U,{value:t.label,isEditing:i,onChange:l})})]}),ze(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),ze(B,{type:"source",position:Pl.Right})]})};import{Position as $r,useReactFlow as Ol}from"@xyflow/react";import{Fragment as Gl,jsx as ee,jsxs as qr}from"react/jsx-runtime";var Xr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ol(),{isMultipleSelection:a}=O(),i=c=>{n(e,{label:c})},s=t.variant?Xe[t.variant].icon:null,l=t.attribute?je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",u=s&&!d,b=l||d;return qr(Gl,{children:[qr("div",{className:_("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:_("m-1",{"py-6":u||b}),onChange:i}),s&&ee("div",{className:_("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:_(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:_("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(xe,{isVisible:!r&&!a&&o,minWidth:Qe.MIN_WIDTH,minHeight:Qe.MIN_HEIGHT}),ee(B,{type:"source",position:$r.Right}),ee(B,{type:"target",position:$r.Left})]})};import{Position as jr}from"@xyflow/react";import{Fragment as Hl,jsx as At,jsxs as Bl}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Bl(Hl,{children:[At("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}),At(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),At(B,{type:"source",position:jr.Right}),At(B,{type:"target",position:jr.Left})]})};import{Position as zl,useReactFlow as Fl}from"@xyflow/react";import{orderBy as Ul}from"lodash";import{useMemo as Qr}from"react";import{Fragment as Wl,jsx as ue,jsxs as en}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Fl(),{isMultipleSelection:s}=O(),l=i(),d=!n,u=Qr(()=>Ul([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),b=d?et.MIN_WIDTH:Y.MIN_WIDTH,c=Qr(()=>{if(d&&u.length>1){let g=[...u];return g.pop(),g.reduce((f,p)=>{var h,w;return f+((w=(h=p.measured)==null?void 0:h.height)!=null?w:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,u]),m=g=>{a(e,{label:g})};return en(Wl,{children:[en("div",{className:_("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:[ue("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:ue("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:ue(U,{value:t.label,className:"w-full h-full",onChange:m})})}),ue("div",{className:"flex-1"})]}),ue(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),ue(xe,{nodeId:e,minWidth:b,minHeight:c,isVisible:!r&&!s&&o}),d&&ue(B,{type:"source",position:zl.Right})]})};var on={START_EVENT:Zr,END_EVENT:Fr,TASK:Xr,GATEWAY:Yr,ANNOTATION:Hr,LANE:tn,UNSUPPORTED:Jr},rn={SEQUENCE_EDGE:Io,MESSAGE_EDGE:Wo,ANNOTATION_EDGE:To},nn="#fafafa",an="#bebebe",sn=1,ln=10,dn="bottom-left",cn=.5,pn=4,mn={x:0,y:0,zoom:.75};import{useStore as Yl}from"@xyflow/react";import{useEffect as Kl,useRef as Zl}from"react";import{jsx as ql}from"react/jsx-runtime";var $l=e=>({width:e.width,height:e.height,transform:e.transform}),un=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Yl($l),s=Zl(null);return Kl(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let u=window.devicePixelRatio;l.width=n*u,l.height=a*u,d.scale(u,u),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),ql("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as gn,Dialog as Xl,DialogContent as jl,DialogFooter as Jl,DialogHeader as Ql,DialogTitle as ed,Notification as td,Typography as Ft,useTranslation as od}from"lecom-ui";import{jsx as te,jsxs as Ut}from"react/jsx-runtime";var fn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=od(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(u=>u.filter(b=>!l.some(c=>c.id===b.id))),d!=null&&d.length&&r(u=>u.filter(b=>!d.some(c=>c.id===b.id))),t(null)},s=()=>{t(null)};return te(Xl,{open:a,onOpenChange:s,children:Ut(jl,{className:"w-[488px] max-w-fit gap-2",children:[te(Ql,{children:te(ed,{children:te(Ft,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Ut("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(td,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Ft,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Ut(Jl,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(gn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Ft,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(gn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as rd,Tooltip as nd,TooltipContent as ad,TooltipTrigger as id,useTranslation as sd}from"lecom-ui";import{jsx as Fe,jsxs as ld}from"react/jsx-runtime";var bn=()=>{let{t:e}=sd(),{setDraggableNode:t}=Ne(),o=[{type:"START_EVENT",icon:$e,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:ke,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:mo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:po,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:co,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Ze,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ke,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:ao,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ye,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Fe("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)=>ld(nd,{children:[Fe(id,{asChild:!0,children:Fe(rd,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Fe(n.icon,{})},a)}),Fe(ad,{color:"black",side:"right",children:n.label})]},a))})};import{Button as dd,useTranslation as cd}from"lecom-ui";import{AlertCircleIcon as pd,CircleCheckIcon as md,XIcon as ud}from"lucide-react";import{useEffect as gd,useState as fd}from"react";import{jsx as J,jsxs as Wt}from"react/jsx-runtime";var hn=({validationResult:e,onClose:t})=>{let{t:o}=cd(),[r,n]=fd(!1);if(gd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Wt("div",{className:_("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Wt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(md,{className:"text-green-500 size-5"}):J(pd,{className:"text-red-500 size-5"})}),Wt("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(dd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(ud,{})})]}),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 Kt}from"react/jsx-runtime";var Sd=[],Ld=({mode:e="edit"})=>{let t=Id(!1),[o,r]=xd([]),[n,a]=Td([]),[i,s]=Ad(null),{isMoveTool:l,isHandTool:d,isReadOnly:u,setIsReadOnly:b,setIsMultipleSelection:c,isMinimapOpen:m}=O(),{validationResult:g,handleValidationComplete:v,clearValidation:f,isAutoValidationEnabled:p,validateDiagram:h}=Ho(),{getNode:w,getNodes:I,getEdges:A}=wd(),{onNodeDrag:P,onDrop:N,onDragOver:T,onNodeDragStop:S}=$o({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:C,onConnect:k}=ko({setEdges:a});Fo();let{createDiagram:x}=rr(),{undo:z,redo:K,saveHistory:V,canUndo:ge,canRedo:de}=sr(),{helperLineHorizontal:ce,helperLineVertical:Cn,customApplyNodeChanges:In}=jo();nr({LIA_CREATE_DIAGRAM:x,CLEAR_DIAGRAM:()=>{r([]),a([])}}),En(()=>{b(e==="readonly")},[e,b]);let An=()=>{f()},kn=Yt(({nodes:F,edges:M})=>{let Ce=F.length+M.length>1;c(Ce)},[c]);_d({onChange:kn});let Sn=F=>{let M=w(F.id);if(M!=null&&M.parentId&&(M==null?void 0:M.type)==="LANE"){let Ce=pe(M.parentId,o.filter(jt=>jt.id!==M.id&&jt.type==="LANE"));r(re(Ce))}},Ln=F=>{F.forEach(M=>{switch(M.type){case"remove":Sn(M);break}})},Dn=Yt(()=>{if(!p){t.current=!1;return}let F=I(),M=A(),Ce=h({nodes:F,edges:M});v(Ce),t.current=!1},[p,I,A,h,v]),qt=kd(Dn,300),Xt=Yt(()=>{p&&!t.current&&(t.current=!0,qt())},[p,qt]),Pn=F=>{r(M=>In(F,M)),V(F),Xt(),Ln(F)},Mn=F=>{a(M=>bd(F,M)),V(F),Xt()},Rn=()=>{V("forceSave")},Vn=async({nodes:F,edges:M})=>(s({nodes:F,edges:M}),!1),On={nodes:o,edges:n};return Kt("div",{className:"w-full h-full",children:[!u&&$(bn,{}),$(dr,{}),Kt(vd,{edges:n,nodes:o,nodeTypes:on,edgeTypes:rn,minZoom:cn,maxZoom:pn,panOnDrag:d||u?!0:Sd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!u&&l,nodesConnectable:!u&&l,nodesDraggable:!u&&l,isValidConnection:C,connectionLineComponent:Ko,onConnect:k,onDrop:N,onDropCapture:Rn,onDragOver:T,onNodesChange:Pn,onEdgesChange:Mn,onNodeDrag:P,onNodeDragStop:S,onBeforeDelete:Vn,selectionMode:yd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:mn,connectOnClick:!1,children:[m&&$(Ed,{pannable:!0,zoomable:!0,position:dn,className:"shadow-md rounded-md"}),Kt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!u&&$(Mr,{canUndo:ge,canRedo:de,undo:z,redo:K}),$(kr,{nodes:o,isReadOnly:u,diagram:On,onValidationComplete:v,onValidateDiagram:h}),$(Rr,{})]}),$(un,{horizontal:ce,vertical:Cn}),$(hd,{gap:ln,size:sn,color:an,bgColor:nn}),g&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(hn,{validationResult:g,onClose:An})})]}),$(fn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Dd=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(En(()=>{t&&Cd.changeLanguage(t)},[t]),$(Nd,{children:$(No,{value:{onConfigureElement:o},children:$(Ld,{mode:e})})})),Zt=Dd;var $t=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 Pd,Translations as Md}from"lecom-ui";var vn={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 Nn={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 yn={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 Tn={pt_BR:yn,en_US:vn,es_ES:Nn};var xn,_n,Rd=(_n=(xn=$t("LecomUserLanguage"))!=null?xn:$t("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?_n:Md.PT_BR;Pd({lng:Rd,resources:Tn});import{jsx as wn}from"react/jsx-runtime";var Wb=e=>wn(to,{children:wn(Zt,E({},e))});export{kt as ElementType,St as ElementVariant,Wb as Modeler};
|
|
34
|
+
`),h.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as Te}from"react/jsx-runtime";function kr(){let{t:e}=bs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Ar(),[s,l]=Ts(!1);return Te(fs,{modal:!1,open:s,onOpenChange:l,children:[G(Es,{asChild:!0,children:G("div",{children:Te(bt,{children:[G(vt,{asChild:!0,children:G(us,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Ns,{})})}),!s&&G(ht,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),Te(gs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[Te(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(vs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),Te(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(hs,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),Te(bt,{children:[G(vt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(ys,{})})}),G(ht,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as ks,jsx as H,jsxs as se}from"react/jsx-runtime";var Pr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=xs(),{deselectAll:i}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:f,isMinimapOpen:g,setIsMinimapOpen:u}=O(),b=Lr(["v","V"]),E=Lr(["h","H"]),h=As(()=>{i(),f()},[i,f]),c=()=>{i();let p=n(o);r&&r(p)};return Sr(()=>{b&&!s&&!t&&d()},[b,d,s,t]),Sr(()=>{E&&!l&&!t&&h()},[E,h,l,t]),se("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&se(ks,{children:[se(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:w(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Is,{})})}),se(Tt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),se(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:w(l&&"bg-grey-400"),iconButton:!0,onClick:h,children:H(_s,{})})}),se(Tt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),se(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:c,children:H(ws,{})})}),H(Tt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(kr,{}),!t&&H(Cr,{disabled:e.length>0}),se(yt,{children:[H(xt,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:w(g&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!g),children:H(Cs,{})})}),H(Tt,{color:"black",children:a(g?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Dr,Tooltip as Mr,TooltipContent as Rr,TooltipTrigger as Vr,useTranslation as Ls}from"lecom-ui";import{RedoIcon as Ss,UndoIcon as Ps}from"lucide-react";import{jsx as le,jsxs as Ut}from"react/jsx-runtime";var Or=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ls();return Ut("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Ut(Mr,{children:[le(Vr,{asChild:!0,children:le(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:le(Ps,{})})}),le(Rr,{color:"black",children:n("editor.controls.history.undo")})]}),Ut(Mr,{children:[le(Vr,{asChild:!0,children:le(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:le(Ss,{})})}),le(Rr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Ds}from"@xyflow/react";import{Button as _t,Tooltip as wt,TooltipContent as Ct,TooltipTrigger as It,useTranslation as Ms}from"lecom-ui";import{ScanIcon as Rs,ZoomIn as Vs,ZoomOut as Os}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Gr=()=>{let{t:e}=Ms(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Ds();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Rs,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Os,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.out")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(lo,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(wt,{children:[W(It,{asChild:!0,children:W(_t,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Vs,{})})}),W(Ct,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as wl,useReactFlow as Cl}from"@xyflow/react";import{Handle as Gs}from"@xyflow/react";import{jsx as Hs}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Hs(Gs,{type:e,position:t,className:w("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Bs,useReactFlow as zs}from"@xyflow/react";import{orderBy as Fs}from"lodash";import{jsx as Us}from"react/jsx-runtime";var xe=o=>{var r=o,{nodeId:e}=r,t=ge(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=zs(),s=({width:l,height:d})=>{if(!e)return;let f=n(e);if((f==null?void 0:f.type)!=="LANE")return;let g=[...a()],u=!f.parentId,b=u?f.id:f.parentId,E=g.filter(p=>p.type==="LANE"&&p.parentId===b);if(!E.length)return;let h=Fs(E,["position.y"]),c=0;h.forEach((p,m)=>{var A,L;let x=m===h.length-1,I=(L=(A=p.measured)==null?void 0:A.height)!=null?L:0;g=g.map(v=>{if(v.id===p.id){let T=u?l-Y.HEADER_WIDTH:l,k=y(N({},v),{width:T,measured:y(N({},v.measured),{width:T}),position:y(N({},v.position),{y:c})});return x&&u&&(k.height=d-c),k}return v}),c+=I}),g=g.map(p=>{if(p.id===b){let m=u?l:l+Y.HEADER_WIDTH;return y(N({},p),{width:m,height:u?d:c,measured:{width:m,height:u?d:c}})}return p}),i(g)};return Us(Bs,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as bl,NodeToolbar as hl}from"@xyflow/react";import{Button as vl,Tooltip as Nl,TooltipContent as yl,TooltipTrigger as Tl,useTranslation as xl}from"lecom-ui";import{useNodesData as Ws,useReactFlow as Ys}from"@xyflow/react";import{Button as Ks,DropdownMenu as Zs,DropdownMenuContent as $s,DropdownMenuGroup as Xs,DropdownMenuItem as qs,DropdownMenuLabel as js,DropdownMenuTrigger as Js,Tooltip as Qs,TooltipContent as el,TooltipTrigger as tl,useTranslation as ol}from"lecom-ui";import{WrenchIcon as rl}from"lucide-react";import{jsx as ne,jsxs as At}from"react/jsx-runtime";var Hr=({nodeId:e})=>{let{t}=ol(),{updateNodeData:o}=Ys(),r=Ws(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return At(Zs,{children:[At(Qs,{children:[ne(tl,{asChild:!0,children:ne(Js,{asChild:!0,children:ne(Ks,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(rl,{})})})}),ne(el,{color:"black",children:t("bpmn.gateway.menu.title")})]}),At($s,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(js,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(Xs,{children:Object.entries(Qe).map(([a,i])=>At(qs,{className:w({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[ne(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};import{useNodesData as nl,useReactFlow as al}from"@xyflow/react";import{Button as Br,DropdownMenu as il,DropdownMenuContent as sl,DropdownMenuGroup as ll,DropdownMenuItem as dl,DropdownMenuLabel as cl,DropdownMenuTrigger as pl,Tooltip as ml,TooltipContent as ul,TooltipTrigger as fl,useTranslation as gl}from"lecom-ui";import{WrenchIcon as El}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=gl(),{updateNodeData:o}=al(),r=nl(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return Be(il,{children:[Be(ml,{children:[q(fl,{asChild:!0,children:q(pl,{asChild:!0,children:q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(El,{})})})}),q(ul,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(sl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(cl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([i,s])=>q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:w({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:q(s.icon,{className:"stroke-inherit"})},i))})]}),q(ll,{children:Object.entries(je).map(([i,s])=>Be(dl,{className:w({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as _l}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var f;let{t:n}=xl(),{setDraggableNode:a}=Ne(),i=({event:g,type:u,variant:b})=>{a({type:u,variant:b}),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:ke,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Ee,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:ke,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(it,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(zr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Hr,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(hl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:bl.Right,align:"start",isVisible:r,children:(f=d[t])==null?void 0:f.map((g,u)=>g.component?j("div",{children:g.component},u):_l(Nl,{children:[j(Tl,{asChild:!0,children:j(vl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:b=>i({event:b,type:g.type,variant:g.variant}),children:g.icon&&j(g.icon,{size:16})})}),j(yl,{color:"black",children:g.label})]},u))})};import{Fragment as Il,jsx as ze,jsxs as Al}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Cl(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Al(Il,{children:[ze("div",{className:w("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(xe,{isVisible:!r&&!a&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:wl.Left})]})};import{Position as Ur,useReactFlow as kl}from"@xyflow/react";import{useState as Ll}from"react";import{Fragment as Sl,jsx as _e,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=kl(),{isMultipleSelection:a}=O(),[i,s]=Ll(!1),l=g=>{n(e,{label:g})};return Wr(Sl,{children:[Wr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[_e(Ee,{className:w("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})}),_e("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:_e(U,{value:t.label,isEditing:i,onChange:l})})]}),_e(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),_e(B,{type:"source",position:Ur.Right}),_e(B,{type:"target",position:Ur.Left})]})};import{Position as Kr,useReactFlow as Pl}from"@xyflow/react";import{useState as Dl}from"react";import{Fragment as Ml,jsx as we,jsxs as Zr}from"react/jsx-runtime";var $r=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Pl(),{isMultipleSelection:i}=O(),[s,l]=Dl(!1),d=u=>{a(e,{label:u})};return Zr(Ml,{children:[Zr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[we(n,{className:w("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})}),we("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:s,onChange:d})})]}),we(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),we(B,{type:"target",position:Kr.Left}),we(B,{type:"source",position:Kr.Right})]})};import{Position as Rl,useReactFlow as Vl}from"@xyflow/react";import{useState as Ol}from"react";import{Fragment as Gl,jsx as Fe,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Vl(),{isMultipleSelection:a}=O(),[i,s]=Ol(!1),l=g=>{n(e,{label:g})};return Xr(Gl,{children:[Xr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(Xe,{className:w("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:i,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),Fe(B,{type:"source",position:Rl.Right})]})};import{Position as jr,useReactFlow as Hl}from"@xyflow/react";import{Fragment as Bl,jsx as ee,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Hl(),{isMultipleSelection:a}=O(),i=u=>{n(e,{label:u})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",f=s&&!d,g=l||d;return Jr(Bl,{children:[Jr("div",{className:w("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:w("m-1",{"py-6":f||g}),onChange:i}),s&&ee("div",{className:w("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:w(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:w("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:w(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(xe,{isVisible:!r&&!a&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:jr.Right}),ee(B,{type:"target",position:jr.Left})]})};import{Position as en}from"@xyflow/react";import{Fragment as zl,jsx as kt,jsxs as Fl}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Fl(zl,{children:[kt("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),kt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),kt(B,{type:"source",position:en.Right}),kt(B,{type:"target",position:en.Left})]})};import{Position as Ul,useReactFlow as Wl}from"@xyflow/react";import{orderBy as Yl}from"lodash";import{useMemo as on}from"react";import{Fragment as Kl,jsx as ue,jsxs as rn}from"react/jsx-runtime";var nn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Wl(),{isMultipleSelection:s}=O(),l=i(),d=!n,f=on(()=>Yl([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),g=d?tt.MIN_WIDTH:Y.MIN_WIDTH,u=on(()=>{if(d&&f.length>1){let E=[...f];return E.pop(),E.reduce((c,p)=>{var m,x;return c+((x=(m=p.measured)==null?void 0:m.height)!=null?x:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,f]),b=E=>{a(e,{label:E})};return rn(Kl,{children:[rn("div",{className:w("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:[ue("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:ue("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:ue(U,{value:t.label,className:"w-full h-full",onChange:b})})}),ue("div",{className:"flex-1"})]}),ue(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),ue(xe,{nodeId:e,minWidth:g,minHeight:u,isVisible:!r&&!s&&o}),d&&ue(B,{type:"source",position:Ul.Right})]})};var an={START_EVENT:qr,END_EVENT:Yr,TASK:Qr,GATEWAY:$r,ANNOTATION:Fr,LANE:nn,UNSUPPORTED:tn},sn={SEQUENCE_EDGE:Lo,MESSAGE_EDGE:Zo,ANNOTATION_EDGE:wo},ln="#fafafa",dn="#bebebe",cn=1,pn=10,mn="bottom-left",un=.5,fn=4,gn={x:0,y:0,zoom:.75};import{useStore as Zl}from"@xyflow/react";import{useEffect as $l,useRef as Xl}from"react";import{jsx as jl}from"react/jsx-runtime";var ql=e=>({width:e.width,height:e.height,transform:e.transform}),En=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Zl(ql),s=Xl(null);return $l(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let f=window.devicePixelRatio;l.width=n*f,l.height=a*f,d.scale(f,f),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),jl("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as bn,Dialog as Jl,DialogContent as Ql,DialogFooter as ed,DialogHeader as td,DialogTitle as od,Notification as rd,Typography as Wt,useTranslation as nd}from"lecom-ui";import{jsx as te,jsxs as Yt}from"react/jsx-runtime";var hn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=nd(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(f=>f.filter(g=>!l.some(u=>u.id===g.id))),d!=null&&d.length&&r(f=>f.filter(g=>!d.some(u=>u.id===g.id))),t(null)},s=()=>{t(null)};return te(Jl,{open:a,onOpenChange:s,children:Yt(Ql,{className:"w-[488px] max-w-fit gap-2",children:[te(td,{children:te(od,{children:te(Wt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Yt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(rd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Wt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Yt(ed,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(bn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Wt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(bn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as ad,Tooltip as id,TooltipContent as sd,TooltipTrigger as ld,useTranslation as dd}from"lecom-ui";import{jsx as Ue,jsxs as cd}from"react/jsx-runtime";var vn=()=>{let{t:e}=dd(),{setDraggableNode:t}=Ne(),o=[{type:"START_EVENT",icon:Xe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Ee,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:ke,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:fo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:uo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:mo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:so,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,a)=>cd(id,{children:[Ue(ld,{asChild:!0,children:Ue(ad,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Ue(n.icon,{})},a)}),Ue(sd,{color:"black",side:"right",children:n.label})]},a))})};import{Button as pd,useTranslation as md}from"lecom-ui";import{AlertCircleIcon as ud,CircleCheckIcon as fd,XIcon as gd}from"lucide-react";import{useEffect as Ed,useState as bd}from"react";import{jsx as J,jsxs as Kt}from"react/jsx-runtime";var Nn=({validationResult:e,onClose:t})=>{let{t:o}=md(),[r,n]=bd(!1);if(Ed(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Kt("div",{className:w("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Kt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(fd,{className:"text-green-500 size-5"}):J(ud,{className:"text-red-500 size-5"})}),Kt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&J("div",{children:o("validation.errors.subtitle")})]}),J(pd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(gd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:i.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as $t}from"react/jsx-runtime";var Pd=[],Dd=({mode:e="edit"})=>{let t=kd(!1),[o,r]=wd([]),[n,a]=_d([]),[i,s]=Ld(null),{isMoveTool:l,isHandTool:d,isReadOnly:f,setIsReadOnly:g,setIsMultipleSelection:u,isMinimapOpen:b}=O(),{validationResult:E,handleValidationComplete:h,clearValidation:c,isAutoValidationEnabled:p,validateDiagram:m}=Fo(),{getNode:x,getNodes:I,getEdges:A}=Id(),{onNodeDrag:L,onDrop:v,onDragOver:T,onNodeDragStop:k}=jo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:C,onConnect:S}=Po({setEdges:a});Yo();let{createDiagram:_}=ir(),{undo:z,redo:K,saveHistory:V,canUndo:fe,canRedo:de}=cr(),{helperLineHorizontal:ce,helperLineVertical:kn,customApplyNodeChanges:Ln}=er();sr({LIA_CREATE_DIAGRAM:_,CLEAR_DIAGRAM:()=>{r([]),a([])}}),yn(()=>{g(e==="readonly")},[e,g]);let Sn=()=>{c()},Pn=Zt(({nodes:F,edges:M})=>{let Ce=F.length+M.length>1;u(Ce)},[u]);Cd({onChange:Pn});let Dn=F=>{let M=x(F.id);if(M!=null&&M.parentId&&(M==null?void 0:M.type)==="LANE"){let Ce=pe(M.parentId,o.filter(Qt=>Qt.id!==M.id&&Qt.type==="LANE"));r(re(Ce))}},Mn=F=>{F.forEach(M=>{switch(M.type){case"remove":Dn(M);break}})},Rn=Zt(()=>{if(!p){t.current=!1;return}let F=I(),M=A(),Ce=m({nodes:F,edges:M});h(Ce),t.current=!1},[p,I,A,m,h]),jt=Sd(Rn,300),Jt=Zt(()=>{p&&!t.current&&(t.current=!0,jt())},[p,jt]),Vn=F=>{r(M=>Ln(F,M)),V(F),Jt(),Mn(F)},On=F=>{a(M=>hd(F,M)),V(F),Jt()},Gn=()=>{V("forceSave")},Hn=async({nodes:F,edges:M})=>(s({nodes:F,edges:M}),!1),Bn={nodes:o,edges:n};return $t("div",{className:"w-full h-full",children:[!f&&$(vn,{}),$(mr,{}),$t(yd,{edges:n,nodes:o,nodeTypes:an,edgeTypes:sn,minZoom:un,maxZoom:fn,panOnDrag:d||f?!0:Pd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&l,nodesConnectable:!f&&l,nodesDraggable:!f&&l,isValidConnection:C,connectionLineComponent:Xo,onConnect:S,onDrop:v,onDropCapture:Gn,onDragOver:T,onNodesChange:Vn,onEdgesChange:On,onNodeDrag:L,onNodeDragStop:k,onBeforeDelete:Hn,selectionMode:xd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:gn,connectOnClick:!1,children:[b&&$(Nd,{pannable:!0,zoomable:!0,position:mn,className:"shadow-md rounded-md"}),$t("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&$(Or,{canUndo:fe,canRedo:de,undo:z,redo:K}),$(Pr,{nodes:o,isReadOnly:f,diagram:Bn,onValidationComplete:h,onValidateDiagram:m}),$(Gr,{})]}),$(En,{horizontal:ce,vertical:kn}),$(vd,{gap:pn,size:cn,color:dn,bgColor:ln}),E&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(Nn,{validationResult:E,onClose:Sn})})]}),$(hn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Md=({mode:e,locale:t="pt_BR",onConfigureElement:o})=>(yn(()=>{t&&Ad.changeLanguage(t)},[t]),$(Td,{children:$(To,{value:{onConfigureElement:o},children:$(Dd,{mode:e})})})),Xt=Md;var qt=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};import{initializeI18n as Rd,Translations as Vd}from"lecom-ui";var Tn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var xn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var _n={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var wn={pt_BR:_n,en_US:Tn,es_ES:xn};var Cn,In,Od=(In=(Cn=qt("LecomUserLanguage"))!=null?Cn:qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?In:Vd.PT_BR;Rd({lng:Od,resources:wn});import{jsx as An}from"react/jsx-runtime";var $E=e=>An(ro,{children:An(Xt,N({},e))});export{St as ActivityVariant,Lt as ElementType,$E as Modeler,Pt as RoutingVariant};
|