lecom-modeler 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ro=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable;var oo=(e,t,o)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))ro.call(t,o)&&oo(e,o,t[o]);if(We)for(var o of We(t))no.call(t,o)&&oo(e,o,t[o]);return e},T=(e,t)=>Fn(e,Un(t));var be=(e,t)=>{var o={};for(var r in e)ro.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&no.call(e,r)&&(o[r]=e[r]);return o};import{forwardRef as Hd}from"react";import{TooltipProvider as Wn,Notification as Yn}from"lecom-ui";import{jsx as Kn,jsxs as Zn}from"react/jsx-runtime";function ao({children:e}){return Zn(Wn,{children:[Kn(Yn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as vd,Background as Nd,MiniMap as yd,ReactFlow as Td,ReactFlowProvider as tE,SelectionMode as xd,useEdgesState as _d,useNodesState as wd,useOnSelectionChange as Cd,useReactFlow as Id}from"@xyflow/react";import{i18n as rE}from"lecom-ui";import{forwardRef as Ad,useCallback as qt,useEffect as kd,useImperativeHandle as Ld,useRef as Sd,useState as Pd}from"react";import{useDebouncedCallback as Dd}from"use-debounce";var St=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(St||{}),Pt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Pt||{}),Dt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Dt||{}),Rt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Rt||{}),Mt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Mt||{});import{RotateCcw as aa,ScrollText as ia,SquarePlus as sa}from"lucide-react";import{jsx as Ye,jsxs as $n}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>$n("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as io}from"react/jsx-runtime";var he=({size:e=24,className:t})=>io("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:io("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ae,jsxs as Xn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Xn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Ae("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt,jsxs as qn}from"react/jsx-runtime";var ve=({size:e=24,className:t})=>qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[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 jn}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[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 Jn}from"react/jsx-runtime";var so=({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:Jn("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 Qn}from"clsx";import{twMerge as ea}from"tailwind-merge";function A(...e){return ea(Qn(e))}var ke=(e,t)=>e<t?t:e;import{jsx as lo,jsxs as ta}from"react/jsx-runtime";var co=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:A("stroke-2",t),children:[lo("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"}),lo("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var po=({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 mo}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>mo("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:mo("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 uo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>uo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:A("stroke-2",t),children:uo("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 oa}from"react/jsx-runtime";var fo=({size:e=24,className:t})=>oa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[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 ra}from"react/jsx-runtime";var go=({size:e=24,className:t})=>ra("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Se("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Se("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as qe,jsxs as na}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>na("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[qe("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),qe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(D||{});var je={SCRIPT:{icon:ia},SUBPROCESS:{icon:sa}};var Je={LOOP:{icon:aa}},se=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(se||{}),Qe={EXCLUSIVE:{icon:ve},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import vo from"@dagrejs/dagre";import{getNodesBounds as ga}from"@xyflow/react";import{orderBy as Ea}from"lodash";var la={MIN_WIDTH:36,MIN_HEIGHT:36},da={MIN_WIDTH:36,MIN_HEIGHT:36},ca={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},pa={MIN_WIDTH:128,MIN_HEIGHT:64},O={START_EVENT:la,END_EVENT:da,GATEWAY:ca,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:pa};import{orderBy as ma}from"lodash";var re=e=>{var t,o,r,n,i,a,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(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=>ma(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),bo=(e,t)=>{let{x:o,y:r}=re(e),{x:n,y:i}=re(t);return{x:o-n,y:r-i}};var Ne=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ua=(e,t)=>{let{x:o,y:r}=re(e),{x:n,y:i}=re(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},fa=(e,t)=>{let{x:o,y:r,w:n,h:i}=re(e),{x:a,y:s,w:l,h:d}=re(t);return o<a+l&&a<o+n&&r<s+d&&s<r+i},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&fa(e,n)){let i=ua(e,n);i<r&&(r=i,o=n)}return o},ho=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var No=(e=[],t=[],o="LR")=>{let r=new vo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),vo.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return T(v({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},fe=(e,t)=>{var p,g;let o=[...t],r=o.find(E=>E.id===e);if(!r)return o;let n=o.filter(E=>E.parentId===e&&E.type==="LANE");if(n.length===0)return o;let i=Ea(n,["position.y"]),a=Math.max((g=(p=r.measured)==null?void 0:p.width)!=null?g:0,tt.MIN_WIDTH),s=ho(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),d=0,b=0;i.forEach(E=>{var x,u,f,c;o=o.map(N=>N.id===E.id?T(v({},N),{width:l-Y.HEADER_WIDTH,measured:T(v({},N.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):N),d+=(u=(x=E.measured)==null?void 0:x.height)!=null?u:0,b+=(c=(f=E.measured)==null?void 0:f.height)!=null?c:0}),o=o.map(E=>E.id===e?T(v({},E),{height:b,width:l,measured:T(v({},E.measured),{height:b,width:l})}):E);let m=o.find(E=>E.id===e);return m!=null&&m.parentId&&(o=fe(m.parentId,o)),o},yo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ba=50,To=(e,t=ba)=>{let o=ga(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as ha}from"zustand";var G=ha(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));import{addEdge as So,useReactFlow as ei}from"@xyflow/react";import{BaseEdge as Ha,EdgeLabelRenderer as Ba,getStraightPath as za,useNodes as Fa,useViewport as Ua}from"@xyflow/react";import{getIncomers as rt,getOutgoers as zt,useReactFlow as xa}from"@xyflow/react";import{Button as _a,Tooltip as wa,TooltipContent as Ca,TooltipTrigger as Ia,useTranslation as Aa}from"lecom-ui";import{PencilIcon as ka}from"lucide-react";import{createContext as va,useContext as Na}from"react";var xo=va(null),ya=xo.Provider,_o=()=>{let e=Na(xo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as La}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Aa(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=xa(),{onConfigureElement:s}=_o(),l=c=>{let N=i(),I=a(),y=rt(c,N,I),k=zt(c,N,I),h=y.some(L=>L.type==="START_EVENT"),w=k.some(L=>L.type==="END_EVENT");return h?"start":w?"end":"between"},d=c=>{var L,C,S;let N=i(),I=a(),y=r(c.source),k=r(c.target);if(!y||!k)return"simple";if(zt(y,N,I).some(_=>_.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((L=y.data)==null?void 0:L.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let _=(C=y.data)==null?void 0:C.variant,M=(S=y.data)==null?void 0:S.attribute;return _==="SCRIPT"?"script":M==="LOOP"?"loop":"simple"}return"simple"},b=c=>{var L;let N=r(c.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="COMPLEX")return;let I=i(),y=a(),k=rt(N,I,y),h=!1,w=!1;if(k.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),h&&w)return"script_loop";if(h)return"script";if(w)return"loop"},m=c=>{var L;let N=r(c.source);if(!N||N.type!=="GATEWAY"||((L=N.data)==null?void 0:L.variant)!=="EXCLUSIVE")return;let I=i(),y=a(),k=rt(N,I,y),h=!1,w=!1;if(k.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(h=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),h)return"script";if(w)return"loop"},p=c=>{var w,L;if(c.type!=="GATEWAY")return;let N=i(),I=a(),y=rt(c,N,I),k=!1,h=!1;if(y.forEach(C=>{var S,_;C.type==="TASK"&&(((S=C.data)==null?void 0:S.variant)==="SCRIPT"&&(k=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(h=!0))}),((w=c.data)==null?void 0:w.variant)==="COMPLEX"){if(k&&h)return"script_loop";if(k)return"script";if(h)return"loop"}else if(((L=c.data)==null?void 0:L.variant)==="EXCLUSIVE"){if(k)return"script";if(h)return"loop"}},g=c=>zt(c,i(),a()).map(y=>{var k,h;return{id:y.id,type:y.type,variant:(k=y.data)==null?void 0:k.variant,label:(h=y.data)==null?void 0:h.label}}),E=c=>a().filter(y=>y.source===c.id).map(y=>{var k;return{id:y.id,type:"routing",variant:d(y),label:(k=y.data)==null?void 0:k.label}}),x=()=>{var N,I,y,k;let c=r(e);if(c){if(c.type!=="GATEWAY"){s==null||s({id:c.id,type:"activity",variant:l(c),label:(N=c.data)==null?void 0:N.label,targets:g(c),edgeTargets:E(c)}),console.log({id:c.id,type:"activity",variant:l(c),label:(I=c.data)==null?void 0:I.label,targets:g(c),edgeTargets:E(c)});return}s==null||s({id:c.id,type:"gateway",variant:((y=c.data)==null?void 0:y.variant)||"EXCLUSIVE",label:(k=c.data)==null?void 0:k.label,subVariant:p(c),targets:g(c)})}},u=()=>{let c=n(e);if(c){let N=d(c),I;N==="complex"?I=b(c):N==="exclusive"&&(I=m(c)),s==null||s({id:c.id,type:"routing",variant:N,subVariant:I})}};return La(wa,{children:[nt(Ia,{asChild:!0,children:nt(_a,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":x();break;case"edge":u();break}},children:nt(ka,{size:16})})}),nt(Ca,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Sa}from"@xyflow/react";import{Button as Pa,Tooltip as Da,TooltipContent as Ra,TooltipTrigger as Ma,useTranslation as Va}from"lecom-ui";import{TrashIcon as Oa}from"lucide-react";import{jsx as it,jsxs as Ga}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=Va(),{deleteElements:r}=Sa();return Ga(Da,{children:[it(Ma,{asChild:!0,children:it(Pa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Oa,{size:16})})}),it(Ra,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as lt}from"react/jsx-runtime";var ye=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=be(n,["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",T(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,d)=>lt("div",{children:l.component},d))}))};import{jsx as ct,jsxs as Wa}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let d=Fa(),{zoom:b}=Ua(),m=d.find(c=>c.id===t),p=d.find(c=>c.id===o),[g,E,x]=za({sourceX:r,sourceY:n,targetX:i,targetY:a}),u=s||(m==null?void 0:m.selected)||(p==null?void 0:p.selected),f=1/b;return Wa("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[ct(Ha,{id:e,path:g,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":u&&!(l!=null&&l.hasError)})}),ct(Ba,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${E}px, ${x}px)`},children:s&&ct(ye,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${f})`}})})})]})};import{BaseEdge as Za,EdgeLabelRenderer as $a,getSmoothStepPath as Xa,MarkerType as Ao,useNodes as qa,useReactFlow as ja,useViewport as Ja}from"@xyflow/react";import{useState as Qa}from"react";import{useEffect as Co,useRef as Ya,useState as Ka}from"react";import{jsx as Io}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=Ya(null),[l,d]=Ka(!1);Co(()=>{d(r!=null?r:!1)},[r]),Co(()=>{if(l&&s.current){s.current.focus();let g=document.createRange();g.selectNodeContents(s.current),g.collapse(!1);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(g))}},[l]);let b=g=>{g.stopPropagation(),d(!0)},m=g=>{let E=g.currentTarget.innerText;t&&E.length>=t&&g.preventDefault()},p=g=>{d(!1),n==null||n(),o==null||o(g.currentTarget.innerText)};return Io("div",{className:A("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:b,children:Io("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:m,onBlur:p,children:e})})};import{jsx as mt,jsxs as ko}from"react/jsx-runtime";var le={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Ao.ArrowClosed},markerEnd:{type:Ao.Arrow},data:{label:""}},Lo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:b})=>{let m=qa(),{zoom:p}=Ja(),{updateEdgeData:g}=ja(),[E,x]=Qa(!1),u=m.find(_=>_.id===t),f=m.find(_=>_.id===o),[c,N,I]=Xa({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),y=b||(u==null?void 0:u.selected)||(f==null?void 0:f.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,w=1/p,L=()=>{x(!0)},C=()=>{x(!1)},S=_=>{g(e,{label:_.trim()})};return ko("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:C,onDoubleClick:L,children:[mt(Za,{id:e,path:c,markerEnd:`url(#${k})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(d!=null&&d.hasError)})}),mt($a,{children:ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[b&&mt(ye,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${w})`}}),h&&mt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};var Po=({setEdges:e})=>{let{getNode:t}=ei();return{isValidConnection:n=>{let i=t(n.source),a=t(n.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:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?So(v(v({},n),pt),i):So(v(v({},n),le),i)})}}};import{useState as zo}from"react";import{useTranslation as ti}from"lecom-ui";import{useReactFlow as oi}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ge=(e=[])=>e.filter(t=>t.type==="END_EVENT"),de=(e=[])=>e.filter(t=>t.type==="TASK")||[],Do=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ro=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Mo=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),$=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Vo=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Oo=(e,t)=>{let o=$(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Go=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},ee=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Ho=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=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 r=$(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.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=de(e.nodes),o=ee(t,r=>$(r.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=ee(t,r=>!!r.label&&r.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=de(e.nodes),r=ee(o,n=>!n.label||n.label.length<=60);return P({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return P({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let i=$(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let i=$(n.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(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ge(e.nodes),o=[],r=[];for(let n of t){let i=Me(n.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=$(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Mo(e.nodes),o=ee(t,n=>$(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>$(n,e.edges).map(i=>i.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=de(e.nodes),o=ee(t,r=>!r.label||Go(r.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 n=de(e.nodes).filter(l=>o.some(d=>d.source===l.id)),i=ee(n,l=>!Vo(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=de(e.nodes),o=ge(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),b=$(l.id,e.edges),m=d.some(g=>{var E;return((E=e.nodes.find(x=>x.id===g.source))==null?void 0:E.type)==="START_EVENT"}),p=b.some(g=>{var E;return((E=e.nodes.find(x=>x.id===g.target))==null?void 0:E.type)==="END_EVENT"});return m&&p}),n=Me(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let i=$(n.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(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=ee(t,r=>$(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let i=$(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Do(e.nodes),o=ee(t,r=>!Oo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ro(e.nodes),o=ee(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Bo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Fo=()=>{let{t:e}=ti(),[t,o]=zo(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=oi(),[s,l]=zo(!1);return{validationResult:t,validateDiagram:p=>{let g=Ho(p.nodes,p.edges),E=Bo(g),x=E.errors.map(u=>T(v({},u),{message:e(`validation.errors.${u.id}`)}));return s||l(!0),{isValid:E.isValid,errors:x}},handleValidationComplete:p=>{if(o(p),!p)return;let g=[],E=[];p.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(w=>g.push(w)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(w=>E.push(w))});let x=[...new Set(g)];r(h=>h.map(w=>T(v({},w),{data:T(v({},w.data),{hasError:!1})}))),n(h=>h.map(w=>T(v({},w),{data:T(v({},w.data),{hasError:!1})})));let u=i(),f=a(),c=new Set(x),N=new Set;p.errors.forEach(h=>{var C,S;let w=Ve.find(_=>_.id===h.id);(w==null?void 0:w.highlightRelatedEdges)!==!1&&((C=h.edgeIds)==null||C.forEach(_=>N.add(_)),(S=h.nodeIds)==null||S.forEach(_=>{f.forEach(M=>{(M.source===_||M.target===_)&&N.add(M.id)})}))});let I=new Set,y=new Set,k=new Set;u.forEach(h=>{h.type==="START_EVENT"?I.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),f.forEach(h=>{I.has(h.source)&&k.add(h.target),y.has(h.target)&&k.add(h.source)}),k.forEach(h=>{var w,L;if(c.has(h)){let C=(w=p.errors.find(_=>{var M;return(M=_.nodeIds)==null?void 0:M.includes(h)}))==null?void 0:w.id;((L=Ve.find(_=>_.id===C))==null?void 0:L.highlightRelatedEdges)!==!1&&f.forEach(_=>{_.source===h&&y.has(_.target)&&(c.add(_.target),N.add(_.id)),_.target===h&&I.has(_.source)&&(c.add(_.source),N.add(_.id))})}}),c.size>0&&r(h=>h.map(w=>T(v({},w),{data:T(v({},w.data),{hasError:c.has(w.id)})}))),N.size>0&&n(h=>h.map(w=>T(v({},w),{data:T(v({},w.data),{hasError:N.has(w.id)})})))},clearValidation:()=>{o(null),l(!1),r(p=>p.map(g=>T(v({},g),{data:T(v({},g.data),{hasError:!1})}))),n(p=>p.map(g=>T(v({},g),{data:T(v({},g.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as ri}from"@xyflow/react";import{useEffect as ni}from"react";import{v7 as Uo}from"uuid";var ai=15,Wo="bpmn:selection",Yo=({offset:e=ai}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=ri();ni(()=>{let i=s=>{var g;s.preventDefault();let l=t(),d=r(),b=l.filter(E=>E.selected);if(!b.length)return;let m=d.filter(E=>b.some(x=>x.id===E.source)&&b.some(x=>x.id===E.target)),p={nodes:b,edges:m};(g=s.clipboardData)==null||g.setData(Wo,JSON.stringify(p))},a=s=>{var p,g;s.preventDefault();let l=JSON.parse(((p=s.clipboardData)==null?void 0:p.getData(Wo))||"{}");if(!((g=l.nodes)!=null&&g.length))return;let d=new Map,b=l.nodes.map(E=>{let x=Uo();return d.set(E.id,x),T(v({},E),{id:x,selected:!0,position:{x:E.position.x+e,y:E.position.y+e}})}),m=l.edges.map(E=>T(v({},E),{id:Uo(),selected:!0,source:d.get(E.source)||E.source,target:d.get(E.target)||E.target}));o(E=>[...E.map(x=>T(v({},x),{selected:!1})),...b]),n(E=>[...E.map(x=>T(v({},x),{selected:!1})),...m])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};import{useReactFlow as Ei,useStoreApi as bi}from"@xyflow/react";import{v7 as qo}from"uuid";import{create as ii}from"zustand";var Te=ii(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as si,EdgeLabelRenderer as li,getSmoothStepPath as di,MarkerType as ci,useNodes as pi,useReactFlow as mi,useViewport as ui}from"@xyflow/react";import{useState as fi}from"react";import{jsx as ft,jsxs as Ko}from"react/jsx-runtime";var Gm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:ci.Arrow},data:{label:""}},Zo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:b})=>{let m=pi(),{zoom:p}=ui(),{updateEdgeData:g}=mi(),[E,x]=fi(!1),u=m.find(_=>_.id===t),f=m.find(_=>_.id===o),[c,N,I]=di({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),y=b||(u==null?void 0:u.selected)||(f==null?void 0:f.selected),k=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=E||(d==null?void 0:d.label.trim().length)>0,w=1/p,L=()=>{x(!0)},C=()=>{x(!1)},S=_=>{g(e,{label:_.trim()})};return Ko("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:C,onDoubleClick:L,children:[ft(si,{id:e,path:c,markerEnd:`url(#${k})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(d!=null&&d.hasError)})}),ft(li,{children:Ko("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[b&&ft(ye,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${w})`}}),h&&ft(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:E,onChange:S})]})})]})};import{jsx as $o,jsxs as gi}from"react/jsx-runtime";var Xo=({fromX:e,fromY:t,toX:o,toY:r})=>gi("g",{children:[$o("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),$o("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var jo=({nodes:e,setNodes:t,setEdges:o})=>{let r=bi(),{draggableNode:n,setDraggableNode:i}=Te(),{getInternalNode:a,screenToFlowPosition:s}=Ei(),l=u=>{let f="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(c=>c.map(N=>T(v({},N),{className:N.id===u?f:""})))},d=()=>{let{nodeLookup:u}=r.getState();return Array.from(u.values())},b=u=>{let f=a(u.id),c=d();if(u.type==="LANE"){if(Ne({parentId:u.id,nodes:e,includeTypes:["LANE"]})){l();return}let w=c.filter(S=>S.id!==u.id&&S.type==="LANE"&&!S.parentId),L=Pe(f,w);if(!L){l();return}if(Ne({parentId:L.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(L.id);return}let I=c.filter(h=>h.id!==u.id&&h.type==="LANE"),y=Pe(f,I);if(!y){l();return}if(Ne({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},m=u=>{u.preventDefault(),u.dataTransfer.dropEffect="move"},p=(u,f)=>{u.preventDefault(),b(f)},g=(u,f,c)=>{var w,L;let N=C=>C.map(S=>T(v({},S),{className:void 0}));if(u.parentId===f.id){let C=fe(f.id,c);t(ne(N(C)));return}if(u.type==="LANE"){if(Ne({parentId:f.id,nodes:c,excludeTypes:["LANE"]}))return;let _=c.filter(F=>F.parentId===f.id).reduce((F,ie)=>{var me,ue;return F+((ue=(me=ie.measured)==null?void 0:me.height)!=null?ue:0)},0),M={x:Y.HEADER_WIDTH,y:_},K=c.map(F=>F.id===u.id?T(v({},F),{parentId:f.id,position:M,className:void 0}):T(v({},F),{className:void 0}));K=fe(f.id,K),t(ne(K));return}if(Ne({parentId:f.id,nodes:c,includeTypes:["LANE"]})){let C;if(u.parentId){let _=a(u.parentId),{x:M,y:K}=re(_);C={x:M+((w=u.position.x)!=null?w:0),y:K+((L=u.position.y)!=null?L:0)}}let S=c.map(_=>_.id===u.id?T(v({},_),{position:C!=null?C:_.position,parentId:void 0,className:void 0}):T(v({},_),{className:void 0}));t(ne(S));return}let k=bo(u,f),h=c.map(C=>C.id===u.id?T(v({},C),{parentId:f.id,position:k,className:void 0}):T(v({},C),{className:void 0}));t(ne(h))};return{onDragOver:m,onDrop:u=>{if(u.preventDefault(),!(n!=null&&n.type))return;let f=s({x:u.clientX,y:u.clientY}),c={width:O[n.type].MIN_WIDTH,height:O[n.type].MIN_HEIGHT},N={id:qo(),type:n.type,position:f,measured:c,data:{label:"",variant:n.variant,attribute:n.attribute}},I=T(v({},N),{internals:{positionAbsolute:f}}),y=d(),k=n.type==="LANE",h=y.filter(C=>k?C.type==="LANE"&&!C.parentId:C.type==="LANE"),w=Pe(I,h);w?g(I,w,[...y,I]):t(C=>{let S=C.concat(N);return ne(S)});let L=u.dataTransfer.getData("sourceId");if(L){let C={id:qo(),source:L,target:N.id};if(n.type==="ANNOTATION"){o(S=>S.concat(v(v({},C),pt)));return}o(S=>S.concat(v(v({},C),le)))}i(null)},onNodeDrag:p,onNodeDragStop:async(u,f)=>{var w,L;let{nodeLookup:c}=r.getState(),N=a(f.id),I=Array.from(c.values()),y=f.type==="LANE",k=I.filter(C=>C.id!==f.id&&(y?C.type==="LANE"&&!C.parentId:C.type==="LANE")),h=Pe(N,k);if(h){g(N,h,I);return}if(f.parentId){let C=a(f.parentId),{x:S,y:_}=re(C),M={x:S+((w=f.position.x)!=null?w:0),y:_+((L=f.position.y)!=null?L:0)},K=e.map(F=>F.id===f.id?T(v({},F),{position:M,parentId:void 0}):F);K=fe(f.parentId,K),t(ne(K))}}}};import{applyNodeChanges as hi}from"@xyflow/react";import{useCallback as vi,useState as Qo}from"react";function Jo(e,t,o=5){var l,d,b,m,p,g,E,x;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(u=>u.id===e.id);if(!n||!e.position)return r;let i={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((m=(b=n.measured)==null?void 0:b.height)!=null?m:0),width:(g=(p=n.measured)==null?void 0:p.width)!=null?g:0,height:(x=(E=n.measured)==null?void 0:E.height)!=null?x:0},a=o,s=o;return t.filter(u=>u.id!==n.id).reduce((u,f)=>{var S,_,M,K,F,ie,me,ue;let c={left:f.position.x,right:f.position.x+((_=(S=f.measured)==null?void 0:S.width)!=null?_:0),top:f.position.y,bottom:f.position.y+((K=(M=f.measured)==null?void 0:M.height)!=null?K:0),width:(ie=(F=f.measured)==null?void 0:F.width)!=null?ie:0,height:(ue=(me=f.measured)==null?void 0:me.height)!=null?ue:0},N=Math.abs(i.left-c.left);N<s&&(u.snapPosition.x=c.left,u.vertical=c.left,s=N);let I=Math.abs(i.right-c.right);I<s&&(u.snapPosition.x=c.right-i.width,u.vertical=c.right,s=I);let y=Math.abs(i.left-c.right);y<s&&(u.snapPosition.x=c.right,u.vertical=c.right,s=y);let k=Math.abs(i.right-c.left);k<s&&(u.snapPosition.x=c.left-i.width,u.vertical=c.left,s=k);let h=Math.abs(i.top-c.top);h<a&&(u.snapPosition.y=c.top,u.horizontal=c.top,a=h);let w=Math.abs(i.bottom-c.top);w<a&&(u.snapPosition.y=c.top-i.height,u.horizontal=c.top,a=w);let L=Math.abs(i.bottom-c.bottom);L<a&&(u.snapPosition.y=c.bottom-i.height,u.horizontal=c.bottom,a=L);let C=Math.abs(i.top-c.bottom);return C<a&&(u.snapPosition.y=c.bottom,u.horizontal=c.bottom,a=C),u},r)}var er=()=>{let[e,t]=Qo(void 0),[o,r]=Qo(void 0),n=vi((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let d=Jo(i[0],a);i[0].position.x=(s=d.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=d.snapPosition.y)!=null?l:i[0].position.y,t(d.horizontal),r(d.vertical)}return hi(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as yi}from"@xyflow/react";import{v7 as ar}from"uuid";var or={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},rr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},tr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],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 r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[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}},Ni=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=tr(i[0],o),s=tr(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},nr=e=>{let{components:t,connections:o}=Ni(e);return{nodes:t,edges:o}};var ir=()=>{let{setNodes:e,setEdges:t,fitView:o}=yi();return{createDiagram:n=>{let{nodes:i,edges:a}=nr(n),s=[],l=new Map;for(let[p,g]of Object.entries(i)){let E=ar(),x=or[g.type],u=rr[g.type];l.set(p,E);let f=O[x].MIN_WIDTH,c=O[x].MIN_HEIGHT;s.push({id:E,type:x,data:{label:g.label||"",variant:u,attribute:""},position:{x:0,y:0},width:f,height:c,measured:{width:f,height:c}})}let d=[];for(let p of a){let g=T(v({},le),{id:ar(),source:l.get(p.sourceId)||p.sourceId,target:l.get(p.targetId)||p.targetId});d.push(g)}let{nodes:b,edges:m}=No(s,d);e(b),t(m),o()}}};import{useEffect as Ti,useCallback as xi}from"react";var _i={origin:"*",debug:!1};function sr(e,t=_i){let{origin:o,debug:r}=t,n=xi((i,a)=>{r&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,r]);return Ti(()=>{let i=a=>{let{type:s,data:l}=a.data||{};r&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,r]),{sendMessage:n}}import{useReactFlow as wi}from"@xyflow/react";import{useCallback as Oe,useState as lr}from"react";import{useDebouncedCallback as Ci}from"use-debounce";var Ii={nodes:[],edges:[]},Ai=500,dr=10,cr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=wi(),[n,i]=lr([Ii]),[a,s]=lr(0),l=n[a],d=a>0,b=a<n.length-1,m=Oe(c=>{o(n[c].nodes),r(n[c].edges)},[n,o,r]),p=Oe(()=>{if(a>0){let c=a-1;s(c),m(c)}},[a,m]),g=Oe(()=>{if(a<n.length-1){let c=a+1;s(c),m(c)}},[n,a,m]),E=c=>{let I=[...n.slice(0,a+1),c],y=I.length>dr?I.slice(I.length-dr):I;i(y),s(y.length-1)},x=Ci(()=>{let c=e(),N=t(),I={nodes:c,edges:N};JSON.stringify(l)!==JSON.stringify(I)&&E(I)},Ai),u=Oe(c=>{if(c==="forceSave"){x();return}c.some(I=>I.type!=="select")&&x()},[x]),f=Oe(()=>{i([]),s(0)},[]);return{undo:p,redo:g,saveHistory:u,canUndo:d,canRedo:b,clearHistory:f}};import{jsx as pr}from"react/jsx-runtime";var Ft=({id:e,className:t})=>pr("marker",{id:e,className:A("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:pr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Ut,jsxs as ki}from"react/jsx-runtime";var mr=()=>Ut("svg",{style:{position:"absolute",top:0,left:0},children:ki("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 Lr}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as _s}from"lecom-ui";import{HandIcon as ws,ListCheckIcon as Cs,MapIcon as Is,MousePointerIcon as As}from"lucide-react";import{useCallback as ks,useEffect as Sr}from"react";import{useStore as Li}from"@xyflow/react";var Si=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=Li(Si);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as os,TooltipContent as rs,TooltipTrigger as ns,useNotificationToast as as,useTranslation as is}from"lecom-ui";var Ge=(f=>(f.START_EVENT="START_EVENT",f.END_EVENT="END_EVENT",f.TASK="TASK",f.SUBPROCESS="SUBPROCESS",f.GATEWAY="GATEWAY",f.ANNOTATION="ANNOTATION",f.CONNECTION="CONNECTION",f.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",f.ACTIVITY="ACTIVITY",f.PROCESS_INTERFACE="PROCESS_INTERFACE",f.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",f.VARIANT_ACTIVITY="VARIANT_ACTIVITY",f.AUTO_ACTIVITY="AUTO_ACTIVITY",f.DATA_STORE="DATA_STORE",f.DATA_OBJECT="DATA_OBJECT",f.DATA_OUTPUT="DATA_OUTPUT",f.DATA_INPUT="DATA_INPUT",f))(Ge||{});import{useReactFlow as Zi}from"@xyflow/react";import{useNotificationToast as $i,useTranslation as Xi,Button as qi}from"lecom-ui";var ur=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var i;t((i=n.target)==null?void 0:i.result)},r.onerror=n=>{var i;o((i=n.target)==null?void 0:i.error)},r.readAsText(e)});function fr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
3
- `),i=encodeURI(n);Et(i,`${o}.csv`)}var Et=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};import{v7 as Fi}from"uuid";import{xml2json as Pi,json2xml as Yu}from"xml-js";var Di={compact:!0,spaces:4},Ri=e=>e.replaceAll(`
4
- `,"&#xA;");function gr(e,t=Di){if(e)return JSON.parse(Pi(e,T(v({},t),{attributeValueFn:Ri})))}function Er(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Vi}from"uuid";var ju={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},br={script:"SCRIPT",subprocess:"SUBPROCESS"},hr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var xe=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:i}=r,a=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},Oi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=O.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.START_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Gi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=O.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=O.END_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Hi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=br[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,O.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,O.TASK.MIN_HEIGHT),{node:xe({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Bi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=hr[o],n=["none","inclusive","event-based"],i="imported";return n.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=O.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=O.GATEWAY.MIN_HEIGHT,{node:xe({cell:e,type:"GATEWAY",variant:r}),status:i,originalType:t}},zi=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:xe({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},vr=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:xe({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Nr=(e,t)=>{let{source:o,target:r}=e._attributes;return T(v({},le),{id:Vi(),source:t.get(o)||o,target:t.get(r)||r})},yr={TASK:Hi,GATEWAY:Bi,START_EVENT:Oi,END_EVENT:Gi,ANNOTATION:zi};var Ui=e=>{var a;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],i=[];for(let s of r){let l=Fi(),{type:d}=s._attributes,b=yr[d]||vr;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:m,status:p,originalType:g}=b(s);n.push(m),i.push({originalType:g,type:m.type,variant:m.data.variant,value:Er(m.data.label),status:p})}return{nodes:n,governanceIdToNodeIdMap:t,summary:i}},Wi=(e,t)=>e.filter(n=>{var i;return(i=n._attributes)==null?void 0:i.edge}).map(n=>Nr(n,t)),Yi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Ui(t.root.mxCell),i=Wi(t.root.mxCell,r);return{nodes:o,edges:i,summary:n}},Ki=async e=>{let t=await ur(e),o=gr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},i=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),a=n==null?void 0:n.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Tr=async e=>{try{let t=await Ki(e),{nodes:o,edges:r,summary:n}=Yi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as ji}from"react/jsx-runtime";var xr=()=>{let{t:e}=Xi(),{toast:t}=$i(),{setNodes:o,setEdges:r,fitView:n}=Zi(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=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:ji(qi,{size:"small",variant:"ghost",onClick:()=>fr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:b}=await Tr(s);if(o(p=>p.concat(l)),r(p=>p.concat(d)),n(),b.some(p=>p.status==="unsupported")){i(b);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as Ji}from"lecom-ui";import{useRef as Qi}from"react";import{Fragment as es,jsx as _r,jsxs as ts}from"react/jsx-runtime";var wr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:i}=l,a=be(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=Qi(null),b=p=>{let g=p.target.files;g!=null&&g.length&&i(g),d.current&&(d.current.value="")};return ts(es,{children:[_r(Ji,T(v({onClick:p=>{var g;(g=d.current)==null||g.click(),n==null||n(p)}},a),{children:e})),_r("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:b})]})};import{jsx as bt,jsxs as ss}from"react/jsx-runtime";var Cr=({disabled:e=!1})=>{let{t}=is(),{toast:o}=as(),{createDiagram:r}=xr(),n=()=>{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}r(s)};return ss(os,{children:[bt(ns,{asChild:!0,children:bt(wr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:i,children:bt(so,{})})}),bt(rs,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as fs,DropdownMenu as gs,DropdownMenuContent as Es,DropdownMenuItem as Yt,DropdownMenuTrigger as bs,Tooltip as ht,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as hs}from"lecom-ui";import{FileCodeIcon as vs,FileImageIcon as Ns,FolderOutputIcon as ys,PrinterIcon as Ts}from"lucide-react";import{useState as xs}from"react";import{useReactFlow as ls}from"@xyflow/react";import{toPng as Ir,toSvg as ds}from"html-to-image";import{toast as cs,useTranslation as ps}from"lecom-ui";import{useState as ms}from"react";var us=3,Wt="diagram",Ar=()=>{let{t:e}=ps(),{getNodes:t}=ls(),{deselectAll:o}=gt(),[r,n]=ms({png:!1,html:!1,print:!1}),i=()=>{let{x:b,y:m,width:p,height:g}=To(t());return{width:p,height:g,style:{width:`${p}px`,height:`${g}px`,transform:`translate(${-b}px, ${-m}px)`}}},a=async(b,m)=>{n(T(v({},r),{[m]:!0})),await o();try{let p=yo();if(!p)throw new Error("Flow element not found");let g=i();return await b(p,g)}catch(p){cs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(T(v({},r),{[m]:!1}))}};return{exportAsPng:async(b=Wt)=>{await a(async(m,p)=>{let g=await Ir(m,T(v({},p),{backgroundColor:"#fcfcfc"}));Et(g,`${b}.png`)},"png")},exportAsHtml:async(b=Wt)=>{await a(async(m,p)=>{let g=await ds(m,T(v({},p),{backgroundColor:"#fcfcfc"})),E=`
1
+ var Zn=Object.defineProperty,$n=Object.defineProperties;var Xn=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var io=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable;var ao=(e,t,o)=>t in e?Zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))io.call(t,o)&&ao(e,o,t[o]);if(We)for(var o of We(t))so.call(t,o)&&ao(e,o,t[o]);return e},x=(e,t)=>$n(e,Xn(t));var Ee=(e,t)=>{var o={};for(var r in e)io.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&so.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as qn,Notification as jn}from"lecom-ui";import{jsx as Jn,jsxs as Qn}from"react/jsx-runtime";function lo({children:e}){return Qn(qn,{children:[Jn(jn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as wd,Background as Cd,MiniMap as Id,ReactFlow as Ad,ReactFlowProvider as kd,SelectionMode as Sd,useEdgesState as Ld,useNodesState as Pd,useOnSelectionChange as Dd,useReactFlow as Rd}from"@xyflow/react";import{i18n as Md}from"lecom-ui";import{useCallback as jt,useEffect as Qt,useRef as Vd,useState as Od}from"react";import{useDebouncedCallback as Gd}from"use-debounce";var Lt=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r))(Lt||{}),Pt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Pt||{}),Dt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Dt||{}),Rt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Rt||{}),Mt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Mt||{});import{RotateCcw as pa,ScrollText as ma,SquarePlus as ua}from"lucide-react";import{jsx as Ye,jsxs as ea}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>ea("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 co}from"react/jsx-runtime";var be=({size:e=24,className:t})=>co("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:co("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ae,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:[Ae("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt,jsxs as oa}from"react/jsx-runtime";var he=({size:e=24,className:t})=>oa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[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 ra}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>ra("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[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 na}from"react/jsx-runtime";var po=({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:na("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 aa}from"clsx";import{twMerge as ia}from"tailwind-merge";function A(...e){return ia(aa(e))}var ke=(e,t)=>e<t?t:e;import{jsx as mo,jsxs as sa}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>sa("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:A("stroke-2",t),children:[mo("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"}),mo("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var fo=({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 Xe=({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 Eo}from"react/jsx-runtime";var Se=({size:e=24,className:t})=>Eo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:A("stroke-2",t),children:Eo("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 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:[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 Le,jsxs as da}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>da("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Le("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as qe,jsxs as ca}from"react/jsx-runtime";var vo=({size:e=24,className:t})=>ca("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[qe("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),qe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),qe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(D||{});var je={SCRIPT:{icon:ma},SUBPROCESS:{icon:ua}};var Je={LOOP:{icon:pa}},ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ie||{}),Qe={EXCLUSIVE:{icon:he},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import To from"@dagrejs/dagre";import{getNodesBounds as ya}from"@xyflow/react";import{orderBy as Ta}from"lodash";var fa={MIN_WIDTH:36,MIN_HEIGHT:36},ga={MIN_WIDTH:36,MIN_HEIGHT:36},Ea={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},ba={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:fa,END_EVENT:ga,GATEWAY:Ea,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:ba};import{orderBy as ha}from"lodash";var re=e=>{var t,o,r,n,i,a,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(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"]),No=(e,t)=>{let{x:o,y:r}=re(e),{x:n,y:i}=re(t);return{x:o-n,y:r-i}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),va=(e,t)=>{let{x:o,y:r}=re(e),{x:n,y:i}=re(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},Na=(e,t)=>{let{x:o,y:r,w:n,h:i}=re(e),{x:a,y:s,w:l,h:d}=re(t);return o<a+l&&a<o+n&&r<s+d&&s<r+i},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&Na(e,n)){let i=va(e,n);i<r&&(r=i,o=n)}return o},yo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var xo=(e=[],t=[],o="LR")=>{let r=new To.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),To.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return x(v({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},me=(e,t)=>{var m,f;let o=[...t],r=o.find(u=>u.id===e);if(!r)return o;let n=o.filter(u=>u.parentId===e&&u.type==="LANE");if(n.length===0)return o;let i=Ta(n,["position.y"]),a=Math.max((f=(m=r.measured)==null?void 0:m.width)!=null?f:0,tt.MIN_WIDTH),s=yo(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),d=0,b=0;i.forEach(u=>{var y,g,E,c;o=o.map(N=>N.id===u.id?x(v({},N),{width:l-Y.HEADER_WIDTH,measured:x(v({},N.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):N),d+=(g=(y=u.measured)==null?void 0:y.height)!=null?g:0,b+=(c=(E=u.measured)==null?void 0:E.height)!=null?c:0}),o=o.map(u=>u.id===e?x(v({},u),{height:b,width:l,measured:x(v({},u.measured),{height:b,width:l})}):u);let p=o.find(u=>u.id===e);return p!=null&&p.parentId&&(o=me(p.parentId,o)),o},_o=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},xa=50,wo=(e,t=xa)=>{let o=ya(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as _a}from"zustand";var O=_a(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));import{addEdge as Mo,useReactFlow as ai}from"@xyflow/react";import{BaseEdge as Wa,EdgeLabelRenderer as Ya,getStraightPath as Ka,useNodes as Za,useViewport as $a}from"@xyflow/react";import{getIncomers as rt,getOutgoers as zt,useReactFlow as Aa}from"@xyflow/react";import{Button as ka,Tooltip as Sa,TooltipContent as La,TooltipTrigger as Pa,useTranslation as Da}from"lecom-ui";import{PencilIcon as Ra}from"lucide-react";import{createContext as wa,useContext as Ca}from"react";var Co=wa(null),Io=Co.Provider,Ao=()=>{let e=Ca(Co);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as Ma}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Da(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=Aa(),{onConfigureElement:s}=Ao(),l=c=>{let N=i(),I=a(),T=rt(c,N,I),k=zt(c,N,I),h=T.some(S=>S.type==="START_EVENT"),w=k.some(S=>S.type==="END_EVENT");return h?"start":w?"end":"between"},d=c=>{var S,C,L;let N=i(),I=a(),T=r(c.source),k=r(c.target);if(!T||!k)return"simple";if(zt(T,N,I).some(_=>_.type==="END_EVENT"))return"final";if(T.type==="GATEWAY")switch((S=T.data)==null?void 0:S.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(T.type==="TASK"){let _=(C=T.data)==null?void 0:C.variant,M=(L=T.data)==null?void 0:L.attribute;return _==="SCRIPT"?"script":M==="LOOP"?"loop":"simple"}return"simple"},b=c=>{var S;let N=r(c.source);if(!N||N.type!=="GATEWAY"||((S=N.data)==null?void 0:S.variant)!=="COMPLEX")return;let I=i(),T=a(),k=rt(N,I,T),h=!1,w=!1;if(k.forEach(C=>{var L,_;C.type==="TASK"&&(((L=C.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),h&&w)return"script_loop";if(h)return"script";if(w)return"loop"},p=c=>{var S;let N=r(c.source);if(!N||N.type!=="GATEWAY"||((S=N.data)==null?void 0:S.variant)!=="EXCLUSIVE")return;let I=i(),T=a(),k=rt(N,I,T),h=!1,w=!1;if(k.forEach(C=>{var L,_;C.type==="TASK"&&(((L=C.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(w=!0))}),h)return"script";if(w)return"loop"},m=c=>{var w,S;if(c.type!=="GATEWAY")return;let N=i(),I=a(),T=rt(c,N,I),k=!1,h=!1;if(T.forEach(C=>{var L,_;C.type==="TASK"&&(((L=C.data)==null?void 0:L.variant)==="SCRIPT"&&(k=!0),((_=C.data)==null?void 0:_.attribute)==="LOOP"&&(h=!0))}),((w=c.data)==null?void 0:w.variant)==="COMPLEX"){if(k&&h)return"script_loop";if(k)return"script";if(h)return"loop"}else if(((S=c.data)==null?void 0:S.variant)==="EXCLUSIVE"){if(k)return"script";if(h)return"loop"}},f=c=>zt(c,i(),a()).map(T=>{var k,h;return{id:T.id,type:T.type,variant:(k=T.data)==null?void 0:k.variant,label:(h=T.data)==null?void 0:h.label}}),u=c=>a().filter(T=>T.source===c.id).map(T=>{var k;return{id:T.id,type:"routing",variant:d(T),label:(k=T.data)==null?void 0:k.label}}),y=()=>{var N,I,T,k;let c=r(e);if(c){if(c.type!=="GATEWAY"){s==null||s({id:c.id,type:"activity",variant:l(c),label:(N=c.data)==null?void 0:N.label,targets:f(c),edgeTargets:u(c)}),console.log({id:c.id,type:"activity",variant:l(c),label:(I=c.data)==null?void 0:I.label,targets:f(c),edgeTargets:u(c)});return}s==null||s({id:c.id,type:"gateway",variant:((T=c.data)==null?void 0:T.variant)||"EXCLUSIVE",label:(k=c.data)==null?void 0:k.label,subVariant:m(c),targets:f(c)})}},g=()=>{let c=n(e);if(c){let N=d(c),I;N==="complex"?I=b(c):N==="exclusive"&&(I=p(c)),s==null||s({id:c.id,type:"routing",variant:N,subVariant:I})}};return Ma(Sa,{children:[nt(Pa,{asChild:!0,children:nt(ka,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":y();break;case"edge":g();break}},children:nt(Ra,{size:16})})}),nt(La,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Va}from"@xyflow/react";import{Button as Oa,Tooltip as Ga,TooltipContent as Ha,TooltipTrigger as Ba,useTranslation as za}from"lecom-ui";import{TrashIcon as Fa}from"lucide-react";import{jsx as it,jsxs as Ua}from"react/jsx-runtime";var st=({elementId:e,elementType:t="node"})=>{let{t:o}=za(),{deleteElements:r}=Va();return Ua(Ga,{children:[it(Ba,{asChild:!0,children:it(Oa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:it(Fa,{size:16})})}),it(Ha,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as lt}from"react/jsx-runtime";var Ne=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=Ee(n,["edgeId","edgeType"]);var s;let 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,d)=>lt("div",{children:l.component},d))}))};import{jsx as ct,jsxs as Xa}from"react/jsx-runtime";var pt={type:"ANNOTATION_EDGE",zIndex:2e3},ko=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let d=Za(),{zoom:b}=$a(),p=d.find(c=>c.id===t),m=d.find(c=>c.id===o),[f,u,y]=Ka({sourceX:r,sourceY:n,targetX:i,targetY:a}),g=s||(p==null?void 0:p.selected)||(m==null?void 0:m.selected),E=1/b;return Xa("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[ct(Wa,{id:e,path:f,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(l!=null&&l.hasError)})}),ct(Ya,{children:ct("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${y}px)`},children:s&&ct(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${E})`}})})})]})};import{BaseEdge as Ja,EdgeLabelRenderer as Qa,getSmoothStepPath as ei,MarkerType as Po,useNodes as ti,useReactFlow as oi,useViewport as ri}from"@xyflow/react";import{useState as ni}from"react";import{useEffect as So,useRef as qa,useState as ja}from"react";import{jsx as Lo}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=qa(null),[l,d]=ja(!1);So(()=>{d(r!=null?r:!1)},[r]),So(()=>{if(l&&s.current){s.current.focus();let f=document.createRange();f.selectNodeContents(s.current),f.collapse(!1);let u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(f))}},[l]);let b=f=>{f.stopPropagation(),d(!0)},p=f=>{let u=f.currentTarget.innerText;t&&u.length>=t&&f.preventDefault()},m=f=>{d(!1),n==null||n(),o==null||o(f.currentTarget.innerText)};return Lo("div",{className:A("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:p,onBlur:m,children:e})})};import{jsx as mt,jsxs as Do}from"react/jsx-runtime";var se={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Po.ArrowClosed},markerEnd:{type:Po.Arrow},data:{label:""}},Ro=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:b})=>{let p=ti(),{zoom:m}=ri(),{updateEdgeData:f}=oi(),[u,y]=ni(!1),g=p.find(_=>_.id===t),E=p.find(_=>_.id===o),[c,N,I]=ei({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),T=b||(g==null?void 0:g.selected)||(E==null?void 0:E.selected),k=T?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=u||(d==null?void 0:d.label.trim().length)>0,w=1/m,S=()=>{y(!0)},C=()=>{y(!1)},L=_=>{f(e,{label:_.trim()})};return Do("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":T}),onBlur:C,onDoubleClick:S,children:[mt(Ja,{id:e,path:c,markerEnd:`url(#${k})`,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":T&&!(d!=null&&d.hasError)})}),mt(Qa,{children:Do("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[b&&mt(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${w})`}}),h&&mt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:L})]})})]})};var Vo=({setEdges:e})=>{let{getNode:t}=ai();return{isValidConnection:n=>{let i=t(n.source),a=t(n.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:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?Mo(v(v({},n),pt),i):Mo(v(v({},n),se),i)})}}};import{useState as Yo}from"react";import{useTranslation as ii}from"lecom-ui";import{useReactFlow as si}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ue=(e=[])=>e.filter(t=>t.type==="END_EVENT"),le=(e=[])=>e.filter(t=>t.type==="TASK")||[],Oo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Go=(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"),Ho=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Bo=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},zo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Fo=e=>e?/\w/g.test(e.trim()):!1,P=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Uo=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ue(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Re(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(i=>i.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.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,r=>X(r.id,e.edges).length<=2);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=le(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return P({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=le(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return P({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.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(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ue(e.nodes),o=[],r=[];for(let n of t){let i=Me(n.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=X(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return P({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Ho(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(i=>i.id));return P({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=le(e.nodes),o=Q(t,r=>!r.label||Fo(r.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=ue(e.nodes)[0];if(!t)return P({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return P({isValid:!0});let n=le(e.nodes).filter(l=>o.some(d=>d.source===l.id)),i=Q(n,l=>!Bo(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=ue(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),b=X(l.id,e.edges),p=d.some(f=>{var u;return((u=e.nodes.find(y=>y.id===f.source))==null?void 0:u.type)==="START_EVENT"}),m=b.some(f=>{var u;return((u=e.nodes.find(y=>y.id===f.target))==null?void 0:u.type)==="END_EVENT"});return p&&m}),n=Me(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return P(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let i=X(n.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(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,r=>X(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return P({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Oo(e.nodes),o=Q(t,r=>!zo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Go(e.nodes),o=Q(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return P({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Wo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Ko=()=>{let{t:e}=ii(),[t,o]=Yo(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=si(),[s,l]=Yo(!1);return{validationResult:t,validateDiagram:m=>{let f=Uo(m.nodes,m.edges),u=Wo(f),y=u.errors.map(g=>x(v({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:u.isValid,errors:y}},handleValidationComplete:m=>{if(o(m),!m)return;let f=[],u=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(w=>f.push(w)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(w=>u.push(w))});let y=[...new Set(f)];r(h=>h.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:!1})}))),n(h=>h.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:!1})})));let g=i(),E=a(),c=new Set(y),N=new Set;m.errors.forEach(h=>{var C,L;let w=Ve.find(_=>_.id===h.id);(w==null?void 0:w.highlightRelatedEdges)!==!1&&((C=h.edgeIds)==null||C.forEach(_=>N.add(_)),(L=h.nodeIds)==null||L.forEach(_=>{E.forEach(M=>{(M.source===_||M.target===_)&&N.add(M.id)})}))});let I=new Set,T=new Set,k=new Set;g.forEach(h=>{h.type==="START_EVENT"?I.add(h.id):h.type==="END_EVENT"&&T.add(h.id)}),E.forEach(h=>{I.has(h.source)&&k.add(h.target),T.has(h.target)&&k.add(h.source)}),k.forEach(h=>{var w,S;if(c.has(h)){let C=(w=m.errors.find(_=>{var M;return(M=_.nodeIds)==null?void 0:M.includes(h)}))==null?void 0:w.id;((S=Ve.find(_=>_.id===C))==null?void 0:S.highlightRelatedEdges)!==!1&&E.forEach(_=>{_.source===h&&T.has(_.target)&&(c.add(_.target),N.add(_.id)),_.target===h&&I.has(_.source)&&(c.add(_.source),N.add(_.id))})}}),c.size>0&&r(h=>h.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:c.has(w.id)})}))),N.size>0&&n(h=>h.map(w=>x(v({},w),{data:x(v({},w.data),{hasError:N.has(w.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(f=>x(v({},f),{data:x(v({},f.data),{hasError:!1})}))),n(m=>m.map(f=>x(v({},f),{data:x(v({},f.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as li}from"@xyflow/react";import{useEffect as di}from"react";import{v7 as Zo}from"uuid";var ci=15,$o="bpmn:selection",Xo=({offset:e=ci}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=li();di(()=>{let i=s=>{var f;s.preventDefault();let l=t(),d=r(),b=l.filter(u=>u.selected);if(!b.length)return;let p=d.filter(u=>b.some(y=>y.id===u.source)&&b.some(y=>y.id===u.target)),m={nodes:b,edges:p};(f=s.clipboardData)==null||f.setData($o,JSON.stringify(m))},a=s=>{var m,f;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData($o))||"{}");if(!((f=l.nodes)!=null&&f.length))return;let d=new Map,b=l.nodes.map(u=>{let y=Zo();return d.set(u.id,y),x(v({},u),{id:y,selected:!0,position:{x:u.position.x+e,y:u.position.y+e}})}),p=l.edges.map(u=>x(v({},u),{id:Zo(),selected:!0,source:d.get(u.source)||u.source,target:d.get(u.target)||u.target}));o(u=>[...u.map(y=>x(v({},y),{selected:!1})),...b]),n(u=>[...u.map(y=>x(v({},y),{selected:!1})),...p])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};import{useReactFlow as yi,useStoreApi as Ti}from"@xyflow/react";import{v7 as er}from"uuid";import{create as pi}from"zustand";var ye=pi(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as mi,EdgeLabelRenderer as ui,getSmoothStepPath as fi,MarkerType as gi,useNodes as Ei,useReactFlow as bi,useViewport as hi}from"@xyflow/react";import{useState as vi}from"react";import{jsx as ft,jsxs as qo}from"react/jsx-runtime";var zm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:gi.Arrow},data:{label:""}},jo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:b})=>{let p=Ei(),{zoom:m}=hi(),{updateEdgeData:f}=bi(),[u,y]=vi(!1),g=p.find(_=>_.id===t),E=p.find(_=>_.id===o),[c,N,I]=fi({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),T=b||(g==null?void 0:g.selected)||(E==null?void 0:E.selected),k=T?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=u||(d==null?void 0:d.label.trim().length)>0,w=1/m,S=()=>{y(!0)},C=()=>{y(!1)},L=_=>{f(e,{label:_.trim()})};return qo("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":T}),onBlur:C,onDoubleClick:S,children:[ft(mi,{id:e,path:c,markerEnd:`url(#${k})`,strokeDasharray:4,className:A("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":T&&!(d!=null&&d.hasError)})}),ft(ui,{children:qo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${N}px, ${I}px)`},children:[b&&ft(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${w})`}}),h&&ft(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:L})]})})]})};import{jsx as Jo,jsxs as Ni}from"react/jsx-runtime";var Qo=({fromX:e,fromY:t,toX:o,toY:r})=>Ni("g",{children:[Jo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),Jo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var tr=({nodes:e,setNodes:t,setEdges:o})=>{let r=Ti(),{draggableNode:n,setDraggableNode:i}=ye(),{getInternalNode:a,screenToFlowPosition:s}=yi(),l=g=>{let E="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(c=>c.map(N=>x(v({},N),{className:N.id===g?E:""})))},d=()=>{let{nodeLookup:g}=r.getState();return Array.from(g.values())},b=g=>{let E=a(g.id),c=d();if(g.type==="LANE"){if(ve({parentId:g.id,nodes:e,includeTypes:["LANE"]})){l();return}let w=c.filter(L=>L.id!==g.id&&L.type==="LANE"&&!L.parentId),S=Pe(E,w);if(!S){l();return}if(ve({parentId:S.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(S.id);return}let I=c.filter(h=>h.id!==g.id&&h.type==="LANE"),T=Pe(E,I);if(!T){l();return}if(ve({parentId:T.id,nodes:e,includeTypes:["LANE"]})){l();return}l(T.id)},p=g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},m=(g,E)=>{g.preventDefault(),b(E)},f=(g,E,c)=>{var w,S;let N=C=>C.map(L=>x(v({},L),{className:void 0}));if(g.parentId===E.id){let C=me(E.id,c);t(ne(N(C)));return}if(g.type==="LANE"){if(ve({parentId:E.id,nodes:c,excludeTypes:["LANE"]}))return;let _=c.filter(z=>z.parentId===E.id).reduce((z,ge)=>{var oe,pe;return z+((pe=(oe=ge.measured)==null?void 0:oe.height)!=null?pe:0)},0),M={x:Y.HEADER_WIDTH,y:_},K=c.map(z=>z.id===g.id?x(v({},z),{parentId:E.id,position:M,className:void 0}):x(v({},z),{className:void 0}));K=me(E.id,K),t(ne(K));return}if(ve({parentId:E.id,nodes:c,includeTypes:["LANE"]})){let C;if(g.parentId){let _=a(g.parentId),{x:M,y:K}=re(_);C={x:M+((w=g.position.x)!=null?w:0),y:K+((S=g.position.y)!=null?S:0)}}let L=c.map(_=>_.id===g.id?x(v({},_),{position:C!=null?C:_.position,parentId:void 0,className:void 0}):x(v({},_),{className:void 0}));t(ne(L));return}let k=No(g,E),h=c.map(C=>C.id===g.id?x(v({},C),{parentId:E.id,position:k,className:void 0}):x(v({},C),{className:void 0}));t(ne(h))};return{onDragOver:p,onDrop:g=>{if(g.preventDefault(),!(n!=null&&n.type))return;let E=s({x:g.clientX,y:g.clientY}),c={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},N={id:er(),type:n.type,position:E,measured:c,data:{label:"",variant:n.variant,attribute:n.attribute}},I=x(v({},N),{internals:{positionAbsolute:E}}),T=d(),k=n.type==="LANE",h=T.filter(C=>k?C.type==="LANE"&&!C.parentId:C.type==="LANE"),w=Pe(I,h);w?f(I,w,[...T,I]):t(C=>{let L=C.concat(N);return ne(L)});let S=g.dataTransfer.getData("sourceId");if(S){let C={id:er(),source:S,target:N.id};if(n.type==="ANNOTATION"){o(L=>L.concat(v(v({},C),pt)));return}o(L=>L.concat(v(v({},C),se)))}i(null)},onNodeDrag:m,onNodeDragStop:async(g,E)=>{var w,S;let{nodeLookup:c}=r.getState(),N=a(E.id),I=Array.from(c.values()),T=E.type==="LANE",k=I.filter(C=>C.id!==E.id&&(T?C.type==="LANE"&&!C.parentId:C.type==="LANE")),h=Pe(N,k);if(h){f(N,h,I);return}if(E.parentId){let C=a(E.parentId),{x:L,y:_}=re(C),M={x:L+((w=E.position.x)!=null?w:0),y:_+((S=E.position.y)!=null?S:0)},K=e.map(z=>z.id===E.id?x(v({},z),{position:M,parentId:void 0}):z);K=me(E.parentId,K),t(ne(K))}}}};import{useReactFlow as xi}from"@xyflow/react";import{useCallback as Ft}from"react";var or=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=xi(),n=Ft((s,l)=>{let d=e(),b=t(),p=d.map(u=>x(v({},u),{selected:!1})),m=b.map(u=>x(v({},u),{selected:!1})),f=!1;if(l==="node"||!l){let u=p.find(y=>y.id===s);if(u)return u.selected=!0,f=!0,o(p),r(m),!0}if(l==="edge"||!l&&!f){let u=m.find(y=>y.id===s);if(u)return u.selected=!0,f=!0,o(p),r(m),!0}return f||(o(p),r(m)),f},[e,t,o,r]),i=Ft(()=>{let s=e(),l=t(),d=s.map(p=>x(v({},p),{selected:!1})),b=l.map(p=>x(v({},p),{selected:!1}));o(d),r(b)},[e,t,o,r]),a=Ft(()=>{let s=e(),l=t();return{nodes:s.filter(d=>d.selected),edges:l.filter(d=>d.selected)}},[e,t]);return{highlightElement:n,clearSelection:i,getSelectedElements:a}};import{applyNodeChanges as _i}from"@xyflow/react";import{useCallback as wi,useState as nr}from"react";function rr(e,t,o=5){var l,d,b,p,m,f,u,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(g=>g.id===e.id);if(!n||!e.position)return r;let i={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((p=(b=n.measured)==null?void 0:b.height)!=null?p:0),width:(f=(m=n.measured)==null?void 0:m.width)!=null?f:0,height:(y=(u=n.measured)==null?void 0:u.height)!=null?y:0},a=o,s=o;return t.filter(g=>g.id!==n.id).reduce((g,E)=>{var L,_,M,K,z,ge,oe,pe;let c={left:E.position.x,right:E.position.x+((_=(L=E.measured)==null?void 0:L.width)!=null?_:0),top:E.position.y,bottom:E.position.y+((K=(M=E.measured)==null?void 0:M.height)!=null?K:0),width:(ge=(z=E.measured)==null?void 0:z.width)!=null?ge:0,height:(pe=(oe=E.measured)==null?void 0:oe.height)!=null?pe:0},N=Math.abs(i.left-c.left);N<s&&(g.snapPosition.x=c.left,g.vertical=c.left,s=N);let I=Math.abs(i.right-c.right);I<s&&(g.snapPosition.x=c.right-i.width,g.vertical=c.right,s=I);let T=Math.abs(i.left-c.right);T<s&&(g.snapPosition.x=c.right,g.vertical=c.right,s=T);let k=Math.abs(i.right-c.left);k<s&&(g.snapPosition.x=c.left-i.width,g.vertical=c.left,s=k);let h=Math.abs(i.top-c.top);h<a&&(g.snapPosition.y=c.top,g.horizontal=c.top,a=h);let w=Math.abs(i.bottom-c.top);w<a&&(g.snapPosition.y=c.top-i.height,g.horizontal=c.top,a=w);let S=Math.abs(i.bottom-c.bottom);S<a&&(g.snapPosition.y=c.bottom-i.height,g.horizontal=c.bottom,a=S);let C=Math.abs(i.top-c.bottom);return C<a&&(g.snapPosition.y=c.bottom,g.horizontal=c.bottom,a=C),g},r)}var ar=()=>{let[e,t]=nr(void 0),[o,r]=nr(void 0),n=wi((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let d=rr(i[0],a);i[0].position.x=(s=d.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=d.snapPosition.y)!=null?l:i[0].position.y,t(d.horizontal),r(d.vertical)}return _i(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ii}from"@xyflow/react";import{v7 as cr}from"uuid";var sr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},lr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},ir=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=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 r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[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}},Ci=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=ir(i[0],o),s=ir(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},dr=e=>{let{components:t,connections:o}=Ci(e);return{nodes:t,edges:o}};var pr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ii();return{createDiagram:n=>{let{nodes:i,edges:a}=dr(n),s=[],l=new Map;for(let[m,f]of Object.entries(i)){let u=cr(),y=sr[f.type],g=lr[f.type];l.set(m,u);let E=V[y].MIN_WIDTH,c=V[y].MIN_HEIGHT;s.push({id:u,type:y,data:{label:f.label||"",variant:g,attribute:""},position:{x:0,y:0},width:E,height:c,measured:{width:E,height:c}})}let d=[];for(let m of a){let f=x(v({},se),{id:cr(),source:l.get(m.sourceId)||m.sourceId,target:l.get(m.targetId)||m.targetId});d.push(f)}let{nodes:b,edges:p}=xo(s,d);e(b),t(p),o()}}};import{useEffect as Ai,useCallback as ki}from"react";var Si={origin:"*",debug:!1};function mr(e,t=Si){let{origin:o,debug:r}=t,n=ki((i,a)=>{r&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,r]);return Ai(()=>{let i=a=>{let{type:s,data:l}=a.data||{};r&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,r]),{sendMessage:n}}import{useReactFlow as Li}from"@xyflow/react";import{useCallback as Oe,useState as ur}from"react";import{useDebouncedCallback as Pi}from"use-debounce";var Di={nodes:[],edges:[]},Ri=500,fr=10,gr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=Li(),[n,i]=ur([Di]),[a,s]=ur(0),l=n[a],d=a>0,b=a<n.length-1,p=Oe(c=>{o(n[c].nodes),r(n[c].edges)},[n,o,r]),m=Oe(()=>{if(a>0){let c=a-1;s(c),p(c)}},[a,p]),f=Oe(()=>{if(a<n.length-1){let c=a+1;s(c),p(c)}},[n,a,p]),u=c=>{let I=[...n.slice(0,a+1),c],T=I.length>fr?I.slice(I.length-fr):I;i(T),s(T.length-1)},y=Pi(()=>{let c=e(),N=t(),I={nodes:c,edges:N};JSON.stringify(l)!==JSON.stringify(I)&&u(I)},Ri),g=Oe(c=>{if(c==="forceSave"){y();return}c.some(I=>I.type!=="select")&&y()},[y]),E=Oe(()=>{i([]),s(0)},[]);return{undo:m,redo:f,saveHistory:g,canUndo:d,canRedo:b,clearHistory:E}};import{jsx as Er}from"react/jsx-runtime";var Ut=({id:e,className:t})=>Er("marker",{id:e,className:A("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:Er("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Wt,jsxs as Mi}from"react/jsx-runtime";var br=()=>Wt("svg",{style:{position:"absolute",top:0,left:0},children:Mi("defs",{children:[Wt(Ut,{id:"sequence-edge-marker",className:"text-grey-400"}),Wt(Ut,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Mr}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as Ss}from"lecom-ui";import{HandIcon as Ls,ListCheckIcon as Ps,MapIcon as Ds,MousePointerIcon as Rs}from"lucide-react";import{useCallback as Ms,useEffect as Vr}from"react";import{useStore as Vi}from"@xyflow/react";var Oi=e=>({unselectAll:e.unselectNodesAndEdges}),gt=()=>{let{unselectAll:e}=Vi(Oi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as ls,TooltipContent as ds,TooltipTrigger as cs,useNotificationToast as ps,useTranslation as ms}from"lecom-ui";var Ge=(E=>(E.START_EVENT="START_EVENT",E.END_EVENT="END_EVENT",E.TASK="TASK",E.SUBPROCESS="SUBPROCESS",E.GATEWAY="GATEWAY",E.ANNOTATION="ANNOTATION",E.CONNECTION="CONNECTION",E.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",E.ACTIVITY="ACTIVITY",E.PROCESS_INTERFACE="PROCESS_INTERFACE",E.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",E.VARIANT_ACTIVITY="VARIANT_ACTIVITY",E.AUTO_ACTIVITY="AUTO_ACTIVITY",E.DATA_STORE="DATA_STORE",E.DATA_OBJECT="DATA_OBJECT",E.DATA_OUTPUT="DATA_OUTPUT",E.DATA_INPUT="DATA_INPUT",E))(Ge||{});import{useReactFlow as Qi}from"@xyflow/react";import{useNotificationToast as es,useTranslation as ts,Button as os}from"lecom-ui";var hr=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var i;t((i=n.target)==null?void 0:i.result)},r.onerror=n=>{var i;o((i=n.target)==null?void 0:i.error)},r.readAsText(e)});function vr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
3
+ `),i=encodeURI(n);Et(i,`${o}.csv`)}var Et=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};import{v7 as $i}from"uuid";import{xml2json as Gi,json2xml as Ju}from"xml-js";var Hi={compact:!0,spaces:4},Bi=e=>e.replaceAll(`
4
+ `,"&#xA;");function Nr(e,t=Hi){if(e)return JSON.parse(Gi(e,x(v({},t),{attributeValueFn:Bi})))}function yr(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Fi}from"uuid";var nf={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},Tr={script:"SCRIPT",subprocess:"SUBPROCESS"},xr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Te=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:i}=r,a=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},Ui=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.START_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Wi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.END_EVENT.MIN_HEIGHT,{node:Te({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Yi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=Tr[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Ki=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=xr[o],n=["none","inclusive","event-based"],i="imported";return n.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:r}),status:i,originalType:t}},Zi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},_r=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=V.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=V.UNSUPPORTED.MIN_HEIGHT,{node:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},wr=(e,t)=>{let{source:o,target:r}=e._attributes;return x(v({},se),{id:Fi(),source:t.get(o)||o,target:t.get(r)||r})},Cr={TASK:Yi,GATEWAY:Ki,START_EVENT:Ui,END_EVENT:Wi,ANNOTATION:Zi};var Xi=e=>{var a;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],i=[];for(let s of r){let l=$i(),{type:d}=s._attributes,b=Cr[d]||_r;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:p,status:m,originalType:f}=b(s);n.push(p),i.push({originalType:f,type:p.type,variant:p.data.variant,value:yr(p.data.label),status:m})}return{nodes:n,governanceIdToNodeIdMap:t,summary:i}},qi=(e,t)=>e.filter(n=>{var i;return(i=n._attributes)==null?void 0:i.edge}).map(n=>wr(n,t)),ji=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Xi(t.root.mxCell),i=qi(t.root.mxCell,r);return{nodes:o,edges:i,summary:n}},Ji=async e=>{let t=await hr(e),o=Nr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},i=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),a=n==null?void 0:n.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Ir=async e=>{try{let t=await Ji(e),{nodes:o,edges:r,summary:n}=ji(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as rs}from"react/jsx-runtime";var Ar=()=>{let{t:e}=ts(),{toast:t}=es(),{setNodes:o,setEdges:r,fitView:n}=Qi(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=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:rs(os,{size:"small",variant:"ghost",onClick:()=>vr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:b}=await Ir(s);if(o(m=>m.concat(l)),r(m=>m.concat(d)),n(),b.some(m=>m.status==="unsupported")){i(b);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as ns}from"lecom-ui";import{useRef as as}from"react";import{Fragment as is,jsx as kr,jsxs as ss}from"react/jsx-runtime";var Sr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:i}=l,a=Ee(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=as(null),b=m=>{let f=m.target.files;f!=null&&f.length&&i(f),d.current&&(d.current.value="")};return ss(is,{children:[kr(ns,x(v({onClick:m=>{var f;(f=d.current)==null||f.click(),n==null||n(m)}},a),{children:e})),kr("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:b})]})};import{jsx as bt,jsxs as us}from"react/jsx-runtime";var Lr=({disabled:e=!1})=>{let{t}=ms(),{toast:o}=ps(),{createDiagram:r}=Ar(),n=()=>{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}r(s)};return us(ls,{children:[bt(cs,{asChild:!0,children:bt(Sr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:i,children:bt(po,{})})}),bt(ds,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as Ns,DropdownMenu as ys,DropdownMenuContent as Ts,DropdownMenuItem as Kt,DropdownMenuTrigger as xs,Tooltip as ht,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as _s}from"lecom-ui";import{FileCodeIcon as ws,FileImageIcon as Cs,FolderOutputIcon as Is,PrinterIcon as As}from"lucide-react";import{useState as ks}from"react";import{useReactFlow as fs}from"@xyflow/react";import{toPng as Pr,toSvg as gs}from"html-to-image";import{toast as Es,useTranslation as bs}from"lecom-ui";import{useState as hs}from"react";var vs=3,Yt="diagram",Dr=()=>{let{t:e}=bs(),{getNodes:t}=fs(),{deselectAll:o}=gt(),[r,n]=hs({png:!1,html:!1,print:!1}),i=()=>{let{x:b,y:p,width:m,height:f}=wo(t());return{width:m,height:f,style:{width:`${m}px`,height:`${f}px`,transform:`translate(${-b}px, ${-p}px)`}}},a=async(b,p)=>{n(x(v({},r),{[p]:!0})),await o();try{let m=_o();if(!m)throw new Error("Flow element not found");let f=i();return await b(m,f)}catch(m){Es({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(x(v({},r),{[p]:!1}))}};return{exportAsPng:async(b=Yt)=>{await a(async(p,m)=>{let f=await Pr(p,x(v({},m),{backgroundColor:"#fcfcfc"}));Et(f,`${b}.png`)},"png")},exportAsHtml:async(b=Yt)=>{await a(async(p,m)=>{let f=await gs(p,x(v({},m),{backgroundColor:"#fcfcfc"})),u=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
@@ -12,10 +12,10 @@ var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnProp
12
12
  </style>
13
13
  </head>
14
14
  <body>
15
- <img src="${g}" alt="Diagram" />
15
+ <img src="${f}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,x=new Blob([E],{type:"text/html"}),u=URL.createObjectURL(x);Et(u,`${b}.html`),setTimeout(()=>URL.revokeObjectURL(u),100)},"html")},printDiagram:async(b=Wt)=>{await a(async(m,p)=>{let g=await Ir(m,T(v({},p),{pixelRatio:us})),E=window.open("","_blank");if(!E)throw new Error("Failed to open print window.");let x=E.document;x.open(),x.write(`
18
+ `,y=new Blob([u],{type:"text/html"}),g=URL.createObjectURL(y);Et(g,`${b}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(b=Yt)=>{await a(async(p,m)=>{let f=await Pr(p,x(v({},m),{pixelRatio:vs})),u=window.open("","_blank");if(!u)throw new Error("Failed to open print window.");let y=u.document;y.open(),y.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
@@ -28,7 +28,7 @@ var zn=Object.defineProperty,Fn=Object.defineProperties;var Un=Object.getOwnProp
28
28
  </style>
29
29
  </head>
30
30
  <body>
31
- <img src="${g}" alt="Diagram" onload="window.print(); window.close();" />
31
+ <img src="${f}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),x.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as H,jsxs as _e}from"react/jsx-runtime";function kr(){let{t:e}=hs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Ar(),[s,l]=xs(!1);return _e(gs,{modal:!1,open:s,onOpenChange:l,children:[H(bs,{asChild:!0,children:H("div",{children:_e(ht,{children:[H(Nt,{asChild:!0,children:H(fs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:H(ys,{})})}),!s&&H(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),_e(Es,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[_e(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:H(Ns,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),_e(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:H(vs,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),_e(ht,{children:[H(Nt,{asChild:!0,children:H(Yt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:H(Ts,{})})}),H(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Ls,jsx as B,jsxs as ce}from"react/jsx-runtime";var Pr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=_s(),{deselectAll:a}=gt(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:b,isMinimapOpen:m,setIsMinimapOpen:p}=G(),g=Lr(["v","V"]),E=Lr(["h","H"]),x=ks(()=>{a(),b()},[a,b]),u=()=>{a();let f=n(o);r&&r(f)};return Sr(()=>{g&&!s&&!t&&d()},[g,d,s,t]),Sr(()=>{E&&!l&&!t&&x()},[E,x,l,t]),ce("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&ce(Ls,{children:[ce(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:B(As,{})})}),ce(xt,{color:"black",children:[i("editor.controls.actions.move_tool"),B("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),ce(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(l&&"bg-grey-400"),iconButton:!0,onClick:x,children:B(ws,{})})}),ce(xt,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",B("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),ce(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:u,children:B(Cs,{})})}),B(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),B(kr,{}),!t&&B(Cr,{disabled:e.length>0}),ce(Tt,{children:[B(_t,{asChild:!0,children:B(yt,{size:"small",variant:"ghost",color:"grey",className:A(m&&"bg-grey-400"),iconButton:!0,onClick:()=>p(!m),children:B(Is,{})})}),B(xt,{color:"black",children:i(m?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Dr,Tooltip as Rr,TooltipContent as Mr,TooltipTrigger as Vr,useTranslation as Ss}from"lecom-ui";import{RedoIcon as Ps,UndoIcon as Ds}from"lucide-react";import{jsx as pe,jsxs as Kt}from"react/jsx-runtime";var Or=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ss();return Kt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Kt(Rr,{children:[pe(Vr,{asChild:!0,children:pe(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:pe(Ds,{})})}),pe(Mr,{color:"black",children:n("editor.controls.history.undo")})]}),Kt(Rr,{children:[pe(Vr,{asChild:!0,children:pe(Dr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:pe(Ps,{})})}),pe(Mr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Rs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Ms}from"lecom-ui";import{ScanIcon as Vs,ZoomIn as Os,ZoomOut as Gs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Gr=()=>{let{t:e}=Ms(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Rs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Vs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Gs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(po,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Os,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Cl,useReactFlow as Il}from"@xyflow/react";import{Handle as Hs}from"@xyflow/react";import{jsx as Bs}from"react/jsx-runtime";var z=({type:e,position:t,className:o})=>Bs(Hs,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as zs,useReactFlow as Fs}from"@xyflow/react";import{orderBy as Us}from"lodash";import{jsx as Ws}from"react/jsx-runtime";var we=o=>{var r=o,{nodeId:e}=r,t=be(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=Fs(),s=({width:l,height:d})=>{if(!e)return;let b=n(e);if((b==null?void 0:b.type)!=="LANE")return;let m=[...i()],p=!b.parentId,g=p?b.id:b.parentId,E=m.filter(f=>f.type==="LANE"&&f.parentId===g);if(!E.length)return;let x=Us(E,["position.y"]),u=0;x.forEach((f,c)=>{var y,k;let N=c===x.length-1,I=(k=(y=f.measured)==null?void 0:y.height)!=null?k:0;m=m.map(h=>{if(h.id===f.id){let w=p?l-Y.HEADER_WIDTH:l,L=T(v({},h),{width:w,measured:T(v({},h.measured),{width:w}),position:T(v({},h.position),{y:u})});return N&&p&&(L.height=d-u),L}return h}),u+=I}),m=m.map(f=>{if(f.id===g){let c=p?l:l+Y.HEADER_WIDTH;return T(v({},f),{width:c,height:p?d:u,measured:{width:c,height:p?d:u}})}return f}),a(m)};return Ws(zs,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as hl,NodeToolbar as vl}from"@xyflow/react";import{Button as Nl,Tooltip as yl,TooltipContent as Tl,TooltipTrigger as xl,useTranslation as _l}from"lecom-ui";import{useNodesData as Ys,useReactFlow as Ks}from"@xyflow/react";import{Button as Zs,DropdownMenu as $s,DropdownMenuContent as Xs,DropdownMenuGroup as qs,DropdownMenuItem as js,DropdownMenuLabel as Js,DropdownMenuTrigger as Qs,Tooltip as el,TooltipContent as tl,TooltipTrigger as ol,useTranslation as rl}from"lecom-ui";import{WrenchIcon as nl}from"lucide-react";import{jsx as ae,jsxs as kt}from"react/jsx-runtime";var Hr=({nodeId:e})=>{let{t}=rl(),{updateNodeData:o}=Ks(),r=Ys(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return kt($s,{children:[kt(el,{children:[ae(ol,{asChild:!0,children:ae(Qs,{asChild:!0,children:ae(Zs,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ae(nl,{})})})}),ae(tl,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(Xs,{align:"start",className:"w-60 bg-white text-grey-600",children:[ae(Js,{className:"flex items-center",children:ae("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ae(qs,{children:Object.entries(Qe).map(([i,a])=>kt(js,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[ae(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as al,useReactFlow as il}from"@xyflow/react";import{Button as Br,DropdownMenu as sl,DropdownMenuContent as ll,DropdownMenuGroup as dl,DropdownMenuItem as cl,DropdownMenuLabel as pl,DropdownMenuTrigger as ml,Tooltip as ul,TooltipContent as fl,TooltipTrigger as gl,useTranslation as El}from"lecom-ui";import{WrenchIcon as bl}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var zr=({nodeId:e})=>{let{t}=El(),{updateNodeData:o}=il(),r=al(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return Be(sl,{children:[Be(ul,{children:[q(gl,{asChild:!0,children:q(ml,{asChild:!0,children:q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(bl,{})})})}),q(fl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(ll,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(pl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([a,s])=>q(Br,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:q(s.icon,{className:"stroke-inherit"})},a))})]}),q(dl,{children:Object.entries(je).map(([a,s])=>Be(cl,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as wl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var b;let{t:n}=_l(),{setDraggableNode:i}=Te(),a=({event:m,type:p,variant:g})=>{i({type:p,variant:g}),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Le,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:he,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Le,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(st,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(zr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Hr,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(vl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:hl.Right,align:"start",isVisible:r,children:(b=d[t])==null?void 0:b.map((m,p)=>m.component?j("div",{children:m.component},p):wl(yl,{children:[j(xl,{asChild:!0,children:j(Nl,{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(Tl,{color:"black",children:m.label})]},p))})};import{Fragment as Al,jsx as ze,jsxs as kl}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Il(),{isMultipleSelection:i}=G(),a=s=>{n(e,{label:s})};return kl(Al,{children:[ze("div",{className:A("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),ze(we,{isVisible:!r&&!i&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(z,{type:"target",position:Cl.Left})]})};import{Position as Ur,useReactFlow as Ll}from"@xyflow/react";import{useState as Sl}from"react";import{Fragment as Pl,jsx as Ce,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ll(),{isMultipleSelection:i}=G(),[a,s]=Sl(!1),l=m=>{n(e,{label:m})};return Wr(Pl,{children:[Wr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Ce(he,{className:A("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Ce("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:a,onChange:l})})]}),Ce(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),Ce(z,{type:"source",position:Ur.Right}),Ce(z,{type:"target",position:Ur.Left})]})};import{Position as Kr,useReactFlow as Dl}from"@xyflow/react";import{useState as Rl}from"react";import{Fragment as Ml,jsx as Ie,jsxs as Zr}from"react/jsx-runtime";var $r=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:i}=Dl(),{isMultipleSelection:a}=G(),[s,l]=Rl(!1),d=p=>{i(e,{label:p})};return Zr(Ml,{children:[Zr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ie(n,{className:A("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ie("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ie(U,{value:t.label,isEditing:s,onChange:d})})]}),Ie(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),Ie(z,{type:"target",position:Kr.Left}),Ie(z,{type:"source",position:Kr.Right})]})};import{Position as Vl,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as Fe,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ol(),{isMultipleSelection:i}=G(),[a,s]=Gl(!1),l=m=>{n(e,{label:m})};return Xr(Hl,{children:[Xr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(Xe,{className:A("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:a,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),Fe(z,{type:"source",position:Vl.Right})]})};import{Position as jr,useReactFlow as Bl}from"@xyflow/react";import{Fragment as zl,jsx as te,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Bl(),{isMultipleSelection:i}=G(),a=p=>{n(e,{label:p})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",b=s&&!d,m=l||d;return Jr(zl,{children:[Jr("div",{className:A("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[te(U,{value:t.label,className:A("m-1",{"py-6":b||m}),onChange:a}),s&&te("div",{className:A("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:te(s,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})}),l&&te("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:te("div",{className:A("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:te(l,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})})})]}),te(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),te(we,{isVisible:!r&&!i&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),te(z,{type:"source",position:jr.Right}),te(z,{type:"target",position:jr.Left})]})};import{Position as en}from"@xyflow/react";import{Fragment as Fl,jsx as Lt,jsxs as Ul}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=G();return Ul(Fl,{children:[Lt("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),Lt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),Lt(z,{type:"source",position:en.Right}),Lt(z,{type:"target",position:en.Left})]})};import{Position as Wl,useReactFlow as Yl}from"@xyflow/react";import{orderBy as Kl}from"lodash";import{useMemo as on}from"react";import{Fragment as Zl,jsx as Ee,jsxs as rn}from"react/jsx-runtime";var nn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=Yl(),{isMultipleSelection:s}=G(),l=a(),d=!n,b=on(()=>Kl([...l.filter(E=>E.parentId===e&&E.type==="LANE")],"position.y","asc"),[l,e]),m=d?tt.MIN_WIDTH:Y.MIN_WIDTH,p=on(()=>{if(d&&b.length>1){let E=[...b];return E.pop(),E.reduce((u,f)=>{var c,N;return u+((N=(c=f.measured)==null?void 0:c.height)!=null?N:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,b]),g=E=>{i(e,{label:E})};return rn(Zl,{children:[rn("div",{className:A("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[Ee("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:Ee("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:Ee(U,{value:t.label,className:"w-full h-full",onChange:g})})}),Ee("div",{className:"flex-1"})]}),Ee(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),Ee(we,{nodeId:e,minWidth:m,minHeight:p,isVisible:!r&&!s&&o}),d&&Ee(z,{type:"source",position:Wl.Right})]})};var an={START_EVENT:qr,END_EVENT:Yr,TASK:Qr,GATEWAY:$r,ANNOTATION:Fr,LANE:nn,UNSUPPORTED:tn},sn={SEQUENCE_EDGE:Lo,MESSAGE_EDGE:Zo,ANNOTATION_EDGE:wo},ln="#fafafa",dn="#bebebe",cn=1,pn=10,mn="bottom-left",un=.5,fn=4,gn={x:0,y:0,zoom:.75};import{useStore as $l}from"@xyflow/react";import{useEffect as Xl,useRef as ql}from"react";import{jsx as Jl}from"react/jsx-runtime";var jl=e=>({width:e.width,height:e.height,transform:e.transform}),En=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=$l(jl),s=ql(null);return Xl(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let b=window.devicePixelRatio;l.width=n*b,l.height=i*b,d.scale(b,b),d.clearRect(0,0,n,i),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*a[2]+a[0],0),d.lineTo(t*a[2]+a[0],i),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*a[2]+a[1]),d.lineTo(n,e*a[2]+a[1]),d.stroke())},[n,i,a,e,t,o,r]),Jl("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as bn,Dialog as Ql,DialogContent as ed,DialogFooter as td,DialogHeader as od,DialogTitle as rd,Notification as nd,Typography as Zt,useTranslation as ad}from"lecom-ui";import{jsx as oe,jsxs as $t}from"react/jsx-runtime";var hn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=ad(),i=!!e,a=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(b=>b.filter(m=>!l.some(p=>p.id===m.id))),d!=null&&d.length&&r(b=>b.filter(m=>!d.some(p=>p.id===m.id))),t(null)},s=()=>{t(null)};return oe(Ql,{open:i,onOpenChange:s,children:$t(ed,{className:"w-[488px] max-w-fit gap-2",children:[oe(od,{children:oe(rd,{children:oe(Zt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),$t("div",{className:"flex flex-col gap-2",children:[oe("div",{className:"py-2",children:oe(nd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),oe(Zt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),$t(td,{className:"flex items-center flex-row justify-end w-full gap-2",children:[oe(bn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:oe(Zt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),oe(bn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as id,Tooltip as sd,TooltipContent as ld,TooltipTrigger as dd,useTranslation as cd}from"lecom-ui";import{jsx as Ue,jsxs as pd}from"react/jsx-runtime";var vn=()=>{let{t:e}=cd(),{setDraggableNode:t}=Te(),o=[{type:"START_EVENT",icon:Xe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:he,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Le,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Eo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:go,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:fo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:co,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,i)=>pd(sd,{children:[Ue(dd,{asChild:!0,children:Ue(id,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:Ue(n.icon,{})},i)}),Ue(ld,{color:"black",side:"right",children:n.label})]},i))})};import{Button as md,useTranslation as ud}from"lecom-ui";import{AlertCircleIcon as fd,CircleCheckIcon as gd,XIcon as Ed}from"lucide-react";import{useEffect as bd,useState as hd}from"react";import{jsx as J,jsxs as Xt}from"react/jsx-runtime";var Nn=({validationResult:e,onClose:t})=>{let{t:o}=ud(),[r,n]=hd(!1);if(bd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return Xt("div",{className:A("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[Xt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:i?J(gd,{className:"text-green-500 size-5"}):J(fd,{className:"text-red-500 size-5"})}),Xt("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(md,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(Ed,{})})]}),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 Q,jsxs as jt}from"react/jsx-runtime";var Rd=[],Md=Ad(({mode:e="edit"},t)=>{let o=Sd(!1),[r,n]=wd([]),[i,a]=_d([]),[s,l]=Pd(null),{isMoveTool:d,isHandTool:b,isReadOnly:m,setIsReadOnly:p,setIsMultipleSelection:g,isMinimapOpen:E}=G();Ld(t,()=>({selectElement:V=>{n(R=>R.map(X=>T(v({},X),{selected:X.id===V}))),a(R=>R.map(X=>T(v({},X),{selected:X.id===V})))}}));let{validationResult:x,handleValidationComplete:u,clearValidation:f,isAutoValidationEnabled:c,validateDiagram:N}=Fo(),{getNode:I,getNodes:y,getEdges:k}=Id(),{onNodeDrag:h,onDrop:w,onDragOver:L,onNodeDragStop:C}=jo({nodes:r,setNodes:n,setEdges:a}),{isValidConnection:S,onConnect:_}=Po({setEdges:a});Yo();let{createDiagram:M}=ir(),{undo:K,redo:F,saveHistory:ie,canUndo:me,canRedo:ue}=cr(),{helperLineHorizontal:An,helperLineVertical:kn,customApplyNodeChanges:Ln}=er();sr({LIA_CREATE_DIAGRAM:M,CLEAR_DIAGRAM:()=>{n([]),a([])}}),kd(()=>{p(e==="readonly")},[e,p]);let Sn=()=>{f()},Pn=qt(({nodes:V,edges:R})=>{let X=V.length+R.length>1;g(X)},[g]);Cd({onChange:Pn});let Dn=V=>{let R=I(V.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let X=fe(R.parentId,r.filter(to=>to.id!==R.id&&to.type==="LANE"));n(ne(X))}},Rn=V=>{V.forEach(R=>{switch(R.type){case"remove":Dn(R);break}})},Mn=qt(()=>{if(!c){o.current=!1;return}let V=y(),R=k(),X=N({nodes:V,edges:R});u(X),o.current=!1},[c,y,k,N,u]),Qt=Dd(Mn,300),eo=qt(()=>{c&&!o.current&&(o.current=!0,Qt())},[c,Qt]),Vn=V=>{n(R=>Ln(V,R)),ie(V),eo(),Rn(V)},On=V=>{a(R=>vd(V,R)),ie(V),eo()},Gn=()=>{ie("forceSave")},Hn=async({nodes:V,edges:R})=>(l({nodes:V,edges:R}),!1),Bn={nodes:r,edges:i};return jt("div",{className:"w-full h-full",children:[!m&&Q(vn,{}),Q(mr,{}),jt(Td,{edges:i,nodes:r,nodeTypes:an,edgeTypes:sn,minZoom:un,maxZoom:fn,panOnDrag:b||m?!0:Rd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&d,nodesConnectable:!m&&d,nodesDraggable:!m&&d,isValidConnection:S,connectionLineComponent:Xo,onConnect:_,onDrop:w,onDropCapture:Gn,onDragOver:L,onNodesChange:Vn,onEdgesChange:On,onNodeDrag:h,onNodeDragStop:C,onBeforeDelete:Hn,selectionMode:xd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:gn,connectOnClick:!1,children:[E&&Q(yd,{pannable:!0,zoomable:!0,position:mn,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&&Q(Or,{canUndo:me,canRedo:ue,undo:K,redo:F}),Q(Pr,{nodes:r,isReadOnly:m,diagram:Bn,onValidationComplete:u,onValidateDiagram:N}),Q(Gr,{})]}),Q(En,{horizontal:An,vertical:kn}),Q(Nd,{gap:pn,size:cn,color:dn,bgColor:ln}),x&&Q("div",{className:"absolute top-6 right-6 z-[1000]",children:Q(Nn,{validationResult:x,onClose:Sn})})]}),Q(hn,{pendingDelete:s,setPendingDelete:l,setNodes:n,setEdges:a})]})});Md.displayName="Editor";var Jt=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 Vd,Translations as Od}from"lecom-ui";var yn={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 Tn={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 xn={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 _n={pt_BR:xn,en_US:yn,es_ES:Tn};var wn,Cn,Gd=(Cn=(wn=Jt("LecomUserLanguage"))!=null?wn:Jt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Cn:Od.PT_BR;Vd({lng:Gd,resources:_n});import{jsx as In}from"react/jsx-runtime";var zd=Hd((e,t)=>In(ao,{children:In(Bd,T(v({},e),{forwardedRef:t}))}));zd.displayName="Modeler";export{Pt as ActivityVariant,Rt as ComplexVariant,St as ElementType,Mt as ExclusiveVariant,se as GatewayVariant,zd as Modeler,Dt as RoutingVariant};
34
+ `),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function Rr(){let{t:e}=_s(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Dr(),[s,l]=ks(!1);return xe(ys,{modal:!1,open:s,onOpenChange:l,children:[G(xs,{asChild:!0,children:G("div",{children:xe(ht,{children:[G(Nt,{asChild:!0,children:G(Ns,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Is,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(Ts,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(ht,{children:[G(Nt,{asChild:!0,children:G(Kt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:G(Cs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Kt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:G(ws,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[G(Nt,{asChild:!0,children:G(Kt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(As,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Vs,jsx as H,jsxs as de}from"react/jsx-runtime";var Or=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=Ss(),{deselectAll:a}=gt(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:b,isMinimapOpen:p,setIsMinimapOpen:m}=O(),f=Mr(["v","V"]),u=Mr(["h","H"]),y=Ms(()=>{a(),b()},[a,b]),g=()=>{a();let E=n(o);r&&r(E)};return Vr(()=>{f&&!s&&!t&&d()},[f,d,s,t]),Vr(()=>{u&&!l&&!t&&y()},[u,y,l,t]),de("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&de(Vs,{children:[de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Rs,{})})}),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:A(l&&"bg-grey-400"),iconButton:!0,onClick:y,children:H(Ls,{})})}),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:g,children:H(Ps,{})})}),H(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),H(Rr,{}),!t&&H(Lr,{disabled:e.length>0}),de(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:A(p&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!p),children:H(Ds,{})})}),H(xt,{color:"black",children:i(p?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Gr,Tooltip as Hr,TooltipContent as Br,TooltipTrigger as zr,useTranslation as Os}from"lecom-ui";import{RedoIcon as Gs,UndoIcon as Hs}from"lucide-react";import{jsx as ce,jsxs as Zt}from"react/jsx-runtime";var Fr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Os();return Zt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Zt(Hr,{children:[ce(zr,{asChild:!0,children:ce(Gr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:ce(Hs,{})})}),ce(Br,{color:"black",children:n("editor.controls.history.undo")})]}),Zt(Hr,{children:[ce(zr,{asChild:!0,children:ce(Gr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:ce(Gs,{})})}),ce(Br,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Bs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as zs}from"lecom-ui";import{ScanIcon as Fs,ZoomIn as Us,ZoomOut as Ws}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Ur=()=>{let{t:e}=zs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Bs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Fs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Ws,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(fo,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Us,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Pl,useReactFlow as Dl}from"@xyflow/react";import{Handle as Ys}from"@xyflow/react";import{jsx as Ks}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Ks(Ys,{type:e,position:t,className:A("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Zs,useReactFlow as $s}from"@xyflow/react";import{orderBy as Xs}from"lodash";import{jsx as qs}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=$s(),s=({width:l,height:d})=>{if(!e)return;let b=n(e);if((b==null?void 0:b.type)!=="LANE")return;let p=[...i()],m=!b.parentId,f=m?b.id:b.parentId,u=p.filter(E=>E.type==="LANE"&&E.parentId===f);if(!u.length)return;let y=Xs(u,["position.y"]),g=0;y.forEach((E,c)=>{var T,k;let N=c===y.length-1,I=(k=(T=E.measured)==null?void 0:T.height)!=null?k:0;p=p.map(h=>{if(h.id===E.id){let w=m?l-Y.HEADER_WIDTH:l,S=x(v({},h),{width:w,measured:x(v({},h.measured),{width:w}),position:x(v({},h.position),{y:g})});return N&&m&&(S.height=d-g),S}return h}),g+=I}),p=p.map(E=>{if(E.id===f){let c=m?l:l+Y.HEADER_WIDTH;return x(v({},E),{width:c,height:m?d:g,measured:{width:c,height:m?d:g}})}return E}),a(p)};return qs(Zs,v({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as _l,NodeToolbar as wl}from"@xyflow/react";import{Button as Cl,Tooltip as Il,TooltipContent as Al,TooltipTrigger as kl,useTranslation as Sl}from"lecom-ui";import{useNodesData as js,useReactFlow as Js}from"@xyflow/react";import{Button as Qs,DropdownMenu as el,DropdownMenuContent as tl,DropdownMenuGroup as ol,DropdownMenuItem as rl,DropdownMenuLabel as nl,DropdownMenuTrigger as al,Tooltip as il,TooltipContent as sl,TooltipTrigger as ll,useTranslation as dl}from"lecom-ui";import{WrenchIcon as cl}from"lucide-react";import{jsx as ae,jsxs as kt}from"react/jsx-runtime";var Wr=({nodeId:e})=>{let{t}=dl(),{updateNodeData:o}=Js(),r=js(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return kt(el,{children:[kt(il,{children:[ae(ll,{asChild:!0,children:ae(al,{asChild:!0,children:ae(Qs,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ae(cl,{})})})}),ae(sl,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(tl,{align:"start",className:"w-60 bg-white text-grey-600",children:[ae(nl,{className:"flex items-center",children:ae("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ae(ol,{children:Object.entries(Qe).map(([i,a])=>kt(rl,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[ae(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as pl,useReactFlow as ml}from"@xyflow/react";import{Button as Yr,DropdownMenu as ul,DropdownMenuContent as fl,DropdownMenuGroup as gl,DropdownMenuItem as El,DropdownMenuLabel as bl,DropdownMenuTrigger as hl,Tooltip as vl,TooltipContent as Nl,TooltipTrigger as yl,useTranslation as Tl}from"lecom-ui";import{WrenchIcon as xl}from"lucide-react";import{jsx as q,jsxs as Be}from"react/jsx-runtime";var Kr=({nodeId:e})=>{let{t}=Tl(),{updateNodeData:o}=ml(),r=pl(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return Be(ul,{children:[Be(vl,{children:[q(yl,{asChild:!0,children:q(hl,{asChild:!0,children:q(Yr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(xl,{})})})}),q(Nl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(fl,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(bl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([a,s])=>q(Yr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:q(s.icon,{className:"stroke-inherit"})},a))})]}),q(gl,{children:Object.entries(je).map(([a,s])=>Be(El,{className:A({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as Ll}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var b;let{t:n}=Sl(),{setDraggableNode:i}=ye(),a=({event:p,type:m,variant:f})=>{i({type:m,variant:f}),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Se,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:be,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Se,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(st,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Kr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Wr,{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(wl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:_l.Right,align:"start",isVisible:r,children:(b=d[t])==null?void 0:b.map((p,m)=>p.component?j("div",{children:p.component},m):Ll(Il,{children:[j(kl,{asChild:!0,children:j(Cl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:f=>a({event:f,type:p.type,variant:p.variant}),children:p.icon&&j(p.icon,{size:16})})}),j(Al,{color:"black",children:p.label})]},m))})};import{Fragment as Rl,jsx as ze,jsxs as Ml}from"react/jsx-runtime";var Zr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Dl(),{isMultipleSelection:i}=O(),a=s=>{n(e,{label:s})};return Ml(Rl,{children:[ze("div",{className:A("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),ze(_e,{isVisible:!r&&!i&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:Pl.Left})]})};import{Position as $r,useReactFlow as Vl}from"@xyflow/react";import{useState as Ol}from"react";import{Fragment as Gl,jsx as we,jsxs as Xr}from"react/jsx-runtime";var qr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Vl(),{isMultipleSelection:i}=O(),[a,s]=Ol(!1),l=p=>{n(e,{label:p})};return Xr(Gl,{children:[Xr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(be,{className:A("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:a,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),we(B,{type:"source",position:$r.Right}),we(B,{type:"target",position:$r.Left})]})};import{Position as jr,useReactFlow as Hl}from"@xyflow/react";import{useState as Bl}from"react";import{Fragment as zl,jsx as Ce,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:i}=Hl(),{isMultipleSelection:a}=O(),[s,l]=Bl(!1),d=m=>{i(e,{label:m})};return Jr(zl,{children:[Jr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(n,{className:A("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:d})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),Ce(B,{type:"target",position:jr.Left}),Ce(B,{type:"source",position:jr.Right})]})};import{Position as Fl,useReactFlow as Ul}from"@xyflow/react";import{useState as Wl}from"react";import{Fragment as Yl,jsx as Fe,jsxs as en}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ul(),{isMultipleSelection:i}=O(),[a,s]=Wl(!1),l=p=>{n(e,{label:p})};return en(Yl,{children:[en("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(Xe,{className:A("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:a,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),Fe(B,{type:"source",position:Fl.Right})]})};import{Position as on,useReactFlow as Kl}from"@xyflow/react";import{Fragment as Zl,jsx as ee,jsxs as rn}from"react/jsx-runtime";var nn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Kl(),{isMultipleSelection:i}=O(),a=m=>{n(e,{label:m})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",b=s&&!d,p=l||d;return rn(Zl,{children:[rn("div",{className:A("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[ee(U,{value:t.label,className:A("m-1",{"py-6":b||p}),onChange:a}),s&&ee("div",{className:A("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})}),l&&ee("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:ee("div",{className:A("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:A(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),ee(_e,{isVisible:!r&&!i&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:on.Right}),ee(B,{type:"target",position:on.Left})]})};import{Position as an}from"@xyflow/react";import{Fragment as $l,jsx as St,jsxs as Xl}from"react/jsx-runtime";var sn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Xl($l,{children:[St("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}),St(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),St(B,{type:"source",position:an.Right}),St(B,{type:"target",position:an.Left})]})};import{Position as ql,useReactFlow as jl}from"@xyflow/react";import{orderBy as Jl}from"lodash";import{useMemo as ln}from"react";import{Fragment as Ql,jsx as fe,jsxs as dn}from"react/jsx-runtime";var cn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=jl(),{isMultipleSelection:s}=O(),l=a(),d=!n,b=ln(()=>Jl([...l.filter(u=>u.parentId===e&&u.type==="LANE")],"position.y","asc"),[l,e]),p=d?tt.MIN_WIDTH:Y.MIN_WIDTH,m=ln(()=>{if(d&&b.length>1){let u=[...b];return u.pop(),u.reduce((g,E)=>{var c,N;return g+((N=(c=E.measured)==null?void 0:c.height)!=null?N:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,b]),f=u=>{i(e,{label:u})};return dn(Ql,{children:[dn("div",{className:A("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:f})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:p,minHeight:m,isVisible:!r&&!s&&o}),d&&fe(B,{type:"source",position:ql.Right})]})};var pn={START_EVENT:tn,END_EVENT:qr,TASK:nn,GATEWAY:Qr,ANNOTATION:Zr,LANE:cn,UNSUPPORTED:sn},mn={SEQUENCE_EDGE:Ro,MESSAGE_EDGE:jo,ANNOTATION_EDGE:ko},un="#fafafa",fn="#bebebe",gn=1,En=10,bn="bottom-left",hn=.5,vn=4,Nn={x:0,y:0,zoom:.75};import{useStore as ed}from"@xyflow/react";import{useEffect as td,useRef as od}from"react";import{jsx as nd}from"react/jsx-runtime";var rd=e=>({width:e.width,height:e.height,transform:e.transform}),yn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=ed(rd),s=od(null);return td(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let b=window.devicePixelRatio;l.width=n*b,l.height=i*b,d.scale(b,b),d.clearRect(0,0,n,i),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*a[2]+a[0],0),d.lineTo(t*a[2]+a[0],i),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*a[2]+a[1]),d.lineTo(n,e*a[2]+a[1]),d.stroke())},[n,i,a,e,t,o,r]),nd("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as Tn,Dialog as ad,DialogContent as id,DialogFooter as sd,DialogHeader as ld,DialogTitle as dd,Notification as cd,Typography as $t,useTranslation as pd}from"lecom-ui";import{jsx as te,jsxs as Xt}from"react/jsx-runtime";var xn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=pd(),i=!!e,a=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(b=>b.filter(p=>!l.some(m=>m.id===p.id))),d!=null&&d.length&&r(b=>b.filter(p=>!d.some(m=>m.id===p.id))),t(null)},s=()=>{t(null)};return te(ad,{open:i,onOpenChange:s,children:Xt(id,{className:"w-[488px] max-w-fit gap-2",children:[te(ld,{children:te(dd,{children:te($t,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Xt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(cd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te($t,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Xt(sd,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(Tn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te($t,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(Tn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as md,Tooltip as ud,TooltipContent as fd,TooltipTrigger as gd,useTranslation as Ed}from"lecom-ui";import{jsx as Ue,jsxs as bd}from"react/jsx-runtime";var _n=()=>{let{t:e}=Ed(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:Xe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Se,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:vo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ho,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:bo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:uo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,i)=>bd(ud,{children:[Ue(gd,{asChild:!0,children:Ue(md,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:Ue(n.icon,{})},i)}),Ue(fd,{color:"black",side:"right",children:n.label})]},i))})};import{Button as hd,useTranslation as vd}from"lecom-ui";import{AlertCircleIcon as Nd,CircleCheckIcon as yd,XIcon as Td}from"lucide-react";import{useEffect as xd,useState as _d}from"react";import{jsx as J,jsxs as qt}from"react/jsx-runtime";var wn=({validationResult:e,onClose:t})=>{let{t:o}=vd(),[r,n]=_d(!1);if(xd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return qt("div",{className:A("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(yd,{className:"text-green-500 size-5"}):J(Nd,{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:()=>{n(!1),t()},children:J(Td,{})})]}),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 Hd=[],Bd=({mode:e="edit",onSelectionAPIReady:t})=>{let o=Vd(!1),[r,n]=Pd([]),[i,a]=Ld([]),[s,l]=Od(null),{isMoveTool:d,isHandTool:b,isReadOnly:p,setIsReadOnly:m,setIsMultipleSelection:f,isMinimapOpen:u}=O(),{validationResult:y,handleValidationComplete:g,clearValidation:E,isAutoValidationEnabled:c,validateDiagram:N}=Ko(),{getNode:I,getNodes:T,getEdges:k}=Rd(),h=or();Qt(()=>{t&&t(h)},[t,h]);let{onNodeDrag:w,onDrop:S,onDragOver:C,onNodeDragStop:L}=tr({nodes:r,setNodes:n,setEdges:a}),{isValidConnection:_,onConnect:M}=Vo({setEdges:a});Xo();let{createDiagram:K}=pr(),{undo:z,redo:ge,saveHistory:oe,canUndo:pe,canRedo:Dn}=gr(),{helperLineHorizontal:Rn,helperLineVertical:Mn,customApplyNodeChanges:Vn}=ar();mr({LIA_CREATE_DIAGRAM:K,CLEAR_DIAGRAM:()=>{n([]),a([])}}),Qt(()=>{m(e==="readonly")},[e,m]);let On=()=>{E()},Gn=jt(({nodes:F,edges:R})=>{let Ie=F.length+R.length>1;f(Ie)},[f]);Dd({onChange:Gn});let Hn=F=>{let R=I(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ie=me(R.parentId,r.filter(no=>no.id!==R.id&&no.type==="LANE"));n(ne(Ie))}},Bn=F=>{F.forEach(R=>{switch(R.type){case"remove":Hn(R);break}})},zn=jt(()=>{if(!c){o.current=!1;return}let F=T(),R=k(),Ie=N({nodes:F,edges:R});g(Ie),o.current=!1},[c,T,k,N,g]),oo=Gd(zn,300),ro=jt(()=>{c&&!o.current&&(o.current=!0,oo())},[c,oo]),Fn=F=>{n(R=>Vn(F,R)),oe(F),ro(),Bn(F)},Un=F=>{a(R=>wd(F,R)),oe(F),ro()},Wn=()=>{oe("forceSave")},Yn=async({nodes:F,edges:R})=>(l({nodes:F,edges:R}),!1),Kn={nodes:r,edges:i};return Jt("div",{className:"w-full h-full",children:[!p&&$(_n,{}),$(br,{}),Jt(Ad,{edges:i,nodes:r,nodeTypes:pn,edgeTypes:mn,minZoom:hn,maxZoom:vn,panOnDrag:b||p?!0:Hd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&d,nodesConnectable:!p&&d,nodesDraggable:!p&&d,isValidConnection:_,connectionLineComponent:Qo,onConnect:M,onDrop:S,onDropCapture:Wn,onDragOver:C,onNodesChange:Fn,onEdgesChange:Un,onNodeDrag:w,onNodeDragStop:L,onBeforeDelete:Yn,selectionMode:Sd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:Nn,connectOnClick:!1,children:[u&&$(Id,{pannable:!0,zoomable:!0,position:bn,className:"shadow-md rounded-md"}),Jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&$(Fr,{canUndo:pe,canRedo:Dn,undo:z,redo:ge}),$(Or,{nodes:r,isReadOnly:p,diagram:Kn,onValidationComplete:g,onValidateDiagram:N}),$(Ur,{})]}),$(yn,{horizontal:Rn,vertical:Mn}),$(Cd,{gap:En,size:gn,color:fn,bgColor:un}),y&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(wn,{validationResult:y,onClose:On})})]}),$(xn,{pendingDelete:s,setPendingDelete:l,setNodes:n,setEdges:a})]})},zd=({mode:e,locale:t="pt_BR",onConfigureElement:o,onSelectionAPIReady:r})=>(Qt(()=>{t&&Md.changeLanguage(t)},[t]),$(kd,{children:$(Io,{value:{onConfigureElement:o},children:$(Bd,{mode:e,onSelectionAPIReady:r})})})),eo=zd;var to=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 Fd,Translations as Ud}from"lecom-ui";var Cn={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 In={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 An={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 kn={pt_BR:An,en_US:Cn,es_ES:In};var Sn,Ln,Wd=(Ln=(Sn=to("LecomUserLanguage"))!=null?Sn:to("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Ln:Ud.PT_BR;Fd({lng:Wd,resources:kn});import{jsx as Pn}from"react/jsx-runtime";var ib=e=>Pn(lo,{children:Pn(eo,v({},e))});export{Pt as ActivityVariant,Rt as ComplexVariant,Lt as ElementType,Mt as ExclusiveVariant,ie as GatewayVariant,ib as Modeler,Dt as RoutingVariant};