| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import{r as Nl,ak as Cl,d as ps,l as Dn,E as jl,F as Rl,R as Ll}from"./vue-vendor-Be68asQ6.js";import{bw as Q,h as X,v as ii,aC as Wo,bx as rr,p as Ge,by as at,bz as me,bA as Ne,bB as le,bC as We,bD as _t,s as Il,bE as kl,bF as Mi,bG as _r,bH as Bl,al as ds,aB as Xl,bI as Hl,ak as Ai,bJ as zl,bK as fs,bL as Gl,bM as Yl,q as Ul}from"./antd-vue-vendor-DcqS7Wvq.js";import{l as hs}from"./_commonjsHelpers-ce4d82cc-RqGMvybJ.js";var Vl={},Fo,H,ys,Ee,Pi,gs,vs,ms,ai,br,xr,Nn={},_s=[],Wl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zn=Array.isArray;function ae(n,t){for(var e in t)n[e]=t[e];return n}function si(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Fe(n,t,e){var o,r,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Fo.call(arguments,2):e),typeof n=="function"&&n.defaultProps!=null)for(i in n.defaultProps)a[i]===void 0&&(a[i]=n.defaultProps[i]);return vo(n,a,o,r,null)}function vo(n,t,e,o,r){var i={type:n,props:t,key:e,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++ys:r,__i:-1,__u:0};return r==null&&H.vnode!=null&&H.vnode(i),i}function Ko(){return{current:null}}function Ke(n){return n.children}function Y(n,t){this.props=n,this.context=t}function Ze(n,t){if(t==null)return n.__?Ze(n.__,n.__i+1):null;for(var e;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null)return e.__e;return typeof n.type=="function"?Ze(n):null}function bs(n){var t,e;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,t=0;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null){n.__e=n.__c.base=e.__e;break}return bs(n)}}function Di(n){(!n.__d&&(n.__d=!0)&&Ee.push(n)&&!xo.__r++||Pi!==H.debounceRendering)&&((Pi=H.debounceRendering)||gs)(xo)}function xo(){for(var n,t,e,o,r,i,a,s=1;Ee.length;)Ee.length>s&&Ee.sort(vs),n=Ee.shift(),s=Ee.length,n.__d&&(e=void 0,r=(o=(t=n).__v).__e,i=[],a=[],t.__P&&((e=ae({},o)).__v=o.__v+1,H.vnode&&H.vnode(e),li(t.__P,e,o,t.__n,t.__P.namespaceURI,32&o.__u?[r]:null,i,r==null?Ze(o):r,!!(32&o.__u),a),e.__v=o.__v,e.__.__k[e.__i]=e,Ts(i,e,a),e.__e!=r&&bs(e)));xo.__r=0}function xs(n,t,e,o,r,i,a,s,l,u,p){var c,d,f,y,h,v,g=o&&o.__k||_s,m=t.length;for(l=Fl(e,t,g,l,m),c=0;c<m;c++)(f=e.__k[c])!=null&&(d=f.__i===-1?Nn:g[f.__i]||Nn,f.__i=c,v=li(n,f,d,r,i,a,s,l,u,p),y=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&ui(d.ref,null,f),p.push(f.ref,f.__c||y,f)),h==null&&y!=null&&(h=y),4&f.__u||d.__k===f.__k?l=Es(f,l,n):typeof f.type=="function"&&v!==void 0?l=v:y&&(l=y.nextSibling),f.__u&=-7);return e.__e=h,l}function Fl(n,t,e,o,r){var i,a,s,l,u,p=e.length,c=p,d=0;for(n.__k=new Array(r),i=0;i<r;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=i+d,(a=n.__k[i]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?vo(null,a,null,null,null):zn(a)?vo(Ke,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?vo(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=n,a.__b=n.__b+1,s=null,(u=a.__i=Kl(a,e,l,c))!==-1&&(c--,(s=e[u])&&(s.__u|=2)),s==null||s.__v===null?(u==-1&&(r>p?d--:r<p&&d++),typeof a.type!="function"&&(a.__u|=4)):u!=l&&(u==l-1?d--:u==l+1?d++:(u>l?d--:d++,a.__u|=4))):n.__k[i]=null;if(c)for(i=0;i<p;i++)(s=e[i])!=null&&!(2&s.__u)&&(s.__e==o&&(o=Ze(s)),ws(s,s));return o}function Es(n,t,e){var o,r;if(typeof n.type=="function"){for(o=n.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=n,t=Es(o[r],t,e));return t}n.__e!=t&&(t&&n.type&&!e.contains(t)&&(t=Ze(n)),e.insertBefore(n.__e,t||null),t=n.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Eo(n,t){return t=t||[],n==null||typeof n=="boolean"||(zn(n)?n.some(function(e){Eo(e,t)}):t.push(n)),t}function Kl(n,t,e,o){var r,i,a=n.key,s=n.type,l=t[e];if(l===null&&n.key==null||l&&a==l.key&&s===l.type&&!(2&l.__u))return e;if(o>(l!=null&&!(2&l.__u)?1:0))for(r=e-1,i=e+1;r>=0||i<t.length;){if(r>=0){if((l=t[r])&&!(2&l.__u)&&a==l.key&&s===l.type)return r;r--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&a==l.key&&s===l.type)return i;i++}}return-1}function Ni(n,t,e){t[0]=="-"?n.setProperty(t,e==null?"":e):n[t]=e==null?"":typeof e!="number"||Wl.test(t)?e:e+"px"}function Kn(n,t,e,o,r){var i;t:if(t=="style")if(typeof e=="string")n.style.cssText=e;else{if(typeof o=="string"&&(n.style.cssText=o=""),o)for(t in o)e&&t in e||Ni(n.style,t,"");if(e)for(t in e)o&&e[t]===o[t]||Ni(n.style,t,e[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ms,"$1")),t=t.toLowerCase()in n||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),n.l||(n.l={}),n.l[t+i]=e,e?o?e.t=o.t:(e.t=ai,n.addEventListener(t,i?xr:br,i)):n.removeEventListener(t,i?xr:br,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in n)try{n[t]=e==null?"":e;break t}catch(a){}typeof e=="function"||(e==null||e===!1&&t[4]!="-"?n.removeAttribute(t):n.setAttribute(t,t=="popover"&&e==1?"":e))}}function Ci(n){return function(t){if(this.l){var e=this.l[t.type+n];if(t.u==null)t.u=ai++;else if(t.u<e.t)return;return e(H.event?H.event(t):t)}}}function li(n,t,e,o,r,i,a,s,l,u){var p,c,d,f,y,h,v,g,m,O,S,w,M,_,T,A,P,k=t.type;if(t.constructor!==void 0)return null;128&e.__u&&(l=!!(32&e.__u),i=[s=t.__e=e.__e]),(p=H.__b)&&p(t);t:if(typeof k=="function")try{if(g=t.props,m="prototype"in k&&k.prototype.render,O=(p=k.contextType)&&o[p.__c],S=p?O?O.props.value:p.__:o,e.__c?v=(c=t.__c=e.__c).__=c.__E:(m?t.__c=c=new k(g,S):(t.__c=c=new Y(g,S),c.constructor=k,c.render=ql),O&&O.sub(c),c.props=g,c.state||(c.state={}),c.context=S,c.__n=o,d=c.__d=!0,c.__h=[],c._sb=[]),m&&c.__s==null&&(c.__s=c.state),m&&k.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ae({},c.__s)),ae(c.__s,k.getDerivedStateFromProps(g,c.__s))),f=c.props,y=c.state,c.__v=t,d)m&&k.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),m&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(m&&k.getDerivedStateFromProps==null&&g!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,S),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,S)===!1||t.__v==e.__v)){for(t.__v!=e.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(I){I&&(I.__=t)}),w=0;w<c._sb.length;w++)c.__h.push(c._sb[w]);c._sb=[],c.__h.length&&a.push(c);break t}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,S),m&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,y,h)})}if(c.context=S,c.props=g,c.__P=n,c.__e=!1,M=H.__r,_=0,m){for(c.state=c.__s,c.__d=!1,M&&M(t),p=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),p=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++_<25);c.state=c.__s,c.getChildContext!=null&&(o=ae(ae({},o),c.getChildContext())),m&&!d&&c.getSnapshotBeforeUpdate!=null&&(h=c.getSnapshotBeforeUpdate(f,y)),A=p,p!=null&&p.type===Ke&&p.key==null&&(A=Os(p.props.children)),s=xs(n,zn(A)?A:[A],t,e,o,r,i,a,s,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&a.push(c),v&&(c.__E=c.__=null)}catch(I){if(t.__v=null,l||i!=null)if(I.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else for(P=i.length;P--;)si(i[P]);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):s=t.__e=Zl(e.__e,t,e,o,r,i,a,l,u);return(p=H.diffed)&&p(t),128&t.__u?void 0:s}function Ts(n,t,e){for(var o=0;o<e.length;o++)ui(e[o],e[++o],e[++o]);H.__c&&H.__c(t,n),n.some(function(r){try{n=r.__h,r.__h=[],n.some(function(i){i.call(r)})}catch(i){H.__e(i,r.__v)}})}function Os(n){return typeof n!="object"||n==null?n:zn(n)?n.map(Os):ae({},n)}function Zl(n,t,e,o,r,i,a,s,l){var u,p,c,d,f,y,h,v=e.props,g=t.props,m=t.type;if(m=="svg"?r="http://www.w3.org/2000/svg":m=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((f=i[u])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){n=f,i[u]=null;break}}if(n==null){if(m==null)return document.createTextNode(g);n=document.createElementNS(r,m,g.is&&g),s&&(H.__m&&H.__m(t,i),s=!1),i=null}if(m===null)v===g||s&&n.data===g||(n.data=g);else{if(i=i&&Fo.call(n.childNodes),v=e.props||Nn,!s&&i!=null)for(v={},u=0;u<n.attributes.length;u++)v[(f=n.attributes[u]).name]=f.value;for(u in v)if(f=v[u],u!="children"){if(u=="dangerouslySetInnerHTML")c=f;else if(!(u in g)){if(u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g)continue;Kn(n,u,null,f,r)}}for(u in g)f=g[u],u=="children"?d=f:u=="dangerouslySetInnerHTML"?p=f:u=="value"?y=f:u=="checked"?h=f:s&&typeof f!="function"||v[u]===f||Kn(n,u,f,v[u],r);if(p)s||c&&(p.__html===c.__html||p.__html===n.innerHTML)||(n.innerHTML=p.__html),t.__k=[];else if(c&&(n.innerHTML=""),xs(t.type==="template"?n.content:n,zn(d)?d:[d],t,e,o,m=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,a,i?i[0]:e.__k&&Ze(e,0),s,l),i!=null)for(u=i.length;u--;)si(i[u]);s||(u="value",m=="progress"&&y==null?n.removeAttribute("value"):y!==void 0&&(y!==n[u]||m=="progress"&&!y||m=="option"&&y!==v[u])&&Kn(n,u,y,v[u],r),u="checked",h!==void 0&&h!==n[u]&&Kn(n,u,h,v[u],r))}return n}function ui(n,t,e){try{if(typeof n=="function"){var o=typeof n.__u=="function";o&&n.__u(),o&&t==null||(n.__u=n(t))}else n.current=t}catch(r){H.__e(r,e)}}function ws(n,t,e){var o,r;if(H.unmount&&H.unmount(n),(o=n.ref)&&(o.current&&o.current!==n.__e||ui(o,null,t)),(o=n.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){H.__e(i,t)}o.base=o.__P=null}if(o=n.__k)for(r=0;r<o.length;r++)o[r]&&ws(o[r],t,e||typeof n.type!="function");e||si(n.__e),n.__c=n.__=n.__e=void 0}function ql(n,t,e){return this.constructor(n,e)}function Jl(n,t,e){var o,r,i,a;t==document&&(t=document.documentElement),H.__&&H.__(n,t),r=(o=typeof e=="function")?null:e&&e.__k||t.__k,i=[],a=[],li(t,n=(!o&&e||t).__k=Fe(Ke,null,[n]),r||Nn,Nn,t.namespaceURI,!o&&e?[e]:r?null:t.firstChild?Fo.call(t.childNodes):null,i,!o&&e?e:r?r.__e:t.firstChild,o,a),Ts(i,n,a)}Fo=_s.slice,H={__e:function(n,t,e,o){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(n)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(n,o||{}),a=r.__d),a)return r.__E=r}catch(s){n=s}throw n}},ys=0,Y.prototype.setState=function(n,t){var e;e=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ae({},this.state),typeof n=="function"&&(n=n(ae({},e),this.props)),n&&ae(e,n),n!=null&&this.__v&&(t&&this._sb.push(t),Di(this))},Y.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Di(this))},Y.prototype.render=Ke,Ee=[],gs=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,vs=function(n,t){return n.__v.__b-t.__v.__b},xo.__r=0,ms=/(PointerCapture)$|Capture$/i,ai=0,br=Ci(!1),xr=Ci(!0);var $l="An invariant failed, however the error is obfuscated because this is a production build.",To=[];Object.freeze(To);var ci={};Object.freeze(ci);function bt(){return++N.mobxGuid}function K(n){throw Me(!1,n),"X"}function Me(n,t){if(!n)throw new Error("[mobx] "+(t||$l))}function Ql(n,t){return!1}function Ss(n){var t=!1;return function(){if(!t)return t=!0,n.apply(this,arguments)}}var Zn=function(){};function tu(n){var t=[];return n.forEach(function(e){t.indexOf(e)===-1&&t.push(e)}),t}function pi(n){return n!==null&&typeof n=="object"}function an(n){if(n===null||typeof n!="object")return!1;var t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}function eu(n){if(ln(n)||xt(n))return n;if(Array.isArray(n))return new Map(n);if(an(n)){var t=new Map;for(var e in n)t.set(e,n[e]);return t}else return K("Cannot convert to map from '"+n+"'")}function sn(n,t,e){Object.defineProperty(n,t,{enumerable:!1,writable:!0,configurable:!0,value:e})}function nu(n,t,e){Object.defineProperty(n,t,{enumerable:!1,writable:!1,configurable:!0,value:e})}function ou(n,t){var e=Object.getOwnPropertyDescriptor(n,t);return!e||e.configurable!==!1&&e.writable!==!1}function _e(n,t){var e="isMobX"+n;return t.prototype[e]=!0,function(o){return pi(o)&&o[e]===!0}}function ln(n){return n instanceof Map}function Gn(n){return n instanceof Set}function Ms(n){var t=new Set;for(var e in n)t.add(e);return Object.getOwnPropertySymbols(n).forEach(function(o){Object.getOwnPropertyDescriptor(n,o).enumerable&&t.add(o)}),Array.from(t)}function ye(n){return n&&n.toString?n.toString():new String(n).toString()}function As(n){return n===null?null:typeof n=="object"?""+n:n}var ru=typeof Reflect!="undefined"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,L=Symbol("mobx administration"),un=function(){function n(t){t===void 0&&(t="Atom@"+bt()),this.name=t,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=q.NOT_TRACKING}return n.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach(function(t){return t()})},n.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach(function(t){return t()})},n.prototype.reportObserved=function(){return Xs(this)},n.prototype.reportChanged=function(){zt(),Au(this),Gt()},n.prototype.toString=function(){return this.name},n}(),di=_e("Atom",un);function fi(n,t,e){t===void 0&&(t=Zn),e===void 0&&(e=Zn);var o=new un(n);return t!==Zn&&Yu(o,t),e!==Zn&&Vs(o,e),o}function iu(n,t){return n===t}function au(n,t){return xi(n,t)}function su(n,t){return xi(n,t,1)}function lu(n,t){return Object.is(n,t)}var qe={identity:iu,structural:au,default:lu,shallow:su};/*! *****************************************************************************
- 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 Er=function(n,t){return Er=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])},Er(n,t)};function uu(n,t){Er(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Oo=function(){return Oo=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Oo.apply(this,arguments)};function qt(n){var t=typeof Symbol=="function"&&n[Symbol.iterator],e=0;return t?t.call(n):{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}}}function Ye(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i}function hi(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(Ye(arguments[t]));return n}var wo=Symbol("mobx did run lazy initializers"),hn=Symbol("mobx pending decorators"),cu={},pu={};function du(n,t){var e=t?cu:pu;return e[n]||(e[n]={configurable:!0,enumerable:t,get:function(){return Ce(this),this[n]},set:function(o){Ce(this),this[n]=o}})}function Ce(n){var t,e;if(n[wo]!==!0){var o=n[hn];if(o){sn(n,wo,!0);var r=hi(Object.getOwnPropertySymbols(o),Object.keys(o));try{for(var i=qt(r),a=i.next();!a.done;a=i.next()){var s=a.value,l=o[s];l.propertyCreator(n,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 Ps(n,t){return function(){var e,o=function(r,i,a,s){if(s===!0)return t(r,i,a,r,e),null;if(!Object.prototype.hasOwnProperty.call(r,hn)){var l=r[hn];sn(r,hn,Oo({},l))}return r[hn][i]={prop:i,propertyCreator:t,descriptor:a,decoratorTarget:r,decoratorArguments:e},du(i,n)};return fu(arguments)?(e=To,o.apply(null,arguments)):(e=Array.prototype.slice.call(arguments),o)}}function fu(n){return(n.length===2||n.length===3)&&(typeof n[1]=="string"||typeof n[1]=="symbol")||n.length===4&&n[3]===!0}function Yn(n,t,e){return tn(n)?n:Array.isArray(n)?x.array(n,{name:e}):an(n)?x.object(n,void 0,{name:e}):ln(n)?x.map(n,{name:e}):Gn(n)?x.set(n,{name:e}):n}function hu(n,t,e){return n==null||Nt(n)||ee(n)||xt(n)||Dt(n)?n:Array.isArray(n)?x.array(n,{name:e,deep:!1}):an(n)?x.object(n,void 0,{name:e,deep:!1}):ln(n)?x.map(n,{name:e,deep:!1}):Gn(n)?x.set(n,{name:e,deep:!1}):K(!1)}function Zo(n){return n}function yu(n,t,e){return xi(n,t)?t:n}function qo(n){Me(n);var t=Ps(!0,function(o,r,i,a,s){var l=i?i.initializer?i.initializer.call(o):i.value:void 0;bi(o).addObservableProp(r,l,n)}),e=t;return e.enhancer=n,e}var Ds={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Ds);function ze(n){return n==null?Ds:typeof n=="string"?{name:n,deep:!0,proxy:!0}:n}var yi=qo(Yn),gu=qo(hu),Ns=qo(Zo),vu=qo(yu);function qn(n){return n.defaultDecorator?n.defaultDecorator.enhancer:n.deep===!1?Zo:Yn}function mu(n,t,e){if(typeof arguments[1]=="string"||typeof arguments[1]=="symbol")return yi.apply(null,arguments);if(tn(n))return n;var o=an(n)?x.object(n,t,e):Array.isArray(n)?x.array(n,t):ln(n)?x.map(n,t):Gn(n)?x.set(n,t):n;if(o!==n)return o;K(!1)}var ji={box:function(n,t){arguments.length>2&&pn("box");var e=ze(t);return new Pe(n,qn(e),e.name,!0,e.equals)},array:function(n,t){arguments.length>2&&pn("array");var e=ze(t);return ic(n,qn(e),e.name)},map:function(n,t){arguments.length>2&&pn("map");var e=ze(t);return new _i(n,qn(e),e.name)},set:function(n,t){arguments.length>2&&pn("set");var e=ze(t);return new Qs(n,qn(e),e.name)},object:function(n,t,e){typeof arguments[1]=="string"&&pn("object");var o=ze(e);if(o.proxy===!1)return Ar({},n,t,o);var r=Fs(o),i=Ar({},void 0,void 0,o),a=nc(i);return Ks(a,n,t,r),a},ref:Ns,shallow:gu,deep:yi,struct:vu},x=mu;Object.keys(ji).forEach(function(n){return x[n]=ji[n]});function pn(n){K("Expected one or two arguments to observable."+n+". Did you accidentally try to use observable."+n+" as decorator?")}var gi=Ps(!1,function(n,t,e,o,r){var i=e.get,a=e.set,s=r[0]||{};bi(n).addComputedProp(n,t,Oo({get:i,set:a,context:n},s))}),_u=gi({equals:qe.structural}),tt=function(n,t,e){if(typeof t=="string"||n!==null&&typeof n=="object"&&arguments.length===1)return gi.apply(null,arguments);var o=typeof t=="object"?t:{};return o.get=n,o.set=typeof t=="function"?t:o.set,o.name=o.name||n.name||"",new $e(o)};tt.struct=_u;var q;(function(n){n[n.NOT_TRACKING=-1]="NOT_TRACKING",n[n.UP_TO_DATE=0]="UP_TO_DATE",n[n.POSSIBLY_STALE=1]="POSSIBLY_STALE",n[n.STALE=2]="STALE"})(q||(q={}));var $t;(function(n){n[n.NONE=0]="NONE",n[n.LOG=1]="LOG",n[n.BREAK=2]="BREAK"})($t||($t={}));var So=function(){function n(t){this.cause=t}return n}();function yn(n){return n instanceof So}function Tr(n){switch(n.dependenciesState){case q.UP_TO_DATE:return!1;case q.NOT_TRACKING:case q.STALE:return!0;case q.POSSIBLY_STALE:{for(var t=vi(!0),e=cn(),o=n.observing,r=o.length,i=0;i<r;i++){var a=o[i];if(Qe(a)){if(N.disableErrorBoundaries)a.get();else try{a.get()}catch(s){return ve(e),mn(t),!0}if(n.dependenciesState===q.STALE)return ve(e),mn(t),!0}}return Rs(n),ve(e),mn(t),!1}}}function Je(n){var t=n.observers.size>0;N.computationDepth>0&&t&&K(!1),!N.allowStateChanges&&(t||N.enforceActions==="strict")&&K(!1)}function Cs(n,t,e){var o=vi(!0);Rs(n),n.newObserving=new Array(n.observing.length+100),n.unboundDepsCount=0,n.runId=++N.runId;var r=N.trackingDerivation;N.trackingDerivation=n;var i;if(N.disableErrorBoundaries===!0)i=t.call(e);else try{i=t.call(e)}catch(a){i=new So(a)}return N.trackingDerivation=r,bu(n),mn(o),i}function bu(n){for(var t=n.observing,e=n.observing=n.newObserving,o=q.UP_TO_DATE,r=0,i=n.unboundDepsCount,a=0;a<i;a++){var s=e[a];s.diffValue===0&&(s.diffValue=1,r!==a&&(e[r]=s),r++),s.dependenciesState>o&&(o=s.dependenciesState)}for(e.length=r,n.newObserving=null,i=t.length;i--;){var s=t[i];s.diffValue===0&&ks(s,n),s.diffValue=0}for(;r--;){var s=e[r];s.diffValue===1&&(s.diffValue=0,Mu(s,n))}o!==q.UP_TO_DATE&&(n.dependenciesState=o,n.onBecomeStale())}function Or(n){var t=n.observing;n.observing=[];for(var e=t.length;e--;)ks(t[e],n);n.dependenciesState=q.NOT_TRACKING}function js(n){var t=cn();try{return n()}finally{ve(t)}}function cn(){var n=N.trackingDerivation;return N.trackingDerivation=null,n}function ve(n){N.trackingDerivation=n}function vi(n){var t=N.allowStateReads;return N.allowStateReads=n,t}function mn(n){N.allowStateReads=n}function Rs(n){if(n.dependenciesState!==q.UP_TO_DATE){n.dependenciesState=q.UP_TO_DATE;for(var t=n.observing,e=t.length;e--;)t[e].lowestObserverState=q.UP_TO_DATE}}var Mo=0,xu=1,Ri=Object.getOwnPropertyDescriptor(function(){},"name"),Ah=Ri&&Ri.configurable;function Ae(n,t,e){var o=function(){return Ls(n,t,e||this,arguments)};return o.isMobxAction=!0,o}function Ls(n,t,e,o){var r=Eu(n,e,o);try{return t.apply(e,o)}catch(i){throw r.error=i,i}finally{Tu(r)}}function Eu(n,t,e){var o=ht()&&!!n,r=0;if(o&&!1){var i,a;if(i>0)for(var s;s<i;s++);}var l=cn();zt();var u=Jo(!0),p=vi(!0),c={prevDerivation:l,prevAllowStateChanges:u,prevAllowStateReads:p,notifySpy:o,startTime:r,actionId:xu++,parentActionId:Mo};return Mo=c.actionId,c}function Tu(n){Mo!==n.actionId&&K("invalid action stack. did you forget to finish an action?"),Mo=n.parentActionId,n.error!==void 0&&(N.suppressReactionErrors=!0),$o(n.prevAllowStateChanges),mn(n.prevAllowStateReads),Gt(),ve(n.prevDerivation),n.notifySpy,N.suppressReactionErrors=!1}function Jo(n){var t=N.allowStateChanges;return N.allowStateChanges=n,t}function $o(n){N.allowStateChanges=n}var Pe=function(n){uu(t,n);function t(e,o,r,i,a){r===void 0&&(r="ObservableValue@"+bt()),i===void 0&&(i=!0),a===void 0&&(a=qe.default);var s=n.call(this,r)||this;return s.enhancer=o,s.name=r,s.equals=a,s.hasUnreportedChange=!1,s.value=o(e,void 0,r),i&&ht(),s}return t.prototype.dehanceValue=function(e){return this.dehancer!==void 0?this.dehancer(e):e},t.prototype.set=function(e){var o=this.value;if(e=this.prepareNewValue(e),e!==N.UNCHANGED){var r=ht();this.setNewValue(e)}},t.prototype.prepareNewValue=function(e){if(Je(this),Qt(this)){var o=te(this,{object:this,type:"update",newValue:e});if(!o)return N.UNCHANGED;e=o.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?N.UNCHANGED:e},t.prototype.setNewValue=function(e){var o=this.value;this.value=e,this.reportChanged(),Yt(this)&&Ut(this,{type:"update",object:this,newValue:e,oldValue:o})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return Un(this,e)},t.prototype.observe=function(e,o){return o&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),Vn(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return As(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(un),Ou=_e("ObservableValue",Pe),$e=function(){function n(t){this.dependenciesState=q.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=q.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+bt(),this.value=new So(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=$t.NONE,Me(t.get,"missing option for computed: get"),this.derivation=t.get,this.name=t.name||"ComputedValue@"+bt(),t.set&&(this.setter=Ae(this.name+"-setter",t.set)),this.equals=t.equals||(t.compareStructural||t.struct?qe.structural:qe.default),this.scope=t.context,this.requiresReaction=!!t.requiresReaction,this.keepAlive=!!t.keepAlive}return n.prototype.onBecomeStale=function(){Du(this)},n.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach(function(t){return t()})},n.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach(function(t){return t()})},n.prototype.get=function(){this.isComputing&&K("Cycle detected in computation "+this.name+": "+this.derivation),N.inBatch===0&&this.observers.size===0&&!this.keepAlive?Tr(this)&&(this.warnAboutUntrackedRead(),zt(),this.value=this.computeValue(!1),Gt()):(Xs(this),Tr(this)&&this.trackAndCompute()&&Pu(this));var t=this.value;if(yn(t))throw t.cause;return t},n.prototype.peek=function(){var t=this.computeValue(!1);if(yn(t))throw t.cause;return t},n.prototype.set=function(t){if(this.setter){Me(!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 Me(!1,!1)},n.prototype.trackAndCompute=function(){ht();var t=this.value,e=this.dependenciesState===q.NOT_TRACKING,o=this.computeValue(!0),r=e||yn(t)||yn(o)||!this.equals(t,o);return r&&(this.value=o),r},n.prototype.computeValue=function(t){this.isComputing=!0,N.computationDepth++;var e;if(t)e=Cs(this,this.derivation,this.scope);else if(N.disableErrorBoundaries===!0)e=this.derivation.call(this.scope);else try{e=this.derivation.call(this.scope)}catch(o){e=new So(o)}return N.computationDepth--,this.isComputing=!1,e},n.prototype.suspend=function(){this.keepAlive||(Or(this),this.value=void 0)},n.prototype.observe=function(t,e){var o=this,r=!0,i=void 0;return Hu(function(){var a=o.get();if(!r||e){var s=cn();t({type:"update",object:o,newValue:a,oldValue:i}),ve(s)}r=!1,i=a})},n.prototype.warnAboutUntrackedRead=function(){},n.prototype.toJSON=function(){return this.get()},n.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},n.prototype.valueOf=function(){return As(this.get())},n.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},n}(),Qe=_e("ComputedValue",$e),mo=function(){function n(){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 n}(),wu={};function wr(){return typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:wu}var _o=!0,Is=!1,N=function(){var n=wr();return n.__mobxInstanceCount>0&&!n.__mobxGlobals&&(_o=!1),n.__mobxGlobals&&n.__mobxGlobals.version!==new mo().version&&(_o=!1),_o?n.__mobxGlobals?(n.__mobxInstanceCount+=1,n.__mobxGlobals.UNCHANGED||(n.__mobxGlobals.UNCHANGED={}),n.__mobxGlobals):(n.__mobxInstanceCount=1,n.__mobxGlobals=new mo):(setTimeout(function(){Is||K("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")},1),new mo)}();function Su(){(N.pendingReactions.length||N.inBatch||N.isRunningReactions)&&K("isolateGlobalState should be called before MobX is running any reactions"),Is=!0,_o&&(--wr().__mobxInstanceCount===0&&(wr().__mobxGlobals=void 0),N=new mo)}function Sr(){return N}function Mu(n,t){n.observers.add(t),n.lowestObserverState>t.dependenciesState&&(n.lowestObserverState=t.dependenciesState)}function ks(n,t){n.observers.delete(t),n.observers.size===0&&Bs(n)}function Bs(n){n.isPendingUnobservation===!1&&(n.isPendingUnobservation=!0,N.pendingUnobservations.push(n))}function zt(){N.inBatch++}function Gt(){if(--N.inBatch===0){Gs();for(var n=N.pendingUnobservations,t=0;t<n.length;t++){var e=n[t];e.isPendingUnobservation=!1,e.observers.size===0&&(e.isBeingObserved&&(e.isBeingObserved=!1,e.onBecomeUnobserved()),e instanceof $e&&e.suspend())}N.pendingUnobservations=[]}}function Xs(n){var t=N.trackingDerivation;return t!==null?(t.runId!==n.lastAccessedBy&&(n.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=n,n.isBeingObserved||(n.isBeingObserved=!0,n.onBecomeObserved())),!0):(n.observers.size===0&&N.inBatch>0&&Bs(n),!1)}function Au(n){n.lowestObserverState!==q.STALE&&(n.lowestObserverState=q.STALE,n.observers.forEach(function(t){t.dependenciesState===q.UP_TO_DATE&&(t.isTracing!==$t.NONE&&Hs(t,n),t.onBecomeStale()),t.dependenciesState=q.STALE}))}function Pu(n){n.lowestObserverState!==q.STALE&&(n.lowestObserverState=q.STALE,n.observers.forEach(function(t){t.dependenciesState===q.POSSIBLY_STALE?t.dependenciesState=q.STALE:t.dependenciesState===q.UP_TO_DATE&&(n.lowestObserverState=q.UP_TO_DATE)}))}function Du(n){n.lowestObserverState===q.UP_TO_DATE&&(n.lowestObserverState=q.POSSIBLY_STALE,n.observers.forEach(function(t){t.dependenciesState===q.UP_TO_DATE&&(t.dependenciesState=q.POSSIBLY_STALE,t.isTracing!==$t.NONE&&Hs(t,n),t.onBecomeStale())}))}function Hs(n,t){if(n.isTracing===$t.BREAK){var e=[];zs(Vu(n),e,1),new Function(`debugger;
- /*
- Tracing '`+n.name+`'
- You are entering this break point because derivation '`+n.name+"' is being traced and '"+t.name+`' is now forcing it to update.
- Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
- The stackframe you are looking for is at least ~6-8 stack-frames up.
- `+(n instanceof $e?n.derivation.toString().replace(/[*]\//g,"/"):"")+`
- The dependencies for this derivation are:
- `+e.join(`
- `)+`
- */
- `)()}}function zs(n,t,e){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+new Array(e).join(" ")+n.name),n.dependencies&&n.dependencies.forEach(function(o){return zs(o,t,e+1)})}var Cn=function(){function n(t,e,o,r){t===void 0&&(t="Reaction@"+bt()),r===void 0&&(r=!1),this.name=t,this.onInvalidate=e,this.errorHandler=o,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=q.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+bt(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=$t.NONE}return n.prototype.onBecomeStale=function(){this.schedule()},n.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,N.pendingReactions.push(this),Gs())},n.prototype.isScheduled=function(){return this._isScheduled},n.prototype.runReaction=function(){if(!this.isDisposed){if(zt(),this._isScheduled=!1,Tr(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&ht()}catch(t){this.reportExceptionInDerivation(t)}}Gt()}},n.prototype.track=function(t){if(!this.isDisposed){zt();var e=ht(),o;this._isRunning=!0;var r=Cs(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Or(this),yn(r)&&this.reportExceptionInDerivation(r.cause),Gt()}},n.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return}if(N.disableErrorBoundaries)throw t;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";N.suppressReactionErrors,ht()&&Ru({type:"error",name:this.name,message:o,error:""+t}),N.globalReactionErrorHandlers.forEach(function(r){return r(t,e)})},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(zt(),Or(this),Gt()))},n.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[L]=this,t},n.prototype.toString=function(){return"Reaction["+this.name+"]"},n.prototype.trace=function(t){t===void 0&&(t=!1),Qu(this,t)},n}(),Nu=100,Mr=function(n){return n()};function Gs(){N.inBatch>0||N.isRunningReactions||Mr(Cu)}function Cu(){N.isRunningReactions=!0;for(var n=N.pendingReactions,t=0;n.length>0;){++t===Nu&&n.splice(0);for(var e=n.splice(0),o=0,r=e.length;o<r;o++)e[o].runReaction()}N.isRunningReactions=!1}var Ao=_e("Reaction",Cn);function ju(n){var t=Mr;Mr=function(e){return n(function(){return t(e)})}}function ht(){return!1}function Ru(n){if(0)for(var t,e,o;e<o;e++);}function Lu(n){return function(){}}function Iu(){K(!1)}function Li(n){return function(t,e,o){if(o){if(o.value)return{value:Ae(n,o.value),enumerable:!1,configurable:!0,writable:!0};var r=o.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return Ae(n,r.call(this))}}}return ku(n).apply(this,arguments)}}function ku(n){return function(t,e,o){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get:function(){},set:function(r){sn(this,e,b(n,r))}})}}function Bu(n,t,e,o){return o===!0?(ir(n,t,e.value),null):e?{configurable:!0,enumerable:!1,get:function(){return ir(this,t,e.value||e.initializer.call(this)),this[t]},set:Iu}:{enumerable:!1,configurable:!0,set:function(r){ir(this,t,r)},get:function(){}}}var b=function(n,t,e,o){if(arguments.length===1&&typeof n=="function")return Ae(n.name||"<unnamed action>",n);if(arguments.length===2&&typeof t=="function")return Ae(n,t);if(arguments.length===1&&typeof n=="string")return Li(n);if(o===!0)sn(n,t,Ae(n.name||t,e.value,this));else return Li(t).apply(null,arguments)};b.bound=Bu;function Xu(n,t){var e=typeof n=="string"?n:n.name||"<unnamed action>",o=typeof n=="function"?n:t;return Ls(e,o,this,void 0)}function ir(n,t,e){sn(n,t,Ae(t,e.bind(n)))}function Hu(n,t){t===void 0&&(t=ci);var e=t&&t.name||n.name||"Autorun@"+bt(),o=!t.scheduler&&!t.delay,r;if(o)r=new Cn(e,function(){this.track(s)},t.onError,t.requiresObservable);else{var i=Ys(t),a=!1;r=new Cn(e,function(){a||(a=!0,i(function(){a=!1,r.isDisposed||r.track(s)}))},t.onError,t.requiresObservable)}function s(){n(r)}return r.schedule(),r.getDisposer()}var zu=function(n){return n()};function Ys(n){return n.scheduler?n.scheduler:n.delay?function(t){return setTimeout(t,n.delay)}:zu}function Us(n,t,e){e===void 0&&(e=ci);var o=e.name||"Reaction@"+bt(),r=b(o,e.onError?Gu(e.onError,t):t),i=!e.scheduler&&!e.delay,a=Ys(e),s=!0,l=!1,u,p=e.compareStructural?qe.structural:e.equals||qe.default,c=new Cn(o,function(){s||i?d():l||(l=!0,a(d))},e.onError,e.requiresObservable);function d(){if(l=!1,!c.isDisposed){var f=!1;c.track(function(){var y=n(c);f=s||!p(u,y),u=y}),s&&e.fireImmediately&&r(u,c),!s&&f===!0&&r(u,c),s&&(s=!1)}}return c.schedule(),c.getDisposer()}function Gu(n,t){return function(){try{return t.apply(this,arguments)}catch(e){n.call(this,e)}}}function Yu(n,t,e){return Ws("onBecomeObserved",n,t,e)}function Vs(n,t,e){return Ws("onBecomeUnobserved",n,t,e)}function Ws(n,t,e,o){var r=typeof o=="function"?ue(t,e):ue(t),i=typeof o=="function"?o:e,a=n+"Listeners";r[a]?r[a].add(i):r[a]=new Set([i]);var s=r[n];return typeof s!="function"?K(!1):function(){var l=r[a];l&&(l.delete(i),l.size===0&&delete r[a])}}function Uu(n){var t=n.enforceActions,e=n.computedRequiresReaction,o=n.computedConfigurable,r=n.disableErrorBoundaries,i=n.reactionScheduler,a=n.reactionRequiresObservable,s=n.observableRequiresReaction;if(n.isolateGlobalState===!0&&Su(),t!==void 0){(typeof t=="boolean"||t==="strict")&&Ql(`Deprecated value for 'enforceActions', use 'false' => '"never"', 'true' => '"observed"', '"strict"' => "'always'" instead`);var l=void 0;switch(t){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:K("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'")}N.enforceActions=l,N.allowStateChanges=!(l===!0||l==="strict")}e!==void 0&&(N.computedRequiresReaction=!!e),a!==void 0&&(N.reactionRequiresObservable=!!a),s!==void 0&&(N.observableRequiresReaction=!!s,N.allowStateReads=!N.observableRequiresReaction),o!==void 0&&(N.computedConfigurable=!!o),r!==void 0&&(N.disableErrorBoundaries=!!r),i&&ju(i)}function Ar(n,t,e,o){o=ze(o);var r=Fs(o);return Ce(n),bi(n,o.name,r.enhancer),t&&Ks(n,t,e,r),n}function Fs(n){return n.defaultDecorator||(n.deep===!1?Ns:yi)}function Ks(n,t,e,o){var r,i,a,s;if(0){var l;try{for(var u,p;!p.done;p=u.next())var c}catch(g){}finally{}}zt();try{var l=ru(t);try{for(var d=qt(l),f=d.next();!f.done;f=d.next()){var c=f.value,y=Object.getOwnPropertyDescriptor(t,c),h=e&&c in e?e[c]:y.get?gi:o,v=h(n,c,y,!0);v&&Object.defineProperty(n,c,v)}}catch(m){a={error:m}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}}finally{Gt()}}function Vu(n,t){return Zs(ue(n,t))}function Zs(n){var t={name:n.name};return n.observing&&n.observing.length>0&&(t.dependencies=tu(n.observing).map(Zs)),t}function qs(n,t){if(n==null)return!1;if(t!==void 0){if(Nt(n)===!1||!n[L].values.has(t))return!1;var e=ue(n,t);return Qe(e)}return Qe(n)}function Wu(n){return arguments.length>1?K(!1):qs(n)}function Ii(n,t){return typeof t!="string"?K(!1):qs(n,t)}function Fu(n,t){return n==null?!1:t!==void 0?Nt(n)?n[L].values.has(t):!1:Nt(n)||!!n[L]||di(n)||Ao(n)||Qe(n)}function tn(n){return arguments.length!==1&&K(!1),Fu(n)}function en(n){return Nt(n)?n[L].getKeys():xt(n)||Dt(n)?Array.from(n.keys()):ee(n)?n.map(function(t,e){return e}):K(!1)}function Ku(n){return Nt(n)?en(n).map(function(t){return n[t]}):xt(n)?en(n).map(function(t){return n.get(t)}):Dt(n)?Array.from(n.values()):ee(n)?n.slice():K(!1)}function Zu(n){return Nt(n)?en(n).map(function(t){return[t,n[t]]}):xt(n)?en(n).map(function(t){return[t,n.get(t)]}):Dt(n)?Array.from(n.entries()):ee(n)?n.map(function(t,e){return[e,t]}):K(!1)}function mi(n,t,e){if(arguments.length===2&&!Dt(n)){zt();var o=t;try{for(var r in o)mi(n,r,o[r])}finally{Gt()}return}if(Nt(n)){var i=n[L],a=i.values.get(t);a?i.write(t,e):i.addObservableProp(t,e,i.defaultEnhancer)}else if(xt(n))n.set(t,e);else if(Dt(n))n.add(t);else if(ee(n))typeof t!="number"&&(t=parseInt(t,10)),Me(t>=0,"Not a valid index: '"+t+"'"),zt(),t>=n.length&&(n.length=t+1),n[t]=e,Gt();else return K(!1)}function Js(n,t,e,o){return typeof e=="function"?Ju(n,t,e,o):qu(n,t,e)}function qu(n,t,e){return Wn(n).observe(t,e)}function Ju(n,t,e,o){return Wn(n,t).observe(e,o)}var $u={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function Le(n,t,e,o){return o.detectCycles&&n.set(t,e),e}function ce(n,t,e){if(!t.recurseEverything&&!tn(n)||typeof n!="object")return n;if(n===null)return null;if(n instanceof Date)return n;if(Ou(n))return ce(n.get(),t,e);tn(n)&&en(n);var o=t.detectCycles===!0;if(o&&n!==null&&e.has(n))return e.get(n);if(ee(n)||Array.isArray(n)){var r=Le(e,n,[],t),i=n.map(function(f){return ce(f,t,e)});r.length=i.length;for(var a=0,s=i.length;a<s;a++)r[a]=i[a];return r}if(Dt(n)||Object.getPrototypeOf(n)===Set.prototype)if(t.exportMapsAsObjects===!1){var l=Le(e,n,new Set,t);return n.forEach(function(f){l.add(ce(f,t,e))}),l}else{var u=Le(e,n,[],t);return n.forEach(function(f){u.push(ce(f,t,e))}),u}if(xt(n)||Object.getPrototypeOf(n)===Map.prototype)if(t.exportMapsAsObjects===!1){var p=Le(e,n,new Map,t);return n.forEach(function(f,y){p.set(y,ce(f,t,e))}),p}else{var c=Le(e,n,{},t);return n.forEach(function(f,y){c[y]=ce(f,t,e)}),c}var d=Le(e,n,{},t);return Ms(n).forEach(function(f){d[f]=ce(n[f],t,e)}),d}function Ft(n,t){typeof t=="boolean"&&(t={detectCycles:t}),t||(t=$u),t.detectCycles=t.detectCycles===void 0?t.recurseEverything===!0:t.detectCycles===!0;var e;return t.detectCycles&&(e=new Map),ce(n,t,e)}function Qu(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=!1;typeof n[n.length-1]=="boolean"&&(e=n.pop());var o=tc(n);if(!o)return K(!1);o.isTracing,$t.NONE,o.isTracing=e?$t.BREAK:$t.LOG}function tc(n){switch(n.length){case 0:return N.trackingDerivation;case 1:return ue(n[0]);case 2:return ue(n[0],n[1])}}function Bt(n,t){t===void 0&&(t=void 0),zt();try{return n.apply(t)}finally{Gt()}}function Jn(n){return n[L]}function $n(n){return typeof n=="string"||typeof n=="number"||typeof n=="symbol"}var ec={has:function(n,t){if(t===L||t==="constructor"||t===wo)return!0;var e=Jn(n);return $n(t)?e.has(t):t in n},get:function(n,t){if(t===L||t==="constructor"||t===wo)return n[t];var e=Jn(n),o=e.values.get(t);if(o instanceof un){var r=o.get();return r===void 0&&e.has(t),r}return $n(t)&&e.has(t),n[t]},set:function(n,t,e){return $n(t)?(mi(n,t,e),!0):!1},deleteProperty:function(n,t){if(!$n(t))return!1;var e=Jn(n);return e.remove(t),!0},ownKeys:function(n){var t=Jn(n);return t.keysAtom.reportObserved(),Reflect.ownKeys(n)},preventExtensions:function(n){return K("Dynamic observable objects cannot be frozen"),!1}};function nc(n){var t=new Proxy(n,ec);return n[L].proxy=t,t}function Qt(n){return n.interceptors!==void 0&&n.interceptors.length>0}function Un(n,t){var e=n.interceptors||(n.interceptors=[]);return e.push(t),Ss(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function te(n,t){var e=cn();try{for(var o=hi(n.interceptors||[]),r=0,i=o.length;r<i&&(t=o[r](t),Me(!t||t.type,"Intercept handlers should return nothing or a change object"),!!t);r++);return t}finally{ve(e)}}function Yt(n){return n.changeListeners!==void 0&&n.changeListeners.length>0}function Vn(n,t){var e=n.changeListeners||(n.changeListeners=[]);return e.push(t),Ss(function(){var o=e.indexOf(t);o!==-1&&e.splice(o,1)})}function Ut(n,t){var e=cn(),o=n.changeListeners;if(o){o=o.slice();for(var r=0,i=o.length;r<i;r++)o[r](t);ve(e)}}var oc=1e4,rc={get:function(n,t){return t===L?n[L]:t==="length"?n[L].getArrayLength():typeof t=="number"?ie.get.call(n,t):typeof t=="string"&&!isNaN(t)?ie.get.call(n,parseInt(t)):ie.hasOwnProperty(t)?ie[t]:n[t]},set:function(n,t,e){return t==="length"&&n[L].setArrayLength(e),typeof t=="number"&&ie.set.call(n,t,e),typeof t=="symbol"||isNaN(t)?n[t]=e:ie.set.call(n,parseInt(t),e),!0},preventExtensions:function(n){return K("Observable arrays cannot be frozen"),!1}};function ic(n,t,e,o){e===void 0&&(e="ObservableArray@"+bt()),o===void 0&&(o=!1);var r=new $s(e,t,o);nu(r.values,L,r);var i=new Proxy(r.values,rc);if(r.proxy=i,n&&n.length){var a=Jo(!0);r.spliceWithArray(0,0,n),$o(a)}return i}var $s=function(){function n(t,e,o){this.owned=o,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new un(t||"ObservableArray@"+bt()),this.enhancer=function(r,i){return e(r,i,t+"[..]")}}return n.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},n.prototype.dehanceValues=function(t){return this.dehancer!==void 0&&t.length>0?t.map(this.dehancer):t},n.prototype.intercept=function(t){return Un(this,t)},n.prototype.observe=function(t,e){return e===void 0&&(e=!1),e&&t({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Vn(this,t)},n.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},n.prototype.setArrayLength=function(t){if(typeof t!="number"||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var o=new Array(t-e),r=0;r<t-e;r++)o[r]=void 0;this.spliceWithArray(e,0,o)}else this.spliceWithArray(t,e-t)},n.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},n.prototype.spliceWithArray=function(t,e,o){var r=this;Je(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)),o===void 0&&(o=To),Qt(this)){var a=te(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:o});if(!a)return To;e=a.removedCount,o=a.added}if(o=o.length===0?o:o.map(function(u){return r.enhancer(u,void 0)}),!1)var s;var l=this.spliceItemsIntoValues(t,e,o);return(e!==0||o.length!==0)&&this.notifyArraySplice(t,o,l),this.dehanceValues(l)},n.prototype.spliceItemsIntoValues=function(t,e,o){var r;if(o.length<oc)return(r=this.values).splice.apply(r,hi([t,e],o));var i=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(o,this.values.slice(t+e)),i},n.prototype.notifyArrayChildUpdate=function(t,e,o){var r=!this.owned&&ht(),i=Yt(this),a=i||r?{object:this.proxy,type:"update",index:t,newValue:e,oldValue:o}:null;this.atom.reportChanged(),i&&Ut(this,a)},n.prototype.notifyArraySplice=function(t,e,o){var r=!this.owned&&ht(),i=Yt(this),a=i||r?{object:this.proxy,type:"splice",index:t,removed:o,added:e,removedCount:o.length,addedCount:e.length}:null;this.atom.reportChanged(),i&&Ut(this,a)},n}(),ie={intercept:function(n){return this[L].intercept(n)},observe:function(n,t){t===void 0&&(t=!1);var e=this[L];return e.observe(n,t)},clear:function(){return this.splice(0)},replace:function(n){var t=this[L];return t.spliceWithArray(0,t.values.length,n)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(n,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=this[L];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray(n);case 2:return r.spliceWithArray(n,t)}return r.spliceWithArray(n,t,e)},spliceWithArray:function(n,t,e){var o=this[L];return o.spliceWithArray(n,t,e)},push:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=this[L];return e.spliceWithArray(e.values.length,0,n),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 n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=this[L];return e.spliceWithArray(0,0,n),e.values.length},reverse:function(){var n=this.slice();return n.reverse.apply(n,arguments)},sort:function(n){var t=this.slice();return t.sort.apply(t,arguments)},remove:function(n){var t=this[L],e=t.dehanceValues(t.values).indexOf(n);return e>-1?(this.splice(e,1),!0):!1},get:function(n){var t=this[L];if(t&&n<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[n])},set:function(n,t){var e=this[L],o=e.values;if(n<o.length){Je(e.atom);var r=o[n];if(Qt(e)){var i=te(e,{type:"update",object:e.proxy,index:n,newValue:t});if(!i)return;t=i.newValue}t=e.enhancer(t,r);var a=t!==r;a&&(o[n]=t,e.notifyArrayChildUpdate(n,t,r))}else if(n===o.length)e.spliceWithArray(n,0,[t]);else throw new Error("[mobx.array] Index out of bounds, "+n+" is larger than "+o.length)}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach(function(n){typeof Array.prototype[n]=="function"&&(ie[n]=function(){var t=this[L];t.atom.reportObserved();var e=t.dehanceValues(t.values);return e[n].apply(e,arguments)})});["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach(function(n){typeof Array.prototype[n]=="function"&&(ie[n]=function(t,e){var o=this,r=this[L];r.atom.reportObserved();var i=r.dehanceValues(r.values);return i[n](function(a,s){return t.call(e,a,s,o)},e)})});["reduce","reduceRight"].forEach(function(n){ie[n]=function(){var t=this,e=this[L];e.atom.reportObserved();var o=arguments[0];return arguments[0]=function(r,i,a){return i=e.dehanceValue(i),o(r,i,a,t)},e.values[n].apply(e.values,arguments)}});var ac=_e("ObservableArrayAdministration",$s);function ee(n){return pi(n)&&ac(n[L])}var ki,sc={},_i=function(){function n(t,e,o){if(e===void 0&&(e=Yn),o===void 0&&(o="ObservableMap@"+bt()),this.enhancer=e,this.name=o,this[ki]=sc,this._keysAtom=fi(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 n.prototype._has=function(t){return this._data.has(t)},n.prototype.has=function(t){var e=this;if(!N.trackingDerivation)return this._has(t);var o=this._hasMap.get(t);if(!o){var r=o=new Pe(this._has(t),Zo,this.name+"."+ye(t)+"?",!1);this._hasMap.set(t,r),Vs(r,function(){return e._hasMap.delete(t)})}return o.get()},n.prototype.set=function(t,e){var o=this._has(t);if(Qt(this)){var r=te(this,{type:o?"update":"add",object:this,newValue:e,name:t});if(!r)return this;e=r.newValue}return o?this._updateValue(t,e):this._addValue(t,e),this},n.prototype.delete=function(t){var e=this;if(Je(this._keysAtom),Qt(this)){var o=te(this,{type:"delete",object:this,name:t});if(!o)return!1}if(this._has(t)){var r=ht(),i=Yt(this),o=i||r?{type:"delete",object:this,oldValue:this._data.get(t).value,name:t}:null;return Bt(function(){e._keysAtom.reportChanged(),e._updateHasMapEntry(t,!1);var s=e._data.get(t);s.setNewValue(void 0),e._data.delete(t)}),i&&Ut(this,o),!0}return!1},n.prototype._updateHasMapEntry=function(t,e){var o=this._hasMap.get(t);o&&o.setNewValue(e)},n.prototype._updateValue=function(t,e){var o=this._data.get(t);if(e=o.prepareNewValue(e),e!==N.UNCHANGED){var r=ht(),i=Yt(this),a=i||r?{type:"update",object:this,oldValue:o.value,name:t,newValue:e}:null;o.setNewValue(e),i&&Ut(this,a)}},n.prototype._addValue=function(t,e){var o=this;Je(this._keysAtom),Bt(function(){var s=new Pe(e,o.enhancer,o.name+"."+ye(t),!1);o._data.set(t,s),e=s.value,o._updateHasMapEntry(t,!0),o._keysAtom.reportChanged()});var r=ht(),i=Yt(this),a=i||r?{type:"add",object:this,name:t,newValue:e}:null;i&&Ut(this,a)},n.prototype.get=function(t){return this.has(t)?this.dehanceValue(this._data.get(t).get()):this.dehanceValue(void 0)},n.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},n.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},n.prototype.values=function(){var t=this,e=this.keys();return Po({next:function(){var o=e.next(),r=o.done,i=o.value;return{done:r,value:r?void 0:t.get(i)}}})},n.prototype.entries=function(){var t=this,e=this.keys();return Po({next:function(){var o=e.next(),r=o.done,i=o.value;return{done:r,value:r?void 0:[i,t.get(i)]}}})},n.prototype[ki=L,Symbol.iterator]=function(){return this.entries()},n.prototype.forEach=function(t,e){var o,r;try{for(var i=qt(this),a=i.next();!a.done;a=i.next()){var s=Ye(a.value,2),l=s[0],u=s[1];t.call(e,u,l,this)}}catch(p){o={error:p}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}},n.prototype.merge=function(t){var e=this;return xt(t)&&(t=t.toJS()),Bt(function(){var o=Jo(!0);try{an(t)?Ms(t).forEach(function(r){return e.set(r,t[r])}):Array.isArray(t)?t.forEach(function(r){var i=Ye(r,2),a=i[0],s=i[1];return e.set(a,s)}):ln(t)?(t.constructor!==Map&&K("Cannot initialize from classes that inherit from Map: "+t.constructor.name),t.forEach(function(r,i){return e.set(i,r)})):t!=null&&K("Cannot initialize map from "+t)}finally{$o(o)}}),this},n.prototype.clear=function(){var t=this;Bt(function(){js(function(){var e,o;try{for(var r=qt(t.keys()),i=r.next();!i.done;i=r.next()){var a=i.value;t.delete(a)}}catch(s){e={error:s}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(e)throw e.error}}})})},n.prototype.replace=function(t){var e=this;return Bt(function(){var o,r,i,a,s=eu(t),l=new Map,u=!1;try{for(var p=qt(e._data.keys()),c=p.next();!c.done;c=p.next()){var d=c.value;if(!s.has(d)){var f=e.delete(d);if(f)u=!0;else{var y=e._data.get(d);l.set(d,y)}}}}catch(T){o={error:T}}finally{try{c&&!c.done&&(r=p.return)&&r.call(p)}finally{if(o)throw o.error}}try{for(var h=qt(s.entries()),v=h.next();!v.done;v=h.next()){var g=Ye(v.value,2),d=g[0],y=g[1],m=e._data.has(d);if(e.set(d,y),e._data.has(d)){var O=e._data.get(d);l.set(d,O),m||(u=!0)}}}catch(T){i={error:T}}finally{try{v&&!v.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 S=e._data.keys(),w=l.keys(),M=S.next(),_=w.next();!M.done;){if(M.value!==_.value){e._keysAtom.reportChanged();break}M=S.next(),_=w.next()}e._data=l}),this},Object.defineProperty(n.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),n.prototype.toPOJO=function(){var t,e,o={};try{for(var r=qt(this),i=r.next();!i.done;i=r.next()){var a=Ye(i.value,2),s=a[0],l=a[1];o[typeof s=="symbol"?s:ye(s)]=l}}catch(u){t={error:u}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},n.prototype.toJS=function(){return new Map(this)},n.prototype.toJSON=function(){return this.toPOJO()},n.prototype.toString=function(){var t=this;return this.name+"[{ "+Array.from(this.keys()).map(function(e){return ye(e)+": "+(""+t.get(e))}).join(", ")+" }]"},n.prototype.observe=function(t,e){return Vn(this,t)},n.prototype.intercept=function(t){return Un(this,t)},n}(),xt=_e("ObservableMap",_i),Bi,lc={},Qs=function(){function n(t,e,o){if(e===void 0&&(e=Yn),o===void 0&&(o="ObservableSet@"+bt()),this.name=o,this[Bi]=lc,this._data=new Set,this._atom=fi(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(r,i){return e(r,i,o)},t&&this.replace(t)}return n.prototype.dehanceValue=function(t){return this.dehancer!==void 0?this.dehancer(t):t},n.prototype.clear=function(){var t=this;Bt(function(){js(function(){var e,o;try{for(var r=qt(t._data.values()),i=r.next();!i.done;i=r.next()){var a=i.value;t.delete(a)}}catch(s){e={error:s}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(e)throw e.error}}})})},n.prototype.forEach=function(t,e){var o,r;try{for(var i=qt(this),a=i.next();!a.done;a=i.next()){var s=a.value;t.call(e,s,s,this)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}},Object.defineProperty(n.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),n.prototype.add=function(t){var e=this;if(Je(this._atom),Qt(this)){var o=te(this,{type:"add",object:this,newValue:t});if(!o)return this}if(!this.has(t)){Bt(function(){e._data.add(e.enhancer(t,void 0)),e._atom.reportChanged()});var r=ht(),i=Yt(this),o=i||r?{type:"add",object:this,newValue:t}:null;i&&Ut(this,o)}return this},n.prototype.delete=function(t){var e=this;if(Qt(this)){var o=te(this,{type:"delete",object:this,oldValue:t});if(!o)return!1}if(this.has(t)){var r=ht(),i=Yt(this),o=i||r?{type:"delete",object:this,oldValue:t}:null;return Bt(function(){e._atom.reportChanged(),e._data.delete(t)}),i&&Ut(this,o),!0}return!1},n.prototype.has=function(t){return this._atom.reportObserved(),this._data.has(this.dehanceValue(t))},n.prototype.entries=function(){var t=0,e=Array.from(this.keys()),o=Array.from(this.values());return Po({next:function(){var r=t;return t+=1,r<o.length?{value:[e[r],o[r]],done:!1}:{done:!0}}})},n.prototype.keys=function(){return this.values()},n.prototype.values=function(){this._atom.reportObserved();var t=this,e=0,o=Array.from(this._data.values());return Po({next:function(){return e<o.length?{value:t.dehanceValue(o[e++]),done:!1}:{done:!0}}})},n.prototype.replace=function(t){var e=this;return Dt(t)&&(t=t.toJS()),Bt(function(){var o=Jo(!0);try{Array.isArray(t)?(e.clear(),t.forEach(function(r){return e.add(r)})):Gn(t)?(e.clear(),t.forEach(function(r){return e.add(r)})):t!=null&&K("Cannot initialize set from "+t)}finally{$o(o)}}),this},n.prototype.observe=function(t,e){return Vn(this,t)},n.prototype.intercept=function(t){return Un(this,t)},n.prototype.toJS=function(){return new Set(this)},n.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},n.prototype[Bi=L,Symbol.iterator]=function(){return this.values()},n}(),Dt=_e("ObservableSet",Qs),tl=function(){function n(t,e,o,r){e===void 0&&(e=new Map),this.target=t,this.values=e,this.name=o,this.defaultEnhancer=r,this.keysAtom=new un(o+".keys")}return n.prototype.read=function(t){return this.values.get(t).get()},n.prototype.write=function(t,e){var o=this.target,r=this.values.get(t);if(r instanceof $e){r.set(e);return}if(Qt(this)){var i=te(this,{type:"update",object:this.proxy||o,name:t,newValue:e});if(!i)return;e=i.newValue}if(e=r.prepareNewValue(e),e!==N.UNCHANGED){var a=Yt(this),s=ht(),i=a||s?{type:"update",object:this.proxy||o,oldValue:r.value,name:t,newValue:e}:null;r.setNewValue(e),a&&Ut(this,i)}},n.prototype.has=function(t){var e=this.pendingKeys||(this.pendingKeys=new Map),o=e.get(t);if(o)return o.get();var r=!!this.values.get(t);return o=new Pe(r,Zo,this.name+"."+ye(t)+"?",!1),e.set(t,o),o.get()},n.prototype.addObservableProp=function(t,e,o){o===void 0&&(o=this.defaultEnhancer);var r=this.target;if(Qt(this)){var i=te(this,{object:this.proxy||r,name:t,type:"add",newValue:e});if(!i)return;e=i.newValue}var a=new Pe(e,o,this.name+"."+ye(t),!1);this.values.set(t,a),e=a.value,Object.defineProperty(r,t,uc(t)),this.notifyPropertyAddition(t,e)},n.prototype.addComputedProp=function(t,e,o){var r=this.target;o.name=o.name||this.name+"."+ye(e),this.values.set(e,new $e(o)),(t===r||ou(t,e))&&Object.defineProperty(t,e,cc(e))},n.prototype.remove=function(t){if(this.values.has(t)){var e=this.target;if(Qt(this)){var o=te(this,{object:this.proxy||e,name:t,type:"remove"});if(!o)return}try{zt();var r=Yt(this),i=ht(),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 o=r||i?{type:"remove",object:this.proxy||e,oldValue:s,name:t}:null;r&&Ut(this,o)}finally{Gt()}}},n.prototype.illegalAccess=function(t,e){},n.prototype.observe=function(t,e){return Vn(this,t)},n.prototype.intercept=function(t){return Un(this,t)},n.prototype.notifyPropertyAddition=function(t,e){var o=Yt(this),r=ht(),i=o||r?{type:"add",object:this.proxy||this.target,name:t,newValue:e}:null;if(o&&Ut(this,i),this.pendingKeys){var a=this.pendingKeys.get(t);a&&a.set(!0)}this.keysAtom.reportChanged()},n.prototype.getKeys=function(){var t,e;this.keysAtom.reportObserved();var o=[];try{for(var r=qt(this.values),i=r.next();!i.done;i=r.next()){var a=Ye(i.value,2),s=a[0],l=a[1];l instanceof Pe&&o.push(s)}}catch(u){t={error:u}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},n}();function bi(n,t,e){if(t===void 0&&(t=""),e===void 0&&(e=Yn),Object.prototype.hasOwnProperty.call(n,L))return n[L];an(n)||(t=(n.constructor.name||"ObservableObject")+"@"+bt()),t||(t="ObservableObject@"+bt());var o=new tl(n,new Map,ye(t),e);return sn(n,L,o),o}var Xi=Object.create(null),Hi=Object.create(null);function uc(n){return Xi[n]||(Xi[n]={configurable:!0,enumerable:!0,get:function(){return this[L].read(n)},set:function(t){this[L].write(n,t)}})}function zi(n){var t=n[L];return t||(Ce(n),n[L])}function cc(n){return Hi[n]||(Hi[n]={configurable:N.computedConfigurable,enumerable:!1,get:function(){return zi(this).read(n)},set:function(t){zi(this).write(n,t)}})}var pc=_e("ObservableObjectAdministration",tl);function Nt(n){return pi(n)?(Ce(n),pc(n[L])):!1}function ue(n,t){if(typeof n=="object"&&n!==null){if(ee(n))return t!==void 0&&K(!1),n[L].atom;if(Dt(n))return n[L];if(xt(n)){var e=n;if(t===void 0)return e._keysAtom;var o=e._data.get(t)||e._hasMap.get(t);return o||K(!1),o}if(Ce(n),t&&!n[L]&&n[t],Nt(n)){if(!t)return K(!1);var o=n[L].values.get(t);return o||K(!1),o}if(di(n)||Qe(n)||Ao(n))return n}else if(typeof n=="function"&&Ao(n[L]))return n[L];return K(!1)}function Wn(n,t){if(n||K("Expecting some object"),t!==void 0)return Wn(ue(n,t));if(di(n)||Qe(n)||Ao(n)||xt(n)||Dt(n))return n;if(Ce(n),n[L])return n[L];K(!1)}function dc(n,t){var e;return t!==void 0?e=ue(n,t):Nt(n)||xt(n)||Dt(n)?e=Wn(n):e=ue(n),e.name}var Gi=Object.prototype.toString;function xi(n,t,e){return e===void 0&&(e=-1),Pr(n,t,e)}function Pr(n,t,e,o,r){if(n===t)return n!==0||1/n===1/t;if(n==null||t==null)return!1;if(n!==n)return t!==t;var i=typeof n;if(i!=="function"&&i!=="object"&&typeof t!="object")return!1;var a=Gi.call(n);if(a!==Gi.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!=+n?+t!=+t:+n==0?1/+n===1/t:+n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object Symbol]":return typeof Symbol!="undefined"&&Symbol.valueOf.call(n)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":e>=0&&e++;break}n=Yi(n),t=Yi(t);var s=a==="[object Array]";if(!s){if(typeof n!="object"||typeof t!="object")return!1;var l=n.constructor,u=t.constructor;if(l!==u&&!(typeof l=="function"&&l instanceof l&&typeof u=="function"&&u instanceof u)&&"constructor"in n&&"constructor"in t)return!1}if(e===0)return!1;e<0&&(e=-1),o=o||[],r=r||[];for(var p=o.length;p--;)if(o[p]===n)return r[p]===t;if(o.push(n),r.push(t),s){if(p=n.length,p!==t.length)return!1;for(;p--;)if(!Pr(n[p],t[p],e-1,o,r))return!1}else{var c=Object.keys(n),d=void 0;if(p=c.length,Object.keys(t).length!==p)return!1;for(;p--;)if(d=c[p],!(fc(t,d)&&Pr(n[d],t[d],e-1,o,r)))return!1}return o.pop(),r.pop(),!0}function Yi(n){return ee(n)?n.slice():ln(n)||xt(n)||Gn(n)||Dt(n)?Array.from(n.entries()):n}function fc(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function Po(n){return n[Symbol.iterator]=hc,n}function hc(){return this}if(typeof Proxy=="undefined"||typeof Symbol=="undefined")throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");(function(){function n(){}if(n.name!=="testCodeMinification"&&!1)var t})();typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Lu,extras:{getDebugName:dc},$mobx:L});function yc(n){return!(n.prototype&&n.prototype.render)&&!Y.isPrototypeOf(n)}function el(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=t.prefix,o=e===void 0?"":e,r=t.suffix,i=r===void 0?"":r,a=n.displayName||n.name||n.constructor&&n.constructor.name||"<component>";return o+a+i}var Ui=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},nl=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")},ol=function(){function n(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}}(),rl=function(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},il=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n},Vi=console;function gc(n){var t=Sr().allowStateChanges;return Sr().allowStateChanges=n,t}function vc(n){Sr().allowStateChanges=n}function mc(n,t,e,o,r){var i=gc(n),a=void 0;try{a=t(e,o,r)}finally{vc(i)}return a}function Wi(n,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=n[t],r=al[t],i=o?e===!0?function(){r.apply(this,arguments),o.apply(this,arguments)}:function(){o.apply(this,arguments),r.apply(this,arguments)}:r;n[t]=i}function Fi(n,t){if(n==null||t==null||(typeof n=="undefined"?"undefined":Ui(n))!=="object"||(typeof t=="undefined"?"undefined":Ui(t))!=="object")return n!==t;var e=Object.keys(n);if(e.length!==Object.keys(t).length)return!0;for(var o=void 0,r=e.length-1;o=e[r];r--)if(t[o]!==n[o])return!0;return!1}var al={componentWillMount:function(){var n=this,t=el(this),e=!1,o=!1;function r(p){var c=this[p],d=fi("reactive "+p);Object.defineProperty(this,p,{configurable:!0,enumerable:!0,get:function(){return d.reportObserved(),c},set:function(f){!o&&Fi(c,f)?(c=f,e=!0,d.reportChanged(),e=!1):c=f}})}r.call(this,"props"),r.call(this,"state");var i=this.render.bind(this),a=null,s=!1,l=function(){return a=new Cn(t+".render()",function(){if(!s&&(s=!0,typeof n.componentWillReact=="function"&&n.componentWillReact(),n.__$mobxIsUnmounted!==!0)){var p=!0;try{o=!0,e||Y.prototype.forceUpdate.call(n),p=!1}finally{o=!1,p&&a.dispose()}}}),a.reactComponent=n,u.$mobx=a,n.render=u,u(n.props,n.state,n.context)},u=function(p,c,d){s=!1;var f=void 0,y=void 0;if(a.track(function(){try{y=mc(!1,i,p,c,d)}catch(h){f=h}}),f)throw f;return y};this.render=l},componentWillUnmount:function(){this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0},componentDidMount:function(){},componentDidUpdate:function(){},shouldComponentUpdate:function(n,t){return this.state!==t?!0:Fi(this.props,n)}};function Ei(n){if(arguments.length>1&&Vi.warn('Mobx observer: Using observer to inject stores is not supported. Use `@connect(["store1", "store2"]) ComponentClass instead or preferably, use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))``'),n.isMobxInjector===!0&&Vi.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),yc(n)){var t,e;return Ei((e=t=function(r){rl(i,r);function i(){return nl(this,i),il(this,(i.__proto__||Object.getPrototypeOf(i)).apply(this,arguments))}return ol(i,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),i}(Y),t.displayName=el(n),e))}if(!n)throw new Error("Please pass a valid component to 'observer'");var o=n.prototype||n;return _c(o),n.isMobXReactObserver=!0,n}function _c(n){Wi(n,"componentWillMount",!0),Wi(n,"componentDidMount"),n.shouldComponentUpdate||(n.shouldComponentUpdate=al.shouldComponentUpdate)}var bc=Ei(function(n){var t=n.children;return t[0]()});bc.displayName="Observer";var xc=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ec(n,t){return t={exports:{}},n(t,t.exports),t.exports}Ec(function(n,t){(function(e,o){n.exports=o()})(xc,function(){var e={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,u=l&&l(Object);return function p(c,d,f){if(typeof d!="string"){if(u){var y=l(d);y&&y!==u&&p(c,y,f)}var h=i(d);a&&(h=h.concat(a(d)));for(var v=0;v<h.length;++v){var g=h[v];if(!e[g]&&!o[g]&&(!f||!f[g])){var m=s(d,g);try{r(c,g,m)}catch(O){}}}return c}return c}})});var Ki={children:!0,key:!0,ref:!0},Zi=console;(function(n){rl(t,n);function t(){return nl(this,t),il(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return ol(t,[{key:"render",value:function(e){var o=e.children;return o.length>1?Fe("div",null," ",o," "):o[0]}},{key:"getChildContext",value:function(){var e={},o=this.context.mobxStores;if(o)for(var r in o)e[r]=o[r];for(var i in this.props)!Ki[i]&&i!=="suppressChangedStoreWarning"&&(e[i]=this.props[i]);return{mobxStores:e}}},{key:"componentWillReceiveProps",value:function(e){if(Object.keys(e).length!==Object.keys(this.props).length&&Zi.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!e.suppressChangedStoreWarning)for(var o in e)!Ki[o]&&this.props[o]!==e[o]&&Zi.warn("MobX Provider: Provided store '"+o+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t})(Y);if(!Y)throw new Error("mobx-preact requires Preact to be available");var Kt,ar,qi,sl=[],ft=H,Ji=ft.__b,$i=ft.__r,Qi=ft.diffed,ta=ft.__c,ea=ft.unmount,na=ft.__;function Tc(){for(var n;n=sl.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(bo),n.__H.__h.forEach(Dr),n.__H.__h=[]}catch(t){n.__H.__h=[],ft.__e(t,n.__v)}}ft.__b=function(n){Kt=null,Ji&&Ji(n)},ft.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),na&&na(n,t)},ft.__r=function(n){$i&&$i(n);var t=(Kt=n.__c).__H;t&&(ar===Kt?(t.__h=[],Kt.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(bo),t.__h.forEach(Dr),t.__h=[])),ar=Kt},ft.diffed=function(n){Qi&&Qi(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(sl.push(t)!==1&&qi===ft.requestAnimationFrame||((qi=ft.requestAnimationFrame)||Oc)(Tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ar=Kt=null},ft.__c=function(n,t){t.some(function(e){try{e.__h.forEach(bo),e.__h=e.__h.filter(function(o){return!o.__||Dr(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],ft.__e(o,e.__v)}}),ta&&ta(n,t)},ft.unmount=function(n){ea&&ea(n);var t,e=n.__c;e&&e.__H&&(e.__H.__.forEach(function(o){try{bo(o)}catch(r){t=r}}),e.__H=void 0,t&&ft.__e(t,e.__v))};var oa=typeof requestAnimationFrame=="function";function Oc(n){var t,e=function(){clearTimeout(o),oa&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(e,100);oa&&(t=requestAnimationFrame(e))}function bo(n){var t=Kt,e=n.__c;typeof e=="function"&&(n.__c=void 0,e()),Kt=t}function Dr(n){var t=Kt;n.__c=n.__(),Kt=t}function wc(n,t){for(var e in t)n[e]=t[e];return n}function ra(n,t){for(var e in n)if(e!=="__source"&&!(e in t))return!0;for(var o in t)if(o!=="__source"&&n[o]!==t[o])return!0;return!1}function ia(n,t){this.props=n,this.context=t}(ia.prototype=new Y).isPureReactComponent=!0,ia.prototype.shouldComponentUpdate=function(n,t){return ra(this.props,n)||ra(this.state,t)};var aa=H.__b;H.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),aa&&aa(n)};var Sc=H.__e;H.__e=function(n,t,e,o){if(n.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t)}Sc(n,t,e,o)};var sa=H.unmount;function ll(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),n.__c.__H=null),(n=wc({},n)).__c!=null&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(o){return ll(o,t,e)})),n}function ul(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(o){return ul(o,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function sr(){this.__u=0,this.o=null,this.__b=null}function cl(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function Qn(){this.i=null,this.l=null}H.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),sa&&sa(n)},(sr.prototype=new Y).__c=function(n,t){var e=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(e);var r=cl(o.__v),i=!1,a=function(){i||(i=!0,e.__R=null,r?r(s):s())};e.__R=a;var s=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=ul(l,l.__c.__P,l.__c.__O)}var u;for(o.setState({__a:o.__b=null});u=o.o.pop();)u.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),n.then(a,a)},sr.prototype.componentWillUnmount=function(){this.o=[]},sr.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=ll(this.__b,e,o.__O=o.__P)}this.__b=null}var r=t.__a&&Fe(Ke,null,n.fallback);return r&&(r.__u&=-33),[Fe(Ke,null,t.__a?null:n.children),r]};var la=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2]}};(Qn.prototype=new Y).__a=function(n){var t=this,e=cl(t.__v),o=t.l.get(n);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),la(t,n,o)):r()};e?e(i):i()}},Qn.prototype.render=function(n){this.i=null,this.l=new Map;var t=Eo(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},Qn.prototype.componentDidUpdate=Qn.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){la(n,e,t)})};var Mc=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Ac=/^(?: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]/,Pc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Dc=/[A-Z0-9]/g,Nc=typeof document!="undefined",Cc=function(n){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function ua(n,t,e){return t.__k==null&&(t.textContent=""),Jl(n,t),typeof e=="function"&&e(),n?n.__c:null}Y.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(Y.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t})}})});var ca=H.event;function jc(){}function Rc(){return this.cancelBubble}function Lc(){return this.defaultPrevented}H.event=function(n){return ca&&(n=ca(n)),n.persist=jc,n.isPropagationStopped=Rc,n.isDefaultPrevented=Lc,n.nativeEvent=n};var Ic={enumerable:!1,configurable:!0,get:function(){return this.class}},pa=H.vnode;H.vnode=function(n){typeof n.type=="string"&&function(t){var e=t.props,o=t.type,r={},i=o.indexOf("-")===-1;for(var a in e){var s=e[a];if(!(a==="value"&&"defaultValue"in e&&s==null||Nc&&a==="children"&&o==="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"||o!=="input"&&o!=="textarea"||Cc(e.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":Pc.test(a)&&(a=l):l=a="oninput":i&&Ac.test(a)?a=a.replace(Dc,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&r[a=l]&&(a="oninputCapture"),r[a]=s}}o=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Eo(e.children).forEach(function(u){u.props.selected=r.value.indexOf(u.props.value)!=-1})),o=="select"&&r.defaultValue!=null&&(r.value=Eo(e.children).forEach(function(u){u.props.selected=r.multiple?r.defaultValue.indexOf(u.props.value)!=-1:r.defaultValue==u.props.value})),e.class&&!e.className?(r.class=e.class,Object.defineProperty(r,"className",Ic)):(e.className&&!e.class||e.class&&e.className)&&(r.class=r.className=e.className),t.props=r}(n),n.$$typeof=Mc,pa&&pa(n)};var da=H.__r;H.__r=function(n){da&&da(n),n.__c};var fa=H.diffed;H.diffed=function(n){fa&&fa(n);var t=n.props,e=n.__e;e!=null&&n.type==="textarea"&&"value"in t&&t.value!==e.value&&(e.value=t.value==null?"":t.value)};var kc=0;function E(n,t,e,o,r,i){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var u={type:n,props:l,key:e,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--kc,__i:-1,__u:0,__source:r,__self:i};if(typeof n=="function"&&(a=n.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return H.vnode&&H.vnode(u),u}var Bc=globalThis&&globalThis.__rest||function(n,t){var e={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(e[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(e[o[r]]=n[o[r]]);return e},jn;(function(n){function t(e){var o=Bc(e,[]),r=e.container;if(!r)throw new Error("Ensure the container of LogicFlow is specified and valid.");return Q({},n.defaults,o)}n.get=t})(jn||(jn={}));(function(n){n.defaults={background:!1,grid:!1,textEdit:!0,snapline:!0,outline:!1,disabledTools:[]}})(jn||(jn={}));var ha={node:!1,edge:!1},Xc={node:!0,edge:!0},Hc=function(n){return!n||typeof n=="boolean"?n===!0?X(Xc):X(ha):ii(X(ha),n)},zc=function(){return Wo(window,"navigator.userAgent","").match(/MSIE|Trident/)!==null};function gt(n){try{return JSON.parse(JSON.stringify(n))}catch(t){return n}}var to=200,Gc=9999,Yc=10,F;(function(n){n[n.DEFAULT=1]="DEFAULT",n[n.TEXT_EDIT=2]="TEXT_EDIT",n[n.SHOW_MENU=3]="SHOW_MENU",n[n.ALLOW_CONNECT=4]="ALLOW_CONNECT",n[n.NOT_ALLOW_CONNECT=5]="NOT_ALLOW_CONNECT"})(F||(F={}));var rt;(function(n){n.NODE="node",n.EDGE="edge",n.GRAPH="graph"})(rt||(rt={}));var z;(function(n){n.NODE="node",n.CIRCLE_NODE="circle-node",n.POLYGON_NODE="polygon-node",n.RECT_NODE="rect-node",n.TEXT_NODE="text-node",n.ELLIPSE_NODE="ellipse-node",n.DIAMOND_NODE="diamond-node",n.HTML_NODE="html-node",n.CUSTOM_HTML_NODE="custom-html-node",n.EDGE="edge",n.LINE_EDGE="line-edge",n.POLYLINE_EDGE="polyline-edge",n.BEZIER_EDGE="bezier-edge",n.GRAPH="graph"})(z||(z={}));var C;(function(n){n.ELEMENT_CLICK="element:click",n.NODE_ADD="node:add",n.NODE_DELETE="node:delete",n.NODE_CLICK="node:click",n.NODE_DBCLICK="node:dbclick",n.NODE_GROUP_COPY="node:group-copy-add",n.NODE_DND_ADD="node:dnd-add",n.NODE_DND_DRAG="node:dnd-drag",n.NODE_MOUSEDOWN="node:mousedown",n.NODE_DRAGSTART="node:dragstart",n.NODE_DRAG="node:drag",n.NODE_DROP="node:drop",n.NODE_MOUSEUP="node:mouseup",n.NODE_MOUSEMOVE="node:mousemove",n.NODE_MOUSEENTER="node:mouseenter",n.NODE_MOUSELEAVE="node:mouseleave",n.NODE_CONTEXTMENU="node:contextmenu",n.NODE_ROTATE="node:rotate",n.NODE_RESIZE="node:resize",n.NODE_FOCUS="node:focus",n.NODE_BLUR="node:blur",n.NODE_PROPERTIES_CHANGE="node:properties-change",n.NODE_PROPERTIES_DELETE="node:properties-delete",n.EDGE_ADD="edge:add",n.EDGE_DELETE="edge:delete",n.EDGE_CLICK="edge:click",n.EDGE_DBCLICK="edge:dbclick",n.EDGE_FOCUS="edge:focus",n.EDGE_BLUR="edge:blur",n.EDGE_MOUSEENTER="edge:mouseenter",n.EDGE_MOUSELEAVE="edge:mouseleave",n.EDGE_CONTEXTMENU="edge:contextmenu",n.EDGE_ADJUST="edge:adjust",n.EDGE_EXCHANGE_NODE="edge:exchange-node",n.ANCHOR_CLICK="anchor:click",n.ANCHOR_MOUSEDOWN="anchor:mousedown",n.ANCHOR_DRAGSTART="anchor:dragstart",n.ANCHOR_DRAG="anchor:drag",n.ANCHOR_DROP="anchor:drop",n.ANCHOR_DRAGEND="anchor:dragend",n.ADJUST_POINT_MOUSEDOWN="adjustPoint:mousedown",n.ADJUST_POINT_MOUSEUP="adjustPoint:mouseup",n.ADJUST_POINT_MOUSEMOVE="adjustPoint:mousemove",n.ADJUST_POINT_DRAGSTART="adjustPoint:dragstart",n.ADJUST_POINT_DRAG="adjustPoint:drag",n.ADJUST_POINT_DROP="adjustPoint:drop",n.ADJUST_POINT_DRAGEND="adjustPoint:dragend",n.BLANK_MOUSEDOWN="blank:mousedown",n.BLANK_DRAGSTART="blank:dragstart",n.BLANK_DRAG="blank:drag",n.BLANK_DROP="blank:drop",n.BLANK_MOUSEMOVE="blank:mousemove",n.BLANK_MOUSEUP="blank:mouseup",n.BLANK_CLICK="blank:click",n.BLANK_CONTEXTMENU="blank:contextmenu",n.SELECTION_MOUSEDOWN="selection:mousedown",n.SELECTION_DRAGSTART="selection:dragstart",n.SELECTION_DRAG="selection:drag",n.SELECTION_DROP="selection:drop",n.SELECTION_MOUSEMOVE="selection:mousemove",n.SELECTION_MOUSEUP="selection:mouseup",n.SELECTION_CONTEXTMENU="selection:contextmenu",n.CONNECTION_NOT_ALLOWED="connection:not-allowed",n.TEXT_MOUSEDOWN="text:mousedown",n.TEXT_DRAGSTART="text:dragstart",n.TEXT_DRAG="text:drag",n.TEXT_DROP="text:drop",n.TEXT_CLICK="text:click",n.TEXT_DBCLICK="text:dbclick",n.TEXT_BLUR="text:blur",n.TEXT_MOUSEMOVE="text:mousemove",n.TEXT_MOUSEUP="text:mouseup",n.TEXT_FOCUS="text:focus",n.TEXT_ADD="text:add",n.TEXT_UPDATE="text:update",n.TEXT_CLEAR="text:clear",n.LABEL_MOUSEDOWN="label:mousedown",n.LABEL_DRAGSTART="label:dragstart",n.LABEL_DRAG="label:drag",n.LABEL_DROP="label:drop",n.LABEL_CLICK="label:click",n.LABEL_DBCLICK="label:dbclick",n.LABEL_BLUR="label:blur",n.LABEL_MOUSEMOVE="label:mousemove",n.LABEL_MOUSEUP="label:mouseup",n.LABEL_FOCUS="label:focus",n.LABEL_ADD="label:add",n.LABEL_UPDATE="label:update",n.LABEL_CLEAR="label:clear",n.LABEL_DELETE="label:delete",n.LABEL_SHOULD_ADD="label:should-add",n.LABEL_BATCH_ADD="label:batch-add",n.LABEL_SHOULD_UPDATE="label:should-update",n.LABEL_SHOULD_DELETE="label:should-delete",n.LABEL_BATCH_DELETE="label:batch-delete",n.LABEL_NOT_ALLOWED_ADD="label:not-allowed-add",n.HISTORY_CHANGE="history:change",n.GRAPH_TRANSFORM="graph:transform",n.GRAPH_RENDERED="graph:rendered",n.GRAPH_UPDATED="graph:updated"})(C||(C={}));var Xt;(function(n){n[n.DEFAULT=0]="DEFAULT",n[n.INCREASE=1]="INCREASE"})(Xt||(Xt={}));var et;(function(n){n.HORIZONTAL="horizontal",n.VERTICAL="vertical"})(et||(et={}));var Pt;(function(n){n.TEXT="text",n.LABEL="label"})(Pt||(Pt={}));var Uc=0,ne=function(){function n(t){var e=t.onDragStart,o=e===void 0?rr:e,r=t.onDragging,i=r===void 0?rr:r,a=t.onDragEnd,s=a===void 0?rr:a,l=t.eventType,u=l===void 0?"":l,p=t.eventCenter,c=t.step,d=c===void 0?1:c,f=t.isStopPropagation,y=f===void 0?!0:f,h=t.model,v=t.data,g=this;this.isDragging=!1,this.isStartDragging=!1,this.startX=0,this.startY=0,this.sumDeltaX=0,this.sumDeltaY=0,this.handleMouseDown=function(m){var O,S,w=window==null?void 0:window.document;if(m.button===Uc){g.isStopPropagation&&m.stopPropagation(),g.isStartDragging=!0,g.startX=m.clientX,g.startY=m.clientY,w.addEventListener("mousemove",g.handleMouseMove,!1),w.addEventListener("mouseup",g.handleMouseUp,!1);var M=(O=g.model)===null||O===void 0?void 0:O.getData();(S=g.eventCenter)===null||S===void 0||S.emit(C["".concat(g.eventType,"_MOUSEDOWN")],{e:m,data:g.data||M}),g.startTime=new Date().getTime()}},this.handleMouseMove=function(m){var O,S;if(g.isStopPropagation&&m.stopPropagation(),!!g.isStartDragging&&(g.sumDeltaX+=m.clientX-g.startX,g.sumDeltaY+=m.clientY-g.startY,g.startX=m.clientX,g.startY=m.clientY,g.step<=1||Math.abs(g.sumDeltaX)>g.step||Math.abs(g.sumDeltaY)>g.step)){var w=g.sumDeltaX%g.step,M=g.sumDeltaY%g.step,_=g.sumDeltaX-w,T=g.sumDeltaY-M;g.sumDeltaX=w,g.sumDeltaY=M;var A=(O=g.model)===null||O===void 0?void 0:O.getData();g.isDragging||((S=g.eventCenter)===null||S===void 0||S.emit(C["".concat(g.eventType,"_DRAGSTART")],{e:m,data:g.data||A}),g.onDragStart({event:m})),g.isDragging=!0,Promise.resolve().then(function(){var P,k;g.onDragging({deltaX:_,deltaY:T,event:m}),(P=g.eventCenter)===null||P===void 0||P.emit(C["".concat(g.eventType,"_MOUSEMOVE")],{deltaX:_,deltaY:T,e:m,data:g.data||A}),(k=g.eventCenter)===null||k===void 0||k.emit(C["".concat(g.eventType,"_DRAG")],{e:m,data:g.data||A})})}},this.handleMouseUp=function(m){var O=window.document;g.isStartDragging=!1,g.isStopPropagation&&m.stopPropagation(),Promise.resolve().then(function(){var S,w,M;O.removeEventListener("mousemove",g.handleMouseMove,!1),O.removeEventListener("mouseup",g.handleMouseUp,!1);var _=(S=g.model)===null||S===void 0?void 0:S.getData();(w=g.eventCenter)===null||w===void 0||w.emit(C["".concat(g.eventType,"_MOUSEUP")],{e:m,data:g.data||_}),g.isDragging&&(g.isDragging=!1,g.onDragEnd({event:m}),(M=g.eventCenter)===null||M===void 0||M.emit(C["".concat(g.eventType,"_DROP")],{e:m,data:g.data||_}))})},this.cancelDrag=function(){var m=window==null?void 0:window.document;m.removeEventListener("mousemove",g.handleMouseMove,!1),m.removeEventListener("mouseup",g.handleMouseUp,!1),g.onDragEnd({event:void 0}),g.isDragging=!1},this.destroy=function(){g.isStartDragging&&g.cancelDrag()},this.onDragStart=o,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=y,this.eventType=u,this.eventCenter=p,this.model=h,this.data=v}return n.prototype.setStep=function(t){this.step=t},n.prototype.setModel=function(t){this.model=t},n}(),Vc=function(n){var t=n.x,e=n.y,o=n.width,r=n.height;return{x:t-o/2,y:e-r/2,x1:t+o/2,y1:e+r/2}},Wc=function(n){var t=n.startPoint,e=n.endPoint,o=(t.x+e.x)/2,r=(t.y+e.y)/2,i=Math.abs(t.x-e.x)+10,a=Math.abs(t.y-e.y)+10;return{x:o-i/2,y:r-a/2,x1:o+i/2,y1:r+a/2}},Fc=function(n){var t=n.points,e=je(t),o=In(e,8),r=o.x,i=o.y,a=o.width,s=o.height;return{x:r-a/2,y:i-s/2,x1:r+a/2,y1:i+s/2}},Kc=function(n){var t=n.path,e=Ti(t),o=In(e,8),r=o.x,i=o.y,a=o.width,s=o.height;return{x:r-a/2,y:i-s/2,x1:r+a/2,y1:i+s/2}},Zc=function(n){if(n.modelType===z.LINE_EDGE)return Wc(n);if(n.modelType===z.POLYLINE_EDGE)return Fc(n);if(n.modelType===z.BEZIER_EDGE)return Kc(n)},qc=function(n,t,e,o){var r=(t.y-n.y)*(o.x-e.x)-(n.x-t.x)*(e.y-o.y);if(r===0)return!1;var i=((t.x-n.x)*(o.x-e.x)*(e.y-n.y)+(t.y-n.y)*(o.x-e.x)*n.x-(o.y-e.y)*(t.x-n.x)*e.x)/r,a=-((t.y-n.y)*(o.y-e.y)*(e.x-n.x)+(t.x-n.x)*(o.y-e.y)*n.y-(o.x-e.x)*(t.y-n.y)*e.y)/r;return(i-n.x)*(i-t.x)<=0&&(a-n.y)*(a-t.y)<=0&&(i-e.x)*(i-o.x)<=0&&(a-e.y)*(a-o.y)<=0?{x:i,y:a}:!1},Rn=function(n,t,e){var o=n.x,r=n.y,i=t.x,a=t.y,s=e.x,l=e.y,u=(l-a)/(s-i),p=a-u*i;return(o>=i&&o<=s||o<=i&&o>=s)&&(r>=a&&r<=l||r<=a&&r>=l)&&Math.abs(r-u*o-p)<Number.EPSILON},Ln=function(n){var t=n.start,e=n.end,o=n.offset,r=n.verticalLength,i=n.type,a={leftX:0,leftY:0,rightX:0,rightY:0},s=Math.atan((e.y-t.y)/(e.x-t.x)),l=Math.atan(o/r),u=Math.sqrt(r*r+o*o);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},Ue=globalThis&&globalThis.__assign||function(){return Ue=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ue.apply(this,arguments)},At=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ge=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Jc=function(n,t){return Math.abs(n.centerX-t.centerX)*2<n.width+t.width&&Math.abs(n.centerY-t.centerY)*2<n.height+t.height},Nr=function(n){var t=[],e={};return n.forEach(function(o){var r="".concat(o.x,"-").concat(o.y);o.id=r,e[r]=o}),Object.keys(e).forEach(function(o){t.push(e[o])}),t},Do=function(n,t){return n.width===0&&n.height===0?n:{x:n.x,y:n.y,centerX:n.centerX,centerY:n.centerY,minX:n.minX-t,minY:n.minY-t,maxX:n.maxX+t,maxY:n.maxY+t,height:n.height+2*t,width:n.width+2*t}},$c=function(n,t){var e=Math.abs(n.x-t.centerX),o=Math.abs(n.y-t.centerY);return e/t.width>o/t.height?et.HORIZONTAL:et.VERTICAL},No=function(n,t,e){var o=$c(e,t);return o===et.HORIZONTAL?{x:e.x>n.centerX?n.maxX:n.minX,y:e.y}:{x:e.x,y:e.y>n.centerY?n.maxY:n.minY}},ya=function(n,t){var e=Math.min(n.minX,t.minX),o=Math.min(n.minY,t.minY),r=Math.max(n.maxX,t.maxX),i=Math.max(n.maxY,t.maxY);return{x:(e+r)/2,y:(o+i)/2,centerX:(e+r)/2,centerY:(o+i)/2,minX:e,minY:o,maxX:r,maxY:i,height:i-o,width:r-e}},In=function(n,t){n===void 0&&(n=[]);var e=[],o=[];n.forEach(function(p){e.push(p.x),o.push(p.y)});var r=Math.min.apply(Math,ge([],At(e),!1)),i=Math.max.apply(Math,ge([],At(e),!1)),a=Math.min.apply(Math,ge([],At(o),!1)),s=Math.max.apply(Math,ge([],At(o),!1)),l=i-r,u=s-a;return t&&(l+=t,u+=t),{centerX:(r+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:r,minY:a,x:(r+i)/2,y:(a+s)/2,height:u,width:l}},Co=function(n){var t=n.minX,e=n.minY,o=n.maxX,r=n.maxY;return[{x:t,y:e},{x:o,y:e},{x:o,y:r},{x:t,y:r}]},eo=function(n,t){var e=n.x,o=n.y;return e<t.minX||e>t.maxX||o<t.minY||o>t.maxY},Qc=function(n,t){return t<n.minX||t>n.maxX?[]:[{x:t,y:n.minY},{x:t,y:n.maxY}]},tp=function(n,t){return t<n.minY||t>n.maxY?[]:[{x:n.minX,y:t},{x:n.maxX,y:t}]},ep=function(n,t){return ge(ge([],At(Qc(n,t.x)),!1),At(tp(n,t.y)),!1)},Cr=function(n,t){return Math.abs(n.x-t.x)+Math.abs(n.y-t.y)},np=function(n,t){var e=-2,o=0;return t.forEach(function(r){r&&(n.x===r.x&&(o+=e),n.y===r.y&&(o+=e))}),o},ga=function(n,t,e,o,r){return Cr(n,t)+Cr(n,e)+np(n,[t,e,o,r])},pl=function(n,t,e,o,r){r||(r=0),n.unshift(t[o]),e[o]&&e[o]!==o&&r<=100&&pl(n,t,e,e[o],r+1)},op=function(n,t){var e=n.indexOf(t);e>-1&&n.splice(e,1)},gn=function(n,t,e,o){var r=t.x-n.x,i=t.y-n.y,a=o.x-e.x,s=o.y-e.y,l=(-i*(n.x-e.x)+r*(n.y-e.y))/(-a*i+r*s),u=(a*(n.y-e.y)-s*(n.x-e.x))/(-a*i+r*s);return l>=0&&l<=1&&u>=0&&u<=1},va=function(n,t,e){if(e.width===0&&e.height===0)return!1;var o=At(Co(e),4),r=o[0],i=o[1],a=o[2],s=o[3];return gn(n,t,r,i)||gn(n,t,r,s)||gn(n,t,i,a)||gn(n,t,a,s)},rp=function(n,t,e,o){var r=[];return n.forEach(function(i){i!==t&&(i.x===t.x||i.y===t.y)&&!va(i,t,e)&&!va(i,t,o)&&r.push(i)}),Nr(r)},ip=function(n,t,e,o,r,i,a){var s=[],l=[t],u={},p={},c={};t.id&&(p[t.id]=0,c[t.id]=ga(t,e,t));var d={};n.forEach(function(h){h.id&&(d[h.id]=h)});for(var f=function(){var h,v=1/0;if(l.forEach(function(m){m.id&&c[m.id]<v&&(v=c[m.id],h=m)}),h===e&&e.id){var g=[];return pl(g,d,u,e.id),{value:g}}if(!h)return{value:[t,e]};op(l,h),s.push(h),rp(n,h,o,r).forEach(function(m){if(s.indexOf(m)===-1&&(l.indexOf(m)===-1&&l.push(m),h!=null&&h.id&&m!=null&&m.id)){var O=c[h.id]+Cr(h,m);if(p[m.id]&&O>=p[m.id])return;u[m.id]=h.id,p[m.id]=O,c[m.id]=p[m.id]+ga(m,e,t,i,a)}})};l.length;){var y=f();if(typeof y=="object")return y.value}return[t,e]},ma=function(n){return Ot(n)},dl=function(n){for(var t=1;t<n.length-1;){var e=n[t-1],o=n[t],r=n[t+1];e.x===o.x&&o.x===r.x||e.y===o.y&&o.y===r.y?n.splice(t,1):t++}return n},_a=function(n,t,e,o,r){var i=ma(e),a=ma(o),s=Do(i,r),l=Do(a,r),u=No(s,i,n),p=No(l,a,t);if(Jc(s,l)){var c=sp(n,t,u,p);return ge(ge([n,u],At(c),!1),[p,t],!1)}var d=In([u,p]),f=ya(s,d),y=ya(l,d),h=[];h=h.concat(Co(f)),h=h.concat(Co(y));var v={x:(n.x+t.x)/2,y:(n.y+t.y)/2};[d,f,y].forEach(function(m){h=h.concat(ep(m,v).filter(function(O){return eo(O,s)&&eo(O,l)}))}),[{x:u.x,y:p.y},{x:p.x,y:u.y}].forEach(function(m){eo(m,s)&&eo(m,l)&&h.push(m)}),h.unshift(u),h.push(p),h=Nr(h);var g=ip(h,u,p,i,a,n,t);return g.unshift(n),g.push(t),g.length>2&&(g=dl(g)),Nr(g)},ap=function(n){if(n.length===1){var t=At(n,1),e=t[0];return[e,e]}else{for(var o=n[0],r=n[1],i=Ht(o.x,o.y,r.x,r.y),a=1;a<n.length-1;a++){var s=n[a],l=n[a+1],u=Ht(s.x,s.y,l.x,l.y);u>i&&(i=u,o=s,r=l)}return[o,r]}},ba=function(n,t,e){var o=se(n,e),r=se(t,e);return o&&r},xa=function(n,t,e){var o=se(n,e),r=se(t,e),i=o&&r,a=o||r;return!i&&a},Ea=function(n,t,e){for(var o=void 0,r=Ot(e),i=Co(r),a=0;a<i.length;a++){var s=gn(n,t,i[a],i[(a+1)%i.length]);s&&(o=[i[a],i[(a+1)%i.length]])}if(o)return qc(n,t,o[0],o[1])},jo=function(n,t){var e=void 0;return n.x===t.x?e=et.VERTICAL:n.y===t.y&&(e=et.HORIZONTAL),e},je=function(n){var t=n.split(" "),e=[];return t&&t.forEach(function(o){var r=At(o.split(","),2),i=r[0],a=r[1];e.push({x:Number(i),y:Number(a)})}),e},sp=function(n,t,e,o){var r=[],i=jo(n,e),a=jo(t,o);if(i===a)n.y===e.y?(r.push({x:e.x,y:(e.y+o.y)/2}),r.push({x:o.x,y:(e.y+o.y)/2})):(r.push({x:(e.x+o.x)/2,y:e.y}),r.push({x:(e.x+o.x)/2,y:o.y}));else{var s={x:e.x,y:o.y},l=Rn(s,n,e),u=Rn(s,t,o);if(l||u)s={x:o.x,y:e.y};else{var p=Ta(s,n,e),c=Ta(s,t,o);p&&c&&(s={x:o.x,y:e.y})}r.push(s)}return r},Ta=function(n,t,e){return n.x===t.x&&n.x===e.x||n.y===t.y&&n.y===e.y},fl=function(n){if(!n)return 0;for(var t=0,e=0;e<n.length;e++){var o=n.charCodeAt(e);n.match(/[A-Z]/)?t+=1.5:o>=1&&o<=126||o>=65376&&o<=65439?t+=1:t+=2}return t},lp=function(n){var t=n.start,e=n.end,o;if(t.x===e.x&&t.y===e.y)o="";else{var r={start:t,end:e,offset:10,verticalLength:5},i=Ln(Ue(Ue({},r),{type:"start"})),a=Ln(Ue(Ue({},r),{type:"end"}));o="M".concat(i.leftX," ").concat(i.leftY,`
- L`).concat(i.rightX," ").concat(i.rightY,`
- L`).concat(a.rightX," ").concat(a.rightY,`
- L`).concat(a.leftX," ").concat(a.leftY," z")}return{d:o,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},Oa=function(n){var t=n.start,e=n.end,o=n.sourceNode,r=n.targetNode,i=n.offset,a=Ot(o),s=Ot(r),l=Do(a,i),u=Do(s,i),p=No(l,a,t),c=No(u,s,e);return{sNext:p,ePre:c}},Ti=function(n){var t=n.replace(/M/g,"").replace(/C/g,",").split(","),e=no(t[0]),o=no(t[1]),r=no(t[2]),i=no(t[3]);return[e,o,r,i]},no=function(n){var t=At(n.replace(/(^\s*)/g,"").split(" "),2),e=t[0],o=t[1];return{x:+e,y:+o}},wa=function(n,t){var e=At(n,4),o=e[0],r=e[1],i=e[2],a=e[3],s=$p(o,r,i,a,t);return[s,n[3]]},hl=function(n,t){for(var e=n.x,o=n.y,r=je(t),i=Number.MAX_SAFE_INTEGER,a,s=[],l=0;l<r.length;l++)s.push({start:r[l],end:r[(l+1)%r.length]});if(s.forEach(function(d){var f=d.start,y=d.end;if(f.x===y.x){var h={x:f.x,y:o},v=Rn(h,f,y);if(v){var g=Math.abs(f.x-e);g<i&&(i=g,a=h)}}else if(f.y===y.y){var h={x:e,y:f.y},v=Rn(h,f,y);if(v){var g=Math.abs(f.y-o);g<i&&(i=g,a=h)}}}),!a){var u=s[0],p=u.start,c=u.end;a={x:p.x+(c.x-p.x)/2,y:p.y+(c.y-p.y)/2}}return a},up=function(n){return Ge(n,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},Sa=function(n,t){return Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))};function cp(n,t){return typeof t!="function"?function(e,o,r){return Object.assign({type:n.edgeType},r)}:function(e,o,r){var i=t(e,o,r);return i?typeof i=="string"?Object.assign({},r,{type:i}):Object.assign({type:i},r):{type:n.edgeType}}}var pp=function(n){var t=n.rows,e=n.rowsLength,o=n.fontSize,r=0;return at(t,function(i){var a=fl(i);r=a>r?a:r}),{width:Math.ceil(r/2)*o+o/4,height:e*(o+2)+o/4}},Ie=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},oo=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))};function nn(n,t,e){return e&&t*Math.round(n/t)||n}function dp(n,t,e){if(!n)return[];var o=Math.min.apply(Math,oo([],Ie(n.map(function(h){return h[0]})),!1)),r=Math.max.apply(Math,oo([],Ie(n.map(function(h){return h[0]})),!1)),i=Math.min.apply(Math,oo([],Ie(n.map(function(h){return h[1]})),!1)),a=Math.max.apply(Math,oo([],Ie(n.map(function(h){return h[1]})),!1)),s=-o,l=-i,u=n.map(function(h){var v=Ie(h,2),g=v[0],m=v[1];return[g+s,m+l]}),p=r-o,c=a-i,d=t?t/p:1,f=e?e/c:1,y=Math.min(d,f);return u.map(function(h){var v=Ie(h,2),g=v[0],m=v[1];return[g*y,m*y]})}var lr=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ur=function(n,t,e){var o=lr(n,2),r=o[0],i=o[1],a=lr(t,2),s=a[0],l=a[1],u=lr(e,2),p=u[0],c=u[1];return r>s&&r<p&&i>l&&i<c},yl=function(n,t){var e=t.multipleSelectKey,o=!1;switch(e){case"meta":o=n.metaKey;break;case"alt":o=n.altKey;break;case"shift":o=n.shiftKey;break;case"ctrl":o=n.ctrlKey;break;default:o=!1;break}return o},Oi=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}();function Ma(n,t){return n instanceof yt&&t instanceof yt}var gl=function(n){Oi(t,n);function t(e,o,r){var i=n.call(this,3)||this;return i[0]=e,i[1]=o,i[2]=r,i.x=e,i.y=o,i.z=r,Object.setPrototypeOf(i,t.prototype),i}return t.prototype.add=function(e){if(Ma(this,e))return new yt(this.x+e.x,this.y+e.y);var o=this.z+e.z;return new jr((this.x+e.x)/o,(this.y+e.y)/o)},t.prototype.subtract=function(e){if(Ma(this,e))return new yt(this.x-e.x,this.y-e.y);var o=this.z-e.z;return o===0?new yt(this.x-e.x,this.y-e.y):new jr((this.x-e.x)/o,(this.y-e.y)/o)},t}(Array),yt=function(n){Oi(t,n);function t(e,o,r){var i=n.call(this,e,o,r!=null?r:0)||this;return Object.setPrototypeOf(i,t.prototype),i}return t.prototype.toString=function(){return"Vector"},t.prototype.dot=function(e){var o=this;return e.reduce(function(r,i,a){return r+i*o[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 o=this.crossZ(e),r=Math.acos(this.normalize().dot(e.normalize()));return o>=0?r:-r},t}(gl),jr=function(n){Oi(t,n);function t(e,o){var r=n.call(this,e,o,1)||this;return Object.setPrototypeOf(r,t.prototype),r}return t.prototype.toString=function(){return"Point"},t}(gl),Qo=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),ke=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},cr=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Fn=function(n){Qo(t,n);function t(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=n.call(this,e.length)||this;return r.fill(new Array(3)),e.forEach(function(i,a){r[a]=i}),r.columns=e[0].length,r.rows=e.length,Object.setPrototypeOf(r,t.prototype),r}return t.prototype.getRow=function(e){return this[e]},t.prototype.getColumn=function(e){return cr([],ke(this.map(function(o){return o[e]})),!1)},t.prototype.transpose=function(){for(var e=[],o=0;o<this.columns;o++)e.push(this.getColumn(o));return new(t.bind.apply(t,cr([void 0],ke(e),!1)))},t.prototype.cross=function(e){var o=new Array(this.rows).fill("").map(function(){return[]});if(this.columns===e.rows)for(var r=0;r<this.rows;r++)for(var i=this.getRow(r),a=function(l){var u=e.getColumn(l);o[r][l]=i.reduce(function(p,c,d){return p+c*u[d]},0)},s=0;s<e.columns;s++)a(s);return new(t.bind.apply(t,cr([void 0],ke(o),!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 jr(e[0],e[1])})},t.prototype.toString=function(){var e=ke(this[0],2),o=e[0],r=e[1],i=ke(this[1],2),a=i[0],s=i[1],l=ke(this[2],2),u=l[0],p=l[1];return"matrix(".concat(o," ").concat(r," ").concat(a," ").concat(s," ").concat(u," ").concat(p,")")},t.prototype.translate=function(e,o){return this.cross(new Ro(e,o))},t.prototype.rotate=function(e){return this.cross(new fp(e))},t.prototype.scale=function(e,o){return this.cross(new hp(e,o))},t}(Array),fp=function(n){Qo(t,n);function t(e){var o=n.call(this,new yt(+Math.cos(e).toFixed(2),+Math.sin(e).toFixed(2),0),new yt(-Math.sin(e).toFixed(2),+Math.cos(e).toFixed(2),0),new yt(0,0,1))||this;return Object.setPrototypeOf(o,t.prototype),o}return t.prototype.inverse=function(){return this.transpose()},t}(Fn),hp=function(n){Qo(t,n);function t(e,o){var r=n.call(this,new yt(e,0,0),new yt(0,o,0),new yt(0,0,1))||this;return r.sx=e,r.sy=o,Object.setPrototypeOf(r,t.prototype),r}return t.prototype.inverse=function(){return new t(1/this.sx,1/this.sy)},t}(Fn),Ro=function(n){Qo(t,n);function t(e,o){var r=n.call(this,new yt(1,0,0),new yt(0,1,0),new yt(e,o,1))||this;return r.tx=e,r.ty=o,Object.setPrototypeOf(r,t.prototype),r}return t.prototype.inverse=function(){return new t(-this.tx,-this.ty)},t}(Fn);Uu({isolateGlobalState:!0});var Lo=globalThis&&globalThis.__assign||function(){return Lo=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Lo.apply(this,arguments)},yp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Rr=function(n){var t=n.anchors;return t},Io=function(n,t){for(var e=t.nodes,o,r=e.length-1;r>=0;r--){var i=e[r],a=mp(n,i);if(a){var s=i.getTargetAnchor(n);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!o||gp(i,o.node,t))&&(o=l)}}}return o},gp=function(n,t,e){return n.zIndex>t.zIndex?!0:e.nodesMap[n.id].index>e.nodesMap[t.id].index},vp=function(n,t){for(var e=Rr(t),o,r=Number.MAX_SAFE_INTEGER,i=0;i<e.length;i++){var a=Ht(n.x,n.y,e[i].x,e[i].y);a<r&&(r=a,o={index:i,anchor:Lo(Lo({},e[i]),{x:e[i].x,y:e[i].y,id:e[i].id})})}return o},Ht=function(n,t,e,o){return Math.hypot(n-e,t-o)},se=function(n,t,e){e===void 0&&(e=0);var o=!1,r=Ot(t),i=yp(new Fn([n.x,n.y,1]).translate(-t.x,-t.y).rotate(-t.rotate).translate(t.x,t.y)[0],2),a=i[0],s=i[1],l={x:a,y:s};return l.x>=r.minX-e&&l.x<=r.maxX+e&&l.y>=r.minY-e&&l.y<=r.maxY+e&&(o=!0),o},mp=function(n,t){return se(n,t,5)},Ot=function(n){var t=n.x,e=n.y,o=n.width,r=n.height;return{minX:t-o/2,minY:e-r/2,maxX:t+o/2,maxY:e+r/2,x:t,y:e,width:o,height:r,centerX:t,centerY:e}},_p=function(n){var t=n,e=t.x,o=t.y,r=t.width,i=t.height,a=t.radius;return[{x:e-r/2+a,y:o-i/2+a,r:a},{x:e+r/2-a,y:o-i/2+a,r:a},{x:e-r/2+a,y:o+i/2-a,r:a},{x:e+r/2-a,y:o+i/2-a,r:a}]},Aa=function(n,t,e){var o=_p(e),r,i=Number.MAX_SAFE_INTEGER;return o.forEach(function(a){var s=Ht(n.x,n.y,a.x,a.y);s<i&&(i=s,r=a)}),Lr(n,t,r)},Lr=function(n,t,e){var o,r=e.x,i=e.y,a=e.r;if(t===et.HORIZONTAL){var s=r-Math.sqrt(a*a-(n.y-i)*(n.y-i)),l=r+Math.sqrt(a*a-(n.y-i)*(n.y-i)),u=Math.abs(s-n.x)<Math.abs(l-n.x)?s:l;o={x:u,y:n.y}}else if(t===et.VERTICAL){var p=i-Math.sqrt(a*a-(n.x-r)*(n.x-r)),c=i+Math.sqrt(a*a-(n.x-r)*(n.x-r)),d=Math.abs(p-n.y)<Math.abs(c-n.y)?p:c;o={x:n.x,y:d}}return o},Pa=function(n,t){var e=t,o=!1,r=e.x,i=e.y,a=e.width,s=e.height,l=e.radius,u={minX:r-a/2+l,maxX:r+a/2-l,minY:i-s/2+l,maxY:i+s/2-l};return n.y===i+s/2||n.y===i-s/2?o=n.x>u.minX&&n.x<u.maxX:(n.x===r+a/2||n.x===r-a/2)&&(o=n.y>u.minY&&n.y<u.maxY),o},Da=function(n,t,e){var o,r=e,i=r.x,a=r.y,s=r.rx,l=r.ry;if(t===et.HORIZONTAL){var u=i-Math.sqrt(s*s-(n.y-a)*(n.y-a)*s*s/(l*l)),p=i+Math.sqrt(s*s-(n.y-a)*(n.y-a)*s*s/(l*l)),c=Math.abs(u-n.x)<Math.abs(p-n.x)?u:p;o={x:c,y:n.y}}else if(t===et.VERTICAL){var d=a-Math.sqrt(l*l-(n.x-i)*(n.x-i)*l*l/(s*s)),f=a+Math.sqrt(l*l-(n.x-i)*(n.x-i)*l*l/(s*s)),y=Math.abs(d-n.y)<Math.abs(f-n.y)?d:f;o={x:n.x,y}}return o},ro=function(n,t,e){for(var o=e.pointsPosition,r=Number.MAX_SAFE_INTEGER,i,a=[],s=0;s<o.length;s++)a.push({start:o[s],end:o[(s+1)%o.length]});return a.forEach(function(l){var u=l.start,p=l.end,c=u,d=p;u.x>p.x&&(c=p,d=u);var f={x:n.x,y:n.y};if(c.x===d.x&&t===et.HORIZONTAL&&(f={x:c.x,y:n.y}),c.y===d.y&&t===et.VERTICAL&&(f={x:n.x,y:c.y}),c.x!==d.x&&c.y!==d.y){var y=(d.y-c.y)/(d.x-c.x),h=(c.x*d.y-d.x*c.y)/(c.x-d.x);t===et.HORIZONTAL?f={x:(n.y-h)/y,y:n.y}:t===et.VERTICAL&&(f={x:n.x,y:y*n.x+h})}var v=Rn(f,u,p);if(v){var g=Ht(f.x,f.y,n.x,n.y);g<r&&(r=g,i=f)}}),i},bp=function(n){var t=Ge(n,["id","type","x","y","text","label","properties","virtual","rotate","resizable","rotatable"]);return t},Na=function(n,t,e,o){var r=n.x,i=n.y;return t.x>n.x?r=n.x+e/2:t.x<n.x&&(r=n.x-e/2),t.y>n.y?i=n.y+o/2:t.y<n.y&&(i=n.y-o/2),{x:r,y:i}},vl=function(n){var t=n.rows,e=n.style,o=n.rowsLength,r=n.className,i=document.createElement("div");i.className=r,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)),o>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},Ca=function(n){var t=n.rows,e=n.rowsLength,o=n.fontSize,r=0;return t&&t.forEach(function(i){var a=fl(i);r=a>r?a:r}),{width:Math.ceil(r/2)*o+o/4,height:e*(o+2)+o/4}},ko=function(n){return typeof n!="object"?{isAllPass:!!n,msg:n?"":"不允许连接"}:n};let io;const xp=new Uint8Array(16);function Ep(){if(!io&&(io=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!io))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return io(xp)}const dt=[];for(let n=0;n<256;++n)dt.push((n+256).toString(16).slice(1));function Tp(n,t=0){return dt[n[t+0]]+dt[n[t+1]]+dt[n[t+2]]+dt[n[t+3]]+"-"+dt[n[t+4]]+dt[n[t+5]]+"-"+dt[n[t+6]]+dt[n[t+7]]+"-"+dt[n[t+8]]+dt[n[t+9]]+"-"+dt[n[t+10]]+dt[n[t+11]]+dt[n[t+12]]+dt[n[t+13]]+dt[n[t+14]]+dt[n[t+15]]}const Op=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ja={randomUUID:Op};function wp(n,t,e){if(ja.randomUUID&&!t&&!n)return ja.randomUUID();n=n||{};const o=n.random||(n.rng||Ep)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,t){e=e||0;for(let r=0;r<16;++r)t[e+r]=o[r];return t}return Tp(o)}var De=function(){return wp()},_n=new Map,ml=function(n){var t=De();function e(){n();var r=_n.get(t);if(r){var i=window.requestAnimationFrame(e);_n.set(t,i)}}var o=window.requestAnimationFrame(e);return _n.set(t,o),t},Bo=function(n){var t=_n.get(n);t&&(window.cancelAnimationFrame(t),_n.delete(n))},kn=globalThis&&globalThis.__assign||function(){return kn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},kn.apply(this,arguments)},Sp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function _l(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.value,a=n.fontSize,s=a===void 0?12:a,l=n.fill,u=l===void 0?"currentColor":l,p=n.overflowMode,c=p===void 0?"default":p,d=n.textWidth,f=d===void 0?void 0:d,y=n.model,h={x:e,y:r,fill:u,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(at(me(n),function(w){var M=Sp(w,2),_=M[0],T=M[1];typeof T!="object"&&(h[_]=T)}),i){var v=String(i).split(/[\r\n]/g),g=v.length;if(c!=="default"){var m=y.BaseType,O=y.modelType;if(m===rt.NODE&&O!==z.TEXT_NODE||m===rt.EDGE&&f)return Mp(n)}if(g>1){var S=v.map(function(w,M){var _=s+2,T=(M-(g-1)/2)*_;return E("tspan",{className:"lf-text-tspan",x:e,y:r+T,children:w})});return E("text",kn({},h,{children:S}))}return E("text",kn({},h,{children:i}))}return null}function Mp(n){var t=n.x,e=n.y,o=n.value,r=n.model,i=n.textWidth,a=n.fontSize,s=a===void 0?12:a,l=n.lineHeight,u=n.fontFamily,p=u===void 0?"":u,c=n.wrapPadding,d=c===void 0?"0, 0":c,f=n.overflowMode,y=r.width,h=r.height,v=r.textHeight,g=i||y,m=String(o).split(/[\r\n]/g),O=m.length,S=vl({rows:m,style:{fontSize:"".concat(s,"px"),width:"".concat(g,"px"),fontFamily:p,lineHeight:l,padding:d},rowsLength:O,className:"lf-get-text-height"}),w=h>S?h:S;v&&(w=v);var M=f==="ellipsis";return M&&(w=s+2),E("g",{children:E("foreignObject",{width:g,height:w,x:t-g/2,y:e-w/2,style:{overflow:"visible",textAlign:"left"},children:E("div",{className:"lf-node-text-auto-wrap",style:{minHeight:w,width:g,padding:d},children:E("div",{className:M?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:M?m.join(""):"",style:kn({},n),children:m.map(function(_){return E("div",{className:"lf-node-text--auto-wrap-inner",children:_})})})})})})}var Ir=globalThis&&globalThis.__assign||function(){return Ir=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ir.apply(this,arguments)},Ap=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function on(n){var t={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return at(me(n),function(e){var o=Ap(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),E("line",Ir({},t))}var kr=globalThis&&globalThis.__assign||function(){return kr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},kr.apply(this,arguments)},Pp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function Jt(n){var t=n.x,e=n.y,o=n.width,r=n.height,i=n.className,a=n.strokeWidth,s=n.radius,l=s===void 0?0:s,u=t-o/2,p=e-r/2,c={};return c["stroke-width"]=a,at(me(n),function(d){var f=Pp(d,2),y=f[0],h=f[1];typeof h!="object"&&(c[y]=h)}),i?c.className="lf-basic-shape ".concat(i):c.className="lf-basic-shape",l&&(c.rx=l,c.ry=l),c.x=u,c.y=p,E("rect",kr({},c))}var Br=globalThis&&globalThis.__assign||function(){return Br=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Br.apply(this,arguments)},Dp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function Bn(n){var t={d:""};return at(me(n),function(e){var o=Dp(e,2),r=o[0],i=o[1];(r==="style"||typeof i!="object")&&(t[r]=i)}),E("path",Br({},t))}var Xr=globalThis&&globalThis.__assign||function(){return Xr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Xr.apply(this,arguments)},Np=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function rn(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.r,a=i===void 0?4:i,s=n.className,l={cx:e,cy:r,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return at(me(n),function(u){var p=Np(u,2),c=p[0],d=p[1];typeof d!="object"&&(l[c]=d)}),s?l.className="lf-basic-shape ".concat(s):l.className="lf-basic-shape",E("circle",Xr({},l))}var Hr=globalThis&&globalThis.__assign||function(){return Hr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Hr.apply(this,arguments)},Cp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function jp(n){var t=n.x,e=t===void 0?0:t,o=n.y,r=o===void 0?0:o,i=n.rx,a=i===void 0?4:i,s=n.ry,l=s===void 0?4:s,u=n.className,p={cx:e,cy:r,rx:a,ry:l,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return at(me(n),function(c){var d=Cp(c,2),f=d[0],y=d[1];typeof y!="object"&&(p[f]=y)}),u?p.className="lf-basic-shape ".concat(u):p.className="lf-basic-shape",E("ellipse",Hr({},p))}var zr=globalThis&&globalThis.__assign||function(){return zr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zr.apply(this,arguments)},Rp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function bl(n){var t=n.points,e=t===void 0?[]:t,o=n.className,r={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return at(me(n),function(i){var a=Rp(i,2),s=a[0],l=a[1];typeof l!="object"&&(r[s]=l)}),o?r.classNmae="lf-basic-shape ".concat(o):r.className="lf-basic-shape",r.points=e.map(function(i){return i.join(",")}).join(" "),E("polygon",zr({},r))}var Gr=globalThis&&globalThis.__assign||function(){return Gr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Gr.apply(this,arguments)},Lp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i};function Ip(n){var t=n.className,e={points:"",fill:"none"};return at(me(n),function(o){var r=Lp(o,2),i=r[0],a=r[1];(i==="style"||typeof a!="object")&&(e[i]=a)}),t&&(e.className="".concat(t)),E("polyline",Gr({},e))}var xl=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Xn=globalThis&&globalThis.__assign||function(){return Xn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Xn.apply(this,arguments)},kp=globalThis&&globalThis.__rest||function(n,t){var e={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(e[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(e[o[r]]=n[o[r]]);return e},Bp=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},$;(function(n){n[n.LEFT_TOP=0]="LEFT_TOP",n[n.RIGHT_TOP=1]="RIGHT_TOP",n[n.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",n[n.LEFT_BOTTOM=3]="LEFT_BOTTOM"})($||($={}));var Xp=function(n){xl(t,n);function t(e){var o=n.call(this)||this;o.updateEdgePointByAnchors=function(){var s=o.nodeModel,l=s.id,u=s.anchors,p=o.graphModel.getNodeEdges(l);at(p,function(c){if(c.sourceNodeId===l){var d=Ne(u,function(f){return f.id===c.sourceAnchorId});d&&c.updateStartPoint({x:d.x,y:d.y})}else if(c.targetNodeId===l){var d=Ne(u,function(y){return y.id===c.targetAnchorId});d&&c.updateEndPoint({x:d.x,y:d.y})}})},o.triggerResizeEvent=function(s,l,u,p,c,d){o.graphModel.eventCenter.emit(C.NODE_RESIZE,{preData:s,data:l,deltaX:u,deltaY:p,index:c,model:d})},o.recalcResizeInfo=function(s,l,u,p,c){u===void 0&&(u=1),p===void 0&&(p=!1),c===void 0&&(c=!1);var d=X(l),f=d.deltaX,y=d.deltaY,h=d.width,v=d.height,g=d.PCTResizeInfo;if(g){var m=4,O=0,S=0;switch(s){case $.LEFT_TOP:S=(f*-1-y)/m;break;case $.RIGHT_TOP:S=(f-y)/m;break;case $.RIGHT_BOTTOM:S=(f+y)/m;break;case $.LEFT_BOTTOM:S=(f*-1+y)/m;break}S!==0&&(O=Math.round(S/g.ResizeBasis.basisHeight*1e5)/1e3),g.ResizePCT.widthPCT=Math.max(Math.min(g.ResizePCT.widthPCT+O,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit),g.ResizePCT.heightPCT=Math.max(Math.min(g.ResizePCT.heightPCT+O,g.ScaleLimit.maxScaleLimit),g.ScaleLimit.minScaleLimit);var w=Math.round(g.ResizePCT.widthPCT*g.ResizeBasis.basisWidth/100),M=Math.round(g.ResizePCT.heightPCT*g.ResizeBasis.basisHeight/100);switch(s){case $.LEFT_TOP:f=h-w,y=v-M;break;case $.RIGHT_TOP:f=w-h,y=v-M;break;case $.RIGHT_BOTTOM:f=w-h,y=M-v;break;case $.LEFT_BOTTOM:f=h-w,y=M-v;break}return d}switch(s){case $.LEFT_TOP:d.width=p?h:h-f*u,d.height=c?v:v-y*u;break;case $.RIGHT_TOP:d.width=p?h:h+f*u,d.height=c?v:v-y*u;break;case $.RIGHT_BOTTOM:d.width=p?h:h+f*u,d.height=c?v:v+y*u;break;case $.LEFT_BOTTOM:d.width=p?h:h-f*u,d.height=c?v:v+y*u;break}return d},o.resizeNode=function(s){var l=s.deltaX,u=s.deltaY,p=o.index,c=o.props,d=c.model,f=c.graphModel,y=c.x,h=c.y;Kp({x:y,y:h,deltaX:l,deltaY:u,index:p,nodeModel:d,graphModel:f,cancelCallback:function(){o.dragHandler.cancelDrag()}})},o.onDragStart=function(){o.graphModel.selectNodeById(o.nodeModel.id)},o.onDragging=function(s){var l=s.deltaX,u=s.deltaY,p=o.graphModel.transformModel,c=Bp(p.fixDeltaXY(l,u),2),d=c[0],f=c[1];o.resizeNode({deltaX:d,deltaY:f})},o.onDragEnd=function(){var s=o.nodeModel.x,l=o.nodeModel.y;o.nodeModel.moveTo(s,l),o.updateEdgePointByAnchors()};var r=e.index,i=e.model,a=e.graphModel;return o.index=r,o.nodeModel=i,o.graphModel=a,o.dragHandler=new ne({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:a.gridSize}),o}return t.prototype.componentWillUnmount=function(){this.dragHandler.destroy()},t.prototype.render=function(){var e=this.props,o=e.x,r=e.y,i=e.direction,a=e.model,s=a.getResizeControlStyle(),l=s.width,u=s.height,p=kp(s,["width","height"]);return E("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[E(Jt,Xn({className:"lf-resize-control-content",x:o,y:r,width:l!=null?l:7,height:u!=null?u:7},p)),E(Jt,{className:"lf-resize-control-content",x:o,y:r,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},t}(Y),Hp=function(n){xl(t,n);function t(){return n.call(this)||this}return t.prototype.getResizeControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=Ot(o),a=i.minX,s=i.minY,l=i.maxX,u=i.maxY,p=[{index:$.LEFT_TOP,direction:"nw",x:a,y:s},{index:$.RIGHT_TOP,direction:"ne",x:l,y:s},{index:$.RIGHT_BOTTOM,direction:"se",x:l,y:u},{index:$.LEFT_BOTTOM,direction:"sw",x:a,y:u}];return le(p,function(c){return E(Xp,Xn({},c,{model:o,graphModel:r}))})},t.prototype.getResizeOutline=function(){var e=this.props.model,o=e.x,r=e.y,i=e.width,a=e.height,s=e.getResizeOutlineStyle();return E(Jt,Xn({},s,{x:o,y:r,width:i,height:a}))},t.prototype.render=function(){return E("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},t}(Y);function zp(n,t){var e=n.x,o=n.y,r=t.x,i=t.y,a={x:e+(r-e)/2,y:o+(i-o)/2};return a}function vn(n,t,e){var o=Gp(e),r=n.x-t.x,i=n.y-t.y,a=r*Math.cos(o)-i*Math.sin(o)+t.x,s=r*Math.sin(o)+i*Math.cos(o)+t.y;return{x:a,y:s}}function Gp(n){return n*Math.PI/180}function Yp(n){return n/Math.PI*180}function Up(n,t,e,o,r,i,a,s,l){s===void 0&&(s=!1),l===void 0&&(l=!1);var u=t.deltaX,p=t.deltaY,c=t.width,d=t.height,f=Yp(e),y={x:o,y:r},h={x:i,y:a},v=vn(y,h,f),g={x:v.x+u,y:v.y+p},m=Zp(v,g,h,f,s,l,c,d),O=m.width,S=m.height,w=m.center;return t.width=O*n,t.height=S*n,t.deltaX=(w.x-h.x)*2,t.deltaY=(w.y-h.y)*2,t}var Vp=function(n,t,e,o,r,i,a,s,l,u){e===void 0&&(e=1),o===void 0&&(o=!1),r===void 0&&(r=!1),i===void 0&&(i=0);var p=X(t),c=p.deltaX,d=p.deltaY,f=p.width,y=p.height,h=p.PCTResizeInfo;if(h){var v=4,g=0,m=0;switch(n){case $.LEFT_TOP:m=(c*-1-d)/v;break;case $.RIGHT_TOP:m=(c-d)/v;break;case $.RIGHT_BOTTOM:m=(c+d)/v;break;case $.LEFT_BOTTOM:m=(c*-1+d)/v;break}m!==0&&(g=Math.round(m/h.ResizeBasis.basisHeight*1e5)/1e3),h.ResizePCT.widthPCT=Math.max(Math.min(h.ResizePCT.widthPCT+g,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit),h.ResizePCT.heightPCT=Math.max(Math.min(h.ResizePCT.heightPCT+g,h.ScaleLimit.maxScaleLimit),h.ScaleLimit.minScaleLimit);var O=Math.round(h.ResizePCT.widthPCT*h.ResizeBasis.basisWidth/100),S=Math.round(h.ResizePCT.heightPCT*h.ResizeBasis.basisHeight/100);switch(n){case $.LEFT_TOP:c=f-O,d=y-S;break;case $.RIGHT_TOP:c=O-f,d=y-S;break;case $.RIGHT_BOTTOM:c=O-f,d=S-y;break;case $.LEFT_BOTTOM:c=f-O,d=S-y;break}return p}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return Up(e,p,i,a,s,l,u,o,r);switch(n){case $.LEFT_TOP:p.width=o?f:f-c*e,p.height=r?y:y-d*e;break;case $.RIGHT_TOP:p.width=o?f:f+c*e,p.height=r?y:y-d*e;break;case $.RIGHT_BOTTOM:p.width=o?f:f+c*e,p.height=r?y:y+d*e;break;case $.LEFT_BOTTOM:p.width=o?f:f-c*e,p.height=r?y:y+d*e;break}return p},Wp=function(n,t){var e=n.id,o=n.anchors,r=t.getNodeEdges(e);at(r,function(i){if(i.sourceNodeId===e){var a=Ne(o,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===e){var a=Ne(o,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},Fp=function(n,t,e,o,r,i,a){a.eventCenter.emit(C.NODE_RESIZE,{preData:n,data:t,deltaX:e,deltaY:o,index:r,model:i})},Kp=function(n){var t=n.x,e=n.y,o=n.deltaX,r=n.deltaY,i=n.index,a=n.nodeModel,s=n.graphModel,l=n.cancelCallback,u=a.r,p=a.rx,c=a.ry,d=a.width,f=a.height,y=a.PCTResizeInfo,h=a.minWidth,v=a.minHeight,g=a.maxWidth,m=a.maxHeight,O=a.rotate,S=a.x,w=a.y,M=h===g,_=v===m,T={width:u||p||d,height:u||c||f,deltaX:o,deltaY:r,PCTResizeInfo:y},A=u||p&&c?1/2:1,P=t,k=e,I=Vp(i,T,A,M,_,O,P,k,S,w);if(I.width<h||I.width>g||I.height<v||I.height>m){l==null||l();return}(O%(2*Math.PI)==0||y||P===void 0||k===void 0)&&(I.deltaX=M?0:I.deltaX,I.deltaY=_?0:I.deltaY);var nt=a.getData(),Z=a.resize(I);nt.x===Z.x&&nt.y===Z.y||(Wp(a,s),Fp(nt,Z,o,r,i,a,s))};function Zp(n,t,e,o,r,i,a,s){r===void 0&&(r=!1),i===void 0&&(i=!1);var l={x:e.x-(n.x-e.x),y:e.y-(n.y-e.y)},u=zp(l,t),p=vn(t,u,-o),c=vn(l,u,-o);if(r){var d=Math.abs(p.x-c.x),f=d-a;u.x>p.x?u.x=u.x+f/2:u.x=u.x-f/2}if(i){var y=Math.abs(p.y-c.y),h=y-s;u.y>p.y?u.y=u.y+h/2:u.y=u.y-h/2}if(r||i){var v=vn(c,u,o),g=v.x-l.x,m=v.y-l.y;u.x=u.x-g,u.y=u.y-m,c=vn(l,u,-o),p={x:u.x-(c.x-u.x),y:u.y-(c.y-u.y)}}var O=Math.abs(p.x-c.x),S=Math.abs(p.y-c.y);return r&&(O=a),i&&(S=s),{width:O,height:S,center:u}}var qp=100,Jp={x:1,y:0,z:0};function $p(n,t,e,o,r){for(var i=function(f){if(f<0||f>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:n.x*Math.pow(1-f,3)+3*t.x*f*Math.pow(1-f,2)+3*e.x*Math.pow(f,2)*(1-f)+o.x*Math.pow(f,3),y:n.y*Math.pow(1-f,3)+3*t.y*f*Math.pow(1-f,2)+3*e.y*Math.pow(f,2)*(1-f)+o.y*Math.pow(f,3)}},a=0,s=2,l=o.x,u=o.y,p=o;a<r&&s<50;){p=i(1-s/qp);var c=p.x,d=p.y;a=Ht(l,u,c,d),s++}return p}function Qp(n,t){return n.x*t.y-n.y*t.x}function td(n,t){var e=[n.x,n.y,n.z],o=[t.x,t.y,t.z];return o.reduce(function(r,i,a){return r+i*e[a]})}function ed(n,t){var e=Qp(n,t),o=Math.acos(td(Ra(n),Ra(t)));return e>=0?o:-o}function Ra(n){var t=Math.hypot(n.x,n.y);return{x:n.x/t,y:n.y/t,z:0}}function nd(n){return ed(Jp,n)}function od(n){return n*(180/Math.PI)}var rd={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},El=function(n){var t=X(rd);return n&&(t=ii(t,n)),t},id=El,ad=1e3,sd=999,wi=function(){return++ad},ld=function(){return--sd},lt=globalThis&&globalThis.__assign||function(){return lt=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},lt.apply(this,arguments)},j=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},tr=function(){function n(t,e){var o;this.BaseType=rt.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Pt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=F.DEFAULT,this.modelType=z.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=e,this.properties=(o=t.properties)!==null&&o!==void 0?o:{},this.initEdgeData(t),this.setAttributes()}return n.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,o=e&&e(t.type),r=this.createId();t.id=r||o||De()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,Q(this,up(t));var a=this.graphModel.overlapMode;a===Xt.INCREASE&&(this.zIndex=t.zIndex||wi()),this.setAnchors(),this.initPoints(),this.formatText(t)},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.getEdgeStyle=function(){return lt(lt({},this.graphModel.theme.baseEdge),this.style)},n.prototype.getAdjustPointStyle=function(){return lt({},this.graphModel.theme.edgeAdjust)},n.prototype.getTextStyle=function(){var t=this.graphModel.theme.edgeText;return X(t)},n.prototype.getEdgeAnimationStyle=function(){var t=this.graphModel.theme.edgeAnimation;return X(t)},n.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),o=this.graphModel.theme.arrow,r=this.isAnimation?e.stroke:t.stroke;return lt(lt(lt({},t),{fill:r,stroke:r}),o)},n.prototype.getOutlineStyle=function(){var t=this.graphModel,e=t.theme.outline;return X(e)},n.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(n.prototype,"sourceNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.sourceNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetNode",{get:function(){var t,e;return(e=(t=this.graphModel)===null||t===void 0?void 0:t.nodesMap[this.targetNodeId])===null||e===void 0?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),n.prototype.getBeginAnchor=function(t,e,o){var r,i,a=Rr(t);return o&&(r=Ne(a,function(s){return s.id===o}),r)||a.forEach(function(s){var l=Sa(s,e);(i===void 0||l<i)&&(i=l,r=s)}),r},n.prototype.getEndAnchor=function(t,e){var o=this,r,i,a=Rr(t);return e&&(r=Ne(a,function(s){return s.id===e}),r)||a.forEach(function(s){if(o.startPoint){var l=Sa(s,o.startPoint);(i===void 0||l<i)&&(i=l,r=s)}}),r},n.prototype.getProperties=function(){return Ft(this.properties)},n.prototype.getData=function(){var t=this.properties;tn(t)&&(t=Ft(t));var e={id:this.id,type:this.type,properties:t,sourceNodeId:this.sourceNodeId,targetNodeId:this.targetNodeId,sourceAnchorId:this.sourceAnchorId,targetAnchorId:this.targetAnchorId,startPoint:Q({},this.startPoint),endPoint:Q({},this.endPoint)};this.graphModel.overlapMode===Xt.INCREASE&&(e.zIndex=this.zIndex);var o=this.text,r=o.x,i=o.y,a=o.value;return a&&(e.text={x:r,y:i,value:a}),e},n.prototype.getHistoryData=function(){return this.getData()},n.prototype.setProperty=function(t,e){mi(this.properties,t,gt(e)),this.setAttributes()},n.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},n.prototype.setProperties=function(t){this.properties=lt(lt({},Ft(this.properties)),gt(t)),this.setAttributes()},n.prototype.changeEdgeId=function(t){var e=this.arrowConfig,o=e.markerEnd,r=e.markerStart;r&&r==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),o&&o==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},n.prototype.setStyle=function(t,e){var o;this.style=lt(lt({},this.style),(o={},o[t]=gt(e),o))},n.prototype.setStyles=function(t){this.style=lt(lt({},this.style),gt(t))},n.prototype.updateStyles=function(t){this.style=lt({},gt(t))},n.prototype.setTextMode=function(t){this.textMode=t},n.prototype.formatText=function(t){var e,o,r,i=this.graphModel.editConfigModel,a=i.edgeTextDraggable,s=i.edgeTextEdit,l=this.textPosition,u=l.x,p=l.y,c=t.text,d={value:"",x:u,y:p,draggable:a,editable:s};c&&(typeof c=="string"?d=lt(lt({},d),{value:c}):(d=lt(lt({},d),{x:(e=c.x)!==null&&e!==void 0?e:u,y:(o=c.y)!==null&&o!==void 0?o:p,value:(r=c.value)!==null&&r!==void 0?r:""}),We(c.draggable)||(d.draggable=c.draggable),We(c.editable)||(d.editable=c.editable))),this.text=d},n.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,o=t.y;this.text.x=e,this.text.y=o},n.prototype.moveText=function(t,e){var o=this.text,r=o.x,i=o.y,a=o.value,s=o.draggable,l=o.editable;this.text={value:a,editable:l,draggable:s,x:r+t,y:i+e}},n.prototype.setText=function(t){t&&Q(this.text,t)},n.prototype.updateText=function(t){this.text=lt(lt({},Ft(this.text)),{value:t})},n.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){var t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId);if(!t)throw new Error("无法获取beginAnchor,请检查anchors相关逻辑,anchors不能为空");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("无法获取endAnchor,请检查anchors相关逻辑,anchors不能为空");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},n.prototype.setSelected=function(t){t===void 0&&(t=!0),this.isSelected=t},n.prototype.setHovered=function(t){t===void 0&&(t=!0),this.isHovered=t},n.prototype.setHitable=function(t){t===void 0&&(t=!0),this.isHitable=t},n.prototype.setHittable=function(t){t===void 0&&(t=!0),this.isHittable=t},n.prototype.openEdgeAnimation=function(){this.isAnimation=!0},n.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},n.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},n.prototype.updateStartPoint=function(t){this.startPoint=t},n.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},n.prototype.updateEndPoint=function(t){this.endPoint=t},n.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},n.prototype.setZIndex=function(t){t===void 0&&(t=0),this.zIndex=t},n.prototype.initPoints=function(){},n.prototype.updateAttributes=function(t){Q(this,t)},n.prototype.getAdjustStart=function(){return this.startPoint},n.prototype.getAdjustEnd=function(){return this.endPoint},n.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,o=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:o.x,y:o.y})},n.BaseType=rt.EDGE,j([x],n.prototype,"type",void 0),j([x],n.prototype,"sourceNodeId",void 0),j([x],n.prototype,"targetNodeId",void 0),j([x],n.prototype,"startPoint",void 0),j([x],n.prototype,"endPoint",void 0),j([x],n.prototype,"textMode",void 0),j([x],n.prototype,"text",void 0),j([x],n.prototype,"properties",void 0),j([x],n.prototype,"points",void 0),j([x],n.prototype,"pointsList",void 0),j([x],n.prototype,"isSelected",void 0),j([x],n.prototype,"isHovered",void 0),j([x],n.prototype,"isHitable",void 0),j([x],n.prototype,"isHittable",void 0),j([x],n.prototype,"draggable",void 0),j([x],n.prototype,"visible",void 0),j([x],n.prototype,"isAnimation",void 0),j([x],n.prototype,"isShowAdjustPoint",void 0),j([x],n.prototype,"zIndex",void 0),j([x],n.prototype,"state",void 0),j([x],n.prototype,"style",void 0),j([x],n.prototype,"arrowConfig",void 0),j([tt],n.prototype,"sourceNode",null),j([tt],n.prototype,"targetNode",null),j([tt],n.prototype,"textPosition",null),j([b],n.prototype,"setProperty",null),j([b],n.prototype,"deleteProperty",null),j([b],n.prototype,"setProperties",null),j([b],n.prototype,"changeEdgeId",null),j([b],n.prototype,"setStyle",null),j([b],n.prototype,"setStyles",null),j([b],n.prototype,"updateStyles",null),j([b],n.prototype,"setTextMode",null),j([b],n.prototype,"formatText",null),j([b],n.prototype,"resetTextPosition",null),j([b],n.prototype,"moveText",null),j([b],n.prototype,"setText",null),j([b],n.prototype,"updateText",null),j([b],n.prototype,"setAnchors",null),j([b],n.prototype,"setSelected",null),j([b],n.prototype,"setHovered",null),j([b],n.prototype,"setHitable",null),j([b],n.prototype,"setHittable",null),j([b],n.prototype,"openEdgeAnimation",null),j([b],n.prototype,"closeEdgeAnimation",null),j([b],n.prototype,"setElementState",null),j([b],n.prototype,"updateStartPoint",null),j([b],n.prototype,"moveStartPoint",null),j([b],n.prototype,"updateEndPoint",null),j([b],n.prototype,"moveEndPoint",null),j([b],n.prototype,"setZIndex",null),j([b],n.prototype,"initPoints",null),j([b],n.prototype,"updateAttributes",null),j([b],n.prototype,"getAdjustStart",null),j([b],n.prototype,"getAdjustEnd",null),j([b],n.prototype,"updateAfterAdjustStartAndEnd",null),n}(),ud=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Te=globalThis&&globalThis.__assign||function(){return Te=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Te.apply(this,arguments)},St=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pr=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},La=function(n){ud(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.BEZIER_EDGE,r.path="",r.initEdgeData(e),r.setAttributes(),r}return t.prototype.initEdgeData=function(e){this.offset=Wo(e,"properties.offset",100),n.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,o=n.prototype.getEdgeStyle.call(this),r=this.properties.style,i=r===void 0?{}:r;return Te(Te(Te({},o),X(e)),X(i))},t.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var e=0,o=0;return this.pointsList.forEach(function(r){var i=r.x,a=r.y;e+=i,o+=a}),{x:e/this.pointsList.length,y:o/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},t.prototype.getData=function(){var e=n.prototype.getData.call(this),o=this.pointsList.map(function(r){var i=r.x,a=r.y;return{x:i,y:a}});return Te(Te({},e),{pointsList:o})},t.prototype.getControls=function(){var e=this.startPoint,o=this.endPoint,r=Oa({start:e,end:o,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return r},t.prototype.getPath=function(e){var o=pr(e,4),r=o[0],i=o[1],a=o[2],s=o[3];return"M ".concat(r.x," ").concat(r.y,`
- C `).concat(i.x," ").concat(i.y,`,
- `).concat(a.x," ").concat(a.y,`,
- `).concat(s.x," ").concat(s.y)},t.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=this.getControls(),o=e.sNext,r=e.ePre;this.updatePath(o,r)},t.prototype.updatePath=function(e,o){e=X(e),o=X(o);var r={x:this.startPoint.x,y:this.startPoint.y},i={x:this.endPoint.x,y:this.endPoint.y};if(!e||!o){var a=this.getControls();e=a.sNext,o=a.ePre}this.pointsList=[r,e,o,i],this.path=this.getPath(this.pointsList)},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,o){this.startPoint.x+=e,this.startPoint.y+=o;var r=pr(this.pointsList,3),i=r[1],a=r[2];i.x+=e,i.y+=o,this.updatePath(i,a)},t.prototype.moveEndPoint=function(e,o){this.endPoint.x+=e,this.endPoint.y+=o;var r=pr(this.pointsList,3),i=r[1],a=r[2];a.x+=e,a.y+=o,this.updatePath(i,a)},t.prototype.updateAdjustAnchor=function(e,o){var r;o==="sNext"?this.pointsList[1]=e:o==="ePre"&&(this.pointsList[2]=e),this.path=this.getPath(this.pointsList),!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Q({},this.text,this.textPosition))},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var o=e.startPoint,r=e.endPoint,i=e.sourceNode,a=e.targetNode,s=Oa({start:o,end:r,sourceNode:i,targetNode:a,offset:this.offset}),l=s.sNext,u=s.ePre;this.pointsList=[o,l,u,r],this.initPoints()},St([x],t.prototype,"offset",void 0),St([x],t.prototype,"path",void 0),St([b],t.prototype,"initPoints",null),St([b],t.prototype,"updatePoints",null),St([b],t.prototype,"updateStartPoint",null),St([b],t.prototype,"updateEndPoint",null),St([b],t.prototype,"moveStartPoint",null),St([b],t.prototype,"moveEndPoint",null),St([b],t.prototype,"updateAdjustAnchor",null),St([b],t.prototype,"getAdjustStart",null),St([b],t.prototype,"getAdjustEnd",null),St([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(tr),cd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),bn=globalThis&&globalThis.__assign||function(){return bn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},bn.apply(this,arguments)},Ia=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},pd=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},ka=function(n){cd(t,n);function t(){var e=n.apply(this,pd([],Ia(arguments),!1))||this;return e.modelType=z.LINE_EDGE,e}return t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.line,o=n.prototype.getEdgeStyle.call(this),r=this.properties.style,i=r===void 0?{}:r;return bn(bn(bn({},o),X(e)),X(i))},t.prototype.initEdgeData=function(e){n.prototype.initEdgeData.call(this,e),this.points=this.getPath([this.startPoint,this.endPoint])},t.prototype.getPath=function(e){var o=Ia(e,2),r=o[0],i=o[1];return"".concat(r.x,",").concat(r.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}(tr),dd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),xn=globalThis&&globalThis.__assign||function(){return xn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},xn.apply(this,arguments)},pt=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ba=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},fd=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Xa=function(n){dd(t,n);function t(){var e=n.apply(this,fd([],Ba(arguments),!1))||this;return e.modelType=z.POLYLINE_EDGE,e.draggingPointList=[],e}return t.prototype.initEdgeData=function(e){this.offset=Wo(e,"properties.offset",30),e.pointsList&&(this.pointsList=e.pointsList),n.prototype.initEdgeData.call(this,e)},t.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.polyline,o=n.prototype.getEdgeStyle.call(this),r=this.properties.style,i=r===void 0?{}:r;return xn(xn(xn({},o),X(e)),X(i))},t.prototype.getTextPosition=function(){var e,o=(e=this.text)===null||e===void 0?void 0:e.value;if(this.dbClickPosition&&!o){var r=this.dbClickPosition,i=r.x,a=r.y;return{x:i,y:a}}var s=je(this.points),l=Ba(ap(s),2),u=l[0],p=l[1];return{x:(u.x+p.x)/2,y:(u.y+p.y)/2}},t.prototype.getAfterAnchor=function(e,o,r){var i,a;return r.forEach(function(s){var l;e===et.HORIZONTAL?l=Math.abs(o.y-s.y):e===et.VERTICAL&&(l=Math.abs(o.x-s.x)),(!a||a>l)&&(a=l,i=s)}),i},t.prototype.getCrossPoint=function(e,o,r){var i;return e===et.HORIZONTAL?i={x:r.x,y:o.y}:e===et.VERTICAL&&(i={x:o.x,y:r.y}),i},t.prototype.removeCrossPoints=function(e,o,r){var i=r.map(function(g){return g});if(e===1){var a=i[e],s=i[o],l=i[e-1],u=ba(l,a,this.sourceNode);if(u){var p=xa(a,s,this.sourceNode);if(p){var c=Ea(a,s,this.sourceNode);c&&(i[e]=c,i.splice(e-1,1),e--,o--)}}else{var d=this.sourceNode.anchors;d.forEach(function(g){if(g.x===l.x&&g.x===a.x||g.y===l.y&&g.y===a.y){var m=Ht(g.x,g.y,a.x,a.y),O=Ht(l.x,l.y,a.x,a.y);m<O&&(i[e-1]=g)}})}}if(o===r.length-2){var f=i[e],y=i[o],h=i[o+1],v=ba(y,h,this.targetNode);if(v){var p=xa(f,y,this.targetNode);if(p){var c=Ea(f,y,this.targetNode);c&&(i[o]=c,i.splice(o+1,1))}}else{var d=this.targetNode.anchors;d.forEach(function(m){if(m.x===h.x&&m.x===y.x||m.y===h.y&&m.y===y.y){var O=Ht(m.x,m.y,y.x,y.y),S=Ht(h.x,h.y,y.x,y.y);O<S&&(i[o+1]=m)}})}}return i},t.prototype.getDraggingPoints=function(e,o,r,i,a){var s=a.map(function(p){return p}),l=this.getAfterAnchor(e,r,i),u=this.getCrossPoint(e,r,l);return o==="start"?(s.unshift(u),s.unshift(l)):(s.push(u),s.push(l)),s},t.prototype.updateCrossPoints=function(e){var o=e.map(function(m){return m}),r=e[0],i=e[1],a=e[o.length-2],s=e[o.length-1],l=this,u=l.sourceNode,p=l.targetNode,c=u.modelType,d=p.modelType,f=jo(r,i),y=o[0];switch(c){case z.RECT_NODE:if(u.radius!==0){var h=Pa(r,u);h||(y=Aa(r,f,u))}break;case z.CIRCLE_NODE:y=Lr(r,f,u);break;case z.ELLIPSE_NODE:y=Da(r,f,u);break;case z.DIAMOND_NODE:y=ro(r,f,u);break;case z.POLYGON_NODE:y=ro(r,f,u);break}y&&(o[0]=y);var v=jo(a,s),g=o[o.length-1];switch(d){case z.RECT_NODE:if(p.radius!==0){var h=Pa(s,p);h||(g=Aa(s,v,p))}break;case z.CIRCLE_NODE:g=Lr(s,v,p);break;case z.ELLIPSE_NODE:g=Da(s,v,p);break;case z.DIAMOND_NODE:g=ro(s,v,p);break;case z.POLYGON_NODE:g=ro(s,v,p);break}return g&&(o[o.length-1]=g),o},t.prototype.updatePath=function(e){this.pointsList=e,this.points=this.getPath(this.pointsList)},t.prototype.getData=function(){var e=n.prototype.getData.call(this),o=this.pointsList.map(function(r){var i=r.x,a=r.y;return{x:i,y:a}});return Object.assign({},e,{pointsList:o})},t.prototype.getPath=function(e){return e.map(function(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},t.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.getPath(this.pointsList):this.updatePoints()},t.prototype.updatePoints=function(){var e=_a({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=e,this.points=e.map(function(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},t.prototype.updateStartPoint=function(e){this.startPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveStartPoint=function(e,o){this.startPoint.x+=e,this.startPoint.y+=o,this.updatePoints()},t.prototype.updateEndPoint=function(e){this.endPoint=Object.assign({},e),this.updatePoints()},t.prototype.moveEndPoint=function(e,o){this.endPoint.x+=e,this.endPoint.y+=o,this.updatePoints()},t.prototype.updatePointsList=function(e,o){this.pointsList.forEach(function(a){a.x+=e,a.y+=o});var r=this.pointsList[0];this.startPoint=Object.assign({},r);var i=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},i),this.initPoints()},t.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map(function(e){return e})},t.prototype.dragAppendSimple=function(e,o){var r;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,p=this.pointsList,c=p;return u===et.HORIZONTAL?(p[s]={x:i.x,y:i.y+o.y},p[l]={x:a.x,y:a.y+o.y},c=this.pointsList.map(function(d){return d})):u===et.VERTICAL&&(p[s]={x:i.x+o.x,y:i.y},p[l]={x:a.x+o.x,y:a.y},c=this.pointsList.map(function(d){return d})),this.updatePointsAfterDrag(c),this.draggingPointList=c,!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Q({},this.text,this.textPosition)),{start:Q({},p[s]),end:Q({},p[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppend=function(e,o){var r;this.isDragging=!0;var i=e.start,a=e.end,s=e.startIndex,l=e.endIndex,u=e.direction,p=this.pointsList;if(u===et.HORIZONTAL){p[s]={x:i.x,y:i.y+o.y},p[l]={x:a.x,y:a.y+o.y};var c=this.pointsList.map(function(v){return v});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x,y:i.y+o.y},f=se(d,this.sourceNode);if(!f){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x,y:a.y+o.y},f=se(h,this.targetNode);if(!f){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}else if(u===et.VERTICAL){p[s]={x:i.x+o.x,y:i.y},p[l]={x:a.x+o.x,y:a.y};var c=this.pointsList.map(function(g){return g});if(s!==0&&l!==this.pointsList.length-1&&(c=this.removeCrossPoints(s,l,c)),s===0){var d={x:i.x+o.x,y:i.y},f=se(d,this.sourceNode);if(!f){var y=this.sourceNode.anchors;c=this.getDraggingPoints(u,"start",d,y,c)}}if(l===this.pointsList.length-1){var h={x:a.x+o.x,y:a.y},f=se(h,this.targetNode);if(!f){var y=this.targetNode.anchors;c=this.getDraggingPoints(u,"end",h,y,c)}}this.updatePointsAfterDrag(c),this.draggingPointList=c}return!((r=this.text)===null||r===void 0)&&r.value&&this.setText(Q({},this.text,this.textPosition)),{start:Q({},p[s]),end:Q({},p[l]),startIndex:s,endIndex:l,direction:u}},t.prototype.dragAppendEnd=function(){if(this.draggingPointList){var e=dl(je(this.points));this.pointsList=e.map(function(i){return i}),this.draggingPointList=[];var o=e[0];this.startPoint=Q({},o);var r=e[e.length-1];this.endPoint=Q({},r)}this.isDragging=!1},t.prototype.updatePointsAfterDrag=function(e){var o=this.updateCrossPoints(e);this.points=o.map(function(r){return"".concat(r.x,",").concat(r.y)}).join(" ")},t.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},t.prototype.getAdjustEnd=function(){var e=this.pointsList;return e[e.length-1]||this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(e){var o=e.startPoint,r=e.endPoint,i=e.sourceNode,a=e.targetNode;this.pointsList=_a({x:o.x,y:o.y},{x:r.x,y:r.y},i,a,this.offset||0),this.initPoints()},pt([x],t.prototype,"offset",void 0),pt([x],t.prototype,"dbClickPosition",void 0),pt([b],t.prototype,"initPoints",null),pt([b],t.prototype,"updatePoints",null),pt([b],t.prototype,"updateStartPoint",null),pt([b],t.prototype,"moveStartPoint",null),pt([b],t.prototype,"updateEndPoint",null),pt([b],t.prototype,"moveEndPoint",null),pt([b],t.prototype,"updatePointsList",null),pt([b],t.prototype,"dragAppendStart",null),pt([b],t.prototype,"dragAppendSimple",null),pt([b],t.prototype,"dragAppend",null),pt([b],t.prototype,"dragAppendEnd",null),pt([b],t.prototype,"updatePointsAfterDrag",null),pt([b],t.prototype,"getAdjustStart",null),pt([b],t.prototype,"getAdjustEnd",null),pt([b],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(tr),ut=globalThis&&globalThis.__assign||function(){return ut=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},ut.apply(this,arguments)},R=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ha=globalThis&&globalThis.__values||function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],o=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},hd=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},be=function(){function n(t,e){var o;this.BaseType=rt.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Pt.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=F.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=z.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.resizeRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=e,this.properties=(o=t.properties)!==null&&o!==void 0?o:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this,o=e.x,r=o===void 0?0:o,i=e.y,a=i===void 0?0:i;this.transform=new Ro(-r,-a).rotate(t).translate(r,a).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),n.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,o=e&&e(t.type),r=this.createId();t.id=r||o||De()}this.formatText(t),Q(this,bp(t));var i=this.graphModel.overlapMode;i===Xt.INCREASE&&(this.zIndex=t.zIndex||wi())},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.setTextMode=function(t){this.textMode=t},n.prototype.formatText=function(t){var e,o,r,i=this.graphModel.editConfigModel,a=i.nodeTextDraggable,s=i.nodeTextEdit,l=t.x,u=t.y,p=t.text,c={value:"",x:l,y:u,draggable:a,editable:s};p&&(typeof p=="string"?c.value=p:(c=ut(ut({},c),{x:(e=p.x)!==null&&e!==void 0?e:l,y:(o=p.y)!==null&&o!==void 0?o:u,value:(r=p.value)!==null&&r!==void 0?r:""}),We(p.draggable)||(c.draggable=p.draggable),We(p.editable)||(c.editable=p.editable))),t.text=c},n.prototype.resize=function(t){var e=t.width,o=t.height,r=t.deltaX,i=t.deltaY,a=this.isAllowResizeNode(r,i,e,o);return a?(this.move(r/2,i/2),this.width=e,this.height=o,this.setProperties({width:e,height:o}),this.getData()):this.getData()},n.prototype.proportionalResize=function(){},n.prototype.getData=function(){var t=this.text,e=t.x,o=t.y,r=t.value,i=this.properties;tn(i)&&(i=Ft(i)),_t(i.width)&&(i.width=this.width),_t(i.height)&&(i.height=this.height);var a={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(a.rotate=this.rotate),this.graphModel.overlapMode===Xt.INCREASE&&(a.zIndex=this.zIndex),r&&(a.text={x:e,y:o,value:r}),a},n.prototype.getHistoryData=function(){return this.getData()},n.prototype.getProperties=function(){return Ft(this.properties)},n.prototype.getOuterGAttributes=function(){return{className:""}},n.prototype.getNodeStyle=function(){return ut(ut({},this.graphModel.theme.baseNode),this.style)},n.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,o=e===void 0?{}:e;return ut(ut({},X(t)),X(o))},n.prototype.getRotateControlStyle=function(){var t=this.graphModel.theme.rotateControl;return X(t)},n.prototype.getResizeControlStyle=function(){var t=this.graphModel.theme.resizeControl;return X(t)},n.prototype.getResizeOutlineStyle=function(){var t=this.graphModel.theme.resizeOutline;return X(t)},n.prototype.getAnchorStyle=function(t){var e=this.graphModel.theme.anchor;return X(e)},n.prototype.getAnchorLineStyle=function(t){var e=this.graphModel.theme.anchorLine;return X(e)},n.prototype.getOutlineStyle=function(){var t=this.graphModel.theme.outline;return X(t)},n.prototype.isAllowConnectedAsSource=function(t,e,o,r){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var a=!0,s="",l=0;l<i.length;l++){var u=i[l];if(!u.validate.call(this,this,t,e,o,r)){a=!1,s=u.message;break}}return{isAllPass:a,msg:s}},n.prototype.getConnectedSourceRules=function(){return this.sourceRules},n.prototype.isAllowConnectedAsTarget=function(t,e,o,r){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,o,r)){a=!1,s=u.message;break}}return{isAllPass:a,msg:s}},n.prototype.isAllowMoveNode=function(t,e){var o,r,i=!0,a=!0,s=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var l=Ha(s),u=l.next();!u.done;u=l.next()){var p=u.value,c=p(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(f){o={error:f}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(o)throw o.error}}return{x:i,y:a}},n.prototype.getConnectedTargetRules=function(){return this.targetRules},n.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,o=t.id,r=t.x,i=t.y;return e&&e.length>0?e.map(function(a,s){return a.length?(a=a,{id:"".concat(o,"_").concat(s),x:r+a[0],y:i+a[1]}):(a=a,ut(ut({},a),{x:r+a.x,y:i+a.y,id:a.id||"".concat(o,"_").concat(s)}))}):this.getDefaultAnchor()},n.prototype.getDefaultAnchor=function(){return[]},n.prototype.getTargetAnchor=function(t){return vp(t,this)},n.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(n.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,o=e.x,r=e.y,i=e.rotate;return t.forEach(function(a){var s=a.x,l=a.y,u=hd(new Fn([s,l,1]).translate(-o,-r).rotate(i).translate(o,r)[0],2),p=u[0],c=u[1];a.x=p,a.y=c}),t},enumerable:!1,configurable:!0}),n.prototype.getAnchorInfo=function(t){if(!_t(t))for(var e=0;e<this.anchors.length;e++){var o=this.anchors[e];if(o.id===t)return o}},n.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},n.prototype.isAllowMoveByXORY=function(t,e,o){var r,i;if(o)r=!0,i=!0;else{var a=this.isAllowMoveNode(t,e);typeof a=="boolean"?(r=a,i=a):(r=a.x,i=a.y)}return{isAllowMoveX:r,isAllowMoveY:i}},n.prototype.move=function(t,e,o){o===void 0&&(o=!1);var r=this.isAllowMoveByXORY(t,e,o),i=r.isAllowMoveX,a=r.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},n.prototype.getMoveDistance=function(t,e,o){o===void 0&&(o=!1);var r=this.isAllowMoveByXORY(t,e,o),i=r.isAllowMoveX,a=r.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),this.transform=new Ro(-this.x,-this.y).rotate(this.rotate).translate(this.x,this.y).toString(),[s,l]},n.prototype.moveTo=function(t,e,o){o===void 0&&(o=!1);var r=t-this.x,i=e-this.y;return!o&&!this.isAllowMoveNode(r,i)?!1:(this.text&&this.moveText(r,i),this.x=t,this.y=e,!0)},n.prototype.moveText=function(t,e){var o=this.text,r=o.x,i=o.y,a=o.value,s=o.draggable,l=o.editable;this.text={value:a,editable:l,draggable:s,x:r+t,y:i+e}},n.prototype.updateText=function(t){this.text=ut(ut({},Ft(this.text)),{value:t})},n.prototype.addNodeResizeRules=function(t){this.resizeRules.includes(t)||this.resizeRules.push(t)},n.prototype.isAllowResizeNode=function(t,e,o,r){var i,a,s=this.resizeRules.concat(this.graphModel.nodeResizeRules);try{for(var l=Ha(s),u=l.next();!u.done;u=l.next()){var p=u.value,c=p(this,t,e,o,r);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},n.prototype.setSelected=function(t){t===void 0&&(t=!0),this.isSelected=t},n.prototype.setHovered=function(t){t===void 0&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},n.prototype.setIsShowAnchor=function(t){t===void 0&&(t=!0),this.isShowAnchor=t},n.prototype.setRotatable=function(t){t===void 0&&(t=!0),this.rotatable=t},n.prototype.setResizable=function(t){t===void 0&&(t=!0),this.resizable=t},n.prototype.setHitable=function(t){t===void 0&&(t=!0),this.isHitable=t},n.prototype.setHittable=function(t){t===void 0&&(t=!0),this.isHittable=t},n.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},n.prototype.updateProperties=function(t,e){var o=Ft(this.properties);this.properties=t,this.setAttributes(),this.graphModel.eventCenter.emit(C.NODE_PROPERTIES_CHANGE,{id:this.id,keys:e,preProperties:o,properties:t})},n.prototype.setProperty=function(t,e){var o=Ft(this.properties),r=X(o);Il(r,t,gt(e)),this.updateProperties(r,[t])},n.prototype.setProperties=function(t){var e=Ft(this.properties),o=ut(ut({},e),gt(t)),r=[];kl(t,function(i,a){(Mi(e,a)&&e[a]!==i||!Mi(e,a))&&r.push(a)}),this.updateProperties(o,r)},n.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},n.prototype.setStyle=function(t,e){var o;this.style=ut(ut({},this.style),(o={},o[t]=gt(e),o))},n.prototype.setStyles=function(t){this.style=ut(ut({},this.style),gt(t))},n.prototype.updateStyles=function(t){this.style=ut({},gt(t))},n.prototype.setZIndex=function(t){t===void 0&&(t=1),this.zIndex=t},n.prototype.updateAttributes=function(t){Q(this,t)},n.BaseType=rt.NODE,R([x],n.prototype,"type",void 0),R([x],n.prototype,"x",void 0),R([x],n.prototype,"y",void 0),R([x],n.prototype,"textMode",void 0),R([x],n.prototype,"text",void 0),R([x],n.prototype,"properties",void 0),R([x],n.prototype,"_width",void 0),R([x],n.prototype,"_height",void 0),R([x],n.prototype,"anchorsOffset",void 0),R([x],n.prototype,"isSelected",void 0),R([x],n.prototype,"isHovered",void 0),R([x],n.prototype,"isShowAnchor",void 0),R([x],n.prototype,"isDragging",void 0),R([x],n.prototype,"isHitable",void 0),R([x],n.prototype,"isHittable",void 0),R([x],n.prototype,"draggable",void 0),R([x],n.prototype,"visible",void 0),R([x],n.prototype,"rotatable",void 0),R([x],n.prototype,"resizable",void 0),R([x],n.prototype,"zIndex",void 0),R([x],n.prototype,"state",void 0),R([x],n.prototype,"autoToFront",void 0),R([x],n.prototype,"style",void 0),R([x],n.prototype,"transform",void 0),R([x],n.prototype,"_rotate",void 0),R([tt],n.prototype,"incoming",null),R([tt],n.prototype,"outgoing",null),R([b],n.prototype,"setTextMode",null),R([b],n.prototype,"addNodeMoveRules",null),R([b],n.prototype,"move",null),R([b],n.prototype,"getMoveDistance",null),R([b],n.prototype,"moveTo",null),R([b],n.prototype,"moveText",null),R([b],n.prototype,"updateText",null),R([b],n.prototype,"addNodeResizeRules",null),R([b],n.prototype,"setSelected",null),R([b],n.prototype,"setHovered",null),R([b],n.prototype,"setIsShowAnchor",null),R([b],n.prototype,"setRotatable",null),R([b],n.prototype,"setResizable",null),R([b],n.prototype,"setHitable",null),R([b],n.prototype,"setHittable",null),R([b],n.prototype,"setElementState",null),R([b],n.prototype,"setProperty",null),R([b],n.prototype,"setProperties",null),R([b],n.prototype,"deleteProperty",null),R([b],n.prototype,"setStyle",null),R([b],n.prototype,"setStyles",null),R([b],n.prototype,"updateStyles",null),R([b],n.prototype,"setZIndex",null),R([b],n.prototype,"updateAttributes",null),n}(),yd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),En=globalThis&&globalThis.__assign||function(){return En=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},En.apply(this,arguments)},dr=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},za=function(n){yd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.CIRCLE_NODE,r.r=50,r.initNodeData(e),r.setAttributes(),r}return Object.defineProperty(t.prototype,"width",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.circle,r=this.properties.style,i=r===void 0?{}:r;return En(En(En({},e),X(o)),X(i))},t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.r;return[{x:o,y:r-i,id:"".concat(this.id,"_0")},{x:o+i,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+i,id:"".concat(this.id,"_2")},{x:o-i,y:r,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var o=e.width,r=e.deltaX,i=e.deltaY;return this.move(r/2,i/2),this.r=o,this.setProperties({r:o}),this.getData()},dr([x],t.prototype,"r",void 0),dr([tt],t.prototype,"width",null),dr([tt],t.prototype,"height",null),t}(be),gd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Tn=globalThis&&globalThis.__assign||function(){return Tn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Tn.apply(this,arguments)},Be=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ao=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Ga=function(n){gd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.DIAMOND_NODE,r.rx=30,r.ry=50,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.rx,r=e.ry;o&&(this.rx=o),r&&(this.ry=r)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.diamond,r=this.properties.style,i=r===void 0?{}:r;return Tn(Tn(Tn({},e),X(o)),X(i))},Object.defineProperty(t.prototype,"points",{get:function(){var e=this,o=e.x,r=e.y,i=e.rx,a=e.ry;return[[o,r-a],[o+i,r],[o,r+a],[o-i,r]]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointsPosition",{get:function(){return le(this.points,function(e){var o=ao(e,2),r=o[0],i=o[1];return{x:r,y:i}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return at(this.points,function(r){var i=ao(r,1),a=i[0];a<e&&(e=a),a>o&&(o=a)}),o-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return at(this.points,function(r){var i=ao(r,2),a=i[1];a<e&&(e=a),a>o&&(o=a)}),o-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this;return le(this.points,function(o,r){var i=ao(o,2),a=i[0],s=i[1];return{x:a,y:s,id:"".concat(e.id,"_").concat(r)}})},t.prototype.resize=function(e){var o=e.width,r=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=o,this.ry=r,this.setProperties({rx:o,ry:r}),this.getData()},Be([x],t.prototype,"rx",void 0),Be([x],t.prototype,"ry",void 0),Be([tt],t.prototype,"points",null),Be([tt],t.prototype,"pointsPosition",null),Be([tt],t.prototype,"width",null),Be([tt],t.prototype,"height",null),t}(be),vd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),On=globalThis&&globalThis.__assign||function(){return On=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},On.apply(this,arguments)},so=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ya=function(n){vd(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.ELLIPSE_NODE,r.rx=30,r.ry=45,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.rx,r=e.ry;o&&(this.rx=o),r&&(this.ry=r)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.ellipse,r=this.properties.style,i=r===void 0?{}:r;return On(On(On({},e),X(o)),X(i))},Object.defineProperty(t.prototype,"width",{get:function(){return this.rx*2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.ry*2},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.rx,a=e.ry;return[{x:o,y:r-a,id:"".concat(this.id,"_0")},{x:o+i,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+a,id:"".concat(this.id,"_2")},{x:o-i,y:r,id:"".concat(this.id,"_3")}]},t.prototype.resize=function(e){var o=e.width,r=e.height,i=e.deltaX,a=e.deltaY;return this.move(i/2,a/2),this.rx=o,this.ry=r,this.setProperties({rx:o,ry:r}),this.getData()},so([x],t.prototype,"rx",void 0),so([x],t.prototype,"ry",void 0),so([tt],t.prototype,"width",null),so([tt],t.prototype,"height",null),t}(be),md=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),wn=globalThis&&globalThis.__assign||function(){return wn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},wn.apply(this,arguments)},lo=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},uo=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Ua=function(n){md(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.POLYGON_NODE,r.points=[[50,0],[100,50],[50,100],[0,50]],r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.points,r=e.width,i=e.height,a=o||this.points;this.points=dp(a,r,i)},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.polygon,r=this.properties.style,i=r===void 0?{}:r;return wn(wn(wn({},e),X(o)),X(i))},Object.defineProperty(t.prototype,"pointsPosition",{get:function(){var e=this,o=e.x,r=e.y,i=e.width,a=e.height;return this.points.map(function(s){return{x:s[0]+o-i/2,y:s[1]+r-a/2}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(r){var i=uo(r,1),a=i[0];a<e&&(e=a),a>o&&(o=a)}),o-e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(r){var i=uo(r,2),a=i[1];a<e&&(e=a),a>o&&(o=a)}),o-e},enumerable:!1,configurable:!0}),t.prototype.getDefaultAnchor=function(){var e=this,o=this,r=o.x,i=o.y,a=o.width,s=o.height,l=o.points;return l.map(function(u,p){var c=uo(u,2),d=c[0],f=c[1];return{x:r+d-a/2,y:i+f-s/2,id:"".concat(e.id,"_").concat(p)}})},t.prototype.resize=function(e){var o=this,r=e.width,i=e.height,a=e.deltaX,s=e.deltaY;this.move(a/2,s/2);var l=le(this.points,function(u){var p=uo(u,2),c=p[0],d=p[1];return[c*r/o.width,d*i/o.height]});return this.points=l,this.properties.points=l,this.getData()},lo([x],t.prototype,"points",void 0),lo([tt],t.prototype,"pointsPosition",null),lo([tt],t.prototype,"width",null),lo([tt],t.prototype,"height",null),t}(be),_d=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Sn=globalThis&&globalThis.__assign||function(){return Sn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Sn.apply(this,arguments)},bd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Va=function(n){_d(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.RECT_NODE,r.radius=0,r.initNodeData(e),r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.width,r=e.height,i=e.radius;_t(o)||(this.width=o),_t(r)||(this.height=r),_t(i)||(this.radius=i)},t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.width,a=e.height;return[{x:o,y:r-a/2,id:"".concat(this.id,"_0")},{x:o+i/2,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+a/2,id:"".concat(this.id,"_2")},{x:o-i/2,y:r,id:"".concat(this.id,"_3")}]},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.graphModel.theme.rect,r=this.properties.style,i=r===void 0?{}:r;return Sn(Sn(Sn({},e),X(o)),X(i))},bd([x],t.prototype,"radius",void 0),t}(be),xd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Mn=globalThis&&globalThis.__assign||function(){return Mn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Mn.apply(this,arguments)},Wa=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ed=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Td=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Fa=function(n){xd(t,n);function t(){var e=n.apply(this,Td([],Ed(arguments),!1))||this;return e.modelType=z.TEXT_NODE,e}return t.prototype.getTextStyle=function(){var e=n.prototype.getTextStyle.call(this),o=this.graphModel.theme.text,r=this.properties.textStyle;return Mn(Mn(Mn({},e),X(o)),X(r))},Object.defineProperty(t.prototype,"width",{get:function(){var e=String(this.text.value).split(/[\r\n]/g),o=this.getTextStyle().fontSize,r=Ca({rows:e,fontSize:o,rowsLength:e.length}).width;return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var e=String(this.text.value).split(/[\r\n]/g),o=this.getTextStyle().fontSize,r=Ca({rows:e,fontSize:o,rowsLength:e.length}).height;return r},enumerable:!1,configurable:!0}),Wa([tt],t.prototype,"width",null),Wa([tt],t.prototype,"height",null),t}(be),Od=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Yr=function(n){Od(t,n);function t(e,o){var r=n.call(this,e,o)||this;return r.modelType=z.HTML_NODE,r.setAttributes(),r}return t.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var e=this.properties,o=e.width,r=e.height;o&&(this.width=o),r&&(this.height=r)},t.prototype.getDefaultAnchor=function(){var e=this,o=e.x,r=e.y,i=e.width,a=e.height;return[{x:o,y:r-a/2,id:"".concat(this.id,"_0")},{x:o+i/2,y:r,id:"".concat(this.id,"_1")},{x:o,y:r+a/2,id:"".concat(this.id,"_2")},{x:o-i/2,y:r,id:"".concat(this.id,"_3")}]},t}(be),W=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wd={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},co=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","snapGrid","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],Sd=function(){function n(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.snapGrid=!1,this.textMode=Pt.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Pt.TEXT,this.edgeTextMode=Pt.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",Q(this,this.computeConfig(t))}return n.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);Q(this,e)},n.prototype.computeConfig=function(t){var e=t.isSilentMode,o=t.textDraggable,r=t.textMode,i=t.textEdit,a=t.adjustEdgeStartAndEnd,s={};if(e===!1&&Q(s,this.stagedConfig),e===!0&&e!==this.isSilentMode){var l=Ge(wd,co);this.stagedConfig=Ge(this,co),Q(s,l)}We(i)||Q(s,{nodeTextEdit:i,edgeTextEdit:i}),We(o)||Q(s,{nodeTextDraggable:o,edgeTextDraggable:o}),r&&Q(s,{nodeTextMode:r,edgeTextMode:r}),_r(a)&&Q(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var u=Ge(t,co);return Q(s,u)},n.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},n.prototype.getConfig=function(){return Ge(this,co)},W([x],n.prototype,"isSilentMode",void 0),W([x],n.prototype,"stopZoomGraph",void 0),W([x],n.prototype,"stopMoveGraph",void 0),W([x],n.prototype,"stopScrollGraph",void 0),W([x],n.prototype,"snapGrid",void 0),W([x],n.prototype,"textMode",void 0),W([x],n.prototype,"textEdit",void 0),W([x],n.prototype,"textDraggable",void 0),W([x],n.prototype,"nodeTextEdit",void 0),W([x],n.prototype,"nodeTextDraggable",void 0),W([x],n.prototype,"nodeTextMultiple",void 0),W([x],n.prototype,"nodeTextVertical",void 0),W([x],n.prototype,"nodeTextMode",void 0),W([x],n.prototype,"edgeTextMode",void 0),W([x],n.prototype,"edgeTextEdit",void 0),W([x],n.prototype,"edgeTextDraggable",void 0),W([x],n.prototype,"edgeTextMultiple",void 0),W([x],n.prototype,"edgeTextVertical",void 0),W([x],n.prototype,"hideAnchors",void 0),W([x],n.prototype,"allowRotate",void 0),W([x],n.prototype,"allowResize",void 0),W([x],n.prototype,"hoverOutline",void 0),W([x],n.prototype,"nodeSelectedOutline",void 0),W([x],n.prototype,"adjustNodePosition",void 0),W([x],n.prototype,"autoExpand",void 0),W([x],n.prototype,"adjustEdge",void 0),W([x],n.prototype,"adjustEdgeMiddle",void 0),W([x],n.prototype,"adjustEdgeStartAndEnd",void 0),W([x],n.prototype,"adjustEdgeStart",void 0),W([x],n.prototype,"adjustEdgeEnd",void 0),W([x],n.prototype,"edgeSelectedOutline",void 0),W([b],n.prototype,"updateEditConfig",null),W([b],n.prototype,"updateTextMode",null),n}(),Md="*",Ad=function(){function n(){this._events={}}return n.prototype.on=function(t,e,o){var r=this;t==null||t.split(",").forEach(function(i){i=i.trim(),r._events[i]||(r._events[i]=[]),r._events[i].push({callback:e,once:!!o})})},n.prototype.once=function(t,e){var o=this;t==null||t.split(",").forEach(function(r){r=r.trim(),o.on(r,e,!0)})},n.prototype.emit=function(t,e){var o=this;t==null||t.split(",").forEach(function(r){var i=o._events[r]||[],a=o._events[Md]||[],s=function(l){for(var u=l.length,p=0;p<u;p++)if(l[p]){var c=l[p],d=c.callback,f=c.once;f&&(l.splice(p,1),l.length===0&&delete o._events[r],u--,p--),d.apply(o,[e])}};s(i),s(a)})},n.prototype.off=function(t,e){var o=this;t||(this._events={}),t.split(",").forEach(function(r){if(!e)delete o._events[r];else{for(var i=o._events[r]||[],a=i.length,s=0;s<a;s++)i[s].callback===e&&(i.splice(s,1),a--,s--);i.length===0&&delete o._events[r]}})},n.prototype.getEvents=function(){return this._events},n.prototype.destroy=function(){this._events={}},n}(),Pd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Ur=globalThis&&globalThis.__assign||function(){return Ur=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ur.apply(this,arguments)},Dd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Nd=function(n){Pd(t,n);function t(e){var o=n.call(this)||this;o.stepScrollX=0,o.stepScrollY=0,o.onDragging=function(s){var l=s.deltaX,u=s.deltaY;o.setState({isDragging:!0});var p=o.props.graphModel,c=p.transformModel,d=p.editConfigModel;d.stopMoveGraph!==!0&&c.translate(l,u)},o.onDragEnd=function(){o.setState({isDragging:!1})},o.zoomHandler=function(s){var l=o.props,u=l.graphModel,p=u.editConfigModel,c=u.transformModel,d=u.gridSize,f=l.graphModel,y=s.deltaX,h=s.deltaY,v=p.stopScrollGraph,g=p.stopZoomGraph;if(!v&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),o.stepScrollX+=y,o.stepScrollY+=h,Math.abs(o.stepScrollX)>=d){var m=o.stepScrollX%d,O=o.stepScrollX-m;c.translate(-O*c.SCALE_X,0),o.stepScrollX=m}if(Math.abs(o.stepScrollY)>=d){var S=o.stepScrollY%d,w=o.stepScrollY-S;c.translate(0,-w*c.SCALE_Y),o.stepScrollY=S}return}if(!g){s.preventDefault();var M=f.getPointByClient({x:s.clientX,y:s.clientY}),_=M.canvasOverlayPosition,T=_.x,A=_.y;c.zoom(s.deltaY<0,[T,A])}},o.clickHandler=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){var u=o.props.graphModel,p=u.selectElements;p.size>0&&u.clearSelectElements(),u.eventCenter.emit(C.BLANK_CLICK,{e:s})}},o.handleContextMenu=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){s.preventDefault();var u=o.props.graphModel,p=u.getPointByClient({x:s.clientX,y:s.clientY});u.eventCenter.emit(C.BLANK_CONTEXTMENU,{e:s,position:p})}},o.mouseDownHandler=function(s){var l=o.props.graphModel,u=l.eventCenter,p=l.editConfigModel,c=l.transformModel.SCALE_X,d=l.gridSize,f=p.adjustEdge,y=p.adjustNodePosition,h=p.stopMoveGraph,v=s.target,g=!f&&!y;(v.getAttribute("name")==="canvas-overlay"||g)&&(h!==!0?(o.stepDrag.setStep(d*c),o.stepDrag.handleMouseDown(s)):u.emit(C.BLANK_MOUSEDOWN,{e:s}),o.clickHandler(s))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter;return o.stepDrag=new ne({onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),o.state={isDragging:!1},o}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=e.getTransformStyle().transform,r=this.props,i=r.children,a=r.dnd,s=this.state.isDragging;return E("svg",Ur({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:s?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},a.eventMap(),{children:E("g",{transform:o,children:i})}))},t=Dd([wt],t),t}(Y),Tl=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Hn=globalThis&&globalThis.__assign||function(){return Hn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Hn.apply(this,arguments)},Cd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},jd=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Ka=function(n){Tl(t,n);function t(){var e=n.call(this)||this;return e.onDragging=function(o){var r=o.event,i=e.props,a=i.graphModel,s=i.bezierModel,l=i.type,u=a.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,p=u.x,c=u.y;s.updateAdjustAnchor({x:p,y:c},l),a.eventCenter.emit(C.EDGE_ADJUST,{data:s.getData()})},e.onDragEnd=function(){var o=e.props.bezierModel;o.isDragging=!1},e.dragHandler=new ne({onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.render=function(){var e=this,o=this.props.position,r=o.x,i=o.y,a=this.props.bezierModel,s=a.getEdgeStyle().adjustAnchor;return E(rn,Hn({className:"lf-bezier-adjust-anchor",x:r,y:i},s,{onMouseDown:function(l){e.dragHandler.handleMouseDown(l)}}))},t}(Y),Rd=function(n){Tl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getBezierAdjust=function(e,o){var r=e.path,i=e.id,a=Ti(r),s=jd(a,4),l=s[0],u=s[1],p=s[2],c=s[3],d=e.getEdgeStyle().adjustLine,f=[];return f.push(E(on,Hn({x1:l.x,y1:l.y,x2:u.x,y2:u.y},d))),f.push(E(Ka,{position:u,bezierModel:e,graphModel:o,type:"sNext"},"".concat(i,"_ePre"))),f.push(E(on,Hn({x1:c.x,y1:c.y,x2:p.x,y2:p.y},d))),f.push(E(Ka,{position:p,bezierModel:e,graphModel:o,type:"ePre"},"".concat(i,"_sNext"))),f},t.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,o=e.edges,r=[],i=0;i<o.length;i++){var a=o[i];a.isSelected&&a.modelType===z.BEZIER_EDGE&&a.draggable&&r.push(this.getBezierAdjust(a,e))}return r},t.prototype.render=function(){return E("g",{className:"lf-bezier-adjust",children:this.selectedBezierEdge()})},t=Cd([wt],t),t}(Y),Ld=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Id=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},kd=function(n){Ld(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.background;return E("div",{className:"lf-background",children:E("div",{style:Bl(e)?e:{},className:"lf-background-area"})})},t=Id([wt],t),t}(Y),Bd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Xd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Xo=function(n){Bd(t,n);function t(e){var o=n.call(this,e)||this;return o.id=De(),o.gridOptions=o.props.graphModel.grid,o}return t.prototype.renderDot=function(){var e=this.gridOptions,o=e.config,r=e.size,i=r===void 0?1:r,a=e.visible,s=o!=null?o:{},l=s.color,u=s.thickness,p=u===void 0?2:u,c=Math.min(Math.max(2,p),i/4),d=a?1:0;return E("g",{fill:l,opacity:d,children:[E("circle",{cx:0,cy:0,r:c/2}),E("circle",{cx:0,cy:i,r:c/2}),E("circle",{cx:i,cy:0,r:c/2}),E("circle",{cx:i,cy:i,r:c/2})]})},t.prototype.renderMesh=function(){var e=this.gridOptions,o=e.config,r=e.size,i=r===void 0?1:r,a=e.visible,s=o!=null?o:{},l=s.color,u=s.thickness,p=u===void 0?1:u,c=Math.min(Math.max(1,p),i/2),d="M 0 0 H ".concat(i," V ").concat(i," H 0 Z"),f=a?1:0;return E("path",{d,stroke:l,strokeWidth:c/2,opacity:f,fill:"transparent"})},t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=this.gridOptions,r=o.type,i=o.size,a=i===void 0?1:i,s=e.SCALE_X,l=e.SKEW_Y,u=e.SKEW_X,p=e.SCALE_Y,c=e.TRANSLATE_X,d=e.TRANSLATE_Y,f=[s,l,u,p,c,d].join(","),y="matrix(".concat(f,")");return E("div",{className:"lf-grid",children:E("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[E("defs",{children:E("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:y,x:"0",y:"0",width:a,height:a,children:[r==="dot"&&this.renderDot(),r==="mesh"&&this.renderMesh()]})}),E("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},t=Xd([wt],t),t}(Y);(function(n){n.defaultProps={size:Yc,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function t(e){var o=X(n.defaultProps);return typeof e=="number"?Q(o,{size:e}):typeof e=="boolean"?Q(o,{visible:e}):Q(o,e)}n.getGridOptions=t})(Xo||(Xo={}));var Hd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),zd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Gd=function(n){Hd(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.graphModel.transformModel,o=e.getTransformStyle().transform,r=this.props.children;return E("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:E("g",{transform:o,children:r})})},t=zd([wt],t),t}(Y),Yd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),pe=globalThis&&globalThis.__assign||function(){return pe=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},pe.apply(this,arguments)},Ud=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vd=function(n){Yd(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getNodesOutline=function(){var e=this.props.graphModel,o=e.nodes,r=e.editConfigModel,i=r.hoverOutline,a=r.nodeSelectedOutline,s=[];return o.forEach(function(l){if(l.isHovered||l.isSelected){var u=l.isHovered,p=l.isSelected,c=l.x,d=l.y,f=l.width,y=l.height;if(a&&p||i&&u){var h=l.getOutlineStyle(),v={};if(Object.keys(h).forEach(function(m){m!=="hover"&&(v[m]=h[m])}),u){var g=h.hover;v=pe(pe({},v),g)}s.push(E(Jt,pe({transform:l.transform,className:"lf-outline-node",x:c,y:d,width:f+10,height:y+10},v)))}}}),s},t.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,o=e.edges,r=e.editConfigModel,i=r.edgeSelectedOutline,a=r.hoverOutline,s=[],l=0;l<o.length;l++){var u=o[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 o=e.startPoint,r=e.endPoint,i=(o.x+r.x)/2,a=(o.y+r.y)/2,s=Math.abs(o.x-r.x)+10,l=Math.abs(o.y-r.y)+10,u=e.getOutlineStyle();return E(Jt,pe({className:"lf-outline-edge",x:i,y:a,width:s,height:l},u))},t.prototype.getPolylineOutline=function(e){var o=e.points,r=je(o),i=In(r,8),a=i.x,s=i.y,l=i.width,u=i.height,p=e.getOutlineStyle();return E(Jt,pe({className:"lf-outline",x:a,y:s,width:l,height:u},p))},t.prototype.getBezierOutline=function(e){var o=e.path,r=Ti(o),i=In(r,8),a=i.x,s=i.y,l=i.width,u=i.height,p=e.getOutlineStyle();return E(Jt,pe({className:"lf-outline",x:a,y:s,width:l,height:u},p))},t.prototype.render=function(){return E("g",{className:"lf-outline",children:[this.getNodesOutline(),this.getEdgeOutline()]})},t=Ud([wt],t),t}(Y),Wd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),de=globalThis&&globalThis.__assign||function(){return de=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},de.apply(this,arguments)},Fd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Kd=function(n){Wd(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.render=function(){var e=this.props.snaplineModel,o=e!=null?e:{},r=o.position,i=o.isShowHorizontal,a=o.isShowVertical,s=e==null?void 0:e.getStyle(),l=r!=null?r:{},u=l.x,p=u===void 0?0:u,c=l.y,d=c===void 0?0:c,f=de(de({x1:-1e5,y1:d,x2:1e5,y2:d},s),{stroke:i?s==null?void 0:s.stroke:"none"}),y=de(de({x1:p,y1:-1e5,x2:p,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return E("g",{className:"lf-snapline",children:[E(on,de({},f)),E(on,de({},y))]})},t=Fd([wt],t),t}(Y),Zd=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),qd=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Jd=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},$d=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Qd=function(n){Zd(t,n);function t(){var e=n.apply(this,$d([],Jd(arguments),!1))||this;return e.zoomHandler=function(o){var r;(r=e.props.getCanvasOverlay())===null||r===void 0||r.zoomHandler(o)},e}return t.prototype.componentDidMount=function(){this.triggerToolRender()},t.prototype.componentDidUpdate=function(){this.triggerToolRender()},t.prototype.getTools=function(){var e=this.props,o=e.tool,r=e.graphModel,i=r.textEditElement,a=o.getTools(),s=a.map(function(l){return Fe(l,{textEditElement:i,graphModel:r,lf:o.instance})});return o.components=s,s},t.prototype.triggerToolRender=function(){var e=this.props,o=e.tool,r=e.graphModel,i=document.querySelector("#ToolOverlay_".concat(r.flowId)),a=o.getInstance();a.components.forEach(function(s){return s(a,i)}),a.components=[]},t.prototype.render=function(){var e=this.props.graphModel;return E("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(e.flowId),onWheel:this.zoomHandler,children:this.getTools()})},t=qd([wt],t),t}(Y),fe=globalThis&&globalThis.__assign||function(){return fe=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},fe.apply(this,arguments)},D=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},tf=globalThis&&globalThis.__values||function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],o=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ct=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Mt=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},ef=function(){function n(t){var e=this,o,r;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=Xt.DEFAULT,this.gridSize=1,this.partial=!1,this.waitCleanEffects=[];var i=t.container,a=t.partial,s=t.background,l=s===void 0?{}:s,u=t.grid,p=t.idGenerator,c=t.edgeGenerator,d=t.animation,f=t.customTrajectory;this.rootEl=i,this.partial=!!a,this.background=l,typeof u=="object"&&t.snapGrid&&(this.gridSize=u.size||1),this.theme=El(t.style),this.grid=Xo.getGridOptions(u!=null?u:!1),this.edgeType=t.edgeType||"polyline",this.animation=Hc(d),this.overlapMode=t.overlapMode||Xt.DEFAULT,this.width=(o=t.width)!==null&&o!==void 0?o:this.rootEl.getBoundingClientRect().width,this.isContainerWidth=_t(t.width),this.height=(r=t.height)!==null&&r!==void 0?r:this.rootEl.getBoundingClientRect().height,this.isContainerHeight=_t(t.height);var y=new ResizeObserver(ds(function(h){var v,g;try{for(var m=tf(h),O=m.next();!O.done;O=m.next()){var S=O.value;S.target===e.rootEl&&(e.resize(),e.eventCenter.emit("graph:resize",{target:e.rootEl,contentRect:S.contentRect}))}}catch(w){v={error:w}}finally{try{O&&!O.done&&(g=m.return)&&g.call(m)}finally{if(v)throw v.error}}},16));y.observe(this.rootEl),this.waitCleanEffects.push(function(){y.disconnect()}),this.eventCenter=new Ad,this.editConfigModel=new Sd(t),this.transformModel=new rf(this.eventCenter,t),this.flowId=De(),this.idGenerator=p,this.edgeGenerator=cp(this,c),this.customTrajectory=f}return Object.defineProperty(n.prototype,"nodesMap",{get:function(){return this.nodes.reduce(function(t,e,o){return t[e.id]={index:o,model:e},t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"edgesMap",{get:function(){return this.edges.reduce(function(t,e,o){return t[e.id]={index:o,model:e},t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"modelsMap",{get:function(){return Mt(Mt([],ct(this.nodes),!1),ct(this.edges),!1).reduce(function(t,e){return t[e.id]=e,t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sortElements",{get:function(){for(var t=Mt(Mt([],ct(this.nodes),!1),ct(this.edges),!1).sort(function(s,l){return s.zIndex-l.zIndex}),e=[],o=[-to,-to],r=[this.width+to,this.height+to],i=0;i<t.length;i++){var a=t[i];a.visible&&(!this.partial||a.isSelected||this.isElementInArea(a,o,r,!1,!1))&&e.push(a)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textEditElement",{get:function(){var t=this.nodes.find(function(o){return o.state===F.TEXT_EDIT}),e=this.edges.find(function(o){return o.state===F.TEXT_EDIT});return t||e},enumerable:!1,configurable:!0}),Object.defineProperty(n.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(n.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach(function(e){e.isSelected&&t.push(e)}),t},enumerable:!1,configurable:!0}),n.prototype.getAreaElement=function(t,e,o,r,i){var a=this;o===void 0&&(o=!0),r===void 0&&(r=!0),i===void 0&&(i=!1);var s=[];return at(Mt(Mt([],ct(this.nodes),!1),ct(this.edges),!1),function(l){var u=a.isElementInArea(l,t,e,o,r);(!i||l.visible)&&u&&s.push(l)}),s},n.prototype.getModel=function(t){return this.modelMap.get(t)},n.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},n.prototype.getPointByClient=function(t){var e=t.x,o=t.y,r=this.rootEl.getBoundingClientRect(),i={x:e-r.left,y:o-r.top},a=ct(this.transformModel.HtmlPointToCanvasPoint([i.x,i.y]),2),s=a[0],l=a[1],u={x:s,y:l};return{domOverlayPosition:i,canvasOverlayPosition:u}},n.prototype.isElementInArea=function(t,e,o,r,i){var a;if(r===void 0&&(r=!0),i===void 0&&(i=!0),t.BaseType===rt.NODE){t=t;for(var s=Ot(t),l=s.minX,u=s.minY,p=s.maxX,c=s.maxY,d=[{x:l,y:u},{x:p,y:u},{x:p,y:c},{x:l,y:c}],f=i,y=0;y<d.length;y++){var h=d[y],v=h.x,g=h.y;if(a=ct(this.transformModel.CanvasPointToHtmlPoint([v,g]),2),v=a[0],g=a[1],ur([v,g],e,o)!==i){f=!i;break}}return f}if(t.BaseType===rt.EDGE){t=t;var m=t.startPoint,O=t.endPoint,S=this.transformModel.CanvasPointToHtmlPoint([m.x,m.y]),w=this.transformModel.CanvasPointToHtmlPoint([O.x,O.y]),M=ur(S,e,o),_=ur(w,e,o);return r?M&&_:M||_}return!1},n.prototype.graphDataToModel=function(t){var e=this;if(!t){this.clearData();return}if(this.elementsModelMap.clear(),this.nodeModelMap.clear(),this.edgeModelMap.clear(),t.nodes?this.nodes=le(t.nodes,function(r){var i=e.getModelAfterSnapToGrid(r);return e.elementsModelMap.set(i.id,i),e.nodeModelMap.set(i.id,i),i}):this.nodes=[],t.edges){var o=this.edgeType;this.edges=le(t.edges,function(r){var i,a=e.getModel((i=r.type)!==null&&i!==void 0?i:o);if(!a)throw new Error("找不到".concat(r.type,"对应的边。"));var s=new a(r,e);return e.edgeModelMap.set(s.id,s),e.elementsModelMap.set(s.id,s),s})}else this.edges=[]},n.prototype.modelToGraphData=function(){var t=[];this.edges.forEach(function(o){var r=o.getData();r&&!o.virtual&&t.push(r)});var e=[];return this.nodes.forEach(function(o){var r=o.getData();r&&!o.virtual&&e.push(r)}),{nodes:e,edges:t}},n.prototype.modelToHistoryData=function(){for(var t=!1,e=[],o=0;o<this.nodes.length;o++){var r=this.nodes[o];if(r.isDragging){t=!0;break}else e.push(r.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}},n.prototype.getEdgeModelById=function(t){var e;return(e=this.edgesMap[t])===null||e===void 0?void 0:e.model},n.prototype.getElement=function(t){return this.modelsMap[t]},n.prototype.getNodeEdges=function(t){for(var e=[],o=0;o<this.edges.length;o++){var r=this.edges[o],i=r.sourceNodeId===t,a=r.targetNodeId===t;(i||a)&&e.push(r)}return e},n.prototype.getSelectElements=function(t){t===void 0&&(t=!0);var e=this.selectElements,o={nodes:[],edges:[]};return e.forEach(function(r){if(r.BaseType===rt.NODE&&o.nodes.push(r.getData()),r.BaseType===rt.EDGE){var i=r.getData(),a=e.get(i.sourceNodeId)&&e.get(i.targetNodeId);(t||a)&&o.edges.push(i)}}),o},n.prototype.updateAttributes=function(t,e){var o=this.getElement(t);o==null||o.updateAttributes(e)},n.prototype.changeNodeId=function(t,e){return e||(e=De()),this.nodesMap[e]||!this.nodesMap[t]?"":(this.edges.forEach(function(o){o.sourceNodeId===t&&(o.sourceNodeId=e),o.targetNodeId===t&&(o.targetNodeId=e)}),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e)},n.prototype.changeEdgeId=function(t,e){return e||(e=De()),this.edgesMap[e]||!this.edgesMap[t]?"":(this.edges.forEach(function(o){o.id===t&&o.changeEdgeId(e)}),e)},n.prototype.getTextModel=function(t){var e=this.editConfigModel,o=e.textMode,r=e.nodeTextMode,i=e.edgeTextMode;if(t.BaseType===rt.NODE)return t.textMode||r||o||Pt.TEXT;if(t.BaseType===rt.EDGE)return t.textMode||i||o||Pt.TEXT},n.prototype.setTextMode=function(t,e){this.editConfigModel.updateEditConfig({textMode:t})},n.prototype.setFakeNode=function(t){this.fakeNode=t},n.prototype.removeFakeNode=function(){this.fakeNode=null},n.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},n.prototype.toFront=function(t){var e,o,r,i=((e=this.nodesMap[t])===null||e===void 0?void 0:e.model)||((o=this.edgesMap[t])===null||o===void 0?void 0:o.model);i&&(this.overlapMode===Xt.DEFAULT&&((r=this.topElement)===null||r===void 0||r.setZIndex(),i.setZIndex(Gc),this.topElement=i),this.overlapMode===Xt.INCREASE&&this.setElementZIndex(t,"top"))},n.prototype.setElementZIndex=function(t,e){var o,r,i=((o=this.nodesMap[t])===null||o===void 0?void 0:o.model)||((r=this.edgesMap[t])===null||r===void 0?void 0:r.model);if(i){var a=void 0;typeof e=="number"?a=e:(e==="top"&&(a=wi()),e==="bottom"&&(a=ld())),i.setZIndex(a)}},n.prototype.deleteNode=function(t){var e=this.nodesMap[t].model,o=e.getData();this.deleteEdgeBySource(t),this.deleteEdgeByTarget(t),this.nodes.splice(this.nodesMap[t].index,1),this.eventCenter.emit(C.NODE_DELETE,{data:o,model:e})},n.prototype.addNode=function(t,e,o){e===void 0&&(e=C.NODE_ADD);var r=gt(t),i=r.id;i&&this.nodesMap[i]&&delete r.id;var a=this.getModelAfterSnapToGrid(r);this.nodes.push(a);var s=a.getData(),l={data:s};return o&&(l.e=o),this.eventCenter.emit(e,l),a},n.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type),o=this.editConfigModel.snapGrid;if(!e)throw new Error("找不到".concat(t.type,"对应的节点,请确认是否已注册此类型节点。"));var r=t.x,i=t.y;r&&i&&(t.x=nn(r,this.gridSize,o),t.y=nn(i,this.gridSize,o),typeof t.text=="object"&&t.text!==null&&(t.text.x+=t.x-r,t.text.y+=t.y-i));var a=new e(t,this);return this.nodeModelMap.set(a.id,a),this.elementsModelMap.set(a.id,a),a},n.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),o=e==null?void 0:e.getData();if(o){o.x+=30,o.y+=30,o.id="",typeof o.text=="object"&&o.text!==null&&(o.text.x+=30,o.text.y+=30);var r=this.addNode(o);return r.setSelected(!0),e==null||e.setSelected(!1),r.getData()}},n.prototype.moveNode=function(t,e,o,r){var i;r===void 0&&(r=!1);var a=this.nodesMap[t];if(a){var s=a.model;i=ct(s.getMoveDistance(e,o,r),2),e=i[0],o=i[1],this.moveEdge(t,e,o)}},n.prototype.moveNode2Coordinate=function(t,e,o,r){r===void 0&&(r=!1);var i=this.nodesMap[t];if(i){var a=i.model,s=a.x,l=a.y,u=e-s,p=o-l;this.moveNode(t,u,p,r)}},n.prototype.editText=function(t){this.setElementStateById(t,F.TEXT_EDIT)},n.prototype.addEdge=function(t){var e=gt(t),o=e.type;o||(o=this.edgeType),e.id&&this.edgesMap[e.id]&&delete e.id;var r=this.getModel(o);if(!r)throw new Error("找不到".concat(o,"对应的边,请确认是否已注册此类型边。"));var i=new r(fe(fe({},e),{type:o}),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},n.prototype.moveEdge=function(t,e,o){for(var r=0;r<this.edges.length;r++){var i=this.edges[r],a=i.textPosition,s=a.x,l=a.y,u=this.edges[r].sourceNodeId===t,p=this.edges[r].targetNodeId===t;u&&i.moveStartPoint(e,o),p&&i.moveEndPoint(e,o),(u||p)&&this.handleEdgeTextMove(i,s,l)}},n.prototype.handleEdgeTextMove=function(t,e,o){var r;if(t.customTextPosition){t.resetTextPosition();return}if(t.modelType===z.POLYLINE_EDGE&&!((r=t.text)===null||r===void 0)&&r.value){var i=t.text,a=hl(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-o)},n.prototype.deleteEdgeBySourceAndTarget=function(t,e){for(var o=0;o<this.edges.length;o++)if(this.edges[o].sourceNodeId===t&&this.edges[o].targetNodeId===e){var r=this.edges[o].getData();this.edges.splice(o,1),o--,this.eventCenter.emit(C.EDGE_DELETE,{data:r})}},n.prototype.deleteEdgeById=function(t){var e=this.edgesMap[t];if(e){var o=this.edgesMap[t].index,r=this.edgesMap[t].model.getData();this.edges.splice(o,1),this.eventCenter.emit(C.EDGE_DELETE,{data:r})}},n.prototype.deleteEdgeBySource=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].sourceNodeId===t){var o=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(C.EDGE_DELETE,{data:o})}},n.prototype.deleteEdgeByTarget=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].targetNodeId===t){var o=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(C.EDGE_DELETE,{data:o})}},n.prototype.setElementStateById=function(t,e,o){this.nodes.forEach(function(r){r.id===t?r.setElementState(e,o):r.setElementState(F.DEFAULT)}),this.edges.forEach(function(r){r.id===t?r.setElementState(e,o):r.setElementState(F.DEFAULT)})},n.prototype.updateText=function(t,e){var o=Ne(Mt(Mt([],ct(this.nodes),!1),ct(this.edges),!1),function(r){return r.id===t});o==null||o.updateText(e)},n.prototype.selectNodeById=function(t,e){var o;e===void 0&&(e=!1),e||this.clearSelectElements();var r=(o=this.nodesMap[t])===null||o===void 0?void 0:o.model;r==null||r.setSelected(!0)},n.prototype.selectEdgeById=function(t,e){var o;e===void 0&&(e=!1),e||this.clearSelectElements();var r=(o=this.edgesMap[t])===null||o===void 0?void 0:o.model;r==null||r.setSelected(!0)},n.prototype.selectElementById=function(t,e){e===void 0&&(e=!1),e||this.clearSelectElements();var o=this.getElement(t);o==null||o.setSelected(!0)},n.prototype.clearSelectElements=function(){var t;this.selectElements.forEach(function(e){e==null||e.setSelected(!1)}),this.selectElements.clear(),this.overlapMode===Xt.DEFAULT&&((t=this.topElement)===null||t===void 0||t.setZIndex())},n.prototype.moveNodes=function(t,e,o,r){var i,a,s,l=this;r===void 0&&(r=!1);for(var u=t.reduce(function(O,S){var w,M=(w=l.nodesMap[S])===null||w===void 0?void 0:w.model;return M&&(O[S]=M.getMoveDistance(e,o,r)),O},{}),p=0;p<this.edges.length;p++){var c=this.edges[p],d=c.textPosition,f=d.x,y=d.y,h=u[c.sourceNodeId],v=u[c.targetNodeId],g=void 0,m=void 0;h&&v&&c.modelType===z.POLYLINE_EDGE?(i=ct(h,2),g=i[0],m=i[1],c.updatePointsList(g,m)):(h&&(a=ct(h,2),g=a[0],m=a[1],c.moveStartPoint(g,m)),v&&(s=ct(v,2),g=s[0],m=s[1],c.moveEndPoint(g,m))),(h||v)&&this.handleEdgeTextMove(c,f,y)}},n.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},n.prototype.addNodeResizeRules=function(t){this.nodeResizeRules.includes(t)||this.nodeResizeRules.push(t)},n.prototype.setDefaultEdgeType=function(t){this.edgeType=t},n.prototype.changeNodeType=function(t,e){var o=this.getNodeModelById(t);if(o){var r=o.getData();r.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));var a=new i(r,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=Na(a,l.startPoint,a.width,a.height);l.updateStartPoint(u)}if(l.targetNodeId===t){var u=Na(a,l.endPoint,a.width,a.height);l.updateEndPoint(u)}})}},n.prototype.changeEdgeType=function(t,e){var o=this.getEdgeModelById(t);if(o&&o.type!==e){var r=o.getData();r.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));delete r.pointsList;var a=new i(r,this);this.edges.splice(this.edgesMap[t].index,1,a)}},n.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach(function(o){o.targetNodeId===t&&e.push(o)}),e},n.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach(function(o){o.sourceNodeId===t&&e.push(o)}),e},n.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach(function(o){o.targetAnchorId===t&&e.push(o)}),e},n.prototype.getAnchorOutgoingEdge=function(t){var e=[];return this.edges.forEach(function(o){o.sourceAnchorId===t&&e.push(o)}),e},n.prototype.getNodeIncomingNode=function(t){var e=this,o=[];return this.edges.forEach(function(r){var i;r.targetNodeId===t&&o.push((i=e.nodesMap[r.sourceNodeId])===null||i===void 0?void 0:i.model)}),o},n.prototype.getNodeOutgoingNode=function(t){var e=this,o=[];return this.edges.forEach(function(r){r.sourceNodeId===t&&o.push(e.nodesMap[r.targetNodeId].model)}),o},n.prototype.setTheme=function(t){this.theme=id(fe(fe({},this.theme),t))},n.prototype.updateGridOptions=function(t){ii(this.grid,t)},n.prototype.updateGridSize=function(t){this.gridSize=t},n.prototype.updateBackgroundOptions=function(t){_r(t)||_r(this.background)?this.background=t:this.background=fe(fe({},this.background),t)},n.prototype.resize=function(t,e){this.width=t!=null?t:this.rootEl.getBoundingClientRect().width,this.isContainerWidth=_t(t),this.height=e!=null?e:this.rootEl.getBoundingClientRect().height,this.isContainerHeight=_t(e),!this.width||this.height},n.prototype.clearData=function(){this.nodes=[],this.edges=[],this.edgeModelMap.clear(),this.nodeModelMap.clear(),this.elementsModelMap.clear()},n.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],o=[];t.forEach(function(d){var f=d.x,y=d.y,h=d.width,v=d.height,g=d.getNodeStyle().strokeWidth,m=g===void 0?0:g,O=f+h/2+m,S=f-h/2-m,w=y+v/2+m,M=y-v/2-m;e=e.concat([O,S].filter(function(_){return!Number.isNaN(_)})),o=o.concat([w,M].filter(function(_){return!Number.isNaN(_)}))});var r=Math.min.apply(Math,Mt([],ct(e),!1)),i=Math.max.apply(Math,Mt([],ct(e),!1)),a=Math.min.apply(Math,Mt([],ct(o),!1)),s=Math.max.apply(Math,Mt([],ct(o),!1)),l=i-r||0,u=s-a||0,p=r+l/2,c=a+u/2;return{width:l,height:u,x:p,y:c}},n.prototype.translateCenter=function(){var t=this,e=t.nodes,o=t.width,r=t.height,i=t.rootEl,a=t.transformModel;if(e.length){var s=o||i.clientWidth,l=r||i.clientHeight,u=this.getVirtualRectSize(),p=u.x,c=u.y;a.focusOn(p,c,s,l)}},n.prototype.fitView=function(t,e){t===void 0&&(t=20),e===void 0&&(e=20);var o=this,r=o.nodes,i=o.width,a=o.height,s=o.rootEl,l=o.transformModel;if(r.length){var u=i||s.clientWidth,p=a||s.clientHeight,c=this.getVirtualRectSize(),d=c.width,f=c.height,y=c.x,h=c.y,v=(d+e)/u,g=(f+t)/p,m=1/Math.max(v,g),O=[u/2,p/2];l.zoom(m,O),l.focusOn(y,h,u,p)}},n.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);e==null||e.openEdgeAnimation()},n.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);e==null||e.closeEdgeAnimation()},n.prototype.getPartial=function(){return this.partial},n.prototype.setPartial=function(t){this.partial=t},n.prototype.destroy=function(){try{this.waitCleanEffects.forEach(function(t){t()})}catch(t){}this.waitCleanEffects.length=0,this.eventCenter.destroy()},D([x],n.prototype,"width",void 0),D([x],n.prototype,"height",void 0),D([x],n.prototype,"theme",void 0),D([x],n.prototype,"grid",void 0),D([x],n.prototype,"edgeType",void 0),D([x],n.prototype,"nodes",void 0),D([x],n.prototype,"edges",void 0),D([x],n.prototype,"fakeNode",void 0),D([x],n.prototype,"overlapMode",void 0),D([x],n.prototype,"background",void 0),D([x],n.prototype,"gridSize",void 0),D([x],n.prototype,"transformModel",void 0),D([x],n.prototype,"editConfigModel",void 0),D([x],n.prototype,"partial",void 0),D([tt],n.prototype,"nodesMap",null),D([tt],n.prototype,"edgesMap",null),D([tt],n.prototype,"modelsMap",null),D([tt],n.prototype,"sortElements",null),D([tt],n.prototype,"textEditElement",null),D([tt],n.prototype,"selectElements",null),D([tt],n.prototype,"selectNodes",null),D([b],n.prototype,"setTextMode",null),D([b],n.prototype,"setFakeNode",null),D([b],n.prototype,"removeFakeNode",null),D([b],n.prototype,"setModel",null),D([b],n.prototype,"toFront",null),D([b],n.prototype,"setElementZIndex",null),D([b],n.prototype,"deleteNode",null),D([b],n.prototype,"addNode",null),D([b],n.prototype,"cloneNode",null),D([b],n.prototype,"moveNode",null),D([b],n.prototype,"moveNode2Coordinate",null),D([b],n.prototype,"editText",null),D([b],n.prototype,"addEdge",null),D([b],n.prototype,"moveEdge",null),D([b],n.prototype,"deleteEdgeBySourceAndTarget",null),D([b],n.prototype,"deleteEdgeById",null),D([b],n.prototype,"deleteEdgeBySource",null),D([b],n.prototype,"deleteEdgeByTarget",null),D([b],n.prototype,"setElementStateById",null),D([b],n.prototype,"updateText",null),D([b],n.prototype,"selectNodeById",null),D([b],n.prototype,"selectEdgeById",null),D([b],n.prototype,"selectElementById",null),D([b],n.prototype,"clearSelectElements",null),D([b],n.prototype,"moveNodes",null),D([b],n.prototype,"setDefaultEdgeType",null),D([b],n.prototype,"changeNodeType",null),D([b],n.prototype,"changeEdgeType",null),D([b],n.prototype,"getNodeIncomingEdge",null),D([b],n.prototype,"getNodeOutgoingEdge",null),D([b],n.prototype,"getAnchorIncomingEdge",null),D([b],n.prototype,"getAnchorOutgoingEdge",null),D([b],n.prototype,"getNodeIncomingNode",null),D([b],n.prototype,"getNodeOutgoingNode",null),D([b],n.prototype,"setTheme",null),D([b],n.prototype,"resize",null),D([b],n.prototype,"clearData",null),D([b],n.prototype,"translateCenter",null),D([b],n.prototype,"fitView",null),D([b],n.prototype,"openEdgeAnimation",null),D([b],n.prototype,"closeEdgeAnimation",null),D([b],n.prototype,"setPartial",null),n}(),Oe=globalThis&&globalThis.__assign||function(){return Oe=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Oe.apply(this,arguments)},dn=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},nf=function(){function n(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return n.prototype.getStyle=function(){return Oe({},this.graphModel.theme.snapline)},n.prototype.getCenterSnapLine=function(t,e){for(var o=t.x,r=t.y,i=!1,a=!1,s=0;s<e.length;s++){var l=e[s];if(l.id!==t.id&&(o===l.x&&(i=!0),r===l.y&&(a=!0),i&&a))break}return{isShowVertical:i,isShowHorizontal:a,position:{x:o,y:r}}},n.prototype.getHorizontalSnapline=function(t,e){var o=!1,r=0,i=t.id,a;if(i){var s=this.graphModel.fakeNode;if(s&&s.id===i)a=Ot(s);else{var l=this.graphModel.getNodeModelById(i);l&&(a=Ot(l))}}for(var u=0;u<e.length;u++){var p=e[u];if(p.id!==t.id){var c=Ot(p);if(c.minY===(a==null?void 0:a.minY)||c.maxY===(a==null?void 0:a.minY)){o=!0,r=a.minY;break}if(c.minY===(a==null?void 0:a.maxY)||c.maxY===(a==null?void 0:a.maxY)){o=!0,r=a.maxY;break}}}return{isShowHorizontal:o,isShowVertical:this.isShowVertical,position:Oe(Oe({},this.position),{y:r})}},n.prototype.getVerticalSnapline=function(t,e){var o=!1,r=0,i=t.id,a;if(i){var s=this.graphModel.fakeNode;if(s&&s.id===i)a=Ot(s);else{var l=this.graphModel.getNodeModelById(i);l&&(a=Ot(l))}}for(var u=0;u<e.length;u++){var p=e[u];if(p.id!==t.id){var c=Ot(p);if(c.minX===(a==null?void 0:a.minX)||c.maxX===(a==null?void 0:a.minX)){o=!0,r=a.minX;break}if(c.minX===(a==null?void 0:a.maxX)||c.maxX===(a==null?void 0:a.maxX)){o=!0,r=a.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:o,position:Oe(Oe({},this.position),{x:r})}},n.prototype.getSnapLinePosition=function(t,e){var o=this.getCenterSnapLine(t,e),r=o.isShowHorizontal,i=o.isShowVertical;if(!r){var a=this.getHorizontalSnapline(t,e);a.isShowHorizontal&&(o.isShowHorizontal=a.isShowHorizontal,o.position.y=a.position.y)}if(!i){var s=this.getVerticalSnapline(t,e);s.isShowVertical&&(o.isShowVertical=s.isShowVertical,o.position.x=s.position.x)}return o},n.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,o=t.isShowVertical,r=t.position;this.position=r,this.isShowHorizontal=e,this.isShowVertical=o},n.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},n.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,o=this.getSnapLinePosition(t,e);this.setSnaplineInfo(o)},dn([x],n.prototype,"isShowHorizontal",void 0),dn([x],n.prototype,"isShowVertical",void 0),dn([x],n.prototype,"position",void 0),dn([b],n.prototype,"clearSnapline",null),dn([b],n.prototype,"setNodeSnapLine",null),n}(),Lt=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Xe=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},of={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},rf=function(){function n(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var o=e.stopMoveGraph,r=o===void 0?!1:o;this.updateTranslateLimits(r)}return n.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},n.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},n.prototype.HtmlPointToCanvasPoint=function(t){var e=Xe(t,2),o=e[0],r=e[1];return[(o-this.TRANSLATE_X)/this.SCALE_X,(r-this.TRANSLATE_Y)/this.SCALE_Y]},n.prototype.CanvasPointToHtmlPoint=function(t){var e=Xe(t,2),o=e[0],r=e[1];return[o*this.SCALE_X+this.TRANSLATE_X,r*this.SCALE_Y+this.TRANSLATE_Y]},n.prototype.moveCanvasPointByHtml=function(t,e,o){var r=Xe(t,2),i=r[0],a=r[1];return[i+e/this.SCALE_X,a+o/this.SCALE_Y]},n.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},n.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},n.prototype.zoom=function(t,e){t===void 0&&(t=!1);var o=this.SCALE_X,r=this.SCALE_Y;return typeof t=="number"?(o=t,r=t):t?(o+=this.ZOOM_SIZE,r+=this.ZOOM_SIZE):(o-=this.ZOOM_SIZE,r-=this.ZOOM_SIZE),o<this.MINI_SCALE_SIZE||o>this.MAX_SCALE_SIZE?"".concat(this.SCALE_X*100,"%"):(e&&(this.TRANSLATE_X-=(o-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(r-this.SCALE_Y)*e[1]),this.SCALE_X=o,this.SCALE_Y=r,this.emitGraphTransform("zoom"),"".concat(this.SCALE_X*100,"%"))},n.prototype.emitGraphTransform=function(t){this.eventCenter.emit(C.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},n.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},n.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},n.prototype.focusOn=function(t,e,o,r){var i=Xe(this.CanvasPointToHtmlPoint([t,e]),2),a=i[0],s=i[1],l=Xe([o/2-a,r/2-s],2),u=l[0],p=l[1];this.TRANSLATE_X+=u,this.TRANSLATE_Y+=p,this.emitGraphTransform("focusOn")},n.prototype.updateTranslateLimits=function(t){var e;e=Xe(Array.isArray(t)&&t.length===4?t:of[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},Lt([x],n.prototype,"SCALE_X",void 0),Lt([x],n.prototype,"SKEW_Y",void 0),Lt([x],n.prototype,"SKEW_X",void 0),Lt([x],n.prototype,"SCALE_Y",void 0),Lt([x],n.prototype,"TRANSLATE_X",void 0),Lt([x],n.prototype,"TRANSLATE_Y",void 0),Lt([x],n.prototype,"ZOOM_SIZE",void 0),Lt([b],n.prototype,"zoom",null),Lt([b],n.prototype,"resetZoom",null),Lt([b],n.prototype,"translate",null),Lt([b],n.prototype,"focusOn",null),n}(),af=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),sf=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},lf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},uf=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},cf=function(n){af(t,n);function t(){var e=n.apply(this,uf([],lf(arguments),!1))||this;return e.canvasOverlayRef=Ko(),e.getCanvasOverlay=function(){return e.canvasOverlayRef.current},e.handleResize=function(){var o=e.props,r=o.graphModel,i=o.options,a=r.width,s=r.height,l=r.isContainerWidth,u=r.isContainerHeight,p=a,c=s,d=!1;l&&(p=void 0,d=!0),u&&(c=void 0,d=!0),d&&r.resize(p,c),i.width=a,i.height=s},e.throttleResize=Xl(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,o,r){r===void 0&&(r="canvas-overlay");var i=this.props.getView,a=i(e.type);return a?E(a,{model:e,graphModel:o,overlay:r},e.id):null},t.prototype.render=function(){var e=this,o=this.props,r=o.graphModel,i=o.tool,a=o.options,s=o.dnd,l=o.snaplineModel,u={};a.width&&(u.width="".concat(r.width,"px")),a.height&&(u.height="".concat(r.height,"px"));var p=r.fakeNode,c=r.editConfigModel,d=r.background,f=c.adjustEdge;return E("div",{className:"lf-graph","flow-id":r.flowId,style:u,children:[E(Nd,{ref:this.canvasOverlayRef,graphModel:r,dnd:s,children:[E("g",{className:"lf-base",children:le(r.sortElements,function(y){return e.getComponent(y,r)})}),p?this.getComponent(p,r):""]}),E(Gd,{graphModel:r,children:[E(Vd,{graphModel:r}),f?E(Rd,{graphModel:r}):"",a.snapline!==!1?E(Kd,{snaplineModel:l}):""]}),E(Qd,{graphModel:r,tool:i,getCanvasOverlay:this.getCanvasOverlay}),d&&E(kd,{background:d}),E(Xo,{graphModel:r})]})},t=sf([wt],t),t}(Y),pf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Wt=globalThis&&globalThis.__assign||function(){return Wt=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Wt.apply(this,arguments)},df=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ff=function(n){pf(t,n);function t(){var e=n.call(this)||this;return e.onDragStart=function(o){var r=o.event,i=e.props,a=i.anchorData,s=i.nodeModel,l=i.graphModel;l.selectNodeById(s.id),s.autoToFront&&l.toFront(s.id),l.eventCenter.emit(C.ANCHOR_DRAGSTART,{data:a,e:r,nodeModel:s}),e.setState({startX:a.x,startY:a.y,endX:a.x,endY:a.y})},e.onDragging=function(o){var r=o.event,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=a.transformModel,p=a.eventCenter,c=a.width,d=a.height,f=a.editConfigModel,y=f.autoExpand,h=f.stopMoveGraph;if(r){var v=r.clientX,g=r.clientY,m=a.getPointByClient({x:v,y:g}),O=m.domOverlayPosition,S=O.x,w=O.y,M=m.canvasOverlayPosition,_=M.x,T=M.y;e.t&&Bo(e.t);var A=[],P=10;S<10?A=[P,0]:S+10>c?A=[-P,0]:w<10?A=[0,P]:w+10>d&&(A=[0,-P]),e.setState({endX:_,endY:T,dragging:!0}),e.moveAnchorEnd(_,T),A.length>0&&!h&&y&&(e.t=ml(function(){var k=df(A,2),I=k[0],nt=k[1];u.translate(I,nt);var Z=e.state,it=Z.endX,vt=Z.endY;e.setState({endX:it-I,endY:vt-nt}),e.moveAnchorEnd(it-I,vt-nt)})),p.emit(C.ANCHOR_DRAG,{data:l,e:r,nodeModel:s})}},e.onDragEnd=function(o){var r=o.event;e.t&&Bo(e.t);var i=e.checkEnd(r);e.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),e.sourceRuleResults.clear(),e.targetRuleResults.clear();var a=e.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData;s.eventCenter.emit(C.ANCHOR_DRAGEND,{data:u,e:r,nodeModel:l,edgeModel:i!=null?i:void 0})},e.checkEnd=function(o){var r,i=e.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,u=l.x,p=l.y,c=l.id,d=e.state,f=d.endX,y=d.endY,h=d.dragging,v=Io({x:f,y},a);if(e.preTargetNode&&e.preTargetNode.state!==F.DEFAULT&&e.preTargetNode.setElementState(F.DEFAULT),!!h&&v&&v.node){var g=v.node,m=v.anchor.id,O="".concat(s.id,"_").concat(g.id,"_").concat(m,"_").concat(c),S=e.sourceRuleResults.get(O)||{},w=S.isAllPass,M=S.msg,_=e.targetRuleResults.get(O)||{},T=_.isAllPass,A=_.msg;if(w&&T){g.setElementState(F.DEFAULT);var P=a.getNodeModelById(v.node.id),k=(r=a.edgeGenerator)===null||r===void 0?void 0:r.call(a,s.getData(),P==null?void 0:P.getData()),I=a.addEdge(Wt(Wt({},k),{sourceNodeId:s.id,sourceAnchorId:c,startPoint:{x:u,y:p},targetNodeId:v.node.id,targetAnchorId:v.anchor.id,endPoint:{x:v.anchor.x,y:v.anchor.y}})),nt=e.props.anchorData;return a.eventCenter.emit(C.ANCHOR_DROP,{data:nt,e:o,nodeModel:s,edgeModel:I}),I}var Z=g.getData();return a.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:Z,msg:A||M||"不允许添加连线"}),null}},e.sourceRuleResults=new Map,e.targetRuleResults=new Map,e.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},e.dragHandler=new ne({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd}),e}return t.prototype.getAnchorShape=function(){var e=this.props,o=e.anchorData,r=e.style,i=e.node,a=i.getAnchorShape(o);if(a)return a;var s=o.x,l=o.y,u=Wt(Wt({},r),r==null?void 0:r.hover);return E("g",{children:[E(rn,Wt({className:"lf-node-anchor-hover"},u,{x:s,y:l})),E(rn,Wt({className:"lf-node-anchor"},r,{x:s,y:l}))]})},Object.defineProperty(t.prototype,"customTrajectory",{get:function(){var e=this.props.graphModel.customTrajectory;return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relateEdges",{get:function(){var e=this.props,o=e.graphModel,r=o.getAnchorIncomingEdge,i=o.getAnchorOutgoingEdge,a=e.anchorData.id;return{incomingEdgeList:r(a),outgoingEdgeList:i(a)}},enumerable:!1,configurable:!0}),t.prototype.moveAnchorEnd=function(e,o){var r,i,a=this.props,s=a.graphModel,l=a.nodeModel,u=a.anchorData,p=Io({x:e,y:o},s);if(p){var c=p.node,d=p.anchor.id;if(this.preTargetNode&&this.preTargetNode!==p.node&&this.preTargetNode.setElementState(F.DEFAULT),u.id===d)return;this.preTargetNode=c;var f="".concat(l.id,"_").concat(c.id,"_").concat(d,"_").concat(u.id);if(!this.targetRuleResults.has(f)){var y=p.anchor,h=l.isAllowConnectedAsSource(c,u,y),v=c.isAllowConnectedAsTarget(l,u,y);this.sourceRuleResults.set(f,ko(h)),this.targetRuleResults.set(f,ko(v))}var g=((r=this.sourceRuleResults.get(f))!==null&&r!==void 0?r:{}).isAllPass,m=((i=this.targetRuleResults.get(f))!==null&&i!==void 0?i:{}).isAllPass;g&&m?c.setElementState(F.ALLOW_CONNECT):c.setElementState(F.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==F.DEFAULT&&this.preTargetNode.setElementState(F.DEFAULT)},t.prototype.isShowLine=function(){var e=this.state,o=e.startX,r=e.startY,i=e.endX,a=e.endY,s=Ht(o,r,i,a);return s>10},t.prototype.render=function(){var e=this,o=this.state,r=o.startX,i=o.startY,a=o.endX,s=o.endY,l=this.props,u=l.anchorData,p=l.edgeStyle,c=l.nodeModel,d=l.graphModel,f=u.edgeAddable;return E("g",{className:"lf-anchor",children:[E("g",{onClick:function(y){y.stopPropagation(),d.eventCenter.emit(C.ANCHOR_CLICK,{data:u,e:y,nodeModel:c})},onMouseDown:function(y){d.eventCenter.emit(C.ANCHOR_MOUSEDOWN,{data:u,e:y,nodeModel:c}),f!==!1&&e.dragHandler.handleMouseDown(y)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(Wt({sourcePoint:{x:r,y:i},targetPoint:{x:a,y:s}},p)):E(on,Wt({x1:r,y1:i,x2:a,y2:s},p,{"pointer-events":"none"})))]})},t}(Y),hf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Vr=globalThis&&globalThis.__assign||function(){return Vr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Vr.apply(this,arguments)},yf=function(n){hf(t,n);function t(e){var o=n.call(this,e)||this;return o.style={},o.onDragging=function(r){var i,a=r.event,s=o.props,l=s.graphModel,u=s.nodeModel,p=s.eventCenter,c=l.selectNodes,d=u.x,f=u.y,y=a.clientX,h=a.clientY,v=l.getPointByClient({x:y,y:h}).canvasOverlayPosition,g=v.x,m=v.y,O=new yt(g-d,m-f),S=((i=o.normal)===null||i===void 0?void 0:i.angle(O))-o.defaultAngle,w=new Ro(-d,-f).rotate(S).translate(d,f).toString();u.transform=w,u.rotate=S;var M=le(c,function(T){return T.id});M.indexOf(u.id)===-1&&(M=[u.id]);var _=Hl(M,function(T,A){var P=l.getNodeModelById(A);return T[A]=P==null?void 0:P.getMoveDistance(0,0,!1),T},{});M.forEach(function(T){var A=l.getNodeEdges(T);A.forEach(function(P){if(_[P.sourceNodeId]){var k=l.getNodeModelById(P.sourceNodeId),I=k.anchors.find(function(nt){return nt.id===P.sourceAnchorId});P.updateStartPoint(I)}if(_[P.targetNodeId]){var k=l.getNodeModelById(P.targetNodeId),I=k.anchors.find(function(it){return it.id===P.targetAnchorId});P.updateEndPoint(I)}})}),p.emit(C.NODE_ROTATE,{e:a,model:u,data:u.getData()})},o.style=e.style,o.stepperDrag=new ne({onDragging:o.onDragging}),o}return t.prototype.render=function(){var e=this,o=this.props.nodeModel,r=o.x,i=o.y,a=o.width,s=o.height,l=r+a/2+20,u=i-s/2-20;return this.normal=new yt(1,0),this.defaultAngle=this.normal.angle(new yt(l-r,u-i)),o.defaultAngle=this.defaultAngle,E("g",{className:"lf-rotate-control",children:E("g",{onMouseDown:function(p){e.stepperDrag.handleMouseDown(p)},children:E(rn,Vr({},this.style,{cx:l,cy:u}))})})},t}(Y),Ol={exports:{}};/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
- */(function(n){(function(){var t={}.hasOwnProperty;function e(){for(var i="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(i=r(i,o(s)))}return i}function o(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=r(a,s));return a}function r(i,a){return a?i?i+" "+a:i+a:i}n.exports?(e.default=e,n.exports=e):window.classNames=e})()})(Ol);var gf=Ol.exports;const vf=hs(gf);var mf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Wr=globalThis&&globalThis.__assign||function(){return Wr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Wr.apply(this,arguments)},_f=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},wl=function(n){mf(t,n);function t(e){var o=n.call(this)||this;o.mouseDownHandler=function(i){var a=o.props,s=a.draggable,l=a.model,u=a.graphModel,p=u.editConfigModel.nodeTextDraggable;(s!=null?s:p)&&(i.stopPropagation(),o.stepperDrag.model=l,o.stepperDrag.handleMouseDown(i))},o.onDragging=function(i){var a=i.deltaX,s=i.deltaY,l=o.props,u=l.model,p=l.graphModel.transformModel;if(a||s){var c=_f(p.fixDeltaXY(a,s),2),d=c[0],f=c[1];u.moveText(d,f)}},o.dbClickHandler=function(){var i=o.props,a=i.editable,s=i.graphModel.eventCenter,l=i.model;a&&l.setElementState(F.TEXT_EDIT),s.emit(C.TEXT_DBCLICK,{data:l.text,model:l})};var r=e.draggable;return o.stepperDrag=new ne({onDragging:o.onDragging,step:1,eventType:"TEXT",isStopPropagation:r}),o}return t.prototype.getShape=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=o.text,s=a.value,l=a.x,u=a.y,p=a.editable,c=a.draggable,d={x:l,y:u,className:"",value:s},f=o.getTextStyle(),y=i.nodeTextDraggable||c;return E(_l,Wr({},d,f,{className:vf({"lf-element-text":p,"lf-text-draggable":!p&&y,"lf-text-disabled":!p&&!y}),model:o}))},t.prototype.render=function(){var e=this.props.model.text;if(e)return E("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},t}(Y),bf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),It=globalThis&&globalThis.__assign||function(){return It=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},It.apply(this,arguments)},po=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},xf=function(n){bf(t,n);function t(e){var o=n.call(this,e)||this;return o.setHoverOn=function(){o.setState({isHovered:!0})},o.setHoverOff=function(){o.setState({isHovered:!1})},o.state={isHovered:!1},o}return t.prototype.getBackground=function(){var e=this.state.isHovered,o=this.props.model,r=o.text,i=o.getTextStyle(),a=i.background||{};if(e&&i.hover&&i.hover.background&&(a=It(It({},a),i.hover.background)),r!=null&&r.value&&(a==null?void 0:a.fill)!=="transparent"){var s=i.fontSize,l=i.textWidth,u=i.lineHeight,p=i.overflowMode,c=a.wrapPadding,d=r==null?void 0:r.value.split(/[\r\n]/g),f=d.length,y=r.x,h=r.y,v={};if(p==="autoWrap"&&l){var g=vl({rows:d,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:u,padding:c},rowsLength:f,className:"lf-get-text-height"});v=It(It({},a),{x:y,y:h,width:l,height:g})}else{var m=pp({rows:d,rowsLength:f,fontSize:s}),O=m.width,S=m.height;if(p==="ellipsis"&&(O=l,S=s+2),typeof a.wrapPadding=="string"){var w=a.wrapPadding.split(",").filter(function(Et){return Et.trim()}).map(function(Et){return parseFloat(Et.trim())});if(w.length>0&&w.length<=4){if(w.length===1){var M=po(w,1),_=M[0];w=[_,_,_,_]}else if(w.length===2){var T=po(w,2),A=T[0],P=T[1];w=[A,P,A,P]}else if(w.length===3){var k=po(w,3),I=k[0],P=k[1],nt=k[2];w=[I,P,nt,P]}var Z=po(w,4),it=Z[0],vt=Z[1],Ct=Z[2],oe=Z[3];O+=vt+oe,S+=it+Ct,y=y+(vt-oe)/2,h=h+(Ct-it)/2}}v=It(It({},a),{x:y-1,y:h-1,width:O,height:S})}return E(Jt,It({},v))}return null},t.prototype.getShape=function(){var e=this.props.model,o=e.text,r=o.x,i=o.y,a=o.value;if(!a)return null;var s=e.getTextStyle(),l=It({x:r,y:i,value:a,model:e,className:"lf-element-text"},s);return E("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),E(_l,It({},l))]})},t}(wl),Ef=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Ho=globalThis&&globalThis.__assign||function(){return Ho=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ho.apply(this,arguments)},Tf=globalThis&&globalThis.__rest||function(n,t){var e={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(e[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(e[o[r]]=n[o[r]]);return e},fo=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},xe=function(n){Ef(t,n);function t(e){var o=n.call(this)||this;o.onDragStart=function(l){var u=l.event,p=o.props,c=p.model,d=p.graphModel;if(u){var f=d.getPointByClient({x:u.clientX,y:u.clientY}).canvasOverlayPosition,y=f.x,h=f.y;o.moveOffset={dx:c.x-y,dy:c.y-h}}},o.onDragging=function(l){var u,p,c,d,f=l.event,y=o.props,h=y.model,v=y.graphModel,g=v.editConfigModel,m=g.stopMoveGraph,O=g.autoExpand,S=g.snapGrid,w=v.transformModel,M=v.selectNodes,_=v.width,T=v.height,A=v.gridSize;h.isDragging=!0;var P=f,k=P.clientX,I=P.clientY,nt=v.getPointByClient({x:k,y:I}).canvasOverlayPosition,Z=nt.x,it=nt.y,vt=fo(w.CanvasPointToHtmlPoint([Z,it]),2),Ct=vt[0],oe=vt[1];if(Z=Z+((p=(u=o.moveOffset)===null||u===void 0?void 0:u.dx)!==null&&p!==void 0?p:0),it=it+((d=(c=o.moveOffset)===null||c===void 0?void 0:c.dy)!==null&&d!==void 0?d:0),Z=nn(Z,A,S),it=nn(it,A,S),!_||!T){v.moveNode2Coordinate(h.id,Z,it);return}var Et=Ct<0||oe<0||Ct>_||oe>T;if(!(O&&!m&&Et)){var jt=fo(w.CanvasPointToHtmlPoint([Z-h.width/2,it-h.height/2]),2),B=jt[0],U=jt[1],J=fo(w.CanvasPointToHtmlPoint([Z+h.width/2,it+h.height/2]),2),G=J[0],ot=J[1],mt=Math.max(A,20),V=[];B<0?V=[mt,0]:G>v.width?V=[-mt,0]:U<0?V=[0,mt]:ot>v.height&&(V=[0,-mt]),o.t&&Bo(o.t);var st=M.map(function(Rt){return Rt.id});st.indexOf(h.id)===-1&&(st=[h.id]),V.length>0&&!m&&O?o.t=ml(function(){var Rt=fo(V,2),Tt=Rt[0],Re=Rt[1];w.translate(Tt!=null?Tt:0,Re!=null?Re:0);var or=-(Tt!=null?Tt:0)/w.SCALE_X,Dl=-(Re!=null?Re:0)/w.SCALE_X;v.moveNodes(st,or,Dl)}):v.moveNodes(st,Z-h.x,it-h.y)}},o.onDragEnd=function(){o.t&&Bo(o.t);var l=o.props.model;l.isDragging=!1},o.onMouseOut=function(l){zc()&&o.setHoverOff(l)},o.handleMouseUp=function(){var l=o.props.model;o.mouseUpDrag=l.isDragging},o.handleClick=function(l){var u=o.mouseUpDrag===!1;if(o.startTime){var p=o.props,c=p.model,d=p.graphModel;if(u){var f=c.getData(),y=d.getPointByClient({x:l.clientX,y:l.clientY}),h={data:f,e:l,position:y,isSelected:!1,isMultiple:!1},v=l.button===2,g=l.detail===2;if(!v){var m=d.editConfigModel,O=yl(l,m);h.isMultiple=O,c.isSelected&&!g&&O?(h.isSelected=!1,c.setSelected(!1)):(d.selectNodeById(c.id,O),h.isSelected=!0,m.isSilentMode||o.toFront()),g?(m.nodeTextEdit&&c.text.editable&&m.textMode===Pt.TEXT&&(c.setSelected(!1),d.setElementStateById(c.id,F.TEXT_EDIT)),d.eventCenter.emit(C.NODE_DBCLICK,h)):(d.eventCenter.emit(C.ELEMENT_CLICK,h),d.eventCenter.emit(C.NODE_CLICK,h))}}}},o.handleContextMenu=function(l){l.preventDefault();var u=o.props,p=u.model,c=u.graphModel,d=c.editConfigModel,f=p.getData(),y=c.getPointByClient({x:l.clientX,y:l.clientY});c.setElementStateById(p.id,F.SHOW_MENU,y.domOverlayPosition),p.isSelected||c.selectNodeById(p.id),c.eventCenter.emit(C.NODE_CONTEXTMENU,{data:f,e:l,position:y}),d.isSilentMode||o.toFront()},o.handleMouseDown=function(l){var u=o.props,p=u.model,c=u.graphModel;o.startTime=new Date().getTime();var d=c.editConfigModel;d.adjustNodePosition&&p.draggable&&o.stepDrag&&o.stepDrag.handleMouseDown(l)},o.handleFocus=function(){var l=o.props,u=l.model,p=l.graphModel;p.eventCenter.emit(C.NODE_FOCUS,{data:u.getData()})},o.handleBlur=function(){var l=o.props,u=l.model,p=l.graphModel;p.eventCenter.emit(C.NODE_BLUR,{data:u.getData()})},o.setHoverOn=function(l){var u=o.props,p=u.model,c=u.graphModel;if(!p.isHovered){var d=p.getData();p.setHovered(!0),c.eventCenter.emit(C.NODE_MOUSEENTER,{data:d,e:l})}},o.setHoverOff=function(l){var u=o.props,p=u.model,c=u.graphModel,d=p.getData();p.isHovered&&(p.setHovered(!1),c.eventCenter.emit(C.NODE_MOUSELEAVE,{data:d,e:l}))};var r=e.graphModel,i=r.gridSize,a=r.eventCenter,s=e.model;return o.stepDrag=new ne({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),o.modelDisposer=Us(function(){return o.props},function(l){l&&l.model&&o.stepDrag.setModel(l.model)}),o}return t.prototype.componentWillUnmount=function(){this.modelDisposer&&this.modelDisposer(),this.render.$mobx&&this.render.$mobx.dispose()},t.prototype.componentDidMount=function(){},t.prototype.componentDidUpdate=function(){},t.prototype.getAnchorShape=function(e){return null},t.prototype.getAnchors=function(){var e=this,o=this.props,r=o.model,i=o.graphModel,a=r.isSelected,s=r.isHitable,l=r.isDragging,u=r.isShowAnchor;return s&&(a||u)&&!l?le(r.anchors,function(p,c){var d=r.getAnchorLineStyle(p),f=r.getAnchorStyle(p);return E(ff,{anchorData:p,node:e,style:f,edgeStyle:d,anchorIndex:c,nodeModel:r,graphModel:i,setHoverOff:e.setHoverOff})}):[]},t.prototype.getRotateControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.isSilentMode,s=i.allowRotate,l=o.isSelected,u=o.isHitable,p=o.rotatable,c=o.isHovered,d=s&&p,f=o.getRotateControlStyle();if(!a&&u&&(l||c)&&d)return E(yf,{graphModel:r,nodeModel:o,eventCenter:r.eventCenter,style:f})},t.prototype.getResizeControl=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.isSilentMode,s=i.allowResize,l=o.isSelected,u=o.isHitable,p=o.resizable,c=o.isHovered,d=s&&p,f=o.getResizeControlStyle();return!a&&u&&(l||c)&&d?E(Hp,{style:f,model:o,graphModel:r}):null},t.prototype.getText=function(){var e,o=this.props,r=o.model,i=o.graphModel,a=i.editConfigModel;if(a.nodeTextMode!==Pt.TEXT||r.state===F.TEXT_EDIT)return null;if(r.text){var s=!1;return a.nodeTextDraggable&&r.text.draggable&&(s=!0),E(wl,{editable:a.nodeTextEdit&&((e=r.text.editable)!==null&&e!==void 0?e:!0),model:r,graphModel:i,draggable:s})}return null},t.prototype.getStateClassName=function(){var e=this.props.model,o=e.state,r=e.isDragging,i=e.isSelected,a="lf-node";switch(o){case F.ALLOW_CONNECT:a+=" lf-node-allow";break;case F.NOT_ALLOW_CONNECT:a+=" lf-node-not-allow";break;default:a+=" lf-node-default";break}return r&&(a+=" lf-dragging"),i&&(a+=" lf-node-selected"),a},t.prototype.toFront=function(){var e=this.props,o=e.model,r=e.graphModel;o.autoToFront&&r.toFront(o.id)},t.prototype.render=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.hideAnchors,s=i.adjustNodePosition,l=i.allowRotate,u=i.allowResize,p=r.gridSize,c=r.transformModel.SCALE_X,d=o.isHitable,f=o.draggable,y=o.transform,h=o.getOuterGAttributes(),v=h.className,g=v===void 0?"":v,m=Tf(h,["className"]),O=E("g",{className:"lf-node-content",children:[E("g",{transform:y,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),u&&this.getResizeControl()]}),!a&&this.getAnchors()]}),S;return d?(s&&f&&this.stepDrag.setStep(p*c),S=E("g",Ho({className:"".concat(this.getStateClassName()," ").concat(g),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,onMouseOut:this.onMouseOut,onContextMenu:this.handleContextMenu,onFocus:this.handleFocus,onBlur:this.handleBlur},m,{children:O}))):S=E("g",Ho({className:"".concat(this.getStateClassName()," ").concat(g)},m,{children:O})),S},t.isObserved=!1,t}(Y),Of=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Fr=globalThis&&globalThis.__assign||function(){return Fr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Fr.apply(this,arguments)},Za=function(n){Of(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,o=e.getNodeStyle();return E(Jt,Fr({},o,{x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius}))},t}(xe),wf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Kr=globalThis&&globalThis.__assign||function(){return Kr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Kr.apply(this,arguments)},qa=function(n){wf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,o=e.x,r=e.y,i=e.r,a=e.getNodeStyle();return E(rn,Kr({},a,{x:o,y:r,r:i}))},t}(xe),Sf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),zo=globalThis&&globalThis.__assign||function(){return zo=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zo.apply(this,arguments)},Ja=function(n){Sf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,o=e,r=o.x,i=o.y,a=o.width,s=o.height,l=o.points,u=e.getNodeStyle(),p={transform:"matrix(1 0 0 1 ".concat(r-a/2," ").concat(i-s/2,")")};return E("g",zo({},p,{children:E(bl,zo({},u,{points:l,x:r,y:i}))}))},t}(xe),Mf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Zr=globalThis&&globalThis.__assign||function(){return Zr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Zr.apply(this,arguments)},$a=function(n){Mf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,o=e.getNodeStyle();return E("g",{children:E(bl,Zr({},o,{points:e.points,x:e.x,y:e.y}))})},t}(xe),Af=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),qr=globalThis&&globalThis.__assign||function(){return qr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},qr.apply(this,arguments)},Qa=function(n){Af(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getShape=function(){var e=this.props.model,o=e.getNodeStyle();return E(jp,qr({},o,{x:e.x,y:e.y,rx:e.rx,ry:e.ry}))},t}(xe),Pf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),An=globalThis&&globalThis.__assign||function(){return An=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},An.apply(this,arguments)},ts=function(n){Pf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getBackground=function(){var e=this.props.model,o=e.getTextStyle(),r=e.width,i=e.height,a=e.x,s=e.y,l=An(An({},o.background),{x:a,y:s,width:r,height:i});return E(Jt,An({},l))},t.prototype.getResizeControl=function(){return null},t.prototype.getShape=function(){return E("g",{children:this.getBackground()})},t}(xe),Df=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Jr=globalThis&&globalThis.__assign||function(){return Jr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Jr.apply(this,arguments)},Nf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Cf=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},$r=function(n){Df(t,n);function t(){var e=n.apply(this,Cf([],Nf(arguments),!1))||this;return e.ref=Ko(),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(){n.prototype.componentWillUnmount.call(this),this.rootEl.innerHTML=""},t.prototype.getShape=function(){var e=this.props.model,o=e.x,r=e.y,i=e.height,a=e.width,s=e.getNodeStyle();return this.currentProperties=JSON.stringify(e.properties),E("foreignObject",Jr({},s,{x:o-a/2,y:r-i/2,width:a,height:i,ref:this.ref}))},t}(xe),jf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),kt=globalThis&&globalThis.__assign||function(){return kt=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},kt.apply(this,arguments)},Rf=globalThis&&globalThis.__rest||function(n,t){var e={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(e[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(e[o[r]]=n[o[r]]);return e},Lf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Zt;(function(n){n.SOURCE="SOURCE",n.TARGET="TARGET"})(Zt||(Zt={}));var es=function(n){jf(t,n);function t(e){var o=n.call(this)||this;o.handleMouseDown=function(l){o.stepDrag&&o.stepDrag.handleMouseDown(l)},o.onDragStart=function(){var l=o.props,u=l.x,p=l.y,c=l.edgeModel,d=c.startPoint,f=c.endPoint,y=c.pointsList;o.oldEdge={startPoint:d,endPoint:f,pointsList:y},o.setState({endX:u,endY:p,dragging:!0})},o.onDragging=function(l){var u=l.deltaX,p=l.deltaY,c=o.state,d=c.endX,f=c.endY,y=o.props,h=y.graphModel,v=y.type,g=h.transformModel,m=h.editConfigModel,O=Lf(g.moveCanvasPointByHtml([d,f],u,p),2),S=O[0],w=O[1];o.setState({endX:S,endY:w,dragging:!0});var M=o.props.edgeModel,_=Io({x:d,y:f},h);if(_&&_.node&&o.isAllowAdjust(_).pass){var T=M.startPoint,A=M.endPoint,P=M.sourceNode,k=M.targetNode,I=v===Zt.SOURCE?{startPoint:{x:_.anchor.x,y:_.anchor.y},endPoint:{x:A.x,y:A.y},sourceNode:_.node,targetNode:k}:{startPoint:{x:T.x,y:T.y},endPoint:{x:_.anchor.x,y:_.anchor.y},sourceNode:P,targetNode:_.node};M.updateAfterAdjustStartAndEnd(I)}else v===Zt.SOURCE?M.updateStartPoint({x:S,y:w}):M.updateEndPoint({x:S,y:w});M.text.value&&m.adjustEdge&&M.setText(Object.assign({},M.text,M.textPosition))},o.onDragEnd=function(l){var u,p,c,d=l.event;try{o.setState({dragging:!1});var f=o.props,y=f.graphModel,h=f.edgeModel,v=f.type,g=o.state,m=g.endX,O=g.endY,S=g.dragging,w=Io({x:m,y:O},y);if(!S)return;var M=!1,_=void 0;if(w&&w.node){var T=o.isAllowAdjust(w),A=T.pass,P=T.msg,k=T.newTargetNode;if(A){var I=h.getData(),nt=I.text,Z=I.sourceAnchorId,it=Z===void 0?"":Z,vt=I.targetAnchorId,Ct=vt===void 0?"":vt,oe=Rf(I,["text","sourceAnchorId","targetAnchorId"]);if(_=kt(kt({sourceAnchorId:it,targetAnchorId:Ct},oe),{text:(nt==null?void 0:nt.value)||""}),v===Zt.SOURCE){var Et=y.getNodeModelById(w.node.id),jt=y.getNodeModelById(h.targetNodeId),B=(u=y.edgeGenerator)===null||u===void 0?void 0:u.call(y,Et==null?void 0:Et.getData(),jt==null?void 0:jt.getData(),_);_=kt(kt({},B),{sourceNodeId:w.node.id,sourceAnchorId:w.anchor.id,startPoint:{x:w.anchor.x,y:w.anchor.y},targetNodeId:h.targetNodeId,endPoint:kt({},h.endPoint)}),h.sourceNodeId===w.node.id&&h.sourceAnchorId===w.anchor.id&&(M=!0)}else if(v===Zt.TARGET){var Et=y.getNodeModelById(h.sourceNodeId),jt=y.getNodeModelById(w.node.id),B=(p=y.edgeGenerator)===null||p===void 0?void 0:p.call(y,Et==null?void 0:Et.getData(),jt==null?void 0:jt.getData(),_);_=kt(kt({},B),{sourceNodeId:h.sourceNodeId,startPoint:kt({},h.startPoint),targetNodeId:w.node.id,targetAnchorId:w.anchor.id,endPoint:{x:w.anchor.x,y:w.anchor.y}}),h.targetNodeId===w.node.id&&h.targetAnchorId===w.anchor.id&&(M=!0)}}else{M=!0;var U=k.getData();y.eventCenter.emit(C.CONNECTION_NOT_ALLOWED,{data:U,msg:P})}}else M=!0;if(M)o.recoveryEdge();else{var J=h.getData();y.deleteEdgeById(h.id);var G=y.addEdge(kt({},_));y.eventCenter.emit(C.EDGE_EXCHANGE_NODE,{data:{newEdge:G.getData(),oldEdge:J}})}(c=o.preTargetNode)===null||c===void 0||c.setElementState(F.DEFAULT)}finally{var y=o.props.graphModel;y.eventCenter.emit(C.ADJUST_POINT_DRAGEND,{e:d,data:o.stepDragData})}},o.recoveryEdge=function(){var l=o.props.edgeModel,u=o.oldEdge,p=u.startPoint,c=u.endPoint,d=u.pointsList;l.updateStartPoint(p),l.updateEndPoint(c),l.modelType!==z.LINE_EDGE&&(l.pointsList=d!=null?d:[],l.initPoints())},o.getAdjustPointStyle=function(){var l=o.props.graphModel.theme,u=l.edgeAdjust;return u},o.state={dragging:!1,endX:0,endY:0},o.targetRuleResults=new Map,o.sourceRuleResults=new Map;var r=e.type,i=e.edgeModel,a=e.graphModel,s=a.eventCenter;return o.stepDragData={type:r,edgeData:i.getData()},o.stepDrag=new ne({onDragStart:o.onDragStart,onDragging:o.onDragging,onDragEnd:o.onDragEnd,eventType:"ADJUST_POINT",isStopPropagation:!1,eventCenter:s,data:o.stepDragData}),o}return t.prototype.isAllowAdjust=function(e){var o=this.props,r=o.edgeModel,i=r.id,a=r.sourceNode,s=r.targetNode,l=r.sourceAnchorId,u=r.targetAnchorId,p=o.type,c,d,f,y;if(p===Zt.SOURCE?(c=e.node,d=s,f=e.anchor,y=s.getAnchorInfo(u)):(c=a,d=e.node,y=e.anchor,f=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==e.node&&this.preTargetNode.setElementState(F.DEFAULT),this.preTargetNode=e.node,y.id===f.id)return{pass:!1,msg:"",newTargetNode:d};var h="".concat(c.id,"_").concat(d.id,"_").concat(f.id,"_").concat(y.id);if(!this.targetRuleResults.has(h)){var v=c.isAllowConnectedAsSource(d,f,y,i),g=d.isAllowConnectedAsTarget(c,f,y,i);this.sourceRuleResults.set(h,ko(v)),this.targetRuleResults.set(h,ko(g))}var m=this.sourceRuleResults.get(h),O=m.isAllPass,S=m.msg,w=this.targetRuleResults.get(h),M=w.isAllPass,_=w.msg,T=O&&M?F.ALLOW_CONNECT:F.NOT_ALLOW_CONNECT;return p===Zt.SOURCE?c.setElementState(T):d.setElementState(T),{pass:O&&M,msg:_||S,newTargetNode:d}},t.prototype.render=function(){var e=this.props,o=e.x,r=e.y,i=e.getAdjustPointShape,a=e.edgeModel,s=this.state.dragging;return E("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(o,r,a)})},t}(Y),If=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Qr=globalThis&&globalThis.__assign||function(){return Qr=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Qr.apply(this,arguments)};(function(n){If(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getArrowAttributes=function(){var e=this.props,o=e.arrowInfo,r=e.style,i=o.start,a=o.end,s={start:i,end:a,offset:r.offset,verticalLength:r.verticalLength,type:"end"},l=Ln(s),u=l.leftX,p=l.leftY,c=l.rightX,d=l.rightY;return Qr({d:"M".concat(u," ").concat(p," L").concat(a.x," ").concat(a.y," L").concat(c," ").concat(d," z")},r)},t.prototype.getShape=function(){var e=this.getArrowAttributes(),o=e.d,r=e.strokeWidth,i=e.stroke,a=e.fill;return E(Bn,{d:o,fill:a,strokeWidth:r,stroke:i})},t.prototype.render=function(){return E("g",{className:"lf-arrow",children:this.getShape()})},t})(Y);var kf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Pn=globalThis&&globalThis.__assign||function(){return Pn=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Pn.apply(this,arguments)},Bf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},er=function(n){kf(t,n);function t(){var e=n.call(this)||this;return e.textRef=Ko(),e.handleHover=function(o,r){var i=e.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(o);var l=o?C.EDGE_MOUSEENTER:C.EDGE_MOUSELEAVE,u=a.getData();s.emit(l,{data:u,e:r})},e.setHoverOn=function(o){var r=e.props.model.isHovered;r||(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOn(),e.handleHover(!0,o))},e.setHoverOff=function(o){var r=e.props.model.isHovered;r&&(e.textRef&&e.textRef.current&&e.textRef.current.setHoverOff(),e.handleHover(!1,o))},e.handleContextMenu=function(o){o.preventDefault(),e.contextMenuTime=new Date().getTime(),e.clickTimer&&clearTimeout(e.clickTimer);var r=e.props,i=r.model,a=r.graphModel,s=a.editConfigModel,l=a.getPointByClient({x:o.clientX,y:o.clientY});a.setElementStateById(i.id,F.SHOW_MENU,l.domOverlayPosition),s.isSilentMode||e.toFront(),i.isSelected||a.selectEdgeById(i.id);var u=i==null?void 0:i.getData();a.eventCenter.emit(C.EDGE_CONTEXTMENU,{data:u,e:o,position:l})},e.handleMouseDown=function(o){o.stopPropagation(),e.startTime=new Date().getTime()},e.handleMouseUp=function(){var o=e.props.model;e.mouseUpDrag=o.isDragging},e.handleClick=function(o){if(e.startTime&&!e.mouseUpDrag){var r=o.button===2;if(!r){var i=o.detail===2,a=e.props,s=a.model,l=a.graphModel,u=s==null?void 0:s.getData(),p=l.getPointByClient({x:o.clientX,y:o.clientY});if(i){var c=l.editConfigModel,d=l.textEditElement,f=s.id,y=s.text,h=s.modelType;if(d&&d.id===f&&l.setElementStateById(f,F.DEFAULT),c.edgeTextEdit&&y.editable&&(s.setSelected(!1),l.setElementStateById(f,F.TEXT_EDIT)),h===z.POLYLINE_EDGE){var v=s,g=l.getPointByClient({x:o.x,y:o.y}).canvasOverlayPosition,m=g.x,O=g.y;v.dbClickPosition=hl({x:m,y:O},v.points)}l.eventCenter.emit(C.EDGE_DBCLICK,{data:u,e:o,position:p})}else l.eventCenter.emit(C.ELEMENT_CLICK,{data:u,e:o,position:p}),l.eventCenter.emit(C.EDGE_CLICK,{data:u,e:o,position:p});var S=l.editConfigModel;l.selectEdgeById(s.id,yl(o,S)),S.isSilentMode||e.toFront()}}},e.handleFocus=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(C.EDGE_FOCUS,{data:r.getData()})},e.handleBlur=function(){var o=e.props,r=o.model,i=o.graphModel;i.eventCenter.emit(C.EDGE_BLUR,{data:r.getData()})},e}return t.prototype.getShape=function(){return E("g",{children:this.getEdge()})},t.prototype.getTextStyle=function(){},t.prototype.getText=function(){var e,o=this.props,r=o.model,i=o.graphModel,a=i.editConfigModel;if(a.edgeTextMode!==Pt.TEXT||r.state===F.TEXT_EDIT)return null;if(r.text){var s=!1;return a.edgeTextDraggable&&r.text.draggable&&(s=!0),E(xf,{ref:this.textRef,editable:a.edgeTextEdit&&((e=r.text.editable)!==null&&e!==void 0?e:!0),model:r,graphModel:i,draggable:s})}return null},t.prototype.getArrowInfo=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint,i=e.isSelected,a=this.state.hover;return{start:o,end:r,hover:a,isSelected:i}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint;return[o,r]},t.prototype.getArrowStyle=function(){return null},t.prototype.getArrow=function(){var e=this.props.model,o=e.id,r=e.getArrowStyle(),i=r.refY,a=i===void 0?0:i,s=r.refX,l=s===void 0?2:s,u=Bf(this.getLastTwoPoints(),2),p=u[0],c=u[1],d="auto";return p!==null&&c!==null&&(d=od(nd({x:c.x-p.x,y:c.y-p.y,z:0}))),E("g",{children:E("defs",{children:[E("marker",{id:"marker-start-".concat(o),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),E("marker",{id:"marker-end-".concat(o),refX:l,refY:a,overflow:"visible",orient:d,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},t.prototype.getStartArrow=function(){return E("path",{})},t.prototype.getEndArrow=function(){var e=this.props.model,o=e.getArrowStyle(),r=o.stroke,i=o.strokeWidth,a=o.offset,s=o.verticalLength;return E("path",{stroke:r,fill:r,strokeWidth:i,transform:"rotate(180)",d:"M 0 0 L ".concat(a," -").concat(s," L ").concat(a," ").concat(s," Z")})},t.prototype.getAdjustPointShape=function(e,o,r){var i=r.getAdjustPointStyle();return E(rn,Pn({className:"lf-edge-adjust-point"},i,{x:e,y:o}))},t.prototype.getAdjustPoints=function(){var e=this.props,o=e.model,r=e.graphModel,i=r.editConfigModel,a=i.adjustEdgeStartAndEnd,s=i.adjustEdgeStart,l=i.adjustEdgeEnd,u=o.getAdjustStart(),p=o.getAdjustEnd();return E("g",{children:[a&&s&&E(es,Pn({type:Zt.SOURCE},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r})),a&&l&&E(es,Pn({type:Zt.TARGET},p,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:o,graphModel:r}))]})},t.prototype.getAnimation=function(){},t.prototype.getAppendWidth=function(){return E("g",{})},t.prototype.getAppend=function(){return E("g",{className:"lf-edge-append",children:this.getAppendWidth()})},t.prototype.getEdge=function(){return null},t.prototype.toFront=function(){var e=this.props,o=e.graphModel,r=e.model;o.toFront(r.id)},t.prototype.render=function(){var e=this.props.model,o=e.isSelected,r=e.isHitable,i=e.isShowAdjustPoint;return E("g",{children:[E("g",{className:["lf-edge",!r&&"pointer-none",o&&"lf-edge-selected"].filter(Boolean).join(" "),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onContextMenu:this.handleContextMenu,onMouseOver:this.setHoverOn,onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,onFocus:this.handleFocus,onBlur:this.handleBlur,children:[this.getShape(),this.getAppend(),this.getText(),this.getArrow()]}),i&&o?this.getAdjustPoints():""]})},t.isObserved=!1,t}(Y),Xf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),ti=globalThis&&globalThis.__assign||function(){return ti=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},ti.apply(this,arguments)},Hf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},ns=function(n){Xf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,o=e.getEdgeStyle(),r=e,i=r.path,a=r.isAnimation,s=r.arrowConfig,l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,p=l.stroke,c=l.strokeDashoffset,d=l.animationName,f=l.animationDuration,y=l.animationIterationCount,h=l.animationTimingFunction,v=l.animationDirection;return E(Bn,ti({d:i},o,s,a?{strokeDasharray:u,stroke:p,style:{strokeDashoffset:c,animationName:d,animationDuration:f,animationIterationCount:y,animationTimingFunction:h,animationDirection:v}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model.path;return E(Bn,{d:e,strokeWidth:10,stroke:"transparent",fill:"none"})},t.prototype.getArrowInfo=function(){var e=this.props.model,o=this.state.hover,r=e.isSelected,i=e.getArrowStyle().offset,a=e.pointsList.map(function(c){return{x:c.x,y:c.y}}),s=Hf(wa(a,i),2),l=s[0],u=s[1],p={start:l,end:u,hover:o,isSelected:r};return p},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.getArrowStyle().offset,r=e.pointsList.map(function(i){return{x:i.x,y:i.y}});return wa(r,o)},t}(er),zf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),ei=globalThis&&globalThis.__assign||function(){return ei=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},ei.apply(this,arguments)},os=function(n){zf(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getEdge=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint,i=e.isAnimation,a=e.arrowConfig,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=l.strokeDasharray,p=l.stroke,c=l.strokeDashoffset,d=l.animationName,f=l.animationDuration,y=l.animationIterationCount,h=l.animationTimingFunction,v=l.animationDirection;return E(on,ei({},s,{x1:o.x,y1:o.y,x2:r.x,y2:r.y},a,i?{strokeDasharray:u,stroke:p,style:{strokeDashoffset:c,animationName:d,animationDuration:f,animationIterationCount:y,animationTimingFunction:h,animationDirection:v}}:{}))},t.prototype.getAppendWidth=function(){var e=this.props.model,o=e.startPoint,r=e.endPoint,i={start:o,end:r},a=lp(i),s=a.d,l=a.strokeWidth,u=a.fill,p=a.strokeDasharray,c=a.stroke;return E(Bn,{d:s,fill:u,strokeWidth:l,stroke:c,strokeDasharray:p})},t}(er),Gf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),we=globalThis&&globalThis.__assign||function(){return we=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},we.apply(this,arguments)},Yf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},rs=function(n){Gf(t,n);function t(){var e=n.call(this)||this;return e.onDragStart=function(){var o=e.props.model;o.dragAppendStart(),e.isShowAdjustPointTemp=o.isShowAdjustPoint,o.isShowAdjustPoint=!1},e.onDragging=function(o){var r=o.deltaX,i=o.deltaY,a=e.props,s=a.model,l=a.graphModel;e.isDragging=!0;var u=l.transformModel,p=l.editConfigModel,c=Yf(u.fixDeltaXY(r,i),2),d=c[0],f=c[1],y=s,h=p.adjustEdgeMiddle;h?e.appendInfo=y.dragAppendSimple(e.appendInfo,{x:d,y:f}):e.appendInfo=y.dragAppend(e.appendInfo,{x:d,y:f})},e.onDragEnd=function(){var o,r=e.props,i=r.model,a=r.graphModel.eventCenter,s=i;s.dragAppendEnd(),e.isDragging=!1,s.isShowAdjustPoint=(o=e.isShowAdjustPointTemp)!==null&&o!==void 0?o:!1,e.appendInfo=void 0,a.emit(C.EDGE_ADJUST,{data:s.getData()})},e.beforeDragStart=function(o,r){r.draggable&&e.drag.handleMouseDown(o),e.appendInfo=r},e.drag=new ne({onDragStart:e.onDragStart,onDragging:e.onDragging,onDragEnd:e.onDragEnd,isStopPropagation:!1}),e}return t.prototype.getEdge=function(){var e=this.props.model,o=e.points,r=e.isAnimation,i=e.arrowConfig,a=e.getEdgeStyle(),s=e.getEdgeAnimationStyle(),l=s.strokeDasharray,u=s.stroke,p=s.strokeDashoffset,c=s.animationName,d=s.animationDuration,f=s.animationIterationCount,y=s.animationTimingFunction,h=s.animationDirection;return E(Ip,we({points:o},a,i,r?{strokeDasharray:l,stroke:u,style:{strokeDashoffset:p,animationName:c,animationDuration:d,animationIterationCount:f,animationTimingFunction:y,animationDirection:h}}:{}))},t.prototype.getArrowInfo=function(){var e=this.props.model,o=e.points,r=e.isSelected,i=this.state.hover,a=je(o),s=a[0],l=a[0];return a.length>=2&&(s=a[a.length-2],l=a[a.length-1]),{start:s,end:l,hover:i,isSelected:r}},t.prototype.getLastTwoPoints=function(){var e=this.props.model,o=e.points,r=je(o),i=r[0],a=r[0];return r.length>=2&&(i=r[r.length-2],a=r[r.length-1]),[i,a]},t.prototype.getAppendAttributes=function(e){var o=e.start,r=e.end,i;if(o.x===r.x&&o.y===r.y)i="";else{var a={start:o,end:r,offset:10,verticalLength:5},s=Ln(we(we({},a),{type:"start"})),l=Ln(we(we({},a),{type:"end"}));i="M".concat(s.leftX," ").concat(s.leftY,`
- L`).concat(s.rightX," ").concat(s.rightY,`
- L`).concat(l.rightX," ").concat(l.rightY,`
- L`).concat(l.leftX," ").concat(l.leftY," z")}return{d:i,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},t.prototype.getAppendShape=function(e){var o=this.getAppendAttributes(e),r=o.d,i=o.strokeWidth,a=o.fill,s=o.strokeDasharray,l=o.stroke;return E(Bn,{d:r,fill:a,strokeWidth:i,stroke:l,strokeDasharray:s})},t.prototype.getAppendWidth=function(){for(var e=this,o=this.props,r=o.model,i=o.graphModel,a=r.pointsList,s=r.draggable,l=[],u=a.length,p=function(f){var y="lf-polyline-append",h={start:{x:a[f].x,y:a[f].y},end:{x:a[f+1].x,y:a[f+1].y},startIndex:f,endIndex:f+1,direction:et.HORIZONTAL,draggable:!0},v=E("g",{className:y,children:c.getAppendShape(h)}),g=i.editConfigModel,m=g.adjustEdge,O=g.adjustEdgeMiddle;if(m&&s){var S=h.startIndex,w=h.endIndex,M=O&&(S===0||w===u-1);h.draggable=!M,h.start.x===h.end.x?(h.draggable&&(y+="-ew-resize"),h.direction=et.VERTICAL):h.start.y===h.end.y&&(h.draggable&&(y+="-ns-resize"),h.direction=et.HORIZONTAL),v=E("g",{className:c.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(_){return e.beforeDragStart(_,h)},children:E("g",{className:y,children:c.getAppendShape(h)})})}l.push(v)},c=this,d=0;d<u-1;d++)p(d);return E("g",{children:l})},t}(er),Ve=globalThis&&globalThis.__assign||function(){return Ve=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ve.apply(this,arguments)},Uf=function(){function n(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(r){!e.nodeConfig||e.fakeNode||(e.fakeNode=e.lf.createFakeNode(Ve(Ve({},e.nodeConfig),e.clientToLocalPoint({x:r.clientX,y:r.clientY}))))},this.onDragOver=function(r){if(r.preventDefault(),e.fakeNode){var i=e.clientToLocalPoint({x:r.clientX,y:r.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:r})}return!1},this.onDragLeave=function(){e.fakeNode&&(e.lf.removeNodeSnapLine(),e.lf.graphModel.removeFakeNode(),e.fakeNode=null)},this.onDrop=function(r){!e.lf.graphModel||!r||!e.nodeConfig||(e.lf.addNode(Ve(Ve({},e.nodeConfig),e.clientToLocalPoint({x:r.clientX,y:r.clientY})),C.NODE_DND_ADD,r),r.preventDefault(),r.stopPropagation(),e.nodeConfig=null,e.lf.removeNodeSnapLine(),e.lf.graphModel.removeFakeNode(),e.fakeNode=null)};var o=t.lf;this.lf=o}return n.prototype.clientToLocalPoint=function(t){var e=t.x,o=t.y,r=Wo(this.lf.options,["grid","size"]),i=this.lf.graphModel.getPointByClient({x:e,y:o}),a=i.canvasOverlayPosition,s=a.x,l=a.y,u=this.lf.graphModel.editConfigModel.snapGrid;return{x:nn(s,r,u),y:nn(l,r,u)}},n.prototype.startDrag=function(t){var e=this.lf.graphModel.editConfigModel;e!=null&&e.isSilentMode||(this.nodeConfig=t,window.document.addEventListener("mouseup",this.stopDrag))},n.prototype.eventMap=function(){return{onMouseEnter:this.dragEnter,onMouseOver:this.dragEnter,onMouseMove:this.onDragOver,onMouseLeave:this.onDragLeave,onMouseUp:this.onDrop}},n}();function Vf(n,t){n.on("node:mousemove",function(e){var o=e.data;t.setNodeSnapLine(o)}),n.on("node:mouseup",function(){t.clearSnapline()})}var Wf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),re=globalThis&&globalThis.__assign||function(){return re=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},re.apply(this,arguments)},Ff=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Kf=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},Zf=function(n){Wf(t,n);function t(e){var o=n.call(this,e)||this;return o.ref=Ko(),o.__prevText={type:"",text:"",id:""},o.keyupHandler=function(r){var i=o.props.graphModel.textEditElement;r.key==="Enter"&&r.altKey&&(i==null||i.setElementState(F.DEFAULT))},o.inputHandler=function(r){var i=r.target.innerText,a=o.props.graphModel.textEditElement;a&&(o.__prevText={type:a.type,text:i.replace(/(\r\n)+$|(\n)+$/,""),id:a.id})},o.keydownHandler=function(r){r.stopPropagation()},o.state={style:{left:0,top:0}},o}return t.getDerivedStateFromProps=function(e){var o,r=e.textEditElement,i=e.graphModel,a=i.transformModel,s=i.theme,l=s.inputText,u;if(r){if(!(!((o=r.text)===null||o===void 0)&&o.value)&&r.BaseType===rt.EDGE){var p=r.text,c=r.textPosition,d=c.x,f=c.y;p.x=d,p.y=f,r.setText(p)}var y={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(r.BaseType===rt.EDGE){var h=s.edgeText,v=h.overflowMode,g=h.lineHeight,m=h.wrapPadding,O=h.textWidth;O&&v==="autoWrap"&&(u=re(re({},y),{width:O,minWidth:O,lineHeight:g,padding:m}))}else if(r.BaseType===rt.NODE){var S=s.nodeText,v=S.overflowMode,g=S.lineHeight,m=S.wrapPadding,O=S.textWidth,w=r.width,M=r.modelType,_=r.textWidth,T=_||O||w;(M!==z.TEXT_NODE&&v==="autoWrap"||M===z.TEXT_NODE&&O)&&(u=re(re({},y),{width:T,minWidth:T,lineHeight:g,padding:m}))}var A=r.text,P=A.x,k=A.y,I=Kf(a.CanvasPointToHtmlPoint([P,k]),2),nt=I[0],Z=I[1];return{style:re(re({left:nt,top:Z},u),l)}}return null},t.prototype.componentDidUpdate=function(){var e=this.props.graphModel;if(this.ref.current&&(this.ref.current.focus(),this.placeCaretAtEnd(this.ref.current)),this.__prevText.id!==""){var o=this.__prevText,r=o.text,i=o.id;e.updateText(i,r),e.eventCenter.emit(C.TEXT_UPDATE,{data:re({},this.__prevText)}),this.__prevText.id="",this.__prevText.text="",this.__prevText.type=""}},t.prototype.placeCaretAtEnd=function(e){if(window.getSelection!==void 0&&document.createRange!==void 0){var o=document.createRange();o.selectNodeContents(e),o.collapse(!1);var r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(o)}},t.prototype.render=function(){var e,o=this.props.graphModel.textEditElement,r=this.state.style;return o?E("div",{contentEditable:!0,className:"lf-text-input",style:r,ref:this.ref,onKeyUp:this.keyupHandler,onKeyDown:this.keydownHandler,onKeyPress:this.keydownHandler,onInput:this.inputHandler,children:(e=o.text)===null||e===void 0?void 0:e.value},o.id):null},t.toolName="text-edit-tool",t=Ff([wt],t),t}(Y),qf=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Jf=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},fr=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},$f=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},Qf=function(n){qf(t,n);function t(e){var o=n.call(this,e)||this;o.handleMouseDown=function(s){o.stepDrag.handleMouseDown(s)},o.handleWheelEvent=function(s){var l,u;s.preventDefault();var p=s.deltaX,c=s.deltaY,d=s.clientX,f=s.clientY,y=s.ctrlKey,h=new WheelEvent("wheel",{deltaX:p,deltaY:c,clientX:d,clientY:f,ctrlKey:y});(u=(l=o.props.lf.container)===null||l===void 0?void 0:l.querySelector('.lf-canvas-overlay[name="canvas-overlay"]'))===null||u===void 0||u.dispatchEvent(h)},o.onDragging=function(s){var l=s.deltaX,u=s.deltaY,p=o.props,c=p.graphModel,d=p.lf,f=d.getTransform(),y=f.SCALE_X,h=f.SCALE_Y,v=c.getSelectElements(!0);c.moveNodes(v.nodes.map(function(g){return g.id}),l/y,u/h)},o.handleContextMenu=function(s){s.preventDefault();var l=o.props,u=l.graphModel,p=l.graphModel,c=p.eventCenter,d=p.selectElements,f=u.getPointByClient({x:s.clientX,y:s.clientY}),y={nodes:[],edges:[]},h=$f([],fr(d.values()),!1);h.forEach(function(v){v.BaseType===rt.NODE&&y.nodes.push(v.getData()),v.BaseType===rt.EDGE&&y.edges.push(v.getData())}),c.emit(C.SELECTION_CONTEXTMENU,{data:y,e:s,position:f})};var r=e.graphModel,i=r.gridSize,a=r.eventCenter;return o.stepDrag=new ne({onDragging:o.onDragging,step:i,eventType:"SELECTION",eventCenter:a}),o}return t.prototype.render=function(){var e,o,r=this.props.graphModel,i=r.selectElements,a=r.transformModel,s=this.props.lf.getTransform(),l=s.SCALE_X,u=s.SCALE_Y;if(!(i.size<=1)){var p=Number.MAX_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;i.forEach(function(h){var v;h.BaseType===rt.NODE&&(v=Vc(h)),h.BaseType===rt.EDGE&&(v=Zc(h)),v!==void 0&&(p=Math.min(p,v.x),c=Math.min(c,v.y),d=Math.max(d,v.x1),f=Math.max(f,v.y1))}),e=fr(a.CanvasPointToHtmlPoint([p,c]),2),p=e[0],c=e[1],o=fr(a.CanvasPointToHtmlPoint([d,f]),2),d=o[0],f=o[1];var y={left:"".concat(p-20*l/2,"px"),top:"".concat(c-20*u/2,"px"),width:"".concat(d-p+20*l,"px"),height:"".concat(f-c+20*u,"px"),"border-width":"".concat(2*l,"px")};return E("div",{className:"lf-multiple-select",style:y,onMouseDown:this.handleMouseDown,onContextMenu:this.handleContextMenu,onWheel:this.handleWheelEvent})}},t.toolName="multiple-select-tool",t=Jf([wt],t),t}(Y),hr=globalThis&&globalThis.__decorate||function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},th=[Zf,Qf],eh=function(){function n(t){var e=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=t,at(th,function(i){e.isDisabled(i.toolName)||e.registerTool(i.toolName,i)});var o=t.graphModel,r=o.eventCenter;r.on("".concat(C.GRAPH_TRANSFORM,",").concat(C.NODE_CLICK,",").concat(C.BLANK_CLICK," "),function(){var i,a=o.textEditElement,s=o.editConfigModel,l=s.edgeTextEdit,u=s.nodeTextEdit;(l||u)&&a&&((i=o.textEditElement)===null||i===void 0||i.setElementState(F.DEFAULT))})}return n.prototype.isDisabled=function(t){var e;return((e=this.instance.options.disabledTools)===null||e===void 0?void 0:e.indexOf(t))!==-1},n.prototype.registerTool=function(t,e){this.toolMap.set(t,e)},n.prototype.disableTool=function(t){var e=this.toolMap.get(t);if(e)return this.disabledToolMap.set(t,e),this.toolMap.delete(t),!0;throw new Error("禁用失败,不存在名为 ".concat(e," 的工具"))},n.prototype.enableTool=function(t){var e=this.disabledToolMap.get(t);if(e)return this.toolMap.set(t,e),this.disabledToolMap.delete(t),!0;throw new Error("不存在名为 ".concat(e," 的工具"))},n.prototype.getTools=function(){return Array.from(this.toolMap.values())},n.prototype.getInstance=function(){return this.instance},n.prototype.destroy=function(){this.toolMap.clear(),this.disabledToolMap.clear()},hr([x],n.prototype,"toolMap",void 0),hr([b],n.prototype,"disableTool",null),hr([b],n.prototype,"enableTool",null),n}();function nh(n){throw new Error("[mobx-utils] "+n)}function Go(n,t){t===void 0&&(t="Illegal state"),n||nh(t)}var Sl=function(n){return n&&n!==Object.prototype&&Object.getOwnPropertyNames(n).concat(Sl(Object.getPrototypeOf(n))||[])},oh=function(n){var t=Sl(n),e=t.filter(function(o,r){return t.indexOf(o)===r});return e},rh=function(n){return oh(n).filter(function(t){return t!=="constructor"&&!~t.indexOf("__")})},Ml="pending",Yo="fulfilled",Si="rejected";function ih(n){switch(this.state){case Ml:return n.pending&&n.pending(this.value);case Si:return n.rejected&&n.rejected(this.value);case Yo:return n.fulfilled?n.fulfilled(this.value):this.value}}function is(n,t){if(Go(arguments.length<=2,"fromPromise expects up to two arguments"),Go(typeof n=="function"||typeof n=="object"&&n&&typeof n.then=="function","Please pass a promise or function to fromPromise"),n.isPromiseBasedObservable===!0)return n;typeof n=="function"&&(n=new Promise(n));var e=n;n.then(b("observableFromPromise-resolve",function(r){e.value=r,e.state=Yo}),b("observableFromPromise-reject",function(r){e.value=r,e.state=Si})),e.isPromiseBasedObservable=!0,e.case=ih;var o=t&&t.state===Yo?t.value:void 0;return Ar(e,{value:o,state:Ml},{},{deep:!1}),e}(function(n){n.reject=b("fromPromise.reject",function(e){var o=n(Promise.reject(e));return o.state=Si,o.value=e,o});function t(e){e===void 0&&(e=void 0);var o=n(Promise.resolve(e));return o.state=Yo,o.value=e,o}n.resolve=b("fromPromise.resolve",t)})(is||(is={}));var ho=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};(function(){function n(t,e){var o=this;Xu(function(){o.current=e,o.subscription=t.subscribe(o)})}return n.prototype.dispose=function(){this.subscription&&this.subscription.unsubscribe()},n.prototype.next=function(t){this.current=t},n.prototype.complete=function(){this.dispose()},n.prototype.error=function(t){this.current=t,this.dispose()},ho([x.ref],n.prototype,"current",void 0),ho([b.bound],n.prototype,"next",null),ho([b.bound],n.prototype,"complete",null),ho([b.bound],n.prototype,"error",null),n})();var Uo=function(){return Uo=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Uo.apply(this,arguments)},fn=function(n,t,e,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(r<3?a(i):r>3?a(t,e,i):a(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ah=["model","reset","submit","isDirty","isPropertyDirty","resetProperty"];(function(){function n(t){var e=this;this.model=t,this.localValues=x.map({}),this.localComputedValues=x.map({}),this.isPropertyDirty=function(o){return e.localValues.has(o)},Go(Nt(t),"createViewModel expects an observable object"),rh(t).forEach(function(o){if(!(o===L||o==="__mobxDidRunLazyInitializers")){if(Go(ah.indexOf(o)===-1,"The propertyname "+o+" is reserved and cannot be used with viewModels"),Ii(t,o)){var r=Wn(t,o).derivation;e.localComputedValues.set(o,tt(r.bind(e)))}var i=Object.getOwnPropertyDescriptor(t,o),a=i?{enumerable:i.enumerable}:{};Object.defineProperty(e,o,Uo(Uo({},a),{configurable:!0,get:function(){return Ii(t,o)?e.localComputedValues.get(o).get():e.isPropertyDirty(o)?e.localValues.get(o):e.model[o]},set:b(function(s){s!==e.model[o]?e.localValues.set(o,s):e.localValues.delete(o)})}))}})}return Object.defineProperty(n.prototype,"isDirty",{get:function(){return this.localValues.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"changedValues",{get:function(){return this.localValues.toJS()},enumerable:!1,configurable:!0}),n.prototype.submit=function(){var t=this;en(this.localValues).forEach(function(e){var o=t.localValues.get(e),r=t.model[e];ee(r)?r.replace(o):xt(r)?(r.clear(),r.merge(o)):Wu(o)||(t.model[e]=o)}),this.localValues.clear()},n.prototype.reset=function(){this.localValues.clear()},n.prototype.resetProperty=function(t){this.localValues.delete(t)},fn([tt],n.prototype,"isDirty",null),fn([tt],n.prototype,"changedValues",null),fn([b.bound],n.prototype,"submit",null),fn([b.bound],n.prototype,"reset",null),fn([b.bound],n.prototype,"resetProperty",null),n})();function yr(n){if(!n)return"ROOT";for(var t=[];n.parent;)t.push(n.path),n=n.parent;return t.reverse().join("/")}function gr(n){return Nt(n)||ee(n)||xt(n)}function sh(n,t){var e=new WeakMap;function o(s){var l=e.get(s.object);r(s,l),t(s,yr(l),n)}function r(s,l){switch(s.type){case"add":i(s.newValue,l,s.name);break;case"update":a(s.oldValue),i(s.newValue,l,s.name||""+s.index);break;case"remove":case"delete":a(s.oldValue);break;case"splice":s.removed.map(a),s.added.forEach(function(c,d){return i(c,l,""+(s.index+d))});for(var u=s.index+s.addedCount;u<s.object.length;u++)if(gr(s.object[u])){var p=e.get(s.object[u]);p&&(p.path=""+u)}break}}function i(s,l,u){if(gr(s)){var p=e.get(s);if(p){if(p.parent!==l||p.path!==u)throw new Error("The same observable object cannot appear twice in the same tree,"+(" trying to assign it to '"+yr(l)+"/"+u+"',")+(" but it already exists at '"+yr(p.parent)+"/"+p.path+"'"))}else{var c={parent:l,path:u,dispose:Js(s,o)};e.set(s,c),Zu(s).forEach(function(d){var f=d[0],y=d[1];return i(y,c,f)})}}}function a(s){if(gr(s)){var l=e.get(s);if(!l)return;e.delete(s),l.dispose(),Ku(s).forEach(a)}}return i(n,void 0,""),function(){a(n)}}var lh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)r.hasOwnProperty(i)&&(o[i]=r[i])},n(t,e)};return function(t,e){n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}();(function(n){lh(t,n);function t(e,o,r){var i=r===void 0?{}:r,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,p=n.call(this)||this;p._keyToName=u,p._groupBy=o,p._ogmInfoKey=Symbol("ogmInfo"+s),p._base=e;for(var c=0;c<e.length;c++)p._addItem(e[c]);return p._disposeBaseObserver=Js(p._base,function(d){if(d.type==="splice")Bt(function(){for(var f=0,y=d.removed;f<y.length;f++){var h=y[f];p._removeItem(h)}for(var v=0,g=d.added;v<g.length;v++){var m=g[v];p._addItem(m)}});else if(d.type==="update")Bt(function(){p._removeItem(d.oldValue),p._addItem(d.newValue)});else throw new Error("illegal state")}),p}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,o){throw new Error("not supported")},t.prototype.dispose=function(){this._disposeBaseObserver();for(var e=0;e<this._base.length;e++){var o=this._base[e],r=o[this._ogmInfoKey];r.reaction(),delete o[this._ogmInfoKey]}},t.prototype._getGroupArr=function(e){var o=n.prototype.get.call(this,e);return o===void 0&&(o=x([],{name:"GroupArray["+this._keyToName(e)+"]",deep:!1}),n.prototype.set.call(this,e,o)),o},t.prototype._removeFromGroupArr=function(e,o){var r=n.prototype.get.call(this,e);r.length===1?n.prototype.delete.call(this,e):(o===r.length-1||(r[o]=r[r.length-1],r[o][this._ogmInfoKey].groupArrIndex=o),r.length--)},t.prototype._addItem=function(e){var o=this,r=this._groupBy(e),i=this._getGroupArr(r),a={groupByValue:r,groupArrIndex:i.length,reaction:Us(function(){return o._groupBy(e)},function(s,l){var u=e[o._ogmInfoKey];o._removeFromGroupArr(u.groupByValue,u.groupArrIndex);var p=o._getGroupArr(s),c=p.length;p.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 o=e[this._ogmInfoKey];this._removeFromGroupArr(o.groupByValue,o.groupArrIndex),o.reaction(),delete e[this._ogmInfoKey]},t})(_i);Promise.resolve(),typeof queueMicrotask!="undefined"||typeof process!="undefined"&&process.nextTick;var ni=globalThis&&globalThis.__assign||function(){return ni=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},ni.apply(this,arguments)},uh=function(){function n(t){this.undos=[],this.redos=[],this.callbacks=[],this.stopWatch=null,this.curData=null,this.maxSize=50,this.waitTime=100,this.eventCenter=t}return n.prototype.add=function(t){Ai(zl(this.undos),t)||(this.undos.push(t),Ai(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())},n.prototype.undoAble=function(){return this.undos.length>1},n.prototype.undo=function(){if(this.undoAble()){var t=this.undos.pop();this.redos.push(t);var e=this.undos.pop();return this.curData=X(e),e}},n.prototype.redoAble=function(){return this.redos.length>0},n.prototype.redo=function(){if(this.redoAble()){var t=this.redos.pop();return this.curData=X(t),t}},n.prototype.watch=function(t){var e=this;this.stopWatch&&this.stopWatch(),this.undos.push(t.modelToGraphData()),this.stopWatch=sh(t,ds(function(){var o=t.modelToHistoryData();o&&e.add(ni({},o))},this.waitTime))},n.prototype.destroy=function(){this.undos=[],this.redos=[],this.curData=null,this.stopWatch&&this.stopWatch()},n}(),Al={exports:{}};(function(n){(function(t,e,o){if(!t)return;for(var r={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},i={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,u=1;u<20;++u)r[111+u]="f"+u;for(u=0;u<=9;++u)r[u+96]=u.toString();function p(_,T,A){if(_.addEventListener){_.addEventListener(T,A,!1);return}_.attachEvent("on"+T,A)}function c(_){if(_.type=="keypress"){var T=String.fromCharCode(_.which);return _.shiftKey||(T=T.toLowerCase()),T}return r[_.which]?r[_.which]:i[_.which]?i[_.which]:String.fromCharCode(_.which).toLowerCase()}function d(_,T){return _.sort().join(",")===T.sort().join(",")}function f(_){var T=[];return _.shiftKey&&T.push("shift"),_.altKey&&T.push("alt"),_.ctrlKey&&T.push("ctrl"),_.metaKey&&T.push("meta"),T}function y(_){if(_.preventDefault){_.preventDefault();return}_.returnValue=!1}function h(_){if(_.stopPropagation){_.stopPropagation();return}_.cancelBubble=!0}function v(_){return _=="shift"||_=="ctrl"||_=="alt"||_=="meta"}function g(){if(!l){l={};for(var _ in r)_>95&&_<112||r.hasOwnProperty(_)&&(l[r[_]]=_)}return l}function m(_,T,A){return A||(A=g()[_]?"keydown":"keypress"),A=="keypress"&&T.length&&(A="keydown"),A}function O(_){return _==="+"?["+"]:(_=_.replace(/\+{2}/g,"+plus"),_.split("+"))}function S(_,T){var A,P,k,I=[];for(A=O(_),k=0;k<A.length;++k)P=A[k],s[P]&&(P=s[P]),T&&T!="keypress"&&a[P]&&(P=a[P],I.push("shift")),v(P)&&I.push(P);return T=m(P,I,T),{key:P,modifiers:I,action:T}}function w(_,T){return _===null||_===e?!1:_===T?!0:w(_.parentNode,T)}function M(_){var T=this;if(_=_||e,!(T instanceof M))return new M(_);T.target=_,T._callbacks={},T._directMap={};var A={},P,k=!1,I=!1,nt=!1;function Z(B){B=B||{};var U=!1,J;for(J in A){if(B[J]){U=!0;continue}A[J]=0}U||(nt=!1)}function it(B,U,J,G,ot,mt){var V,st,Rt=[],Tt=J.type;if(!T._callbacks[B])return[];for(Tt=="keyup"&&v(B)&&(U=[B]),V=0;V<T._callbacks[B].length;++V)if(st=T._callbacks[B][V],!(!G&&st.seq&&A[st.seq]!=st.level)&&Tt==st.action&&(Tt=="keypress"&&!J.metaKey&&!J.ctrlKey||d(U,st.modifiers))){var Re=!G&&st.combo==ot,or=G&&st.seq==G&&st.level==mt;(Re||or)&&T._callbacks[B].splice(V,1),Rt.push(st)}return Rt}function vt(B,U,J,G){T.stopCallback(U,U.target||U.srcElement,J,G)||B(U,J)===!1&&(y(U),h(U))}T._handleKey=function(B,U,J){var G=it(B,U,J),ot,mt={},V=0,st=!1;for(ot=0;ot<G.length;++ot)G[ot].seq&&(V=Math.max(V,G[ot].level));for(ot=0;ot<G.length;++ot){if(G[ot].seq){if(G[ot].level!=V)continue;st=!0,mt[G[ot].seq]=1,vt(G[ot].callback,J,G[ot].combo,G[ot].seq);continue}st||vt(G[ot].callback,J,G[ot].combo)}var Rt=J.type=="keypress"&&I;J.type==nt&&!v(B)&&!Rt&&Z(mt),I=st&&J.type=="keydown"};function Ct(B){typeof B.which!="number"&&(B.which=B.keyCode);var U=c(B);if(U){if(B.type=="keyup"&&k===U){k=!1;return}T.handleKey(U,f(B),B)}}function oe(){clearTimeout(P),P=setTimeout(Z,1e3)}function Et(B,U,J,G){A[B]=0;function ot(Tt){return function(){nt=Tt,++A[B],oe()}}function mt(Tt){vt(J,Tt,B),G!=="keyup"&&(k=c(Tt)),setTimeout(Z,10)}for(var V=0;V<U.length;++V){var st=V+1===U.length,Rt=st?mt:ot(G||S(U[V+1]).action);jt(U[V],Rt,G,B,V)}}function jt(B,U,J,G,ot){T._directMap[B+":"+J]=U,B=B.replace(/\s+/g," ");var mt=B.split(" "),V;if(mt.length>1){Et(B,mt,U,J);return}V=S(B,J),T._callbacks[V.key]=T._callbacks[V.key]||[],it(V.key,V.modifiers,{type:V.action},G,B,ot),T._callbacks[V.key][G?"unshift":"push"]({callback:U,modifiers:V.modifiers,action:V.action,seq:G,level:ot,combo:B})}T._bindMultiple=function(B,U,J){for(var G=0;G<B.length;++G)jt(B[G],U,J)},p(_,"keypress",Ct),p(_,"keydown",Ct),p(_,"keyup",Ct)}M.prototype.bind=function(_,T,A){var P=this;return _=_ instanceof Array?_:[_],P._bindMultiple.call(P,_,T,A),P},M.prototype.unbind=function(_,T){var A=this;return A.bind.call(A,_,function(){},T)},M.prototype.trigger=function(_,T){var A=this;return A._directMap[_+":"+T]&&A._directMap[_+":"+T]({},_),A},M.prototype.reset=function(){var _=this;return _._callbacks={},_._directMap={},_},M.prototype.stopCallback=function(_,T){var A=this;if((" "+T.className+" ").indexOf(" mousetrap ")>-1||w(T,A.target))return!1;if("composedPath"in _&&typeof _.composedPath=="function"){var P=_.composedPath()[0];P!==_.target&&(T=P)}return T.tagName=="INPUT"||T.tagName=="SELECT"||T.tagName=="TEXTAREA"||T.isContentEditable},M.prototype.handleKey=function(){var _=this;return _._handleKey.apply(_,arguments)},M.addKeycodes=function(_){for(var T in _)_.hasOwnProperty(T)&&(r[T]=_[T]);l=null},M.init=function(){var _=M(e);for(var T in _)T.charAt(0)!=="_"&&(M[T]=function(A){return function(){return _[A].apply(_,arguments)}}(T))},M.init(),t.Mousetrap=M,n.exports&&(n.exports=M),typeof o=="function"&&o.amd&&o(function(){return M})})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)})(Al);var ch=Al.exports;const ph=hs(ch);var as=globalThis&&globalThis.__assign||function(){return as=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},as.apply(this,arguments)};globalThis&&globalThis.__rest;var Vt=null;function ss(n,t){return n.x+=t,n.y+=t,fs(n.text)||(n.text.x+=t,n.text.y+=t),n}function ls(n,t){return n.startPoint&&(n.startPoint.x+=t,n.startPoint.y+=t),n.endPoint&&(n.endPoint.x+=t,n.endPoint.y+=t),n.pointsList&&n.pointsList.length>0&&n.pointsList.forEach(function(e){e.x+=t,e.y+=t}),fs(n.text)||(n.text.x+=t,n.text.y+=t),n}var He=40,yo=40;function dh(n,t){var e=n.keyboard,o=e.options.keyboard;e.on(["cmd + c","ctrl + c"],function(){if(yo=He,!(o!=null&&o.enabled)||t.textEditElement)return!0;var r=n.options.guards,i=t.getSelectElements(!1),a=r&&r.beforeClone?r.beforeClone(i):!0;return!a||i.nodes.length===0&&i.edges.length===0?(Vt=null,!0):(Vt=i,Vt.nodes.forEach(function(s){return ss(s,He)}),Vt.edges.forEach(function(s){return ls(s,He)}),!1)}),e.on(["cmd + v","ctrl + v"],function(){if(!(o!=null&&o.enabled)||t.textEditElement)return!0;if(Vt&&(Vt.nodes||Vt.edges)){n.clearSelectElements();var r=n.addElements(Vt,yo);if(!r)return!0;r.nodes.forEach(function(i){return n.selectElementById(i.id,!0)}),r.edges.forEach(function(i){return n.selectElementById(i.id,!0)}),Vt.nodes.forEach(function(i){return ss(i,He)}),Vt.edges.forEach(function(i){return ls(i,He)}),yo=yo+He}return!1}),e.on(["cmd + z","ctrl + z"],function(){return!(o!=null&&o.enabled)||t.textEditElement?!0:(n.undo(),!1)}),e.on(["cmd + y","ctrl + y"],function(){return!(o!=null&&o.enabled)||t.textEditElement?!0:(n.redo(),!1)}),e.on(["backspace"],function(){if(!(o!=null&&o.enabled)||t.textEditElement)return!0;var r=t.getSelectElements(!0);return n.clearSelectElements(),r.edges.forEach(function(i){return i.id&&n.deleteEdge(i.id)}),r.nodes.forEach(function(i){return i.id&&n.deleteNode(i.id)}),!1})}var fh=function(){function n(t){t.keyboard||(t.keyboard={enabled:!1}),this.options=t;var e=t.lf;this.target=e.container,this.mousetrap=new ph(this.target),t.keyboard.enabled&&!e.options.isSilentMode&&this.enable(!0)}return n.prototype.initShortcuts=function(){var t=this,e,o=((e=this.options.keyboard)!==null&&e!==void 0?e:{}).shortcuts;if(o)if(Gl(o))o.forEach(function(s){var l=s.keys,u=s.callback,p=s.action;return t.on(l,u,p)});else{var r=o.keys,i=o.callback,a=o.action;this.on(r,i,a)}},n.prototype.on=function(t,e,o){this.mousetrap.bind(this.getKeys(t),e,o)},Object.defineProperty(n.prototype,"disabled",{get:function(){var t,e;return((e=(t=this.options)===null||t===void 0?void 0:t.keyboard)===null||e===void 0?void 0:e.enabled)!==!0},enumerable:!1,configurable:!0}),n.prototype.off=function(t,e){this.mousetrap.unbind(this.getKeys(t),e)},n.prototype.enable=function(t){(this.disabled||t)&&(this.options.keyboard&&(this.options.keyboard.enabled=!0),this.target instanceof HTMLElement&&(this.target.setAttribute("tabindex","-1"),this.target.style.outline="none"))},n.prototype.disable=function(){this.disabled||(this.options.keyboard&&(this.options.keyboard.enabled=!1),this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))},n.prototype.destroy=function(){this.mousetrap.reset()},n.prototype.getKeys=function(t){var e=this;return(Array.isArray(t)?t:[t]).map(function(o){return e.formatKey(o)})},n.prototype.formatKey=function(t){return t.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command")},n}(),he=globalThis&&globalThis.__assign||function(){return he=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},he.apply(this,arguments)},go=globalThis&&globalThis.__read||function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var o=e.call(n),r,i=[],a;try{for(;(t===void 0||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i},vr=globalThis&&globalThis.__spreadArray||function(n,t,e){if(e||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return n.concat(i||Array.prototype.slice.call(t))},mr=Symbol("plugin registered by Logicflow.use"),oi=function(){function n(t){var e=this,o;this.viewMap=new Map,this.components=[],this.extension={},this.setView=function(u,p){return e.viewMap.set(u,p)},this.getView=function(u){return e.viewMap.get(u)};var r=jn.get(t),i=r.container,a=r.width,s=r.height;this.options=r,this.container=this.initContainer(i,a,s),this.graphModel=new ef(he(he({},r),{container:this.container})),this.plugins=(o=r.plugins)!==null&&o!==void 0?o:[];var l=this.graphModel.eventCenter;this.tool=new eh(this),this.dnd=new Uf({lf:this}),this.history=new uh(l),this.keyboard=new fh({lf:this,keyboard:r.keyboard}),r.snapline!==!1&&(this.snaplineModel=new nf(this.graphModel),Vf(l,this.snaplineModel)),r.isSilentMode||(dh(this,this.graphModel),this.keyboard.initShortcuts()),this.defaultRegister(),this.installPlugins(r.disabledPlugins)}return n.prototype.initContainer=function(t,e,o){var r=document.createElement("div");return r.style.position="relative",r.style.width=e?"".concat(e,"px"):"100%",r.style.height=o?"".concat(o,"px"):"100%",t.innerHTML="",t.appendChild(r),r},Object.defineProperty(n.prototype,Symbol.toStringTag,{get:function(){return n.toStringTag},enumerable:!1,configurable:!0}),n.prototype.register=function(t,e,o){if(o===void 0&&(o=!0),typeof t!="string"){this.registerElement(t);return}var r={BaseEdge:er,BaseEdgeModel:tr,BaseNode:xe,BaseNodeModel:be,RectNode:Za,RectNodeModel:Va,CircleNode:qa,CircleNodeModel:za,PolygonNode:Ja,PolygonNodeModel:Ua,TextNode:ts,TextNodeModel:Fa,LineEdge:os,LineEdgeModel:ka,DiamondNode:$a,DiamondNodeModel:Ga,PolylineEdge:rs,PolylineEdgeModel:Xa,BezierEdge:ns,BezierEdgeModel:La,EllipseNode:Qa,EllipseNodeModel:Ya,HtmlNode:$r,HtmlNodeModel:Yr,h:Fe,type:t};if(this.viewMap.forEach(function(u){var p=u.extendKey;p&&(r[p]=u)}),this.graphModel.modelMap.forEach(function(u){var p=u.extendKey;p&&(r[p]=u)}),e){var i=e(r),a=i.view,s=i.model,l=a;o&&!l.isObserved&&(l.isObserved=!0,l=wt(l)),this.setView(t,l),this.graphModel.setModel(t,s)}},n.prototype.registerElement=function(t){var e=t.view;t.isObserverView!==!1&&!e.isObserved&&(e.isObserved=!0,e=wt(e)),this.setView(t.type,e),this.graphModel.setModel(t.type,t.model)},n.prototype.batchRegister=function(t){var e=this;t===void 0&&(t=[]),at(t,function(o){e.registerElement(o)})},n.prototype.defaultRegister=function(){var t=[{type:"rect",view:Za,model:Va},{type:"circle",view:qa,model:za},{type:"polygon",view:Ja,model:Ua},{type:"text",view:ts,model:Fa},{type:"ellipse",view:Qa,model:Ya},{type:"diamond",view:$a,model:Ga},{type:"html",view:$r,model:Yr},{type:"line",view:os,model:ka},{type:"polyline",view:rs,model:Xa},{type:"bezier",view:ns,model:La}];this.batchRegister(t)},n.prototype.addNode=function(t,e,o){return e===void 0&&(e=C.NODE_ADD),this.graphModel.addNode(t,e,o)},n.prototype.deleteNode=function(t){var e=this.graphModel.getNodeModelById(t);if(!e)return!1;var o=e.getData(),r=this.options.guards,i=r!=null&&r.beforeDelete?r.beforeDelete(o):!0;return i&&this.graphModel.deleteNode(t),i},n.prototype.cloneNode=function(t){var e=this.graphModel.getNodeModelById(t),o=e==null?void 0:e.getData();if(o){var r=this.options.guards,i=r!=null&&r.beforeClone?r.beforeClone(o):!0;if(i)return this.graphModel.cloneNode(t)}},n.prototype.changeNodeId=function(t,e){return this.graphModel.changeNodeId(t,e)},n.prototype.changeNodeType=function(t,e){this.graphModel.changeNodeType(t,e)},n.prototype.getNodeModelById=function(t){return this.graphModel.getNodeModelById(t)},n.prototype.getNodeDataById=function(t){var e=this.getNodeModelById(t);return e==null?void 0:e.getData()},n.prototype.getNodeIncomingEdge=function(t){return this.graphModel.getNodeIncomingEdge(t)},n.prototype.getNodeOutgoingEdge=function(t){return this.graphModel.getNodeOutgoingEdge(t)},n.prototype.getNodeIncomingNode=function(t){return this.graphModel.getNodeIncomingNode(t)},n.prototype.getNodeOutgoingNode=function(t){return this.graphModel.getNodeOutgoingNode(t)},n.prototype.createFakeNode=function(t){var e=this.graphModel.modelMap.get(t.type);if(!e)return null;var o=new e(he(he({},t),{virtual:!0}),this.graphModel);return this.graphModel.setFakeNode(o),o},n.prototype.removeFakeNode=function(){this.graphModel.removeFakeNode()},n.prototype.setNodeSnapLine=function(t){var e;(e=this.snaplineModel)===null||e===void 0||e.setNodeSnapLine(t)},n.prototype.removeNodeSnapLine=function(){var t;(t=this.snaplineModel)===null||t===void 0||t.clearSnapline()},n.prototype.setDefaultEdgeType=function(t){this.graphModel.setDefaultEdgeType(t)},n.prototype.addEdge=function(t){return this.graphModel.addEdge(t)},n.prototype.getEdgeDataById=function(t){var e=this.getEdgeModelById(t);return e==null?void 0:e.getData()},n.prototype.getEdgeModelById=function(t){return this.graphModel.getEdgeModelById(t)},n.prototype.getEdgeModels=function(t){var e=t.sourceNodeId,o=t.targetNodeId,r=[],i=this.graphModel.edges;return e&&o?at(i,function(a){a.sourceNodeId===e&&a.targetNodeId===o&&r.push(a)}):e?at(i,function(a){a.sourceNodeId===e&&r.push(a)}):o&&at(i,function(a){a.targetNodeId===o&&r.push(a)}),r},n.prototype.changeEdgeId=function(t,e){return this.graphModel.changeEdgeId(t,e)},n.prototype.changeEdgeType=function(t,e){this.graphModel.changeEdgeType(t,e)},n.prototype.deleteEdge=function(t){var e=this.graphModel.getEdgeModelById(t);if(!e)return!1;var o=e.getData(),r=this.options.guards,i=r!=null&&r.beforeDelete?r.beforeDelete(o):!0;return i&&this.graphModel.deleteEdgeById(t),i},n.prototype.deleteEdgeByNodeId=function(t){var e=t.sourceNodeId,o=t.targetNodeId;e&&o?this.graphModel.deleteEdgeBySourceAndTarget(e,o):e?this.graphModel.deleteEdgeBySource(e):o&&this.graphModel.deleteEdgeByTarget(o)},n.prototype.getNodeEdges=function(t){return this.graphModel.getNodeEdges(t)},n.prototype.addElements=function(t,e){var o=this,r=t.nodes,i=t.edges;e===void 0&&(e=40);var a={},s={nodes:[],edges:[]};return at(r,function(l){var u=l.id,p=o.addNode(l);u&&(a[u]=p.id),s.nodes.push(p)}),at(i,function(l){var u=l.sourceNodeId,p=l.targetNodeId;a[u]&&(u=a[u]),a[p]&&(p=a[p]);var c=o.graphModel.addEdge(he(he({},l),{sourceNodeId:u,targetNodeId:p}));s.edges.push(c)}),s},n.prototype.selectElementById=function(t,e,o){e===void 0&&(e=!1),o===void 0&&(o=!0),this.graphModel.selectElementById(t,e),!e&&o&&this.graphModel.toFront(t)},n.prototype.getSelectElements=function(t){return t===void 0&&(t=!0),this.graphModel.getSelectElements(t)},n.prototype.clearSelectElements=function(){this.graphModel.clearSelectElements()},n.prototype.getModelById=function(t){return this.graphModel.getElement(t)},n.prototype.getDataById=function(t){var e;return(e=this.graphModel.getElement(t))===null||e===void 0?void 0:e.getData()},n.prototype.deleteElement=function(t){var e,o,r,i=this.getModelById(t);if(!i)return!1;var a=(e={},e[rt.NODE]=this.deleteNode,e[rt.EDGE]=this.deleteEdge,e);return(r=(o=a[i.BaseType])===null||o===void 0?void 0:o.call(this,t))!==null&&r!==void 0?r:!1},n.prototype.setElementZIndex=function(t,e){return this.graphModel.setElementZIndex(t,e)},n.prototype.getAreaElement=function(t,e,o,r,i){return o===void 0&&(o=!0),r===void 0&&(r=!0),i===void 0&&(i=!1),this.graphModel.getAreaElement(t,e,o,r,i).map(function(a){return a.getData()})},n.prototype.setProperties=function(t,e){var o;(o=this.graphModel.getElement(t))===null||o===void 0||o.setProperties(gt(e))},n.prototype.getProperties=function(t){var e;return(e=this.graphModel.getElement(t))===null||e===void 0?void 0:e.getProperties()},n.prototype.deleteProperty=function(t,e){var o;(o=this.graphModel.getElement(t))===null||o===void 0||o.deleteProperty(e)},n.prototype.updateAttributes=function(t,e){this.graphModel.updateAttributes(t,e)},n.prototype.editText=function(t){this.graphModel.editText(t)},n.prototype.updateText=function(t,e){this.graphModel.updateText(t,e)},n.prototype.updateEditConfig=function(t){var e=this.graphModel,o=e.editConfigModel,r=e.transformModel,i=o.snapGrid;if(o.updateEditConfig(t),(t==null?void 0:t.stopMoveGraph)!==void 0&&r.updateTranslateLimits(t.stopMoveGraph),t!=null&&t.isSilentMode?this.keyboard.disable():this.keyboard.enable(!0),!_t(t==null?void 0:t.snapGrid)&&t.snapGrid!==i){var a=this.graphModel.grid.size,s=a===void 0?1:a;this.graphModel.updateGridSize(t.snapGrid?s:1)}},n.prototype.getEditConfig=function(){return this.graphModel.editConfigModel.getConfig()},n.prototype.setTheme=function(t){this.graphModel.setTheme(t)},n.prototype.focusByElement=function(t){var e=void 0,o=this.getNodeModelById(t);if(o){var r=o.getData(),i=r.x,a=r.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)},n.prototype.focusByCoordinate=function(t){var e=this.graphModel,o=e.transformModel,r=e.width,i=e.height,a=t.x,s=t.y;o.focusOn(a,s,r,i)},n.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,o=t.coordinate;e&&this.focusByElement(e),o&&this.focusByCoordinate(o)}},n.prototype.resize=function(t,e){this.graphModel.resize(t,e),this.options.width=this.graphModel.width,this.options.height=this.graphModel.height},n.prototype.toFront=function(t){this.graphModel.toFront(t)},n.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})},n.prototype.getGraphData=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=this.getGraphRawData();return this.adapterOut?this.adapterOut.apply(this,vr([o],go(t),!1)):o},n.prototype.getGraphRawData=function(){return this.graphModel.modelToGraphData()},n.prototype.clearData=function(){this.graphModel.clearData(),this.render({})},n.prototype.renderRawData=function(t){this.graphModel.graphDataToModel(gt(t)),this.options.history!==!1&&this.history.watch(this.graphModel),ua(E(cf,{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})},n.prototype.render=function(t){var e=X(t);this.adapterIn&&(e=this.adapterIn(e)),this.renderRawData(e)},n.prototype.undo=function(){if(this.history.undoAble()){var t=gt(this.history.undo());this.clearSelectElements(),this.graphModel.graphDataToModel(t)}},n.prototype.redo=function(){if(this.history.redoAble()){var t=gt(this.history.redo());this.clearSelectElements(),this.graphModel.graphDataToModel(t)}},n.prototype.zoom=function(t,e){var o=this.graphModel.transformModel;return o.zoom(t,e)},n.prototype.resetZoom=function(){var t=this.graphModel.transformModel;t.resetZoom()},n.prototype.setZoomMiniSize=function(t){var e=this.graphModel.transformModel;e.setZoomMiniSize(t)},n.prototype.setZoomMaxSize=function(t){var e=this.graphModel.transformModel;e.setZoomMaxSize(t)},n.prototype.getTransform=function(){var t=this.graphModel.transformModel,e=t.SCALE_X,o=t.SCALE_Y,r=t.TRANSLATE_X,i=t.TRANSLATE_Y;return{SCALE_X:e,SCALE_Y:o,TRANSLATE_X:r,TRANSLATE_Y:i}},n.prototype.translate=function(t,e){var o=this.graphModel.transformModel;o.translate(t,e)},n.prototype.resetTranslate=function(){var t=this.graphModel.transformModel,e=t.TRANSLATE_X,o=t.TRANSLATE_Y;this.translate(-e,-o)},n.prototype.translateCenter=function(){this.graphModel.translateCenter()},n.prototype.fitView=function(t,e){e===void 0&&(e=t),this.graphModel.fitView(t,e)},n.prototype.openEdgeAnimation=function(t){this.graphModel.openEdgeAnimation(t)},n.prototype.closeEdgeAnimation=function(t){this.graphModel.closeEdgeAnimation(t)},n.prototype.on=function(t,e){this.graphModel.eventCenter.on(t,e)},n.prototype.off=function(t,e){this.graphModel.eventCenter.off(t,e)},n.prototype.once=function(t,e){this.graphModel.eventCenter.once(t,e)},n.prototype.emit=function(t,e){this.graphModel.eventCenter.emit(t,e)},n.use=function(t,e){var o,r=t.pluginName;if(!r)throw new Error("请给插件指定 pluginName!");this.extensions.set(r,(o={},o[mr]=mr,o.extension=t,o.props=e,o))},n.prototype.installPlugins=function(t){var e=this;t===void 0&&(t=[]);var o=Array.from(n.extensions,function(i){var a=go(i,2),s=a[1];return s}),r=vr(vr([],go(this.plugins),!1),go(o),!1);at(r,function(i){var a,s;mr in i?(a=i.extension,s=i.props):a=i;var l=a==null?void 0:a.pluginName;Yl(t,l)===-1&&e.installPlugin(a,s)})},n.prototype.installPlugin=function(t,e){var o,r;if("pluginName"in t&&"install"in t){var i=t.pluginName,a=t.install,s=t.render;i&&(a&&a.call(t,this,n),s&&this.components.push(s.bind(t)),this.extension[i]=t);return}var l=t,u=l.pluginName,p=new l({lf:this,LogicFlow:n,props:e,options:(r=(o=this.options.pluginsOptions)===null||o===void 0?void 0:o[u])!==null&&r!==void 0?r:{}});p.render&&this.components.push(p.render.bind(p)),this.extension[u]=p},n.prototype.destroy=function(){var t;this.clearData(),ua(null,this.container),this.keyboard.destroy(),this.graphModel.destroy(),this.tool.destroy(),this.history.destroy();for(var e in this.extension){var o=this.extension[e];"destroy"in o&&((t=o.destroy)===null||t===void 0||t.call(o))}},n.extensions=new Map,n}();(function(n){n.toStringTag="LF.".concat(n.name)})(oi||(oi={}));const Ph=oi;function wt(n){return Ei(n)}var hh=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),Se=globalThis&&globalThis.__assign||function(){return Se=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Se.apply(this,arguments)},yh=function(n){hh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.setAttributes=function(){var e=this.properties,o=e.width,r=e.height,i=e.radius;_t(o)||(this.width=o),_t(r)||(this.height=r),_t(i)||(this.radius=i)},t.prototype.getTextStyle=function(){var e=this.properties,o=e.refX,r=o===void 0?0:o,i=e.refY,a=i===void 0?0:i,s=e.textStyle,l=n.prototype.getTextStyle.call(this);return Se(Se(Se({},l),X(s)||{}),{transform:"matrix(1 0 0 1 ".concat(r," ").concat(a,")")})},t.prototype.getNodeStyle=function(){var e=n.prototype.getNodeStyle.call(this),o=this.properties.style;return Se(Se({},e),X(o)||{})},t}(Yr),Pl={};function Dh(n,t){var e=n.type,o=n.component,r=n.effect,i=n.view,a=n.model;if(!e)throw new Error("You should specify type in config");Pl[e]={component:o,effect:r},t.register({type:e,view:i||_h,model:a||yh})}var nr=!1,Vo=Nl({});function gh(n,t,e,o,r){nr&&(Vo[n]=Cl(ps({render:function(){return Dn(jl,{to:e},[Dn(t,{node:o,graph:r})])},provide:function(){return{getNode:function(){return o},getGraph:function(){return r}}}})))}function vh(n){nr&&delete Vo[n]}function us(){return nr}function Nh(){return nr=!0,ps({props:{flowId:{type:String,required:!0}},setup:function(n){return function(){var t=[];return Object.keys(Vo).forEach(function(e){e.startsWith(n.flowId)&&t.push(Vo[e])}),Dn(Rl,{},t.map(function(e){return Dn(e)}))}}})}var mh=globalThis&&globalThis.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function o(){this.constructor=t}t.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)}}(),_h=function(n){mh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getComponentContainer=function(){return this.root},t.prototype.targetId=function(){return"".concat(this.props.graphModel.flowId,":").concat(this.props.model.id)},t.prototype.componentWillUnmount=function(){n.prototype.componentWillUnmount.call(this),this.unmount()},t.prototype.setHtml=function(e){var o=document.createElement("div");o.className="custom-vue-node-content",this.root=o,e.appendChild(o),this.renderVueComponent()},t.prototype.confirmUpdate=function(e){},t.prototype.renderVueComponent=function(){var e;this.unmountVueComponent();var o=this.getComponentContainer(),r=this.props,i=r.model,a=r.graphModel;if(o){var s=Pl[i.type].component;s&&(us()?gh(this.targetId(),s,o,i,a):(this.vm=Ll({render:function(){return Dn(s,{node:i,graph:a})},provide:function(){return{getNode:function(){return i},getGraph:function(){return a}}}}),(e=this.vm)===null||e===void 0||e.mount(o)))}},t.prototype.unmountVueComponent=function(){var e=this.getComponentContainer();return this.vm&&(this.vm.unmount(),this.vm=null),e&&(e.innerHTML=""),e},t.prototype.unmount=function(){us()&&vh(this.targetId()),this.unmountVueComponent()},t}($r);function ri(n,t,e){for(var o=[],r=Math.max(n.length,t.length),i=0,a=0;a<r||i;){var s=a<n.length?n[a]:0,l=a<t.length?t[a]:0,u=i+s+l;o.push(u%e),i=Math.floor(u/e),a++}return o}function cs(n,t,e){if(n<0)return null;if(n==0)return[];for(var o=[],r=t;n&1&&(o=ri(o,r,e)),n=n>>1,n!==0;)r=ri(r,r,e);return o}function bh(n,t){for(var e=n.split(""),o=[],r=e.length-1;r>=0;r--){var i=parseInt(e[r],t);if(isNaN(i))return null;o.push(i)}return o}function xh(n,t,e){var o=bh(n,t);if(o===null)return null;for(var r=[],i=[1],a=0;a<o.length;a++)o[a]&&(r=ri(r,cs(o[a],i,e),e)),i=cs(t,i,e);for(var s="",a=r.length-1;a>=0;a--)s+=r[a].toString(e);return s}function Eh(n){return n.substring(0,2)==="0x"&&(n=n.substring(2)),n=n.toLowerCase(),xh(n,16,10)}class Th{constructor(t){t=t||{},this.seq=0,this.mid=(t.mid||1)%1023,this.offset=t.offset||0,this.lastTime=0}generate(){const t=Date.now(),e=(t-this.offset).toString(2);this.lastTime==t?(this.seq++,this.seq>4095&&(this.seq=0)):this.seq=0,this.lastTime=t;let o=this.seq.toString(2),r=this.mid.toString(2);for(;o.length<12;)o="0"+o;for(;r.length<10;)r="0"+r;const i=e+r+o;let a="";for(let s=i.length;s>0;s-=4)a=parseInt(i.substring(s-4,s),2).toString(16)+a;return Eh(a)}}const Oh=new Th({mid:Ul(0,1023),offset:54*31536e3*1e3});function Ch(){return Oh.generate()}export{Nh as H,_h as N,Fe as Q,Ph as X,Ch as Y,Pl as a,ns as f,Dh as k,yh as w,La as z};
|