lecom-modeler 0.1.15 → 0.1.16

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,11 +1,11 @@
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=`
1
+ var Kn=Object.defineProperty,Zn=Object.defineProperties;var $n=Object.getOwnPropertyDescriptors;var Ye=Object.getOwnPropertySymbols;var so=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable;var io=(e,t,o)=>t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))so.call(t,o)&&io(e,o,t[o]);if(Ye)for(var o of Ye(t))lo.call(t,o)&&io(e,o,t[o]);return e},C=(e,t)=>Zn(e,$n(t));var be=(e,t)=>{var o={};for(var r in e)so.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ye)for(var r of Ye(e))t.indexOf(r)<0&&lo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Xn,Notification as qn}from"lecom-ui";import{jsx as jn,jsxs as Jn}from"react/jsx-runtime";function co({children:e}){return Jn(Xn,{children:[jn(qn,{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 ca,ScrollText as pa,SquarePlus as ma}from"lucide-react";import{jsx as Ke,jsxs as Qn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ke("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ke("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ke("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ke("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as po}from"react/jsx-runtime";var he=({size:e=24,className:t})=>po("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:po("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 ke,jsxs as ea}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>ea("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[ke("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"}),ke("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),ke("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),ke("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),ke("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt,jsxs as ta}from"react/jsx-runtime";var ve=({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:[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 oa}from"react/jsx-runtime";var Xe=({size:e=24,className:t})=>oa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Ot("path",{d:"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 ra}from"react/jsx-runtime";var mo=({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:ra("g",{children:[Gt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Gt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as na}from"clsx";import{twMerge as aa}from"tailwind-merge";function A(...e){return aa(na(e))}var Se=(e,t)=>e<t?t:e;import{jsx as uo,jsxs as ia}from"react/jsx-runtime";var fo=({size:e=24,className:t})=>ia("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:[uo("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"}),uo("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht}from"react/jsx-runtime";var go=({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 Eo}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>Eo("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:Eo("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 bo}from"react/jsx-runtime";var Le=({size:e=24,className:t})=>bo("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:bo("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 sa}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>sa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[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 Pe,jsxs as la}from"react/jsx-runtime";var vo=({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:[Pe("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"}),Pe("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"}),Pe("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"}),Pe("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Pe("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as je,jsxs as da}from"react/jsx-runtime";var No=({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:[je("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"}),je("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),je("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),je("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:pa},SUBPROCESS:{icon:ma}};var Qe={LOOP:{icon:ca}},ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ie||{}),et={EXCLUSIVE:{icon:ve},PARALLEL:{icon:Xe},COMPLEX:{icon:$e}};import xo from"@dagrejs/dagre";import{getNodesBounds as Na}from"@xyflow/react";import{orderBy as ya}from"lodash";var ua={MIN_WIDTH:36,MIN_HEIGHT:36},fa={MIN_WIDTH:36,MIN_HEIGHT:36},ga={MIN_WIDTH:56,MIN_HEIGHT:56},tt={MIN_WIDTH:176,MIN_HEIGHT:96},ot={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},rt={MIN_WIDTH:176,MIN_HEIGHT:64},Ea={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:ua,END_EVENT:fa,GATEWAY:ga,TASK:tt,LANE:Y,ANNOTATION:rt,UNSUPPORTED:Ea};import{orderBy as ba}from"lodash";var oe=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}},re=e=>ba(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),yo=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(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)),ha=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},va=(e,t)=>{let{x:o,y:r,w:n,h:i}=oe(e),{x:a,y:s,w:l,h:d}=oe(t);return o<a+l&&a<o+n&&r<s+d&&s<r+i},De=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&va(e,n)){let i=ha(e,n);i<r&&(r=i,o=n)}return o},To=(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 _o=(e=[],t=[],o="LR")=>{let r=new xo.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)),xo.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return C(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},ue=(e,t)=>{var m,f;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let i=ya(n,["position.y"]),a=Math.max((f=(m=r.measured)==null?void 0:m.width)!=null?f:0,ot.MIN_WIDTH),s=To(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),d=0,u=0;i.forEach(g=>{var y,E,b,c;o=o.map(v=>v.id===g.id?C(N({},v),{width:l-Y.HEADER_WIDTH,measured:C(N({},v.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):v),d+=(E=(y=g.measured)==null?void 0:y.height)!=null?E:0,u+=(c=(b=g.measured)==null?void 0:b.height)!=null?c:0}),o=o.map(g=>g.id===e?C(N({},g),{height:u,width:l,measured:C(N({},g.measured),{height:u,width:l})}):g);let p=o.find(g=>g.id===e);return p!=null&&p.parentId&&(o=ue(p.parentId,o)),o},wo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Ta=50,Co=(e,t=Ta)=>{let o=Na(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as xa}from"zustand";var O=xa(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 Vo,useReactFlow as ni}from"@xyflow/react";import{BaseEdge as Ua,EdgeLabelRenderer as Wa,getStraightPath as Ya,useNodes as Ka,useViewport as Za}from"@xyflow/react";import{getIncomers as nt,getOutgoers as zt,useReactFlow as Ia}from"@xyflow/react";import{Button as Aa,Tooltip as ka,TooltipContent as Sa,TooltipTrigger as La,useTranslation as Pa}from"lecom-ui";import{PencilIcon as Da}from"lucide-react";import{createContext as _a,useContext as wa}from"react";var Io=_a(null),Ao=Io.Provider,ko=()=>{let e=wa(Io);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as at,jsxs as Ra}from"react/jsx-runtime";var Re=({elementId:e,elementType:t="node"})=>{let{t:o}=Pa(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=Ia(),{onConfigureElement:s}=ko(),l=c=>{let v=i(),I=a(),T=nt(c,v,I),k=zt(c,v,I),h=T.some(S=>S.type==="START_EVENT"),_=k.some(S=>S.type==="END_EVENT");return h?"start":_?"end":"between"},d=c=>{var S,w,L;let v=i(),I=a(),T=r(c.source),k=r(c.target);if(!T||!k)return"simple";if(zt(T,v,I).some(x=>x.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 x=(w=T.data)==null?void 0:w.variant,M=(L=T.data)==null?void 0:L.attribute;return x==="SCRIPT"?"script":M==="LOOP"?"loop":"simple"}return"simple"},u=c=>{var S;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((S=v.data)==null?void 0:S.variant)!=="COMPLEX")return;let I=i(),T=a(),k=nt(v,I,T),h=!1,_=!1;if(k.forEach(w=>{var L,x;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h&&_)return"script_loop";if(h)return"script";if(_)return"loop"},p=c=>{var S;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((S=v.data)==null?void 0:S.variant)!=="EXCLUSIVE")return;let I=i(),T=a(),k=nt(v,I,T),h=!1,_=!1;if(k.forEach(w=>{var L,x;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(_=!0))}),h)return"script";if(_)return"loop"},m=c=>{var _,S;if(c.type!=="GATEWAY")return;let v=i(),I=a(),T=nt(c,v,I),k=!1,h=!1;if(T.forEach(w=>{var L,x;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(k=!0),((x=w.data)==null?void 0:x.attribute)==="LOOP"&&(h=!0))}),((_=c.data)==null?void 0:_.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}}),g=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 v,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:(v=c.data)==null?void 0:v.label,targets:f(c),edgeTargets:g(c)}),console.log({id:c.id,type:"activity",variant:l(c),label:(I=c.data)==null?void 0:I.label,targets:f(c),edgeTargets:g(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)})}},E=()=>{let c=n(e);if(c){let v=d(c),I;v==="complex"?I=u(c):v==="exclusive"&&(I=p(c)),s==null||s({id:c.id,type:"routing",variant:v,subVariant:I})}};return Ra(ka,{children:[at(La,{asChild:!0,children:at(Aa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":y();break;case"edge":E();break}},children:at(Da,{size:16})})}),at(Sa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Ma}from"@xyflow/react";import{Button as Va,Tooltip as Oa,TooltipContent as Ga,TooltipTrigger as Ha,useTranslation as Ba}from"lecom-ui";import{TrashIcon as za}from"lucide-react";import{jsx as st,jsxs as Fa}from"react/jsx-runtime";var lt=({elementId:e,elementType:t="node"})=>{let{t:o}=Ba(),{deleteElements:r}=Ma();return Fa(Oa,{children:[st(Ha,{asChild:!0,children:st(Va,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:st(za,{size:16})})}),st(Ga,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as dt}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:dt(lt,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:dt(Re,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return dt("div",C(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,d)=>dt("div",{children:l.component},d))}))};import{jsx as pt,jsxs as $a}from"react/jsx-runtime";var mt={type:"ANNOTATION_EDGE",zIndex:2e3},So=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let d=Ka(),{zoom:u}=Za(),p=d.find(c=>c.id===t),m=d.find(c=>c.id===o),[f,g,y]=Ya({sourceX:r,sourceY:n,targetX:i,targetY:a}),E=s||(p==null?void 0:p.selected)||(m==null?void 0:m.selected),b=1/u;return $a("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":E}),children:[pt(Ua,{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)]":E&&!(l!=null&&l.hasError)})}),pt(Wa,{children:pt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${g}px, ${y}px)`},children:s&&pt(ye,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${b})`}})})})]})};import{BaseEdge as ja,EdgeLabelRenderer as Ja,getSmoothStepPath as Qa,MarkerType as Do,useNodes as ei,useReactFlow as ti,useViewport as oi}from"@xyflow/react";import{useState as ri}from"react";import{useEffect as Lo,useRef as Xa,useState as qa}from"react";import{jsx as Po}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=Xa(null),[l,d]=qa(!1);Lo(()=>{d(r!=null?r:!1)},[r]),Lo(()=>{if(l&&s.current){s.current.focus();let f=document.createRange();f.selectNodeContents(s.current),f.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(f))}},[l]);let u=f=>{f.stopPropagation(),d(!0)},p=f=>{let g=f.currentTarget.innerText;t&&g.length>=t&&f.preventDefault()},m=f=>{d(!1),n==null||n(),o==null||o(f.currentTarget.innerText)};return Po("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:u,children:Po("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:p,onBlur:m,children:e})})};import{jsx as ut,jsxs as Ro}from"react/jsx-runtime";var se={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Do.ArrowClosed},markerEnd:{type:Do.Arrow},data:{label:""}},Mo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:u})=>{let p=ei(),{zoom:m}=oi(),{updateEdgeData:f}=ti(),[g,y]=ri(!1),E=p.find(x=>x.id===t),b=p.find(x=>x.id===o),[c,v,I]=Qa({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),T=u||(E==null?void 0:E.selected)||(b==null?void 0:b.selected),k=T?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(d==null?void 0:d.label.trim().length)>0,_=1/m,S=()=>{y(!0)},w=()=>{y(!1)},L=x=>{f(e,{label:x.trim()})};return Ro("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":T}),onBlur:w,onDoubleClick:S,children:[ut(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)})}),ut(Ja,{children:Ro("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${v}px, ${I}px)`},children:[u&&ut(ye,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${_})`}}),h&&ut(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};var Oo=({setEdges:e})=>{let{getNode:t}=ni();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"?Vo(N(N({},n),mt),i):Vo(N(N({},n),se),i)})}}};import{useState as Ko}from"react";import{useTranslation as ai}from"lecom-ui";import{useReactFlow as ii}from"@xyflow/react";var Me=(e=[])=>e.filter(t=>t.type==="START_EVENT"),fe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),le=(e=[])=>e.filter(t=>t.type==="TASK")||[],Go=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ho=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ft=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Bo=(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),Ve=(e,t=[])=>t.filter(o=>o.target===e),zo=(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"},Fo=(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},Uo=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)}},Wo=(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 Oe=[{id:"start_event_not_found",validate:e=>{let t=Me(e.nodes);return P({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=fe(e.nodes);return P({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Me(e.nodes),o=t.length===1;if(t.length===0)return P({isValid:!0});if(!o)return P({isValid:!1,nodeIds:t.map(i=>i.id)});let 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=ft(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=[...Me(e.nodes),...fe(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=fe(e.nodes),o=[],r=[];for(let n of t){let i=Ve(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=Bo(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||Uo(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=fe(e.nodes)[0];if(!t)return P({isValid:!0});let o=Ve(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=>!zo(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=fe(e.nodes)[0];if(!o)return P({isValid:!0});let r=t.filter(l=>{let d=Ve(l.id,e.edges),u=X(l.id,e.edges),p=d.some(f=>{var g;return((g=e.nodes.find(y=>y.id===f.source))==null?void 0:g.type)==="START_EVENT"}),m=u.some(f=>{var g;return((g=e.nodes.find(y=>y.id===f.target))==null?void 0:g.type)==="END_EVENT"});return p&&m}),n=Ve(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=ft(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=ft(e.nodes),o=Q(t,r=>X(r.id,e.edges).length>=1);return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Me(e.nodes),...fe(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=Go(e.nodes),o=Q(t,r=>!Fo(r.id,e));return P({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ho(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 Yo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Oe){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 Zo=()=>{let{t:e}=ai(),[t,o]=Ko(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=ii(),[s,l]=Ko(!1);return{validationResult:t,validateDiagram:m=>{let f=Wo(m.nodes,m.edges),g=Yo(f),y=g.errors.map(E=>C(N({},E),{message:e(`validation.errors.${E.id}`)}));return s||l(!0),{isValid:g.isValid,errors:y}},handleValidationComplete:m=>{if(o(m),!m)return;let f=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(_=>f.push(_)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(_=>g.push(_))});let y=[...new Set(f)];r(h=>h.map(_=>C(N({},_),{data:C(N({},_.data),{hasError:!1})}))),n(h=>h.map(_=>C(N({},_),{data:C(N({},_.data),{hasError:!1})})));let E=i(),b=a(),c=new Set(y),v=new Set;m.errors.forEach(h=>{var w,L;let _=Oe.find(x=>x.id===h.id);(_==null?void 0:_.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(x=>v.add(x)),(L=h.nodeIds)==null||L.forEach(x=>{b.forEach(M=>{(M.source===x||M.target===x)&&v.add(M.id)})}))});let I=new Set,T=new Set,k=new Set;E.forEach(h=>{h.type==="START_EVENT"?I.add(h.id):h.type==="END_EVENT"&&T.add(h.id)}),b.forEach(h=>{I.has(h.source)&&k.add(h.target),T.has(h.target)&&k.add(h.source)}),k.forEach(h=>{var _,S;if(c.has(h)){let w=(_=m.errors.find(x=>{var M;return(M=x.nodeIds)==null?void 0:M.includes(h)}))==null?void 0:_.id;((S=Oe.find(x=>x.id===w))==null?void 0:S.highlightRelatedEdges)!==!1&&b.forEach(x=>{x.source===h&&T.has(x.target)&&(c.add(x.target),v.add(x.id)),x.target===h&&I.has(x.source)&&(c.add(x.source),v.add(x.id))})}}),c.size>0&&r(h=>h.map(_=>C(N({},_),{data:C(N({},_.data),{hasError:c.has(_.id)})}))),v.size>0&&n(h=>h.map(_=>C(N({},_),{data:C(N({},_.data),{hasError:v.has(_.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(f=>C(N({},f),{data:C(N({},f.data),{hasError:!1})}))),n(m=>m.map(f=>C(N({},f),{data:C(N({},f.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as si}from"@xyflow/react";import{useEffect as li}from"react";import{v7 as $o}from"uuid";var di=15,Xo="bpmn:selection",qo=({offset:e=di}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=si();li(()=>{let i=s=>{var f;s.preventDefault();let l=t(),d=r(),u=l.filter(g=>g.selected);if(!u.length)return;let p=d.filter(g=>u.some(y=>y.id===g.source)&&u.some(y=>y.id===g.target)),m={nodes:u,edges:p};(f=s.clipboardData)==null||f.setData(Xo,JSON.stringify(m))},a=s=>{var m,f;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Xo))||"{}");if(!((f=l.nodes)!=null&&f.length))return;let d=new Map,u=l.nodes.map(g=>{let y=$o();return d.set(g.id,y),C(N({},g),{id:y,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),p=l.edges.map(g=>C(N({},g),{id:$o(),selected:!0,source:d.get(g.source)||g.source,target:d.get(g.target)||g.target}));o(g=>[...g.map(y=>C(N({},y),{selected:!1})),...u]),n(g=>[...g.map(y=>C(N({},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 Ni,useStoreApi as yi}from"@xyflow/react";import{v7 as tr}from"uuid";import{create as ci}from"zustand";var Te=ci(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as pi,EdgeLabelRenderer as mi,getSmoothStepPath as ui,MarkerType as fi,useNodes as gi,useReactFlow as Ei,useViewport as bi}from"@xyflow/react";import{useState as hi}from"react";import{jsx as gt,jsxs as jo}from"react/jsx-runtime";var zm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:fi.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:u})=>{let p=gi(),{zoom:m}=bi(),{updateEdgeData:f}=Ei(),[g,y]=hi(!1),E=p.find(x=>x.id===t),b=p.find(x=>x.id===o),[c,v,I]=ui({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),T=u||(E==null?void 0:E.selected)||(b==null?void 0:b.selected),k=T?"sequence-edge-marker-highlighted":"sequence-edge-marker",h=g||(d==null?void 0:d.label.trim().length)>0,_=1/m,S=()=>{y(!0)},w=()=>{y(!1)},L=x=>{f(e,{label:x.trim()})};return jo("g",{className:A("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":T}),onBlur:w,onDoubleClick:S,children:[gt(pi,{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)})}),gt(mi,{children:jo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${v}px, ${I}px)`},children:[u&&gt(ye,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${_})`}}),h&&gt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:g,onChange:L})]})})]})};import{jsx as Qo,jsxs as vi}from"react/jsx-runtime";var er=({fromX:e,fromY:t,toX:o,toY:r})=>vi("g",{children:[Qo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),Qo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var or=({nodes:e,setNodes:t,setEdges:o})=>{let r=yi(),{draggableNode:n,setDraggableNode:i}=Te(),{getInternalNode:a,screenToFlowPosition:s}=Ni(),l=E=>{let b="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(c=>c.map(v=>C(N({},v),{className:v.id===E?b:""})))},d=()=>{let{nodeLookup:E}=r.getState();return Array.from(E.values())},u=E=>{let b=a(E.id),c=d();if(E.type==="LANE"){if(Ne({parentId:E.id,nodes:e,includeTypes:["LANE"]})){l();return}let _=c.filter(L=>L.id!==E.id&&L.type==="LANE"&&!L.parentId),S=De(b,_);if(!S){l();return}if(Ne({parentId:S.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(S.id);return}let I=c.filter(h=>h.id!==E.id&&h.type==="LANE"),T=De(b,I);if(!T){l();return}if(Ne({parentId:T.id,nodes:e,includeTypes:["LANE"]})){l();return}l(T.id)},p=E=>{E.preventDefault(),E.dataTransfer.dropEffect="move"},m=(E,b)=>{E.preventDefault(),u(b)},f=(E,b,c)=>{var _,S;let v=w=>w.map(L=>C(N({},L),{className:void 0}));if(E.parentId===b.id){let w=ue(b.id,c);t(re(v(w)));return}if(E.type==="LANE"){if(Ne({parentId:b.id,nodes:c,excludeTypes:["LANE"]}))return;let x=c.filter(z=>z.parentId===b.id).reduce((z,ae)=>{var pe,me;return z+((me=(pe=ae.measured)==null?void 0:pe.height)!=null?me:0)},0),M={x:Y.HEADER_WIDTH,y:x},K=c.map(z=>z.id===E.id?C(N({},z),{parentId:b.id,position:M,className:void 0}):C(N({},z),{className:void 0}));K=ue(b.id,K),t(re(K));return}if(Ne({parentId:b.id,nodes:c,includeTypes:["LANE"]})){let w;if(E.parentId){let x=a(E.parentId),{x:M,y:K}=oe(x);w={x:M+((_=E.position.x)!=null?_:0),y:K+((S=E.position.y)!=null?S:0)}}let L=c.map(x=>x.id===E.id?C(N({},x),{position:w!=null?w:x.position,parentId:void 0,className:void 0}):C(N({},x),{className:void 0}));t(re(L));return}let k=yo(E,b),h=c.map(w=>w.id===E.id?C(N({},w),{parentId:b.id,position:k,className:void 0}):C(N({},w),{className:void 0}));t(re(h))};return{onDragOver:p,onDrop:E=>{if(E.preventDefault(),!(n!=null&&n.type))return;let b=s({x:E.clientX,y:E.clientY}),c={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},v={id:tr(),type:n.type,position:b,measured:c,data:{label:"",variant:n.variant,attribute:n.attribute}},I=C(N({},v),{internals:{positionAbsolute:b}}),T=d(),k=n.type==="LANE",h=T.filter(w=>k?w.type==="LANE"&&!w.parentId:w.type==="LANE"),_=De(I,h);_?f(I,_,[...T,I]):t(w=>{let L=w.concat(v);return re(L)});let S=E.dataTransfer.getData("sourceId");if(S){let w={id:tr(),source:S,target:v.id};if(n.type==="ANNOTATION"){o(L=>L.concat(N(N({},w),mt)));return}o(L=>L.concat(N(N({},w),se)))}i(null)},onNodeDrag:m,onNodeDragStop:async(E,b)=>{var _,S;let{nodeLookup:c}=r.getState(),v=a(b.id),I=Array.from(c.values()),T=b.type==="LANE",k=I.filter(w=>w.id!==b.id&&(T?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=De(v,k);if(h){f(v,h,I);return}if(b.parentId){let w=a(b.parentId),{x:L,y:x}=oe(w),M={x:L+((_=b.position.x)!=null?_:0),y:x+((S=b.position.y)!=null?S:0)},K=e.map(z=>z.id===b.id?C(N({},z),{position:M,parentId:void 0}):z);K=ue(b.parentId,K),t(re(K))}}}};import{applyNodeChanges as Ti}from"@xyflow/react";import{useCallback as xi,useState as nr}from"react";function rr(e,t,o=5){var l,d,u,p,m,f,g,y;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(E=>E.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=(u=n.measured)==null?void 0:u.height)!=null?p:0),width:(f=(m=n.measured)==null?void 0:m.width)!=null?f:0,height:(y=(g=n.measured)==null?void 0:g.height)!=null?y:0},a=o,s=o;return t.filter(E=>E.id!==n.id).reduce((E,b)=>{var L,x,M,K,z,ae,pe,me;let c={left:b.position.x,right:b.position.x+((x=(L=b.measured)==null?void 0:L.width)!=null?x:0),top:b.position.y,bottom:b.position.y+((K=(M=b.measured)==null?void 0:M.height)!=null?K:0),width:(ae=(z=b.measured)==null?void 0:z.width)!=null?ae:0,height:(me=(pe=b.measured)==null?void 0:pe.height)!=null?me:0},v=Math.abs(i.left-c.left);v<s&&(E.snapPosition.x=c.left,E.vertical=c.left,s=v);let I=Math.abs(i.right-c.right);I<s&&(E.snapPosition.x=c.right-i.width,E.vertical=c.right,s=I);let T=Math.abs(i.left-c.right);T<s&&(E.snapPosition.x=c.right,E.vertical=c.right,s=T);let k=Math.abs(i.right-c.left);k<s&&(E.snapPosition.x=c.left-i.width,E.vertical=c.left,s=k);let h=Math.abs(i.top-c.top);h<a&&(E.snapPosition.y=c.top,E.horizontal=c.top,a=h);let _=Math.abs(i.bottom-c.top);_<a&&(E.snapPosition.y=c.top-i.height,E.horizontal=c.top,a=_);let S=Math.abs(i.bottom-c.bottom);S<a&&(E.snapPosition.y=c.bottom-i.height,E.horizontal=c.bottom,a=S);let w=Math.abs(i.top-c.bottom);return w<a&&(E.snapPosition.y=c.bottom,E.horizontal=c.bottom,a=w),E},r)}var ar=()=>{let[e,t]=nr(void 0),[o,r]=nr(void 0),n=xi((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 Ti(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as wi}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}},_i=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}=_i(e);return{nodes:t,edges:o}};var pr=()=>{let{setNodes:e,setEdges:t,fitView:o}=wi();return{createDiagram:n=>{let{nodes:i,edges:a}=dr(n),s=[],l=new Map;for(let[m,f]of Object.entries(i)){let g=cr(),y=sr[f.type],E=lr[f.type];l.set(m,g);let b=V[y].MIN_WIDTH,c=V[y].MIN_HEIGHT;s.push({id:g,type:y,data:{label:f.label||"",variant:E,attribute:""},position:{x:0,y:0},width:b,height:c,measured:{width:b,height:c}})}let d=[];for(let m of a){let f=C(N({},se),{id:cr(),source:l.get(m.sourceId)||m.sourceId,target:l.get(m.targetId)||m.targetId});d.push(f)}let{nodes:u,edges:p}=_o(s,d);e(u),t(p),o()}}};import{useEffect as Ci,useCallback as Ii}from"react";var Ai={origin:"*",debug:!1};function mr(e,t=Ai){let{origin:o,debug:r}=t,n=Ii((i,a)=>{r&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,r]);return Ci(()=>{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 ki,useStore as Si,useStoreApi as Li}from"@xyflow/react";import{useCallback as Ft}from"react";var Pi=e=>({unselectAll:e.unselectNodesAndEdges,addSelectedNodes:e.addSelectedNodes,addSelectedEdges:e.addSelectedEdges}),ge=()=>{let e=Li(),{getNodes:t,getEdges:o}=ki(),{unselectAll:r,addSelectedNodes:n,addSelectedEdges:i}=Si(Pi),a=Ft(u=>{let p=t(),m=o(),f=p.find(y=>y.id===u);if(f)return{found:!0,type:"node",element:f};let g=m.find(y=>y.id===u);return g?{found:!0,type:"edge",element:g}:{found:!1,type:null,element:null}},[t,o]),s=async()=>(r(),new Promise(u=>{setTimeout(u,1e3)})),l=Ft(u=>{try{r();let p=a(u);if(!p.found)return!1;switch(p.type){case"node":n([u]);break;case"edge":i([u]);break;default:return!1}return!0}catch(p){return!1}},[r,n,i,a]),d=Ft(()=>!0,[]);return{deselectAll:s,selectElement:l,isReady:d,store:e,getElement:a}};import{useReactFlow as Di}from"@xyflow/react";import{useCallback as Ge,useState as ur}from"react";import{useDebouncedCallback as Ri}from"use-debounce";var Mi={nodes:[],edges:[]},Vi=500,fr=10,gr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=Di(),[n,i]=ur([Mi]),[a,s]=ur(0),l=n[a],d=a>0,u=a<n.length-1,p=Ge(c=>{o(n[c].nodes),r(n[c].edges)},[n,o,r]),m=Ge(()=>{if(a>0){let c=a-1;s(c),p(c)}},[a,p]),f=Ge(()=>{if(a<n.length-1){let c=a+1;s(c),p(c)}},[n,a,p]),g=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=Ri(()=>{let c=e(),v=t(),I={nodes:c,edges:v};JSON.stringify(l)!==JSON.stringify(I)&&g(I)},Vi),E=Ge(c=>{if(c==="forceSave"){y();return}c.some(I=>I.type!=="select")&&y()},[y]),b=Ge(()=>{i([]),s(0)},[]);return{undo:m,redo:f,saveHistory:E,canUndo:d,canRedo:u,clearHistory:b}};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 Oi}from"react/jsx-runtime";var br=()=>Wt("svg",{style:{position:"absolute",top:0,left:0},children:Oi("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{Tooltip as ls,TooltipContent as ds,TooltipTrigger as cs,useNotificationToast as ps,useTranslation as ms}from"lecom-ui";var He=(b=>(b.START_EVENT="START_EVENT",b.END_EVENT="END_EVENT",b.TASK="TASK",b.SUBPROCESS="SUBPROCESS",b.GATEWAY="GATEWAY",b.ANNOTATION="ANNOTATION",b.CONNECTION="CONNECTION",b.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",b.ACTIVITY="ACTIVITY",b.PROCESS_INTERFACE="PROCESS_INTERFACE",b.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",b.VARIANT_ACTIVITY="VARIANT_ACTIVITY",b.AUTO_ACTIVITY="AUTO_ACTIVITY",b.DATA_STORE="DATA_STORE",b.DATA_OBJECT="DATA_OBJECT",b.DATA_OUTPUT="DATA_OUTPUT",b.DATA_INPUT="DATA_INPUT",b))(He||{});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,C(N({},t),{attributeValueFn:Bi})))}function yr(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Fi}from"uuid";var rf={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 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}}},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:xe({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:xe({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=Se(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Se(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:xe({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: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=Se(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Se(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:xe({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:xe({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},wr=(e,t)=>{let{source:o,target:r}=e._attributes;return C(N({},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(He),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,u=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}=u(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(u=>[u.originalType,u.value,e(`adapter.governance.report.status.${u.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action: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:u}=await Ir(s);if(o(m=>m.concat(l)),r(m=>m.concat(d)),n(),u.some(m=>m.status==="unsupported")){i(u);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=be(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=as(null),u=m=>{let f=m.target.files;f!=null&&f.length&&i(f),d.current&&(d.current.value="")};return ss(is,{children:[kr(ns,C(N({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:u})]})};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(mo,{})})}),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}=ge(),[r,n]=hs({png:!1,html:!1,print:!1}),i=()=>{let{x:u,y:p,width:m,height:f}=Co(t());return{width:m,height:f,style:{width:`${m}px`,height:`${f}px`,transform:`translate(${-u}px, ${-p}px)`}}},a=async(u,p)=>{n(C(N({},r),{[p]:!0})),await o();try{let m=wo();if(!m)throw new Error("Flow element not found");let f=i();return await u(m,f)}catch(m){Es({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(C(N({},r),{[p]:!1}))}};return{exportAsPng:async(u=Yt)=>{await a(async(p,m)=>{let f=await Pr(p,C(N({},m),{backgroundColor:"#fcfcfc"}));Et(f,`${u}.png`)},"png")},exportAsHtml:async(u=Yt)=>{await a(async(p,m)=>{let f=await gs(p,C(N({},m),{backgroundColor:"#fcfcfc"})),g=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
8
- <title>${b}</title>
8
+ <title>${u}</title>
9
9
  <style>
10
10
  body { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #eee; }
11
11
  img { max-width: 95%; max-height: 95vh; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
@@ -15,11 +15,11 @@ var Zn=Object.defineProperty,$n=Object.defineProperties;var Xn=Object.getOwnProp
15
15
  <img src="${f}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
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(`
18
+ `,y=new Blob([g],{type:"text/html"}),E=URL.createObjectURL(y);Et(E,`${u}.html`),setTimeout(()=>URL.revokeObjectURL(E),100)},"html")},printDiagram:async(u=Yt)=>{await a(async(p,m)=>{let f=await Pr(p,C(N({},m),{pixelRatio:vs})),g=window.open("","_blank");if(!g)throw new Error("Failed to open print window.");let y=g.document;y.open(),y.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
22
- <title>${b}</title>
22
+ <title>${u}</title>
23
23
  <style>
24
24
  @page { size: auto; margin: 0mm; }
25
25
  @media print { body { margin: 0; } img { width: 100%; height: auto; vertical-align: middle; } }
@@ -31,4 +31,4 @@ var Zn=Object.defineProperty,$n=Object.defineProperties;var Xn=Object.getOwnProp
31
31
  <img src="${f}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as xe}from"react/jsx-runtime";function 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};
34
+ `),y.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as _e}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 _e(ys,{modal:!1,open:s,onOpenChange:l,children:[G(xs,{asChild:!0,children:G("div",{children:_e(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")})]})})}),_e(Ts,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[_e(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")})]}),_e(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")})]}),_e(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}=ge(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:u,isMinimapOpen:p,setIsMinimapOpen:m}=O(),f=Mr(["v","V"]),g=Mr(["h","H"]),y=Ms(()=>{a(),u()},[a,u]),E=()=>{a();let b=n(o);r&&r(b)};return Vr(()=>{f&&!s&&!t&&d()},[f,d,s,t]),Vr(()=>{g&&!l&&!t&&y()},[g,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:E,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 Be}from"react/jsx-runtime";var Ur=()=>{let{t:e}=zs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Bs();return Be("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Be(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")})]}),Be(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")})]}),Be(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(go,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),Be(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 we=o=>{var r=o,{nodeId:e}=r,t=be(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=$s(),s=({width:l,height:d})=>{if(!e)return;let u=n(e);if((u==null?void 0:u.type)!=="LANE")return;let p=[...i()],m=!u.parentId,f=m?u.id:u.parentId,g=p.filter(b=>b.type==="LANE"&&b.parentId===f);if(!g.length)return;let y=Xs(g,["position.y"]),E=0;y.forEach((b,c)=>{var T,k;let v=c===y.length-1,I=(k=(T=b.measured)==null?void 0:T.height)!=null?k:0;p=p.map(h=>{if(h.id===b.id){let _=m?l-Y.HEADER_WIDTH:l,S=C(N({},h),{width:_,measured:C(N({},h.measured),{width:_}),position:C(N({},h.position),{y:E})});return v&&m&&(S.height=d-E),S}return h}),E+=I}),p=p.map(b=>{if(b.id===f){let c=m?l:l+Y.HEADER_WIDTH;return C(N({},b),{width:c,height:m?d:E,measured:{width:c,height:m?d:E}})}return b}),a(p)};return qs(Zs,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as _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 ne,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:[ne(ll,{asChild:!0,children:ne(al,{asChild:!0,children:ne(Qs,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(cl,{})})})}),ne(sl,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(tl,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(nl,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(ol,{children:Object.entries(et).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:[ne(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 ze}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 ze(ul,{children:[ze(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")})]}),ze(fl,{align:"start",className:"w-60 bg-white text-grey-600",children:[ze(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(Qe).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])=>ze(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 u;let{t:n}=Sl(),{setDraggableNode:i}=Te(),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: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:Ze,label:n("bpmn.annotation.variant.default")}},l=[{component:j(lt,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(Re,{elementId:e})},{component:j(Kr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(Re,{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:(u=d[t])==null?void 0:u.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 Fe,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:[Fe("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:Fe(U,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),Fe(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),Fe(we,{isVisible:!r&&!i&&o,minWidth:rt.MIN_WIDTH,minHeight:rt.MIN_HEIGHT}),Fe(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 Ce,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:[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(B,{type:"source",position:$r.Right}),Ce(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 Ie,jsxs as Jr}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let n=et[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:[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(B,{type:"target",position:jr.Left}),Ie(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 Ue,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:[Ue(qe,{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})}),Ue("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ue(U,{value:t.label,isEditing:a,onChange:l})})]}),Ue(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),Ue(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?Qe[t.attribute].icon:null,d=t.variant==="SUBPROCESS",u=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":u||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(we,{isVisible:!r&&!i&&o,minWidth:tt.MIN_WIDTH,minHeight:tt.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 Ee,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,u=ln(()=>Jl([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),p=d?ot.MIN_WIDTH:Y.MIN_WIDTH,m=ln(()=>{if(d&&u.length>1){let g=[...u];return g.pop(),g.reduce((E,b)=>{var c,v;return E+((v=(c=b.measured)==null?void 0:c.height)!=null?v:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,u]),f=g=>{i(e,{label:g})};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:[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:f})})}),Ee("div",{className:"flex-1"})]}),Ee(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),Ee(we,{nodeId:e,minWidth:p,minHeight:m,isVisible:!r&&!s&&o}),d&&Ee(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:Mo,MESSAGE_EDGE:Jo,ANNOTATION_EDGE:So},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 u=window.devicePixelRatio;l.width=n*u,l.height=i*u,d.scale(u,u),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(u=>u.filter(p=>!l.some(m=>m.id===p.id))),d!=null&&d.length&&r(u=>u.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 We,jsxs as bd}from"react/jsx-runtime";var _n=()=>{let{t:e}=Ed(),{setDraggableNode:t}=Te(),o=[{type:"START_EVENT",icon:qe,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:No,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:vo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ho,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Xe,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:$e,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:fo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ze,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return We("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:[We(gd,{asChild:!0,children:We(md,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:We(n.icon,{})},i)}),We(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",selectorRef:t})=>{let o=Vd(!1),[r,n]=Pd([]),[i,a]=Ld([]),[s,l]=Od(null),{isMoveTool:d,isHandTool:u,isReadOnly:p,setIsReadOnly:m,setIsMultipleSelection:f,isMinimapOpen:g}=O(),{validationResult:y,handleValidationComplete:E,clearValidation:b,isAutoValidationEnabled:c,validateDiagram:v}=Zo(),{getNode:I,getNodes:T,getEdges:k}=Rd(),{onNodeDrag:h,onDrop:_,onDragOver:S,onNodeDragStop:w}=or({nodes:r,setNodes:n,setEdges:a}),{isValidConnection:L,onConnect:x}=Oo({setEdges:a});qo();let{createDiagram:M}=pr(),{undo:K,redo:z,saveHistory:ae,canUndo:pe,canRedo:me}=gr(),{helperLineHorizontal:Dn,helperLineVertical:Rn,customApplyNodeChanges:Mn}=ar(),oo=ge();Qt(()=>{t&&(t.current=oo)},[t,oo]),mr({LIA_CREATE_DIAGRAM:M,CLEAR_DIAGRAM:()=>{n([]),a([])}}),Qt(()=>{m(e==="readonly")},[e,m]);let Vn=()=>{b()},On=jt(({nodes:F,edges:R})=>{let Ae=F.length+R.length>1;f(Ae)},[f]);Dd({onChange:On});let Gn=F=>{let R=I(F.id);if(R!=null&&R.parentId&&(R==null?void 0:R.type)==="LANE"){let Ae=ue(R.parentId,r.filter(ao=>ao.id!==R.id&&ao.type==="LANE"));n(re(Ae))}},Hn=F=>{F.forEach(R=>{switch(R.type){case"remove":Gn(R);break}})},Bn=jt(()=>{if(!c){o.current=!1;return}let F=T(),R=k(),Ae=v({nodes:F,edges:R});E(Ae),o.current=!1},[c,T,k,v,E]),ro=Gd(Bn,300),no=jt(()=>{c&&!o.current&&(o.current=!0,ro())},[c,ro]),zn=F=>{n(R=>Mn(F,R)),ae(F),no(),Hn(F)},Fn=F=>{a(R=>wd(F,R)),ae(F),no()},Un=()=>{ae("forceSave")},Wn=async({nodes:F,edges:R})=>(l({nodes:F,edges:R}),!1),Yn={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:u||p?!0:Hd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&d,nodesConnectable:!p&&d,nodesDraggable:!p&&d,isValidConnection:L,connectionLineComponent:er,onConnect:x,onDrop:_,onDropCapture:Un,onDragOver:S,onNodesChange:zn,onEdgesChange:Fn,onNodeDrag:h,onNodeDragStop:w,onBeforeDelete:Wn,selectionMode:Sd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:Nn,connectOnClick:!1,children:[g&&$(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:me,undo:K,redo:z}),$(Or,{nodes:r,isReadOnly:p,diagram:Yn,onValidationComplete:E,onValidateDiagram:v}),$(Ur,{})]}),$(yn,{horizontal:Dn,vertical:Rn}),$(Cd,{gap:En,size:gn,color:fn,bgColor:un}),y&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(wn,{validationResult:y,onClose:Vn})})]}),$(xn,{pendingDelete:s,setPendingDelete:l,setNodes:n,setEdges:a})]})},zd=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:r})=>(Qt(()=>{t&&Md.changeLanguage(t)},[t]),$(kd,{children:$(Ao,{value:{onConfigureElement:o},children:$(Bd,{mode:e,selectorRef: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(co,{children:Pn(eo,N({},e))});export{Pt as ActivityVariant,Rt as ComplexVariant,Lt as ElementType,Mt as ExclusiveVariant,ie as GatewayVariant,ib as Modeler,Dt as RoutingVariant,ge as useSelectionUtils};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-modeler",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",