123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import{aP as Ul,aQ as bs,ap as xs,aR as Fl,ar as Es,aS as zl,aT as Gl,aU as Gn,aV as $l,aW as Os,aX as Vl,aY as Ts,aZ as Wl,a_ as Kl,as as Zl,a$ as ql,b0 as Jl,b1 as Ql,b2 as tu,b3 as eu,b4 as ru,b5 as nu,aq as ws,b6 as ou,b7 as iu,b8 as Y,b9 as pi,ba as Ss,bb as so,bc as We,bd as de,be as Qe,bf as Je,bg as au,bh as su,bi as Ms,N as Oo,bj as lu,bk as uu,aF as $n,a6 as cu,d as fu,m as Ii,j as du,n as pu,w as hu,p as vu,o as yu,c as gu,e as _u,_ as mu}from"./index.js";import{f as Ie}from"./find.5020d717.js";var bu=Object.prototype,xu=bu.hasOwnProperty,Eu=Ul(function(r,t){if(bs(t)||xs(t)){Fl(t,Es(t),r);return}for(var e in t)xu.call(t,e)&&zl(r,e,t[e])}),tt=Eu;function Ou(r,t,e,n){var o=-1,i=r==null?0:r.length;for(n&&i&&(e=r[++o]);++o<i;)e=t(e,r[o],o,r);return e}function Tu(r){return typeof r=="function"?r:Gl}function ut(r,t){var e=Gn(r)?$l:Os;return e(r,Tu(t))}function wu(r,t){return Vl(t,function(e){return[e,r[e]]})}function Su(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=[n,n]}),e}var Mu="[object Map]",Au="[object Set]";function Pu(r){return function(t){var e=Ts(t);return e==Mu?Wl(t):e==Au?Su(t):wu(t,r(t))}}var Du=Pu(Es),we=Du,Nu=Object.prototype,Cu=Nu.hasOwnProperty;function Ru(r,t){return r!=null&&Cu.call(r,t)}function Bi(r,t){return r!=null&&Kl(r,t,Ru)}var ju=Math.max;function Lu(r,t,e){var n=r==null?0:r.length;if(!n)return-1;var o=e==null?0:Zl(e);return o<0&&(o=ju(n+o,0)),ql(r,t,o)}var Iu="[object Boolean]";function To(r){return r===!0||r===!1||Jl(r)&&Ql(r)==Iu}var Bu="[object Map]",Xu="[object Set]",ku=Object.prototype,Yu=ku.hasOwnProperty;function As(r){if(r==null)return!0;if(xs(r)&&(Gn(r)||typeof r=="string"||typeof r.splice=="function"||tu(r)||eu(r)||ru(r)))return!r.length;var t=Ts(r);if(t==Bu||t==Xu)return!r.size;if(bs(r))return!nu(r).length;for(var e in r)if(Yu.call(r,e))return!1;return!0}function Hu(r,t){var e={};return t=ws(t),ou(r,function(n,o,i){iu(e,t(n,o,i),n)}),e}function Uu(r,t,e,n,o){return o(r,function(i,a,s){e=n?(n=!1,i):t(e,i,a,s)}),e}function Fu(r,t,e){var n=Gn(r)?Ou:Uu,o=arguments.length<3;return n(r,ws(t),e,o,Os)}var Vn,H,Ps,Pe,Xi,Ds,wo,hi,So,Mo,jr={},Ns=[],zu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wn=Array.isArray;function be(r,t){for(var e in t)r[e]=t[e];return r}function Cs(r){r&&r.parentNode&&r.parentNode.removeChild(r)}function tr(r,t,e){var n,o,i,a={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Vn.call(arguments,2):e),typeof r=="function"&&r.defaultProps!=null)for(i in r.defaultProps)a[i]===void 0&&(a[i]=r.defaultProps[i]);return _n(r,a,n,o,null)}function _n(r,t,e,n,o){var i={type:r,props:t,key:e,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o==null?++Ps:o,__i:-1,__u:0};return o==null&&H.vnode!=null&&H.vnode(i),i}function vi(){return{current:null}}function er(r){return r.children}function $(r,t){this.props=r,this.context=t}function rr(r,t){if(t==null)return r.__?rr(r.__,r.__i+1):null;for(var e;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null)return e.__e;return typeof r.type=="function"?rr(r):null}function Rs(r){var t,e;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,t=0;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null){r.__e=r.__c.base=e.__e;break}return Rs(r)}}function ki(r){(!r.__d&&(r.__d=!0)&&Pe.push(r)&&!En.__r++||Xi!==H.debounceRendering)&&((Xi=H.debounceRendering)||Ds)(En)}function En(){var r,t,e,n,o,i,a,s;for(Pe.sort(wo);r=Pe.shift();)r.__d&&(t=Pe.length,n=void 0,i=(o=(e=r).__v).__e,a=[],s=[],e.__P&&((n=be({},o)).__v=o.__v+1,H.vnode&&H.vnode(n),yi(e.__P,n,o,e.__n,e.__P.namespaceURI,32&o.__u?[i]:null,a,i==null?rr(o):i,!!(32&o.__u),s),n.__v=o.__v,n.__.__k[n.__i]=n,Is(a,n,s),n.__e!=i&&Rs(n)),Pe.length>t&&Pe.sort(wo));En.__r=0}function js(r,t,e,n,o,i,a,s,l,u,f){var c,d,p,y,h,g=n&&n.__k||Ns,v=t.length;for(e.__d=l,Gu(e,t,g),l=e.__d,c=0;c<v;c++)(p=e.__k[c])!=null&&(d=p.__i===-1?jr:g[p.__i]||jr,p.__i=c,yi(r,p,d,o,i,a,s,l,u,f),y=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&gi(d.ref,null,p),f.push(p.ref,p.__c||y,p)),h==null&&y!=null&&(h=y),65536&p.__u||d.__k===p.__k?l=Ls(p,l,r):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:y&&(l=y.nextSibling),p.__d=void 0,p.__u&=-196609);e.__d=l,e.__e=h}function Gu(r,t,e){var n,o,i,a,s,l=t.length,u=e.length,f=u,c=0;for(r.__k=[],n=0;n<l;n++)(o=t[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(a=n+c,(o=r.__k[n]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?_n(null,o,null,null,null):Wn(o)?_n(er,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?_n(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=r,o.__b=r.__b+1,i=null,(s=o.__i=$u(o,e,a,f))!==-1&&(f--,(i=e[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&c--,typeof o.type!="function"&&(o.__u|=65536)):s!==a&&(s==a-1?c--:s==a+1?c++:(s>a?c--:c++,o.__u|=65536))):o=r.__k[n]=null;if(f)for(n=0;n<u;n++)(i=e[n])!=null&&(131072&i.__u)==0&&(i.__e==r.__d&&(r.__d=rr(i)),Bs(i,i))}function Ls(r,t,e){var n,o;if(typeof r.type=="function"){for(n=r.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=r,t=Ls(n[o],t,e));return t}r.__e!=t&&(t&&r.type&&!e.contains(t)&&(t=rr(r)),e.insertBefore(r.__e,t||null),t=r.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function On(r,t){return t=t||[],r==null||typeof r=="boolean"||(Wn(r)?r.some(function(e){On(e,t)}):t.push(r)),t}function $u(r,t,e,n){var o=r.key,i=r.type,a=e-1,s=e+1,l=t[e];if(l===null||l&&o==l.key&&i===l.type&&(131072&l.__u)==0)return e;if(n>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||s<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&o==l.key&&i===l.type)return a;a--}if(s<t.length){if((l=t[s])&&(131072&l.__u)==0&&o==l.key&&i===l.type)return s;s++}}return-1}function Yi(r,t,e){t[0]==="-"?r.setProperty(t,e==null?"":e):r[t]=e==null?"":typeof e!="number"||zu.test(t)?e:e+"px"}function Kr(r,t,e,n,o){var i;t:if(t==="style")if(typeof e=="string")r.style.cssText=e;else{if(typeof n=="string"&&(r.style.cssText=n=""),n)for(t in n)e&&t in e||Yi(r.style,t,"");if(e)for(t in e)n&&e[t]===n[t]||Yi(r.style,t,e[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in r||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),r.l||(r.l={}),r.l[t+i]=e,e?n?e.u=n.u:(e.u=hi,r.addEventListener(t,i?Mo:So,i)):r.removeEventListener(t,i?Mo:So,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in r)try{r[t]=e==null?"":e;break t}catch{}typeof e=="function"||(e==null||e===!1&&t[4]!=="-"?r.removeAttribute(t):r.setAttribute(t,t=="popover"&&e==1?"":e))}}function Hi(r){return function(t){if(this.l){var e=this.l[t.type+r];if(t.t==null)t.t=hi++;else if(t.t<e.u)return;return e(H.event?H.event(t):t)}}}function yi(r,t,e,n,o,i,a,s,l,u){var f,c,d,p,y,h,g,v,_,O,w,S,M,m,T,P,A=t.type;if(t.constructor!==void 0)return null;128&e.__u&&(l=!!(32&e.__u),i=[s=t.__e=e.__e]),(f=H.__b)&&f(t);t:if(typeof A=="function")try{if(v=t.props,_="prototype"in A&&A.prototype.render,O=(f=A.contextType)&&n[f.__c],w=f?O?O.props.value:f.__:n,e.__c?g=(c=t.__c=e.__c).__=c.__E:(_?t.__c=c=new A(v,w):(t.__c=c=new $(v,w),c.constructor=A,c.render=Wu),O&&O.sub(c),c.props=v,c.state||(c.state={}),c.context=w,c.__n=n,d=c.__d=!0,c.__h=[],c._sb=[]),_&&c.__s==null&&(c.__s=c.state),_&&A.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=be({},c.__s)),be(c.__s,A.getDerivedStateFromProps(v,c.__s))),p=c.props,y=c.state,c.__v=t,d)_&&A.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),_&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(_&&A.getDerivedStateFromProps==null&&v!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(v,w),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(v,c.__s,w)===!1||t.__v===e.__v)){for(t.__v!==e.__v&&(c.props=v,c.state=c.__s,c.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(I){I&&(I.__=t)}),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[],c.__h.length&&a.push(c);break t}c.componentWillUpdate!=null&&c.componentWillUpdate(v,c.__s,w),_&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,y,h)})}if(c.context=w,c.props=v,c.__P=r,c.__e=!1,M=H.__r,m=0,_){for(c.state=c.__s,c.__d=!1,M&&M(t),f=c.render(c.props,c.state,c.context),T=0;T<c._sb.length;T++)c.__h.push(c._sb[T]);c._sb=[]}else do c.__d=!1,M&&M(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++m<25);c.state=c.__s,c.getChildContext!=null&&(n=be(be({},n),c.getChildContext())),_&&!d&&c.getSnapshotBeforeUpdate!=null&&(h=c.getSnapshotBeforeUpdate(p,y)),js(r,Wn(P=f!=null&&f.type===er&&f.key==null?f.props.children:f)?P:[P],t,e,n,o,i,a,s,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&a.push(c),g&&(c.__E=c.__=null)}catch(I){if(t.__v=null,l||i!=null){for(t.__u|=l?160:128;s&&s.nodeType===8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else t.__e=e.__e,t.__k=e.__k;H.__e(I,t,e)}else i==null&&t.__v===e.__v?(t.__k=e.__k,t.__e=e.__e):t.__e=Vu(e.__e,t,e,n,o,i,a,l,u);(f=H.diffed)&&f(t)}function Is(r,t,e){t.__d=void 0;for(var n=0;n<e.length;n++)gi(e[n],e[++n],e[++n]);H.__c&&H.__c(t,r),r.some(function(o){try{r=o.__h,o.__h=[],r.some(function(i){i.call(o)})}catch(i){H.__e(i,o.__v)}})}function Vu(r,t,e,n,o,i,a,s,l){var u,f,c,d,p,y,h,g=e.props,v=t.props,_=t.type;if(_==="svg"?o="http://www.w3.org/2000/svg":_==="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!_&&(_?p.localName===_:p.nodeType===3)){r=p,i[u]=null;break}}if(r==null){if(_===null)return document.createTextNode(v);r=document.createElementNS(o,_,v.is&&v),s&&(H.__m&&H.__m(t,i),s=!1),i=null}if(_===null)g===v||s&&r.data===v||(r.data=v);else{if(i=i&&Vn.call(r.childNodes),g=e.props||jr,!s&&i!=null)for(g={},u=0;u<r.attributes.length;u++)g[(p=r.attributes[u]).name]=p.value;for(u in g)if(p=g[u],u!="children"){if(u=="dangerouslySetInnerHTML")c=p;else if(!(u in v)){if(u=="value"&&"defaultValue"in v||u=="checked"&&"defaultChecked"in v)continue;Kr(r,u,null,p,o)}}for(u in v)p=v[u],u=="children"?d=p:u=="dangerouslySetInnerHTML"?f=p:u=="value"?y=p:u=="checked"?h=p:s&&typeof p!="function"||g[u]===p||Kr(r,u,p,g[u],o);if(f)s||c&&(f.__html===c.__html||f.__html===r.innerHTML)||(r.innerHTML=f.__html),t.__k=[];else if(c&&(r.innerHTML=""),js(r,Wn(d)?d:[d],t,e,n,_==="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:e.__k&&rr(e,0),s,l),i!=null)for(u=i.length;u--;)Cs(i[u]);s||(u="value",_==="progress"&&y==null?r.removeAttribute("value"):y!==void 0&&(y!==r[u]||_==="progress"&&!y||_==="option"&&y!==g[u])&&Kr(r,u,y,g[u],o),u="checked",h!==void 0&&h!==r[u]&&Kr(r,u,h,g[u],o))}return r}function gi(r,t,e){try{if(typeof r=="function"){var n=typeof r.__u=="function";n&&r.__u(),n&&t==null||(r.__u=r(t))}else r.current=t}catch(o){H.__e(o,e)}}function Bs(r,t,e){var n,o;if(H.unmount&&H.unmount(r),(n=r.ref)&&(n.current&&n.current!==r.__e||gi(n,null,t)),(n=r.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){H.__e(i,t)}n.base=n.__P=null}if(n=r.__k)for(o=0;o<n.length;o++)n[o]&&Bs(n[o],t,e||typeof r.type!="function");e||Cs(r.__e),r.__c=r.__=r.__e=r.__d=void 0}function Wu(r,t,e){return this.constructor(r,e)}function Ku(r,t,e){var n,o,i,a;H.__&&H.__(r,t),o=(n=typeof e=="function")?null:e&&e.__k||t.__k,i=[],a=[],yi(t,r=(!n&&e||t).__k=tr(er,null,[r]),o||jr,jr,t.namespaceURI,!n&&e?[e]:o?null:t.firstChild?Vn.call(t.childNodes):null,i,!n&&e?e:o?o.__e:t.firstChild,n,a),Is(i,r,a)}Vn=Ns.slice,H={__e:function(r,t,e,n){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(r)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(r,n||{}),a=o.__d),a)return o.__E=o}catch(s){r=s}throw r}},Ps=0,$.prototype.setState=function(r,t){var e;e=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=be({},this.state),typeof r=="function"&&(r=r(be({},e),this.props)),r&&be(e,r),r!=null&&this.__v&&(t&&this._sb.push(t),ki(this))},$.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),ki(this))},$.prototype.render=er,Pe=[],Ds=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wo=function(r,t){return r.__v.__b-t.__v.__b},En.__r=0,hi=0,So=Hi(!1),Mo=Hi(!0);var Zu="An invariant failed, however the error is obfuscated because this is a production build.",Tn=[];Object.freeze(Tn);var _i={};Object.freeze(_i);function At(){return++D.mobxGuid}function X(r){throw at(!1,r),"X"}function at(r,t){if(!r)throw new Error("[mobx] "+(t||Zu))}var Ui=[];function Xs(r,t){return t?Xs("'"+r+"', use '"+t+"' instead."):Ui.indexOf(r)!==-1?!1:(Ui.push(r),console.error("[mobx] Deprecated: "+r),!0)}function mi(r){var t=!1;return function(){if(!t)return t=!0,r.apply(this,arguments)}}var Zr=function(){};function qu(r){var t=[];return r.forEach(function(e){t.indexOf(e)===-1&&t.push(e)}),t}function bi(r){return r!==null&&typeof r=="object"}function Ye(r){if(r===null||typeof r!="object")return!1;var t=Object.getPrototypeOf(r);return t===Object.prototype||t===null}function Ju(r){if(dr(r)||Tt(r))return r;if(Array.isArray(r))return new Map(r);if(Ye(r)){var t=new Map;for(var e in r)t.set(e,r[e]);return t}else return X("Cannot convert to map from '"+r+"'")}function fr(r,t,e){Object.defineProperty(r,t,{enumerable:!1,writable:!0,configurable:!0,value:e})}function Qu(r,t,e){Object.defineProperty(r,t,{enumerable:!1,writable:!1,configurable:!0,value:e})}function ks(r,t){var e=Object.getOwnPropertyDescriptor(r,t);return!e||e.configurable!==!1&&e.writable!==!1}function tc(r,t){ks(r,t)||X("Cannot make property '"+t.toString()+"' observable, it is not configurable and writable in the target object")}function Se(r,t){var e="isMobX"+r;return t.prototype[e]=!0,function(n){return bi(n)&&n[e]===!0}}function dr(r){return r instanceof Map}function zr(r){return r instanceof Set}function xi(r){var t=new Set;for(var e in r)t.add(e);return Object.getOwnPropertySymbols(r).forEach(function(n){Object.getOwnPropertyDescriptor(r,n).enumerable&&t.add(n)}),Array.from(t)}function It(r){return r&&r.toString?r.toString():new String(r).toString()}function Ys(r){return r===null?null:typeof r=="object"?""+r:r}var ec=typeof Reflect!="undefined"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:Object.getOwnPropertyNames,L=Symbol("mobx administration"),pr=function(){function r(t){t===void 0&&(t="Atom@"+At()),this.name=t,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Z.NOT_TRACKING}return r.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach(function(t){return t()})},r.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach(function(t){return t()})},r.prototype.reportObserved=function(){return qs(this)},r.prototype.reportChanged=function(){Zt(),Ac(this),qt()},r.prototype.toString=function(){return this.name},r}(),Ei=Se("Atom",pr);function Oi(r,t,e){t===void 0&&(t=Zr),e===void 0&&(e=Zr);var n=new pr(r);return t!==Zr&&Fc(n,t),e!==Zr&&nl(n,e),n}function rc(r,t){return r===t}function nc(r,t){return Di(r,t)}function oc(r,t){return Di(r,t,1)}function ic(r,t){return Object.is(r,t)}var nr={identity:rc,structural:nc,default:ic,shallow:oc};/*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */var Ao=function(r,t){return Ao=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o])},Ao(r,t)};function ac(r,t){Ao(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var it=function(){return it=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},it.apply(this,arguments)};function Gt(r){var t=typeof Symbol=="function"&&r[Symbol.iterator],e=0;return t?t.call(r):{next:function(){return r&&e>=r.length&&(r=void 0),{value:r&&r[e++],done:!r}}}}function Ke(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i}function Ti(){for(var r=[],t=0;t<arguments.length;t++)r=r.concat(Ke(arguments[t]));return r}var wn=Symbol("mobx did run lazy initializers"),_r=Symbol("mobx pending decorators"),sc={},lc={};function uc(r,t){var e=t?sc:lc;return e[r]||(e[r]={configurable:!0,enumerable:t,get:function(){return Be(this),this[r]},set:function(n){Be(this),this[r]=n}})}function Be(r){var t,e;if(r[wn]!==!0){var n=r[_r];if(n){fr(r,wn,!0);var o=Ti(Object.getOwnPropertySymbols(n),Object.keys(n));try{for(var i=Gt(o),a=i.next();!a.done;a=i.next()){var s=a.value,l=n[s];l.propertyCreator(r,l.prop,l.descriptor,l.decoratorTarget,l.decoratorArguments)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}}}}function Hs(r,t){return function(){var n,o=function(a,s,l,u){if(u===!0)return t(a,s,l,a,n),null;if(Fi(arguments)||X("This function is a decorator, but it wasn't invoked like a decorator"),!Object.prototype.hasOwnProperty.call(a,_r)){var f=a[_r];fr(a,_r,it({},f))}return a[_r][s]={prop:s,propertyCreator:t,descriptor:l,decoratorTarget:a,decoratorArguments:n},uc(s,r)};return Fi(arguments)?(n=Tn,o.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),o)}}function Fi(r){return(r.length===2||r.length===3)&&(typeof r[1]=="string"||typeof r[1]=="symbol")||r.length===4&&r[3]===!0}function Gr(r,t,e){return Te(r)?r:Array.isArray(r)?E.array(r,{name:e}):Ye(r)?E.object(r,void 0,{name:e}):dr(r)?E.map(r,{name:e}):zr(r)?E.set(r,{name:e}):r}function cc(r,t,e){return r==null||Yt(r)||te(r)||Tt(r)||kt(r)?r:Array.isArray(r)?E.array(r,{name:e,deep:!1}):Ye(r)?E.object(r,void 0,{name:e,deep:!1}):dr(r)?E.map(r,{name:e,deep:!1}):zr(r)?E.set(r,{name:e,deep:!1}):X("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Kn(r){return r}function fc(r,t,e){if(Te(r))throw"observable.struct should not be used with observable values";return Di(r,t)?t:r}function Zn(r){at(r);var t=Hs(!0,function(n,o,i,a,s){at(!i||!i.get,'@observable cannot be used on getter (property "'+It(o)+'"), use @computed instead.');var l=i?i.initializer?i.initializer.call(n):i.value:void 0;Pi(n).addObservableProp(o,l,r)}),e=typeof process!="undefined"&&process.env?function(){return arguments.length<2?X("Incorrect decorator invocation. @observable decorator doesn't expect any arguments"):t.apply(null,arguments)}:t;return e.enhancer=r,e}var Us={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Us);function dc(r){/^(deep|name|equals|defaultDecorator|proxy)$/.test(r)||X("invalid option for (extend)observable: "+r)}function Ve(r){if(r==null)return Us;if(typeof r=="string")return{name:r,deep:!0,proxy:!0};{if(typeof r!="object")return X("expected options object");Object.keys(r).forEach(dc)}return r}var wi=Zn(Gr),pc=Zn(cc),Fs=Zn(Kn),hc=Zn(fc);function qr(r){return r.defaultDecorator?r.defaultDecorator.enhancer:r.deep===!1?Kn:Gr}function vc(r,t,e){if(typeof arguments[1]=="string"||typeof arguments[1]=="symbol")return wi.apply(null,arguments);if(Te(r))return r;var n=Ye(r)?E.object(r,t,e):Array.isArray(r)?E.array(r,t):dr(r)?E.map(r,t):zr(r)?E.set(r,t):r;if(n!==r)return n;X("The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'")}var zi={box:function(r,t){arguments.length>2&&vr("box");var e=Ve(t);return new je(r,qr(e),e.name,!0,e.equals)},array:function(r,t){arguments.length>2&&vr("array");var e=Ve(t);return of(r,qr(e),e.name)},map:function(r,t){arguments.length>2&&vr("map");var e=Ve(t);return new Ai(r,qr(e),e.name)},set:function(r,t){arguments.length>2&&vr("set");var e=Ve(t);return new dl(r,qr(e),e.name)},object:function(r,t,e){typeof arguments[1]=="string"&&vr("object");var n=Ve(e);if(n.proxy===!1)return jo({},r,t,n);var o=il(n),i=jo({},void 0,void 0,n),a=ef(i);return al(a,r,t,o),a},ref:Fs,shallow:pc,deep:wi,struct:hc},E=vc;Object.keys(zi).forEach(function(r){return E[r]=zi[r]});function vr(r){X("Expected one or two arguments to observable."+r+". Did you accidentally try to use observable."+r+" as decorator?")}var Sn=Hs(!1,function(r,t,e,n,o){at(e&&e.get,"Trying to declare a computed value for unspecified getter '"+It(t)+"'");var i=e.get,a=e.set,s=o[0]||{};Pi(r).addComputedProp(r,t,it({get:i,set:a,context:r},s))}),yc=Sn({equals:nr.structural}),et=function(t,e,n){if(typeof e=="string"||t!==null&&typeof t=="object"&&arguments.length===1)return Sn.apply(null,arguments);at(typeof t=="function","First argument to `computed` should be an expression."),at(arguments.length<3,"Computed takes one or two arguments if used as function");var o=typeof e=="object"?e:{};return o.get=t,o.set=typeof e=="function"?e:o.set,o.name=o.name||t.name||"",new ir(o)};et.struct=yc;var Z;(function(r){r[r.NOT_TRACKING=-1]="NOT_TRACKING",r[r.UP_TO_DATE=0]="UP_TO_DATE",r[r.POSSIBLY_STALE=1]="POSSIBLY_STALE",r[r.STALE=2]="STALE"})(Z||(Z={}));var Kt;(function(r){r[r.NONE=0]="NONE",r[r.LOG=1]="LOG",r[r.BREAK=2]="BREAK"})(Kt||(Kt={}));var Mn=function(){function r(t){this.cause=t}return r}();function mr(r){return r instanceof Mn}function Po(r){switch(r.dependenciesState){case Z.UP_TO_DATE:return!1;case Z.NOT_TRACKING:case Z.STALE:return!0;case Z.POSSIBLY_STALE:{for(var t=Si(!0),e=hr(),n=r.observing,o=n.length,i=0;i<o;i++){var a=n[i];if(ar(a)){if(D.disableErrorBoundaries)a.get();else try{a.get()}catch{return Oe(e),Er(t),!0}if(r.dependenciesState===Z.STALE)return Oe(e),Er(t),!0}}return $s(r),Oe(e),Er(t),!1}}}function or(r){var t=r.observers.size>0;D.computationDepth>0&&t&&X("Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: "+r.name),!D.allowStateChanges&&(t||D.enforceActions==="strict")&&X((D.enforceActions?"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ")+r.name)}function gc(r){!D.allowStateReads&&D.observableRequiresReaction&&console.warn("[mobx] Observable "+r.name+" being read outside a reactive context")}function zs(r,t,e){var n=Si(!0);$s(r),r.newObserving=new Array(r.observing.length+100),r.unboundDepsCount=0,r.runId=++D.runId;var o=D.trackingDerivation;D.trackingDerivation=r;var i;if(D.disableErrorBoundaries===!0)i=t.call(e);else try{i=t.call(e)}catch(a){i=new Mn(a)}return D.trackingDerivation=o,mc(r),_c(r),Er(n),i}function _c(r){r.observing.length===0&&(D.reactionRequiresObservable||r.requiresObservable)&&console.warn("[mobx] Derivation "+r.name+" is created/updated without reading any observable value")}function mc(r){for(var t=r.observing,e=r.observing=r.newObserving,n=Z.UP_TO_DATE,o=0,i=r.unboundDepsCount,a=0;a<i;a++){var s=e[a];s.diffValue===0&&(s.diffValue=1,o!==a&&(e[o]=s),o++),s.dependenciesState>n&&(n=s.dependenciesState)}for(e.length=o,r.newObserving=null,i=t.length;i--;){var s=t[i];s.diffValue===0&&Ks(s,r),s.diffValue=0}for(;o--;){var s=e[o];s.diffValue===1&&(s.diffValue=0,Mc(s,r))}n!==Z.UP_TO_DATE&&(r.dependenciesState=n,r.onBecomeStale())}function Do(r){var t=r.observing;r.observing=[];for(var e=t.length;e--;)Ks(t[e],r);r.dependenciesState=Z.NOT_TRACKING}function Gs(r){var t=hr();try{return r()}finally{Oe(t)}}function hr(){var r=D.trackingDerivation;return D.trackingDerivation=null,r}function Oe(r){D.trackingDerivation=r}function Si(r){var t=D.allowStateReads;return D.allowStateReads=r,t}function Er(r){D.allowStateReads=r}function $s(r){if(r.dependenciesState!==Z.UP_TO_DATE){r.dependenciesState=Z.UP_TO_DATE;for(var t=r.observing,e=t.length;e--;)t[e].lowestObserverState=Z.UP_TO_DATE}}var An=0,bc=1,Gi=Object.getOwnPropertyDescriptor(function(){},"name"),xc=Gi&&Gi.configurable;function Re(r,t,e){at(typeof t=="function","`action` can only be invoked on functions"),(typeof r!="string"||!r)&&X("actions should have valid names, got: '"+r+"'");var n=function(){return Vs(r,t,e||this,arguments)};return n.isMobxAction=!0,xc&&Object.defineProperty(n,"name",{value:r}),n}function Vs(r,t,e,n){var o=Ec(r,e,n);try{return t.apply(e,n)}catch(i){throw o.error=i,i}finally{Oc(o)}}function Ec(r,t,e){var n=mt()&&!!r,o=0;if(n){o=Date.now();var i=e&&e.length||0,a=new Array(i);if(i>0)for(var s=0;s<i;s++)a[s]=e[s];Dt({type:"action",name:r,object:t,arguments:a})}var l=hr();Zt();var u=qn(!0),f=Si(!0),c={prevDerivation:l,prevAllowStateChanges:u,prevAllowStateReads:f,notifySpy:n,startTime:o,actionId:bc++,parentActionId:An};return An=c.actionId,c}function Oc(r){An!==r.actionId&&X("invalid action stack. did you forget to finish an action?"),An=r.parentActionId,r.error!==void 0&&(D.suppressReactionErrors=!0),Jn(r.prevAllowStateChanges),Er(r.prevAllowStateReads),qt(),Oe(r.prevDerivation),r.notifySpy&&Nt({time:Date.now()-r.startTime}),D.suppressReactionErrors=!1}function qn(r){var t=D.allowStateChanges;return D.allowStateChanges=r,t}function Jn(r){D.allowStateChanges=r}var je=function(r){ac(t,r);function t(e,n,o,i,a){o===void 0&&(o="ObservableValue@"+At()),i===void 0&&(i=!0),a===void 0&&(a=nr.default);var s=r.call(this,o)||this;return s.enhancer=n,s.name=o,s.equals=a,s.hasUnreportedChange=!1,s.value=n(e,void 0,o),i&&mt()&&Xe({type:"create",name:s.name,newValue:""+s.value}),s}return t.prototype.dehanceValue=function(e){return this.dehancer!==void 0?this.dehancer(e):e},t.prototype.set=function(e){var n=this.value;if(e=this.prepareNewValue(e),e!==D.UNCHANGED){var o=mt();o&&Dt({type:"update",name:this.name,newValue:e,oldValue:n}),this.setNewValue(e),o&&Nt()}},t.prototype.prepareNewValue=function(e){if(or(this),se(this)){var n=le(this,{object:this,type:"update",newValue:e});if(!n)return D.UNCHANGED;e=n.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?D.UNCHANGED:e},t.prototype.setNewValue=function(e){var n=this.value;this.value=e,this.reportChanged(),Jt(this)&&Qt(this,{type:"update",object:this,newValue:e,oldValue:n})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return $r(this,e)},t.prototype.observe=function(e,n){return n&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),Vr(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return Ys(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(pr),Tc=Se("ObservableValue",je),ir=function(){function r(t){this.dependenciesState=Z.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Z.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+At(),this.value=new Mn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Kt.NONE,at(t.get,"missing option for computed: get"),this.derivation=t.get,this.name=t.name||"ComputedValue@"+At(),t.set&&(this.setter=Re(this.name+"-setter",t.set)),this.equals=t.equals||(t.compareStructural||t.struct?nr.structural:nr.default),this.scope=t.context,this.requiresReaction=!!t.requiresReaction,this.keepAlive=!!t.keepAlive}return r.prototype.onBecomeStale=function(){Dc(this)},r.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach(function(t){return t()})},r.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach(function(t){return t()})},r.prototype.get=function(){this.isComputing&&X("Cycle detected in computation "+this.name+": "+this.derivation),D.inBatch===0&&this.observers.size===0&&!this.keepAlive?Po(this)&&(this.warnAboutUntrackedRead(),Zt(),this.value=this.computeValue(!1),qt()):(qs(this),Po(this)&&this.trackAndCompute()&&Pc(this));var t=this.value;if(mr(t))throw t.cause;return t},r.prototype.peek=function(){var t=this.computeValue(!1);if(mr(t))throw t.cause;return t},r.prototype.set=function(t){if(this.setter){at(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,t)}finally{this.isRunningSetter=!1}}else at(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},r.prototype.trackAndCompute=function(){mt()&&Xe({object:this.scope,type:"compute",name:this.name});var t=this.value,e=this.dependenciesState===Z.NOT_TRACKING,n=this.computeValue(!0),o=e||mr(t)||mr(n)||!this.equals(t,n);return o&&(this.value=n),o},r.prototype.computeValue=function(t){this.isComputing=!0,D.computationDepth++;var e;if(t)e=zs(this,this.derivation,this.scope);else if(D.disableErrorBoundaries===!0)e=this.derivation.call(this.scope);else try{e=this.derivation.call(this.scope)}catch(n){e=new Mn(n)}return D.computationDepth--,this.isComputing=!1,e},r.prototype.suspend=function(){this.keepAlive||(Do(this),this.value=void 0)},r.prototype.observe=function(t,e){var n=this,o=!0,i=void 0;return Yc(function(){var a=n.get();if(!o||e){var s=hr();t({type:"update",object:n,newValue:a,oldValue:i}),Oe(s)}o=!1,i=a})},r.prototype.warnAboutUntrackedRead=function(){this.requiresReaction===!0&&X("[mobx] Computed value "+this.name+" is read outside a reactive context"),this.isTracing!==Kt.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context. Doing a full recompute"),D.computedRequiresReaction&&console.warn("[mobx] Computed value "+this.name+" is being read outside a reactive context. Doing a full recompute")},r.prototype.toJSON=function(){return this.get()},r.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},r.prototype.valueOf=function(){return Ys(this.get())},r.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},r}(),ar=Se("ComputedValue",ir),mn=function(){function r(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1}return r}(),wc={};function No(){return typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:wc}var bn=!0,Ws=!1,D=function(){var r=No();return r.__mobxInstanceCount>0&&!r.__mobxGlobals&&(bn=!1),r.__mobxGlobals&&r.__mobxGlobals.version!==new mn().version&&(bn=!1),bn?r.__mobxGlobals?(r.__mobxInstanceCount+=1,r.__mobxGlobals.UNCHANGED||(r.__mobxGlobals.UNCHANGED={}),r.__mobxGlobals):(r.__mobxInstanceCount=1,r.__mobxGlobals=new mn):(setTimeout(function(){Ws||X("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")},1),new mn)}();function Sc(){(D.pendingReactions.length||D.inBatch||D.isRunningReactions)&&X("isolateGlobalState should be called before MobX is running any reactions"),Ws=!0,bn&&(--No().__mobxInstanceCount===0&&(No().__mobxGlobals=void 0),D=new mn)}function Co(){return D}function Mc(r,t){r.observers.add(t),r.lowestObserverState>t.dependenciesState&&(r.lowestObserverState=t.dependenciesState)}function Ks(r,t){r.observers.delete(t),r.observers.size===0&&Zs(r)}function Zs(r){r.isPendingUnobservation===!1&&(r.isPendingUnobservation=!0,D.pendingUnobservations.push(r))}function Zt(){D.inBatch++}function qt(){if(--D.inBatch===0){tl();for(var r=D.pendingUnobservations,t=0;t<r.length;t++){var e=r[t];e.isPendingUnobservation=!1,e.observers.size===0&&(e.isBeingObserved&&(e.isBeingObserved=!1,e.onBecomeUnobserved()),e instanceof ir&&e.suspend())}D.pendingUnobservations=[]}}function qs(r){gc(r);var t=D.trackingDerivation;return t!==null?(t.runId!==r.lastAccessedBy&&(r.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=r,r.isBeingObserved||(r.isBeingObserved=!0,r.onBecomeObserved())),!0):(r.observers.size===0&&D.inBatch>0&&Zs(r),!1)}function Ac(r){r.lowestObserverState!==Z.STALE&&(r.lowestObserverState=Z.STALE,r.observers.forEach(function(t){t.dependenciesState===Z.UP_TO_DATE&&(t.isTracing!==Kt.NONE&&Js(t,r),t.onBecomeStale()),t.dependenciesState=Z.STALE}))}function Pc(r){r.lowestObserverState!==Z.STALE&&(r.lowestObserverState=Z.STALE,r.observers.forEach(function(t){t.dependenciesState===Z.POSSIBLY_STALE?t.dependenciesState=Z.STALE:t.dependenciesState===Z.UP_TO_DATE&&(r.lowestObserverState=Z.UP_TO_DATE)}))}function Dc(r){r.lowestObserverState===Z.UP_TO_DATE&&(r.lowestObserverState=Z.POSSIBLY_STALE,r.observers.forEach(function(t){t.dependenciesState===Z.UP_TO_DATE&&(t.dependenciesState=Z.POSSIBLY_STALE,t.isTracing!==Kt.NONE&&Js(t,r),t.onBecomeStale())}))}function Js(r,t){if(console.log("[mobx.trace] '"+r.name+"' is invalidated due to a change in: '"+t.name+"'"),r.isTracing===Kt.BREAK){var e=[];Qs(Gc(r),e,1),new Function(`debugger;
- /*
- Tracing '`+r.name+`'
- You are entering this break point because derivation '`+r.name+"' is being traced and '"+t.name+`' is now forcing it to update.
- Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
- The stackframe you are looking for is at least ~6-8 stack-frames up.
- `+(r instanceof ir?r.derivation.toString().replace(/[*]\//g,"/"):"")+`
- The dependencies for this derivation are:
- `+e.join(`
- `)+`
- */
- `)()}}function Qs(r,t,e){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+new Array(e).join(" ")+r.name),r.dependencies&&r.dependencies.forEach(function(n){return Qs(n,t,e+1)})}var Lr=function(){function r(t,e,n,o){t===void 0&&(t="Reaction@"+At()),o===void 0&&(o=!1),this.name=t,this.onInvalidate=e,this.errorHandler=n,this.requiresObservable=o,this.observing=[],this.newObserving=[],this.dependenciesState=Z.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+At(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Kt.NONE}return r.prototype.onBecomeStale=function(){this.schedule()},r.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,D.pendingReactions.push(this),tl())},r.prototype.isScheduled=function(){return this._isScheduled},r.prototype.runReaction=function(){if(!this.isDisposed){if(Zt(),this._isScheduled=!1,Po(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&mt()&&Xe({name:this.name,type:"scheduled-reaction"})}catch(t){this.reportExceptionInDerivation(t)}}qt()}},r.prototype.track=function(t){if(!this.isDisposed){Zt();var e=mt(),n;e&&(n=Date.now(),Dt({name:this.name,type:"reaction"})),this._isRunning=!0;var o=zs(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Do(this),mr(o)&&this.reportExceptionInDerivation(o.cause),e&&Nt({time:Date.now()-n}),qt()}},r.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return}if(D.disableErrorBoundaries)throw t;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";D.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,t),mt()&&Xe({type:"error",name:this.name,message:n,error:""+t}),D.globalReactionErrorHandlers.forEach(function(o){return o(t,e)})},r.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Zt(),Do(this),qt()))},r.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[L]=this,t},r.prototype.toString=function(){return"Reaction["+this.name+"]"},r.prototype.trace=function(t){t===void 0&&(t=!1),Jc(this,t)},r}(),$i=100,Ro=function(r){return r()};function tl(){D.inBatch>0||D.isRunningReactions||Ro(Nc)}function Nc(){D.isRunningReactions=!0;for(var r=D.pendingReactions,t=0;r.length>0;){++t===$i&&(console.error("Reaction doesn't converge to a stable state after "+$i+" iterations."+(" Probably there is a cycle in the reactive function: "+r[0])),r.splice(0));for(var e=r.splice(0),n=0,o=e.length;n<o;n++)e[n].runReaction()}D.isRunningReactions=!1}var Pn=Se("Reaction",Lr);function Cc(r){var t=Ro;Ro=function(e){return r(function(){return t(e)})}}function mt(){return!!D.spyListeners.length}function Xe(r){if(!!D.spyListeners.length)for(var t=D.spyListeners,e=0,n=t.length;e<n;e++)t[e](r)}function Dt(r){var t=it(it({},r),{spyReportStart:!0});Xe(t)}var Rc={spyReportEnd:!0};function Nt(r){Xe(r?it(it({},r),{spyReportEnd:!0}):Rc)}function jc(r){return D.spyListeners.push(r),mi(function(){D.spyListeners=D.spyListeners.filter(function(t){return t!==r})})}function Lc(){X("@action fields are not reassignable")}function Vi(r){return function(t,e,n){if(n){if(n.get!==void 0)return X("@action cannot be used with getters");if(n.value)return{value:Re(r,n.value),enumerable:!1,configurable:!0,writable:!0};var o=n.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return Re(r,o.call(this))}}}return Ic(r).apply(this,arguments)}}function Ic(r){return function(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get:function(){},set:function(o){fr(this,e,b(r,o))}})}}function Bc(r,t,e,n){return n===!0?(lo(r,t,e.value),null):e?{configurable:!0,enumerable:!1,get:function(){return lo(this,t,e.value||e.initializer.call(this)),this[t]},set:Lc}:{enumerable:!1,configurable:!0,set:function(o){lo(this,t,o)},get:function(){}}}var b=function(t,e,n,o){if(arguments.length===1&&typeof t=="function")return Re(t.name||"<unnamed action>",t);if(arguments.length===2&&typeof e=="function")return Re(t,e);if(arguments.length===1&&typeof t=="string")return Vi(t);if(o===!0)fr(t,e,Re(t.name||e,n.value,this));else return Vi(e).apply(null,arguments)};b.bound=Bc;function Xc(r,t){var e=typeof r=="string"?r:r.name||"<unnamed action>",n=typeof r=="function"?r:t;return at(typeof n=="function"&&n.length===0,"`runInAction` expects a function without arguments"),(typeof e!="string"||!e)&&X("actions should have valid names, got: '"+e+"'"),Vs(e,n,this,void 0)}function kc(r){return typeof r=="function"&&r.isMobxAction===!0}function lo(r,t,e){fr(r,t,Re(t,e.bind(r)))}function Yc(r,t){t===void 0&&(t=_i),at(typeof r=="function","Autorun expects a function as first argument"),at(kc(r)===!1,"Autorun does not accept actions since actions are untrackable");var e=t&&t.name||r.name||"Autorun@"+At(),n=!t.scheduler&&!t.delay,o;if(n)o=new Lr(e,function(){this.track(s)},t.onError,t.requiresObservable);else{var i=el(t),a=!1;o=new Lr(e,function(){a||(a=!0,i(function(){a=!1,o.isDisposed||o.track(s)}))},t.onError,t.requiresObservable)}function s(){r(o)}return o.schedule(),o.getDisposer()}var Hc=function(r){return r()};function el(r){return r.scheduler?r.scheduler:r.delay?function(t){return setTimeout(t,r.delay)}:Hc}function rl(r,t,e){e===void 0&&(e=_i),at(typeof r=="function","First argument to reaction should be a function"),at(typeof e=="object","Third argument of reactions should be an object");var n=e.name||"Reaction@"+At(),o=b(n,e.onError?Uc(e.onError,t):t),i=!e.scheduler&&!e.delay,a=el(e),s=!0,l=!1,u,f=e.compareStructural?nr.structural:e.equals||nr.default,c=new Lr(n,function(){s||i?d():l||(l=!0,a(d))},e.onError,e.requiresObservable);function d(){if(l=!1,!c.isDisposed){var p=!1;c.track(function(){var y=r(c);p=s||!f(u,y),u=y}),s&&e.fireImmediately&&o(u,c),!s&&p===!0&&o(u,c),s&&(s=!1)}}return c.schedule(),c.getDisposer()}function Uc(r,t){return function(){try{return t.apply(this,arguments)}catch(e){r.call(this,e)}}}function Fc(r,t,e){return ol("onBecomeObserved",r,t,e)}function nl(r,t,e){return ol("onBecomeUnobserved",r,t,e)}function ol(r,t,e,n){var o=typeof n=="function"?pe(t,e):pe(t),i=typeof n=="function"?n:e,a=r+"Listeners";o[a]?o[a].add(i):o[a]=new Set([i]);var s=o[r];return typeof s!="function"?X("Not an atom that can be (un)observed"):function(){var l=o[a];l&&(l.delete(i),l.size===0&&delete o[a])}}function zc(r){var t=r.enforceActions,e=r.computedRequiresReaction,n=r.computedConfigurable,o=r.disableErrorBoundaries,i=r.reactionScheduler,a=r.reactionRequiresObservable,s=r.observableRequiresReaction;if(r.isolateGlobalState===!0&&Sc(),t!==void 0){(typeof t=="boolean"||t==="strict")&&Xs(`Deprecated value for 'enforceActions', use 'false' => '"never"', 'true' => '"observed"', '"strict"' => "'always'" instead`);var l=void 0;switch(t){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:X("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'")}D.enforceActions=l,D.allowStateChanges=!(l===!0||l==="strict")}e!==void 0&&(D.computedRequiresReaction=!!e),a!==void 0&&(D.reactionRequiresObservable=!!a),s!==void 0&&(D.observableRequiresReaction=!!s,D.allowStateReads=!D.observableRequiresReaction),n!==void 0&&(D.computedConfigurable=!!n),o!==void 0&&(o===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),D.disableErrorBoundaries=!!o),i&&Cc(i)}function jo(r,t,e,n){at(arguments.length>=2&&arguments.length<=4,"'extendObservable' expected 2-4 arguments"),at(typeof r=="object","'extendObservable' expects an object as first argument"),at(!Tt(r),"'extendObservable' should not be used on maps, use map.merge instead"),n=Ve(n);var o=il(n);return Be(r),Pi(r,n.name,o.enhancer),t&&al(r,t,e,o),r}function il(r){return r.defaultDecorator||(r.deep===!1?Fs:wi)}function al(r,t,e,n){var o,i,a,s;if(at(!Te(t),"Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540"),e){var l=xi(e);try{for(var u=Gt(l),f=u.next();!f.done;f=u.next()){var c=f.value;c in t||X("Trying to declare a decorator for unspecified property '"+It(c)+"'")}}catch(v){o={error:v}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}}Zt();try{var l=ec(t);try{for(var d=Gt(l),p=d.next();!p.done;p=d.next()){var c=p.value,y=Object.getOwnPropertyDescriptor(t,c);Ye(t)||X("'extendObservable' only accepts plain objects as second argument"),ul(y.value)&&X("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead");var h=e&&c in e?e[c]:y.get?Sn:n;typeof h!="function"&&X("Not a valid decorator for '"+It(c)+"', got: "+h);var g=h(r,c,y,!0);g&&Object.defineProperty(r,c,g)}}catch(_){a={error:_}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}}finally{qt()}}function Gc(r,t){return sl(pe(r,t))}function sl(r){var t={name:r.name};return r.observing&&r.observing.length>0&&(t.dependencies=qu(r.observing).map(sl)),t}function ll(r,t){if(r==null)return!1;if(t!==void 0){if(Yt(r)===!1||!r[L].values.has(t))return!1;var e=pe(r,t);return ar(e)}return ar(r)}function ul(r){return arguments.length>1?X("isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property"):ll(r)}function Wi(r,t){return typeof t!="string"?X("isComputed expected a property name as second argument"):ll(r,t)}function $c(r,t){return r==null?!1:t!==void 0?Tt(r)||te(r)?X("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Yt(r)?r[L].values.has(t):!1:Yt(r)||!!r[L]||Ei(r)||Pn(r)||ar(r)}function Te(r){return arguments.length!==1&&X("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),$c(r)}function sr(r){return Yt(r)?r[L].getKeys():Tt(r)||kt(r)?Array.from(r.keys()):te(r)?r.map(function(t,e){return e}):X("'keys()' can only be used on observable objects, arrays, sets and maps")}function Vc(r){return Yt(r)?sr(r).map(function(t){return r[t]}):Tt(r)?sr(r).map(function(t){return r.get(t)}):kt(r)?Array.from(r.values()):te(r)?r.slice():X("'values()' can only be used on observable objects, arrays, sets and maps")}function Wc(r){return Yt(r)?sr(r).map(function(t){return[t,r[t]]}):Tt(r)?sr(r).map(function(t){return[t,r.get(t)]}):kt(r)?Array.from(r.entries()):te(r)?r.map(function(t,e){return[e,t]}):X("'entries()' can only be used on observable objects, arrays and maps")}function Mi(r,t,e){if(arguments.length===2&&!kt(r)){Zt();var n=t;try{for(var o in n)Mi(r,o,n[o])}finally{qt()}return}if(Yt(r)){var i=r[L],a=i.values.get(t);a?i.write(t,e):i.addObservableProp(t,e,i.defaultEnhancer)}else if(Tt(r))r.set(t,e);else if(kt(r))r.add(t);else if(te(r))typeof t!="number"&&(t=parseInt(t,10)),at(t>=0,"Not a valid index: '"+t+"'"),Zt(),t>=r.length&&(r.length=t+1),r[t]=e,qt();else return X("'set()' can only be used on observable objects, arrays and maps")}function cl(r,t,e,n){return typeof e=="function"?Zc(r,t,e,n):Kc(r,t,e)}function Kc(r,t,e){return Wr(r).observe(t,e)}function Zc(r,t,e,n){return Wr(r,t).observe(e,n)}var qc={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function He(r,t,e,n){return n.detectCycles&&r.set(t,e),e}function ve(r,t,e){if(!t.recurseEverything&&!Te(r)||typeof r!="object")return r;if(r===null)return null;if(r instanceof Date)return r;if(Tc(r))return ve(r.get(),t,e);Te(r)&&sr(r);var n=t.detectCycles===!0;if(n&&r!==null&&e.has(r))return e.get(r);if(te(r)||Array.isArray(r)){var o=He(e,r,[],t),i=r.map(function(p){return ve(p,t,e)});o.length=i.length;for(var a=0,s=i.length;a<s;a++)o[a]=i[a];return o}if(kt(r)||Object.getPrototypeOf(r)===Set.prototype)if(t.exportMapsAsObjects===!1){var l=He(e,r,new Set,t);return r.forEach(function(p){l.add(ve(p,t,e))}),l}else{var u=He(e,r,[],t);return r.forEach(function(p){u.push(ve(p,t,e))}),u}if(Tt(r)||Object.getPrototypeOf(r)===Map.prototype)if(t.exportMapsAsObjects===!1){var f=He(e,r,new Map,t);return r.forEach(function(p,y){f.set(y,ve(p,t,e))}),f}else{var c=He(e,r,{},t);return r.forEach(function(p,y){c[y]=ve(p,t,e)}),c}var d=He(e,r,{},t);return xi(r).forEach(function(p){d[p]=ve(r[p],t,e)}),d}function ne(r,t){typeof t=="boolean"&&(t={detectCycles:t}),t||(t=qc),t.detectCycles=t.detectCycles===void 0?t.recurseEverything===!0:t.detectCycles===!0;var e;return t.detectCycles&&(e=new Map),ve(r,t,e)}function Jc(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;typeof r[r.length-1]=="boolean"&&(e=r.pop());var n=Qc(r);if(!n)return X("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");n.isTracing===Kt.NONE&&console.log("[mobx.trace] '"+n.name+"' tracing enabled"),n.isTracing=e?Kt.BREAK:Kt.LOG}function Qc(r){switch(r.length){case 0:return D.trackingDerivation;case 1:return pe(r[0]);case 2:return pe(r[0],r[1])}}function $t(r,t){t===void 0&&(t=void 0),Zt();try{return r.apply(t)}finally{qt()}}function Jr(r){return r[L]}function Qr(r){return typeof r=="string"||typeof r=="number"||typeof r=="symbol"}var tf={has:function(r,t){if(t===L||t==="constructor"||t===wn)return!0;var e=Jr(r);return Qr(t)?e.has(t):t in r},get:function(r,t){if(t===L||t==="constructor"||t===wn)return r[t];var e=Jr(r),n=e.values.get(t);if(n instanceof pr){var o=n.get();return o===void 0&&e.has(t),o}return Qr(t)&&e.has(t),r[t]},set:function(r,t,e){return Qr(t)?(Mi(r,t,e),!0):!1},deleteProperty:function(r,t){if(!Qr(t))return!1;var e=Jr(r);return e.remove(t),!0},ownKeys:function(r){var t=Jr(r);return t.keysAtom.reportObserved(),Reflect.ownKeys(r)},preventExtensions:function(r){return X("Dynamic observable objects cannot be frozen"),!1}};function ef(r){var t=new Proxy(r,tf);return r[L].proxy=t,t}function se(r){return r.interceptors!==void 0&&r.interceptors.length>0}function $r(r,t){var e=r.interceptors||(r.interceptors=[]);return e.push(t),mi(function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)})}function le(r,t){var e=hr();try{for(var n=Ti(r.interceptors||[]),o=0,i=n.length;o<i&&(t=n[o](t),at(!t||t.type,"Intercept handlers should return nothing or a change object"),!!t);o++);return t}finally{Oe(e)}}function Jt(r){return r.changeListeners!==void 0&&r.changeListeners.length>0}function Vr(r,t){var e=r.changeListeners||(r.changeListeners=[]);return e.push(t),mi(function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)})}function Qt(r,t){var e=hr(),n=r.changeListeners;if(!!n){n=n.slice();for(var o=0,i=n.length;o<i;o++)n[o](t);Oe(e)}}var rf=1e4,nf={get:function(r,t){return t===L?r[L]:t==="length"?r[L].getArrayLength():typeof t=="number"?fe.get.call(r,t):typeof t=="string"&&!isNaN(t)?fe.get.call(r,parseInt(t)):fe.hasOwnProperty(t)?fe[t]:r[t]},set:function(r,t,e){return t==="length"&&r[L].setArrayLength(e),typeof t=="number"&&fe.set.call(r,t,e),typeof t=="symbol"||isNaN(t)?r[t]=e:fe.set.call(r,parseInt(t),e),!0},preventExtensions:function(r){return X("Observable arrays cannot be frozen"),!1}};function of(r,t,e,n){e===void 0&&(e="ObservableArray@"+At()),n===void 0&&(n=!1);var o=new fl(e,t,n);Qu(o.values,L,o);var i=new Proxy(o.values,nf);if(o.proxy=i,r&&r.length){var a=qn(!0);o.spliceWithArray(0,0,r),Jn(a)}return i}var fl=function(){function r(t,e,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new pr(t||"ObservableArray@"+At()),this.enhancer=function(o,i){return e(o,i,t+"[..]")}}return r.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},r.prototype.dehanceValues=function(t){return this.dehancer!==void 0&&t.length>0?t.map(this.dehancer):t},r.prototype.intercept=function(t){return $r(this,t)},r.prototype.observe=function(t,e){return e===void 0&&(e=!1),e&&t({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Vr(this,t)},r.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},r.prototype.setArrayLength=function(t){if(typeof t!="number"||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),o=0;o<t-e;o++)n[o]=void 0;this.spliceWithArray(e,0,n)}else this.spliceWithArray(t,e-t)},r.prototype.updateArrayLength=function(t,e){if(t!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=e},r.prototype.spliceWithArray=function(t,e,n){var o=this;or(this.atom);var i=this.values.length;if(t===void 0?t=0:t>i?t=i:t<0&&(t=Math.max(0,i+t)),arguments.length===1?e=i-t:e==null?e=0:e=Math.max(0,Math.min(e,i-t)),n===void 0&&(n=Tn),se(this)){var a=le(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:n});if(!a)return Tn;e=a.removedCount,n=a.added}n=n.length===0?n:n.map(function(u){return o.enhancer(u,void 0)});{var s=n.length-e;this.updateArrayLength(i,s)}var l=this.spliceItemsIntoValues(t,e,n);return(e!==0||n.length!==0)&&this.notifyArraySplice(t,n,l),this.dehanceValues(l)},r.prototype.spliceItemsIntoValues=function(t,e,n){var o;if(n.length<rf)return(o=this.values).splice.apply(o,Ti([t,e],n));var i=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(n,this.values.slice(t+e)),i},r.prototype.notifyArrayChildUpdate=function(t,e,n){var o=!this.owned&&mt(),i=Jt(this),a=i||o?{object:this.proxy,type:"update",index:t,newValue:e,oldValue:n}:null;o&&Dt(it(it({},a),{name:this.atom.name})),this.atom.reportChanged(),i&&Qt(this,a),o&&Nt()},r.prototype.notifyArraySplice=function(t,e,n){var o=!this.owned&&mt(),i=Jt(this),a=i||o?{object:this.proxy,type:"splice",index:t,removed:n,added:e,removedCount:n.length,addedCount:e.length}:null;o&&Dt(it(it({},a),{name:this.atom.name})),this.atom.reportChanged(),i&&Qt(this,a),o&&Nt()},r}(),fe={intercept:function(r){return this[L].intercept(r)},observe:function(r,t){t===void 0&&(t=!1);var e=this[L];return e.observe(r,t)},clear:function(){return this.splice(0)},replace:function(r){var t=this[L];return t.spliceWithArray(0,t.values.length,r)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(r,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var o=this[L];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray(r);case 2:return o.spliceWithArray(r,t)}return o.spliceWithArray(r,t,e)},spliceWithArray:function(r,t,e){var n=this[L];return n.spliceWithArray(r,t,e)},push:function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this[L];return e.spliceWithArray(e.values.length,0,r),e.values.length},pop:function(){return this.splice(Math.max(this[L].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this[L];return e.spliceWithArray(0,0,r),e.values.length},reverse:function(){console.warn("[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place");var r=this.slice();return r.reverse.apply(r,arguments)},sort:function(r){console.warn("[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place");var t=this.slice();return t.sort.apply(t,arguments)},remove:function(r){var t=this[L],e=t.dehanceValues(t.values).indexOf(r);return e>-1?(this.splice(e,1),!0):!1},get:function(r){var t=this[L];if(t){if(r<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[r]);console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+t.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},set:function(r,t){var e=this[L],n=e.values;if(r<n.length){or(e.atom);var o=n[r];if(se(e)){var i=le(e,{type:"update",object:e.proxy,index:r,newValue:t});if(!i)return;t=i.newValue}t=e.enhancer(t,o);var a=t!==o;a&&(n[r]=t,e.notifyArrayChildUpdate(r,t,o))}else if(r===n.length)e.spliceWithArray(r,0,[t]);else throw new Error("[mobx.array] Index out of bounds, "+r+" is larger than "+n.length)}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach(function(r){typeof Array.prototype[r]=="function"&&(fe[r]=function(){var t=this[L];t.atom.reportObserved();var e=t.dehanceValues(t.values);return e[r].apply(e,arguments)})});["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach(function(r){typeof Array.prototype[r]=="function"&&(fe[r]=function(t,e){var n=this,o=this[L];o.atom.reportObserved();var i=o.dehanceValues(o.values);return i[r](function(a,s){return t.call(e,a,s,n)},e)})});["reduce","reduceRight"].forEach(function(r){fe[r]=function(){var t=this,e=this[L];e.atom.reportObserved();var n=arguments[0];return arguments[0]=function(o,i,a){return i=e.dehanceValue(i),n(o,i,a,t)},e.values[r].apply(e.values,arguments)}});var af=Se("ObservableArrayAdministration",fl);function te(r){return bi(r)&&af(r[L])}var Ki,sf={},Ai=function(){function r(t,e,n){if(e===void 0&&(e=Gr),n===void 0&&(n="ObservableMap@"+At()),this.enhancer=e,this.name=n,this[Ki]=sf,this._keysAtom=Oi(this.name+".keys()"),this[Symbol.toStringTag]="Map",typeof Map!="function")throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(t)}return r.prototype._has=function(t){return this._data.has(t)},r.prototype.has=function(t){var e=this;if(!D.trackingDerivation)return this._has(t);var n=this._hasMap.get(t);if(!n){var o=n=new je(this._has(t),Kn,this.name+"."+It(t)+"?",!1);this._hasMap.set(t,o),nl(o,function(){return e._hasMap.delete(t)})}return n.get()},r.prototype.set=function(t,e){var n=this._has(t);if(se(this)){var o=le(this,{type:n?"update":"add",object:this,newValue:e,name:t});if(!o)return this;e=o.newValue}return n?this._updateValue(t,e):this._addValue(t,e),this},r.prototype.delete=function(t){var e=this;if(or(this._keysAtom),se(this)){var n=le(this,{type:"delete",object:this,name:t});if(!n)return!1}if(this._has(t)){var o=mt(),i=Jt(this),n=i||o?{type:"delete",object:this,oldValue:this._data.get(t).value,name:t}:null;return o&&Dt(it(it({},n),{name:this.name,key:t})),$t(function(){e._keysAtom.reportChanged(),e._updateHasMapEntry(t,!1);var s=e._data.get(t);s.setNewValue(void 0),e._data.delete(t)}),i&&Qt(this,n),o&&Nt(),!0}return!1},r.prototype._updateHasMapEntry=function(t,e){var n=this._hasMap.get(t);n&&n.setNewValue(e)},r.prototype._updateValue=function(t,e){var n=this._data.get(t);if(e=n.prepareNewValue(e),e!==D.UNCHANGED){var o=mt(),i=Jt(this),a=i||o?{type:"update",object:this,oldValue:n.value,name:t,newValue:e}:null;o&&Dt(it(it({},a),{name:this.name,key:t})),n.setNewValue(e),i&&Qt(this,a),o&&Nt()}},r.prototype._addValue=function(t,e){var n=this;or(this._keysAtom),$t(function(){var s=new je(e,n.enhancer,n.name+"."+It(t),!1);n._data.set(t,s),e=s.value,n._updateHasMapEntry(t,!0),n._keysAtom.reportChanged()});var o=mt(),i=Jt(this),a=i||o?{type:"add",object:this,name:t,newValue:e}:null;o&&Dt(it(it({},a),{name:this.name,key:t})),i&&Qt(this,a),o&&Nt()},r.prototype.get=function(t){return this.has(t)?this.dehanceValue(this._data.get(t).get()):this.dehanceValue(void 0)},r.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},r.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},r.prototype.values=function(){var t=this,e=this.keys();return Dn({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:t.get(i)}}})},r.prototype.entries=function(){var t=this,e=this.keys();return Dn({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:[i,t.get(i)]}}})},r.prototype[Ki=L,Symbol.iterator]=function(){return this.entries()},r.prototype.forEach=function(t,e){var n,o;try{for(var i=Gt(this),a=i.next();!a.done;a=i.next()){var s=Ke(a.value,2),l=s[0],u=s[1];t.call(e,u,l,this)}}catch(f){n={error:f}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},r.prototype.merge=function(t){var e=this;return Tt(t)&&(t=t.toJS()),$t(function(){var n=qn(!0);try{Ye(t)?xi(t).forEach(function(o){return e.set(o,t[o])}):Array.isArray(t)?t.forEach(function(o){var i=Ke(o,2),a=i[0],s=i[1];return e.set(a,s)}):dr(t)?(t.constructor!==Map&&X("Cannot initialize from classes that inherit from Map: "+t.constructor.name),t.forEach(function(o,i){return e.set(i,o)})):t!=null&&X("Cannot initialize map from "+t)}finally{Jn(n)}}),this},r.prototype.clear=function(){var t=this;$t(function(){Gs(function(){var e,n;try{for(var o=Gt(t.keys()),i=o.next();!i.done;i=o.next()){var a=i.value;t.delete(a)}}catch(s){e={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}})})},r.prototype.replace=function(t){var e=this;return $t(function(){var n,o,i,a,s=Ju(t),l=new Map,u=!1;try{for(var f=Gt(e._data.keys()),c=f.next();!c.done;c=f.next()){var d=c.value;if(!s.has(d)){var p=e.delete(d);if(p)u=!0;else{var y=e._data.get(d);l.set(d,y)}}}}catch(T){n={error:T}}finally{try{c&&!c.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var h=Gt(s.entries()),g=h.next();!g.done;g=h.next()){var v=Ke(g.value,2),d=v[0],y=v[1],_=e._data.has(d);if(e.set(d,y),e._data.has(d)){var O=e._data.get(d);l.set(d,O),_||(u=!0)}}}catch(T){i={error:T}}finally{try{g&&!g.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}if(!u)if(e._data.size!==l.size)e._keysAtom.reportChanged();else for(var w=e._data.keys(),S=l.keys(),M=w.next(),m=S.next();!M.done;){if(M.value!==m.value){e._keysAtom.reportChanged();break}M=w.next(),m=S.next()}e._data=l}),this},Object.defineProperty(r.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),r.prototype.toPOJO=function(){var t,e,n={};try{for(var o=Gt(this),i=o.next();!i.done;i=o.next()){var a=Ke(i.value,2),s=a[0],l=a[1];n[typeof s=="symbol"?s:It(s)]=l}}catch(u){t={error:u}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},r.prototype.toJS=function(){return new Map(this)},r.prototype.toJSON=function(){return this.toPOJO()},r.prototype.toString=function(){var t=this;return this.name+"[{ "+Array.from(this.keys()).map(function(e){return It(e)+": "+(""+t.get(e))}).join(", ")+" }]"},r.prototype.observe=function(t,e){return at(e!==!0,"`observe` doesn't support fireImmediately=true in combination with maps."),Vr(this,t)},r.prototype.intercept=function(t){return $r(this,t)},r}(),Tt=Se("ObservableMap",Ai),Zi,lf={},dl=function(){function r(t,e,n){if(e===void 0&&(e=Gr),n===void 0&&(n="ObservableSet@"+At()),this.name=n,this[Zi]=lf,this._data=new Set,this._atom=Oi(this.name),this[Symbol.toStringTag]="Set",typeof Set!="function")throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(o,i){return e(o,i,n)},t&&this.replace(t)}return r.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},r.prototype.clear=function(){var t=this;$t(function(){Gs(function(){var e,n;try{for(var o=Gt(t._data.values()),i=o.next();!i.done;i=o.next()){var a=i.value;t.delete(a)}}catch(s){e={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}})})},r.prototype.forEach=function(t,e){var n,o;try{for(var i=Gt(this),a=i.next();!a.done;a=i.next()){var s=a.value;t.call(e,s,s,this)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},Object.defineProperty(r.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),r.prototype.add=function(t){var e=this;if(or(this._atom),se(this)){var n=le(this,{type:"add",object:this,newValue:t});if(!n)return this}if(!this.has(t)){$t(function(){e._data.add(e.enhancer(t,void 0)),e._atom.reportChanged()});var o=mt(),i=Jt(this),n=i||o?{type:"add",object:this,newValue:t}:null;o&&Dt(n),i&&Qt(this,n),o&&Nt()}return this},r.prototype.delete=function(t){var e=this;if(se(this)){var n=le(this,{type:"delete",object:this,oldValue:t});if(!n)return!1}if(this.has(t)){var o=mt(),i=Jt(this),n=i||o?{type:"delete",object:this,oldValue:t}:null;return o&&Dt(it(it({},n),{name:this.name})),$t(function(){e._atom.reportChanged(),e._data.delete(t)}),i&&Qt(this,n),o&&Nt(),!0}return!1},r.prototype.has=function(t){return this._atom.reportObserved(),this._data.has(this.dehanceValue(t))},r.prototype.entries=function(){var t=0,e=Array.from(this.keys()),n=Array.from(this.values());return Dn({next:function(){var o=t;return t+=1,o<n.length?{value:[e[o],n[o]],done:!1}:{done:!0}}})},r.prototype.keys=function(){return this.values()},r.prototype.values=function(){this._atom.reportObserved();var t=this,e=0,n=Array.from(this._data.values());return Dn({next:function(){return e<n.length?{value:t.dehanceValue(n[e++]),done:!1}:{done:!0}}})},r.prototype.replace=function(t){var e=this;return kt(t)&&(t=t.toJS()),$t(function(){var n=qn(!0);try{Array.isArray(t)?(e.clear(),t.forEach(function(o){return e.add(o)})):zr(t)?(e.clear(),t.forEach(function(o){return e.add(o)})):t!=null&&X("Cannot initialize set from "+t)}finally{Jn(n)}}),this},r.prototype.observe=function(t,e){return at(e!==!0,"`observe` doesn't support fireImmediately=true in combination with sets."),Vr(this,t)},r.prototype.intercept=function(t){return $r(this,t)},r.prototype.toJS=function(){return new Set(this)},r.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},r.prototype[Zi=L,Symbol.iterator]=function(){return this.values()},r}(),kt=Se("ObservableSet",dl),pl=function(){function r(t,e,n,o){e===void 0&&(e=new Map),this.target=t,this.values=e,this.name=n,this.defaultEnhancer=o,this.keysAtom=new pr(n+".keys")}return r.prototype.read=function(t){return this.values.get(t).get()},r.prototype.write=function(t,e){var n=this.target,o=this.values.get(t);if(o instanceof ir){o.set(e);return}if(se(this)){var i=le(this,{type:"update",object:this.proxy||n,name:t,newValue:e});if(!i)return;e=i.newValue}if(e=o.prepareNewValue(e),e!==D.UNCHANGED){var a=Jt(this),s=mt(),i=a||s?{type:"update",object:this.proxy||n,oldValue:o.value,name:t,newValue:e}:null;s&&Dt(it(it({},i),{name:this.name,key:t})),o.setNewValue(e),a&&Qt(this,i),s&&Nt()}},r.prototype.has=function(t){var e=this.pendingKeys||(this.pendingKeys=new Map),n=e.get(t);if(n)return n.get();var o=!!this.values.get(t);return n=new je(o,Kn,this.name+"."+It(t)+"?",!1),e.set(t,n),n.get()},r.prototype.addObservableProp=function(t,e,n){n===void 0&&(n=this.defaultEnhancer);var o=this.target;if(tc(o,t),se(this)){var i=le(this,{object:this.proxy||o,name:t,type:"add",newValue:e});if(!i)return;e=i.newValue}var a=new je(e,n,this.name+"."+It(t),!1);this.values.set(t,a),e=a.value,Object.defineProperty(o,t,uf(t)),this.notifyPropertyAddition(t,e)},r.prototype.addComputedProp=function(t,e,n){var o=this.target;n.name=n.name||this.name+"."+It(e),this.values.set(e,new ir(n)),(t===o||ks(t,e))&&Object.defineProperty(t,e,cf(e))},r.prototype.remove=function(t){if(!!this.values.has(t)){var e=this.target;if(se(this)){var n=le(this,{object:this.proxy||e,name:t,type:"remove"});if(!n)return}try{Zt();var o=Jt(this),i=mt(),a=this.values.get(t),s=a&&a.get();if(a&&a.set(void 0),this.keysAtom.reportChanged(),this.values.delete(t),this.pendingKeys){var l=this.pendingKeys.get(t);l&&l.set(!1)}delete this.target[t];var n=o||i?{type:"remove",object:this.proxy||e,oldValue:s,name:t}:null;i&&Dt(it(it({},n),{name:this.name,key:t})),o&&Qt(this,n),i&&Nt()}finally{qt()}}},r.prototype.illegalAccess=function(t,e){console.warn("Property '"+e+"' of '"+t+"' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner")},r.prototype.observe=function(t,e){return at(e!==!0,"`observe` doesn't support the fire immediately property for observable objects."),Vr(this,t)},r.prototype.intercept=function(t){return $r(this,t)},r.prototype.notifyPropertyAddition=function(t,e){var n=Jt(this),o=mt(),i=n||o?{type:"add",object:this.proxy||this.target,name:t,newValue:e}:null;if(o&&Dt(it(it({},i),{name:this.name,key:t})),n&&Qt(this,i),o&&Nt(),this.pendingKeys){var a=this.pendingKeys.get(t);a&&a.set(!0)}this.keysAtom.reportChanged()},r.prototype.getKeys=function(){var t,e;this.keysAtom.reportObserved();var n=[];try{for(var o=Gt(this.values),i=o.next();!i.done;i=o.next()){var a=Ke(i.value,2),s=a[0],l=a[1];l instanceof je&&n.push(s)}}catch(u){t={error:u}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},r}();function Pi(r,t,e){if(t===void 0&&(t=""),e===void 0&&(e=Gr),Object.prototype.hasOwnProperty.call(r,L))return r[L];at(Object.isExtensible(r),"Cannot make the designated object observable; it is not extensible"),Ye(r)||(t=(r.constructor.name||"ObservableObject")+"@"+At()),t||(t="ObservableObject@"+At());var n=new pl(r,new Map,It(t),e);return fr(r,L,n),n}var qi=Object.create(null),Ji=Object.create(null);function uf(r){return qi[r]||(qi[r]={configurable:!0,enumerable:!0,get:function(){return this[L].read(r)},set:function(t){this[L].write(r,t)}})}function Qi(r){var t=r[L];return t||(Be(r),r[L])}function cf(r){return Ji[r]||(Ji[r]={configurable:D.computedConfigurable,enumerable:!1,get:function(){return Qi(this).read(r)},set:function(t){Qi(this).write(r,t)}})}var ff=Se("ObservableObjectAdministration",pl);function Yt(r){return bi(r)?(Be(r),ff(r[L])):!1}function pe(r,t){if(typeof r=="object"&&r!==null){if(te(r))return t!==void 0&&X("It is not possible to get index atoms from arrays"),r[L].atom;if(kt(r))return r[L];if(Tt(r)){var e=r;if(t===void 0)return e._keysAtom;var n=e._data.get(t)||e._hasMap.get(t);return n||X("the entry '"+t+"' does not exist in the observable map '"+Lo(r)+"'"),n}if(Be(r),t&&!r[L]&&r[t],Yt(r)){if(!t)return X("please specify a property");var n=r[L].values.get(t);return n||X("no observable property '"+t+"' found on the observable object '"+Lo(r)+"'"),n}if(Ei(r)||ar(r)||Pn(r))return r}else if(typeof r=="function"&&Pn(r[L]))return r[L];return X("Cannot obtain atom from "+r)}function Wr(r,t){if(r||X("Expecting some object"),t!==void 0)return Wr(pe(r,t));if(Ei(r)||ar(r)||Pn(r)||Tt(r)||kt(r))return r;if(Be(r),r[L])return r[L];X("Cannot obtain administration from "+r)}function Lo(r,t){var e;return t!==void 0?e=pe(r,t):Yt(r)||Tt(r)||kt(r)?e=Wr(r):e=pe(r),e.name}var ta=Object.prototype.toString;function Di(r,t,e){return e===void 0&&(e=-1),Io(r,t,e)}function Io(r,t,e,n,o){if(r===t)return r!==0||1/r===1/t;if(r==null||t==null)return!1;if(r!==r)return t!==t;var i=typeof r;if(i!=="function"&&i!=="object"&&typeof t!="object")return!1;var a=ta.call(r);if(a!==ta.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+r==""+t;case"[object Number]":return+r!=+r?+t!=+t:+r==0?1/+r===1/t:+r==+t;case"[object Date]":case"[object Boolean]":return+r==+t;case"[object Symbol]":return typeof Symbol!="undefined"&&Symbol.valueOf.call(r)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":e>=0&&e++;break}r=ea(r),t=ea(t);var s=a==="[object Array]";if(!s){if(typeof r!="object"||typeof t!="object")return!1;var l=r.constructor,u=t.constructor;if(l!==u&&!(typeof l=="function"&&l instanceof l&&typeof u=="function"&&u instanceof u)&&"constructor"in r&&"constructor"in t)return!1}if(e===0)return!1;e<0&&(e=-1),n=n||[],o=o||[];for(var f=n.length;f--;)if(n[f]===r)return o[f]===t;if(n.push(r),o.push(t),s){if(f=r.length,f!==t.length)return!1;for(;f--;)if(!Io(r[f],t[f],e-1,n,o))return!1}else{var c=Object.keys(r),d=void 0;if(f=c.length,Object.keys(t).length!==f)return!1;for(;f--;)if(d=c[f],!(df(t,d)&&Io(r[d],t[d],e-1,n,o)))return!1}return n.pop(),o.pop(),!0}function ea(r){return te(r)?r.slice():dr(r)||Tt(r)||zr(r)||kt(r)?Array.from(r.entries()):r}function df(r,t){return Object.prototype.hasOwnProperty.call(r,t)}function Dn(r){return r[Symbol.iterator]=pf,r}function pf(){return this}if(typeof Proxy=="undefined"||typeof Symbol=="undefined")throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");(function(){function r(){}if(r.name!=="testCodeMinification"&&!0&&typeof process!="undefined"&&{}.IGNORE_MOBX_MINIFY_WARNING!=="true"){var t=["process","env","NODE_ENV"].join(".");console.warn("[mobx] you are running a minified build, but '"+t+"' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle")}})();typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:jc,extras:{getDebugName:Lo},$mobx:L});function hf(r){return!(r.prototype&&r.prototype.render)&&!$.isPrototypeOf(r)}function hl(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=t.prefix,n=e===void 0?"":e,o=t.suffix,i=o===void 0?"":o,a=r.displayName||r.name||r.constructor&&r.constructor.name||"<component>";return n+a+i}var ra=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vl=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},yl=function(){function r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),gl=function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(r,t):r.__proto__=t)},_l=function(r,t){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:r},na=console;function vf(r){var t=Co().allowStateChanges;return Co().allowStateChanges=r,t}function yf(r){Co().allowStateChanges=r}function gf(r,t,e,n,o){var i=vf(r),a=void 0;try{a=t(e,n,o)}finally{yf(i)}return a}function oa(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=r[t],o=ml[t],i=n?e===!0?function(){o.apply(this,arguments),n.apply(this,arguments)}:function(){n.apply(this,arguments),o.apply(this,arguments)}:o;r[t]=i}function ia(r,t){if(r==null||t==null||(typeof r=="undefined"?"undefined":ra(r))!=="object"||(typeof t=="undefined"?"undefined":ra(t))!=="object")return r!==t;var e=Object.keys(r);if(e.length!==Object.keys(t).length)return!0;for(var n=void 0,o=e.length-1;n=e[o];o--)if(t[n]!==r[n])return!0;return!1}var ml={componentWillMount:function(){var t=this,e=hl(this),n=!1,o=!1;function i(c){var d=this[c],p=Oi("reactive "+c);Object.defineProperty(this,c,{configurable:!0,enumerable:!0,get:function(){return p.reportObserved(),d},set:function(h){!o&&ia(d,h)?(d=h,n=!0,p.reportChanged(),n=!1):d=h}})}i.call(this,"props"),i.call(this,"state");var a=this.render.bind(this),s=null,l=!1,u=function(){return s=new Lr(e+".render()",function(){if(!l&&(l=!0,typeof t.componentWillReact=="function"&&t.componentWillReact(),t.__$mobxIsUnmounted!==!0)){var d=!0;try{o=!0,n||$.prototype.forceUpdate.call(t),d=!1}finally{o=!1,d&&s.dispose()}}}),s.reactComponent=t,f.$mobx=s,t.render=f,f(t.props,t.state,t.context)},f=function(d,p,y){l=!1;var h=void 0,g=void 0;if(s.track(function(){try{g=gf(!1,a,d,p,y)}catch(v){h=v}}),h)throw h;return g};this.render=u},componentWillUnmount:function(){this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0},componentDidMount:function(){},componentDidUpdate:function(){},shouldComponentUpdate:function(t,e){return this.state!==e?!0:ia(this.props,t)}};function Ni(r){if(arguments.length>1&&na.warn('Mobx observer: Using observer to inject stores is not supported. Use `@connect(["store1", "store2"]) ComponentClass instead or preferably, use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))``'),r.isMobxInjector===!0&&na.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),hf(r)){var t,e;return Ni((e=t=function(o){gl(i,o);function i(){return vl(this,i),_l(this,(i.__proto__||Object.getPrototypeOf(i)).apply(this,arguments))}return yl(i,[{key:"render",value:function(){return r.call(this,this.props,this.context)}}]),i}($),t.displayName=hl(r),e))}if(!r)throw new Error("Please pass a valid component to 'observer'");var n=r.prototype||r;return _f(n),r.isMobXReactObserver=!0,r}function _f(r){oa(r,"componentWillMount",!0),oa(r,"componentDidMount"),r.shouldComponentUpdate||(r.shouldComponentUpdate=ml.shouldComponentUpdate)}var mf=Ni(function(r){var t=r.children;return t[0]()});mf.displayName="Observer";var bf=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function xf(r,t){return t={exports:{}},r(t,t.exports),t.exports}xf(function(r,t){(function(e,n){r.exports=n()})(bf,function(){var e={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,u=l&&l(Object);return function f(c,d,p){if(typeof d!="string"){if(u){var y=l(d);y&&y!==u&&f(c,y,p)}var h=i(d);a&&(h=h.concat(a(d)));for(var g=0;g<h.length;++g){var v=h[g];if(!e[v]&&!n[v]&&(!p||!p[v])){var _=s(d,v);try{o(c,v,_)}catch{}}}return c}return c}})});var aa={children:!0,key:!0,ref:!0},sa=console;(function(r){gl(t,r);function t(){return vl(this,t),_l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return yl(t,[{key:"render",value:function(n){var o=n.children;return o.length>1?tr("div",null," ",o," "):o[0]}},{key:"getChildContext",value:function(){var n={},o=this.context.mobxStores;if(o)for(var i in o)n[i]=o[i];for(var a in this.props)!aa[a]&&a!=="suppressChangedStoreWarning"&&(n[a]=this.props[a]);return{mobxStores:n}}},{key:"componentWillReceiveProps",value:function(n){if(Object.keys(n).length!==Object.keys(this.props).length&&sa.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!n.suppressChangedStoreWarning)for(var o in n)!aa[o]&&this.props[o]!==n[o]&&sa.warn("MobX Provider: Provided store '"+o+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t})($);if(!$)throw new Error("mobx-preact requires Preact to be available");var oe,uo,la,bl=[],_t=H,ua=_t.__b,ca=_t.__r,fa=_t.diffed,da=_t.__c,pa=_t.unmount,ha=_t.__;function Ef(){for(var r;r=bl.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(xn),r.__H.__h.forEach(Bo),r.__H.__h=[]}catch(t){r.__H.__h=[],_t.__e(t,r.__v)}}_t.__b=function(r){oe=null,ua&&ua(r)},_t.__=function(r,t){r&&t.__k&&t.__k.__m&&(r.__m=t.__k.__m),ha&&ha(r,t)},_t.__r=function(r){ca&&ca(r);var t=(oe=r.__c).__H;t&&(uo===oe?(t.__h=[],oe.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0})):(t.__h.forEach(xn),t.__h.forEach(Bo),t.__h=[])),uo=oe},_t.diffed=function(r){fa&&fa(r);var t=r.__c;t&&t.__H&&(t.__H.__h.length&&(bl.push(t)!==1&&la===_t.requestAnimationFrame||((la=_t.requestAnimationFrame)||Of)(Ef)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.i=void 0})),uo=oe=null},_t.__c=function(r,t){t.some(function(e){try{e.__h.forEach(xn),e.__h=e.__h.filter(function(n){return!n.__||Bo(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],_t.__e(n,e.__v)}}),da&&da(r,t)},_t.unmount=function(r){pa&&pa(r);var t,e=r.__c;e&&e.__H&&(e.__H.__.forEach(function(n){try{xn(n)}catch(o){t=o}}),e.__H=void 0,t&&_t.__e(t,e.__v))};var va=typeof requestAnimationFrame=="function";function Of(r){var t,e=function(){clearTimeout(n),va&&cancelAnimationFrame(t),setTimeout(r)},n=setTimeout(e,100);va&&(t=requestAnimationFrame(e))}function xn(r){var t=oe,e=r.__c;typeof e=="function"&&(r.__c=void 0,e()),oe=t}function Bo(r){var t=oe;r.__c=r.__(),oe=t}function ya(r,t){for(var e in r)if(e!=="__source"&&!(e in t))return!0;for(var n in t)if(n!=="__source"&&r[n]!==t[n])return!0;return!1}function ga(r,t){this.props=r,this.context=t}(ga.prototype=new $).isPureReactComponent=!0,ga.prototype.shouldComponentUpdate=function(r,t){return ya(this.props,r)||ya(this.state,t)};var _a=H.__b;H.__b=function(r){r.type&&r.type.__f&&r.ref&&(r.props.ref=r.ref,r.ref=null),_a&&_a(r)};var Tf=H.__e;H.__e=function(r,t,e,n){if(r.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),o.__c(r,t)}Tf(r,t,e,n)};var ma=H.unmount;function xl(r,t,e){return r&&(r.__c&&r.__c.__H&&(r.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),r.__c.__H=null),(r=function(n,o){for(var i in o)n[i]=o[i];return n}({},r)).__c!=null&&(r.__c.__P===e&&(r.__c.__P=t),r.__c=null),r.__k=r.__k&&r.__k.map(function(n){return xl(n,t,e)})),r}function El(r,t,e){return r&&e&&(r.__v=null,r.__k=r.__k&&r.__k.map(function(n){return El(n,t,e)}),r.__c&&r.__c.__P===t&&(r.__e&&e.appendChild(r.__e),r.__c.__e=!0,r.__c.__P=e)),r}function co(){this.__u=0,this.t=null,this.__b=null}function Ol(r){var t=r.__.__c;return t&&t.__a&&t.__a(r)}function tn(){this.u=null,this.o=null}H.unmount=function(r){var t=r.__c;t&&t.__R&&t.__R(),t&&32&r.__u&&(r.type=null),ma&&ma(r)},(co.prototype=new $).__c=function(r,t){var e=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(e);var o=Ol(n.__v),i=!1,a=function(){i||(i=!0,e.__R=null,o?o(s):s())};e.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=El(l,l.__c.__P,l.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.t.pop();)u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),r.then(a,a)},co.prototype.componentWillUnmount=function(){this.t=[]},co.prototype.render=function(r,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=xl(this.__b,e,n.__O=n.__P)}this.__b=null}var o=t.__a&&tr(er,null,r.fallback);return o&&(o.__u&=-33),[tr(er,null,t.__a?null:r.children),o]};var ba=function(r,t,e){if(++e[1]===e[0]&&r.o.delete(t),r.props.revealOrder&&(r.props.revealOrder[0]!=="t"||!r.o.size))for(e=r.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;r.u=e=e[2]}};(tn.prototype=new $).__a=function(r){var t=this,e=Ol(t.__v),n=t.o.get(r);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),ba(t,r,n)):o()};e?e(i):i()}},tn.prototype.render=function(r){this.u=null,this.o=new Map;var t=On(r.children);r.revealOrder&&r.revealOrder[0]==="b"&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return r.children},tn.prototype.componentDidUpdate=tn.prototype.componentDidMount=function(){var r=this;this.o.forEach(function(t,e){ba(r,e,t)})};var wf=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Sf=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Mf=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Af=/[A-Z0-9]/g,Pf=typeof document!="undefined",Df=function(r){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(r)};function Nf(r,t,e){return t.__k==null&&(t.textContent=""),Ku(r,t),typeof e=="function"&&e(),r?r.__c:null}$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(r){Object.defineProperty($.prototype,r,{configurable:!0,get:function(){return this["UNSAFE_"+r]},set:function(t){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t})}})});var xa=H.event;function Cf(){}function Rf(){return this.cancelBubble}function jf(){return this.defaultPrevented}H.event=function(r){return xa&&(r=xa(r)),r.persist=Cf,r.isPropagationStopped=Rf,r.isDefaultPrevented=jf,r.nativeEvent=r};var Lf={enumerable:!1,configurable:!0,get:function(){return this.class}},Ea=H.vnode;H.vnode=function(r){typeof r.type=="string"&&function(t){var e=t.props,n=t.type,o={},i=n.indexOf("-")===-1;for(var a in e){var s=e[a];if(!(a==="value"&&"defaultValue"in e&&s==null||Pf&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in e&&e.value==null?a="value":a==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Df(e.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":Mf.test(a)&&(a=l):l=a="oninput":i&&Sf.test(a)?a=a.replace(Af,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&o[a=l]&&(a="oninputCapture"),o[a]=s}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=On(e.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=On(e.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),e.class&&!e.className?(o.class=e.class,Object.defineProperty(o,"className",Lf)):(e.className&&!e.class||e.class&&e.className)&&(o.class=o.className=e.className),t.props=o}(r),r.$$typeof=wf,Ea&&Ea(r)};var Oa=H.__r;H.__r=function(r){Oa&&Oa(r),r.__c};var Ta=H.diffed;H.diffed=function(r){Ta&&Ta(r);var t=r.props,e=r.__e;e!=null&&r.type==="textarea"&&"value"in t&&t.value!==e.value&&(e.value=t.value==null?"":t.value)};var If=0;function x(r,t,e,n,o,i){t||(t={});var a,s,l=t;"ref"in t&&(a=t.ref,delete t.ref);var u={type:r,props:l,key:e,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--If,__i:-1,__u:0,__source:o,__self:i};if(typeof r=="function"&&(a=r.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return H.vnode&&H.vnode(u),u}var Bf=globalThis&&globalThis.__rest||function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]]);return e},Ir;(function(r){function t(e){var n=Bf(e,[]),o=e.container;if(!o)throw new Error("Ensure the container of LogicFlow is specified and valid.");return tt({},r.defaults,n)}r.get=t})(Ir||(Ir={}));(function(r){r.defaults={background:!1,grid:!1,textEdit:!0,snapline:!0,outline:!1,disabledTools:[]}})(Ir||(Ir={}));var wa={node:!1,edge:!1},Xf={node:!0,edge:!0},kf=function(r){return!r||typeof r=="boolean"?r===!0?Y(Xf):Y(wa):pi(Y(wa),r)},Yf=function(){return Ss(window,"navigator.userAgent","").match(/MSIE|Trident/)!==null};function Ot(r){try{return JSON.parse(JSON.stringify(r))}catch{return r}}var en=200,Hf=9999,Uf=10,W;(function(r){r[r.DEFAULT=1]="DEFAULT",r[r.TEXT_EDIT=2]="TEXT_EDIT",r[r.SHOW_MENU=3]="SHOW_MENU",r[r.ALLOW_CONNECT=4]="ALLOW_CONNECT",r[r.NOT_ALLOW_CONNECT=5]="NOT_ALLOW_CONNECT"})(W||(W={}));var st;(function(r){r.NODE="node",r.EDGE="edge",r.GRAPH="graph"})(st||(st={}));var z;(function(r){r.NODE="node",r.CIRCLE_NODE="circle-node",r.POLYGON_NODE="polygon-node",r.RECT_NODE="rect-node",r.TEXT_NODE="text-node",r.ELLIPSE_NODE="ellipse-node",r.DIAMOND_NODE="diamond-node",r.HTML_NODE="html-node",r.CUSTOM_HTML_NODE="custom-html-node",r.EDGE="edge",r.LINE_EDGE="line-edge",r.POLYLINE_EDGE="polyline-edge",r.BEZIER_EDGE="bezier-edge",r.GRAPH="graph"})(z||(z={}));var C;(function(r){r.ELEMENT_CLICK="element:click",r.NODE_ADD="node:add",r.NODE_DELETE="node:delete",r.NODE_CLICK="node:click",r.NODE_DBCLICK="node:dbclick",r.NODE_GROUP_COPY="node:group-copy-add",r.NODE_DND_ADD="node:dnd-add",r.NODE_DND_DRAG="node:dnd-drag",r.NODE_MOUSEDOWN="node:mousedown",r.NODE_DRAGSTART="node:dragstart",r.NODE_DRAG="node:drag",r.NODE_DROP="node:drop",r.NODE_MOUSEUP="node:mouseup",r.NODE_MOUSEMOVE="node:mousemove",r.NODE_MOUSEENTER="node:mouseenter",r.NODE_MOUSELEAVE="node:mouseleave",r.NODE_CONTEXTMENU="node:contextmenu",r.NODE_ROTATE="node:rotate",r.NODE_RESIZE="node:resize",r.NODE_FOCUS="node:focus",r.NODE_BLUR="node:blur",r.NODE_PROPERTIES_CHANGE="node:properties-change",r.NODE_PROPERTIES_DELETE="node:properties-delete",r.EDGE_ADD="edge:add",r.EDGE_DELETE="edge:delete",r.EDGE_CLICK="edge:click",r.EDGE_DBCLICK="edge:dbclick",r.EDGE_FOCUS="edge:focus",r.EDGE_BLUR="edge:blur",r.EDGE_MOUSEENTER="edge:mouseenter",r.EDGE_MOUSELEAVE="edge:mouseleave",r.EDGE_CONTEXTMENU="edge:contextmenu",r.EDGE_ADJUST="edge:adjust",r.EDGE_EXCHANGE_NODE="edge:exchange-node",r.ANCHOR_DRAGSTART="anchor:dragstart",r.ANCHOR_DRAG="anchor:drag",r.ANCHOR_DROP="anchor:drop",r.ANCHOR_DRAGEND="anchor:dragend",r.ADJUST_POINT_MOUSEDOWN="adjustPoint:mousedown",r.ADJUST_POINT_MOUSEUP="adjustPoint:mouseup",r.ADJUST_POINT_MOUSEMOVE="adjustPoint:mousemove",r.ADJUST_POINT_DRAGSTART="adjustPoint:dragstart",r.ADJUST_POINT_DRAG="adjustPoint:drag",r.ADJUST_POINT_DROP="adjustPoint:drop",r.ADJUST_POINT_DRAGEND="adjustPoint:dragend",r.BLANK_MOUSEDOWN="blank:mousedown",r.BLANK_DRAGSTART="blank:dragstart",r.BLANK_DRAG="blank:drag",r.BLANK_DROP="blank:drop",r.BLANK_MOUSEMOVE="blank:mousemove",r.BLANK_MOUSEUP="blank:mouseup",r.BLANK_CLICK="blank:click",r.BLANK_CONTEXTMENU="blank:contextmenu",r.SELECTION_MOUSEDOWN="selection:mousedown",r.SELECTION_DRAGSTART="selection:dragstart",r.SELECTION_DRAG="selection:drag",r.SELECTION_DROP="selection:drop",r.SELECTION_MOUSEMOVE="selection:mousemove",r.SELECTION_MOUSEUP="selection:mouseup",r.SELECTION_CONTEXTMENU="selection:contextmenu",r.CONNECTION_NOT_ALLOWED="connection:not-allowed",r.TEXT_MOUSEDOWN="text:mousedown",r.TEXT_DRAGSTART="text:dragstart",r.TEXT_DRAG="text:drag",r.TEXT_DROP="text:drop",r.TEXT_CLICK="text:click",r.TEXT_DBCLICK="text:dbclick",r.TEXT_BLUR="text:blur",r.TEXT_MOUSEMOVE="text:mousemove",r.TEXT_MOUSEUP="text:mouseup",r.TEXT_FOCUS="text:focus",r.TEXT_ADD="text:add",r.TEXT_UPDATE="text:update",r.TEXT_CLEAR="text:clear",r.LABEL_MOUSEDOWN="label:mousedown",r.LABEL_DRAGSTART="label:dragstart",r.LABEL_DRAG="label:drag",r.LABEL_DROP="label:drop",r.LABEL_CLICK="label:click",r.LABEL_DBCLICK="label:dbclick",r.LABEL_BLUR="label:blur",r.LABEL_MOUSEMOVE="label:mousemove",r.LABEL_MOUSEUP="label:mouseup",r.LABEL_FOCUS="label:focus",r.LABEL_ADD="label:add",r.LABEL_UPDATE="label:update",r.LABEL_CLEAR="label:clear",r.LABEL_DELETE="label:delete",r.LABEL_SHOULD_ADD="label:should-add",r.LABEL_BATCH_ADD="label:batch-add",r.LABEL_SHOULD_UPDATE="label:should-update",r.LABEL_SHOULD_DELETE="label:should-delete",r.LABEL_BATCH_DELETE="label:batch-delete",r.LABEL_NOT_ALLOWED_ADD="label:not-allowed-add",r.HISTORY_CHANGE="history:change",r.GRAPH_TRANSFORM="graph:transform",r.GRAPH_RENDERED="graph:rendered",r.GRAPH_UPDATED="graph:updated"})(C||(C={}));var Vt;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.INCREASE=1]="INCREASE"})(Vt||(Vt={}));var ot;(function(r){r.HORIZONTAL="horizontal",r.VERTICAL="vertical"})(ot||(ot={}));var Xt;(function(r){r.TEXT="text",r.LABEL="label"})(Xt||(Xt={}));var Ff=0,ue=function(){function r(t){var e=t.onDragStart,n=e===void 0?so:e,o=t.onDragging,i=o===void 0?so:o,a=t.onDragEnd,s=a===void 0?so:a,l=t.eventType,u=l===void 0?"":l,f=t.eventCenter,c=t.step,d=c===void 0?1:c,p=t.isStopPropagation,y=p===void 0?!0:p,h=t.model,g=t.data,v=this;this.isDragging=!1,this.isStartDragging=!1,this.startX=0,this.startY=0,this.sumDeltaX=0,this.sumDeltaY=0,this.handleMouseDown=function(_){var O,w,S=window==null?void 0:window.document;if(_.button===Ff){v.isStopPropagation&&_.stopPropagation(),v.isStartDragging=!0,v.startX=_.clientX,v.startY=_.clientY,S.addEventListener("mousemove",v.handleMouseMove,!1),S.addEventListener("mouseup",v.handleMouseUp,!1);var M=(O=v.model)===null||O===void 0?void 0:O.getData();(w=v.eventCenter)===null||w===void 0||w.emit(C["".concat(v.eventType,"_MOUSEDOWN")],{e:_,data:v.data||M}),v.startTime=new Date().getTime()}},this.handleMouseMove=function(_){var O,w;if(v.isStopPropagation&&_.stopPropagation(),!!v.isStartDragging&&(v.sumDeltaX+=_.clientX-v.startX,v.sumDeltaY+=_.clientY-v.startY,v.startX=_.clientX,v.startY=_.clientY,v.step<=1||Math.abs(v.sumDeltaX)>v.step||Math.abs(v.sumDeltaY)>v.step)){var S=v.sumDeltaX%v.step,M=v.sumDeltaY%v.step,m=v.sumDeltaX-S,T=v.sumDeltaY-M;v.sumDeltaX=S,v.sumDeltaY=M;var P=(O=v.model)===null||O===void 0?void 0:O.getData();v.isDragging||((w=v.eventCenter)===null||w===void 0||w.emit(C["".concat(v.eventType,"_DRAGSTART")],{e:_,data:v.data||P}),v.onDragStart({event:_})),v.isDragging=!0,Promise.resolve().then(function(){var A,I;v.onDragging({deltaX:m,deltaY:T,event:_}),(A=v.eventCenter)===null||A===void 0||A.emit(C["".concat(v.eventType,"_MOUSEMOVE")],{deltaX:m,deltaY:T,e:_,data:v.data||P}),(I=v.eventCenter)===null||I===void 0||I.emit(C["".concat(v.eventType,"_DRAG")],{e:_,data:v.data||P})})}},this.handleMouseUp=function(_){var O=window.document;v.isStartDragging=!1,v.isStopPropagation&&_.stopPropagation(),Promise.resolve().then(function(){var w,S,M;O.removeEventListener("mousemove",v.handleMouseMove,!1),O.removeEventListener("mouseup",v.handleMouseUp,!1);var m=(w=v.model)===null||w===void 0?void 0:w.getData();(S=v.eventCenter)===null||S===void 0||S.emit(C["".concat(v.eventType,"_MOUSEUP")],{e:_,data:v.data||m}),v.isDragging&&(v.isDragging=!1,v.onDragEnd({event:_}),(M=v.eventCenter)===null||M===void 0||M.emit(C["".concat(v.eventType,"_DROP")],{e:_,data:v.data||m}))})},this.cancelDrag=function(){var _=window==null?void 0:window.document;_.removeEventListener("mousemove",v.handleMouseMove,!1),_.removeEventListener("mouseup",v.handleMouseUp,!1),v.onDragEnd({event:void 0}),v.isDragging=!1},this.destroy=function(){v.isStartDragging&&v.cancelDrag()},this.onDragStart=n,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=y,this.eventType=u,this.eventCenter=f,this.model=h,this.data=g}return r.prototype.setStep=function(t){this.step=t},r.prototype.setModel=function(t){this.model=t},r}(),zf=function(r){var t=r.x,e=r.y,n=r.width,o=r.height;return{x:t-n/2,y:e-o/2,x1:t+n/2,y1:e+o/2}},Gf=function(r){var t=r.startPoint,e=r.endPoint,n=(t.x+e.x)/2,o=(t.y+e.y)/2,i=Math.abs(t.x-e.x)+10,a=Math.abs(t.y-e.y)+10;return{x:n-i/2,y:o-a/2,x1:n+i/2,y1:o+a/2}},$f=function(r){var t=r.points,e=ke(t),n=kr(e,8),o=n.x,i=n.y,a=n.width,s=n.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},Vf=function(r){var t=r.path,e=Ci(t),n=kr(e,8),o=n.x,i=n.y,a=n.width,s=n.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},Wf=function(r){if(r.modelType===z.LINE_EDGE)return Gf(r);if(r.modelType===z.POLYLINE_EDGE)return $f(r);if(r.modelType===z.BEZIER_EDGE)return Vf(r)},Kf=function(r,t,e,n){var o=(t.y-r.y)*(n.x-e.x)-(r.x-t.x)*(e.y-n.y);if(o===0)return!1;var i=((t.x-r.x)*(n.x-e.x)*(e.y-r.y)+(t.y-r.y)*(n.x-e.x)*r.x-(n.y-e.y)*(t.x-r.x)*e.x)/o,a=-((t.y-r.y)*(n.y-e.y)*(e.x-r.x)+(t.x-r.x)*(n.y-e.y)*r.y-(n.x-e.x)*(t.y-r.y)*e.y)/o;return(i-r.x)*(i-t.x)<=0&&(a-r.y)*(a-t.y)<=0&&(i-e.x)*(i-n.x)<=0&&(a-e.y)*(a-n.y)<=0?{x:i,y:a}:!1},Br=function(r,t,e){var n=r.x,o=r.y,i=t.x,a=t.y,s=e.x,l=e.y,u=(l-a)/(s-i),f=a-u*i;return(n>=i&&n<=s||n<=i&&n>=s)&&(o>=a&&o<=l||o<=a&&o>=l)&&Math.abs(o-u*n-f)<Number.EPSILON},Xr=function(r){var t=r.start,e=r.end,n=r.offset,o=r.verticalLength,i=r.type,a={leftX:0,leftY:0,rightX:0,rightY:0},s=Math.atan((e.y-t.y)/(e.x-t.x)),l=Math.atan(n/o),u=Math.sqrt(o*o+n*n);return i==="start"?e.x>=t.x?(a.leftX=t.x+u*Math.sin(s+l),a.leftY=t.y-u*Math.cos(s+l),a.rightX=t.x-u*Math.sin(s-l),a.rightY=t.y+u*Math.cos(s-l)):(a.leftX=t.x-u*Math.sin(s+l),a.leftY=t.y+u*Math.cos(s+l),a.rightX=t.x+u*Math.sin(s-l),a.rightY=t.y-u*Math.cos(s-l)):i==="end"&&(e.x>=t.x?(a.leftX=e.x+u*Math.sin(s-l),a.leftY=e.y-u*Math.cos(s-l),a.rightX=e.x-u*Math.sin(s+l),a.rightY=e.y+u*Math.cos(s+l)):(a.leftX=e.x-u*Math.sin(s-l),a.leftY=e.y+u*Math.cos(s-l),a.rightX=e.x+u*Math.sin(s+l),a.rightY=e.y-u*Math.cos(s+l))),a},Ze=globalThis&&globalThis.__assign||function(){return Ze=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ze.apply(this,arguments)},Bt=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xe=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},Zf=function(r,t){return Math.abs(r.centerX-t.centerX)*2<r.width+t.width&&Math.abs(r.centerY-t.centerY)*2<r.height+t.height},Xo=function(r){var t=[],e={};return r.forEach(function(n){var o="".concat(n.x,"-").concat(n.y);n.id=o,e[o]=n}),Object.keys(e).forEach(function(n){t.push(e[n])}),t},Nn=function(r,t){return r.width===0&&r.height===0?r:{x:r.x,y:r.y,centerX:r.centerX,centerY:r.centerY,minX:r.minX-t,minY:r.minY-t,maxX:r.maxX+t,maxY:r.maxY+t,height:r.height+2*t,width:r.width+2*t}},qf=function(r,t){var e=Math.abs(r.x-t.centerX),n=Math.abs(r.y-t.centerY);return e/t.width>n/t.height?ot.HORIZONTAL:ot.VERTICAL},Cn=function(r,t,e){var n=qf(e,t);return n===ot.HORIZONTAL?{x:e.x>r.centerX?r.maxX:r.minX,y:e.y}:{x:e.x,y:e.y>r.centerY?r.maxY:r.minY}},Sa=function(r,t){var e=Math.min(r.minX,t.minX),n=Math.min(r.minY,t.minY),o=Math.max(r.maxX,t.maxX),i=Math.max(r.maxY,t.maxY);return{x:(e+o)/2,y:(n+i)/2,centerX:(e+o)/2,centerY:(n+i)/2,minX:e,minY:n,maxX:o,maxY:i,height:i-n,width:o-e}},kr=function(r,t){r===void 0&&(r=[]);var e=[],n=[];r.forEach(function(f){e.push(f.x),n.push(f.y)});var o=Math.min.apply(Math,xe([],Bt(e),!1)),i=Math.max.apply(Math,xe([],Bt(e),!1)),a=Math.min.apply(Math,xe([],Bt(n),!1)),s=Math.max.apply(Math,xe([],Bt(n),!1)),l=i-o,u=s-a;return t&&(l+=t,u+=t),{centerX:(o+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:o,minY:a,x:(o+i)/2,y:(a+s)/2,height:u,width:l}},Rn=function(r){var t=r.minX,e=r.minY,n=r.maxX,o=r.maxY;return[{x:t,y:e},{x:n,y:e},{x:n,y:o},{x:t,y:o}]},rn=function(r,t){var e=r.x,n=r.y;return e<t.minX||e>t.maxX||n<t.minY||n>t.maxY},Jf=function(r,t){return t<r.minX||t>r.maxX?[]:[{x:t,y:r.minY},{x:t,y:r.maxY}]},Qf=function(r,t){return t<r.minY||t>r.maxY?[]:[{x:r.minX,y:t},{x:r.maxX,y:t}]},td=function(r,t){return xe(xe([],Bt(Jf(r,t.x)),!1),Bt(Qf(r,t.y)),!1)},ko=function(r,t){return Math.abs(r.x-t.x)+Math.abs(r.y-t.y)},ed=function(r,t){var e=-2,n=0;return t.forEach(function(o){o&&(r.x===o.x&&(n+=e),r.y===o.y&&(n+=e))}),n},Ma=function(r,t,e,n,o){return ko(r,t)+ko(r,e)+ed(r,[t,e,n,o])},Tl=function(r,t,e,n,o){o||(o=0),r.unshift(t[n]),e[n]&&e[n]!==n&&o<=100&&Tl(r,t,e,e[n],o+1)},rd=function(r,t){var e=r.indexOf(t);e>-1&&r.splice(e,1)},br=function(r,t,e,n){var o=t.x-r.x,i=t.y-r.y,a=n.x-e.x,s=n.y-e.y,l=(-i*(r.x-e.x)+o*(r.y-e.y))/(-a*i+o*s),u=(a*(r.y-e.y)-s*(r.x-e.x))/(-a*i+o*s);return l>=0&&l<=1&&u>=0&&u<=1},Aa=function(r,t,e){if(e.width===0&&e.height===0)return!1;var n=Bt(Rn(e),4),o=n[0],i=n[1],a=n[2],s=n[3];return br(r,t,o,i)||br(r,t,o,s)||br(r,t,i,a)||br(r,t,a,s)},nd=function(r,t,e,n){var o=[];return r.forEach(function(i){i!==t&&(i.x===t.x||i.y===t.y)&&!Aa(i,t,e)&&!Aa(i,t,n)&&o.push(i)}),Xo(o)},od=function(r,t,e,n,o,i,a){var s=[],l=[t],u={},f={},c={};t.id&&(f[t.id]=0,c[t.id]=Ma(t,e,t));var d={};r.forEach(function(h){h.id&&(d[h.id]=h)});for(var p=function(){var h,g=1/0;if(l.forEach(function(_){_.id&&c[_.id]<g&&(g=c[_.id],h=_)}),h===e&&e.id){var v=[];return Tl(v,d,u,e.id),{value:v}}if(!h)return{value:[t,e]};rd(l,h),s.push(h),nd(r,h,n,o).forEach(function(_){if(s.indexOf(_)===-1&&(l.indexOf(_)===-1&&l.push(_),(h==null?void 0:h.id)&&(_==null?void 0:_.id))){var O=c[h.id]+ko(h,_);if(f[_.id]&&O>=f[_.id])return;u[_.id]=h.id,f[_.id]=O,c[_.id]=f[_.id]+Ma(_,e,t,i,a)}})};l.length;){var y=p();if(typeof y=="object")return y.value}return[t,e]},Pa=function(r){return Mt(r)},wl=function(r){for(var t=1;t<r.length-1;){var e=r[t-1],n=r[t],o=r[t+1];e.x===n.x&&n.x===o.x||e.y===n.y&&n.y===o.y?r.splice(t,1):t++}return r},Da=function(r,t,e,n,o){var i=Pa(e),a=Pa(n),s=Nn(i,o),l=Nn(a,o),u=Cn(s,i,r),f=Cn(l,a,t);if(Zf(s,l)){var c=ad(r,t,u,f);return xe(xe([r,u],Bt(c),!1),[f,t],!1)}var d=kr([u,f]),p=Sa(s,d),y=Sa(l,d),h=[];h=h.concat(Rn(p)),h=h.concat(Rn(y));var g={x:(r.x+t.x)/2,y:(r.y+t.y)/2};[d,p,y].forEach(function(_){h=h.concat(td(_,g).filter(function(O){return rn(O,s)&&rn(O,l)}))}),[{x:u.x,y:f.y},{x:f.x,y:u.y}].forEach(function(_){rn(_,s)&&rn(_,l)&&h.push(_)}),h.unshift(u),h.push(f),h=Xo(h);var v=od(h,u,f,i,a,r,t);return v.unshift(r),v.push(t),v.length>2&&(v=wl(v)),Xo(v)},id=function(r){if(r.length===1){var t=Bt(r,1),e=t[0];return[e,e]}else{for(var n=r[0],o=r[1],i=Wt(n.x,n.y,o.x,o.y),a=1;a<r.length-1;a++){var s=r[a],l=r[a+1],u=Wt(s.x,s.y,l.x,l.y);u>i&&(i=u,n=s,o=l)}return[n,o]}},Na=function(r,t,e){var n=Ee(r,e),o=Ee(t,e);return n&&o},Ca=function(r,t,e){var n=Ee(r,e),o=Ee(t,e),i=n&&o,a=n||o;return!i&&a},Ra=function(r,t,e){for(var n=void 0,o=Mt(e),i=Rn(o),a=0;a<i.length;a++){var s=br(r,t,i[a],i[(a+1)%i.length]);s&&(n=[i[a],i[(a+1)%i.length]])}if(n)return Kf(r,t,n[0],n[1])},jn=function(r,t){var e=void 0;return r.x===t.x?e=ot.VERTICAL:r.y===t.y&&(e=ot.HORIZONTAL),e},ke=function(r){var t=r.split(" "),e=[];return t&&t.forEach(function(n){var o=Bt(n.split(","),2),i=o[0],a=o[1];e.push({x:Number(i),y:Number(a)})}),e},ad=function(r,t,e,n){var o=[],i=jn(r,e),a=jn(t,n);if(i===a)r.y===e.y?(o.push({x:e.x,y:(e.y+n.y)/2}),o.push({x:n.x,y:(e.y+n.y)/2})):(o.push({x:(e.x+n.x)/2,y:e.y}),o.push({x:(e.x+n.x)/2,y:n.y}));else{var s={x:e.x,y:n.y},l=Br(s,r,e),u=Br(s,t,n);if(l||u)s={x:n.x,y:e.y};else{var f=ja(s,r,e),c=ja(s,t,n);f&&c&&(s={x:n.x,y:e.y})}o.push(s)}return o},ja=function(r,t,e){return r.x===t.x&&r.x===e.x||r.y===t.y&&r.y===e.y},Sl=function(r){if(!r)return 0;for(var t=0,e=0;e<r.length;e++){var n=r.charCodeAt(e);r.match(/[A-Z]/)?t+=1.5:n>=1&&n<=126||n>=65376&&n<=65439?t+=1:t+=2}return t},sd=function(r){var t=r.start,e=r.end,n;if(t.x===e.x&&t.y===e.y)n="";else{var o={start:t,end:e,offset:10,verticalLength:5},i=Xr(Ze(Ze({},o),{type:"start"})),a=Xr(Ze(Ze({},o),{type:"end"}));n="M".concat(i.leftX," ").concat(i.leftY,`
- L`).concat(i.rightX," ").concat(i.rightY,`
- L`).concat(a.rightX," ").concat(a.rightY,`
- L`).concat(a.leftX," ").concat(a.leftY," z")}return{d:n,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},La=function(r){var t=r.start,e=r.end,n=r.sourceNode,o=r.targetNode,i=r.offset,a=Mt(n),s=Mt(o),l=Nn(a,i),u=Nn(s,i),f=Cn(l,a,t),c=Cn(u,s,e);return{sNext:f,ePre:c}},Ci=function(r){var t=r.replace(/M/g,"").replace(/C/g,",").split(","),e=nn(t[0]),n=nn(t[1]),o=nn(t[2]),i=nn(t[3]);return[e,n,o,i]},nn=function(r){var t=Bt(r.replace(/(^\s*)/g,"").split(" "),2),e=t[0],n=t[1];return{x:+e,y:+n}},Ia=function(r,t){var e=Bt(r,4),n=e[0],o=e[1],i=e[2],a=e[3],s=Zd(n,o,i,a,t);return[s,r[3]]},Ml=function(r,t){for(var e=r.x,n=r.y,o=ke(t),i=Number.MAX_SAFE_INTEGER,a,s=[],l=0;l<o.length;l++)s.push({start:o[l],end:o[(l+1)%o.length]});if(s.forEach(function(d){var p=d.start,y=d.end;if(p.x===y.x){var h={x:p.x,y:n},g=Br(h,p,y);if(g){var v=Math.abs(p.x-e);v<i&&(i=v,a=h)}}else if(p.y===y.y){var h={x:e,y:p.y},g=Br(h,p,y);if(g){var v=Math.abs(p.y-n);v<i&&(i=v,a=h)}}}),!a){var u=s[0],f=u.start,c=u.end;a={x:f.x+(c.x-f.x)/2,y:f.y+(c.y-f.y)/2}}return a},ld=function(r){return We(r,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},Ba=function(r,t){return Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2))};function ud(r,t){return typeof t!="function"?function(e,n,o){return Object.assign({type:r.edgeType},o)}:function(e,n,o){var i=t(e,n,o);return i?typeof i=="string"?Object.assign({},o,{type:i}):Object.assign({type:i},o):{type:r.edgeType}}}var cd=function(r){var t=r.rows,e=r.rowsLength,n=r.fontSize,o=0;return ut(t,function(i){var a=Sl(i);o=a>o?a:o}),{width:Math.ceil(o/2)*n+n/4,height:e*(n+2)+n/4}},Ue=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},on=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))};function lr(r,t){return t*Math.round(r/t)||r}function fd(r,t,e){if(!r)return[];var n=Math.min.apply(Math,on([],Ue(r.map(function(h){return h[0]})),!1)),o=Math.max.apply(Math,on([],Ue(r.map(function(h){return h[0]})),!1)),i=Math.min.apply(Math,on([],Ue(r.map(function(h){return h[1]})),!1)),a=Math.max.apply(Math,on([],Ue(r.map(function(h){return h[1]})),!1)),s=-n,l=-i,u=r.map(function(h){var g=Ue(h,2),v=g[0],_=g[1];return[v+s,_+l]}),f=o-n,c=a-i,d=t?t/f:1,p=e?e/c:1,y=Math.min(d,p);return u.map(function(h){var g=Ue(h,2),v=g[0],_=g[1];return[v*y,_*y]})}var fo=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},po=function(r,t,e){var n=fo(r,2),o=n[0],i=n[1],a=fo(t,2),s=a[0],l=a[1],u=fo(e,2),f=u[0],c=u[1];return o>s&&o<f&&i>l&&i<c},Al=function(r,t){var e=t.multipleSelectKey,n=!1;switch(e){case"meta":n=r.metaKey;break;case"alt":n=r.altKey;break;case"shift":n=r.shiftKey;break;case"ctrl":n=r.ctrlKey;break;default:n=!1;break}return n},Ri=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();function Xa(r,t){return r instanceof bt&&t instanceof bt}var Pl=function(r){Ri(t,r);function t(e,n,o){var i=r.call(this,3)||this;return i[0]=e,i[1]=n,i[2]=o,i.x=e,i.y=n,i.z=o,Object.setPrototypeOf(i,t.prototype),i}return t.prototype.add=function(e){if(Xa(this,e))return new bt(this.x+e.x,this.y+e.y);var n=this.z+e.z;return new Yo((this.x+e.x)/n,(this.y+e.y)/n)},t.prototype.subtract=function(e){if(Xa(this,e))return new bt(this.x-e.x,this.y-e.y);var n=this.z-e.z;return n===0?new bt(this.x-e.x,this.y-e.y):new Yo((this.x-e.x)/n,(this.y-e.y)/n)},t}(Array),bt=function(r){Ri(t,r);function t(e,n,o){var i=r.call(this,e,n,o!=null?o:0)||this;return Object.setPrototypeOf(i,t.prototype),i}return t.prototype.toString=function(){return"Vector"},t.prototype.dot=function(e){var n=this;return e.reduce(function(o,i,a){return o+i*n[a]})},t.prototype.cross=function(e){return new t(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)},t.prototype.getLength=function(){return Math.hypot(this.x,this.y)},t.prototype.normalize=function(){var e=this.getLength();return new t(this.x/e,this.y/e)},t.prototype.crossZ=function(e){return this.x*e.y-this.y*e.x},t.prototype.angle=function(e){var n=this.crossZ(e),o=Math.acos(this.normalize().dot(e.normalize()));return n>=0?o:-o},t}(Pl),Yo=function(r){Ri(t,r);function t(e,n){var o=r.call(this,e,n,1)||this;return Object.setPrototypeOf(o,t.prototype),o}return t.prototype.toString=function(){return"Point"},t}(Pl),Qn=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fe=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ho=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},to=function(r){Qn(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=r.call(this,e.length)||this;return o.fill(new Array(3)),e.forEach(function(i,a){o[a]=i}),o.columns=e[0].length,o.rows=e.length,Object.setPrototypeOf(o,t.prototype),o}return t.prototype.getRow=function(e){return this[e]},t.prototype.getColumn=function(e){return ho([],Fe(this.map(function(n){return n[e]})),!1)},t.prototype.transpose=function(){for(var e=[],n=0;n<this.columns;n++)e.push(this.getColumn(n));return new(t.bind.apply(t,ho([void 0],Fe(e),!1)))},t.prototype.cross=function(e){var n=new Array(this.rows).fill("").map(function(){return[]});if(this.columns===e.rows)for(var o=0;o<this.rows;o++)for(var i=this.getRow(o),a=function(l){var u=e.getColumn(l);n[o][l]=i.reduce(function(f,c,d){return f+c*u[d]},0)},s=0;s<e.columns;s++)a(s);return new(t.bind.apply(t,ho([void 0],Fe(n),!1)))},t.prototype.to2D=function(){return this.map(function(e){return[e[0],e[1]]})},t.prototype.toPoints=function(){return this.map(function(e){return new Yo(e[0],e[1])})},t.prototype.toString=function(){var e=Fe(this[0],2),n=e[0],o=e[1],i=Fe(this[1],2),a=i[0],s=i[1],l=Fe(this[2],2),u=l[0],f=l[1];return"matrix(".concat(n," ").concat(o," ").concat(a," ").concat(s," ").concat(u," ").concat(f,")")},t.prototype.translate=function(e,n){return this.cross(new eo(e,n))},t.prototype.rotate=function(e){return this.cross(new dd(e))},t.prototype.scale=function(e,n){return this.cross(new pd(e,n))},t}(Array),dd=function(r){Qn(t,r);function t(e){var n=r.call(this,new bt(+Math.cos(e).toFixed(2),+Math.sin(e).toFixed(2),0),new bt(-Math.sin(e).toFixed(2),+Math.cos(e).toFixed(2),0),new bt(0,0,1))||this;return Object.setPrototypeOf(n,t.prototype),n}return t.prototype.inverse=function(){return this.transpose()},t}(to),pd=function(r){Qn(t,r);function t(e,n){var o=r.call(this,new bt(e,0,0),new bt(0,n,0),new bt(0,0,1))||this;return o.sx=e,o.sy=n,Object.setPrototypeOf(o,t.prototype),o}return t.prototype.inverse=function(){return new t(1/this.sx,1/this.sy)},t}(to),eo=function(r){Qn(t,r);function t(e,n){var o=r.call(this,new bt(1,0,0),new bt(0,1,0),new bt(e,n,1))||this;return o.tx=e,o.ty=n,Object.setPrototypeOf(o,t.prototype),o}return t.prototype.inverse=function(){return new t(-this.tx,-this.ty)},t}(to);zc({isolateGlobalState:!0});var Ln=globalThis&&globalThis.__assign||function(){return Ln=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ln.apply(this,arguments)},Ho=function(r){var t=r.anchors;return t},In=function(r,t){for(var e=t.nodes,n,o=e.length-1;o>=0;o--){var i=e[o],a=yd(r,i);if(a){var s=i.getTargetAnchor(r);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!n||hd(i,n.node,t))&&(n=l)}}}return n},hd=function(r,t,e){return r.zIndex>t.zIndex?!0:e.nodesMap[r.id].index>e.nodesMap[t.id].index},vd=function(r,t){for(var e=Ho(t),n,o=Number.MAX_SAFE_INTEGER,i=0;i<e.length;i++){var a=Wt(r.x,r.y,e[i].x,e[i].y);a<o&&(o=a,n={index:i,anchor:Ln(Ln({},e[i]),{x:e[i].x,y:e[i].y,id:e[i].id})})}return n},Wt=function(r,t,e,n){return Math.hypot(r-e,t-n)},Ee=function(r,t){var e=!1,n=0,o=Mt(t);return r.x>=o.minX-n&&r.x<=o.maxX+n&&r.y>=o.minY-n&&r.y<=o.maxY+n&&(e=!0),e},yd=function(r,t){var e=!1,n=5,o=Mt(t);return r.x>=o.minX-n&&r.x<=o.maxX+n&&r.y>=o.minY-n&&r.y<=o.maxY+n&&(e=!0),e},Mt=function(r){var t=r.x,e=r.y,n=r.width,o=r.height;return{minX:t-n/2,minY:e-o/2,maxX:t+n/2,maxY:e+o/2,x:t,y:e,width:n,height:o,centerX:t,centerY:e}},gd=function(r){var t=r,e=t.x,n=t.y,o=t.width,i=t.height,a=t.radius;return[{x:e-o/2+a,y:n-i/2+a,r:a},{x:e+o/2-a,y:n-i/2+a,r:a},{x:e-o/2+a,y:n+i/2-a,r:a},{x:e+o/2-a,y:n+i/2-a,r:a}]},ka=function(r,t,e){var n=gd(e),o,i=Number.MAX_SAFE_INTEGER;return n.forEach(function(a){var s=Wt(r.x,r.y,a.x,a.y);s<i&&(i=s,o=a)}),Uo(r,t,o)},Uo=function(r,t,e){var n,o=e.x,i=e.y,a=e.r;if(t===ot.HORIZONTAL){var s=o-Math.sqrt(a*a-(r.y-i)*(r.y-i)),l=o+Math.sqrt(a*a-(r.y-i)*(r.y-i)),u=Math.abs(s-r.x)<Math.abs(l-r.x)?s:l;n={x:u,y:r.y}}else if(t===ot.VERTICAL){var f=i-Math.sqrt(a*a-(r.x-o)*(r.x-o)),c=i+Math.sqrt(a*a-(r.x-o)*(r.x-o)),d=Math.abs(f-r.y)<Math.abs(c-r.y)?f:c;n={x:r.x,y:d}}return n},Ya=function(r,t){var e=t,n=!1,o=e.x,i=e.y,a=e.width,s=e.height,l=e.radius,u={minX:o-a/2+l,maxX:o+a/2-l,minY:i-s/2+l,maxY:i+s/2-l};return r.y===i+s/2||r.y===i-s/2?n=r.x>u.minX&&r.x<u.maxX:(r.x===o+a/2||r.x===o-a/2)&&(n=r.y>u.minY&&r.y<u.maxY),n},Ha=function(r,t,e){var n,o=e,i=o.x,a=o.y,s=o.rx,l=o.ry;if(t===ot.HORIZONTAL){var u=i-Math.sqrt(s*s-(r.y-a)*(r.y-a)*s*s/(l*l)),f=i+Math.sqrt(s*s-(r.y-a)*(r.y-a)*s*s/(l*l)),c=Math.abs(u-r.x)<Math.abs(f-r.x)?u:f;n={x:c,y:r.y}}else if(t===ot.VERTICAL){var d=a-Math.sqrt(l*l-(r.x-i)*(r.x-i)*l*l/(s*s)),p=a+Math.sqrt(l*l-(r.x-i)*(r.x-i)*l*l/(s*s)),y=Math.abs(d-r.y)<Math.abs(p-r.y)?d:p;n={x:r.x,y}}return n},an=function(r,t,e){for(var n=e.pointsPosition,o=Number.MAX_SAFE_INTEGER,i,a=[],s=0;s<n.length;s++)a.push({start:n[s],end:n[(s+1)%n.length]});return a.forEach(function(l){var u=l.start,f=l.end,c=u,d=f;u.x>f.x&&(c=f,d=u);var p={x:r.x,y:r.y};if(c.x===d.x&&t===ot.HORIZONTAL&&(p={x:c.x,y:r.y}),c.y===d.y&&t===ot.VERTICAL&&(p={x:r.x,y:c.y}),c.x!==d.x&&c.y!==d.y){var y=(d.y-c.y)/(d.x-c.x),h=(c.x*d.y-d.x*c.y)/(c.x-d.x);t===ot.HORIZONTAL?p={x:(r.y-h)/y,y:r.y}:t===ot.VERTICAL&&(p={x:r.x,y:y*r.x+h})}var g=Br(p,u,f);if(g){var v=Wt(p.x,p.y,r.x,r.y);v<o&&(o=v,i=p)}}),i},_d=function(r){var t=We(r,["id","type","x","y","text","label","properties","virtual","rotate","resizable","rotatable"]);return t},Ua=function(r,t,e,n){var o=r.x,i=r.y;return t.x>r.x?o=r.x+e/2:t.x<r.x&&(o=r.x-e/2),t.y>r.y?i=r.y+n/2:t.y<r.y&&(i=r.y-n/2),{x:o,y:i}},Dl=function(r){var t=r.rows,e=r.style,n=r.rowsLength,o=r.className,i=document.createElement("div");i.className=o,i.style.fontSize="".concat(e.fontSize),i.style.width="".concat(e.width),i.style.lineHeight="".concat(e.lineHeight),i.style.padding="".concat(e.padding),e.fontFamily&&(i.style.fontFamily="".concat(e.fontFamily)),n>1?t.forEach(function(s){var l=document.createElement("div");l.textContent=s,i.appendChild(l)}):i.textContent=t[0],document.body.appendChild(i);var a=i.clientHeight;return document.body.removeChild(i),a},Fa=function(r){var t=r.rows,e=r.rowsLength,n=r.fontSize,o=0;return t&&t.forEach(function(i){var a=Sl(i);o=a>o?a:o}),{width:Math.ceil(o/2)*n+n/4,height:e*(n+2)+n/4}},Bn=function(r){return typeof r!="object"?{isAllPass:!!r,msg:r?"":"\u4E0D\u5141\u8BB8\u8FDE\u63A5"}:r};let sn;const md=new Uint8Array(16);function bd(){if(!sn&&(sn=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!sn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sn(md)}const gt=[];for(let r=0;r<256;++r)gt.push((r+256).toString(16).slice(1));function xd(r,t=0){return gt[r[t+0]]+gt[r[t+1]]+gt[r[t+2]]+gt[r[t+3]]+"-"+gt[r[t+4]]+gt[r[t+5]]+"-"+gt[r[t+6]]+gt[r[t+7]]+"-"+gt[r[t+8]]+gt[r[t+9]]+"-"+gt[r[t+10]]+gt[r[t+11]]+gt[r[t+12]]+gt[r[t+13]]+gt[r[t+14]]+gt[r[t+15]]}const Ed=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var za={randomUUID:Ed};function Od(r,t,e){if(za.randomUUID&&!t&&!r)return za.randomUUID();r=r||{};const n=r.random||(r.rng||bd)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(let o=0;o<16;++o)t[e+o]=n[o];return t}return xd(n)}var Le=function(){return Od()},Or=new Map,Nl=function(r){var t=Le();function e(){r();var o=Or.get(t);if(o){var i=window.requestAnimationFrame(e);Or.set(t,i)}}var n=window.requestAnimationFrame(e);return Or.set(t,n),t},Xn=function(r){var t=Or.get(r);t&&(window.cancelAnimationFrame(t),Or.delete(r))},Yr=globalThis&&globalThis.__assign||function(){return Yr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Yr.apply(this,arguments)},Td=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Cl(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.value,a=r.fontSize,s=a===void 0?12:a,l=r.fill,u=l===void 0?"currentColor":l,f=r.overflowMode,c=f===void 0?"default":f,d=r.textWidth,p=d===void 0?void 0:d,y=r.model,h={x:e,y:o,fill:u,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(ut(we(r),function(S){var M=Td(S,2),m=M[0],T=M[1];typeof T!="object"&&(h[m]=T)}),i){var g=String(i).split(/[\r\n]/g),v=g.length;if(c!=="default"){var _=y.BaseType,O=y.modelType;if(_===st.NODE&&O!==z.TEXT_NODE||_===st.EDGE&&p)return wd(r)}if(v>1){var w=g.map(function(S,M){var m=s+2,T=(M-(v-1)/2)*m;return x("tspan",{className:"lf-text-tspan",x:e,y:o+T,children:S})});return x("text",Yr({},h,{children:w}))}return x("text",Yr({},h,{children:i}))}return null}function wd(r){var t=r.x,e=r.y,n=r.value,o=r.model,i=r.textWidth,a=r.fontSize,s=a===void 0?12:a,l=r.lineHeight,u=r.fontFamily,f=u===void 0?"":u,c=r.wrapPadding,d=c===void 0?"0, 0":c,p=r.overflowMode,y=o.width,h=o.height,g=o.textHeight,v=i||y,_=String(n).split(/[\r\n]/g),O=_.length,w=Dl({rows:_,style:{fontSize:"".concat(s,"px"),width:"".concat(v,"px"),fontFamily:f,lineHeight:l,padding:d},rowsLength:O,className:"lf-get-text-height"}),S=h>w?h:w;g&&(S=g);var M=p==="ellipsis";return M&&(S=s+2),x("g",{children:x("foreignObject",{width:v,height:S,x:t-v/2,y:e-S/2,style:{overflow:"visible",textAlign:"left"},children:x("div",{className:"lf-node-text-auto-wrap",style:{minHeight:S,width:v,padding:d},children:x("div",{className:M?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:M?_.join(""):"",style:Yr({},r),children:_.map(function(m){return x("div",{className:"lf-node-text--auto-wrap-inner",children:m})})})})})})}var Fo=globalThis&&globalThis.__assign||function(){return Fo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Fo.apply(this,arguments)},Sd=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function ur(r){var t={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return ut(we(r),function(e){var n=Sd(e,2),o=n[0],i=n[1];(o==="style"||typeof i!="object")&&(t[o]=i)}),x("line",Fo({},t))}var zo=globalThis&&globalThis.__assign||function(){return zo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},zo.apply(this,arguments)},Md=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function ae(r){var t=r.x,e=r.y,n=r.width,o=r.height,i=r.className,a=r.strokeWidth,s=r.radius,l=s===void 0?0:s,u=t-n/2,f=e-o/2,c={};return c["stroke-width"]=a,ut(we(r),function(d){var p=Md(d,2),y=p[0],h=p[1];typeof h!="object"&&(c[y]=h)}),i?c.className="lf-basic-shape ".concat(i):c.className="lf-basic-shape",l&&(c.rx=l,c.ry=l),c.x=u,c.y=f,x("rect",zo({},c))}var Go=globalThis&&globalThis.__assign||function(){return Go=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Go.apply(this,arguments)},Ad=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Hr(r){var t={d:""};return ut(we(r),function(e){var n=Ad(e,2),o=n[0],i=n[1];(o==="style"||typeof i!="object")&&(t[o]=i)}),x("path",Go({},t))}var $o=globalThis&&globalThis.__assign||function(){return $o=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},$o.apply(this,arguments)},Pd=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function cr(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.r,a=i===void 0?4:i,s=r.className,l={cx:e,cy:o,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return ut(we(r),function(u){var f=Pd(u,2),c=f[0],d=f[1];typeof d!="object"&&(l[c]=d)}),s?l.className="lf-basic-shape ".concat(s):l.className="lf-basic-shape",x("circle",$o({},l))}var Vo=globalThis&&globalThis.__assign||function(){return Vo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Vo.apply(this,arguments)},Dd=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Nd(r){var t=r.x,e=t===void 0?0:t,n=r.y,o=n===void 0?0:n,i=r.rx,a=i===void 0?4:i,s=r.ry,l=s===void 0?4:s,u=r.className,f={cx:e,cy:o,rx:a,ry:l,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return ut(we(r),function(c){var d=Dd(c,2),p=d[0],y=d[1];typeof y!="object"&&(f[p]=y)}),u?f.className="lf-basic-shape ".concat(u):f.className="lf-basic-shape",x("ellipse",Vo({},f))}var Wo=globalThis&&globalThis.__assign||function(){return Wo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Wo.apply(this,arguments)},Cd=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function Rl(r){var t=r.points,e=t===void 0?[]:t,n=r.className,o={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return ut(we(r),function(i){var a=Cd(i,2),s=a[0],l=a[1];typeof l!="object"&&(o[s]=l)}),n?o.classNmae="lf-basic-shape ".concat(n):o.className="lf-basic-shape",o.points=e.map(function(i){return i.join(",")}).join(" "),x("polygon",Wo({},o))}var Ko=globalThis&&globalThis.__assign||function(){return Ko=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ko.apply(this,arguments)},Rd=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i};function jd(r){var t=r.className,e={points:"",fill:"none"};return ut(we(r),function(n){var o=Rd(n,2),i=o[0],a=o[1];(i==="style"||typeof a!="object")&&(e[i]=a)}),t&&(e.className="".concat(t)),x("polyline",Ko({},e))}var jl=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ur=globalThis&&globalThis.__assign||function(){return Ur=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ur.apply(this,arguments)},Ld=globalThis&&globalThis.__rest||function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]]);return e},Id=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},J;(function(r){r[r.LEFT_TOP=0]="LEFT_TOP",r[r.RIGHT_TOP=1]="RIGHT_TOP",r[r.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",r[r.LEFT_BOTTOM=3]="LEFT_BOTTOM"})(J||(J={}));var Bd=function(r){jl(t,r);function t(e){var n=r.call(this)||this;n.updateEdgePointByAnchors=function(){var s=n.nodeModel,l=s.id,u=s.anchors,f=n.graphModel.getNodeEdges(l);ut(f,function(c){if(c.sourceNodeId===l){var d=Ie(u,function(p){return p.id===c.sourceAnchorId});d&&c.updateStartPoint({x:d.x,y:d.y})}else if(c.targetNodeId===l){var d=Ie(u,function(y){return y.id===c.targetAnchorId});d&&c.updateEndPoint({x:d.x,y:d.y})}})},n.triggerResizeEvent=function(s,l,u,f,c,d){n.graphModel.eventCenter.emit(C.NODE_RESIZE,{preData:s,data:l,deltaX:u,deltaY:f,index:c,model:d})},n.recalcResizeInfo=function(s,l,u,f,c){u===void 0&&(u=1),f===void 0&&(f=!1),c===void 0&&(c=!1);var d=Y(l),p=d.deltaX,y=d.deltaY,h=d.width,g=d.height,v=d.PCTResizeInfo;if(v){var _=4,O=0,w=0;switch(s){case J.LEFT_TOP:w=(p*-1-y)/_;break;case J.RIGHT_TOP:w=(p-y)/_;break;case J.RIGHT_BOTTOM:w=(p+y)/_;break;case J.LEFT_BOTTOM:w=(p*-1+y)/_;break}w!==0&&(O=Math.round(w/v.ResizeBasis.basisHeight*1e5)/1e3),v.ResizePCT.widthPCT=Math.max(Math.min(v.ResizePCT.widthPCT+O,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit),v.ResizePCT.heightPCT=Math.max(Math.min(v.ResizePCT.heightPCT+O,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit);var S=Math.round(v.ResizePCT.widthPCT*v.ResizeBasis.basisWidth/100),M=Math.round(v.ResizePCT.heightPCT*v.ResizeBasis.basisHeight/100);switch(s){case J.LEFT_TOP:p=h-S,y=g-M;break;case J.RIGHT_TOP:p=S-h,y=g-M;break;case J.RIGHT_BOTTOM:p=S-h,y=M-g;break;case J.LEFT_BOTTOM:p=h-S,y=M-g;break}return d}switch(s){case J.LEFT_TOP:d.width=f?h:h-p*u,d.height=c?g:g-y*u;break;case J.RIGHT_TOP:d.width=f?h:h+p*u,d.height=c?g:g-y*u;break;case J.RIGHT_BOTTOM:d.width=f?h:h+p*u,d.height=c?g:g+y*u;break;case J.LEFT_BOTTOM:d.width=f?h:h-p*u,d.height=c?g:g+y*u;break}return d},n.resizeNode=function(s){var l=s.deltaX,u=s.deltaY,f=n.index,c=n.props,d=c.model,p=c.graphModel,y=c.x,h=c.y;$d({x:y,y:h,deltaX:l,deltaY:u,index:f,nodeModel:d,graphModel:p,cancelCallback:function(){n.dragHandler.cancelDrag()}})},n.onDragging=function(s){var l=s.deltaX,u=s.deltaY,f=n.graphModel.transformModel,c=Id(f.fixDeltaXY(l,u),2),d=c[0],p=c[1];n.resizeNode({deltaX:d,deltaY:p})},n.onDragEnd=function(){var s=n.nodeModel.x,l=n.nodeModel.y;n.nodeModel.moveTo(s,l),n.updateEdgePointByAnchors()};var o=e.index,i=e.model,a=e.graphModel;return n.index=o,n.nodeModel=i,n.graphModel=a,n.dragHandler=new ue({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:a.gridSize}),n}return t.prototype.componentWillUnmount=function(){this.dragHandler.destroy()},t.prototype.render=function(){var e=this.props,n=e.x,o=e.y,i=e.direction,a=e.model,s=a.getResizeControlStyle(),l=s.width,u=s.height,f=Ld(s,["width","height"]);return x("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[x(ae,Ur({className:"lf-resize-control-content",x:n,y:o,width:l!=null?l:7,height:u!=null?u:7},f)),x(ae,{className:"lf-resize-control-content",x:n,y:o,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},t}($),Xd=function(r){jl(t,r);function t(){return r.call(this)||this}return t.prototype.getResizeControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=Mt(n),a=i.minX,s=i.minY,l=i.maxX,u=i.maxY,f=[{index:J.LEFT_TOP,direction:"nw",x:a,y:s},{index:J.RIGHT_TOP,direction:"ne",x:l,y:s},{index:J.RIGHT_BOTTOM,direction:"se",x:l,y:u},{index:J.LEFT_BOTTOM,direction:"sw",x:a,y:u}];return de(f,function(c){return x(Bd,Ur({},c,{model:n,graphModel:o}))})},t.prototype.getResizeOutline=function(){var e=this.props.model,n=e.x,o=e.y,i=e.width,a=e.height,s=e.getResizeOutlineStyle();return x(ae,Ur({},s,{x:n,y:o,width:i,height:a}))},t.prototype.render=function(){return x("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},t}($);function kd(r,t){var e=r.x,n=r.y,o=t.x,i=t.y,a={x:e+(o-e)/2,y:n+(i-n)/2};return a}function xr(r,t,e){var n=Yd(e),o=r.x-t.x,i=r.y-t.y,a=o*Math.cos(n)-i*Math.sin(n)+t.x,s=o*Math.sin(n)+i*Math.cos(n)+t.y;return{x:a,y:s}}function Yd(r){return r*Math.PI/180}function Hd(r){return r/Math.PI*180}function Ud(r,t,e,n,o,i,a,s,l){s===void 0&&(s=!1),l===void 0&&(l=!1);var u=t.deltaX,f=t.deltaY,c=t.width,d=t.height,p=Hd(e),y={x:n,y:o},h={x:i,y:a},g=xr(y,h,p),v={x:g.x+u,y:g.y+f},_=Vd(g,v,h,p,s,l,c,d),O=_.width,w=_.height,S=_.center;return t.width=O*r,t.height=w*r,t.deltaX=(S.x-h.x)*2,t.deltaY=(S.y-h.y)*2,t}var Fd=function(r,t,e,n,o,i,a,s,l,u){e===void 0&&(e=1),n===void 0&&(n=!1),o===void 0&&(o=!1),i===void 0&&(i=0);var f=Y(t),c=f.deltaX,d=f.deltaY,p=f.width,y=f.height,h=f.PCTResizeInfo;if(h){var g=4,v=0,_=0;switch(r){case J.LEFT_TOP:_=(c*-1-d)/g;break;case J.RIGHT_TOP:_=(c-d)/g;break;case J.RIGHT_BOTTOM:_=(c+d)/g;break;case J.LEFT_BOTTOM:_=(c*-1+d)/g;break}_!==0&&(v=Math.round(_/h.ResizeBasis.basisHeight*1e5)/1e3),h.ResizePCT.widthPCT=Math.max(Math.min(h.ResizePCT.widthPCT+v,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit),h.ResizePCT.heightPCT=Math.max(Math.min(h.ResizePCT.heightPCT+v,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit);var O=Math.round(h.ResizePCT.widthPCT*h.ResizeBasis.basisWidth/100),w=Math.round(h.ResizePCT.heightPCT*h.ResizeBasis.basisHeight/100);switch(r){case J.LEFT_TOP:c=p-O,d=y-w;break;case J.RIGHT_TOP:c=O-p,d=y-w;break;case J.RIGHT_BOTTOM:c=O-p,d=w-y;break;case J.LEFT_BOTTOM:c=p-O,d=w-y;break}return f}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return Ud(e,f,i,a,s,l,u,n,o);switch(r){case J.LEFT_TOP:f.width=n?p:p-c*e,f.height=o?y:y-d*e;break;case J.RIGHT_TOP:f.width=n?p:p+c*e,f.height=o?y:y-d*e;break;case J.RIGHT_BOTTOM:f.width=n?p:p+c*e,f.height=o?y:y+d*e;break;case J.LEFT_BOTTOM:f.width=n?p:p-c*e,f.height=o?y:y+d*e;break}return f},zd=function(r,t){var e=r.id,n=r.anchors,o=t.getNodeEdges(e);ut(o,function(i){if(i.sourceNodeId===e){var a=Ie(n,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===e){var a=Ie(n,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},Gd=function(r,t,e,n,o,i,a){a.eventCenter.emit(C.NODE_RESIZE,{preData:r,data:t,deltaX:e,deltaY:n,index:o,model:i})},$d=function(r){var t=r.x,e=r.y,n=r.deltaX,o=r.deltaY,i=r.index,a=r.nodeModel,s=r.graphModel,l=r.cancelCallback,u=a.r,f=a.rx,c=a.ry,d=a.width,p=a.height,y=a.PCTResizeInfo,h=a.minWidth,g=a.minHeight,v=a.maxWidth,_=a.maxHeight,O=a.rotate,w=a.x,S=a.y,M=h===v,m=g===_,T={width:u||f||d,height:u||c||p,deltaX:n,deltaY:o,PCTResizeInfo:y},P=u||f&&c?1/2:1,A=t,I=e,B=Fd(i,T,P,M,m,O,A,I,w,S);if(B.width<h||B.width>v||B.height<g||B.height>_){l==null||l();return}(O%(2*Math.PI)==0||y||A===void 0||I===void 0)&&(B.deltaX=M?0:B.deltaX,B.deltaY=m?0:B.deltaY);var U=a.getData(),F=a.resize(B);U.x===F.x&&U.y===F.y||(zd(a,s),Gd(U,F,n,o,i,a,s))};function Vd(r,t,e,n,o,i,a,s){o===void 0&&(o=!1),i===void 0&&(i=!1);var l={x:e.x-(r.x-e.x),y:e.y-(r.y-e.y)},u=kd(l,t),f=xr(t,u,-n),c=xr(l,u,-n);if(o){var d=Math.abs(f.x-c.x),p=d-a;u.x>f.x?u.x=u.x+p/2:u.x=u.x-p/2}if(i){var y=Math.abs(f.y-c.y),h=y-s;u.y>f.y?u.y=u.y+h/2:u.y=u.y-h/2}if(o||i){var g=xr(c,u,n),v=g.x-l.x,_=g.y-l.y;u.x=u.x-v,u.y=u.y-_,c=xr(l,u,-n),f={x:u.x-(c.x-u.x),y:u.y-(c.y-u.y)}}var O=Math.abs(f.x-c.x),w=Math.abs(f.y-c.y);return o&&(O=a),i&&(w=s),{width:O,height:w,center:u}}var Wd=100,Kd={x:1,y:0,z:0};function Zd(r,t,e,n,o){for(var i=function(p){if(p<0||p>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:r.x*Math.pow(1-p,3)+3*t.x*p*Math.pow(1-p,2)+3*e.x*Math.pow(p,2)*(1-p)+n.x*Math.pow(p,3),y:r.y*Math.pow(1-p,3)+3*t.y*p*Math.pow(1-p,2)+3*e.y*Math.pow(p,2)*(1-p)+n.y*Math.pow(p,3)}},a=0,s=2,l=n.x,u=n.y,f=n;a<o&&s<50;){f=i(1-s/Wd);var c=f.x,d=f.y;a=Wt(l,u,c,d),s++}return f}function qd(r,t){return r.x*t.y-r.y*t.x}function Jd(r,t){var e=[r.x,r.y,r.z],n=[t.x,t.y,t.z];return n.reduce(function(o,i,a){return o+i*e[a]})}function Qd(r,t){var e=qd(r,t),n=Math.acos(Jd(Ga(r),Ga(t)));return e>=0?n:-n}function Ga(r){var t=Math.hypot(r.x,r.y);return{x:r.x/t,y:r.y/t,z:0}}function tp(r){return Qd(Kd,r)}function ep(r){return r*(180/Math.PI)}var rp={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},Ll=function(r){var t=Y(rp);return r&&(t=pi(t,r)),t},np=Ll,op=1e3,ip=999,ji=function(){return++op},ap=function(){return--ip},dt=globalThis&&globalThis.__assign||function(){return dt=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},dt.apply(this,arguments)},R=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},ro=function(){function r(t,e){var n;this.BaseType=st.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Xt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=W.DEFAULT,this.modelType=z.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=e,this.properties=(n=t.properties)!==null&&n!==void 0?n:{},this.initEdgeData(t),this.setAttributes()}return r.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||Le()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,tt(this,ld(t));var a=this.graphModel.overlapMode;a===Vt.INCREASE&&(this.zIndex=t.zIndex||ji()),this.setAnchors(),this.initPoints(),this.formatText(t)},r.prototype.setAttributes=function(){},r.prototype.createId=function(){return null},r.prototype.getEdgeStyle=function(){return dt(dt({},this.graphModel.theme.baseEdge),this.style)},r.prototype.getAdjustPointStyle=function(){return dt({},this.graphModel.theme.edgeAdjust)},r.prototype.getTextStyle=function(){var t=this.graphModel.theme.edgeText;return Y(t)},r.prototype.getEdgeAnimationStyle=function(){var t=this.graphModel.theme.edgeAnimation;return Y(t)},r.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,o=this.isAnimation?e.stroke:t.stroke;return dt(dt(dt({},t),{fill:o,stroke:o}),n)},r.prototype.getOutlineStyle=function(){var t=this.graphModel,e=t.theme.outline;return Y(e)},r.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(r.prototype,"sourceNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.sourceNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"targetNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.targetNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),r.prototype.getBeginAnchor=function(t,e,n){var o,i,a=Ho(t);if(n){if(o=Ie(a,function(s){return s.id===n}),o)return o;console.warn("\u672A\u5728\u8282\u70B9\u4E0A\u627E\u5230\u6307\u5B9A\u7684\u8D77\u70B9\u951A\u70B9".concat(n,"\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u951A\u70B9\u4F5C\u4E3A\u8D77\u70B9"))}return a.forEach(function(s){var l=Ba(s,e);(i===void 0||l<i)&&(i=l,o=s)}),o},r.prototype.getEndAnchor=function(t,e){var n=this,o,i,a=Ho(t);if(e){if(o=Ie(a,function(s){return s.id===e}),o)return o;console.warn("\u672A\u5728\u8282\u70B9\u4E0A\u627E\u5230\u6307\u5B9A\u7684\u7EC8\u70B9\u951A\u70B9".concat(e,"\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u951A\u70B9\u4F5C\u4E3A\u7EC8\u70B9"))}return a.forEach(function(s){if(!!n.startPoint){var l=Ba(s,n.startPoint);(i===void 0||l<i)&&(i=l,o=s)}}),o},r.prototype.getProperties=function(){return ne(this.properties)},r.prototype.getData=function(){var t=this.properties;Te(t)&&(t=ne(t));var e={id:this.id,type:this.type,properties:t,sourceNodeId:this.sourceNodeId,targetNodeId:this.targetNodeId,startPoint:tt({},this.startPoint),endPoint:tt({},this.endPoint)};this.graphModel.overlapMode===Vt.INCREASE&&(e.zIndex=this.zIndex);var n=this.text,o=n.x,i=n.y,a=n.value;return a&&(e.text={x:o,y:i,value:a}),e},r.prototype.getHistoryData=function(){return this.getData()},r.prototype.setProperty=function(t,e){Mi(this.properties,t,Ot(e)),this.setAttributes()},r.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},r.prototype.setProperties=function(t){this.properties=dt(dt({},ne(this.properties)),Ot(t)),this.setAttributes()},r.prototype.changeEdgeId=function(t){var e=this.arrowConfig,n=e.markerEnd,o=e.markerStart;o&&o==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),n&&n==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},r.prototype.setStyle=function(t,e){var n;this.style=dt(dt({},this.style),(n={},n[t]=Ot(e),n))},r.prototype.setStyles=function(t){this.style=dt(dt({},this.style),Ot(t))},r.prototype.updateStyles=function(t){this.style=dt({},Ot(t))},r.prototype.setTextMode=function(t){this.textMode=t},r.prototype.formatText=function(t){var e,n,o,i=this.textPosition,a=i.x,s=i.y,l=t.text,u={value:"",x:a,y:s,draggable:!1,editable:!0};l&&(typeof l=="string"?u=dt(dt({},u),{value:l}):(u=dt(dt({},u),{x:(e=l.x)!==null&&e!==void 0?e:a,y:(n=l.y)!==null&&n!==void 0?n:s,value:(o=l.value)!==null&&o!==void 0?o:""}),Qe(l.draggable)||(u.draggable=l.draggable),Qe(l.editable)||(u.editable=l.editable))),this.text=u},r.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,n=t.y;this.text.x=e,this.text.y=n},r.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,a=n.value,s=n.draggable,l=n.editable;this.text={value:a,editable:l,draggable:s,x:o+t,y:i+e}},r.prototype.setText=function(t){t&&tt(this.text,t)},r.prototype.updateText=function(t){this.text=dt(dt({},ne(this.text)),{value:t})},r.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){var t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId);if(!t)throw new Error("\u65E0\u6CD5\u83B7\u53D6beginAnchor\uFF0C\u8BF7\u68C0\u67E5anchors\u76F8\u5173\u903B\u8F91\uFF0Canchors\u4E0D\u80FD\u4E3A\u7A7A");this.startPoint||(this.startPoint={x:t.x,y:t.y}),this.sourceAnchorId||(this.sourceAnchorId=t.id)}if(!this.targetAnchorId||!this.endPoint){var t=this.getEndAnchor(this.targetNode,this.targetAnchorId);if(!t)throw new Error("\u65E0\u6CD5\u83B7\u53D6endAnchor\uFF0C\u8BF7\u68C0\u67E5anchors\u76F8\u5173\u903B\u8F91\uFF0Canchors\u4E0D\u80FD\u4E3A\u7A7A");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},r.prototype.setSelected=function(t){t===void 0&&(t=!0),this.isSelected=t},r.prototype.setHovered=function(t){t===void 0&&(t=!0),this.isHovered=t},r.prototype.setHitable=function(t){t===void 0&&(t=!0),this.isHitable=t},r.prototype.setHittable=function(t){t===void 0&&(t=!0),this.isHittable=t},r.prototype.openEdgeAnimation=function(){this.isAnimation=!0},r.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},r.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},r.prototype.updateStartPoint=function(t){this.startPoint=t},r.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},r.prototype.updateEndPoint=function(t){this.endPoint=t},r.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},r.prototype.setZIndex=function(t){t===void 0&&(t=0),this.zIndex=t},r.prototype.initPoints=function(){},r.prototype.updateAttributes=function(t){tt(this,t)},r.prototype.getAdjustStart=function(){return this.startPoint},r.prototype.getAdjustEnd=function(){return this.endPoint},r.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:n.x,y:n.y})},r.BaseType=st.EDGE,R([E],r.prototype,"type",void 0),R([E],r.prototype,"sourceNodeId",void 0),R([E],r.prototype,"targetNodeId",void 0),R([E],r.prototype,"startPoint",void 0),R([E],r.prototype,"endPoint",void 0),R([E],r.prototype,"textMode",void 0),R([E],r.prototype,"text",void 0),R([E],r.prototype,"properties",void 0),R([E],r.prototype,"points",void 0),R([E],r.prototype,"pointsList",void 0),R([E],r.prototype,"isSelected",void 0),R([E],r.prototype,"isHovered",void 0),R([E],r.prototype,"isHitable",void 0),R([E],r.prototype,"isHittable",void 0),R([E],r.prototype,"draggable",void 0),R([E],r.prototype,"visible",void 0),R([E],r.prototype,"isAnimation",void 0),R([E],r.prototype,"isShowAdjustPoint",void 0),R([E],r.prototype,"zIndex",void 0),R([E],r.prototype,"state",void 0),R([E],r.prototype,"style",void 0),R([E],r.prototype,"arrowConfig",void 0),R([et],r.prototype,"sourceNode",null),R([et],r.prototype,"targetNode",null),R([et],r.prototype,"textPosition",null),R([b],r.prototype,"setProperty",null),R([b],r.prototype,"deleteProperty",null),R([b],r.prototype,"setProperties",null),R([b],r.prototype,"changeEdgeId",null),R([b],r.prototype,"setStyle",null),R([b],r.prototype,"setStyles",null),R([b],r.prototype,"updateStyles",null),R([b],r.prototype,"setTextMode",null),R([b],r.prototype,"formatText",null),R([b],r.prototype,"resetTextPosition",null),R([b],r.prototype,"moveText",null),R([b],r.prototype,"setText",null),R([b],r.prototype,"updateText",null),R([b],r.prototype,"setAnchors",null),R([b],r.prototype,"setSelected",null),R([b],r.prototype,"setHovered",null),R([b],r.prototype,"setHitable",null),R([b],r.prototype,"setHittable",null),R([b],r.prototype,"openEdgeAnimation",null),R([b],r.prototype,"closeEdgeAnimation",null),R([b],r.prototype,"setElementState",null),R([b],r.prototype,"updateStartPoint",null),R([b],r.prototype,"moveStartPoint",null),R([b],r.prototype,"updateEndPoint",null),R([b],r.prototype,"moveEndPoint",null),R([b],r.prototype,"setZIndex",null),R([b],r.prototype,"initPoints",null),R([b],r.prototype,"updateAttributes",null),R([b],r.prototype,"getAdjustStart",null),R([b],r.prototype,"getAdjustEnd",null),R([b],r.prototype,"updateAfterAdjustStartAndEnd",null),r}(),sp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),De=globalThis&&globalThis.__assign||function(){return De=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},De.apply(this,arguments)},Ht=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},vo=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},$a=function(r){sp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.BEZIER_EDGE,o.path="",o.initEdgeData(e),o.setAttributes(),o}return t.prototype.initEdgeData=function(e){this.offset=100,r.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,n=r.prototype.getEdgeStyle.call(this),o=this.properties.style,i=o===void 0?{}:o;return De(De(De({},n),Y(e)),Y(i))},t.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var e=0,n=0;return this.pointsList.forEach(function(o){var i=o.x,a=o.y;e+=i,n+=a}),{x:e/this.pointsList.length,y:n/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},t.prototype.getData=function(){var e=r.prototype.getData.call(this),n=this.pointsList.map(function(o){var i=o.x,a=o.y;return{x:i,y:a}});return De(De({},e),{pointsList:n})},t.prototype.getControls=function(){var e=this.startPoint,n=this.endPoint,o=La({start:e,end:n,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return o},t.prototype.getPath=function(e){var n=vo(e,4),o=n[0],i=n[1],a=n[2],s=n[3];return"M ".concat(o.x," ").concat(o.y,`
- C `).concat(i.x," ").concat(i.y,`,
- `).concat(a.x," ").concat(a.y,`,
- `).concat(s.x," ").concat(s.y)},t.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=this.getControls(),n=e.sNext,o=e.ePre;this.updatePath(n,o)},t.prototype.updatePath=function(e,n){e=Y(e),n=Y(n);var o={x:this.startPoint.x,y:this.startPoint.y},i={x:this.endPoint.x,y:this.endPoint.y};if(!e||!n){var a=this.getControls();e=a.sNext,n=a.ePre}this.pointsList=[o,e,n,i],this.path=this.getPath(this.pointsList)},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,n){this.startPoint.x+=e,this.startPoint.y+=n;var o=vo(this.pointsList,3),i=o[1],a=o[2];i.x+=e,i.y+=n,this.updatePath(i,a)},t.prototype.moveEndPoint=function(e,n){this.endPoint.x+=e,this.endPoint.y+=n;var o=vo(this.pointsList,3),i=o[1],a=o[2];a.x+=e,a.y+=n,this.updatePath(i,a)},t.prototype.updateAdjustAnchor=function(e,n){var o;n==="sNext"?this.pointsList[1]=e:n==="ePre"&&(this.pointsList[2]=e),this.path=this.getPath(this.pointsList),!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition))},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var n=e.startPoint,o=e.endPoint,i=e.sourceNode,a=e.targetNode,s=La({start:n,end:o,sourceNode:i,targetNode:a,offset:this.offset}),l=s.sNext,u=s.ePre;this.pointsList=[n,l,u,o],this.initPoints()},Ht([E],t.prototype,"path",void 0),Ht([b],t.prototype,"initPoints",null),Ht([b],t.prototype,"updatePoints",null),Ht([b],t.prototype,"updateStartPoint",null),Ht([b],t.prototype,"updateEndPoint",null),Ht([b],t.prototype,"moveStartPoint",null),Ht([b],t.prototype,"moveEndPoint",null),Ht([b],t.prototype,"updateAdjustAnchor",null),Ht([b],t.prototype,"getAdjustStart",null),Ht([b],t.prototype,"getAdjustEnd",null),Ht([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(ro),lp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Tr=globalThis&&globalThis.__assign||function(){return Tr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Tr.apply(this,arguments)},Va=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},up=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},Wa=function(r){lp(t,r);function t(){var e=r.apply(this,up([],Va(arguments),!1))||this;return e.modelType=z.LINE_EDGE,e}return t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.line,n=r.prototype.getEdgeStyle.call(this),o=this.properties.style,i=o===void 0?{}:o;return Tr(Tr(Tr({},n),Y(e)),Y(i))},t.prototype.initEdgeData=function(e){r.prototype.initEdgeData.call(this,e),this.points=this.getPath([this.startPoint,this.endPoint])},t.prototype.getPath=function(e){var n=Va(e,2),o=n[0],i=n[1];return"".concat(o.x,",").concat(o.y," ").concat(i.x,",").concat(i.y)},t.prototype.getTextPosition=function(){return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},t}(ro),cp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),wr=globalThis&&globalThis.__assign||function(){return wr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},wr.apply(this,arguments)},Et=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Ka=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},fp=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},Zo=function(r){cp(t,r);function t(){var e=r.apply(this,fp([],Ka(arguments),!1))||this;return e.modelType=z.POLYLINE_EDGE,e.draggingPointList=[],e}return t.prototype.initEdgeData=function(e){this.offset=30,r.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.polyline,n=r.prototype.getEdgeStyle.call(this),o=this.properties.style,i=o===void 0?{}:o;return wr(wr(wr({},n),Y(e)),Y(i))},t.prototype.getTextPosition=function(){var e,n=(e=this.text)===null||e===void 0?void 0:e.value;if(this.dbClickPosition&&!n){var o=this.dbClickPosition,i=o.x,a=o.y;return{x:i,y:a}}var s=ke(this.points),l=Ka(id(s),2),u=l[0],f=l[1];return{x:(u.x+f.x)/2,y:(u.y+f.y)/2}},t.prototype.getAfterAnchor=function(e,n,o){var i,a;return o.forEach(function(s){var l;e===ot.HORIZONTAL?l=Math.abs(n.y-s.y):e===ot.VERTICAL&&(l=Math.abs(n.x-s.x)),(!a||a>l)&&(a=l,i=s)}),i},t.prototype.getCrossPoint=function(e,n,o){var i;return e===ot.HORIZONTAL?i={x:o.x,y:n.y}:e===ot.VERTICAL&&(i={x:n.x,y:o.y}),i},t.prototype.removeCrossPoints=function(e,n,o){var i=o.map(function(v){return v});if(e===1){var a=i[e],s=i[n],l=i[e-1],u=Na(l,a,this.sourceNode);if(u){var f=Ca(a,s,this.sourceNode);if(f){var c=Ra(a,s,this.sourceNode);c&&(i[e]=c,i.splice(e-1,1),e--,n--)}}else{var d=this.sourceNode.anchors;d.forEach(function(v){if(v.x===l.x&&v.x===a.x||v.y===l.y&&v.y===a.y){var _=Wt(v.x,v.y,a.x,a.y),O=Wt(l.x,l.y,a.x,a.y);_<O&&(i[e-1]=v)}})}}if(n===o.length-2){var p=i[e],y=i[n],h=i[n+1],g=Na(y,h,this.targetNode);if(g){var f=Ca(p,y,this.targetNode);if(f){var c=Ra(p,y,this.targetNode);c&&(i[n]=c,i.splice(n+1,1))}}else{var d=this.targetNode.anchors;d.forEach(function(_){if(_.x===h.x&&_.x===y.x||_.y===h.y&&_.y===y.y){var O=Wt(_.x,_.y,y.x,y.y),w=Wt(h.x,h.y,y.x,y.y);O<w&&(i[n+1]=_)}})}}return i},t.prototype.getDraggingPoints=function(e,n,o,i,a){var s=a.map(function(f){return f}),l=this.getAfterAnchor(e,o,i),u=this.getCrossPoint(e,o,l);return n==="start"?(s.unshift(u),s.unshift(l)):(s.push(u),s.push(l)),s},t.prototype.updateCrossPoints=function(e){var n=e.map(function(_){return _}),o=e[0],i=e[1],a=e[n.length-2],s=e[n.length-1],l=this,u=l.sourceNode,f=l.targetNode,c=u.modelType,d=f.modelType,p=jn(o,i),y=n[0];switch(c){case z.RECT_NODE:if(u.radius!==0){var h=Ya(o,u);h||(y=ka(o,p,u))}break;case z.CIRCLE_NODE:y=Uo(o,p,u);break;case z.ELLIPSE_NODE:y=Ha(o,p,u);break;case z.DIAMOND_NODE:y=an(o,p,u);break;case z.POLYGON_NODE:y=an(o,p,u);break}y&&(n[0]=y);var g=jn(a,s),v=n[n.length-1];switch(d){case z.RECT_NODE:if(f.radius!==0){var h=Ya(s,f);h||(v=ka(s,g,f))}break;case z.CIRCLE_NODE:v=Uo(s,g,f);break;case z.ELLIPSE_NODE:v=Ha(s,g,f);break;case z.DIAMOND_NODE:v=an(s,g,f);break;case z.POLYGON_NODE:v=an(s,g,f);break}return v&&(n[n.length-1]=v),n},t.prototype.getData=function(){var e=r.prototype.getData.call(this),n=this.pointsList.map(function(o){var i=o.x,a=o.y;return{x:i,y:a}});return Object.assign({},e,{pointsList:n})},t.prototype.getPath=function(e){return e.map(function(n){return"".concat(n.x,",").concat(n.y)}).join(" ")},t.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=Da({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=e,this.points=e.map(function(n){return"".concat(n.x,",").concat(n.y)}).join(" ")},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,n){this.startPoint.x+=e,this.startPoint.y+=n,this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveEndPoint=function(e,n){this.endPoint.x+=e,this.endPoint.y+=n,this.updatePoints()},t.prototype.updatePointsList=function(e,n){this.pointsList.forEach(function(a){a.x+=e,a.y+=n});var o=this.pointsList[0];this.startPoint=Object.assign({},o);var i=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},i),this.initPoints()},t.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map(function(e){return e})},t.prototype.dragAppendSimple=function(e,n){var o;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,f=this.pointsList,c=f;return u===ot.HORIZONTAL?(f[s]={x:i.x,y:i.y+n.y},f[l]={x:a.x,y:a.y+n.y},c=this.pointsList.map(function(d){return d})):u===ot.VERTICAL&&(f[s]={x:i.x+n.x,y:i.y},f[l]={x:a.x+n.x,y:a.y},c=this.pointsList.map(function(d){return d})),this.updatePointsAfterDrag(c),this.draggingPointList=c,!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition)),{start:tt({},f[s]),end:tt({},f[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppend=function(e,n){var o;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,f=this.pointsList;if(u===ot.HORIZONTAL){f[s]={x:i.x,y:i.y+n.y},f[l]={x:a.x,y:a.y+n.y};var c=this.pointsList.map(function(g){return g});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x,y:i.y+n.y},p=Ee(d,this.sourceNode);if(!p){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x,y:a.y+n.y},p=Ee(h,this.targetNode);if(!p){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}else if(u===ot.VERTICAL){f[s]={x:i.x+n.x,y:i.y},f[l]={x:a.x+n.x,y:a.y};var c=this.pointsList.map(function(v){return v});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x+n.x,y:i.y},p=Ee(d,this.sourceNode);if(!p){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x+n.x,y:a.y},p=Ee(h,this.targetNode);if(!p){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}return!((o=this.text)===null||o===void 0)&&o.value&&this.setText(tt({},this.text,this.textPosition)),{start:tt({},f[s]),end:tt({},f[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppendEnd=function(){if(this.draggingPointList){var e=wl(ke(this.points));this.pointsList=e.map(function(i){return i}),this.draggingPointList=[];var n=e[0];this.startPoint=tt({},n);var o=e[e.length-1];this.endPoint=tt({},o)}this.isDragging=!1},t.prototype.updatePointsAfterDrag=function(e){var n=this.updateCrossPoints(e);this.points=n.map(function(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var n=e.startPoint,o=e.endPoint,i=e.sourceNode,a=e.targetNode;this.pointsList=Da({x:n.x,y:n.y},{x:o.x,y:o.y},i,a,this.offset||0),this.initPoints()},Et([E],t.prototype,"dbClickPosition",void 0),Et([b],t.prototype,"initPoints",null),Et([b],t.prototype,"updatePoints",null),Et([b],t.prototype,"updateStartPoint",null),Et([b],t.prototype,"moveStartPoint",null),Et([b],t.prototype,"updateEndPoint",null),Et([b],t.prototype,"moveEndPoint",null),Et([b],t.prototype,"updatePointsList",null),Et([b],t.prototype,"dragAppendStart",null),Et([b],t.prototype,"dragAppendSimple",null),Et([b],t.prototype,"dragAppend",null),Et([b],t.prototype,"dragAppendEnd",null),Et([b],t.prototype,"updatePointsAfterDrag",null),Et([b],t.prototype,"getAdjustStart",null),Et([b],t.prototype,"getAdjustEnd",null),Et([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(ro),ht=globalThis&&globalThis.__assign||function(){return ht=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ht.apply(this,arguments)},j=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Za=globalThis&&globalThis.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},dp=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Me=function(){function r(t,e){var n;this.BaseType=st.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Xt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=W.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=z.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.resizeRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=e,this.properties=(n=t.properties)!==null&&n!==void 0?n:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(r.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this,n=e.x,o=n===void 0?0:n,i=e.y,a=i===void 0?0:i;this.transform=new eo(-o,-a).rotate(t).translate(o,a).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),r.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||Le()}this.formatText(t),tt(this,_d(t));var i=this.graphModel.overlapMode;i===Vt.INCREASE&&(this.zIndex=t.zIndex||ji())},r.prototype.setAttributes=function(){},r.prototype.createId=function(){return null},r.prototype.setTextMode=function(t){this.textMode=t},r.prototype.formatText=function(t){var e,n,o,i=t.x,a=t.y,s=t.text,l={value:"",x:i,y:a,draggable:!1,editable:!0};s&&(typeof s=="string"?l.value=s:(l=ht(ht({},l),{x:(e=s.x)!==null&&e!==void 0?e:i,y:(n=s.y)!==null&&n!==void 0?n:a,value:(o=s.value)!==null&&o!==void 0?o:""}),Qe(s.draggable)||(l.draggable=s.draggable),Qe(s.editable)||(l.editable=s.editable))),t.text=l},r.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY,a=this.isAllowResizeNode(o,i,e,n);return a?(this.move(o/2,i/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()):this.getData()},r.prototype.proportionalResize=function(){},r.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,o=t.value,i=this.properties;Te(i)&&(i=ne(i)),Je(i.width)&&(i.width=this.width),Je(i.height)&&(i.height=this.height);var a={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(a.rotate=this.rotate),this.graphModel.overlapMode===Vt.INCREASE&&(a.zIndex=this.zIndex),o&&(a.text={x:e,y:n,value:o}),a},r.prototype.getHistoryData=function(){return this.getData()},r.prototype.getProperties=function(){return ne(this.properties)},r.prototype.getOuterGAttributes=function(){return{className:""}},r.prototype.getNodeStyle=function(){return ht(ht({},this.graphModel.theme.baseNode),this.style)},r.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,n=e===void 0?{}:e;return ht(ht({},Y(t)),Y(n))},r.prototype.getRotateControlStyle=function(){var t=this.graphModel.theme.rotateControl;return Y(t)},r.prototype.getResizeControlStyle=function(){var t=this.graphModel.theme.resizeControl;return Y(t)},r.prototype.getResizeOutlineStyle=function(){var t=this.graphModel.theme.resizeOutline;return Y(t)},r.prototype.getAnchorStyle=function(t){var e=this.graphModel.theme.anchor;return Y(e)},r.prototype.getAnchorLineStyle=function(t){var e=this.graphModel.theme.anchorLine;return Y(e)},r.prototype.getOutlineStyle=function(){var t=this.graphModel.theme.outline;return Y(t)},r.prototype.isAllowConnectedAsSource=function(t,e,n,o){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var a=!0,s="",l=0;l<i.length;l++){var u=i[l];if(!u.validate.call(this,this,t,e,n,o)){a=!1,s=u.message;break}}return{isAllPass:a,msg:s}},r.prototype.getConnectedSourceRules=function(){return this.sourceRules},r.prototype.isAllowConnectedAsTarget=function(t,e,n,o){var i=this.hasSetTargetRules?this.targetRules:this.getConnectedTargetRules();this.hasSetTargetRules=!0;for(var a=!0,s="",l=0;l<i.length;l++){var u=i[l];if(!u.validate.call(this,t,this,e,n,o)){a=!1,s=u.message;break}}return{isAllPass:a,msg:s}},r.prototype.isAllowMoveNode=function(t,e){var n,o,i=!0,a=!0,s=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var l=Za(s),u=l.next();!u.done;u=l.next()){var f=u.value,c=f(this,t,e);if(!c)return!1;if(typeof c=="object"){var d=c;if(!d.x&&!d.y)return!1;i=i&&d.x,a=a&&d.y}}}catch(p){n={error:p}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return{x:i,y:a}},r.prototype.getConnectedTargetRules=function(){return this.targetRules},r.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,n=t.id,o=t.x,i=t.y;return e&&e.length>0?e.map(function(a,s){return a.length?(a=a,{id:"".concat(n,"_").concat(s),x:o+a[0],y:i+a[1]}):(a=a,ht(ht({},a),{x:o+a.x,y:i+a.y,id:a.id||"".concat(n,"_").concat(s)}))}):this.getDefaultAnchor()},r.prototype.getDefaultAnchor=function(){return[]},r.prototype.getTargetAnchor=function(t){return vd(t,this)},r.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(r.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,o=e.y,i=e.rotate;return t.forEach(function(a){var s=a.x,l=a.y,u=dp(new to([s,l,1]).translate(-n,-o).rotate(i).translate(n,o)[0],2),f=u[0],c=u[1];a.x=f,a.y=c}),t},enumerable:!1,configurable:!0}),r.prototype.getAnchorInfo=function(t){if(!Je(t))for(var e=0;e<this.anchors.length;e++){var n=this.anchors[e];if(n.id===t)return n}},r.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},r.prototype.isAllowMoveByXORY=function(t,e,n){var o,i;if(n)o=!0,i=!0;else{var a=this.isAllowMoveNode(t,e);typeof a=="boolean"?(o=a,i=a):(o=a.x,i=a.y)}return{isAllowMoveX:o,isAllowMoveY:i}},r.prototype.move=function(t,e,n){n===void 0&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,a=o.isAllowMoveY;return i&&(this.x=this.x+t,this.text&&this.moveText(t,0)),a&&(this.y=this.y+e,this.text&&this.moveText(0,e)),(i||a)&&(this.rotate=this._rotate),i||a},r.prototype.getMoveDistance=function(t,e,n){n===void 0&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,a=o.isAllowMoveY,s=0,l=0;return i&&t&&(this.x=this.x+t,this.text&&this.moveText(t,0),s=t),a&&e&&(this.y=this.y+e,this.text&&this.moveText(0,e),l=e),[s,l]},r.prototype.moveTo=function(t,e,n){n===void 0&&(n=!1);var o=t-this.x,i=e-this.y;return!n&&!this.isAllowMoveNode(o,i)?!1:(this.text&&this.moveText(o,i),this.x=t,this.y=e,!0)},r.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,a=n.value,s=n.draggable,l=n.editable;this.text={value:a,editable:l,draggable:s,x:o+t,y:i+e}},r.prototype.updateText=function(t){this.text=ht(ht({},ne(this.text)),{value:t})},r.prototype.addNodeResizeRules=function(t){this.resizeRules.includes(t)||this.resizeRules.push(t)},r.prototype.isAllowResizeNode=function(t,e,n,o){var i,a,s=this.resizeRules.concat(this.graphModel.nodeResizeRules);try{for(var l=Za(s),u=l.next();!u.done;u=l.next()){var f=u.value,c=f(this,t,e,n,o);if(!c)return!1}}catch(d){i={error:d}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return!0},r.prototype.setSelected=function(t){t===void 0&&(t=!0),this.isSelected=t},r.prototype.setHovered=function(t){t===void 0&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},r.prototype.setIsShowAnchor=function(t){t===void 0&&(t=!0),this.isShowAnchor=t},r.prototype.setRotatable=function(t){t===void 0&&(t=!0),this.rotatable=t},r.prototype.setResizable=function(t){t===void 0&&(t=!0),this.resizable=t},r.prototype.setHitable=function(t){t===void 0&&(t=!0),this.isHitable=t},r.prototype.setHittable=function(t){t===void 0&&(t=!0),this.isHittable=t},r.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},r.prototype.updateProperties=function(t,e){var n=ne(this.properties);this.properties=t,this.setAttributes(),this.graphModel.eventCenter.emit(C.NODE_PROPERTIES_CHANGE,{id:this.id,keys:e,preProperties:n,properties:t})},r.prototype.setProperty=function(t,e){var n=ne(this.properties),o=Y(n);au(o,t,Ot(e)),this.updateProperties(o,[t])},r.prototype.setProperties=function(t){var e=ne(this.properties),n=ht(ht({},e),Ot(t)),o=[];Hu(t,function(i,a){(Bi(e,a)&&e[a]!==i||!Bi(e,a))&&o.push(a)}),this.updateProperties(n,o)},r.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},r.prototype.setStyle=function(t,e){var n;this.style=ht(ht({},this.style),(n={},n[t]=Ot(e),n))},r.prototype.setStyles=function(t){this.style=ht(ht({},this.style),Ot(t))},r.prototype.updateStyles=function(t){this.style=ht({},Ot(t))},r.prototype.setZIndex=function(t){t===void 0&&(t=1),this.zIndex=t},r.prototype.updateAttributes=function(t){tt(this,t)},r.BaseType=st.NODE,j([E],r.prototype,"type",void 0),j([E],r.prototype,"x",void 0),j([E],r.prototype,"y",void 0),j([E],r.prototype,"textMode",void 0),j([E],r.prototype,"text",void 0),j([E],r.prototype,"properties",void 0),j([E],r.prototype,"_width",void 0),j([E],r.prototype,"_height",void 0),j([E],r.prototype,"anchorsOffset",void 0),j([E],r.prototype,"isSelected",void 0),j([E],r.prototype,"isHovered",void 0),j([E],r.prototype,"isShowAnchor",void 0),j([E],r.prototype,"isDragging",void 0),j([E],r.prototype,"isHitable",void 0),j([E],r.prototype,"isHittable",void 0),j([E],r.prototype,"draggable",void 0),j([E],r.prototype,"visible",void 0),j([E],r.prototype,"rotatable",void 0),j([E],r.prototype,"resizable",void 0),j([E],r.prototype,"zIndex",void 0),j([E],r.prototype,"state",void 0),j([E],r.prototype,"autoToFront",void 0),j([E],r.prototype,"style",void 0),j([E],r.prototype,"transform",void 0),j([E],r.prototype,"_rotate",void 0),j([et],r.prototype,"incoming",null),j([et],r.prototype,"outgoing",null),j([b],r.prototype,"setTextMode",null),j([b],r.prototype,"addNodeMoveRules",null),j([b],r.prototype,"move",null),j([b],r.prototype,"getMoveDistance",null),j([b],r.prototype,"moveTo",null),j([b],r.prototype,"moveText",null),j([b],r.prototype,"updateText",null),j([b],r.prototype,"addNodeResizeRules",null),j([b],r.prototype,"setSelected",null),j([b],r.prototype,"setHovered",null),j([b],r.prototype,"setIsShowAnchor",null),j([b],r.prototype,"setRotatable",null),j([b],r.prototype,"setResizable",null),j([b],r.prototype,"setHitable",null),j([b],r.prototype,"setHittable",null),j([b],r.prototype,"setElementState",null),j([b],r.prototype,"setProperty",null),j([b],r.prototype,"setProperties",null),j([b],r.prototype,"deleteProperty",null),j([b],r.prototype,"setStyle",null),j([b],r.prototype,"setStyles",null),j([b],r.prototype,"updateStyles",null),j([b],r.prototype,"setZIndex",null),j([b],r.prototype,"updateAttributes",null),r}(),pp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Sr=globalThis&&globalThis.__assign||function(){return Sr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Sr.apply(this,arguments)},yo=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},qa=function(r){pp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.CIRCLE_NODE,o.r=50,o.initNodeData(e),o.setAttributes(),o}return Object.defineProperty(t.prototype,"width",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,o=this.properties.style,i=o===void 0?{}:o;return Sr(Sr(Sr({},e),Y(n)),Y(i))},t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.r;return[{x:n,y:o-i,id:"".concat(this.id,"_0")},{x:n+i,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+i,id:"".concat(this.id,"_2")},{x:n-i,y:o,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var n=e.width,o=e.deltaX,i=e.deltaY;return this.move(o/2,i/2),this.r=n,this.setProperties({r:n}),this.getData()},yo([E],t.prototype,"r",void 0),yo([et],t.prototype,"width",null),yo([et],t.prototype,"height",null),t}(Me),hp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Mr=globalThis&&globalThis.__assign||function(){return Mr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Mr.apply(this,arguments)},ze=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},ln=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Ja=function(r){hp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.DIAMOND_NODE,o.rx=30,o.ry=50,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,o=this.properties.style,i=o===void 0?{}:o;return Mr(Mr(Mr({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"points",{get:function(){var e=this,n=e.x,o=e.y,i=e.rx,a=e.ry;return[[n,o-a],[n+i,o],[n,o+a],[n-i,o]]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointsPosition",{get:function(){return de(this.points,function(e){var n=ln(e,2),o=n[0],i=n[1];return{x:o,y:i}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return ut(this.points,function(o){var i=ln(o,1),a=i[0];a<e&&(e=a),a>n&&(n=a)}),n-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return ut(this.points,function(o){var i=ln(o,2),a=i[1];a<e&&(e=a),a>n&&(n=a)}),n-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this;return de(this.points,function(n,o){var i=ln(n,2),a=i[0],s=i[1];return{x:a,y:s,id:"".concat(e.id,"_").concat(o)}})},t.prototype.resize=function(e){var n=e.width,o=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=n,this.ry=o,this.setProperties({rx:n,ry:o}),this.getData()},ze([E],t.prototype,"rx",void 0),ze([E],t.prototype,"ry",void 0),ze([et],t.prototype,"points",null),ze([et],t.prototype,"pointsPosition",null),ze([et],t.prototype,"width",null),ze([et],t.prototype,"height",null),t}(Me),vp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ar=globalThis&&globalThis.__assign||function(){return Ar=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ar.apply(this,arguments)},un=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Qa=function(r){vp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.ELLIPSE_NODE,o.rx=30,o.ry=45,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,o=this.properties.style,i=o===void 0?{}:o;return Ar(Ar(Ar({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"width",{get:function(){return this.rx*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.ry*2},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.rx,a=e.ry;return[{x:n,y:o-a,id:"".concat(this.id,"_0")},{x:n+i,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+a,id:"".concat(this.id,"_2")},{x:n-i,y:o,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var n=e.width,o=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=n,this.ry=o,this.setProperties({rx:n,ry:o}),this.getData()},un([E],t.prototype,"rx",void 0),un([E],t.prototype,"ry",void 0),un([et],t.prototype,"width",null),un([et],t.prototype,"height",null),t}(Me),yp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Pr=globalThis&&globalThis.__assign||function(){return Pr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Pr.apply(this,arguments)},cn=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},fn=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ts=function(r){yp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.points,o=e.width,i=e.height,a=n||this.points;this.points=fd(a,o,i)},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,o=this.properties.style,i=o===void 0?{}:o;return Pr(Pr(Pr({},e),Y(n)),Y(i))},Object.defineProperty(t.prototype,"pointsPosition",{get:function(){var e=this,n=e.x,o=e.y,i=e.width,a=e.height;return this.points.map(function(s){return{x:s[0]+n-i/2,y:s[1]+o-a/2}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=fn(o,1),a=i[0];a<e&&(e=a),a>n&&(n=a)}),n-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=fn(o,2),a=i[1];a<e&&(e=a),a>n&&(n=a)}),n-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,n=this,o=n.x,i=n.y,a=n.width,s=n.height,l=n.points;return l.map(function(u,f){var c=fn(u,2),d=c[0],p=c[1];return{x:o+d-a/2,y:i+p-s/2,id:"".concat(e.id,"_").concat(f)}})},t.prototype.resize=function(e){var n=this,o=e.width,i=e.height,a=e.deltaX,s=e.deltaY;this.move(a/2,s/2);var l=de(this.points,function(u){var f=fn(u,2),c=f[0],d=f[1];return[c*o/n.width,d*i/n.height]});return this.points=l,this.properties.points=l,this.getData()},cn([E],t.prototype,"points",void 0),cn([et],t.prototype,"pointsPosition",null),cn([et],t.prototype,"width",null),cn([et],t.prototype,"height",null),t}(Me),gp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dr=globalThis&&globalThis.__assign||function(){return Dr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Dr.apply(this,arguments)},_p=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},qo=function(r){gp(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.RECT_NODE,o.radius=0,o.initNodeData(e),o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height,i=e.radius;Je(n)||(this.width=n),Je(o)||(this.height=o),Je(i)||(this.radius=i)},t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.width,a=e.height;return[{x:n,y:o-a/2,id:"".concat(this.id,"_0")},{x:n+i/2,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+a/2,id:"".concat(this.id,"_2")},{x:n-i/2,y:o,id:"".concat(this.id,"_3")}]},t.prototype.getNodeStyle=function(){var e=r.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,o=this.properties.style,i=o===void 0?{}:o;return Dr(Dr(Dr({},e),Y(n)),Y(i))},_p([E],t.prototype,"radius",void 0),t}(Me),mp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Nr=globalThis&&globalThis.__assign||function(){return Nr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Nr.apply(this,arguments)},es=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},bp=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xp=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},rs=function(r){mp(t,r);function t(){var e=r.apply(this,xp([],bp(arguments),!1))||this;return e.modelType=z.TEXT_NODE,e}return t.prototype.getTextStyle=function(){var e=r.prototype.getTextStyle.call(this),n=this.graphModel.theme.text,o=this.properties.textStyle;return Nr(Nr(Nr({},e),Y(n)),Y(o))},Object.defineProperty(t.prototype,"width",{get:function(){var e=String(this.text.value).split(/[\r\n]/g),n=this.getTextStyle().fontSize,o=Fa({rows:e,fontSize:n,rowsLength:e.length}).width;return o},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=String(this.text.value).split(/[\r\n]/g),n=this.getTextStyle().fontSize,o=Fa({rows:e,fontSize:n,rowsLength:e.length}).height;return o},enumerable:!1,configurable:!0}),es([et],t.prototype,"width",null),es([et],t.prototype,"height",null),t}(Me),Ep=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ns=function(r){Ep(t,r);function t(e,n){var o=r.call(this,e,n)||this;return o.modelType=z.HTML_NODE,o.setAttributes(),o}return t.prototype.setAttributes=function(){r.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height;n&&(this.width=n),o&&(this.height=o)},t.prototype.getDefaultAnchor=function(){var e=this,n=e.x,o=e.y,i=e.width,a=e.height;return[{x:n,y:o-a/2,id:"".concat(this.id,"_0")},{x:n+i/2,y:o,id:"".concat(this.id,"_1")},{x:n,y:o+a/2,id:"".concat(this.id,"_2")},{x:n-i/2,y:o,id:"".concat(this.id,"_3")}]},t}(Me),K=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Op={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},dn=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],Tp=function(){function r(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.textMode=Xt.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Xt.TEXT,this.edgeTextMode=Xt.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",tt(this,this.computeConfig(t))}return r.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);tt(this,e)},r.prototype.computeConfig=function(t){var e=t.isSilentMode,n=t.textDraggable,o=t.textMode,i=t.textEdit,a=t.adjustEdgeStartAndEnd,s={};if(e===!1&&tt(s,this.stagedConfig),e===!0&&e!==this.isSilentMode){var l=We(Op,dn);this.stagedConfig=We(this,dn),tt(s,l)}Qe(i)||tt(s,{nodeTextEdit:i,edgeTextEdit:i}),Qe(n)||tt(s,{nodeTextDraggable:n,edgeTextDraggable:n}),o&&tt(s,{nodeTextMode:o,edgeTextMode:o}),To(a)&&tt(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var u=We(t,dn);return tt(s,u)},r.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},r.prototype.getConfig=function(){return We(this,dn)},K([E],r.prototype,"isSilentMode",void 0),K([E],r.prototype,"stopZoomGraph",void 0),K([E],r.prototype,"stopMoveGraph",void 0),K([E],r.prototype,"stopScrollGraph",void 0),K([E],r.prototype,"textMode",void 0),K([E],r.prototype,"textEdit",void 0),K([E],r.prototype,"textDraggable",void 0),K([E],r.prototype,"nodeTextEdit",void 0),K([E],r.prototype,"nodeTextDraggable",void 0),K([E],r.prototype,"nodeTextMultiple",void 0),K([E],r.prototype,"nodeTextVertical",void 0),K([E],r.prototype,"nodeTextMode",void 0),K([E],r.prototype,"edgeTextMode",void 0),K([E],r.prototype,"edgeTextEdit",void 0),K([E],r.prototype,"edgeTextDraggable",void 0),K([E],r.prototype,"edgeTextMultiple",void 0),K([E],r.prototype,"edgeTextVertical",void 0),K([E],r.prototype,"hideAnchors",void 0),K([E],r.prototype,"allowRotate",void 0),K([E],r.prototype,"allowResize",void 0),K([E],r.prototype,"hoverOutline",void 0),K([E],r.prototype,"nodeSelectedOutline",void 0),K([E],r.prototype,"adjustNodePosition",void 0),K([E],r.prototype,"autoExpand",void 0),K([E],r.prototype,"adjustEdge",void 0),K([E],r.prototype,"adjustEdgeMiddle",void 0),K([E],r.prototype,"adjustEdgeStartAndEnd",void 0),K([E],r.prototype,"adjustEdgeStart",void 0),K([E],r.prototype,"adjustEdgeEnd",void 0),K([E],r.prototype,"edgeSelectedOutline",void 0),K([b],r.prototype,"updateEditConfig",null),K([b],r.prototype,"updateTextMode",null),r}(),wp="*",Sp=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){var o=this;t==null||t.split(",").forEach(function(i){i=i.trim(),o._events[i]||(o._events[i]=[]),o._events[i].push({callback:e,once:!!n})})},r.prototype.once=function(t,e){var n=this;t==null||t.split(",").forEach(function(o){o=o.trim(),n.on(o,e,!0)})},r.prototype.emit=function(t,e){var n=this;t==null||t.split(",").forEach(function(o){var i=n._events[o]||[],a=n._events[wp]||[],s=function(l){for(var u=l.length,f=0;f<u;f++)if(!!l[f]){var c=l[f],d=c.callback,p=c.once;p&&(l.splice(f,1),l.length===0&&delete n._events[o],u--,f--),d.apply(n,[e])}};s(i),s(a)})},r.prototype.off=function(t,e){var n=this;t||(this._events={}),t.split(",").forEach(function(o){if(!e)delete n._events[o];else{for(var i=n._events[o]||[],a=i.length,s=0;s<a;s++)i[s].callback===e&&(i.splice(s,1),a--,s--);i.length===0&&delete n._events[o]}})},r.prototype.getEvents=function(){return this._events},r}(),Mp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Jo=globalThis&&globalThis.__assign||function(){return Jo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Jo.apply(this,arguments)},Ap=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Pp=function(r){Mp(t,r);function t(e){var n=r.call(this)||this;n.stepScrollX=0,n.stepScrollY=0,n.onDragging=function(s){var l=s.deltaX,u=s.deltaY;n.setState({isDragging:!0});var f=n.props.graphModel,c=f.transformModel,d=f.editConfigModel;d.stopMoveGraph!==!0&&c.translate(l,u)},n.onDragEnd=function(){n.setState({isDragging:!1})},n.zoomHandler=function(s){var l=n.props,u=l.graphModel,f=u.editConfigModel,c=u.transformModel,d=u.gridSize,p=l.graphModel,y=s.deltaX,h=s.deltaY;if(!f.stopScrollGraph&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),n.stepScrollX+=y,n.stepScrollY+=h,Math.abs(n.stepScrollX)>=d){var g=n.stepScrollX%d,v=n.stepScrollX-g;c.translate(-v*c.SCALE_X,0),n.stepScrollX=g}if(Math.abs(n.stepScrollY)>=d){var _=n.stepScrollY%d,O=n.stepScrollY-_;c.translate(0,-O*c.SCALE_Y),n.stepScrollY=_}return}if(!f.stopZoomGraph){s.preventDefault();var w=p.getPointByClient({x:s.clientX,y:s.clientY}),S=w.canvasOverlayPosition,M=S.x,m=S.y;c.zoom(s.deltaY<0,[M,m])}},n.clickHandler=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){var u=n.props.graphModel,f=u.selectElements;f.size>0&&u.clearSelectElements(),u.eventCenter.emit(C.BLANK_CLICK,{e:s})}},n.handleContextMenu=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){s.preventDefault();var u=n.props.graphModel,f=u.getPointByClient({x:s.clientX,y:s.clientY});u.eventCenter.emit(C.BLANK_CONTEXTMENU,{e:s,position:f})}},n.mouseDownHandler=function(s){var l=n.props.graphModel,u=l.eventCenter,f=l.editConfigModel,c=l.transformModel.SCALE_X,d=l.gridSize,p=s.target,y=!f.adjustEdge&&!f.adjustNodePosition;(p.getAttribute("name")==="canvas-overlay"||y)&&(f.stopMoveGraph!==!0?(n.stepDrag.setStep(d*c),n.stepDrag.handleMouseDown(s)):u.emit(C.BLANK_MOUSEDOWN,{e:s}),n.clickHandler(s))};var o=e.graphModel,i=o.gridSize,a=o.eventCenter;return n.stepDrag=new ue({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),n.state={isDragging:!1},n}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=e.getTransformStyle().transform,o=this.props,i=o.children,a=o.dnd,s=this.state.isDragging;return x("svg",Jo({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:s?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},a.eventMap(),{children:x("g",{transform:n,children:i})}))},t=Ap([Ct],t),t}($),Il=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fr=globalThis&&globalThis.__assign||function(){return Fr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Fr.apply(this,arguments)},Dp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Np=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},os=function(r){Il(t,r);function t(){var e=r.call(this)||this;return e.onDragging=function(n){var o=n.event,i=e.props,a=i.graphModel,s=i.bezierModel,l=i.type,u=a.getPointByClient({x:o.clientX,y:o.clientY}).canvasOverlayPosition,f=u.x,c=u.y;s.updateAdjustAnchor({x:f,y:c},l),a.eventCenter.emit(C.EDGE_ADJUST,{data:s.getData()})},e.onDragEnd=function(){var n=e.props.bezierModel;n.isDragging=!1},e.dragHandler=new ue({onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.render=function(){var e=this,n=this.props.position,o=n.x,i=n.y,a=this.props.bezierModel,s=a.getEdgeStyle().adjustAnchor;return x(cr,Fr({className:"lf-bezier-adjust-anchor",x:o,y:i},s,{onMouseDown:function(l){e.dragHandler.handleMouseDown(l)}}))},t}($),Cp=function(r){Il(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getBezierAdjust=function(e,n){var o=e.path,i=e.id,a=Ci(o),s=Np(a,4),l=s[0],u=s[1],f=s[2],c=s[3],d=e.getEdgeStyle().adjustLine,p=[];return p.push(x(ur,Fr({x1:l.x,y1:l.y,x2:u.x,y2:u.y},d))),p.push(x(os,{position:u,bezierModel:e,graphModel:n,type:"sNext"},"".concat(i,"_ePre"))),p.push(x(ur,Fr({x1:c.x,y1:c.y,x2:f.x,y2:f.y},d))),p.push(x(os,{position:f,bezierModel:e,graphModel:n,type:"ePre"},"".concat(i,"_sNext"))),p},t.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,n=e.edges,o=[],i=0;i<n.length;i++){var a=n[i];a.isSelected&&a.modelType===z.BEZIER_EDGE&&a.draggable&&o.push(this.getBezierAdjust(a,e))}return o},t.prototype.render=function(){return x("g",{className:"lf-bezier-adjust",children:this.selectedBezierEdge()})},t=Dp([Ct],t),t}($),Rp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Lp=function(r){Rp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.background;return x("div",{className:"lf-background",children:x("div",{style:su(e)?e:{},className:"lf-background-area"})})},t=jp([Ct],t),t}($),Ip=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Bp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},kn=function(r){Ip(t,r);function t(e){var n=r.call(this,e)||this;return n.id=Le(),n.gridOptions=n.props.graphModel.grid,n}return t.prototype.renderDot=function(){var e=this.gridOptions,n=e.config,o=e.size,i=o===void 0?1:o,a=e.visible,s=n!=null?n:{},l=s.color,u=s.thickness,f=u===void 0?2:u,c=Math.min(Math.max(2,f),i/4),d=a?1:0;return x("g",{fill:l,opacity:d,children:[x("circle",{cx:0,cy:0,r:c/2}),x("circle",{cx:0,cy:i,r:c/2}),x("circle",{cx:i,cy:0,r:c/2}),x("circle",{cx:i,cy:i,r:c/2})]})},t.prototype.renderMesh=function(){var e=this.gridOptions,n=e.config,o=e.size,i=o===void 0?1:o,a=e.visible,s=n!=null?n:{},l=s.color,u=s.thickness,f=u===void 0?1:u,c=Math.min(Math.max(1,f),i/2),d="M 0 0 H ".concat(i," V ").concat(i," H 0 Z"),p=a?1:0;return x("path",{d,stroke:l,strokeWidth:c/2,opacity:p,fill:"transparent"})},t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=this.gridOptions,o=n.type,i=n.size,a=i===void 0?1:i,s=e.SCALE_X,l=e.SKEW_Y,u=e.SKEW_X,f=e.SCALE_Y,c=e.TRANSLATE_X,d=e.TRANSLATE_Y,p=[s,l,u,f,c,d].join(","),y="matrix(".concat(p,")");return x("div",{className:"lf-grid",children:x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[x("defs",{children:x("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:y,x:"0",y:"0",width:a,height:a,children:[o==="dot"&&this.renderDot(),o==="mesh"&&this.renderMesh()]})}),x("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},t=Bp([Ct],t),t}($);(function(r){r.defaultProps={size:Uf,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function t(e){var n=Y(r.defaultProps);return typeof e=="number"?tt(n,{size:e}):typeof e=="boolean"?tt(n,{visible:e}):tt(n,e)}r.getGridOptions=t})(kn||(kn={}));var Xp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Yp=function(r){Xp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,n=e.getTransformStyle().transform,o=this.props.children;return x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:x("g",{transform:n,children:o})})},t=kp([Ct],t),t}($),Hp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ye=globalThis&&globalThis.__assign||function(){return ye=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ye.apply(this,arguments)},Up=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Fp=function(r){Hp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getNodesOutline=function(){var e=this.props.graphModel,n=e.nodes,o=e.editConfigModel,i=o.hoverOutline,a=o.nodeSelectedOutline,s=[];return n.forEach(function(l){if(l.isHovered||l.isSelected){var u=l.isHovered,f=l.isSelected,c=l.x,d=l.y,p=l.width,y=l.height;if(a&&f||i&&u){var h=l.getOutlineStyle(),g={};if(Object.keys(h).forEach(function(_){_!=="hover"&&(g[_]=h[_])}),u){var v=h.hover;g=ye(ye({},g),v)}s.push(x(ae,ye({transform:l.transform,className:"lf-outline-node",x:c,y:d,width:p+10,height:y+10},g)))}}}),s},t.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,n=e.edges,o=e.editConfigModel,i=o.edgeSelectedOutline,a=o.hoverOutline,s=[],l=0;l<n.length;l++){var u=n[l];(i&&u.isSelected||a&&u.isHovered)&&(u.modelType===z.LINE_EDGE?s.push(this.getLineOutline(u)):u.modelType===z.POLYLINE_EDGE?s.push(this.getPolylineOutline(u)):u.modelType===z.BEZIER_EDGE&&s.push(this.getBezierOutline(u)))}return s},t.prototype.getLineOutline=function(e){var n=e.startPoint,o=e.endPoint,i=(n.x+o.x)/2,a=(n.y+o.y)/2,s=Math.abs(n.x-o.x)+10,l=Math.abs(n.y-o.y)+10,u=e.getOutlineStyle();return x(ae,ye({className:"lf-outline-edge",x:i,y:a,width:s,height:l},u))},t.prototype.getPolylineOutline=function(e){var n=e.points,o=ke(n),i=kr(o,8),a=i.x,s=i.y,l=i.width,u=i.height,f=e.getOutlineStyle();return x(ae,ye({className:"lf-outline",x:a,y:s,width:l,height:u},f))},t.prototype.getBezierOutline=function(e){var n=e.path,o=Ci(n),i=kr(o,8),a=i.x,s=i.y,l=i.width,u=i.height,f=e.getOutlineStyle();return x(ae,ye({className:"lf-outline",x:a,y:s,width:l,height:u},f))},t.prototype.render=function(){return x("g",{className:"lf-outline",children:[this.getNodesOutline(),this.getEdgeOutline()]})},t=Up([Ct],t),t}($),zp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ge=globalThis&&globalThis.__assign||function(){return ge=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ge.apply(this,arguments)},Gp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},$p=function(r){zp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.snaplineModel,n=e!=null?e:{},o=n.position,i=n.isShowHorizontal,a=n.isShowVertical,s=e==null?void 0:e.getStyle(),l=o!=null?o:{},u=l.x,f=u===void 0?0:u,c=l.y,d=c===void 0?0:c,p=ge(ge({x1:-1e5,y1:d,x2:1e5,y2:d},s),{stroke:i?s==null?void 0:s.stroke:"none"}),y=ge(ge({x1:f,y1:-1e5,x2:f,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return x("g",{className:"lf-snapline",children:[x(ur,ge({},p)),x(ur,ge({},y))]})},t=Gp([Ct],t),t}($),Vp=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Wp=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Kp=function(r){Vp(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){this.triggerToolRender()},t.prototype.componentDidUpdate=function(){this.triggerToolRender()},t.prototype.getTools=function(){var e=this.props,n=e.tool,o=e.graphModel,i=o.textEditElement,a=n.getTools(),s=a.map(function(l){return tr(l,{textEditElement:i,graphModel:o,lf:n.instance})});return n.components=s,s},t.prototype.triggerToolRender=function(){var e=this.props,n=e.tool,o=e.graphModel,i=document.querySelector("#ToolOverlay_".concat(o.flowId)),a=n.getInstance();a.components.forEach(function(s){return s(a,i)}),a.components=[]},t.prototype.render=function(){var e=this.props.graphModel;return x("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(e.flowId),children:this.getTools()})},t=Wp([Ct],t),t}($),_e=globalThis&&globalThis.__assign||function(){return _e=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},_e.apply(this,arguments)},N=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Zp=globalThis&&globalThis.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vt=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},jt=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},qp=function(){function r(t){var e=this;this.modelMap=new Map,this.nodeModelMap=new Map,this.edgeModelMap=new Map,this.elementsModelMap=new Map,this.nodeMoveRules=[],this.nodeResizeRules=[],this.nodes=[],this.edges=[],this.overlapMode=Vt.DEFAULT,this.gridSize=1,this.partial=!1,this.waitCleanEffects=[];var n=t.container,o=t.partial,i=t.background,a=i===void 0?{}:i,s=t.grid,l=t.idGenerator,u=t.edgeGenerator,f=t.animation,c=t.customTrajectory;this.rootEl=n,this.partial=!!o,this.background=a,typeof s=="object"&&(this.gridSize=s.size||1),this.theme=Ll(t.style),this.grid=kn.getGridOptions(s!=null?s:!1),this.edgeType=t.edgeType||"polyline",this.animation=kf(f),this.overlapMode=t.overlapMode||Vt.DEFAULT,this.width=t.width||this.rootEl.getBoundingClientRect().width,this.height=t.height||this.rootEl.getBoundingClientRect().height;var d=new ResizeObserver(Ms(function(p){var y,h;try{for(var g=Zp(p),v=g.next();!v.done;v=g.next()){var _=v.value;_.target===e.rootEl&&(e.resize(),e.eventCenter.emit("graph:resize",{target:e.rootEl,contentRect:_.contentRect}))}}catch(O){y={error:O}}finally{try{v&&!v.done&&(h=g.return)&&h.call(g)}finally{if(y)throw y.error}}},16));d.observe(this.rootEl),this.waitCleanEffects.push(function(){d.disconnect()}),this.eventCenter=new Sp,this.editConfigModel=new Tp(t),this.transformModel=new th(this.eventCenter,t),this.flowId=Le(),this.idGenerator=l,this.edgeGenerator=ud(this,u),this.customTrajectory=c}return Object.defineProperty(r.prototype,"nodesMap",{get:function(){return this.nodes.reduce(function(t,e,n){return t[e.id]={index:n,model:e},t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"edgesMap",{get:function(){return this.edges.reduce(function(t,e,n){return t[e.id]={index:n,model:e},t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"modelsMap",{get:function(){return jt(jt([],vt(this.nodes),!1),vt(this.edges),!1).reduce(function(t,e){return t[e.id]=e,t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sortElements",{get:function(){for(var t=jt(jt([],vt(this.nodes),!1),vt(this.edges),!1).sort(function(s,l){return s.zIndex-l.zIndex}),e=[],n=[-en,-en],o=[this.width+en,this.height+en],i=0;i<t.length;i++){var a=t[i];a.visible&&(!this.partial||a.isSelected||this.isElementInArea(a,n,o,!1,!1))&&e.push(a)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textEditElement",{get:function(){var t=this.nodes.find(function(n){return n.state===W.TEXT_EDIT}),e=this.edges.find(function(n){return n.state===W.TEXT_EDIT});return t||e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectElements",{get:function(){var t=new Map;return this.nodes.forEach(function(e){e.isSelected&&t.set(e.id,e)}),this.edges.forEach(function(e){e.isSelected&&t.set(e.id,e)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach(function(e){e.isSelected&&t.push(e)}),t},enumerable:!1,configurable:!0}),r.prototype.getAreaElement=function(t,e,n,o,i){var a=this;n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=!1);var s=[];return ut(jt(jt([],vt(this.nodes),!1),vt(this.edges),!1),function(l){var u=a.isElementInArea(l,t,e,n,o);(!i||l.visible)&&u&&s.push(l)}),s},r.prototype.getModel=function(t){return this.modelMap.get(t)},r.prototype.getNodeModelById=function(t){var e;return this.fakeNode&&t===this.fakeNode.id?this.fakeNode:(e=this.nodesMap[t])===null||e===void 0?void 0:e.model},r.prototype.getPointByClient=function(t){var e=t.x,n=t.y,o=this.rootEl.getBoundingClientRect(),i={x:e-o.left,y:n-o.top},a=vt(this.transformModel.HtmlPointToCanvasPoint([i.x,i.y]),2),s=a[0],l=a[1],u={x:s,y:l};return{domOverlayPosition:i,canvasOverlayPosition:u}},r.prototype.isElementInArea=function(t,e,n,o,i){var a;if(o===void 0&&(o=!0),i===void 0&&(i=!0),t.BaseType===st.NODE){t=t;for(var s=Mt(t),l=s.minX,u=s.minY,f=s.maxX,c=s.maxY,d=[{x:l,y:u},{x:f,y:u},{x:f,y:c},{x:l,y:c}],p=i,y=0;y<d.length;y++){var h=d[y],g=h.x,v=h.y;if(a=vt(this.transformModel.CanvasPointToHtmlPoint([g,v]),2),g=a[0],v=a[1],po([g,v],e,n)!==i){p=!i;break}}return p}if(t.BaseType===st.EDGE){t=t;var _=t.startPoint,O=t.endPoint,w=this.transformModel.CanvasPointToHtmlPoint([_.x,_.y]),S=this.transformModel.CanvasPointToHtmlPoint([O.x,O.y]),M=po(w,e,n),m=po(S,e,n);return o?M&&m:M||m}return!1},r.prototype.graphDataToModel=function(t){var e=this;if((!this.width||!this.height)&&this.resize(),!t){this.nodes=[],this.edges=[];return}if(t.nodes?this.nodes=de(t.nodes,function(o){return e.getModelAfterSnapToGrid(o)}):this.nodes=[],t.edges){var n=this.edgeType;this.edges=de(t.edges,function(o){var i,a=e.getModel((i=o.type)!==null&&i!==void 0?i:n);if(!a)throw new Error("\u627E\u4E0D\u5230".concat(o.type,"\u5BF9\u5E94\u7684\u8FB9\u3002"));var s=new a(o,e),l=s.sourceNodeId,u=s.targetNodeId,f=s.sourceAnchorId,c=f===void 0?"":f,d=s.targetAnchorId,p=d===void 0?"":d,y=s.startPoint,h=s.endPoint,g=s.text,v=s.textPosition,_=function(I,B,U,F){var lt=I==null?void 0:I.anchors.find(function(pt){return pt.id===B});lt&&!Oo(lt,U)&&F(lt)},O=e.getNodeModelById(l),w=e.getNodeModelById(u);if(_(O,c,y,s.updateStartPoint.bind(s)),_(w,p,h,s.updateEndPoint.bind(s)),g){var S=g.x,M=g.y,m=v.x,T=v.y;if(S&&M&&m&&T){var P=S-m,A=M-T;s.resetTextPosition(),s.moveText(P,A)}}return e.edgeModelMap.set(s.id,s),e.elementsModelMap.set(s.id,s),s})}else this.edges=[]},r.prototype.modelToGraphData=function(){var t=[];this.edges.forEach(function(n){var o=n.getData();o&&!n.virtual&&t.push(o)});var e=[];return this.nodes.forEach(function(n){var o=n.getData();o&&!n.virtual&&e.push(o)}),{nodes:e,edges:t}},r.prototype.modelToHistoryData=function(){for(var t=!1,e=[],n=0;n<this.nodes.length;n++){var o=this.nodes[n];if(o.isDragging){t=!0;break}else e.push(o.getHistoryData())}if(t)return!1;for(var i=!1,a=[],s=0;s<this.edges.length;s++){var l=this.edges[s];if(l.isDragging){i=!0;break}else a.push(l.getHistoryData())}return i?!1:{nodes:e,edges:a}},r.prototype.getEdgeModelById=function(t){var e;return(e=this.edgesMap[t])===null||e===void 0?void 0:e.model},r.prototype.getElement=function(t){return this.modelsMap[t]},r.prototype.getNodeEdges=function(t){for(var e=[],n=0;n<this.edges.length;n++){var o=this.edges[n],i=o.sourceNodeId===t,a=o.targetNodeId===t;(i||a)&&e.push(o)}return e},r.prototype.getSelectElements=function(t){t===void 0&&(t=!0);var e=this.selectElements,n={nodes:[],edges:[]};return e.forEach(function(o){if(o.BaseType===st.NODE&&n.nodes.push(o.getData()),o.BaseType===st.EDGE){var i=o.getData(),a=e.get(i.sourceNodeId)&&e.get(i.targetNodeId);(t||a)&&n.edges.push(i)}}),n},r.prototype.updateAttributes=function(t,e){var n=this.getElement(t);n==null||n.updateAttributes(e)},r.prototype.changeNodeId=function(t,e){return e||(e=Le()),this.nodesMap[e]?(console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u5DF2\u5B58\u5728\u8282\u70B9".concat(e,", \u4FEE\u6539\u5931\u8D25")),""):this.nodesMap[t]?(this.edges.forEach(function(n){n.sourceNodeId===t&&(n.sourceNodeId=e),n.targetNodeId===t&&(n.targetNodeId=e)}),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e):(console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u627E\u4E0D\u5230\u8282\u70B9".concat(t,", \u4FEE\u6539\u5931\u8D25")),"")},r.prototype.changeEdgeId=function(t,e){return e||(e=Le()),this.edgesMap[e]?(console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u5DF2\u5B58\u5728\u8FB9: ".concat(e,", \u4FEE\u6539\u5931\u8D25")),""):this.edgesMap[t]?(this.edges.forEach(function(n){n.id===t&&n.changeEdgeId(e)}),e):(console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u627E\u4E0D\u5230\u8FB9: ".concat(e,", \u4FEE\u6539\u5931\u8D25")),"")},r.prototype.getTextModel=function(t){var e=this.editConfigModel,n=e.textMode,o=e.nodeTextMode,i=e.edgeTextMode;if(t.BaseType===st.NODE)return t.textMode||o||n||Xt.TEXT;if(t.BaseType===st.EDGE)return t.textMode||i||n||Xt.TEXT},r.prototype.setTextMode=function(t,e){this.editConfigModel.updateEditConfig({textMode:t})},r.prototype.setFakeNode=function(t){this.fakeNode=t},r.prototype.removeFakeNode=function(){this.fakeNode=null},r.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},r.prototype.toFront=function(t){var e,n,o,i=((e=this.nodesMap[t])===null||e===void 0?void 0:e.model)||((n=this.edgesMap[t])===null||n===void 0?void 0:n.model);i&&(this.overlapMode===Vt.DEFAULT&&((o=this.topElement)===null||o===void 0||o.setZIndex(),i.setZIndex(Hf),this.topElement=i),this.overlapMode===Vt.INCREASE&&this.setElementZIndex(t,"top"))},r.prototype.setElementZIndex=function(t,e){var n,o,i=((n=this.nodesMap[t])===null||n===void 0?void 0:n.model)||((o=this.edgesMap[t])===null||o===void 0?void 0:o.model);if(i){var a=void 0;typeof e=="number"?a=e:(e==="top"&&(a=ji()),e==="bottom"&&(a=ap())),i.setZIndex(a)}},r.prototype.deleteNode=function(t){var e=this.nodesMap[t].model,n=e.getData();this.deleteEdgeBySource(t),this.deleteEdgeByTarget(t),this.nodes.splice(this.nodesMap[t].index,1),this.eventCenter.emit(C.NODE_DELETE,{data:n,model:e})},r.prototype.addNode=function(t,e,n){e===void 0&&(e=C.NODE_ADD);var o=Ot(t),i=o.id;i&&this.nodesMap[i]&&delete o.id;var a=this.getModelAfterSnapToGrid(o);this.nodes.push(a);var s=a.getData(),l={data:s};return n&&(l.e=n),this.eventCenter.emit(e,l),a},r.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type);if(!e)throw new Error("\u627E\u4E0D\u5230".concat(t.type,"\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002"));var n=t.x,o=t.y;n&&o&&(t.x=lr(n,this.gridSize),t.y=lr(o,this.gridSize),typeof t.text=="object"&&t.text!==null&&(t.text.x+=t.x-n,t.text.y+=t.y-o));var i=new e(t,this);return this.nodeModelMap.set(i.id,i),this.elementsModelMap.set(i.id,i),i},r.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),n=e==null?void 0:e.getData();if(n){n.x+=30,n.y+=30,n.id="",typeof n.text=="object"&&n.text!==null&&(n.text.x+=30,n.text.y+=30);var o=this.addNode(n);return o.setSelected(!0),e==null||e.setSelected(!1),o.getData()}},r.prototype.moveNode=function(t,e,n,o){var i;o===void 0&&(o=!1);var a=this.nodesMap[t];if(!a){console.warn("\u4E0D\u5B58\u5728id\u4E3A".concat(t,"\u7684\u8282\u70B9"));return}var s=a.model;i=vt(s.getMoveDistance(e,n,o),2),e=i[0],n=i[1],this.moveEdge(t,e,n)},r.prototype.moveNode2Coordinate=function(t,e,n,o){o===void 0&&(o=!1);var i=this.nodesMap[t];if(!i){console.warn("\u4E0D\u5B58\u5728id\u4E3A".concat(t,"\u7684\u8282\u70B9"));return}var a=i.model,s=a.x,l=a.y,u=e-s,f=n-l;this.moveNode(t,u,f,o)},r.prototype.editText=function(t){this.setElementStateById(t,W.TEXT_EDIT)},r.prototype.addEdge=function(t){var e=Ot(t),n=e.type;n||(n=this.edgeType),e.id&&this.edgesMap[e.id]&&delete e.id;var o=this.getModel(n);if(!o)throw new Error("\u627E\u4E0D\u5230".concat(n,"\u5BF9\u5E94\u7684\u8FB9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8FB9\u3002"));var i=new o(_e(_e({},e),{type:n}),this);this.edgeModelMap.set(i.id,i),this.elementsModelMap.set(i.id,i);var a=i.getData();return this.edges.push(i),this.eventCenter.emit(C.EDGE_ADD,{data:a}),i},r.prototype.moveEdge=function(t,e,n){for(var o=0;o<this.edges.length;o++){var i=this.edges[o],a=i.textPosition,s=a.x,l=a.y,u=this.edges[o].sourceNodeId===t,f=this.edges[o].targetNodeId===t;u&&i.moveStartPoint(e,n),f&&i.moveEndPoint(e,n),(u||f)&&this.handleEdgeTextMove(i,s,l)}},r.prototype.handleEdgeTextMove=function(t,e,n){var o;if(t.customTextPosition){t.resetTextPosition();return}if(t.modelType===z.POLYLINE_EDGE&&((o=t.text)===null||o===void 0?void 0:o.value)){var i=t.text,a=Ml(i,t.points);t.moveText(a.x-i.x,a.y-i.y)}var s=t.textPosition,l=s.x,u=s.y;t.moveText(l-e,u-n)},r.prototype.deleteEdgeBySourceAndTarget=function(t,e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].sourceNodeId===t&&this.edges[n].targetNodeId===e){var o=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(C.EDGE_DELETE,{data:o})}},r.prototype.deleteEdgeById=function(t){var e=this.edgesMap[t];if(!!e){var n=this.edgesMap[t].index,o=this.edgesMap[t].model.getData();this.edges.splice(n,1),this.eventCenter.emit(C.EDGE_DELETE,{data:o})}},r.prototype.deleteEdgeBySource=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].sourceNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(C.EDGE_DELETE,{data:n})}},r.prototype.deleteEdgeByTarget=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].targetNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(C.EDGE_DELETE,{data:n})}},r.prototype.setElementStateById=function(t,e,n){this.nodes.forEach(function(o){o.id===t?o.setElementState(e,n):o.setElementState(W.DEFAULT)}),this.edges.forEach(function(o){o.id===t?o.setElementState(e,n):o.setElementState(W.DEFAULT)})},r.prototype.updateText=function(t,e){var n=Ie(jt(jt([],vt(this.nodes),!1),vt(this.edges),!1),function(o){return o.id===t});n==null||n.updateText(e)},r.prototype.selectNodeById=function(t,e){var n;e===void 0&&(e=!1),e||this.clearSelectElements();var o=(n=this.nodesMap[t])===null||n===void 0?void 0:n.model;o==null||o.setSelected(!0)},r.prototype.selectEdgeById=function(t,e){var n;e===void 0&&(e=!1),e||this.clearSelectElements();var o=(n=this.edgesMap[t])===null||n===void 0?void 0:n.model;o==null||o.setSelected(!0)},r.prototype.selectElementById=function(t,e){e===void 0&&(e=!1),e||this.clearSelectElements();var n=this.getElement(t);n==null||n.setSelected(!0)},r.prototype.clearSelectElements=function(){var t;this.selectElements.forEach(function(e){e==null||e.setSelected(!1)}),this.selectElements.clear(),this.overlapMode===Vt.DEFAULT&&((t=this.topElement)===null||t===void 0||t.setZIndex())},r.prototype.moveNodes=function(t,e,n,o){var i,a,s,l=this;o===void 0&&(o=!1);for(var u=t.reduce(function(O,w){var S,M=(S=l.nodesMap[w])===null||S===void 0?void 0:S.model;return M&&(O[w]=M.getMoveDistance(e,n,o)),O},{}),f=0;f<this.edges.length;f++){var c=this.edges[f],d=c.textPosition,p=d.x,y=d.y,h=u[c.sourceNodeId],g=u[c.targetNodeId],v=void 0,_=void 0;h&&g&&c.modelType===z.POLYLINE_EDGE?(i=vt(h,2),v=i[0],_=i[1],c.updatePointsList(v,_)):(h&&(a=vt(h,2),v=a[0],_=a[1],c.moveStartPoint(v,_)),g&&(s=vt(g,2),v=s[0],_=s[1],c.moveEndPoint(v,_))),(h||g)&&this.handleEdgeTextMove(c,p,y)}},r.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},r.prototype.addNodeResizeRules=function(t){this.nodeResizeRules.includes(t)||this.nodeResizeRules.push(t)},r.prototype.setDefaultEdgeType=function(t){this.edgeType=t},r.prototype.changeNodeType=function(t,e){var n=this.getNodeModelById(t);if(!n){console.warn("\u627E\u4E0D\u5230id\u4E3A".concat(t,"\u7684\u8282\u70B9"));return}var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("\u627E\u4E0D\u5230".concat(e,"\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002"));var a=new i(o,this);this.nodes.splice(this.nodesMap[t].index,1,a);var s=this.getNodeEdges(t);s.forEach(function(l){if(l.sourceNodeId===t){var u=Ua(a,l.startPoint,a.width,a.height);l.updateStartPoint(u)}if(l.targetNodeId===t){var u=Ua(a,l.endPoint,a.width,a.height);l.updateEndPoint(u)}})},r.prototype.changeEdgeType=function(t,e){var n=this.getEdgeModelById(t);if(!n){console.warn("\u627E\u4E0D\u5230id\u4E3A".concat(t,"\u7684\u8FB9"));return}if(n.type!==e){var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("\u627E\u4E0D\u5230".concat(e,"\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002"));delete o.pointsList;var a=new i(o,this);this.edges.splice(this.edgesMap[t].index,1,a)}},r.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach(function(n){n.targetNodeId===t&&e.push(n)}),e},r.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach(function(n){n.sourceNodeId===t&&e.push(n)}),e},r.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach(function(n){n.targetAnchorId===t&&e.push(n)}),e},r.prototype.getAnchorOutgoingEdge=function(t){var e=[];return this.edges.forEach(function(n){n.sourceAnchorId===t&&e.push(n)}),e},r.prototype.getNodeIncomingNode=function(t){var e=this,n=[];return this.edges.forEach(function(o){var i;o.targetNodeId===t&&n.push((i=e.nodesMap[o.sourceNodeId])===null||i===void 0?void 0:i.model)}),n},r.prototype.getNodeOutgoingNode=function(t){var e=this,n=[];return this.edges.forEach(function(o){o.sourceNodeId===t&&n.push(e.nodesMap[o.targetNodeId].model)}),n},r.prototype.setTheme=function(t){this.theme=np(_e(_e({},this.theme),t))},r.prototype.updateGridOptions=function(t){pi(this.grid,t)},r.prototype.updateBackgroundOptions=function(t){To(t)||To(this.background)?this.background=t:this.background=_e(_e({},this.background),t)},r.prototype.resize=function(t,e){this.width=t||this.rootEl.getBoundingClientRect().width,this.height=e||this.rootEl.getBoundingClientRect().height,(!this.width||!this.height)&&console.warn("\u6E32\u67D3\u753B\u5E03\u7684\u65F6\u5019\u65E0\u6CD5\u83B7\u53D6\u753B\u5E03\u5BBD\u9AD8\uFF0C\u8BF7\u786E\u8BA4\u5728container\u5DF2\u6302\u8F7D\u5230DOM\u3002@see https://github.com/didi/LogicFlow/issues/675")},r.prototype.clearData=function(){this.nodes=[],this.edges=[]},r.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],n=[];t.forEach(function(d){var p=d.x,y=d.y,h=d.width,g=d.height,v=d.getNodeStyle().strokeWidth,_=v===void 0?0:v,O=p+h/2+_,w=p-h/2-_,S=y+g/2+_,M=y-g/2-_;e=e.concat([O,w].filter(function(m){return!Number.isNaN(m)})),n=n.concat([S,M].filter(function(m){return!Number.isNaN(m)}))});var o=Math.min.apply(Math,jt([],vt(e),!1)),i=Math.max.apply(Math,jt([],vt(e),!1)),a=Math.min.apply(Math,jt([],vt(n),!1)),s=Math.max.apply(Math,jt([],vt(n),!1)),l=i-o||0,u=s-a||0,f=o+l/2,c=a+u/2;return{width:l,height:u,x:f,y:c}},r.prototype.translateCenter=function(){var t=this,e=t.nodes,n=t.width,o=t.height,i=t.rootEl,a=t.transformModel;if(!!e.length){var s=n||i.clientWidth,l=o||i.clientHeight,u=this.getVirtualRectSize(),f=u.x,c=u.y;a.focusOn(f,c,s,l)}},r.prototype.fitView=function(t,e){t===void 0&&(t=20),e===void 0&&(e=20);var n=this,o=n.nodes,i=n.width,a=n.height,s=n.rootEl,l=n.transformModel;if(!!o.length){var u=i||s.clientWidth,f=a||s.clientHeight,c=this.getVirtualRectSize(),d=c.width,p=c.height,y=c.x,h=c.y,g=(d+e)/u,v=(p+t)/f,_=1/Math.max(g,v),O=[u/2,f/2];l.zoom(_,O),l.focusOn(y,h,u,f)}},r.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);e==null||e.openEdgeAnimation()},r.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);e==null||e.closeEdgeAnimation()},r.prototype.getPartial=function(){return this.partial},r.prototype.setPartial=function(t){this.partial=t},r.prototype.destroy=function(){try{this.waitCleanEffects.forEach(function(t){t()})}catch(t){console.warn("error on destroy GraphModel",t)}this.waitCleanEffects.length=0},N([E],r.prototype,"width",void 0),N([E],r.prototype,"height",void 0),N([E],r.prototype,"grid",void 0),N([E],r.prototype,"edgeType",void 0),N([E],r.prototype,"nodes",void 0),N([E],r.prototype,"edges",void 0),N([E],r.prototype,"fakeNode",void 0),N([E],r.prototype,"overlapMode",void 0),N([E],r.prototype,"background",void 0),N([E],r.prototype,"gridSize",void 0),N([E],r.prototype,"transformModel",void 0),N([E],r.prototype,"editConfigModel",void 0),N([E],r.prototype,"partial",void 0),N([et],r.prototype,"nodesMap",null),N([et],r.prototype,"edgesMap",null),N([et],r.prototype,"modelsMap",null),N([et],r.prototype,"sortElements",null),N([et],r.prototype,"textEditElement",null),N([et],r.prototype,"selectElements",null),N([et],r.prototype,"selectNodes",null),N([b],r.prototype,"setTextMode",null),N([b],r.prototype,"setFakeNode",null),N([b],r.prototype,"removeFakeNode",null),N([b],r.prototype,"setModel",null),N([b],r.prototype,"toFront",null),N([b],r.prototype,"setElementZIndex",null),N([b],r.prototype,"deleteNode",null),N([b],r.prototype,"addNode",null),N([b],r.prototype,"cloneNode",null),N([b],r.prototype,"moveNode",null),N([b],r.prototype,"moveNode2Coordinate",null),N([b],r.prototype,"editText",null),N([b],r.prototype,"addEdge",null),N([b],r.prototype,"moveEdge",null),N([b],r.prototype,"deleteEdgeBySourceAndTarget",null),N([b],r.prototype,"deleteEdgeById",null),N([b],r.prototype,"deleteEdgeBySource",null),N([b],r.prototype,"deleteEdgeByTarget",null),N([b],r.prototype,"setElementStateById",null),N([b],r.prototype,"updateText",null),N([b],r.prototype,"selectNodeById",null),N([b],r.prototype,"selectEdgeById",null),N([b],r.prototype,"selectElementById",null),N([b],r.prototype,"clearSelectElements",null),N([b],r.prototype,"moveNodes",null),N([b],r.prototype,"setDefaultEdgeType",null),N([b],r.prototype,"changeNodeType",null),N([b],r.prototype,"changeEdgeType",null),N([b],r.prototype,"getNodeIncomingEdge",null),N([b],r.prototype,"getNodeOutgoingEdge",null),N([b],r.prototype,"getAnchorIncomingEdge",null),N([b],r.prototype,"getAnchorOutgoingEdge",null),N([b],r.prototype,"getNodeIncomingNode",null),N([b],r.prototype,"getNodeOutgoingNode",null),N([b],r.prototype,"setTheme",null),N([b],r.prototype,"resize",null),N([b],r.prototype,"clearData",null),N([b],r.prototype,"translateCenter",null),N([b],r.prototype,"fitView",null),N([b],r.prototype,"openEdgeAnimation",null),N([b],r.prototype,"closeEdgeAnimation",null),N([b],r.prototype,"setPartial",null),r}(),Ne=globalThis&&globalThis.__assign||function(){return Ne=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ne.apply(this,arguments)},yr=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Jp=function(){function r(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return r.prototype.getStyle=function(){return Ne({},this.graphModel.theme.snapline)},r.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,o=t.y,i=!1,a=!1,s=0;s<e.length;s++){var l=e[s];if(l.id!==t.id&&(n===l.x&&(i=!0),o===l.y&&(a=!0),i&&a))break}return{isShowVertical:i,isShowHorizontal:a,position:{x:n,y:o}}},r.prototype.getHorizontalSnapline=function(t,e){var n=!1,o=0,i=t.id,a;if(i){var s=this.graphModel.fakeNode;if(s&&s.id===i)a=Mt(s);else{var l=this.graphModel.getNodeModelById(i);l&&(a=Mt(l))}}for(var u=0;u<e.length;u++){var f=e[u];if(f.id!==t.id){var c=Mt(f);if(c.minY===(a==null?void 0:a.minY)||c.maxY===(a==null?void 0:a.minY)){n=!0,o=a.minY;break}if(c.minY===(a==null?void 0:a.maxY)||c.maxY===(a==null?void 0:a.maxY)){n=!0,o=a.maxY;break}}}return{isShowHorizontal:n,isShowVertical:this.isShowVertical,position:Ne(Ne({},this.position),{y:o})}},r.prototype.getVerticalSnapline=function(t,e){var n=!1,o=0,i=t.id,a;if(i){var s=this.graphModel.fakeNode;if(s&&s.id===i)a=Mt(s);else{var l=this.graphModel.getNodeModelById(i);l&&(a=Mt(l))}}for(var u=0;u<e.length;u++){var f=e[u];if(f.id!==t.id){var c=Mt(f);if(c.minX===(a==null?void 0:a.minX)||c.maxX===(a==null?void 0:a.minX)){n=!0,o=a.minX;break}if(c.minX===(a==null?void 0:a.maxX)||c.maxX===(a==null?void 0:a.maxX)){n=!0,o=a.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:n,position:Ne(Ne({},this.position),{x:o})}},r.prototype.getSnapLinePosition=function(t,e){var n=this.getCenterSnapLine(t,e),o=n.isShowHorizontal,i=n.isShowVertical;if(!o){var a=this.getHorizontalSnapline(t,e);a.isShowHorizontal&&(n.isShowHorizontal=a.isShowHorizontal,n.position.y=a.position.y)}if(!i){var s=this.getVerticalSnapline(t,e);s.isShowVertical&&(n.isShowVertical=s.isShowVertical,n.position.x=s.position.x)}return n},r.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,n=t.isShowVertical,o=t.position;this.position=o,this.isShowHorizontal=e,this.isShowVertical=n},r.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},r.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,n=this.getSnapLinePosition(t,e);this.setSnaplineInfo(n)},yr([E],r.prototype,"isShowHorizontal",void 0),yr([E],r.prototype,"isShowVertical",void 0),yr([E],r.prototype,"position",void 0),yr([b],r.prototype,"clearSnapline",null),yr([b],r.prototype,"setNodeSnapLine",null),r}(),Ut=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Ge=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Qp={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},th=function(){function r(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,o=n===void 0?!1:n;this.updateTranslateLimits(o)}return r.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},r.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},r.prototype.HtmlPointToCanvasPoint=function(t){var e=Ge(t,2),n=e[0],o=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(o-this.TRANSLATE_Y)/this.SCALE_Y]},r.prototype.CanvasPointToHtmlPoint=function(t){var e=Ge(t,2),n=e[0],o=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,o*this.SCALE_Y+this.TRANSLATE_Y]},r.prototype.moveCanvasPointByHtml=function(t,e,n){var o=Ge(t,2),i=o[0],a=o[1];return[i+e/this.SCALE_X,a+n/this.SCALE_Y]},r.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},r.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},r.prototype.zoom=function(t,e){t===void 0&&(t=!1);var n=this.SCALE_X,o=this.SCALE_Y;return typeof t=="number"?(n=t,o=t):t?(n+=this.ZOOM_SIZE,o+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,o-=this.ZOOM_SIZE),n<this.MINI_SCALE_SIZE||n>this.MAX_SCALE_SIZE?"".concat(this.SCALE_X*100,"%"):(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(o-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=o,this.emitGraphTransform("zoom"),"".concat(this.SCALE_X*100,"%"))},r.prototype.emitGraphTransform=function(t){this.eventCenter.emit(C.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},r.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},r.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},r.prototype.focusOn=function(t,e,n,o){var i=Ge(this.CanvasPointToHtmlPoint([t,e]),2),a=i[0],s=i[1],l=Ge([n/2-a,o/2-s],2),u=l[0],f=l[1];this.TRANSLATE_X+=u,this.TRANSLATE_Y+=f,this.emitGraphTransform("focusOn")},r.prototype.updateTranslateLimits=function(t){var e;e=Ge(Array.isArray(t)&&t.length===4?t:Qp[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},Ut([E],r.prototype,"SCALE_X",void 0),Ut([E],r.prototype,"SKEW_Y",void 0),Ut([E],r.prototype,"SKEW_X",void 0),Ut([E],r.prototype,"SCALE_Y",void 0),Ut([E],r.prototype,"TRANSLATE_X",void 0),Ut([E],r.prototype,"TRANSLATE_Y",void 0),Ut([E],r.prototype,"ZOOM_SIZE",void 0),Ut([b],r.prototype,"zoom",null),Ut([b],r.prototype,"resetZoom",null),Ut([b],r.prototype,"translate",null),Ut([b],r.prototype,"focusOn",null),r}(),eh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),rh=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},nh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},oh=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},ih=function(r){eh(t,r);function t(){var e=r.apply(this,oh([],nh(arguments),!1))||this;return e.handleResize=function(){e.props.graphModel.resize()},e.throttleResize=function(){return lu(e.handleResize,200)},e}return t.prototype.componentDidMount=function(){window.addEventListener("resize",this.throttleResize)},t.prototype.componentDidUpdate=function(){var e=this.props.graphModel.modelToGraphData();this.props.graphModel.eventCenter.emit(C.GRAPH_UPDATED,{data:e})},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.throttleResize)},t.prototype.getComponent=function(e,n,o){o===void 0&&(o="canvas-overlay");var i=this.props.getView,a=i(e.type);return a?x(a,{model:e,graphModel:n,overlay:o},e.id):null},t.prototype.render=function(){var e=this,n=this.props,o=n.graphModel,i=n.tool,a=n.options,s=n.dnd,l=n.snaplineModel,u={};a.width&&(u.width="".concat(o.width,"px")),a.height&&(u.height="".concat(o.height,"px"));var f=o.fakeNode,c=o.editConfigModel,d=o.background,p=c.adjustEdge;return x("div",{className:"lf-graph","flow-id":o.flowId,style:u,children:[x(Pp,{graphModel:o,dnd:s,children:[x("g",{className:"lf-base",children:de(o.sortElements,function(y){return e.getComponent(y,o)})}),f?this.getComponent(f,o):""]}),x(Yp,{graphModel:o,children:[x(Fp,{graphModel:o}),p?x(Cp,{graphModel:o}):"",a.snapline!==!1?x($p,{snaplineModel:l}):""]}),x(Kp,{graphModel:o,tool:i}),d&&x(Lp,{background:d}),x(kn,{graphModel:o})]})},t=rh([Ct],t),t}($),ah=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),re=globalThis&&globalThis.__assign||function(){return re=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},re.apply(this,arguments)},sh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},lh=function(r){ah(t,r);function t(){var e=r.call(this)||this;return e.onDragStart=function(n){var o=n.event,i=e.props,a=i.anchorData,s=i.nodeModel,l=i.graphModel;l.selectNodeById(s.id),s.autoToFront&&l.toFront(s.id),l.eventCenter.emit(C.ANCHOR_DRAGSTART,{data:a,e:o,nodeModel:s}),e.setState({startX:a.x,startY:a.y,endX:a.x,endY:a.y})},e.onDragging=function(n){var o=n.event,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=a.transformModel,f=a.eventCenter,c=a.width,d=a.height,p=a.editConfigModel,y=p.autoExpand,h=p.stopMoveGraph;if(!!o){var g=o.clientX,v=o.clientY,_=a.getPointByClient({x:g,y:v}),O=_.domOverlayPosition,w=O.x,S=O.y,M=_.canvasOverlayPosition,m=M.x,T=M.y;e.t&&Xn(e.t);var P=[],A=10;w<10?P=[A,0]:w+10>c?P=[-A,0]:S<10?P=[0,A]:S+10>d&&(P=[0,-A]),e.setState({endX:m,endY:T,dragging:!0}),e.moveAnchorEnd(m,T),P.length>0&&!h&&y&&(e.t=Nl(function(){var I=sh(P,2),B=I[0],U=I[1];u.translate(B,U);var F=e.state,lt=F.endX,pt=F.endY;e.setState({endX:lt-B,endY:pt-U}),e.moveAnchorEnd(lt-B,pt-U)})),f.emit(C.ANCHOR_DRAG,{data:l,e:o,nodeModel:s})}},e.onDragEnd=function(n){var o=n.event;e.t&&Xn(e.t);var i=e.checkEnd(o);e.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),e.sourceRuleResults.clear(),e.targetRuleResults.clear();var a=e.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData;s.eventCenter.emit(C.ANCHOR_DRAGEND,{data:u,e:o,nodeModel:l,edgeModel:i!=null?i:void 0})},e.checkEnd=function(n){var o,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=l.x,f=l.y,c=l.id,d=e.state,p=d.endX,y=d.endY,h=d.dragging,g=In({x:p,y},a);if(e.preTargetNode&&e.preTargetNode.state!==W.DEFAULT&&e.preTargetNode.setElementState(W.DEFAULT),!!h&&g&&g.node){var v=g.node,_=g.anchor.id,O="".concat(s.id,"_").concat(v.id,"_").concat(_,"_").concat(c),w=e.sourceRuleResults.get(O)||{},S=w.isAllPass,M=w.msg,m=e.targetRuleResults.get(O)||{},T=m.isAllPass,P=m.msg;if(S&&T){v.setElementState(W.DEFAULT);var A=a.getNodeModelById(g.node.id),I=(o=a.edgeGenerator)===null||o===void 0?void 0:o.call(a,s.getData(),A==null?void 0:A.getData()),B=a.addEdge(re(re({},I),{sourceNodeId:s.id,sourceAnchorId:c,startPoint:{x:u,y:f},targetNodeId:g.node.id,targetAnchorId:g.anchor.id,endPoint:{x:g.anchor.x,y:g.anchor.y}})),U=e.props.anchorData;return a.eventCenter.emit(C.ANCHOR_DROP,{data:U,e:n,nodeModel:s,edgeModel:B}),B}var F=v.getData();return a.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:F,msg:P||M||"\u4E0D\u5141\u8BB8\u6DFB\u52A0\u8FDE\u7EBF"}),null}},e.sourceRuleResults=new Map,e.targetRuleResults=new Map,e.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},e.dragHandler=new ue({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.getAnchorShape=function(){var e=this.props,n=e.anchorData,o=e.style,i=e.node,a=i.getAnchorShape(n);if(a)return a;var s=n.x,l=n.y,u=re(re({},o),o==null?void 0:o.hover);return x("g",{children:[x(cr,re({className:"lf-node-anchor-hover"},u,{x:s,y:l})),x(cr,re({className:"lf-node-anchor"},o,{x:s,y:l}))]})},Object.defineProperty(t.prototype,"customTrajectory",{get:function(){var e=this.props.graphModel.customTrajectory;return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relateEdges",{get:function(){var e=this.props,n=e.graphModel,o=n.getAnchorIncomingEdge,i=n.getAnchorOutgoingEdge,a=e.anchorData.id;return{incomingEdgeList:o(a),outgoingEdgeList:i(a)}},enumerable:!1,configurable:!0}),t.prototype.moveAnchorEnd=function(e,n){var o,i,a=this.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData,f=In({x:e,y:n},s);if(f){var c=f.node,d=f.anchor.id;if(this.preTargetNode&&this.preTargetNode!==f.node&&this.preTargetNode.setElementState(W.DEFAULT),u.id===d)return;this.preTargetNode=c;var p="".concat(l.id,"_").concat(c.id,"_").concat(d,"_").concat(u.id);if(!this.targetRuleResults.has(p)){var y=f.anchor,h=l.isAllowConnectedAsSource(c,u,y),g=c.isAllowConnectedAsTarget(l,u,y);this.sourceRuleResults.set(p,Bn(h)),this.targetRuleResults.set(p,Bn(g))}var v=((o=this.sourceRuleResults.get(p))!==null&&o!==void 0?o:{}).isAllPass,_=((i=this.targetRuleResults.get(p))!==null&&i!==void 0?i:{}).isAllPass;v&&_?c.setElementState(W.ALLOW_CONNECT):c.setElementState(W.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==W.DEFAULT&&this.preTargetNode.setElementState(W.DEFAULT)},t.prototype.isShowLine=function(){var e=this.state,n=e.startX,o=e.startY,i=e.endX,a=e.endY,s=Wt(n,o,i,a);return s>10},t.prototype.render=function(){var e=this,n=this.state,o=n.startX,i=n.startY,a=n.endX,s=n.endY,l=this.props,u=l.anchorData.edgeAddable,f=l.edgeStyle;return x("g",{className:"lf-anchor",children:[x("g",{onMouseDown:function(c){u!==!1&&e.dragHandler.handleMouseDown(c)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(re({sourcePoint:{x:o,y:i},targetPoint:{x:a,y:s}},f)):x(ur,re({x1:o,y1:i,x2:a,y2:s},f,{"pointer-events":"none"})))]})},t}($),uh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Qo=globalThis&&globalThis.__assign||function(){return Qo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Qo.apply(this,arguments)},ch=function(r){uh(t,r);function t(e){var n=r.call(this,e)||this;return n.style={},n.onDragging=function(o){var i,a=o.event,s=n.props,l=s.graphModel,u=s.nodeModel,f=s.eventCenter,c=l.selectNodes,d=u.x,p=u.y,y=a.clientX,h=a.clientY,g=l.getPointByClient({x:y,y:h}).canvasOverlayPosition,v=g.x,_=g.y,O=new bt(v-d,_-p),w=((i=n.normal)===null||i===void 0?void 0:i.angle(O))-n.defaultAngle,S=new eo(-d,-p).rotate(w).translate(d,p).toString();u.transform=S,u.rotate=w;var M=de(c,function(T){return T.id});M.indexOf(u.id)===-1&&(M=[u.id]);var m=Fu(M,function(T,P){var A=l.getNodeModelById(P);return T[P]=A==null?void 0:A.getMoveDistance(0,0,!1),T},{});M.forEach(function(T){var P=l.getNodeEdges(T);P.forEach(function(A){if(m[A.sourceNodeId]){var I=l.getNodeModelById(A.sourceNodeId),B=I.anchors.find(function(U){return U.id===A.sourceAnchorId});A.updateStartPoint(B)}if(m[A.targetNodeId]){var I=l.getNodeModelById(A.targetNodeId),B=I.anchors.find(function(lt){return lt.id===A.targetAnchorId});A.updateEndPoint(B)}})}),f.emit(C.NODE_ROTATE,{e:a,model:u,data:u.getData()})},n.style=e.style,n.stepperDrag=new ue({onDragging:n.onDragging}),n}return t.prototype.render=function(){var e=this,n=this.props.nodeModel,o=n.x,i=n.y,a=n.width,s=n.height,l=o+a/2+20,u=i-s/2-20;return this.normal=new bt(1,0),this.defaultAngle=this.normal.angle(new bt(l-o,u-i)),n.defaultAngle=this.defaultAngle,x("g",{className:"lf-rotate-control",children:x("g",{onMouseDown:function(f){e.stepperDrag.handleMouseDown(f)},children:x(cr,Qo({},this.style,{cx:l,cy:u}))})})},t}($),Bl={exports:{}};/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
- */(function(r){(function(){var t={}.hasOwnProperty;function e(){for(var i="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(i=o(i,n(s)))}return i}function n(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return e.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var a="";for(var s in i)t.call(i,s)&&i[s]&&(a=o(a,s));return a}function o(i,a){return a?i?i+" "+a:i+a:i}r.exports?(e.default=e,r.exports=e):window.classNames=e})()})(Bl);var fh=Bl.exports,dh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ti=globalThis&&globalThis.__assign||function(){return ti=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ti.apply(this,arguments)},ph=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Xl=function(r){dh(t,r);function t(e){var n=r.call(this)||this;n.mouseDownHandler=function(i){var a=n.props,s=a.draggable,l=a.model,u=a.graphModel,f=u.editConfigModel.nodeTextDraggable;(s!=null?s:f)&&(n.stepperDrag.model=l,n.stepperDrag.handleMouseDown(i))},n.onDragging=function(i){var a=i.deltaX,s=i.deltaY,l=n.props,u=l.model,f=l.graphModel.transformModel;if(a||s){var c=ph(f.fixDeltaXY(a,s),2),d=c[0],p=c[1];u.moveText(d,p)}},n.dbClickHandler=function(){var i=n.props,a=i.editable,s=i.graphModel.eventCenter,l=i.model;a&&l.setElementState(W.TEXT_EDIT),s.emit(C.TEXT_DBCLICK,{data:l.text,model:l})};var o=e.draggable;return n.stepperDrag=new ue({onDragging:n.onDragging,step:1,eventType:"TEXT",isStopPropagation:o}),n}return t.prototype.getShape=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=n.text,s=a.value,l=a.x,u=a.y,f=a.editable,c=a.draggable,d={x:l,y:u,className:"",value:s},p=n.getTextStyle(),y=i.nodeTextDraggable||c;return x(Cl,ti({},d,p,{className:fh({"lf-element-text":f,"lf-text-draggable":!f&&y,"lf-text-disabled":!f&&!y}),model:n}))},t.prototype.render=function(){var e=this.props.model.text;if(e)return x("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},t}($),hh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ft=globalThis&&globalThis.__assign||function(){return Ft=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ft.apply(this,arguments)},pn=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},vh=function(r){hh(t,r);function t(e){var n=r.call(this,e)||this;return n.setHoverOn=function(){n.setState({isHovered:!0})},n.setHoverOff=function(){n.setState({isHovered:!1})},n.state={isHovered:!1},n}return t.prototype.getBackground=function(){var e=this.state.isHovered,n=this.props.model,o=n.text,i=n.getTextStyle(),a=i.background||{};if(e&&i.hover&&i.hover.background&&(a=Ft(Ft({},a),i.hover.background)),(o==null?void 0:o.value)&&(a==null?void 0:a.fill)!=="transparent"){var s=i.fontSize,l=i.textWidth,u=i.lineHeight,f=i.overflowMode,c=a.wrapPadding,d=o==null?void 0:o.value.split(/[\r\n]/g),p=d.length,y=o.x,h=o.y,g={};if(f==="autoWrap"&&l){var v=Dl({rows:d,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:u,padding:c},rowsLength:p,className:"lf-get-text-height"});g=Ft(Ft({},a),{x:y,y:h,width:l,height:v})}else{var _=cd({rows:d,rowsLength:p,fontSize:s}),O=_.width,w=_.height;if(f==="ellipsis"&&(O=l,w=s+2),typeof a.wrapPadding=="string"){var S=a.wrapPadding.split(",").filter(function(ct){return ct.trim()}).map(function(ct){return parseFloat(ct.trim())});if(S.length>0&&S.length<=4){if(S.length===1){var M=pn(S,1),m=M[0];S=[m,m,m,m]}else if(S.length===2){var T=pn(S,2),P=T[0],A=T[1];S=[P,A,P,A]}else if(S.length===3){var I=pn(S,3),B=I[0],A=I[1],U=I[2];S=[B,A,U,A]}var F=pn(S,4),lt=F[0],pt=F[1],St=F[2],yt=F[3];O+=pt+yt,w+=lt+St,y=y+(pt-yt)/2,h=h+(St-lt)/2}}g=Ft(Ft({},a),{x:y-1,y:h-1,width:O,height:w})}return x(ae,Ft({},g))}return null},t.prototype.getShape=function(){var e=this.props.model,n=e.text,o=n.x,i=n.y,a=n.value;if(!a)return null;var s=e.getTextStyle(),l=Ft({x:o,y:i,value:a,model:e,className:"lf-element-text"},s);return x("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),x(Cl,Ft({},l))]})},t}(Xl),yh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Yn=globalThis&&globalThis.__assign||function(){return Yn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Yn.apply(this,arguments)},gh=globalThis&&globalThis.__rest||function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]]);return e},hn=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Ae=function(r){yh(t,r);function t(e){var n=r.call(this)||this;n.onDragStart=function(l){var u=l.event,f=n.props,c=f.model,d=f.graphModel;if(u){var p=d.getPointByClient({x:u.clientX,y:u.clientY}).canvasOverlayPosition,y=p.x,h=p.y;n.moveOffset={dx:c.x-y,dy:c.y-h}}},n.onDragging=function(l){var u,f,c,d,p=l.event,y=n.props,h=y.model,g=y.graphModel,v=g.editConfigModel,_=v.stopMoveGraph,O=v.autoExpand,w=g.transformModel,S=g.selectNodes,M=g.width,m=g.height,T=g.gridSize;h.isDragging=!0;var P=p,A=P.clientX,I=P.clientY,B=g.getPointByClient({x:A,y:I}).canvasOverlayPosition,U=B.x,F=B.y,lt=hn(w.CanvasPointToHtmlPoint([U,F]),2),pt=lt[0],St=lt[1];if(U=U+((f=(u=n.moveOffset)===null||u===void 0?void 0:u.dx)!==null&&f!==void 0?f:0),F=F+((d=(c=n.moveOffset)===null||c===void 0?void 0:c.dy)!==null&&d!==void 0?d:0),U=lr(U,T),F=lr(F,T),!M||!m){g.moveNode2Coordinate(h.id,U,F);return}var yt=pt<0||St<0||pt>M||St>m;if(!(O&&!_&&yt)){var ct=hn(w.CanvasPointToHtmlPoint([U-h.width/2,F-h.height/2]),2),Rt=ct[0],k=ct[1],V=hn(w.CanvasPointToHtmlPoint([U+h.width/2,F+h.height/2]),2),Q=V[0],G=V[1],rt=Math.max(T,20),xt=[];Rt<0?xt=[rt,0]:Q>g.width?xt=[-rt,0]:k<0?xt=[0,rt]:G>g.height&&(xt=[0,-rt]),n.t&&Xn(n.t),h.transform=new eo(-U,-F).rotate(h.rotate).translate(U,F).toString();var q=S.map(function(ft){return ft.id});q.indexOf(h.id)===-1&&(q=[h.id]),xt.length>0&&!_&&O?n.t=Nl(function(){var ft=hn(xt,2),Pt=ft[0],wt=ft[1];w.translate(Pt!=null?Pt:0,wt!=null?wt:0);var io=-(Pt!=null?Pt:0)/w.SCALE_X,ao=-(wt!=null?wt:0)/w.SCALE_X;g.moveNodes(q,io,ao)}):g.moveNodes(q,U-h.x,F-h.y)}},n.onDragEnd=function(){n.t&&Xn(n.t);var l=n.props.model;l.isDragging=!1},n.onMouseOut=function(l){Yf()&&n.setHoverOff(l)},n.handleMouseUp=function(){var l=n.props.model;n.mouseUpDrag=l.isDragging},n.handleClick=function(l){var u=n.mouseUpDrag===!1;if(!!n.startTime){var f=n.props,c=f.model,d=f.graphModel;if(!!u){var p=c.getData(),y=d.getPointByClient({x:l.clientX,y:l.clientY}),h={data:p,e:l,position:y,isSelected:!1,isMultiple:!1},g=l.button===2,v=l.detail===2;if(!g){var _=d.editConfigModel,O=Al(l,_);h.isMultiple=O,c.isSelected&&!v&&O?(h.isSelected=!1,c.setSelected(!1)):(d.selectNodeById(c.id,O),h.isSelected=!0,n.toFront()),v?(_.nodeTextEdit&&c.text.editable&&_.textMode===Xt.TEXT&&(c.setSelected(!1),d.setElementStateById(c.id,W.TEXT_EDIT)),d.eventCenter.emit(C.NODE_DBCLICK,h)):(d.eventCenter.emit(C.ELEMENT_CLICK,h),d.eventCenter.emit(C.NODE_CLICK,h))}}}},n.handleContextMenu=function(l){l.preventDefault();var u=n.props,f=u.model,c=u.graphModel,d=f.getData(),p=c.getPointByClient({x:l.clientX,y:l.clientY});c.setElementStateById(f.id,W.SHOW_MENU,p.domOverlayPosition),f.isSelected||c.selectNodeById(f.id),c.eventCenter.emit(C.NODE_CONTEXTMENU,{data:d,e:l,position:p}),n.toFront()},n.handleMouseDown=function(l){var u=n.props,f=u.model,c=u.graphModel;n.startTime=new Date().getTime();var d=c.editConfigModel;d.adjustNodePosition&&f.draggable&&n.stepDrag&&n.stepDrag.handleMouseDown(l)},n.handleFocus=function(){var l=n.props,u=l.model,f=l.graphModel;f.eventCenter.emit(C.NODE_FOCUS,{data:u.getData()})},n.handleBlur=function(){var l=n.props,u=l.model,f=l.graphModel;f.eventCenter.emit(C.NODE_BLUR,{data:u.getData()})},n.setHoverOn=function(l){var u=n.props,f=u.model,c=u.graphModel;if(!f.isHovered){var d=f.getData();f.setHovered(!0),c.eventCenter.emit(C.NODE_MOUSEENTER,{data:d,e:l})}},n.setHoverOff=function(l){var u=n.props,f=u.model,c=u.graphModel,d=f.getData();!f.isHovered||(f.setHovered(!1),c.eventCenter.emit(C.NODE_MOUSELEAVE,{data:d,e:l}))};var o=e.graphModel,i=o.gridSize,a=o.eventCenter,s=e.model;return n.stepDrag=new ue({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),n.modelDisposer=rl(function(){return n.props},function(l){l&&l.model&&n.stepDrag.setModel(l.model)}),n}return t.prototype.componentWillUnmount=function(){this.modelDisposer&&this.modelDisposer()},t.prototype.componentDidMount=function(){},t.prototype.componentDidUpdate=function(){},t.prototype.getAnchorShape=function(e){return null},t.prototype.getAnchors=function(){var e=this,n=this.props,o=n.model,i=n.graphModel,a=o.isSelected,s=o.isHitable,l=o.isDragging,u=o.isShowAnchor;return s&&(a||u)&&!l?de(o.anchors,function(f,c){var d=o.getAnchorLineStyle(f),p=o.getAnchorStyle(f);return x(lh,{anchorData:f,node:e,style:p,edgeStyle:d,anchorIndex:c,nodeModel:o,graphModel:i,setHoverOff:e.setHoverOff})}):[]},t.prototype.getRotateControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowRotate,l=n.isSelected,u=n.isHitable,f=n.rotatable,c=n.isHovered,d=s&&f,p=n.getRotateControlStyle();if(!a&&u&&(l||c)&&d)return x(ch,{graphModel:o,nodeModel:n,eventCenter:o.eventCenter,style:p})},t.prototype.getResizeControl=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowResize,l=n.isSelected,u=n.isHitable,f=n.resizable,c=n.isHovered,d=s&&f,p=n.getResizeControlStyle();return!a&&u&&(l||c)&&d?x(Xd,{style:p,model:n,graphModel:o}):null},t.prototype.getText=function(){var e,n=this.props,o=n.model,i=n.graphModel,a=i.editConfigModel;if(a.nodeTextMode!==Xt.TEXT||o.state===W.TEXT_EDIT)return null;if(o.text){var s=!1;return a.nodeTextDraggable&&o.text.draggable&&(s=!0),x(Xl,{editable:a.nodeTextEdit&&((e=o.text.editable)!==null&&e!==void 0?e:!0),model:o,graphModel:i,draggable:s})}return null},t.prototype.getStateClassName=function(){var e=this.props.model,n=e.state,o=e.isDragging,i=e.isSelected,a="lf-node";switch(n){case W.ALLOW_CONNECT:a+=" lf-node-allow";break;case W.NOT_ALLOW_CONNECT:a+=" lf-node-not-allow";break;default:a+=" lf-node-default";break}return o&&(a+=" lf-dragging"),i&&(a+=" lf-node-selected"),a},t.prototype.toFront=function(){var e=this.props,n=e.model,o=e.graphModel;n.autoToFront&&o.toFront(n.id)},t.prototype.render=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.hideAnchors,s=i.adjustNodePosition,l=i.allowRotate,u=i.allowResize,f=o.gridSize,c=o.transformModel.SCALE_X,d=n.isHitable,p=n.draggable,y=n.transform,h=n.getOuterGAttributes(),g=h.className,v=g===void 0?"":g,_=gh(h,["className"]),O=x("g",{className:"lf-node-content",children:[x("g",{transform:y,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),u&&this.getResizeControl()]}),!a&&this.getAnchors()]}),w;return d?(s&&p&&this.stepDrag.setStep(f*c),w=x("g",Yn({className:"".concat(this.getStateClassName()," ").concat(v),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,onMouseOut:this.onMouseOut,onContextMenu:this.handleContextMenu,onFocus:this.handleFocus,onBlur:this.handleBlur},_,{children:O}))):w=x("g",Yn({className:"".concat(this.getStateClassName()," ").concat(v)},_,{children:O})),w},t.isObserved=!1,t}($),_h=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ei=globalThis&&globalThis.__assign||function(){return ei=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ei.apply(this,arguments)},ri=function(r){_h(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,n=e.getNodeStyle();return x(ae,ei({},n,{x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius}))},t}(Ae),mh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ni=globalThis&&globalThis.__assign||function(){return ni=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ni.apply(this,arguments)},is=function(r){mh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,n=e.x,o=e.y,i=e.r,a=e.getNodeStyle();return x(cr,ni({},a,{x:n,y:o,r:i}))},t}(Ae),bh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Hn=globalThis&&globalThis.__assign||function(){return Hn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Hn.apply(this,arguments)},as=function(r){bh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,n=e,o=n.x,i=n.y,a=n.width,s=n.height,l=n.points,u=e.getNodeStyle(),f={transform:"matrix(1 0 0 1 ".concat(o-a/2," ").concat(i-s/2,")")};return x("g",Hn({},f,{children:x(Rl,Hn({},u,{points:l,x:o,y:i}))}))},t}(Ae),xh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),oi=globalThis&&globalThis.__assign||function(){return oi=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},oi.apply(this,arguments)},ss=function(r){xh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,n=e.getNodeStyle();return x("g",{children:x(Rl,oi({},n,{points:e.points,x:e.x,y:e.y}))})},t}(Ae),Eh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ii=globalThis&&globalThis.__assign||function(){return ii=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ii.apply(this,arguments)},ls=function(r){Eh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,n=e.getNodeStyle();return x(Nd,ii({},n,{x:e.x,y:e.y,rx:e.rx,ry:e.ry}))},t}(Ae),Oh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Cr=globalThis&&globalThis.__assign||function(){return Cr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Cr.apply(this,arguments)},us=function(r){Oh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getBackground=function(){var e=this.props.model,n=e.getTextStyle(),o=e.width,i=e.height,a=e.x,s=e.y,l=Cr(Cr({},n.background),{x:a,y:s,width:o,height:i});return x(ae,Cr({},l))},t.prototype.getResizeControl=function(){return null},t.prototype.getShape=function(){return x("g",{children:this.getBackground()})},t}(Ae),Th=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ai=globalThis&&globalThis.__assign||function(){return ai=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ai.apply(this,arguments)},wh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Sh=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},cs=function(r){Th(t,r);function t(){var e=r.apply(this,Sh([],wh(arguments),!1))||this;return e.ref=vi(),e}return Object.defineProperty(t.prototype,"rootEl",{get:function(){return this.ref.current},enumerable:!1,configurable:!0}),t.prototype.setHtml=function(e){e.appendChild(document.createElement("div"))},t.prototype.confirmUpdate=function(e){this.setHtml(e)},t.prototype.shouldUpdate=function(){return this.preProperties&&this.preProperties===this.currentProperties?!1:(this.preProperties=this.currentProperties,!0)},t.prototype.componentDidMount=function(){this.shouldUpdate()&&this.rootEl&&this.setHtml(this.rootEl)},t.prototype.componentDidUpdate=function(){this.shouldUpdate()&&this.rootEl&&this.confirmUpdate(this.rootEl)},t.prototype.componentWillUnmount=function(){this.rootEl.innerHTML=""},t.prototype.getShape=function(){var e=this.props.model,n=e.x,o=e.y,i=e.height,a=e.width,s=e.getNodeStyle();return this.currentProperties=JSON.stringify(e.properties),x("foreignObject",ai({},s,{x:n-a/2,y:o-i/2,width:a,height:i,ref:this.ref}))},t}(Ae),Mh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),zt=globalThis&&globalThis.__assign||function(){return zt=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},zt.apply(this,arguments)},Ah=globalThis&&globalThis.__rest||function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]]);return e},Ph=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ie;(function(r){r.SOURCE="SOURCE",r.TARGET="TARGET"})(ie||(ie={}));var fs=function(r){Mh(t,r);function t(e){var n=r.call(this)||this;n.handleMouseDown=function(l){n.stepDrag&&n.stepDrag.handleMouseDown(l)},n.onDragStart=function(){var l=n.props,u=l.x,f=l.y,c=l.edgeModel,d=c.startPoint,p=c.endPoint,y=c.pointsList;n.oldEdge={startPoint:d,endPoint:p,pointsList:y},n.setState({endX:u,endY:f,dragging:!0})},n.onDragging=function(l){var u=l.deltaX,f=l.deltaY,c=n.state,d=c.endX,p=c.endY,y=n.props,h=y.graphModel,g=y.type,v=h.transformModel,_=h.editConfigModel,O=Ph(v.moveCanvasPointByHtml([d,p],u,f),2),w=O[0],S=O[1];n.setState({endX:w,endY:S,dragging:!0});var M=n.props.edgeModel,m=In({x:d,y:p},h);if(m&&m.node&&n.isAllowAdjust(m).pass){var T=M.startPoint,P=M.endPoint,A=M.sourceNode,I=M.targetNode,B=g===ie.SOURCE?{startPoint:{x:m.anchor.x,y:m.anchor.y},endPoint:{x:P.x,y:P.y},sourceNode:m.node,targetNode:I}:{startPoint:{x:T.x,y:T.y},endPoint:{x:m.anchor.x,y:m.anchor.y},sourceNode:A,targetNode:m.node};M.updateAfterAdjustStartAndEnd(B)}else g===ie.SOURCE?M.updateStartPoint({x:w,y:S}):M.updateEndPoint({x:w,y:S});M.text.value&&_.adjustEdge&&M.setText(Object.assign({},M.text,M.textPosition))},n.onDragEnd=function(l){var u,f,c,d=l.event;try{n.setState({dragging:!1});var p=n.props,y=p.graphModel,h=p.edgeModel,g=p.type,v=n.state,_=v.endX,O=v.endY,w=v.dragging,S=In({x:_,y:O},y);if(!w)return;var M=!1,m=void 0;if(S&&S.node){var T=n.isAllowAdjust(S),P=T.pass,A=T.msg,I=T.newTargetNode;if(P){var B=h.getData(),U=B.text,F=B.sourceAnchorId,lt=F===void 0?"":F,pt=B.targetAnchorId,St=pt===void 0?"":pt,yt=Ah(B,["text","sourceAnchorId","targetAnchorId"]);if(m=zt(zt({sourceAnchorId:lt,targetAnchorId:St},yt),{text:(U==null?void 0:U.value)||""}),g===ie.SOURCE){var ct=y.getNodeModelById(S.node.id),Rt=y.getNodeModelById(h.targetNodeId),k=(u=y.edgeGenerator)===null||u===void 0?void 0:u.call(y,ct==null?void 0:ct.getData(),Rt==null?void 0:Rt.getData(),m);m=zt(zt({},k),{sourceNodeId:S.node.id,sourceAnchorId:S.anchor.id,startPoint:{x:S.anchor.x,y:S.anchor.y},targetNodeId:h.targetNodeId,endPoint:zt({},h.endPoint)}),h.sourceNodeId===S.node.id&&h.sourceAnchorId===S.anchor.id&&(M=!0)}else if(g===ie.TARGET){var ct=y.getNodeModelById(h.sourceNodeId),Rt=y.getNodeModelById(S.node.id),k=(f=y.edgeGenerator)===null||f===void 0?void 0:f.call(y,ct==null?void 0:ct.getData(),Rt==null?void 0:Rt.getData(),m);m=zt(zt({},k),{sourceNodeId:h.sourceNodeId,startPoint:zt({},h.startPoint),targetNodeId:S.node.id,targetAnchorId:S.anchor.id,endPoint:{x:S.anchor.x,y:S.anchor.y}}),h.targetNodeId===S.node.id&&h.targetAnchorId===S.anchor.id&&(M=!0)}}else{M=!0;var V=I.getData();y.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:V,msg:A})}}else M=!0;if(M)n.recoveryEdge();else{var Q=h.getData();y.deleteEdgeById(h.id);var G=y.addEdge(zt({},m));y.eventCenter.emit(C.EDGE_EXCHANGE_NODE,{data:{newEdge:G.getData(),oldEdge:Q}})}(c=n.preTargetNode)===null||c===void 0||c.setElementState(W.DEFAULT)}finally{var y=n.props.graphModel;y.eventCenter.emit(C.ADJUST_POINT_DRAGEND,{e:d,data:n.stepDragData})}},n.recoveryEdge=function(){var l=n.props.edgeModel,u=n.oldEdge,f=u.startPoint,c=u.endPoint,d=u.pointsList;l.updateStartPoint(f),l.updateEndPoint(c),l.modelType!==z.LINE_EDGE&&(l.pointsList=d!=null?d:[],l.initPoints())},n.getAdjustPointStyle=function(){var l=n.props.graphModel.theme,u=l.edgeAdjust;return u},n.state={dragging:!1,endX:0,endY:0},n.targetRuleResults=new Map,n.sourceRuleResults=new Map;var o=e.type,i=e.edgeModel,a=e.graphModel,s=a.eventCenter;return n.stepDragData={type:o,edgeData:i.getData()},n.stepDrag=new ue({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd,eventType:"ADJUST_POINT",isStopPropagation:!1,eventCenter:s,data:n.stepDragData}),n}return t.prototype.isAllowAdjust=function(e){var n=this.props,o=n.edgeModel,i=o.id,a=o.sourceNode,s=o.targetNode,l=o.sourceAnchorId,u=o.targetAnchorId,f=n.type,c,d,p,y;if(f===ie.SOURCE?(c=e.node,d=s,p=e.anchor,y=s.getAnchorInfo(u)):(c=a,d=e.node,y=e.anchor,p=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==e.node&&this.preTargetNode.setElementState(W.DEFAULT),this.preTargetNode=e.node,y.id===p.id)return{pass:!1,msg:"",newTargetNode:d};var h="".concat(c.id,"_").concat(d.id,"_").concat(p.id,"_").concat(y.id);if(!this.targetRuleResults.has(h)){var g=c.isAllowConnectedAsSource(d,p,y,i),v=d.isAllowConnectedAsTarget(c,p,y,i);this.sourceRuleResults.set(h,Bn(g)),this.targetRuleResults.set(h,Bn(v))}var _=this.sourceRuleResults.get(h),O=_.isAllPass,w=_.msg,S=this.targetRuleResults.get(h),M=S.isAllPass,m=S.msg,T=O&&M?W.ALLOW_CONNECT:W.NOT_ALLOW_CONNECT;return f===ie.SOURCE?c.setElementState(T):d.setElementState(T),{pass:O&&M,msg:m||w,newTargetNode:d}},t.prototype.render=function(){var e=this.props,n=e.x,o=e.y,i=e.getAdjustPointShape,a=e.edgeModel,s=this.state.dragging;return x("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(n,o,a)})},t}($),Dh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),si=globalThis&&globalThis.__assign||function(){return si=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},si.apply(this,arguments)};(function(r){Dh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getArrowAttributes=function(){var e=this.props,n=e.arrowInfo,o=e.style,i=n.start,a=n.end,s={start:i,end:a,offset:o.offset,verticalLength:o.verticalLength,type:"end"},l=Xr(s),u=l.leftX,f=l.leftY,c=l.rightX,d=l.rightY;return si({d:"M".concat(u," ").concat(f," L").concat(a.x," ").concat(a.y," L").concat(c," ").concat(d," z")},o)},t.prototype.getShape=function(){var e=this.getArrowAttributes(),n=e.d,o=e.strokeWidth,i=e.stroke,a=e.fill;return x(Hr,{d:n,fill:a,strokeWidth:o,stroke:i})},t.prototype.render=function(){return x("g",{className:"lf-arrow",children:this.getShape()})},t})($);var Nh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Rr=globalThis&&globalThis.__assign||function(){return Rr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Rr.apply(this,arguments)},Ch=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},no=function(r){Nh(t,r);function t(){var e=r.call(this)||this;return e.textRef=vi(),e.handleHover=function(n,o){var i=e.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(n);var l=n?C.EDGE_MOUSEENTER:C.EDGE_MOUSELEAVE,u=a.getData();s.emit(l,{data:u,e:o})},e.setHoverOn=function(n){var o=e.props.model.isHovered;o||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOn(),e.handleHover(!0,n))},e.setHoverOff=function(n){var o=e.props.model.isHovered;!o||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOff(),e.handleHover(!1,n))},e.handleContextMenu=function(n){n.preventDefault(),e.contextMenuTime=new Date().getTime(),e.clickTimer&&clearTimeout(e.clickTimer);var o=e.props,i=o.model,a=o.graphModel,s=a.getPointByClient({x:n.clientX,y:n.clientY});a.setElementStateById(i.id,W.SHOW_MENU,s.domOverlayPosition),e.toFront(),i.isSelected||a.selectEdgeById(i.id);var l=i==null?void 0:i.getData();a.eventCenter.emit(C.EDGE_CONTEXTMENU,{data:l,e:n,position:s})},e.handleMouseDown=function(n){n.stopPropagation(),e.startTime=new Date().getTime()},e.handleMouseUp=function(){var n=e.props.model;e.mouseUpDrag=n.isDragging},e.handleClick=function(n){if(!!e.startTime&&!e.mouseUpDrag){var o=n.button===2;if(!o){var i=n.detail===2,a=e.props,s=a.model,l=a.graphModel,u=s==null?void 0:s.getData(),f=l.getPointByClient({x:n.clientX,y:n.clientY});if(i){var c=l.editConfigModel,d=l.textEditElement,p=s.id,y=s.text,h=s.modelType;if(d&&d.id===p&&l.setElementStateById(p,W.DEFAULT),c.edgeTextEdit&&y.editable&&(s.setSelected(!1),l.setElementStateById(p,W.TEXT_EDIT)),h===z.POLYLINE_EDGE){var g=s,v=l.getPointByClient({x:n.x,y:n.y}).canvasOverlayPosition,_=v.x,O=v.y;g.dbClickPosition=Ml({x:_,y:O},g.points)}l.eventCenter.emit(C.EDGE_DBCLICK,{data:u,e:n,position:f})}else l.eventCenter.emit(C.ELEMENT_CLICK,{data:u,e:n,position:f}),l.eventCenter.emit(C.EDGE_CLICK,{data:u,e:n,position:f});var w=l.editConfigModel;l.selectEdgeById(s.id,Al(n,w)),e.toFront()}}},e.handleFocus=function(){var n=e.props,o=n.model,i=n.graphModel;i.eventCenter.emit(C.EDGE_FOCUS,{data:o.getData()})},e.handleBlur=function(){var n=e.props,o=n.model,i=n.graphModel;i.eventCenter.emit(C.EDGE_BLUR,{data:o.getData()})},e}return t.prototype.getShape=function(){return x("g",{children:this.getEdge()})},t.prototype.getTextStyle=function(){},t.prototype.getText=function(){var e,n=this.props,o=n.model,i=n.graphModel,a=i.editConfigModel;if(a.edgeTextMode!==Xt.TEXT||o.state===W.TEXT_EDIT)return null;if(o.text){var s=!1;return a.edgeTextDraggable&&o.text.draggable&&(s=!0),x(vh,{ref:this.textRef,editable:a.edgeTextEdit&&((e=o.text.editable)!==null&&e!==void 0?e:!0),model:o,graphModel:i,draggable:s})}return null},t.prototype.getArrowInfo=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint,i=e.isSelected,a=this.state.hover;return{start:n,end:o,hover:a,isSelected:i}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint;return[n,o]},t.prototype.getArrowStyle=function(){return console.error("getArrowStyle is deprecated in 1.2.0, please use model.getArrowStyle"),null},t.prototype.getArrow=function(){var e=this.props.model,n=e.id,o=e.getArrowStyle(),i=o.refY,a=i===void 0?0:i,s=o.refX,l=s===void 0?2:s,u=Ch(this.getLastTwoPoints(),2),f=u[0],c=u[1],d="auto";return f!==null&&c!==null&&(d=ep(tp({x:c.x-f.x,y:c.y-f.y,z:0}))),x("g",{children:x("defs",{children:[x("marker",{id:"marker-start-".concat(n),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),x("marker",{id:"marker-end-".concat(n),refX:l,refY:a,overflow:"visible",orient:d,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},t.prototype.getStartArrow=function(){return x("path",{})},t.prototype.getEndArrow=function(){var e=this.props.model,n=e.getArrowStyle(),o=n.stroke,i=n.strokeWidth,a=n.offset,s=n.verticalLength;return x("path",{stroke:o,fill:o,strokeWidth:i,transform:"rotate(180)",d:"M 0 0 L ".concat(a," -").concat(s," L ").concat(a," ").concat(s," Z")})},t.prototype.getAdjustPointShape=function(e,n,o){var i=o.getAdjustPointStyle();return x(cr,Rr({className:"lf-edge-adjust-point"},i,{x:e,y:n}))},t.prototype.getAdjustPoints=function(){var e=this.props,n=e.model,o=e.graphModel,i=o.editConfigModel,a=i.adjustEdgeStartAndEnd,s=i.adjustEdgeStart,l=i.adjustEdgeEnd,u=n.getAdjustStart(),f=n.getAdjustEnd();return x("g",{children:[a&&s&&x(fs,Rr({type:ie.SOURCE},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:n,graphModel:o})),a&&l&&x(fs,Rr({type:ie.TARGET},f,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:n,graphModel:o}))]})},t.prototype.getAnimation=function(){console.error("getAnimation is deprecated in 1.2.0, please use model.getEdgeAnimationStyle")},t.prototype.getAppendWidth=function(){return x("g",{})},t.prototype.getAppend=function(){return x("g",{className:"lf-edge-append",children:this.getAppendWidth()})},t.prototype.getEdge=function(){return null},t.prototype.toFront=function(){var e=this.props,n=e.graphModel,o=e.model;n.toFront(o.id)},t.prototype.render=function(){var e=this.props.model,n=e.isSelected,o=e.isHitable,i=e.isShowAdjustPoint;return x("g",{children:[x("g",{className:["lf-edge",!o&&"pointer-none",n&&"lf-edge-selected"].filter(Boolean).join(" "),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onContextMenu:this.handleContextMenu,onMouseOver:this.setHoverOn,onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,onFocus:this.handleFocus,onBlur:this.handleBlur,children:[this.getShape(),this.getAppend(),this.getText(),this.getArrow()]}),i&&n?this.getAdjustPoints():""]})},t.isObserved=!1,t}($),Rh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),li=globalThis&&globalThis.__assign||function(){return li=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},li.apply(this,arguments)},jh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ds=function(r){Rh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,n=e.getEdgeStyle(),o=e,i=o.path,a=o.isAnimation,s=o.arrowConfig,l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,f=l.stroke,c=l.strokeDashoffset,d=l.animationName,p=l.animationDuration,y=l.animationIterationCount,h=l.animationTimingFunction,g=l.animationDirection;return x(Hr,li({d:i},n,s,a?{strokeDasharray:u,stroke:f,style:{strokeDashoffset:c,animationName:d,animationDuration:p,animationIterationCount:y,animationTimingFunction:h,animationDirection:g}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model.path;return x(Hr,{d:e,strokeWidth:10,stroke:"transparent",fill:"none"})},t.prototype.getArrowInfo=function(){var e=this.props.model,n=this.state.hover,o=e.isSelected,i=e.getArrowStyle().offset,a=e.pointsList.map(function(c){return{x:c.x,y:c.y}}),s=jh(Ia(a,i),2),l=s[0],u=s[1],f={start:l,end:u,hover:n,isSelected:o};return f},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.getArrowStyle().offset,o=e.pointsList.map(function(i){return{x:i.x,y:i.y}});return Ia(o,n)},t}(no),Lh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ui=globalThis&&globalThis.__assign||function(){return ui=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ui.apply(this,arguments)},ps=function(r){Lh(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint,i=e.isAnimation,a=e.arrowConfig,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,f=l.stroke,c=l.strokeDashoffset,d=l.animationName,p=l.animationDuration,y=l.animationIterationCount,h=l.animationTimingFunction,g=l.animationDirection;return x(ur,ui({},s,{x1:n.x,y1:n.y,x2:o.x,y2:o.y},a,i?{strokeDasharray:u,stroke:f,style:{strokeDashoffset:c,animationName:d,animationDuration:p,animationIterationCount:y,animationTimingFunction:h,animationDirection:g}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model,n=e.startPoint,o=e.endPoint,i={start:n,end:o},a=sd(i),s=a.d,l=a.strokeWidth,u=a.fill,f=a.strokeDasharray,c=a.stroke;return x(Hr,{d:s,fill:u,strokeWidth:l,stroke:c,strokeDasharray:f})},t}(no),Ih=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ce=globalThis&&globalThis.__assign||function(){return Ce=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},Ce.apply(this,arguments)},Bh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},ci=function(r){Ih(t,r);function t(){var e=r.call(this)||this;return e.onDragStart=function(){var n=e.props.model;n.dragAppendStart(),e.isShowAdjustPointTemp=n.isShowAdjustPoint,n.isShowAdjustPoint=!1},e.onDragging=function(n){var o=n.deltaX,i=n.deltaY,a=e.props,s=a.model,l=a.graphModel;e.isDragging=!0;var u=l.transformModel,f=l.editConfigModel,c=Bh(u.fixDeltaXY(o,i),2),d=c[0],p=c[1],y=s,h=f.adjustEdgeMiddle;h?e.appendInfo=y.dragAppendSimple(e.appendInfo,{x:d,y:p}):e.appendInfo=y.dragAppend(e.appendInfo,{x:d,y:p})},e.onDragEnd=function(){var n,o=e.props,i=o.model,a=o.graphModel.eventCenter,s=i;s.dragAppendEnd(),e.isDragging=!1,s.isShowAdjustPoint=(n=e.isShowAdjustPointTemp)!==null&&n!==void 0?n:!1,e.appendInfo=void 0,a.emit(C.EDGE_ADJUST,{data:s.getData()})},e.beforeDragStart=function(n,o){o.draggable&&e.drag.handleMouseDown(n),e.appendInfo=o},e.drag=new ue({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd,isStopPropagation:!1}),e}return t.prototype.getEdge=function(){var e=this.props.model,n=e.points,o=e.isAnimation,i=e.arrowConfig,a=e.getEdgeStyle(),s=e.getEdgeAnimationStyle(),l=s.strokeDasharray,u=s.stroke,f=s.strokeDashoffset,c=s.animationName,d=s.animationDuration,p=s.animationIterationCount,y=s.animationTimingFunction,h=s.animationDirection;return x(jd,Ce({points:n},a,i,o?{strokeDasharray:l,stroke:u,style:{strokeDashoffset:f,animationName:c,animationDuration:d,animationIterationCount:p,animationTimingFunction:y,animationDirection:h}}:{}))},t.prototype.getArrowInfo=function(){var e=this.props.model,n=e.points,o=e.isSelected,i=this.state.hover,a=ke(n),s=a[0],l=a[0];return a.length>=2&&(s=a[a.length-2],l=a[a.length-1]),{start:s,end:l,hover:i,isSelected:o}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,n=e.points,o=ke(n),i=o[0],a=o[0];return o.length>=2&&(i=o[o.length-2],a=o[o.length-1]),[i,a]},t.prototype.getAppendAttributes=function(e){var n=e.start,o=e.end,i;if(n.x===o.x&&n.y===o.y)i="";else{var a={start:n,end:o,offset:10,verticalLength:5},s=Xr(Ce(Ce({},a),{type:"start"})),l=Xr(Ce(Ce({},a),{type:"end"}));i="M".concat(s.leftX," ").concat(s.leftY,`
- L`).concat(s.rightX," ").concat(s.rightY,`
- L`).concat(l.rightX," ").concat(l.rightY,`
- L`).concat(l.leftX," ").concat(l.leftY," z")}return{d:i,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},t.prototype.getAppendShape=function(e){var n=this.getAppendAttributes(e),o=n.d,i=n.strokeWidth,a=n.fill,s=n.strokeDasharray,l=n.stroke;return x(Hr,{d:o,fill:a,strokeWidth:i,stroke:l,strokeDasharray:s})},t.prototype.getAppendWidth=function(){for(var e=this,n=this.props,o=n.model,i=n.graphModel,a=o.pointsList,s=o.draggable,l=[],u=a.length,f=function(p){var y="lf-polyline-append",h={start:{x:a[p].x,y:a[p].y},end:{x:a[p+1].x,y:a[p+1].y},startIndex:p,endIndex:p+1,direction:ot.HORIZONTAL,draggable:!0},g=x("g",{className:y,children:c.getAppendShape(h)}),v=i.editConfigModel,_=v.adjustEdge,O=v.adjustEdgeMiddle;if(_&&s){var w=h.startIndex,S=h.endIndex,M=O&&(w===0||S===u-1);h.draggable=!M,h.start.x===h.end.x?(h.draggable&&(y+="-ew-resize"),h.direction=ot.VERTICAL):h.start.y===h.end.y&&(h.draggable&&(y+="-ns-resize"),h.direction=ot.HORIZONTAL),g=x("g",{className:c.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(m){return e.beforeDragStart(m,h)},children:x("g",{className:y,children:c.getAppendShape(h)})})}l.push(g)},c=this,d=0;d<u-1;d++)f(d);return x("g",{children:l})},t}(no),qe=globalThis&&globalThis.__assign||function(){return qe=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},qe.apply(this,arguments)},Xh=function(){function r(t){var e=this;this.nodeConfig=null,this.fakeNode=null,this.stopDrag=function(){e.nodeConfig=null,window.document.removeEventListener("mouseup",e.stopDrag)},this.dragEnter=function(o){!e.nodeConfig||e.fakeNode||(e.fakeNode=e.lf.createFakeNode(qe(qe({},e.nodeConfig),e.clientToLocalPoint({x:o.clientX,y:o.clientY}))))},this.onDragOver=function(o){if(o.preventDefault(),e.fakeNode){var i=e.clientToLocalPoint({x:o.clientX,y:o.clientY}),a=i.x,s=i.y;e.fakeNode.moveTo(a,s);var l=e.fakeNode.getData();e.lf.setNodeSnapLine(l),e.lf.graphModel.eventCenter.emit(C.NODE_DND_DRAG,{data:l,e:o})}return!1},this.onDragLeave=function(){e.fakeNode&&(e.lf.removeNodeSnapLine(),e.lf.graphModel.removeFakeNode(),e.fakeNode=null)},this.onDrop=function(o){!e.lf.graphModel||!o||!e.nodeConfig||(e.lf.addNode(qe(qe({},e.nodeConfig),e.clientToLocalPoint({x:o.clientX,y:o.clientY})),C.NODE_DND_ADD,o),o.preventDefault(),o.stopPropagation(),e.nodeConfig=null,e.lf.removeNodeSnapLine(),e.lf.graphModel.removeFakeNode(),e.fakeNode=null)};var n=t.lf;this.lf=n}return r.prototype.clientToLocalPoint=function(t){var e=t.x,n=t.y,o=Ss(this.lf.options,["grid","size"]),i=this.lf.graphModel.getPointByClient({x:e,y:n}),a=i.canvasOverlayPosition,s=a.x,l=a.y;return{x:lr(s,o),y:lr(l,o)}},r.prototype.startDrag=function(t){var e=this.lf.graphModel.editConfigModel;e!=null&&e.isSilentMode||(this.nodeConfig=t,window.document.addEventListener("mouseup",this.stopDrag))},r.prototype.eventMap=function(){return{onMouseEnter:this.dragEnter,onMouseOver:this.dragEnter,onMouseMove:this.onDragOver,onMouseLeave:this.onDragLeave,onMouseUp:this.onDrop}},r}();function kh(r,t){r.on("node:mousemove",function(e){var n=e.data;t.setNodeSnapLine(n)}),r.on("node:mouseup",function(){t.clearSnapline()})}var Yh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ce=globalThis&&globalThis.__assign||function(){return ce=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},ce.apply(this,arguments)},Hh=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Uh=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},Fh=function(r){Yh(t,r);function t(e){var n=r.call(this,e)||this;return n.ref=vi(),n.__prevText={type:"",text:"",id:""},n.keyupHandler=function(o){var i=n.props.graphModel.textEditElement;o.key==="Enter"&&o.altKey&&(i==null||i.setElementState(W.DEFAULT))},n.inputHandler=function(o){var i=o.target.innerText,a=n.props.graphModel.textEditElement;a&&(n.__prevText={type:a.type,text:i.replace(/(\r\n)+$|(\n)+$/,""),id:a.id})},n.keydownHandler=function(o){o.stopPropagation()},n.state={style:{left:0,top:0}},n}return t.getDerivedStateFromProps=function(e){var n,o=e.textEditElement,i=e.graphModel,a=i.transformModel,s=i.theme,l=s.inputText,u;if(o){if(!(!((n=o.text)===null||n===void 0)&&n.value)&&o.BaseType===st.EDGE){var f=o.text,c=o.textPosition,d=c.x,p=c.y;f.x=d,f.y=p,o.setText(f)}var y={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(o.BaseType===st.EDGE){var h=s.edgeText,g=h.overflowMode,v=h.lineHeight,_=h.wrapPadding,O=h.textWidth;O&&g==="autoWrap"&&(u=ce(ce({},y),{width:O,minWidth:O,lineHeight:v,padding:_}))}else if(o.BaseType===st.NODE){var w=s.nodeText,g=w.overflowMode,v=w.lineHeight,_=w.wrapPadding,O=w.textWidth,S=o.width,M=o.modelType,m=o.textWidth,T=m||O||S;(M!==z.TEXT_NODE&&g==="autoWrap"||M===z.TEXT_NODE&&O)&&(u=ce(ce({},y),{width:T,minWidth:T,lineHeight:v,padding:_}))}var P=o.text,A=P.x,I=P.y,B=Uh(a.CanvasPointToHtmlPoint([A,I]),2),U=B[0],F=B[1];return{style:ce(ce({left:U,top:F},u),l)}}return null},t.prototype.componentDidUpdate=function(){var e=this.props.graphModel;if(this.ref.current&&(this.ref.current.focus(),this.placeCaretAtEnd(this.ref.current)),this.__prevText.id!==""){var n=this.__prevText,o=n.text,i=n.id;e.updateText(i,o),e.eventCenter.emit(C.TEXT_UPDATE,{data:ce({},this.__prevText)}),this.__prevText.id="",this.__prevText.text="",this.__prevText.type=""}},t.prototype.placeCaretAtEnd=function(e){if(window.getSelection!==void 0&&document.createRange!==void 0){var n=document.createRange();n.selectNodeContents(e),n.collapse(!1);var o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}},t.prototype.render=function(){var e,n=this.props.graphModel.textEditElement,o=this.state.style;return n?x("div",{contentEditable:!0,className:"lf-text-input",style:o,ref:this.ref,onKeyUp:this.keyupHandler,onKeyDown:this.keydownHandler,onKeyPress:this.keydownHandler,onInput:this.inputHandler,children:(e=n.text)===null||e===void 0?void 0:e.value},n.id):null},t.toolName="text-edit-tool",t=Hh([Ct],t),t}($),zh=globalThis&&globalThis.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Gh=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},go=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},$h=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},Vh=function(r){zh(t,r);function t(e){var n=r.call(this,e)||this;n.handleMouseDown=function(s){n.stepDrag.handleMouseDown(s)},n.handleWheelEvent=function(s){var l,u;s.preventDefault();var f=s.deltaX,c=s.deltaY,d=s.clientX,p=s.clientY,y=s.ctrlKey,h=new WheelEvent("wheel",{deltaX:f,deltaY:c,clientX:d,clientY:p,ctrlKey:y});(u=(l=n.props.lf.container)===null||l===void 0?void 0:l.querySelector('.lf-canvas-overlay[name="canvas-overlay"]'))===null||u===void 0||u.dispatchEvent(h)},n.onDragging=function(s){var l=s.deltaX,u=s.deltaY,f=n.props,c=f.graphModel,d=f.lf,p=d.getTransform(),y=p.SCALE_X,h=p.SCALE_Y,g=c.getSelectElements(!0);c.moveNodes(g.nodes.map(function(v){return v.id}),l/y,u/h)},n.handleContextMenu=function(s){s.preventDefault();var l=n.props,u=l.graphModel,f=l.graphModel,c=f.eventCenter,d=f.selectElements,p=u.getPointByClient({x:s.clientX,y:s.clientY}),y={nodes:[],edges:[]},h=$h([],go(d.values()),!1);h.forEach(function(g){g.BaseType===st.NODE&&y.nodes.push(g.getData()),g.BaseType===st.EDGE&&y.edges.push(g.getData())}),c.emit(C.SELECTION_CONTEXTMENU,{data:y,e:s,position:p})};var o=e.graphModel,i=o.gridSize,a=o.eventCenter;return n.stepDrag=new ue({onDragging:n.onDragging,step:i,eventType:"SELECTION",eventCenter:a}),n}return t.prototype.render=function(){var e,n,o=this.props.graphModel,i=o.selectElements,a=o.transformModel,s=this.props.lf.getTransform(),l=s.SCALE_X,u=s.SCALE_Y;if(!(i.size<=1)){var f=Number.MAX_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER;i.forEach(function(h){var g;h.BaseType===st.NODE&&(g=zf(h)),h.BaseType===st.EDGE&&(g=Wf(h)),g!==void 0&&(f=Math.min(f,g.x),c=Math.min(c,g.y),d=Math.max(d,g.x1),p=Math.max(p,g.y1))}),e=go(a.CanvasPointToHtmlPoint([f,c]),2),f=e[0],c=e[1],n=go(a.CanvasPointToHtmlPoint([d,p]),2),d=n[0],p=n[1];var y={left:"".concat(f-20*l/2,"px"),top:"".concat(c-20*u/2,"px"),width:"".concat(d-f+20*l,"px"),height:"".concat(p-c+20*u,"px"),"border-width":"".concat(2*l,"px")};return x("div",{className:"lf-multiple-select",style:y,onMouseDown:this.handleMouseDown,onContextMenu:this.handleContextMenu,onWheel:this.handleWheelEvent})}},t.toolName="multiple-select-tool",t=Gh([Ct],t),t}($),_o=globalThis&&globalThis.__decorate||function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Wh=[Fh,Vh],Kh=function(){function r(t){var e=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=t,ut(Wh,function(i){e.isDisabled(i.toolName)||e.registerTool(i.toolName,i)});var n=t.graphModel,o=n.eventCenter;o.on("".concat(C.GRAPH_TRANSFORM,",").concat(C.NODE_CLICK,",").concat(C.BLANK_CLICK," "),function(){var i,a=n.textEditElement,s=n.editConfigModel,l=s.edgeTextEdit,u=s.nodeTextEdit;(l||u)&&a&&((i=n.textEditElement)===null||i===void 0||i.setElementState(W.DEFAULT))})}return r.prototype.isDisabled=function(t){var e;return((e=this.instance.options.disabledTools)===null||e===void 0?void 0:e.indexOf(t))!==-1},r.prototype.registerTool=function(t,e){this.toolMap.set(t,e)},r.prototype.disableTool=function(t){var e=this.toolMap.get(t);if(e)return this.disabledToolMap.set(t,e),this.toolMap.delete(t),!0;throw new Error("\u7981\u7528\u5931\u8D25\uFF0C\u4E0D\u5B58\u5728\u540D\u4E3A ${tool} \u7684\u5DE5\u5177")},r.prototype.enableTool=function(t){var e=this.disabledToolMap.get(t);if(e)return this.toolMap.set(t,e),this.disabledToolMap.delete(t),!0;throw new Error("\u4E0D\u5B58\u5728\u540D\u4E3A ${tool} \u7684\u5DE5\u5177")},r.prototype.getTools=function(){return Array.from(this.toolMap.values())},r.prototype.getInstance=function(){return this.instance},_o([E],r.prototype,"toolMap",void 0),_o([b],r.prototype,"disableTool",null),_o([b],r.prototype,"enableTool",null),r}();function Zh(r){throw new Error("[mobx-utils] "+r)}function Un(r,t){t===void 0&&(t="Illegal state"),r||Zh(t)}var kl=function(r){return r&&r!==Object.prototype&&Object.getOwnPropertyNames(r).concat(kl(Object.getPrototypeOf(r))||[])},qh=function(r){var t=kl(r),e=t.filter(function(n,o){return t.indexOf(n)===o});return e},Jh=function(r){return qh(r).filter(function(t){return t!=="constructor"&&!~t.indexOf("__")})},Yl="pending",Fn="fulfilled",Li="rejected";function Qh(r){switch(this.state){case Yl:return r.pending&&r.pending(this.value);case Li:return r.rejected&&r.rejected(this.value);case Fn:return r.fulfilled?r.fulfilled(this.value):this.value}}function hs(r,t){if(Un(arguments.length<=2,"fromPromise expects up to two arguments"),Un(typeof r=="function"||typeof r=="object"&&r&&typeof r.then=="function","Please pass a promise or function to fromPromise"),r.isPromiseBasedObservable===!0)return r;typeof r=="function"&&(r=new Promise(r));var e=r;r.then(b("observableFromPromise-resolve",function(o){e.value=o,e.state=Fn}),b("observableFromPromise-reject",function(o){e.value=o,e.state=Li})),e.isPromiseBasedObservable=!0,e.case=Qh;var n=t&&t.state===Fn?t.value:void 0;return jo(e,{value:n,state:Yl},{},{deep:!1}),e}(function(r){r.reject=b("fromPromise.reject",function(e){var n=r(Promise.reject(e));return n.state=Li,n.value=e,n});function t(e){e===void 0&&(e=void 0);var n=r(Promise.resolve(e));return n.state=Fn,n.value=e,n}r.resolve=b("fromPromise.resolve",t)})(hs||(hs={}));var vn=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i};(function(){function r(t,e){var n=this;Xc(function(){n.current=e,n.subscription=t.subscribe(n)})}return r.prototype.dispose=function(){this.subscription&&this.subscription.unsubscribe()},r.prototype.next=function(t){this.current=t},r.prototype.complete=function(){this.dispose()},r.prototype.error=function(t){this.current=t,this.dispose()},vn([E.ref],r.prototype,"current",void 0),vn([b.bound],r.prototype,"next",null),vn([b.bound],r.prototype,"complete",null),vn([b.bound],r.prototype,"error",null),r})();var zn=function(){return zn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},zn.apply(this,arguments)},gr=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(i=(o<3?a(i):o>3?a(t,e,i):a(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},tv=["model","reset","submit","isDirty","isPropertyDirty","resetProperty"];(function(){function r(t){var e=this;this.model=t,this.localValues=E.map({}),this.localComputedValues=E.map({}),this.isPropertyDirty=function(n){return e.localValues.has(n)},Un(Yt(t),"createViewModel expects an observable object"),Jh(t).forEach(function(n){if(!(n===L||n==="__mobxDidRunLazyInitializers")){if(Un(tv.indexOf(n)===-1,"The propertyname "+n+" is reserved and cannot be used with viewModels"),Wi(t,n)){var o=Wr(t,n).derivation;e.localComputedValues.set(n,et(o.bind(e)))}var i=Object.getOwnPropertyDescriptor(t,n),a=i?{enumerable:i.enumerable}:{};Object.defineProperty(e,n,zn(zn({},a),{configurable:!0,get:function(){return Wi(t,n)?e.localComputedValues.get(n).get():e.isPropertyDirty(n)?e.localValues.get(n):e.model[n]},set:b(function(s){s!==e.model[n]?e.localValues.set(n,s):e.localValues.delete(n)})}))}})}return Object.defineProperty(r.prototype,"isDirty",{get:function(){return this.localValues.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"changedValues",{get:function(){return this.localValues.toJS()},enumerable:!1,configurable:!0}),r.prototype.submit=function(){var t=this;sr(this.localValues).forEach(function(e){var n=t.localValues.get(e),o=t.model[e];te(o)?o.replace(n):Tt(o)?(o.clear(),o.merge(n)):ul(n)||(t.model[e]=n)}),this.localValues.clear()},r.prototype.reset=function(){this.localValues.clear()},r.prototype.resetProperty=function(t){this.localValues.delete(t)},gr([et],r.prototype,"isDirty",null),gr([et],r.prototype,"changedValues",null),gr([b.bound],r.prototype,"submit",null),gr([b.bound],r.prototype,"reset",null),gr([b.bound],r.prototype,"resetProperty",null),r})();function mo(r){if(!r)return"ROOT";for(var t=[];r.parent;)t.push(r.path),r=r.parent;return t.reverse().join("/")}function bo(r){return Yt(r)||te(r)||Tt(r)}function ev(r,t){var e=new WeakMap;function n(s){var l=e.get(s.object);o(s,l),t(s,mo(l),r)}function o(s,l){switch(s.type){case"add":i(s.newValue,l,s.name);break;case"update":a(s.oldValue),i(s.newValue,l,s.name||""+s.index);break;case"remove":case"delete":a(s.oldValue);break;case"splice":s.removed.map(a),s.added.forEach(function(c,d){return i(c,l,""+(s.index+d))});for(var u=s.index+s.addedCount;u<s.object.length;u++)if(bo(s.object[u])){var f=e.get(s.object[u]);f&&(f.path=""+u)}break}}function i(s,l,u){if(bo(s)){var f=e.get(s);if(f){if(f.parent!==l||f.path!==u)throw new Error("The same observable object cannot appear twice in the same tree,"+(" trying to assign it to '"+mo(l)+"/"+u+"',")+(" but it already exists at '"+mo(f.parent)+"/"+f.path+"'"))}else{var c={parent:l,path:u,dispose:cl(s,n)};e.set(s,c),Wc(s).forEach(function(d){var p=d[0],y=d[1];return i(y,c,p)})}}}function a(s){if(bo(s)){var l=e.get(s);if(!l)return;e.delete(s),l.dispose(),Vc(s).forEach(a)}}return i(r,void 0,""),function(){a(r)}}var rv=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();(function(r){rv(t,r);function t(e,n,o){var i=o===void 0?{}:o,a=i.name,s=a===void 0?"ogm"+(Math.random()*1e3|0):a,l=i.keyToName,u=l===void 0?function(d){return""+d}:l,f=r.call(this)||this;f._keyToName=u,f._groupBy=n,f._ogmInfoKey=Symbol("ogmInfo"+s),f._base=e;for(var c=0;c<e.length;c++)f._addItem(e[c]);return f._disposeBaseObserver=cl(f._base,function(d){if(d.type==="splice")$t(function(){for(var p=0,y=d.removed;p<y.length;p++){var h=y[p];f._removeItem(h)}for(var g=0,v=d.added;g<v.length;g++){var _=v[g];f._addItem(_)}});else if(d.type==="update")$t(function(){f._removeItem(d.oldValue),f._addItem(d.newValue)});else throw new Error("illegal state")}),f}return t.prototype.clear=function(){throw new Error("not supported")},t.prototype.delete=function(e){throw new Error("not supported")},t.prototype.set=function(e,n){throw new Error("not supported")},t.prototype.dispose=function(){this._disposeBaseObserver();for(var e=0;e<this._base.length;e++){var n=this._base[e],o=n[this._ogmInfoKey];o.reaction(),delete n[this._ogmInfoKey]}},t.prototype._getGroupArr=function(e){var n=r.prototype.get.call(this,e);return n===void 0&&(n=E([],{name:"GroupArray["+this._keyToName(e)+"]",deep:!1}),r.prototype.set.call(this,e,n)),n},t.prototype._removeFromGroupArr=function(e,n){var o=r.prototype.get.call(this,e);o.length===1?r.prototype.delete.call(this,e):(n===o.length-1||(o[n]=o[o.length-1],o[n][this._ogmInfoKey].groupArrIndex=n),o.length--)},t.prototype._addItem=function(e){var n=this,o=this._groupBy(e),i=this._getGroupArr(o),a={groupByValue:o,groupArrIndex:i.length,reaction:rl(function(){return n._groupBy(e)},function(s,l){var u=e[n._ogmInfoKey];n._removeFromGroupArr(u.groupByValue,u.groupArrIndex);var f=n._getGroupArr(s),c=f.length;f.push(e),u.groupByValue=s,u.groupArrIndex=c})};Object.defineProperty(e,this._ogmInfoKey,{configurable:!0,enumerable:!1,value:a}),i.push(e)},t.prototype._removeItem=function(e){var n=e[this._ogmInfoKey];this._removeFromGroupArr(n.groupByValue,n.groupArrIndex),n.reaction(),delete e[this._ogmInfoKey]},t})(Ai);Promise.resolve(),typeof queueMicrotask!="undefined"||typeof process!="undefined"&&process.nextTick;var fi=globalThis&&globalThis.__assign||function(){return fi=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},fi.apply(this,arguments)},nv=function(){function r(t){this.undos=[],this.redos=[],this.callbacks=[],this.stopWatch=null,this.curData=null,this.maxSize=50,this.waitTime=100,this.eventCenter=t}return r.prototype.add=function(t){Oo(uu(this.undos),t)||(this.undos.push(t),Oo(this.curData,t)||(this.redos=[]),this.eventCenter.emit(C.HISTORY_CHANGE,{data:{undos:this.undos,redos:this.redos,undoAble:this.undoAble(),redoAble:this.redoAble()}}),this.undos.length>this.maxSize&&this.undos.shift())},r.prototype.undoAble=function(){return this.undos.length>1},r.prototype.undo=function(){if(!!this.undoAble()){var t=this.undos.pop();this.redos.push(t);var e=this.undos.pop();return this.curData=Y(e),e}},r.prototype.redoAble=function(){return this.redos.length>0},r.prototype.redo=function(){if(!!this.redoAble()){var t=this.redos.pop();return this.curData=Y(t),t}},r.prototype.watch=function(t){var e=this;this.stopWatch&&this.stopWatch(),this.undos.push(t.modelToGraphData()),this.stopWatch=ev(t,Ms(function(){var n=t.modelToHistoryData();n&&e.add(fi({},n))},this.waitTime))},r}(),Hl={exports:{}};(function(r){(function(t,e,n){if(!t)return;for(var o={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},i={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,u=1;u<20;++u)o[111+u]="f"+u;for(u=0;u<=9;++u)o[u+96]=u.toString();function f(m,T,P){if(m.addEventListener){m.addEventListener(T,P,!1);return}m.attachEvent("on"+T,P)}function c(m){if(m.type=="keypress"){var T=String.fromCharCode(m.which);return m.shiftKey||(T=T.toLowerCase()),T}return o[m.which]?o[m.which]:i[m.which]?i[m.which]:String.fromCharCode(m.which).toLowerCase()}function d(m,T){return m.sort().join(",")===T.sort().join(",")}function p(m){var T=[];return m.shiftKey&&T.push("shift"),m.altKey&&T.push("alt"),m.ctrlKey&&T.push("ctrl"),m.metaKey&&T.push("meta"),T}function y(m){if(m.preventDefault){m.preventDefault();return}m.returnValue=!1}function h(m){if(m.stopPropagation){m.stopPropagation();return}m.cancelBubble=!0}function g(m){return m=="shift"||m=="ctrl"||m=="alt"||m=="meta"}function v(){if(!l){l={};for(var m in o)m>95&&m<112||o.hasOwnProperty(m)&&(l[o[m]]=m)}return l}function _(m,T,P){return P||(P=v()[m]?"keydown":"keypress"),P=="keypress"&&T.length&&(P="keydown"),P}function O(m){return m==="+"?["+"]:(m=m.replace(/\+{2}/g,"+plus"),m.split("+"))}function w(m,T){var P,A,I,B=[];for(P=O(m),I=0;I<P.length;++I)A=P[I],s[A]&&(A=s[A]),T&&T!="keypress"&&a[A]&&(A=a[A],B.push("shift")),g(A)&&B.push(A);return T=_(A,B,T),{key:A,modifiers:B,action:T}}function S(m,T){return m===null||m===e?!1:m===T?!0:S(m.parentNode,T)}function M(m){var T=this;if(m=m||e,!(T instanceof M))return new M(m);T.target=m,T._callbacks={},T._directMap={};var P={},A,I=!1,B=!1,U=!1;function F(k){k=k||{};var V=!1,Q;for(Q in P){if(k[Q]){V=!0;continue}P[Q]=0}V||(U=!1)}function lt(k,V,Q,G,rt,xt){var q,ft,Pt=[],wt=Q.type;if(!T._callbacks[k])return[];for(wt=="keyup"&&g(k)&&(V=[k]),q=0;q<T._callbacks[k].length;++q)if(ft=T._callbacks[k][q],!(!G&&ft.seq&&P[ft.seq]!=ft.level)&&wt==ft.action&&(wt=="keypress"&&!Q.metaKey&&!Q.ctrlKey||d(V,ft.modifiers))){var io=!G&&ft.combo==rt,ao=G&&ft.seq==G&&ft.level==xt;(io||ao)&&T._callbacks[k].splice(q,1),Pt.push(ft)}return Pt}function pt(k,V,Q,G){T.stopCallback(V,V.target||V.srcElement,Q,G)||k(V,Q)===!1&&(y(V),h(V))}T._handleKey=function(k,V,Q){var G=lt(k,V,Q),rt,xt={},q=0,ft=!1;for(rt=0;rt<G.length;++rt)G[rt].seq&&(q=Math.max(q,G[rt].level));for(rt=0;rt<G.length;++rt){if(G[rt].seq){if(G[rt].level!=q)continue;ft=!0,xt[G[rt].seq]=1,pt(G[rt].callback,Q,G[rt].combo,G[rt].seq);continue}ft||pt(G[rt].callback,Q,G[rt].combo)}var Pt=Q.type=="keypress"&&B;Q.type==U&&!g(k)&&!Pt&&F(xt),B=ft&&Q.type=="keydown"};function St(k){typeof k.which!="number"&&(k.which=k.keyCode);var V=c(k);if(!!V){if(k.type=="keyup"&&I===V){I=!1;return}T.handleKey(V,p(k),k)}}function yt(){clearTimeout(A),A=setTimeout(F,1e3)}function ct(k,V,Q,G){P[k]=0;function rt(wt){return function(){U=wt,++P[k],yt()}}function xt(wt){pt(Q,wt,k),G!=="keyup"&&(I=c(wt)),setTimeout(F,10)}for(var q=0;q<V.length;++q){var ft=q+1===V.length,Pt=ft?xt:rt(G||w(V[q+1]).action);Rt(V[q],Pt,G,k,q)}}function Rt(k,V,Q,G,rt){T._directMap[k+":"+Q]=V,k=k.replace(/\s+/g," ");var xt=k.split(" "),q;if(xt.length>1){ct(k,xt,V,Q);return}q=w(k,Q),T._callbacks[q.key]=T._callbacks[q.key]||[],lt(q.key,q.modifiers,{type:q.action},G,k,rt),T._callbacks[q.key][G?"unshift":"push"]({callback:V,modifiers:q.modifiers,action:q.action,seq:G,level:rt,combo:k})}T._bindMultiple=function(k,V,Q){for(var G=0;G<k.length;++G)Rt(k[G],V,Q)},f(m,"keypress",St),f(m,"keydown",St),f(m,"keyup",St)}M.prototype.bind=function(m,T,P){var A=this;return m=m instanceof Array?m:[m],A._bindMultiple.call(A,m,T,P),A},M.prototype.unbind=function(m,T){var P=this;return P.bind.call(P,m,function(){},T)},M.prototype.trigger=function(m,T){var P=this;return P._directMap[m+":"+T]&&P._directMap[m+":"+T]({},m),P},M.prototype.reset=function(){var m=this;return m._callbacks={},m._directMap={},m},M.prototype.stopCallback=function(m,T){var P=this;if((" "+T.className+" ").indexOf(" mousetrap ")>-1||S(T,P.target))return!1;if("composedPath"in m&&typeof m.composedPath=="function"){var A=m.composedPath()[0];A!==m.target&&(T=A)}return T.tagName=="INPUT"||T.tagName=="SELECT"||T.tagName=="TEXTAREA"||T.isContentEditable},M.prototype.handleKey=function(){var m=this;return m._handleKey.apply(m,arguments)},M.addKeycodes=function(m){for(var T in m)m.hasOwnProperty(T)&&(o[T]=m[T]);l=null},M.init=function(){var m=M(e);for(var T in m)T.charAt(0)!=="_"&&(M[T]=function(P){return function(){return m[P].apply(m,arguments)}}(T))},M.init(),t.Mousetrap=M,r.exports&&(r.exports=M),typeof n=="function"&&n.amd&&n(function(){return M})})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)})(Hl);var ov=Hl.exports,vs=globalThis&&globalThis.__assign||function(){return vs=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},vs.apply(this,arguments)};globalThis&&globalThis.__rest;var ee=null;function ys(r,t){return r.x+=t,r.y+=t,As(r.text)||(r.text.x+=t,r.text.y+=t),r}function gs(r,t){return r.startPoint&&(r.startPoint.x+=t,r.startPoint.y+=t),r.endPoint&&(r.endPoint.x+=t,r.endPoint.y+=t),r.pointsList&&r.pointsList.length>0&&r.pointsList.forEach(function(e){e.x+=t,e.y+=t}),As(r.text)||(r.text.x+=t,r.text.y+=t),r}var $e=40,yn=40;function iv(r,t){var e=r.keyboard,n=e.options.keyboard;e.on(["cmd + c","ctrl + c"],function(){if(yn=$e,!(n!=null&&n.enabled)||t.textEditElement)return!0;var o=r.options.guards,i=t.getSelectElements(!1),a=o&&o.beforeClone?o.beforeClone(i):!0;return!a||i.nodes.length===0&&i.edges.length===0?(ee=null,!0):(ee=i,ee.nodes.forEach(function(s){return ys(s,$e)}),ee.edges.forEach(function(s){return gs(s,$e)}),!1)}),e.on(["cmd + v","ctrl + v"],function(){if(!(n!=null&&n.enabled)||t.textEditElement)return!0;if(ee&&(ee.nodes||ee.edges)){r.clearSelectElements();var o=r.addElements(ee,yn);if(!o)return!0;o.nodes.forEach(function(i){return r.selectElementById(i.id,!0)}),o.edges.forEach(function(i){return r.selectElementById(i.id,!0)}),ee.nodes.forEach(function(i){return ys(i,$e)}),ee.edges.forEach(function(i){return gs(i,$e)}),yn=yn+$e}return!1}),e.on(["cmd + z","ctrl + z"],function(){return!(n!=null&&n.enabled)||t.textEditElement?!0:(r.undo(),!1)}),e.on(["cmd + y","ctrl + y"],function(){return!(n!=null&&n.enabled)||t.textEditElement?!0:(r.redo(),!1)}),e.on(["backspace"],function(){if(!(n!=null&&n.enabled)||t.textEditElement)return!0;var o=t.getSelectElements(!0);return r.clearSelectElements(),o.edges.forEach(function(i){return i.id&&r.deleteEdge(i.id)}),o.nodes.forEach(function(i){return i.id&&r.deleteNode(i.id)}),!1})}var av=function(){function r(t){t.keyboard||(t.keyboard={enabled:!1}),this.options=t;var e=t.lf;this.target=e.container,this.mousetrap=new ov(this.target),t.keyboard.enabled&&!e.options.isSilentMode&&this.enable(!0)}return r.prototype.initShortcuts=function(){var t=this,e,n=((e=this.options.keyboard)!==null&&e!==void 0?e:{}).shortcuts;if(n)if(Gn(n))n.forEach(function(s){var l=s.keys,u=s.callback,f=s.action;return t.on(l,u,f)});else{var o=n.keys,i=n.callback,a=n.action;this.on(o,i,a)}},r.prototype.on=function(t,e,n){this.mousetrap.bind(this.getKeys(t),e,n)},Object.defineProperty(r.prototype,"disabled",{get:function(){var t,e;return((e=(t=this.options)===null||t===void 0?void 0:t.keyboard)===null||e===void 0?void 0:e.enabled)!==!0},enumerable:!1,configurable:!0}),r.prototype.off=function(t,e){this.mousetrap.unbind(this.getKeys(t),e)},r.prototype.enable=function(t){(this.disabled||t)&&(this.options.keyboard&&(this.options.keyboard.enabled=!0),this.target instanceof HTMLElement&&(this.target.setAttribute("tabindex","-1"),this.target.style.outline="none"))},r.prototype.disable=function(){this.disabled||(this.options.keyboard&&(this.options.keyboard.enabled=!1),this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))},r.prototype.getKeys=function(t){var e=this;return(Array.isArray(t)?t:[t]).map(function(n){return e.formatKey(n)})},r.prototype.formatKey=function(t){return t.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command")},r}(),me=globalThis&&globalThis.__assign||function(){return me=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},me.apply(this,arguments)},gn=globalThis&&globalThis.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return i},xo=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return r.concat(i||Array.prototype.slice.call(t))},Eo=Symbol("plugin registered by Logicflow.use"),di=function(){function r(t){var e=this,n;this.viewMap=new Map,this.components=[],this.extension={},this.setView=function(u,f){return e.viewMap.set(u,f)},this.getView=function(u){return e.viewMap.get(u)};var o=Ir.get(t),i=o.container,a=o.width,s=o.height;this.options=o,this.container=this.initContainer(i,a,s),this.graphModel=new qp(me(me({},o),{container:this.container})),this.plugins=(n=o.plugins)!==null&&n!==void 0?n:[];var l=this.graphModel.eventCenter;this.tool=new Kh(this),this.dnd=new Xh({lf:this}),this.history=new nv(l),this.keyboard=new av({lf:this,keyboard:o.keyboard}),o.snapline!==!1&&(this.snaplineModel=new Jp(this.graphModel),kh(l,this.snaplineModel)),o.isSilentMode||(iv(this,this.graphModel),this.keyboard.initShortcuts()),this.defaultRegister(),this.installPlugins(o.disabledPlugins)}return r.prototype.initContainer=function(t,e,n){var o=document.createElement("div");return o.style.position="relative",o.style.width=e?"".concat(e,"px"):"100%",o.style.height=n?"".concat(n,"px"):"100%",t.innerHTML="",t.appendChild(o),o},Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function(){return r.toStringTag},enumerable:!1,configurable:!0}),r.prototype.register=function(t,e,n){if(n===void 0&&(n=!0),typeof t!="string"){this.registerElement(t);return}var o={BaseEdge:no,BaseEdgeModel:ro,BaseNode:Ae,BaseNodeModel:Me,RectNode:ri,RectNodeModel:qo,CircleNode:is,CircleNodeModel:qa,PolygonNode:as,PolygonNodeModel:ts,TextNode:us,TextNodeModel:rs,LineEdge:ps,LineEdgeModel:Wa,DiamondNode:ss,DiamondNodeModel:Ja,PolylineEdge:ci,PolylineEdgeModel:Zo,BezierEdge:ds,BezierEdgeModel:$a,EllipseNode:ls,EllipseNodeModel:Qa,HtmlNode:cs,HtmlNodeModel:ns,h:tr,type:t};if(this.viewMap.forEach(function(u){var f=u.extendKey;f&&(o[f]=u)}),this.graphModel.modelMap.forEach(function(u){var f=u.extendKey;f&&(o[f]=u)}),e){var i=e(o),a=i.view,s=i.model,l=a;n&&!l.isObserved&&(l.isObserved=!0,l=Ct(l)),this.setView(t,l),this.graphModel.setModel(t,s)}},r.prototype.registerElement=function(t){var e=t.view;t.isObserverView!==!1&&!e.isObserved&&(e.isObserved=!0,e=Ct(e)),this.setView(t.type,e),this.graphModel.setModel(t.type,t.model)},r.prototype.batchRegister=function(t){var e=this;t===void 0&&(t=[]),ut(t,function(n){e.registerElement(n)})},r.prototype.defaultRegister=function(){var t=[{type:"rect",view:ri,model:qo},{type:"circle",view:is,model:qa},{type:"polygon",view:as,model:ts},{type:"text",view:us,model:rs},{type:"ellipse",view:ls,model:Qa},{type:"diamond",view:ss,model:Ja},{type:"html",view:cs,model:ns},{type:"line",view:ps,model:Wa},{type:"polyline",view:ci,model:Zo},{type:"bezier",view:ds,model:$a}];this.batchRegister(t)},r.prototype.addNode=function(t,e,n){return e===void 0&&(e=C.NODE_ADD),this.graphModel.addNode(t,e,n)},r.prototype.deleteNode=function(t){var e=this.graphModel.getNodeModelById(t);if(!e)return!1;var n=e.getData(),o=this.options.guards,i=o!=null&&o.beforeDelete?o.beforeDelete(n):!0;return i&&this.graphModel.deleteNode(t),i},r.prototype.cloneNode=function(t){var e=this.graphModel.getNodeModelById(t),n=e==null?void 0:e.getData();if(n){var o=this.options.guards,i=o!=null&&o.beforeClone?o.beforeClone(n):!0;if(i)return this.graphModel.cloneNode(t)}},r.prototype.changeNodeId=function(t,e){return this.graphModel.changeNodeId(t,e)},r.prototype.changeNodeType=function(t,e){this.graphModel.changeNodeType(t,e)},r.prototype.getNodeModelById=function(t){return this.graphModel.getNodeModelById(t)},r.prototype.getNodeDataById=function(t){var e=this.getNodeModelById(t);return e==null?void 0:e.getData()},r.prototype.getNodeIncomingEdge=function(t){return this.graphModel.getNodeIncomingEdge(t)},r.prototype.getNodeOutgoingEdge=function(t){return this.graphModel.getNodeOutgoingEdge(t)},r.prototype.getNodeIncomingNode=function(t){return this.graphModel.getNodeIncomingNode(t)},r.prototype.getNodeOutgoingNode=function(t){return this.graphModel.getNodeOutgoingNode(t)},r.prototype.createFakeNode=function(t){var e=this.graphModel.modelMap.get(t.type);if(!e)return console.warn("\u4E0D\u5B58\u5728\u4E3A".concat(t.type,"\u7C7B\u578B\u7684\u8282\u70B9")),null;var n=new e(me(me({},t),{virtual:!0}),this.graphModel);return this.graphModel.setFakeNode(n),n},r.prototype.removeFakeNode=function(){this.graphModel.removeFakeNode()},r.prototype.setNodeSnapLine=function(t){var e;(e=this.snaplineModel)===null||e===void 0||e.setNodeSnapLine(t)},r.prototype.removeNodeSnapLine=function(){var t;(t=this.snaplineModel)===null||t===void 0||t.clearSnapline()},r.prototype.setDefaultEdgeType=function(t){this.graphModel.setDefaultEdgeType(t)},r.prototype.addEdge=function(t){return this.graphModel.addEdge(t)},r.prototype.getEdgeDataById=function(t){var e=this.getEdgeModelById(t);return e==null?void 0:e.getData()},r.prototype.getEdgeModelById=function(t){return this.graphModel.getEdgeModelById(t)},r.prototype.getEdgeModels=function(t){var e=t.sourceNodeId,n=t.targetNodeId,o=[],i=this.graphModel.edges;return e&&n?ut(i,function(a){a.sourceNodeId===e&&a.targetNodeId===n&&o.push(a)}):e?ut(i,function(a){a.sourceNodeId===e&&o.push(a)}):n&&ut(i,function(a){a.targetNodeId===n&&o.push(a)}),o},r.prototype.changeEdgeId=function(t,e){return this.graphModel.changeEdgeId(t,e)},r.prototype.changeEdgeType=function(t,e){this.graphModel.changeEdgeType(t,e)},r.prototype.deleteEdge=function(t){var e=this.graphModel.getEdgeModelById(t);if(!e)return!1;var n=e.getData(),o=this.options.guards,i=o!=null&&o.beforeDelete?o.beforeDelete(n):!0;return i&&this.graphModel.deleteEdgeById(t),i},r.prototype.deleteEdgeByNodeId=function(t){var e=t.sourceNodeId,n=t.targetNodeId;e&&n?this.graphModel.deleteEdgeBySourceAndTarget(e,n):e?this.graphModel.deleteEdgeBySource(e):n&&this.graphModel.deleteEdgeByTarget(n)},r.prototype.getNodeEdges=function(t){return this.graphModel.getNodeEdges(t)},r.prototype.addElements=function(t,e){var n=this,o=t.nodes,i=t.edges;e===void 0&&(e=40),console.log("distance",e);var a={},s={nodes:[],edges:[]};return ut(o,function(l){var u=l.id,f=n.addNode(l);u&&(a[u]=f.id),s.nodes.push(f)}),ut(i,function(l){var u=l.sourceNodeId,f=l.targetNodeId;a[u]&&(u=a[u]),a[f]&&(f=a[f]);var c=n.graphModel.addEdge(me(me({},l),{sourceNodeId:u,targetNodeId:f}));s.edges.push(c)}),s},r.prototype.selectElementById=function(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),this.graphModel.selectElementById(t,e),!e&&n&&this.graphModel.toFront(t)},r.prototype.getSelectElements=function(t){return t===void 0&&(t=!0),this.graphModel.getSelectElements(t)},r.prototype.clearSelectElements=function(){this.graphModel.clearSelectElements()},r.prototype.getModelById=function(t){return this.graphModel.getElement(t)},r.prototype.getDataById=function(t){var e;return(e=this.graphModel.getElement(t))===null||e===void 0?void 0:e.getData()},r.prototype.deleteElement=function(t){var e,n,o,i=this.getModelById(t);if(!i)return!1;var a=(e={},e[st.NODE]=this.deleteNode,e[st.EDGE]=this.deleteEdge,e);return(o=(n=a[i.BaseType])===null||n===void 0?void 0:n.call(this,t))!==null&&o!==void 0?o:!1},r.prototype.setElementZIndex=function(t,e){return this.graphModel.setElementZIndex(t,e)},r.prototype.getAreaElement=function(t,e,n,o,i){return n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=!1),this.graphModel.getAreaElement(t,e,n,o,i).map(function(a){return a.getData()})},r.prototype.setProperties=function(t,e){var n;(n=this.graphModel.getElement(t))===null||n===void 0||n.setProperties(Ot(e))},r.prototype.getProperties=function(t){var e;return(e=this.graphModel.getElement(t))===null||e===void 0?void 0:e.getProperties()},r.prototype.deleteProperty=function(t,e){var n;(n=this.graphModel.getElement(t))===null||n===void 0||n.deleteProperty(e)},r.prototype.updateAttributes=function(t,e){this.graphModel.updateAttributes(t,e)},r.prototype.editText=function(t){this.graphModel.editText(t)},r.prototype.updateText=function(t,e){this.graphModel.updateText(t,e)},r.prototype.updateEditConfig=function(t){var e=this.graphModel,n=e.editConfigModel,o=e.transformModel;n.updateEditConfig(t),(t==null?void 0:t.stopMoveGraph)!==void 0&&o.updateTranslateLimits(t.stopMoveGraph),t!=null&&t.isSilentMode?this.keyboard.disable():this.keyboard.enable(!0)},r.prototype.getEditConfig=function(){return this.graphModel.editConfigModel.getConfig()},r.prototype.setTheme=function(t){this.graphModel.setTheme(t)},r.prototype.focusByElement=function(t){var e=void 0,n=this.getNodeModelById(t);if(n){var o=n.getData(),i=o.x,a=o.y;e={x:i,y:a}}var s=this.getEdgeModelById(t);if(s){var l=s.textPosition,i=l.x,a=l.y;e={x:i,y:a}}e&&this.focusByCoordinate(e)},r.prototype.focusByCoordinate=function(t){var e=this.graphModel,n=e.transformModel,o=e.width,i=e.height,a=t.x,s=t.y;n.focusOn(a,s,o,i)},r.prototype.focusOn=function(t){if(typeof t=="string")this.focusByElement(t);else if("x"in t&&"y"in t)this.focusByCoordinate(t);else{var e=t.id,n=t.coordinate;e&&this.focusByElement(e),n&&this.focusByCoordinate(n)}},r.prototype.resize=function(t,e){this.graphModel.resize(t,e),this.options.width=this.graphModel.width,this.options.height=this.graphModel.height},r.prototype.toFront=function(t){this.graphModel.toFront(t)},r.prototype.getPointByClient=function(t,e){if(typeof t=="object")return this.graphModel.getPointByClient(t);if(typeof e=="number")return this.graphModel.getPointByClient({x:t,y:e})},r.prototype.getGraphData=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.getGraphRawData();return this.adapterOut?this.adapterOut.apply(this,xo([n],gn(t),!1)):n},r.prototype.getGraphRawData=function(){return this.graphModel.modelToGraphData()},r.prototype.clearData=function(){this.graphModel.clearData()},r.prototype.renderRawData=function(t){this.graphModel.graphDataToModel(Ot(t)),this.options.history!==!1&&this.history.watch(this.graphModel),Nf(x(ih,{getView:this.getView,tool:this.tool,options:this.options,dnd:this.dnd,snaplineModel:this.snaplineModel,graphModel:this.graphModel}),this.container),this.emit(C.GRAPH_RENDERED,{data:this.graphModel.modelToGraphData(),graphModel:this.graphModel})},r.prototype.render=function(t){var e=Y(t);this.adapterIn&&(e=this.adapterIn(e)),this.renderRawData(e)},r.prototype.undo=function(){if(!!this.history.undoAble()){var t=Ot(this.history.undo());this.clearSelectElements(),this.graphModel.graphDataToModel(t)}},r.prototype.redo=function(){if(!!this.history.redoAble()){var t=Ot(this.history.redo());this.clearSelectElements(),this.graphModel.graphDataToModel(t)}},r.prototype.zoom=function(t,e){var n=this.graphModel.transformModel;return n.zoom(t,e)},r.prototype.resetZoom=function(){var t=this.graphModel.transformModel;t.resetZoom()},r.prototype.setZoomMiniSize=function(t){var e=this.graphModel.transformModel;e.setZoomMiniSize(t)},r.prototype.setZoomMaxSize=function(t){var e=this.graphModel.transformModel;e.setZoomMaxSize(t)},r.prototype.getTransform=function(){var t=this.graphModel.transformModel,e=t.SCALE_X,n=t.SCALE_Y,o=t.TRANSLATE_X,i=t.TRANSLATE_Y;return{SCALE_X:e,SCALE_Y:n,TRANSLATE_X:o,TRANSLATE_Y:i}},r.prototype.translate=function(t,e){var n=this.graphModel.transformModel;n.translate(t,e)},r.prototype.resetTranslate=function(){var t=this.graphModel.transformModel,e=t.TRANSLATE_X,n=t.TRANSLATE_Y;this.translate(-e,-n)},r.prototype.translateCenter=function(){this.graphModel.translateCenter()},r.prototype.fitView=function(t,e){e===void 0&&(e=t),this.graphModel.fitView(t,e)},r.prototype.openEdgeAnimation=function(t){this.graphModel.openEdgeAnimation(t)},r.prototype.closeEdgeAnimation=function(t){this.graphModel.closeEdgeAnimation(t)},r.prototype.on=function(t,e){this.graphModel.eventCenter.on(t,e)},r.prototype.off=function(t,e){this.graphModel.eventCenter.off(t,e)},r.prototype.once=function(t,e){this.graphModel.eventCenter.once(t,e)},r.prototype.emit=function(t,e){this.graphModel.eventCenter.emit(t,e)},r.use=function(t,e){var n,o=t.pluginName;if(!o)throw new Error("\u8BF7\u7ED9\u63D2\u4EF6\u6307\u5B9A pluginName!");this.extensions.set(o,(n={},n[Eo]=Eo,n.extension=t,n.props=e,n))},r.prototype.installPlugins=function(t){var e=this;t===void 0&&(t=[]);var n=Array.from(r.extensions,function(i){var a=gn(i,2),s=a[1];return s}),o=xo(xo([],gn(this.plugins),!1),gn(n),!1);ut(o,function(i){var a,s;Eo in i?(a=i.extension,s=i.props):a=i;var l=a==null?void 0:a.pluginName;Lu(t,l)===-1&&e.installPlugin(a,s)})},r.prototype.installPlugin=function(t,e){var n,o;if("pluginName"in t&&"install"in t){var i=t.pluginName,a=t.install,s=t.render;i&&(a&&a.call(t,this,r),s&&this.components.push(s.bind(t)),this.extension[i]=t);return}var l=t,u=l.pluginName,f=new l({lf:this,LogicFlow:r,props:e,options:(o=(n=this.options.pluginsOptions)===null||n===void 0?void 0:n[u])!==null&&o!==void 0?o:{}});f.render&&this.components.push(f.render.bind(f)),this.extension[u]=f},r.prototype.destroy=function(){this.graphModel.destroy()},r.extensions=new Map,r}();(function(r){r.toStringTag="LF.".concat(r.name)})(di||(di={}));var sv=di;function Ct(r){return Ni(r)}const _s={start:{background:"#e5fff5",border:"#a2e9d6"},process:{background:"#d1e9ff",border:"#afcaff"},end:{background:"#e7faf0",border:"rgb(19, 206, 102)"}},lv=100,uv=260,cv=40,fv=80;var nt=(r=>(r.PRODUCT_ADJUST="\u5546\u54C1ID :",r.PRODUCT="\u5546\u54C1ID:",r.IN="\u5165\u5E93ID:",r.OUT="\u51FA\u5E93ID:",r.PROVISION="\u8BA1\u63D0\u5F85\u5904\u7406ID:",r.ADJUST="\u8C03\u6574\u5355ID:",r.CHECK="\u76D8\u70B9ID:",r))(nt||{});const dv={["\u5546\u54C1ID:"]:"/invoiceInOut/productManagerDetail",["\u8BA1\u63D0\u5F85\u5904\u7406ID:"]:"/invoiceInOut/provisionOutDetail",["\u8C03\u6574\u5355ID:"]:"/invoiceInOut/adjustOrderDetail",["\u5546\u54C1ID :"]:"/invoiceInOut/productManagerDetail"};function Lt(r,t,e,n){return{id:t+r,type:"StartTask",x:lv+e*uv,y:cv+n*fv,text:t+r}}function he(r,t,e="dashe-edge"){return{sourceNodeId:r,targetNodeId:t,isHitable:!1,type:e}}const{VITE_PROXY_DOMAIN_REAL:Mv,VITE_PROXY_USER_REAL:Av,VITE_WORKORDER_REAL:pv}=cu(),oo=pv,hv=r=>$n.request("post",`${oo}/cxinv/FinancialManager/info`,{data:r}),ms=r=>$n.request("post",`${oo}/cxinv/adjust/info`,{data:r}),vv=r=>$n.request("post",`${oo}/cxinv/FinancialProducts/CheckInfo`,{data:r}),yv=r=>$n.request("post",`${oo}/cxinv//FinancialManager/CheckInfo`,{data:r});class gv extends qo{initNodeData(t){super.initNodeData(t),this.height=30}getNodeStyle(){const t=super.getNodeStyle();return t.fill=_s.start.background,t.stroke=_s.start.border,t.strokeWidth=.5,t.cursor="pointer",t}}class _v extends ri{}var mv={type:"StartTask",model:gv,view:_v};class bv extends Zo{initEdgeData(t){super.initEdgeData(t),this.customTextPosition=!0,this.zIndex=-1}getEdgeStyle(){const t=super.getEdgeStyle();return t.stroke="#000",t.strokeDasharray="5 5",t.strokeWidth=1,t}}class xv extends ci{}var Ev={type:"dashe-edge",model:bv,view:xv};const Ov={class:"mine-flow-container"},Tv=fu({__name:"index",props:{id:{type:String,required:!1},mode:{type:String,required:!0}},setup(r){const t=Ii(null),e=Ii(null),n=r,o=du();function i(){e.value=new sv({container:t.value,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!0,isSilentMode:!0,grid:{size:18,type:"mesh",visible:!0,config:{thickness:1,color:"#ccc"}},textEdit:!1})}pu(()=>{i(),e.value.register(mv),e.value.register(Ev),e.value.on("node:click",({data:c})=>{const[d,p]=((c==null?void 0:c.id)||"").split(":"),y=dv[d+":"];o.push(y+"?id="+p)})});async function a(c,d,p,y){var w,S,M,m,T,P,A,I,B,U,F,lt,pt,St;const h=[Lt(c,d,p,y)],g=[],v=await hv({id:c});(((w=v.data)==null?void 0:w.ProductRela)||[]).forEach((yt,ct)=>{h.push(Lt(yt.product_id,nt.PRODUCT,1,ct)),g.push(he(d+c,nt.PRODUCT+yt.product_id,ct==0?"line":"bezier"))});const _=(S=v.data)==null?void 0:S.ProductRela.findIndex(yt=>yt.is_check===1);_>=0&&(h.push(Lt((m=(M=v.data)==null?void 0:M.FinancialTz)==null?void 0:m.id,nt.PROVISION,2,0)),g.push(he(nt.PRODUCT+((P=(T=v.data)==null?void 0:T.ProductRela[_])==null?void 0:P.product_id),nt.PROVISION+((I=(A=v.data)==null?void 0:A.FinancialTz)==null?void 0:I.id),_==0?"line":"bezier")));const O=await ms({id:(U=(B=v.data)==null?void 0:B.FinancialTz)==null?void 0:U.id});if(((F=O.data)==null?void 0:F.FinancialCheck)&&O.data.FinancialCheck.id){h.push(Lt(O.data.FinancialCheck.id,nt.ADJUST,3,0)),g.push(he(nt.PROVISION+((pt=(lt=v.data)==null?void 0:lt.FinancialTz)==null?void 0:pt.id),nt.ADJUST+O.data.FinancialCheck.id,"dashe-edge"));const yt=(((St=O.data)==null?void 0:St.ProductTz)||[]).find(ct=>ct.type==2);yt&&(h.push(Lt(yt.product_id,nt.PRODUCT_ADJUST,4,0)),g.push(he(nt.ADJUST+O.data.FinancialCheck.id,nt.PRODUCT_ADJUST+yt.product_id,"line")))}return{nodes:h,edges:g}}async function s(c,d,p,y){var _;const h=[Lt(c,d,p,y)],g=[],v=await ms({id:c});if(v.data.FinancialCheck&&v.data.FinancialCheck.id){h.push(Lt(v.data.FinancialCheck.id,nt.ADJUST,1,0)),g.push(he(nt.PROVISION+c,nt.ADJUST+v.data.FinancialCheck.id,"dashe-edge"));const O=(((_=v.data)==null?void 0:_.ProductTz)||[]).find(w=>w.type==2);O&&(h.push(Lt(O.product_id,nt.PRODUCT_ADJUST,2,0)),g.push(he(nt.ADJUST+v.data.FinancialCheck.id,nt.PRODUCT_ADJUST+O.product_id,"line")))}return{nodes:h,edges:g}}async function l(c,d,p,y){var _,O,w,S,M,m;const h=await vv({id:c}),g=[Lt((_=h.data)==null?void 0:_.id,d,0,0),Lt((w=(O=h.data)==null?void 0:O.product)==null?void 0:w.id,nt.PRODUCT,1,0)],v=[he(d+((S=h.data)==null?void 0:S.id),nt.PRODUCT+((m=(M=h.data)==null?void 0:M.product)==null?void 0:m.id),"line")];return{nodes:g,edges:v}}async function u(c,d,p,y){var O,w,S;const h=await yv({id:c}),g=[Lt((O=h.data)==null?void 0:O.id,d,0,0)],v=[],_=(((S=(w=h.data)==null?void 0:w.FinancialTz)==null?void 0:S.ProductTz)||[]).find(M=>M.type==2);return _&&(g.push(Lt(_.product_id,nt.PRODUCT_ADJUST,1,0)),v.push(he(nt.ADJUST+c,nt.PRODUCT_ADJUST+_.product_id,"line"))),{nodes:g,edges:v}}async function f(c,d,p=0,y=0){switch(d){case nt.IN:case nt.OUT:return a(c,d,p,y);case nt.PROVISION:return s(c,d,p,y);case nt.CHECK:return l(c,d);case nt.ADJUST:return u(c,d)}}return hu(()=>[n,e.value],async()=>{if(!n.mode||!n.id||!e.value)return;let c=null;c=await f(n.id,n.mode),c&&vu(()=>e.value.render(c))},{immediate:!0,deep:!0}),(c,d)=>(yu(),gu("div",Ov,[_u("div",{class:"lf",ref_key:"container",ref:t},null,512)]))}});var Pv=mu(Tv,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/components/MineFlowChart/index.vue"]]);export{Pv as F,nt as M};
|