import{r as Nl,ak as Cl,d as ps,l as Dn,E as jl,F as Rl,R as Ll}from"./vue-vendor-Be68asQ6.js";import{bw as Q,h as X,v as ii,aC as Wo,bx as rr,p as Ge,by as at,bz as me,bA as Ne,bB as le,bC as We,bD as _t,s as Il,bE as kl,bF as Mi,bG as _r,bH as Bl,al as ds,aB as Xl,bI as Hl,ak as Ai,bJ as zl,bK as fs,bL as Gl,bM as Yl,q as Ul}from"./antd-vue-vendor-DcqS7Wvq.js";import{l as hs}from"./_commonjsHelpers-ce4d82cc-RqGMvybJ.js";var Vl={},Fo,H,ys,Ee,Pi,gs,vs,ms,ai,br,xr,Nn={},_s=[],Wl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zn=Array.isArray;function ae(n,t){for(var e in t)n[e]=t[e];return n}function si(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Fe(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?Fo.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 vo(n,a,o,r,null)}function vo(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?++ys:r,__i:-1,__u:0};return r==null&&H.vnode!=null&&H.vnode(i),i}function Ko(){return{current:null}}function Ke(n){return n.children}function Y(n,t){this.props=n,this.context=t}function Ze(n,t){if(t==null)return n.__?Ze(n.__,n.__i+1):null;for(var e;ts&&Ee.sort(vs),n=Ee.shift(),s=Ee.length,n.__d&&(e=void 0,r=(o=(t=n).__v).__e,i=[],a=[],t.__P&&((e=ae({},o)).__v=o.__v+1,H.vnode&&H.vnode(e),li(t.__P,e,o,t.__n,t.__P.namespaceURI,32&o.__u?[r]:null,i,r==null?Ze(o):r,!!(32&o.__u),a),e.__v=o.__v,e.__.__k[e.__i]=e,Ts(i,e,a),e.__e!=r&&bs(e)));xo.__r=0}function xs(n,t,e,o,r,i,a,s,l,u,p){var c,d,f,y,h,v,g=o&&o.__k||_s,m=t.length;for(l=Fl(e,t,g,l,m),c=0;c0?vo(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=n,a.__b=n.__b+1,s=null,(u=a.__i=Kl(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(l!=null&&!(2&l.__u)?1:0))for(r=e-1,i=e+1;r>=0||i=0){if((l=t[r])&&!(2&l.__u)&&a==l.key&&s===l.type)return r;r--}if(i=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}}}function Ye(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 hi(){for(var n=[],t=0;t2&&pn("box");var e=ze(t);return new Pe(n,qn(e),e.name,!0,e.equals)},array:function(n,t){arguments.length>2&&pn("array");var e=ze(t);return ic(n,qn(e),e.name)},map:function(n,t){arguments.length>2&&pn("map");var e=ze(t);return new _i(n,qn(e),e.name)},set:function(n,t){arguments.length>2&&pn("set");var e=ze(t);return new Qs(n,qn(e),e.name)},object:function(n,t,e){typeof arguments[1]=="string"&&pn("object");var o=ze(e);if(o.proxy===!1)return Ar({},n,t,o);var r=Fs(o),i=Ar({},void 0,void 0,o),a=nc(i);return Ks(a,n,t,r),a},ref:Ns,shallow:gu,deep:yi,struct:vu},x=mu;Object.keys(ji).forEach(function(n){return x[n]=ji[n]});function pn(n){K("Expected one or two arguments to observable."+n+". Did you accidentally try to use observable."+n+" as decorator?")}var gi=Ps(!1,function(n,t,e,o,r){var i=e.get,a=e.set,s=r[0]||{};bi(n).addComputedProp(n,t,Oo({get:i,set:a,context:n},s))}),_u=gi({equals:qe.structural}),tt=function(n,t,e){if(typeof t=="string"||n!==null&&typeof n=="object"&&arguments.length===1)return gi.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 $e(o)};tt.struct=_u;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 $t;(function(n){n[n.NONE=0]="NONE",n[n.LOG=1]="LOG",n[n.BREAK=2]="BREAK"})($t||($t={}));var So=function(){function n(t){this.cause=t}return n}();function yn(n){return n instanceof So}function Tr(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=vi(!0),e=cn(),o=n.observing,r=o.length,i=0;i0;N.computationDepth>0&&t&&K(!1),!N.allowStateChanges&&(t||N.enforceActions==="strict")&&K(!1)}function Cs(n,t,e){var o=vi(!0);Rs(n),n.newObserving=new Array(n.observing.length+100),n.unboundDepsCount=0,n.runId=++N.runId;var r=N.trackingDerivation;N.trackingDerivation=n;var i;if(N.disableErrorBoundaries===!0)i=t.call(e);else try{i=t.call(e)}catch(a){i=new So(a)}return N.trackingDerivation=r,bu(n),mn(o),i}function bu(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&&ks(s,n),s.diffValue=0}for(;r--;){var s=e[r];s.diffValue===1&&(s.diffValue=0,Mu(s,n))}o!==q.UP_TO_DATE&&(n.dependenciesState=o,n.onBecomeStale())}function Or(n){var t=n.observing;n.observing=[];for(var e=t.length;e--;)ks(t[e],n);n.dependenciesState=q.NOT_TRACKING}function js(n){var t=cn();try{return n()}finally{ve(t)}}function cn(){var n=N.trackingDerivation;return N.trackingDerivation=null,n}function ve(n){N.trackingDerivation=n}function vi(n){var t=N.allowStateReads;return N.allowStateReads=n,t}function mn(n){N.allowStateReads=n}function Rs(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 Mo=0,xu=1,Ri=Object.getOwnPropertyDescriptor(function(){},"name"),Ah=Ri&&Ri.configurable;function Ae(n,t,e){var o=function(){return Ls(n,t,e||this,arguments)};return o.isMobxAction=!0,o}function Ls(n,t,e,o){var r=Eu(n,e,o);try{return t.apply(e,o)}catch(i){throw r.error=i,i}finally{Tu(r)}}function Eu(n,t,e){var o=ht()&&!!n,r=0;if(o&&!1){var i,a;if(i>0)for(var s;s0&&!n.__mobxGlobals&&(_o=!1),n.__mobxGlobals&&n.__mobxGlobals.version!==new mo().version&&(_o=!1),_o?n.__mobxGlobals?(n.__mobxInstanceCount+=1,n.__mobxGlobals.UNCHANGED||(n.__mobxGlobals.UNCHANGED={}),n.__mobxGlobals):(n.__mobxInstanceCount=1,n.__mobxGlobals=new mo):(setTimeout(function(){Is||K("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")},1),new mo)}();function Su(){(N.pendingReactions.length||N.inBatch||N.isRunningReactions)&&K("isolateGlobalState should be called before MobX is running any reactions"),Is=!0,_o&&(--wr().__mobxInstanceCount===0&&(wr().__mobxGlobals=void 0),N=new mo)}function Sr(){return N}function Mu(n,t){n.observers.add(t),n.lowestObserverState>t.dependenciesState&&(n.lowestObserverState=t.dependenciesState)}function ks(n,t){n.observers.delete(t),n.observers.size===0&&Bs(n)}function Bs(n){n.isPendingUnobservation===!1&&(n.isPendingUnobservation=!0,N.pendingUnobservations.push(n))}function zt(){N.inBatch++}function Gt(){if(--N.inBatch===0){Gs();for(var n=N.pendingUnobservations,t=0;t0&&Bs(n),!1)}function Au(n){n.lowestObserverState!==q.STALE&&(n.lowestObserverState=q.STALE,n.observers.forEach(function(t){t.dependenciesState===q.UP_TO_DATE&&(t.isTracing!==$t.NONE&&Hs(t,n),t.onBecomeStale()),t.dependenciesState=q.STALE}))}function Pu(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 Du(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!==$t.NONE&&Hs(t,n),t.onBecomeStale())}))}function Hs(n,t){if(n.isTracing===$t.BREAK){var e=[];zs(Vu(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 $e?n.derivation.toString().replace(/[*]\//g,"/"):"")+` The dependencies for this derivation are: `+e.join(` `)+` */ `)()}}function zs(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 zs(o,t,e+1)})}var Cn=function(){function n(t,e,o,r){t===void 0&&(t="Reaction@"+bt()),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="#"+bt(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=$t.NONE}return n.prototype.onBecomeStale=function(){this.schedule()},n.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,N.pendingReactions.push(this),Gs())},n.prototype.isScheduled=function(){return this._isScheduled},n.prototype.runReaction=function(){if(!this.isDisposed){if(zt(),this._isScheduled=!1,Tr(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&ht()}catch(t){this.reportExceptionInDerivation(t)}}Gt()}},n.prototype.track=function(t){if(!this.isDisposed){zt();var e=ht(),o;this._isRunning=!0;var r=Cs(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Or(this),yn(r)&&this.reportExceptionInDerivation(r.cause),Gt()}},n.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return}if(N.disableErrorBoundaries)throw t;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";N.suppressReactionErrors,ht()&&Ru({type:"error",name:this.name,message:o,error:""+t}),N.globalReactionErrorHandlers.forEach(function(r){return r(t,e)})},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(zt(),Or(this),Gt()))},n.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[L]=this,t},n.prototype.toString=function(){return"Reaction["+this.name+"]"},n.prototype.trace=function(t){t===void 0&&(t=!1),Qu(this,t)},n}(),Nu=100,Mr=function(n){return n()};function Gs(){N.inBatch>0||N.isRunningReactions||Mr(Cu)}function Cu(){N.isRunningReactions=!0;for(var n=N.pendingReactions,t=0;n.length>0;){++t===Nu&&n.splice(0);for(var e=n.splice(0),o=0,r=e.length;o",n);if(arguments.length===2&&typeof t=="function")return Ae(n,t);if(arguments.length===1&&typeof n=="string")return Li(n);if(o===!0)sn(n,t,Ae(n.name||t,e.value,this));else return Li(t).apply(null,arguments)};b.bound=Bu;function Xu(n,t){var e=typeof n=="string"?n:n.name||"",o=typeof n=="function"?n:t;return Ls(e,o,this,void 0)}function ir(n,t,e){sn(n,t,Ae(t,e.bind(n)))}function Hu(n,t){t===void 0&&(t=ci);var e=t&&t.name||n.name||"Autorun@"+bt(),o=!t.scheduler&&!t.delay,r;if(o)r=new Cn(e,function(){this.track(s)},t.onError,t.requiresObservable);else{var i=Ys(t),a=!1;r=new Cn(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 zu=function(n){return n()};function Ys(n){return n.scheduler?n.scheduler:n.delay?function(t){return setTimeout(t,n.delay)}:zu}function Us(n,t,e){e===void 0&&(e=ci);var o=e.name||"Reaction@"+bt(),r=b(o,e.onError?Gu(e.onError,t):t),i=!e.scheduler&&!e.delay,a=Ys(e),s=!0,l=!1,u,p=e.compareStructural?qe.structural:e.equals||qe.default,c=new Cn(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 y=n(c);f=s||!p(u,y),u=y}),s&&e.fireImmediately&&r(u,c),!s&&f===!0&&r(u,c),s&&(s=!1)}}return c.schedule(),c.getDisposer()}function Gu(n,t){return function(){try{return t.apply(this,arguments)}catch(e){n.call(this,e)}}}function Yu(n,t,e){return Ws("onBecomeObserved",n,t,e)}function Vs(n,t,e){return Ws("onBecomeUnobserved",n,t,e)}function Ws(n,t,e,o){var r=typeof o=="function"?ue(t,e):ue(t),i=typeof o=="function"?o: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 Uu(n){var t=n.enforceActions,e=n.computedRequiresReaction,o=n.computedConfigurable,r=n.disableErrorBoundaries,i=n.reactionScheduler,a=n.reactionRequiresObservable,s=n.observableRequiresReaction;if(n.isolateGlobalState===!0&&Su(),t!==void 0){(typeof t=="boolean"||t==="strict")&&Ql(`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'")}N.enforceActions=l,N.allowStateChanges=!(l===!0||l==="strict")}e!==void 0&&(N.computedRequiresReaction=!!e),a!==void 0&&(N.reactionRequiresObservable=!!a),s!==void 0&&(N.observableRequiresReaction=!!s,N.allowStateReads=!N.observableRequiresReaction),o!==void 0&&(N.computedConfigurable=!!o),r!==void 0&&(N.disableErrorBoundaries=!!r),i&&ju(i)}function Ar(n,t,e,o){o=ze(o);var r=Fs(o);return Ce(n),bi(n,o.name,r.enhancer),t&&Ks(n,t,e,r),n}function Fs(n){return n.defaultDecorator||(n.deep===!1?Ns:yi)}function Ks(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{}}zt();try{var l=ru(t);try{for(var d=qt(l),f=d.next();!f.done;f=d.next()){var c=f.value,y=Object.getOwnPropertyDescriptor(t,c),h=e&&c in e?e[c]:y.get?gi:o,v=h(n,c,y,!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{Gt()}}function Vu(n,t){return Zs(ue(n,t))}function Zs(n){var t={name:n.name};return n.observing&&n.observing.length>0&&(t.dependencies=tu(n.observing).map(Zs)),t}function qs(n,t){if(n==null)return!1;if(t!==void 0){if(Nt(n)===!1||!n[L].values.has(t))return!1;var e=ue(n,t);return Qe(e)}return Qe(n)}function Wu(n){return arguments.length>1?K(!1):qs(n)}function Ii(n,t){return typeof t!="string"?K(!1):qs(n,t)}function Fu(n,t){return n==null?!1:t!==void 0?Nt(n)?n[L].values.has(t):!1:Nt(n)||!!n[L]||di(n)||Ao(n)||Qe(n)}function tn(n){return arguments.length!==1&&K(!1),Fu(n)}function en(n){return Nt(n)?n[L].getKeys():xt(n)||Dt(n)?Array.from(n.keys()):ee(n)?n.map(function(t,e){return e}):K(!1)}function Ku(n){return Nt(n)?en(n).map(function(t){return n[t]}):xt(n)?en(n).map(function(t){return n.get(t)}):Dt(n)?Array.from(n.values()):ee(n)?n.slice():K(!1)}function Zu(n){return Nt(n)?en(n).map(function(t){return[t,n[t]]}):xt(n)?en(n).map(function(t){return[t,n.get(t)]}):Dt(n)?Array.from(n.entries()):ee(n)?n.map(function(t,e){return[e,t]}):K(!1)}function mi(n,t,e){if(arguments.length===2&&!Dt(n)){zt();var o=t;try{for(var r in o)mi(n,r,o[r])}finally{Gt()}return}if(Nt(n)){var i=n[L],a=i.values.get(t);a?i.write(t,e):i.addObservableProp(t,e,i.defaultEnhancer)}else if(xt(n))n.set(t,e);else if(Dt(n))n.add(t);else if(ee(n))typeof t!="number"&&(t=parseInt(t,10)),Me(t>=0,"Not a valid index: '"+t+"'"),zt(),t>=n.length&&(n.length=t+1),n[t]=e,Gt();else return K(!1)}function Js(n,t,e,o){return typeof e=="function"?Ju(n,t,e,o):qu(n,t,e)}function qu(n,t,e){return Wn(n).observe(t,e)}function Ju(n,t,e,o){return Wn(n,t).observe(e,o)}var $u={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function Le(n,t,e,o){return o.detectCycles&&n.set(t,e),e}function ce(n,t,e){if(!t.recurseEverything&&!tn(n)||typeof n!="object")return n;if(n===null)return null;if(n instanceof Date)return n;if(Ou(n))return ce(n.get(),t,e);tn(n)&&en(n);var o=t.detectCycles===!0;if(o&&n!==null&&e.has(n))return e.get(n);if(ee(n)||Array.isArray(n)){var r=Le(e,n,[],t),i=n.map(function(f){return ce(f,t,e)});r.length=i.length;for(var a=0,s=i.length;a0}function Un(n,t){var e=n.interceptors||(n.interceptors=[]);return e.push(t),Ss(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function te(n,t){var e=cn();try{for(var o=hi(n.interceptors||[]),r=0,i=o.length;r0}function Vn(n,t){var e=n.changeListeners||(n.changeListeners=[]);return e.push(t),Ss(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function Ut(n,t){var e=cn(),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 Un(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}),Vn(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=To),Qt(this)){var a=te(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:o});if(!a)return To;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[L];if(t&&n=0&&e++;break}n=Yi(n),t=Yi(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(!Pr(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],!(fc(t,d)&&Pr(n[d],t[d],e-1,o,r)))return!1}return o.pop(),r.pop(),!0}function Yi(n){return ee(n)?n.slice():ln(n)||xt(n)||Gn(n)||Dt(n)?Array.from(n.entries()):n}function fc(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function Po(n){return n[Symbol.iterator]=hc,n}function hc(){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:Lu,extras:{getDebugName:dc},$mobx:L});function yc(n){return!(n.prototype&&n.prototype.render)&&!Y.isPrototypeOf(n)}function el(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 Ui=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},nl=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")},ol=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 Fi(n,t){if(n==null||t==null||(typeof n=="undefined"?"undefined":Ui(n))!=="object"||(typeof t=="undefined"?"undefined":Ui(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=el(this),e=!1,o=!1;function r(p){var c=this[p],d=fi("reactive "+p);Object.defineProperty(this,p,{configurable:!0,enumerable:!0,get:function(){return d.reportObserved(),c},set:function(f){!o&&Fi(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 Cn(t+".render()",function(){if(!s&&(s=!0,typeof n.componentWillReact=="function"&&n.componentWillReact(),n.__$mobxIsUnmounted!==!0)){var p=!0;try{o=!0,e||Y.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,y=void 0;if(a.track(function(){try{y=mc(!1,i,p,c,d)}catch(h){f=h}}),f)throw f;return y};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:Fi(this.props,n)}};function Ei(n){if(arguments.length>1&&Vi.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&&Vi.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),yc(n)){var t,e;return Ei((e=t=function(r){rl(i,r);function i(){return nl(this,i),il(this,(i.__proto__||Object.getPrototypeOf(i)).apply(this,arguments))}return ol(i,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),i}(Y),t.displayName=el(n),e))}if(!n)throw new Error("Please pass a valid component to 'observer'");var o=n.prototype||n;return _c(o),n.isMobXReactObserver=!0,n}function _c(n){Wi(n,"componentWillMount",!0),Wi(n,"componentDidMount"),n.shouldComponentUpdate||(n.shouldComponentUpdate=al.shouldComponentUpdate)}var bc=Ei(function(n){var t=n.children;return t[0]()});bc.displayName="Observer";var xc=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ec(n,t){return t={exports:{}},n(t,t.exports),t.exports}Ec(function(n,t){(function(e,o){n.exports=o()})(xc,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 y=l(d);y&&y!==u&&p(c,y,f)}var h=i(d);a&&(h=h.concat(a(d)));for(var v=0;v1?Fe("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)!Ki[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&&Zi.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)!Ki[o]&&this.props[o]!==e[o]&&Zi.warn("MobX Provider: Provided store '"+o+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t})(Y);if(!Y)throw new Error("mobx-preact requires Preact to be available");var Kt,ar,qi,sl=[],ft=H,Ji=ft.__b,$i=ft.__r,Qi=ft.diffed,ta=ft.__c,ea=ft.unmount,na=ft.__;function Tc(){for(var n;n=sl.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(bo),n.__H.__h.forEach(Dr),n.__H.__h=[]}catch(t){n.__H.__h=[],ft.__e(t,n.__v)}}ft.__b=function(n){Kt=null,Ji&&Ji(n)},ft.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),na&&na(n,t)},ft.__r=function(n){$i&&$i(n);var t=(Kt=n.__c).__H;t&&(ar===Kt?(t.__h=[],Kt.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(bo),t.__h.forEach(Dr),t.__h=[])),ar=Kt},ft.diffed=function(n){Qi&&Qi(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(sl.push(t)!==1&&qi===ft.requestAnimationFrame||((qi=ft.requestAnimationFrame)||Oc)(Tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ar=Kt=null},ft.__c=function(n,t){t.some(function(e){try{e.__h.forEach(bo),e.__h=e.__h.filter(function(o){return!o.__||Dr(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],ft.__e(o,e.__v)}}),ta&&ta(n,t)},ft.unmount=function(n){ea&&ea(n);var t,e=n.__c;e&&e.__H&&(e.__H.__.forEach(function(o){try{bo(o)}catch(r){t=r}}),e.__H=void 0,t&&ft.__e(t,e.__v))};var oa=typeof requestAnimationFrame=="function";function Oc(n){var t,e=function(){clearTimeout(o),oa&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(e,100);oa&&(t=requestAnimationFrame(e))}function bo(n){var t=Kt,e=n.__c;typeof e=="function"&&(n.__c=void 0,e()),Kt=t}function Dr(n){var t=Kt;n.__c=n.__(),Kt=t}function wc(n,t){for(var e in t)n[e]=t[e];return n}function ra(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 ia(n,t){this.props=n,this.context=t}(ia.prototype=new Y).isPureReactComponent=!0,ia.prototype.shouldComponentUpdate=function(n,t){return ra(this.props,n)||ra(this.state,t)};var aa=H.__b;H.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),aa&&aa(n)};var Sc=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)}Sc(n,t,e,o)};var sa=H.unmount;function ll(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=wc({},n)).__c!=null&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(o){return ll(o,t,e)})),n}function ul(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(o){return ul(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 sr(){this.__u=0,this.o=null,this.__b=null}function cl(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function Qn(){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),sa&&sa(n)},(sr.prototype=new Y).__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]=ul(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)},sr.prototype.componentWillUnmount=function(){this.o=[]},sr.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]=ll(this.__b,e,o.__O=o.__P)}this.__b=null}var r=t.__a&&Fe(Ke,null,n.fallback);return r&&(r.__u&=-33),[Fe(Ke,null,t.__a?null:n.children),r]};var la=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,M=g.sumDeltaY%g.step,_=g.sumDeltaX-w,T=g.sumDeltaY-M;g.sumDeltaX=w,g.sumDeltaY=M;var A=(O=g.model)===null||O===void 0?void 0:O.getData();g.isDragging||((S=g.eventCenter)===null||S===void 0||S.emit(C["".concat(g.eventType,"_DRAGSTART")],{e:m,data:g.data||A}),g.onDragStart({event:m})),g.isDragging=!0,Promise.resolve().then(function(){var P,k;g.onDragging({deltaX:_,deltaY:T,event:m}),(P=g.eventCenter)===null||P===void 0||P.emit(C["".concat(g.eventType,"_MOUSEMOVE")],{deltaX:_,deltaY:T,e:m,data:g.data||A}),(k=g.eventCenter)===null||k===void 0||k.emit(C["".concat(g.eventType,"_DRAG")],{e:m,data:g.data||A})})}},this.handleMouseUp=function(m){var O=window.document;g.isStartDragging=!1,g.isStopPropagation&&m.stopPropagation(),Promise.resolve().then(function(){var S,w,M;O.removeEventListener("mousemove",g.handleMouseMove,!1),O.removeEventListener("mouseup",g.handleMouseUp,!1);var _=(S=g.model)===null||S===void 0?void 0:S.getData();(w=g.eventCenter)===null||w===void 0||w.emit(C["".concat(g.eventType,"_MOUSEUP")],{e:m,data:g.data||_}),g.isDragging&&(g.isDragging=!1,g.onDragEnd({event:m}),(M=g.eventCenter)===null||M===void 0||M.emit(C["".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=y,this.eventType=u,this.eventCenter=p,this.model=h,this.data=v}return n.prototype.setStep=function(t){this.step=t},n.prototype.setModel=function(t){this.model=t},n}(),Vc=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}},Wc=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}},Fc=function(n){var t=n.points,e=je(t),o=In(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}},Kc=function(n){var t=n.path,e=Ti(t),o=In(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}},Zc=function(n){if(n.modelType===z.LINE_EDGE)return Wc(n);if(n.modelType===z.POLYLINE_EDGE)return Fc(n);if(n.modelType===z.BEZIER_EDGE)return Kc(n)},qc=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},Rn=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},Ue=globalThis&&globalThis.__assign||function(){return Ue=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=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;oo/t.height?et.HORIZONTAL:et.VERTICAL},No=function(n,t,e){var o=$c(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}},ya=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}},In=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([],At(e),!1)),i=Math.max.apply(Math,ge([],At(e),!1)),a=Math.min.apply(Math,ge([],At(o),!1)),s=Math.max.apply(Math,ge([],At(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}},Co=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}]},eo=function(n,t){var e=n.x,o=n.y;return et.maxX||ot.maxY},Qc=function(n,t){return tn.maxX?[]:[{x:t,y:n.minY},{x:t,y:n.maxY}]},tp=function(n,t){return tn.maxY?[]:[{x:n.minX,y:t},{x:n.maxX,y:t}]},ep=function(n,t){return ge(ge([],At(Qc(n,t.x)),!1),At(tp(n,t.y)),!1)},Cr=function(n,t){return Math.abs(n.x-t.x)+Math.abs(n.y-t.y)},np=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},ga=function(n,t,e,o,r){return Cr(n,t)+Cr(n,e)+np(n,[t,e,o,r])},pl=function(n,t,e,o,r){r||(r=0),n.unshift(t[o]),e[o]&&e[o]!==o&&r<=100&&pl(n,t,e,e[o],r+1)},op=function(n,t){var e=n.indexOf(t);e>-1&&n.splice(e,1)},gn=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},va=function(n,t,e){if(e.width===0&&e.height===0)return!1;var o=At(Co(e),4),r=o[0],i=o[1],a=o[2],s=o[3];return gn(n,t,r,i)||gn(n,t,r,s)||gn(n,t,i,a)||gn(n,t,a,s)},rp=function(n,t,e,o){var r=[];return n.forEach(function(i){i!==t&&(i.x===t.x||i.y===t.y)&&!va(i,t,e)&&!va(i,t,o)&&r.push(i)}),Nr(r)},ip=function(n,t,e,o,r,i,a){var s=[],l=[t],u={},p={},c={};t.id&&(p[t.id]=0,c[t.id]=ga(t,e,t));var d={};n.forEach(function(h){h.id&&(d[h.id]=h)});for(var f=function(){var h,v=1/0;if(l.forEach(function(m){m.id&&c[m.id]=p[m.id])return;u[m.id]=h.id,p[m.id]=O,c[m.id]=p[m.id]+ga(m,e,t,i,a)}})};l.length;){var y=f();if(typeof y=="object")return y.value}return[t,e]},ma=function(n){return Ot(n)},dl=function(n){for(var t=1;t2&&(g=dl(g)),Nr(g)},ap=function(n){if(n.length===1){var t=At(n,1),e=t[0];return[e,e]}else{for(var o=n[0],r=n[1],i=Ht(o.x,o.y,r.x,r.y),a=1;ai&&(i=u,o=s,r=l)}return[o,r]}},ba=function(n,t,e){var o=se(n,e),r=se(t,e);return o&&r},xa=function(n,t,e){var o=se(n,e),r=se(t,e),i=o&&r,a=o||r;return!i&&a},Ea=function(n,t,e){for(var o=void 0,r=Ot(e),i=Co(r),a=0;a=1&&o<=126||o>=65376&&o<=65439?t+=1:t+=2}return t},lp=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=Ln(Ue(Ue({},r),{type:"start"})),a=Ln(Ue(Ue({},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"}},Oa=function(n){var t=n.start,e=n.end,o=n.sourceNode,r=n.targetNode,i=n.offset,a=Ot(o),s=Ot(r),l=Do(a,i),u=Do(s,i),p=No(l,a,t),c=No(u,s,e);return{sNext:p,ePre:c}},Ti=function(n){var t=n.replace(/M/g,"").replace(/C/g,",").split(","),e=no(t[0]),o=no(t[1]),r=no(t[2]),i=no(t[3]);return[e,o,r,i]},no=function(n){var t=At(n.replace(/(^\s*)/g,"").split(" "),2),e=t[0],o=t[1];return{x:+e,y:+o}},wa=function(n,t){var e=At(n,4),o=e[0],r=e[1],i=e[2],a=e[3],s=$p(o,r,i,a,t);return[s,n[3]]},hl=function(n,t){for(var e=n.x,o=n.y,r=je(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}},Ie=globalThis&&globalThis.__read||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},oo=globalThis&&globalThis.__spreadArray||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},ur=function(n,t,e){var o=lr(n,2),r=o[0],i=o[1],a=lr(t,2),s=a[0],l=a[1],u=lr(e,2),p=u[0],c=u[1];return r>s&&rl&&i=0?r:-r},t}(gl),jr=function(n){Oi(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}(gl),Qo=globalThis&&globalThis.__extends||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)}}(),ke=globalThis&&globalThis.__read||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},cr=globalThis&&globalThis.__spreadArray||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},Rr=function(n){var t=n.anchors;return t},Io=function(n,t){for(var e=t.nodes,o,r=e.length-1;r>=0;r--){var i=e[r],a=mp(n,i);if(a){var s=i.getTargetAnchor(n);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!o||gp(i,o.node,t))&&(o=l)}}}return o},gp=function(n,t,e){return n.zIndex>t.zIndex?!0:e.nodesMap[n.id].index>e.nodesMap[t.id].index},vp=function(n,t){for(var e=Rr(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},mp=function(n,t){return se(n,t,5)},Ot=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}},_p=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}]},Aa=function(n,t,e){var o=_p(e),r,i=Number.MAX_SAFE_INTEGER;return o.forEach(function(a){var s=Ht(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 y=(d.y-c.y)/(d.x-c.x),h=(c.x*d.y-d.x*c.y)/(c.x-d.x);t===et.HORIZONTAL?f={x:(n.y-h)/y,y:n.y}:t===et.VERTICAL&&(f={x:n.x,y:y*n.x+h})}var v=Rn(f,u,p);if(v){var g=Ht(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},Ca=function(n){var t=n.rows,e=n.rowsLength,o=n.fontSize,r=0;return t&&t.forEach(function(i){var a=fl(i);r=a>r?a:r}),{width:Math.ceil(r/2)*o+o/4,height:e*(o+2)+o/4}},ko=function(n){return typeof n!="object"?{isAllPass:!!n,msg:n?"":"不允许连接"}:n};let io;const xp=new Uint8Array(16);function Ep(){if(!io&&(io=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!io))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return io(xp)}const dt=[];for(let n=0;n<256;++n)dt.push((n+256).toString(16).slice(1));function Tp(n,t=0){return dt[n[t+0]]+dt[n[t+1]]+dt[n[t+2]]+dt[n[t+3]]+"-"+dt[n[t+4]]+dt[n[t+5]]+"-"+dt[n[t+6]]+dt[n[t+7]]+"-"+dt[n[t+8]]+dt[n[t+9]]+"-"+dt[n[t+10]]+dt[n[t+11]]+dt[n[t+12]]+dt[n[t+13]]+dt[n[t+14]]+dt[n[t+15]]}const Op=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ja={randomUUID:Op};function wp(n,t,e){if(ja.randomUUID&&!t&&!n)return ja.randomUUID();n=n||{};const o=n.random||(n.rng||Ep)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,t){e=e||0;for(let r=0;r<16;++r)t[e+r]=o[r];return t}return Tp(o)}var De=function(){return wp()},_n=new Map,ml=function(n){var t=De();function e(){n();var r=_n.get(t);if(r){var i=window.requestAnimationFrame(e);_n.set(t,i)}}var o=window.requestAnimationFrame(e);return _n.set(t,o),t},Bo=function(n){var t=_n.get(n);t&&(window.cancelAnimationFrame(t),_n.delete(n))},kn=globalThis&&globalThis.__assign||function(){return kn=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 _l(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,y=n.model,h={x:e,y:r,fill:u,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(at(me(n),function(w){var M=Sp(w,2),_=M[0],T=M[1];typeof T!="object"&&(h[_]=T)}),i){var v=String(i).split(/[\r\n]/g),g=v.length;if(c!=="default"){var m=y.BaseType,O=y.modelType;if(m===rt.NODE&&O!==z.TEXT_NODE||m===rt.EDGE&&f)return Mp(n)}if(g>1){var S=v.map(function(w,M){var _=s+2,T=(M-(g-1)/2)*_;return E("tspan",{className:"lf-text-tspan",x:e,y:r+T,children:w})});return E("text",kn({},h,{children:S}))}return E("text",kn({},h,{children:i}))}return null}function Mp(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,y=r.width,h=r.height,v=r.textHeight,g=i||y,m=String(o).split(/[\r\n]/g),O=m.length,S=vl({rows:m,style:{fontSize:"".concat(s,"px"),width:"".concat(g,"px"),fontFamily:p,lineHeight:l,padding:d},rowsLength:O,className:"lf-get-text-height"}),w=h>S?h:S;v&&(w=v);var M=f==="ellipsis";return M&&(w=s+2),E("g",{children:E("foreignObject",{width:g,height:w,x:t-g/2,y:e-w/2,style:{overflow:"visible",textAlign:"left"},children:E("div",{className:"lf-node-text-auto-wrap",style:{minHeight:w,width:g,padding:d},children:E("div",{className:M?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:M?m.join(""):"",style:kn({},n),children:m.map(function(_){return E("div",{className:"lf-node-text--auto-wrap-inner",children:_})})})})})})}var Ir=globalThis&&globalThis.__assign||function(){return Ir=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 on(n){var t={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return at(me(n),function(e){var o=Ap(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),E("line",Ir({},t))}var kr=globalThis&&globalThis.__assign||function(){return kr=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 Jt(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,at(me(n),function(d){var f=Pp(d,2),y=f[0],h=f[1];typeof h!="object"&&(c[y]=h)}),i?c.className="lf-basic-shape ".concat(i):c.className="lf-basic-shape",l&&(c.rx=l,c.ry=l),c.x=u,c.y=p,E("rect",kr({},c))}var Br=globalThis&&globalThis.__assign||function(){return Br=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 Bn(n){var t={d:""};return at(me(n),function(e){var o=Dp(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),E("path",Br({},t))}var Xr=globalThis&&globalThis.__assign||function(){return Xr=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 rn(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 at(me(n),function(u){var p=Np(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",E("circle",Xr({},l))}var Hr=globalThis&&globalThis.__assign||function(){return Hr=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 jp(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 at(me(n),function(c){var d=Cp(c,2),f=d[0],y=d[1];typeof y!="object"&&(p[f]=y)}),u?p.className="lf-basic-shape ".concat(u):p.className="lf-basic-shape",E("ellipse",Hr({},p))}var zr=globalThis&&globalThis.__assign||function(){return zr=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 bl(n){var t=n.points,e=t===void 0?[]:t,o=n.className,r={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return at(me(n),function(i){var a=Rp(i,2),s=a[0],l=a[1];typeof l!="object"&&(r[s]=l)}),o?r.classNmae="lf-basic-shape ".concat(o):r.className="lf-basic-shape",r.points=e.map(function(i){return i.join(",")}).join(" "),E("polygon",zr({},r))}var Gr=globalThis&&globalThis.__assign||function(){return Gr=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 Ip(n){var t=n.className,e={points:"",fill:"none"};return at(me(n),function(o){var r=Lp(o,2),i=r[0],a=r[1];(i==="style"||typeof a!="object")&&(e[i]=a)}),t&&(e.className="".concat(t)),E("polyline",Gr({},e))}var xl=globalThis&&globalThis.__extends||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)}}(),Xn=globalThis&&globalThis.__assign||function(){return Xn=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(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"})($||($={}));var Xp=function(n){xl(t,n);function t(e){var o=n.call(this)||this;o.updateEdgePointByAnchors=function(){var s=o.nodeModel,l=s.id,u=s.anchors,p=o.graphModel.getNodeEdges(l);at(p,function(c){if(c.sourceNodeId===l){var d=Ne(u,function(f){return f.id===c.sourceAnchorId});d&&c.updateStartPoint({x:d.x,y:d.y})}else if(c.targetNodeId===l){var d=Ne(u,function(y){return y.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(C.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,y=d.deltaY,h=d.width,v=d.height,g=d.PCTResizeInfo;if(g){var m=4,O=0,S=0;switch(s){case $.LEFT_TOP:S=(f*-1-y)/m;break;case $.RIGHT_TOP:S=(f-y)/m;break;case $.RIGHT_BOTTOM:S=(f+y)/m;break;case $.LEFT_BOTTOM:S=(f*-1+y)/m;break}S!==0&&(O=Math.round(S/g.ResizeBasis.basisHeight*1e5)/1e3),g.ResizePCT.widthPCT=Math.max(Math.min(g.ResizePCT.widthPCT+O,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit),g.ResizePCT.heightPCT=Math.max(Math.min(g.ResizePCT.heightPCT+O,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit);var w=Math.round(g.ResizePCT.widthPCT*g.ResizeBasis.basisWidth/100),M=Math.round(g.ResizePCT.heightPCT*g.ResizeBasis.basisHeight/100);switch(s){case $.LEFT_TOP:f=h-w,y=v-M;break;case $.RIGHT_TOP:f=w-h,y=v-M;break;case $.RIGHT_BOTTOM:f=w-h,y=M-v;break;case $.LEFT_BOTTOM:f=h-w,y=M-v;break}return d}switch(s){case $.LEFT_TOP:d.width=p?h:h-f*u,d.height=c?v:v-y*u;break;case $.RIGHT_TOP:d.width=p?h:h+f*u,d.height=c?v:v-y*u;break;case $.RIGHT_BOTTOM:d.width=p?h:h+f*u,d.height=c?v:v+y*u;break;case $.LEFT_BOTTOM:d.width=p?h:h-f*u,d.height=c?v:v+y*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,y=c.x,h=c.y;Kp({x:y,y:h,deltaX:l,deltaY:u,index:p,nodeModel:d,graphModel:f,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=Bp(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 ne({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:a.gridSize}),o}return t.prototype.componentWillUnmount=function(){this.dragHandler.destroy()},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=kp(s,["width","height"]);return E("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[E(Jt,Xn({className:"lf-resize-control-content",x:o,y:r,width:l!=null?l:7,height:u!=null?u:7},p)),E(Jt,{className:"lf-resize-control-content",x:o,y:r,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},t}(Y),Hp=function(n){xl(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=Ot(o),a=i.minX,s=i.minY,l=i.maxX,u=i.maxY,p=[{index:$.LEFT_TOP,direction:"nw",x:a,y:s},{index:$.RIGHT_TOP,direction:"ne",x:l,y:s},{index:$.RIGHT_BOTTOM,direction:"se",x:l,y:u},{index:$.LEFT_BOTTOM,direction:"sw",x:a,y:u}];return le(p,function(c){return E(Xp,Xn({},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 E(Jt,Xn({},s,{x:o,y:r,width:i,height:a}))},t.prototype.render=function(){return E("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},t}(Y);function zp(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 vn(n,t,e){var o=Gp(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 Gp(n){return n*Math.PI/180}function Yp(n){return n/Math.PI*180}function Up(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=Yp(e),y={x:o,y:r},h={x:i,y:a},v=vn(y,h,f),g={x:v.x+u,y:v.y+p},m=Zp(v,g,h,f,s,l,c,d),O=m.width,S=m.height,w=m.center;return t.width=O*n,t.height=S*n,t.deltaX=(w.x-h.x)*2,t.deltaY=(w.y-h.y)*2,t}var Vp=function(n,t,e,o,r,i,a,s,l,u){e===void 0&&(e=1),o===void 0&&(o=!1),r===void 0&&(r=!1),i===void 0&&(i=0);var p=X(t),c=p.deltaX,d=p.deltaY,f=p.width,y=p.height,h=p.PCTResizeInfo;if(h){var v=4,g=0,m=0;switch(n){case $.LEFT_TOP:m=(c*-1-d)/v;break;case $.RIGHT_TOP:m=(c-d)/v;break;case $.RIGHT_BOTTOM:m=(c+d)/v;break;case $.LEFT_BOTTOM:m=(c*-1+d)/v;break}m!==0&&(g=Math.round(m/h.ResizeBasis.basisHeight*1e5)/1e3),h.ResizePCT.widthPCT=Math.max(Math.min(h.ResizePCT.widthPCT+g,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit),h.ResizePCT.heightPCT=Math.max(Math.min(h.ResizePCT.heightPCT+g,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit);var O=Math.round(h.ResizePCT.widthPCT*h.ResizeBasis.basisWidth/100),S=Math.round(h.ResizePCT.heightPCT*h.ResizeBasis.basisHeight/100);switch(n){case $.LEFT_TOP:c=f-O,d=y-S;break;case $.RIGHT_TOP:c=O-f,d=y-S;break;case $.RIGHT_BOTTOM:c=O-f,d=S-y;break;case $.LEFT_BOTTOM:c=f-O,d=S-y;break}return p}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return Up(e,p,i,a,s,l,u,o,r);switch(n){case $.LEFT_TOP:p.width=o?f:f-c*e,p.height=r?y:y-d*e;break;case $.RIGHT_TOP:p.width=o?f:f+c*e,p.height=r?y:y-d*e;break;case $.RIGHT_BOTTOM:p.width=o?f:f+c*e,p.height=r?y:y+d*e;break;case $.LEFT_BOTTOM:p.width=o?f:f-c*e,p.height=r?y:y+d*e;break}return p},Wp=function(n,t){var e=n.id,o=n.anchors,r=t.getNodeEdges(e);at(r,function(i){if(i.sourceNodeId===e){var a=Ne(o,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===e){var a=Ne(o,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},Fp=function(n,t,e,o,r,i,a){a.eventCenter.emit(C.NODE_RESIZE,{preData:n,data:t,deltaX:e,deltaY:o,index:r,model:i})},Kp=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=a.r,p=a.rx,c=a.ry,d=a.width,f=a.height,y=a.PCTResizeInfo,h=a.minWidth,v=a.minHeight,g=a.maxWidth,m=a.maxHeight,O=a.rotate,S=a.x,w=a.y,M=h===g,_=v===m,T={width:u||p||d,height:u||c||f,deltaX:o,deltaY:r,PCTResizeInfo:y},A=u||p&&c?1/2:1,P=t,k=e,I=Vp(i,T,A,M,_,O,P,k,S,w);if(I.widthg||I.heightm){l==null||l();return}(O%(2*Math.PI)==0||y||P===void 0||k===void 0)&&(I.deltaX=M?0:I.deltaX,I.deltaY=_?0:I.deltaY);var nt=a.getData(),Z=a.resize(I);nt.x===Z.x&&nt.y===Z.y||(Wp(a,s),Fp(nt,Z,o,r,i,a,s))};function Zp(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=zp(l,t),p=vn(t,u,-o),c=vn(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 y=Math.abs(p.y-c.y),h=y-s;u.y>p.y?u.y=u.y+h/2:u.y=u.y-h/2}if(r||i){var v=vn(c,u,o),g=v.x-l.x,m=v.y-l.y;u.x=u.x-g,u.y=u.y-m,c=vn(l,u,-o),p={x:u.x-(c.x-u.x),y:u.y-(c.y-u.y)}}var O=Math.abs(p.x-c.x),S=Math.abs(p.y-c.y);return r&&(O=a),i&&(S=s),{width:O,height:S,center:u}}var qp=100,Jp={x:1,y:0,z:0};function $p(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 Ra(n){var t=Math.hypot(n.x,n.y);return{x:n.x/t,y:n.y/t,z:0}}function nd(n){return ed(Jp,n)}function od(n){return n*(180/Math.PI)}var rd={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"}},El=function(n){var t=X(rd);return n&&(t=ii(t,n)),t},id=El,ad=1e3,sd=999,wi=function(){return++ad},ld=function(){return--sd},lt=globalThis&&globalThis.__assign||function(){return lt=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},tr=function(){function n(t,e){var o;this.BaseType=rt.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Pt.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=F.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){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,o=e&&e(t.type),r=this.createId();t.id=r||o||De()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,Q(this,up(t));var a=this.graphModel.overlapMode;a===Xt.INCREASE&&(this.zIndex=t.zIndex||wi()),this.setAnchors(),this.initPoints(),this.formatText(t)},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.getEdgeStyle=function(){return lt(lt({},this.graphModel.theme.baseEdge),this.style)},n.prototype.getAdjustPointStyle=function(){return lt({},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 lt(lt(lt({},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=Rr(t);return o&&(r=Ne(a,function(s){return s.id===o}),r)||a.forEach(function(s){var l=Sa(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},pr=globalThis&&globalThis.__read||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},La=function(n){ud(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=Wo(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 Te(Te(Te({},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 Te(Te({},e),{pointsList:o})},t.prototype.getControls=function(){var e=this.startPoint,o=this.endPoint,r=Oa({start:e,end:o,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return r},t.prototype.getPath=function(e){var o=pr(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=pr(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=pr(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(Q({},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=Oa({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()},St([x],t.prototype,"offset",void 0),St([x],t.prototype,"path",void 0),St([b],t.prototype,"initPoints",null),St([b],t.prototype,"updatePoints",null),St([b],t.prototype,"updateStartPoint",null),St([b],t.prototype,"updateEndPoint",null),St([b],t.prototype,"moveStartPoint",null),St([b],t.prototype,"moveEndPoint",null),St([b],t.prototype,"updateAdjustAnchor",null),St([b],t.prototype,"getAdjustStart",null),St([b],t.prototype,"getAdjustEnd",null),St([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(tr),cd=globalThis&&globalThis.__extends||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)}}(),bn=globalThis&&globalThis.__assign||function(){return bn=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},pd=globalThis&&globalThis.__spreadArray||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},Ba=globalThis&&globalThis.__read||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},fd=globalThis&&globalThis.__spreadArray||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=ba(l,a,this.sourceNode);if(u){var p=xa(a,s,this.sourceNode);if(p){var c=Ea(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=Ht(g.x,g.y,a.x,a.y),O=Ht(l.x,l.y,a.x,a.y);m0?this.points=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=_a({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(Q({},this.text,this.textPosition)),{start:Q({},p[s]),end:Q({},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=se(d,this.sourceNode);if(!f){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x,y:a.y+o.y},f=se(h,this.targetNode);if(!f){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,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=se(d,this.sourceNode);if(!f){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x+o.x,y:a.y},f=se(h,this.targetNode);if(!f){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}return!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Q({},this.text,this.textPosition)),{start:Q({},p[s]),end:Q({},p[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppendEnd=function(){if(this.draggingPointList){var e=dl(je(this.points));this.pointsList=e.map(function(i){return i}),this.draggingPointList=[];var o=e[0];this.startPoint=Q({},o);var r=e[e.length-1];this.endPoint=Q({},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=_a({x:o.x,y:o.y},{x:r.x,y:r.y},i,a,this.offset||0),this.initPoints()},pt([x],t.prototype,"offset",void 0),pt([x],t.prototype,"dbClickPosition",void 0),pt([b],t.prototype,"initPoints",null),pt([b],t.prototype,"updatePoints",null),pt([b],t.prototype,"updateStartPoint",null),pt([b],t.prototype,"moveStartPoint",null),pt([b],t.prototype,"updateEndPoint",null),pt([b],t.prototype,"moveEndPoint",null),pt([b],t.prototype,"updatePointsList",null),pt([b],t.prototype,"dragAppendStart",null),pt([b],t.prototype,"dragAppendSimple",null),pt([b],t.prototype,"dragAppend",null),pt([b],t.prototype,"dragAppendEnd",null),pt([b],t.prototype,"updatePointsAfterDrag",null),pt([b],t.prototype,"getAdjustStart",null),pt([b],t.prototype,"getAdjustEnd",null),pt([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(tr),ut=globalThis&&globalThis.__assign||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},Ha=globalThis&&globalThis.__values||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.")},hd=globalThis&&globalThis.__read||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},be=function(){function n(t,e){var o;this.BaseType=rt.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Pt.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=F.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 Ro(-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){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,o=e&&e(t.type),r=this.createId();t.id=r||o||De()}this.formatText(t),Q(this,bp(t));var i=this.graphModel.overlapMode;i===Xt.INCREASE&&(this.zIndex=t.zIndex||wi())},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:""}),We(p.draggable)||(c.draggable=p.draggable),We(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;tn(i)&&(i=Ft(i)),_t(i.width)&&(i.width=this.width),_t(i.height)&&(i.height=this.height);var a={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(a.rotate=this.rotate),this.graphModel.overlapMode===Xt.INCREASE&&(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 Ft(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 vp(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=hd(new Fn([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(!_t(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},za=function(n){yd(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 En(En(En({},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()},dr([x],t.prototype,"r",void 0),dr([tt],t.prototype,"width",null),dr([tt],t.prototype,"height",null),t}(be),gd=globalThis&&globalThis.__extends||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)}}(),Tn=globalThis&&globalThis.__assign||function(){return Tn=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},ao=globalThis&&globalThis.__read||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},Ga=function(n){gd(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 Tn(Tn(Tn({},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 le(this.points,function(e){var o=ao(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 at(this.points,function(r){var i=ao(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 at(this.points,function(r){var i=ao(r,2),a=i[1];ao&&(o=a)}),o-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this;return le(this.points,function(o,r){var i=ao(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()},Be([x],t.prototype,"rx",void 0),Be([x],t.prototype,"ry",void 0),Be([tt],t.prototype,"points",null),Be([tt],t.prototype,"pointsPosition",null),Be([tt],t.prototype,"width",null),Be([tt],t.prototype,"height",null),t}(be),vd=globalThis&&globalThis.__extends||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)}}(),On=globalThis&&globalThis.__assign||function(){return On=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},Ya=function(n){vd(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 On(On(On({},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()},so([x],t.prototype,"rx",void 0),so([x],t.prototype,"ry",void 0),so([tt],t.prototype,"width",null),so([tt],t.prototype,"height",null),t}(be),md=globalThis&&globalThis.__extends||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=globalThis&&globalThis.__assign||function(){return wn=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},uo=globalThis&&globalThis.__read||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},Ua=function(n){md(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=dp(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 wn(wn(wn({},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=uo(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=uo(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=uo(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=le(this.points,function(u){var p=uo(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()},lo([x],t.prototype,"points",void 0),lo([tt],t.prototype,"pointsPosition",null),lo([tt],t.prototype,"width",null),lo([tt],t.prototype,"height",null),t}(be),_d=globalThis&&globalThis.__extends||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)}}(),Sn=globalThis&&globalThis.__assign||function(){return Sn=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},Va=function(n){_d(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;_t(o)||(this.width=o),_t(r)||(this.height=r),_t(i)||(this.radius=i)},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 Sn(Sn(Sn({},e),X(o)),X(i))},bd([x],t.prototype,"radius",void 0),t}(be),xd=globalThis&&globalThis.__extends||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)}}(),Mn=globalThis&&globalThis.__assign||function(){return Mn=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},Ed=globalThis&&globalThis.__read||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},Td=globalThis&&globalThis.__spreadArray||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},wd={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},co=["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"],Sd=function(){function n(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.snapGrid=!1,this.textMode=Pt.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Pt.TEXT,this.edgeTextMode=Pt.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="",Q(this,this.computeConfig(t))}return n.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);Q(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&&Q(s,this.stagedConfig),e===!0&&e!==this.isSilentMode){var l=Ge(wd,co);this.stagedConfig=Ge(this,co),Q(s,l)}We(i)||Q(s,{nodeTextEdit:i,edgeTextEdit:i}),We(o)||Q(s,{nodeTextDraggable:o,edgeTextDraggable:o}),r&&Q(s,{nodeTextMode:r,edgeTextMode:r}),_r(a)&&Q(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var u=Ge(t,co);return Q(s,u)},n.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},n.prototype.getConfig=function(){return Ge(this,co)},W([x],n.prototype,"isSilentMode",void 0),W([x],n.prototype,"stopZoomGraph",void 0),W([x],n.prototype,"stopMoveGraph",void 0),W([x],n.prototype,"stopScrollGraph",void 0),W([x],n.prototype,"snapGrid",void 0),W([x],n.prototype,"textMode",void 0),W([x],n.prototype,"textEdit",void 0),W([x],n.prototype,"textDraggable",void 0),W([x],n.prototype,"nodeTextEdit",void 0),W([x],n.prototype,"nodeTextDraggable",void 0),W([x],n.prototype,"nodeTextMultiple",void 0),W([x],n.prototype,"nodeTextVertical",void 0),W([x],n.prototype,"nodeTextMode",void 0),W([x],n.prototype,"edgeTextMode",void 0),W([x],n.prototype,"edgeTextEdit",void 0),W([x],n.prototype,"edgeTextDraggable",void 0),W([x],n.prototype,"edgeTextMultiple",void 0),W([x],n.prototype,"edgeTextVertical",void 0),W([x],n.prototype,"hideAnchors",void 0),W([x],n.prototype,"allowRotate",void 0),W([x],n.prototype,"allowResize",void 0),W([x],n.prototype,"hoverOutline",void 0),W([x],n.prototype,"nodeSelectedOutline",void 0),W([x],n.prototype,"adjustNodePosition",void 0),W([x],n.prototype,"autoExpand",void 0),W([x],n.prototype,"adjustEdge",void 0),W([x],n.prototype,"adjustEdgeMiddle",void 0),W([x],n.prototype,"adjustEdgeStartAndEnd",void 0),W([x],n.prototype,"adjustEdgeStart",void 0),W([x],n.prototype,"adjustEdgeEnd",void 0),W([x],n.prototype,"edgeSelectedOutline",void 0),W([b],n.prototype,"updateEditConfig",null),W([b],n.prototype,"updateTextMode",null),n}(),Md="*",Ad=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[Md]||[],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},Nd=function(n){Pd(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,y=s.deltaX,h=s.deltaY,v=p.stopScrollGraph,g=p.stopZoomGraph;if(!v&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),o.stepScrollX+=y,o.stepScrollY+=h,Math.abs(o.stepScrollX)>=d){var m=o.stepScrollX%d,O=o.stepScrollX-m;c.translate(-O*c.SCALE_X,0),o.stepScrollX=m}if(Math.abs(o.stepScrollY)>=d){var S=o.stepScrollY%d,w=o.stepScrollY-S;c.translate(0,-w*c.SCALE_Y),o.stepScrollY=S}return}if(!g){s.preventDefault();var M=f.getPointByClient({x:s.clientX,y:s.clientY}),_=M.canvasOverlayPosition,T=_.x,A=_.y;c.zoom(s.deltaY<0,[T,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(C.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(C.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,y=p.adjustNodePosition,h=p.stopMoveGraph,v=s.target,g=!f&&!y;(v.getAttribute("name")==="canvas-overlay"||g)&&(h!==!0?(o.stepDrag.setStep(d*c),o.stepDrag.handleMouseDown(s)):u.emit(C.BLANK_MOUSEDOWN,{e:s}),o.clickHandler(s))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter;return o.stepDrag=new ne({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 E("svg",Ur({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:E("g",{transform:o,children:i})}))},t=Dd([wt],t),t}(Y),Tl=globalThis&&globalThis.__extends||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)}}(),Hn=globalThis&&globalThis.__assign||function(){return Hn=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},jd=globalThis&&globalThis.__read||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},Ka=function(n){Tl(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(C.EDGE_ADJUST,{data:s.getData()})},e.onDragEnd=function(){var o=e.props.bezierModel;o.isDragging=!1},e.dragHandler=new ne({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 E(rn,Hn({className:"lf-bezier-adjust-anchor",x:r,y:i},s,{onMouseDown:function(l){e.dragHandler.handleMouseDown(l)}}))},t}(Y),Rd=function(n){Tl(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=Ti(r),s=jd(a,4),l=s[0],u=s[1],p=s[2],c=s[3],d=e.getEdgeStyle().adjustLine,f=[];return f.push(E(on,Hn({x1:l.x,y1:l.y,x2:u.x,y2:u.y},d))),f.push(E(Ka,{position:u,bezierModel:e,graphModel:o,type:"sNext"},"".concat(i,"_ePre"))),f.push(E(on,Hn({x1:c.x,y1:c.y,x2:p.x,y2:p.y},d))),f.push(E(Ka,{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},kd=function(n){Ld(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.background;return E("div",{className:"lf-background",children:E("div",{style:Bl(e)?e:{},className:"lf-background-area"})})},t=Id([wt],t),t}(Y),Bd=globalThis&&globalThis.__extends||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)}}(),Xd=globalThis&&globalThis.__decorate||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},Xo=function(n){Bd(t,n);function t(e){var o=n.call(this,e)||this;return o.id=De(),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 E("g",{fill:l,opacity:d,children:[E("circle",{cx:0,cy:0,r:c/2}),E("circle",{cx:0,cy:i,r:c/2}),E("circle",{cx:i,cy:0,r:c/2}),E("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 E("path",{d,stroke:l,strokeWidth:c/2,opacity:f,fill:"transparent"})},t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=this.gridOptions,r=o.type,i=o.size,a=i===void 0?1:i,s=e.SCALE_X,l=e.SKEW_Y,u=e.SKEW_X,p=e.SCALE_Y,c=e.TRANSLATE_X,d=e.TRANSLATE_Y,f=[s,l,u,p,c,d].join(","),y="matrix(".concat(f,")");return E("div",{className:"lf-grid",children:E("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[E("defs",{children:E("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:y,x:"0",y:"0",width:a,height:a,children:[r==="dot"&&this.renderDot(),r==="mesh"&&this.renderMesh()]})}),E("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},t=Xd([wt],t),t}(Y);(function(n){n.defaultProps={size:Yc,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function t(e){var o=X(n.defaultProps);return typeof e=="number"?Q(o,{size:e}):typeof e=="boolean"?Q(o,{visible:e}):Q(o,e)}n.getGridOptions=t})(Xo||(Xo={}));var Hd=globalThis&&globalThis.__extends||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)}}(),zd=globalThis&&globalThis.__decorate||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},Gd=function(n){Hd(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 E("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:E("g",{transform:o,children:r})})},t=zd([wt],t),t}(Y),Yd=globalThis&&globalThis.__extends||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)}}(),pe=globalThis&&globalThis.__assign||function(){return pe=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},Vd=function(n){Yd(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,y=l.height;if(a&&p||i&&u){var h=l.getOutlineStyle(),v={};if(Object.keys(h).forEach(function(m){m!=="hover"&&(v[m]=h[m])}),u){var g=h.hover;v=pe(pe({},v),g)}s.push(E(Jt,pe({transform:l.transform,className:"lf-outline-node",x:c,y:d,width:f+10,height:y+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},Kd=function(n){Wd(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=de(de({x1:-1e5,y1:d,x2:1e5,y2:d},s),{stroke:i?s==null?void 0:s.stroke:"none"}),y=de(de({x1:p,y1:-1e5,x2:p,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return E("g",{className:"lf-snapline",children:[E(on,de({},f)),E(on,de({},y))]})},t=Fd([wt],t),t}(Y),Zd=globalThis&&globalThis.__extends||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)}}(),qd=globalThis&&globalThis.__decorate||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},Jd=globalThis&&globalThis.__read||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},$d=globalThis&&globalThis.__spreadArray||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},tf=globalThis&&globalThis.__values||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.")},ct=globalThis&&globalThis.__read||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},Mt=globalThis&&globalThis.__spreadArray||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=function(){function n(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return n.prototype.getStyle=function(){return Oe({},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},Xe=globalThis&&globalThis.__read||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},of={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]},rf=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=Xe(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=Xe(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=Xe(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(C.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},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=Xe(this.CanvasPointToHtmlPoint([t,e]),2),a=i[0],s=i[1],l=Xe([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=Xe(Array.isArray(t)&&t.length===4?t:of[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},Lt([x],n.prototype,"SCALE_X",void 0),Lt([x],n.prototype,"SKEW_Y",void 0),Lt([x],n.prototype,"SKEW_X",void 0),Lt([x],n.prototype,"SCALE_Y",void 0),Lt([x],n.prototype,"TRANSLATE_X",void 0),Lt([x],n.prototype,"TRANSLATE_Y",void 0),Lt([x],n.prototype,"ZOOM_SIZE",void 0),Lt([b],n.prototype,"zoom",null),Lt([b],n.prototype,"resetZoom",null),Lt([b],n.prototype,"translate",null),Lt([b],n.prototype,"focusOn",null),n}(),af=globalThis&&globalThis.__extends||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)}}(),sf=globalThis&&globalThis.__decorate||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},lf=globalThis&&globalThis.__read||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},uf=globalThis&&globalThis.__spreadArray||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},ff=function(n){pf(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(C.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,y=f.autoExpand,h=f.stopMoveGraph;if(r){var v=r.clientX,g=r.clientY,m=a.getPointByClient({x:v,y:g}),O=m.domOverlayPosition,S=O.x,w=O.y,M=m.canvasOverlayPosition,_=M.x,T=M.y;e.t&&Bo(e.t);var A=[],P=10;S<10?A=[P,0]:S+10>c?A=[-P,0]:w<10?A=[0,P]:w+10>d&&(A=[0,-P]),e.setState({endX:_,endY:T,dragging:!0}),e.moveAnchorEnd(_,T),A.length>0&&!h&&y&&(e.t=ml(function(){var k=df(A,2),I=k[0],nt=k[1];u.translate(I,nt);var Z=e.state,it=Z.endX,vt=Z.endY;e.setState({endX:it-I,endY:vt-nt}),e.moveAnchorEnd(it-I,vt-nt)})),p.emit(C.ANCHOR_DRAG,{data:l,e:r,nodeModel:s})}},e.onDragEnd=function(o){var r=o.event;e.t&&Bo(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(C.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,y=d.endY,h=d.dragging,v=Io({x:f,y},a);if(e.preTargetNode&&e.preTargetNode.state!==F.DEFAULT&&e.preTargetNode.setElementState(F.DEFAULT),!!h&&v&&v.node){var g=v.node,m=v.anchor.id,O="".concat(s.id,"_").concat(g.id,"_").concat(m,"_").concat(c),S=e.sourceRuleResults.get(O)||{},w=S.isAllPass,M=S.msg,_=e.targetRuleResults.get(O)||{},T=_.isAllPass,A=_.msg;if(w&&T){g.setElementState(F.DEFAULT);var P=a.getNodeModelById(v.node.id),k=(r=a.edgeGenerator)===null||r===void 0?void 0:r.call(a,s.getData(),P==null?void 0:P.getData()),I=a.addEdge(Wt(Wt({},k),{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}})),nt=e.props.anchorData;return a.eventCenter.emit(C.ANCHOR_DROP,{data:nt,e:o,nodeModel:s,edgeModel:I}),I}var Z=g.getData();return a.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:Z,msg:A||M||"不允许添加连线"}),null}},e.sourceRuleResults=new Map,e.targetRuleResults=new Map,e.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},e.dragHandler=new ne({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=Wt(Wt({},r),r==null?void 0:r.hover);return E("g",{children:[E(rn,Wt({className:"lf-node-anchor-hover"},u,{x:s,y:l})),E(rn,Wt({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=Io({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(F.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 y=p.anchor,h=l.isAllowConnectedAsSource(c,u,y),v=c.isAllowConnectedAsTarget(l,u,y);this.sourceRuleResults.set(f,ko(h)),this.targetRuleResults.set(f,ko(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(F.ALLOW_CONNECT):c.setElementState(F.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==F.DEFAULT&&this.preTargetNode.setElementState(F.DEFAULT)},t.prototype.isShowLine=function(){var e=this.state,o=e.startX,r=e.startY,i=e.endX,a=e.endY,s=Ht(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 E("g",{className:"lf-anchor",children:[E("g",{onClick:function(y){y.stopPropagation(),d.eventCenter.emit(C.ANCHOR_CLICK,{data:u,e:y,nodeModel:c})},onMouseDown:function(y){d.eventCenter.emit(C.ANCHOR_MOUSEDOWN,{data:u,e:y,nodeModel:c}),f!==!1&&e.dragHandler.handleMouseDown(y)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(Wt({sourcePoint:{x:r,y:i},targetPoint:{x:a,y:s}},p)):E(on,Wt({x1:r,y1:i,x2:a,y2:s},p,{"pointer-events":"none"})))]})},t}(Y),hf=globalThis&&globalThis.__extends||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)}}(),Vr=globalThis&&globalThis.__assign||function(){return Vr=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){mf(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(F.TEXT_EDIT),s.emit(C.TEXT_DBCLICK,{data:l.text,model:l})};var r=e.draggable;return o.stepperDrag=new ne({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(),y=i.nodeTextDraggable||c;return E(_l,Wr({},d,f,{className:vf({"lf-element-text":p,"lf-text-draggable":!p&&y,"lf-text-disabled":!p&&!y}),model:o}))},t.prototype.render=function(){var e=this.props.model.text;if(e)return E("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},t}(Y),bf=globalThis&&globalThis.__extends||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)}}(),It=globalThis&&globalThis.__assign||function(){return It=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},xf=function(n){bf(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=It(It({},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,y=r.x,h=r.y,v={};if(p==="autoWrap"&&l){var g=vl({rows:d,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:u,padding:c},rowsLength:f,className:"lf-get-text-height"});v=It(It({},a),{x:y,y:h,width:l,height:g})}else{var m=pp({rows:d,rowsLength:f,fontSize:s}),O=m.width,S=m.height;if(p==="ellipsis"&&(O=l,S=s+2),typeof a.wrapPadding=="string"){var w=a.wrapPadding.split(",").filter(function(Et){return Et.trim()}).map(function(Et){return parseFloat(Et.trim())});if(w.length>0&&w.length<=4){if(w.length===1){var M=po(w,1),_=M[0];w=[_,_,_,_]}else if(w.length===2){var T=po(w,2),A=T[0],P=T[1];w=[A,P,A,P]}else if(w.length===3){var k=po(w,3),I=k[0],P=k[1],nt=k[2];w=[I,P,nt,P]}var Z=po(w,4),it=Z[0],vt=Z[1],Ct=Z[2],oe=Z[3];O+=vt+oe,S+=it+Ct,y=y+(vt-oe)/2,h=h+(Ct-it)/2}}v=It(It({},a),{x:y-1,y:h-1,width:O,height:S})}return E(Jt,It({},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=It({x:r,y:i,value:a,model:e,className:"lf-element-text"},s);return E("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),E(_l,It({},l))]})},t}(wl),Ef=globalThis&&globalThis.__extends||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)}}(),Ho=globalThis&&globalThis.__assign||function(){return Ho=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},xe=function(n){Ef(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,y=f.x,h=f.y;o.moveOffset={dx:c.x-y,dy:c.y-h}}},o.onDragging=function(l){var u,p,c,d,f=l.event,y=o.props,h=y.model,v=y.graphModel,g=v.editConfigModel,m=g.stopMoveGraph,O=g.autoExpand,S=g.snapGrid,w=v.transformModel,M=v.selectNodes,_=v.width,T=v.height,A=v.gridSize;h.isDragging=!0;var P=f,k=P.clientX,I=P.clientY,nt=v.getPointByClient({x:k,y:I}).canvasOverlayPosition,Z=nt.x,it=nt.y,vt=fo(w.CanvasPointToHtmlPoint([Z,it]),2),Ct=vt[0],oe=vt[1];if(Z=Z+((p=(u=o.moveOffset)===null||u===void 0?void 0:u.dx)!==null&&p!==void 0?p:0),it=it+((d=(c=o.moveOffset)===null||c===void 0?void 0:c.dy)!==null&&d!==void 0?d:0),Z=nn(Z,A,S),it=nn(it,A,S),!_||!T){v.moveNode2Coordinate(h.id,Z,it);return}var Et=Ct<0||oe<0||Ct>_||oe>T;if(!(O&&!m&&Et)){var jt=fo(w.CanvasPointToHtmlPoint([Z-h.width/2,it-h.height/2]),2),B=jt[0],U=jt[1],J=fo(w.CanvasPointToHtmlPoint([Z+h.width/2,it+h.height/2]),2),G=J[0],ot=J[1],mt=Math.max(A,20),V=[];B<0?V=[mt,0]:G>v.width?V=[-mt,0]:U<0?V=[0,mt]:ot>v.height&&(V=[0,-mt]),o.t&&Bo(o.t);var st=M.map(function(Rt){return Rt.id});st.indexOf(h.id)===-1&&(st=[h.id]),V.length>0&&!m&&O?o.t=ml(function(){var Rt=fo(V,2),Tt=Rt[0],Re=Rt[1];w.translate(Tt!=null?Tt:0,Re!=null?Re:0);var or=-(Tt!=null?Tt:0)/w.SCALE_X,Dl=-(Re!=null?Re:0)/w.SCALE_X;v.moveNodes(st,or,Dl)}):v.moveNodes(st,Z-h.x,it-h.y)}},o.onDragEnd=function(){o.t&&Bo(o.t);var l=o.props.model;l.isDragging=!1},o.onMouseOut=function(l){zc()&&o.setHoverOff(l)},o.handleMouseUp=function(){var l=o.props.model;o.mouseUpDrag=l.isDragging},o.handleClick=function(l){var u=o.mouseUpDrag===!1;if(o.startTime){var p=o.props,c=p.model,d=p.graphModel;if(u){var f=c.getData(),y=d.getPointByClient({x:l.clientX,y:l.clientY}),h={data:f,e:l,position:y,isSelected:!1,isMultiple:!1},v=l.button===2,g=l.detail===2;if(!v){var m=d.editConfigModel,O=yl(l,m);h.isMultiple=O,c.isSelected&&!g&&O?(h.isSelected=!1,c.setSelected(!1)):(d.selectNodeById(c.id,O),h.isSelected=!0,m.isSilentMode||o.toFront()),g?(m.nodeTextEdit&&c.text.editable&&m.textMode===Pt.TEXT&&(c.setSelected(!1),d.setElementStateById(c.id,F.TEXT_EDIT)),d.eventCenter.emit(C.NODE_DBCLICK,h)):(d.eventCenter.emit(C.ELEMENT_CLICK,h),d.eventCenter.emit(C.NODE_CLICK,h))}}}},o.handleContextMenu=function(l){l.preventDefault();var u=o.props,p=u.model,c=u.graphModel,d=c.editConfigModel,f=p.getData(),y=c.getPointByClient({x:l.clientX,y:l.clientY});c.setElementStateById(p.id,F.SHOW_MENU,y.domOverlayPosition),p.isSelected||c.selectNodeById(p.id),c.eventCenter.emit(C.NODE_CONTEXTMENU,{data:f,e:l,position:y}),d.isSilentMode||o.toFront()},o.handleMouseDown=function(l){var u=o.props,p=u.model,c=u.graphModel;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(C.NODE_FOCUS,{data:u.getData()})},o.handleBlur=function(){var l=o.props,u=l.model,p=l.graphModel;p.eventCenter.emit(C.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(C.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(C.NODE_MOUSELEAVE,{data:d,e:l}))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter,s=e.model;return o.stepDrag=new ne({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),o.modelDisposer=Us(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?le(r.anchors,function(p,c){var d=r.getAnchorLineStyle(p),f=r.getAnchorStyle(p);return E(ff,{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 E(yf,{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?E(Hp,{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!==Pt.TEXT||r.state===F.TEXT_EDIT)return null;if(r.text){var s=!1;return a.nodeTextDraggable&&r.text.draggable&&(s=!0),E(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 F.ALLOW_CONNECT:a+=" lf-node-allow";break;case F.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,y=o.transform,h=o.getOuterGAttributes(),v=h.className,g=v===void 0?"":v,m=Tf(h,["className"]),O=E("g",{className:"lf-node-content",children:[E("g",{transform:y,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),u&&this.getResizeControl()]}),!a&&this.getAnchors()]}),S;return d?(s&&f&&this.stepDrag.setStep(p*c),S=E("g",Ho({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:O}))):S=E("g",Ho({className:"".concat(this.getStateClassName()," ").concat(g)},m,{children:O})),S},t.isObserved=!1,t}(Y),Of=globalThis&&globalThis.__extends||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)}}(),Fr=globalThis&&globalThis.__assign||function(){return Fr=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},Cf=globalThis&&globalThis.__spreadArray||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},Zt;(function(n){n.SOURCE="SOURCE",n.TARGET="TARGET"})(Zt||(Zt={}));var es=function(n){jf(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,y=c.pointsList;o.oldEdge={startPoint:d,endPoint:f,pointsList:y},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,y=o.props,h=y.graphModel,v=y.type,g=h.transformModel,m=h.editConfigModel,O=Lf(g.moveCanvasPointByHtml([d,f],u,p),2),S=O[0],w=O[1];o.setState({endX:S,endY:w,dragging:!0});var M=o.props.edgeModel,_=Io({x:d,y:f},h);if(_&&_.node&&o.isAllowAdjust(_).pass){var T=M.startPoint,A=M.endPoint,P=M.sourceNode,k=M.targetNode,I=v===Zt.SOURCE?{startPoint:{x:_.anchor.x,y:_.anchor.y},endPoint:{x:A.x,y:A.y},sourceNode:_.node,targetNode:k}:{startPoint:{x:T.x,y:T.y},endPoint:{x:_.anchor.x,y:_.anchor.y},sourceNode:P,targetNode:_.node};M.updateAfterAdjustStartAndEnd(I)}else v===Zt.SOURCE?M.updateStartPoint({x:S,y:w}):M.updateEndPoint({x:S,y:w});M.text.value&&m.adjustEdge&&M.setText(Object.assign({},M.text,M.textPosition))},o.onDragEnd=function(l){var u,p,c,d=l.event;try{o.setState({dragging:!1});var f=o.props,y=f.graphModel,h=f.edgeModel,v=f.type,g=o.state,m=g.endX,O=g.endY,S=g.dragging,w=Io({x:m,y:O},y);if(!S)return;var M=!1,_=void 0;if(w&&w.node){var T=o.isAllowAdjust(w),A=T.pass,P=T.msg,k=T.newTargetNode;if(A){var I=h.getData(),nt=I.text,Z=I.sourceAnchorId,it=Z===void 0?"":Z,vt=I.targetAnchorId,Ct=vt===void 0?"":vt,oe=Rf(I,["text","sourceAnchorId","targetAnchorId"]);if(_=kt(kt({sourceAnchorId:it,targetAnchorId:Ct},oe),{text:(nt==null?void 0:nt.value)||""}),v===Zt.SOURCE){var Et=y.getNodeModelById(w.node.id),jt=y.getNodeModelById(h.targetNodeId),B=(u=y.edgeGenerator)===null||u===void 0?void 0:u.call(y,Et==null?void 0:Et.getData(),jt==null?void 0:jt.getData(),_);_=kt(kt({},B),{sourceNodeId:w.node.id,sourceAnchorId:w.anchor.id,startPoint:{x:w.anchor.x,y:w.anchor.y},targetNodeId:h.targetNodeId,endPoint:kt({},h.endPoint)}),h.sourceNodeId===w.node.id&&h.sourceAnchorId===w.anchor.id&&(M=!0)}else if(v===Zt.TARGET){var Et=y.getNodeModelById(h.sourceNodeId),jt=y.getNodeModelById(w.node.id),B=(p=y.edgeGenerator)===null||p===void 0?void 0:p.call(y,Et==null?void 0:Et.getData(),jt==null?void 0:jt.getData(),_);_=kt(kt({},B),{sourceNodeId:h.sourceNodeId,startPoint:kt({},h.startPoint),targetNodeId:w.node.id,targetAnchorId:w.anchor.id,endPoint:{x:w.anchor.x,y:w.anchor.y}}),h.targetNodeId===w.node.id&&h.targetAnchorId===w.anchor.id&&(M=!0)}}else{M=!0;var U=k.getData();y.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:U,msg:P})}}else M=!0;if(M)o.recoveryEdge();else{var J=h.getData();y.deleteEdgeById(h.id);var G=y.addEdge(kt({},_));y.eventCenter.emit(C.EDGE_EXCHANGE_NODE,{data:{newEdge:G.getData(),oldEdge:J}})}(c=o.preTargetNode)===null||c===void 0||c.setElementState(F.DEFAULT)}finally{var y=o.props.graphModel;y.eventCenter.emit(C.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 ne({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,y;if(p===Zt.SOURCE?(c=e.node,d=s,f=e.anchor,y=s.getAnchorInfo(u)):(c=a,d=e.node,y=e.anchor,f=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==e.node&&this.preTargetNode.setElementState(F.DEFAULT),this.preTargetNode=e.node,y.id===f.id)return{pass:!1,msg:"",newTargetNode:d};var h="".concat(c.id,"_").concat(d.id,"_").concat(f.id,"_").concat(y.id);if(!this.targetRuleResults.has(h)){var v=c.isAllowConnectedAsSource(d,f,y,i),g=d.isAllowConnectedAsTarget(c,f,y,i);this.sourceRuleResults.set(h,ko(v)),this.targetRuleResults.set(h,ko(g))}var m=this.sourceRuleResults.get(h),O=m.isAllPass,S=m.msg,w=this.targetRuleResults.get(h),M=w.isAllPass,_=w.msg,T=O&&M?F.ALLOW_CONNECT:F.NOT_ALLOW_CONNECT;return p===Zt.SOURCE?c.setElementState(T):d.setElementState(T),{pass:O&&M,msg:_||S,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 E("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(o,r,a)})},t}(Y),If=globalThis&&globalThis.__extends||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)}}(),Qr=globalThis&&globalThis.__assign||function(){return Qr=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},er=function(n){kf(t,n);function t(){var e=n.call(this)||this;return e.textRef=Ko(),e.handleHover=function(o,r){var i=e.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(o);var l=o?C.EDGE_MOUSEENTER:C.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,F.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(C.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,y=s.text,h=s.modelType;if(d&&d.id===f&&l.setElementStateById(f,F.DEFAULT),c.edgeTextEdit&&y.editable&&(s.setSelected(!1),l.setElementStateById(f,F.TEXT_EDIT)),h===z.POLYLINE_EDGE){var v=s,g=l.getPointByClient({x:o.x,y:o.y}).canvasOverlayPosition,m=g.x,O=g.y;v.dbClickPosition=hl({x:m,y:O},v.points)}l.eventCenter.emit(C.EDGE_DBCLICK,{data:u,e:o,position:p})}else l.eventCenter.emit(C.ELEMENT_CLICK,{data:u,e:o,position:p}),l.eventCenter.emit(C.EDGE_CLICK,{data:u,e:o,position:p});var S=l.editConfigModel;l.selectEdgeById(s.id,yl(o,S)),S.isSilentMode||e.toFront()}}},e.handleFocus=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(C.EDGE_FOCUS,{data:r.getData()})},e.handleBlur=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(C.EDGE_BLUR,{data:r.getData()})},e}return t.prototype.getShape=function(){return E("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!==Pt.TEXT||r.state===F.TEXT_EDIT)return null;if(r.text){var s=!1;return a.edgeTextDraggable&&r.text.draggable&&(s=!0),E(xf,{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=Bf(this.getLastTwoPoints(),2),p=u[0],c=u[1],d="auto";return p!==null&&c!==null&&(d=od(nd({x:c.x-p.x,y:c.y-p.y,z:0}))),E("g",{children:E("defs",{children:[E("marker",{id:"marker-start-".concat(o),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),E("marker",{id:"marker-end-".concat(o),refX:l,refY:a,overflow:"visible",orient:d,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},t.prototype.getStartArrow=function(){return E("path",{})},t.prototype.getEndArrow=function(){var e=this.props.model,o=e.getArrowStyle(),r=o.stroke,i=o.strokeWidth,a=o.offset,s=o.verticalLength;return E("path",{stroke:r,fill:r,strokeWidth:i,transform:"rotate(180)",d:"M 0 0 L ".concat(a," -").concat(s," L ").concat(a," ").concat(s," Z")})},t.prototype.getAdjustPointShape=function(e,o,r){var i=r.getAdjustPointStyle();return E(rn,Pn({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 E("g",{children:[a&&s&&E(es,Pn({type:Zt.SOURCE},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r})),a&&l&&E(es,Pn({type:Zt.TARGET},p,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r}))]})},t.prototype.getAnimation=function(){},t.prototype.getAppendWidth=function(){return E("g",{})},t.prototype.getAppend=function(){return E("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 E("g",{children:[E("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}(Y),Xf=globalThis&&globalThis.__extends||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)}}(),ti=globalThis&&globalThis.__assign||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},ns=function(n){Xf(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,y=l.animationIterationCount,h=l.animationTimingFunction,v=l.animationDirection;return E(Bn,ti({d:i},o,s,a?{strokeDasharray:u,stroke:p,style:{strokeDashoffset:c,animationName:d,animationDuration:f,animationIterationCount:y,animationTimingFunction:h,animationDirection:v}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model.path;return E(Bn,{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=Hf(wa(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 wa(r,o)},t}(er),zf=globalThis&&globalThis.__extends||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)}}(),ei=globalThis&&globalThis.__assign||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},rs=function(n){Gf(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=Yf(u.fixDeltaXY(r,i),2),d=c[0],f=c[1],y=s,h=p.adjustEdgeMiddle;h?e.appendInfo=y.dragAppendSimple(e.appendInfo,{x:d,y:f}):e.appendInfo=y.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(C.EDGE_ADJUST,{data:s.getData()})},e.beforeDragStart=function(o,r){r.draggable&&e.drag.handleMouseDown(o),e.appendInfo=r},e.drag=new ne({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,y=s.animationTimingFunction,h=s.animationDirection;return E(Ip,we({points:o},a,i,r?{strokeDasharray:l,stroke:u,style:{strokeDashoffset:p,animationName:c,animationDuration:d,animationIterationCount:f,animationTimingFunction:y,animationDirection:h}}:{}))},t.prototype.getArrowInfo=function(){var e=this.props.model,o=e.points,r=e.isSelected,i=this.state.hover,a=je(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=je(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=Ln(we(we({},a),{type:"start"})),l=Ln(we(we({},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 E(Bn,{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 y="lf-polyline-append",h={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=E("g",{className:y,children:c.getAppendShape(h)}),g=i.editConfigModel,m=g.adjustEdge,O=g.adjustEdgeMiddle;if(m&&s){var S=h.startIndex,w=h.endIndex,M=O&&(S===0||w===u-1);h.draggable=!M,h.start.x===h.end.x?(h.draggable&&(y+="-ew-resize"),h.direction=et.VERTICAL):h.start.y===h.end.y&&(h.draggable&&(y+="-ns-resize"),h.direction=et.HORIZONTAL),v=E("g",{className:c.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(_){return e.beforeDragStart(_,h)},children:E("g",{className:y,children:c.getAppendShape(h)})})}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},Kf=globalThis&&globalThis.__read||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},Zf=function(n){Wf(t,n);function t(e){var o=n.call(this,e)||this;return o.ref=Ko(),o.__prevText={type:"",text:"",id:""},o.keyupHandler=function(r){var i=o.props.graphModel.textEditElement;r.key==="Enter"&&r.altKey&&(i==null||i.setElementState(F.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 y={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(r.BaseType===rt.EDGE){var h=s.edgeText,v=h.overflowMode,g=h.lineHeight,m=h.wrapPadding,O=h.textWidth;O&&v==="autoWrap"&&(u=re(re({},y),{width:O,minWidth:O,lineHeight:g,padding:m}))}else if(r.BaseType===rt.NODE){var S=s.nodeText,v=S.overflowMode,g=S.lineHeight,m=S.wrapPadding,O=S.textWidth,w=r.width,M=r.modelType,_=r.textWidth,T=_||O||w;(M!==z.TEXT_NODE&&v==="autoWrap"||M===z.TEXT_NODE&&O)&&(u=re(re({},y),{width:T,minWidth:T,lineHeight:g,padding:m}))}var A=r.text,P=A.x,k=A.y,I=Kf(a.CanvasPointToHtmlPoint([P,k]),2),nt=I[0],Z=I[1];return{style:re(re({left:nt,top:Z},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(C.TEXT_UPDATE,{data:re({},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?E("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=Ff([wt],t),t}(Y),qf=globalThis&&globalThis.__extends||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)}}(),Jf=globalThis&&globalThis.__decorate||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},fr=globalThis&&globalThis.__read||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},$f=globalThis&&globalThis.__spreadArray||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},th=[Zf,Qf],eh=function(){function n(t){var e=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=t,at(th,function(i){e.isDisabled(i.toolName)||e.registerTool(i.toolName,i)});var o=t.graphModel,r=o.eventCenter;r.on("".concat(C.GRAPH_TRANSFORM,",").concat(C.NODE_CLICK,",").concat(C.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(F.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()},hr([x],n.prototype,"toolMap",void 0),hr([b],n.prototype,"disableTool",null),hr([b],n.prototype,"enableTool",null),n}();function nh(n){throw new Error("[mobx-utils] "+n)}function Go(n,t){t===void 0&&(t="Illegal state"),n||nh(t)}var Sl=function(n){return n&&n!==Object.prototype&&Object.getOwnPropertyNames(n).concat(Sl(Object.getPrototypeOf(n))||[])},oh=function(n){var t=Sl(n),e=t.filter(function(o,r){return t.indexOf(o)===r});return e},rh=function(n){return oh(n).filter(function(t){return t!=="constructor"&&!~t.indexOf("__")})},Ml="pending",Yo="fulfilled",Si="rejected";function ih(n){switch(this.state){case Ml:return n.pending&&n.pending(this.value);case Si:return n.rejected&&n.rejected(this.value);case Yo:return n.fulfilled?n.fulfilled(this.value):this.value}}function is(n,t){if(Go(arguments.length<=2,"fromPromise expects up to two arguments"),Go(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=Yo}),b("observableFromPromise-reject",function(r){e.value=r,e.state=Si})),e.isPromiseBasedObservable=!0,e.case=ih;var o=t&&t.state===Yo?t.value:void 0;return Ar(e,{value:o,state:Ml},{},{deep:!1}),e}(function(n){n.reject=b("fromPromise.reject",function(e){var o=n(Promise.reject(e));return o.state=Si,o.value=e,o});function t(e){e===void 0&&(e=void 0);var o=n(Promise.resolve(e));return o.state=Yo,o.value=e,o}n.resolve=b("fromPromise.resolve",t)})(is||(is={}));var ho=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;Xu(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()},ho([x.ref],n.prototype,"current",void 0),ho([b.bound],n.prototype,"next",null),ho([b.bound],n.prototype,"complete",null),ho([b.bound],n.prototype,"error",null),n})();var Uo=function(){return Uo=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},ah=["model","reset","submit","isDirty","isPropertyDirty","resetProperty"];(function(){function n(t){var e=this;this.model=t,this.localValues=x.map({}),this.localComputedValues=x.map({}),this.isPropertyDirty=function(o){return e.localValues.has(o)},Go(Nt(t),"createViewModel expects an observable object"),rh(t).forEach(function(o){if(!(o===L||o==="__mobxDidRunLazyInitializers")){if(Go(ah.indexOf(o)===-1,"The propertyname "+o+" is reserved and cannot be used with viewModels"),Ii(t,o)){var r=Wn(t,o).derivation;e.localComputedValues.set(o,tt(r.bind(e)))}var i=Object.getOwnPropertyDescriptor(t,o),a=i?{enumerable:i.enumerable}:{};Object.defineProperty(e,o,Uo(Uo({},a),{configurable:!0,get:function(){return Ii(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;en(this.localValues).forEach(function(e){var o=t.localValues.get(e),r=t.model[e];ee(r)?r.replace(o):xt(r)?(r.clear(),r.merge(o)):Wu(o)||(t.model[e]=o)}),this.localValues.clear()},n.prototype.reset=function(){this.localValues.clear()},n.prototype.resetProperty=function(t){this.localValues.delete(t)},fn([tt],n.prototype,"isDirty",null),fn([tt],n.prototype,"changedValues",null),fn([b.bound],n.prototype,"submit",null),fn([b.bound],n.prototype,"reset",null),fn([b.bound],n.prototype,"resetProperty",null),n})();function yr(n){if(!n)return"ROOT";for(var t=[];n.parent;)t.push(n.path),n=n.parent;return t.reverse().join("/")}function gr(n){return Nt(n)||ee(n)||xt(n)}function sh(n,t){var e=new WeakMap;function o(s){var l=e.get(s.object);r(s,l),t(s,yr(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=sh(t,ds(function(){var o=t.modelToHistoryData();o&&e.add(ni({},o))},this.waitTime))},n.prototype.destroy=function(){this.undos=[],this.redos=[],this.curData=null,this.stopWatch&&this.stopWatch()},n}(),Al={exports:{}};(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(_,T,A){if(_.addEventListener){_.addEventListener(T,A,!1);return}_.attachEvent("on"+T,A)}function c(_){if(_.type=="keypress"){var T=String.fromCharCode(_.which);return _.shiftKey||(T=T.toLowerCase()),T}return r[_.which]?r[_.which]:i[_.which]?i[_.which]:String.fromCharCode(_.which).toLowerCase()}function d(_,T){return _.sort().join(",")===T.sort().join(",")}function f(_){var T=[];return _.shiftKey&&T.push("shift"),_.altKey&&T.push("alt"),_.ctrlKey&&T.push("ctrl"),_.metaKey&&T.push("meta"),T}function y(_){if(_.preventDefault){_.preventDefault();return}_.returnValue=!1}function h(_){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(_,T,A){return A||(A=g()[_]?"keydown":"keypress"),A=="keypress"&&T.length&&(A="keydown"),A}function O(_){return _==="+"?["+"]:(_=_.replace(/\+{2}/g,"+plus"),_.split("+"))}function S(_,T){var A,P,k,I=[];for(A=O(_),k=0;k1){Et(B,mt,U,J);return}V=S(B,J),T._callbacks[V.key]=T._callbacks[V.key]||[],it(V.key,V.modifiers,{type:V.action},G,B,ot),T._callbacks[V.key][G?"unshift":"push"]({callback:U,modifiers:V.modifiers,action:V.action,seq:G,level:ot,combo:B})}T._bindMultiple=function(B,U,J){for(var G=0;G-1||w(T,A.target))return!1;if("composedPath"in _&&typeof _.composedPath=="function"){var P=_.composedPath()[0];P!==_.target&&(T=P)}return T.tagName=="INPUT"||T.tagName=="SELECT"||T.tagName=="TEXTAREA"||T.isContentEditable},M.prototype.handleKey=function(){var _=this;return _._handleKey.apply(_,arguments)},M.addKeycodes=function(_){for(var T in _)_.hasOwnProperty(T)&&(r[T]=_[T]);l=null},M.init=function(){var _=M(e);for(var T in _)T.charAt(0)!=="_"&&(M[T]=function(A){return function(){return _[A].apply(_,arguments)}}(T))},M.init(),t.Mousetrap=M,n.exports&&(n.exports=M),typeof o=="function"&&o.amd&&o(function(){return M})})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)})(Al);var ch=Al.exports;const ph=hs(ch);var as=globalThis&&globalThis.__assign||function(){return as=Object.assign||function(n){for(var t,e=1,o=arguments.length;e0&&n.pointsList.forEach(function(e){e.x+=t,e.y+=t}),fs(n.text)||(n.text.x+=t,n.text.y+=t),n}var He=40,yo=40;function dh(n,t){var e=n.keyboard,o=e.options.keyboard;e.on(["cmd + c","ctrl + c"],function(){if(yo=He,!(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?(Vt=null,!0):(Vt=i,Vt.nodes.forEach(function(s){return ss(s,He)}),Vt.edges.forEach(function(s){return ls(s,He)}),!1)}),e.on(["cmd + v","ctrl + v"],function(){if(!(o!=null&&o.enabled)||t.textEditElement)return!0;if(Vt&&(Vt.nodes||Vt.edges)){n.clearSelectElements();var r=n.addElements(Vt,yo);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)}),Vt.nodes.forEach(function(i){return ss(i,He)}),Vt.edges.forEach(function(i){return ls(i,He)}),yo=yo+He}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 fh=function(){function n(t){t.keyboard||(t.keyboard={enabled:!1}),this.options=t;var e=t.lf;this.target=e.container,this.mousetrap=new ph(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(Gl(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=globalThis&&globalThis.__assign||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},vr=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o>1,n!==0;)r=ri(r,r,e);return o}function bh(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 xh(n,t,e){var o=bh(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 Eh(n){return n.substring(0,2)==="0x"&&(n=n.substring(2)),n=n.toLowerCase(),xh(n,16,10)}class Th{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 Eh(a)}}const Oh=new Th({mid:Ul(0,1023),offset:54*31536e3*1e3});function Ch(){return Oh.generate()}export{Nh as H,_h as N,Fe as Q,Ph as X,Ch as Y,Pl as a,ns as f,Dh as k,yh as w,La as z};