import{aP as Ul,aQ as bs,ap as xs,aR as Fl,ar as Es,aS as zl,aT as Gl,aU as Gn,aV as $l,aW as Os,aX as Vl,aY as Ts,aZ as Wl,a_ as Kl,as as Zl,a$ as ql,b0 as Jl,b1 as Ql,b2 as tu,b3 as eu,b4 as ru,b5 as nu,aq as ws,b6 as ou,b7 as iu,b8 as Y,b9 as pi,ba as Ss,bb as so,bc as We,bd as de,be as Qe,bf as Je,bg as au,bh as su,bi as Ms,N as Oo,bj as lu,bk as uu,aF as $n,a6 as cu,d as fu,m as Ii,j as du,n as pu,w as hu,p as vu,o as yu,c as gu,e as _u,_ as mu}from"./index.js";import{f as Ie}from"./find.5020d717.js";var bu=Object.prototype,xu=bu.hasOwnProperty,Eu=Ul(function(r,t){if(bs(t)||xs(t)){Fl(t,Es(t),r);return}for(var e in t)xu.call(t,e)&&zl(r,e,t[e])}),tt=Eu;function Ou(r,t,e,n){var o=-1,i=r==null?0:r.length;for(n&&i&&(e=r[++o]);++o2&&(a.children=arguments.length>3?Vn.call(arguments,2):e),typeof r=="function"&&r.defaultProps!=null)for(i in r.defaultProps)a[i]===void 0&&(a[i]=r.defaultProps[i]);return _n(r,a,n,o,null)}function _n(r,t,e,n,o){var i={type:r,props:t,key:e,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o==null?++Ps:o,__i:-1,__u:0};return o==null&&H.vnode!=null&&H.vnode(i),i}function vi(){return{current:null}}function er(r){return r.children}function $(r,t){this.props=r,this.context=t}function rr(r,t){if(t==null)return r.__?rr(r.__,r.__i+1):null;for(var e;tt&&Pe.sort(wo));En.__r=0}function js(r,t,e,n,o,i,a,s,l,u,f){var c,d,p,y,h,g=n&&n.__k||Ns,v=t.length;for(e.__d=l,Gu(e,t,g),l=e.__d,c=0;c0?_n(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=r,o.__b=r.__b+1,i=null,(s=o.__i=$u(o,e,a,f))!==-1&&(f--,(i=e[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&c--,typeof o.type!="function"&&(o.__u|=65536)):s!==a&&(s==a-1?c--:s==a+1?c++:(s>a?c--:c++,o.__u|=65536))):o=r.__k[n]=null;if(f)for(n=0;n(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||s=0){if((l=t[a])&&(131072&l.__u)==0&&o==l.key&&i===l.type)return a;a--}if(s=r.length&&(r=void 0),{value:r&&r[e++],done:!r}}}}function Ke(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i}function Ti(){for(var r=[],t=0;t2&&vr("box");var e=Ve(t);return new je(r,qr(e),e.name,!0,e.equals)},array:function(r,t){arguments.length>2&&vr("array");var e=Ve(t);return of(r,qr(e),e.name)},map:function(r,t){arguments.length>2&&vr("map");var e=Ve(t);return new Ai(r,qr(e),e.name)},set:function(r,t){arguments.length>2&&vr("set");var e=Ve(t);return new dl(r,qr(e),e.name)},object:function(r,t,e){typeof arguments[1]=="string"&&vr("object");var n=Ve(e);if(n.proxy===!1)return jo({},r,t,n);var o=il(n),i=jo({},void 0,void 0,n),a=ef(i);return al(a,r,t,o),a},ref:Fs,shallow:pc,deep:wi,struct:hc},E=vc;Object.keys(zi).forEach(function(r){return E[r]=zi[r]});function vr(r){X("Expected one or two arguments to observable."+r+". Did you accidentally try to use observable."+r+" as decorator?")}var Sn=Hs(!1,function(r,t,e,n,o){at(e&&e.get,"Trying to declare a computed value for unspecified getter '"+It(t)+"'");var i=e.get,a=e.set,s=o[0]||{};Pi(r).addComputedProp(r,t,it({get:i,set:a,context:r},s))}),yc=Sn({equals:nr.structural}),et=function(t,e,n){if(typeof e=="string"||t!==null&&typeof t=="object"&&arguments.length===1)return Sn.apply(null,arguments);at(typeof t=="function","First argument to `computed` should be an expression."),at(arguments.length<3,"Computed takes one or two arguments if used as function");var o=typeof e=="object"?e:{};return o.get=t,o.set=typeof e=="function"?e:o.set,o.name=o.name||t.name||"",new ir(o)};et.struct=yc;var Z;(function(r){r[r.NOT_TRACKING=-1]="NOT_TRACKING",r[r.UP_TO_DATE=0]="UP_TO_DATE",r[r.POSSIBLY_STALE=1]="POSSIBLY_STALE",r[r.STALE=2]="STALE"})(Z||(Z={}));var Kt;(function(r){r[r.NONE=0]="NONE",r[r.LOG=1]="LOG",r[r.BREAK=2]="BREAK"})(Kt||(Kt={}));var Mn=function(){function r(t){this.cause=t}return r}();function mr(r){return r instanceof Mn}function Po(r){switch(r.dependenciesState){case Z.UP_TO_DATE:return!1;case Z.NOT_TRACKING:case Z.STALE:return!0;case Z.POSSIBLY_STALE:{for(var t=Si(!0),e=hr(),n=r.observing,o=n.length,i=0;i0;D.computationDepth>0&&t&&X("Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: "+r.name),!D.allowStateChanges&&(t||D.enforceActions==="strict")&&X((D.enforceActions?"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ")+r.name)}function gc(r){!D.allowStateReads&&D.observableRequiresReaction&&console.warn("[mobx] Observable "+r.name+" being read outside a reactive context")}function zs(r,t,e){var n=Si(!0);$s(r),r.newObserving=new Array(r.observing.length+100),r.unboundDepsCount=0,r.runId=++D.runId;var o=D.trackingDerivation;D.trackingDerivation=r;var i;if(D.disableErrorBoundaries===!0)i=t.call(e);else try{i=t.call(e)}catch(a){i=new Mn(a)}return D.trackingDerivation=o,mc(r),_c(r),Er(n),i}function _c(r){r.observing.length===0&&(D.reactionRequiresObservable||r.requiresObservable)&&console.warn("[mobx] Derivation "+r.name+" is created/updated without reading any observable value")}function mc(r){for(var t=r.observing,e=r.observing=r.newObserving,n=Z.UP_TO_DATE,o=0,i=r.unboundDepsCount,a=0;an&&(n=s.dependenciesState)}for(e.length=o,r.newObserving=null,i=t.length;i--;){var s=t[i];s.diffValue===0&&Ks(s,r),s.diffValue=0}for(;o--;){var s=e[o];s.diffValue===1&&(s.diffValue=0,Mc(s,r))}n!==Z.UP_TO_DATE&&(r.dependenciesState=n,r.onBecomeStale())}function Do(r){var t=r.observing;r.observing=[];for(var e=t.length;e--;)Ks(t[e],r);r.dependenciesState=Z.NOT_TRACKING}function Gs(r){var t=hr();try{return r()}finally{Oe(t)}}function hr(){var r=D.trackingDerivation;return D.trackingDerivation=null,r}function Oe(r){D.trackingDerivation=r}function Si(r){var t=D.allowStateReads;return D.allowStateReads=r,t}function Er(r){D.allowStateReads=r}function $s(r){if(r.dependenciesState!==Z.UP_TO_DATE){r.dependenciesState=Z.UP_TO_DATE;for(var t=r.observing,e=t.length;e--;)t[e].lowestObserverState=Z.UP_TO_DATE}}var An=0,bc=1,Gi=Object.getOwnPropertyDescriptor(function(){},"name"),xc=Gi&&Gi.configurable;function Re(r,t,e){at(typeof t=="function","`action` can only be invoked on functions"),(typeof r!="string"||!r)&&X("actions should have valid names, got: '"+r+"'");var n=function(){return Vs(r,t,e||this,arguments)};return n.isMobxAction=!0,xc&&Object.defineProperty(n,"name",{value:r}),n}function Vs(r,t,e,n){var o=Ec(r,e,n);try{return t.apply(e,n)}catch(i){throw o.error=i,i}finally{Oc(o)}}function Ec(r,t,e){var n=mt()&&!!r,o=0;if(n){o=Date.now();var i=e&&e.length||0,a=new Array(i);if(i>0)for(var s=0;s0&&!r.__mobxGlobals&&(bn=!1),r.__mobxGlobals&&r.__mobxGlobals.version!==new mn().version&&(bn=!1),bn?r.__mobxGlobals?(r.__mobxInstanceCount+=1,r.__mobxGlobals.UNCHANGED||(r.__mobxGlobals.UNCHANGED={}),r.__mobxGlobals):(r.__mobxInstanceCount=1,r.__mobxGlobals=new mn):(setTimeout(function(){Ws||X("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")},1),new mn)}();function Sc(){(D.pendingReactions.length||D.inBatch||D.isRunningReactions)&&X("isolateGlobalState should be called before MobX is running any reactions"),Ws=!0,bn&&(--No().__mobxInstanceCount===0&&(No().__mobxGlobals=void 0),D=new mn)}function Co(){return D}function Mc(r,t){r.observers.add(t),r.lowestObserverState>t.dependenciesState&&(r.lowestObserverState=t.dependenciesState)}function Ks(r,t){r.observers.delete(t),r.observers.size===0&&Zs(r)}function Zs(r){r.isPendingUnobservation===!1&&(r.isPendingUnobservation=!0,D.pendingUnobservations.push(r))}function Zt(){D.inBatch++}function qt(){if(--D.inBatch===0){tl();for(var r=D.pendingUnobservations,t=0;t0&&Zs(r),!1)}function Ac(r){r.lowestObserverState!==Z.STALE&&(r.lowestObserverState=Z.STALE,r.observers.forEach(function(t){t.dependenciesState===Z.UP_TO_DATE&&(t.isTracing!==Kt.NONE&&Js(t,r),t.onBecomeStale()),t.dependenciesState=Z.STALE}))}function Pc(r){r.lowestObserverState!==Z.STALE&&(r.lowestObserverState=Z.STALE,r.observers.forEach(function(t){t.dependenciesState===Z.POSSIBLY_STALE?t.dependenciesState=Z.STALE:t.dependenciesState===Z.UP_TO_DATE&&(r.lowestObserverState=Z.UP_TO_DATE)}))}function Dc(r){r.lowestObserverState===Z.UP_TO_DATE&&(r.lowestObserverState=Z.POSSIBLY_STALE,r.observers.forEach(function(t){t.dependenciesState===Z.UP_TO_DATE&&(t.dependenciesState=Z.POSSIBLY_STALE,t.isTracing!==Kt.NONE&&Js(t,r),t.onBecomeStale())}))}function Js(r,t){if(console.log("[mobx.trace] '"+r.name+"' is invalidated due to a change in: '"+t.name+"'"),r.isTracing===Kt.BREAK){var e=[];Qs(Gc(r),e,1),new Function(`debugger; /* Tracing '`+r.name+`' You are entering this break point because derivation '`+r.name+"' is being traced and '"+t.name+`' is now forcing it to update. Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update The stackframe you are looking for is at least ~6-8 stack-frames up. `+(r instanceof ir?r.derivation.toString().replace(/[*]\//g,"/"):"")+` The dependencies for this derivation are: `+e.join(` `)+` */ `)()}}function Qs(r,t,e){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+new Array(e).join(" ")+r.name),r.dependencies&&r.dependencies.forEach(function(n){return Qs(n,t,e+1)})}var Lr=function(){function r(t,e,n,o){t===void 0&&(t="Reaction@"+At()),o===void 0&&(o=!1),this.name=t,this.onInvalidate=e,this.errorHandler=n,this.requiresObservable=o,this.observing=[],this.newObserving=[],this.dependenciesState=Z.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+At(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Kt.NONE}return r.prototype.onBecomeStale=function(){this.schedule()},r.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,D.pendingReactions.push(this),tl())},r.prototype.isScheduled=function(){return this._isScheduled},r.prototype.runReaction=function(){if(!this.isDisposed){if(Zt(),this._isScheduled=!1,Po(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&mt()&&Xe({name:this.name,type:"scheduled-reaction"})}catch(t){this.reportExceptionInDerivation(t)}}qt()}},r.prototype.track=function(t){if(!this.isDisposed){Zt();var e=mt(),n;e&&(n=Date.now(),Dt({name:this.name,type:"reaction"})),this._isRunning=!0;var o=zs(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Do(this),mr(o)&&this.reportExceptionInDerivation(o.cause),e&&Nt({time:Date.now()-n}),qt()}},r.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return}if(D.disableErrorBoundaries)throw t;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";D.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,t),mt()&&Xe({type:"error",name:this.name,message:n,error:""+t}),D.globalReactionErrorHandlers.forEach(function(o){return o(t,e)})},r.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Zt(),Do(this),qt()))},r.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[L]=this,t},r.prototype.toString=function(){return"Reaction["+this.name+"]"},r.prototype.trace=function(t){t===void 0&&(t=!1),Jc(this,t)},r}(),$i=100,Ro=function(r){return r()};function tl(){D.inBatch>0||D.isRunningReactions||Ro(Nc)}function Nc(){D.isRunningReactions=!0;for(var r=D.pendingReactions,t=0;r.length>0;){++t===$i&&(console.error("Reaction doesn't converge to a stable state after "+$i+" iterations."+(" Probably there is a cycle in the reactive function: "+r[0])),r.splice(0));for(var e=r.splice(0),n=0,o=e.length;n",t);if(arguments.length===2&&typeof e=="function")return Re(t,e);if(arguments.length===1&&typeof t=="string")return Vi(t);if(o===!0)fr(t,e,Re(t.name||e,n.value,this));else return Vi(e).apply(null,arguments)};b.bound=Bc;function Xc(r,t){var e=typeof r=="string"?r:r.name||"",n=typeof r=="function"?r:t;return at(typeof n=="function"&&n.length===0,"`runInAction` expects a function without arguments"),(typeof e!="string"||!e)&&X("actions should have valid names, got: '"+e+"'"),Vs(e,n,this,void 0)}function kc(r){return typeof r=="function"&&r.isMobxAction===!0}function lo(r,t,e){fr(r,t,Re(t,e.bind(r)))}function Yc(r,t){t===void 0&&(t=_i),at(typeof r=="function","Autorun expects a function as first argument"),at(kc(r)===!1,"Autorun does not accept actions since actions are untrackable");var e=t&&t.name||r.name||"Autorun@"+At(),n=!t.scheduler&&!t.delay,o;if(n)o=new Lr(e,function(){this.track(s)},t.onError,t.requiresObservable);else{var i=el(t),a=!1;o=new Lr(e,function(){a||(a=!0,i(function(){a=!1,o.isDisposed||o.track(s)}))},t.onError,t.requiresObservable)}function s(){r(o)}return o.schedule(),o.getDisposer()}var Hc=function(r){return r()};function el(r){return r.scheduler?r.scheduler:r.delay?function(t){return setTimeout(t,r.delay)}:Hc}function rl(r,t,e){e===void 0&&(e=_i),at(typeof r=="function","First argument to reaction should be a function"),at(typeof e=="object","Third argument of reactions should be an object");var n=e.name||"Reaction@"+At(),o=b(n,e.onError?Uc(e.onError,t):t),i=!e.scheduler&&!e.delay,a=el(e),s=!0,l=!1,u,f=e.compareStructural?nr.structural:e.equals||nr.default,c=new Lr(n,function(){s||i?d():l||(l=!0,a(d))},e.onError,e.requiresObservable);function d(){if(l=!1,!c.isDisposed){var p=!1;c.track(function(){var y=r(c);p=s||!f(u,y),u=y}),s&&e.fireImmediately&&o(u,c),!s&&p===!0&&o(u,c),s&&(s=!1)}}return c.schedule(),c.getDisposer()}function Uc(r,t){return function(){try{return t.apply(this,arguments)}catch(e){r.call(this,e)}}}function Fc(r,t,e){return ol("onBecomeObserved",r,t,e)}function nl(r,t,e){return ol("onBecomeUnobserved",r,t,e)}function ol(r,t,e,n){var o=typeof n=="function"?pe(t,e):pe(t),i=typeof n=="function"?n:e,a=r+"Listeners";o[a]?o[a].add(i):o[a]=new Set([i]);var s=o[r];return typeof s!="function"?X("Not an atom that can be (un)observed"):function(){var l=o[a];l&&(l.delete(i),l.size===0&&delete o[a])}}function zc(r){var t=r.enforceActions,e=r.computedRequiresReaction,n=r.computedConfigurable,o=r.disableErrorBoundaries,i=r.reactionScheduler,a=r.reactionRequiresObservable,s=r.observableRequiresReaction;if(r.isolateGlobalState===!0&&Sc(),t!==void 0){(typeof t=="boolean"||t==="strict")&&Xs(`Deprecated value for 'enforceActions', use 'false' => '"never"', 'true' => '"observed"', '"strict"' => "'always'" instead`);var l=void 0;switch(t){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:X("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'")}D.enforceActions=l,D.allowStateChanges=!(l===!0||l==="strict")}e!==void 0&&(D.computedRequiresReaction=!!e),a!==void 0&&(D.reactionRequiresObservable=!!a),s!==void 0&&(D.observableRequiresReaction=!!s,D.allowStateReads=!D.observableRequiresReaction),n!==void 0&&(D.computedConfigurable=!!n),o!==void 0&&(o===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),D.disableErrorBoundaries=!!o),i&&Cc(i)}function jo(r,t,e,n){at(arguments.length>=2&&arguments.length<=4,"'extendObservable' expected 2-4 arguments"),at(typeof r=="object","'extendObservable' expects an object as first argument"),at(!Tt(r),"'extendObservable' should not be used on maps, use map.merge instead"),n=Ve(n);var o=il(n);return Be(r),Pi(r,n.name,o.enhancer),t&&al(r,t,e,o),r}function il(r){return r.defaultDecorator||(r.deep===!1?Fs:wi)}function al(r,t,e,n){var o,i,a,s;if(at(!Te(t),"Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540"),e){var l=xi(e);try{for(var u=Gt(l),f=u.next();!f.done;f=u.next()){var c=f.value;c in t||X("Trying to declare a decorator for unspecified property '"+It(c)+"'")}}catch(v){o={error:v}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}}Zt();try{var l=ec(t);try{for(var d=Gt(l),p=d.next();!p.done;p=d.next()){var c=p.value,y=Object.getOwnPropertyDescriptor(t,c);Ye(t)||X("'extendObservable' only accepts plain objects as second argument"),ul(y.value)&&X("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead");var h=e&&c in e?e[c]:y.get?Sn:n;typeof h!="function"&&X("Not a valid decorator for '"+It(c)+"', got: "+h);var g=h(r,c,y,!0);g&&Object.defineProperty(r,c,g)}}catch(_){a={error:_}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}}finally{qt()}}function Gc(r,t){return sl(pe(r,t))}function sl(r){var t={name:r.name};return r.observing&&r.observing.length>0&&(t.dependencies=qu(r.observing).map(sl)),t}function ll(r,t){if(r==null)return!1;if(t!==void 0){if(Yt(r)===!1||!r[L].values.has(t))return!1;var e=pe(r,t);return ar(e)}return ar(r)}function ul(r){return arguments.length>1?X("isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property"):ll(r)}function Wi(r,t){return typeof t!="string"?X("isComputed expected a property name as second argument"):ll(r,t)}function $c(r,t){return r==null?!1:t!==void 0?Tt(r)||te(r)?X("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Yt(r)?r[L].values.has(t):!1:Yt(r)||!!r[L]||Ei(r)||Pn(r)||ar(r)}function Te(r){return arguments.length!==1&&X("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),$c(r)}function sr(r){return Yt(r)?r[L].getKeys():Tt(r)||kt(r)?Array.from(r.keys()):te(r)?r.map(function(t,e){return e}):X("'keys()' can only be used on observable objects, arrays, sets and maps")}function Vc(r){return Yt(r)?sr(r).map(function(t){return r[t]}):Tt(r)?sr(r).map(function(t){return r.get(t)}):kt(r)?Array.from(r.values()):te(r)?r.slice():X("'values()' can only be used on observable objects, arrays, sets and maps")}function Wc(r){return Yt(r)?sr(r).map(function(t){return[t,r[t]]}):Tt(r)?sr(r).map(function(t){return[t,r.get(t)]}):kt(r)?Array.from(r.entries()):te(r)?r.map(function(t,e){return[e,t]}):X("'entries()' can only be used on observable objects, arrays and maps")}function Mi(r,t,e){if(arguments.length===2&&!kt(r)){Zt();var n=t;try{for(var o in n)Mi(r,o,n[o])}finally{qt()}return}if(Yt(r)){var i=r[L],a=i.values.get(t);a?i.write(t,e):i.addObservableProp(t,e,i.defaultEnhancer)}else if(Tt(r))r.set(t,e);else if(kt(r))r.add(t);else if(te(r))typeof t!="number"&&(t=parseInt(t,10)),at(t>=0,"Not a valid index: '"+t+"'"),Zt(),t>=r.length&&(r.length=t+1),r[t]=e,qt();else return X("'set()' can only be used on observable objects, arrays and maps")}function cl(r,t,e,n){return typeof e=="function"?Zc(r,t,e,n):Kc(r,t,e)}function Kc(r,t,e){return Wr(r).observe(t,e)}function Zc(r,t,e,n){return Wr(r,t).observe(e,n)}var qc={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function He(r,t,e,n){return n.detectCycles&&r.set(t,e),e}function ve(r,t,e){if(!t.recurseEverything&&!Te(r)||typeof r!="object")return r;if(r===null)return null;if(r instanceof Date)return r;if(Tc(r))return ve(r.get(),t,e);Te(r)&&sr(r);var n=t.detectCycles===!0;if(n&&r!==null&&e.has(r))return e.get(r);if(te(r)||Array.isArray(r)){var o=He(e,r,[],t),i=r.map(function(p){return ve(p,t,e)});o.length=i.length;for(var a=0,s=i.length;a0}function $r(r,t){var e=r.interceptors||(r.interceptors=[]);return e.push(t),mi(function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)})}function le(r,t){var e=hr();try{for(var n=Ti(r.interceptors||[]),o=0,i=n.length;o0}function Vr(r,t){var e=r.changeListeners||(r.changeListeners=[]);return e.push(t),mi(function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)})}function Qt(r,t){var e=hr(),n=r.changeListeners;if(!!n){n=n.slice();for(var o=0,i=n.length;o0?t.map(this.dehancer):t},r.prototype.intercept=function(t){return $r(this,t)},r.prototype.observe=function(t,e){return e===void 0&&(e=!1),e&&t({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Vr(this,t)},r.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},r.prototype.setArrayLength=function(t){if(typeof t!="number"||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),o=0;oi?t=i:t<0&&(t=Math.max(0,i+t)),arguments.length===1?e=i-t:e==null?e=0:e=Math.max(0,Math.min(e,i-t)),n===void 0&&(n=Tn),se(this)){var a=le(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:n});if(!a)return Tn;e=a.removedCount,n=a.added}n=n.length===0?n:n.map(function(u){return o.enhancer(u,void 0)});{var s=n.length-e;this.updateArrayLength(i,s)}var l=this.spliceItemsIntoValues(t,e,n);return(e!==0||n.length!==0)&&this.notifyArraySplice(t,n,l),this.dehanceValues(l)},r.prototype.spliceItemsIntoValues=function(t,e,n){var o;if(n.length-1?(this.splice(e,1),!0):!1},get:function(r){var t=this[L];if(t){if(r=0&&e++;break}r=ea(r),t=ea(t);var s=a==="[object Array]";if(!s){if(typeof r!="object"||typeof t!="object")return!1;var l=r.constructor,u=t.constructor;if(l!==u&&!(typeof l=="function"&&l instanceof l&&typeof u=="function"&&u instanceof u)&&"constructor"in r&&"constructor"in t)return!1}if(e===0)return!1;e<0&&(e=-1),n=n||[],o=o||[];for(var f=n.length;f--;)if(n[f]===r)return o[f]===t;if(n.push(r),o.push(t),s){if(f=r.length,f!==t.length)return!1;for(;f--;)if(!Io(r[f],t[f],e-1,n,o))return!1}else{var c=Object.keys(r),d=void 0;if(f=c.length,Object.keys(t).length!==f)return!1;for(;f--;)if(d=c[f],!(df(t,d)&&Io(r[d],t[d],e-1,n,o)))return!1}return n.pop(),o.pop(),!0}function ea(r){return te(r)?r.slice():dr(r)||Tt(r)||zr(r)||kt(r)?Array.from(r.entries()):r}function df(r,t){return Object.prototype.hasOwnProperty.call(r,t)}function Dn(r){return r[Symbol.iterator]=pf,r}function pf(){return this}if(typeof Proxy=="undefined"||typeof Symbol=="undefined")throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");(function(){function r(){}if(r.name!=="testCodeMinification"&&!0&&typeof process!="undefined"&&{}.IGNORE_MOBX_MINIFY_WARNING!=="true"){var t=["process","env","NODE_ENV"].join(".");console.warn("[mobx] you are running a minified build, but '"+t+"' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle")}})();typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:jc,extras:{getDebugName:Lo},$mobx:L});function hf(r){return!(r.prototype&&r.prototype.render)&&!$.isPrototypeOf(r)}function hl(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=t.prefix,n=e===void 0?"":e,o=t.suffix,i=o===void 0?"":o,a=r.displayName||r.name||r.constructor&&r.constructor.name||"";return n+a+i}var ra=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vl=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},yl=function(){function r(t,e){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:!1,n=r[t],o=ml[t],i=n?e===!0?function(){o.apply(this,arguments),n.apply(this,arguments)}:function(){n.apply(this,arguments),o.apply(this,arguments)}:o;r[t]=i}function ia(r,t){if(r==null||t==null||(typeof r=="undefined"?"undefined":ra(r))!=="object"||(typeof t=="undefined"?"undefined":ra(t))!=="object")return r!==t;var e=Object.keys(r);if(e.length!==Object.keys(t).length)return!0;for(var n=void 0,o=e.length-1;n=e[o];o--)if(t[n]!==r[n])return!0;return!1}var ml={componentWillMount:function(){var t=this,e=hl(this),n=!1,o=!1;function i(c){var d=this[c],p=Oi("reactive "+c);Object.defineProperty(this,c,{configurable:!0,enumerable:!0,get:function(){return p.reportObserved(),d},set:function(h){!o&&ia(d,h)?(d=h,n=!0,p.reportChanged(),n=!1):d=h}})}i.call(this,"props"),i.call(this,"state");var a=this.render.bind(this),s=null,l=!1,u=function(){return s=new Lr(e+".render()",function(){if(!l&&(l=!0,typeof t.componentWillReact=="function"&&t.componentWillReact(),t.__$mobxIsUnmounted!==!0)){var d=!0;try{o=!0,n||$.prototype.forceUpdate.call(t),d=!1}finally{o=!1,d&&s.dispose()}}}),s.reactComponent=t,f.$mobx=s,t.render=f,f(t.props,t.state,t.context)},f=function(d,p,y){l=!1;var h=void 0,g=void 0;if(s.track(function(){try{g=gf(!1,a,d,p,y)}catch(v){h=v}}),h)throw h;return g};this.render=u},componentWillUnmount:function(){this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0},componentDidMount:function(){},componentDidUpdate:function(){},shouldComponentUpdate:function(t,e){return this.state!==e?!0:ia(this.props,t)}};function Ni(r){if(arguments.length>1&&na.warn('Mobx observer: Using observer to inject stores is not supported. Use `@connect(["store1", "store2"]) ComponentClass instead or preferably, use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))``'),r.isMobxInjector===!0&&na.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),hf(r)){var t,e;return Ni((e=t=function(o){gl(i,o);function i(){return vl(this,i),_l(this,(i.__proto__||Object.getPrototypeOf(i)).apply(this,arguments))}return yl(i,[{key:"render",value:function(){return r.call(this,this.props,this.context)}}]),i}($),t.displayName=hl(r),e))}if(!r)throw new Error("Please pass a valid component to 'observer'");var n=r.prototype||r;return _f(n),r.isMobXReactObserver=!0,r}function _f(r){oa(r,"componentWillMount",!0),oa(r,"componentDidMount"),r.shouldComponentUpdate||(r.shouldComponentUpdate=ml.shouldComponentUpdate)}var mf=Ni(function(r){var t=r.children;return t[0]()});mf.displayName="Observer";var bf=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function xf(r,t){return t={exports:{}},r(t,t.exports),t.exports}xf(function(r,t){(function(e,n){r.exports=n()})(bf,function(){var e={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,u=l&&l(Object);return function f(c,d,p){if(typeof d!="string"){if(u){var y=l(d);y&&y!==u&&f(c,y,p)}var h=i(d);a&&(h=h.concat(a(d)));for(var g=0;g1?tr("div",null," ",o," "):o[0]}},{key:"getChildContext",value:function(){var n={},o=this.context.mobxStores;if(o)for(var i in o)n[i]=o[i];for(var a in this.props)!aa[a]&&a!=="suppressChangedStoreWarning"&&(n[a]=this.props[a]);return{mobxStores:n}}},{key:"componentWillReceiveProps",value:function(n){if(Object.keys(n).length!==Object.keys(this.props).length&&sa.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!n.suppressChangedStoreWarning)for(var o in n)!aa[o]&&this.props[o]!==n[o]&&sa.warn("MobX Provider: Provided store '"+o+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t})($);if(!$)throw new Error("mobx-preact requires Preact to be available");var oe,uo,la,bl=[],_t=H,ua=_t.__b,ca=_t.__r,fa=_t.diffed,da=_t.__c,pa=_t.unmount,ha=_t.__;function Ef(){for(var r;r=bl.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(xn),r.__H.__h.forEach(Bo),r.__H.__h=[]}catch(t){r.__H.__h=[],_t.__e(t,r.__v)}}_t.__b=function(r){oe=null,ua&&ua(r)},_t.__=function(r,t){r&&t.__k&&t.__k.__m&&(r.__m=t.__k.__m),ha&&ha(r,t)},_t.__r=function(r){ca&&ca(r);var t=(oe=r.__c).__H;t&&(uo===oe?(t.__h=[],oe.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0})):(t.__h.forEach(xn),t.__h.forEach(Bo),t.__h=[])),uo=oe},_t.diffed=function(r){fa&&fa(r);var t=r.__c;t&&t.__H&&(t.__H.__h.length&&(bl.push(t)!==1&&la===_t.requestAnimationFrame||((la=_t.requestAnimationFrame)||Of)(Ef)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.i=void 0})),uo=oe=null},_t.__c=function(r,t){t.some(function(e){try{e.__h.forEach(xn),e.__h=e.__h.filter(function(n){return!n.__||Bo(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],_t.__e(n,e.__v)}}),da&&da(r,t)},_t.unmount=function(r){pa&&pa(r);var t,e=r.__c;e&&e.__H&&(e.__H.__.forEach(function(n){try{xn(n)}catch(o){t=o}}),e.__H=void 0,t&&_t.__e(t,e.__v))};var va=typeof requestAnimationFrame=="function";function Of(r){var t,e=function(){clearTimeout(n),va&&cancelAnimationFrame(t),setTimeout(r)},n=setTimeout(e,100);va&&(t=requestAnimationFrame(e))}function xn(r){var t=oe,e=r.__c;typeof e=="function"&&(r.__c=void 0,e()),oe=t}function Bo(r){var t=oe;r.__c=r.__(),oe=t}function ya(r,t){for(var e in r)if(e!=="__source"&&!(e in t))return!0;for(var n in t)if(n!=="__source"&&r[n]!==t[n])return!0;return!1}function ga(r,t){this.props=r,this.context=t}(ga.prototype=new $).isPureReactComponent=!0,ga.prototype.shouldComponentUpdate=function(r,t){return ya(this.props,r)||ya(this.state,t)};var _a=H.__b;H.__b=function(r){r.type&&r.type.__f&&r.ref&&(r.props.ref=r.ref,r.ref=null),_a&&_a(r)};var Tf=H.__e;H.__e=function(r,t,e,n){if(r.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),o.__c(r,t)}Tf(r,t,e,n)};var ma=H.unmount;function xl(r,t,e){return r&&(r.__c&&r.__c.__H&&(r.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),r.__c.__H=null),(r=function(n,o){for(var i in o)n[i]=o[i];return n}({},r)).__c!=null&&(r.__c.__P===e&&(r.__c.__P=t),r.__c=null),r.__k=r.__k&&r.__k.map(function(n){return xl(n,t,e)})),r}function El(r,t,e){return r&&e&&(r.__v=null,r.__k=r.__k&&r.__k.map(function(n){return El(n,t,e)}),r.__c&&r.__c.__P===t&&(r.__e&&e.appendChild(r.__e),r.__c.__e=!0,r.__c.__P=e)),r}function co(){this.__u=0,this.t=null,this.__b=null}function Ol(r){var t=r.__.__c;return t&&t.__a&&t.__a(r)}function tn(){this.u=null,this.o=null}H.unmount=function(r){var t=r.__c;t&&t.__R&&t.__R(),t&&32&r.__u&&(r.type=null),ma&&ma(r)},(co.prototype=new $).__c=function(r,t){var e=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(e);var o=Ol(n.__v),i=!1,a=function(){i||(i=!0,e.__R=null,o?o(s):s())};e.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=El(l,l.__c.__P,l.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.t.pop();)u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),r.then(a,a)},co.prototype.componentWillUnmount=function(){this.t=[]},co.prototype.render=function(r,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=xl(this.__b,e,n.__O=n.__P)}this.__b=null}var o=t.__a&&tr(er,null,r.fallback);return o&&(o.__u&=-33),[tr(er,null,t.__a?null:r.children),o]};var ba=function(r,t,e){if(++e[1]===e[0]&&r.o.delete(t),r.props.revealOrder&&(r.props.revealOrder[0]!=="t"||!r.o.size))for(e=r.u;e;){for(;e.length>3;)e.pop()();if(e[1]v.step||Math.abs(v.sumDeltaY)>v.step)){var S=v.sumDeltaX%v.step,M=v.sumDeltaY%v.step,m=v.sumDeltaX-S,T=v.sumDeltaY-M;v.sumDeltaX=S,v.sumDeltaY=M;var P=(O=v.model)===null||O===void 0?void 0:O.getData();v.isDragging||((w=v.eventCenter)===null||w===void 0||w.emit(C["".concat(v.eventType,"_DRAGSTART")],{e:_,data:v.data||P}),v.onDragStart({event:_})),v.isDragging=!0,Promise.resolve().then(function(){var A,I;v.onDragging({deltaX:m,deltaY:T,event:_}),(A=v.eventCenter)===null||A===void 0||A.emit(C["".concat(v.eventType,"_MOUSEMOVE")],{deltaX:m,deltaY:T,e:_,data:v.data||P}),(I=v.eventCenter)===null||I===void 0||I.emit(C["".concat(v.eventType,"_DRAG")],{e:_,data:v.data||P})})}},this.handleMouseUp=function(_){var O=window.document;v.isStartDragging=!1,v.isStopPropagation&&_.stopPropagation(),Promise.resolve().then(function(){var w,S,M;O.removeEventListener("mousemove",v.handleMouseMove,!1),O.removeEventListener("mouseup",v.handleMouseUp,!1);var m=(w=v.model)===null||w===void 0?void 0:w.getData();(S=v.eventCenter)===null||S===void 0||S.emit(C["".concat(v.eventType,"_MOUSEUP")],{e:_,data:v.data||m}),v.isDragging&&(v.isDragging=!1,v.onDragEnd({event:_}),(M=v.eventCenter)===null||M===void 0||M.emit(C["".concat(v.eventType,"_DROP")],{e:_,data:v.data||m}))})},this.cancelDrag=function(){var _=window==null?void 0:window.document;_.removeEventListener("mousemove",v.handleMouseMove,!1),_.removeEventListener("mouseup",v.handleMouseUp,!1),v.onDragEnd({event:void 0}),v.isDragging=!1},this.destroy=function(){v.isStartDragging&&v.cancelDrag()},this.onDragStart=n,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=y,this.eventType=u,this.eventCenter=f,this.model=h,this.data=g}return r.prototype.setStep=function(t){this.step=t},r.prototype.setModel=function(t){this.model=t},r}(),zf=function(r){var t=r.x,e=r.y,n=r.width,o=r.height;return{x:t-n/2,y:e-o/2,x1:t+n/2,y1:e+o/2}},Gf=function(r){var t=r.startPoint,e=r.endPoint,n=(t.x+e.x)/2,o=(t.y+e.y)/2,i=Math.abs(t.x-e.x)+10,a=Math.abs(t.y-e.y)+10;return{x:n-i/2,y:o-a/2,x1:n+i/2,y1:o+a/2}},$f=function(r){var t=r.points,e=ke(t),n=kr(e,8),o=n.x,i=n.y,a=n.width,s=n.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},Vf=function(r){var t=r.path,e=Ci(t),n=kr(e,8),o=n.x,i=n.y,a=n.width,s=n.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},Wf=function(r){if(r.modelType===z.LINE_EDGE)return Gf(r);if(r.modelType===z.POLYLINE_EDGE)return $f(r);if(r.modelType===z.BEZIER_EDGE)return Vf(r)},Kf=function(r,t,e,n){var o=(t.y-r.y)*(n.x-e.x)-(r.x-t.x)*(e.y-n.y);if(o===0)return!1;var i=((t.x-r.x)*(n.x-e.x)*(e.y-r.y)+(t.y-r.y)*(n.x-e.x)*r.x-(n.y-e.y)*(t.x-r.x)*e.x)/o,a=-((t.y-r.y)*(n.y-e.y)*(e.x-r.x)+(t.x-r.x)*(n.y-e.y)*r.y-(n.x-e.x)*(t.y-r.y)*e.y)/o;return(i-r.x)*(i-t.x)<=0&&(a-r.y)*(a-t.y)<=0&&(i-e.x)*(i-n.x)<=0&&(a-e.y)*(a-n.y)<=0?{x:i,y:a}:!1},Br=function(r,t,e){var n=r.x,o=r.y,i=t.x,a=t.y,s=e.x,l=e.y,u=(l-a)/(s-i),f=a-u*i;return(n>=i&&n<=s||n<=i&&n>=s)&&(o>=a&&o<=l||o<=a&&o>=l)&&Math.abs(o-u*n-f)=t.x?(a.leftX=t.x+u*Math.sin(s+l),a.leftY=t.y-u*Math.cos(s+l),a.rightX=t.x-u*Math.sin(s-l),a.rightY=t.y+u*Math.cos(s-l)):(a.leftX=t.x-u*Math.sin(s+l),a.leftY=t.y+u*Math.cos(s+l),a.rightX=t.x+u*Math.sin(s-l),a.rightY=t.y-u*Math.cos(s-l)):i==="end"&&(e.x>=t.x?(a.leftX=e.x+u*Math.sin(s-l),a.leftY=e.y-u*Math.cos(s-l),a.rightX=e.x-u*Math.sin(s+l),a.rightY=e.y+u*Math.cos(s+l)):(a.leftX=e.x-u*Math.sin(s-l),a.leftY=e.y+u*Math.cos(s-l),a.rightX=e.x+u*Math.sin(s+l),a.rightY=e.y-u*Math.cos(s+l))),a},Ze=globalThis&&globalThis.__assign||function(){return Ze=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xe=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;nn/t.height?ot.HORIZONTAL:ot.VERTICAL},Cn=function(r,t,e){var n=qf(e,t);return n===ot.HORIZONTAL?{x:e.x>r.centerX?r.maxX:r.minX,y:e.y}:{x:e.x,y:e.y>r.centerY?r.maxY:r.minY}},Sa=function(r,t){var e=Math.min(r.minX,t.minX),n=Math.min(r.minY,t.minY),o=Math.max(r.maxX,t.maxX),i=Math.max(r.maxY,t.maxY);return{x:(e+o)/2,y:(n+i)/2,centerX:(e+o)/2,centerY:(n+i)/2,minX:e,minY:n,maxX:o,maxY:i,height:i-n,width:o-e}},kr=function(r,t){r===void 0&&(r=[]);var e=[],n=[];r.forEach(function(f){e.push(f.x),n.push(f.y)});var o=Math.min.apply(Math,xe([],Bt(e),!1)),i=Math.max.apply(Math,xe([],Bt(e),!1)),a=Math.min.apply(Math,xe([],Bt(n),!1)),s=Math.max.apply(Math,xe([],Bt(n),!1)),l=i-o,u=s-a;return t&&(l+=t,u+=t),{centerX:(o+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:o,minY:a,x:(o+i)/2,y:(a+s)/2,height:u,width:l}},Rn=function(r){var t=r.minX,e=r.minY,n=r.maxX,o=r.maxY;return[{x:t,y:e},{x:n,y:e},{x:n,y:o},{x:t,y:o}]},rn=function(r,t){var e=r.x,n=r.y;return et.maxX||nt.maxY},Jf=function(r,t){return tr.maxX?[]:[{x:t,y:r.minY},{x:t,y:r.maxY}]},Qf=function(r,t){return tr.maxY?[]:[{x:r.minX,y:t},{x:r.maxX,y:t}]},td=function(r,t){return xe(xe([],Bt(Jf(r,t.x)),!1),Bt(Qf(r,t.y)),!1)},ko=function(r,t){return Math.abs(r.x-t.x)+Math.abs(r.y-t.y)},ed=function(r,t){var e=-2,n=0;return t.forEach(function(o){o&&(r.x===o.x&&(n+=e),r.y===o.y&&(n+=e))}),n},Ma=function(r,t,e,n,o){return ko(r,t)+ko(r,e)+ed(r,[t,e,n,o])},Tl=function(r,t,e,n,o){o||(o=0),r.unshift(t[n]),e[n]&&e[n]!==n&&o<=100&&Tl(r,t,e,e[n],o+1)},rd=function(r,t){var e=r.indexOf(t);e>-1&&r.splice(e,1)},br=function(r,t,e,n){var o=t.x-r.x,i=t.y-r.y,a=n.x-e.x,s=n.y-e.y,l=(-i*(r.x-e.x)+o*(r.y-e.y))/(-a*i+o*s),u=(a*(r.y-e.y)-s*(r.x-e.x))/(-a*i+o*s);return l>=0&&l<=1&&u>=0&&u<=1},Aa=function(r,t,e){if(e.width===0&&e.height===0)return!1;var n=Bt(Rn(e),4),o=n[0],i=n[1],a=n[2],s=n[3];return br(r,t,o,i)||br(r,t,o,s)||br(r,t,i,a)||br(r,t,a,s)},nd=function(r,t,e,n){var o=[];return r.forEach(function(i){i!==t&&(i.x===t.x||i.y===t.y)&&!Aa(i,t,e)&&!Aa(i,t,n)&&o.push(i)}),Xo(o)},od=function(r,t,e,n,o,i,a){var s=[],l=[t],u={},f={},c={};t.id&&(f[t.id]=0,c[t.id]=Ma(t,e,t));var d={};r.forEach(function(h){h.id&&(d[h.id]=h)});for(var p=function(){var h,g=1/0;if(l.forEach(function(_){_.id&&c[_.id]=f[_.id])return;u[_.id]=h.id,f[_.id]=O,c[_.id]=f[_.id]+Ma(_,e,t,i,a)}})};l.length;){var y=p();if(typeof y=="object")return y.value}return[t,e]},Pa=function(r){return Mt(r)},wl=function(r){for(var t=1;t2&&(v=wl(v)),Xo(v)},id=function(r){if(r.length===1){var t=Bt(r,1),e=t[0];return[e,e]}else{for(var n=r[0],o=r[1],i=Wt(n.x,n.y,o.x,o.y),a=1;ai&&(i=u,n=s,o=l)}return[n,o]}},Na=function(r,t,e){var n=Ee(r,e),o=Ee(t,e);return n&&o},Ca=function(r,t,e){var n=Ee(r,e),o=Ee(t,e),i=n&&o,a=n||o;return!i&&a},Ra=function(r,t,e){for(var n=void 0,o=Mt(e),i=Rn(o),a=0;a=1&&n<=126||n>=65376&&n<=65439?t+=1:t+=2}return t},sd=function(r){var t=r.start,e=r.end,n;if(t.x===e.x&&t.y===e.y)n="";else{var o={start:t,end:e,offset:10,verticalLength:5},i=Xr(Ze(Ze({},o),{type:"start"})),a=Xr(Ze(Ze({},o),{type:"end"}));n="M".concat(i.leftX," ").concat(i.leftY,` L`).concat(i.rightX," ").concat(i.rightY,` L`).concat(a.rightX," ").concat(a.rightY,` L`).concat(a.leftX," ").concat(a.leftY," z")}return{d:n,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},La=function(r){var t=r.start,e=r.end,n=r.sourceNode,o=r.targetNode,i=r.offset,a=Mt(n),s=Mt(o),l=Nn(a,i),u=Nn(s,i),f=Cn(l,a,t),c=Cn(u,s,e);return{sNext:f,ePre:c}},Ci=function(r){var t=r.replace(/M/g,"").replace(/C/g,",").split(","),e=nn(t[0]),n=nn(t[1]),o=nn(t[2]),i=nn(t[3]);return[e,n,o,i]},nn=function(r){var t=Bt(r.replace(/(^\s*)/g,"").split(" "),2),e=t[0],n=t[1];return{x:+e,y:+n}},Ia=function(r,t){var e=Bt(r,4),n=e[0],o=e[1],i=e[2],a=e[3],s=Zd(n,o,i,a,t);return[s,r[3]]},Ml=function(r,t){for(var e=r.x,n=r.y,o=ke(t),i=Number.MAX_SAFE_INTEGER,a,s=[],l=0;lo?a:o}),{width:Math.ceil(o/2)*n+n/4,height:e*(n+2)+n/4}},Ue=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},on=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},po=function(r,t,e){var n=fo(r,2),o=n[0],i=n[1],a=fo(t,2),s=a[0],l=a[1],u=fo(e,2),f=u[0],c=u[1];return o>s&&ol&&i=0?o:-o},t}(Pl),Yo=function(r){Ri(t,r);function t(e,n){var o=r.call(this,e,n,1)||this;return Object.setPrototypeOf(o,t.prototype),o}return t.prototype.toString=function(){return"Point"},t}(Pl),Qn=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fe=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ho=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n=0;o--){var i=e[o],a=yd(r,i);if(a){var s=i.getTargetAnchor(r);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!n||hd(i,n.node,t))&&(n=l)}}}return n},hd=function(r,t,e){return r.zIndex>t.zIndex?!0:e.nodesMap[r.id].index>e.nodesMap[t.id].index},vd=function(r,t){for(var e=Ho(t),n,o=Number.MAX_SAFE_INTEGER,i=0;i=o.minX-n&&r.x<=o.maxX+n&&r.y>=o.minY-n&&r.y<=o.maxY+n&&(e=!0),e},yd=function(r,t){var e=!1,n=5,o=Mt(t);return r.x>=o.minX-n&&r.x<=o.maxX+n&&r.y>=o.minY-n&&r.y<=o.maxY+n&&(e=!0),e},Mt=function(r){var t=r.x,e=r.y,n=r.width,o=r.height;return{minX:t-n/2,minY:e-o/2,maxX:t+n/2,maxY:e+o/2,x:t,y:e,width:n,height:o,centerX:t,centerY:e}},gd=function(r){var t=r,e=t.x,n=t.y,o=t.width,i=t.height,a=t.radius;return[{x:e-o/2+a,y:n-i/2+a,r:a},{x:e+o/2-a,y:n-i/2+a,r:a},{x:e-o/2+a,y:n+i/2-a,r:a},{x:e+o/2-a,y:n+i/2-a,r:a}]},ka=function(r,t,e){var n=gd(e),o,i=Number.MAX_SAFE_INTEGER;return n.forEach(function(a){var s=Wt(r.x,r.y,a.x,a.y);su.minX&&r.xu.minY&&r.yf.x&&(c=f,d=u);var p={x:r.x,y:r.y};if(c.x===d.x&&t===ot.HORIZONTAL&&(p={x:c.x,y:r.y}),c.y===d.y&&t===ot.VERTICAL&&(p={x:r.x,y:c.y}),c.x!==d.x&&c.y!==d.y){var y=(d.y-c.y)/(d.x-c.x),h=(c.x*d.y-d.x*c.y)/(c.x-d.x);t===ot.HORIZONTAL?p={x:(r.y-h)/y,y:r.y}:t===ot.VERTICAL&&(p={x:r.x,y:y*r.x+h})}var g=Br(p,u,f);if(g){var v=Wt(p.x,p.y,r.x,r.y);vr.x?o=r.x+e/2:t.xr.y?i=r.y+n/2:t.y1?t.forEach(function(s){var l=document.createElement("div");l.textContent=s,i.appendChild(l)}):i.textContent=t[0],document.body.appendChild(i);var a=i.clientHeight;return document.body.removeChild(i),a},Fa=function(r){var t=r.rows,e=r.rowsLength,n=r.fontSize,o=0;return t&&t.forEach(function(i){var a=Sl(i);o=a>o?a:o}),{width:Math.ceil(o/2)*n+n/4,height:e*(n+2)+n/4}},Bn=function(r){return typeof r!="object"?{isAllPass:!!r,msg:r?"":"\u4E0D\u5141\u8BB8\u8FDE\u63A5"}:r};let sn;const md=new Uint8Array(16);function bd(){if(!sn&&(sn=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!sn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sn(md)}const gt=[];for(let r=0;r<256;++r)gt.push((r+256).toString(16).slice(1));function xd(r,t=0){return gt[r[t+0]]+gt[r[t+1]]+gt[r[t+2]]+gt[r[t+3]]+"-"+gt[r[t+4]]+gt[r[t+5]]+"-"+gt[r[t+6]]+gt[r[t+7]]+"-"+gt[r[t+8]]+gt[r[t+9]]+"-"+gt[r[t+10]]+gt[r[t+11]]+gt[r[t+12]]+gt[r[t+13]]+gt[r[t+14]]+gt[r[t+15]]}const Ed=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var za={randomUUID:Ed};function Od(r,t,e){if(za.randomUUID&&!t&&!r)return za.randomUUID();r=r||{};const n=r.random||(r.rng||bd)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(let o=0;o<16;++o)t[e+o]=n[o];return t}return xd(n)}var Le=function(){return Od()},Or=new Map,Nl=function(r){var t=Le();function e(){r();var o=Or.get(t);if(o){var i=window.requestAnimationFrame(e);Or.set(t,i)}}var n=window.requestAnimationFrame(e);return Or.set(t,n),t},Xn=function(r){var t=Or.get(r);t&&(window.cancelAnimationFrame(t),Or.delete(r))},Yr=globalThis&&globalThis.__assign||function(){return Yr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Cl(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.value,a=r.fontSize,s=a===void 0?12:a,l=r.fill,u=l===void 0?"currentColor":l,f=r.overflowMode,c=f===void 0?"default":f,d=r.textWidth,p=d===void 0?void 0:d,y=r.model,h={x:e,y:o,fill:u,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(ut(we(r),function(S){var M=Td(S,2),m=M[0],T=M[1];typeof T!="object"&&(h[m]=T)}),i){var g=String(i).split(/[\r\n]/g),v=g.length;if(c!=="default"){var _=y.BaseType,O=y.modelType;if(_===st.NODE&&O!==z.TEXT_NODE||_===st.EDGE&&p)return wd(r)}if(v>1){var w=g.map(function(S,M){var m=s+2,T=(M-(v-1)/2)*m;return x("tspan",{className:"lf-text-tspan",x:e,y:o+T,children:S})});return x("text",Yr({},h,{children:w}))}return x("text",Yr({},h,{children:i}))}return null}function wd(r){var t=r.x,e=r.y,n=r.value,o=r.model,i=r.textWidth,a=r.fontSize,s=a===void 0?12:a,l=r.lineHeight,u=r.fontFamily,f=u===void 0?"":u,c=r.wrapPadding,d=c===void 0?"0, 0":c,p=r.overflowMode,y=o.width,h=o.height,g=o.textHeight,v=i||y,_=String(n).split(/[\r\n]/g),O=_.length,w=Dl({rows:_,style:{fontSize:"".concat(s,"px"),width:"".concat(v,"px"),fontFamily:f,lineHeight:l,padding:d},rowsLength:O,className:"lf-get-text-height"}),S=h>w?h:w;g&&(S=g);var M=p==="ellipsis";return M&&(S=s+2),x("g",{children:x("foreignObject",{width:v,height:S,x:t-v/2,y:e-S/2,style:{overflow:"visible",textAlign:"left"},children:x("div",{className:"lf-node-text-auto-wrap",style:{minHeight:S,width:v,padding:d},children:x("div",{className:M?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:M?_.join(""):"",style:Yr({},r),children:_.map(function(m){return x("div",{className:"lf-node-text--auto-wrap-inner",children:m})})})})})})}var Fo=globalThis&&globalThis.__assign||function(){return Fo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function ur(r){var t={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return ut(we(r),function(e){var n=Sd(e,2),o=n[0],i=n[1];(o==="style"||typeof i!="object")&&(t[o]=i)}),x("line",Fo({},t))}var zo=globalThis&&globalThis.__assign||function(){return zo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function ae(r){var t=r.x,e=r.y,n=r.width,o=r.height,i=r.className,a=r.strokeWidth,s=r.radius,l=s===void 0?0:s,u=t-n/2,f=e-o/2,c={};return c["stroke-width"]=a,ut(we(r),function(d){var p=Md(d,2),y=p[0],h=p[1];typeof h!="object"&&(c[y]=h)}),i?c.className="lf-basic-shape ".concat(i):c.className="lf-basic-shape",l&&(c.rx=l,c.ry=l),c.x=u,c.y=f,x("rect",zo({},c))}var Go=globalThis&&globalThis.__assign||function(){return Go=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Hr(r){var t={d:""};return ut(we(r),function(e){var n=Ad(e,2),o=n[0],i=n[1];(o==="style"||typeof i!="object")&&(t[o]=i)}),x("path",Go({},t))}var $o=globalThis&&globalThis.__assign||function(){return $o=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function cr(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.r,a=i===void 0?4:i,s=r.className,l={cx:e,cy:o,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return ut(we(r),function(u){var f=Pd(u,2),c=f[0],d=f[1];typeof d!="object"&&(l[c]=d)}),s?l.className="lf-basic-shape ".concat(s):l.className="lf-basic-shape",x("circle",$o({},l))}var Vo=globalThis&&globalThis.__assign||function(){return Vo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Nd(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.rx,a=i===void 0?4:i,s=r.ry,l=s===void 0?4:s,u=r.className,f={cx:e,cy:o,rx:a,ry:l,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return ut(we(r),function(c){var d=Dd(c,2),p=d[0],y=d[1];typeof y!="object"&&(f[p]=y)}),u?f.className="lf-basic-shape ".concat(u):f.className="lf-basic-shape",x("ellipse",Vo({},f))}var Wo=globalThis&&globalThis.__assign||function(){return Wo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Rl(r){var t=r.points,e=t===void 0?[]:t,n=r.className,o={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return ut(we(r),function(i){var a=Cd(i,2),s=a[0],l=a[1];typeof l!="object"&&(o[s]=l)}),n?o.classNmae="lf-basic-shape ".concat(n):o.className="lf-basic-shape",o.points=e.map(function(i){return i.join(",")}).join(" "),x("polygon",Wo({},o))}var Ko=globalThis&&globalThis.__assign||function(){return Ko=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function jd(r){var t=r.className,e={points:"",fill:"none"};return ut(we(r),function(n){var o=Rd(n,2),i=o[0],a=o[1];(i==="style"||typeof a!="object")&&(e[i]=a)}),t&&(e.className="".concat(t)),x("polyline",Ko({},e))}var jl=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ur=globalThis&&globalThis.__assign||function(){return Ur=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},J;(function(r){r[r.LEFT_TOP=0]="LEFT_TOP",r[r.RIGHT_TOP=1]="RIGHT_TOP",r[r.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",r[r.LEFT_BOTTOM=3]="LEFT_BOTTOM"})(J||(J={}));var Bd=function(r){jl(t,r);function t(e){var n=r.call(this)||this;n.updateEdgePointByAnchors=function(){var s=n.nodeModel,l=s.id,u=s.anchors,f=n.graphModel.getNodeEdges(l);ut(f,function(c){if(c.sourceNodeId===l){var d=Ie(u,function(p){return p.id===c.sourceAnchorId});d&&c.updateStartPoint({x:d.x,y:d.y})}else if(c.targetNodeId===l){var d=Ie(u,function(y){return y.id===c.targetAnchorId});d&&c.updateEndPoint({x:d.x,y:d.y})}})},n.triggerResizeEvent=function(s,l,u,f,c,d){n.graphModel.eventCenter.emit(C.NODE_RESIZE,{preData:s,data:l,deltaX:u,deltaY:f,index:c,model:d})},n.recalcResizeInfo=function(s,l,u,f,c){u===void 0&&(u=1),f===void 0&&(f=!1),c===void 0&&(c=!1);var d=Y(l),p=d.deltaX,y=d.deltaY,h=d.width,g=d.height,v=d.PCTResizeInfo;if(v){var _=4,O=0,w=0;switch(s){case J.LEFT_TOP:w=(p*-1-y)/_;break;case J.RIGHT_TOP:w=(p-y)/_;break;case J.RIGHT_BOTTOM:w=(p+y)/_;break;case J.LEFT_BOTTOM:w=(p*-1+y)/_;break}w!==0&&(O=Math.round(w/v.ResizeBasis.basisHeight*1e5)/1e3),v.ResizePCT.widthPCT=Math.max(Math.min(v.ResizePCT.widthPCT+O,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit),v.ResizePCT.heightPCT=Math.max(Math.min(v.ResizePCT.heightPCT+O,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit);var S=Math.round(v.ResizePCT.widthPCT*v.ResizeBasis.basisWidth/100),M=Math.round(v.ResizePCT.heightPCT*v.ResizeBasis.basisHeight/100);switch(s){case J.LEFT_TOP:p=h-S,y=g-M;break;case J.RIGHT_TOP:p=S-h,y=g-M;break;case J.RIGHT_BOTTOM:p=S-h,y=M-g;break;case J.LEFT_BOTTOM:p=h-S,y=M-g;break}return d}switch(s){case J.LEFT_TOP:d.width=f?h:h-p*u,d.height=c?g:g-y*u;break;case J.RIGHT_TOP:d.width=f?h:h+p*u,d.height=c?g:g-y*u;break;case J.RIGHT_BOTTOM:d.width=f?h:h+p*u,d.height=c?g:g+y*u;break;case J.LEFT_BOTTOM:d.width=f?h:h-p*u,d.height=c?g:g+y*u;break}return d},n.resizeNode=function(s){var l=s.deltaX,u=s.deltaY,f=n.index,c=n.props,d=c.model,p=c.graphModel,y=c.x,h=c.y;$d({x:y,y:h,deltaX:l,deltaY:u,index:f,nodeModel:d,graphModel:p,cancelCallback:function(){n.dragHandler.cancelDrag()}})},n.onDragging=function(s){var l=s.deltaX,u=s.deltaY,f=n.graphModel.transformModel,c=Id(f.fixDeltaXY(l,u),2),d=c[0],p=c[1];n.resizeNode({deltaX:d,deltaY:p})},n.onDragEnd=function(){var s=n.nodeModel.x,l=n.nodeModel.y;n.nodeModel.moveTo(s,l),n.updateEdgePointByAnchors()};var o=e.index,i=e.model,a=e.graphModel;return n.index=o,n.nodeModel=i,n.graphModel=a,n.dragHandler=new ue({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:a.gridSize}),n}return t.prototype.componentWillUnmount=function(){this.dragHandler.destroy()},t.prototype.render=function(){var e=this.props,n=e.x,o=e.y,i=e.direction,a=e.model,s=a.getResizeControlStyle(),l=s.width,u=s.height,f=Ld(s,["width","height"]);return x("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[x(ae,Ur({className:"lf-resize-control-content",x:n,y:o,width:l!=null?l:7,height:u!=null?u:7},f)),x(ae,{className:"lf-resize-control-content",x:n,y:o,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},t}($),Xd=function(r){jl(t,r);function t(){return r.call(this)||this}return t.prototype.getResizeControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=Mt(n),a=i.minX,s=i.minY,l=i.maxX,u=i.maxY,f=[{index:J.LEFT_TOP,direction:"nw",x:a,y:s},{index:J.RIGHT_TOP,direction:"ne",x:l,y:s},{index:J.RIGHT_BOTTOM,direction:"se",x:l,y:u},{index:J.LEFT_BOTTOM,direction:"sw",x:a,y:u}];return de(f,function(c){return x(Bd,Ur({},c,{model:n,graphModel:o}))})},t.prototype.getResizeOutline=function(){var e=this.props.model,n=e.x,o=e.y,i=e.width,a=e.height,s=e.getResizeOutlineStyle();return x(ae,Ur({},s,{x:n,y:o,width:i,height:a}))},t.prototype.render=function(){return x("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},t}($);function kd(r,t){var e=r.x,n=r.y,o=t.x,i=t.y,a={x:e+(o-e)/2,y:n+(i-n)/2};return a}function xr(r,t,e){var n=Yd(e),o=r.x-t.x,i=r.y-t.y,a=o*Math.cos(n)-i*Math.sin(n)+t.x,s=o*Math.sin(n)+i*Math.cos(n)+t.y;return{x:a,y:s}}function Yd(r){return r*Math.PI/180}function Hd(r){return r/Math.PI*180}function Ud(r,t,e,n,o,i,a,s,l){s===void 0&&(s=!1),l===void 0&&(l=!1);var u=t.deltaX,f=t.deltaY,c=t.width,d=t.height,p=Hd(e),y={x:n,y:o},h={x:i,y:a},g=xr(y,h,p),v={x:g.x+u,y:g.y+f},_=Vd(g,v,h,p,s,l,c,d),O=_.width,w=_.height,S=_.center;return t.width=O*r,t.height=w*r,t.deltaX=(S.x-h.x)*2,t.deltaY=(S.y-h.y)*2,t}var Fd=function(r,t,e,n,o,i,a,s,l,u){e===void 0&&(e=1),n===void 0&&(n=!1),o===void 0&&(o=!1),i===void 0&&(i=0);var f=Y(t),c=f.deltaX,d=f.deltaY,p=f.width,y=f.height,h=f.PCTResizeInfo;if(h){var g=4,v=0,_=0;switch(r){case J.LEFT_TOP:_=(c*-1-d)/g;break;case J.RIGHT_TOP:_=(c-d)/g;break;case J.RIGHT_BOTTOM:_=(c+d)/g;break;case J.LEFT_BOTTOM:_=(c*-1+d)/g;break}_!==0&&(v=Math.round(_/h.ResizeBasis.basisHeight*1e5)/1e3),h.ResizePCT.widthPCT=Math.max(Math.min(h.ResizePCT.widthPCT+v,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit),h.ResizePCT.heightPCT=Math.max(Math.min(h.ResizePCT.heightPCT+v,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit);var O=Math.round(h.ResizePCT.widthPCT*h.ResizeBasis.basisWidth/100),w=Math.round(h.ResizePCT.heightPCT*h.ResizeBasis.basisHeight/100);switch(r){case J.LEFT_TOP:c=p-O,d=y-w;break;case J.RIGHT_TOP:c=O-p,d=y-w;break;case J.RIGHT_BOTTOM:c=O-p,d=w-y;break;case J.LEFT_BOTTOM:c=p-O,d=w-y;break}return f}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return Ud(e,f,i,a,s,l,u,n,o);switch(r){case J.LEFT_TOP:f.width=n?p:p-c*e,f.height=o?y:y-d*e;break;case J.RIGHT_TOP:f.width=n?p:p+c*e,f.height=o?y:y-d*e;break;case J.RIGHT_BOTTOM:f.width=n?p:p+c*e,f.height=o?y:y+d*e;break;case J.LEFT_BOTTOM:f.width=n?p:p-c*e,f.height=o?y:y+d*e;break}return f},zd=function(r,t){var e=r.id,n=r.anchors,o=t.getNodeEdges(e);ut(o,function(i){if(i.sourceNodeId===e){var a=Ie(n,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===e){var a=Ie(n,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},Gd=function(r,t,e,n,o,i,a){a.eventCenter.emit(C.NODE_RESIZE,{preData:r,data:t,deltaX:e,deltaY:n,index:o,model:i})},$d=function(r){var t=r.x,e=r.y,n=r.deltaX,o=r.deltaY,i=r.index,a=r.nodeModel,s=r.graphModel,l=r.cancelCallback,u=a.r,f=a.rx,c=a.ry,d=a.width,p=a.height,y=a.PCTResizeInfo,h=a.minWidth,g=a.minHeight,v=a.maxWidth,_=a.maxHeight,O=a.rotate,w=a.x,S=a.y,M=h===v,m=g===_,T={width:u||f||d,height:u||c||p,deltaX:n,deltaY:o,PCTResizeInfo:y},P=u||f&&c?1/2:1,A=t,I=e,B=Fd(i,T,P,M,m,O,A,I,w,S);if(B.widthv||B.height_){l==null||l();return}(O%(2*Math.PI)==0||y||A===void 0||I===void 0)&&(B.deltaX=M?0:B.deltaX,B.deltaY=m?0:B.deltaY);var U=a.getData(),F=a.resize(B);U.x===F.x&&U.y===F.y||(zd(a,s),Gd(U,F,n,o,i,a,s))};function Vd(r,t,e,n,o,i,a,s){o===void 0&&(o=!1),i===void 0&&(i=!1);var l={x:e.x-(r.x-e.x),y:e.y-(r.y-e.y)},u=kd(l,t),f=xr(t,u,-n),c=xr(l,u,-n);if(o){var d=Math.abs(f.x-c.x),p=d-a;u.x>f.x?u.x=u.x+p/2:u.x=u.x-p/2}if(i){var y=Math.abs(f.y-c.y),h=y-s;u.y>f.y?u.y=u.y+h/2:u.y=u.y-h/2}if(o||i){var g=xr(c,u,n),v=g.x-l.x,_=g.y-l.y;u.x=u.x-v,u.y=u.y-_,c=xr(l,u,-n),f={x:u.x-(c.x-u.x),y:u.y-(c.y-u.y)}}var O=Math.abs(f.x-c.x),w=Math.abs(f.y-c.y);return o&&(O=a),i&&(w=s),{width:O,height:w,center:u}}var Wd=100,Kd={x:1,y:0,z:0};function Zd(r,t,e,n,o){for(var i=function(p){if(p<0||p>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:r.x*Math.pow(1-p,3)+3*t.x*p*Math.pow(1-p,2)+3*e.x*Math.pow(p,2)*(1-p)+n.x*Math.pow(p,3),y:r.y*Math.pow(1-p,3)+3*t.y*p*Math.pow(1-p,2)+3*e.y*Math.pow(p,2)*(1-p)+n.y*Math.pow(p,3)}},a=0,s=2,l=n.x,u=n.y,f=n;a=0?n:-n}function Ga(r){var t=Math.hypot(r.x,r.y);return{x:r.x/t,y:r.y/t,z:0}}function tp(r){return Qd(Kd,r)}function ep(r){return r*(180/Math.PI)}var rp={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},Ll=function(r){var t=Y(rp);return r&&(t=pi(t,r)),t},np=Ll,op=1e3,ip=999,ji=function(){return++op},ap=function(){return--ip},dt=globalThis&&globalThis.__assign||function(){return dt=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},ro=function(){function r(t,e){var n;this.BaseType=st.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Xt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=W.DEFAULT,this.modelType=z.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=e,this.properties=(n=t.properties)!==null&&n!==void 0?n:{},this.initEdgeData(t),this.setAttributes()}return r.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||Le()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,tt(this,ld(t));var a=this.graphModel.overlapMode;a===Vt.INCREASE&&(this.zIndex=t.zIndex||ji()),this.setAnchors(),this.initPoints(),this.formatText(t)},r.prototype.setAttributes=function(){},r.prototype.createId=function(){return null},r.prototype.getEdgeStyle=function(){return dt(dt({},this.graphModel.theme.baseEdge),this.style)},r.prototype.getAdjustPointStyle=function(){return dt({},this.graphModel.theme.edgeAdjust)},r.prototype.getTextStyle=function(){var t=this.graphModel.theme.edgeText;return Y(t)},r.prototype.getEdgeAnimationStyle=function(){var t=this.graphModel.theme.edgeAnimation;return Y(t)},r.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,o=this.isAnimation?e.stroke:t.stroke;return dt(dt(dt({},t),{fill:o,stroke:o}),n)},r.prototype.getOutlineStyle=function(){var t=this.graphModel,e=t.theme.outline;return Y(e)},r.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(r.prototype,"sourceNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.sourceNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"targetNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.targetNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),r.prototype.getBeginAnchor=function(t,e,n){var o,i,a=Ho(t);if(n){if(o=Ie(a,function(s){return s.id===n}),o)return o;console.warn("\u672A\u5728\u8282\u70B9\u4E0A\u627E\u5230\u6307\u5B9A\u7684\u8D77\u70B9\u951A\u70B9".concat(n,"\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u951A\u70B9\u4F5C\u4E3A\u8D77\u70B9"))}return a.forEach(function(s){var l=Ba(s,e);(i===void 0||l=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},vo=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},$a=function(r){sp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.BEZIER_EDGE,o.path="",o.initEdgeData(e),o.setAttributes(),o}return t.prototype.initEdgeData=function(e){this.offset=100,r.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,n=r.prototype.getEdgeStyle.call(this),o=this.properties.style,i=o===void 0?{}:o;return De(De(De({},n),Y(e)),Y(i))},t.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var e=0,n=0;return this.pointsList.forEach(function(o){var i=o.x,a=o.y;e+=i,n+=a}),{x:e/this.pointsList.length,y:n/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},t.prototype.getData=function(){var e=r.prototype.getData.call(this),n=this.pointsList.map(function(o){var i=o.x,a=o.y;return{x:i,y:a}});return De(De({},e),{pointsList:n})},t.prototype.getControls=function(){var e=this.startPoint,n=this.endPoint,o=La({start:e,end:n,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return o},t.prototype.getPath=function(e){var n=vo(e,4),o=n[0],i=n[1],a=n[2],s=n[3];return"M ".concat(o.x," ").concat(o.y,` C `).concat(i.x," ").concat(i.y,`, `).concat(a.x," ").concat(a.y,`, `).concat(s.x," ").concat(s.y)},t.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=this.getControls(),n=e.sNext,o=e.ePre;this.updatePath(n,o)},t.prototype.updatePath=function(e,n){e=Y(e),n=Y(n);var o={x:this.startPoint.x,y:this.startPoint.y},i={x:this.endPoint.x,y:this.endPoint.y};if(!e||!n){var a=this.getControls();e=a.sNext,n=a.ePre}this.pointsList=[o,e,n,i],this.path=this.getPath(this.pointsList)},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,n){this.startPoint.x+=e,this.startPoint.y+=n;var o=vo(this.pointsList,3),i=o[1],a=o[2];i.x+=e,i.y+=n,this.updatePath(i,a)},t.prototype.moveEndPoint=function(e,n){this.endPoint.x+=e,this.endPoint.y+=n;var o=vo(this.pointsList,3),i=o[1],a=o[2];a.x+=e,a.y+=n,this.updatePath(i,a)},t.prototype.updateAdjustAnchor=function(e,n){var o;n==="sNext"?this.pointsList[1]=e:n==="ePre"&&(this.pointsList[2]=e),this.path=this.getPath(this.pointsList),!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition))},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var n=e.startPoint,o=e.endPoint,i=e.sourceNode,a=e.targetNode,s=La({start:n,end:o,sourceNode:i,targetNode:a,offset:this.offset}),l=s.sNext,u=s.ePre;this.pointsList=[n,l,u,o],this.initPoints()},Ht([E],t.prototype,"path",void 0),Ht([b],t.prototype,"initPoints",null),Ht([b],t.prototype,"updatePoints",null),Ht([b],t.prototype,"updateStartPoint",null),Ht([b],t.prototype,"updateEndPoint",null),Ht([b],t.prototype,"moveStartPoint",null),Ht([b],t.prototype,"moveEndPoint",null),Ht([b],t.prototype,"updateAdjustAnchor",null),Ht([b],t.prototype,"getAdjustStart",null),Ht([b],t.prototype,"getAdjustEnd",null),Ht([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(ro),lp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Tr=globalThis&&globalThis.__assign||function(){return Tr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},up=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Ka=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},fp=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;nl)&&(a=l,i=s)}),i},t.prototype.getCrossPoint=function(e,n,o){var i;return e===ot.HORIZONTAL?i={x:o.x,y:n.y}:e===ot.VERTICAL&&(i={x:n.x,y:o.y}),i},t.prototype.removeCrossPoints=function(e,n,o){var i=o.map(function(v){return v});if(e===1){var a=i[e],s=i[n],l=i[e-1],u=Na(l,a,this.sourceNode);if(u){var f=Ca(a,s,this.sourceNode);if(f){var c=Ra(a,s,this.sourceNode);c&&(i[e]=c,i.splice(e-1,1),e--,n--)}}else{var d=this.sourceNode.anchors;d.forEach(function(v){if(v.x===l.x&&v.x===a.x||v.y===l.y&&v.y===a.y){var _=Wt(v.x,v.y,a.x,a.y),O=Wt(l.x,l.y,a.x,a.y);_0?this.points=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=Da({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=e,this.points=e.map(function(n){return"".concat(n.x,",").concat(n.y)}).join(" ")},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,n){this.startPoint.x+=e,this.startPoint.y+=n,this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveEndPoint=function(e,n){this.endPoint.x+=e,this.endPoint.y+=n,this.updatePoints()},t.prototype.updatePointsList=function(e,n){this.pointsList.forEach(function(a){a.x+=e,a.y+=n});var o=this.pointsList[0];this.startPoint=Object.assign({},o);var i=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},i),this.initPoints()},t.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map(function(e){return e})},t.prototype.dragAppendSimple=function(e,n){var o;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,f=this.pointsList,c=f;return u===ot.HORIZONTAL?(f[s]={x:i.x,y:i.y+n.y},f[l]={x:a.x,y:a.y+n.y},c=this.pointsList.map(function(d){return d})):u===ot.VERTICAL&&(f[s]={x:i.x+n.x,y:i.y},f[l]={x:a.x+n.x,y:a.y},c=this.pointsList.map(function(d){return d})),this.updatePointsAfterDrag(c),this.draggingPointList=c,!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition)),{start:tt({},f[s]),end:tt({},f[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppend=function(e,n){var o;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,f=this.pointsList;if(u===ot.HORIZONTAL){f[s]={x:i.x,y:i.y+n.y},f[l]={x:a.x,y:a.y+n.y};var c=this.pointsList.map(function(g){return g});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x,y:i.y+n.y},p=Ee(d,this.sourceNode);if(!p){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x,y:a.y+n.y},p=Ee(h,this.targetNode);if(!p){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}else if(u===ot.VERTICAL){f[s]={x:i.x+n.x,y:i.y},f[l]={x:a.x+n.x,y:a.y};var c=this.pointsList.map(function(v){return v});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x+n.x,y:i.y},p=Ee(d,this.sourceNode);if(!p){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x+n.x,y:a.y},p=Ee(h,this.targetNode);if(!p){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}return!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition)),{start:tt({},f[s]),end:tt({},f[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppendEnd=function(){if(this.draggingPointList){var e=wl(ke(this.points));this.pointsList=e.map(function(i){return i}),this.draggingPointList=[];var n=e[0];this.startPoint=tt({},n);var o=e[e.length-1];this.endPoint=tt({},o)}this.isDragging=!1},t.prototype.updatePointsAfterDrag=function(e){var n=this.updateCrossPoints(e);this.points=n.map(function(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var n=e.startPoint,o=e.endPoint,i=e.sourceNode,a=e.targetNode;this.pointsList=Da({x:n.x,y:n.y},{x:o.x,y:o.y},i,a,this.offset||0),this.initPoints()},Et([E],t.prototype,"dbClickPosition",void 0),Et([b],t.prototype,"initPoints",null),Et([b],t.prototype,"updatePoints",null),Et([b],t.prototype,"updateStartPoint",null),Et([b],t.prototype,"moveStartPoint",null),Et([b],t.prototype,"updateEndPoint",null),Et([b],t.prototype,"moveEndPoint",null),Et([b],t.prototype,"updatePointsList",null),Et([b],t.prototype,"dragAppendStart",null),Et([b],t.prototype,"dragAppendSimple",null),Et([b],t.prototype,"dragAppend",null),Et([b],t.prototype,"dragAppendEnd",null),Et([b],t.prototype,"updatePointsAfterDrag",null),Et([b],t.prototype,"getAdjustStart",null),Et([b],t.prototype,"getAdjustEnd",null),Et([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(ro),ht=globalThis&&globalThis.__assign||function(){return ht=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Za=globalThis&&globalThis.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},dp=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Me=function(){function r(t,e){var n;this.BaseType=st.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Xt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=W.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=z.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.resizeRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=e,this.properties=(n=t.properties)!==null&&n!==void 0?n:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(r.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this,n=e.x,o=n===void 0?0:n,i=e.y,a=i===void 0?0:i;this.transform=new eo(-o,-a).rotate(t).translate(o,a).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),r.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||Le()}this.formatText(t),tt(this,_d(t));var i=this.graphModel.overlapMode;i===Vt.INCREASE&&(this.zIndex=t.zIndex||ji())},r.prototype.setAttributes=function(){},r.prototype.createId=function(){return null},r.prototype.setTextMode=function(t){this.textMode=t},r.prototype.formatText=function(t){var e,n,o,i=t.x,a=t.y,s=t.text,l={value:"",x:i,y:a,draggable:!1,editable:!0};s&&(typeof s=="string"?l.value=s:(l=ht(ht({},l),{x:(e=s.x)!==null&&e!==void 0?e:i,y:(n=s.y)!==null&&n!==void 0?n:a,value:(o=s.value)!==null&&o!==void 0?o:""}),Qe(s.draggable)||(l.draggable=s.draggable),Qe(s.editable)||(l.editable=s.editable))),t.text=l},r.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY,a=this.isAllowResizeNode(o,i,e,n);return a?(this.move(o/2,i/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()):this.getData()},r.prototype.proportionalResize=function(){},r.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,o=t.value,i=this.properties;Te(i)&&(i=ne(i)),Je(i.width)&&(i.width=this.width),Je(i.height)&&(i.height=this.height);var a={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(a.rotate=this.rotate),this.graphModel.overlapMode===Vt.INCREASE&&(a.zIndex=this.zIndex),o&&(a.text={x:e,y:n,value:o}),a},r.prototype.getHistoryData=function(){return this.getData()},r.prototype.getProperties=function(){return ne(this.properties)},r.prototype.getOuterGAttributes=function(){return{className:""}},r.prototype.getNodeStyle=function(){return ht(ht({},this.graphModel.theme.baseNode),this.style)},r.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,n=e===void 0?{}:e;return ht(ht({},Y(t)),Y(n))},r.prototype.getRotateControlStyle=function(){var t=this.graphModel.theme.rotateControl;return Y(t)},r.prototype.getResizeControlStyle=function(){var t=this.graphModel.theme.resizeControl;return Y(t)},r.prototype.getResizeOutlineStyle=function(){var t=this.graphModel.theme.resizeOutline;return Y(t)},r.prototype.getAnchorStyle=function(t){var e=this.graphModel.theme.anchor;return Y(e)},r.prototype.getAnchorLineStyle=function(t){var e=this.graphModel.theme.anchorLine;return Y(e)},r.prototype.getOutlineStyle=function(){var t=this.graphModel.theme.outline;return Y(t)},r.prototype.isAllowConnectedAsSource=function(t,e,n,o){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var a=!0,s="",l=0;l0?e.map(function(a,s){return a.length?(a=a,{id:"".concat(n,"_").concat(s),x:o+a[0],y:i+a[1]}):(a=a,ht(ht({},a),{x:o+a.x,y:i+a.y,id:a.id||"".concat(n,"_").concat(s)}))}):this.getDefaultAnchor()},r.prototype.getDefaultAnchor=function(){return[]},r.prototype.getTargetAnchor=function(t){return vd(t,this)},r.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(r.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,o=e.y,i=e.rotate;return t.forEach(function(a){var s=a.x,l=a.y,u=dp(new to([s,l,1]).translate(-n,-o).rotate(i).translate(n,o)[0],2),f=u[0],c=u[1];a.x=f,a.y=c}),t},enumerable:!1,configurable:!0}),r.prototype.getAnchorInfo=function(t){if(!Je(t))for(var e=0;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},qa=function(r){pp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.CIRCLE_NODE,o.r=50,o.initNodeData(e),o.setAttributes(),o}return Object.defineProperty(t.prototype,"width",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,o=this.properties.style,i=o===void 0?{}:o;return Sr(Sr(Sr({},e),Y(n)),Y(i))},t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.r;return[{x:n,y:o-i,id:"".concat(this.id,"_0")},{x:n+i,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+i,id:"".concat(this.id,"_2")},{x:n-i,y:o,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var n=e.width,o=e.deltaX,i=e.deltaY;return this.move(o/2,i/2),this.r=n,this.setProperties({r:n}),this.getData()},yo([E],t.prototype,"r",void 0),yo([et],t.prototype,"width",null),yo([et],t.prototype,"height",null),t}(Me),hp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Mr=globalThis&&globalThis.__assign||function(){return Mr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},ln=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Ja=function(r){hp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.DIAMOND_NODE,o.rx=30,o.ry=50,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,o=this.properties.style,i=o===void 0?{}:o;return Mr(Mr(Mr({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"points",{get:function(){var e=this,n=e.x,o=e.y,i=e.rx,a=e.ry;return[[n,o-a],[n+i,o],[n,o+a],[n-i,o]]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointsPosition",{get:function(){return de(this.points,function(e){var n=ln(e,2),o=n[0],i=n[1];return{x:o,y:i}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return ut(this.points,function(o){var i=ln(o,1),a=i[0];an&&(n=a)}),n-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return ut(this.points,function(o){var i=ln(o,2),a=i[1];an&&(n=a)}),n-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this;return de(this.points,function(n,o){var i=ln(n,2),a=i[0],s=i[1];return{x:a,y:s,id:"".concat(e.id,"_").concat(o)}})},t.prototype.resize=function(e){var n=e.width,o=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=n,this.ry=o,this.setProperties({rx:n,ry:o}),this.getData()},ze([E],t.prototype,"rx",void 0),ze([E],t.prototype,"ry",void 0),ze([et],t.prototype,"points",null),ze([et],t.prototype,"pointsPosition",null),ze([et],t.prototype,"width",null),ze([et],t.prototype,"height",null),t}(Me),vp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ar=globalThis&&globalThis.__assign||function(){return Ar=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Qa=function(r){vp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.ELLIPSE_NODE,o.rx=30,o.ry=45,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,o=this.properties.style,i=o===void 0?{}:o;return Ar(Ar(Ar({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"width",{get:function(){return this.rx*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.ry*2},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.rx,a=e.ry;return[{x:n,y:o-a,id:"".concat(this.id,"_0")},{x:n+i,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+a,id:"".concat(this.id,"_2")},{x:n-i,y:o,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var n=e.width,o=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=n,this.ry=o,this.setProperties({rx:n,ry:o}),this.getData()},un([E],t.prototype,"rx",void 0),un([E],t.prototype,"ry",void 0),un([et],t.prototype,"width",null),un([et],t.prototype,"height",null),t}(Me),yp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Pr=globalThis&&globalThis.__assign||function(){return Pr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},fn=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ts=function(r){yp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.points,o=e.width,i=e.height,a=n||this.points;this.points=fd(a,o,i)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,o=this.properties.style,i=o===void 0?{}:o;return Pr(Pr(Pr({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"pointsPosition",{get:function(){var e=this,n=e.x,o=e.y,i=e.width,a=e.height;return this.points.map(function(s){return{x:s[0]+n-i/2,y:s[1]+o-a/2}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=fn(o,1),a=i[0];an&&(n=a)}),n-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=fn(o,2),a=i[1];an&&(n=a)}),n-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,n=this,o=n.x,i=n.y,a=n.width,s=n.height,l=n.points;return l.map(function(u,f){var c=fn(u,2),d=c[0],p=c[1];return{x:o+d-a/2,y:i+p-s/2,id:"".concat(e.id,"_").concat(f)}})},t.prototype.resize=function(e){var n=this,o=e.width,i=e.height,a=e.deltaX,s=e.deltaY;this.move(a/2,s/2);var l=de(this.points,function(u){var f=fn(u,2),c=f[0],d=f[1];return[c*o/n.width,d*i/n.height]});return this.points=l,this.properties.points=l,this.getData()},cn([E],t.prototype,"points",void 0),cn([et],t.prototype,"pointsPosition",null),cn([et],t.prototype,"width",null),cn([et],t.prototype,"height",null),t}(Me),gp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dr=globalThis&&globalThis.__assign||function(){return Dr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},qo=function(r){gp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.RECT_NODE,o.radius=0,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height,i=e.radius;Je(n)||(this.width=n),Je(o)||(this.height=o),Je(i)||(this.radius=i)},t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.width,a=e.height;return[{x:n,y:o-a/2,id:"".concat(this.id,"_0")},{x:n+i/2,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+a/2,id:"".concat(this.id,"_2")},{x:n-i/2,y:o,id:"".concat(this.id,"_3")}]},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,o=this.properties.style,i=o===void 0?{}:o;return Dr(Dr(Dr({},e),Y(n)),Y(i))},_p([E],t.prototype,"radius",void 0),t}(Me),mp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Nr=globalThis&&globalThis.__assign||function(){return Nr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},bp=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xp=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Op={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},dn=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],Tp=function(){function r(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.textMode=Xt.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Xt.TEXT,this.edgeTextMode=Xt.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",tt(this,this.computeConfig(t))}return r.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);tt(this,e)},r.prototype.computeConfig=function(t){var e=t.isSilentMode,n=t.textDraggable,o=t.textMode,i=t.textEdit,a=t.adjustEdgeStartAndEnd,s={};if(e===!1&&tt(s,this.stagedConfig),e===!0&&e!==this.isSilentMode){var l=We(Op,dn);this.stagedConfig=We(this,dn),tt(s,l)}Qe(i)||tt(s,{nodeTextEdit:i,edgeTextEdit:i}),Qe(n)||tt(s,{nodeTextDraggable:n,edgeTextDraggable:n}),o&&tt(s,{nodeTextMode:o,edgeTextMode:o}),To(a)&&tt(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var u=We(t,dn);return tt(s,u)},r.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},r.prototype.getConfig=function(){return We(this,dn)},K([E],r.prototype,"isSilentMode",void 0),K([E],r.prototype,"stopZoomGraph",void 0),K([E],r.prototype,"stopMoveGraph",void 0),K([E],r.prototype,"stopScrollGraph",void 0),K([E],r.prototype,"textMode",void 0),K([E],r.prototype,"textEdit",void 0),K([E],r.prototype,"textDraggable",void 0),K([E],r.prototype,"nodeTextEdit",void 0),K([E],r.prototype,"nodeTextDraggable",void 0),K([E],r.prototype,"nodeTextMultiple",void 0),K([E],r.prototype,"nodeTextVertical",void 0),K([E],r.prototype,"nodeTextMode",void 0),K([E],r.prototype,"edgeTextMode",void 0),K([E],r.prototype,"edgeTextEdit",void 0),K([E],r.prototype,"edgeTextDraggable",void 0),K([E],r.prototype,"edgeTextMultiple",void 0),K([E],r.prototype,"edgeTextVertical",void 0),K([E],r.prototype,"hideAnchors",void 0),K([E],r.prototype,"allowRotate",void 0),K([E],r.prototype,"allowResize",void 0),K([E],r.prototype,"hoverOutline",void 0),K([E],r.prototype,"nodeSelectedOutline",void 0),K([E],r.prototype,"adjustNodePosition",void 0),K([E],r.prototype,"autoExpand",void 0),K([E],r.prototype,"adjustEdge",void 0),K([E],r.prototype,"adjustEdgeMiddle",void 0),K([E],r.prototype,"adjustEdgeStartAndEnd",void 0),K([E],r.prototype,"adjustEdgeStart",void 0),K([E],r.prototype,"adjustEdgeEnd",void 0),K([E],r.prototype,"edgeSelectedOutline",void 0),K([b],r.prototype,"updateEditConfig",null),K([b],r.prototype,"updateTextMode",null),r}(),wp="*",Sp=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){var o=this;t==null||t.split(",").forEach(function(i){i=i.trim(),o._events[i]||(o._events[i]=[]),o._events[i].push({callback:e,once:!!n})})},r.prototype.once=function(t,e){var n=this;t==null||t.split(",").forEach(function(o){o=o.trim(),n.on(o,e,!0)})},r.prototype.emit=function(t,e){var n=this;t==null||t.split(",").forEach(function(o){var i=n._events[o]||[],a=n._events[wp]||[],s=function(l){for(var u=l.length,f=0;f=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Pp=function(r){Mp(t,r);function t(e){var n=r.call(this)||this;n.stepScrollX=0,n.stepScrollY=0,n.onDragging=function(s){var l=s.deltaX,u=s.deltaY;n.setState({isDragging:!0});var f=n.props.graphModel,c=f.transformModel,d=f.editConfigModel;d.stopMoveGraph!==!0&&c.translate(l,u)},n.onDragEnd=function(){n.setState({isDragging:!1})},n.zoomHandler=function(s){var l=n.props,u=l.graphModel,f=u.editConfigModel,c=u.transformModel,d=u.gridSize,p=l.graphModel,y=s.deltaX,h=s.deltaY;if(!f.stopScrollGraph&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),n.stepScrollX+=y,n.stepScrollY+=h,Math.abs(n.stepScrollX)>=d){var g=n.stepScrollX%d,v=n.stepScrollX-g;c.translate(-v*c.SCALE_X,0),n.stepScrollX=g}if(Math.abs(n.stepScrollY)>=d){var _=n.stepScrollY%d,O=n.stepScrollY-_;c.translate(0,-O*c.SCALE_Y),n.stepScrollY=_}return}if(!f.stopZoomGraph){s.preventDefault();var w=p.getPointByClient({x:s.clientX,y:s.clientY}),S=w.canvasOverlayPosition,M=S.x,m=S.y;c.zoom(s.deltaY<0,[M,m])}},n.clickHandler=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){var u=n.props.graphModel,f=u.selectElements;f.size>0&&u.clearSelectElements(),u.eventCenter.emit(C.BLANK_CLICK,{e:s})}},n.handleContextMenu=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){s.preventDefault();var u=n.props.graphModel,f=u.getPointByClient({x:s.clientX,y:s.clientY});u.eventCenter.emit(C.BLANK_CONTEXTMENU,{e:s,position:f})}},n.mouseDownHandler=function(s){var l=n.props.graphModel,u=l.eventCenter,f=l.editConfigModel,c=l.transformModel.SCALE_X,d=l.gridSize,p=s.target,y=!f.adjustEdge&&!f.adjustNodePosition;(p.getAttribute("name")==="canvas-overlay"||y)&&(f.stopMoveGraph!==!0?(n.stepDrag.setStep(d*c),n.stepDrag.handleMouseDown(s)):u.emit(C.BLANK_MOUSEDOWN,{e:s}),n.clickHandler(s))};var o=e.graphModel,i=o.gridSize,a=o.eventCenter;return n.stepDrag=new ue({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),n.state={isDragging:!1},n}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=e.getTransformStyle().transform,o=this.props,i=o.children,a=o.dnd,s=this.state.isDragging;return x("svg",Jo({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:s?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},a.eventMap(),{children:x("g",{transform:n,children:i})}))},t=Ap([Ct],t),t}($),Il=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fr=globalThis&&globalThis.__assign||function(){return Fr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Np=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},os=function(r){Il(t,r);function t(){var e=r.call(this)||this;return e.onDragging=function(n){var o=n.event,i=e.props,a=i.graphModel,s=i.bezierModel,l=i.type,u=a.getPointByClient({x:o.clientX,y:o.clientY}).canvasOverlayPosition,f=u.x,c=u.y;s.updateAdjustAnchor({x:f,y:c},l),a.eventCenter.emit(C.EDGE_ADJUST,{data:s.getData()})},e.onDragEnd=function(){var n=e.props.bezierModel;n.isDragging=!1},e.dragHandler=new ue({onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.render=function(){var e=this,n=this.props.position,o=n.x,i=n.y,a=this.props.bezierModel,s=a.getEdgeStyle().adjustAnchor;return x(cr,Fr({className:"lf-bezier-adjust-anchor",x:o,y:i},s,{onMouseDown:function(l){e.dragHandler.handleMouseDown(l)}}))},t}($),Cp=function(r){Il(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getBezierAdjust=function(e,n){var o=e.path,i=e.id,a=Ci(o),s=Np(a,4),l=s[0],u=s[1],f=s[2],c=s[3],d=e.getEdgeStyle().adjustLine,p=[];return p.push(x(ur,Fr({x1:l.x,y1:l.y,x2:u.x,y2:u.y},d))),p.push(x(os,{position:u,bezierModel:e,graphModel:n,type:"sNext"},"".concat(i,"_ePre"))),p.push(x(ur,Fr({x1:c.x,y1:c.y,x2:f.x,y2:f.y},d))),p.push(x(os,{position:f,bezierModel:e,graphModel:n,type:"ePre"},"".concat(i,"_sNext"))),p},t.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,n=e.edges,o=[],i=0;i=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Lp=function(r){Rp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.background;return x("div",{className:"lf-background",children:x("div",{style:su(e)?e:{},className:"lf-background-area"})})},t=jp([Ct],t),t}($),Ip=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Bp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},kn=function(r){Ip(t,r);function t(e){var n=r.call(this,e)||this;return n.id=Le(),n.gridOptions=n.props.graphModel.grid,n}return t.prototype.renderDot=function(){var e=this.gridOptions,n=e.config,o=e.size,i=o===void 0?1:o,a=e.visible,s=n!=null?n:{},l=s.color,u=s.thickness,f=u===void 0?2:u,c=Math.min(Math.max(2,f),i/4),d=a?1:0;return x("g",{fill:l,opacity:d,children:[x("circle",{cx:0,cy:0,r:c/2}),x("circle",{cx:0,cy:i,r:c/2}),x("circle",{cx:i,cy:0,r:c/2}),x("circle",{cx:i,cy:i,r:c/2})]})},t.prototype.renderMesh=function(){var e=this.gridOptions,n=e.config,o=e.size,i=o===void 0?1:o,a=e.visible,s=n!=null?n:{},l=s.color,u=s.thickness,f=u===void 0?1:u,c=Math.min(Math.max(1,f),i/2),d="M 0 0 H ".concat(i," V ").concat(i," H 0 Z"),p=a?1:0;return x("path",{d,stroke:l,strokeWidth:c/2,opacity:p,fill:"transparent"})},t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=this.gridOptions,o=n.type,i=n.size,a=i===void 0?1:i,s=e.SCALE_X,l=e.SKEW_Y,u=e.SKEW_X,f=e.SCALE_Y,c=e.TRANSLATE_X,d=e.TRANSLATE_Y,p=[s,l,u,f,c,d].join(","),y="matrix(".concat(p,")");return x("div",{className:"lf-grid",children:x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[x("defs",{children:x("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:y,x:"0",y:"0",width:a,height:a,children:[o==="dot"&&this.renderDot(),o==="mesh"&&this.renderMesh()]})}),x("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},t=Bp([Ct],t),t}($);(function(r){r.defaultProps={size:Uf,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function t(e){var n=Y(r.defaultProps);return typeof e=="number"?tt(n,{size:e}):typeof e=="boolean"?tt(n,{visible:e}):tt(n,e)}r.getGridOptions=t})(kn||(kn={}));var Xp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Yp=function(r){Xp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=e.getTransformStyle().transform,o=this.props.children;return x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:x("g",{transform:n,children:o})})},t=kp([Ct],t),t}($),Hp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ye=globalThis&&globalThis.__assign||function(){return ye=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Fp=function(r){Hp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getNodesOutline=function(){var e=this.props.graphModel,n=e.nodes,o=e.editConfigModel,i=o.hoverOutline,a=o.nodeSelectedOutline,s=[];return n.forEach(function(l){if(l.isHovered||l.isSelected){var u=l.isHovered,f=l.isSelected,c=l.x,d=l.y,p=l.width,y=l.height;if(a&&f||i&&u){var h=l.getOutlineStyle(),g={};if(Object.keys(h).forEach(function(_){_!=="hover"&&(g[_]=h[_])}),u){var v=h.hover;g=ye(ye({},g),v)}s.push(x(ae,ye({transform:l.transform,className:"lf-outline-node",x:c,y:d,width:p+10,height:y+10},g)))}}}),s},t.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,n=e.edges,o=e.editConfigModel,i=o.edgeSelectedOutline,a=o.hoverOutline,s=[],l=0;l=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},$p=function(r){zp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.snaplineModel,n=e!=null?e:{},o=n.position,i=n.isShowHorizontal,a=n.isShowVertical,s=e==null?void 0:e.getStyle(),l=o!=null?o:{},u=l.x,f=u===void 0?0:u,c=l.y,d=c===void 0?0:c,p=ge(ge({x1:-1e5,y1:d,x2:1e5,y2:d},s),{stroke:i?s==null?void 0:s.stroke:"none"}),y=ge(ge({x1:f,y1:-1e5,x2:f,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return x("g",{className:"lf-snapline",children:[x(ur,ge({},p)),x(ur,ge({},y))]})},t=Gp([Ct],t),t}($),Vp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Wp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Kp=function(r){Vp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){this.triggerToolRender()},t.prototype.componentDidUpdate=function(){this.triggerToolRender()},t.prototype.getTools=function(){var e=this.props,n=e.tool,o=e.graphModel,i=o.textEditElement,a=n.getTools(),s=a.map(function(l){return tr(l,{textEditElement:i,graphModel:o,lf:n.instance})});return n.components=s,s},t.prototype.triggerToolRender=function(){var e=this.props,n=e.tool,o=e.graphModel,i=document.querySelector("#ToolOverlay_".concat(o.flowId)),a=n.getInstance();a.components.forEach(function(s){return s(a,i)}),a.components=[]},t.prototype.render=function(){var e=this.props.graphModel;return x("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(e.flowId),children:this.getTools()})},t=Wp([Ct],t),t}($),_e=globalThis&&globalThis.__assign||function(){return _e=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Zp=globalThis&&globalThis.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vt=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},jt=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Jp=function(){function r(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return r.prototype.getStyle=function(){return Ne({},this.graphModel.theme.snapline)},r.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,o=t.y,i=!1,a=!1,s=0;s=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Ge=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Qp={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},th=function(){function r(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,o=n===void 0?!1:n;this.updateTranslateLimits(o)}return r.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},r.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},r.prototype.HtmlPointToCanvasPoint=function(t){var e=Ge(t,2),n=e[0],o=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(o-this.TRANSLATE_Y)/this.SCALE_Y]},r.prototype.CanvasPointToHtmlPoint=function(t){var e=Ge(t,2),n=e[0],o=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,o*this.SCALE_Y+this.TRANSLATE_Y]},r.prototype.moveCanvasPointByHtml=function(t,e,n){var o=Ge(t,2),i=o[0],a=o[1];return[i+e/this.SCALE_X,a+n/this.SCALE_Y]},r.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},r.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},r.prototype.zoom=function(t,e){t===void 0&&(t=!1);var n=this.SCALE_X,o=this.SCALE_Y;return typeof t=="number"?(n=t,o=t):t?(n+=this.ZOOM_SIZE,o+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,o-=this.ZOOM_SIZE),nthis.MAX_SCALE_SIZE?"".concat(this.SCALE_X*100,"%"):(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(o-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=o,this.emitGraphTransform("zoom"),"".concat(this.SCALE_X*100,"%"))},r.prototype.emitGraphTransform=function(t){this.eventCenter.emit(C.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},r.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},r.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},r.prototype.focusOn=function(t,e,n,o){var i=Ge(this.CanvasPointToHtmlPoint([t,e]),2),a=i[0],s=i[1],l=Ge([n/2-a,o/2-s],2),u=l[0],f=l[1];this.TRANSLATE_X+=u,this.TRANSLATE_Y+=f,this.emitGraphTransform("focusOn")},r.prototype.updateTranslateLimits=function(t){var e;e=Ge(Array.isArray(t)&&t.length===4?t:Qp[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},Ut([E],r.prototype,"SCALE_X",void 0),Ut([E],r.prototype,"SKEW_Y",void 0),Ut([E],r.prototype,"SKEW_X",void 0),Ut([E],r.prototype,"SCALE_Y",void 0),Ut([E],r.prototype,"TRANSLATE_X",void 0),Ut([E],r.prototype,"TRANSLATE_Y",void 0),Ut([E],r.prototype,"ZOOM_SIZE",void 0),Ut([b],r.prototype,"zoom",null),Ut([b],r.prototype,"resetZoom",null),Ut([b],r.prototype,"translate",null),Ut([b],r.prototype,"focusOn",null),r}(),eh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),rh=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},nh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},oh=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},lh=function(r){ah(t,r);function t(){var e=r.call(this)||this;return e.onDragStart=function(n){var o=n.event,i=e.props,a=i.anchorData,s=i.nodeModel,l=i.graphModel;l.selectNodeById(s.id),s.autoToFront&&l.toFront(s.id),l.eventCenter.emit(C.ANCHOR_DRAGSTART,{data:a,e:o,nodeModel:s}),e.setState({startX:a.x,startY:a.y,endX:a.x,endY:a.y})},e.onDragging=function(n){var o=n.event,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=a.transformModel,f=a.eventCenter,c=a.width,d=a.height,p=a.editConfigModel,y=p.autoExpand,h=p.stopMoveGraph;if(!!o){var g=o.clientX,v=o.clientY,_=a.getPointByClient({x:g,y:v}),O=_.domOverlayPosition,w=O.x,S=O.y,M=_.canvasOverlayPosition,m=M.x,T=M.y;e.t&&Xn(e.t);var P=[],A=10;w<10?P=[A,0]:w+10>c?P=[-A,0]:S<10?P=[0,A]:S+10>d&&(P=[0,-A]),e.setState({endX:m,endY:T,dragging:!0}),e.moveAnchorEnd(m,T),P.length>0&&!h&&y&&(e.t=Nl(function(){var I=sh(P,2),B=I[0],U=I[1];u.translate(B,U);var F=e.state,lt=F.endX,pt=F.endY;e.setState({endX:lt-B,endY:pt-U}),e.moveAnchorEnd(lt-B,pt-U)})),f.emit(C.ANCHOR_DRAG,{data:l,e:o,nodeModel:s})}},e.onDragEnd=function(n){var o=n.event;e.t&&Xn(e.t);var i=e.checkEnd(o);e.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),e.sourceRuleResults.clear(),e.targetRuleResults.clear();var a=e.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData;s.eventCenter.emit(C.ANCHOR_DRAGEND,{data:u,e:o,nodeModel:l,edgeModel:i!=null?i:void 0})},e.checkEnd=function(n){var o,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=l.x,f=l.y,c=l.id,d=e.state,p=d.endX,y=d.endY,h=d.dragging,g=In({x:p,y},a);if(e.preTargetNode&&e.preTargetNode.state!==W.DEFAULT&&e.preTargetNode.setElementState(W.DEFAULT),!!h&&g&&g.node){var v=g.node,_=g.anchor.id,O="".concat(s.id,"_").concat(v.id,"_").concat(_,"_").concat(c),w=e.sourceRuleResults.get(O)||{},S=w.isAllPass,M=w.msg,m=e.targetRuleResults.get(O)||{},T=m.isAllPass,P=m.msg;if(S&&T){v.setElementState(W.DEFAULT);var A=a.getNodeModelById(g.node.id),I=(o=a.edgeGenerator)===null||o===void 0?void 0:o.call(a,s.getData(),A==null?void 0:A.getData()),B=a.addEdge(re(re({},I),{sourceNodeId:s.id,sourceAnchorId:c,startPoint:{x:u,y:f},targetNodeId:g.node.id,targetAnchorId:g.anchor.id,endPoint:{x:g.anchor.x,y:g.anchor.y}})),U=e.props.anchorData;return a.eventCenter.emit(C.ANCHOR_DROP,{data:U,e:n,nodeModel:s,edgeModel:B}),B}var F=v.getData();return a.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:F,msg:P||M||"\u4E0D\u5141\u8BB8\u6DFB\u52A0\u8FDE\u7EBF"}),null}},e.sourceRuleResults=new Map,e.targetRuleResults=new Map,e.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},e.dragHandler=new ue({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.getAnchorShape=function(){var e=this.props,n=e.anchorData,o=e.style,i=e.node,a=i.getAnchorShape(n);if(a)return a;var s=n.x,l=n.y,u=re(re({},o),o==null?void 0:o.hover);return x("g",{children:[x(cr,re({className:"lf-node-anchor-hover"},u,{x:s,y:l})),x(cr,re({className:"lf-node-anchor"},o,{x:s,y:l}))]})},Object.defineProperty(t.prototype,"customTrajectory",{get:function(){var e=this.props.graphModel.customTrajectory;return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relateEdges",{get:function(){var e=this.props,n=e.graphModel,o=n.getAnchorIncomingEdge,i=n.getAnchorOutgoingEdge,a=e.anchorData.id;return{incomingEdgeList:o(a),outgoingEdgeList:i(a)}},enumerable:!1,configurable:!0}),t.prototype.moveAnchorEnd=function(e,n){var o,i,a=this.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData,f=In({x:e,y:n},s);if(f){var c=f.node,d=f.anchor.id;if(this.preTargetNode&&this.preTargetNode!==f.node&&this.preTargetNode.setElementState(W.DEFAULT),u.id===d)return;this.preTargetNode=c;var p="".concat(l.id,"_").concat(c.id,"_").concat(d,"_").concat(u.id);if(!this.targetRuleResults.has(p)){var y=f.anchor,h=l.isAllowConnectedAsSource(c,u,y),g=c.isAllowConnectedAsTarget(l,u,y);this.sourceRuleResults.set(p,Bn(h)),this.targetRuleResults.set(p,Bn(g))}var v=((o=this.sourceRuleResults.get(p))!==null&&o!==void 0?o:{}).isAllPass,_=((i=this.targetRuleResults.get(p))!==null&&i!==void 0?i:{}).isAllPass;v&&_?c.setElementState(W.ALLOW_CONNECT):c.setElementState(W.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==W.DEFAULT&&this.preTargetNode.setElementState(W.DEFAULT)},t.prototype.isShowLine=function(){var e=this.state,n=e.startX,o=e.startY,i=e.endX,a=e.endY,s=Wt(n,o,i,a);return s>10},t.prototype.render=function(){var e=this,n=this.state,o=n.startX,i=n.startY,a=n.endX,s=n.endY,l=this.props,u=l.anchorData.edgeAddable,f=l.edgeStyle;return x("g",{className:"lf-anchor",children:[x("g",{onMouseDown:function(c){u!==!1&&e.dragHandler.handleMouseDown(c)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(re({sourcePoint:{x:o,y:i},targetPoint:{x:a,y:s}},f)):x(ur,re({x1:o,y1:i,x2:a,y2:s},f,{"pointer-events":"none"})))]})},t}($),uh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Qo=globalThis&&globalThis.__assign||function(){return Qo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Xl=function(r){dh(t,r);function t(e){var n=r.call(this)||this;n.mouseDownHandler=function(i){var a=n.props,s=a.draggable,l=a.model,u=a.graphModel,f=u.editConfigModel.nodeTextDraggable;(s!=null?s:f)&&(n.stepperDrag.model=l,n.stepperDrag.handleMouseDown(i))},n.onDragging=function(i){var a=i.deltaX,s=i.deltaY,l=n.props,u=l.model,f=l.graphModel.transformModel;if(a||s){var c=ph(f.fixDeltaXY(a,s),2),d=c[0],p=c[1];u.moveText(d,p)}},n.dbClickHandler=function(){var i=n.props,a=i.editable,s=i.graphModel.eventCenter,l=i.model;a&&l.setElementState(W.TEXT_EDIT),s.emit(C.TEXT_DBCLICK,{data:l.text,model:l})};var o=e.draggable;return n.stepperDrag=new ue({onDragging:n.onDragging,step:1,eventType:"TEXT",isStopPropagation:o}),n}return t.prototype.getShape=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=n.text,s=a.value,l=a.x,u=a.y,f=a.editable,c=a.draggable,d={x:l,y:u,className:"",value:s},p=n.getTextStyle(),y=i.nodeTextDraggable||c;return x(Cl,ti({},d,p,{className:fh({"lf-element-text":f,"lf-text-draggable":!f&&y,"lf-text-disabled":!f&&!y}),model:n}))},t.prototype.render=function(){var e=this.props.model.text;if(e)return x("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},t}($),hh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ft=globalThis&&globalThis.__assign||function(){return Ft=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},vh=function(r){hh(t,r);function t(e){var n=r.call(this,e)||this;return n.setHoverOn=function(){n.setState({isHovered:!0})},n.setHoverOff=function(){n.setState({isHovered:!1})},n.state={isHovered:!1},n}return t.prototype.getBackground=function(){var e=this.state.isHovered,n=this.props.model,o=n.text,i=n.getTextStyle(),a=i.background||{};if(e&&i.hover&&i.hover.background&&(a=Ft(Ft({},a),i.hover.background)),(o==null?void 0:o.value)&&(a==null?void 0:a.fill)!=="transparent"){var s=i.fontSize,l=i.textWidth,u=i.lineHeight,f=i.overflowMode,c=a.wrapPadding,d=o==null?void 0:o.value.split(/[\r\n]/g),p=d.length,y=o.x,h=o.y,g={};if(f==="autoWrap"&&l){var v=Dl({rows:d,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:u,padding:c},rowsLength:p,className:"lf-get-text-height"});g=Ft(Ft({},a),{x:y,y:h,width:l,height:v})}else{var _=cd({rows:d,rowsLength:p,fontSize:s}),O=_.width,w=_.height;if(f==="ellipsis"&&(O=l,w=s+2),typeof a.wrapPadding=="string"){var S=a.wrapPadding.split(",").filter(function(ct){return ct.trim()}).map(function(ct){return parseFloat(ct.trim())});if(S.length>0&&S.length<=4){if(S.length===1){var M=pn(S,1),m=M[0];S=[m,m,m,m]}else if(S.length===2){var T=pn(S,2),P=T[0],A=T[1];S=[P,A,P,A]}else if(S.length===3){var I=pn(S,3),B=I[0],A=I[1],U=I[2];S=[B,A,U,A]}var F=pn(S,4),lt=F[0],pt=F[1],St=F[2],yt=F[3];O+=pt+yt,w+=lt+St,y=y+(pt-yt)/2,h=h+(St-lt)/2}}g=Ft(Ft({},a),{x:y-1,y:h-1,width:O,height:w})}return x(ae,Ft({},g))}return null},t.prototype.getShape=function(){var e=this.props.model,n=e.text,o=n.x,i=n.y,a=n.value;if(!a)return null;var s=e.getTextStyle(),l=Ft({x:o,y:i,value:a,model:e,className:"lf-element-text"},s);return x("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),x(Cl,Ft({},l))]})},t}(Xl),yh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Yn=globalThis&&globalThis.__assign||function(){return Yn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Ae=function(r){yh(t,r);function t(e){var n=r.call(this)||this;n.onDragStart=function(l){var u=l.event,f=n.props,c=f.model,d=f.graphModel;if(u){var p=d.getPointByClient({x:u.clientX,y:u.clientY}).canvasOverlayPosition,y=p.x,h=p.y;n.moveOffset={dx:c.x-y,dy:c.y-h}}},n.onDragging=function(l){var u,f,c,d,p=l.event,y=n.props,h=y.model,g=y.graphModel,v=g.editConfigModel,_=v.stopMoveGraph,O=v.autoExpand,w=g.transformModel,S=g.selectNodes,M=g.width,m=g.height,T=g.gridSize;h.isDragging=!0;var P=p,A=P.clientX,I=P.clientY,B=g.getPointByClient({x:A,y:I}).canvasOverlayPosition,U=B.x,F=B.y,lt=hn(w.CanvasPointToHtmlPoint([U,F]),2),pt=lt[0],St=lt[1];if(U=U+((f=(u=n.moveOffset)===null||u===void 0?void 0:u.dx)!==null&&f!==void 0?f:0),F=F+((d=(c=n.moveOffset)===null||c===void 0?void 0:c.dy)!==null&&d!==void 0?d:0),U=lr(U,T),F=lr(F,T),!M||!m){g.moveNode2Coordinate(h.id,U,F);return}var yt=pt<0||St<0||pt>M||St>m;if(!(O&&!_&&yt)){var ct=hn(w.CanvasPointToHtmlPoint([U-h.width/2,F-h.height/2]),2),Rt=ct[0],k=ct[1],V=hn(w.CanvasPointToHtmlPoint([U+h.width/2,F+h.height/2]),2),Q=V[0],G=V[1],rt=Math.max(T,20),xt=[];Rt<0?xt=[rt,0]:Q>g.width?xt=[-rt,0]:k<0?xt=[0,rt]:G>g.height&&(xt=[0,-rt]),n.t&&Xn(n.t),h.transform=new eo(-U,-F).rotate(h.rotate).translate(U,F).toString();var q=S.map(function(ft){return ft.id});q.indexOf(h.id)===-1&&(q=[h.id]),xt.length>0&&!_&&O?n.t=Nl(function(){var ft=hn(xt,2),Pt=ft[0],wt=ft[1];w.translate(Pt!=null?Pt:0,wt!=null?wt:0);var io=-(Pt!=null?Pt:0)/w.SCALE_X,ao=-(wt!=null?wt:0)/w.SCALE_X;g.moveNodes(q,io,ao)}):g.moveNodes(q,U-h.x,F-h.y)}},n.onDragEnd=function(){n.t&&Xn(n.t);var l=n.props.model;l.isDragging=!1},n.onMouseOut=function(l){Yf()&&n.setHoverOff(l)},n.handleMouseUp=function(){var l=n.props.model;n.mouseUpDrag=l.isDragging},n.handleClick=function(l){var u=n.mouseUpDrag===!1;if(!!n.startTime){var f=n.props,c=f.model,d=f.graphModel;if(!!u){var p=c.getData(),y=d.getPointByClient({x:l.clientX,y:l.clientY}),h={data:p,e:l,position:y,isSelected:!1,isMultiple:!1},g=l.button===2,v=l.detail===2;if(!g){var _=d.editConfigModel,O=Al(l,_);h.isMultiple=O,c.isSelected&&!v&&O?(h.isSelected=!1,c.setSelected(!1)):(d.selectNodeById(c.id,O),h.isSelected=!0,n.toFront()),v?(_.nodeTextEdit&&c.text.editable&&_.textMode===Xt.TEXT&&(c.setSelected(!1),d.setElementStateById(c.id,W.TEXT_EDIT)),d.eventCenter.emit(C.NODE_DBCLICK,h)):(d.eventCenter.emit(C.ELEMENT_CLICK,h),d.eventCenter.emit(C.NODE_CLICK,h))}}}},n.handleContextMenu=function(l){l.preventDefault();var u=n.props,f=u.model,c=u.graphModel,d=f.getData(),p=c.getPointByClient({x:l.clientX,y:l.clientY});c.setElementStateById(f.id,W.SHOW_MENU,p.domOverlayPosition),f.isSelected||c.selectNodeById(f.id),c.eventCenter.emit(C.NODE_CONTEXTMENU,{data:d,e:l,position:p}),n.toFront()},n.handleMouseDown=function(l){var u=n.props,f=u.model,c=u.graphModel;n.startTime=new Date().getTime();var d=c.editConfigModel;d.adjustNodePosition&&f.draggable&&n.stepDrag&&n.stepDrag.handleMouseDown(l)},n.handleFocus=function(){var l=n.props,u=l.model,f=l.graphModel;f.eventCenter.emit(C.NODE_FOCUS,{data:u.getData()})},n.handleBlur=function(){var l=n.props,u=l.model,f=l.graphModel;f.eventCenter.emit(C.NODE_BLUR,{data:u.getData()})},n.setHoverOn=function(l){var u=n.props,f=u.model,c=u.graphModel;if(!f.isHovered){var d=f.getData();f.setHovered(!0),c.eventCenter.emit(C.NODE_MOUSEENTER,{data:d,e:l})}},n.setHoverOff=function(l){var u=n.props,f=u.model,c=u.graphModel,d=f.getData();!f.isHovered||(f.setHovered(!1),c.eventCenter.emit(C.NODE_MOUSELEAVE,{data:d,e:l}))};var o=e.graphModel,i=o.gridSize,a=o.eventCenter,s=e.model;return n.stepDrag=new ue({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),n.modelDisposer=rl(function(){return n.props},function(l){l&&l.model&&n.stepDrag.setModel(l.model)}),n}return t.prototype.componentWillUnmount=function(){this.modelDisposer&&this.modelDisposer()},t.prototype.componentDidMount=function(){},t.prototype.componentDidUpdate=function(){},t.prototype.getAnchorShape=function(e){return null},t.prototype.getAnchors=function(){var e=this,n=this.props,o=n.model,i=n.graphModel,a=o.isSelected,s=o.isHitable,l=o.isDragging,u=o.isShowAnchor;return s&&(a||u)&&!l?de(o.anchors,function(f,c){var d=o.getAnchorLineStyle(f),p=o.getAnchorStyle(f);return x(lh,{anchorData:f,node:e,style:p,edgeStyle:d,anchorIndex:c,nodeModel:o,graphModel:i,setHoverOff:e.setHoverOff})}):[]},t.prototype.getRotateControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowRotate,l=n.isSelected,u=n.isHitable,f=n.rotatable,c=n.isHovered,d=s&&f,p=n.getRotateControlStyle();if(!a&&u&&(l||c)&&d)return x(ch,{graphModel:o,nodeModel:n,eventCenter:o.eventCenter,style:p})},t.prototype.getResizeControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowResize,l=n.isSelected,u=n.isHitable,f=n.resizable,c=n.isHovered,d=s&&f,p=n.getResizeControlStyle();return!a&&u&&(l||c)&&d?x(Xd,{style:p,model:n,graphModel:o}):null},t.prototype.getText=function(){var e,n=this.props,o=n.model,i=n.graphModel,a=i.editConfigModel;if(a.nodeTextMode!==Xt.TEXT||o.state===W.TEXT_EDIT)return null;if(o.text){var s=!1;return a.nodeTextDraggable&&o.text.draggable&&(s=!0),x(Xl,{editable:a.nodeTextEdit&&((e=o.text.editable)!==null&&e!==void 0?e:!0),model:o,graphModel:i,draggable:s})}return null},t.prototype.getStateClassName=function(){var e=this.props.model,n=e.state,o=e.isDragging,i=e.isSelected,a="lf-node";switch(n){case W.ALLOW_CONNECT:a+=" lf-node-allow";break;case W.NOT_ALLOW_CONNECT:a+=" lf-node-not-allow";break;default:a+=" lf-node-default";break}return o&&(a+=" lf-dragging"),i&&(a+=" lf-node-selected"),a},t.prototype.toFront=function(){var e=this.props,n=e.model,o=e.graphModel;n.autoToFront&&o.toFront(n.id)},t.prototype.render=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.hideAnchors,s=i.adjustNodePosition,l=i.allowRotate,u=i.allowResize,f=o.gridSize,c=o.transformModel.SCALE_X,d=n.isHitable,p=n.draggable,y=n.transform,h=n.getOuterGAttributes(),g=h.className,v=g===void 0?"":g,_=gh(h,["className"]),O=x("g",{className:"lf-node-content",children:[x("g",{transform:y,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),u&&this.getResizeControl()]}),!a&&this.getAnchors()]}),w;return d?(s&&p&&this.stepDrag.setStep(f*c),w=x("g",Yn({className:"".concat(this.getStateClassName()," ").concat(v),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,onMouseOut:this.onMouseOut,onContextMenu:this.handleContextMenu,onFocus:this.handleFocus,onBlur:this.handleBlur},_,{children:O}))):w=x("g",Yn({className:"".concat(this.getStateClassName()," ").concat(v)},_,{children:O})),w},t.isObserved=!1,t}($),_h=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ei=globalThis&&globalThis.__assign||function(){return ei=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Sh=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ie;(function(r){r.SOURCE="SOURCE",r.TARGET="TARGET"})(ie||(ie={}));var fs=function(r){Mh(t,r);function t(e){var n=r.call(this)||this;n.handleMouseDown=function(l){n.stepDrag&&n.stepDrag.handleMouseDown(l)},n.onDragStart=function(){var l=n.props,u=l.x,f=l.y,c=l.edgeModel,d=c.startPoint,p=c.endPoint,y=c.pointsList;n.oldEdge={startPoint:d,endPoint:p,pointsList:y},n.setState({endX:u,endY:f,dragging:!0})},n.onDragging=function(l){var u=l.deltaX,f=l.deltaY,c=n.state,d=c.endX,p=c.endY,y=n.props,h=y.graphModel,g=y.type,v=h.transformModel,_=h.editConfigModel,O=Ph(v.moveCanvasPointByHtml([d,p],u,f),2),w=O[0],S=O[1];n.setState({endX:w,endY:S,dragging:!0});var M=n.props.edgeModel,m=In({x:d,y:p},h);if(m&&m.node&&n.isAllowAdjust(m).pass){var T=M.startPoint,P=M.endPoint,A=M.sourceNode,I=M.targetNode,B=g===ie.SOURCE?{startPoint:{x:m.anchor.x,y:m.anchor.y},endPoint:{x:P.x,y:P.y},sourceNode:m.node,targetNode:I}:{startPoint:{x:T.x,y:T.y},endPoint:{x:m.anchor.x,y:m.anchor.y},sourceNode:A,targetNode:m.node};M.updateAfterAdjustStartAndEnd(B)}else g===ie.SOURCE?M.updateStartPoint({x:w,y:S}):M.updateEndPoint({x:w,y:S});M.text.value&&_.adjustEdge&&M.setText(Object.assign({},M.text,M.textPosition))},n.onDragEnd=function(l){var u,f,c,d=l.event;try{n.setState({dragging:!1});var p=n.props,y=p.graphModel,h=p.edgeModel,g=p.type,v=n.state,_=v.endX,O=v.endY,w=v.dragging,S=In({x:_,y:O},y);if(!w)return;var M=!1,m=void 0;if(S&&S.node){var T=n.isAllowAdjust(S),P=T.pass,A=T.msg,I=T.newTargetNode;if(P){var B=h.getData(),U=B.text,F=B.sourceAnchorId,lt=F===void 0?"":F,pt=B.targetAnchorId,St=pt===void 0?"":pt,yt=Ah(B,["text","sourceAnchorId","targetAnchorId"]);if(m=zt(zt({sourceAnchorId:lt,targetAnchorId:St},yt),{text:(U==null?void 0:U.value)||""}),g===ie.SOURCE){var ct=y.getNodeModelById(S.node.id),Rt=y.getNodeModelById(h.targetNodeId),k=(u=y.edgeGenerator)===null||u===void 0?void 0:u.call(y,ct==null?void 0:ct.getData(),Rt==null?void 0:Rt.getData(),m);m=zt(zt({},k),{sourceNodeId:S.node.id,sourceAnchorId:S.anchor.id,startPoint:{x:S.anchor.x,y:S.anchor.y},targetNodeId:h.targetNodeId,endPoint:zt({},h.endPoint)}),h.sourceNodeId===S.node.id&&h.sourceAnchorId===S.anchor.id&&(M=!0)}else if(g===ie.TARGET){var ct=y.getNodeModelById(h.sourceNodeId),Rt=y.getNodeModelById(S.node.id),k=(f=y.edgeGenerator)===null||f===void 0?void 0:f.call(y,ct==null?void 0:ct.getData(),Rt==null?void 0:Rt.getData(),m);m=zt(zt({},k),{sourceNodeId:h.sourceNodeId,startPoint:zt({},h.startPoint),targetNodeId:S.node.id,targetAnchorId:S.anchor.id,endPoint:{x:S.anchor.x,y:S.anchor.y}}),h.targetNodeId===S.node.id&&h.targetAnchorId===S.anchor.id&&(M=!0)}}else{M=!0;var V=I.getData();y.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:V,msg:A})}}else M=!0;if(M)n.recoveryEdge();else{var Q=h.getData();y.deleteEdgeById(h.id);var G=y.addEdge(zt({},m));y.eventCenter.emit(C.EDGE_EXCHANGE_NODE,{data:{newEdge:G.getData(),oldEdge:Q}})}(c=n.preTargetNode)===null||c===void 0||c.setElementState(W.DEFAULT)}finally{var y=n.props.graphModel;y.eventCenter.emit(C.ADJUST_POINT_DRAGEND,{e:d,data:n.stepDragData})}},n.recoveryEdge=function(){var l=n.props.edgeModel,u=n.oldEdge,f=u.startPoint,c=u.endPoint,d=u.pointsList;l.updateStartPoint(f),l.updateEndPoint(c),l.modelType!==z.LINE_EDGE&&(l.pointsList=d!=null?d:[],l.initPoints())},n.getAdjustPointStyle=function(){var l=n.props.graphModel.theme,u=l.edgeAdjust;return u},n.state={dragging:!1,endX:0,endY:0},n.targetRuleResults=new Map,n.sourceRuleResults=new Map;var o=e.type,i=e.edgeModel,a=e.graphModel,s=a.eventCenter;return n.stepDragData={type:o,edgeData:i.getData()},n.stepDrag=new ue({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd,eventType:"ADJUST_POINT",isStopPropagation:!1,eventCenter:s,data:n.stepDragData}),n}return t.prototype.isAllowAdjust=function(e){var n=this.props,o=n.edgeModel,i=o.id,a=o.sourceNode,s=o.targetNode,l=o.sourceAnchorId,u=o.targetAnchorId,f=n.type,c,d,p,y;if(f===ie.SOURCE?(c=e.node,d=s,p=e.anchor,y=s.getAnchorInfo(u)):(c=a,d=e.node,y=e.anchor,p=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==e.node&&this.preTargetNode.setElementState(W.DEFAULT),this.preTargetNode=e.node,y.id===p.id)return{pass:!1,msg:"",newTargetNode:d};var h="".concat(c.id,"_").concat(d.id,"_").concat(p.id,"_").concat(y.id);if(!this.targetRuleResults.has(h)){var g=c.isAllowConnectedAsSource(d,p,y,i),v=d.isAllowConnectedAsTarget(c,p,y,i);this.sourceRuleResults.set(h,Bn(g)),this.targetRuleResults.set(h,Bn(v))}var _=this.sourceRuleResults.get(h),O=_.isAllPass,w=_.msg,S=this.targetRuleResults.get(h),M=S.isAllPass,m=S.msg,T=O&&M?W.ALLOW_CONNECT:W.NOT_ALLOW_CONNECT;return f===ie.SOURCE?c.setElementState(T):d.setElementState(T),{pass:O&&M,msg:m||w,newTargetNode:d}},t.prototype.render=function(){var e=this.props,n=e.x,o=e.y,i=e.getAdjustPointShape,a=e.edgeModel,s=this.state.dragging;return x("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(n,o,a)})},t}($),Dh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),si=globalThis&&globalThis.__assign||function(){return si=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},no=function(r){Nh(t,r);function t(){var e=r.call(this)||this;return e.textRef=vi(),e.handleHover=function(n,o){var i=e.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(n);var l=n?C.EDGE_MOUSEENTER:C.EDGE_MOUSELEAVE,u=a.getData();s.emit(l,{data:u,e:o})},e.setHoverOn=function(n){var o=e.props.model.isHovered;o||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOn(),e.handleHover(!0,n))},e.setHoverOff=function(n){var o=e.props.model.isHovered;!o||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOff(),e.handleHover(!1,n))},e.handleContextMenu=function(n){n.preventDefault(),e.contextMenuTime=new Date().getTime(),e.clickTimer&&clearTimeout(e.clickTimer);var o=e.props,i=o.model,a=o.graphModel,s=a.getPointByClient({x:n.clientX,y:n.clientY});a.setElementStateById(i.id,W.SHOW_MENU,s.domOverlayPosition),e.toFront(),i.isSelected||a.selectEdgeById(i.id);var l=i==null?void 0:i.getData();a.eventCenter.emit(C.EDGE_CONTEXTMENU,{data:l,e:n,position:s})},e.handleMouseDown=function(n){n.stopPropagation(),e.startTime=new Date().getTime()},e.handleMouseUp=function(){var n=e.props.model;e.mouseUpDrag=n.isDragging},e.handleClick=function(n){if(!!e.startTime&&!e.mouseUpDrag){var o=n.button===2;if(!o){var i=n.detail===2,a=e.props,s=a.model,l=a.graphModel,u=s==null?void 0:s.getData(),f=l.getPointByClient({x:n.clientX,y:n.clientY});if(i){var c=l.editConfigModel,d=l.textEditElement,p=s.id,y=s.text,h=s.modelType;if(d&&d.id===p&&l.setElementStateById(p,W.DEFAULT),c.edgeTextEdit&&y.editable&&(s.setSelected(!1),l.setElementStateById(p,W.TEXT_EDIT)),h===z.POLYLINE_EDGE){var g=s,v=l.getPointByClient({x:n.x,y:n.y}).canvasOverlayPosition,_=v.x,O=v.y;g.dbClickPosition=Ml({x:_,y:O},g.points)}l.eventCenter.emit(C.EDGE_DBCLICK,{data:u,e:n,position:f})}else l.eventCenter.emit(C.ELEMENT_CLICK,{data:u,e:n,position:f}),l.eventCenter.emit(C.EDGE_CLICK,{data:u,e:n,position:f});var w=l.editConfigModel;l.selectEdgeById(s.id,Al(n,w)),e.toFront()}}},e.handleFocus=function(){var n=e.props,o=n.model,i=n.graphModel;i.eventCenter.emit(C.EDGE_FOCUS,{data:o.getData()})},e.handleBlur=function(){var n=e.props,o=n.model,i=n.graphModel;i.eventCenter.emit(C.EDGE_BLUR,{data:o.getData()})},e}return t.prototype.getShape=function(){return x("g",{children:this.getEdge()})},t.prototype.getTextStyle=function(){},t.prototype.getText=function(){var e,n=this.props,o=n.model,i=n.graphModel,a=i.editConfigModel;if(a.edgeTextMode!==Xt.TEXT||o.state===W.TEXT_EDIT)return null;if(o.text){var s=!1;return a.edgeTextDraggable&&o.text.draggable&&(s=!0),x(vh,{ref:this.textRef,editable:a.edgeTextEdit&&((e=o.text.editable)!==null&&e!==void 0?e:!0),model:o,graphModel:i,draggable:s})}return null},t.prototype.getArrowInfo=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint,i=e.isSelected,a=this.state.hover;return{start:n,end:o,hover:a,isSelected:i}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint;return[n,o]},t.prototype.getArrowStyle=function(){return console.error("getArrowStyle is deprecated in 1.2.0, please use model.getArrowStyle"),null},t.prototype.getArrow=function(){var e=this.props.model,n=e.id,o=e.getArrowStyle(),i=o.refY,a=i===void 0?0:i,s=o.refX,l=s===void 0?2:s,u=Ch(this.getLastTwoPoints(),2),f=u[0],c=u[1],d="auto";return f!==null&&c!==null&&(d=ep(tp({x:c.x-f.x,y:c.y-f.y,z:0}))),x("g",{children:x("defs",{children:[x("marker",{id:"marker-start-".concat(n),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),x("marker",{id:"marker-end-".concat(n),refX:l,refY:a,overflow:"visible",orient:d,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},t.prototype.getStartArrow=function(){return x("path",{})},t.prototype.getEndArrow=function(){var e=this.props.model,n=e.getArrowStyle(),o=n.stroke,i=n.strokeWidth,a=n.offset,s=n.verticalLength;return x("path",{stroke:o,fill:o,strokeWidth:i,transform:"rotate(180)",d:"M 0 0 L ".concat(a," -").concat(s," L ").concat(a," ").concat(s," Z")})},t.prototype.getAdjustPointShape=function(e,n,o){var i=o.getAdjustPointStyle();return x(cr,Rr({className:"lf-edge-adjust-point"},i,{x:e,y:n}))},t.prototype.getAdjustPoints=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.adjustEdgeStartAndEnd,s=i.adjustEdgeStart,l=i.adjustEdgeEnd,u=n.getAdjustStart(),f=n.getAdjustEnd();return x("g",{children:[a&&s&&x(fs,Rr({type:ie.SOURCE},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:n,graphModel:o})),a&&l&&x(fs,Rr({type:ie.TARGET},f,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:n,graphModel:o}))]})},t.prototype.getAnimation=function(){console.error("getAnimation is deprecated in 1.2.0, please use model.getEdgeAnimationStyle")},t.prototype.getAppendWidth=function(){return x("g",{})},t.prototype.getAppend=function(){return x("g",{className:"lf-edge-append",children:this.getAppendWidth()})},t.prototype.getEdge=function(){return null},t.prototype.toFront=function(){var e=this.props,n=e.graphModel,o=e.model;n.toFront(o.id)},t.prototype.render=function(){var e=this.props.model,n=e.isSelected,o=e.isHitable,i=e.isShowAdjustPoint;return x("g",{children:[x("g",{className:["lf-edge",!o&&"pointer-none",n&&"lf-edge-selected"].filter(Boolean).join(" "),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onContextMenu:this.handleContextMenu,onMouseOver:this.setHoverOn,onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,onFocus:this.handleFocus,onBlur:this.handleBlur,children:[this.getShape(),this.getAppend(),this.getText(),this.getArrow()]}),i&&n?this.getAdjustPoints():""]})},t.isObserved=!1,t}($),Rh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),li=globalThis&&globalThis.__assign||function(){return li=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ds=function(r){Rh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,n=e.getEdgeStyle(),o=e,i=o.path,a=o.isAnimation,s=o.arrowConfig,l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,f=l.stroke,c=l.strokeDashoffset,d=l.animationName,p=l.animationDuration,y=l.animationIterationCount,h=l.animationTimingFunction,g=l.animationDirection;return x(Hr,li({d:i},n,s,a?{strokeDasharray:u,stroke:f,style:{strokeDashoffset:c,animationName:d,animationDuration:p,animationIterationCount:y,animationTimingFunction:h,animationDirection:g}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model.path;return x(Hr,{d:e,strokeWidth:10,stroke:"transparent",fill:"none"})},t.prototype.getArrowInfo=function(){var e=this.props.model,n=this.state.hover,o=e.isSelected,i=e.getArrowStyle().offset,a=e.pointsList.map(function(c){return{x:c.x,y:c.y}}),s=jh(Ia(a,i),2),l=s[0],u=s[1],f={start:l,end:u,hover:n,isSelected:o};return f},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.getArrowStyle().offset,o=e.pointsList.map(function(i){return{x:i.x,y:i.y}});return Ia(o,n)},t}(no),Lh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ui=globalThis&&globalThis.__assign||function(){return ui=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ci=function(r){Ih(t,r);function t(){var e=r.call(this)||this;return e.onDragStart=function(){var n=e.props.model;n.dragAppendStart(),e.isShowAdjustPointTemp=n.isShowAdjustPoint,n.isShowAdjustPoint=!1},e.onDragging=function(n){var o=n.deltaX,i=n.deltaY,a=e.props,s=a.model,l=a.graphModel;e.isDragging=!0;var u=l.transformModel,f=l.editConfigModel,c=Bh(u.fixDeltaXY(o,i),2),d=c[0],p=c[1],y=s,h=f.adjustEdgeMiddle;h?e.appendInfo=y.dragAppendSimple(e.appendInfo,{x:d,y:p}):e.appendInfo=y.dragAppend(e.appendInfo,{x:d,y:p})},e.onDragEnd=function(){var n,o=e.props,i=o.model,a=o.graphModel.eventCenter,s=i;s.dragAppendEnd(),e.isDragging=!1,s.isShowAdjustPoint=(n=e.isShowAdjustPointTemp)!==null&&n!==void 0?n:!1,e.appendInfo=void 0,a.emit(C.EDGE_ADJUST,{data:s.getData()})},e.beforeDragStart=function(n,o){o.draggable&&e.drag.handleMouseDown(n),e.appendInfo=o},e.drag=new ue({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd,isStopPropagation:!1}),e}return t.prototype.getEdge=function(){var e=this.props.model,n=e.points,o=e.isAnimation,i=e.arrowConfig,a=e.getEdgeStyle(),s=e.getEdgeAnimationStyle(),l=s.strokeDasharray,u=s.stroke,f=s.strokeDashoffset,c=s.animationName,d=s.animationDuration,p=s.animationIterationCount,y=s.animationTimingFunction,h=s.animationDirection;return x(jd,Ce({points:n},a,i,o?{strokeDasharray:l,stroke:u,style:{strokeDashoffset:f,animationName:c,animationDuration:d,animationIterationCount:p,animationTimingFunction:y,animationDirection:h}}:{}))},t.prototype.getArrowInfo=function(){var e=this.props.model,n=e.points,o=e.isSelected,i=this.state.hover,a=ke(n),s=a[0],l=a[0];return a.length>=2&&(s=a[a.length-2],l=a[a.length-1]),{start:s,end:l,hover:i,isSelected:o}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.points,o=ke(n),i=o[0],a=o[0];return o.length>=2&&(i=o[o.length-2],a=o[o.length-1]),[i,a]},t.prototype.getAppendAttributes=function(e){var n=e.start,o=e.end,i;if(n.x===o.x&&n.y===o.y)i="";else{var a={start:n,end:o,offset:10,verticalLength:5},s=Xr(Ce(Ce({},a),{type:"start"})),l=Xr(Ce(Ce({},a),{type:"end"}));i="M".concat(s.leftX," ").concat(s.leftY,` L`).concat(s.rightX," ").concat(s.rightY,` L`).concat(l.rightX," ").concat(l.rightY,` L`).concat(l.leftX," ").concat(l.leftY," z")}return{d:i,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},t.prototype.getAppendShape=function(e){var n=this.getAppendAttributes(e),o=n.d,i=n.strokeWidth,a=n.fill,s=n.strokeDasharray,l=n.stroke;return x(Hr,{d:o,fill:a,strokeWidth:i,stroke:l,strokeDasharray:s})},t.prototype.getAppendWidth=function(){for(var e=this,n=this.props,o=n.model,i=n.graphModel,a=o.pointsList,s=o.draggable,l=[],u=a.length,f=function(p){var y="lf-polyline-append",h={start:{x:a[p].x,y:a[p].y},end:{x:a[p+1].x,y:a[p+1].y},startIndex:p,endIndex:p+1,direction:ot.HORIZONTAL,draggable:!0},g=x("g",{className:y,children:c.getAppendShape(h)}),v=i.editConfigModel,_=v.adjustEdge,O=v.adjustEdgeMiddle;if(_&&s){var w=h.startIndex,S=h.endIndex,M=O&&(w===0||S===u-1);h.draggable=!M,h.start.x===h.end.x?(h.draggable&&(y+="-ew-resize"),h.direction=ot.VERTICAL):h.start.y===h.end.y&&(h.draggable&&(y+="-ns-resize"),h.direction=ot.HORIZONTAL),g=x("g",{className:c.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(m){return e.beforeDragStart(m,h)},children:x("g",{className:y,children:c.getAppendShape(h)})})}l.push(g)},c=this,d=0;d=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Uh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Fh=function(r){Yh(t,r);function t(e){var n=r.call(this,e)||this;return n.ref=vi(),n.__prevText={type:"",text:"",id:""},n.keyupHandler=function(o){var i=n.props.graphModel.textEditElement;o.key==="Enter"&&o.altKey&&(i==null||i.setElementState(W.DEFAULT))},n.inputHandler=function(o){var i=o.target.innerText,a=n.props.graphModel.textEditElement;a&&(n.__prevText={type:a.type,text:i.replace(/(\r\n)+$|(\n)+$/,""),id:a.id})},n.keydownHandler=function(o){o.stopPropagation()},n.state={style:{left:0,top:0}},n}return t.getDerivedStateFromProps=function(e){var n,o=e.textEditElement,i=e.graphModel,a=i.transformModel,s=i.theme,l=s.inputText,u;if(o){if(!(!((n=o.text)===null||n===void 0)&&n.value)&&o.BaseType===st.EDGE){var f=o.text,c=o.textPosition,d=c.x,p=c.y;f.x=d,f.y=p,o.setText(f)}var y={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(o.BaseType===st.EDGE){var h=s.edgeText,g=h.overflowMode,v=h.lineHeight,_=h.wrapPadding,O=h.textWidth;O&&g==="autoWrap"&&(u=ce(ce({},y),{width:O,minWidth:O,lineHeight:v,padding:_}))}else if(o.BaseType===st.NODE){var w=s.nodeText,g=w.overflowMode,v=w.lineHeight,_=w.wrapPadding,O=w.textWidth,S=o.width,M=o.modelType,m=o.textWidth,T=m||O||S;(M!==z.TEXT_NODE&&g==="autoWrap"||M===z.TEXT_NODE&&O)&&(u=ce(ce({},y),{width:T,minWidth:T,lineHeight:v,padding:_}))}var P=o.text,A=P.x,I=P.y,B=Uh(a.CanvasPointToHtmlPoint([A,I]),2),U=B[0],F=B[1];return{style:ce(ce({left:U,top:F},u),l)}}return null},t.prototype.componentDidUpdate=function(){var e=this.props.graphModel;if(this.ref.current&&(this.ref.current.focus(),this.placeCaretAtEnd(this.ref.current)),this.__prevText.id!==""){var n=this.__prevText,o=n.text,i=n.id;e.updateText(i,o),e.eventCenter.emit(C.TEXT_UPDATE,{data:ce({},this.__prevText)}),this.__prevText.id="",this.__prevText.text="",this.__prevText.type=""}},t.prototype.placeCaretAtEnd=function(e){if(window.getSelection!==void 0&&document.createRange!==void 0){var n=document.createRange();n.selectNodeContents(e),n.collapse(!1);var o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}},t.prototype.render=function(){var e,n=this.props.graphModel.textEditElement,o=this.state.style;return n?x("div",{contentEditable:!0,className:"lf-text-input",style:o,ref:this.ref,onKeyUp:this.keyupHandler,onKeyDown:this.keydownHandler,onKeyPress:this.keydownHandler,onInput:this.inputHandler,children:(e=n.text)===null||e===void 0?void 0:e.value},n.id):null},t.toolName="text-edit-tool",t=Hh([Ct],t),t}($),zh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Gh=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},go=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},$h=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Wh=[Fh,Vh],Kh=function(){function r(t){var e=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=t,ut(Wh,function(i){e.isDisabled(i.toolName)||e.registerTool(i.toolName,i)});var n=t.graphModel,o=n.eventCenter;o.on("".concat(C.GRAPH_TRANSFORM,",").concat(C.NODE_CLICK,",").concat(C.BLANK_CLICK," "),function(){var i,a=n.textEditElement,s=n.editConfigModel,l=s.edgeTextEdit,u=s.nodeTextEdit;(l||u)&&a&&((i=n.textEditElement)===null||i===void 0||i.setElementState(W.DEFAULT))})}return r.prototype.isDisabled=function(t){var e;return((e=this.instance.options.disabledTools)===null||e===void 0?void 0:e.indexOf(t))!==-1},r.prototype.registerTool=function(t,e){this.toolMap.set(t,e)},r.prototype.disableTool=function(t){var e=this.toolMap.get(t);if(e)return this.disabledToolMap.set(t,e),this.toolMap.delete(t),!0;throw new Error("\u7981\u7528\u5931\u8D25\uFF0C\u4E0D\u5B58\u5728\u540D\u4E3A ${tool} \u7684\u5DE5\u5177")},r.prototype.enableTool=function(t){var e=this.disabledToolMap.get(t);if(e)return this.toolMap.set(t,e),this.disabledToolMap.delete(t),!0;throw new Error("\u4E0D\u5B58\u5728\u540D\u4E3A ${tool} \u7684\u5DE5\u5177")},r.prototype.getTools=function(){return Array.from(this.toolMap.values())},r.prototype.getInstance=function(){return this.instance},_o([E],r.prototype,"toolMap",void 0),_o([b],r.prototype,"disableTool",null),_o([b],r.prototype,"enableTool",null),r}();function Zh(r){throw new Error("[mobx-utils] "+r)}function Un(r,t){t===void 0&&(t="Illegal state"),r||Zh(t)}var kl=function(r){return r&&r!==Object.prototype&&Object.getOwnPropertyNames(r).concat(kl(Object.getPrototypeOf(r))||[])},qh=function(r){var t=kl(r),e=t.filter(function(n,o){return t.indexOf(n)===o});return e},Jh=function(r){return qh(r).filter(function(t){return t!=="constructor"&&!~t.indexOf("__")})},Yl="pending",Fn="fulfilled",Li="rejected";function Qh(r){switch(this.state){case Yl:return r.pending&&r.pending(this.value);case Li:return r.rejected&&r.rejected(this.value);case Fn:return r.fulfilled?r.fulfilled(this.value):this.value}}function hs(r,t){if(Un(arguments.length<=2,"fromPromise expects up to two arguments"),Un(typeof r=="function"||typeof r=="object"&&r&&typeof r.then=="function","Please pass a promise or function to fromPromise"),r.isPromiseBasedObservable===!0)return r;typeof r=="function"&&(r=new Promise(r));var e=r;r.then(b("observableFromPromise-resolve",function(o){e.value=o,e.state=Fn}),b("observableFromPromise-reject",function(o){e.value=o,e.state=Li})),e.isPromiseBasedObservable=!0,e.case=Qh;var n=t&&t.state===Fn?t.value:void 0;return jo(e,{value:n,state:Yl},{},{deep:!1}),e}(function(r){r.reject=b("fromPromise.reject",function(e){var n=r(Promise.reject(e));return n.state=Li,n.value=e,n});function t(e){e===void 0&&(e=void 0);var n=r(Promise.resolve(e));return n.state=Fn,n.value=e,n}r.resolve=b("fromPromise.resolve",t)})(hs||(hs={}));var vn=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i};(function(){function r(t,e){var n=this;Xc(function(){n.current=e,n.subscription=t.subscribe(n)})}return r.prototype.dispose=function(){this.subscription&&this.subscription.unsubscribe()},r.prototype.next=function(t){this.current=t},r.prototype.complete=function(){this.dispose()},r.prototype.error=function(t){this.current=t,this.dispose()},vn([E.ref],r.prototype,"current",void 0),vn([b.bound],r.prototype,"next",null),vn([b.bound],r.prototype,"complete",null),vn([b.bound],r.prototype,"error",null),r})();var zn=function(){return zn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},tv=["model","reset","submit","isDirty","isPropertyDirty","resetProperty"];(function(){function r(t){var e=this;this.model=t,this.localValues=E.map({}),this.localComputedValues=E.map({}),this.isPropertyDirty=function(n){return e.localValues.has(n)},Un(Yt(t),"createViewModel expects an observable object"),Jh(t).forEach(function(n){if(!(n===L||n==="__mobxDidRunLazyInitializers")){if(Un(tv.indexOf(n)===-1,"The propertyname "+n+" is reserved and cannot be used with viewModels"),Wi(t,n)){var o=Wr(t,n).derivation;e.localComputedValues.set(n,et(o.bind(e)))}var i=Object.getOwnPropertyDescriptor(t,n),a=i?{enumerable:i.enumerable}:{};Object.defineProperty(e,n,zn(zn({},a),{configurable:!0,get:function(){return Wi(t,n)?e.localComputedValues.get(n).get():e.isPropertyDirty(n)?e.localValues.get(n):e.model[n]},set:b(function(s){s!==e.model[n]?e.localValues.set(n,s):e.localValues.delete(n)})}))}})}return Object.defineProperty(r.prototype,"isDirty",{get:function(){return this.localValues.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"changedValues",{get:function(){return this.localValues.toJS()},enumerable:!1,configurable:!0}),r.prototype.submit=function(){var t=this;sr(this.localValues).forEach(function(e){var n=t.localValues.get(e),o=t.model[e];te(o)?o.replace(n):Tt(o)?(o.clear(),o.merge(n)):ul(n)||(t.model[e]=n)}),this.localValues.clear()},r.prototype.reset=function(){this.localValues.clear()},r.prototype.resetProperty=function(t){this.localValues.delete(t)},gr([et],r.prototype,"isDirty",null),gr([et],r.prototype,"changedValues",null),gr([b.bound],r.prototype,"submit",null),gr([b.bound],r.prototype,"reset",null),gr([b.bound],r.prototype,"resetProperty",null),r})();function mo(r){if(!r)return"ROOT";for(var t=[];r.parent;)t.push(r.path),r=r.parent;return t.reverse().join("/")}function bo(r){return Yt(r)||te(r)||Tt(r)}function ev(r,t){var e=new WeakMap;function n(s){var l=e.get(s.object);o(s,l),t(s,mo(l),r)}function o(s,l){switch(s.type){case"add":i(s.newValue,l,s.name);break;case"update":a(s.oldValue),i(s.newValue,l,s.name||""+s.index);break;case"remove":case"delete":a(s.oldValue);break;case"splice":s.removed.map(a),s.added.forEach(function(c,d){return i(c,l,""+(s.index+d))});for(var u=s.index+s.addedCount;uthis.maxSize&&this.undos.shift())},r.prototype.undoAble=function(){return this.undos.length>1},r.prototype.undo=function(){if(!!this.undoAble()){var t=this.undos.pop();this.redos.push(t);var e=this.undos.pop();return this.curData=Y(e),e}},r.prototype.redoAble=function(){return this.redos.length>0},r.prototype.redo=function(){if(!!this.redoAble()){var t=this.redos.pop();return this.curData=Y(t),t}},r.prototype.watch=function(t){var e=this;this.stopWatch&&this.stopWatch(),this.undos.push(t.modelToGraphData()),this.stopWatch=ev(t,Ms(function(){var n=t.modelToHistoryData();n&&e.add(fi({},n))},this.waitTime))},r}(),Hl={exports:{}};(function(r){(function(t,e,n){if(!t)return;for(var o={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},i={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,u=1;u<20;++u)o[111+u]="f"+u;for(u=0;u<=9;++u)o[u+96]=u.toString();function f(m,T,P){if(m.addEventListener){m.addEventListener(T,P,!1);return}m.attachEvent("on"+T,P)}function c(m){if(m.type=="keypress"){var T=String.fromCharCode(m.which);return m.shiftKey||(T=T.toLowerCase()),T}return o[m.which]?o[m.which]:i[m.which]?i[m.which]:String.fromCharCode(m.which).toLowerCase()}function d(m,T){return m.sort().join(",")===T.sort().join(",")}function p(m){var T=[];return m.shiftKey&&T.push("shift"),m.altKey&&T.push("alt"),m.ctrlKey&&T.push("ctrl"),m.metaKey&&T.push("meta"),T}function y(m){if(m.preventDefault){m.preventDefault();return}m.returnValue=!1}function h(m){if(m.stopPropagation){m.stopPropagation();return}m.cancelBubble=!0}function g(m){return m=="shift"||m=="ctrl"||m=="alt"||m=="meta"}function v(){if(!l){l={};for(var m in o)m>95&&m<112||o.hasOwnProperty(m)&&(l[o[m]]=m)}return l}function _(m,T,P){return P||(P=v()[m]?"keydown":"keypress"),P=="keypress"&&T.length&&(P="keydown"),P}function O(m){return m==="+"?["+"]:(m=m.replace(/\+{2}/g,"+plus"),m.split("+"))}function w(m,T){var P,A,I,B=[];for(P=O(m),I=0;I1){ct(k,xt,V,Q);return}q=w(k,Q),T._callbacks[q.key]=T._callbacks[q.key]||[],lt(q.key,q.modifiers,{type:q.action},G,k,rt),T._callbacks[q.key][G?"unshift":"push"]({callback:V,modifiers:q.modifiers,action:q.action,seq:G,level:rt,combo:k})}T._bindMultiple=function(k,V,Q){for(var G=0;G-1||S(T,P.target))return!1;if("composedPath"in m&&typeof m.composedPath=="function"){var A=m.composedPath()[0];A!==m.target&&(T=A)}return T.tagName=="INPUT"||T.tagName=="SELECT"||T.tagName=="TEXTAREA"||T.isContentEditable},M.prototype.handleKey=function(){var m=this;return m._handleKey.apply(m,arguments)},M.addKeycodes=function(m){for(var T in m)m.hasOwnProperty(T)&&(o[T]=m[T]);l=null},M.init=function(){var m=M(e);for(var T in m)T.charAt(0)!=="_"&&(M[T]=function(P){return function(){return m[P].apply(m,arguments)}}(T))},M.init(),t.Mousetrap=M,r.exports&&(r.exports=M),typeof n=="function"&&n.amd&&n(function(){return M})})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)})(Hl);var ov=Hl.exports,vs=globalThis&&globalThis.__assign||function(){return vs=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0&&r.pointsList.forEach(function(e){e.x+=t,e.y+=t}),As(r.text)||(r.text.x+=t,r.text.y+=t),r}var $e=40,yn=40;function iv(r,t){var e=r.keyboard,n=e.options.keyboard;e.on(["cmd + c","ctrl + c"],function(){if(yn=$e,!(n!=null&&n.enabled)||t.textEditElement)return!0;var o=r.options.guards,i=t.getSelectElements(!1),a=o&&o.beforeClone?o.beforeClone(i):!0;return!a||i.nodes.length===0&&i.edges.length===0?(ee=null,!0):(ee=i,ee.nodes.forEach(function(s){return ys(s,$e)}),ee.edges.forEach(function(s){return gs(s,$e)}),!1)}),e.on(["cmd + v","ctrl + v"],function(){if(!(n!=null&&n.enabled)||t.textEditElement)return!0;if(ee&&(ee.nodes||ee.edges)){r.clearSelectElements();var o=r.addElements(ee,yn);if(!o)return!0;o.nodes.forEach(function(i){return r.selectElementById(i.id,!0)}),o.edges.forEach(function(i){return r.selectElementById(i.id,!0)}),ee.nodes.forEach(function(i){return ys(i,$e)}),ee.edges.forEach(function(i){return gs(i,$e)}),yn=yn+$e}return!1}),e.on(["cmd + z","ctrl + z"],function(){return!(n!=null&&n.enabled)||t.textEditElement?!0:(r.undo(),!1)}),e.on(["cmd + y","ctrl + y"],function(){return!(n!=null&&n.enabled)||t.textEditElement?!0:(r.redo(),!1)}),e.on(["backspace"],function(){if(!(n!=null&&n.enabled)||t.textEditElement)return!0;var o=t.getSelectElements(!0);return r.clearSelectElements(),o.edges.forEach(function(i){return i.id&&r.deleteEdge(i.id)}),o.nodes.forEach(function(i){return i.id&&r.deleteNode(i.id)}),!1})}var av=function(){function r(t){t.keyboard||(t.keyboard={enabled:!1}),this.options=t;var e=t.lf;this.target=e.container,this.mousetrap=new ov(this.target),t.keyboard.enabled&&!e.options.isSilentMode&&this.enable(!0)}return r.prototype.initShortcuts=function(){var t=this,e,n=((e=this.options.keyboard)!==null&&e!==void 0?e:{}).shortcuts;if(n)if(Gn(n))n.forEach(function(s){var l=s.keys,u=s.callback,f=s.action;return t.on(l,u,f)});else{var o=n.keys,i=n.callback,a=n.action;this.on(o,i,a)}},r.prototype.on=function(t,e,n){this.mousetrap.bind(this.getKeys(t),e,n)},Object.defineProperty(r.prototype,"disabled",{get:function(){var t,e;return((e=(t=this.options)===null||t===void 0?void 0:t.keyboard)===null||e===void 0?void 0:e.enabled)!==!0},enumerable:!1,configurable:!0}),r.prototype.off=function(t,e){this.mousetrap.unbind(this.getKeys(t),e)},r.prototype.enable=function(t){(this.disabled||t)&&(this.options.keyboard&&(this.options.keyboard.enabled=!0),this.target instanceof HTMLElement&&(this.target.setAttribute("tabindex","-1"),this.target.style.outline="none"))},r.prototype.disable=function(){this.disabled||(this.options.keyboard&&(this.options.keyboard.enabled=!1),this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))},r.prototype.getKeys=function(t){var e=this;return(Array.isArray(t)?t:[t]).map(function(n){return e.formatKey(n)})},r.prototype.formatKey=function(t){return t.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command")},r}(),me=globalThis&&globalThis.__assign||function(){return me=Object.assign||function(r){for(var t,e=1,n=arguments.length;e0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xo=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n(r.PRODUCT_ADJUST="\u5546\u54C1ID :",r.PRODUCT="\u5546\u54C1ID:",r.IN="\u5165\u5E93ID:",r.OUT="\u51FA\u5E93ID:",r.PROVISION="\u8BA1\u63D0\u5F85\u5904\u7406ID:",r.ADJUST="\u8C03\u6574\u5355ID:",r.CHECK="\u76D8\u70B9ID:",r))(nt||{});const dv={["\u5546\u54C1ID:"]:"/invoiceInOut/productManagerDetail",["\u8BA1\u63D0\u5F85\u5904\u7406ID:"]:"/invoiceInOut/provisionOutDetail",["\u8C03\u6574\u5355ID:"]:"/invoiceInOut/adjustOrderDetail",["\u5546\u54C1ID :"]:"/invoiceInOut/productManagerDetail"};function Lt(r,t,e,n){return{id:t+r,type:"StartTask",x:lv+e*uv,y:cv+n*fv,text:t+r}}function he(r,t,e="dashe-edge"){return{sourceNodeId:r,targetNodeId:t,isHitable:!1,type:e}}const{VITE_PROXY_DOMAIN_REAL:Mv,VITE_PROXY_USER_REAL:Av,VITE_WORKORDER_REAL:pv}=cu(),oo=pv,hv=r=>$n.request("post",`${oo}/cxinv/FinancialManager/info`,{data:r}),ms=r=>$n.request("post",`${oo}/cxinv/adjust/info`,{data:r}),vv=r=>$n.request("post",`${oo}/cxinv/FinancialProducts/CheckInfo`,{data:r}),yv=r=>$n.request("post",`${oo}/cxinv//FinancialManager/CheckInfo`,{data:r});class gv extends qo{initNodeData(t){super.initNodeData(t),this.height=30}getNodeStyle(){const t=super.getNodeStyle();return t.fill=_s.start.background,t.stroke=_s.start.border,t.strokeWidth=.5,t.cursor="pointer",t}}class _v extends ri{}var mv={type:"StartTask",model:gv,view:_v};class bv extends Zo{initEdgeData(t){super.initEdgeData(t),this.customTextPosition=!0,this.zIndex=-1}getEdgeStyle(){const t=super.getEdgeStyle();return t.stroke="#000",t.strokeDasharray="5 5",t.strokeWidth=1,t}}class xv extends ci{}var Ev={type:"dashe-edge",model:bv,view:xv};const Ov={class:"mine-flow-container"},Tv=fu({__name:"index",props:{id:{type:String,required:!1},mode:{type:String,required:!0}},setup(r){const t=Ii(null),e=Ii(null),n=r,o=du();function i(){e.value=new sv({container:t.value,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!0,isSilentMode:!0,grid:{size:18,type:"mesh",visible:!0,config:{thickness:1,color:"#ccc"}},textEdit:!1})}pu(()=>{i(),e.value.register(mv),e.value.register(Ev),e.value.on("node:click",({data:c})=>{const[d,p]=((c==null?void 0:c.id)||"").split(":"),y=dv[d+":"];o.push(y+"?id="+p)})});async function a(c,d,p,y){var w,S,M,m,T,P,A,I,B,U,F,lt,pt,St;const h=[Lt(c,d,p,y)],g=[],v=await hv({id:c});(((w=v.data)==null?void 0:w.ProductRela)||[]).forEach((yt,ct)=>{h.push(Lt(yt.product_id,nt.PRODUCT,1,ct)),g.push(he(d+c,nt.PRODUCT+yt.product_id,ct==0?"line":"bezier"))});const _=(S=v.data)==null?void 0:S.ProductRela.findIndex(yt=>yt.is_check===1);_>=0&&(h.push(Lt((m=(M=v.data)==null?void 0:M.FinancialTz)==null?void 0:m.id,nt.PROVISION,2,0)),g.push(he(nt.PRODUCT+((P=(T=v.data)==null?void 0:T.ProductRela[_])==null?void 0:P.product_id),nt.PROVISION+((I=(A=v.data)==null?void 0:A.FinancialTz)==null?void 0:I.id),_==0?"line":"bezier")));const O=await ms({id:(U=(B=v.data)==null?void 0:B.FinancialTz)==null?void 0:U.id});if(((F=O.data)==null?void 0:F.FinancialCheck)&&O.data.FinancialCheck.id){h.push(Lt(O.data.FinancialCheck.id,nt.ADJUST,3,0)),g.push(he(nt.PROVISION+((pt=(lt=v.data)==null?void 0:lt.FinancialTz)==null?void 0:pt.id),nt.ADJUST+O.data.FinancialCheck.id,"dashe-edge"));const yt=(((St=O.data)==null?void 0:St.ProductTz)||[]).find(ct=>ct.type==2);yt&&(h.push(Lt(yt.product_id,nt.PRODUCT_ADJUST,4,0)),g.push(he(nt.ADJUST+O.data.FinancialCheck.id,nt.PRODUCT_ADJUST+yt.product_id,"line")))}return{nodes:h,edges:g}}async function s(c,d,p,y){var _;const h=[Lt(c,d,p,y)],g=[],v=await ms({id:c});if(v.data.FinancialCheck&&v.data.FinancialCheck.id){h.push(Lt(v.data.FinancialCheck.id,nt.ADJUST,1,0)),g.push(he(nt.PROVISION+c,nt.ADJUST+v.data.FinancialCheck.id,"dashe-edge"));const O=(((_=v.data)==null?void 0:_.ProductTz)||[]).find(w=>w.type==2);O&&(h.push(Lt(O.product_id,nt.PRODUCT_ADJUST,2,0)),g.push(he(nt.ADJUST+v.data.FinancialCheck.id,nt.PRODUCT_ADJUST+O.product_id,"line")))}return{nodes:h,edges:g}}async function l(c,d,p,y){var _,O,w,S,M,m;const h=await vv({id:c}),g=[Lt((_=h.data)==null?void 0:_.id,d,0,0),Lt((w=(O=h.data)==null?void 0:O.product)==null?void 0:w.id,nt.PRODUCT,1,0)],v=[he(d+((S=h.data)==null?void 0:S.id),nt.PRODUCT+((m=(M=h.data)==null?void 0:M.product)==null?void 0:m.id),"line")];return{nodes:g,edges:v}}async function u(c,d,p,y){var O,w,S;const h=await yv({id:c}),g=[Lt((O=h.data)==null?void 0:O.id,d,0,0)],v=[],_=(((S=(w=h.data)==null?void 0:w.FinancialTz)==null?void 0:S.ProductTz)||[]).find(M=>M.type==2);return _&&(g.push(Lt(_.product_id,nt.PRODUCT_ADJUST,1,0)),v.push(he(nt.ADJUST+c,nt.PRODUCT_ADJUST+_.product_id,"line"))),{nodes:g,edges:v}}async function f(c,d,p=0,y=0){switch(d){case nt.IN:case nt.OUT:return a(c,d,p,y);case nt.PROVISION:return s(c,d,p,y);case nt.CHECK:return l(c,d);case nt.ADJUST:return u(c,d)}}return hu(()=>[n,e.value],async()=>{if(!n.mode||!n.id||!e.value)return;let c=null;c=await f(n.id,n.mode),c&&vu(()=>e.value.render(c))},{immediate:!0,deep:!0}),(c,d)=>(yu(),gu("div",Ov,[_u("div",{class:"lf",ref_key:"container",ref:t},null,512)]))}});var Pv=mu(Tv,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/components/MineFlowChart/index.vue"]]);export{Pv as F,nt as M};