lecom-modeler 0.1.12 → 0.1.13

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.
Files changed (3) hide show
  1. package/lib/index.cjs +10 -10
  2. package/lib/index.js +10 -10
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,25 +1,25 @@
1
- var Yr=Object.defineProperty,Kr=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ao=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable;var ro=(e,t,o)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))ao.call(t,o)&&ro(e,o,t[o]);if(We)for(var o of We(t))io.call(t,o)&&ro(e,o,t[o]);return e},x=(e,t)=>Kr(e,$r(t));var he=(e,t)=>{var o={};for(var n in e)ao.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&We)for(var n of We(e))t.indexOf(n)<0&&io.call(e,n)&&(o[n]=e[n]);return o};import{TooltipProvider as Zr,Notification as qr}from"lecom-ui";import{jsx as Xr,jsxs as jr}from"react/jsx-runtime";function so({children:e}){return jr(Zr,{children:[Xr(qr,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as xd,Background as _d,MiniMap as wd,ReactFlow as Cd,ReactFlowProvider as Ad,SelectionMode as Id,useEdgesState as kd,useNodesState as Ld,useOnSelectionChange as Sd,useReactFlow as Pd}from"@xyflow/react";import{i18n as Dd}from"lecom-ui";import{useCallback as Xt,useEffect as Jt,useRef as Rd,useState as Md}from"react";import{useDebouncedCallback as Vd}from"use-debounce";var St=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n))(St||{}),Pt=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Pt||{}),Dt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Dt||{}),Rt=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Rt||{}),Mt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Mt||{});import{RotateCcw as da,ScrollText as ca,SquarePlus as pa}from"lucide-react";import{jsx as Ye,jsxs as Jr}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>Jr("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 lo}from"react/jsx-runtime";var Ee=({size:e=24,className:t})=>lo("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:lo("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 Qr}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>Qr("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 Vt,jsxs as ea}from"react/jsx-runtime";var be=({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:[Vt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot,jsxs as ta}from"react/jsx-runtime";var Ze=({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:[Ot("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as oa}from"react/jsx-runtime";var co=({size:e=24,className:t})=>Gt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:oa("g",{children:[Gt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Gt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as na}from"clsx";import{twMerge as ra}from"tailwind-merge";function k(...e){return ra(na(e))}var ke=(e,t)=>e<t?t:e;import{jsx as po,jsxs as aa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>aa("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:k("stroke-2",t),children:[po("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"}),po("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ht("g",{children:Ht("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});import{jsx as go}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>go("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:go("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as fo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>fo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:k("stroke-2",t),children:fo("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Bt,jsxs as ia}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>ia("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Bt("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Bt("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Bt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as sa}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>sa("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 Xe,jsxs as la}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>la("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:[Xe("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"}),Xe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),Xe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("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:ca},SUBPROCESS:{icon:pa}};var Je={LOOP:{icon:da}},ie=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(ie||{}),Qe={EXCLUSIVE:{icon:be},PARALLEL:{icon:Ze},COMPLEX:{icon:$e}};import No from"@dagrejs/dagre";import{getNodesBounds as va}from"@xyflow/react";import{orderBy as ya}from"lodash";var ma={MIN_WIDTH:36,MIN_HEIGHT:36},ua={MIN_WIDTH:36,MIN_HEIGHT:36},ga={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},fa={MIN_WIDTH:128,MIN_HEIGHT:64},O={START_EVENT:ma,END_EVENT:ua,GATEWAY:ga,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:fa};import{orderBy as ha}from"lodash";var oe=e=>{var t,o,n,r,i,a,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ne=e=>ha(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),vo=(e,t)=>{let{x:o,y:n}=oe(e),{x:r,y:i}=oe(t);return{x:o-r,y:n-i}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Ea=(e,t)=>{let{x:o,y:n}=oe(e),{x:r,y:i}=oe(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},ba=(e,t)=>{let{x:o,y:n,w:r,h:i}=oe(e),{x:a,y:s,w:l,h:c}=oe(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},Pe=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&ba(e,r)){let i=Ea(e,r);i<n&&(n=i,o=r)}return o},yo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0);var To=(e=[],t=[],o="LR")=>{let n=new No.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>n.setNode(i,{width:a,height:s})),t.forEach(i=>n.setEdge(i.source,i.target)),No.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return x(v({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},ue=(e,t)=>{var u,E;let o=[...t],n=o.find(p=>p.id===e);if(!n)return o;let r=o.filter(p=>p.parentId===e&&p.type==="LANE");if(r.length===0)return o;let i=ya(r,["position.y"]),a=Math.max((E=(u=n.measured)==null?void 0:u.width)!=null?E:0,tt.MIN_WIDTH),s=yo(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),c=0,b=0;i.forEach(p=>{var y,m,g,d;o=o.map(T=>T.id===p.id?x(v({},T),{width:l-Y.HEADER_WIDTH,measured:x(v({},T.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:c}}):T),c+=(m=(y=p.measured)==null?void 0:y.height)!=null?m:0,b+=(d=(g=p.measured)==null?void 0:g.height)!=null?d:0}),o=o.map(p=>p.id===e?x(v({},p),{height:b,width:l,measured:x(v({},p.measured),{height:b,width:l})}):p);let f=o.find(p=>p.id===e);return f!=null&&f.parentId&&(o=ue(f.parentId,o)),o},xo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Na=50,_o=(e,t=Na)=>{let o=va(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as Ta}from"zustand";var M=Ta((e,t)=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,highlightedElements:[],activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:o=>{e({isReadOnly:o})},setIsMultipleSelection:o=>{e({isMultipleSelection:o})},setIsMinimapOpen:o=>{e({isMinimapOpen:o})},highlightElement:o=>{e({highlightedElements:[o]})},highlightElements:o=>{e({highlightedElements:o})},clearHighlight:()=>{e({highlightedElements:[]})},isElementHighlighted:o=>t().highlightedElements.includes(o)}));import{addEdge as Ro,useReactFlow as ni}from"@xyflow/react";import{BaseEdge as Fa,EdgeLabelRenderer as Ua,getStraightPath as Wa,useNodes as Ya,useViewport as Ka}from"@xyflow/react";import{getIncomers as nt,getOutgoers as zt,useReactFlow as Ca}from"@xyflow/react";import{Button as Aa,Tooltip as Ia,TooltipContent as ka,TooltipTrigger as La,useTranslation as Sa}from"lecom-ui";import{PencilIcon as Pa}from"lucide-react";import{createContext as xa,useContext as _a}from"react";var wo=xa(null),Co=wo.Provider,Ao=()=>{let e=_a(wo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as rt,jsxs as Da}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Sa(),{getNode:n,getEdge:r,getNodes:i,getEdges:a}=Ca(),{onConfigureElement:s}=Ao(),l=d=>{let T=i(),A=a(),h=nt(d,T,A),I=zt(d,T,A),N=h.some(L=>L.type==="START_EVENT"),w=I.some(L=>L.type==="END_EVENT");return N?"start":w?"end":"between"},c=d=>{var L,C,S;let T=i(),A=a(),h=n(d.source),I=n(d.target);if(!h||!I)return"simple";if(zt(h,T,A).some(_=>_.type==="END_EVENT"))return"final";if(h.type==="GATEWAY")switch((L=h.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(h.type==="TASK"){let _=(C=h.data)==null?void 0:C.variant,V=(S=h.data)==null?void 0:S.attribute;return _==="SCRIPT"?"script":V==="LOOP"?"loop":"simple"}return"simple"},b=d=>{var L;let T=n(d.source);if(!T||T.type!=="GATEWAY"||((L=T.data)==null?void 0:L.variant)!=="COMPLEX")return;let A=i(),h=a(),I=nt(T,A,h),N=!1,w=!1;if(I.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(N=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),N&&w)return"script_loop";if(N)return"script";if(w)return"loop"},f=d=>{var L;let T=n(d.source);if(!T||T.type!=="GATEWAY"||((L=T.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let A=i(),h=a(),I=nt(T,A,h),N=!1,w=!1;if(I.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(N=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),N)return"script";if(w)return"loop"},u=d=>{var w,L;if(d.type!=="GATEWAY")return;let T=i(),A=a(),h=nt(d,T,A),I=!1,N=!1;if(h.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(I=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(N=!0))}),((w=d.data)==null?void 0:w.variant)==="COMPLEX"){if(I&&N)return"script_loop";if(I)return"script";if(N)return"loop"}else if(((L=d.data)==null?void 0:L.variant)==="EXCLUSIVE"){if(I)return"script";if(N)return"loop"}},E=d=>zt(d,i(),a()).map(h=>{var I,N;return{id:h.id,type:h.type,variant:(I=h.data)==null?void 0:I.variant,label:(N=h.data)==null?void 0:N.label}}),p=d=>a().filter(h=>h.source===d.id).map(h=>{var I;return{id:h.id,type:"routing",variant:c(h),label:(I=h.data)==null?void 0:I.label}}),y=()=>{var T,A,h,I;let d=n(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(T=d.data)==null?void 0:T.label,targets:E(d),edgeTargets:p(d)}),console.log({id:d.id,type:"activity",variant:l(d),label:(A=d.data)==null?void 0:A.label,targets:E(d),edgeTargets:p(d)});return}s==null||s({id:d.id,type:"gateway",variant:((h=d.data)==null?void 0:h.variant)||"EXCLUSIVE",label:(I=d.data)==null?void 0:I.label,subVariant:u(d),targets:E(d)})}},m=()=>{let d=r(e);if(d){let T=c(d),A;T==="complex"?A=b(d):T==="exclusive"&&(A=f(d)),s==null||s({id:d.id,type:"routing",variant:T,subVariant:A})}};return Da(Ia,{children:[rt(La,{asChild:!0,children:rt(Aa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":y();break;case"edge":m();break}},children:rt(Pa,{size:16})})}),rt(ka,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Ra}from"@xyflow/react";import{Button as Ma,Tooltip as Va,TooltipContent as Oa,TooltipTrigger as Ga,useTranslation as Ha}from"lecom-ui";import{TrashIcon as Ba}from"lucide-react";import{jsx as it,jsxs as za}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Ha(),{deleteElements:n}=Ra();return za(Va,{children:[it(Ga,{asChild:!0,children:it(Ma,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Ba,{size:16})})}),it(Oa,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as lt}from"react/jsx-runtime";var ye=n=>{var r=n,{edgeId:e,edgeType:t}=r,o=he(r,["edgeId","edgeType"]);var s;let i=[{component:lt(st,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:lt(De,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return lt("div",x(v({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,c)=>lt("div",{children:l.component},c))}))};import{jsx as ct,jsxs as $a}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},Io=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,selected:s,data:l})=>{let c=Ya(),{zoom:b}=Ka(),f=c.find(d=>d.id===t),u=c.find(d=>d.id===o),[E,p,y]=Wa({sourceX:n,sourceY:r,targetX:i,targetY:a}),m=s||(f==null?void 0:f.selected)||(u==null?void 0:u.selected),g=1/b;return $a("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":m}),children:[ct(Fa,{id:e,path:E,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":m&&!(l!=null&&l.hasError)})}),ct(Ua,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${p}px, ${y}px)`},children:s&&ct(ye,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${g})`}})})})]})};import{BaseEdge as Xa,EdgeLabelRenderer as ja,getSmoothStepPath as Ja,MarkerType as So,useNodes as Qa,useReactFlow as ei,useViewport as ti}from"@xyflow/react";import{useState as oi}from"react";import{useEffect as ko,useRef as Za,useState as qa}from"react";import{jsx as Lo}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:n,onBlur:r,className:i,style:a})=>{let s=Za(null),[l,c]=qa(!1);ko(()=>{c(n!=null?n:!1)},[n]),ko(()=>{if(l&&s.current){s.current.focus();let E=document.createRange();E.selectNodeContents(s.current),E.collapse(!1);let p=window.getSelection();p&&(p.removeAllRanges(),p.addRange(E))}},[l]);let b=E=>{E.stopPropagation(),c(!0)},f=E=>{let p=E.currentTarget.innerText;t&&p.length>=t&&E.preventDefault()},u=E=>{c(!1),r==null||r(),o==null||o(E.currentTarget.innerText)};return Lo("div",{className:k("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:b,children:Lo("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:u,children:e})})};import{jsx as mt,jsxs as Po}from"react/jsx-runtime";var se={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:So.ArrowClosed},markerEnd:{type:So.Arrow},data:{label:""}},Do=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:b})=>{let f=Qa(),{zoom:u}=ti(),{updateEdgeData:E}=ei(),[p,y]=oi(!1),m=f.find(_=>_.id===t),g=f.find(_=>_.id===o),[d,T,A]=Ja({sourceX:n,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),h=b||(m==null?void 0:m.selected)||(g==null?void 0:g.selected),I=h?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=p||(c==null?void 0:c.label.trim().length)>0,w=1/u,L=()=>{y(!0)},C=()=>{y(!1)},S=_=>{E(e,{label:_.trim()})};return Po("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":h}),onBlur:C,onDoubleClick:L,children:[mt(Xa,{id:e,path:d,markerEnd:`url(#${I})`,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":h&&!(c!=null&&c.hasError)})}),mt(ja,{children:Po("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${A}px)`},children:[b&&mt(ye,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${w})`}}),N&&mt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:p,onChange:S})]})})]})};var Mo=({setEdges:e})=>{let{getNode:t}=ni();return{isValidConnection:r=>{let i=t(r.source),a=t(r.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:r=>{e(i=>{let a=t(r.target);return(a==null?void 0:a.type)==="ANNOTATION"?Ro(v(v({},r),pt),i):Ro(v(v({},r),se),i)})}}};import{useState as Wo}from"react";import{useTranslation as ri}from"lecom-ui";import{useReactFlow as ai}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ge=(e=[])=>e.filter(t=>t.type==="END_EVENT"),le=(e=[])=>e.filter(t=>t.type==="TASK")||[],Vo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Oo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Go=(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),Ho=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Bo=(e,t)=>{let o=q(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},zo=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},Fo=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ge(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Re(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(i=>i.id)});let n=q(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return P({isValid:!1,nodeIds:[...new Set(i)]})}return P({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=le(e.nodes),o=Q(t,n=>q(n.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=Q(t,n=>!!n.label&&n.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=le(e.nodes),n=Q(o,r=>!r.label||r.label.length<=60);return P({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return P({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ge(e.nodes),o=[],n=[];for(let r of t){let i=Me(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=q(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Go(e.nodes),o=Q(t,r=>q(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>q(r,e.edges).map(i=>i.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=le(e.nodes),o=Q(t,n=>!n.label||zo(n.label));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return P({isValid:!0});let t=ge(e.nodes)[0];if(!t)return P({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return P({isValid:!0});let r=le(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Q(r,l=>!Ho(l.id,e));return P({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=le(e.nodes),o=ge(e.nodes)[0];if(!o)return P({isValid:!0});let n=t.filter(l=>{let c=Me(l.id,e.edges),b=q(l.id,e.edges),f=c.some(E=>{var p;return((p=e.nodes.find(y=>y.id===E.source))==null?void 0:p.type)==="START_EVENT"}),u=b.some(E=>{var p;return((p=e.nodes.find(y=>y.id===E.target))==null?void 0:p.type)==="END_EVENT"});return f&&u}),r=Me(o.id,e.edges),i=r.length>1,a=r.map(l=>l.source),s={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?a:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,n=>q(n.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Vo(e.nodes),o=Q(t,n=>!Bo(n.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Oo(e.nodes),o=Q(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Uo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Ve){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Yo=()=>{let{t:e}=ri(),[t,o]=Wo(null),{setNodes:n,setEdges:r,getNodes:i,getEdges:a}=ai(),[s,l]=Wo(!1);return{validationResult:t,validateDiagram:u=>{let E=Fo(u.nodes,u.edges),p=Uo(E),y=p.errors.map(m=>x(v({},m),{message:e(`validation.errors.${m.id}`)}));return s||l(!0),{isValid:p.isValid,errors:y}},handleValidationComplete:u=>{if(o(u),!u)return;let E=[],p=[];u.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(w=>E.push(w)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(w=>p.push(w))});let y=[...new Set(E)];n(N=>N.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:!1})}))),r(N=>N.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:!1})})));let m=i(),g=a(),d=new Set(y),T=new Set;u.errors.forEach(N=>{var C,S;let w=Ve.find(_=>_.id===N.id);(w==null?void 0:w.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(_=>T.add(_)),(S=N.nodeIds)==null||S.forEach(_=>{g.forEach(V=>{(V.source===_||V.target===_)&&T.add(V.id)})}))});let A=new Set,h=new Set,I=new Set;m.forEach(N=>{N.type==="START_EVENT"?A.add(N.id):N.type==="END_EVENT"&&h.add(N.id)}),g.forEach(N=>{A.has(N.source)&&I.add(N.target),h.has(N.target)&&I.add(N.source)}),I.forEach(N=>{var w,L;if(d.has(N)){let C=(w=u.errors.find(_=>{var V;return(V=_.nodeIds)==null?void 0:V.includes(N)}))==null?void 0:w.id;((L=Ve.find(_=>_.id===C))==null?void 0:L.highlightRelatedEdges)!==!1&&g.forEach(_=>{_.source===N&&h.has(_.target)&&(d.add(_.target),T.add(_.id)),_.target===N&&A.has(_.source)&&(d.add(_.source),T.add(_.id))})}}),d.size>0&&n(N=>N.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:d.has(w.id)})}))),T.size>0&&r(N=>N.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:T.has(w.id)})})))},clearValidation:()=>{o(null),l(!1),n(u=>u.map(E=>x(v({},E),{data:x(v({},E.data),{hasError:!1})}))),r(u=>u.map(E=>x(v({},E),{data:x(v({},E.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ii}from"@xyflow/react";import{useEffect as si}from"react";import{v7 as Ko}from"uuid";var li=15,$o="bpmn:selection",Zo=({offset:e=li}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=ii();si(()=>{let i=s=>{var E;s.preventDefault();let l=t(),c=n(),b=l.filter(p=>p.selected);if(!b.length)return;let f=c.filter(p=>b.some(y=>y.id===p.source)&&b.some(y=>y.id===p.target)),u={nodes:b,edges:f};(E=s.clipboardData)==null||E.setData($o,JSON.stringify(u))},a=s=>{var u,E;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData($o))||"{}");if(!((E=l.nodes)!=null&&E.length))return;let c=new Map,b=l.nodes.map(p=>{let y=Ko();return c.set(p.id,y),x(v({},p),{id:y,selected:!0,position:{x:p.position.x+e,y:p.position.y+e}})}),f=l.edges.map(p=>x(v({},p),{id:Ko(),selected:!0,source:c.get(p.source)||p.source,target:c.get(p.target)||p.target}));o(p=>[...p.map(y=>x(v({},y),{selected:!1})),...b]),r(p=>[...p.map(y=>x(v({},y),{selected:!1})),...f])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,n,r,e])};import{useReactFlow as vi,useStoreApi as yi}from"@xyflow/react";import{v7 as Qo}from"uuid";import{create as di}from"zustand";var Ne=di(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ci,EdgeLabelRenderer as pi,getSmoothStepPath as mi,MarkerType as ui,useNodes as gi,useReactFlow as fi,useViewport as hi}from"@xyflow/react";import{useState as Ei}from"react";import{jsx as gt,jsxs as qo}from"react/jsx-runtime";var Bm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:ui.Arrow},data:{label:""}},Xo=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:b})=>{let f=gi(),{zoom:u}=hi(),{updateEdgeData:E}=fi(),[p,y]=Ei(!1),m=f.find(_=>_.id===t),g=f.find(_=>_.id===o),[d,T,A]=mi({sourceX:n,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),h=b||(m==null?void 0:m.selected)||(g==null?void 0:g.selected),I=h?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=p||(c==null?void 0:c.label.trim().length)>0,w=1/u,L=()=>{y(!0)},C=()=>{y(!1)},S=_=>{E(e,{label:_.trim()})};return qo("g",{className:k("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":h}),onBlur:C,onDoubleClick:L,children:[gt(ci,{id:e,path:d,markerEnd:`url(#${I})`,strokeDasharray:4,className:k("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":h&&!(c!=null&&c.hasError)})}),gt(pi,{children:qo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${A}px)`},children:[b&&gt(ye,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${w})`}}),N&&gt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:p,onChange:S})]})})]})};import{jsx as jo,jsxs as bi}from"react/jsx-runtime";var Jo=({fromX:e,fromY:t,toX:o,toY:n})=>bi("g",{children:[jo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${n} ${e} ${n} ${o},${n}`}),jo("circle",{cx:o,cy:n,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var en=({nodes:e,setNodes:t,setEdges:o})=>{let n=yi(),{draggableNode:r,setDraggableNode:i}=Ne(),{getInternalNode:a,screenToFlowPosition:s}=vi(),l=m=>{let g="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(T=>x(v({},T),{className:T.id===m?g:""})))},c=()=>{let{nodeLookup:m}=n.getState();return Array.from(m.values())},b=m=>{let g=a(m.id),d=c();if(m.type==="LANE"){if(ve({parentId:m.id,nodes:e,includeTypes:["LANE"]})){l();return}let w=d.filter(S=>S.id!==m.id&&S.type==="LANE"&&!S.parentId),L=Pe(g,w);if(!L){l();return}if(ve({parentId:L.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(L.id);return}let A=d.filter(N=>N.id!==m.id&&N.type==="LANE"),h=Pe(g,A);if(!h){l();return}if(ve({parentId:h.id,nodes:e,includeTypes:["LANE"]})){l();return}l(h.id)},f=m=>{m.preventDefault(),m.dataTransfer.dropEffect="move"},u=(m,g)=>{m.preventDefault(),b(g)},E=(m,g,d)=>{var w,L;let T=C=>C.map(S=>x(v({},S),{className:void 0}));if(m.parentId===g.id){let C=ue(g.id,d);t(ne(T(C)));return}if(m.type==="LANE"){if(ve({parentId:g.id,nodes:d,excludeTypes:["LANE"]}))return;let _=d.filter(z=>z.parentId===g.id).reduce((z,ae)=>{var pe,me;return z+((me=(pe=ae.measured)==null?void 0:pe.height)!=null?me:0)},0),V={x:Y.HEADER_WIDTH,y:_},$=d.map(z=>z.id===m.id?x(v({},z),{parentId:g.id,position:V,className:void 0}):x(v({},z),{className:void 0}));$=ue(g.id,$),t(ne($));return}if(ve({parentId:g.id,nodes:d,includeTypes:["LANE"]})){let C;if(m.parentId){let _=a(m.parentId),{x:V,y:$}=oe(_);C={x:V+((w=m.position.x)!=null?w:0),y:$+((L=m.position.y)!=null?L:0)}}let S=d.map(_=>_.id===m.id?x(v({},_),{position:C!=null?C:_.position,parentId:void 0,className:void 0}):x(v({},_),{className:void 0}));t(ne(S));return}let I=vo(m,g),N=d.map(C=>C.id===m.id?x(v({},C),{parentId:g.id,position:I,className:void 0}):x(v({},C),{className:void 0}));t(ne(N))};return{onDragOver:f,onDrop:m=>{if(m.preventDefault(),!(r!=null&&r.type))return;let g=s({x:m.clientX,y:m.clientY}),d={width:O[r.type].MIN_WIDTH,height:O[r.type].MIN_HEIGHT},T={id:Qo(),type:r.type,position:g,measured:d,data:{label:"",variant:r.variant,attribute:r.attribute}},A=x(v({},T),{internals:{positionAbsolute:g}}),h=c(),I=r.type==="LANE",N=h.filter(C=>I?C.type==="LANE"&&!C.parentId:C.type==="LANE"),w=Pe(A,N);w?E(A,w,[...h,A]):t(C=>{let S=C.concat(T);return ne(S)});let L=m.dataTransfer.getData("sourceId");if(L){let C={id:Qo(),source:L,target:T.id};if(r.type==="ANNOTATION"){o(S=>S.concat(v(v({},C),pt)));return}o(S=>S.concat(v(v({},C),se)))}i(null)},onNodeDrag:u,onNodeDragStop:async(m,g)=>{var w,L;let{nodeLookup:d}=n.getState(),T=a(g.id),A=Array.from(d.values()),h=g.type==="LANE",I=A.filter(C=>C.id!==g.id&&(h?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=Pe(T,I);if(N){E(T,N,A);return}if(g.parentId){let C=a(g.parentId),{x:S,y:_}=oe(C),V={x:S+((w=g.position.x)!=null?w:0),y:_+((L=g.position.y)!=null?L:0)},$=e.map(z=>z.id===g.id?x(v({},z),{position:V,parentId:void 0}):z);$=ue(g.parentId,$),t(ne($))}}}};import{applyNodeChanges as Ni}from"@xyflow/react";import{useCallback as Ti,useState as on}from"react";function tn(e,t,o=5){var l,c,b,f,u,E,p,y;let n={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},r=t.find(m=>m.id===e.id);if(!r||!e.position)return n;let i={left:e.position.x,right:e.position.x+((c=(l=r.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(b=r.measured)==null?void 0:b.height)!=null?f:0),width:(E=(u=r.measured)==null?void 0:u.width)!=null?E:0,height:(y=(p=r.measured)==null?void 0:p.height)!=null?y:0},a=o,s=o;return t.filter(m=>m.id!==r.id).reduce((m,g)=>{var S,_,V,$,z,ae,pe,me;let d={left:g.position.x,right:g.position.x+((_=(S=g.measured)==null?void 0:S.width)!=null?_:0),top:g.position.y,bottom:g.position.y+(($=(V=g.measured)==null?void 0:V.height)!=null?$:0),width:(ae=(z=g.measured)==null?void 0:z.width)!=null?ae:0,height:(me=(pe=g.measured)==null?void 0:pe.height)!=null?me:0},T=Math.abs(i.left-d.left);T<s&&(m.snapPosition.x=d.left,m.vertical=d.left,s=T);let A=Math.abs(i.right-d.right);A<s&&(m.snapPosition.x=d.right-i.width,m.vertical=d.right,s=A);let h=Math.abs(i.left-d.right);h<s&&(m.snapPosition.x=d.right,m.vertical=d.right,s=h);let I=Math.abs(i.right-d.left);I<s&&(m.snapPosition.x=d.left-i.width,m.vertical=d.left,s=I);let N=Math.abs(i.top-d.top);N<a&&(m.snapPosition.y=d.top,m.horizontal=d.top,a=N);let w=Math.abs(i.bottom-d.top);w<a&&(m.snapPosition.y=d.top-i.height,m.horizontal=d.top,a=w);let L=Math.abs(i.bottom-d.bottom);L<a&&(m.snapPosition.y=d.bottom-i.height,m.horizontal=d.bottom,a=L);let C=Math.abs(i.top-d.bottom);return C<a&&(m.snapPosition.y=d.bottom,m.horizontal=d.bottom,a=C),m},n)}var nn=()=>{let[e,t]=on(void 0),[o,n]=on(void 0),r=Ti((i,a)=>{var s,l;if(t(void 0),n(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let c=tn(i[0],a);i[0].position.x=(s=c.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=c.snapPosition.y)!=null?l:i[0].position.y,t(c.horizontal),n(c.vertical)}return Ni(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:r}};import{useReactFlow as xi}from"@xyflow/react";var rn=()=>{let e=xi(),{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=e,{highlightElement:i,highlightElements:a,clearHighlight:s,isElementHighlighted:l,highlightedElements:c}=M(),b=()=>{try{let p=t(),y=o();return Array.isArray(p)&&Array.isArray(y)}catch(p){return console.warn("\u{1F504} ReactFlow ainda n\xE3o est\xE1 pronto:",p),!1}},f=p=>{if(console.log(`\u{1F50D} Tentando destacar elemento: ${p}`),!b()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(()=>f(p),200);return}try{i(p);let y=t(),m=o();console.log(`\u{1F4CA} Total de nodes: ${y.length}, edges: ${m.length}`);let g=y.some(h=>h.id===p),d=m.some(h=>h.id===p);if(!g&&!d){console.warn(`\u26A0\uFE0F Elemento ${p} n\xE3o encontrado no diagrama`),console.log("\u{1F50D} Nodes dispon\xEDveis:",y.map(h=>({id:h.id,type:h.type}))),console.log("\u{1F50D} Edges dispon\xEDveis:",m.map(h=>({id:h.id,source:h.source,target:h.target})));return}console.log(`\u2705 Elemento encontrado: ${g?"Node":"Edge"}`);let T=y.map(h=>x(v({},h),{style:x(v({},h.style),{outline:h.id===p?"3px solid #3b82f6":void 0,filter:h.id===p?"drop-shadow(0 0 10px rgba(59, 130, 246, 0.7))":void 0})})),A=m.map(h=>x(v({},h),{style:x(v({},h.style),{stroke:h.id===p?"#3b82f6":void 0,strokeWidth:h.id===p?3:void 0,filter:h.id===p?"drop-shadow(0 0 10px rgba(59, 130, 246, 0.7))":void 0})}));n(T),r(A),console.log(`\u{1F3AF} Destaque aplicado com sucesso para: ${p}`)}catch(y){console.error(`\u274C Erro ao destacar elemento ${p}:`,y)}},u=p=>{if(console.log("\u{1F50D} Tentando destacar m\xFAltiplos elementos:",p),!b()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(()=>u(p),200);return}try{a(p);let y=t(),m=o(),g=p.filter(h=>y.some(I=>I.id===h)),d=p.filter(h=>m.some(I=>I.id===h));console.log(`\u{1F4CA} Elementos existentes - Nodes: ${g.length}, Edges: ${d.length}`);let T=y.map(h=>x(v({},h),{style:x(v({},h.style),{outline:p.includes(h.id)?"3px solid #3b82f6":void 0,filter:p.includes(h.id)?"drop-shadow(0 0 10px rgba(59, 130, 246, 0.7))":void 0})})),A=m.map(h=>x(v({},h),{style:x(v({},h.style),{stroke:p.includes(h.id)?"#3b82f6":void 0,strokeWidth:p.includes(h.id)?3:void 0,filter:p.includes(h.id)?"drop-shadow(0 0 10px rgba(59, 130, 246, 0.7))":void 0})}));n(T),r(A),console.log("\u{1F3AF} Destaque aplicado com sucesso para m\xFAltiplos elementos")}catch(y){console.error("\u274C Erro ao destacar m\xFAltiplos elementos:",y)}},E=()=>{if(console.log("\u{1F9F9} Limpando todos os destaques"),!b()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(E,200);return}try{s();let p=t(),y=o(),m=p.map(d=>x(v({},d),{style:x(v({},d.style),{outline:void 0,filter:void 0})})),g=y.map(d=>x(v({},d),{style:x(v({},d.style),{stroke:void 0,strokeWidth:void 0,filter:void 0})}));n(m),r(g),console.log("\u2705 Todos os destaques foram removidos")}catch(p){console.error("\u274C Erro ao limpar destaques:",p)}};return{highlightElement:f,highlightElements:u,clearHighlight:E,isElementHighlighted:l,highlightedElements:c}};import{useReactFlow as wi}from"@xyflow/react";import{v7 as cn}from"uuid";var sn={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ln={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},an=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},_i=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=an(i[0],o),s=an(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},dn=e=>{let{components:t,connections:o}=_i(e);return{nodes:t,edges:o}};var pn=()=>{let{setNodes:e,setEdges:t,fitView:o}=wi();return{createDiagram:r=>{let{nodes:i,edges:a}=dn(r),s=[],l=new Map;for(let[u,E]of Object.entries(i)){let p=cn(),y=sn[E.type],m=ln[E.type];l.set(u,p);let g=O[y].MIN_WIDTH,d=O[y].MIN_HEIGHT;s.push({id:p,type:y,data:{label:E.label||"",variant:m,attribute:""},position:{x:0,y:0},width:g,height:d,measured:{width:g,height:d}})}let c=[];for(let u of a){let E=x(v({},se),{id:cn(),source:l.get(u.sourceId)||u.sourceId,target:l.get(u.targetId)||u.targetId});c.push(E)}let{nodes:b,edges:f}=To(s,c);e(b),t(f),o()}}};import{useEffect as Ci,useCallback as Ai}from"react";var Ii={origin:"*",debug:!1};function mn(e,t=Ii){let{origin:o,debug:n}=t,r=Ai((i,a)=>{n&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,n]);return Ci(()=>{let i=a=>{let{type:s,data:l}=a.data||{};n&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}import{useReactFlow as ki}from"@xyflow/react";import{useCallback as Oe,useState as un}from"react";import{useDebouncedCallback as Li}from"use-debounce";var Si={nodes:[],edges:[]},Pi=500,gn=10,fn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n}=ki(),[r,i]=un([Si]),[a,s]=un(0),l=r[a],c=a>0,b=a<r.length-1,f=Oe(d=>{o(r[d].nodes),n(r[d].edges)},[r,o,n]),u=Oe(()=>{if(a>0){let d=a-1;s(d),f(d)}},[a,f]),E=Oe(()=>{if(a<r.length-1){let d=a+1;s(d),f(d)}},[r,a,f]),p=d=>{let A=[...r.slice(0,a+1),d],h=A.length>gn?A.slice(A.length-gn):A;i(h),s(h.length-1)},y=Li(()=>{let d=e(),T=t(),A={nodes:d,edges:T};JSON.stringify(l)!==JSON.stringify(A)&&p(A)},Pi),m=Oe(d=>{if(d==="forceSave"){y();return}d.some(A=>A.type!=="select")&&y()},[y]),g=Oe(()=>{i([]),s(0)},[]);return{undo:u,redo:E,saveHistory:m,canUndo:c,canRedo:b,clearHistory:g}};import{jsx as hn}from"react/jsx-runtime";var Ft=({id:e,className:t})=>hn("marker",{id:e,className:k("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:hn("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Ut,jsxs as Di}from"react/jsx-runtime";var En=()=>Ut("svg",{style:{position:"absolute",top:0,left:0},children:Di("defs",{children:[Ut(Ft,{id:"sequence-edge-marker",className:"text-grey-400"}),Ut(Ft,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Mn}from"@xyflow/react";import{Button as Nt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as Is}from"lecom-ui";import{HandIcon as ks,ListCheckIcon as Ls,MapIcon as Ss,MousePointerIcon as Ps}from"lucide-react";import{useCallback as Ds,useEffect as Vn}from"react";import{useStore as Ri}from"@xyflow/react";var Mi=e=>({unselectAll:e.unselectNodesAndEdges}),ft=()=>{let{unselectAll:e}=Ri(Mi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as is,TooltipContent as ss,TooltipTrigger as ls,useNotificationToast as ds,useTranslation as cs}from"lecom-ui";var Ge=(g=>(g.START_EVENT="START_EVENT",g.END_EVENT="END_EVENT",g.TASK="TASK",g.SUBPROCESS="SUBPROCESS",g.GATEWAY="GATEWAY",g.ANNOTATION="ANNOTATION",g.CONNECTION="CONNECTION",g.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",g.ACTIVITY="ACTIVITY",g.PROCESS_INTERFACE="PROCESS_INTERFACE",g.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",g.VARIANT_ACTIVITY="VARIANT_ACTIVITY",g.AUTO_ACTIVITY="AUTO_ACTIVITY",g.DATA_STORE="DATA_STORE",g.DATA_OBJECT="DATA_OBJECT",g.DATA_OUTPUT="DATA_OUTPUT",g.DATA_INPUT="DATA_INPUT",g))(Ge||{});import{useReactFlow as ji}from"@xyflow/react";import{useNotificationToast as Ji,useTranslation as Qi,Button as es}from"lecom-ui";var bn=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function vn({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
3
- `),i=encodeURI(r);ht(i,`${o}.csv`)}var ht=(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 Ki}from"uuid";import{xml2json as Vi,json2xml as ju}from"xml-js";var Oi={compact:!0,spaces:4},Gi=e=>e.replaceAll(`
4
- `,"&#xA;");function yn(e,t=Oi){if(e)return JSON.parse(Vi(e,x(v({},t),{attributeValueFn:Gi})))}function Nn(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Bi}from"uuid";var ng={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Tn={script:"SCRIPT",subprocess:"SUBPROCESS"},xn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Te=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i}=n,a=Number(r._attributes.width),s=Number(r._attributes.height);return{id:n.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x),y:Number(r._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},zi=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=O.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.START_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Fi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=O.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.END_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Ui=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Tn[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,O.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,O.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Wi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=xn[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=O.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=O.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Yi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,O.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,O.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},_n=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=O.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=O.UNSUPPORTED.MIN_HEIGHT,{node:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},wn=(e,t)=>{let{source:o,target:n}=e._attributes;return x(v({},se),{id:Bi(),source:t.get(o)||o,target:t.get(n)||n})},Cn={TASK:Ui,GATEWAY:Wi,START_EVENT:zi,END_EVENT:Fi,ANNOTATION:Yi};var $i=e=>{var a;let t=new Map,o=Object.values(Ge),n=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),r=[],i=[];for(let s of n){let l=Ki(),{type:c}=s._attributes,b=Cn[c]||_n;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:f,status:u,originalType:E}=b(s);r.push(f),i.push({originalType:E,type:f.type,variant:f.data.variant,value:Nn(f.data.label),status:u})}return{nodes:r,governanceIdToNodeIdMap:t,summary:i}},Zi=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>wn(r,t)),qi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=$i(t.root.mxCell),i=Zi(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Xi=async e=>{let t=await bn(e),o=yn(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},An=async e=>{try{let t=await Xi(e),{nodes:o,edges:n,summary:r}=qi(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};import{jsx as ts}from"react/jsx-runtime";var In=()=>{let{t:e}=Qi(),{toast:t}=Ji(),{setNodes:o,setEdges:n,fitView:r}=ji(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(b=>[b.originalType,b.value,e(`adapter.governance.report.status.${b.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:ts(es,{size:"small",variant:"ghost",onClick:()=>vn({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:b}=await An(s);if(o(u=>u.concat(l)),n(u=>u.concat(c)),r(),b.some(u=>u.status==="unsupported")){i(b);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};import{Button as os}from"lecom-ui";import{useRef as ns}from"react";import{Fragment as rs,jsx as kn,jsxs as as}from"react/jsx-runtime";var Ln=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=he(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=ns(null),b=u=>{let E=u.target.files;E!=null&&E.length&&i(E),c.current&&(c.current.value="")};return as(rs,{children:[kn(os,x(v({onClick:u=>{var E;(E=c.current)==null||E.click(),r==null||r(u)}},a),{children:e})),kn("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:b})]})};import{jsx as Et,jsxs as ps}from"react/jsx-runtime";var Sn=({disabled:e=!1})=>{let{t}=cs(),{toast:o}=ds(),{createDiagram:n}=In(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(s)};return ps(is,{children:[Et(ls,{asChild:!0,children:Et(Ln,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:Et(co,{})})}),Et(ss,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as bs,DropdownMenu as vs,DropdownMenuContent as ys,DropdownMenuItem as Yt,DropdownMenuTrigger as Ns,Tooltip as bt,TooltipContent as vt,TooltipTrigger as yt,useTranslation as Ts}from"lecom-ui";import{FileCodeIcon as xs,FileImageIcon as _s,FolderOutputIcon as ws,PrinterIcon as Cs}from"lucide-react";import{useState as As}from"react";import{useReactFlow as ms}from"@xyflow/react";import{toPng as Pn,toSvg as us}from"html-to-image";import{toast as gs,useTranslation as fs}from"lecom-ui";import{useState as hs}from"react";var Es=3,Wt="diagram",Dn=()=>{let{t:e}=fs(),{getNodes:t}=ms(),{deselectAll:o}=ft(),[n,r]=hs({png:!1,html:!1,print:!1}),i=()=>{let{x:b,y:f,width:u,height:E}=_o(t());return{width:u,height:E,style:{width:`${u}px`,height:`${E}px`,transform:`translate(${-b}px, ${-f}px)`}}},a=async(b,f)=>{r(x(v({},n),{[f]:!0})),await o();try{let u=xo();if(!u)throw new Error("Flow element not found");let E=i();return await b(u,E)}catch(u){gs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(x(v({},n),{[f]:!1}))}};return{exportAsPng:async(b=Wt)=>{await a(async(f,u)=>{let E=await Pn(f,x(v({},u),{backgroundColor:"#fcfcfc"}));ht(E,`${b}.png`)},"png")},exportAsHtml:async(b=Wt)=>{await a(async(f,u)=>{let E=await us(f,x(v({},u),{backgroundColor:"#fcfcfc"})),p=`
1
+ var Yr=Object.defineProperty,$r=Object.defineProperties;var Kr=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ao=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable;var ro=(e,t,o)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))ao.call(t,o)&&ro(e,o,t[o]);if(We)for(var o of We(t))io.call(t,o)&&ro(e,o,t[o]);return e},A=(e,t)=>$r(e,Kr(t));var he=(e,t)=>{var o={};for(var n in e)ao.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&We)for(var n of We(e))t.indexOf(n)<0&&io.call(e,n)&&(o[n]=e[n]);return o};import{TooltipProvider as Zr,Notification as qr}from"lecom-ui";import{jsx as Xr,jsxs as jr}from"react/jsx-runtime";function so({children:e}){return jr(Zr,{children:[Xr(qr,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as xd,Background as _d,MiniMap as wd,ReactFlow as Cd,ReactFlowProvider as Ad,SelectionMode as Id,useEdgesState as kd,useNodesState as Ld,useOnSelectionChange as Sd,useReactFlow as Pd}from"@xyflow/react";import{i18n as Dd}from"lecom-ui";import{useCallback as Xt,useEffect as Jt,useRef as Md,useState as Rd}from"react";import{useDebouncedCallback as Vd}from"use-debounce";var St=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n))(St||{}),Pt=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(Pt||{}),Dt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Dt||{}),Mt=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Mt||{}),Rt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Rt||{});import{RotateCcw as da,ScrollText as ca,SquarePlus as pa}from"lucide-react";import{jsx as Ye,jsxs as Jr}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>Jr("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 lo}from"react/jsx-runtime";var Ee=({size:e=24,className:t})=>lo("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:lo("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 Qr}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>Qr("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 Vt,jsxs as ea}from"react/jsx-runtime";var be=({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:[Vt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Vt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot,jsxs as ta}from"react/jsx-runtime";var Ze=({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:[Ot("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as oa}from"react/jsx-runtime";var co=({size:e=24,className:t})=>Gt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:oa("g",{children:[Gt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Gt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as na}from"clsx";import{twMerge as ra}from"tailwind-merge";function L(...e){return ra(na(e))}var ke=(e,t)=>e<t?t:e;import{jsx as po,jsxs as aa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>aa("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:L("stroke-2",t),children:[po("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"}),po("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ht("g",{children:Ht("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});import{jsx as go}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>go("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:go("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as fo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>fo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:L("stroke-2",t),children:fo("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Bt,jsxs as ia}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>ia("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Bt("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Bt("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Bt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Se,jsxs as sa}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>sa("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 Xe,jsxs as la}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>la("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:[Xe("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"}),Xe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),Xe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("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:ca},SUBPROCESS:{icon:pa}};var Je={LOOP:{icon:da}},ie=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(ie||{}),Qe={EXCLUSIVE:{icon:be},PARALLEL:{icon:Ze},COMPLEX:{icon:Ke}};import yo from"@dagrejs/dagre";import{getNodesBounds as va}from"@xyflow/react";import{orderBy as Na}from"lodash";var ma={MIN_WIDTH:36,MIN_HEIGHT:36},ua={MIN_WIDTH:36,MIN_HEIGHT:36},ga={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},fa={MIN_WIDTH:128,MIN_HEIGHT:64},O={START_EVENT:ma,END_EVENT:ua,GATEWAY:ga,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:fa};import{orderBy as ha}from"lodash";var oe=e=>{var t,o,n,r,i,a,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ne=e=>ha(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),vo=(e,t)=>{let{x:o,y:n}=oe(e),{x:r,y:i}=oe(t);return{x:o-r,y:n-i}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Ea=(e,t)=>{let{x:o,y:n}=oe(e),{x:r,y:i}=oe(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},ba=(e,t)=>{let{x:o,y:n,w:r,h:i}=oe(e),{x:a,y:s,w:l,h:c}=oe(t);return o<a+l&&a<o+r&&n<s+c&&s<n+i},Pe=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&ba(e,r)){let i=Ea(e,r);i<n&&(n=i,o=r)}return o},No=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0);var To=(e=[],t=[],o="LR")=>{let n=new yo.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>n.setNode(i,{width:a,height:s})),t.forEach(i=>n.setEdge(i.source,i.target)),yo.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return A(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},ue=(e,t)=>{var u,g;let o=[...t],n=o.find(h=>h.id===e);if(!n)return o;let r=o.filter(h=>h.parentId===e&&h.type==="LANE");if(r.length===0)return o;let i=Na(r,["position.y"]),a=Math.max((g=(u=n.measured)==null?void 0:u.width)!=null?g:0,tt.MIN_WIDTH),s=No(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),c=0,E=0;i.forEach(h=>{var _,f,p,d;o=o.map(b=>b.id===h.id?A(N({},b),{width:l-Y.HEADER_WIDTH,measured:A(N({},b.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:c}}):b),c+=(f=(_=h.measured)==null?void 0:_.height)!=null?f:0,E+=(d=(p=h.measured)==null?void 0:p.height)!=null?d:0}),o=o.map(h=>h.id===e?A(N({},h),{height:E,width:l,measured:A(N({},h.measured),{height:E,width:l})}):h);let m=o.find(h=>h.id===e);return m!=null&&m.parentId&&(o=ue(m.parentId,o)),o},xo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ya=50,_o=(e,t=ya)=>{let o=va(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as Ta}from"zustand";var V=Ta((e,t)=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,highlightedElements:[],activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:o=>{e({isReadOnly:o})},setIsMultipleSelection:o=>{e({isMultipleSelection:o})},setIsMinimapOpen:o=>{e({isMinimapOpen:o})},highlightElement:o=>{e({highlightedElements:[o]})},highlightElements:o=>{e({highlightedElements:o})},clearHighlight:()=>{e({highlightedElements:[]})},isElementHighlighted:o=>t().highlightedElements.includes(o)}));import{addEdge as Mo,useReactFlow as ni}from"@xyflow/react";import{BaseEdge as Fa,EdgeLabelRenderer as Ua,getStraightPath as Wa,useNodes as Ya,useViewport as $a}from"@xyflow/react";import{getIncomers as nt,getOutgoers as zt,useReactFlow as Ca}from"@xyflow/react";import{Button as Aa,Tooltip as Ia,TooltipContent as ka,TooltipTrigger as La,useTranslation as Sa}from"lecom-ui";import{PencilIcon as Pa}from"lucide-react";import{createContext as xa,useContext as _a}from"react";var wo=xa(null),Co=wo.Provider,Ao=()=>{let e=_a(wo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as rt,jsxs as Da}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Sa(),{getNode:n,getEdge:r,getNodes:i,getEdges:a}=Ca(),{onConfigureElement:s}=Ao(),l=d=>{let b=i(),w=a(),y=nt(d,b,w),k=zt(d,b,w),v=y.some(T=>T.type==="START_EVENT"),C=k.some(T=>T.type==="END_EVENT");return v?"start":C?"end":"between"},c=d=>{var T,x,S;let b=i(),w=a(),y=n(d.source),k=n(d.target);if(!y||!k)return"simple";if(zt(y,b,w).some(I=>I.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((T=y.data)==null?void 0:T.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let I=(x=y.data)==null?void 0:x.variant,M=(S=y.data)==null?void 0:S.attribute;return I==="SCRIPT"?"script":M==="LOOP"?"loop":"simple"}return"simple"},E=d=>{var T;let b=n(d.source);if(!b||b.type!=="GATEWAY"||((T=b.data)==null?void 0:T.variant)!=="COMPLEX")return;let w=i(),y=a(),k=nt(b,w,y),v=!1,C=!1;if(k.forEach(x=>{var S,I;x.type==="TASK"&&(((S=x.data)==null?void 0:S.variant)==="SCRIPT"&&(v=!0),((I=x.data)==null?void 0:I.attribute)==="LOOP"&&(C=!0))}),v&&C)return"script_loop";if(v)return"script";if(C)return"loop"},m=d=>{var T;let b=n(d.source);if(!b||b.type!=="GATEWAY"||((T=b.data)==null?void 0:T.variant)!=="EXCLUSIVE")return;let w=i(),y=a(),k=nt(b,w,y),v=!1,C=!1;if(k.forEach(x=>{var S,I;x.type==="TASK"&&(((S=x.data)==null?void 0:S.variant)==="SCRIPT"&&(v=!0),((I=x.data)==null?void 0:I.attribute)==="LOOP"&&(C=!0))}),v)return"script";if(C)return"loop"},u=d=>{var C,T;if(d.type!=="GATEWAY")return;let b=i(),w=a(),y=nt(d,b,w),k=!1,v=!1;if(y.forEach(x=>{var S,I;x.type==="TASK"&&(((S=x.data)==null?void 0:S.variant)==="SCRIPT"&&(k=!0),((I=x.data)==null?void 0:I.attribute)==="LOOP"&&(v=!0))}),((C=d.data)==null?void 0:C.variant)==="COMPLEX"){if(k&&v)return"script_loop";if(k)return"script";if(v)return"loop"}else if(((T=d.data)==null?void 0:T.variant)==="EXCLUSIVE"){if(k)return"script";if(v)return"loop"}},g=d=>zt(d,i(),a()).map(y=>{var k,v;return{id:y.id,type:y.type,variant:(k=y.data)==null?void 0:k.variant,label:(v=y.data)==null?void 0:v.label}}),h=d=>a().filter(y=>y.source===d.id).map(y=>{var k;return{id:y.id,type:"routing",variant:c(y),label:(k=y.data)==null?void 0:k.label}}),_=()=>{var b,w,y,k;let d=n(e);if(d){if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(b=d.data)==null?void 0:b.label,targets:g(d),edgeTargets:h(d)}),console.log({id:d.id,type:"activity",variant:l(d),label:(w=d.data)==null?void 0:w.label,targets:g(d),edgeTargets:h(d)});return}s==null||s({id:d.id,type:"gateway",variant:((y=d.data)==null?void 0:y.variant)||"EXCLUSIVE",label:(k=d.data)==null?void 0:k.label,subVariant:u(d),targets:g(d)})}},f=()=>{let d=r(e);if(d){let b=c(d),w;b==="complex"?w=E(d):b==="exclusive"&&(w=m(d)),s==null||s({id:d.id,type:"routing",variant:b,subVariant:w})}};return Da(Ia,{children:[rt(La,{asChild:!0,children:rt(Aa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":_();break;case"edge":f();break}},children:rt(Pa,{size:16})})}),rt(ka,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Ma}from"@xyflow/react";import{Button as Ra,Tooltip as Va,TooltipContent as Oa,TooltipTrigger as Ga,useTranslation as Ha}from"lecom-ui";import{TrashIcon as Ba}from"lucide-react";import{jsx as it,jsxs as za}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Ha(),{deleteElements:n}=Ma();return za(Va,{children:[it(Ga,{asChild:!0,children:it(Ra,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Ba,{size:16})})}),it(Oa,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as lt}from"react/jsx-runtime";var Ne=n=>{var r=n,{edgeId:e,edgeType:t}=r,o=he(r,["edgeId","edgeType"]);var s;let i=[{component:lt(st,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:lt(De,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return lt("div",A(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,c)=>lt("div",{children:l.component},c))}))};import{jsx as ct,jsxs as Ka}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},Io=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,selected:s,data:l})=>{let c=Ya(),{zoom:E}=$a(),m=c.find(d=>d.id===t),u=c.find(d=>d.id===o),[g,h,_]=Wa({sourceX:n,sourceY:r,targetX:i,targetY:a}),f=s||(m==null?void 0:m.selected)||(u==null?void 0:u.selected),p=1/E;return Ka("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":f}),children:[ct(Fa,{id:e,path:g,strokeDasharray:4,className:L("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)})}),ct(Ua,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${_}px)`},children:s&&ct(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Xa,EdgeLabelRenderer as ja,getSmoothStepPath as Ja,MarkerType as So,useNodes as Qa,useReactFlow as ei,useViewport as ti}from"@xyflow/react";import{useState as oi}from"react";import{useEffect as ko,useRef as Za,useState as qa}from"react";import{jsx as Lo}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:n,onBlur:r,className:i,style:a})=>{let s=Za(null),[l,c]=qa(!1);ko(()=>{c(n!=null?n:!1)},[n]),ko(()=>{if(l&&s.current){s.current.focus();let g=document.createRange();g.selectNodeContents(s.current),g.collapse(!1);let h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(g))}},[l]);let E=g=>{g.stopPropagation(),c(!0)},m=g=>{let h=g.currentTarget.innerText;t&&h.length>=t&&g.preventDefault()},u=g=>{c(!1),r==null||r(),o==null||o(g.currentTarget.innerText)};return Lo("div",{className:L("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:E,children:Lo("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:m,onBlur:u,children:e})})};import{jsx as mt,jsxs as Po}from"react/jsx-runtime";var se={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:So.ArrowClosed},markerEnd:{type:So.Arrow},data:{label:""}},Do=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let m=Qa(),{zoom:u}=ti(),{updateEdgeData:g}=ei(),[h,_]=oi(!1),f=m.find(I=>I.id===t),p=m.find(I=>I.id===o),[d,b,w]=Ja({sourceX:n,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),y=E||(f==null?void 0:f.selected)||(p==null?void 0:p.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=h||(c==null?void 0:c.label.trim().length)>0,C=1/u,T=()=>{_(!0)},x=()=>{_(!1)},S=I=>{g(e,{label:I.trim()})};return Po("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:x,onDoubleClick:T,children:[mt(Xa,{id:e,path:d,markerEnd:`url(#${k})`,className:L("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.hasError)})}),mt(ja,{children:Po("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${b}px, ${w}px)`},children:[E&&mt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${C})`}}),v&&mt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:S})]})})]})};var Ro=({setEdges:e})=>{let{getNode:t}=ni();return{isValidConnection:r=>{let i=t(r.source),a=t(r.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:r=>{e(i=>{let a=t(r.target);return(a==null?void 0:a.type)==="ANNOTATION"?Mo(N(N({},r),pt),i):Mo(N(N({},r),se),i)})}}};import{useState as Wo}from"react";import{useTranslation as ri}from"lecom-ui";import{useReactFlow as ai}from"@xyflow/react";var Me=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ge=(e=[])=>e.filter(t=>t.type==="END_EVENT"),le=(e=[])=>e.filter(t=>t.type==="TASK")||[],Vo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Oo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Go=(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),Re=(e,t=[])=>t.filter(o=>o.target===e),Ho=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},Bo=(e,t)=>{let o=q(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},zo=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},Fo=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var 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=ge(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(i=>i.id)});let n=q(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return P({isValid:!1,nodeIds:[...new Set(i)]})}return P({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=le(e.nodes),o=Q(t,n=>q(n.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=Q(t,n=>!!n.label&&n.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=le(e.nodes),n=Q(o,r=>!r.label||r.label.length<=60);return P({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return P({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Me(e.nodes),...ge(e.nodes)],o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ge(e.nodes),o=[],n=[];for(let r of t){let i=Re(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=q(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>n.push(c.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Go(e.nodes),o=Q(t,r=>q(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>q(r,e.edges).map(i=>i.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=le(e.nodes),o=Q(t,n=>!n.label||zo(n.label));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return P({isValid:!0});let t=ge(e.nodes)[0];if(!t)return P({isValid:!0});let o=Re(t.id,e.edges);if(!o.length)return P({isValid:!0});let r=le(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Q(r,l=>!Ho(l.id,e));return P({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=le(e.nodes),o=ge(e.nodes)[0];if(!o)return P({isValid:!0});let n=t.filter(l=>{let c=Re(l.id,e.edges),E=q(l.id,e.edges),m=c.some(g=>{var h;return((h=e.nodes.find(_=>_.id===g.source))==null?void 0:h.type)==="START_EVENT"}),u=E.some(g=>{var h;return((h=e.nodes.find(_=>_.id===g.target))==null?void 0:h.type)==="END_EVENT"});return m&&u}),r=Re(o.id,e.edges),i=r.length>1,a=r.map(l=>l.source),s={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?a:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,n=>q(n.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Me(e.nodes),...ge(e.nodes)],o=[],n=[];for(let r of t){let i=q(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=Vo(e.nodes),o=Q(t,n=>!Bo(n.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Oo(e.nodes),o=Q(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Uo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of Ve){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Yo=()=>{let{t:e}=ri(),[t,o]=Wo(null),{setNodes:n,setEdges:r,getNodes:i,getEdges:a}=ai(),[s,l]=Wo(!1);return{validationResult:t,validateDiagram:u=>{let g=Fo(u.nodes,u.edges),h=Uo(g),_=h.errors.map(f=>A(N({},f),{message:e(`validation.errors.${f.id}`)}));return s||l(!0),{isValid:h.isValid,errors:_}},handleValidationComplete:u=>{if(o(u),!u)return;let g=[],h=[];u.errors.forEach(v=>{v.nodeIds&&v.nodeIds.length>0&&v.nodeIds.forEach(C=>g.push(C)),v.edgeIds&&v.edgeIds.length>0&&v.edgeIds.forEach(C=>h.push(C))});let _=[...new Set(g)];n(v=>v.map(C=>A(N({},C),{data:A(N({},C.data),{hasError:!1})}))),r(v=>v.map(C=>A(N({},C),{data:A(N({},C.data),{hasError:!1})})));let f=i(),p=a(),d=new Set(_),b=new Set;u.errors.forEach(v=>{var x,S;let C=Ve.find(I=>I.id===v.id);(C==null?void 0:C.highlightRelatedEdges)!==!1&&((x=v.edgeIds)==null||x.forEach(I=>b.add(I)),(S=v.nodeIds)==null||S.forEach(I=>{p.forEach(M=>{(M.source===I||M.target===I)&&b.add(M.id)})}))});let w=new Set,y=new Set,k=new Set;f.forEach(v=>{v.type==="START_EVENT"?w.add(v.id):v.type==="END_EVENT"&&y.add(v.id)}),p.forEach(v=>{w.has(v.source)&&k.add(v.target),y.has(v.target)&&k.add(v.source)}),k.forEach(v=>{var C,T;if(d.has(v)){let x=(C=u.errors.find(I=>{var M;return(M=I.nodeIds)==null?void 0:M.includes(v)}))==null?void 0:C.id;((T=Ve.find(I=>I.id===x))==null?void 0:T.highlightRelatedEdges)!==!1&&p.forEach(I=>{I.source===v&&y.has(I.target)&&(d.add(I.target),b.add(I.id)),I.target===v&&w.has(I.source)&&(d.add(I.source),b.add(I.id))})}}),d.size>0&&n(v=>v.map(C=>A(N({},C),{data:A(N({},C.data),{hasError:d.has(C.id)})}))),b.size>0&&r(v=>v.map(C=>A(N({},C),{data:A(N({},C.data),{hasError:b.has(C.id)})})))},clearValidation:()=>{o(null),l(!1),n(u=>u.map(g=>A(N({},g),{data:A(N({},g.data),{hasError:!1})}))),r(u=>u.map(g=>A(N({},g),{data:A(N({},g.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ii}from"@xyflow/react";import{useEffect as si}from"react";import{v7 as $o}from"uuid";var li=15,Ko="bpmn:selection",Zo=({offset:e=li}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=ii();si(()=>{let i=s=>{var g;s.preventDefault();let l=t(),c=n(),E=l.filter(h=>h.selected);if(!E.length)return;let m=c.filter(h=>E.some(_=>_.id===h.source)&&E.some(_=>_.id===h.target)),u={nodes:E,edges:m};(g=s.clipboardData)==null||g.setData(Ko,JSON.stringify(u))},a=s=>{var u,g;s.preventDefault();let l=JSON.parse(((u=s.clipboardData)==null?void 0:u.getData(Ko))||"{}");if(!((g=l.nodes)!=null&&g.length))return;let c=new Map,E=l.nodes.map(h=>{let _=$o();return c.set(h.id,_),A(N({},h),{id:_,selected:!0,position:{x:h.position.x+e,y:h.position.y+e}})}),m=l.edges.map(h=>A(N({},h),{id:$o(),selected:!0,source:c.get(h.source)||h.source,target:c.get(h.target)||h.target}));o(h=>[...h.map(_=>A(N({},_),{selected:!1})),...E]),r(h=>[...h.map(_=>A(N({},_),{selected:!1})),...m])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,n,r,e])};import{useReactFlow as vi,useStoreApi as Ni}from"@xyflow/react";import{v7 as Qo}from"uuid";import{create as di}from"zustand";var ye=di(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ci,EdgeLabelRenderer as pi,getSmoothStepPath as mi,MarkerType as ui,useNodes as gi,useReactFlow as fi,useViewport as hi}from"@xyflow/react";import{useState as Ei}from"react";import{jsx as gt,jsxs as qo}from"react/jsx-runtime";var Bm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:ui.Arrow},data:{label:""}},Xo=({id:e,source:t,target:o,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let m=gi(),{zoom:u}=hi(),{updateEdgeData:g}=fi(),[h,_]=Ei(!1),f=m.find(I=>I.id===t),p=m.find(I=>I.id===o),[d,b,w]=mi({sourceX:n,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),y=E||(f==null?void 0:f.selected)||(p==null?void 0:p.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=h||(c==null?void 0:c.label.trim().length)>0,C=1/u,T=()=>{_(!0)},x=()=>{_(!1)},S=I=>{g(e,{label:I.trim()})};return qo("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:x,onDoubleClick:T,children:[gt(ci,{id:e,path:d,markerEnd:`url(#${k})`,strokeDasharray:4,className:L("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(c!=null&&c.hasError)})}),gt(pi,{children:qo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${b}px, ${w}px)`},children:[E&&gt(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${C})`}}),v&&gt(U,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:h,onChange:S})]})})]})};import{jsx as jo,jsxs as bi}from"react/jsx-runtime";var Jo=({fromX:e,fromY:t,toX:o,toY:n})=>bi("g",{children:[jo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${n} ${e} ${n} ${o},${n}`}),jo("circle",{cx:o,cy:n,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var en=({nodes:e,setNodes:t,setEdges:o})=>{let n=Ni(),{draggableNode:r,setDraggableNode:i}=ye(),{getInternalNode:a,screenToFlowPosition:s}=vi(),l=f=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(b=>A(N({},b),{className:b.id===f?p:""})))},c=()=>{let{nodeLookup:f}=n.getState();return Array.from(f.values())},E=f=>{let p=a(f.id),d=c();if(f.type==="LANE"){if(ve({parentId:f.id,nodes:e,includeTypes:["LANE"]})){l();return}let C=d.filter(S=>S.id!==f.id&&S.type==="LANE"&&!S.parentId),T=Pe(p,C);if(!T){l();return}if(ve({parentId:T.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(T.id);return}let w=d.filter(v=>v.id!==f.id&&v.type==="LANE"),y=Pe(p,w);if(!y){l();return}if(ve({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},m=f=>{f.preventDefault(),f.dataTransfer.dropEffect="move"},u=(f,p)=>{f.preventDefault(),E(p)},g=(f,p,d)=>{var C,T;let b=x=>x.map(S=>A(N({},S),{className:void 0}));if(f.parentId===p.id){let x=ue(p.id,d);t(ne(b(x)));return}if(f.type==="LANE"){if(ve({parentId:p.id,nodes:d,excludeTypes:["LANE"]}))return;let I=d.filter(z=>z.parentId===p.id).reduce((z,ae)=>{var pe,me;return z+((me=(pe=ae.measured)==null?void 0:pe.height)!=null?me:0)},0),M={x:Y.HEADER_WIDTH,y:I},K=d.map(z=>z.id===f.id?A(N({},z),{parentId:p.id,position:M,className:void 0}):A(N({},z),{className:void 0}));K=ue(p.id,K),t(ne(K));return}if(ve({parentId:p.id,nodes:d,includeTypes:["LANE"]})){let x;if(f.parentId){let I=a(f.parentId),{x:M,y:K}=oe(I);x={x:M+((C=f.position.x)!=null?C:0),y:K+((T=f.position.y)!=null?T:0)}}let S=d.map(I=>I.id===f.id?A(N({},I),{position:x!=null?x:I.position,parentId:void 0,className:void 0}):A(N({},I),{className:void 0}));t(ne(S));return}let k=vo(f,p),v=d.map(x=>x.id===f.id?A(N({},x),{parentId:p.id,position:k,className:void 0}):A(N({},x),{className:void 0}));t(ne(v))};return{onDragOver:m,onDrop:f=>{if(f.preventDefault(),!(r!=null&&r.type))return;let p=s({x:f.clientX,y:f.clientY}),d={width:O[r.type].MIN_WIDTH,height:O[r.type].MIN_HEIGHT},b={id:Qo(),type:r.type,position:p,measured:d,data:{label:"",variant:r.variant,attribute:r.attribute}},w=A(N({},b),{internals:{positionAbsolute:p}}),y=c(),k=r.type==="LANE",v=y.filter(x=>k?x.type==="LANE"&&!x.parentId:x.type==="LANE"),C=Pe(w,v);C?g(w,C,[...y,w]):t(x=>{let S=x.concat(b);return ne(S)});let T=f.dataTransfer.getData("sourceId");if(T){let x={id:Qo(),source:T,target:b.id};if(r.type==="ANNOTATION"){o(S=>S.concat(N(N({},x),pt)));return}o(S=>S.concat(N(N({},x),se)))}i(null)},onNodeDrag:u,onNodeDragStop:async(f,p)=>{var C,T;let{nodeLookup:d}=n.getState(),b=a(p.id),w=Array.from(d.values()),y=p.type==="LANE",k=w.filter(x=>x.id!==p.id&&(y?x.type==="LANE"&&!x.parentId:x.type==="LANE")),v=Pe(b,k);if(v){g(b,v,w);return}if(p.parentId){let x=a(p.parentId),{x:S,y:I}=oe(x),M={x:S+((C=p.position.x)!=null?C:0),y:I+((T=p.position.y)!=null?T:0)},K=e.map(z=>z.id===p.id?A(N({},z),{position:M,parentId:void 0}):z);K=ue(p.parentId,K),t(ne(K))}}}};import{applyNodeChanges as yi}from"@xyflow/react";import{useCallback as Ti,useState as on}from"react";function tn(e,t,o=5){var l,c,E,m,u,g,h,_;let n={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},r=t.find(f=>f.id===e.id);if(!r||!e.position)return n;let i={left:e.position.x,right:e.position.x+((c=(l=r.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((m=(E=r.measured)==null?void 0:E.height)!=null?m:0),width:(g=(u=r.measured)==null?void 0:u.width)!=null?g:0,height:(_=(h=r.measured)==null?void 0:h.height)!=null?_:0},a=o,s=o;return t.filter(f=>f.id!==r.id).reduce((f,p)=>{var S,I,M,K,z,ae,pe,me;let d={left:p.position.x,right:p.position.x+((I=(S=p.measured)==null?void 0:S.width)!=null?I:0),top:p.position.y,bottom:p.position.y+((K=(M=p.measured)==null?void 0:M.height)!=null?K:0),width:(ae=(z=p.measured)==null?void 0:z.width)!=null?ae:0,height:(me=(pe=p.measured)==null?void 0:pe.height)!=null?me:0},b=Math.abs(i.left-d.left);b<s&&(f.snapPosition.x=d.left,f.vertical=d.left,s=b);let w=Math.abs(i.right-d.right);w<s&&(f.snapPosition.x=d.right-i.width,f.vertical=d.right,s=w);let y=Math.abs(i.left-d.right);y<s&&(f.snapPosition.x=d.right,f.vertical=d.right,s=y);let k=Math.abs(i.right-d.left);k<s&&(f.snapPosition.x=d.left-i.width,f.vertical=d.left,s=k);let v=Math.abs(i.top-d.top);v<a&&(f.snapPosition.y=d.top,f.horizontal=d.top,a=v);let C=Math.abs(i.bottom-d.top);C<a&&(f.snapPosition.y=d.top-i.height,f.horizontal=d.top,a=C);let T=Math.abs(i.bottom-d.bottom);T<a&&(f.snapPosition.y=d.bottom-i.height,f.horizontal=d.bottom,a=T);let x=Math.abs(i.top-d.bottom);return x<a&&(f.snapPosition.y=d.bottom,f.horizontal=d.bottom,a=x),f},n)}var nn=()=>{let[e,t]=on(void 0),[o,n]=on(void 0),r=Ti((i,a)=>{var s,l;if(t(void 0),n(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let c=tn(i[0],a);i[0].position.x=(s=c.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=c.snapPosition.y)!=null?l:i[0].position.y,t(c.horizontal),n(c.vertical)}return yi(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:r}};import{useReactFlow as xi}from"@xyflow/react";var rn=()=>{let e=xi(),{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=e,{highlightElement:i,highlightElements:a,clearHighlight:s,isElementHighlighted:l,highlightedElements:c,isMoveTool:E,isHandTool:m,activeMoveTool:u}=V(),g=()=>{try{let p=t(),d=o();return Array.isArray(p)&&Array.isArray(d)}catch(p){return console.warn("\u{1F504} ReactFlow ainda n\xE3o est\xE1 pronto:",p),!1}},h=p=>{if(console.log(`\u{1F50D} Tentando destacar elemento: ${p}`),console.log(`\u{1F6E0}\uFE0F Estado atual - isMoveTool: ${E}, isHandTool: ${m}`),!g()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(()=>h(p),200);return}let d=m;m&&(console.log("\u{1F504} Ativando MoveTool temporariamente para permitir destaque..."),u());try{i(p);let b=t(),w=o();console.log(`\u{1F4CA} Total de nodes: ${b.length}, edges: ${w.length}`);let y=b.some(T=>T.id===p),k=w.some(T=>T.id===p);if(!y&&!k){console.warn(`\u26A0\uFE0F Elemento ${p} n\xE3o encontrado no diagrama`),console.log("\u{1F50D} Nodes dispon\xEDveis:",b.map(T=>({id:T.id,type:T.type}))),console.log("\u{1F50D} Edges dispon\xEDveis:",w.map(T=>({id:T.id,source:T.source,target:T.target})));return}console.log(`\u2705 Elemento encontrado: ${y?"Node":"Edge"}`);let v=b.map(T=>A(N({},T),{selected:T.id===p})),C=w.map(T=>A(N({},T),{selected:T.id===p}));n(v),r(C),console.log(`\u{1F3AF} Elemento destacado usando sele\xE7\xE3o nativa: ${p}`),setTimeout(()=>{let T=t(),x=o(),S=T.some(M=>M.id===p&&M.selected),I=x.some(M=>M.id===p&&M.selected);S||I?console.log(`\u2705 Sele\xE7\xE3o confirmada para: ${p}`):console.warn(`\u26A0\uFE0F Sele\xE7\xE3o n\xE3o foi aplicada para: ${p}`)},100)}catch(b){console.error(`\u274C Erro ao destacar elemento ${p}:`,b)}},_=p=>{if(console.log("\u{1F50D} Tentando destacar m\xFAltiplos elementos:",p),console.log(`\u{1F6E0}\uFE0F Estado atual - isMoveTool: ${E}, isHandTool: ${m}`),!g()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(()=>_(p),200);return}let d=m;m&&(console.log("\u{1F504} Ativando MoveTool temporariamente para permitir destaque..."),u());try{a(p);let b=t(),w=o(),y=p.filter(T=>b.some(x=>x.id===T)),k=p.filter(T=>w.some(x=>x.id===T));console.log(`\u{1F4CA} Elementos existentes - Nodes: ${y.length}, Edges: ${k.length}`);let v=b.map(T=>A(N({},T),{selected:p.includes(T.id)})),C=w.map(T=>A(N({},T),{selected:p.includes(T.id)}));n(v),r(C),console.log("\u{1F3AF} M\xFAltiplos elementos destacados usando sele\xE7\xE3o nativa")}catch(b){console.error("\u274C Erro ao destacar m\xFAltiplos elementos:",b)}},f=()=>{if(console.log("\u{1F9F9} Limpando todos os destaques"),!g()){console.warn("\u26A0\uFE0F ReactFlow n\xE3o est\xE1 pronto ainda, tentando novamente..."),setTimeout(f,200);return}try{s();let p=t(),d=o(),b=p.map(y=>A(N({},y),{selected:!1})),w=d.map(y=>A(N({},y),{selected:!1}));n(b),r(w),console.log("\u2705 Todas as sele\xE7\xF5es foram removidas")}catch(p){console.error("\u274C Erro ao limpar destaques:",p)}};return{highlightElement:h,highlightElements:_,clearHighlight:f,isElementHighlighted:l,highlightedElements:c}};import{useReactFlow as wi}from"@xyflow/react";import{v7 as cn}from"uuid";var sn={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ln={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},an=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},_i=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=an(i[0],o),s=an(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},dn=e=>{let{components:t,connections:o}=_i(e);return{nodes:t,edges:o}};var pn=()=>{let{setNodes:e,setEdges:t,fitView:o}=wi();return{createDiagram:r=>{let{nodes:i,edges:a}=dn(r),s=[],l=new Map;for(let[u,g]of Object.entries(i)){let h=cn(),_=sn[g.type],f=ln[g.type];l.set(u,h);let p=O[_].MIN_WIDTH,d=O[_].MIN_HEIGHT;s.push({id:h,type:_,data:{label:g.label||"",variant:f,attribute:""},position:{x:0,y:0},width:p,height:d,measured:{width:p,height:d}})}let c=[];for(let u of a){let g=A(N({},se),{id:cn(),source:l.get(u.sourceId)||u.sourceId,target:l.get(u.targetId)||u.targetId});c.push(g)}let{nodes:E,edges:m}=To(s,c);e(E),t(m),o()}}};import{useEffect as Ci,useCallback as Ai}from"react";var Ii={origin:"*",debug:!1};function mn(e,t=Ii){let{origin:o,debug:n}=t,r=Ai((i,a)=>{n&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,n]);return Ci(()=>{let i=a=>{let{type:s,data:l}=a.data||{};n&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}import{useReactFlow as ki}from"@xyflow/react";import{useCallback as Oe,useState as un}from"react";import{useDebouncedCallback as Li}from"use-debounce";var Si={nodes:[],edges:[]},Pi=500,gn=10,fn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n}=ki(),[r,i]=un([Si]),[a,s]=un(0),l=r[a],c=a>0,E=a<r.length-1,m=Oe(d=>{o(r[d].nodes),n(r[d].edges)},[r,o,n]),u=Oe(()=>{if(a>0){let d=a-1;s(d),m(d)}},[a,m]),g=Oe(()=>{if(a<r.length-1){let d=a+1;s(d),m(d)}},[r,a,m]),h=d=>{let w=[...r.slice(0,a+1),d],y=w.length>gn?w.slice(w.length-gn):w;i(y),s(y.length-1)},_=Li(()=>{let d=e(),b=t(),w={nodes:d,edges:b};JSON.stringify(l)!==JSON.stringify(w)&&h(w)},Pi),f=Oe(d=>{if(d==="forceSave"){_();return}d.some(w=>w.type!=="select")&&_()},[_]),p=Oe(()=>{i([]),s(0)},[]);return{undo:u,redo:g,saveHistory:f,canUndo:c,canRedo:E,clearHistory:p}};import{jsx as hn}from"react/jsx-runtime";var Ft=({id:e,className:t})=>hn("marker",{id:e,className:L("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:hn("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Ut,jsxs as Di}from"react/jsx-runtime";var En=()=>Ut("svg",{style:{position:"absolute",top:0,left:0},children:Di("defs",{children:[Ut(Ft,{id:"sequence-edge-marker",className:"text-grey-400"}),Ut(Ft,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Rn}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as Is}from"lecom-ui";import{HandIcon as ks,ListCheckIcon as Ls,MapIcon as Ss,MousePointerIcon as Ps}from"lucide-react";import{useCallback as Ds,useEffect as Vn}from"react";import{useStore as Mi}from"@xyflow/react";var Ri=e=>({unselectAll:e.unselectNodesAndEdges}),ft=()=>{let{unselectAll:e}=Mi(Ri);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as is,TooltipContent as ss,TooltipTrigger as ls,useNotificationToast as ds,useTranslation as cs}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 ji}from"@xyflow/react";import{useNotificationToast as Ji,useTranslation as Qi,Button as es}from"lecom-ui";var bn=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function vn({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
3
+ `),i=encodeURI(r);ht(i,`${o}.csv`)}var ht=(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 $i}from"uuid";import{xml2json as Vi,json2xml as ju}from"xml-js";var Oi={compact:!0,spaces:4},Gi=e=>e.replaceAll(`
4
+ `,"&#xA;");function Nn(e,t=Oi){if(e)return JSON.parse(Vi(e,A(N({},t),{attributeValueFn:Gi})))}function yn(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Bi}from"uuid";var ng={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Tn={script:"SCRIPT",subprocess:"SUBPROCESS"},xn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Te=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i}=n,a=Number(r._attributes.width),s=Number(r._attributes.height);return{id:n.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x),y:Number(r._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},zi=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=O.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.START_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Fi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=O.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.END_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Ui=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=Tn[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,O.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,O.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Wi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=xn[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=O.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=O.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Yi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,O.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,O.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},_n=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=O.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=O.UNSUPPORTED.MIN_HEIGHT,{node:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},wn=(e,t)=>{let{source:o,target:n}=e._attributes;return A(N({},se),{id:Bi(),source:t.get(o)||o,target:t.get(n)||n})},Cn={TASK:Ui,GATEWAY:Wi,START_EVENT:zi,END_EVENT:Fi,ANNOTATION:Yi};var Ki=e=>{var a;let t=new Map,o=Object.values(Ge),n=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),r=[],i=[];for(let s of n){let l=$i(),{type:c}=s._attributes,E=Cn[c]||_n;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:m,status:u,originalType:g}=E(s);r.push(m),i.push({originalType:g,type:m.type,variant:m.data.variant,value:yn(m.data.label),status:u})}return{nodes:r,governanceIdToNodeIdMap:t,summary:i}},Zi=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>wn(r,t)),qi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Ki(t.root.mxCell),i=Zi(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Xi=async e=>{let t=await bn(e),o=Nn(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},An=async e=>{try{let t=await Xi(e),{nodes:o,edges:n,summary:r}=qi(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};import{jsx as ts}from"react/jsx-runtime";var In=()=>{let{t:e}=Qi(),{toast:t}=Ji(),{setNodes:o,setEdges:n,fitView:r}=ji(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(E=>[E.originalType,E.value,e(`adapter.governance.report.status.${E.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:ts(es,{size:"small",variant:"ghost",onClick:()=>vn({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:E}=await An(s);if(o(u=>u.concat(l)),n(u=>u.concat(c)),r(),E.some(u=>u.status==="unsupported")){i(E);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};import{Button as os}from"lecom-ui";import{useRef as ns}from"react";import{Fragment as rs,jsx as kn,jsxs as as}from"react/jsx-runtime";var Ln=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=he(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=ns(null),E=u=>{let g=u.target.files;g!=null&&g.length&&i(g),c.current&&(c.current.value="")};return as(rs,{children:[kn(os,A(N({onClick:u=>{var g;(g=c.current)==null||g.click(),r==null||r(u)}},a),{children:e})),kn("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:E})]})};import{jsx as Et,jsxs as ps}from"react/jsx-runtime";var Sn=({disabled:e=!1})=>{let{t}=cs(),{toast:o}=ds(),{createDiagram:n}=In(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(s)};return ps(is,{children:[Et(ls,{asChild:!0,children:Et(Ln,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:Et(co,{})})}),Et(ss,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as bs,DropdownMenu as vs,DropdownMenuContent as Ns,DropdownMenuItem as Yt,DropdownMenuTrigger as ys,Tooltip as bt,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as Ts}from"lecom-ui";import{FileCodeIcon as xs,FileImageIcon as _s,FolderOutputIcon as ws,PrinterIcon as Cs}from"lucide-react";import{useState as As}from"react";import{useReactFlow as ms}from"@xyflow/react";import{toPng as Pn,toSvg as us}from"html-to-image";import{toast as gs,useTranslation as fs}from"lecom-ui";import{useState as hs}from"react";var Es=3,Wt="diagram",Dn=()=>{let{t:e}=fs(),{getNodes:t}=ms(),{deselectAll:o}=ft(),[n,r]=hs({png:!1,html:!1,print:!1}),i=()=>{let{x:E,y:m,width:u,height:g}=_o(t());return{width:u,height:g,style:{width:`${u}px`,height:`${g}px`,transform:`translate(${-E}px, ${-m}px)`}}},a=async(E,m)=>{r(A(N({},n),{[m]:!0})),await o();try{let u=xo();if(!u)throw new Error("Flow element not found");let g=i();return await E(u,g)}catch(u){gs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(A(N({},n),{[m]:!1}))}};return{exportAsPng:async(E=Wt)=>{await a(async(m,u)=>{let g=await Pn(m,A(N({},u),{backgroundColor:"#fcfcfc"}));ht(g,`${E}.png`)},"png")},exportAsHtml:async(E=Wt)=>{await a(async(m,u)=>{let g=await us(m,A(N({},u),{backgroundColor:"#fcfcfc"})),h=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
8
- <title>${b}</title>
8
+ <title>${E}</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="${E}" alt="Diagram" />
15
+ <img src="${g}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,y=new Blob([p],{type:"text/html"}),m=URL.createObjectURL(y);ht(m,`${b}.html`),setTimeout(()=>URL.revokeObjectURL(m),100)},"html")},printDiagram:async(b=Wt)=>{await a(async(f,u)=>{let E=await Pn(f,x(v({},u),{pixelRatio:Es})),p=window.open("","_blank");if(!p)throw new Error("Failed to open print window.");let y=p.document;y.open(),y.write(`
18
+ `,_=new Blob([h],{type:"text/html"}),f=URL.createObjectURL(_);ht(f,`${E}.html`),setTimeout(()=>URL.revokeObjectURL(f),100)},"html")},printDiagram:async(E=Wt)=>{await a(async(m,u)=>{let g=await Pn(m,A(N({},u),{pixelRatio:Es})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let _=h.document;_.open(),_.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
22
- <title>${b}</title>
22
+ <title>${E}</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 Yr=Object.defineProperty,Kr=Object.defineProperties;var $r=Object.getOwnProp
28
28
  </style>
29
29
  </head>
30
30
  <body>
31
- <img src="${E}" alt="Diagram" onload="window.print(); window.close();" />
31
+ <img src="${g}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),y.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function Rn(){let{t:e}=Ts(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=Dn(),[s,l]=As(!1);return xe(vs,{modal:!1,open:s,onOpenChange:l,children:[G(Ns,{asChild:!0,children:G("div",{children:xe(bt,{children:[G(yt,{asChild:!0,children:G(bs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(ws,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(ys,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(bt,{children:[G(yt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:G(_s,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(bt,{children:[G(yt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:G(xs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(bt,{children:[G(yt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:r,onClick:()=>n(),children:G(Cs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Rs,jsx as H,jsxs as de}from"react/jsx-runtime";var On=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:n,onValidateDiagram:r})=>{let{t:i}=Is(),{deselectAll:a}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:b,isMinimapOpen:f,setIsMinimapOpen:u}=M(),E=Mn(["v","V"]),p=Mn(["h","H"]),y=Ds(()=>{a(),b()},[a,b]),m=()=>{a();let g=r(o);n&&n(g)};return Vn(()=>{E&&!s&&!t&&c()},[E,c,s,t]),Vn(()=>{p&&!l&&!t&&y()},[p,y,l,t]),de("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&de(Rs,{children:[de(Tt,{children:[H(_t,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:k(s&&"bg-grey-400"),iconButton:!0,onClick:c,children:H(Ps,{})})}),de(xt,{color:"black",children:[i("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),de(Tt,{children:[H(_t,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:k(l&&"bg-grey-400"),iconButton:!0,onClick:y,children:H(ks,{})})}),de(xt,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),de(Tt,{children:[H(_t,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:m,children:H(Ls,{})})}),H(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),H(Rn,{}),!t&&H(Sn,{disabled:e.length>0}),de(Tt,{children:[H(_t,{asChild:!0,children:H(Nt,{size:"small",variant:"ghost",color:"grey",className:k(f&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!f),children:H(Ss,{})})}),H(xt,{color:"black",children:i(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Gn,Tooltip as Hn,TooltipContent as Bn,TooltipTrigger as zn,useTranslation as Ms}from"lecom-ui";import{RedoIcon as Vs,UndoIcon as Os}from"lucide-react";import{jsx as ce,jsxs as Kt}from"react/jsx-runtime";var Fn=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=Ms();return Kt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Kt(Hn,{children:[ce(zn,{asChild:!0,children:ce(Gn,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:ce(Os,{})})}),ce(Bn,{color:"black",children:r("editor.controls.history.undo")})]}),Kt(Hn,{children:[ce(zn,{asChild:!0,children:ce(Gn,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:ce(Vs,{})})}),ce(Bn,{color:"black",children:r("editor.controls.history.redo")})]})]})};import{useReactFlow as Gs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as At,TooltipTrigger as It,useTranslation as Hs}from"lecom-ui";import{ScanIcon as Bs,ZoomIn as zs,ZoomOut as Fs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Un=()=>{let{t:e}=Hs(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=Gs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:W(Bs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Fs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:W(uo,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(zs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Ll,useReactFlow as Sl}from"@xyflow/react";import{Handle as Us}from"@xyflow/react";import{jsx as Ws}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Ws(Us,{type:e,position:t,className:k("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Ys,useReactFlow as Ks}from"@xyflow/react";import{orderBy as $s}from"lodash";import{jsx as Zs}from"react/jsx-runtime";var _e=o=>{var n=o,{nodeId:e}=n,t=he(n,["nodeId"]);let{getNode:r,getNodes:i,setNodes:a}=Ks(),s=({width:l,height:c})=>{if(!e)return;let b=r(e);if((b==null?void 0:b.type)!=="LANE")return;let f=[...i()],u=!b.parentId,E=u?b.id:b.parentId,p=f.filter(g=>g.type==="LANE"&&g.parentId===E);if(!p.length)return;let y=$s(p,["position.y"]),m=0;y.forEach((g,d)=>{var h,I;let T=d===y.length-1,A=(I=(h=g.measured)==null?void 0:h.height)!=null?I:0;f=f.map(N=>{if(N.id===g.id){let w=u?l-Y.HEADER_WIDTH:l,L=x(v({},N),{width:w,measured:x(v({},N.measured),{width:w}),position:x(v({},N.position),{y:m})});return T&&u&&(L.height=c-m),L}return N}),m+=A}),f=f.map(g=>{if(g.id===E){let d=u?l:l+Y.HEADER_WIDTH;return x(v({},g),{width:d,height:u?c:m,measured:{width:d,height:u?c:m}})}return g}),a(f)};return Zs(Ys,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};import{Position as Tl,NodeToolbar as xl}from"@xyflow/react";import{Button as _l,Tooltip as wl,TooltipContent as Cl,TooltipTrigger as Al,useTranslation as Il}from"lecom-ui";import{useNodesData as qs,useReactFlow as Xs}from"@xyflow/react";import{Button as js,DropdownMenu as Js,DropdownMenuContent as Qs,DropdownMenuGroup as el,DropdownMenuItem as tl,DropdownMenuLabel as ol,DropdownMenuTrigger as nl,Tooltip as rl,TooltipContent as al,TooltipTrigger as il,useTranslation as sl}from"lecom-ui";import{WrenchIcon as ll}from"lucide-react";import{jsx as re,jsxs as kt}from"react/jsx-runtime";var Wn=({nodeId:e})=>{let{t}=sl(),{updateNodeData:o}=Xs(),n=qs(e),r=i=>{(n==null?void 0:n.data.variant)!==i&&o(e,{variant:i})};return kt(Js,{children:[kt(rl,{children:[re(il,{asChild:!0,children:re(nl,{asChild:!0,children:re(js,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:re(ll,{})})})}),re(al,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(Qs,{align:"start",className:"w-60 bg-white text-grey-600",children:[re(ol,{className:"flex items-center",children:re("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),re(el,{children:Object.entries(Qe).map(([i,a])=>kt(tl,{className:k({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===i}),onClick:()=>r(i),children:[re(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as dl,useReactFlow as cl}from"@xyflow/react";import{Button as Yn,DropdownMenu as pl,DropdownMenuContent as ml,DropdownMenuGroup as ul,DropdownMenuItem as gl,DropdownMenuLabel as fl,DropdownMenuTrigger as hl,Tooltip as El,TooltipContent as bl,TooltipTrigger as vl,useTranslation as yl}from"lecom-ui";import{WrenchIcon as Nl}from"lucide-react";import{jsx as X,jsxs as Be}from"react/jsx-runtime";var Kn=({nodeId:e})=>{let{t}=yl(),{updateNodeData:o}=cl(),n=dl(e),r=a=>{o(e,{variant:(n==null?void 0:n.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(n==null?void 0:n.data.attribute)===a?"":a})};return Be(pl,{children:[Be(El,{children:[X(vl,{asChild:!0,children:X(hl,{asChild:!0,children:X(Yn,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:X(Nl,{})})})}),X(bl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(ml,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(fl,{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(([a,s])=>X(Yn,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:k({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.attribute)===a}),onClick:()=>i(a),children:X(s.icon,{className:"stroke-inherit"})},a))})]}),X(ul,{children:Object.entries(je).map(([a,s])=>Be(gl,{className:k({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===a}),onClick:()=>r(a),children:[X(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as kl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:n})=>{var b;let{t:r}=Il(),{setDraggableNode:i}=Ne(),a=({event:f,type:u,variant:E})=>{i({type:u,variant:E}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Le,label:r("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Ee,label:r("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Le,label:r("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,label:r("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:r("bpmn.annotation.variant.default")}},l=[{component:j(st,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Kn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Wn,{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(xl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:Tl.Right,align:"start",isVisible:n,children:(b=c[t])==null?void 0:b.map((f,u)=>f.component?j("div",{children:f.component},u):kl(wl,{children:[j(Al,{asChild:!0,children:j(_l,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:E=>a({event:E,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(Cl,{color:"black",children:f.label})]},u))})};import{Fragment as Pl,jsx as ze,jsxs as Dl}from"react/jsx-runtime";var $n=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Sl(),{isMultipleSelection:i}=M(),a=s=>{r(e,{label:s})};return Dl(Pl,{children:[ze("div",{className:k("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&!i&&o}),ze(_e,{isVisible:!n&&!i&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:Ll.Left})]})};import{Position as Zn,useReactFlow as Rl}from"@xyflow/react";import{useState as Ml}from"react";import{Fragment as Vl,jsx as we,jsxs as qn}from"react/jsx-runtime";var Xn=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Rl(),{isMultipleSelection:i}=M(),[a,s]=Ml(!1),l=f=>{r(e,{label:f})};return qn(Vl,{children:[qn("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(Ee,{className:k("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:a,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&!i&&o}),we(B,{type:"source",position:Zn.Right}),we(B,{type:"target",position:Zn.Left})]})};import{Position as jn,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as Ce,jsxs as Jn}from"react/jsx-runtime";var Qn=({id:e,data:t,selected:o,dragging:n})=>{let r=Qe[t.variant].icon,{updateNodeData:i}=Ol(),{isMultipleSelection:a}=M(),[s,l]=Gl(!1),c=u=>{i(e,{label:u})};return Jn(Hl,{children:[Jn("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(r,{className:k("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:c})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&!a&&o}),Ce(B,{type:"target",position:jn.Left}),Ce(B,{type:"source",position:jn.Right})]})};import{Position as Bl,useReactFlow as zl}from"@xyflow/react";import{useState as Fl}from"react";import{Fragment as Ul,jsx as Fe,jsxs as er}from"react/jsx-runtime";var tr=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=zl(),{isMultipleSelection:i}=M(),[a,s]=Fl(!1),l=f=>{r(e,{label:f})};return er(Ul,{children:[er("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(qe,{className:k("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),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:a,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&!i&&o}),Fe(B,{type:"source",position:Bl.Right})]})};import{Position as or,useReactFlow as Wl}from"@xyflow/react";import{Fragment as Yl,jsx as ee,jsxs as nr}from"react/jsx-runtime";var rr=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Wl(),{isMultipleSelection:i}=M(),a=u=>{r(e,{label:u})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,c=t.variant==="SUBPROCESS",b=s&&!c,f=l||c;return nr(Yl,{children:[nr("div",{className:k("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[ee(U,{value:t.label,className:k("m-1",{"py-6":b||f}),onChange:a}),s&&ee("div",{className:k("absolute flex items-center p-1",c?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:k(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:k("flex items-center w-16 p-1",c?"justify-between":"justify-center"),children:ee(l,{size:16,className:k(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!n&&!i&&o}),ee(_e,{isVisible:!n&&!i&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:or.Right}),ee(B,{type:"target",position:or.Left})]})};import{Position as ar}from"@xyflow/react";import{Fragment as Kl,jsx as Lt,jsxs as $l}from"react/jsx-runtime";var ir=({id:e,data:t,selected:o,dragging:n})=>{let{isMultipleSelection:r}=M();return $l(Kl,{children:[Lt("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),Lt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&!r&&o}),Lt(B,{type:"source",position:ar.Right}),Lt(B,{type:"target",position:ar.Left})]})};import{Position as Zl,useReactFlow as ql}from"@xyflow/react";import{orderBy as Xl}from"lodash";import{useMemo as sr}from"react";import{Fragment as jl,jsx as fe,jsxs as lr}from"react/jsx-runtime";var dr=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=ql(),{isMultipleSelection:s}=M(),l=a(),c=!r,b=sr(()=>Xl([...l.filter(p=>p.parentId===e&&p.type==="LANE")],"position.y","asc"),[l,e]),f=c?tt.MIN_WIDTH:Y.MIN_WIDTH,u=sr(()=>{if(c&&b.length>1){let p=[...b];return p.pop(),p.reduce((m,g)=>{var d,T;return m+((T=(d=g.measured)==null?void 0:d.height)!=null?T:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[c,b]),E=p=>{i(e,{label:p})};return lr(jl,{children:[lr("div",{className:k("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:E})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!n&&!s&&o}),fe(_e,{nodeId:e,minWidth:f,minHeight:u,isVisible:!n&&!s&&o}),c&&fe(B,{type:"source",position:Zl.Right})]})};var cr={START_EVENT:tr,END_EVENT:Xn,TASK:rr,GATEWAY:Qn,ANNOTATION:$n,LANE:dr,UNSUPPORTED:ir},pr={SEQUENCE_EDGE:Do,MESSAGE_EDGE:Xo,ANNOTATION_EDGE:Io},mr="#fafafa",ur="#bebebe",gr=1,fr=10,hr="bottom-left",Er=.5,br=4,vr={x:0,y:0,zoom:.75};import{useStore as Jl}from"@xyflow/react";import{useEffect as Ql,useRef as ed}from"react";import{jsx as od}from"react/jsx-runtime";var td=e=>({width:e.width,height:e.height,transform:e.transform}),yr=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:n=[6,6]})=>{let{width:r,height:i,transform:a}=Jl(td),s=ed(null);return Ql(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let b=window.devicePixelRatio;l.width=r*b,l.height=i*b,c.scale(b,b),c.clearRect(0,0,r,i),c.strokeStyle=o,c.setLineDash(n),typeof t=="number"&&(c.moveTo(t*a[2]+a[0],0),c.lineTo(t*a[2]+a[0],i),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*a[2]+a[1]),c.lineTo(r,e*a[2]+a[1]),c.stroke())},[r,i,a,e,t,o,n]),od("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as Nr,Dialog as nd,DialogContent as rd,DialogFooter as ad,DialogHeader as id,DialogTitle as sd,Notification as ld,Typography as $t,useTranslation as dd}from"lecom-ui";import{jsx as te,jsxs as Zt}from"react/jsx-runtime";var Tr=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:n})=>{let{t:r}=dd(),i=!!e,a=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(b=>b.filter(f=>!l.some(u=>u.id===f.id))),c!=null&&c.length&&n(b=>b.filter(f=>!c.some(u=>u.id===f.id))),t(null)},s=()=>{t(null)};return te(nd,{open:i,onOpenChange:s,children:Zt(rd,{className:"w-[488px] max-w-fit gap-2",children:[te(id,{children:te(sd,{children:te($t,{variant:"heading-small-600",textColor:"text-grey-950",children:r("editor.modals.delete_elements.title")})})}),Zt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(ld,{type:"callout",variant:"warning",content:r("editor.modals.delete_elements.callout")})}),te($t,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:r("editor.modals.delete_elements.content")})]}),Zt(ad,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(Nr,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te($t,{variant:"body-medium-500",textColor:"text-grey-800",children:r("editor.modals.delete_elements.cancel")})}),te(Nr,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:r("editor.modals.delete_elements.confirm")})]})]})})};import{Button as cd,Tooltip as pd,TooltipContent as md,TooltipTrigger as ud,useTranslation as gd}from"lecom-ui";import{jsx as Ue,jsxs as fd}from"react/jsx-runtime";var xr=()=>{let{t:e}=gd(),{setDraggableNode:t}=Ne(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Ee,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Le,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:bo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Eo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ho,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Ze,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:$e,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:mo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],n=(r,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),r.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((r,i)=>fd(pd,{children:[Ue(ud,{asChild:!0,children:Ue(cd,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>n(a,r),children:Ue(r.icon,{})},i)}),Ue(md,{color:"black",side:"right",children:r.label})]},i))})};import{Button as hd,useTranslation as Ed}from"lecom-ui";import{AlertCircleIcon as bd,CircleCheckIcon as vd,XIcon as yd}from"lucide-react";import{useEffect as Nd,useState as Td}from"react";import{jsx as J,jsxs as qt}from"react/jsx-runtime";var _r=({validationResult:e,onClose:t})=>{let{t:o}=Ed(),[n,r]=Td(!1);if(Nd(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:a}=e;return qt("div",{className:k("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[qt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:i?J(vd,{className:"text-green-500 size-5"}):J(bd,{className:"text-red-500 size-5"})}),qt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&J("div",{children:o("validation.errors.subtitle")})]}),J(hd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:J(yd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:a.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as K,jsxs as jt}from"react/jsx-runtime";var Od=[],Gd=({onHighlightMethods:e})=>{let t=rn(),{highlightedElements:o}=M();return Jt(()=>{if(e&&t){console.log("\u{1F527} Inicializando m\xE9todos de destaque...");let n={highlightElement:t.highlightElement,highlightElements:t.highlightElements,clearHighlight:t.clearHighlight,isElementHighlighted:t.isElementHighlighted,getHighlightedElements:()=>o};e(n),console.log("\u2705 M\xE9todos de destaque inicializados com sucesso")}},[e,t.highlightElement,t.highlightElements,t.clearHighlight,t.isElementHighlighted,o]),null},Hd=({mode:e="edit",onHighlightMethods:t})=>{let o=Rd(!1),[n,r]=Ld([]),[i,a]=kd([]),[s,l]=Md(null),{isMoveTool:c,isHandTool:b,isReadOnly:f,setIsReadOnly:u,setIsMultipleSelection:E,isMinimapOpen:p}=M(),{validationResult:y,handleValidationComplete:m,clearValidation:g,isAutoValidationEnabled:d,validateDiagram:T}=Yo(),{getNode:A,getNodes:h,getEdges:I}=Pd(),{onNodeDrag:N,onDrop:w,onDragOver:L,onNodeDragStop:C}=en({nodes:n,setNodes:r,setEdges:a}),{isValidConnection:S,onConnect:_}=Mo({setEdges:a});Zo();let{createDiagram:V}=pn(),{undo:$,redo:z,saveHistory:ae,canUndo:pe,canRedo:me}=fn(),{helperLineHorizontal:Pr,helperLineVertical:Dr,customApplyNodeChanges:Rr}=nn();mn({LIA_CREATE_DIAGRAM:V,CLEAR_DIAGRAM:()=>{r([]),a([])}}),Jt(()=>{u(e==="readonly")},[e,u]);let Mr=()=>{g()},Vr=Xt(({nodes:F,edges:R})=>{let Ae=F.length+R.length>1;E(Ae)},[E]);Sd({onChange:Vr});let Or=F=>{let R=A(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ae=ue(R.parentId,n.filter(no=>no.id!==R.id&&no.type==="LANE"));r(ne(Ae))}},Gr=F=>{F.forEach(R=>{switch(R.type){case"remove":Or(R);break}})},Hr=Xt(()=>{if(!d){o.current=!1;return}let F=h(),R=I(),Ae=T({nodes:F,edges:R});m(Ae),o.current=!1},[d,h,I,T,m]),to=Vd(Hr,300),oo=Xt(()=>{d&&!o.current&&(o.current=!0,to())},[d,to]),Br=F=>{r(R=>Rr(F,R)),ae(F),oo(),Gr(F)},zr=F=>{a(R=>xd(F,R)),ae(F),oo()},Fr=()=>{ae("forceSave")},Ur=async({nodes:F,edges:R})=>(l({nodes:F,edges:R}),!1),Wr={nodes:n,edges:i};return jt("div",{className:"w-full h-full",children:[K(Gd,{onHighlightMethods:t}),!f&&K(xr,{}),K(En,{}),jt(Cd,{edges:i,nodes:n,nodeTypes:cr,edgeTypes:pr,minZoom:Er,maxZoom:br,panOnDrag:b||f?!0:Od,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!f&&c,nodesConnectable:!f&&c,nodesDraggable:!f&&c,isValidConnection:S,connectionLineComponent:Jo,onConnect:_,onDrop:w,onDropCapture:Fr,onDragOver:L,onNodesChange:Br,onEdgesChange:zr,onNodeDrag:N,onNodeDragStop:C,onBeforeDelete:Ur,selectionMode:Id.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:vr,connectOnClick:!1,children:[p&&K(wd,{pannable:!0,zoomable:!0,position:hr,className:"shadow-md rounded-md"}),jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!f&&K(Fn,{canUndo:pe,canRedo:me,undo:$,redo:z}),K(On,{nodes:n,isReadOnly:f,diagram:Wr,onValidationComplete:m,onValidateDiagram:T}),K(Un,{})]}),K(yr,{horizontal:Pr,vertical:Dr}),K(_d,{gap:fr,size:gr,color:ur,bgColor:mr}),y&&K("div",{className:"absolute top-6 right-6 z-[1000]",children:K(_r,{validationResult:y,onClose:Mr})})]}),K(Tr,{pendingDelete:s,setPendingDelete:l,setNodes:r,setEdges:a})]})},Bd=({mode:e,locale:t="pt_BR",onConfigureElement:o,onHighlightMethods:n})=>(Jt(()=>{t&&Dd.changeLanguage(t)},[t]),K(Ad,{children:K(Co,{value:{onConfigureElement:o},children:K(Hd,{mode:e})})})),Qt=Bd;var eo=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 zd,Translations as Fd}from"lecom-ui";var wr={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 Cr={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 Ar={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 Ir={pt_BR:Ar,en_US:wr,es_ES:Cr};var kr,Lr,Ud=(Lr=(kr=eo("LecomUserLanguage"))!=null?kr:eo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Lr:Fd.PT_BR;zd({lng:Ud,resources:Ir});import{jsx as Sr}from"react/jsx-runtime";var rE=e=>Sr(so,{children:Sr(Qt,v({},e))});export{Pt as ActivityVariant,Rt as ComplexVariant,St as ElementType,Mt as ExclusiveVariant,ie as GatewayVariant,rE as Modeler,Dt as RoutingVariant};
34
+ `),_.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function Mn(){let{t:e}=Ts(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=Dn(),[s,l]=As(!1);return xe(vs,{modal:!1,open:s,onOpenChange:l,children:[G(ys,{asChild:!0,children:G("div",{children:xe(bt,{children:[G(Nt,{asChild:!0,children:G(bs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(ws,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(Ns,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(bt,{children:[G(Nt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:G(_s,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(bt,{children:[G(Nt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:G(xs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(bt,{children:[G(Nt,{asChild:!0,children:G(Yt,{className:"p-1.5",disabled:r,onClick:()=>n(),children:G(Cs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Ms,jsx as H,jsxs as de}from"react/jsx-runtime";var On=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:n,onValidateDiagram:r})=>{let{t:i}=Is(),{deselectAll:a}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:E,isMinimapOpen:m,setIsMinimapOpen:u}=V(),g=Rn(["v","V"]),h=Rn(["h","H"]),_=Ds(()=>{a(),E()},[a,E]),f=()=>{a();let p=r(o);n&&n(p)};return Vn(()=>{g&&!s&&!t&&c()},[g,c,s,t]),Vn(()=>{h&&!l&&!t&&_()},[h,_,l,t]),de("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&de(Ms,{children:[de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:L(s&&"bg-grey-400"),iconButton:!0,onClick:c,children:H(Ps,{})})}),de(xt,{color:"black",children:[i("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:L(l&&"bg-grey-400"),iconButton:!0,onClick:_,children:H(ks,{})})}),de(xt,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:f,children:H(Ls,{})})}),H(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),H(Mn,{}),!t&&H(Sn,{disabled:e.length>0}),de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:L(m&&"bg-grey-400"),iconButton:!0,onClick:()=>u(!m),children:H(Ss,{})})}),H(xt,{color:"black",children:i(m?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Gn,Tooltip as Hn,TooltipContent as Bn,TooltipTrigger as zn,useTranslation as Rs}from"lecom-ui";import{RedoIcon as Vs,UndoIcon as Os}from"lucide-react";import{jsx as ce,jsxs as $t}from"react/jsx-runtime";var Fn=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=Rs();return $t("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[$t(Hn,{children:[ce(zn,{asChild:!0,children:ce(Gn,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:ce(Os,{})})}),ce(Bn,{color:"black",children:r("editor.controls.history.undo")})]}),$t(Hn,{children:[ce(zn,{asChild:!0,children:ce(Gn,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:ce(Vs,{})})}),ce(Bn,{color:"black",children:r("editor.controls.history.redo")})]})]})};import{useReactFlow as Gs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as At,TooltipTrigger as It,useTranslation as Hs}from"lecom-ui";import{ScanIcon as Bs,ZoomIn as zs,ZoomOut as Fs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Un=()=>{let{t:e}=Hs(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=Gs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:W(Bs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Fs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:W(uo,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(It,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(zs,{})})}),W(At,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Ll,useReactFlow as Sl}from"@xyflow/react";import{Handle as Us}from"@xyflow/react";import{jsx as Ws}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Ws(Us,{type:e,position:t,className:L("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Ys,useReactFlow as $s}from"@xyflow/react";import{orderBy as Ks}from"lodash";import{jsx as Zs}from"react/jsx-runtime";var _e=o=>{var n=o,{nodeId:e}=n,t=he(n,["nodeId"]);let{getNode:r,getNodes:i,setNodes:a}=$s(),s=({width:l,height:c})=>{if(!e)return;let E=r(e);if((E==null?void 0:E.type)!=="LANE")return;let m=[...i()],u=!E.parentId,g=u?E.id:E.parentId,h=m.filter(p=>p.type==="LANE"&&p.parentId===g);if(!h.length)return;let _=Ks(h,["position.y"]),f=0;_.forEach((p,d)=>{var y,k;let b=d===_.length-1,w=(k=(y=p.measured)==null?void 0:y.height)!=null?k:0;m=m.map(v=>{if(v.id===p.id){let C=u?l-Y.HEADER_WIDTH:l,T=A(N({},v),{width:C,measured:A(N({},v.measured),{width:C}),position:A(N({},v.position),{y:f})});return b&&u&&(T.height=c-f),T}return v}),f+=w}),m=m.map(p=>{if(p.id===g){let d=u?l:l+Y.HEADER_WIDTH;return A(N({},p),{width:d,height:u?c:f,measured:{width:d,height:u?c:f}})}return p}),a(m)};return Zs(Ys,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};import{Position as Tl,NodeToolbar as xl}from"@xyflow/react";import{Button as _l,Tooltip as wl,TooltipContent as Cl,TooltipTrigger as Al,useTranslation as Il}from"lecom-ui";import{useNodesData as qs,useReactFlow as Xs}from"@xyflow/react";import{Button as js,DropdownMenu as Js,DropdownMenuContent as Qs,DropdownMenuGroup as el,DropdownMenuItem as tl,DropdownMenuLabel as ol,DropdownMenuTrigger as nl,Tooltip as rl,TooltipContent as al,TooltipTrigger as il,useTranslation as sl}from"lecom-ui";import{WrenchIcon as ll}from"lucide-react";import{jsx as re,jsxs as kt}from"react/jsx-runtime";var Wn=({nodeId:e})=>{let{t}=sl(),{updateNodeData:o}=Xs(),n=qs(e),r=i=>{(n==null?void 0:n.data.variant)!==i&&o(e,{variant:i})};return kt(Js,{children:[kt(rl,{children:[re(il,{asChild:!0,children:re(nl,{asChild:!0,children:re(js,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:re(ll,{})})})}),re(al,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(Qs,{align:"start",className:"w-60 bg-white text-grey-600",children:[re(ol,{className:"flex items-center",children:re("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),re(el,{children:Object.entries(Qe).map(([i,a])=>kt(tl,{className:L({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===i}),onClick:()=>r(i),children:[re(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as dl,useReactFlow as cl}from"@xyflow/react";import{Button as Yn,DropdownMenu as pl,DropdownMenuContent as ml,DropdownMenuGroup as ul,DropdownMenuItem as gl,DropdownMenuLabel as fl,DropdownMenuTrigger as hl,Tooltip as El,TooltipContent as bl,TooltipTrigger as vl,useTranslation as Nl}from"lecom-ui";import{WrenchIcon as yl}from"lucide-react";import{jsx as X,jsxs as Be}from"react/jsx-runtime";var $n=({nodeId:e})=>{let{t}=Nl(),{updateNodeData:o}=cl(),n=dl(e),r=a=>{o(e,{variant:(n==null?void 0:n.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(n==null?void 0:n.data.attribute)===a?"":a})};return Be(pl,{children:[Be(El,{children:[X(vl,{asChild:!0,children:X(hl,{asChild:!0,children:X(Yn,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:X(yl,{})})})}),X(bl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(ml,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(fl,{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(([a,s])=>X(Yn,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:L({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.attribute)===a}),onClick:()=>i(a),children:X(s.icon,{className:"stroke-inherit"})},a))})]}),X(ul,{children:Object.entries(je).map(([a,s])=>Be(gl,{className:L({"bg-grey-100 text-blue-500":(n==null?void 0:n.data.variant)===a}),onClick:()=>r(a),children:[X(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as kl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:n})=>{var E;let{t:r}=Il(),{setDraggableNode:i}=ye(),a=({event:m,type:u,variant:g})=>{i({type:u,variant:g}),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Le,label:r("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Ee,label:r("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Le,label:r("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,label:r("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:$e,label:r("bpmn.annotation.variant.default")}},l=[{component:j(st,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j($n,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Wn,{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(xl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:Tl.Right,align:"start",isVisible:n,children:(E=c[t])==null?void 0:E.map((m,u)=>m.component?j("div",{children:m.component},u):kl(wl,{children:[j(Al,{asChild:!0,children:j(_l,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:g=>a({event:g,type:m.type,variant:m.variant}),children:m.icon&&j(m.icon,{size:16})})}),j(Cl,{color:"black",children:m.label})]},u))})};import{Fragment as Pl,jsx as ze,jsxs as Dl}from"react/jsx-runtime";var Kn=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Sl(),{isMultipleSelection:i}=V(),a=s=>{r(e,{label:s})};return Dl(Pl,{children:[ze("div",{className:L("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:a})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&!i&&o}),ze(_e,{isVisible:!n&&!i&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:Ll.Left})]})};import{Position as Zn,useReactFlow as Ml}from"@xyflow/react";import{useState as Rl}from"react";import{Fragment as Vl,jsx as we,jsxs as qn}from"react/jsx-runtime";var Xn=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Ml(),{isMultipleSelection:i}=V(),[a,s]=Rl(!1),l=m=>{r(e,{label:m})};return qn(Vl,{children:[qn("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(Ee,{className:L("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:a,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&!i&&o}),we(B,{type:"source",position:Zn.Right}),we(B,{type:"target",position:Zn.Left})]})};import{Position as jn,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as Ce,jsxs as Jn}from"react/jsx-runtime";var Qn=({id:e,data:t,selected:o,dragging:n})=>{let r=Qe[t.variant].icon,{updateNodeData:i}=Ol(),{isMultipleSelection:a}=V(),[s,l]=Gl(!1),c=u=>{i(e,{label:u})};return Jn(Hl,{children:[Jn("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(r,{className:L("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:c})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&!a&&o}),Ce(B,{type:"target",position:jn.Left}),Ce(B,{type:"source",position:jn.Right})]})};import{Position as Bl,useReactFlow as zl}from"@xyflow/react";import{useState as Fl}from"react";import{Fragment as Ul,jsx as Fe,jsxs as er}from"react/jsx-runtime";var tr=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=zl(),{isMultipleSelection:i}=V(),[a,s]=Fl(!1),l=m=>{r(e,{label:m})};return er(Ul,{children:[er("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(qe,{className:L("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:a,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&!i&&o}),Fe(B,{type:"source",position:Bl.Right})]})};import{Position as or,useReactFlow as Wl}from"@xyflow/react";import{Fragment as Yl,jsx as ee,jsxs as nr}from"react/jsx-runtime";var rr=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=Wl(),{isMultipleSelection:i}=V(),a=u=>{r(e,{label:u})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,c=t.variant==="SUBPROCESS",E=s&&!c,m=l||c;return nr(Yl,{children:[nr("div",{className:L("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:L("m-1",{"py-6":E||m}),onChange:a}),s&&ee("div",{className:L("absolute flex items-center p-1",c?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:L(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:L("flex items-center w-16 p-1",c?"justify-between":"justify-center"),children:ee(l,{size:16,className:L(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!n&&!i&&o}),ee(_e,{isVisible:!n&&!i&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:or.Right}),ee(B,{type:"target",position:or.Left})]})};import{Position as ar}from"@xyflow/react";import{Fragment as $l,jsx as Lt,jsxs as Kl}from"react/jsx-runtime";var ir=({id:e,data:t,selected:o,dragging:n})=>{let{isMultipleSelection:r}=V();return Kl($l,{children:[Lt("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),Lt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&!r&&o}),Lt(B,{type:"source",position:ar.Right}),Lt(B,{type:"target",position:ar.Left})]})};import{Position as Zl,useReactFlow as ql}from"@xyflow/react";import{orderBy as Xl}from"lodash";import{useMemo as sr}from"react";import{Fragment as jl,jsx as fe,jsxs as lr}from"react/jsx-runtime";var dr=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=ql(),{isMultipleSelection:s}=V(),l=a(),c=!r,E=sr(()=>Xl([...l.filter(h=>h.parentId===e&&h.type==="LANE")],"position.y","asc"),[l,e]),m=c?tt.MIN_WIDTH:Y.MIN_WIDTH,u=sr(()=>{if(c&&E.length>1){let h=[...E];return h.pop(),h.reduce((f,p)=>{var d,b;return f+((b=(d=p.measured)==null?void 0:d.height)!=null?b:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[c,E]),g=h=>{i(e,{label:h})};return lr(jl,{children:[lr("div",{className:L("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:g})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!n&&!s&&o}),fe(_e,{nodeId:e,minWidth:m,minHeight:u,isVisible:!n&&!s&&o}),c&&fe(B,{type:"source",position:Zl.Right})]})};var cr={START_EVENT:tr,END_EVENT:Xn,TASK:rr,GATEWAY:Qn,ANNOTATION:Kn,LANE:dr,UNSUPPORTED:ir},pr={SEQUENCE_EDGE:Do,MESSAGE_EDGE:Xo,ANNOTATION_EDGE:Io},mr="#fafafa",ur="#bebebe",gr=1,fr=10,hr="bottom-left",Er=.5,br=4,vr={x:0,y:0,zoom:.75};import{useStore as Jl}from"@xyflow/react";import{useEffect as Ql,useRef as ed}from"react";import{jsx as od}from"react/jsx-runtime";var td=e=>({width:e.width,height:e.height,transform:e.transform}),Nr=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:n=[6,6]})=>{let{width:r,height:i,transform:a}=Jl(td),s=ed(null);return Ql(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let E=window.devicePixelRatio;l.width=r*E,l.height=i*E,c.scale(E,E),c.clearRect(0,0,r,i),c.strokeStyle=o,c.setLineDash(n),typeof t=="number"&&(c.moveTo(t*a[2]+a[0],0),c.lineTo(t*a[2]+a[0],i),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*a[2]+a[1]),c.lineTo(r,e*a[2]+a[1]),c.stroke())},[r,i,a,e,t,o,n]),od("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as yr,Dialog as nd,DialogContent as rd,DialogFooter as ad,DialogHeader as id,DialogTitle as sd,Notification as ld,Typography as Kt,useTranslation as dd}from"lecom-ui";import{jsx as te,jsxs as Zt}from"react/jsx-runtime";var Tr=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:n})=>{let{t:r}=dd(),i=!!e,a=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(E=>E.filter(m=>!l.some(u=>u.id===m.id))),c!=null&&c.length&&n(E=>E.filter(m=>!c.some(u=>u.id===m.id))),t(null)},s=()=>{t(null)};return te(nd,{open:i,onOpenChange:s,children:Zt(rd,{className:"w-[488px] max-w-fit gap-2",children:[te(id,{children:te(sd,{children:te(Kt,{variant:"heading-small-600",textColor:"text-grey-950",children:r("editor.modals.delete_elements.title")})})}),Zt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(ld,{type:"callout",variant:"warning",content:r("editor.modals.delete_elements.callout")})}),te(Kt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:r("editor.modals.delete_elements.content")})]}),Zt(ad,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(yr,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Kt,{variant:"body-medium-500",textColor:"text-grey-800",children:r("editor.modals.delete_elements.cancel")})}),te(yr,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:r("editor.modals.delete_elements.confirm")})]})]})})};import{Button as cd,Tooltip as pd,TooltipContent as md,TooltipTrigger as ud,useTranslation as gd}from"lecom-ui";import{jsx as Ue,jsxs as fd}from"react/jsx-runtime";var xr=()=>{let{t:e}=gd(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Ee,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Le,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:bo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Eo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ho,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:be,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:mo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:$e,label:e("bpmn.annotation.variant.default")}],n=(r,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),r.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((r,i)=>fd(pd,{children:[Ue(ud,{asChild:!0,children:Ue(cd,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>n(a,r),children:Ue(r.icon,{})},i)}),Ue(md,{color:"black",side:"right",children:r.label})]},i))})};import{Button as hd,useTranslation as Ed}from"lecom-ui";import{AlertCircleIcon as bd,CircleCheckIcon as vd,XIcon as Nd}from"lucide-react";import{useEffect as yd,useState as Td}from"react";import{jsx as J,jsxs as qt}from"react/jsx-runtime";var _r=({validationResult:e,onClose:t})=>{let{t:o}=Ed(),[n,r]=Td(!1);if(yd(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:a}=e;return qt("div",{className:L("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[qt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:i?J(vd,{className:"text-green-500 size-5"}):J(bd,{className:"text-red-500 size-5"})}),qt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&J("div",{children:o("validation.errors.subtitle")})]}),J(hd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:J(Nd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:a.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as jt}from"react/jsx-runtime";var Od=[],Gd=({onHighlightMethods:e})=>{let t=rn(),{highlightedElements:o}=V();return Jt(()=>{if(e&&t){console.log("\u{1F527} Inicializando m\xE9todos de destaque...");let n={highlightElement:t.highlightElement,highlightElements:t.highlightElements,clearHighlight:t.clearHighlight,isElementHighlighted:t.isElementHighlighted,getHighlightedElements:()=>o};e(n),console.log("\u2705 M\xE9todos de destaque inicializados com sucesso")}},[e,t.highlightElement,t.highlightElements,t.clearHighlight,t.isElementHighlighted,o]),null},Hd=({mode:e="edit",onHighlightMethods:t})=>{let o=Md(!1),[n,r]=Ld([]),[i,a]=kd([]),[s,l]=Rd(null),{isMoveTool:c,isHandTool:E,isReadOnly:m,setIsReadOnly:u,setIsMultipleSelection:g,isMinimapOpen:h}=V(),{validationResult:_,handleValidationComplete:f,clearValidation:p,isAutoValidationEnabled:d,validateDiagram:b}=Yo(),{getNode:w,getNodes:y,getEdges:k}=Pd(),{onNodeDrag:v,onDrop:C,onDragOver:T,onNodeDragStop:x}=en({nodes:n,setNodes:r,setEdges:a}),{isValidConnection:S,onConnect:I}=Ro({setEdges:a});Zo();let{createDiagram:M}=pn(),{undo:K,redo:z,saveHistory:ae,canUndo:pe,canRedo:me}=fn(),{helperLineHorizontal:Pr,helperLineVertical:Dr,customApplyNodeChanges:Mr}=nn();mn({LIA_CREATE_DIAGRAM:M,CLEAR_DIAGRAM:()=>{r([]),a([])}}),Jt(()=>{u(e==="readonly")},[e,u]);let Rr=()=>{p()},Vr=Xt(({nodes:F,edges:R})=>{let Ae=F.length+R.length>1;g(Ae)},[g]);Sd({onChange:Vr});let Or=F=>{let R=w(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ae=ue(R.parentId,n.filter(no=>no.id!==R.id&&no.type==="LANE"));r(ne(Ae))}},Gr=F=>{F.forEach(R=>{switch(R.type){case"remove":Or(R);break}})},Hr=Xt(()=>{if(!d){o.current=!1;return}let F=y(),R=k(),Ae=b({nodes:F,edges:R});f(Ae),o.current=!1},[d,y,k,b,f]),to=Vd(Hr,300),oo=Xt(()=>{d&&!o.current&&(o.current=!0,to())},[d,to]),Br=F=>{r(R=>Mr(F,R)),ae(F),oo(),Gr(F)},zr=F=>{a(R=>xd(F,R)),ae(F),oo()},Fr=()=>{ae("forceSave")},Ur=async({nodes:F,edges:R})=>(l({nodes:F,edges:R}),!1),Wr={nodes:n,edges:i};return jt("div",{className:"w-full h-full",children:[$(Gd,{onHighlightMethods:t}),!m&&$(xr,{}),$(En,{}),jt(Cd,{edges:i,nodes:n,nodeTypes:cr,edgeTypes:pr,minZoom:Er,maxZoom:br,panOnDrag:E||m?!0:Od,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&c,nodesConnectable:!m&&c,nodesDraggable:!m&&c,isValidConnection:S,connectionLineComponent:Jo,onConnect:I,onDrop:C,onDropCapture:Fr,onDragOver:T,onNodesChange:Br,onEdgesChange:zr,onNodeDrag:v,onNodeDragStop:x,onBeforeDelete:Ur,selectionMode:Id.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:vr,connectOnClick:!1,children:[h&&$(wd,{pannable:!0,zoomable:!0,position:hr,className:"shadow-md rounded-md"}),jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!m&&$(Fn,{canUndo:pe,canRedo:me,undo:K,redo:z}),$(On,{nodes:n,isReadOnly:m,diagram:Wr,onValidationComplete:f,onValidateDiagram:b}),$(Un,{})]}),$(Nr,{horizontal:Pr,vertical:Dr}),$(_d,{gap:fr,size:gr,color:ur,bgColor:mr}),_&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(_r,{validationResult:_,onClose:Rr})})]}),$(Tr,{pendingDelete:s,setPendingDelete:l,setNodes:r,setEdges:a})]})},Bd=({mode:e,locale:t="pt_BR",onConfigureElement:o,onHighlightMethods:n})=>(Jt(()=>{t&&Dd.changeLanguage(t)},[t]),$(Ad,{children:$(Co,{value:{onConfigureElement:o},children:$(Hd,{mode:e})})})),Qt=Bd;var eo=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 zd,Translations as Fd}from"lecom-ui";var wr={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 Cr={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 Ar={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 Ir={pt_BR:Ar,en_US:wr,es_ES:Cr};var kr,Lr,Ud=(Lr=(kr=eo("LecomUserLanguage"))!=null?kr:eo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Lr:Fd.PT_BR;zd({lng:Ud,resources:Ir});import{jsx as Sr}from"react/jsx-runtime";var r2=e=>Sr(so,{children:Sr(Qt,N({},e))});export{Pt as ActivityVariant,Mt as ComplexVariant,St as ElementType,Rt as ExclusiveVariant,ie as GatewayVariant,r2 as Modeler,Dt as RoutingVariant};