lecom-modeler 0.1.11 → 0.1.13

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