import{r as tu,ak as eu,d as Ns,l as Xn,E as nu,F as ou,R as Cs}from"./vue-vendor-C7Zq48Yl.js";import{bY as Z,h as X,v as Io,aC as lr,bZ as mr,p as Ve,b_ as it,b$ as be,c0 as je,c1 as re,c2 as qe,c3 as vt,s as ru,c4 as iu,c5 as Gi,c6 as kr,c7 as au,al as js,aB as su,c8 as lu,c9 as Ls,ak as Ui,ca as uu,cb as Ir,aP as cu,cc as pu,q as du}from"./antd-vue-vendor-BPnV8VqP.js";import{n as ks}from"./_commonjsHelpers-B52_cu2H-BG14nIm9.js";import{n as fu}from"./index-Crt100Db-kwMQ9qxI.js";import{P as hu}from"./propStore-Cl0CojEU-DVRhovlH.js";import{J as No}from"./NodeContainer.vue_vue_type_style_index_0_lang-hKTylTLH-Banxh0Pc.js";var yu={},ur,H,Is,we,Vi,Rs,Xs,Bs,Oi,Rr,Xr,Bn={},Hs=[],gu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qn=Array.isArray;function ue(n,t){for(var e in t)n[e]=t[e];return n}function wi(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function $e(n,t,e){var o,r,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?ur.call(arguments,2):e),typeof n=="function"&&n.defaultProps!=null)for(i in n.defaultProps)a[i]===void 0&&(a[i]=n.defaultProps[i]);return Co(n,a,o,r,null)}function Co(n,t,e,o,r){var i={type:n,props:t,key:e,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++Is:r,__i:-1,__u:0};return r==null&&H.vnode!=null&&H.vnode(i),i}function Si(){return{current:null}}function Je(n){return n.children}function G(n,t){this.props=n,this.context=t}function Qe(n,t){if(t==null)return n.__?Qe(n.__,n.__i+1):null;for(var e;ts&&we.sort(Xs),n=we.shift(),s=we.length,n.__d&&(e=void 0,o=void 0,r=(o=(t=n).__v).__e,i=[],a=[],t.__P&&((e=ue({},o)).__v=o.__v+1,H.vnode&&H.vnode(e),Mi(t.__P,e,o,t.__n,t.__P.namespaceURI,32&o.__u?[r]:null,i,r==null?Qe(o):r,!!(32&o.__u),a),e.__v=o.__v,e.__.__k[e.__i]=e,Us(i,e,a),o.__e=o.__=null,e.__e!=r&&zs(e)));Ro.__r=0}function Ys(n,t,e,o,r,i,a,s,l,u,p){var c,d,f,h,y,v,g,m=o&&o.__k||Hs,M=t.length;for(l=vu(e,t,m,l,M),c=0;c0?a=n.__k[i]=Co(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):n.__k[i]=a,l=i+d,a.__=n,a.__b=n.__b+1,s=null,(u=a.__i=mu(a,e,l,c))!=-1&&(c--,(s=e[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>p?d--:rl?d--:d++,a.__u|=4))):n.__k[i]=null;if(c)for(i=0;i(p?1:0)){for(r=e-1,i=e+1;r>=0||i=0?r--:i++])!=null&&(2&u.__u)==0&&s==u.key&&l==u.type)return a}return-1}function Wi(n,t,e){t[0]=="-"?n.setProperty(t,e==null?"":e):n[t]=e==null?"":typeof e!="number"||gu.test(t)?e:e+"px"}function so(n,t,e,o,r){var i,a;t:if(t=="style")if(typeof e=="string")n.style.cssText=e;else{if(typeof o=="string"&&(n.style.cssText=o=""),o)for(t in o)e&&t in e||Wi(n.style,t,"");if(e)for(t in e)o&&e[t]==o[t]||Wi(n.style,t,e[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Bs,"$1")),a=t.toLowerCase(),t=a in n||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),n.l||(n.l={}),n.l[t+i]=e,e?o?e.u=o.u:(e.u=Oi,n.addEventListener(t,i?Xr:Rr,i)):n.removeEventListener(t,i?Xr:Rr,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in n)try{n[t]=e==null?"":e;break t}catch(s){}typeof e=="function"||(e==null||e===!1&&t[4]!="-"?n.removeAttribute(t):n.setAttribute(t,t=="popover"&&e==1?"":e))}}function Ki(n){return function(t){if(this.l){var e=this.l[t.type+n];if(t.t==null)t.t=Oi++;else if(t.t0?n:Qn(n)?n.map(Vs):ue({},n)}function _u(n,t,e,o,r,i,a,s,l){var u,p,c,d,f,h,y,v=e.props||Bn,g=t.props,m=t.type;if(m=="svg"?r="http://www.w3.org/2000/svg":m=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}}}function Fe(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i}function Ci(){for(var n=[],t=0;t2&&mn("box");var e=Ue(t);return new Ne(n,uo(e),e.name,!0,e.equals)},array:function(n,t){arguments.length>2&&mn("array");var e=Ue(t);return Mc(n,uo(e),e.name)},map:function(n,t){arguments.length>2&&mn("map");var e=Ue(t);return new Ri(n,uo(e),e.name)},set:function(n,t){arguments.length>2&&mn("set");var e=Ue(t);return new bl(n,uo(e),e.name)},object:function(n,t,e){typeof arguments[1]=="string"&&mn("object");var o=Ue(e);if(o.proxy===!1)return Fr({},n,t,o);var r=hl(o),i=Fr({},void 0,void 0,o),a=Oc(i);return yl(a,n,t,r),a},ref:Js,shallow:Xu,deep:ji,struct:Bu},E=Hu;Object.keys(Zi).forEach(function(n){return E[n]=Zi[n]});function mn(n){K("Expected one or two arguments to observable."+n+". Did you accidentally try to use observable."+n+" as decorator?")}var Li=qs(!1,function(n,t,e,o,r){var i=e.get,a=e.set,s=r[0]||{};Xi(n).addComputedProp(n,t,Ho({get:i,set:a,context:n},s))}),zu=Li({equals:tn.structural}),Q=function(n,t,e){if(typeof t=="string"||n!==null&&typeof n=="object"&&arguments.length===1)return Li.apply(null,arguments);var o=typeof t=="object"?t:{};return o.get=n,o.set=typeof t=="function"?t:o.set,o.name=o.name||n.name||"",new nn(o)};Q.struct=zu;var q;(function(n){n[n.NOT_TRACKING=-1]="NOT_TRACKING",n[n.UP_TO_DATE=0]="UP_TO_DATE",n[n.POSSIBLY_STALE=1]="POSSIBLY_STALE",n[n.STALE=2]="STALE"})(q||(q={}));var ee;(function(n){n[n.NONE=0]="NONE",n[n.LOG=1]="LOG",n[n.BREAK=2]="BREAK"})(ee||(ee={}));var Yo=(function(){function n(t){this.cause=t}return n})();function On(n){return n instanceof Yo}function zr(n){switch(n.dependenciesState){case q.UP_TO_DATE:return!1;case q.NOT_TRACKING:case q.STALE:return!0;case q.POSSIBLY_STALE:{for(var t=ki(!0),e=gn(),o=n.observing,r=o.length,i=0;i0;C.computationDepth>0&&t&&K(!1),!C.allowStateChanges&&(t||C.enforceActions==="strict")&&K(!1)}function Qs(n,t,e){var o=ki(!0);el(n),n.newObserving=new Array(n.observing.length+100),n.unboundDepsCount=0,n.runId=++C.runId;var r=C.trackingDerivation;C.trackingDerivation=n;var i;if(C.disableErrorBoundaries===!0)i=t.call(e);else try{i=t.call(e)}catch(a){i=new Yo(a)}return C.trackingDerivation=r,Yu(n),Mn(o),i}function Yu(n){for(var t=n.observing,e=n.observing=n.newObserving,o=q.UP_TO_DATE,r=0,i=n.unboundDepsCount,a=0;ao&&(o=s.dependenciesState)}for(e.length=r,n.newObserving=null,i=t.length;i--;){var s=t[i];s.diffValue===0&&rl(s,n),s.diffValue=0}for(;r--;){var s=e[r];s.diffValue===1&&(s.diffValue=0,Zu(s,n))}o!==q.UP_TO_DATE&&(n.dependenciesState=o,n.onBecomeStale())}function Yr(n){var t=n.observing;n.observing=[];for(var e=t.length;e--;)rl(t[e],n);n.dependenciesState=q.NOT_TRACKING}function tl(n){var t=gn();try{return n()}finally{me(t)}}function gn(){var n=C.trackingDerivation;return C.trackingDerivation=null,n}function me(n){C.trackingDerivation=n}function ki(n){var t=C.allowStateReads;return C.allowStateReads=n,t}function Mn(n){C.allowStateReads=n}function el(n){if(n.dependenciesState!==q.UP_TO_DATE){n.dependenciesState=q.UP_TO_DATE;for(var t=n.observing,e=t.length;e--;)t[e].lowestObserverState=q.UP_TO_DATE}}var Go=0,Gu=1,qi=Object.getOwnPropertyDescriptor(function(){},"name"),yy=qi&&qi.configurable;function De(n,t,e){var o=function(){return nl(n,t,e||this,arguments)};return o.isMobxAction=!0,o}function nl(n,t,e,o){var r=Uu(n,e,o);try{return t.apply(e,o)}catch(i){throw r.error=i,i}finally{Vu(r)}}function Uu(n,t,e){var o=mt()&&!!n,r=0;if(o&&!1){var i,a;if(i>0)for(var s;s0&&!n.__mobxGlobals&&(Lo=!1),n.__mobxGlobals&&n.__mobxGlobals.version!==new jo().version&&(Lo=!1),Lo?n.__mobxGlobals?(n.__mobxInstanceCount+=1,n.__mobxGlobals.UNCHANGED||(n.__mobxGlobals.UNCHANGED={}),n.__mobxGlobals):(n.__mobxInstanceCount=1,n.__mobxGlobals=new jo):(setTimeout(function(){ol||K("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")},1),new jo)})();function Ku(){(C.pendingReactions.length||C.inBatch||C.isRunningReactions)&&K("isolateGlobalState should be called before MobX is running any reactions"),ol=!0,Lo&&(--Gr().__mobxInstanceCount===0&&(Gr().__mobxGlobals=void 0),C=new jo)}function Ur(){return C}function Zu(n,t){n.observers.add(t),n.lowestObserverState>t.dependenciesState&&(n.lowestObserverState=t.dependenciesState)}function rl(n,t){n.observers.delete(t),n.observers.size===0&&il(n)}function il(n){n.isPendingUnobservation===!1&&(n.isPendingUnobservation=!0,C.pendingUnobservations.push(n))}function Gt(){C.inBatch++}function Ut(){if(--C.inBatch===0){ul();for(var n=C.pendingUnobservations,t=0;t0&&il(n),!1)}function qu(n){n.lowestObserverState!==q.STALE&&(n.lowestObserverState=q.STALE,n.observers.forEach(function(t){t.dependenciesState===q.UP_TO_DATE&&(t.isTracing!==ee.NONE&&sl(t,n),t.onBecomeStale()),t.dependenciesState=q.STALE}))}function $u(n){n.lowestObserverState!==q.STALE&&(n.lowestObserverState=q.STALE,n.observers.forEach(function(t){t.dependenciesState===q.POSSIBLY_STALE?t.dependenciesState=q.STALE:t.dependenciesState===q.UP_TO_DATE&&(n.lowestObserverState=q.UP_TO_DATE)}))}function Ju(n){n.lowestObserverState===q.UP_TO_DATE&&(n.lowestObserverState=q.POSSIBLY_STALE,n.observers.forEach(function(t){t.dependenciesState===q.UP_TO_DATE&&(t.dependenciesState=q.POSSIBLY_STALE,t.isTracing!==ee.NONE&&sl(t,n),t.onBecomeStale())}))}function sl(n,t){if(n.isTracing===ee.BREAK){var e=[];ll(fc(n),e,1),new Function(`debugger; /* Tracing '`+n.name+`' You are entering this break point because derivation '`+n.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. `+(n instanceof nn?n.derivation.toString().replace(/[*]\//g,"/"):"")+` The dependencies for this derivation are: `+e.join(` `)+` */ `)()}}function ll(n,t,e){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+new Array(e).join(" ")+n.name),n.dependencies&&n.dependencies.forEach(function(o){return ll(o,t,e+1)})}var Hn=(function(){function n(t,e,o,r){t===void 0&&(t="Reaction@"+St()),r===void 0&&(r=!1),this.name=t,this.onInvalidate=e,this.errorHandler=o,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=q.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+St(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ee.NONE}return n.prototype.onBecomeStale=function(){this.schedule()},n.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,C.pendingReactions.push(this),ul())},n.prototype.isScheduled=function(){return this._isScheduled},n.prototype.runReaction=function(){if(!this.isDisposed){if(Gt(),this._isScheduled=!1,zr(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&mt()}catch(t){this.reportExceptionInDerivation(t)}}Ut()}},n.prototype.track=function(t){if(!this.isDisposed){Gt();var e=mt(),o;this._isRunning=!0;var r=Qs(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Yr(this),On(r)&&this.reportExceptionInDerivation(r.cause),Ut()}},n.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return}if(C.disableErrorBoundaries)throw t;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";C.suppressReactionErrors,mt()&&nc({type:"error",name:this.name,message:o,error:""+t}),C.globalReactionErrorHandlers.forEach(function(r){return r(t,e)})},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Gt(),Yr(this),Ut()))},n.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[k]=this,t},n.prototype.toString=function(){return"Reaction["+this.name+"]"},n.prototype.trace=function(t){t===void 0&&(t=!1),bc(this,t)},n})(),Qu=100,Vr=function(n){return n()};function ul(){C.inBatch>0||C.isRunningReactions||Vr(tc)}function tc(){C.isRunningReactions=!0;for(var n=C.pendingReactions,t=0;n.length>0;){++t===Qu&&n.splice(0);for(var e=n.splice(0),o=0,r=e.length;o",n);if(arguments.length===2&&typeof t=="function")return De(n,t);if(arguments.length===1&&typeof n=="string")return $i(n);if(o===!0)fn(n,t,De(n.name||t,e.value,this));else return $i(t).apply(null,arguments)};b.bound=ac;function sc(n,t){var e=typeof n=="string"?n:n.name||"",o=typeof n=="function"?n:t;return nl(e,o,this,void 0)}function _r(n,t,e){fn(n,t,De(t,e.bind(n)))}function lc(n,t){t===void 0&&(t=Ai);var e=t&&t.name||n.name||"Autorun@"+St(),o=!t.scheduler&&!t.delay,r;if(o)r=new Hn(e,function(){this.track(s)},t.onError,t.requiresObservable);else{var i=cl(t),a=!1;r=new Hn(e,function(){a||(a=!0,i(function(){a=!1,r.isDisposed||r.track(s)}))},t.onError,t.requiresObservable)}function s(){n(r)}return r.schedule(),r.getDisposer()}var uc=function(n){return n()};function cl(n){return n.scheduler?n.scheduler:n.delay?function(t){return setTimeout(t,n.delay)}:uc}function pl(n,t,e){e===void 0&&(e=Ai);var o=e.name||"Reaction@"+St(),r=b(o,e.onError?cc(e.onError,t):t),i=!e.scheduler&&!e.delay,a=cl(e),s=!0,l=!1,u,p=e.compareStructural?tn.structural:e.equals||tn.default,c=new Hn(o,function(){s||i?d():l||(l=!0,a(d))},e.onError,e.requiresObservable);function d(){if(l=!1,!c.isDisposed){var f=!1;c.track(function(){var h=n(c);f=s||!p(u,h),u=h}),s&&e.fireImmediately&&r(u,c),!s&&f===!0&&r(u,c),s&&(s=!1)}}return c.schedule(),c.getDisposer()}function cc(n,t){return function(){try{return t.apply(this,arguments)}catch(e){n.call(this,e)}}}function pc(n,t,e){return fl("onBecomeObserved",n,t)}function dl(n,t,e){return fl("onBecomeUnobserved",n,t)}function fl(n,t,e,o){var r=_e(t),i=e,a=n+"Listeners";r[a]?r[a].add(i):r[a]=new Set([i]);var s=r[n];return typeof s!="function"?K(!1):function(){var l=r[a];l&&(l.delete(i),l.size===0&&delete r[a])}}function dc(n){var t=n.enforceActions,e=n.computedRequiresReaction,o=n.computedConfigurable,r=n.disableErrorBoundaries,i=n.reactionScheduler,a=n.reactionRequiresObservable,s=n.observableRequiresReaction;if(Ku(),t!==void 0){(typeof t=="boolean"||t==="strict")&&Ou(`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:K("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'")}C.enforceActions=l,C.allowStateChanges=!(l===!0||l==="strict")}e!==void 0&&(C.computedRequiresReaction=!!e),a!==void 0&&(C.reactionRequiresObservable=!!a),s!==void 0&&(C.observableRequiresReaction=!!s,C.allowStateReads=!C.observableRequiresReaction),o!==void 0&&(C.computedConfigurable=!!o),r!==void 0&&(C.disableErrorBoundaries=!!r),i&&ec(i)}function Fr(n,t,e,o){o=Ue(o);var r=hl(o);return Le(n),Xi(n,o.name,r.enhancer),t&&yl(n,t,e,r),n}function hl(n){return n.defaultDecorator||(n.deep===!1?Js:ji)}function yl(n,t,e,o){var r,i,a,s;if(0){var l;try{for(var u,p;!p.done;p=u.next())var c}catch(g){}finally{}}Gt();try{var l=Au(t);try{for(var d=Qt(l),f=d.next();!f.done;f=d.next()){var c=f.value,h=Object.getOwnPropertyDescriptor(t,c),y=e&&c in e?e[c]:h.get?Li:o,v=y(n,c,h,!0);v&&Object.defineProperty(n,c,v)}}catch(m){a={error:m}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}}finally{Ut()}}function fc(n,t){return gl(_e(n,t))}function gl(n){var t={name:n.name};return n.observing&&n.observing.length>0&&(t.dependencies=wu(n.observing).map(gl)),t}function vl(n,t){if(n==null)return!1;if(t!==void 0){if(Wt(n)===!1||!n[k].values.has(t))return!1;var e=_e(n,t);return on(e)}return on(n)}function hc(n){return arguments.length>1?K(!1):vl(n)}function Ji(n,t){return typeof t!="string"?K(!1):vl(n,t)}function yc(n,t){return n==null?!1:Wt(n)||!!n[k]||Di(n)||Uo(n)||on(n)}function rn(n){return arguments.length!==1&&K(!1),yc(n)}function an(n){return Wt(n)?n[k].getKeys():Mt(n)||Lt(n)?Array.from(n.keys()):ie(n)?n.map(function(t,e){return e}):K(!1)}function gc(n){return Wt(n)?an(n).map(function(t){return n[t]}):Mt(n)?an(n).map(function(t){return n.get(t)}):Lt(n)?Array.from(n.values()):ie(n)?n.slice():K(!1)}function vc(n){return Wt(n)?an(n).map(function(t){return[t,n[t]]}):Mt(n)?an(n).map(function(t){return[t,n.get(t)]}):Lt(n)?Array.from(n.entries()):ie(n)?n.map(function(t,e){return[e,t]}):K(!1)}function Ii(n,t,e){if(arguments.length===2&&!Lt(n)){Gt();var o=t;try{for(var r in o)Ii(n,r,o[r])}finally{Ut()}return}if(Wt(n)){var i=n[k],a=i.values.get(t);a?i.write(t,e):i.addObservableProp(t,e,i.defaultEnhancer)}else if(Mt(n))n.set(t,e);else if(Lt(n))n.add(t);else if(ie(n))typeof t!="number"&&(t=parseInt(t,10)),Pe(t>=0,"Not a valid index: '"+t+"'"),Gt(),t>=n.length&&(n.length=t+1),n[t]=e,Ut();else return K(!1)}function ml(n,t,e,o){return mc(n,t,e)}function mc(n,t,e){return hr(n).observe(t,e)}var _c={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function Xe(n,t,e,o){return o.detectCycles&&n.set(t,e),e}function pe(n,t,e){if(!t.recurseEverything&&!rn(n)||typeof n!="object")return n;if(n===null)return null;if(n instanceof Date)return n;if(Fu(n))return pe(n.get(),t,e);rn(n)&&an(n);var o=t.detectCycles===!0;if(o&&n!==null&&e.has(n))return e.get(n);if(ie(n)||Array.isArray(n)){var r=Xe(e,n,[],t),i=n.map(function(f){return pe(f,t,e)});r.length=i.length;for(var a=0,s=i.length;a0}function no(n,t){var e=n.interceptors||(n.interceptors=[]);return e.push(t),Ws(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function oe(n,t){var e=gn();try{for(var o=Ci(n.interceptors||[]),r=0,i=o.length;r0}function oo(n,t){var e=n.changeListeners||(n.changeListeners=[]);return e.push(t),Ws(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function Ft(n,t){var e=gn(),o=n.changeListeners;if(o){o=o.slice();for(var r=0,i=o.length;r0?t.map(this.dehancer):t},n.prototype.intercept=function(t){return no(this,t)},n.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}),oo(this,t)},n.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},n.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 o=new Array(t-e),r=0;ri?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)),o===void 0&&(o=Bo),ne(this)){var a=oe(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:o});if(!a)return Bo;e=a.removedCount,o=a.added}if(o=o.length===0?o:o.map(function(u){return r.enhancer(u,void 0)}),!1)var s;var l=this.spliceItemsIntoValues(t,e,o);return(e!==0||o.length!==0)&&this.notifyArraySplice(t,o,l),this.dehanceValues(l)},n.prototype.spliceItemsIntoValues=function(t,e,o){var r;if(o.length-1?(this.splice(e,1),!0):!1},get:function(n){var t=this[k];if(t&&n=0&&e++;break}n=ia(n),t=ia(t);var s=a==="[object Array]";if(!s){if(typeof n!="object"||typeof t!="object")return!1;var l=n.constructor,u=t.constructor;if(l!==u&&!(typeof l=="function"&&l instanceof l&&typeof u=="function"&&u instanceof u)&&"constructor"in n&&"constructor"in t)return!1}if(e===0)return!1;e<0&&(e=-1),o=o||[],r=r||[];for(var p=o.length;p--;)if(o[p]===n)return r[p]===t;if(o.push(n),r.push(t),s){if(p=n.length,p!==t.length)return!1;for(;p--;)if(!Wr(n[p],t[p],e-1,o,r))return!1}else{var c=Object.keys(n),d=void 0;if(p=c.length,Object.keys(t).length!==p)return!1;for(;p--;)if(d=c[p],!(Lc(t,d)&&Wr(n[d],t[d],e-1,o,r)))return!1}return o.pop(),r.pop(),!0}function ia(n){return ie(n)?n.slice():hn(n)||Mt(n)||to(n)||Lt(n)?Array.from(n.entries()):n}function Lc(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function Vo(n){return n[Symbol.iterator]=kc,n}function kc(){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 n(){}if(n.name!=="testCodeMinification"&&!1)var t})();typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:oc,extras:{getDebugName:jc},$mobx:k});function Ic(n){return!(n.prototype&&n.prototype.render)&&!G.isPrototypeOf(n)}function Ol(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=t.prefix,o=e===void 0?"":e,r=t.suffix,i=r===void 0?"":r,a=n.displayName||n.name||n.constructor&&n.constructor.name||"";return o+a+i}var aa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},wl=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")},Sl=(function(){function n(t,e){for(var o=0;o2&&arguments[2]!==void 0?arguments[2]:!1,o=n[t],r=Al[t],i=o?e===!0?function(){r.apply(this,arguments),o.apply(this,arguments)}:function(){o.apply(this,arguments),r.apply(this,arguments)}:r;n[t]=i}function ua(n,t){if(n==null||t==null||(typeof n=="undefined"?"undefined":aa(n))!=="object"||(typeof t=="undefined"?"undefined":aa(t))!=="object")return n!==t;var e=Object.keys(n);if(e.length!==Object.keys(t).length)return!0;for(var o=void 0,r=e.length-1;o=e[r];r--)if(t[o]!==n[o])return!0;return!1}var Al={componentWillMount:function(){var n=this,t=Ol(this),e=!1,o=!1;function r(p){var c=this[p],d=Ni("reactive "+p);Object.defineProperty(this,p,{configurable:!0,enumerable:!0,get:function(){return d.reportObserved(),c},set:function(f){!o&&ua(c,f)?(c=f,e=!0,d.reportChanged(),e=!1):c=f}})}r.call(this,"props"),r.call(this,"state");var i=this.render.bind(this),a=null,s=!1,l=function(){return a=new Hn(t+".render()",function(){if(!s&&(s=!0,typeof n.componentWillReact=="function"&&n.componentWillReact(),n.__$mobxIsUnmounted!==!0)){var p=!0;try{o=!0,e||G.prototype.forceUpdate.call(n),p=!1}finally{o=!1,p&&a.dispose()}}}),a.reactComponent=n,u.$mobx=a,n.render=u,u(n.props,n.state,n.context)},u=function(p,c,d){s=!1;var f=void 0,h=void 0;if(a.track(function(){try{h=Bc(!1,i,p,c,d)}catch(y){f=y}}),f)throw f;return h};this.render=l},componentWillUnmount:function(){this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0},componentDidMount:function(){},componentDidUpdate:function(){},shouldComponentUpdate:function(n,t){return this.state!==t?!0:ua(this.props,n)}};function Bi(n){if(arguments.length>1&&sa.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))``'),n.isMobxInjector===!0&&sa.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),Ic(n)){var t,e;return Bi((e=t=(function(r){Ml(i,r);function i(){return wl(this,i),Tl(this,(i.__proto__||Object.getPrototypeOf(i)).apply(this,arguments))}return Sl(i,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),i})(G),t.displayName=Ol(n),e))}if(!n)throw new Error("Please pass a valid component to 'observer'");var o=n.prototype||n;return Hc(o),n.isMobXReactObserver=!0,n}function Hc(n){la(n,"componentWillMount",!0),la(n,"componentDidMount"),n.shouldComponentUpdate||(n.shouldComponentUpdate=Al.shouldComponentUpdate)}var zc=Bi(function(n){var t=n.children;return t[0]()});zc.displayName="Observer";var Yc=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Gc(n,t){return t={exports:{}},n(t,t.exports),t.exports}Gc(function(n,t){(function(e,o){n.exports=o()})(Yc,(function(){var e={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,u=l&&l(Object);return function p(c,d,f){if(typeof d!="string"){if(u){var h=l(d);h&&h!==u&&p(c,h,f)}var y=i(d);a&&(y=y.concat(a(d)));for(var v=0;v1?$e("div",null," ",o," "):o[0]}},{key:"getChildContext",value:function(){var e={},o=this.context.mobxStores;if(o)for(var r in o)e[r]=o[r];for(var i in this.props)!ca[i]&&i!=="suppressChangedStoreWarning"&&(e[i]=this.props[i]);return{mobxStores:e}}},{key:"componentWillReceiveProps",value:function(e){if(Object.keys(e).length!==Object.keys(this.props).length&&pa.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!e.suppressChangedStoreWarning)for(var o in e)!ca[o]&&this.props[o]!==e[o]&&pa.warn("MobX Provider: Provided store '"+o+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t})(G);if(!G)throw new Error("mobx-preact requires Preact to be available");var $t,br,da,Pl=[],gt=H,fa=gt.__b,ha=gt.__r,ya=gt.diffed,ga=gt.__c,va=gt.unmount,ma=gt.__;function Uc(){for(var n;n=Pl.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(ko),n.__H.__h.forEach(Kr),n.__H.__h=[]}catch(t){n.__H.__h=[],gt.__e(t,n.__v)}}gt.__b=function(n){$t=null,fa&&fa(n)},gt.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),ma&&ma(n,t)},gt.__r=function(n){ha&&ha(n);var t=($t=n.__c).__H;t&&(br===$t?(t.__h=[],$t.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ko),t.__h.forEach(Kr),t.__h=[])),br=$t},gt.diffed=function(n){ya&&ya(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(Pl.push(t)!==1&&da===gt.requestAnimationFrame||((da=gt.requestAnimationFrame)||Vc)(Uc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),br=$t=null},gt.__c=function(n,t){t.some(function(e){try{e.__h.forEach(ko),e.__h=e.__h.filter(function(o){return!o.__||Kr(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],gt.__e(o,e.__v)}}),ga&&ga(n,t)},gt.unmount=function(n){va&&va(n);var t,e=n.__c;e&&e.__H&&(e.__H.__.forEach(function(o){try{ko(o)}catch(r){t=r}}),e.__H=void 0,t&>.__e(t,e.__v))};var _a=typeof requestAnimationFrame=="function";function Vc(n){var t,e=function(){clearTimeout(o),_a&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(e,35);_a&&(t=requestAnimationFrame(e))}function ko(n){var t=$t,e=n.__c;typeof e=="function"&&(n.__c=void 0,e()),$t=t}function Kr(n){var t=$t;n.__c=n.__(),$t=t}function Fc(n,t){for(var e in t)n[e]=t[e];return n}function ba(n,t){for(var e in n)if(e!=="__source"&&!(e in t))return!0;for(var o in t)if(o!=="__source"&&n[o]!==t[o])return!0;return!1}function xa(n,t){this.props=n,this.context=t}(xa.prototype=new G).isPureReactComponent=!0,xa.prototype.shouldComponentUpdate=function(n,t){return ba(this.props,n)||ba(this.state,t)};var Ea=H.__b;H.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),Ea&&Ea(n)};var Wc=H.__e;H.__e=function(n,t,e,o){if(n.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t)}Wc(n,t,e,o)};var Oa=H.unmount;function Dl(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),n.__c.__H=null),(n=Fc({},n)).__c!=null&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(o){return Dl(o,t,e)})),n}function Nl(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(o){return Nl(o,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function xr(){this.__u=0,this.o=null,this.__b=null}function Cl(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function fo(){this.i=null,this.l=null}H.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),Oa&&Oa(n)},(xr.prototype=new G).__c=function(n,t){var e=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(e);var r=Cl(o.__v),i=!1,a=function(){i||(i=!0,e.__R=null,r?r(s):s())};e.__R=a;var s=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=Nl(l,l.__c.__P,l.__c.__O)}var u;for(o.setState({__a:o.__b=null});u=o.o.pop();)u.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),n.then(a,a)},xr.prototype.componentWillUnmount=function(){this.o=[]},xr.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Dl(this.__b,e,o.__O=o.__P)}this.__b=null}var r=t.__a&&$e(Je,null,n.fallback);return r&&(r.__u&=-33),[$e(Je,null,t.__a?null:n.children),r]};var wa=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]g.step||Math.abs(g.sumDeltaY)>g.step)){var w=g.sumDeltaX%g.step,S=g.sumDeltaY%g.step,_=g.sumDeltaX-w,x=g.sumDeltaY-S;g.sumDeltaX=w,g.sumDeltaY=S;var A=(M=g.model)===null||M===void 0?void 0:M.getData();g.isDragging||((T=g.eventCenter)===null||T===void 0||T.emit(N["".concat(g.eventType,"_DRAGSTART")],{e:m,data:g.data||A}),g.onDragStart({event:m})),g.isDragging=!0,Promise.resolve().then(function(){var P,I;g.onDragging({deltaX:_,deltaY:x,event:m}),(P=g.eventCenter)===null||P===void 0||P.emit(N["".concat(g.eventType,"_MOUSEMOVE")],{deltaX:_,deltaY:x,e:m,data:g.data||A}),(I=g.eventCenter)===null||I===void 0||I.emit(N["".concat(g.eventType,"_DRAG")],{e:m,data:g.data||A})})}},this.handleMouseUp=function(m){var M=window.document;g.isStartDragging=!1,g.isStopPropagation&&m.stopPropagation(),Promise.resolve().then(function(){var T,w,S;M.removeEventListener("mousemove",g.handleMouseMove,!1),M.removeEventListener("mouseup",g.handleMouseUp,!1);var _=(T=g.model)===null||T===void 0?void 0:T.getData();(w=g.eventCenter)===null||w===void 0||w.emit(N["".concat(g.eventType,"_MOUSEUP")],{e:m,data:g.data||_}),g.isDragging&&(g.isDragging=!1,g.onDragEnd({event:m}),(S=g.eventCenter)===null||S===void 0||S.emit(N["".concat(g.eventType,"_DROP")],{e:m,data:g.data||_}))})},this.cancelDrag=function(){var m=window==null?void 0:window.document;m.removeEventListener("mousemove",g.handleMouseMove,!1),m.removeEventListener("mouseup",g.handleMouseUp,!1),g.onDragEnd({event:void 0}),g.isDragging=!1},this.destroy=function(){g.isStartDragging&&g.cancelDrag()},this.onDragStart=o,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=h,this.eventType=u,this.eventCenter=p,this.model=y,this.data=v}return n.prototype.setStep=function(t){this.step=t},n.prototype.setModel=function(t){this.model=t},n})(),dp=function(n){var t=n.x,e=n.y,o=n.width,r=n.height;return{x:t-o/2,y:e-r/2,x1:t+o/2,y1:e+r/2}},fp=function(n){var t=n.startPoint,e=n.endPoint,o=(t.x+e.x)/2,r=(t.y+e.y)/2,i=Math.abs(t.x-e.x)+10,a=Math.abs(t.y-e.y)+10;return{x:o-i/2,y:r-a/2,x1:o+i/2,y1:r+a/2}},hp=function(n){var t=n.points,e=ke(t),o=Un(e,8),r=o.x,i=o.y,a=o.width,s=o.height;return{x:r-a/2,y:i-s/2,x1:r+a/2,y1:i+s/2}},yp=function(n){var t=n.path,e=Hi(t),o=Un(e,8),r=o.x,i=o.y,a=o.width,s=o.height;return{x:r-a/2,y:i-s/2,x1:r+a/2,y1:i+s/2}},gp=function(n){if(n.modelType===z.LINE_EDGE)return fp(n);if(n.modelType===z.POLYLINE_EDGE)return hp(n);if(n.modelType===z.BEZIER_EDGE)return yp(n)},vp=function(n,t,e,o){var r=(t.y-n.y)*(o.x-e.x)-(n.x-t.x)*(e.y-o.y);if(r===0)return!1;var i=((t.x-n.x)*(o.x-e.x)*(e.y-n.y)+(t.y-n.y)*(o.x-e.x)*n.x-(o.y-e.y)*(t.x-n.x)*e.x)/r,a=-((t.y-n.y)*(o.y-e.y)*(e.x-n.x)+(t.x-n.x)*(o.y-e.y)*n.y-(o.x-e.x)*(t.y-n.y)*e.y)/r;return(i-n.x)*(i-t.x)<=0&&(a-n.y)*(a-t.y)<=0&&(i-e.x)*(i-o.x)<=0&&(a-e.y)*(a-o.y)<=0?{x:i,y:a}:!1},Yn=function(n,t,e){var o=n.x,r=n.y,i=t.x,a=t.y,s=e.x,l=e.y,u=(l-a)/(s-i),p=a-u*i;return(o>=i&&o<=s||o<=i&&o>=s)&&(r>=a&&r<=l||r<=a&&r>=l)&&Math.abs(r-u*o-p)=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},We=function(){return We=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ge=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;oo/t.height?et.HORIZONTAL:et.VERTICAL},Wo=function(n,t,e){var o=_p(e,t);return o===et.HORIZONTAL?{x:e.x>n.centerX?n.maxX:n.minX,y:e.y}:{x:e.x,y:e.y>n.centerY?n.maxY:n.minY}},Na=function(n,t){var e=Math.min(n.minX,t.minX),o=Math.min(n.minY,t.minY),r=Math.max(n.maxX,t.maxX),i=Math.max(n.maxY,t.maxY);return{x:(e+r)/2,y:(o+i)/2,centerX:(e+r)/2,centerY:(o+i)/2,minX:e,minY:o,maxX:r,maxY:i,height:i-o,width:r-e}},Un=function(n,t){n===void 0&&(n=[]);var e=[],o=[];n.forEach(function(p){e.push(p.x),o.push(p.y)});var r=Math.min.apply(Math,ge([],Ct(e),!1)),i=Math.max.apply(Math,ge([],Ct(e),!1)),a=Math.min.apply(Math,ge([],Ct(o),!1)),s=Math.max.apply(Math,ge([],Ct(o),!1)),l=i-r,u=s-a;return t&&(l+=t,u+=t),{centerX:(r+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:r,minY:a,x:(r+i)/2,y:(a+s)/2,height:u,width:l}},Ko=function(n){var t=n.minX,e=n.minY,o=n.maxX,r=n.maxY;return[{x:t,y:e},{x:o,y:e},{x:o,y:r},{x:t,y:r}]},yo=function(n,t){var e=n.x,o=n.y;return et.maxX||ot.maxY},bp=function(n,t){return tn.maxX?[]:[{x:t,y:n.minY},{x:t,y:n.maxY}]},xp=function(n,t){return tn.maxY?[]:[{x:n.minX,y:t},{x:n.maxX,y:t}]},Ep=function(n,t){return ge(ge([],Ct(bp(n,t.x)),!1),Ct(xp(n,t.y)),!1)},qr=function(n,t){return Math.abs(n.x-t.x)+Math.abs(n.y-t.y)},Op=function(n,t){var e=-2,o=0;return t.forEach(function(r){r&&(n.x===r.x&&(o+=e),n.y===r.y&&(o+=e))}),o},Ca=function(n,t,e,o,r){return qr(n,t)+qr(n,e)+Op(n,[t,e,o,r])},jl=function(n,t,e,o,r){r||(r=0),n.unshift(t[o]),e[o]&&e[o]!==o&&r<=100&&jl(n,t,e,e[o],r+1)},wp=function(n,t){var e=n.indexOf(t);e>-1&&n.splice(e,1)},wn=function(n,t,e,o){var r=t.x-n.x,i=t.y-n.y,a=o.x-e.x,s=o.y-e.y,l=(-i*(n.x-e.x)+r*(n.y-e.y))/(-a*i+r*s),u=(a*(n.y-e.y)-s*(n.x-e.x))/(-a*i+r*s);return l>=0&&l<=1&&u>=0&&u<=1},ja=function(n,t,e){if(e.width===0&&e.height===0)return!1;var o=Ct(Ko(e),4),r=o[0],i=o[1],a=o[2],s=o[3];return wn(n,t,r,i)||wn(n,t,r,s)||wn(n,t,i,a)||wn(n,t,a,s)},Sp=function(n,t,e,o){var r=[];return n.forEach(function(i){i!==t&&(i.x===t.x||i.y===t.y)&&!ja(i,t,e)&&!ja(i,t,o)&&r.push(i)}),Zr(r)},Mp=function(n,t,e,o,r,i,a){var s=[],l=[t],u={},p={},c={};t.id&&(p[t.id]=0,c[t.id]=Ca(t,e,t));var d={};n.forEach(function(y){y.id&&(d[y.id]=y)});for(var f=function(){var y,v=1/0;if(l.forEach(function(m){m.id&&c[m.id]=p[m.id])return;u[m.id]=y.id,p[m.id]=M,c[m.id]=p[m.id]+Ca(m,e,t,i,a)}})};l.length;){var h=f();if(typeof h=="object")return h.value}return[t,e]},La=function(n){return At(n)},Ll=function(n){for(var t=1;t2&&(g=Ll(g)),Zr(g)},Tp=function(n){if(n.length===1){var t=Ct(n,1),e=t[0];return[e,e]}else{for(var o=n[0],r=n[1],i=Yt(o.x,o.y,r.x,r.y),a=1;ai&&(i=u,o=s,r=l)}return[o,r]}},Ia=function(n,t,e){var o=ce(n,e),r=ce(t,e);return o&&r},Ra=function(n,t,e){var o=ce(n,e),r=ce(t,e),i=o&&r,a=o||r;return!i&&a},Xa=function(n,t,e){for(var o=void 0,r=At(e),i=Ko(r),a=0;a=1&&o<=126||o>=65376&&o<=65439?t+=1:t+=2}return t},Pp=function(n){var t=n.start,e=n.end,o;if(t.x===e.x&&t.y===e.y)o="";else{var r={start:t,end:e,offset:10,verticalLength:5},i=Gn(We(We({},r),{type:"start"})),a=Gn(We(We({},r),{type:"end"}));o="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:o,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},Ha=function(n){var t=n.start,e=n.end,o=n.sourceNode,r=n.targetNode,i=n.offset,a=At(o),s=At(r),l=Fo(a,i),u=Fo(s,i),p=Wo(l,a,t),c=Wo(u,s,e);return{sNext:p,ePre:c}},Hi=function(n){var t=n.replace(/M/g,"").replace(/C/g,",").split(","),e=go(t[0]),o=go(t[1]),r=go(t[2]),i=go(t[3]);return[e,o,r,i]},go=function(n){var t=Ct(n.replace(/(^\s*)/g,"").split(" "),2),e=t[0],o=t[1];return{x:+e,y:+o}},za=function(n,t){var e=Ct(n,4),o=e[0],r=e[1],i=e[2],a=e[3],s=bd(o,r,i,a,t);return[s,n[3]]},Il=function(n,t){for(var e=n.x,o=n.y,r=ke(t),i=Number.MAX_SAFE_INTEGER,a,s=[],l=0;lr?a:r}),{width:Math.ceil(r/2)*o+o/4,height:e*(o+2)+o/4}},Be=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},vo=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Or=function(n,t,e){var o=Er(n,2),r=o[0],i=o[1],a=Er(t,2),s=a[0],l=a[1],u=Er(e,2),p=u[0],c=u[1];return r>s&&rl&&i=0?r:-r},t})(Xl),$r=(function(n){zi(t,n);function t(e,o){var r=n.call(this,e,o,1)||this;return Object.setPrototypeOf(r,t.prototype),r}return t.prototype.toString=function(){return"Point"},t})(Xl),yr=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),He=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},wr=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Jr=function(n){var t=n.anchors;return t},Jo=function(n,t){for(var e=t.nodes,o,r=e.length-1;r>=0;r--){var i=e[r],a=Bp(n,i);if(a){var s=i.getTargetAnchor(n);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!o||Rp(i,o.node,t))&&(o=l)}}}return o},Rp=function(n,t,e){return n.zIndex>t.zIndex?!0:e.nodesMap[n.id].index>e.nodesMap[t.id].index},Xp=function(n,t){for(var e=Jr(t),o,r=Number.MAX_SAFE_INTEGER,i=0;i=r.minX-e&&l.x<=r.maxX+e&&l.y>=r.minY-e&&l.y<=r.maxY+e&&(o=!0),o},Bp=function(n,t){return ce(n,t,5)},At=function(n){var t=n.x,e=n.y,o=n.width,r=n.height;return{minX:t-o/2,minY:e-r/2,maxX:t+o/2,maxY:e+r/2,x:t,y:e,width:o,height:r,centerX:t,centerY:e}},Hp=function(n){var t=n,e=t.x,o=t.y,r=t.width,i=t.height,a=t.radius;return[{x:e-r/2+a,y:o-i/2+a,r:a},{x:e+r/2-a,y:o-i/2+a,r:a},{x:e-r/2+a,y:o+i/2-a,r:a},{x:e+r/2-a,y:o+i/2-a,r:a}]},Ua=function(n,t,e){var o=Hp(e),r,i=Number.MAX_SAFE_INTEGER;return o.forEach(function(a){var s=Yt(n.x,n.y,a.x,a.y);su.minX&&n.xu.minY&&n.yp.x&&(c=p,d=u);var f={x:n.x,y:n.y};if(c.x===d.x&&t===et.HORIZONTAL&&(f={x:c.x,y:n.y}),c.y===d.y&&t===et.VERTICAL&&(f={x:n.x,y:c.y}),c.x!==d.x&&c.y!==d.y){var h=(d.y-c.y)/(d.x-c.x),y=(c.x*d.y-d.x*c.y)/(c.x-d.x);t===et.HORIZONTAL?f={x:(n.y-y)/h,y:n.y}:t===et.VERTICAL&&(f={x:n.x,y:h*n.x+y})}var v=Yn(f,u,p);if(v){var g=Yt(f.x,f.y,n.x,n.y);gn.x?r=n.x+e/2:t.xn.y?i=n.y+o/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},Ka=function(n){var t=n.rows,e=n.rowsLength,o=n.fontSize,r=0;return t&&t.forEach(function(i){var a=kl(i);r=a>r?a:r}),{width:Math.ceil(r/2)*o+o/4,height:e*(o+2)+o/4}},Qo=function(n){return typeof n!="object"?{isAllPass:!!n,msg:n?"":"不允许连接"}:n};let _o;const Yp=new Uint8Array(16);function Gp(){if(!_o&&(_o=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_o))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _o(Yp)}const yt=[];for(let n=0;n<256;++n)yt.push((n+256).toString(16).slice(1));function Up(n,t=0){return yt[n[t+0]]+yt[n[t+1]]+yt[n[t+2]]+yt[n[t+3]]+"-"+yt[n[t+4]]+yt[n[t+5]]+"-"+yt[n[t+6]]+yt[n[t+7]]+"-"+yt[n[t+8]]+yt[n[t+9]]+"-"+yt[n[t+10]]+yt[n[t+11]]+yt[n[t+12]]+yt[n[t+13]]+yt[n[t+14]]+yt[n[t+15]]}const Vp=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Za={randomUUID:Vp};function Fp(n,t,e){if(Za.randomUUID&&!n)return Za.randomUUID();n=n||{};const o=n.random||(n.rng||Gp)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,Up(o)}var Ce=function(){return Fp()},Tn=new Map,Hl=function(n){var t=Ce();function e(){n();var r=Tn.get(t);if(r){var i=window.requestAnimationFrame(e);Tn.set(t,i)}}var o=window.requestAnimationFrame(e);return Tn.set(t,o),t},tr=function(n){var t=Tn.get(n);t&&(window.cancelAnimationFrame(t),Tn.delete(n))},Vn=function(){return Vn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function zl(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.value,a=n.fontSize,s=a===void 0?12:a,l=n.fill,u=l===void 0?"currentColor":l,p=n.overflowMode,c=p===void 0?"default":p,d=n.textWidth,f=d===void 0?void 0:d,h=n.model,y={x:e,y:r,fill:u,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(it(be(n),function(w){var S=Wp(w,2),_=S[0],x=S[1];typeof x!="object"&&(y[_]=x)}),i){var v=String(i).split(/[\r\n]/g),g=v.length;if(c!=="default"){var m=h.BaseType,M=h.modelType;if(m===rt.NODE&&M!==z.TEXT_NODE||m===rt.EDGE&&f)return Kp(n)}if(g>1){var T=v.map(function(w,S){var _=s+2,x=(S-(g-1)/2)*_;return O("tspan",{className:"lf-text-tspan",x:e,y:r+x,children:w})});return O("text",Vn({},y,{children:T}))}return O("text",Vn({},y,{children:i}))}return null}function Kp(n){var t=n.x,e=n.y,o=n.value,r=n.model,i=n.textWidth,a=n.fontSize,s=a===void 0?12:a,l=n.lineHeight,u=n.fontFamily,p=u===void 0?"":u,c=n.wrapPadding,d=c===void 0?"0, 0":c,f=n.overflowMode,h=r.width,y=r.height,v=r.textHeight,g=i||h,m=String(o).split(/[\r\n]/g),M=m.length,T=Bl({rows:m,style:{fontSize:"".concat(s,"px"),width:"".concat(g,"px"),fontFamily:p,lineHeight:l,padding:d},rowsLength:M,className:"lf-get-text-height"}),w=y>T?y:T;v&&(w=v);var S=f==="ellipsis";return S&&(w=s+2),O("g",{children:O("foreignObject",{width:g,height:w,x:t-g/2,y:e-w/2,style:{overflow:"visible",textAlign:"left"},children:O("div",{className:"lf-node-text-auto-wrap",style:{minHeight:w,width:g,padding:d},children:O("div",{className:S?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:S?m.join(""):"",style:Vn({},n),children:m.map(function(_){return O("div",{className:"lf-node-text--auto-wrap-inner",children:_})})})})})})}var ti=function(){return ti=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function ln(n){var t={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return it(be(n),function(e){var o=Zp(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),O("line",ti({},t))}var ei=function(){return ei=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function te(n){var t=n.x,e=n.y,o=n.width,r=n.height,i=n.className,a=n.strokeWidth,s=n.radius,l=s===void 0?0:s,u=t-o/2,p=e-r/2,c={};return c["stroke-width"]=a,it(be(n),function(d){var f=qp(d,2),h=f[0],y=f[1];typeof y!="object"&&(c[h]=y)}),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=p,O("rect",ei({},c))}var ni=function(){return ni=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function Fn(n){var t={d:""};return it(be(n),function(e){var o=$p(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),O("path",ni({},t))}var oi=function(){return oi=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function un(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.r,a=i===void 0?4:i,s=n.className,l={cx:e,cy:r,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return it(be(n),function(u){var p=Jp(u,2),c=p[0],d=p[1];typeof d!="object"&&(l[c]=d)}),s?l.className="lf-basic-shape ".concat(s):l.className="lf-basic-shape",O("circle",oi({},l))}var ri=function(){return ri=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function td(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.rx,a=i===void 0?4:i,s=n.ry,l=s===void 0?4:s,u=n.className,p={cx:e,cy:r,rx:a,ry:l,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return it(be(n),function(c){var d=Qp(c,2),f=d[0],h=d[1];typeof h!="object"&&(p[f]=h)}),u?p.className="lf-basic-shape ".concat(u):p.className="lf-basic-shape",O("ellipse",ri({},p))}var er=function(){return er=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function nd(n,t){var e=n.map(function(m){return{x:m[0],y:m[1]}}),o=e.length;if(o<3)return"";for(var r=Math.abs(t),i="",a=0;a0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function rd(n){var t=n.className,e={points:"",fill:"none"};return it(be(n),function(o){var r=od(o,2),i=r[0],a=r[1];(i==="style"||typeof a!="object")&&(e[i]=a)}),t&&(e.className="".concat(t)),O("polyline",ii({},e))}var Gl=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Wn=function(){return Wn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},U;(function(n){n[n.LEFT_TOP=0]="LEFT_TOP",n[n.RIGHT_TOP=1]="RIGHT_TOP",n[n.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",n[n.LEFT_BOTTOM=3]="LEFT_BOTTOM"})(U||(U={}));var sd=(function(n){Gl(t,n);function t(e){var o=n.call(this)||this;o.isShiftPressed=!1,o.bindKeyboardEvents=function(){document.addEventListener("keydown",o.handleKeyDown),document.addEventListener("keyup",o.handleKeyUp)},o.handleKeyDown=function(s){s.key==="Shift"&&(o.isShiftPressed=!0)},o.handleKeyUp=function(s){s.key==="Shift"&&(o.isShiftPressed=!1)},o.updateEdgePointByAnchors=function(){var s=o.nodeModel,l=s.id,u=s.anchors,p=o.graphModel.getNodeEdges(l);it(p,function(c){if(c.sourceNodeId===l){var d=je(u,function(f){return f.id===c.sourceAnchorId});d&&c.updateStartPoint({x:d.x,y:d.y})}else if(c.targetNodeId===l){var d=je(u,function(h){return h.id===c.targetAnchorId});d&&c.updateEndPoint({x:d.x,y:d.y})}})},o.triggerResizeEvent=function(s,l,u,p,c,d){o.graphModel.eventCenter.emit(N.NODE_RESIZE,{preData:s,data:l,deltaX:u,deltaY:p,index:c,model:d})},o.recalcResizeInfo=function(s,l,u,p,c){u===void 0&&(u=1),p===void 0&&(p=!1),c===void 0&&(c=!1);var d=X(l),f=d.deltaX,h=d.deltaY,y=d.width,v=d.height,g=d.PCTResizeInfo;if(g){var m=4,M=0,T=0;switch(s){case U.LEFT_TOP:T=(f*-1-h)/m;break;case U.RIGHT_TOP:T=(f-h)/m;break;case U.RIGHT_BOTTOM:T=(f+h)/m;break;case U.LEFT_BOTTOM:T=(f*-1+h)/m;break}T!==0&&(M=Math.round(T/g.ResizeBasis.basisHeight*1e5)/1e3),g.ResizePCT.widthPCT=Math.max(Math.min(g.ResizePCT.widthPCT+M,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit),g.ResizePCT.heightPCT=Math.max(Math.min(g.ResizePCT.heightPCT+M,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit);var w=Math.round(g.ResizePCT.widthPCT*g.ResizeBasis.basisWidth/100),S=Math.round(g.ResizePCT.heightPCT*g.ResizeBasis.basisHeight/100);switch(s){case U.LEFT_TOP:f=y-w,h=v-S;break;case U.RIGHT_TOP:f=w-y,h=v-S;break;case U.RIGHT_BOTTOM:f=w-y,h=S-v;break;case U.LEFT_BOTTOM:f=y-w,h=S-v;break}return d}switch(s){case U.LEFT_TOP:d.width=p?y:y-f*u,d.height=c?v:v-h*u;break;case U.RIGHT_TOP:d.width=p?y:y+f*u,d.height=c?v:v-h*u;break;case U.RIGHT_BOTTOM:d.width=p?y:y+f*u,d.height=c?v:v+h*u;break;case U.LEFT_BOTTOM:d.width=p?y:y-f*u,d.height=c?v:v+h*u;break}return d},o.resizeNode=function(s){var l=s.deltaX,u=s.deltaY,p=o.index,c=o.props,d=c.model,f=c.graphModel,h=c.x,y=c.y;vd({x:h,y,deltaX:l,deltaY:u,index:p,nodeModel:d,graphModel:f,forceProportional:o.isShiftPressed,cancelCallback:function(){o.dragHandler.cancelDrag()}})},o.onDragStart=function(){o.graphModel.selectNodeById(o.nodeModel.id)},o.onDragging=function(s){var l=s.deltaX,u=s.deltaY,p=o.graphModel.transformModel,c=ad(p.fixDeltaXY(l,u),2),d=c[0],f=c[1];o.resizeNode({deltaX:d,deltaY:f})},o.onDragEnd=function(){var s=o.nodeModel.x,l=o.nodeModel.y;o.nodeModel.moveTo(s,l),o.updateEdgePointByAnchors()};var r=e.index,i=e.model,a=e.graphModel;return o.index=r,o.nodeModel=i,o.graphModel=a,o.dragHandler=new ae({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:a.gridSize}),o.bindKeyboardEvents(),o}return t.prototype.componentWillUnmount=function(){this.dragHandler.destroy(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},t.prototype.render=function(){var e=this.props,o=e.x,r=e.y,i=e.direction,a=e.model,s=a.getResizeControlStyle(),l=s.width,u=s.height,p=id(s,["width","height"]);return O("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[O(te,Wn({className:"lf-resize-control-content",x:o,y:r,width:l!=null?l:7,height:u!=null?u:7},p)),O(te,{className:"lf-resize-control-content",x:o,y:r,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},t})(G),ld=(function(n){Gl(t,n);function t(){return n.call(this)||this}return t.prototype.getResizeControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=At(o),a=i.minX,s=i.minY,l=i.maxX,u=i.maxY,p=[{index:U.LEFT_TOP,direction:"nw",x:a,y:s},{index:U.RIGHT_TOP,direction:"ne",x:l,y:s},{index:U.RIGHT_BOTTOM,direction:"se",x:l,y:u},{index:U.LEFT_BOTTOM,direction:"sw",x:a,y:u}];return re(p,function(c){return O(sd,Wn({},c,{model:o,graphModel:r}))})},t.prototype.getResizeOutline=function(){var e=this.props.model,o=e.x,r=e.y,i=e.width,a=e.height,s=e.getResizeOutlineStyle();return O(te,Wn({},s,{x:o,y:r,width:i,height:a}))},t.prototype.render=function(){return O("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},t})(G);function ud(n,t){var e=n.x,o=n.y,r=t.x,i=t.y,a={x:e+(r-e)/2,y:o+(i-o)/2};return a}function Sn(n,t,e){var o=cd(e),r=n.x-t.x,i=n.y-t.y,a=r*Math.cos(o)-i*Math.sin(o)+t.x,s=r*Math.sin(o)+i*Math.cos(o)+t.y;return{x:a,y:s}}function cd(n){return n*Math.PI/180}function pd(n){return n/Math.PI*180}function dd(n,t,e,o,r,i,a,s){r===void 0&&(r=!1),i===void 0&&(i=!1);var l={x:e.x-(n.x-e.x),y:e.y-(n.y-e.y)},u=ud(l,t),p=Sn(t,u,-o),c=Sn(l,u,-o);if(r){var d=Math.abs(p.x-c.x),f=d-a;u.x>p.x?u.x=u.x+f/2:u.x=u.x-f/2}if(i){var h=Math.abs(p.y-c.y),y=h-s;u.y>p.y?u.y=u.y+y/2:u.y=u.y-y/2}if(r||i){var v=Sn(c,u,o),g=v.x-l.x,m=v.y-l.y;u.x=u.x-g,u.y=u.y-m,c=Sn(l,u,-o),p={x:u.x-(c.x-u.x),y:u.y-(c.y-u.y)}}var M=Math.abs(p.x-c.x),T=Math.abs(p.y-c.y);return r&&(M=a),i&&(T=s),{width:M,height:T,center:u}}function fd(n,t,e,o,r,i,a,s,l){s===void 0&&(s=!1),l===void 0&&(l=!1);var u=t.deltaX,p=t.deltaY,c=t.width,d=t.height,f=pd(e),h={x:o,y:r},y={x:i,y:a},v=Sn(h,y,f),g={x:v.x+u,y:v.y+p},m=dd(v,g,y,f,s,l,c,d),M=m.width,T=m.height,w=m.center;return t.width=M*n,t.height=T*n,t.deltaX=(w.x-y.x)*2,t.deltaY=(w.y-y.y)*2,t}var hd=function(n,t,e,o,r,i,a,s,l,u,p){e===void 0&&(e=1),o===void 0&&(o=!1),r===void 0&&(r=!1),i===void 0&&(i=0),p===void 0&&(p=!1);var c=X(t),d=c.deltaX,f=c.deltaY,h=c.width,y=c.height,v=c.PCTResizeInfo;if(v){var g=4,m=0,M=0;switch(n){case U.LEFT_TOP:M=(d*-1-f)/g;break;case U.RIGHT_TOP:M=(d-f)/g;break;case U.RIGHT_BOTTOM:M=(d+f)/g;break;case U.LEFT_BOTTOM:M=(d*-1+f)/g;break}M!==0&&(m=Math.round(M/v.ResizeBasis.basisHeight*1e5)/1e3),v.ResizePCT.widthPCT=Math.max(Math.min(v.ResizePCT.widthPCT+m,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit),v.ResizePCT.heightPCT=Math.max(Math.min(v.ResizePCT.heightPCT+m,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit);var T=Math.round(v.ResizePCT.widthPCT*v.ResizeBasis.basisWidth/100),w=Math.round(v.ResizePCT.heightPCT*v.ResizeBasis.basisHeight/100);switch(n){case U.LEFT_TOP:d=h-T,f=y-w;break;case U.RIGHT_TOP:d=T-h,f=y-w;break;case U.RIGHT_BOTTOM:d=T-h,f=w-y;break;case U.LEFT_BOTTOM:d=h-T,f=w-y;break}return c}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return fd(e,c,i,a,s,l,u,o,r);if(p){var S=h/y,_=0,x=h,A=y;switch(n){case U.LEFT_TOP:_=Math.abs(d)>Math.abs(f)?-d:-f,S>=1?(x=h+_,A=x/S):(A=y+_,x=A*S),c.width=x,c.height=A,c.deltaX=h-x,c.deltaY=y-A;break;case U.RIGHT_TOP:_=Math.abs(d)>Math.abs(f)?d:-f,S>=1?(x=h+_,A=x/S):(A=y-_,x=A*S),c.width=x,c.height=A,c.deltaX=x-h,c.deltaY=y-A;break;case U.RIGHT_BOTTOM:_=Math.abs(d)>Math.abs(f)?d:f,S>=1?(x=h+_,A=x/S):(A=y+_,x=A*S),c.width=x,c.height=A,c.deltaX=x-h,c.deltaY=A-y;break;case U.LEFT_BOTTOM:_=Math.abs(d)>Math.abs(f)?-d:f,S>=1?(x=h-_,A=x/S):(A=y+_,x=A*S),c.width=x,c.height=A,c.deltaX=h-x,c.deltaY=A-y;break}return c}switch(n){case U.LEFT_TOP:c.width=o?h:h-d*e,c.height=r?y:y-f*e;break;case U.RIGHT_TOP:c.width=o?h:h+d*e,c.height=r?y:y-f*e;break;case U.RIGHT_BOTTOM:c.width=o?h:h+d*e,c.height=r?y:y+f*e;break;case U.LEFT_BOTTOM:c.width=o?h:h-d*e,c.height=r?y:y+f*e;break}return c},yd=function(n,t){var e=n.id,o=n.anchors,r=t.getNodeEdges(e);it(r,function(i){if(i.sourceNodeId===e){var a=je(o,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===e){var a=je(o,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},gd=function(n,t,e,o,r,i,a){a.eventCenter.emit(N.NODE_RESIZE,{preData:n,data:t,deltaX:e,deltaY:o,index:r,model:i})},vd=function(n){var t=n.x,e=n.y,o=n.deltaX,r=n.deltaY,i=n.index,a=n.nodeModel,s=n.graphModel,l=n.cancelCallback,u=n.forceProportional,p=u===void 0?!1:u,c=a.r,d=a.rx,f=a.ry,h=a.width,y=a.height,v=a.PCTResizeInfo,g=a.minWidth,m=a.minHeight,M=a.maxWidth,T=a.maxHeight,w=a.rotate,S=a.x,_=a.y,x=g===M,A=m===T,P={width:c||d||h,height:c||f||y,deltaX:o,deltaY:r,PCTResizeInfo:v},I=c||d&&f?1/2:1,B=t,ot=e,$=hd(i,P,I,x,A,w,B,ot,S,_,p);if($.widthM||$.heightT){l==null||l();return}(w%(2*Math.PI)==0||v||B===void 0||ot===void 0)&&($.deltaX=x?0:$.deltaX,$.deltaY=A?0:$.deltaY);var ct=a.getData(),st=a.resize($);ct.x===st.x&&ct.y===st.y||(yd(a,s),gd(ct,st,o,r,i,a,s))},md=100,_d={x:1,y:0};function bd(n,t,e,o,r){for(var i=function(f){if(f<0||f>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:n.x*Math.pow(1-f,3)+3*t.x*f*Math.pow(1-f,2)+3*e.x*Math.pow(f,2)*(1-f)+o.x*Math.pow(f,3),y:n.y*Math.pow(1-f,3)+3*t.y*f*Math.pow(1-f,2)+3*e.y*Math.pow(f,2)*(1-f)+o.y*Math.pow(f,3)}},a=0,s=2,l=o.x,u=o.y,p=o;a=0?o:-o}function qa(n){var t=Math.hypot(n.x,n.y);return{x:n.x/t,y:n.y/t,z:0}}function wd(n){return Od(_d,n)}function Sd(n){return n*(180/Math.PI)}var Ul={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"}},Md={rect:{radius:8},diamond:{radius:8},polygon:{radius:8},polyline:{radius:8},arrow:{strokeLinecap:"round",strokeLinejoin:"round",offset:10,verticalLength:5},snapline:{strokeLinecap:"round",strokeLinejoin:"round",stroke:"#949494",strokeWidth:1},outline:{radius:8,fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},resizeOutline:{radius:8,fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},Td={baseNode:{fill:"#23272e",stroke:"#fefeff"},baseEdge:{stroke:"#fefeff"},rect:{radius:8},diamond:{radius:8},polygon:{radius:8},polyline:{radius:8},nodeText:{color:"#fefeff",overflowMode:"default",fontSize:12,lineHeight:1.2},arrow:{strokeLinecap:"round",strokeLinejoin:"round",offset:10,verticalLength:5},snapline:{strokeLinecap:"round",strokeLinejoin:"round",stroke:"#949494",strokeWidth:1},outline:{radius:8,fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},resizeOutline:{radius:8,fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},Ad={rect:{fill:"#72CBFF",stroke:"#3ABDF9",radius:8},circle:{fill:"#FFE075",stroke:"#F9CE3A",radius:8},ellipse:{fill:"#FFA8A8",stroke:"#FF6B66",radius:8},text:{fill:"#72CBFF",radius:8},diamond:{fill:"#96F7AF",stroke:"#40EF7E",radius:8},polygon:{fill:"#E0A8FF",stroke:"#C271FF",radius:8},polyline:{radius:8},arrow:{strokeLinecap:"round",strokeLinejoin:"round",offset:10,verticalLength:5},snapline:{strokeLinecap:"round",strokeLinejoin:"round",stroke:"#949494",strokeWidth:1},outline:{radius:8,fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},resizeOutline:{radius:8,fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},Kn={colorful:Ad,dark:Td,radius:Md,default:Ul},Pd={background:"#23272e"},Dd={background:"#fefeff"},ai={background:"#ffffff"},Zn={colorful:Dd,dark:Pd,radius:ai,default:ai},Nd={color:"#66676a",thickness:1},Cd={color:"#dadada",thickness:1},si={color:"#acacac",thickness:1},qn={colorful:Cd,dark:Nd,radius:si,default:si},Vl=function(n,t){var e=X(Ul);return t&&(e=Io(e,Kn[t])),n&&(e=Io(e,n)),e},jd=function(n,t){Kn[n]||(Kn[n]=t,Zn[n]=t.background||ai,qn[n]=t.grid||si)},Ld=function(n){delete Kn[n],delete Zn[n],delete qn[n]},kd=function(){var n={colorful:{},dark:{},radius:{},default:{}};Z(Kn,n),Z(Zn,n),Z(qn,n)},Id=Vl,Rd=1e3,Xd=999,$n=function(){return++Rd},Bd=function(){return--Xd},at=function(){return at=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},gr=(function(){function n(t,e){var o;this.BaseType=rt.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=jt.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=(o=t.properties)!==null&&o!==void 0?o:{},this.initEdgeData(t),this.setAttributes()}return n.prototype.initEdgeData=function(t){var e=this;if(t.properties||(t.properties={}),!t.id){var o=this.graphModel.idGenerator,r=o&&o(t.type),i=this.createId();t.id=i||r||Ce()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var a=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=a,Z(this,Dp(t));var s=this.graphModel,l=s.overlapMode,u=s.eventCenter;this.updateZIndexByOverlap(l,t.zIndex||$n()),this.setAnchors(),this.initPoints(),this.formatText(t),u.on("overlap:change",function(p){var c=p.overlapMode;e.updateZIndexByOverlap(c,e.zIndex||$n())})},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.getEdgeStyle=function(){return at(at({},this.graphModel.theme.baseEdge),this.style)},n.prototype.getAdjustPointStyle=function(){return at({},this.graphModel.theme.edgeAdjust)},n.prototype.getTextStyle=function(){var t=this.graphModel.theme.edgeText;return X(t)},n.prototype.getEdgeAnimationStyle=function(){var t=this.graphModel.theme.edgeAnimation;return X(t)},n.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),o=this.graphModel.theme.arrow,r=this.isAnimation?e.stroke:t.stroke;return at(at(at({},t),{fill:r,stroke:r}),o)},n.prototype.getOutlineStyle=function(){var t=this.graphModel,e=t.theme.outline;return X(e)},n.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(n.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(n.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(n.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),n.prototype.getBeginAnchor=function(t,e,o){var r,i,a=Jr(t);return o&&(r=je(a,function(s){return s.id===o}),r)||a.forEach(function(s){var l=Ya(s,e);(i===void 0||l=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sr=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},$a=(function(n){Hd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.BEZIER_EDGE,r.path="",r.initEdgeData(e),r.setAttributes(),r}return t.prototype.initEdgeData=function(e){this.offset=lr(e,"properties.offset",100),n.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,o=n.prototype.getEdgeStyle.call(this),r=this.properties.style,i=r===void 0?{}:r;return Se(Se(Se({},o),X(e)),X(i))},t.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var e=0,o=0;return this.pointsList.forEach(function(r){var i=r.x,a=r.y;e+=i,o+=a}),{x:e/this.pointsList.length,y:o/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=n.prototype.getData.call(this),o=this.pointsList.map(function(r){var i=r.x,a=r.y;return{x:i,y:a}});return Se(Se({},e),{pointsList:o})},t.prototype.getControls=function(){var e=this.startPoint,o=this.endPoint,r=Ha({start:e,end:o,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return r},t.prototype.getPath=function(e){var o=Sr(e,4),r=o[0],i=o[1],a=o[2],s=o[3];return"M ".concat(r.x," ").concat(r.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(),o=e.sNext,r=e.ePre;this.updatePath(o,r)},t.prototype.updatePath=function(e,o){e=X(e),o=X(o);var r={x:this.startPoint.x,y:this.startPoint.y},i={x:this.endPoint.x,y:this.endPoint.y};if(!e||!o){var a=this.getControls();e=a.sNext,o=a.ePre}this.pointsList=[r,e,o,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,o){this.startPoint.x+=e,this.startPoint.y+=o;var r=Sr(this.pointsList,3),i=r[1],a=r[2];i.x+=e,i.y+=o,this.updatePath(i,a)},t.prototype.moveEndPoint=function(e,o){this.endPoint.x+=e,this.endPoint.y+=o;var r=Sr(this.pointsList,3),i=r[1],a=r[2];a.x+=e,a.y+=o,this.updatePath(i,a)},t.prototype.updateAdjustAnchor=function(e,o){var r;o==="sNext"?this.pointsList[1]=e:o==="ePre"&&(this.pointsList[2]=e),this.path=this.getPath(this.pointsList),!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Z({},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 o=e.startPoint,r=e.endPoint,i=e.sourceNode,a=e.targetNode,s=Ha({start:o,end:r,sourceNode:i,targetNode:a,offset:this.offset}),l=s.sNext,u=s.ePre;this.pointsList=[o,l,u,r],this.initPoints()},Nt([E],t.prototype,"offset",void 0),Nt([E],t.prototype,"path",void 0),Nt([b],t.prototype,"initPoints",null),Nt([b],t.prototype,"updatePoints",null),Nt([b],t.prototype,"updateStartPoint",null),Nt([b],t.prototype,"updateEndPoint",null),Nt([b],t.prototype,"moveStartPoint",null),Nt([b],t.prototype,"moveEndPoint",null),Nt([b],t.prototype,"updateAdjustAnchor",null),Nt([b],t.prototype,"getAdjustStart",null),Nt([b],t.prototype,"getAdjustEnd",null),Nt([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t})(gr),zd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),An=function(){return An=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Yd=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ts=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Ud=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;ol)&&(a=l,i=s)}),i},t.prototype.getCrossPoint=function(e,o,r){var i;return e===et.HORIZONTAL?i={x:r.x,y:o.y}:e===et.VERTICAL&&(i={x:o.x,y:r.y}),i},t.prototype.removeCrossPoints=function(e,o,r){var i=r.map(function(g){return g});if(e===1){var a=i[e],s=i[o],l=i[e-1],u=Ia(l,a,this.sourceNode);if(u){var p=Ra(a,s,this.sourceNode);if(p){var c=Xa(a,s,this.sourceNode);c&&(i[e]=c,i.splice(e-1,1),e--,o--)}}else{var d=this.sourceNode.anchors;d.forEach(function(g){if(g.x===l.x&&g.x===a.x||g.y===l.y&&g.y===a.y){var m=Yt(g.x,g.y,a.x,a.y),M=Yt(l.x,l.y,a.x,a.y);m0?this.points=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=ka({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(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,o){this.startPoint.x+=e,this.startPoint.y+=o,this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveEndPoint=function(e,o){this.endPoint.x+=e,this.endPoint.y+=o,this.updatePoints()},t.prototype.updatePointsList=function(e,o){this.pointsList.forEach(function(a){a.x+=e,a.y+=o});var r=this.pointsList[0];this.startPoint=Object.assign({},r);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,o){var r;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,p=this.pointsList,c=p;return u===et.HORIZONTAL?(p[s]={x:i.x,y:i.y+o.y},p[l]={x:a.x,y:a.y+o.y},c=this.pointsList.map(function(d){return d})):u===et.VERTICAL&&(p[s]={x:i.x+o.x,y:i.y},p[l]={x:a.x+o.x,y:a.y},c=this.pointsList.map(function(d){return d})),this.updatePointsAfterDrag(c),this.draggingPointList=c,!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Z({},this.text,this.textPosition)),{start:Z({},p[s]),end:Z({},p[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppend=function(e,o){var r;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,p=this.pointsList;if(u===et.HORIZONTAL){p[s]={x:i.x,y:i.y+o.y},p[l]={x:a.x,y:a.y+o.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,y:i.y+o.y},f=ce(d,this.sourceNode);if(!f){var h=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,h,c)}}if(l===this.pointsList.length-1){var y={x:a.x,y:a.y+o.y},f=ce(y,this.targetNode);if(!f){var h=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",y,h,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}else if(u===et.VERTICAL){p[s]={x:i.x+o.x,y:i.y},p[l]={x:a.x+o.x,y:a.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+o.x,y:i.y},f=ce(d,this.sourceNode);if(!f){var h=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,h,c)}}if(l===this.pointsList.length-1){var y={x:a.x+o.x,y:a.y},f=ce(y,this.targetNode);if(!f){var h=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",y,h,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}return!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Z({},this.text,this.textPosition)),{start:Z({},p[s]),end:Z({},p[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppendEnd=function(){if(this.draggingPointList){var e=Ll(ke(this.points));this.pointsList=e.map(function(i){return i}),this.draggingPointList=[];var o=e[0];this.startPoint=Z({},o);var r=e[e.length-1];this.endPoint=Z({},r)}this.isDragging=!1},t.prototype.updatePointsAfterDrag=function(e){var o=this.updateCrossPoints(e);this.points=o.map(function(r){return"".concat(r.x,",").concat(r.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 o=e.startPoint,r=e.endPoint,i=e.sourceNode,a=e.targetNode;this.pointsList=ka({x:o.x,y:o.y},{x:r.x,y:r.y},i,a,this.offset||0),this.initPoints()},ht([E],t.prototype,"offset",void 0),ht([E],t.prototype,"dbClickPosition",void 0),ht([b],t.prototype,"initPoints",null),ht([b],t.prototype,"updatePoints",null),ht([b],t.prototype,"updateStartPoint",null),ht([b],t.prototype,"moveStartPoint",null),ht([b],t.prototype,"updateEndPoint",null),ht([b],t.prototype,"moveEndPoint",null),ht([b],t.prototype,"updatePointsList",null),ht([b],t.prototype,"dragAppendStart",null),ht([b],t.prototype,"dragAppendSimple",null),ht([b],t.prototype,"dragAppend",null),ht([b],t.prototype,"dragAppendEnd",null),ht([b],t.prototype,"updatePointsAfterDrag",null),ht([b],t.prototype,"getAdjustStart",null),ht([b],t.prototype,"getAdjustEnd",null),ht([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t})(gr),ut=function(){return ut=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ns=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],o=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Vd=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Ee=(function(){function n(t,e){var o;this.BaseType=rt.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=jt.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=(o=t.properties)!==null&&o!==void 0?o:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this,o=e.x,r=o===void 0?0:o,i=e.y,a=i===void 0?0:i;this.transform=new qo(-r,-a).rotate(t).translate(r,a).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),n.prototype.initNodeData=function(t){var e=this;if(t.properties||(t.properties={}),!t.id){var o=this.graphModel.idGenerator,r=o&&o(t.type),i=this.createId();t.id=i||r||Ce()}this.formatText(t),Z(this,zp(t));var a=this.graphModel,s=a.overlapMode,l=a.eventCenter;this.updateZIndexByOverlap(s,t.zIndex||$n()),l.on("overlap:change",function(u){var p=u.overlapMode;e.updateZIndexByOverlap(p,e.zIndex||$n())})},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.setTextMode=function(t){this.textMode=t},n.prototype.formatText=function(t){var e,o,r,i=this.graphModel.editConfigModel,a=i.nodeTextDraggable,s=i.nodeTextEdit,l=t.x,u=t.y,p=t.text,c={value:"",x:l,y:u,draggable:a,editable:s};p&&(typeof p=="string"?c.value=p:(c=ut(ut({},c),{x:(e=p.x)!==null&&e!==void 0?e:l,y:(o=p.y)!==null&&o!==void 0?o:u,value:(r=p.value)!==null&&r!==void 0?r:""}),qe(p.draggable)||(c.draggable=p.draggable),qe(p.editable)||(c.editable=p.editable))),t.text=c},n.prototype.resize=function(t){var e=t.width,o=t.height,r=t.deltaX,i=t.deltaY,a=this.isAllowResizeNode(r,i,e,o);return a?(this.move(r/2,i/2),this.width=e,this.height=o,this.setProperties({width:e,height:o}),this.getData()):this.getData()},n.prototype.proportionalResize=function(){},n.prototype.getData=function(){var t=this.text,e=t.x,o=t.y,r=t.value,i=this.properties;rn(i)&&(i=qt(i)),vt(i.width)&&(i.width=this.width),vt(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),[ft.INCREASE,ft.STATIC].includes(this.graphModel.overlapMode)&&(a.zIndex=this.zIndex),r&&(a.text={x:e,y:o,value:r}),a},n.prototype.getHistoryData=function(){return this.getData()},n.prototype.getProperties=function(){return qt(this.properties)},n.prototype.getOuterGAttributes=function(){return{className:""}},n.prototype.getNodeStyle=function(){return ut(ut({},this.graphModel.theme.baseNode),this.style)},n.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,o=e===void 0?{}:e;return ut(ut({},X(t)),X(o))},n.prototype.getRotateControlStyle=function(){var t=this.graphModel.theme.rotateControl;return X(t)},n.prototype.getResizeControlStyle=function(){var t=this.graphModel.theme.resizeControl;return X(t)},n.prototype.getResizeOutlineStyle=function(){var t=this.graphModel.theme.resizeOutline;return X(t)},n.prototype.getAnchorStyle=function(t){var e=this.graphModel.theme.anchor;return X(e)},n.prototype.getAnchorLineStyle=function(t){var e=this.graphModel.theme.anchorLine;return X(e)},n.prototype.getOutlineStyle=function(){var t=this.graphModel.theme.outline;return X(t)},n.prototype.isAllowConnectedAsSource=function(t,e,o,r){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(o,"_").concat(s),x:r+a[0],y:i+a[1]}):(a=a,ut(ut({},a),{x:r+a.x,y:i+a.y,id:a.id||"".concat(o,"_").concat(s)}))}):this.getDefaultAnchor()},n.prototype.getDefaultAnchor=function(){return[]},n.prototype.getTargetAnchor=function(t){return Xp(t,this)},n.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(n.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,o=e.x,r=e.y,i=e.rotate;return t.forEach(function(a){var s=a.x,l=a.y,u=Vd(new ro([s,l,1]).translate(-o,-r).rotate(i).translate(o,r)[0],2),p=u[0],c=u[1];a.x=p,a.y=c}),t},enumerable:!1,configurable:!0}),n.prototype.getAnchorInfo=function(t){if(!vt(t))for(var e=0;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},os=(function(n){Fd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.CIRCLE_NODE,r.r=50,r.initNodeData(e),r.setAttributes(),r}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(){n.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.circle,r=this.properties.style,i=r===void 0?{}:r;return Dn(Dn(Dn({},e),X(o)),X(i))},t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.r;return[{x:o,y:r-i,id:"".concat(this.id,"_0")},{x:o+i,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+i,id:"".concat(this.id,"_2")},{x:o-i,y:r,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var o=e.width,r=e.deltaX,i=e.deltaY;return this.move(r/2,i/2),this.r=o,this.setProperties({r:o}),this.getData()},Mr([E],t.prototype,"r",void 0),Mr([Q],t.prototype,"width",null),Mr([Q],t.prototype,"height",null),t})(Ee),Wd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Nn=function(){return Nn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},bo=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},rs=(function(n){Wd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.DIAMOND_NODE,r.rx=30,r.ry=50,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.rx,r=e.ry;o&&(this.rx=o),r&&(this.ry=r)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.diamond,r=this.properties.style,i=r===void 0?{}:r;return Nn(Nn(Nn({},e),X(o)),X(i))},Object.defineProperty(t.prototype,"points",{get:function(){var e=this,o=e.x,r=e.y,i=e.rx,a=e.ry;return[[o,r-a],[o+i,r],[o,r+a],[o-i,r]]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointsPosition",{get:function(){return re(this.points,function(e){var o=bo(e,2),r=o[0],i=o[1];return{x:r,y:i}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return it(this.points,function(r){var i=bo(r,1),a=i[0];ao&&(o=a)}),o-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return it(this.points,function(r){var i=bo(r,2),a=i[1];ao&&(o=a)}),o-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this;return re(this.points,function(o,r){var i=bo(o,2),a=i[0],s=i[1];return{x:a,y:s,id:"".concat(e.id,"_").concat(r)}})},t.prototype.resize=function(e){var o=e.width,r=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=o,this.ry=r,this.setProperties({rx:o,ry:r}),this.getData()},ze([E],t.prototype,"rx",void 0),ze([E],t.prototype,"ry",void 0),ze([Q],t.prototype,"points",null),ze([Q],t.prototype,"pointsPosition",null),ze([Q],t.prototype,"width",null),ze([Q],t.prototype,"height",null),t})(Ee),Kd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Cn=function(){return Cn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},is=(function(n){Kd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.ELLIPSE_NODE,r.rx=30,r.ry=45,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.rx,r=e.ry;o&&(this.rx=o),r&&(this.ry=r)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.ellipse,r=this.properties.style,i=r===void 0?{}:r;return Cn(Cn(Cn({},e),X(o)),X(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,o=e.x,r=e.y,i=e.rx,a=e.ry;return[{x:o,y:r-a,id:"".concat(this.id,"_0")},{x:o+i,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+a,id:"".concat(this.id,"_2")},{x:o-i,y:r,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var o=e.width,r=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=o,this.ry=r,this.setProperties({rx:o,ry:r}),this.getData()},xo([E],t.prototype,"rx",void 0),xo([E],t.prototype,"ry",void 0),xo([Q],t.prototype,"width",null),xo([Q],t.prototype,"height",null),t})(Ee),Zd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),jn=function(){return jn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Oo=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},as=(function(n){Zd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.POLYGON_NODE,r.points=[[50,0],[100,50],[50,100],[0,50]],r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.points,r=e.width,i=e.height,a=o||this.points;this.points=jp(a,r,i)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.polygon,r=this.properties.style,i=r===void 0?{}:r;return jn(jn(jn({},e),X(o)),X(i))},Object.defineProperty(t.prototype,"pointsPosition",{get:function(){var e=this,o=e.x,r=e.y,i=e.width,a=e.height;return this.points.map(function(s){return{x:s[0]+o-i/2,y:s[1]+r-a/2}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(r){var i=Oo(r,1),a=i[0];ao&&(o=a)}),o-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(r){var i=Oo(r,2),a=i[1];ao&&(o=a)}),o-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,o=this,r=o.x,i=o.y,a=o.width,s=o.height,l=o.points;return l.map(function(u,p){var c=Oo(u,2),d=c[0],f=c[1];return{x:r+d-a/2,y:i+f-s/2,id:"".concat(e.id,"_").concat(p)}})},t.prototype.resize=function(e){var o=this,r=e.width,i=e.height,a=e.deltaX,s=e.deltaY;this.move(a/2,s/2);var l=re(this.points,function(u){var p=Oo(u,2),c=p[0],d=p[1];return[c*r/o.width,d*i/o.height]});return this.points=l,this.properties.points=l,this.getData()},Eo([E],t.prototype,"points",void 0),Eo([Q],t.prototype,"pointsPosition",null),Eo([Q],t.prototype,"width",null),Eo([Q],t.prototype,"height",null),t})(Ee),qd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Ln=function(){return Ln=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ss=(function(n){qd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.RECT_NODE,r.radius=0,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.width,r=e.height,i=e.radius,a=this.getNodeStyle().radius;vt(o)||(this.width=o),vt(r)||(this.height=r),vt(i)||(this.radius=i),vt(a)||(this.radius=a)},t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.width,a=e.height;return[{x:o,y:r-a/2,id:"".concat(this.id,"_0")},{x:o+i/2,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+a/2,id:"".concat(this.id,"_2")},{x:o-i/2,y:r,id:"".concat(this.id,"_3")}]},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.rect,r=this.properties.style,i=r===void 0?{}:r;return Ln(Ln(Ln({},e),X(o)),X(i))},$d([E],t.prototype,"radius",void 0),t})(Ee),Jd=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),kn=function(){return kn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Qd=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},tf=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},nf={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},wo=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","snapGrid","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"],of=(function(){function n(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.snapGrid=!1,this.textMode=jt.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=jt.TEXT,this.edgeTextMode=jt.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="",Z(this,this.computeConfig(t))}return n.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);Z(this,e)},n.prototype.computeConfig=function(t){var e=t.isSilentMode,o=t.textDraggable,r=t.textMode,i=t.textEdit,a=t.adjustEdgeStartAndEnd,s={};if(e===!1&&Z(s,this.stagedConfig),e===!0&&e!==this.isSilentMode){var l=Ve(nf,wo);this.stagedConfig=Ve(this,wo),Z(s,l)}qe(i)||Z(s,{nodeTextEdit:i,edgeTextEdit:i}),qe(o)||Z(s,{nodeTextDraggable:o,edgeTextDraggable:o}),r&&Z(s,{nodeTextMode:r,edgeTextMode:r}),kr(a)&&Z(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var u=Ve(t,wo);return Z(s,u)},n.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},n.prototype.getConfig=function(){return Ve(this,wo)},F([E],n.prototype,"isSilentMode",void 0),F([E],n.prototype,"stopZoomGraph",void 0),F([E],n.prototype,"stopMoveGraph",void 0),F([E],n.prototype,"stopScrollGraph",void 0),F([E],n.prototype,"snapGrid",void 0),F([E],n.prototype,"textMode",void 0),F([E],n.prototype,"textEdit",void 0),F([E],n.prototype,"textDraggable",void 0),F([E],n.prototype,"nodeTextEdit",void 0),F([E],n.prototype,"nodeTextDraggable",void 0),F([E],n.prototype,"nodeTextMultiple",void 0),F([E],n.prototype,"nodeTextVertical",void 0),F([E],n.prototype,"nodeTextMode",void 0),F([E],n.prototype,"edgeTextMode",void 0),F([E],n.prototype,"edgeTextEdit",void 0),F([E],n.prototype,"edgeTextDraggable",void 0),F([E],n.prototype,"edgeTextMultiple",void 0),F([E],n.prototype,"edgeTextVertical",void 0),F([E],n.prototype,"hideAnchors",void 0),F([E],n.prototype,"allowRotate",void 0),F([E],n.prototype,"allowResize",void 0),F([E],n.prototype,"hoverOutline",void 0),F([E],n.prototype,"nodeSelectedOutline",void 0),F([E],n.prototype,"adjustNodePosition",void 0),F([E],n.prototype,"autoExpand",void 0),F([E],n.prototype,"adjustEdge",void 0),F([E],n.prototype,"adjustEdgeMiddle",void 0),F([E],n.prototype,"adjustEdgeStartAndEnd",void 0),F([E],n.prototype,"adjustEdgeStart",void 0),F([E],n.prototype,"adjustEdgeEnd",void 0),F([E],n.prototype,"edgeSelectedOutline",void 0),F([b],n.prototype,"updateEditConfig",null),F([b],n.prototype,"updateTextMode",null),n})(),rf="*",af=(function(){function n(){this._events={}}return n.prototype.on=function(t,e,o){var r=this;t==null||t.split(",").forEach(function(i){i=i.trim(),r._events[i]||(r._events[i]=[]),r._events[i].push({callback:e,once:!!o})})},n.prototype.once=function(t,e){var o=this;t==null||t.split(",").forEach(function(r){r=r.trim(),o.on(r,e,!0)})},n.prototype.emit=function(t,e){var o=this;t==null||t.split(",").forEach(function(r){var i=o._events[r]||[],a=o._events[rf]||[],s=function(l){for(var u=l.length,p=0;p=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},uf=(function(n){sf(t,n);function t(e){var o=n.call(this)||this;o.stepScrollX=0,o.stepScrollY=0,o.onDragging=function(s){var l=s.deltaX,u=s.deltaY;o.setState({isDragging:!0});var p=o.props.graphModel,c=p.transformModel,d=p.editConfigModel;d.stopMoveGraph!==!0&&c.translate(l,u)},o.onDragEnd=function(){o.setState({isDragging:!1})},o.zoomHandler=function(s){var l=o.props,u=l.graphModel,p=u.editConfigModel,c=u.transformModel,d=u.gridSize,f=l.graphModel,h=s.deltaX,y=s.deltaY,v=p.stopScrollGraph,g=p.stopZoomGraph;if(!v&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),o.stepScrollX+=h,o.stepScrollY+=y,Math.abs(o.stepScrollX)>=d){var m=o.stepScrollX%d,M=o.stepScrollX-m;c.translate(-M*c.SCALE_X,0),o.stepScrollX=m}if(Math.abs(o.stepScrollY)>=d){var T=o.stepScrollY%d,w=o.stepScrollY-T;c.translate(0,-w*c.SCALE_Y),o.stepScrollY=T}return}if(!g){s.preventDefault();var S=f.getPointByClient({x:s.clientX,y:s.clientY}),_=S.canvasOverlayPosition,x=_.x,A=_.y;c.zoom(s.deltaY<0,[x,A])}},o.clickHandler=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){var u=o.props.graphModel,p=u.selectElements;p.size>0&&u.clearSelectElements(),u.eventCenter.emit(N.BLANK_CLICK,{e:s})}},o.handleContextMenu=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){s.preventDefault();var u=o.props.graphModel,p=u.getPointByClient({x:s.clientX,y:s.clientY});u.eventCenter.emit(N.BLANK_CONTEXTMENU,{e:s,position:p})}},o.mouseDownHandler=function(s){var l=o.props.graphModel,u=l.eventCenter,p=l.editConfigModel,c=l.transformModel.SCALE_X,d=l.gridSize,f=p.adjustEdge,h=p.adjustNodePosition,y=p.stopMoveGraph,v=s.target,g=!f&&!h;(v.getAttribute("name")==="canvas-overlay"||g)&&(y!==!0?(o.stepDrag.setStep(d*c),o.stepDrag.handleMouseDown(s)):u.emit(N.BLANK_MOUSEDOWN,{e:s}),o.clickHandler(s))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter;return o.stepDrag=new ae({onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),o.state={isDragging:!1},o}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=e.getTransformStyle().transform,r=this.props,i=r.children,a=r.dnd,s=this.state.isDragging;return O("svg",ui({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:O("g",{transform:o,children:i})}))},t=lf([Pt],t),t})(G),Fl=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Jn=function(){return Jn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pf=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},cs=(function(n){Fl(t,n);function t(){var e=n.call(this)||this;return e.onDragging=function(o){var r=o.event,i=e.props,a=i.graphModel,s=i.bezierModel,l=i.type,u=a.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,p=u.x,c=u.y;s.updateAdjustAnchor({x:p,y:c},l),a.eventCenter.emit(N.EDGE_ADJUST,{data:s.getData()})},e.onDragEnd=function(){var o=e.props.bezierModel;o.isDragging=!1},e.dragHandler=new ae({onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.render=function(){var e=this,o=this.props.position,r=o.x,i=o.y,a=this.props.bezierModel,s=a.getEdgeStyle().adjustAnchor;return O(un,Jn({className:"lf-bezier-adjust-anchor",x:r,y:i},s,{onMouseDown:function(l){e.dragHandler.handleMouseDown(l)}}))},t})(G),df=(function(n){Fl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getBezierAdjust=function(e,o){var r=e.path,i=e.id,a=Hi(r),s=pf(a,4),l=s[0],u=s[1],p=s[2],c=s[3],d=e.getEdgeStyle().adjustLine,f=[];return f.push(O(ln,Jn({x1:l.x,y1:l.y,x2:u.x,y2:u.y},d))),f.push(O(cs,{position:u,bezierModel:e,graphModel:o,type:"sNext"},"".concat(i,"_ePre"))),f.push(O(ln,Jn({x1:c.x,y1:c.y,x2:p.x,y2:p.y},d))),f.push(O(cs,{position:p,bezierModel:e,graphModel:o,type:"ePre"},"".concat(i,"_sNext"))),f},t.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,o=e.edges,r=[],i=0;i=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},yf=(function(n){ff(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.background;return O("div",{className:"lf-background",children:O("div",{style:au(e)?e:{},className:"lf-background-area"})})},t=hf([Pt],t),t})(G),gf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),vf=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ze=(function(n){gf(t,n);function t(e){var o=n.call(this,e)||this;return o.id=Ce(),o.gridOptions=o.props.graphModel.grid,o}return t.prototype.renderDot=function(){var e=this.gridOptions,o=e.config,r=e.size,i=r===void 0?1:r,a=e.visible,s=o!=null?o:{},l=s.color,u=s.thickness,p=u===void 0?2:u,c=Math.min(Math.max(2,p),i/4),d=a?1:0;return O("g",{fill:l,opacity:d,children:[O("circle",{cx:0,cy:0,r:c/2}),O("circle",{cx:0,cy:i,r:c/2}),O("circle",{cx:i,cy:0,r:c/2}),O("circle",{cx:i,cy:i,r:c/2})]})},t.prototype.renderMesh=function(){var e=this.gridOptions,o=e.config,r=e.size,i=r===void 0?1:r,a=e.visible,s=o!=null?o:{},l=s.color,u=s.thickness,p=u===void 0?1:u,c=Math.min(Math.max(1,p),i/2),d="M 0 0 H ".concat(i," V ").concat(i," H 0 Z"),f=a?1:0;return O("path",{d,stroke:l,strokeWidth:c/2,opacity:f,fill:"transparent"})},t.prototype.render=function(){var e=this.props.graphModel,o=e.transformModel,r=e.grid;this.gridOptions=r;var i=this.gridOptions,a=i.type,s=i.size,l=s===void 0?1:s,u=o.SCALE_X,p=o.SKEW_Y,c=o.SKEW_X,d=o.SCALE_Y,f=o.TRANSLATE_X,h=o.TRANSLATE_Y,y=[u,p,c,d,f,h].join(","),v="matrix(".concat(y,")");return O("div",{className:"lf-grid",children:O("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[O("defs",{children:O("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:v,x:"0",y:"0",width:l,height:l,children:[a==="dot"&&this.renderDot(),a==="mesh"&&this.renderMesh()]})}),O("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},t=vf([Pt],t),t})(G);(function(n){n.defaultProps={size:cp,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function t(e){var o=X(n.defaultProps);return typeof e=="number"?Z(o,{size:e}):typeof e=="boolean"?Z(o,{visible:e}):Z(o,e)}n.getGridOptions=t})(Ze||(Ze={}));var mf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),_f=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},bf=(function(n){mf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=e.getTransformStyle().transform,r=this.props.children;return O("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:O("g",{transform:o,children:r})})},t=_f([Pt],t),t})(G),xf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),de=function(){return de=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Of=(function(n){xf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getNodesOutline=function(){var e=this.props.graphModel,o=e.nodes,r=e.editConfigModel,i=r.hoverOutline,a=r.nodeSelectedOutline,s=[];return o.forEach(function(l){if(l.isHovered||l.isSelected){var u=l.isHovered,p=l.isSelected,c=l.x,d=l.y,f=l.width,h=l.height;if(a&&p||i&&u){var y=l.getOutlineStyle()||{},v={};if(Object.keys(y).forEach(function(m){m!=="hover"&&(v[m]=y[m])}),u){var g=y.hover;v=de(de({},v),g)}s.push(O(te,de({transform:l.transform,className:"lf-outline-node",x:c,y:d,width:f+10,height:h+10},v)))}}}),s},t.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,o=e.edges,r=e.editConfigModel,i=r.edgeSelectedOutline,a=r.hoverOutline,s=[],l=0;l=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Mf=(function(n){wf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.snaplineModel,o=e!=null?e:{},r=o.position,i=o.isShowHorizontal,a=o.isShowVertical,s=e==null?void 0:e.getStyle(),l=r!=null?r:{},u=l.x,p=u===void 0?0:u,c=l.y,d=c===void 0?0:c,f=fe(fe({x1:-1e5,y1:d,x2:1e5,y2:d},s),{stroke:i?s==null?void 0:s.stroke:"none"}),h=fe(fe({x1:p,y1:-1e5,x2:p,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return O("g",{className:"lf-snapline",children:[O(ln,fe({},f)),O(ln,fe({},h))]})},t=Sf([Pt],t),t})(G),Tf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Af=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Pf=(function(n){Tf(t,n);function t(){return n!==null&&n.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,o=e.tool,r=e.graphModel,i=r.textEditElement,a=o.getTools(),s=a.map(function(l){return $e(l,{textEditElement:i,graphModel:r,lf:o.instance})});return o.components=s,s},t.prototype.triggerToolRender=function(){var e=this.props,o=e.tool,r=e.graphModel,i=document.querySelector("#ToolOverlay_".concat(r.flowId)),a=o.getInstance();a.components.forEach(function(s){return s(a,i)}),a.components=[]},t.prototype.render=function(){var e=this.props.graphModel;return O("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(e.flowId),children:this.getTools()})},t=Af([Pt],t),t})(G),Rt=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ye=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Df={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]},Nf=(function(){function n(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 o=e.stopMoveGraph,r=o===void 0?!1:o;this.updateTranslateLimits(r)}return n.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},n.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},n.prototype.HtmlPointToCanvasPoint=function(t){var e=Ye(t,2),o=e[0],r=e[1];return[(o-this.TRANSLATE_X)/this.SCALE_X,(r-this.TRANSLATE_Y)/this.SCALE_Y]},n.prototype.CanvasPointToHtmlPoint=function(t){var e=Ye(t,2),o=e[0],r=e[1];return[o*this.SCALE_X+this.TRANSLATE_X,r*this.SCALE_Y+this.TRANSLATE_Y]},n.prototype.moveCanvasPointByHtml=function(t,e,o){var r=Ye(t,2),i=r[0],a=r[1];return[i+e/this.SCALE_X,a+o/this.SCALE_Y]},n.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},n.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,")")}},n.prototype.zoom=function(t,e){t===void 0&&(t=!1);var o=this.SCALE_X,r=this.SCALE_Y;return typeof t=="number"?(o=t,r=t):t?(o+=this.ZOOM_SIZE,r+=this.ZOOM_SIZE):(o-=this.ZOOM_SIZE,r-=this.ZOOM_SIZE),othis.MAX_SCALE_SIZE?"".concat(this.SCALE_X*100,"%"):(e&&(this.TRANSLATE_X-=(o-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(r-this.SCALE_Y)*e[1]),this.SCALE_X=o,this.SCALE_Y=r,this.emitGraphTransform("zoom"),"".concat(this.SCALE_X*100,"%"))},n.prototype.emitGraphTransform=function(t){this.eventCenter.emit(N.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}})},n.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},n.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")},n.prototype.focusOn=function(t,e,o,r){var i=Ye(this.CanvasPointToHtmlPoint([t,e]),2),a=i[0],s=i[1],l=Ye([o/2-a,r/2-s],2),u=l[0],p=l[1];this.TRANSLATE_X+=u,this.TRANSLATE_Y+=p,this.emitGraphTransform("focusOn")},n.prototype.updateTranslateLimits=function(t){var e;e=Ye(Array.isArray(t)&&t.length===4?t:Df[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},Rt([E],n.prototype,"SCALE_X",void 0),Rt([E],n.prototype,"SKEW_Y",void 0),Rt([E],n.prototype,"SKEW_X",void 0),Rt([E],n.prototype,"SCALE_Y",void 0),Rt([E],n.prototype,"TRANSLATE_X",void 0),Rt([E],n.prototype,"TRANSLATE_Y",void 0),Rt([E],n.prototype,"ZOOM_SIZE",void 0),Rt([b],n.prototype,"zoom",null),Rt([b],n.prototype,"resetZoom",null),Rt([b],n.prototype,"translate",null),Rt([b],n.prototype,"focusOn",null),n})(),Cf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Tr=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},jf=(function(n){Cf(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.parentTransform=o.parentTransform,r}return t.prototype.setParentTransform=function(e){this.parentTransform=e},t.prototype.getCumulativeScale=function(){var e=this.SCALE_X,o=this.SCALE_Y;if(this.parentTransform)if(this.parentTransform instanceof t){var r=this.parentTransform.getCumulativeScale();e*=r.scaleX,o*=r.scaleY}else e*=this.parentTransform.SCALE_X,o*=this.parentTransform.SCALE_Y;return{scaleX:e,scaleY:o}},t.prototype.getCumulativeTranslate=function(){var e=this.TRANSLATE_X,o=this.TRANSLATE_Y;if(this.parentTransform&&this.parentTransform instanceof t){var r=this.parentTransform.getCumulativeScale(),i=r.scaleX,a=r.scaleY;e=i*e,o=a*o}return{translateX:e,translateY:o}},t.prototype.HtmlPointToCanvasPoint=function(e){var o=Tr(e,2),r=o[0],i=o[1],a=this.getCumulativeScale(),s=a.scaleX,l=a.scaleY,u=this.getCumulativeTranslate(),p=u.translateX,c=u.translateY;return[(r-p)/s,(i-c)/l]},t.prototype.CanvasPointToHtmlPoint=function(e){var o=Tr(e,2),r=o[0],i=o[1],a=this.getCumulativeScale(),s=a.scaleX,l=a.scaleY,u=this.getCumulativeTranslate(),p=u.translateX,c=u.translateY;return[r*s+p,i*l+c]},t.prototype.moveCanvasPointByHtml=function(e,o,r){var i=Tr(e,2),a=i[0],s=i[1],l=this.getCumulativeScale(),u=l.scaleX,p=l.scaleY;return[a+o/u,s+r/p]},t.prototype.fixDeltaXY=function(e,o){var r=this.getCumulativeScale(),i=r.scaleX,a=r.scaleY;return[e/i,o/a]},t})(Nf),xt=function(){return xt=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Lf=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],o=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},lt=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Tt=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},If=(function(){function n(t,e){e===void 0&&(e=1),this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t,this.epsilon=e}return n.prototype.getStyle=function(){return Me({},this.graphModel.theme.snapline)},n.prototype.getCenterSnapLine=function(t,e){for(var o=t.x,r=t.y,i=!1,a=!1,s=0;s=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bf=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Hf=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Uf=(function(n){Yf(t,n);function t(){var e=n.call(this)||this;return e.onDragStart=function(o){var r=o.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(N.ANCHOR_DRAGSTART,{data:a,e:r,nodeModel:s}),e.setState({startX:a.x,startY:a.y,endX:a.x,endY:a.y})},e.onDragging=function(o){var r=o.event,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=a.transformModel,p=a.eventCenter,c=a.width,d=a.height,f=a.editConfigModel,h=f.autoExpand,y=f.stopMoveGraph;if(r){var v=r.clientX,g=r.clientY,m=a.getPointByClient({x:v,y:g}),M=m.domOverlayPosition,T=M.x,w=M.y,S=m.canvasOverlayPosition,_=S.x,x=S.y;e.t&&tr(e.t);var A=[],P=10;T<10?A=[P,0]:T+10>c?A=[-P,0]:w<10?A=[0,P]:w+10>d&&(A=[0,-P]),e.setState({endX:_,endY:x,dragging:!0}),e.moveAnchorEnd(_,x),A.length>0&&!y&&h&&(e.t=Hl(function(){var I=Gf(A,2),B=I[0],ot=I[1];u.translate(B,ot);var $=e.state,ct=$.endX,st=$.endY;e.setState({endX:ct-B,endY:st-ot}),e.moveAnchorEnd(ct-B,st-ot)})),p.emit(N.ANCHOR_DRAG,{data:l,e:r,nodeModel:s})}},e.onDragEnd=function(o){var r=o.event;e.t&&tr(e.t);var i=e.checkEnd(r);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(N.ANCHOR_DRAGEND,{data:u,e:r,nodeModel:l,edgeModel:i!=null?i:void 0})},e.checkEnd=function(o){var r,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=l.x,p=l.y,c=l.id,d=e.state,f=d.endX,h=d.endY,y=d.dragging,v=Jo({x:f,y:h},a);if(e.preTargetNode&&e.preTargetNode.state!==W.DEFAULT&&e.preTargetNode.setElementState(W.DEFAULT),!!y&&v&&v.node){var g=v.node,m=v.anchor.id,M="".concat(s.id,"_").concat(g.id,"_").concat(m,"_").concat(c),T=e.sourceRuleResults.get(M)||{},w=T.isAllPass,S=T.msg,_=e.targetRuleResults.get(M)||{},x=_.isAllPass,A=_.msg;if(w&&x){g.setElementState(W.DEFAULT);var P=a.getNodeModelById(v.node.id),I=(r=a.edgeGenerator)===null||r===void 0?void 0:r.call(a,s.getData(),P==null?void 0:P.getData()),B=a.addEdge(Zt(Zt({},I),{sourceNodeId:s.id,sourceAnchorId:c,startPoint:{x:u,y:p},targetNodeId:v.node.id,targetAnchorId:v.anchor.id,endPoint:{x:v.anchor.x,y:v.anchor.y}})),ot=e.props.anchorData;return a.eventCenter.emit(N.ANCHOR_DROP,{data:ot,e:o,nodeModel:s,edgeModel:B}),B}var $=g.getData();return a.eventCenter.emit(N.CONNECTION_NOT_ALLOWED,{data:$,msg:A||S||"不允许添加连线"}),null}},e.sourceRuleResults=new Map,e.targetRuleResults=new Map,e.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},e.dragHandler=new ae({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.getAnchorShape=function(){var e=this.props,o=e.anchorData,r=e.style,i=e.node,a=i.getAnchorShape(o);if(a)return a;var s=o.x,l=o.y,u=Zt(Zt({},r),r==null?void 0:r.hover);return O("g",{children:[O(un,Zt({className:"lf-node-anchor-hover"},u,{x:s,y:l})),O(un,Zt({className:"lf-node-anchor"},r,{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,o=e.graphModel,r=o.getAnchorIncomingEdge,i=o.getAnchorOutgoingEdge,a=e.anchorData.id;return{incomingEdgeList:r(a),outgoingEdgeList:i(a)}},enumerable:!1,configurable:!0}),t.prototype.moveAnchorEnd=function(e,o){var r,i,a=this.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData,p=Jo({x:e,y:o},s);if(p){var c=p.node,d=p.anchor.id;if(this.preTargetNode&&this.preTargetNode!==p.node&&this.preTargetNode.setElementState(W.DEFAULT),u.id===d)return;this.preTargetNode=c;var f="".concat(l.id,"_").concat(c.id,"_").concat(d,"_").concat(u.id);if(!this.targetRuleResults.has(f)){var h=p.anchor,y=l.isAllowConnectedAsSource(c,u,h),v=c.isAllowConnectedAsTarget(l,u,h);this.sourceRuleResults.set(f,Qo(y)),this.targetRuleResults.set(f,Qo(v))}var g=((r=this.sourceRuleResults.get(f))!==null&&r!==void 0?r:{}).isAllPass,m=((i=this.targetRuleResults.get(f))!==null&&i!==void 0?i:{}).isAllPass;g&&m?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,o=e.startX,r=e.startY,i=e.endX,a=e.endY,s=Yt(o,r,i,a);return s>10},t.prototype.render=function(){var e=this,o=this.state,r=o.startX,i=o.startY,a=o.endX,s=o.endY,l=this.props,u=l.anchorData,p=l.edgeStyle,c=l.nodeModel,d=l.graphModel,f=u.edgeAddable;return O("g",{className:"lf-anchor",children:[O("g",{onClick:function(h){h.stopPropagation(),d.eventCenter.emit(N.ANCHOR_CLICK,{data:u,e:h,nodeModel:c})},onMouseDown:function(h){d.eventCenter.emit(N.ANCHOR_MOUSEDOWN,{data:u,e:h,nodeModel:c}),f!==!1&&e.dragHandler.handleMouseDown(h)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(Zt({sourcePoint:{x:r,y:i},targetPoint:{x:a,y:s}},p)):O(ln,Zt({x1:r,y1:i,x2:a,y2:s},p,{"pointer-events":"none"})))]})},t})(G),Vf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),ci=function(){return ci=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Wl=(function(n){qf(t,n);function t(e){var o=n.call(this)||this;o.mouseDownHandler=function(i){var a=o.props,s=a.draggable,l=a.model,u=a.graphModel,p=u.editConfigModel.nodeTextDraggable;(s!=null?s:p)&&(i.stopPropagation(),o.stepperDrag.model=l,o.stepperDrag.handleMouseDown(i))},o.onDragging=function(i){var a=i.deltaX,s=i.deltaY,l=o.props,u=l.model,p=l.graphModel.transformModel;if(a||s){var c=$f(p.fixDeltaXY(a,s),2),d=c[0],f=c[1];u.moveText(d,f)}},o.dbClickHandler=function(){var i=o.props,a=i.editable,s=i.graphModel.eventCenter,l=i.model;a&&l.setElementState(W.TEXT_EDIT),s.emit(N.TEXT_DBCLICK,{data:l.text,model:l})};var r=e.draggable;return o.stepperDrag=new ae({onDragging:o.onDragging,step:1,eventType:"TEXT",isStopPropagation:r}),o}return t.prototype.getShape=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=o.text,s=a.value,l=a.x,u=a.y,p=a.editable,c=a.draggable,d={x:l,y:u,className:"",value:s},f=o.getTextStyle(),h=i.nodeTextDraggable||c;return O(zl,pi({},d,f,{className:Zf({"lf-element-text":p,"lf-text-draggable":!p&&h,"lf-text-disabled":!p&&!h}),model:o}))},t.prototype.render=function(){var e=this.props.model.text;if(e)return O("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},t})(G),Jf=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Bt=function(){return Bt=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Qf=(function(n){Jf(t,n);function t(e){var o=n.call(this,e)||this;return o.setHoverOn=function(){o.setState({isHovered:!0})},o.setHoverOff=function(){o.setState({isHovered:!1})},o.state={isHovered:!1},o}return t.prototype.getBackground=function(){var e=this.state.isHovered,o=this.props.model,r=o.text,i=o.getTextStyle(),a=i.background||{};if(e&&i.hover&&i.hover.background&&(a=Bt(Bt({},a),i.hover.background)),r!=null&&r.value&&(a==null?void 0:a.fill)!=="transparent"){var s=i.fontSize,l=i.textWidth,u=i.lineHeight,p=i.overflowMode,c=a.wrapPadding,d=r==null?void 0:r.value.split(/[\r\n]/g),f=d.length,h=r.x,y=r.y,v={};if(p==="autoWrap"&&l){var g=Bl({rows:d,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:u,padding:c},rowsLength:f,className:"lf-get-text-height"});v=Bt(Bt({},a),{x:h,y,width:l,height:g})}else{var m=Cp({rows:d,rowsLength:f,fontSize:s}),M=m.width,T=m.height;if(p==="ellipsis"&&(M=l,T=s+2),typeof a.wrapPadding=="string"){var w=a.wrapPadding.split(",").filter(function(wt){return wt.trim()}).map(function(wt){return parseFloat(wt.trim())});if(w.length>0&&w.length<=4){if(w.length===1){var S=So(w,1),_=S[0];w=[_,_,_,_]}else if(w.length===2){var x=So(w,2),A=x[0],P=x[1];w=[A,P,A,P]}else if(w.length===3){var I=So(w,3),B=I[0],P=I[1],ot=I[2];w=[B,P,ot,P]}var $=So(w,4),ct=$[0],st=$[1],pt=$[2],bt=$[3];M+=st+bt,T+=ct+pt,h=h+(st-bt)/2,y=y+(pt-ct)/2}}v=Bt(Bt({},a),{x:h-1,y:y-1,width:M,height:T})}return O(te,Bt({},v))}return null},t.prototype.getShape=function(){var e=this.props.model,o=e.text,r=o.x,i=o.y,a=o.value;if(!a)return null;var s=e.getTextStyle(),l=Bt({x:r,y:i,value:a,model:e,className:"lf-element-text"},s);return O("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),O(zl,Bt({},l))]})},t})(Wl),th=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),nr=function(){return nr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Oe=(function(n){th(t,n);function t(e){var o=n.call(this)||this;o.onDragStart=function(l){var u=l.event,p=o.props,c=p.model,d=p.graphModel;if(u){var f=d.getPointByClient({x:u.clientX,y:u.clientY}).canvasOverlayPosition,h=f.x,y=f.y;o.moveOffset={dx:c.x-h,dy:c.y-y}}},o.onDragging=function(l){var u,p,c,d,f=l.event,h=o.props,y=h.model,v=h.graphModel,g=v.editConfigModel,m=g.stopMoveGraph,M=g.autoExpand,T=g.snapGrid,w=v.transformModel,S=v.selectNodes,_=v.width,x=v.height,A=v.gridSize;y.isDragging=!0;var P=f,I=P.clientX,B=P.clientY,ot=o.mouseDownPosition,$=ot.x,ct=ot.y;(I-$>A||B-ct>A)&&(y.isDragging=!0);var st=v.getPointByClient({x:I,y:B}).canvasOverlayPosition,pt=st.x,bt=st.y,wt=Mo(w.CanvasPointToHtmlPoint([pt,bt]),2),kt=wt[0],R=wt[1];if(pt=pt+((p=(u=o.moveOffset)===null||u===void 0?void 0:u.dx)!==null&&p!==void 0?p:0),bt=bt+((d=(c=o.moveOffset)===null||c===void 0?void 0:c.dy)!==null&&d!==void 0?d:0),pt=sn(pt,A,T),bt=sn(bt,A,T),!_||!x){v.moveNode2Coordinate(y.id,pt,bt);return}var V=kt<0||R<0||kt>_||R>x;if(!(M&&!m&&V)){var J=Mo(w.CanvasPointToHtmlPoint([pt-y.width/2,bt-y.height/2]),2),Y=J[0],nt=J[1],Dt=Mo(w.CanvasPointToHtmlPoint([pt+y.width/2,bt+y.height/2]),2),tt=Dt[0],dt=Dt[1],It=Math.max(A,20),Ot=[];Y<0?Ot=[It,0]:tt>v.width?Ot=[-It,0]:nt<0?Ot=[0,It]:dt>v.height&&(Ot=[0,-It]),o.t&&tr(o.t);var Ie=S.map(function(Re){return Re.id});Ie.indexOf(y.id)===-1&&(Ie=[y.id]),Ot.length>0&&!m&&M?o.t=Hl(function(){var Re=Mo(Ot,2),io=Re[0],ao=Re[1];w.translate(io!=null?io:0,ao!=null?ao:0);var Jl=-(io!=null?io:0)/w.SCALE_X,Ql=-(ao!=null?ao:0)/w.SCALE_X;v.moveNodes(Ie,Jl,Ql)}):v.moveNodes(Ie,pt-y.x,bt-y.y)}},o.onDragEnd=function(){o.t&&tr(o.t);var l=o.props.model;l.isDragging=!1},o.onMouseOut=function(l){lp()&&o.setHoverOff(l)},o.handleMouseUp=function(){var l=o.props.model;o.mouseUpDrag=l.isDragging},o.handleClick=function(l){var u=o.mouseUpDrag===!1,p=new Date().getTime();if(o.startTime){var c=p-o.startTime,d=o.props,f=d.model,h=d.graphModel;if(!(!u&&c>300)){u||(o.onDragEnd(),o.handleMouseUp());var y=f.getData(),v=h.getPointByClient({x:l.clientX,y:l.clientY}),g={data:y,e:l,position:v,isSelected:!1,isMultiple:!1},m=l.button===2,M=l.detail===2;if(!m){var T=h.editConfigModel,w=Rl(l,T);if(g.isMultiple=w,f.isSelected&&!M&&w?(g.isSelected=!1,f.setSelected(!1)):(h.selectNodeById(f.id,w),g.isSelected=!0,T.isSilentMode||o.toFront()),M)T.nodeTextEdit&&f.text.editable&&T.textMode===jt.TEXT&&(f.setSelected(!1),h.setElementStateById(f.id,W.TEXT_EDIT)),h.eventCenter.emit(N.NODE_DBCLICK,g);else{h.eventCenter.emit(N.ELEMENT_CLICK,g),h.eventCenter.emit(N.NODE_CLICK,g);var S=l.currentTarget,_=!vt(window)&&Ls(window.requestAnimationFrame)?window.requestAnimationFrame.bind(window):function(x){return setTimeout(x,0)};_(function(){S.focus()})}}}}},o.handleContextMenu=function(l){l.preventDefault();var u=o.props,p=u.model,c=u.graphModel,d=c.editConfigModel,f=p.getData(),h=c.getPointByClient({x:l.clientX,y:l.clientY});c.setElementStateById(p.id,W.SHOW_MENU,h.domOverlayPosition),p.isSelected||c.selectNodeById(p.id),c.eventCenter.emit(N.NODE_CONTEXTMENU,{data:f,e:l,position:h}),d.isSilentMode||o.toFront()},o.handleMouseDown=function(l){var u=o.props,p=u.model,c=u.graphModel;o.mouseDownPosition={x:l.clientX,y:l.clientY},o.startTime=new Date().getTime();var d=c.editConfigModel;d.adjustNodePosition&&p.draggable&&o.stepDrag&&o.stepDrag.handleMouseDown(l)},o.handleFocus=function(){var l=o.props,u=l.model,p=l.graphModel;p.eventCenter.emit(N.NODE_FOCUS,{data:u.getData()})},o.handleBlur=function(){if(o.props){var l=o.props,u=l.model,p=l.graphModel;p.eventCenter.emit(N.NODE_BLUR,{data:u.getData()})}},o.setHoverOn=function(l){var u=o.props,p=u.model,c=u.graphModel;if(!p.isHovered){var d=p.getData();p.setHovered(!0),c.eventCenter.emit(N.NODE_MOUSEENTER,{data:d,e:l})}},o.setHoverOff=function(l){var u=o.props,p=u.model,c=u.graphModel,d=p.getData();p.isHovered&&(p.setHovered(!1),c.eventCenter.emit(N.NODE_MOUSELEAVE,{data:d,e:l}))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter,s=e.model;return o.stepDrag=new ae({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),o.modelDisposer=pl(function(){return o.props},function(l){l&&l.model&&o.stepDrag.setModel(l.model)}),o}return t.prototype.componentWillUnmount=function(){this.modelDisposer&&this.modelDisposer(),this.render.$mobx&&this.render.$mobx.dispose()},t.prototype.componentDidMount=function(){},t.prototype.componentDidUpdate=function(){},t.prototype.getAnchorShape=function(e){return null},t.prototype.getAnchors=function(){var e=this,o=this.props,r=o.model,i=o.graphModel,a=r.isSelected,s=r.isHitable,l=r.isDragging,u=r.isShowAnchor;return s&&(a||u)&&!l?re(r.anchors,function(p,c){var d=r.getAnchorLineStyle(p),f=r.getAnchorStyle(p);return O(Uf,{anchorData:p,node:e,style:f,edgeStyle:d,anchorIndex:c,nodeModel:r,graphModel:i,setHoverOff:e.setHoverOff})}):[]},t.prototype.getRotateControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.isSilentMode,s=i.allowRotate,l=o.isSelected,u=o.isHitable,p=o.rotatable,c=o.isHovered,d=s&&p,f=o.getRotateControlStyle();if(!a&&u&&(l||c)&&d)return O(Ff,{graphModel:r,nodeModel:o,eventCenter:r.eventCenter,style:f})},t.prototype.getResizeControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.isSilentMode,s=i.allowResize,l=o.isSelected,u=o.isHitable,p=o.resizable,c=o.isHovered,d=s&&p,f=o.getResizeControlStyle();return!a&&u&&(l||c)&&d?O(ld,{style:f,model:o,graphModel:r}):null},t.prototype.getText=function(){var e,o=this.props,r=o.model,i=o.graphModel,a=i.editConfigModel;if(a.nodeTextMode!==jt.TEXT||r.state===W.TEXT_EDIT)return null;if(r.text){var s=!1;return a.nodeTextDraggable&&r.text.draggable&&(s=!0),O(Wl,{editable:a.nodeTextEdit&&((e=r.text.editable)!==null&&e!==void 0?e:!0),model:r,graphModel:i,draggable:s})}return null},t.prototype.getStateClassName=function(){var e=this.props.model,o=e.state,r=e.isDragging,i=e.isSelected,a="lf-node";switch(o){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 r&&(a+=" lf-dragging"),i&&(a+=" lf-node-selected"),a},t.prototype.toFront=function(){var e=this.props,o=e.model,r=e.graphModel;o.autoToFront&&r.toFront(o.id)},t.prototype.render=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.hideAnchors,s=i.adjustNodePosition,l=i.allowRotate,u=i.allowResize,p=r.gridSize,c=r.transformModel.SCALE_X,d=o.isHitable,f=o.draggable,h=o.transform,y=o.getOuterGAttributes(),v=y.className,g=v===void 0?"":v,m=eh(y,["className"]),M=O("g",{className:"lf-node-content",children:[O("g",{transform:h,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),u&&this.getResizeControl()]}),!a&&this.getAnchors()]}),T;return d?(s&&f&&this.stepDrag.setStep(p*c),T=O("g",nr({className:"".concat(this.getStateClassName()," ").concat(g),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},m,{children:M}))):T=O("g",nr({className:"".concat(this.getStateClassName()," ").concat(g)},m,{children:M})),T},t.isObserved=!1,t})(G),nh=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),di=function(){return di=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ch=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Jt;(function(n){n.SOURCE="SOURCE",n.TARGET="TARGET"})(Jt||(Jt={}));var _s=(function(n){ph(t,n);function t(e){var o=n.call(this)||this;o.handleMouseDown=function(l){o.stepDrag&&o.stepDrag.handleMouseDown(l)},o.onDragStart=function(){var l=o.props,u=l.x,p=l.y,c=l.edgeModel,d=c.startPoint,f=c.endPoint,h=c.pointsList;o.oldEdge={startPoint:d,endPoint:f,pointsList:h},o.setState({endX:u,endY:p,dragging:!0})},o.onDragging=function(l){var u=l.deltaX,p=l.deltaY,c=o.state,d=c.endX,f=c.endY,h=o.props,y=h.graphModel,v=h.type,g=y.transformModel,m=y.editConfigModel,M=fh(g.moveCanvasPointByHtml([d,f],u,p),2),T=M[0],w=M[1];o.setState({endX:T,endY:w,dragging:!0});var S=o.props.edgeModel,_=Jo({x:d,y:f},y);if(_&&_.node&&o.isAllowAdjust(_).pass){var x=S.startPoint,A=S.endPoint,P=S.sourceNode,I=S.targetNode,B=v===Jt.SOURCE?{startPoint:{x:_.anchor.x,y:_.anchor.y},endPoint:{x:A.x,y:A.y},sourceNode:_.node,targetNode:I}:{startPoint:{x:x.x,y:x.y},endPoint:{x:_.anchor.x,y:_.anchor.y},sourceNode:P,targetNode:_.node};S.updateAfterAdjustStartAndEnd(B)}else v===Jt.SOURCE?S.updateStartPoint({x:T,y:w}):S.updateEndPoint({x:T,y:w});S.text.value&&m.adjustEdge&&S.setText(Object.assign({},S.text,S.textPosition))},o.onDragEnd=function(l){var u,p,c,d=l.event;try{o.setState({dragging:!1});var f=o.props,h=f.graphModel,y=f.edgeModel,v=f.type,g=o.state,m=g.endX,M=g.endY,T=g.dragging,w=Jo({x:m,y:M},h);if(!T)return;var S=!1,_=void 0;if(w&&w.node){var x=o.isAllowAdjust(w),A=x.pass,P=x.msg,I=x.newTargetNode;if(A){var B=y.getData(),ot=B.text,$=B.sourceAnchorId,ct=$===void 0?"":$,st=B.targetAnchorId,pt=st===void 0?"":st,bt=dh(B,["text","sourceAnchorId","targetAnchorId"]);if(_=Ht(Ht({sourceAnchorId:ct,targetAnchorId:pt},bt),{text:(ot==null?void 0:ot.value)||""}),v===Jt.SOURCE){var wt=h.getNodeModelById(w.node.id),kt=h.getNodeModelById(y.targetNodeId),R=(u=h.edgeGenerator)===null||u===void 0?void 0:u.call(h,wt==null?void 0:wt.getData(),kt==null?void 0:kt.getData(),_);_=Ht(Ht({},R),{sourceNodeId:w.node.id,sourceAnchorId:w.anchor.id,startPoint:{x:w.anchor.x,y:w.anchor.y},targetNodeId:y.targetNodeId,endPoint:Ht({},y.endPoint)}),y.sourceNodeId===w.node.id&&y.sourceAnchorId===w.anchor.id&&(S=!0)}else if(v===Jt.TARGET){var wt=h.getNodeModelById(y.sourceNodeId),kt=h.getNodeModelById(w.node.id),R=(p=h.edgeGenerator)===null||p===void 0?void 0:p.call(h,wt==null?void 0:wt.getData(),kt==null?void 0:kt.getData(),_);_=Ht(Ht({},R),{sourceNodeId:y.sourceNodeId,startPoint:Ht({},y.startPoint),targetNodeId:w.node.id,targetAnchorId:w.anchor.id,endPoint:{x:w.anchor.x,y:w.anchor.y}}),y.targetNodeId===w.node.id&&y.targetAnchorId===w.anchor.id&&(S=!0)}}else{S=!0;var V=I.getData();h.eventCenter.emit(N.CONNECTION_NOT_ALLOWED,{data:V,msg:P})}}else S=!0;if(S)o.recoveryEdge();else{var J=y.getData();h.deleteEdgeById(y.id);var Y=h.addEdge(Ht({},_));h.eventCenter.emit(N.EDGE_EXCHANGE_NODE,{data:{newEdge:Y.getData(),oldEdge:J}})}(c=o.preTargetNode)===null||c===void 0||c.setElementState(W.DEFAULT)}finally{var h=o.props.graphModel;h.eventCenter.emit(N.ADJUST_POINT_DRAGEND,{e:d,data:o.stepDragData})}},o.recoveryEdge=function(){var l=o.props.edgeModel,u=o.oldEdge,p=u.startPoint,c=u.endPoint,d=u.pointsList;l.updateStartPoint(p),l.updateEndPoint(c),l.modelType!==z.LINE_EDGE&&(l.pointsList=d!=null?d:[],l.initPoints())},o.getAdjustPointStyle=function(){var l=o.props.graphModel.theme,u=l.edgeAdjust;return u},o.state={dragging:!1,endX:0,endY:0},o.targetRuleResults=new Map,o.sourceRuleResults=new Map;var r=e.type,i=e.edgeModel,a=e.graphModel,s=a.eventCenter;return o.stepDragData={type:r,edgeData:i.getData()},o.stepDrag=new ae({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,eventType:"ADJUST_POINT",isStopPropagation:!1,eventCenter:s,data:o.stepDragData}),o}return t.prototype.isAllowAdjust=function(e){var o=this.props,r=o.edgeModel,i=r.id,a=r.sourceNode,s=r.targetNode,l=r.sourceAnchorId,u=r.targetAnchorId,p=o.type,c,d,f,h;if(p===Jt.SOURCE?(c=e.node,d=s,f=e.anchor,h=s.getAnchorInfo(u)):(c=a,d=e.node,h=e.anchor,f=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==e.node&&this.preTargetNode.setElementState(W.DEFAULT),this.preTargetNode=e.node,h.id===f.id)return{pass:!1,msg:"",newTargetNode:d};var y="".concat(c.id,"_").concat(d.id,"_").concat(f.id,"_").concat(h.id);if(!this.targetRuleResults.has(y)){var v=c.isAllowConnectedAsSource(d,f,h,i),g=d.isAllowConnectedAsTarget(c,f,h,i);this.sourceRuleResults.set(y,Qo(v)),this.targetRuleResults.set(y,Qo(g))}var m=this.sourceRuleResults.get(y),M=m.isAllPass,T=m.msg,w=this.targetRuleResults.get(y),S=w.isAllPass,_=w.msg,x=M&&S?W.ALLOW_CONNECT:W.NOT_ALLOW_CONNECT;return p===Jt.SOURCE?c.setElementState(x):d.setElementState(x),{pass:M&&S,msg:_||T,newTargetNode:d}},t.prototype.render=function(){var e=this.props,o=e.x,r=e.y,i=e.getAdjustPointShape,a=e.edgeModel,s=this.state.dragging;return O("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(o,r,a)})},t})(G),hh=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),mi=function(){return mi=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},vr=(function(n){yh(t,n);function t(){var e=n.call(this)||this;return e.textRef=Si(),e.handleHover=function(o,r){var i=e.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(o);var l=o?N.EDGE_MOUSEENTER:N.EDGE_MOUSELEAVE,u=a.getData();s.emit(l,{data:u,e:r})},e.setHoverOn=function(o){var r=e.props.model.isHovered;r||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOn(),e.handleHover(!0,o))},e.setHoverOff=function(o){var r=e.props.model.isHovered;r&&(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOff(),e.handleHover(!1,o))},e.handleContextMenu=function(o){o.preventDefault(),e.contextMenuTime=new Date().getTime(),e.clickTimer&&clearTimeout(e.clickTimer);var r=e.props,i=r.model,a=r.graphModel,s=a.editConfigModel,l=a.getPointByClient({x:o.clientX,y:o.clientY});a.setElementStateById(i.id,W.SHOW_MENU,l.domOverlayPosition),s.isSilentMode||e.toFront(),i.isSelected||a.selectEdgeById(i.id);var u=i==null?void 0:i.getData();a.eventCenter.emit(N.EDGE_CONTEXTMENU,{data:u,e:o,position:l})},e.handleMouseDown=function(o){o.stopPropagation(),e.startTime=new Date().getTime()},e.handleMouseUp=function(){var o=e.props.model;e.mouseUpDrag=o.isDragging},e.handleClick=function(o){if(e.startTime&&!e.mouseUpDrag){var r=o.button===2;if(!r){var i=o.detail===2,a=e.props,s=a.model,l=a.graphModel,u=s==null?void 0:s.getData(),p=l.getPointByClient({x:o.clientX,y:o.clientY});if(i){var c=l.editConfigModel,d=l.textEditElement,f=s.id,h=s.text,y=s.modelType;if(d&&d.id===f&&l.setElementStateById(f,W.DEFAULT),c.edgeTextEdit&&h.editable&&(s.setSelected(!1),l.setElementStateById(f,W.TEXT_EDIT)),y===z.POLYLINE_EDGE){var v=s,g=l.getPointByClient({x:o.x,y:o.y}).canvasOverlayPosition,m=g.x,M=g.y;v.dbClickPosition=Il({x:m,y:M},v.points)}l.eventCenter.emit(N.EDGE_DBCLICK,{data:u,e:o,position:p})}else{l.eventCenter.emit(N.ELEMENT_CLICK,{data:u,e:o,position:p}),l.eventCenter.emit(N.EDGE_CLICK,{data:u,e:o,position:p});var T=o.currentTarget,w=!vt(window)&&Ls(window.requestAnimationFrame)?window.requestAnimationFrame.bind(window):function(_){return setTimeout(_,0)};w(function(){T.focus()})}var S=l.editConfigModel;l.selectEdgeById(s.id,Rl(o,S)),S.isSilentMode||e.toFront()}}},e.handleFocus=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(N.EDGE_FOCUS,{data:r.getData()})},e.handleBlur=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(N.EDGE_BLUR,{data:r.getData()})},e}return t.prototype.getShape=function(){return O("g",{children:this.getEdge()})},t.prototype.getTextStyle=function(){},t.prototype.getText=function(){var e,o=this.props,r=o.model,i=o.graphModel,a=i.editConfigModel;if(a.edgeTextMode!==jt.TEXT||r.state===W.TEXT_EDIT)return null;if(r.text){var s=!1;return a.edgeTextDraggable&&r.text.draggable&&(s=!0),O(Qf,{ref:this.textRef,editable:a.edgeTextEdit&&((e=r.text.editable)!==null&&e!==void 0?e:!0),model:r,graphModel:i,draggable:s})}return null},t.prototype.getArrowInfo=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint,i=e.isSelected,a=this.state.hover;return{start:o,end:r,hover:a,isSelected:i}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint;return[o,r]},t.prototype.getArrowStyle=function(){return null},t.prototype.getArrow=function(){var e=this.props.model,o=e.id,r=e.getArrowStyle(),i=r.refY,a=i===void 0?0:i,s=r.refX,l=s===void 0?2:s,u=gh(this.getLastTwoPoints(),2),p=u[0],c=u[1],d="auto";if(p&&c){var f=c.x-p.x,h=c.y-p.y;if(f!==0||h!==0){var y=Sd(wd({x:f,y:h}));Number.isFinite(y)&&!Number.isNaN(y)&&(d=y)}}return O("g",{children:O("defs",{children:[O("marker",{id:"marker-start-".concat(o),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),O("marker",{id:"marker-end-".concat(o),refX:l,refY:a,overflow:"visible",orient:d,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},t.prototype.getArrowPath=function(e,o){var r=o.stroke,i=o.fill,a=i===void 0?r:i,s=o.strokeWidth,l=o.offset,u=l===void 0?10:l,p=o.verticalLength,c=o.strokeLinecap,d=o.strokeLinejoin,f=o.transform,h="";switch(e){case"solid":h="M".concat(-u/4,",0 L").concat(3*u/4,",").concat(p," L").concat(3*u/4,",-").concat(p," Z");break;case"hollow":h="M".concat(-u/4,",0 L").concat(3*u/4,",").concat(p," L").concat(-u/4,",0 L").concat(3*u/4,",-").concat(p," L").concat(-u/4,",0 Z");break;case"diamond":h="M".concat(-u/2,",0 L0,").concat(p," L").concat(u/2,",0 L0,-").concat(p," L").concat(-u/2,",0 Z");break;case"circle":h="M".concat(-u/2,",0 A").concat(u/4,",").concat(u/4," 0 1,0 ").concat(u/2,",0 A").concat(u/4,",").concat(u/4," 0 1,0 ").concat(-u/2,",0 Z");break;default:h="";break}return O("path",{d:h,stroke:r,fill:a,strokeWidth:s,strokeLinecap:c,strokeLinejoin:d,transform:f})},t.prototype.getStartArrow=function(){var e=this.props.model,o=e.getArrowStyle(),r=o.stroke,i=o.strokeWidth,a=o.offset,s=o.verticalLength,l=o.startArrowType,u=l===void 0?"none":l,p=o.strokeLinecap,c=o.strokeLinejoin;return this.getArrowPath(u,{stroke:r,strokeWidth:i,offset:a,verticalLength:s,strokeLinecap:p,strokeLinejoin:c})},t.prototype.getEndArrow=function(){var e=this.props.model,o=e.getArrowStyle(),r=o.stroke,i=o.strokeWidth,a=o.offset,s=o.verticalLength,l=o.endArrowType,u=l===void 0?"solid":l,p=o.strokeLinecap,c=o.strokeLinejoin;return this.getArrowPath(u,{stroke:r,strokeWidth:i,offset:a,verticalLength:s,strokeLinecap:p,strokeLinejoin:c,transform:"rotate(180)"})},t.prototype.getAdjustPointShape=function(e,o,r){var i=r.getAdjustPointStyle();return O(un,Rn({className:"lf-edge-adjust-point"},i,{x:e,y:o}))},t.prototype.getAdjustPoints=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.adjustEdgeStartAndEnd,s=i.adjustEdgeStart,l=i.adjustEdgeEnd,u=o.getAdjustStart(),p=o.getAdjustEnd();return O("g",{children:[a&&s&&O(_s,Rn({type:Jt.SOURCE},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r})),a&&l&&O(_s,Rn({type:Jt.TARGET},p,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r}))]})},t.prototype.getAnimation=function(){},t.prototype.getAppendWidth=function(){return O("g",{})},t.prototype.getAppend=function(){return O("g",{className:"lf-edge-append",children:this.getAppendWidth()})},t.prototype.getEdge=function(){return null},t.prototype.toFront=function(){var e=this.props,o=e.graphModel,r=e.model;o.toFront(r.id)},t.prototype.render=function(){var e=this.props.model,o=e.isSelected,r=e.isHitable,i=e.isShowAdjustPoint;return O("g",{children:[O("g",{className:["lf-edge",!r&&"pointer-none",o&&"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&&o?this.getAdjustPoints():""]})},t.isObserved=!1,t})(G),vh=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),_i=function(){return _i=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},bs=(function(n){vh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,o=e.getEdgeStyle(),r=e,i=r.path,a=r.isAnimation,s=r.arrowConfig,l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,p=l.stroke,c=l.strokeDashoffset,d=l.animationName,f=l.animationDuration,h=l.animationIterationCount,y=l.animationTimingFunction,v=l.animationDirection;return O(Fn,_i({d:i},o,s,a?{strokeDasharray:u,stroke:p,style:{strokeDashoffset:c,animationName:d,animationDuration:f,animationIterationCount:h,animationTimingFunction:y,animationDirection:v}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model.path;return O(Fn,{d:e,strokeWidth:10,stroke:"transparent",fill:"none"})},t.prototype.getArrowInfo=function(){var e=this.props.model,o=this.state.hover,r=e.isSelected,i=e.getArrowStyle().offset,a=e.pointsList.map(function(c){return{x:c.x,y:c.y}}),s=mh(za(a,i),2),l=s[0],u=s[1],p={start:l,end:u,hover:o,isSelected:r};return p},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.getArrowStyle().offset,r=e.pointsList.map(function(i){return{x:i.x,y:i.y}});return za(r,o)},t})(vr),_h=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),bi=function(){return bi=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Es=(function(n){bh(t,n);function t(){var e=n.call(this)||this;return e.onDragStart=function(){var o=e.props.model;o.dragAppendStart(),e.isShowAdjustPointTemp=o.isShowAdjustPoint,o.isShowAdjustPoint=!1},e.onDragging=function(o){var r=o.deltaX,i=o.deltaY,a=e.props,s=a.model,l=a.graphModel;e.isDragging=!0;var u=l.transformModel,p=l.editConfigModel,c=xh(u.fixDeltaXY(r,i),2),d=c[0],f=c[1],h=s,y=p.adjustEdgeMiddle;y?e.appendInfo=h.dragAppendSimple(e.appendInfo,{x:d,y:f}):e.appendInfo=h.dragAppend(e.appendInfo,{x:d,y:f})},e.onDragEnd=function(){var o,r=e.props,i=r.model,a=r.graphModel.eventCenter,s=i;s.dragAppendEnd(),e.isDragging=!1,s.isShowAdjustPoint=(o=e.isShowAdjustPointTemp)!==null&&o!==void 0?o:!1,e.appendInfo=void 0,a.emit(N.EDGE_ADJUST,{data:s.getData()})},e.beforeDragStart=function(o,r){r.draggable&&e.drag.handleMouseDown(o),e.appendInfo=r},e.drag=new ae({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd,isStopPropagation:!1}),e}return t.prototype.getEdge=function(){var e=this.props.model,o=e.points,r=e.isAnimation,i=e.arrowConfig,a=e.getEdgeStyle(),s=e.getEdgeAnimationStyle(),l=s.strokeDasharray,u=s.stroke,p=s.strokeDashoffset,c=s.animationName,d=s.animationDuration,f=s.animationIterationCount,h=s.animationTimingFunction,y=s.animationDirection;return O(rd,Te({points:o},a,i,r?{strokeDasharray:l,stroke:u,style:{strokeDashoffset:p,animationName:c,animationDuration:d,animationIterationCount:f,animationTimingFunction:h,animationDirection:y}}:{}))},t.prototype.getArrowInfo=function(){var e=this.props.model,o=e.points,r=e.isSelected,i=this.state.hover,a=ke(o),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:r}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.points,r=ke(o),i=r[0],a=r[0];return r.length>=2&&(i=r[r.length-2],a=r[r.length-1]),[i,a]},t.prototype.getAppendAttributes=function(e){var o=e.start,r=e.end,i;if(o.x===r.x&&o.y===r.y)i="";else{var a={start:o,end:r,offset:10,verticalLength:5},s=Gn(Te(Te({},a),{type:"start"})),l=Gn(Te(Te({},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 o=this.getAppendAttributes(e),r=o.d,i=o.strokeWidth,a=o.fill,s=o.strokeDasharray,l=o.stroke;return O(Fn,{d:r,fill:a,strokeWidth:i,stroke:l,strokeDasharray:s})},t.prototype.getAppendWidth=function(){for(var e=this,o=this.props,r=o.model,i=o.graphModel,a=r.pointsList,s=r.draggable,l=[],u=a.length,p=function(f){var h="lf-polyline-append",y={start:{x:a[f].x,y:a[f].y},end:{x:a[f+1].x,y:a[f+1].y},startIndex:f,endIndex:f+1,direction:et.HORIZONTAL,draggable:!0},v=O("g",{className:h,children:c.getAppendShape(y)}),g=i.editConfigModel,m=g.adjustEdge,M=g.adjustEdgeMiddle;if(m&&s){var T=y.startIndex,w=y.endIndex,S=M&&(T===0||w===u-1);y.draggable=!S,y.start.x===y.end.x?(y.draggable&&(h+="-ew-resize"),y.direction=et.VERTICAL):y.start.y===y.end.y&&(y.draggable&&(h+="-ns-resize"),y.direction=et.HORIZONTAL),v=O("g",{className:c.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(_){return e.beforeDragStart(_,y)},children:O("g",{className:h,children:c.getAppendShape(y)})})}l.push(v)},c=this,d=0;d=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Mh=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Th=(function(n){wh(t,n);function t(e){var o=n.call(this,e)||this;return o.ref=Si(),o.__prevText={type:"",text:"",id:""},o.keyupHandler=function(r){var i=o.props.graphModel.textEditElement;r.key==="Enter"&&r.altKey&&(i==null||i.setElementState(W.DEFAULT))},o.inputHandler=function(r){var i=r.target.innerText,a=o.props.graphModel.textEditElement;a&&(o.__prevText={type:a.type,text:i.replace(/(\r\n)+$|(\n)+$/,""),id:a.id})},o.keydownHandler=function(r){r.stopPropagation()},o.state={style:{left:0,top:0}},o}return t.getDerivedStateFromProps=function(e){var o,r=e.textEditElement,i=e.graphModel,a=i.transformModel,s=i.theme,l=s.inputText,u;if(r){if(!(!((o=r.text)===null||o===void 0)&&o.value)&&r.BaseType===rt.EDGE){var p=r.text,c=r.textPosition,d=c.x,f=c.y;p.x=d,p.y=f,r.setText(p)}var h={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(r.BaseType===rt.EDGE){var y=s.edgeText,v=y.overflowMode,g=y.lineHeight,m=y.wrapPadding,M=y.textWidth;M&&v==="autoWrap"&&(u=se(se({},h),{width:M,minWidth:M,lineHeight:g,padding:m}))}else if(r.BaseType===rt.NODE){var T=s.nodeText,v=T.overflowMode,g=T.lineHeight,m=T.wrapPadding,M=T.textWidth,w=r.width,S=r.modelType,_=r.textWidth,x=_||M||w;(S!==z.TEXT_NODE&&v==="autoWrap"||S===z.TEXT_NODE&&M)&&(u=se(se({},h),{width:x,minWidth:x,lineHeight:g,padding:m}))}var A=r.text,P=A.x,I=A.y,B=Mh(a.CanvasPointToHtmlPoint([P,I]),2),ot=B[0],$=B[1];return{style:se(se({left:ot,top:$},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 o=this.__prevText,r=o.text,i=o.id;e.updateText(i,r),e.eventCenter.emit(N.TEXT_UPDATE,{data:se({},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 o=document.createRange();o.selectNodeContents(e),o.collapse(!1);var r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(o)}},t.prototype.render=function(){var e,o=this.props.graphModel.textEditElement,r=this.state.style;return o?O("div",{contentEditable:!0,className:"lf-text-input",style:r,ref:this.ref,onKeyUp:this.keyupHandler,onKeyDown:this.keydownHandler,onKeyPress:this.keydownHandler,onInput:this.inputHandler,children:(e=o.text)===null||e===void 0?void 0:e.value},o.id):null},t.toolName="text-edit-tool",t=Sh([Pt],t),t})(G),Ah=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),Ph=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ar=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Dh=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ch=[Th,Nh],jh=(function(){function n(t){var e=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=t,it(Ch,function(i){e.isDisabled(i.toolName)||e.registerTool(i.toolName,i)});var o=t.graphModel,r=o.eventCenter;r.on("".concat(N.GRAPH_TRANSFORM,",").concat(N.NODE_CLICK,",").concat(N.BLANK_CLICK," "),function(){var i,a=o.textEditElement,s=o.editConfigModel,l=s.edgeTextEdit,u=s.nodeTextEdit;(l||u)&&a&&((i=o.textEditElement)===null||i===void 0||i.setElementState(W.DEFAULT))})}return n.prototype.isDisabled=function(t){var e;return((e=this.instance.options.disabledTools)===null||e===void 0?void 0:e.indexOf(t))!==-1},n.prototype.registerTool=function(t,e){this.toolMap.set(t,e)},n.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("禁用失败,不存在名为 ".concat(e," 的工具"))},n.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("不存在名为 ".concat(e," 的工具"))},n.prototype.getTools=function(){return Array.from(this.toolMap.values())},n.prototype.getInstance=function(){return this.instance},n.prototype.destroy=function(){this.toolMap.clear(),this.disabledToolMap.clear()},Pr([E],n.prototype,"toolMap",void 0),Pr([b],n.prototype,"disableTool",null),Pr([b],n.prototype,"enableTool",null),n})();function Lh(n){throw new Error("[mobx-utils] "+n)}function rr(n,t){t===void 0&&(t="Illegal state"),n||Lh(t)}var Kl=function(n){return n&&n!==Object.prototype&&Object.getOwnPropertyNames(n).concat(Kl(Object.getPrototypeOf(n))||[])},kh=function(n){var t=Kl(n),e=t.filter(function(o,r){return t.indexOf(o)===r});return e},Ih=function(n){return kh(n).filter(function(t){return t!=="constructor"&&!~t.indexOf("__")})},Zl="pending",ir="fulfilled",Yi="rejected";function Rh(n){switch(this.state){case Zl:return n.pending&&n.pending(this.value);case Yi:return n.rejected&&n.rejected(this.value);case ir:return n.fulfilled?n.fulfilled(this.value):this.value}}function Os(n,t){if(rr(arguments.length<=2,"fromPromise expects up to two arguments"),rr(typeof n=="function"||typeof n=="object"&&n&&typeof n.then=="function","Please pass a promise or function to fromPromise"),n.isPromiseBasedObservable===!0)return n;typeof n=="function"&&(n=new Promise(n));var e=n;n.then(b("observableFromPromise-resolve",function(r){e.value=r,e.state=ir}),b("observableFromPromise-reject",function(r){e.value=r,e.state=Yi})),e.isPromiseBasedObservable=!0,e.case=Rh;var o=t&&t.state===ir?t.value:void 0;return Fr(e,{value:o,state:Zl},{},{deep:!1}),e}(function(n){n.reject=b("fromPromise.reject",function(e){var o=n(Promise.reject(e));return o.state=Yi,o.value=e,o});function t(e){e===void 0&&(e=void 0);var o=n(Promise.resolve(e));return o.state=ir,o.value=e,o}n.resolve=b("fromPromise.resolve",t)})(Os||(Os={}));var To=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};(function(){function n(t,e){var o=this;sc(function(){o.current=e,o.subscription=t.subscribe(o)})}return n.prototype.dispose=function(){this.subscription&&this.subscription.unsubscribe()},n.prototype.next=function(t){this.current=t},n.prototype.complete=function(){this.dispose()},n.prototype.error=function(t){this.current=t,this.dispose()},To([E.ref],n.prototype,"current",void 0),To([b.bound],n.prototype,"next",null),To([b.bound],n.prototype,"complete",null),To([b.bound],n.prototype,"error",null),n})();var ar=function(){return ar=Object.assign||function(n){for(var t,e=1,o=arguments.length;e=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Xh=["model","reset","submit","isDirty","isPropertyDirty","resetProperty"];(function(){function n(t){var e=this;this.model=t,this.localValues=E.map({}),this.localComputedValues=E.map({}),this.isPropertyDirty=function(o){return e.localValues.has(o)},rr(Wt(t),"createViewModel expects an observable object"),Ih(t).forEach(function(o){if(!(o===k||o==="__mobxDidRunLazyInitializers")){if(rr(Xh.indexOf(o)===-1,"The propertyname "+o+" is reserved and cannot be used with viewModels"),Ji(t,o)){var r=hr(t,o).derivation;e.localComputedValues.set(o,Q(r.bind(e)))}var i=Object.getOwnPropertyDescriptor(t,o),a=i?{enumerable:i.enumerable}:{};Object.defineProperty(e,o,ar(ar({},a),{configurable:!0,get:function(){return Ji(t,o)?e.localComputedValues.get(o).get():e.isPropertyDirty(o)?e.localValues.get(o):e.model[o]},set:b(function(s){s!==e.model[o]?e.localValues.set(o,s):e.localValues.delete(o)})}))}})}return Object.defineProperty(n.prototype,"isDirty",{get:function(){return this.localValues.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"changedValues",{get:function(){return this.localValues.toJS()},enumerable:!1,configurable:!0}),n.prototype.submit=function(){var t=this;an(this.localValues).forEach(function(e){var o=t.localValues.get(e),r=t.model[e];ie(r)?r.replace(o):Mt(r)?(r.clear(),r.merge(o)):hc(o)||(t.model[e]=o)}),this.localValues.clear()},n.prototype.reset=function(){this.localValues.clear()},n.prototype.resetProperty=function(t){this.localValues.delete(t)},bn([Q],n.prototype,"isDirty",null),bn([Q],n.prototype,"changedValues",null),bn([b.bound],n.prototype,"submit",null),bn([b.bound],n.prototype,"reset",null),bn([b.bound],n.prototype,"resetProperty",null),n})();function Dr(n){if(!n)return"ROOT";for(var t=[];n.parent;)t.push(n.path),n=n.parent;return t.reverse().join("/")}function Nr(n){return Wt(n)||ie(n)||Mt(n)}function Bh(n,t){var e=new WeakMap;function o(s){var l=e.get(s.object);r(s,l),t(s,Dr(l),n)}function r(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())},n.prototype.undoAble=function(){return this.undos.length>1},n.prototype.undo=function(){if(this.undoAble()){var t=this.undos.pop();this.redos.push(t);var e=this.undos.pop();return this.curData=X(e),e}},n.prototype.redoAble=function(){return this.redos.length>0},n.prototype.redo=function(){if(this.redoAble()){var t=this.redos.pop();return this.curData=X(t),t}},n.prototype.watch=function(t){var e=this;this.stopWatch&&this.stopWatch(),this.undos.push(t.modelToGraphData()),this.stopWatch=Bh(t,js(function(){var o=t.modelToHistoryData();o&&e.add(xi({},o))},this.waitTime))},n.prototype.destroy=function(){this.undos=[],this.redos=[],this.curData=null,this.stopWatch&&this.stopWatch()},n})(),ws={exports:{}},Ss;function Yh(){return Ss||(Ss=1,(function(n){(function(t,e,o){if(!t)return;for(var r={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)r[111+u]="f"+u;for(u=0;u<=9;++u)r[u+96]=u.toString();function p(_,x,A){if(_.addEventListener){_.addEventListener(x,A,!1);return}_.attachEvent("on"+x,A)}function c(_){if(_.type=="keypress"){var x=String.fromCharCode(_.which);return _.shiftKey||(x=x.toLowerCase()),x}return r[_.which]?r[_.which]:i[_.which]?i[_.which]:String.fromCharCode(_.which).toLowerCase()}function d(_,x){return _.sort().join(",")===x.sort().join(",")}function f(_){var x=[];return _.shiftKey&&x.push("shift"),_.altKey&&x.push("alt"),_.ctrlKey&&x.push("ctrl"),_.metaKey&&x.push("meta"),x}function h(_){if(_.preventDefault){_.preventDefault();return}_.returnValue=!1}function y(_){if(_.stopPropagation){_.stopPropagation();return}_.cancelBubble=!0}function v(_){return _=="shift"||_=="ctrl"||_=="alt"||_=="meta"}function g(){if(!l){l={};for(var _ in r)_>95&&_<112||r.hasOwnProperty(_)&&(l[r[_]]=_)}return l}function m(_,x,A){return A||(A=g()[_]?"keydown":"keypress"),A=="keypress"&&x.length&&(A="keydown"),A}function M(_){return _==="+"?["+"]:(_=_.replace(/\+{2}/g,"+plus"),_.split("+"))}function T(_,x){var A,P,I,B=[];for(A=M(_),I=0;I1){wt(R,Dt,V,J);return}tt=T(R,J),x._callbacks[tt.key]=x._callbacks[tt.key]||[],ct(tt.key,tt.modifiers,{type:tt.action},Y,R,nt),x._callbacks[tt.key][Y?"unshift":"push"]({callback:V,modifiers:tt.modifiers,action:tt.action,seq:Y,level:nt,combo:R})}x._bindMultiple=function(R,V,J){for(var Y=0;Y-1||w(x,A.target))return!1;if("composedPath"in _&&typeof _.composedPath=="function"){var P=_.composedPath()[0];P!==_.target&&(x=P)}return x.tagName=="INPUT"||x.tagName=="SELECT"||x.tagName=="TEXTAREA"||x.isContentEditable},S.prototype.handleKey=function(){var _=this;return _._handleKey.apply(_,arguments)},S.addKeycodes=function(_){for(var x in _)_.hasOwnProperty(x)&&(r[x]=_[x]);l=null},S.init=function(){var _=S(e);for(var x in _)x.charAt(0)!=="_"&&(S[x]=(function(A){return function(){return _[A].apply(_,arguments)}})(x))},S.init(),t.Mousetrap=S,n.exports&&(n.exports=S)})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)})(ws)),ws.exports}var Gh=Yh();const Uh=ks(Gh);var ve=function(){return ve=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0&&n.pointsList.forEach(function(e){e.x+=t,e.y+=t}),Ir(n.text)||(n.text.x+=t,n.text.y+=t),n}function gy(n,t){var e=n.x,o=n.y,r=n.text,i=r?{x:r.x+t,y:r.y+t,value:r.value}:void 0;return ve(ve({},n),{id:"",x:e+t,y:o+t,text:i})}function vy(n,t){var e=n.startPoint,o=n.endPoint,r=n.pointsList,i=n.text,a=Vh(n,["startPoint","endPoint","pointsList","text"]);a.id="";var s={x:e.x+t,y:e.y+t},l={x:o.x+t,y:o.y+t},u=re(r,function(c){return{x:c.x+t,y:c.y+t}}),p=i?ve(ve({},i),{x:i.x+t,y:i.y+t}):void 0;return ve(ve({},a),{startPoint:s,endPoint:l,pointsList:u,text:p})}var Ge=40,Ao=40;function Fh(n,t){var e=n.keyboard,o=e.options.keyboard;e.on(["cmd + c","ctrl + c"],function(){if(Ao=Ge,!(o!=null&&o.enabled)||t.textEditElement)return!0;var r=n.options.guards,i=t.getSelectElements(!1),a=r&&r.beforeClone?r.beforeClone(i):!0;return!a||i.nodes.length===0&&i.edges.length===0?(Kt=null,!0):(Kt=i,Kt.nodes.forEach(function(s){return Ms(s,Ge)}),Kt.edges.forEach(function(s){return Ts(s,Ge)}),!1)}),e.on(["cmd + v","ctrl + v"],function(){if(!(o!=null&&o.enabled)||t.textEditElement)return!0;if(Kt&&(Kt.nodes||Kt.edges)){n.clearSelectElements();var r=n.addElements(Kt,Ao);if(!r)return!0;r.nodes.forEach(function(i){return n.selectElementById(i.id,!0)}),r.edges.forEach(function(i){return n.selectElementById(i.id,!0)}),Kt.nodes.forEach(function(i){return Ms(i,Ge)}),Kt.edges.forEach(function(i){return Ts(i,Ge)}),Ao=Ao+Ge}return!1}),e.on(["cmd + z","ctrl + z"],function(){return!(o!=null&&o.enabled)||t.textEditElement?!0:(n.undo(),!1)}),e.on(["cmd + y","ctrl + y"],function(){return!(o!=null&&o.enabled)||t.textEditElement?!0:(n.redo(),!1)}),e.on(["backspace"],function(){if(!(o!=null&&o.enabled)||t.textEditElement)return!0;var r=t.getSelectElements(!0);return n.clearSelectElements(),r.edges.forEach(function(i){return i.id&&n.deleteEdge(i.id)}),r.nodes.forEach(function(i){return i.id&&n.deleteNode(i.id)}),!1})}var Wh=(function(){function n(t){t.keyboard||(t.keyboard={enabled:!1}),this.options=t;var e=t.lf;this.target=e.container,this.mousetrap=new Uh(this.target),t.keyboard.enabled&&!e.options.isSilentMode&&this.enable(!0)}return n.prototype.initShortcuts=function(){var t=this,e,o=((e=this.options.keyboard)!==null&&e!==void 0?e:{}).shortcuts;if(o)if(cu(o))o.forEach(function(s){var l=s.keys,u=s.callback,p=s.action;return t.on(l,u,p)});else{var r=o.keys,i=o.callback,a=o.action;this.on(r,i,a)}},n.prototype.on=function(t,e,o){this.mousetrap.bind(this.getKeys(t),e,o)},Object.defineProperty(n.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}),n.prototype.off=function(t,e){this.mousetrap.unbind(this.getKeys(t),e)},n.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"))},n.prototype.disable=function(){this.disabled||(this.options.keyboard&&(this.options.keyboard.enabled=!1),this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))},n.prototype.destroy=function(){this.mousetrap.reset()},n.prototype.getKeys=function(t){var e=this;return(Array.isArray(t)?t:[t]).map(function(o){return e.formatKey(o)})},n.prototype.formatKey=function(t){return t.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command")},n})(),he=function(){return he=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Cr=function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o-1&&(e.splice(o,1),e.length===0?Qh(t):pn.set(t,e))}}function Lr(){return vn}function $h(){return vn=!0,Ns({props:{flowId:{type:String,required:!0}},setup:function(n){return function(){var t=[];return Object.keys(sr).forEach(function(e){if(e.startsWith(n.flowId)){if(cn.has(n.flowId)){var o=pn.get(n.flowId)||[];o.includes(e)||(o.push(e),pn.set(n.flowId,o))}t.push(sr[e])}}),Xn(ou,{},t.map(function(e){return Xn(e)}))}}})}function Jh(n,t){if(!(!t||!n||!vn)){var e=$h();if(!cn.has(t)){var o=document.createElement("div");n.appendChild(o);var r=Cs(e,{flowId:t});r.mount(o),cn.set(t,r),pn.set(t,[])}}}function Qh(n){if(!(!n||!vn)){var t=cn.get(n);t&&(t.unmount(),cn.delete(n),pn.delete(n))}}var ty=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(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");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}})(),ey=(function(n){ty(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getComponentContainer=function(){return this.root},t.prototype.targetId=function(){return"".concat(this.props.graphModel.flowId,":").concat(this.props.model.id)},t.prototype.componentWillUnmount=function(){n.prototype.componentWillUnmount.call(this),this.unmount()},t.prototype.setHtml=function(e){var o=document.createElement("div");o.className="custom-vue-node-content",this.root=o,e.appendChild(o),this.renderVueComponent()},t.prototype.confirmUpdate=function(e){},t.prototype.renderVueComponent=function(){var e;this.unmountVueComponent();var o=this.getComponentContainer(),r=this.props,i=r.model,a=r.graphModel;if(o){var s=$l[i.type].component;s&&(Lr()?Zh(this.targetId(),s,o,i,a):(this.vm=Cs({render:function(){return Xn(s,{node:i,graph:a})},provide:function(){return{getNode:function(){return i},getGraph:function(){return a}}}}),(e=this.vm)===null||e===void 0||e.mount(o)))}},t.prototype.unmountVueComponent=function(){var e=this.getComponentContainer();return this.vm&&(this.vm.unmount(),this.vm=null),e&&!Lr()&&(e.innerHTML=""),e},t.prototype.unmount=function(){Lr()&&qh(this.targetId(),this.props.graphModel.flowId),this.unmountVueComponent()},t})(vi);const _y="j-airag-vue-node",by=20,ny=332,Ps=62,xy={LINK_BODY:"link_body"},Ey="_"+No.LOOP_BODY,Do={LINK_LOOP:"link_loop",LOOP_START:"loop_start",LOOP_END:"loop_end"},Oy=[{field:"currentLoopTimes",name:"当前循环次数",type:"number"},{field:"currentLoopItem",name:"当前循环项",type:"any"}];function Ei(n,t,e){for(var o=[],r=Math.max(n.length,t.length),i=0,a=0;a>1,n!==0;)r=Ei(r,r,e);return o}function oy(n,t){for(var e=n.split(""),o=[],r=e.length-1;r>=0;r--){var i=parseInt(e[r],t);if(isNaN(i))return null;o.push(i)}return o}function ry(n,t,e){var o=oy(n,t);if(o===null)return null;for(var r=[],i=[1],a=0;a=0;a--)s+=r[a].toString(e);return s}function iy(n){return n.substring(0,2)==="0x"&&(n=n.substring(2)),n=n.toLowerCase(),ry(n,16,10)}class ay{constructor(t){t=t||{},this.seq=0,this.mid=(t.mid||1)%1023,this.offset=t.offset||0,this.lastTime=0}generate(){const t=Date.now(),e=(t-this.offset).toString(2);this.lastTime==t?(this.seq++,this.seq>4095&&(this.seq=0)):this.seq=0,this.lastTime=t;let o=this.seq.toString(2),r=this.mid.toString(2);for(;o.length<12;)o="0"+o;for(;r.length<10;)r="0"+r;const i=e+r+o;let a="";for(let s=i.length;s>0;s-=4)a=parseInt(i.substring(s-4,s),2).toString(16)+a;return iy(a)}}const sy=new ay({mid:du(0,1023),offset:54*31536e3*1e3});function ly(){return sy.generate()}const xn=hu();class wy extends ql{constructor(t,e){t.id||(t.id=ly()),delete t.text,super(t,e),this.type=t.type,this.nodeConfig=fu.get(t.type),this.initNodeData(t)}updateId(t){if(!t||this.id===t)return;const e=this.id;xn.removeProps(e),this.id=t,xn.setProps(this)}initNodeData(t){var e,o,r,i,a;if(!this.nodeConfig)return;t.properties=(e=t.properties)!=null?e:{};const{params:s,methods:l}=this.nodeConfig;this.width=(r=(o=t.properties.width)!=null?o:s==null?void 0:s.width)!=null?r:ny,this.height=(a=(i=t.properties.height)!=null?i:s==null?void 0:s.height)!=null?a:Ps,t.properties.width=this.width,t.properties.height=this.height,typeof(l==null?void 0:l.initNodeData)=="function"&&l.initNodeData.call(this,t),super.initNodeData(t),xn.setProps(this);const u=(p,c)=>(p==null?void 0:p.id)===(c==null?void 0:c.id);this.sourceRules.push({validate:(p,c,d,f)=>{if(p==null||c==null||u(p,c)||d==null||f==null)return!1;const h=p.type,y=c.type,v=h===No.LOOP_BODY?p.id:xn.nodeGroupMap.get(p.id),g=v===c.id?c.id:xn.nodeGroupMap.get(c.id);if((v||g)&&v!==g)return!1;if(y===No.LOOP_BODY){if(d.type==="right"&&f.type===Do.LOOP_END)return!0}else if(h===No.LOOP_BODY&&d.type===Do.LOOP_START&&f.type==="left")return!0;return d.type==="right"&&f.type==="left"},message:"右侧锚点只能连接左侧锚点!"}),this.targetRules.push({message:"左侧锚点只能连接右侧锚点!",validate:(p,c,d,f)=>{if(u(p,c)||d==null||f==null)return!1;if(f.type===Do.LOOP_END||d.type===Do.LOOP_START)return!0;let h=!1;if(f.type==="left"&&d.type==="right"){const y=this.graphModel.getNodeIncomingEdge(c.id);y&&y.length>0?h=!y.some(v=>v.sourceAnchorId===d.id):h=!0}return h?!this.graphModel.$J.getAllPrevNodes(p).some(y=>y.id===c.id):!1}})}getTextStyle(){const t=super.getTextStyle();return t.color="transparent",t}getNodeStyle(){const t=super.getNodeStyle();return t.overflow="visible",t}getOutlineStyle(){const t=super.getOutlineStyle();return t.stroke="none",t.hover&&(t.hover.stroke="none"),t}getDefaultAnchor(){var t;if(!this.nodeConfig)return;const e=this.width/2,o=this.height/2,r=this.y-o+Ps/2,i=[{x:this.x-e,y:r,id:`${this.id}_input`,type:"left"},{x:this.x+e,y:r,id:`${this.id}_output`,type:"right"}],a=()=>({x:this.x,y:this.y-o,id:`${this.id}_top`,type:"top"}),s=()=>({x:this.x,y:this.y+o,id:`${this.id}_bottom`,type:"bottom"});return typeof((t=this.nodeConfig.methods)==null?void 0:t.getDefaultAnchor)=="function"?this.nodeConfig.methods.getDefaultAnchor.call(this,i,{getTopAnchor:a,getBottomAnchor:s}):i}getAnchorLineStyle(t){const e=super.getAnchorLineStyle();return e.stroke="#999999",e}}export{my as A,As as B,Oy as C,gy as D,vy as E,Si as F,z as G,Zf as H,Pt as I,Ce as J,qt as K,Do as L,gs as M,vd as N,fs as O,bs as P,ey as Q,_y as R,ys as S,Ey as T,by as U,G as V,W,xs as X,Qa as Y,ly as _,wy as a,xy as b,ny as c,$l as d,es as e,Es as f,as as g,os as h,$e as i,ss as j,Ps as k,ae as l,O as m,te as n,vs as o,li as p,Yl as q,vi as r,$h as s,rt as t,$a as u,rs as v,hs as w,E as x,is as y,N as z};