@antv/g6 4.6.0-beta.2 → 4.6.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/g6.min.js CHANGED
@@ -34,5 +34,5 @@ and limitations under the License.
34
34
  * Released under MIT license <https://lodash.com/license>
35
35
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
36
36
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
37
- */(function(){var a="Expected a function",s="__lodash_placeholder__",u=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",l="[object Array]",f="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",g="[object GeneratorFunction]",v="[object Map]",y="[object Number]",m="[object Object]",b="[object RegExp]",x="[object Set]",_="[object String]",w="[object Symbol]",E="[object WeakMap]",S="[object ArrayBuffer]",O="[object DataView]",M="[object Float32Array]",k="[object Float64Array]",A="[object Int8Array]",C="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",j="[object Uint16Array]",P="[object Uint32Array]",N=/\b__p \+= '';/g,D=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,F=RegExp(R.source),G=RegExp(B.source),z=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,V=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Y=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,q=RegExp(H.source),K=/^\s+/,Z=/\s/,Q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,tt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,et=/[()=,{}\[\]\/\s]/,nt=/\\(\\)?/g,rt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,ot=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,st=/^\[object .+?Constructor\]$/,ut=/^0o[0-7]+$/i,ct=/^(?:0|[1-9]\d*)$/,lt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,ht=/['\n\r\u2028\u2029\\]/g,dt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",gt="[\\ud800-\\udfff]",vt="["+pt+"]",yt="["+dt+"]",mt="\\d+",bt="[\\u2700-\\u27bf]",xt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+pt+mt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",wt="\\ud83c[\\udffb-\\udfff]",Et="[^\\ud800-\\udfff]",St="(?:\\ud83c[\\udde6-\\uddff]){2}",Ot="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",kt="(?:"+xt+"|"+_t+")",At="(?:"+Mt+"|"+_t+")",Ct="(?:"+yt+"|"+wt+")"+"?",Tt="[\\ufe0e\\ufe0f]?"+Ct+("(?:\\u200d(?:"+[Et,St,Ot].join("|")+")[\\ufe0e\\ufe0f]?"+Ct+")*"),It="(?:"+[bt,St,Ot].join("|")+")"+Tt,jt="(?:"+[Et+yt+"?",yt,St,Ot,gt].join("|")+")",Pt=RegExp("['’]","g"),Nt=RegExp(yt,"g"),Dt=RegExp(wt+"(?="+wt+")|"+jt+Tt,"g"),Lt=RegExp([Mt+"?"+xt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[vt,Mt,"$"].join("|")+")",At+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[vt,Mt+kt,"$"].join("|")+")",Mt+"?"+kt+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Mt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mt,It].join("|"),"g"),Rt=RegExp("[\\u200d\\ud800-\\udfff"+dt+"\\ufe0e\\ufe0f]"),Bt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ft=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Gt=-1,zt={};zt[M]=zt[k]=zt[A]=zt[C]=zt[T]=zt[I]=zt["[object Uint8ClampedArray]"]=zt[j]=zt[P]=!0,zt[c]=zt[l]=zt[S]=zt[f]=zt[O]=zt[h]=zt[d]=zt[p]=zt[v]=zt[y]=zt[m]=zt[b]=zt[x]=zt[_]=zt[E]=!1;var Ut={};Ut[c]=Ut[l]=Ut[S]=Ut[O]=Ut[f]=Ut[h]=Ut[M]=Ut[k]=Ut[A]=Ut[C]=Ut[T]=Ut[v]=Ut[y]=Ut[m]=Ut[b]=Ut[x]=Ut[_]=Ut[w]=Ut[I]=Ut["[object Uint8ClampedArray]"]=Ut[j]=Ut[P]=!0,Ut[d]=Ut[p]=Ut[E]=!1;var Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Wt=parseFloat,Xt=parseInt,Yt="object"==(void 0===t?"undefined":o(t))&&t&&t.Object===Object&&t,Ht="object"==("undefined"==typeof self?"undefined":o(self))&&self&&self.Object===Object&&self,qt=Yt||Ht||Function("return this")(),Kt="object"==o(e)&&e&&!e.nodeType&&e,Zt=Kt&&"object"==o(r)&&r&&!r.nodeType&&r,Qt=Zt&&Zt.exports===Kt,$t=Qt&&Yt.process,Jt=function(){try{var t=Zt&&Zt.require&&Zt.require("util").types;return t||$t&&$t.binding&&$t.binding("util")}catch(t){}}(),te=Jt&&Jt.isArrayBuffer,ee=Jt&&Jt.isDate,ne=Jt&&Jt.isMap,re=Jt&&Jt.isRegExp,ie=Jt&&Jt.isSet,oe=Jt&&Jt.isTypedArray;function ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function se(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function ue(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function le(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function fe(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function he(t,e){return!!(null==t?0:t.length)&&we(t,e,0)>-1}function de(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function ge(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function ve(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ye(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function me(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var be=Me("length");function xe(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function _e(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function we(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):_e(t,Se,n)}function Ee(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Se(t){return t!=t}function Oe(t,e){var n=null==t?0:t.length;return n?Ce(t,e)/n:NaN}function Me(t){return function(e){return null==e?void 0:e[t]}}function ke(t){return function(e){return null==t?void 0:t[e]}}function Ae(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Ce(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Te(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ie(t){return t?t.slice(0,Ke(t)+1).replace(K,""):t}function je(t){return function(e){return t(e)}}function Pe(t,e){return pe(e,(function(e){return t[e]}))}function Ne(t,e){return t.has(e)}function De(t,e){for(var n=-1,r=t.length;++n<r&&we(e,t[n],0)>-1;);return n}function Le(t,e){for(var n=t.length;n--&&we(e,t[n],0)>-1;);return n}function Re(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Be=ke({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Fe=ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Ge(t){return"\\"+Vt[t]}function ze(t){return Rt.test(t)}function Ue(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function Ve(t,e){return function(n){return t(e(n))}}function We(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[i++]=n)}return o}function Xe(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function Ye(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function He(t){return ze(t)?function(t){var e=Dt.lastIndex=0;for(;Dt.test(t);)++e;return e}(t):be(t)}function qe(t){return ze(t)?function(t){return t.match(Dt)||[]}(t):function(t){return t.split("")}(t)}function Ke(t){for(var e=t.length;e--&&Z.test(t.charAt(e)););return e}var Ze=ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Qe=function t(e){var n,r=(e=null==e?qt:Qe.defaults(qt.Object(),e,Qe.pick(qt,Ft))).Array,i=e.Date,Z=e.Error,dt=e.Function,pt=e.Math,gt=e.Object,vt=e.RegExp,yt=e.String,mt=e.TypeError,bt=r.prototype,xt=dt.prototype,_t=gt.prototype,wt=e["__core-js_shared__"],Et=xt.toString,St=_t.hasOwnProperty,Ot=0,Mt=(n=/[^.]+$/.exec(wt&&wt.keys&&wt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",kt=_t.toString,At=Et.call(gt),Ct=qt._,Tt=vt("^"+Et.call(St).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=Qt?e.Buffer:void 0,jt=e.Symbol,Dt=e.Uint8Array,Rt=It?It.allocUnsafe:void 0,Vt=Ve(gt.getPrototypeOf,gt),Yt=gt.create,Ht=_t.propertyIsEnumerable,Kt=bt.splice,Zt=jt?jt.isConcatSpreadable:void 0,$t=jt?jt.iterator:void 0,Jt=jt?jt.toStringTag:void 0,be=function(){try{var t=eo(gt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ke=e.clearTimeout!==qt.clearTimeout&&e.clearTimeout,$e=i&&i.now!==qt.Date.now&&i.now,Je=e.setTimeout!==qt.setTimeout&&e.setTimeout,tn=pt.ceil,en=pt.floor,nn=gt.getOwnPropertySymbols,rn=It?It.isBuffer:void 0,on=e.isFinite,an=bt.join,sn=Ve(gt.keys,gt),un=pt.max,cn=pt.min,ln=i.now,fn=e.parseInt,hn=pt.random,dn=bt.reverse,pn=eo(e,"DataView"),gn=eo(e,"Map"),vn=eo(e,"Promise"),yn=eo(e,"Set"),mn=eo(e,"WeakMap"),bn=eo(gt,"create"),xn=mn&&new mn,_n={},wn=Co(pn),En=Co(gn),Sn=Co(vn),On=Co(yn),Mn=Co(mn),kn=jt?jt.prototype:void 0,An=kn?kn.valueOf:void 0,Cn=kn?kn.toString:void 0;function Tn(t){if(Ya(t)&&!Da(t)&&!(t instanceof Nn)){if(t instanceof Pn)return t;if(St.call(t,"__wrapped__"))return To(t)}return new Pn(t)}var In=function(){function t(){}return function(e){if(!Xa(e))return{};if(Yt)return Yt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function jn(){}function Pn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Nn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Dn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Bn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Rn;++e<n;)this.add(t[e])}function Fn(t){var e=this.__data__=new Ln(t);this.size=e.size}function Gn(t,e){var n=Da(t),r=!n&&Na(t),i=!n&&!r&&Fa(t),o=!n&&!r&&!i&&ts(t),a=n||r||i||o,s=a?Te(t.length,yt):[],u=s.length;for(var c in t)!e&&!St.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||uo(c,u))||s.push(c);return s}function zn(t){var e=t.length;return e?t[Br(0,e-1)]:void 0}function Un(t,e){return Mo(bi(t),Qn(e,0,t.length))}function Vn(t){return Mo(bi(t))}function Wn(t,e,n){(void 0!==n&&!Ia(t[e],n)||void 0===n&&!(e in t))&&Kn(t,e,n)}function Xn(t,e,n){var r=t[e];St.call(t,e)&&Ia(r,n)&&(void 0!==n||e in t)||Kn(t,e,n)}function Yn(t,e){for(var n=t.length;n--;)if(Ia(t[n][0],e))return n;return-1}function Hn(t,e,n,r){return nr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function qn(t,e){return t&&xi(e,ws(e),t)}function Kn(t,e,n){"__proto__"==e&&be?be(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Zn(t,e){for(var n=-1,i=e.length,o=r(i),a=null==t;++n<i;)o[n]=a?void 0:ys(t,e[n]);return o}function Qn(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function $n(t,e,n,r,i,o){var a,s=1&e,u=2&e,l=4&e;if(n&&(a=i?n(t,r,i,o):n(t)),void 0!==a)return a;if(!Xa(t))return t;var d=Da(t);if(d){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&St.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!s)return bi(t,a)}else{var E=io(t),N=E==p||E==g;if(Fa(t))return di(t,s);if(E==m||E==c||N&&!i){if(a=u||N?{}:ao(t),!s)return u?function(t,e){return xi(t,ro(t),e)}(t,function(t,e){return t&&xi(e,Es(e),t)}(a,t)):function(t,e){return xi(t,no(t),e)}(t,qn(a,t))}else{if(!Ut[E])return i?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case S:return pi(t);case f:case h:return new r(+t);case O:return function(t,e){var n=e?pi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case M:case k:case A:case C:case T:case I:case"[object Uint8ClampedArray]":case j:case P:return gi(t,n);case v:return new r;case y:case _:return new r(t);case b:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case x:return new r;case w:return i=t,An?gt(An.call(i)):{}}var i}(t,E,s)}}o||(o=new Fn);var D=o.get(t);if(D)return D;o.set(t,a),Qa(t)?t.forEach((function(r){a.add($n(r,e,n,r,t,o))})):Ha(t)&&t.forEach((function(r,i){a.set(i,$n(r,e,n,i,t,o))}));var L=d?void 0:(l?u?qi:Hi:u?Es:ws)(t);return ue(L||t,(function(r,i){L&&(r=t[i=r]),Xn(a,i,$n(r,e,n,i,t,o))})),a}function Jn(t,e,n){var r=n.length;if(null==t)return!r;for(t=gt(t);r--;){var i=n[r],o=e[i],a=t[i];if(void 0===a&&!(i in t)||!o(a))return!1}return!0}function tr(t,e,n){if("function"!=typeof t)throw new mt(a);return wo((function(){t.apply(void 0,n)}),e)}function er(t,e,n,r){var i=-1,o=he,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=pe(e,je(n))),r?(o=de,a=!1):e.length>=200&&(o=Ne,a=!1,e=new Bn(e));t:for(;++i<s;){var l=t[i],f=null==n?l:n(l);if(l=r||0!==l?l:0,a&&f==f){for(var h=c;h--;)if(e[h]===f)continue t;u.push(l)}else o(e,f,r)||u.push(l)}return u}Tn.templateSettings={escape:z,evaluate:U,interpolate:V,variable:"",imports:{_:Tn}},Tn.prototype=jn.prototype,Tn.prototype.constructor=Tn,Pn.prototype=In(jn.prototype),Pn.prototype.constructor=Pn,Nn.prototype=In(jn.prototype),Nn.prototype.constructor=Nn,Dn.prototype.clear=function(){this.__data__=bn?bn(null):{},this.size=0},Dn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Dn.prototype.get=function(t){var e=this.__data__;if(bn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return St.call(e,t)?e[t]:void 0},Dn.prototype.has=function(t){var e=this.__data__;return bn?void 0!==e[t]:St.call(e,t)},Dn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=bn&&void 0===e?"__lodash_hash_undefined__":e,this},Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(t){var e=this.__data__,n=Yn(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Ln.prototype.get=function(t){var e=this.__data__,n=Yn(e,t);return n<0?void 0:e[n][1]},Ln.prototype.has=function(t){return Yn(this.__data__,t)>-1},Ln.prototype.set=function(t,e){var n=this.__data__,r=Yn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Rn.prototype.clear=function(){this.size=0,this.__data__={hash:new Dn,map:new(gn||Ln),string:new Dn}},Rn.prototype.delete=function(t){var e=Ji(this,t).delete(t);return this.size-=e?1:0,e},Rn.prototype.get=function(t){return Ji(this,t).get(t)},Rn.prototype.has=function(t){return Ji(this,t).has(t)},Rn.prototype.set=function(t,e){var n=Ji(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Bn.prototype.add=Bn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Bn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.clear=function(){this.__data__=new Ln,this.size=0},Fn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Fn.prototype.get=function(t){return this.__data__.get(t)},Fn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ln){var r=n.__data__;if(!gn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Rn(r)}return n.set(t,e),this.size=n.size,this};var nr=Ei(lr),rr=Ei(fr,!0);function ir(t,e){var n=!0;return nr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function or(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===s?a==a&&!Ja(a):n(a,s)))var s=a,u=o}return u}function ar(t,e){var n=[];return nr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function sr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=so),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?sr(s,e-1,n,r,i):ge(i,s):r||(i[i.length]=s)}return i}var ur=Si(),cr=Si(!0);function lr(t,e){return t&&ur(t,e,ws)}function fr(t,e){return t&&cr(t,e,ws)}function hr(t,e){return fe(e,(function(e){return Ua(t[e])}))}function dr(t,e){for(var n=0,r=(e=ci(e,t)).length;null!=t&&n<r;)t=t[Ao(e[n++])];return n&&n==r?t:void 0}function pr(t,e,n){var r=e(t);return Da(t)?r:ge(r,n(t))}function gr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Jt&&Jt in gt(t)?function(t){var e=St.call(t,Jt),n=t[Jt];try{t[Jt]=void 0;var r=!0}catch(t){}var i=kt.call(t);r&&(e?t[Jt]=n:delete t[Jt]);return i}(t):function(t){return kt.call(t)}(t)}function vr(t,e){return t>e}function yr(t,e){return null!=t&&St.call(t,e)}function mr(t,e){return null!=t&&e in gt(t)}function br(t,e,n){for(var i=n?de:he,o=t[0].length,a=t.length,s=a,u=r(a),c=1/0,l=[];s--;){var f=t[s];s&&e&&(f=pe(f,je(e))),c=cn(f.length,c),u[s]=!n&&(e||o>=120&&f.length>=120)?new Bn(s&&f):void 0}f=t[0];var h=-1,d=u[0];t:for(;++h<o&&l.length<c;){var p=f[h],g=e?e(p):p;if(p=n||0!==p?p:0,!(d?Ne(d,g):i(l,g,n))){for(s=a;--s;){var v=u[s];if(!(v?Ne(v,g):i(t[s],g,n)))continue t}d&&d.push(g),l.push(p)}}return l}function xr(t,e,n){var r=null==(t=mo(t,e=ci(e,t)))?t:t[Ao(zo(e))];return null==r?void 0:ae(r,t,n)}function _r(t){return Ya(t)&&gr(t)==c}function wr(t,e,n,r,i){return t===e||(null==t||null==e||!Ya(t)&&!Ya(e)?t!=t&&e!=e:function(t,e,n,r,i,o){var a=Da(t),s=Da(e),u=a?l:io(t),p=s?l:io(e),g=(u=u==c?m:u)==m,E=(p=p==c?m:p)==m,M=u==p;if(M&&Fa(t)){if(!Fa(e))return!1;a=!0,g=!1}if(M&&!g)return o||(o=new Fn),a||ts(t)?Xi(t,e,n,r,i,o):function(t,e,n,r,i,o,a){switch(n){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case S:return!(t.byteLength!=e.byteLength||!o(new Dt(t),new Dt(e)));case f:case h:case y:return Ia(+t,+e);case d:return t.name==e.name&&t.message==e.message;case b:case _:return t==e+"";case v:var s=Ue;case x:var u=1&r;if(s||(s=Xe),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Xi(s(t),s(e),r,i,o,a);return a.delete(t),l;case w:if(An)return An.call(t)==An.call(e)}return!1}(t,e,u,n,r,i,o);if(!(1&n)){var k=g&&St.call(t,"__wrapped__"),A=E&&St.call(e,"__wrapped__");if(k||A){var C=k?t.value():t,T=A?e.value():e;return o||(o=new Fn),i(C,T,n,r,o)}}if(!M)return!1;return o||(o=new Fn),function(t,e,n,r,i,o){var a=1&n,s=Hi(t),u=s.length,c=Hi(e).length;if(u!=c&&!a)return!1;var l=u;for(;l--;){var f=s[l];if(!(a?f in e:St.call(e,f)))return!1}var h=o.get(t),d=o.get(e);if(h&&d)return h==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);var g=a;for(;++l<u;){f=s[l];var v=t[f],y=e[f];if(r)var m=a?r(y,v,f,e,t,o):r(v,y,f,t,e,o);if(!(void 0===m?v===y||i(v,y,n,r,o):m)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=e.constructor;b==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o)}(t,e,n,r,wr,i))}function Er(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=gt(t);i--;){var s=n[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var u=(s=n[i])[0],c=t[u],l=s[1];if(a&&s[2]){if(void 0===c&&!(u in t))return!1}else{var f=new Fn;if(r)var h=r(c,l,u,t,e,f);if(!(void 0===h?wr(l,c,3,r,f):h))return!1}}return!0}function Sr(t){return!(!Xa(t)||(e=t,Mt&&Mt in e))&&(Ua(t)?Tt:st).test(Co(t));var e}function Or(t){return"function"==typeof t?t:null==t?qs:"object"==o(t)?Da(t)?Ir(t[0],t[1]):Tr(t):ru(t)}function Mr(t){if(!po(t))return sn(t);var e=[];for(var n in gt(t))St.call(t,n)&&"constructor"!=n&&e.push(n);return e}function kr(t){if(!Xa(t))return function(t){var e=[];if(null!=t)for(var n in gt(t))e.push(n);return e}(t);var e=po(t),n=[];for(var r in t)("constructor"!=r||!e&&St.call(t,r))&&n.push(r);return n}function Ar(t,e){return t<e}function Cr(t,e){var n=-1,i=Ra(t)?r(t.length):[];return nr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Tr(t){var e=to(t);return 1==e.length&&e[0][2]?vo(e[0][0],e[0][1]):function(n){return n===t||Er(n,t,e)}}function Ir(t,e){return lo(t)&&go(e)?vo(Ao(t),e):function(n){var r=ys(n,t);return void 0===r&&r===e?ms(n,t):wr(e,r,3)}}function jr(t,e,n,r,i){t!==e&&ur(e,(function(o,a){if(i||(i=new Fn),Xa(o))!function(t,e,n,r,i,o,a){var s=xo(t,n),u=xo(e,n),c=a.get(u);if(c)return void Wn(t,n,c);var l=o?o(s,u,n+"",t,e,a):void 0,f=void 0===l;if(f){var h=Da(u),d=!h&&Fa(u),p=!h&&!d&&ts(u);l=u,h||d||p?Da(s)?l=s:Ba(s)?l=bi(s):d?(f=!1,l=di(u,!0)):p?(f=!1,l=gi(u,!0)):l=[]:Ka(u)||Na(u)?(l=s,Na(s)?l=us(s):Xa(s)&&!Ua(s)||(l=ao(u))):f=!1}f&&(a.set(u,l),i(l,u,r,o,a),a.delete(u));Wn(t,n,l)}(t,e,a,n,jr,r,i);else{var s=r?r(xo(t,a),o,a+"",t,e,i):void 0;void 0===s&&(s=o),Wn(t,a,s)}}),Es)}function Pr(t,e){var n=t.length;if(n)return uo(e+=e<0?n:0,n)?t[e]:void 0}function Nr(t,e,n){e=e.length?pe(e,(function(t){return Da(t)?function(e){return dr(e,1===t.length?t[0]:t)}:t})):[qs];var r=-1;return e=pe(e,je($i())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Cr(t,(function(t,n,i){return{criteria:pe(e,(function(e){return e(t)})),index:++r,value:t}})),(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;for(;++r<a;){var u=vi(i[r],o[r]);if(u){if(r>=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return t.index-e.index}(t,e,n)}))}function Dr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=dr(t,a);n(s,a)&&Vr(o,ci(a,t),s)}return o}function Lr(t,e,n,r){var i=r?Ee:we,o=-1,a=e.length,s=t;for(t===e&&(e=bi(e)),n&&(s=pe(t,je(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Kt.call(s,u,1),Kt.call(t,u,1);return t}function Rr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;uo(i)?Kt.call(t,i,1):ei(t,i)}}return t}function Br(t,e){return t+en(hn()*(e-t+1))}function Fr(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=en(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(yo(t,e,qs),t+"")}function zr(t){return zn(Is(t))}function Ur(t,e){var n=Is(t);return Mo(n,Qn(e,0,n.length))}function Vr(t,e,n,r){if(!Xa(t))return t;for(var i=-1,o=(e=ci(e,t)).length,a=o-1,s=t;null!=s&&++i<o;){var u=Ao(e[i]),c=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(i!=a){var l=s[u];void 0===(c=r?r(l,u,s):void 0)&&(c=Xa(l)?l:uo(e[i+1])?[]:{})}Xn(s,u,c),s=s[u]}return t}var Wr=xn?function(t,e){return xn.set(t,e),t}:qs,Xr=be?function(t,e){return be(t,"toString",{configurable:!0,enumerable:!1,value:Xs(e),writable:!0})}:qs;function Yr(t){return Mo(Is(t))}function Hr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=r(o);++i<o;)a[i]=t[i+e];return a}function qr(t,e){var n;return nr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function Kr(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!Ja(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return Zr(t,e,qs,n)}function Zr(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,s=null===e,u=Ja(e),c=void 0===e;i<o;){var l=en((i+o)/2),f=n(t[l]),h=void 0!==f,d=null===f,p=f==f,g=Ja(f);if(a)var v=r||p;else v=c?p&&(r||h):s?p&&h&&(r||!d):u?p&&h&&!d&&(r||!g):!d&&!g&&(r?f<=e:f<e);v?i=l+1:o=l}return cn(o,4294967294)}function Qr(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Ia(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function $r(t){return"number"==typeof t?t:Ja(t)?NaN:+t}function Jr(t){if("string"==typeof t)return t;if(Da(t))return pe(t,Jr)+"";if(Ja(t))return Cn?Cn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ti(t,e,n){var r=-1,i=he,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=de;else if(o>=200){var c=e?null:Fi(t);if(c)return Xe(c);a=!1,i=Ne,u=new Bn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],f=e?e(l):l;if(l=n||0!==l?l:0,a&&f==f){for(var h=u.length;h--;)if(u[h]===f)continue t;e&&u.push(f),s.push(l)}else i(u,f,n)||(u!==s&&u.push(f),s.push(l))}return s}function ei(t,e){return null==(t=mo(t,e=ci(e,t)))||delete t[Ao(zo(e))]}function ni(t,e,n,r){return Vr(t,e,n(dr(t,e)),r)}function ri(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?Hr(t,r?0:o,r?o+1:i):Hr(t,r?o+1:0,r?i:o)}function ii(t,e){var n=t;return n instanceof Nn&&(n=n.value()),ve(e,(function(t,e){return e.func.apply(e.thisArg,ge([t],e.args))}),n)}function oi(t,e,n){var i=t.length;if(i<2)return i?ti(t[0]):[];for(var o=-1,a=r(i);++o<i;)for(var s=t[o],u=-1;++u<i;)u!=o&&(a[o]=er(a[o]||s,t[u],e,n));return ti(sr(a,1),e,n)}function ai(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var s=r<o?e[r]:void 0;n(a,t[r],s)}return a}function si(t){return Ba(t)?t:[]}function ui(t){return"function"==typeof t?t:qs}function ci(t,e){return Da(t)?t:lo(t,e)?[t]:ko(cs(t))}var li=Gr;function fi(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:Hr(t,e,n)}var hi=ke||function(t){return qt.clearTimeout(t)};function di(t,e){if(e)return t.slice();var n=t.length,r=Rt?Rt(n):new t.constructor(n);return t.copy(r),r}function pi(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function gi(t,e){var n=e?pi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function vi(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Ja(t),a=void 0!==e,s=null===e,u=e==e,c=Ja(e);if(!s&&!c&&!o&&t>e||o&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!i)return 1;if(!r&&!o&&!c&&t<e||c&&n&&i&&!r&&!o||s&&n&&i||!a&&i||!u)return-1}return 0}function yi(t,e,n,i){for(var o=-1,a=t.length,s=n.length,u=-1,c=e.length,l=un(a-s,0),f=r(c+l),h=!i;++u<c;)f[u]=e[u];for(;++o<s;)(h||o<a)&&(f[n[o]]=t[o]);for(;l--;)f[u++]=t[o++];return f}function mi(t,e,n,i){for(var o=-1,a=t.length,s=-1,u=n.length,c=-1,l=e.length,f=un(a-u,0),h=r(f+l),d=!i;++o<f;)h[o]=t[o];for(var p=o;++c<l;)h[p+c]=e[c];for(;++s<u;)(d||o<a)&&(h[p+n[s]]=t[o++]);return h}function bi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function xi(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var s=e[o],u=r?r(n[s],t[s],s,n,t):void 0;void 0===u&&(u=t[s]),i?Kn(n,s,u):Xn(n,s,u)}return n}function _i(t,e){return function(n,r){var i=Da(n)?se:Hn,o=e?e():{};return i(n,t,$i(r,2),o)}}function wi(t){return Gr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&co(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=gt(e);++r<i;){var s=n[r];s&&t(e,s,r,o)}return e}))}function Ei(t,e){return function(n,r){if(null==n)return n;if(!Ra(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=gt(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Si(t){return function(e,n,r){for(var i=-1,o=gt(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Oi(t){return function(e){var n=ze(e=cs(e))?qe(e):void 0,r=n?n[0]:e.charAt(0),i=n?fi(n,1).join(""):e.slice(1);return r[t]()+i}}function Mi(t){return function(e){return ve(Us(Ns(e).replace(Pt,"")),t,"")}}function ki(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=In(t.prototype),r=t.apply(n,e);return Xa(r)?r:n}}function Ai(t){return function(e,n,r){var i=gt(e);if(!Ra(e)){var o=$i(n,3);e=ws(e),n=function(t){return o(i[t],t,i)}}var a=t(e,n,r);return a>-1?i[o?e[a]:a]:void 0}}function Ci(t){return Yi((function(e){var n=e.length,r=n,i=Pn.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new mt(a);if(i&&!s&&"wrapper"==Zi(o))var s=new Pn([],!0)}for(r=s?r:n;++r<n;){var u=Zi(o=e[r]),c="wrapper"==u?Ki(o):void 0;s=c&&fo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Zi(c[0])].apply(s,c[3]):1==o.length&&fo(o)?s[u]():s.thru(o)}return function(){var t=arguments,r=t[0];if(s&&1==t.length&&Da(r))return s.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Ti(t,e,n,i,o,a,s,u,c,l){var f=128&e,h=1&e,d=2&e,p=24&e,g=512&e,v=d?void 0:ki(t);return function y(){for(var m=arguments.length,b=r(m),x=m;x--;)b[x]=arguments[x];if(p)var _=Qi(y),w=Re(b,_);if(i&&(b=yi(b,i,o,p)),a&&(b=mi(b,a,s,p)),m-=w,p&&m<l){var E=We(b,_);return Ri(t,e,Ti,y.placeholder,n,b,E,u,c,l-m)}var S=h?n:this,O=d?S[t]:t;return m=b.length,u?b=bo(b,u):g&&m>1&&b.reverse(),f&&c<m&&(b.length=c),this&&this!==qt&&this instanceof y&&(O=v||ki(O)),O.apply(S,b)}}function Ii(t,e){return function(n,r){return function(t,e,n,r){return lr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function ji(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Jr(n),r=Jr(r)):(n=$r(n),r=$r(r)),i=t(n,r)}return i}}function Pi(t){return Yi((function(e){return e=pe(e,je($i())),Gr((function(n){var r=this;return t(e,(function(t){return ae(t,r,n)}))}))}))}function Ni(t,e){var n=(e=void 0===e?" ":Jr(e)).length;if(n<2)return n?Fr(e,t):e;var r=Fr(e,tn(t/He(e)));return ze(e)?fi(qe(r),0,t).join(""):r.slice(0,t)}function Di(t){return function(e,n,i){return i&&"number"!=typeof i&&co(e,n,i)&&(n=i=void 0),e=is(e),void 0===n?(n=e,e=0):n=is(n),function(t,e,n,i){for(var o=-1,a=un(tn((e-t)/(n||1)),0),s=r(a);a--;)s[i?a:++o]=t,t+=n;return s}(e,n,i=void 0===i?e<n?1:-1:is(i),t)}}function Li(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ss(e),n=ss(n)),t(e,n)}}function Ri(t,e,n,r,i,o,a,s,u,c){var l=8&e;e|=l?32:64,4&(e&=~(l?64:32))||(e&=-4);var f=[t,e,i,l?o:void 0,l?a:void 0,l?void 0:o,l?void 0:a,s,u,c],h=n.apply(void 0,f);return fo(t)&&_o(h,f),h.placeholder=r,So(h,t,e)}function Bi(t){var e=pt[t];return function(t,n){if(t=ss(t),(n=null==n?0:cn(os(n),292))&&on(t)){var r=(cs(t)+"e").split("e");return+((r=(cs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Fi=yn&&1/Xe(new yn([,-0]))[1]==1/0?function(t){return new yn(t)}:Js;function Gi(t){return function(e){var n=io(e);return n==v?Ue(e):n==x?Ye(e):function(t,e){return pe(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function zi(t,e,n,i,o,u,c,l){var f=2&e;if(!f&&"function"!=typeof t)throw new mt(a);var h=i?i.length:0;if(h||(e&=-97,i=o=void 0),c=void 0===c?c:un(os(c),0),l=void 0===l?l:os(l),h-=o?o.length:0,64&e){var d=i,p=o;i=o=void 0}var g=f?void 0:Ki(t),v=[t,e,n,i,o,d,p,u,c,l];if(g&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,a=128==r&&8==n||128==r&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?yi(c,u,e[4]):u,t[4]=c?We(t[3],s):e[4]}(u=e[5])&&(c=t[5],t[5]=c?mi(c,u,e[6]):u,t[6]=c?We(t[5],s):e[6]);(u=e[7])&&(t[7]=u);128&r&&(t[8]=null==t[8]?e[8]:cn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(v,g),t=v[0],e=v[1],n=v[2],i=v[3],o=v[4],!(l=v[9]=void 0===v[9]?f?0:t.length:un(v[9]-h,0))&&24&e&&(e&=-25),e&&1!=e)y=8==e||16==e?function(t,e,n){var i=ki(t);return function o(){for(var a=arguments.length,s=r(a),u=a,c=Qi(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:We(s,c);if((a-=l.length)<n)return Ri(t,e,Ti,o.placeholder,void 0,s,l,void 0,void 0,n-a);var f=this&&this!==qt&&this instanceof o?i:t;return ae(f,this,s)}}(t,e,l):32!=e&&33!=e||o.length?Ti.apply(void 0,v):function(t,e,n,i){var o=1&e,a=ki(t);return function e(){for(var s=-1,u=arguments.length,c=-1,l=i.length,f=r(l+u),h=this&&this!==qt&&this instanceof e?a:t;++c<l;)f[c]=i[c];for(;u--;)f[c++]=arguments[++s];return ae(h,o?n:this,f)}}(t,e,n,i);else var y=function(t,e,n){var r=1&e,i=ki(t);return function e(){var o=this&&this!==qt&&this instanceof e?i:t;return o.apply(r?n:this,arguments)}}(t,e,n);return So((g?Wr:_o)(y,v),t,e)}function Ui(t,e,n,r){return void 0===t||Ia(t,_t[n])&&!St.call(r,n)?e:t}function Vi(t,e,n,r,i,o){return Xa(t)&&Xa(e)&&(o.set(e,t),jr(t,e,void 0,Vi,o),o.delete(e)),t}function Wi(t){return Ka(t)?void 0:t}function Xi(t,e,n,r,i,o){var a=1&n,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=o.get(t),l=o.get(e);if(c&&l)return c==e&&l==t;var f=-1,h=!0,d=2&n?new Bn:void 0;for(o.set(t,e),o.set(e,t);++f<s;){var p=t[f],g=e[f];if(r)var v=a?r(g,p,f,e,t,o):r(p,g,f,t,e,o);if(void 0!==v){if(v)continue;h=!1;break}if(d){if(!me(e,(function(t,e){if(!Ne(d,e)&&(p===t||i(p,t,n,r,o)))return d.push(e)}))){h=!1;break}}else if(p!==g&&!i(p,g,n,r,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function Yi(t){return Eo(yo(t,void 0,Lo),t+"")}function Hi(t){return pr(t,ws,no)}function qi(t){return pr(t,Es,ro)}var Ki=xn?function(t){return xn.get(t)}:Js;function Zi(t){for(var e=t.name+"",n=_n[e],r=St.call(_n,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Qi(t){return(St.call(Tn,"placeholder")?Tn:t).placeholder}function $i(){var t=Tn.iteratee||Ks;return t=t===Ks?Or:t,arguments.length?t(arguments[0],arguments[1]):t}function Ji(t,e){var n,r,i=t.__data__;return("string"==(r=o(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function to(t){for(var e=ws(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,go(i)]}return e}function eo(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Sr(n)?n:void 0}var no=nn?function(t){return null==t?[]:(t=gt(t),fe(nn(t),(function(e){return Ht.call(t,e)})))}:au,ro=nn?function(t){for(var e=[];t;)ge(e,no(t)),t=Vt(t);return e}:au,io=gr;function oo(t,e,n){for(var r=-1,i=(e=ci(e,t)).length,o=!1;++r<i;){var a=Ao(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Wa(i)&&uo(a,i)&&(Da(t)||Na(t))}function ao(t){return"function"!=typeof t.constructor||po(t)?{}:In(Vt(t))}function so(t){return Da(t)||Na(t)||!!(Zt&&t&&t[Zt])}function uo(t,e){var n=o(t);return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ct.test(t))&&t>-1&&t%1==0&&t<e}function co(t,e,n){if(!Xa(n))return!1;var r=o(e);return!!("number"==r?Ra(n)&&uo(e,n.length):"string"==r&&e in n)&&Ia(n[e],t)}function lo(t,e){if(Da(t))return!1;var n=o(t);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ja(t))||(X.test(t)||!W.test(t)||null!=e&&t in gt(e))}function fo(t){var e=Zi(t),n=Tn[e];if("function"!=typeof n||!(e in Nn.prototype))return!1;if(t===n)return!0;var r=Ki(n);return!!r&&t===r[0]}(pn&&io(new pn(new ArrayBuffer(1)))!=O||gn&&io(new gn)!=v||vn&&"[object Promise]"!=io(vn.resolve())||yn&&io(new yn)!=x||mn&&io(new mn)!=E)&&(io=function(t){var e=gr(t),n=e==m?t.constructor:void 0,r=n?Co(n):"";if(r)switch(r){case wn:return O;case En:return v;case Sn:return"[object Promise]";case On:return x;case Mn:return E}return e});var ho=wt?Ua:su;function po(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function go(t){return t==t&&!Xa(t)}function vo(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in gt(n)))}}function yo(t,e,n){return e=un(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,a=un(i.length-e,0),s=r(a);++o<a;)s[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(s),ae(t,this,u)}}function mo(t,e){return e.length<2?t:dr(t,Hr(e,0,-1))}function bo(t,e){for(var n=t.length,r=cn(e.length,n),i=bi(t);r--;){var o=e[r];t[r]=uo(o,n)?i[o]:void 0}return t}function xo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var _o=Oo(Wr),wo=Je||function(t,e){return qt.setTimeout(t,e)},Eo=Oo(Xr);function So(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Q,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ue(u,(function(n){var r="_."+n[0];e&n[1]&&!he(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match($);return e?e[1].split(J):[]}(r),n)))}function Oo(t){var e=0,n=0;return function(){var r=ln(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Mo(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=Br(n,i),a=t[o];t[o]=t[n],t[n]=a}return t.length=e,t}var ko=function(t){var e=Oa(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Y,(function(t,n,r,i){e.push(r?i.replace(nt,"$1"):n||t)})),e}));function Ao(t){if("string"==typeof t||Ja(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Co(t){if(null!=t){try{return Et.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function To(t){if(t instanceof Nn)return t.clone();var e=new Pn(t.__wrapped__,t.__chain__);return e.__actions__=bi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Io=Gr((function(t,e){return Ba(t)?er(t,sr(e,1,Ba,!0)):[]})),jo=Gr((function(t,e){var n=zo(e);return Ba(n)&&(n=void 0),Ba(t)?er(t,sr(e,1,Ba,!0),$i(n,2)):[]})),Po=Gr((function(t,e){var n=zo(e);return Ba(n)&&(n=void 0),Ba(t)?er(t,sr(e,1,Ba,!0),void 0,n):[]}));function No(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:os(n);return i<0&&(i=un(r+i,0)),_e(t,$i(e,3),i)}function Do(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=os(n),i=n<0?un(r+i,0):cn(i,r-1)),_e(t,$i(e,3),i,!0)}function Lo(t){return(null==t?0:t.length)?sr(t,1):[]}function Ro(t){return t&&t.length?t[0]:void 0}var Bo=Gr((function(t){var e=pe(t,si);return e.length&&e[0]===t[0]?br(e):[]})),Fo=Gr((function(t){var e=zo(t),n=pe(t,si);return e===zo(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?br(n,$i(e,2)):[]})),Go=Gr((function(t){var e=zo(t),n=pe(t,si);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?br(n,void 0,e):[]}));function zo(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Uo=Gr(Vo);function Vo(t,e){return t&&t.length&&e&&e.length?Lr(t,e):t}var Wo=Yi((function(t,e){var n=null==t?0:t.length,r=Zn(t,e);return Rr(t,pe(e,(function(t){return uo(t,n)?+t:t})).sort(vi)),r}));function Xo(t){return null==t?t:dn.call(t)}var Yo=Gr((function(t){return ti(sr(t,1,Ba,!0))})),Ho=Gr((function(t){var e=zo(t);return Ba(e)&&(e=void 0),ti(sr(t,1,Ba,!0),$i(e,2))})),qo=Gr((function(t){var e=zo(t);return e="function"==typeof e?e:void 0,ti(sr(t,1,Ba,!0),void 0,e)}));function Ko(t){if(!t||!t.length)return[];var e=0;return t=fe(t,(function(t){if(Ba(t))return e=un(t.length,e),!0})),Te(e,(function(e){return pe(t,Me(e))}))}function Zo(t,e){if(!t||!t.length)return[];var n=Ko(t);return null==e?n:pe(n,(function(t){return ae(e,void 0,t)}))}var Qo=Gr((function(t,e){return Ba(t)?er(t,e):[]})),$o=Gr((function(t){return oi(fe(t,Ba))})),Jo=Gr((function(t){var e=zo(t);return Ba(e)&&(e=void 0),oi(fe(t,Ba),$i(e,2))})),ta=Gr((function(t){var e=zo(t);return e="function"==typeof e?e:void 0,oi(fe(t,Ba),void 0,e)})),ea=Gr(Ko);var na=Gr((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Zo(t,n)}));function ra(t){var e=Tn(t);return e.__chain__=!0,e}function ia(t,e){return e(t)}var oa=Yi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Zn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Nn&&uo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:ia,args:[i],thisArg:void 0}),new Pn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));var aa=_i((function(t,e,n){St.call(t,n)?++t[n]:Kn(t,n,1)}));var sa=Ai(No),ua=Ai(Do);function ca(t,e){return(Da(t)?ue:nr)(t,$i(e,3))}function la(t,e){return(Da(t)?ce:rr)(t,$i(e,3))}var fa=_i((function(t,e,n){St.call(t,n)?t[n].push(e):Kn(t,n,[e])}));var ha=Gr((function(t,e,n){var i=-1,o="function"==typeof e,a=Ra(t)?r(t.length):[];return nr(t,(function(t){a[++i]=o?ae(e,t,n):xr(t,e,n)})),a})),da=_i((function(t,e,n){Kn(t,n,e)}));function pa(t,e){return(Da(t)?pe:Cr)(t,$i(e,3))}var ga=_i((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var va=Gr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&co(t,e[0],e[1])?e=[]:n>2&&co(e[0],e[1],e[2])&&(e=[e[0]]),Nr(t,sr(e,1),[])})),ya=$e||function(){return qt.Date.now()};function ma(t,e,n){return e=n?void 0:e,zi(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ba(t,e){var n;if("function"!=typeof e)throw new mt(a);return t=os(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var xa=Gr((function(t,e,n){var r=1;if(n.length){var i=We(n,Qi(xa));r|=32}return zi(t,r,e,n,i)})),_a=Gr((function(t,e,n){var r=3;if(n.length){var i=We(n,Qi(_a));r|=32}return zi(e,r,t,n,i)}));function wa(t,e,n){var r,i,o,s,u,c,l=0,f=!1,h=!1,d=!0;if("function"!=typeof t)throw new mt(a);function p(e){var n=r,o=i;return r=i=void 0,l=e,s=t.apply(o,n)}function g(t){return l=t,u=wo(y,e),f?p(t):s}function v(t){var n=t-c;return void 0===c||n>=e||n<0||h&&t-l>=o}function y(){var t=ya();if(v(t))return m(t);u=wo(y,function(t){var n=e-(t-c);return h?cn(n,o-(t-l)):n}(t))}function m(t){return u=void 0,d&&r?p(t):(r=i=void 0,s)}function b(){var t=ya(),n=v(t);if(r=arguments,i=this,c=t,n){if(void 0===u)return g(c);if(h)return hi(u),u=wo(y,e),p(c)}return void 0===u&&(u=wo(y,e)),s}return e=ss(e)||0,Xa(n)&&(f=!!n.leading,o=(h="maxWait"in n)?un(ss(n.maxWait)||0,e):o,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==u&&hi(u),l=0,r=c=i=u=void 0},b.flush=function(){return void 0===u?s:m(ya())},b}var Ea=Gr((function(t,e){return tr(t,1,e)})),Sa=Gr((function(t,e,n){return tr(t,ss(e)||0,n)}));function Oa(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new mt(a);var n=function n(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Oa.Cache||Rn),n}function Ma(t){if("function"!=typeof t)throw new mt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Oa.Cache=Rn;var ka=li((function(t,e){var n=(e=1==e.length&&Da(e[0])?pe(e[0],je($i())):pe(sr(e,1),je($i()))).length;return Gr((function(r){for(var i=-1,o=cn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return ae(t,this,r)}))})),Aa=Gr((function(t,e){return zi(t,32,void 0,e,We(e,Qi(Aa)))})),Ca=Gr((function(t,e){return zi(t,64,void 0,e,We(e,Qi(Ca)))})),Ta=Yi((function(t,e){return zi(t,256,void 0,void 0,void 0,e)}));function Ia(t,e){return t===e||t!=t&&e!=e}var ja=Li(vr),Pa=Li((function(t,e){return t>=e})),Na=_r(function(){return arguments}())?_r:function(t){return Ya(t)&&St.call(t,"callee")&&!Ht.call(t,"callee")},Da=r.isArray,La=te?je(te):function(t){return Ya(t)&&gr(t)==S};function Ra(t){return null!=t&&Wa(t.length)&&!Ua(t)}function Ba(t){return Ya(t)&&Ra(t)}var Fa=rn||su,Ga=ee?je(ee):function(t){return Ya(t)&&gr(t)==h};function za(t){if(!Ya(t))return!1;var e=gr(t);return e==d||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ka(t)}function Ua(t){if(!Xa(t))return!1;var e=gr(t);return e==p||e==g||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Va(t){return"number"==typeof t&&t==os(t)}function Wa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Xa(t){var e=o(t);return null!=t&&("object"==e||"function"==e)}function Ya(t){return null!=t&&"object"==o(t)}var Ha=ne?je(ne):function(t){return Ya(t)&&io(t)==v};function qa(t){return"number"==typeof t||Ya(t)&&gr(t)==y}function Ka(t){if(!Ya(t)||gr(t)!=m)return!1;var e=Vt(t);if(null===e)return!0;var n=St.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Et.call(n)==At}var Za=re?je(re):function(t){return Ya(t)&&gr(t)==b};var Qa=ie?je(ie):function(t){return Ya(t)&&io(t)==x};function $a(t){return"string"==typeof t||!Da(t)&&Ya(t)&&gr(t)==_}function Ja(t){return"symbol"==o(t)||Ya(t)&&gr(t)==w}var ts=oe?je(oe):function(t){return Ya(t)&&Wa(t.length)&&!!zt[gr(t)]};var es=Li(Ar),ns=Li((function(t,e){return t<=e}));function rs(t){if(!t)return[];if(Ra(t))return $a(t)?qe(t):bi(t);if($t&&t[$t])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[$t]());var e=io(t);return(e==v?Ue:e==x?Xe:Is)(t)}function is(t){return t?(t=ss(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function os(t){var e=is(t),n=e%1;return e==e?n?e-n:e:0}function as(t){return t?Qn(os(t),0,4294967295):0}function ss(t){if("number"==typeof t)return t;if(Ja(t))return NaN;if(Xa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Xa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ie(t);var n=at.test(t);return n||ut.test(t)?Xt(t.slice(2),n?2:8):ot.test(t)?NaN:+t}function us(t){return xi(t,Es(t))}function cs(t){return null==t?"":Jr(t)}var ls=wi((function(t,e){if(po(e)||Ra(e))xi(e,ws(e),t);else for(var n in e)St.call(e,n)&&Xn(t,n,e[n])})),fs=wi((function(t,e){xi(e,Es(e),t)})),hs=wi((function(t,e,n,r){xi(e,Es(e),t,r)})),ds=wi((function(t,e,n,r){xi(e,ws(e),t,r)})),ps=Yi(Zn);var gs=Gr((function(t,e){t=gt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&co(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=Es(o),s=-1,u=a.length;++s<u;){var c=a[s],l=t[c];(void 0===l||Ia(l,_t[c])&&!St.call(t,c))&&(t[c]=o[c])}return t})),vs=Gr((function(t){return t.push(void 0,Vi),ae(Os,void 0,t)}));function ys(t,e,n){var r=null==t?void 0:dr(t,e);return void 0===r?n:r}function ms(t,e){return null!=t&&oo(t,e,mr)}var bs=Ii((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=kt.call(e)),t[e]=n}),Xs(qs)),xs=Ii((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=kt.call(e)),St.call(t,e)?t[e].push(n):t[e]=[n]}),$i),_s=Gr(xr);function ws(t){return Ra(t)?Gn(t):Mr(t)}function Es(t){return Ra(t)?Gn(t,!0):kr(t)}var Ss=wi((function(t,e,n){jr(t,e,n)})),Os=wi((function(t,e,n,r){jr(t,e,n,r)})),Ms=Yi((function(t,e){var n={};if(null==t)return n;var r=!1;e=pe(e,(function(e){return e=ci(e,t),r||(r=e.length>1),e})),xi(t,qi(t),n),r&&(n=$n(n,7,Wi));for(var i=e.length;i--;)ei(n,e[i]);return n}));var ks=Yi((function(t,e){return null==t?{}:function(t,e){return Dr(t,e,(function(e,n){return ms(t,n)}))}(t,e)}));function As(t,e){if(null==t)return{};var n=pe(qi(t),(function(t){return[t]}));return e=$i(e),Dr(t,n,(function(t,n){return e(t,n[0])}))}var Cs=Gi(ws),Ts=Gi(Es);function Is(t){return null==t?[]:Pe(t,ws(t))}var js=Mi((function(t,e,n){return e=e.toLowerCase(),t+(n?Ps(e):e)}));function Ps(t){return zs(cs(t).toLowerCase())}function Ns(t){return(t=cs(t))&&t.replace(lt,Be).replace(Nt,"")}var Ds=Mi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ls=Mi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Rs=Oi("toLowerCase");var Bs=Mi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Fs=Mi((function(t,e,n){return t+(n?" ":"")+zs(e)}));var Gs=Mi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),zs=Oi("toUpperCase");function Us(t,e,n){return t=cs(t),void 0===(e=n?void 0:e)?function(t){return Bt.test(t)}(t)?function(t){return t.match(Lt)||[]}(t):function(t){return t.match(tt)||[]}(t):t.match(e)||[]}var Vs=Gr((function(t,e){try{return ae(t,void 0,e)}catch(t){return za(t)?t:new Z(t)}})),Ws=Yi((function(t,e){return ue(e,(function(e){e=Ao(e),Kn(t,e,xa(t[e],t))})),t}));function Xs(t){return function(){return t}}var Ys=Ci(),Hs=Ci(!0);function qs(t){return t}function Ks(t){return Or("function"==typeof t?t:$n(t,1))}var Zs=Gr((function(t,e){return function(n){return xr(n,t,e)}})),Qs=Gr((function(t,e){return function(n){return xr(t,n,e)}}));function $s(t,e,n){var r=ws(e),i=hr(e,r);null!=n||Xa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=hr(e,ws(e)));var o=!(Xa(n)&&"chain"in n&&!n.chain),a=Ua(t);return ue(i,(function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=bi(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,ge([this.value()],arguments))})})),t}function Js(){}var tu=Pi(pe),eu=Pi(le),nu=Pi(me);function ru(t){return lo(t)?Me(Ao(t)):function(t){return function(e){return dr(e,t)}}(t)}var iu=Di(),ou=Di(!0);function au(){return[]}function su(){return!1}var uu=ji((function(t,e){return t+e}),0),cu=Bi("ceil"),lu=ji((function(t,e){return t/e}),1),fu=Bi("floor");var hu,du=ji((function(t,e){return t*e}),1),pu=Bi("round"),gu=ji((function(t,e){return t-e}),0);return Tn.after=function(t,e){if("function"!=typeof e)throw new mt(a);return t=os(t),function(){if(--t<1)return e.apply(this,arguments)}},Tn.ary=ma,Tn.assign=ls,Tn.assignIn=fs,Tn.assignInWith=hs,Tn.assignWith=ds,Tn.at=ps,Tn.before=ba,Tn.bind=xa,Tn.bindAll=Ws,Tn.bindKey=_a,Tn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Da(t)?t:[t]},Tn.chain=ra,Tn.chunk=function(t,e,n){e=(n?co(t,e,n):void 0===e)?1:un(os(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=r(tn(i/e));o<i;)s[a++]=Hr(t,o,o+=e);return s},Tn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Tn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return ge(Da(n)?bi(n):[n],sr(e,1))},Tn.cond=function(t){var e=null==t?0:t.length,n=$i();return t=e?pe(t,(function(t){if("function"!=typeof t[1])throw new mt(a);return[n(t[0]),t[1]]})):[],Gr((function(n){for(var r=-1;++r<e;){var i=t[r];if(ae(i[0],this,n))return ae(i[1],this,n)}}))},Tn.conforms=function(t){return function(t){var e=ws(t);return function(n){return Jn(n,t,e)}}($n(t,1))},Tn.constant=Xs,Tn.countBy=aa,Tn.create=function(t,e){var n=In(t);return null==e?n:qn(n,e)},Tn.curry=function t(e,n,r){var i=zi(e,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Tn.curryRight=function t(e,n,r){var i=zi(e,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Tn.debounce=wa,Tn.defaults=gs,Tn.defaultsDeep=vs,Tn.defer=Ea,Tn.delay=Sa,Tn.difference=Io,Tn.differenceBy=jo,Tn.differenceWith=Po,Tn.drop=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,(e=n||void 0===e?1:os(e))<0?0:e,r):[]},Tn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,0,(e=r-(e=n||void 0===e?1:os(e)))<0?0:e):[]},Tn.dropRightWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!0,!0):[]},Tn.dropWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!0):[]},Tn.fill=function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&co(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=os(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:os(r))<0&&(r+=i),r=n>r?0:as(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Tn.filter=function(t,e){return(Da(t)?fe:ar)(t,$i(e,3))},Tn.flatMap=function(t,e){return sr(pa(t,e),1)},Tn.flatMapDeep=function(t,e){return sr(pa(t,e),1/0)},Tn.flatMapDepth=function(t,e,n){return n=void 0===n?1:os(n),sr(pa(t,e),n)},Tn.flatten=Lo,Tn.flattenDeep=function(t){return(null==t?0:t.length)?sr(t,1/0):[]},Tn.flattenDepth=function(t,e){return(null==t?0:t.length)?sr(t,e=void 0===e?1:os(e)):[]},Tn.flip=function(t){return zi(t,512)},Tn.flow=Ys,Tn.flowRight=Hs,Tn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Tn.functions=function(t){return null==t?[]:hr(t,ws(t))},Tn.functionsIn=function(t){return null==t?[]:hr(t,Es(t))},Tn.groupBy=fa,Tn.initial=function(t){return(null==t?0:t.length)?Hr(t,0,-1):[]},Tn.intersection=Bo,Tn.intersectionBy=Fo,Tn.intersectionWith=Go,Tn.invert=bs,Tn.invertBy=xs,Tn.invokeMap=ha,Tn.iteratee=Ks,Tn.keyBy=da,Tn.keys=ws,Tn.keysIn=Es,Tn.map=pa,Tn.mapKeys=function(t,e){var n={};return e=$i(e,3),lr(t,(function(t,r,i){Kn(n,e(t,r,i),t)})),n},Tn.mapValues=function(t,e){var n={};return e=$i(e,3),lr(t,(function(t,r,i){Kn(n,r,e(t,r,i))})),n},Tn.matches=function(t){return Tr($n(t,1))},Tn.matchesProperty=function(t,e){return Ir(t,$n(e,1))},Tn.memoize=Oa,Tn.merge=Ss,Tn.mergeWith=Os,Tn.method=Zs,Tn.methodOf=Qs,Tn.mixin=$s,Tn.negate=Ma,Tn.nthArg=function(t){return t=os(t),Gr((function(e){return Pr(e,t)}))},Tn.omit=Ms,Tn.omitBy=function(t,e){return As(t,Ma($i(e)))},Tn.once=function(t){return ba(2,t)},Tn.orderBy=function(t,e,n,r){return null==t?[]:(Da(e)||(e=null==e?[]:[e]),Da(n=r?void 0:n)||(n=null==n?[]:[n]),Nr(t,e,n))},Tn.over=tu,Tn.overArgs=ka,Tn.overEvery=eu,Tn.overSome=nu,Tn.partial=Aa,Tn.partialRight=Ca,Tn.partition=ga,Tn.pick=ks,Tn.pickBy=As,Tn.property=ru,Tn.propertyOf=function(t){return function(e){return null==t?void 0:dr(t,e)}},Tn.pull=Uo,Tn.pullAll=Vo,Tn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Lr(t,e,$i(n,2)):t},Tn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Lr(t,e,void 0,n):t},Tn.pullAt=Wo,Tn.range=iu,Tn.rangeRight=ou,Tn.rearg=Ta,Tn.reject=function(t,e){return(Da(t)?fe:ar)(t,Ma($i(e,3)))},Tn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=$i(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return Rr(t,i),n},Tn.rest=function(t,e){if("function"!=typeof t)throw new mt(a);return Gr(t,e=void 0===e?e:os(e))},Tn.reverse=Xo,Tn.sampleSize=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:os(e),(Da(t)?Un:Ur)(t,e)},Tn.set=function(t,e,n){return null==t?t:Vr(t,e,n)},Tn.setWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Vr(t,e,n,r)},Tn.shuffle=function(t){return(Da(t)?Vn:Yr)(t)},Tn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&co(t,e,n)?(e=0,n=r):(e=null==e?0:os(e),n=void 0===n?r:os(n)),Hr(t,e,n)):[]},Tn.sortBy=va,Tn.sortedUniq=function(t){return t&&t.length?Qr(t):[]},Tn.sortedUniqBy=function(t,e){return t&&t.length?Qr(t,$i(e,2)):[]},Tn.split=function(t,e,n){return n&&"number"!=typeof n&&co(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=cs(t))&&("string"==typeof e||null!=e&&!Za(e))&&!(e=Jr(e))&&ze(t)?fi(qe(t),0,n):t.split(e,n):[]},Tn.spread=function(t,e){if("function"!=typeof t)throw new mt(a);return e=null==e?0:un(os(e),0),Gr((function(n){var r=n[e],i=fi(n,0,e);return r&&ge(i,r),ae(t,this,i)}))},Tn.tail=function(t){var e=null==t?0:t.length;return e?Hr(t,1,e):[]},Tn.take=function(t,e,n){return t&&t.length?Hr(t,0,(e=n||void 0===e?1:os(e))<0?0:e):[]},Tn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,(e=r-(e=n||void 0===e?1:os(e)))<0?0:e,r):[]},Tn.takeRightWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!1,!0):[]},Tn.takeWhile=function(t,e){return t&&t.length?ri(t,$i(e,3)):[]},Tn.tap=function(t,e){return e(t),t},Tn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new mt(a);return Xa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),wa(t,e,{leading:r,maxWait:e,trailing:i})},Tn.thru=ia,Tn.toArray=rs,Tn.toPairs=Cs,Tn.toPairsIn=Ts,Tn.toPath=function(t){return Da(t)?pe(t,Ao):Ja(t)?[t]:bi(ko(cs(t)))},Tn.toPlainObject=us,Tn.transform=function(t,e,n){var r=Da(t),i=r||Fa(t)||ts(t);if(e=$i(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Xa(t)&&Ua(o)?In(Vt(t)):{}}return(i?ue:lr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Tn.unary=function(t){return ma(t,1)},Tn.union=Yo,Tn.unionBy=Ho,Tn.unionWith=qo,Tn.uniq=function(t){return t&&t.length?ti(t):[]},Tn.uniqBy=function(t,e){return t&&t.length?ti(t,$i(e,2)):[]},Tn.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?ti(t,void 0,e):[]},Tn.unset=function(t,e){return null==t||ei(t,e)},Tn.unzip=Ko,Tn.unzipWith=Zo,Tn.update=function(t,e,n){return null==t?t:ni(t,e,ui(n))},Tn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ni(t,e,ui(n),r)},Tn.values=Is,Tn.valuesIn=function(t){return null==t?[]:Pe(t,Es(t))},Tn.without=Qo,Tn.words=Us,Tn.wrap=function(t,e){return Aa(ui(e),t)},Tn.xor=$o,Tn.xorBy=Jo,Tn.xorWith=ta,Tn.zip=ea,Tn.zipObject=function(t,e){return ai(t||[],e||[],Xn)},Tn.zipObjectDeep=function(t,e){return ai(t||[],e||[],Vr)},Tn.zipWith=na,Tn.entries=Cs,Tn.entriesIn=Ts,Tn.extend=fs,Tn.extendWith=hs,$s(Tn,Tn),Tn.add=uu,Tn.attempt=Vs,Tn.camelCase=js,Tn.capitalize=Ps,Tn.ceil=cu,Tn.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=ss(n))==n?n:0),void 0!==e&&(e=(e=ss(e))==e?e:0),Qn(ss(t),e,n)},Tn.clone=function(t){return $n(t,4)},Tn.cloneDeep=function(t){return $n(t,5)},Tn.cloneDeepWith=function(t,e){return $n(t,5,e="function"==typeof e?e:void 0)},Tn.cloneWith=function(t,e){return $n(t,4,e="function"==typeof e?e:void 0)},Tn.conformsTo=function(t,e){return null==e||Jn(t,e,ws(e))},Tn.deburr=Ns,Tn.defaultTo=function(t,e){return null==t||t!=t?e:t},Tn.divide=lu,Tn.endsWith=function(t,e,n){t=cs(t),e=Jr(e);var r=t.length,i=n=void 0===n?r:Qn(os(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},Tn.eq=Ia,Tn.escape=function(t){return(t=cs(t))&&G.test(t)?t.replace(B,Fe):t},Tn.escapeRegExp=function(t){return(t=cs(t))&&q.test(t)?t.replace(H,"\\$&"):t},Tn.every=function(t,e,n){var r=Da(t)?le:ir;return n&&co(t,e,n)&&(e=void 0),r(t,$i(e,3))},Tn.find=sa,Tn.findIndex=No,Tn.findKey=function(t,e){return xe(t,$i(e,3),lr)},Tn.findLast=ua,Tn.findLastIndex=Do,Tn.findLastKey=function(t,e){return xe(t,$i(e,3),fr)},Tn.floor=fu,Tn.forEach=ca,Tn.forEachRight=la,Tn.forIn=function(t,e){return null==t?t:ur(t,$i(e,3),Es)},Tn.forInRight=function(t,e){return null==t?t:cr(t,$i(e,3),Es)},Tn.forOwn=function(t,e){return t&&lr(t,$i(e,3))},Tn.forOwnRight=function(t,e){return t&&fr(t,$i(e,3))},Tn.get=ys,Tn.gt=ja,Tn.gte=Pa,Tn.has=function(t,e){return null!=t&&oo(t,e,yr)},Tn.hasIn=ms,Tn.head=Ro,Tn.identity=qs,Tn.includes=function(t,e,n,r){t=Ra(t)?t:Is(t),n=n&&!r?os(n):0;var i=t.length;return n<0&&(n=un(i+n,0)),$a(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&we(t,e,n)>-1},Tn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:os(n);return i<0&&(i=un(r+i,0)),we(t,e,i)},Tn.inRange=function(t,e,n){return e=is(e),void 0===n?(n=e,e=0):n=is(n),function(t,e,n){return t>=cn(e,n)&&t<un(e,n)}(t=ss(t),e,n)},Tn.invoke=_s,Tn.isArguments=Na,Tn.isArray=Da,Tn.isArrayBuffer=La,Tn.isArrayLike=Ra,Tn.isArrayLikeObject=Ba,Tn.isBoolean=function(t){return!0===t||!1===t||Ya(t)&&gr(t)==f},Tn.isBuffer=Fa,Tn.isDate=Ga,Tn.isElement=function(t){return Ya(t)&&1===t.nodeType&&!Ka(t)},Tn.isEmpty=function(t){if(null==t)return!0;if(Ra(t)&&(Da(t)||"string"==typeof t||"function"==typeof t.splice||Fa(t)||ts(t)||Na(t)))return!t.length;var e=io(t);if(e==v||e==x)return!t.size;if(po(t))return!Mr(t).length;for(var n in t)if(St.call(t,n))return!1;return!0},Tn.isEqual=function(t,e){return wr(t,e)},Tn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?wr(t,e,void 0,n):!!r},Tn.isError=za,Tn.isFinite=function(t){return"number"==typeof t&&on(t)},Tn.isFunction=Ua,Tn.isInteger=Va,Tn.isLength=Wa,Tn.isMap=Ha,Tn.isMatch=function(t,e){return t===e||Er(t,e,to(e))},Tn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:void 0,Er(t,e,to(e),n)},Tn.isNaN=function(t){return qa(t)&&t!=+t},Tn.isNative=function(t){if(ho(t))throw new Z("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Sr(t)},Tn.isNil=function(t){return null==t},Tn.isNull=function(t){return null===t},Tn.isNumber=qa,Tn.isObject=Xa,Tn.isObjectLike=Ya,Tn.isPlainObject=Ka,Tn.isRegExp=Za,Tn.isSafeInteger=function(t){return Va(t)&&t>=-9007199254740991&&t<=9007199254740991},Tn.isSet=Qa,Tn.isString=$a,Tn.isSymbol=Ja,Tn.isTypedArray=ts,Tn.isUndefined=function(t){return void 0===t},Tn.isWeakMap=function(t){return Ya(t)&&io(t)==E},Tn.isWeakSet=function(t){return Ya(t)&&"[object WeakSet]"==gr(t)},Tn.join=function(t,e){return null==t?"":an.call(t,e)},Tn.kebabCase=Ds,Tn.last=zo,Tn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=os(n))<0?un(r+i,0):cn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,Se,i,!0)},Tn.lowerCase=Ls,Tn.lowerFirst=Rs,Tn.lt=es,Tn.lte=ns,Tn.max=function(t){return t&&t.length?or(t,qs,vr):void 0},Tn.maxBy=function(t,e){return t&&t.length?or(t,$i(e,2),vr):void 0},Tn.mean=function(t){return Oe(t,qs)},Tn.meanBy=function(t,e){return Oe(t,$i(e,2))},Tn.min=function(t){return t&&t.length?or(t,qs,Ar):void 0},Tn.minBy=function(t,e){return t&&t.length?or(t,$i(e,2),Ar):void 0},Tn.stubArray=au,Tn.stubFalse=su,Tn.stubObject=function(){return{}},Tn.stubString=function(){return""},Tn.stubTrue=function(){return!0},Tn.multiply=du,Tn.nth=function(t,e){return t&&t.length?Pr(t,os(e)):void 0},Tn.noConflict=function(){return qt._===this&&(qt._=Ct),this},Tn.noop=Js,Tn.now=ya,Tn.pad=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Ni(en(i),n)+t+Ni(tn(i),n)},Tn.padEnd=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;return e&&r<e?t+Ni(e-r,n):t},Tn.padStart=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;return e&&r<e?Ni(e-r,n)+t:t},Tn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),fn(cs(t).replace(K,""),e||0)},Tn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&co(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=is(t),void 0===e?(e=t,t=0):e=is(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=hn();return cn(t+i*(e-t+Wt("1e-"+((i+"").length-1))),e)}return Br(t,e)},Tn.reduce=function(t,e,n){var r=Da(t)?ve:Ae,i=arguments.length<3;return r(t,$i(e,4),n,i,nr)},Tn.reduceRight=function(t,e,n){var r=Da(t)?ye:Ae,i=arguments.length<3;return r(t,$i(e,4),n,i,rr)},Tn.repeat=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:os(e),Fr(cs(t),e)},Tn.replace=function(){var t=arguments,e=cs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Tn.result=function(t,e,n){var r=-1,i=(e=ci(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[Ao(e[r])];void 0===o&&(r=i,o=n),t=Ua(o)?o.call(t):o}return t},Tn.round=pu,Tn.runInContext=t,Tn.sample=function(t){return(Da(t)?zn:zr)(t)},Tn.size=function(t){if(null==t)return 0;if(Ra(t))return $a(t)?He(t):t.length;var e=io(t);return e==v||e==x?t.size:Mr(t).length},Tn.snakeCase=Bs,Tn.some=function(t,e,n){var r=Da(t)?me:qr;return n&&co(t,e,n)&&(e=void 0),r(t,$i(e,3))},Tn.sortedIndex=function(t,e){return Kr(t,e)},Tn.sortedIndexBy=function(t,e,n){return Zr(t,e,$i(n,2))},Tn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=Kr(t,e);if(r<n&&Ia(t[r],e))return r}return-1},Tn.sortedLastIndex=function(t,e){return Kr(t,e,!0)},Tn.sortedLastIndexBy=function(t,e,n){return Zr(t,e,$i(n,2),!0)},Tn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=Kr(t,e,!0)-1;if(Ia(t[n],e))return n}return-1},Tn.startCase=Fs,Tn.startsWith=function(t,e,n){return t=cs(t),n=null==n?0:Qn(os(n),0,t.length),e=Jr(e),t.slice(n,n+e.length)==e},Tn.subtract=gu,Tn.sum=function(t){return t&&t.length?Ce(t,qs):0},Tn.sumBy=function(t,e){return t&&t.length?Ce(t,$i(e,2)):0},Tn.template=function(t,e,n){var r=Tn.templateSettings;n&&co(t,e,n)&&(e=void 0),t=cs(t),e=hs({},e,r,Ui);var i,o,a=hs({},e.imports,r.imports,Ui),s=ws(a),u=Pe(a,s),c=0,l=e.interpolate||ft,f="__p += '",h=vt((e.escape||ft).source+"|"+l.source+"|"+(l===V?rt:ft).source+"|"+(e.evaluate||ft).source+"|$","g"),d="//# sourceURL="+(St.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Gt+"]")+"\n";t.replace(h,(function(e,n,r,a,s,u){return r||(r=a),f+=t.slice(c,u).replace(ht,Ge),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(o=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=u+e.length,e})),f+="';\n";var p=St.call(e,"variable")&&e.variable;if(p){if(et.test(p))throw new Z("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(N,""):f).replace(D,"$1").replace(L,"$1;"),f="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=Vs((function(){return dt(s,d+"return "+f).apply(void 0,u)}));if(g.source=f,za(g))throw g;return g},Tn.times=function(t,e){if((t=os(t))<1||t>9007199254740991)return[];var n=4294967295,r=cn(t,4294967295);t-=4294967295;for(var i=Te(r,e=$i(e));++n<t;)e(n);return i},Tn.toFinite=is,Tn.toInteger=os,Tn.toLength=as,Tn.toLower=function(t){return cs(t).toLowerCase()},Tn.toNumber=ss,Tn.toSafeInteger=function(t){return t?Qn(os(t),-9007199254740991,9007199254740991):0===t?t:0},Tn.toString=cs,Tn.toUpper=function(t){return cs(t).toUpperCase()},Tn.trim=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return Ie(t);if(!t||!(e=Jr(e)))return t;var r=qe(t),i=qe(e);return fi(r,De(r,i),Le(r,i)+1).join("")},Tn.trimEnd=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return t.slice(0,Ke(t)+1);if(!t||!(e=Jr(e)))return t;var r=qe(t);return fi(r,0,Le(r,qe(e))+1).join("")},Tn.trimStart=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return t.replace(K,"");if(!t||!(e=Jr(e)))return t;var r=qe(t);return fi(r,De(r,qe(e))).join("")},Tn.truncate=function(t,e){var n=30,r="...";if(Xa(e)){var i="separator"in e?e.separator:i;n="length"in e?os(e.length):n,r="omission"in e?Jr(e.omission):r}var o=(t=cs(t)).length;if(ze(t)){var a=qe(t);o=a.length}if(n>=o)return t;var s=n-He(r);if(s<1)return r;var u=a?fi(a,0,s).join(""):t.slice(0,s);if(void 0===i)return u+r;if(a&&(s+=u.length-s),Za(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=vt(i.source,cs(it.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,void 0===f?s:f)}}else if(t.indexOf(Jr(i),s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Tn.unescape=function(t){return(t=cs(t))&&F.test(t)?t.replace(R,Ze):t},Tn.uniqueId=function(t){var e=++Ot;return cs(t)+e},Tn.upperCase=Gs,Tn.upperFirst=zs,Tn.each=ca,Tn.eachRight=la,Tn.first=Ro,$s(Tn,(hu={},lr(Tn,(function(t,e){St.call(Tn.prototype,e)||(hu[e]=t)})),hu),{chain:!1}),Tn.VERSION="4.17.21",ue(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Tn[t].placeholder=Tn})),ue(["drop","take"],(function(t,e){Nn.prototype[t]=function(n){n=void 0===n?1:un(os(n),0);var r=this.__filtered__&&!e?new Nn(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},Nn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ue(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Nn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:$i(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ue(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Nn.prototype[t]=function(){return this[n](1).value()[0]}})),ue(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Nn.prototype[t]=function(){return this.__filtered__?new Nn(this):this[n](1)}})),Nn.prototype.compact=function(){return this.filter(qs)},Nn.prototype.find=function(t){return this.filter(t).head()},Nn.prototype.findLast=function(t){return this.reverse().find(t)},Nn.prototype.invokeMap=Gr((function(t,e){return"function"==typeof t?new Nn(this):this.map((function(n){return xr(n,t,e)}))})),Nn.prototype.reject=function(t){return this.filter(Ma($i(t)))},Nn.prototype.slice=function(t,e){t=os(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Nn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=os(e))<0?n.dropRight(-e):n.take(e-t)),n)},Nn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Nn.prototype.toArray=function(){return this.take(4294967295)},lr(Nn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=Tn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(Tn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof Nn,u=a[0],c=s||Da(e),l=function(t){var e=i.apply(Tn,ge([t],a));return r&&f?e[0]:e};c&&n&&"function"==typeof u&&1!=u.length&&(s=c=!1);var f=this.__chain__,h=!!this.__actions__.length,d=o&&!f,p=s&&!h;if(!o&&c){e=p?e:new Nn(this);var g=t.apply(e,a);return g.__actions__.push({func:ia,args:[l],thisArg:void 0}),new Pn(g,f)}return d&&p?t.apply(this,a):(g=this.thru(l),d?r?g.value()[0]:g.value():g)})})),ue(["pop","push","shift","sort","splice","unshift"],(function(t){var e=bt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Tn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Da(i)?i:[],t)}return this[n]((function(n){return e.apply(Da(n)?n:[],t)}))}})),lr(Nn.prototype,(function(t,e){var n=Tn[e];if(n){var r=n.name+"";St.call(_n,r)||(_n[r]=[]),_n[r].push({name:e,func:n})}})),_n[Ti(void 0,2).name]=[{name:"wrapper",func:void 0}],Nn.prototype.clone=function(){var t=new Nn(this.__wrapped__);return t.__actions__=bi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=bi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=bi(this.__views__),t},Nn.prototype.reverse=function(){if(this.__filtered__){var t=new Nn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Nn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Da(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=cn(e,t+a);break;case"takeRight":t=un(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,h=0,d=cn(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return ii(t,this.__actions__);var p=[];t:for(;u--&&h<d;){for(var g=-1,v=t[c+=e];++g<f;){var y=l[g],m=y.iteratee,b=y.type,x=m(v);if(2==b)v=x;else if(!x){if(1==b)continue t;break t}}p[h++]=v}return p},Tn.prototype.at=oa,Tn.prototype.chain=function(){return ra(this)},Tn.prototype.commit=function(){return new Pn(this.value(),this.__chain__)},Tn.prototype.next=function(){void 0===this.__values__&&(this.__values__=rs(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Tn.prototype.plant=function(t){for(var e,n=this;n instanceof jn;){var r=To(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},Tn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Nn){var e=t;return this.__actions__.length&&(e=new Nn(this)),(e=e.reverse()).__actions__.push({func:ia,args:[Xo],thisArg:void 0}),new Pn(e,this.__chain__)}return this.thru(Xo)},Tn.prototype.toJSON=Tn.prototype.valueOf=Tn.prototype.value=function(){return ii(this.__wrapped__,this.__actions__)},Tn.prototype.first=Tn.prototype.head,$t&&(Tn.prototype[$t]=function(){return this}),Tn}();"object"==o(n(152))&&n(152)?(qt._=Qe,void 0===(i=function(){return Qe}.call(e,n,e,r))||(r.exports=i)):Zt?((Zt.exports=Qe)._=Qe,Kt._=Qe):qt._=Qe}).call(this)}).call(this,n(151),n(120)(t))},function(t,e){t.exports="2.1.4"},function(t,e,n){var r=n(44),i=n(119);function o(t){return r.map(t.nodes(),(function(e){var n=t.node(e),i=t.parent(e),o={v:e};return r.isUndefined(n)||(o.value=n),r.isUndefined(i)||(o.parent=i),o}))}function a(t){return r.map(t.edges(),(function(e){var n=t.edge(e),i={v:e.v,w:e.w};return r.isUndefined(e.name)||(i.name=e.name),r.isUndefined(n)||(i.value=n),i}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:o(t),edges:a(t)};r.isUndefined(t.graph())||(e.value=r.clone(t.graph()));return e},read:function(t){var e=new i(t.options).setGraph(t.value);return r.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),r.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},function(t,e,n){t.exports={components:n(269),dijkstra:n(153),dijkstraAll:n(270),findCycles:n(271),floydWarshall:n(272),isAcyclic:n(273),postorder:n(274),preorder:n(275),prim:n(276),tarjan:n(155),topsort:n(156)}},function(t,e,n){var r=n(44);t.exports=function(t){var e,n={},i=[];function o(i){r.has(n,i)||(n[i]=!0,e.push(i),r.each(t.successors(i),o),r.each(t.predecessors(i),o))}return r.each(t.nodes(),(function(t){e=[],o(t),e.length&&i.push(e)})),i}},function(t,e,n){var r=n(153),i=n(44);t.exports=function(t,e,n){return i.transform(t.nodes(),(function(i,o){i[o]=r(t,o,e,n)}),{})}},function(t,e,n){var r=n(44),i=n(155);t.exports=function(t){return r.filter(i(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},function(t,e,n){var r=n(44);t.exports=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)}))}))})),r}(t,e||i,n||function(e){return t.outEdges(e)})};var i=r.constant(1)},function(t,e,n){var r=n(156);t.exports=function(t){try{r(t)}catch(t){if(t instanceof r.CycleException)return!1;throw t}return!0}},function(t,e,n){var r=n(157);t.exports=function(t,e){return r(t,e,"post")}},function(t,e,n){var r=n(157);t.exports=function(t,e){return r(t,e,"pre")}},function(t,e,n){var r=n(44),i=n(119),o=n(154);t.exports=function(t,e){var n,a=new i,s={},u=new o;function c(t){var r=t.v===n?t.w:t.v,i=u.priority(r);if(void 0!==i){var o=e(t);o<i&&(s[r]=n,u.decrease(r,o))}}if(0===t.nodeCount())return a;r.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),u.decrease(t.nodes()[0],0);var l=!1;for(;u.size()>0;){if(n=u.removeMin(),r.has(s,n))a.setEdge(n,s[n]);else{if(l)throw new Error("Input graph is not connected: "+t);l=!0}t.nodeEdges(n).forEach(c)}return a}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(n(278)),u=a(n(281)),c=a(n(282)),l=o(n(45)),f=a(n(284)),h=a(n(285)),d=a(n(286)),p=a(n(287)),g=a(n(288)),v=a(n(297)),y=a(n(52)),m=a(n(299)),b=y.default.Graph,x=function(t,e,n){e(" removeSelfEdges",(function(){z(t)})),e(" acyclic",(function(){s.default.run(t)})),e(" nestingGraph.run",(function(){h.default.run(t)})),e(" rank",(function(){(0,c.default)(l.default.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){P(t)})),e(" removeEmptyRanks",(function(){(0,l.removeEmptyRanks)(t)})),e(" nestingGraph.cleanup",(function(){h.default.cleanup(t)})),e(" normalizeRanks",(function(){(0,l.normalizeRanks)(t)})),e(" assignRankMinMax",(function(){N(t)})),e(" removeEdgeLabelProxies",(function(){D(t)})),e(" normalize.run",(function(){u.default.run(t)})),e(" parentDummyChains",(function(){(0,f.default)(t)})),e(" addBorderSegments",(function(){(0,d.default)(t)})),n&&n.keepNodeOrder&&e(" initDataOrder",(function(){(0,m.default)(t,n.nodeOrder)})),e(" order",(function(){(0,g.default)(t)})),e(" insertSelfEdges",(function(){U(t)})),e(" adjustCoordinateSystem",(function(){p.default.adjust(t)})),e(" position",(function(){(0,v.default)(t)})),e(" positionSelfEdges",(function(){V(t)})),e(" removeBorderNodes",(function(){G(t)})),e(" normalize.undo",(function(){u.default.undo(t)})),e(" fixupEdgeLabelCoords",(function(){B(t)})),e(" undoCoordinateSystem",(function(){p.default.undo(t)})),e(" translateGraph",(function(){L(t)})),e(" assignNodeIntersects",(function(){R(t)})),e(" reversePoints",(function(){F(t)})),e(" acyclic.undo",(function(){s.default.undo(t)}))},_=function(t,e){var n=e._nodes||{};t.nodes().forEach((function(e){var r=t.node(e);void 0!==n[e]?(r.fixorder=n[e]._order,delete n[e]._order):delete r.fixorder}))},w=function(t,e){t.nodes().forEach((function(n){var r,i=t.node(n),o=e.node(n);i&&(i.x=o.x,i.y=o.y,i._order=o.order,i._rank=o.rank,(null===(r=e.children(n))||void 0===r?void 0:r.length)&&(i.width=o.width,i.height=o.height))})),t.edges().forEach((function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,i.hasOwnProperty("x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height},E=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},O=["acyclicer","ranker","rankdir","align"],M=["width","height","layer","fixorder"],k={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],C={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"],I=function(t){var e=new b({multigraph:!0,compound:!0}),n=X(t.graph()),r={};return null==O||O.forEach((function(t){void 0!==n[t]&&(r[t]=n[t])})),e.setGraph(Object.assign({},S,W(n,E),r)),t.nodes().forEach((function(n){var r=X(t.node(n)),i=W(r,M);Object.keys(k).forEach((function(t){void 0===i[t]&&(i[t]=k[t])})),e.setNode(n,i),e.setParent(n,t.parent(n))})),t.edges().forEach((function(n){var r=X(t.edge(n)),i={};null==T||T.forEach((function(t){void 0!==r[t]&&(i[t]=r[t])})),e.setEdge(n,Object.assign({},C,W(r,A),i))})),e},j=function(t){var e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach((function(e){var n=t.node(e);isNaN(n.layer)||(n.layer?n.layer*=2:n.layer=0)})),t.edges().forEach((function(n){var r,i=t.edge(n);i.minlen*=2,"c"!==(null===(r=i.labelpos)||void 0===r?void 0:r.toLowerCase())&&("TB"===e.rankdir||"BT"===e.rankdir?i.width+=i.labeloffset:i.height+=i.labeloffset)}))},P=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={e:e,rank:(t.node(e.w).rank-r.rank)/2+r.rank};l.default.addDummyNode(t,"edge-proxy",i,"_ep")}}))},N=function(t){var e=0;t.nodes().forEach((function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank||-1/0))})),t.graph().maxRank=e},D=function(t){t.nodes().forEach((function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))},L=function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0,u=function(t){if(t){var o=t.x,a=t.y,s=t.width,u=t.height;isNaN(o)||isNaN(s)||(e=Math.min(e,o-s/2),n=Math.max(n,o+s/2)),isNaN(a)||isNaN(u)||(r=Math.min(r,a-u/2),i=Math.max(i,a+u/2))}};t.nodes().forEach((function(e){u(t.node(e))})),t.edges().forEach((function(e){var n=t.edge(e);n.hasOwnProperty("x")&&u(n)})),e-=a,r-=s,t.nodes().forEach((function(n){var i=t.node(n);i.x-=e,i.y-=r})),t.edges().forEach((function(n){var i,o=t.edge(n);null===(i=o.points)||void 0===i||i.forEach((function(t){t.x-=e,t.y-=r})),o.hasOwnProperty("x")&&(o.x-=e),o.hasOwnProperty("y")&&(o.y-=r)})),o.width=n-e+a,o.height=i-r+s},R=function(t){t.edges().forEach((function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(l.default.intersectRect(o,n)),i.points.push(l.default.intersectRect(a,r))}))},B=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.hasOwnProperty("x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))},F=function(t){t.edges().forEach((function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))},G=function(t){t.nodes().forEach((function(e){var n,r,i;if(null===(n=t.children(e))||void 0===n?void 0:n.length){var o=t.node(e),a=t.node(o.borderTop),s=t.node(o.borderBottom),u=t.node(o.borderLeft[(null===(r=o.borderLeft)||void 0===r?void 0:r.length)-1]),c=t.node(o.borderRight[(null===(i=o.borderRight)||void 0===i?void 0:i.length)-1]);o.width=Math.abs((null==c?void 0:c.x)-(null==u?void 0:u.x))||10,o.height=Math.abs((null==s?void 0:s.y)-(null==a?void 0:a.y))||10,o.x=((null==u?void 0:u.x)||0)+o.width/2,o.y=((null==a?void 0:a.y)||0)+o.height/2}})),t.nodes().forEach((function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))},z=function(t){t.edges().forEach((function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))},U=function(t){var e=l.default.buildLayerMatrix(t);null==e||e.forEach((function(e){var n=0;null==e||e.forEach((function(e,r){var i,o=t.node(e);o.order=r+n,null===(i=o.selfEdges)||void 0===i||i.forEach((function(e){l.default.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete o.selfEdges}))}))},V=function(t){t.nodes().forEach((function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{y:o,x:i+a},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))},W=function(t,e){var n={};return null==e||e.forEach((function(e){void 0!==t[e]&&(n[e]=+t[e])})),n},X=function(t){var e={};return Object.keys(t).forEach((function(n){var r=t[n];e[n.toLowerCase()]=r})),e};e.default=function(t,e){var n=e&&e.debugTiming?l.default.time:l.default.notime;n("layout",(function(){e&&!e.keepNodeOrder&&e.prevGraph&&n(" inheritOrder",(function(){_(t,e.prevGraph)}));var r=n(" buildLayoutGraph",(function(){return I(t)}));e&&!1===e.edgeLabelSpace||n(" makeSpaceForEdgeLabels",(function(){j(r)}));try{n(" runLayout",(function(){x(r,n,e)}))}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}n(" updateInputGraph",(function(){w(t,r)}))}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(279)),o=function(t){var e=[],n={},r={};return t.nodes().forEach((function i(o){var a;r.hasOwnProperty(o)||(r[o]=!0,n[o]=!0,null===(a=t.outEdges(o))||void 0===a||a.forEach((function(t){n.hasOwnProperty(t.w)?e.push(t):i(t.w)})),delete n[o])})),e};e.default={run:function(t){var e="greedy"===t.graph().acyclicer?(0,i.default)(t,function(t){return function(e){return t.edge(e).weight}}(t)):o(t);null==e||e.forEach((function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,"rev-"+Math.random())}))},undo:function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(52)),o=r(n(280)),a=i.default.Graph,s=function(){return 1},u=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)c(t,e,n,r);for(;r=o.dequeue();)c(t,e,n,r);if(t.nodeCount())for(var s=e.length-2;s>0;--s)if(r=e[s].dequeue()){i=i.concat(c(t,e,n,r,!0));break}}return i},c=function(t,e,n,r,i){var o,a,s=i?[]:void 0;return null===(o=t.inEdges(r.v))||void 0===o||o.forEach((function(r){var o=t.edge(r),a=t.node(r.v);i&&s.push({v:r.v,w:r.w}),void 0===a.out&&(a.out=0),a.out-=o,f(e,n,a)})),null===(a=t.outEdges(r.v))||void 0===a||a.forEach((function(r){var i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,f(e,n,a)})),t.removeNode(r.v),s},l=function(t,e){var n=new a,r=0,i=0;t.nodes().forEach((function(t){n.setNode(t,{v:t,in:0,out:0})})),t.edges().forEach((function(t){var o=n.edge(t.v,t.w)||0,a=null==e?void 0:e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));for(var s=[],u=i+r+3,c=0;c<u;c++)s.push(new o.default);var l=r+1;return n.nodes().forEach((function(t){f(s,l,n.node(t))})),{buckets:s,zeroIdx:l,graph:n}},f=function(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)};e.default=function(t,e){var n;if(t.nodeCount()<=1)return[];var r=l(t,e||s);return null===(n=u(r.graph,r.buckets,r.zeroIdx).map((function(e){return t.outEdges(e.v,e.w)})))||void 0===n?void 0:n.flat()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev},i=function(t,e){if("_next"!==t&&"_prev"!==t)return e},o=function(){function t(){var t={};t._next=t._prev=t,this.isentinel=t}return t.prototype.dequeue=function(){var t=this.isentinel,e=t._prev;if(e!==t)return r(e),e},t.prototype.enqueue=function(){var t=this.isentinel,e=t._prev;if(e!==t)return r(e),e},t.prototype.toString=function(){for(var t=[],e=this.isentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,i)),n=n._prev;return"["+t.join(", ")+"]"},t}();e.default=o},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e){var n,r,o=e.v,a=t.node(o).rank,s=e.w,u=t.node(s).rank,c=e.name,l=t.edge(e),f=l.labelRank;if(u!==a+1){var h,d,p;for(t.removeEdge(e),p=0,++a;a<u;++p,++a)l.points=[],d={edgeLabel:l,width:0,height:0,edgeObj:e,rank:a},h=i.default.addDummyNode(t,"edge",d,"_d"),a===f&&(d.width=l.width,d.height=l.height,d.dummy="edge-label",d.labelpos=l.labelpos),t.setEdge(o,h,{weight:l.weight},c),0===p&&(t.graph().dummyChains||(t.graph().dummyChains=[]),null===(r=null===(n=t.graph())||void 0===n?void 0:n.dummyChains)||void 0===r||r.push(h)),o=h;t.setEdge(o,s,{weight:l.weight},c)}};e.default={run:function(t){t.graph().dummyChains=[],t.edges().forEach((function(e){return o(t,e)}))},undo:function(t){var e;null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var n,r,i=t.node(e),o=i.edgeLabel;i.edgeObj&&t.setEdge(i.edgeObj,o);for(var a=e;i.dummy;)r=null===(n=t.successors(a))||void 0===n?void 0:n[0],t.removeNode(a),o.points.push({x:i.x,y:i.y}),"edge-label"===i.dummy&&(o.x=i.x,o.y=i.y,o.width=i.width,o.height=i.height),a=r,i=t.node(a)}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(121),o=n(158),a=r(n(283)),s=i.longestPath,u=function(t){(0,i.longestPathWithLayer)(t),(0,o.feasibleTreeWithLayer)(t)},c=function(t){(0,a.default)(t)};e.default=function(t){switch(t.graph().ranker){case"network-simplex":c(t);break;case"tight-tree":u(t);break;case"longest-path":s(t);break;default:u(t)}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(158),o=n(121),a=n(45),s=r(n(52)).default.alg,u=s.preorder,c=s.postorder,l=function(t){t=(0,a.simplify)(t),(0,o.longestPath)(t);var e,n,r=(0,i.feasibleTree)(t);for(p(r),f(r,t);e=v(r);)n=y(r,t,e),m(r,t,e,n)},f=function(t,e){var n=c(t,t.nodes());null==(n=null==n?void 0:n.slice(0,(null==n?void 0:n.length)-1))||n.forEach((function(n){h(t,e,n)}))},h=function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=d(t,e,n)},d=function(t,e,n){var r,i=t.node(n).parent,o=!0,a=e.edge(n,i),s=0;return a||(o=!1,a=e.edge(i,n)),s=a.weight,null===(r=e.nodeEdges(n))||void 0===r||r.forEach((function(r){var a=r.v===n,u=a?r.w:r.v;if(u!==i){var c=a===o,l=e.edge(r).weight;if(s+=c?l:-l,x(t,n,u)){var f=t.edge(n,u).cutvalue;s+=c?-f:f}}})),s},p=function(t,e){void 0!==e&&(e=t.nodes()[0]),g(t,{},1,e)},g=function t(e,n,r,i,o){var a,s=r,u=r,c=e.node(i);return n[i]=!0,null===(a=e.neighbors(i))||void 0===a||a.forEach((function(r){n.hasOwnProperty(r)||(u=t(e,n,u,r,i))})),c.low=s,c.lim=u++,o?c.parent=o:delete c.parent,u},v=function(t){return t.edges().find((function(e){return t.edge(e).cutvalue<0}))},y=function(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var s=t.node(r),u=t.node(i),c=s,l=!1;s.lim>u.lim&&(c=u,l=!0);var f=e.edges().filter((function(e){return l===_(t,t.node(e.v),c)&&l!==_(t,t.node(e.w),c)}));return(0,a.minBy)(f,(function(t){return(0,o.slack)(e,t)}))},m=function(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),p(t),f(t,e),b(t,e)},b=function(t,e){var n=t.nodes().find((function(t){return!e.node(t).parent})),r=u(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},x=function(t,e,n){return t.hasEdge(e,n)},_=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};l.initLowLimValues=p,l.initCutValues=f,l.calcCutValue=d,l.leaveEdge=v,l.enterEdge=y,l.exchangeEdges=m,e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e,n,r){var i,o,a=[],s=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>u||c>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)s.push(i);return{lca:o,path:a.concat(s.reverse())}},i=function(t){var e,n={},r=0;return null===(e=t.children())||void 0===e||e.forEach((function e(i){var o,a=r;null===(o=t.children(i))||void 0===o||o.forEach(e),n[i]={low:a,lim:r++}})),n};e.default=function(t){var e,n=i(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var i,o,a=t.node(e),s=a.edgeObj;if(s)for(var u=r(t,n,s.v,s.w),c=u.path,l=u.lca,f=0,h=c[f],d=!0;e!==s.w;){if(a=t.node(e),d){for(;(h=c[f])!==l&&t.node(h).maxRank<a.rank;)f++;h===l&&(d=!1)}if(!d){for(;f<c.length-1&&(null===(i=t.node(h=c[f+1]))||void 0===i?void 0:i.minRank)<=a.rank;)f++;h=c[f]}t.setParent(e,h),e=null===(o=t.successors(e))||void 0===o?void 0:o[0]}}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function t(e,n,r,o,a,s,u){var c=e.children(u);if(null==c?void 0:c.length){var l=i.default.addBorderNode(e,"_bt"),f=i.default.addBorderNode(e,"_bb"),h=e.node(u);e.setParent(l,u),h.borderTop=l,e.setParent(f,u),h.borderBottom=f,null==c||c.forEach((function(i){t(e,n,r,o,a,s,i);var c=e.node(i),h=c.borderTop?c.borderTop:i,d=c.borderBottom?c.borderBottom:i,p=c.borderTop?o:2*o,g=h!==d?1:a-s[u]+1;e.setEdge(l,h,{minlen:g,weight:p,nestingEdge:!0}),e.setEdge(d,f,{minlen:g,weight:p,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,l,{weight:0,minlen:a+s[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})},a=function(t){var e,n={};return null===(e=t.children())||void 0===e||e.forEach((function(e){return function e(r,i){var o=t.children(r);null==o||o.forEach((function(t){return e(t,i+1)})),n[r]=i}(e,1)})),n},s=function(t){var e=0;return t.edges().forEach((function(n){e+=t.edge(n).weight})),e};e.default={run:function(t){var e,n=i.default.addDummyNode(t,"root",{},"_root"),r=a(t),u=Math.max.apply(Math,Object.values(r))-1,c=2*u+1;t.graph().nestingRoot=n,t.edges().forEach((function(e){t.edge(e).minlen*=c}));var l=s(t)+1;null===(e=t.children())||void 0===e||e.forEach((function(e){o(t,n,c,l,u,r,e)})),t.graph().nodeRankFactor=c},cleanup:function(t){var e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach((function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e,n,r,o,a){var s={rank:a,width:0,height:0,borderType:e},u=o[e][a-1],c=i.default.addDummyNode(t,"border",s,n);o[e][a]=c,t.setParent(c,r),u&&t.setEdge(u,c,{weight:1})};e.default=function(t){var e;null===(e=t.children())||void 0===e||e.forEach((function(e){return function e(n){var r=t.children(n),i=t.node(n);if((null==r?void 0:r.length)&&r.forEach((function(t){return e(t)})),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)o(t,"borderLeft","_bl",n,i,a),o(t,"borderRight","_br",n,i,a)}}(e)}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){t.nodes().forEach((function(e){i(t.node(e))})),t.edges().forEach((function(e){i(t.edge(e))}))},i=function(t){var e=t.width;t.width=t.height,t.height=e},o=function(t){t.nodes().forEach((function(e){a(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return a(t)})),r.hasOwnProperty("y")&&a(r)}))},a=function(t){t.y=-t.y},s=function(t){t.nodes().forEach((function(e){u(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return u(t)})),r.hasOwnProperty("x")&&u(r)}))},u=function(t){var e=t.x;t.x=t.y,t.y=e};e.default={adjust:function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"lr"!==n&&"rl"!==n||r(t)},undo:function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"bt"!==n&&"rl"!==n||o(t),"lr"!==n&&"rl"!==n||(s(t),r(t))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(289)),o=r(n(290)),a=r(n(291)),s=r(n(292)),u=r(n(293)),c=r(n(52)),l=r(n(45)),f=n(32),h=c.default.Graph,d=function(t,e,n){return e.map((function(e){return(0,a.default)(t,e,n)}))},p=function(t,e,n){var r=new h;null==t||t.forEach((function(t){for(var i,o=t.graph().root,a=(0,u.default)(t,o,r,e,n),c=0;c<(null===(i=a.vs)||void 0===i?void 0:i.length);c++)t.node(a.vs[c]).order=c;(0,s.default)(t,r,a.vs)}))},g=function(t,e){null==e||e.forEach((function(e){null==e||e.forEach((function(e,n){t.node(e).order=n}))}))};e.default=function(t){for(var e=l.default.maxRank(t),n=[],r=[],a=1;a<e+1;a++)n.push(a);for(a=e-1;a>-1;a--)r.push(a);var s=d(t,n,"inEdges"),u=d(t,r,"outEdges"),c=(0,i.default)(t);g(t,c);for(var h,v=Number.POSITIVE_INFINITY,y=(a=0,0);y<4;++a,++y){p(a%2?s:u,a%4>=2),c=l.default.buildLayerMatrix(t),(m=(0,o.default)(t,c))<v&&(y=0,h=(0,f.clone)(c),v=m)}c=(0,i.default)(t),g(t,c);for(a=0,y=0;y<4;++a,++y){var m;p(a%2?s:u,a%4>=2,!0),c=l.default.buildLayerMatrix(t),(m=(0,o.default)(t,c))<v&&(y=0,h=(0,f.clone)(c),v=m)}g(t,h)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t){for(var e={},n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=[],a=0;a<i+1;a++)o.push([]);var s=n.sort((function(e,n){return t.node(e).rank-t.node(n).rank})),u=s.filter((function(e){return void 0!==t.node(e).fixorder})).sort((function(e,n){return t.node(e).fixorder-t.node(n).fixorder}));return null==u||u.forEach((function(n){isNaN(t.node(n).rank)||o[t.node(n).rank].push(n),e[n]=!0})),null==s||s.forEach((function n(r){var i;if(!e.hasOwnProperty(r)){e[r]=!0;var a=t.node(r);isNaN(a.rank)||o[a.rank].push(r),null===(i=t.successors(r))||void 0===i||i.forEach((function(t){return n(t)}))}})),o}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(45),i=function(t,e,n){for(var i=(0,r.zipObject)(n,n.map((function(t,e){return e}))),o=e.map((function(e){var n,r=null===(n=t.outEdges(e))||void 0===n?void 0:n.map((function(e){return{pos:i[e.w]||0,weight:t.edge(e).weight}}));return null==r?void 0:r.sort((function(t,e){return t.pos-e.pos}))})).flat().filter((function(t){return void 0!==t})),a=1;a<n.length;)a<<=1;var s=2*a-1;a-=1;var u=Array(s).fill(0,0,s),c=0;return null==o||o.forEach((function(t){var e=t.pos+a;u[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*n})),c};e.default=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);++r)n+=i(t,e[r-1],e[r]);return n}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(52)).default.Graph,o=function(t){for(var e;t.hasNode(e="_root"+Math.random()););return e};e.default=function(t,e,n){var r=o(t),a=new i({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return t.nodes().forEach((function(i){var o=t.node(i),s=t.parent(i);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||r),t[n](i).forEach((function(e){var n=e.v===i?e.w:e.v,r=a.edge(n,i),o=void 0!==r?r.weight:0;a.setEdge(n,i,{weight:t.edge(e).weight+o})})),o.hasOwnProperty("minRank")&&a.setNode(i,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))})),a}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e,n){var r,i={};null==n||n.forEach((function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(294)),o=r(n(295)),a=r(n(296)),s=function(t,e){null==t||t.forEach((function(t){var n,r=null===(n=t.vs)||void 0===n?void 0:n.map((function(t){return e[t]?e[t].vs:t}));t.vs=r.flat()}))},u=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};e.default=function t(e,n,r,c,l){var f,h,d,p,g=e.children(n),v=e.node(n),y=v?v.borderLeft:void 0,m=v?v.borderRight:void 0,b={};y&&(g=null==g?void 0:g.filter((function(t){return t!==y&&t!==m})));var x=(0,i.default)(e,g||[]);null==x||x.forEach((function(n){var i;if(null===(i=e.children(n.v))||void 0===i?void 0:i.length){var o=t(e,n.v,r,c);b[n.v]=o,o.hasOwnProperty("barycenter")&&u(n,o)}}));var _=(0,o.default)(x,r);s(_,b),null===(f=_.filter((function(t){var e;return!!t.vs||(null===(e=t.vs)||void 0===e?void 0:e.length)>0})))||void 0===f||f.forEach((function(t){var n=e.node(t.vs[0]);t.fixorder=n.fixorder,t.order=n.order}));var w=(0,a.default)(_,c,l);if(y&&(w.vs=[y,w.vs,m].flat(),null===(h=e.predecessors(y))||void 0===h?void 0:h.length)){var E=e.node((null===(d=e.predecessors(y))||void 0===d?void 0:d[0])||{}),S=e.node((null===(p=e.predecessors(m))||void 0===p?void 0:p[0])||{});w.hasOwnProperty("barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+E.order+S.order)/(w.weight+2),w.weight+=2}return w}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e){return e.map((function(e){var n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};var r={sum:0,weight:0};return null==n||n.forEach((function(e){var n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){for(var e,n,r=[],o=function(){var o=t.pop();r.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((function(t){return(e=o,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&i(e,t)})(t);var e})),null===(n=o.out)||void 0===n||n.forEach((function(e){return(n=o,function(e){e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))};null==t?void 0:t.length;)o();var a=r.filter((function(t){return!t.merged})),s=["vs","i","barycenter","weight"];return a.map((function(t){var e={};return null==s||s.forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),e}))},i=function(t,e){var n,r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};e.default=function(t,e){var n,i,o,a={};null==t||t.forEach((function(t,e){var n=a[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.edges())||void 0===n||n.forEach((function(t){var e=a[t.v],n=a[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(a[t.w]))}));var s=null===(o=(i=Object.values(a)).filter)||void 0===o?void 0:o.call(i,(function(t){return!t.indegree}));return r(s)}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e,n){for(var r,i=n;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},a=function(t,e){return function(n,r){if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i}};e.default=function(t,e,n){var r=i.default.partition(t,(function(t){return t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder)||t.hasOwnProperty("barycenter")})),s=r.lhs,u=r.rhs.sort((function(t,e){return-t.i- -e.i})),c=[],l=0,f=0,h=0;null==s||s.sort(a(!!e,!!n)),h=o(c,u,h),null==s||s.forEach((function(t){var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,c.push(t.vs),l+=t.barycenter*t.weight,f+=t.weight,h=o(c,u,h)}));var d={vs:c.flat()};return f&&(d.barycenter=l/f,d.weight=f),d}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=n(298);e.default=function(t){var e;!function(t){var e=i.default.buildLayerMatrix(t),n=t.graph().ranksep,r=0;null==e||e.forEach((function(e){var i=e.map((function(e){return t.node(e).height})),o=Math.max.apply(Math,i);null==e||e.forEach((function(e){t.node(e).y=r+o/2})),r+=o+n}))}(t=i.default.asNonCompoundGraph(t));var n=function(t){var e,n=i.default.buildLayerMatrix(t),r=Object.assign((0,o.findType1Conflicts)(t,n),(0,o.findType2Conflicts)(t,n)),a={};["u","d"].forEach((function(i){e="u"===i?n:Object.values(n).reverse(),["l","r"].forEach((function(n){"r"===n&&(e=e.map((function(t){return Object.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),u=(0,o.verticalAlignment)(t,e,r,s),c=(0,o.horizontalCompaction)(t,e,u.root,u.align,"r"===n);"r"===n&&Object.keys(c).forEach((function(t){return c[t]=-c[t]})),a[i+n]=c}))}));var s=(0,o.findSmallestWidthAlignment)(t,a);return s&&(0,o.alignCoordinates)(a,s),(0,o.balance)(a,t.graph().align)}(t);null===(e=Object.keys(n))||void 0===e||e.forEach((function(e){t.node(e).x=n[e]}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.balance=e.findSmallestWidthAlignment=e.alignCoordinates=e.horizontalCompaction=e.verticalAlignment=e.hasConflict=e.addConflict=e.findType2Conflicts=e.findType1Conflicts=e.positionX=void 0;var i=r(n(52)),o=r(n(45)),a=i.default.Graph,s=function(t,e){var n={};return(null==e?void 0:e.length)&&e.reduce((function(e,r){var i=0,o=0,a=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((function(e,u){var f,h=c(t,e),d=h?t.node(h).order:a;(h||e===s)&&(null===(f=r.slice(o,u+1))||void 0===f||f.forEach((function(e){var r;null===(r=t.predecessors(e))||void 0===r||r.forEach((function(r){var o=t.node(r),a=o.order;!(a<i||d<a)||o.dummy&&t.node(e).dummy||l(n,r,e)}))})),o=u+1,i=d)})),r})),n};e.findType1Conflicts=s;var u=function(t,e){var n={},r=function(e,r,i,o,a){for(var s,u=[],c=r;c<i;c++)u.push(c);u.forEach((function(r){var i;s=e[r],t.node(s).dummy&&(null===(i=t.predecessors(s))||void 0===i||i.forEach((function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&l(n,e,s)})))}))};return(null==e?void 0:e.length)&&e.reduce((function(e,n){var i,o=-1,a=0;return null==n||n.forEach((function(s,u){if("border"===t.node(s).dummy){var c=t.predecessors(s)||[];c.length&&(i=t.node(c[0]).order,r(n,a,u,o,i),a=u,o=i)}r(n,a,n.length,i,e.length)})),n})),n};e.findType2Conflicts=u;var c=function(t,e){var n;if(t.node(e).dummy)return null===(n=t.predecessors(e))||void 0===n?void 0:n.find((function(e){return t.node(e).dummy}))},l=function(t,e,n){var r=e,i=n;if(r>i){var o=r;r=i,i=o}var a=t[r];a||(t[r]=a={}),a[i]=!0};e.addConflict=l;var f=function(t,e,n){var r=e,i=n;r>i&&(r=i,i=e);return t[r]&&t[r].hasOwnProperty(i)};e.hasConflict=f;var h=function(t,e,n,r){var i={},o={},a={};return null==e||e.forEach((function(t){null==t||t.forEach((function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((function(t){var e=-1;null==t||t.forEach((function(t){var s=r(t);if(s.length)for(var u=((s=s.sort((function(t,e){return a[t]-a[e]}))).length-1)/2,c=Math.floor(u),l=Math.ceil(u);c<=l;++c){var h=s[c];o[t]===t&&e<a[h]&&!f(n,t,h)&&(o[h]=t,o[t]=i[t]=i[h],e=a[h])}}))})),{root:i,align:o}};e.verticalAlignment=h;var d=function(t,e,n,r,i){var o,a={},s=p(t,e,n,i),u=i?"borderLeft":"borderRight",c=function(t,e){for(var n=s.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()};return c((function(t){a[t]=(s.inEdges(t)||[]).reduce((function(t,e){return Math.max(t,(a[e.v]||0)+s.edge(e))}),0)}),s.predecessors.bind(s)),c((function(e){var n=(s.outEdges(e)||[]).reduce((function(t,e){return Math.min(t,(a[e.w]||0)-s.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(a[e]=Math.max(a[e],n))}),s.successors.bind(s)),null===(o=Object.values(r))||void 0===o||o.forEach((function(t){a[t]=a[n[t]]})),a};e.horizontalCompaction=d;var p=function(t,e,n,r){var i=new a,o=t.graph(),s=b(o.nodesep,o.edgesep,r);return null==e||e.forEach((function(e){var r;null==e||e.forEach((function(e){var o=n[e];if(i.setNode(o),r){var a=n[r],u=i.edge(a,o);i.setEdge(a,o,Math.max(s(t,e,r),u||0))}r=e}))})),i},g=function(t,e){return o.default.minBy(Object.values(e),(function(e){var n,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((function(n){var o=e[n],a=x(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i}))};function v(t,e){var n=Object.values(e),r=Math.min.apply(Math,n),i=Math.max.apply(Math,n);["u","d"].forEach((function(n){["l","r"].forEach((function(o){var a,s=n+o,u=t[s];if(u!==e){var c=Object.values(u);(a="l"===o?r-Math.min.apply(Math,c):i-Math.max.apply(Math,c))&&(t[s]={},Object.keys(u).forEach((function(e){t[s][e]=u[e]+a})))}}))}))}e.findSmallestWidthAlignment=g,e.alignCoordinates=v;var y=function(t,e){var n={};return Object.keys(t.ul).forEach((function(r){if(e)n[r]=t[e.toLowerCase()][r];else{var i=Object.values(t).map((function(t){return t[r]})).sort((function(t,e){return t-e}));n[r]=(i[1]+i[2])/2}})),n};e.balance=y;var m=function(t){var e,n=o.default.buildLayerMatrix(t),r=Object.assign(s(t,n),u(t,n)),i={};["u","d"].forEach((function(o){e="u"===o?n:Object.values(n).reverse(),["l","r"].forEach((function(n){"r"===n&&(e=e.map((function(t){return Object.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),s=h(0,e,r,a),u=d(t,e,s.root,s.align,"r"===n);"r"===n&&(u=Object.values(u).map((function(t){return-t}))),i[o+n]=u}))}));var a=g(t,i);return v(i,a),y(i,t.graph().align)};e.positionX=m;var b=function(t,e,n){return function(r,i,o){var a,s=r.node(i),u=r.node(o),c=0;if(c+=s.width/2,s.hasOwnProperty("labelpos"))switch((s.labelpos||"").toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(u.dummy?e:t)/2,c+=u.width/2,u.hasOwnProperty("labelpos"))switch((u.labelpos||"").toLowerCase()){case"l":a=u.width/2;break;case"r":a=-u.width/2}return a&&(c+=n?a:-a),a=0,c}},x=function(t,e){var n;return(null===(n=t.node(e))||void 0===n?void 0:n.width)||0};e.default={positionX:m,findType1Conflicts:s,findType2Conflicts:u,addConflict:l,hasConflict:f,verticalAlignment:h,horizontalCompaction:d,alignCoordinates:v,findSmallestWidthAlignment:g,balance:y}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e){for(var n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})).map((function(e){return t.node(e).rank})),r=Math.max.apply(Math,n),i=[],o=0;o<r+1;o++)i.push([]);null==e||e.forEach((function(e){var n=t.node(e);n&&!n.dummy&&(isNaN(n.rank)||(n.fixorder=i[n.rank].length,i[n.rank].push(e)))}))}},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RadialLayout=void 0;var a=n(32),s=n(34),u=o(n(301)),c=o(n(302));function l(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var f=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges||[];if(e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var r=t.center;if(1===e.length)return e[0].x=r[0],e[0].y=r[1],void(t.onLayoutEnd&&t.onLayoutEnd());var i=t.linkDistance,o=null;if((0,a.isString)(t.focusNode)){for(var s=!1,l=0;l<e.length;l++)e[l].id===t.focusNode&&(o=e[l],t.focusNode=o,s=!0,l=e.length);s||(o=null)}else o=t.focusNode;o||(o=e[0],t.focusNode=o);var f,h,d,p=(f=e,h=o.id,d=-1,f.forEach((function(t,e){t.id===h&&(d=e)})),d);p<0&&(p=0),t.focusIndex=p;var g=(0,a.getAdjMatrix)({nodes:e,edges:n},!1),v=(0,a.floydWarshall)(g),y=t.maxToFocus(v,p);t.handleInfinity(v,p,y+1),t.distances=v;var m=v[p],b=t.width||500,x=t.height||500,_=b-r[0]>r[0]?r[0]:b-r[0],w=x-r[1]>r[1]?r[1]:x-r[1];0===_&&(_=b/2),0===w&&(w=x/2);var E=w>_?_:w,S=Math.max.apply(Math,m),O=[];m.forEach((function(e,n){t.unitRadius||(t.unitRadius=E/S),O[n]=e*t.unitRadius})),t.radii=O;var M=t.eIdealDisMatrix();t.eIdealDistances=M;var k=function(t){for(var e=t.length,n=t[0].length,r=[],i=0;i<e;i++){for(var o=[],a=0;a<n;a++)0!==t[i][a]?o.push(1/(t[i][a]*t[i][a])):o.push(0);r.push(o)}return r}(M);t.weights=k;var A=new u.default({linkDistance:i,distances:M}).layout();A.forEach((function(t){(0,a.isNaN)(t[0])&&(t[0]=Math.random()*i),(0,a.isNaN)(t[1])&&(t[1]=Math.random()*i)})),t.positions=A,A.forEach((function(t,n){e[n].x=t[0]+r[0],e[n].y=t[1]+r[1]})),A.forEach((function(t){t[0]-=A[p][0],t[1]-=A[p][1]})),t.run();var C,T=t.preventOverlap,I=t.nodeSize,j=t.strictRadial;if(T){var P,N=t.nodeSpacing;P=(0,a.isNumber)(N)?function(){return N}:(0,a.isFunction)(N)?N:function(){return 0},C=I?(0,a.isArray)(I)?function(t){return(I[0]>I[1]?I[0]:I[1])+P(t)}:function(t){return I+P(t)}:function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+P(t):(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+P(t):t.size+P(t):10+P(t)};var D={nodes:e,nodeSizeFunc:C,adjMatrix:g,positions:A,radii:O,height:x,width:b,strictRadial:j,focusID:p,iterations:t.maxPreventOverlapIteration||200,k:A.length/4.5},L=new c.default(D);A=L.layout()}return A.forEach((function(t,n){e[n].x=t[0]+r[0],e[n].y=t[1]+r[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:n}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){for(var t=this.maxIteration,e=this.positions||[],n=this.weights||[],r=this.eIdealDistances||[],i=this.radii||[],o=0;o<=t;o++){var a=o/t;this.oneIteration(a,e,i,r,n)}},e.prototype.oneIteration=function(t,e,n,r,i){var o=1-t,a=this.focusIndex;e.forEach((function(s,u){var c=l(s,[0,0]),f=0===c?0:1/c;if(u!==a){var h=0,d=0,p=0;e.forEach((function(t,e){if(u!==e){var n=l(s,t),o=0===n?0:1/n,a=r[e][u];p+=i[u][e],h+=i[u][e]*(t[0]+a*(s[0]-t[0])*o),d+=i[u][e]*(t[1]+a*(s[1]-t[1])*o)}}));var g=0===n[u]?0:1/n[u];p*=o,p+=t*g*g,h*=o,h+=t*g*s[0]*f,s[0]=h/p,d*=o,d+=t*g*s[1]*f,s[1]=d/p}}))},e.prototype.eIdealDisMatrix=function(){var t=this,e=t.nodes;if(!e)return[];var n=t.distances,r=t.linkDistance,i=t.radii||[],o=t.unitRadius||50,s=[];return n&&n.forEach((function(n,u){var c=[];n.forEach((function(n,s){if(u===s)c.push(0);else if(i[u]===i[s])if("data"===t.sortBy)c.push(n*(Math.abs(u-s)*t.sortStrength)/(i[u]/o));else if(t.sortBy){var l=e[u][t.sortBy]||0,f=e[s][t.sortBy]||0;(0,a.isString)(l)&&(l=l.charCodeAt(0)),(0,a.isString)(f)&&(f=f.charCodeAt(0)),c.push(n*(Math.abs(l-f)*t.sortStrength)/(i[u]/o))}else c.push(n*r/(i[u]/o));else{var h=(r+o)/2;c.push(n*h)}})),s.push(c)})),s},e.prototype.handleInfinity=function(t,e,n){for(var r=t.length,i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(var o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(i=0;i<r;i++)if(i!==e)for(o=0;o<r;o++)if(t[i][o]===1/0){var a=Math.abs(t[e][i]-t[e][o]);a=0===a?1:a,t[i][o]=a}},e.prototype.maxToFocus=function(t,e){for(var n=0,r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},e.prototype.getType=function(){return"radial"},e}(s.Base);e.RadialLayout=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(207),i=function(){function t(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return t.prototype.layout=function(){var t=this.dimension,e=this.distances,n=this.linkDistance;try{var i=r.Matrix.mul(r.Matrix.pow(e,2),-.5),o=i.mean("row"),a=i.mean("column"),s=i.mean();i.add(s).subRowVector(o).subColumnVector(a);var u=new r.SingularValueDecomposition(i),c=r.Matrix.sqrt(u.diagonalMatrix).diagonal();return u.leftSingularVectors.toJSON().map((function(e){return r.Matrix.mul([e],[c]).toJSON()[0].splice(0,t)}))}catch(t){for(var l=[],f=0;f<e.length;f++){var h=Math.random()*n,d=Math.random()*n;l.push([h,d])}return l}},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return t.prototype.layout=function(){var t=this.positions,e=[],n=this.iterations,r=this.width/10;this.maxDisplace=r,this.disp=e;for(var i=0;i<n;i++)t.forEach((function(t,n){e[n]={x:0,y:0}})),this.getRepulsion(),this.updatePositions();return t},t.prototype.getRepulsion=function(){var t=this,e=t.positions,n=t.nodes,r=t.disp,i=t.k,o=t.radii||[];e.forEach((function(a,s){r[s]={x:0,y:0},e.forEach((function(e,u){if(s!==u&&o[s]===o[u]){var c=a[0]-e[0],l=a[1]-e[1],f=Math.sqrt(c*c+l*l);if(0===f){f=1;var h=s>u?1:-1;c=.01*h,l=.01*h}if(f<t.nodeSizeFunc(n[s])/2+t.nodeSizeFunc(n[u])/2){var d=i*i/f;r[s].x+=c/f*d,r[s].y+=l/f*d}}}))}))},t.prototype.updatePositions=function(){var t=this.positions,e=this.disp,n=this.speed,r=this.strictRadial,i=this.focusID,o=this.maxDisplace||this.width/10;r&&e.forEach((function(e,n){var r=t[n][0]-t[i][0],o=t[n][1]-t[i][1],a=Math.sqrt(r*r+o*o),s=o/a,u=-r/a,c=Math.sqrt(e.x*e.x+e.y*e.y),l=Math.acos((s*e.x+u*e.y)/c);l>Math.PI/2&&(l-=Math.PI/2,s*=-1,u*=-1);var f=Math.cos(l)*c;e.x=s*f,e.y=u*f}));var a=this.radii;t.forEach((function(s,u){if(u!==i){var c=Math.sqrt(e[u].x*e[u].x+e[u].y*e[u].y);if(c>0&&u!==i){var l=Math.min(o*(n/800),c);if(s[0]+=e[u].x/c*l,s[1]+=e[u].y/c*l,r){var f=s[0]-t[i][0],h=s[1]-t[i][1],d=Math.sqrt(f*f+h*h);f=f/d*a[u],h=h/d*a[u],s[0]=t[i][0]+f,s[1]=t[i][1]+h}}}}))},t}();e.default=r},function(t,e,n){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return M()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var g={};u(g,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(O([])));y&&y!==n&&r.call(y,o)&&(g=y);var m=p.prototype=h.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,n){var i;this._invoke=function(o,a){function s(){return new n((function(i,s){!function i(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"===e(h)&&r.call(h,"__await")?n.resolve(h.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):n.resolve(h).then((function(t){f.value=t,s(f)}),(function(t){return i("throw",t,s,u)}))}u(c.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:M}}function M(){return{value:void 0,done:!0}}return d.prototype=p,u(m,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,s,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new x(c(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,s,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}("object"===e(t)?t.exports:{});try{regeneratorRuntime=n}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}).call(this,n(120)(t))},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var s=n(308),u=n(42),c=n(53),l=n(33),f=n(167),h=n(309),d=n(316),p=n(318),g=n(60),v=n(78),y=n(321),m=n(322),b=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!==r(e))throw new Error(""+u.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=c.BindingScopeEnum.Transient;else if(e.defaultScope!==c.BindingScopeEnum.Singleton&&e.defaultScope!==c.BindingScopeEnum.Transient&&e.defaultScope!==c.BindingScopeEnum.Request)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=g.id(),this._bindingDictionary=new m.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=new t,s=a([e,n],r).map((function(t){return h.getBindingDictionary(t)})),u=h.getBindingDictionary(o);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return s.forEach((function(t){c(t,u)})),o},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i(this,void 0,void 0,(function(){var e,n,r,i,a;return o(this,(function(o){switch(o.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,o.label=1;case 1:return n<r.length?(i=r[n],a=e(i.id),[4,i.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||c.BindingScopeEnum.Transient,n=new s.Binding(t,e);return this._bindingDictionary.add(t,n),new p.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(u.CANNOT_UNBIND+" "+v.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new m.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,l.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=h.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(y.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(u.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,c.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,c.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,l.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,c.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,c.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,l.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw new Error(u.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=h.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),d.resolve(n)}},t}();e.Container=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(53),i=n(60),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(310),i=n(42),o=n(53),a=n(33),s=n(168),u=n(78),c=n(311),l=n(48),f=n(312),h=n(313),d=n(315),p=n(170);function g(t){return t._bindingDictionary}function v(t,e,n,o,a){var s=y(n.container,a.serviceIdentifier),c=[];return s.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),s=y(n.container,a.serviceIdentifier)),c=e?s:s.filter((function(t){var e=new d.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=u.getServiceIdentifierAsString(t),s=i.NOT_REGISTERED;throw s+=u.listMetadataForTarget(a,n),s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;a=u.getServiceIdentifierAsString(t),s=i.AMBIGUOUS_MATCH+" "+a;throw s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s)}}(a.serviceIdentifier,c,a,n.container),c}function y(t,e){var n=[],r=g(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=y(t.parent,e)),n}e.getBindingDictionary=g,e.plan=function(t,e,n,r,g,y,m,b){void 0===b&&(b=!1);var x=new c.Context(e),_=function(t,e,n,r,i,o){var s=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,u=new l.Metadata(s,n),c=new p.Target(e,r,n,u);if(void 0!==i){var f=new l.Metadata(i,o);c.metadata.push(f)}return c}(n,r,g,"",y,m);try{return function t(e,n,r,a,s,u){var c,l;if(null===s){c=v(e,n,a,null,u),l=new d.Request(r,a,null,c,u);var p=new f.Plan(a,l);a.addPlan(p)}else c=v(e,n,a,s,u),l=s.addChildRequest(u.serviceIdentifier,c,u);c.forEach((function(n){var r=null;if(u.isArray())r=l.addChildRequest(n.serviceIdentifier,n,u);else{if(n.cache)return;r=l}if(n.type===o.BindingTypeEnum.Instance&&null!==n.implementationType){var s=h.getDependencies(e,n.implementationType);if(!a.container.options.skipBaseClassChecks){var c=h.getBaseClassDependencyCount(e,n.implementationType);if(s.length<c){var f=i.ARGUMENTS_LENGTH_MISMATCH(h.getFunctionName(n.implementationType));throw new Error(f)}}s.forEach((function(n){t(e,!1,n.serviceIdentifier,a,r,n)}))}}))}(t,b,g,x,null,_),x}catch(t){throw s.isStackOverflowExeption(t)&&x.plan&&u.circularDependencyToException(x.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new l.Metadata(n,r)),a=new c.Context(t);return new d.Request(e,a,null,[],i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0;e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(60),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;var r=function(t,e){this.parentContext=t,this.rootRequest=e};e.Plan=r},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(169),o=n(42),a=n(53),s=n(33),u=n(78);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return u.getFunctionName}});var c=n(170);function l(t,e,n,i){var s=t.getConstructorMetadata(n),u=s.compilerGeneratedMetadata;if(void 0===u){var l=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(l)}var d=s.userGeneratedMetadata,p=Object.keys(d),g=0===n.length&&p.length>0,v=p.length>n.length,y=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var s=f(a,t,e,n,r);null!==s&&o.push(s)}return o}(i,e,u,d,g||v?p.length:n.length),m=function t(e,n){for(var i=e.getPropertiesMetadata(n),o=[],s=Object.keys(i),u=0,l=s;u<l.length;u++){var f=l[u],d=i[f],p=h(i[f]),g=p.targetName||f,v=p.inject||p.multiInject,y=new c.Target(a.TargetTypeEnum.ClassProperty,g,v);y.metadata=d,o.push(y)}var m=Object.getPrototypeOf(n.prototype).constructor;if(m!==Object){var b=t(e,m);o=r(r([],o),b)}return o}(t,n);return r(r([],y),m)}function f(t,e,n,r,s){var u=s[t.toString()]||[],l=h(u),f=!0!==l.unmanaged,d=r[t],p=l.inject||l.multiInject;if((d=p||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),f){if(!e&&(d===Object||d===Function||void 0===d)){var g=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(g)}var v=new c.Target(a.TargetTypeEnum.ConstructorArgument,l.targetName,d);return v.metadata=u,v}return null}function h(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[s.INJECT_TAG],multiInject:e[s.MULTI_INJECT_TAG],targetName:e[s.NAME_TAG],unmanaged:e[s.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return l(t,u.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=l(e,u.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===s.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var r=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(60),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(42),i=n(53),o=n(168),a=n(78),s=n(317),u=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}};e.resolve=function(t){return function t(e){return function(n){n.parentContext.setCurrentRequest(n);var o=n.bindings,c=n.childRequests,l=n.target&&n.target.isArray(),f=!(n.parentRequest&&n.parentRequest.target&&n.target&&n.parentRequest.target.matchesArray(n.target.serviceIdentifier));if(l&&f)return c.map((function(n){return t(e)(n)}));var h=null;if(!n.target.isOptional()||0!==o.length){var d=o[0],p=d.scope===i.BindingScopeEnum.Singleton,g=d.scope===i.BindingScopeEnum.Request;if(p&&d.activated)return d.cache;if(g&&null!==e&&e.has(d.id))return e.get(d.id);if(d.type===i.BindingTypeEnum.ConstantValue)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Function)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Constructor)h=d.implementationType;else if(d.type===i.BindingTypeEnum.DynamicValue&&null!==d.dynamicValue)h=u("toDynamicValue",d.serviceIdentifier,(function(){return d.dynamicValue(n.parentContext)}));else if(d.type===i.BindingTypeEnum.Factory&&null!==d.factory)h=u("toFactory",d.serviceIdentifier,(function(){return d.factory(n.parentContext)}));else if(d.type===i.BindingTypeEnum.Provider&&null!==d.provider)h=u("toProvider",d.serviceIdentifier,(function(){return d.provider(n.parentContext)}));else{if(d.type!==i.BindingTypeEnum.Instance||null===d.implementationType){var v=a.getServiceIdentifierAsString(n.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+v)}h=s.resolveInstance(d.implementationType,c,t(e))}return"function"==typeof d.onActivation&&(h=d.onActivation(n.parentContext,h)),p&&(d.cache=h,d.activated=!0),g&&null!==e&&!e.has(d.id)&&e.set(d.id,h),h}}}(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(42),o=n(53),a=n(33);e.resolveInstance=function(t,e,n){var s,u,c=null;if(e.length>0){var l=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n);u=l,c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((s=t).bind.apply(s,r([void 0],u))),e,n)}else c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(42),i=n(53),o=n(319),a=n(171),s=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(320),i=n(122),o=n(123),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(53),i=n(171),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var r=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(42),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(60),i=function(t){this.id=r.id(),this.registry=t};e.ContainerModule=i;var o=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(42),i=n(33);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(48),i=n(56);e.tagged=function(t,e){return function(n,o,a){var s=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,s):i.tagProperty(n,o,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(33),i=n(48),o=n(56);e.named=function(t){return function(e,n,a){var s=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(33),i=n(48),o=n(56);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(33),i=n(48),o=n(56);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(33),i=n(48),o=n(56);e.multiInject=function(t){return function(e,n,a){var s=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(33),i=n(48),o=n(56);e.targetName=function(t){return function(e,n,a){var s=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(42),i=n(33),o=n(48);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0;e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Symbol.for("INJECTION");function i(t,e,n,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(r,this,e)&&Reflect.defineMetadata(r,n(),this,e),Reflect.hasMetadata(r,this,e)?Reflect.getMetadata(r,this,e):n()},set:function(t){Reflect.defineMetadata(r,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,r){return function(o,a){i(o,a,(function(){return t.getNamed(n,r)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,r,o){return function(a,s){i(a,s,(function(){return t.getTagged(n,r,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.getAll(n)}),e)}}}},function(t,e,n){var r=n(166);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){var e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e}},function(t,e){t.exports=function(t,e){var n=new Float32Array(2);return n[0]=t,n[1]=e,n}},function(t,e){t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},function(t,e,n){t.exports=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r*Math.max(1,Math.abs(i),Math.abs(a))};var r=n(188)},function(t,e){t.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},function(t,e,n){t.exports=n(124)},function(t,e,n){t.exports=n(192)},function(t,e,n){t.exports=n(193)},function(t,e){t.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){var r=Math.cos(n),i=Math.sin(n),o=e[0],a=e[1];return t[0]=o*r-a*i,t[1]=o*i+a*r,t}},function(t,e){t.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}},function(t,e,n){t.exports=n(194)},function(t,e,n){t.exports=n(195)},function(t,e,n){t.exports=n(196)},function(t,e,n){t.exports=n(197)},function(t,e){t.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t}},function(t,e){t.exports=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}},function(t,e){t.exports=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}},function(t,e){t.exports=function(t,e){e=e||1;var n=2*Math.random()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}},function(t,e,n){t.exports=function(t,e,n,i,o,a){var s,u;e||(e=2);n||(n=0);u=i?Math.min(i*e+n,t.length):t.length;for(s=n;s<u;s+=e)r[0]=t[s],r[1]=t[s+1],o(r,r,a),t[s]=r[0],t[s+1]=r[1];return t};var r=n(189)()},function(t,e){t.exports=function(t,e,n){var r=e[0]*e[0]+e[1]*e[1];if(r>n*n){var i=Math.sqrt(r);t[0]=e[0]/i*n,t[1]=e[1]/i*n}else t[0]=e[0],t[1]=e[1];return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.clusterBundle=e.clusterCode=e.fruchtermanBundle=e.fruchtermanCode=void 0,e.fruchtermanCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass Fruchterman {\n @in @out\n u_Data: vec4[];\n @in\n u_K: float;\n @in\n u_K2: float;\n \n @in\n u_Center: vec2;\n @in\n u_Gravity: float;\n @in\n u_ClusterGravity: float;\n @in\n u_Speed: float;\n @in\n u_MaxDisplace: float;\n @in\n u_Clustering: float;\n @in\n u_AttributeArray: vec4[];\n @in\n u_ClusterCenters: vec4[];\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = (xDist * xDist + yDist * yDist) + 0.01;\n let param = this.u_K2 / dist;\n \n if (dist > 0.0) {\n dx += param * xDist;\n dy += param * yDist;\n if (xDist == 0 && yDist == 0) {\n const sign = i < j ? 1 : -1;\n dx += param * sign;\n dy += param * sign;\n }\n }\n }\n }\n return [dx, dy];\n }\n calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // \n let dx = 0, dy = 0;\n const vx = currentNode[0] - this.u_Center[0];\n const vy = currentNode[1] - this.u_Center[1];\n const gf = 0.01 * this.u_K * this.u_Gravity;\n dx = gf * vx;\n dy = gf * vy;\n if (this.u_Clustering == 1) {\n const clusterIdx = int(nodeAttributes[0]);\n const center = this.u_ClusterCenters[clusterIdx];\n const cvx = currentNode[0] - center[0];\n const cvy = currentNode[1] - center[1];\n const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;\n const parma = this.u_K * this.u_ClusterGravity / dist;\n dx += parma * cvx;\n dy += parma * cvy;\n }\n return [dx, dy];\n }\n calcAttractive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n const arr_offset = int(floor(currentNode[2] + 0.5));\n const length = int(floor(currentNode[3] + 0.5));\n const node_buffer: vec4;\n for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + p;\n // when arr_idx % 4 == 0 update currentNodedx_buffer\n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)];\n }\n const float_j = buf_offset == 0 ? node_buffer[0] :\n buf_offset == 1 ? node_buffer[1] :\n buf_offset == 2 ? node_buffer[2] :\n node_buffer[3];\n const nextNode = this.u_Data[int(float_j)];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;\n let attractiveF = dist / this.u_K;\n \n if (dist > 0.0) {\n dx -= xDist * attractiveF;\n dy -= yDist * attractiveF;\n if (xDist == 0 && yDist == 0) {\n const sign = i < int(float_j) ? 1 : -1;\n dx -= sign * attractiveF;\n dy -= sign * attractiveF;\n }\n }\n }\n return [dx, dy];\n }\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n let dx = 0, dy = 0;\n if (i >= VERTEX_COUNT) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // [gravity, fx, fy, 0]\n const nodeAttributes = this.u_AttributeArray[i];\n\n if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {\n // the node is fixed\n this.u_Data[i] = [\n nodeAttributes[1],\n nodeAttributes[2],\n currentNode[2],\n currentNode[3]\n ];\n return;\n }\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n dx += repulsive[0];\n dy += repulsive[1];\n // attractive\n const attractive = this.calcAttractive(i, currentNode);\n dx += attractive[0];\n dy += attractive[1];\n // gravity\n const gravity = this.calcGravity(currentNode, nodeAttributes);\n dx -= gravity[0];\n dy -= gravity[1];\n // speed\n dx *= this.u_Speed;\n dy *= this.u_Speed;\n\n // move\n const distLength = sqrt(dx * dx + dy * dy);\n if (distLength > 0.0) {\n const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);\n this.u_Data[i] = [\n currentNode[0] + dx / distLength * limitedDist,\n currentNode[1] + dy / distLength * limitedDist,\n currentNode[2],\n currentNode[3]\n ];\n }\n }\n}\n",e.fruchtermanBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2<f32>;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2<f32>","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.clusterCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst VERTEX_COUNT;\nconst CLUSTER_COUNT;\n@numthreads(1, 1, 1)\nclass CalcCenter {\n @in\n u_Data: vec4[];\n @in\n u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]\n @in @out\n u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]\n @main\n compute() {\n const i = globalInvocationID.x;\n const center = this.u_ClusterCenters[i];\n let sumx = 0;\n let sumy = 0;\n let count = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n const attributes = this.u_NodeAttributes[j];\n const clusterIdx = int(attributes[0]);\n const vertex = this.u_Data[j];\n if (clusterIdx == i) {\n sumx += vertex.x;\n sumy += vertex.y;\n count += 1;\n }\n }\n this.u_ClusterCenters[i] = [\n sumx / count,\n sumy / count,\n count,\n i\n ];\n }\n}\n",e.clusterBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.aveMovementBundle=e.aveMovementCode=e.gForceBundle=e.gForceCode=void 0,e.gForceCode="\nimport { globalInvocationID } from 'g-webgpu';\n\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\nconst SHIFT_20 = 1048576;\n\n@numthreads(1, 1, 1)\nclass GGForce {\n @in @out\n u_Data: vec4[];\n\n @in\n u_damping: float;\n \n @in\n u_maxSpeed: float;\n\n @in\n u_minMovement: float;\n\n @in\n u_AveMovement: vec4[];\n\n @in\n u_coulombDisScale: float;\n\n @in\n u_factor: float;\n\n @in\n u_NodeAttributeArray1: vec4[];\n\n @in\n u_NodeAttributeArray2: vec4[];\n\n @in\n u_interval: float;\n\n unpack_float(packedValue: float): ivec2 {\n const packedIntValue = int(packedValue);\n const v0 = packedIntValue / SHIFT_20;\n return [v0, packedIntValue - v0 * SHIFT_20];\n }\n\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let ax = 0, ay = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const vx = currentNode[0] - nextNode[0];\n const vy = currentNode[1] - nextNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const n_dist = (dist + 0.1) * this.u_coulombDisScale;\n const direx = vx / dist;\n const direy = vy / dist;\n const attributesi = this.u_NodeAttributeArray1[i];\n const attributesj = this.u_NodeAttributeArray1[j];\n const massi = attributesi[0];\n const nodeStrengthi = attributesi[2];\n const nodeStrengthj = attributesj[2];\n const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;\n // const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);\n const param = nodeStrength * this.u_factor / (n_dist * n_dist);\n ax += direx * param;\n ay += direy * param;\n }\n }\n return [ax, ay];\n }\n\n calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {\n // note: attributes2 = [centerX, centerY, gravity, 0]\n\n const vx = currentNode[0] - attributes2[0];\n const vy = currentNode[1] - attributes2[1];\n \n const ax = vx * attributes2[2];\n const ay = vy * attributes2[2];\n \n return [ax, ay];\n }\n\n calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {\n // note: attributes1 = [mass, degree, nodeSterngth, 0]\n\n const mass = attributes1[0];\n let ax = 0, ay = 0;\n // const arr_offset = int(floor(currentNode[2] + 0.5));\n // const length = int(floor(currentNode[3] + 0.5));\n\n const compressed = this.unpack_float(currentNode[2]);\n const length = compressed[0];\n const arr_offset = compressed[1];\n\n const node_buffer: vec4;\n for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置\n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4,\n }\n\n let float_j: float = node_buffer[0];\n\n const nextNode = this.u_Data[int(float_j)];\n const vx = nextNode[0] - currentNode[0];\n const vy = nextNode[1] - currentNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const direx = vx / dist;\n const direy = vy / dist;\n const edgeLength = node_buffer[1];\n const edgeStrength = node_buffer[2];\n const diff: float = edgeLength - dist;//edgeLength\n // const param = diff * this.u_stiffness / mass; //\n const param = diff * edgeStrength / mass; // \n ax -= direx * param;\n ay -= direy * param;\n }\n return [ax, ay];\n }\n\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n const movement = u_AveMovement[0];\n let ax = 0, ay = 0;\n\n if (i >= VERTEX_COUNT || movement.x < u_minMovement) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // 每个节点属性占两个数组中各一格\n // [mass, degree, nodeStrength, fx]\n const nodeAttributes1 = this.u_NodeAttributeArray1[i];\n // [centerX, centerY, centerGravity, fy]\n const nodeAttributes2 = this.u_NodeAttributeArray2[i];\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n ax += repulsive[0];\n ay += repulsive[1];\n\n // attractive\n const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);\n ax += attractive[0];\n ay += attractive[1];\n\n // gravity\n const gravity = this.calcGravity(i, currentNode, nodeAttributes2);\n ax -= gravity[0];\n ay -= gravity[1];\n\n // speed\n const param = this.u_interval * this.u_damping;\n let vx = ax * param;\n let vy = ay * param;\n const vlength = sqrt(vx * vx + vy * vy) + 0.0001;\n if (vlength > this.u_maxSpeed) {\n const param2 = this.u_maxSpeed / vlength;\n vx = param2 * vx;\n vy = param2 * vy;\n }\n\n // move\n if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {\n this.u_Data[i] = [\n nodeAttributes1[3],\n nodeAttributes2[3],\n currentNode[2],\n 0\n ];\n } else {\n const distx = vx * this.u_interval;\n const disty = vy * this.u_interval;\n const distLength = sqrt(distx * distx + disty * disty);\n this.u_Data[i] = [\n currentNode[0] + distx,\n currentNode[1] + disty,\n currentNode[2],\n distLength\n ];\n }\n \n // the avarage move distance\n // need to share memory\n \n }\n}\n",e.gForceBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {float mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.aveMovementCode="\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass CalcAveMovement {\n @in\n u_Data: vec4[];\n @in\n u_iter: float;\n @in @out\n u_AveMovement: vec4[];\n @main\n compute() {\n let movement = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n const vertex = this.u_Data[j];\n movement += vertex[3];\n }\n movement = movement / float(VERTEX_COUNT);\n this.u_AveMovement[0] = [movement, 0, 0, 0];\n }\n}\n",e.aveMovementBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n);r=r<1e-4?1e-4:r;var i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var n=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/n,ry:(this.ry*this.mass+e.ry*e.mass)/n,mass:n,degree:this.degree+e.degree})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))},t}();e.default=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var u=a(n(125)),c=s(n(375)),l=s(n(377)),f=n(118);e.default=function(t,e){var n=t.nodes,i=t.edges,o=e.width,a=e.height;if(!(null==n?void 0:n.length))return Promise.resolve();var s=[];n.forEach((function(t){if(i.filter((function(e){return e.source===t.id||e.target===t.id})).length>1){var e=r({},t);delete e.size,s.push(e)}}));var h=[];i.forEach((function(t){var e=s.find((function(e){return e.id===t.source})),n=s.find((function(e){return e.id===t.target}));e&&n&&h.push(t)}));var d=new f.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:s,edges:h}).nodes;n.forEach((function(t){var e=(d||[]).find((function(e){return e.id===t.id}));t.x=(null==e?void 0:e.x)||o/2,t.y=(null==e?void 0:e.y)||a/2}));var p=JSON.parse(JSON.stringify(n)),g=JSON.parse(JSON.stringify(i)),v=u.forceSimulation().nodes(p).force("link",u.forceLink(g).id((function(t){return t.id})).distance((function(t){return h.find((function(e){return e.source===t.source&&e.target===t.target}))?30:20}))).force("charge",u.forceManyBody()).force("center",u.forceCenter(o/2,a/2)).force("x",u.forceX(o/2)).force("y",u.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001);return new Promise((function(t){v.on("end",(function(){n.forEach((function(t){var e=p.find((function(e){return e.id===t.id}));e&&(t.x=e.x,t.y=e.y)}));var r=Math.min.apply(Math,n.map((function(t){return t.x}))),s=Math.max.apply(Math,n.map((function(t){return t.x}))),u=Math.min.apply(Math,n.map((function(t){return t.y}))),f=Math.max.apply(Math,n.map((function(t){return t.y}))),h=o/(s-r),d=a/(f-u);n.forEach((function(t){void 0!==t.x&&h<1&&(t.x=(t.x-r)*h),void 0!==t.y&&d<1&&(t.y=(t.y-u)*d)})),n.forEach((function(t){t.sizeTemp=t.size,t.size=[10,10]})),(0,l.default)(n,i),n.forEach((function(t){t.size=t.sizeTemp||[],delete t.sizeTemp})),(0,c.default)({nodes:n,edges:i},e),t()}))}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(376));e.default=function(t,e){if(!t.nodes||0===t.nodes.length)return t;var n=e.width,r=e.height,o=e.nodeMinGap,a=1e4,s=1e4;t.nodes.forEach((function(t){var e=t.size[0]||50,n=t.size[1]||50;a=Math.min(e,a),s=Math.min(n,s)}));var u=new i.default;u.init(n,r,{CELL_H:s,CELL_W:a}),t.nodes.forEach((function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)}));for(var c=0;c<t.nodes.length;c++){var l=t.nodes[c],f=u.findGridByNodeId(l.id);if(!f)throw new Error("can not find node cell");var h=f.column,d=f.row;if(l.size[0]+o>a){for(var p=v=Math.ceil((l.size[0]+o)/a)-1,g=0;g<v;g++){if(!(u.additionColumn.indexOf(h+g+1)>-1)||u.cells[h+g+1][d].node)break;p--}u.insertColumn(h,p)}if(l.size[1]+o>s){var v;for(p=v=Math.ceil((l.size[1]+o)/s)-1,g=0;g<v;g++){if(!(u.additionRow.indexOf(d+g+1)>-1)||u.cells[h][d+g+1].node)break;p--}u.insertRow(d,p)}}for(c=0;c<u.columnNum;c++){var y=function(e){var n=u.cells[c][e];if(n.node){var r=t.nodes.find((function(t){var e;return t.id===(null===(e=null==n?void 0:n.node)||void 0===e?void 0:e.id)}));r&&(r.x=n.x+r.size[0]/2,r.y=n.y+r.size[1]/2)}};for(g=0;g<u.rowNum;g++)y(g)}}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(e,n,r){this.cells=[],this.CELL_W=r.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=r.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(n/this.CELL_H),t.MIN_DIST=Math.pow(e,2)+Math.pow(n,2);for(var i=0;i<this.columnNum;i++){for(var o=[],a=0;a<this.rowNum;a++){var s={dx:i,dy:a,x:i*this.CELL_W,y:a*this.CELL_H,occupied:!1};o.push(s)}this.cells.push(o)}},t.prototype.findGridByNodeId=function(t){for(var e,n,r=0;r<this.columnNum;r++)for(var i=0;i<this.rowNum;i++)if(this.cells[r][i].node&&(null===(n=null===(e=this.cells[r][i])||void 0===e?void 0:e.node)||void 0===n?void 0:n.id)===t)return{column:r,row:i};return null},t.prototype.sqdist=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},t.prototype.occupyNearest=function(e){for(var n,r=t.MIN_DIST,i=null,o=0;o<this.columnNum;o++)for(var a=0;a<this.rowNum;a++)!this.cells[o][a].occupied&&(n=this.sqdist(e,this.cells[o][a]))<r&&(r=n,i=this.cells[o][a]);return i&&(i.occupied=!0),i},t.prototype.insertColumn=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++){this.cells[n+this.columnNum]=[];for(var i=0;i<this.rowNum;i++)this.cells[n+this.columnNum][i]={dx:n,dy:i,x:n*this.CELL_W,y:i*this.CELL_H,occupied:!1,node:null}}for(n=this.columnNum-1;n>t;n--)for(i=0;i<this.rowNum;i++)this.cells[n+e][i]=r(r({},this.cells[n][i]),{x:(n+e)*this.CELL_W,y:i*this.CELL_H}),this.cells[n][i]={x:n*this.CELL_W,y:i*this.CELL_H,occupied:!0,node:null};for(i=0;i<this.additionColumn.length;i++)this.additionColumn[i]>=t&&(this.additionColumn[i]+=e);for(n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}},t.prototype.insertRow=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++)for(var i=0;i<this.columnNum;i++)this.cells[i][n+this.rowNum]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(i=0;i<this.columnNum;i++)for(n=this.rowNum-1;n>t;n--)this.cells[i][n+e]=r(r({},this.cells[i][n]),{dx:i,dy:n+e,x:i*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(i=0;i<e;i++)this.additionRow.push(t+i+1);this.rowNum+=e}},t.prototype.getNodes=function(){for(var t=[],e=0;e<this.columnNum;e++)for(var n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=1.5707963267948966,i=new Map,o=.8;function a(t,e){var n=(i.get(t.id)||[]).find((function(t){return t.source===e.id||t.target===e.id})),o=t.size[0]*t.size[1],a=e.size[0]*e.size[1],s=o>a?e:t,u=o>a?t:e,c=s.x-s.size[0]/2,l=s.y-s.size[1]/2,f=s.x+s.size[0]/2,h=s.y+s.size[1]/2,d=u.x-u.size[0]/2,p=u.y-u.size[1]/2,g=u.x+u.size[0]/2,v=u.y+u.size[1]/2,y=s.x,m=s.y,b=u.x,x=u.y,_=0,w=0;if(f>=d&&g>=c&&h>=p&&v>=l){0===(w=Math.sqrt(Math.pow(b-y,2)+Math.pow(x-m,2)))&&(w=1e-7),_=10/w*100+((f<g?f:g)-(c>d?c:d))*((h<v?h:v)-(l>p?l:p)),_*=1e7}else{var E=!1,S=function(t,e,n){var i=t.x-t.size[0]/2,o=t.y-t.size[1]/2,a=t.x+t.size[0]/2,s=t.y+t.size[1]/2,u=e.x-e.size[0]/2,c=e.y-e.size[1]/2,l=e.x+e.size[0]/2,f=e.y+e.size[1]/2,h=t.x,d=t.y,p=e.x,g=e.y,v=p-h,y=Math.atan2(v,g-d),m=0,b=0,x=0,_=0;y>r?(b=o-f,m=u-a,x=parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)),_=parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2))):x=_=0<y&&y<=r?(b=c-s)>(m=u-a)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):y<-r?(b=o-f)>(m=-(l-i))?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):(b=c-s)>(m=Math.abs(v)>(a-i)/2?i-l:v)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m&&0!==y?(m/Math.sin(y)).toFixed(2):b.toFixed(2));var w=parseFloat(y.toFixed(2)),E=n;return n&&(E=1.1780972450961724<w&&w<1.9634954084936207),{distance:Math.abs(x<_?x:_),isHoriz:E}}(s,u,E);w=S.distance,E=S.isHoriz,w<=10?_+=0!==w?n?10+1e7/w:10+1e8/w:1e7:(_+=w,n&&(_+=w*w))}return _}function s(t){for(var e=0,n=0;n<t.length;n++){var r=t[n];(r.x<0||r.y<0||r.x>1200||r.y>800)&&(e+=1e12);for(var i=n+1;i<t.length;i++)e+=a(r,t[i])}return e}function u(t,e,n,r){var i=new Map;n.forEach((function(t,e){i.set(t.id,t)}));var o=r.filter((function(e){return e.source===t.id||e.target===t.id}))||[],a=[];o.forEach((function(e){var n=e.source===t.id?e.target:e.source,r=i.get(n);r&&a.push(r)}));for(var s=!0,u=0;u<a.length;u++){var c=a[u],l=180*Math.atan((t.y-c.y)/(c.x-t.y)),f=180*Math.atan((e.y-c.y)/(c.x-e.y)),h=l>70&&l<110,d=f>70&&f<110;if((l<30||l>150)&&!(f<30||f>150)||l*f<0){s=!1;break}if(h&&!d||l*f<0){s=!1;break}if((c.x-t.x)*(c.x-e.x)<0){s=!1;break}if((c.y-t.y)*(c.y-e.y)<0){s=!1;break}}return s}function c(t,e){for(var n=!1,r=[10,-10,0,0],i=[0,0,10,-10],a=0;a<t.length;++a)for(var c=t[a],f=l(c,t),h=0;h<r.length;h++){if(u(c,{x:c.x+r[h],y:c.y+i[h]},t,e)){c.x+=r[h],c.y+=i[h];var d=l(c,t),p=Math.random();d<f||p<o&&p>.1?(f=d,n=!0):(c.x-=r[h],c.y-=i[h])}}return o>.1&&(o*=.5),n?s(t):0}function l(t,e){var n=0;(t.x<0||t.y<0||t.x+t.size[0]+20>1200||t.y+t.size[1]+20>800)&&(n+=1e12);for(var r=0;r<e.length;++r)t.id!==e[r].id&&(n+=a(t,e[r]));return n}e.default=function(t,e){if(0===t.length)return{nodes:t,edges:e};t.forEach((function(t){var n=e.filter((function(e){return e.source===t.id||e.target===t.id}));i.set(t,n)})),t.sort((function(t,e){var n,r;return(null===(n=i.get(t.id))||void 0===n?void 0:n.length)-(null===(r=i.get(e.id))||void 0===r?void 0:r.length)}));for(var n=s(t),r=20,o=1,a=0,u=0;r>0&&!(++u>=50);){var l=c(t,e);0!==l&&(a=l),o=a-n,n=a,0===o?--r:r=20}return t.forEach((function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2})),{nodes:t,edges:e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Layouts=e.Layout=void 0;var r=n(142),i=n(146),o=n(147),a=n(148),s=n(149),u=n(150),c=n(118),l=n(159),f=n(160),h=n(161),d=n(162),p=n(163),g=n(201),v=n(202),y=n(203),m=n(204),b=n(205),x=function(){function t(t){var e=(0,r.getLayoutByName)(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.layoutInstance.init(t)},t.prototype.execute=function(){this.layoutInstance.execute()},t.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},t.prototype.destroy=function(){return this.layoutInstance.destroy()},t}();e.Layout=x,e.Layouts={force:s.ForceLayout,fruchterman:d.FruchtermanLayout,forceAtlas2:m.ForceAtlas2Layout,gForce:a.GForceLayout,dagre:c.DagreLayout,circular:u.CircularLayout,radial:l.RadialLayout,concentric:f.ConcentricLayout,grid:i.GridLayout,mds:h.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:y.ComboCombinedLayout,random:o.RandomLayout,"gForce-gpu":g.GForceGPULayout,"fruchterman-gpu":p.FruchtermanGPULayout,er:b.ERLayout}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,n){"use strict";n.r(e),n.d(e,"G6GraphEvent",(function(){return He})),n.d(e,"G6Event",(function(){return rr})),n.d(e,"Node",(function(){return vn})),n.d(e,"Edge",(function(){return gn})),n.d(e,"Combo",(function(){return yn})),n.d(e,"Hull",(function(){return Un})),n.d(e,"registerNode",(function(){return hr})),n.d(e,"registerCombo",(function(){return pr})),n.d(e,"AbstractGraph",(function(){return Wn})),n.d(e,"registerEdge",(function(){return dr})),n.d(e,"registerBehavior",(function(){return gr})),n.d(e,"AbstractLayout",(function(){return lr})),n.d(e,"AbstractEvent",(function(){return fr})),n.d(e,"BaseGlobal",(function(){return vr})),n.d(e,"Graph",(function(){return Ai})),n.d(e,"TreeGraph",(function(){return Ii})),n.d(e,"Util",(function(){return oi})),n.d(e,"Layout",(function(){return Hr.Layouts})),n.d(e,"TreeLayout",(function(){return si})),n.d(e,"registerLayout",(function(){return ui})),n.d(e,"Global",(function(){return Gr})),n.d(e,"Minimap",(function(){return Gu})),n.d(e,"Grid",(function(){return Fu})),n.d(e,"Bundling",(function(){return zu})),n.d(e,"Menu",(function(){return Uu})),n.d(e,"Fisheye",(function(){return Vu})),n.d(e,"Algorithm",(function(){return Bu})),n.d(e,"ToolBar",(function(){return Wu})),n.d(e,"Tooltip",(function(){return Xu})),n.d(e,"TimeBar",(function(){return Yu})),n.d(e,"ImageMinimap",(function(){return Hu})),n.d(e,"EdgeFilterLens",(function(){return qu})),n.d(e,"SnapLine",(function(){return Ku})),n.d(e,"Legend",(function(){return Zu})),n.d(e,"Arrow",(function(){return ir})),n.d(e,"Marker",(function(){return or})),n.d(e,"Shape",(function(){return ar})),n.d(e,"version",(function(){return $u}));var r={};n.r(r),n.d(r,"getAdjMatrix",(function(){return x})),n.d(r,"breadthFirstSearch",(function(){return A})),n.d(r,"connectedComponent",(function(){return T})),n.d(r,"getDegree",(function(){return j})),n.d(r,"getInDegree",(function(){return P})),n.d(r,"getOutDegree",(function(){return N})),n.d(r,"detectCycle",(function(){return F})),n.d(r,"detectDirectedCycle",(function(){return Pt})),n.d(r,"detectAllCycles",(function(){return B})),n.d(r,"detectAllDirectedCycle",(function(){return R})),n.d(r,"detectAllUndirectedCycle",(function(){return L})),n.d(r,"depthFirstSearch",(function(){return D})),n.d(r,"dijkstra",(function(){return G})),n.d(r,"findAllPath",(function(){return W})),n.d(r,"findShortestPath",(function(){return V})),n.d(r,"floydWarshall",(function(){return X})),n.d(r,"labelPropagation",(function(){return Y})),n.d(r,"louvain",(function(){return tt})),n.d(r,"iLouvain",(function(){return et})),n.d(r,"kCore",(function(){return nt})),n.d(r,"kMeans",(function(){return it})),n.d(r,"cosineSimilarity",(function(){return ot})),n.d(r,"nodesCosineSimilarity",(function(){return at})),n.d(r,"minimumSpanningTree",(function(){return ht})),n.d(r,"pageRank",(function(){return dt})),n.d(r,"getNeighbors",(function(){return O})),n.d(r,"Stack",(function(){return jt})),n.d(r,"GADDI",(function(){return It})),n.d(r,"default",(function(){return Nt}));var i={};n.r(i),n.d(i,"compare",(function(){return Lt})),n.d(i,"getLineIntersect",(function(){return Bt})),n.d(i,"getRectIntersectByPoint",(function(){return Ft})),n.d(i,"getCircleIntersectByPoint",(function(){return Gt})),n.d(i,"getEllipseIntersectByPoint",(function(){return zt})),n.d(i,"applyMatrix",(function(){return Ut})),n.d(i,"invertMatrix",(function(){return Vt})),n.d(i,"getCircleCenterByPoints",(function(){return Wt})),n.d(i,"distance",(function(){return Xt})),n.d(i,"scaleMatrix",(function(){return Yt})),n.d(i,"floydWarshall",(function(){return Ht})),n.d(i,"getAdjMatrix",(function(){return qt})),n.d(i,"translate",(function(){return Kt})),n.d(i,"move",(function(){return Zt})),n.d(i,"scale",(function(){return Qt})),n.d(i,"rotate",(function(){return $t})),n.d(i,"getDegree",(function(){return Jt})),n.d(i,"isPointInPolygon",(function(){return ee})),n.d(i,"intersectBBox",(function(){return ne})),n.d(i,"isPolygonsIntersect",(function(){return re})),n.d(i,"Line",(function(){return ie})),n.d(i,"getBBoxBoundLine",(function(){return oe})),n.d(i,"itemIntersectByLine",(function(){return se})),n.d(i,"fractionToLine",(function(){return ue})),n.d(i,"getPointsCenter",(function(){return ce})),n.d(i,"squareDist",(function(){return le})),n.d(i,"pointLineSquareDist",(function(){return fe})),n.d(i,"isPointsOverlap",(function(){return he})),n.d(i,"pointRectSquareDist",(function(){return de})),n.d(i,"pointLineDistance",(function(){return pe})),n.d(i,"lerp",(function(){return ge}));var o={};n.r(o),n.d(o,"getBBox",(function(){return je})),n.d(o,"getLoopCfgs",(function(){return Pe})),n.d(o,"getLabelPosition",(function(){return Ne})),n.d(o,"traverseTree",(function(){return Le})),n.d(o,"traverseTreeUp",(function(){return Re})),n.d(o,"getLetterWidth",(function(){return Be})),n.d(o,"getTextSize",(function(){return Fe})),n.d(o,"plainCombosToTrees",(function(){return Ge})),n.d(o,"reconstructTree",(function(){return ze})),n.d(o,"getComboBBox",(function(){return Ue})),n.d(o,"shouldRefreshEdge",(function(){return Ve})),n.d(o,"cloneBesidesImg",(function(){return We}));var a={};n.r(a),n.d(a,"uniqueId",(function(){return qe})),n.d(a,"formatPadding",(function(){return Ke})),n.d(a,"cloneEvent",(function(){return Ze})),n.d(a,"isViewportChanged",(function(){return Qe})),n.d(a,"isNaN",(function(){return $e})),n.d(a,"calculationItemsBBox",(function(){return Je})),n.d(a,"processParallelEdges",(function(){return tn}));var s={};n.r(s),n.d(s,"getSpline",(function(){return En})),n.d(s,"getControlPoint",(function(){return Sn})),n.d(s,"pointsToPolygon",(function(){return On})),n.d(s,"pathToPoints",(function(){return Mn})),n.d(s,"getClosedSpline",(function(){return kn})),n.d(s,"roundedHull",(function(){return In})),n.d(s,"paddedHull",(function(){return jn}));var u={};n.r(u),n.d(u,"defaultSubjectColors",(function(){return sr}));var c={};n.r(c),n.d(c,"mixColor",(function(){return Lr})),n.d(c,"getColorsWithSubjectColor",(function(){return Rr})),n.d(c,"getColorSetsBySubjectColors",(function(){return Br}));var l={};n.r(l),n.d(l,"proccessToFunc",(function(){return Qr})),n.d(l,"buildTextureData",(function(){return $r})),n.d(l,"buildTextureDataWithOneEdgeAttr",(function(){return Jr})),n.d(l,"buildTextureDataWithTwoEdgeAttr",(function(){return ti})),n.d(l,"attributesToTextureData",(function(){return ei})),n.d(l,"arrayToTextureData",(function(){return ni})),n.d(l,"radialLayout",(function(){return ri}));var f={};n.r(f),n.d(f,"gpuDetector",(function(){return ii}));var h={};n.r(h),n.d(h,"default",(function(){return Po})),n.d(h,"assign",(function(){return ho})),n.d(h,"format",(function(){return Io})),n.d(h,"parse",(function(){return jo})),n.d(h,"defaultI18n",(function(){return yo})),n.d(h,"setGlobalDateI18n",(function(){return bo})),n.d(h,"setGlobalDateMasks",(function(){return To}));var d=n(1),p=n(0),g={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(t){return Object.assign(this,t),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(t){var e=this,n=this.events;this.graph=t,"drag-canvas"!==this.type&&"brush-select"!==this.type&&"lasso-select"!==this.type||t.get("canvas").set("draggable",!0),Object(p.each)(n,(function(e,n){t.on(n,e)})),document.addEventListener("visibilitychange",(function(){e.keydown=!1}))},unbind:function(t){var e=this.events,n=t.get("canvas").get("draggable");"drag-canvas"!==this.type&&"brush-select"!==this.type&&"lasso-select"!==this.type||t.get("canvas").set("draggable",!1),Object(p.each)(e,(function(e,n){t.off(n,e)})),t.get("canvas").set("draggable",n)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}},v=function(){function t(){}return t.registerBehavior=function(e,n){if(!n)throw new Error("please specify handler for this behavior: ".concat(e));var r=Object(p.clone)(g);Object.assign(r,n);var i=function(t){var e=this;Object.assign(this,this.getDefaultCfg(),t);var n=this.getEvents();this.events=null;var r={};n&&(Object(p.each)(n,(function(t,n){r[n]=Object(p.wrapBehavior)(e,t)})),this.events=r)};i.prototype=r,t.types[e]=i},t.hasBehavior=function(e){return!!t.types[e]},t.getBehavior=function(e){return t.types[e]},t.types={},t}(),y=v,m=n(69),b=n(14),x=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];!a&&0!==a||!s&&0!==s||(i[a][s]=1,e||(i[s][a]=1))})),i},_=function(t,e){return t===e},w=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),E=function(){function t(t){void 0===t&&(t=_),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new w(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new w(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach((function(t){return e.append(t)})),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map((function(e){return e.toString(t)})).toString()},t}(),S=function(){function t(){this.linkedList=new E}return t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},t.prototype.enqueue=function(t){this.linkedList.append(t)},t.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toString=function(t){return this.linkedList.toString(t)},t}(),O=function(t,e,n){void 0===e&&(e=[]);var r=e.filter((function(e){return e.source===t||e.target===t}));if("target"===n){return r.filter((function(e){return e.source===t})).map((function(t){return t.target}))}if("source"===n){return r.filter((function(e){return e.target===t})).map((function(t){return t.source}))}return r.map((function(e){return e.source===t?e.target:e.source}))},M=function(t,e){return e.filter((function(e){return e.source===t||e.target===t}))},k=function(t){void 0===t&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(n)};var A=function(t,e,n,r){void 0===r&&(r=!0);var i=function(t){void 0===t&&(t={});var e,n=t,r=function(){},i=(e={},function(t){var n=t.next;return!e[n]&&(e[n]=!0,!0)});return n.allowTraversal=t.allowTraversal||i,n.enter=t.enter||r,n.leave=t.leave||r,n}(n),o=new S,a=t.edges,s=void 0===a?[]:a;o.enqueue(e);for(var u="",c=function(){var t=o.dequeue();i.enter({current:t,previous:u}),O(t,s,r?"target":void 0).forEach((function(e){i.allowTraversal({previous:u,current:t,next:e})&&o.enqueue(e)})),i.leave({current:t,previous:u}),u=t};!o.isEmpty();)c()},C=function(t){for(var e=t.nodes,n=void 0===e?[]:e,r=t.edges,i=void 0===r?[]:r,o=[],a={},s={},u={},c=[],l=0,f=function t(e){s[e.id]=l,u[e.id]=l,l+=1,o.push(e),a[e.id]=!0;for(var r=O(e.id,i,"target").filter((function(t){return n.map((function(t){return t.id})).indexOf(t)>-1})),f=function(i){var o=r[i];if(s[o]||0===s[o])a[o]&&(u[e.id]=Math.min(u[e.id],s[o]));else{var c=n.filter((function(t){return t.id===o}));c.length>0&&t(c[0]),u[e.id]=Math.min(u[e.id],u[o])}},h=0;h<r.length;h++)f(h);if(u[e.id]===s[e.id]){for(var d=[];o.length>0;){var p=o.pop();if(a[p.id]=!1,d.push(p),p===e)break}d.length>0&&c.push(d)}},h=0,d=n;h<d.length;h++){var p=d[h];s[p.id]||0===s[p.id]||f(p)}return c};function T(t,e){return e?C(t):function(t){for(var e=t.nodes,n=void 0===e?[]:e,r=t.edges,i=void 0===r?[]:r,o=[],a={},s=[],u=function t(e){s.push(e),a[e.id]=!0;for(var r=O(e.id,i),o=function(e){var i=r[e];if(!a[i]){var o=n.filter((function(t){return t.id===i}));o.length>0&&t(o[0])}},u=0;u<r.length;++u)o(u)},c=0;c<n.length;c++){var l=n[c];if(!a[l.id]){u(l);for(var f=[];s.length>0;)f.push(s.pop());o.push(f)}}return o}(t)}var I=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach((function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}})),o.forEach((function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++})),e},j=I,P=function(t,e){return I(t)[e]?I(t)[e].inDegree:0},N=function(t,e){return I(t)[e]?I(t)[e].outDegree:0};function D(t,e,n){!function t(e,n,r,i){i.enter({current:n,previous:r});var o=e.edges;O(n,void 0===o?[]:o,"target").forEach((function(o){i.allowTraversal({previous:r,current:n,next:o})&&t(e,o,n,i)})),i.leave({current:n,previous:r})}(t,e,"",function(t){void 0===t&&(t={});var e,n=t,r=function(){},i=(e={},function(t){var n=t.next;return!e[n]&&(e[n]=!0,!0)});return n.allowTraversal=t.allowTraversal||i,n.enter=t.enter||r,n.leave=t.leave||r,n}(n))}var L=function(t,e,n){var r,i;void 0===n&&(n=!0);for(var o=[],a=0,s=T(t,!1);a<s.length;a++){var u=s[a];if(u.length)for(var c=u[0],l=c.id,f=[c],h=((r={})[l]=c,r),d=((i={})[l]=new Set,i);f.length>0;)for(var p=f.pop(),g=p.id,v=O(g,t.edges),y=function(r){var i,a=v[r],s=t.nodes.find((function(t){return t.id===a}));if(a===g)o.push(((i={})[a]=p,i));else if(a in d){if(!d[g].has(s)){for(var u=!0,c=[s,p],l=h[g];d[a].size&&!d[a].has(l)&&(c.push(l),l!==h[l.id]);)l=h[l.id];if(c.push(l),e&&n?(u=!1,c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!0)):e&&!n&&c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!1),u){for(var y={},m=1;m<c.length;m+=1)y[c[m-1].id]=c[m];c.length&&(y[c[c.length-1].id]=c[0]),o.push(y)}d[a].add(p)}}else h[a]=p,f.push(s),d[a]=new Set([p])},m=0;m<v.length;m+=1)y(m)}return o},R=function(t,e,n){void 0===n&&(n=!0);for(var r=[],i=new Set,o=[],a=[],s={},u={},c=function t(u,c,l){var f=!1;if(e&&!1===n&&e.indexOf(u.id)>-1)return f;r.push(u),i.add(u);for(var h=l[u.id],d=0;d<h.length;d+=1){if((v=s[h[d]])===c){for(var p={},g=1;g<r.length;g+=1)p[r[g-1].id]=r[g];r.length&&(p[r[r.length-1].id]=r[0]),a.push(p),f=!0}else i.has(v)||t(v,c,l)&&(f=!0)}if(f)!function(t){for(var e=[t];e.length>0;){var n=e.pop();i.has(n)&&(i.delete(n),o[n.id].forEach((function(t){e.push(t)})),o[n.id].clear())}}(u);else for(d=0;d<h.length;d+=1){var v=s[h[d]];o[v.id].has(u)||o[v.id].add(u)}return r.pop(),f},l=t.nodes,f=void 0===l?[]:l,h=0;h<f.length;h+=1){var d=f[h],p=d.id;u[p]=h,s[h]=d}if(e&&n){var g=function(t){var n=e[t];u[f[t].id]=u[n],u[n]=0,s[0]=f.find((function(t){return t.id===n})),s[u[f[t].id]]=f[t]};for(h=0;h<e.length;h++)g(h)}for(var v=function(r){for(var i,o,s=1/0,c=0;c<r.length;c+=1)for(var l=r[c],f=0;f<l.length;f++){var h=u[l[f].id];h<s&&(s=h,o=c)}var d=r[o],p=[];for(c=0;c<d.length;c+=1){var g=d[c];p[g.id]=[];for(var v=0,y=O(g.id,t.edges,"target").filter((function(t){return d.map((function(t){return t.id})).indexOf(t)>-1}));v<y.length;v++){var m=y[v];m!==g.id||!1===n&&e.indexOf(g.id)>-1?p[g.id].push(u[m]):a.push(((i={})[g.id]=g,i))}}return{component:d,adjList:p,minIdx:s}},y=0;y<f.length;){var m=f.filter((function(t){return u[t.id]>=y})),b=C({nodes:m,edges:t.edges}).filter((function(t){return t.length>1}));if(0===b.length)break;var x=v(b),_=x.minIdx,w=x.adjList,E=x.component;if(!(E.length>1))break;E.forEach((function(t){o[t.id]=new Set}));var S=s[_];if(e&&n&&-1===e.indexOf(S.id))return a;c(S,S,w),y=_+1}return a},B=function(t,e,n,r){return void 0===r&&(r=!0),e?R(t,n,r):L(t,n,r)},F=function(t){var e=null,n=t.nodes,r={},i={},o={},a={};(void 0===n?[]:n).forEach((function(t){i[t.id]=t}));for(var s={enter:function(t){var n=t.current,a=t.previous;if(o[n]){e={};for(var s=n,u=a;u!==n;)e[s]=u,s=u,u=r[u];e[s]=u}else o[n]=n,delete i[n],r[n]=a},leave:function(t){var e=t.current;a[e]=e,delete o[e]},allowTraversal:function(t){var n=t.next;return!e&&!a[n]}};Object.keys(i).length;){D(t,Object.keys(i)[0],s)}return e},G=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u=[],c={},l={},f={};o.forEach((function(t,n){var r=t.id;u.push(r),l[r]=1/0,r===e&&(l[r]=0)}));for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var a=e[o].id;!n[a]&&t[a]<=i&&(i=t[a],r=e[o])}return r}(l,o,c),i=e.id;if(c[i]=!0,l[i]===1/0)return"continue";(n?function(t,e){return e.filter((function(e){return e.source===t}))}(i,s):M(i,s)).forEach((function(t){var n=t.target,o=t.source,a=n===i?o:n,s=r&&t[r]?t[r]:1;l[a]>l[e.id]+s?(l[a]=l[e.id]+s,f[a]=[e.id]):l[a]===l[e.id]+s&&f[a].push(e.id)}))},p=0;p<h;p++)d();f[e]=[e];var g={};for(var v in l)l[v]!==1/0&&z(e,v,f,g);var y={};for(var v in g)y[v]=g[v][0];return{length:l,path:y,allPath:g}};function z(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,a=n[e];o<a.length;o++){var s=z(t,a[o],n,r);if(!s)return;for(var u=0,c=s;u<c.length;u++){var l=c[u];Object(p.isArray)(l)?i.push(Object(d.__spreadArray)(Object(d.__spreadArray)([],l,!0),[e],!1)):i.push([l,e])}}return r[e]=i,r[e]}var U,V=function(t,e,n,r,i){var o=G(t,e,r,i),a=o.length,s=o.path,u=o.allPath;return{length:a[n],path:s[n],allPath:u[n]}},W=function(t,e,n,r){var i;if(e===n)return[[e]];var o=t.edges,a=void 0===o?[]:o,s=[e],u=((i={})[e]=!0,i),c=[],l=[],f=r?O(e,a,"target"):O(e,a);for(c.push(f);s.length>0&&c.length>0;){var h=c[c.length-1];if(h.length){var d=h.shift();if(d&&(s.push(d),u[d]=!0,f=r?O(d,a,"target"):O(d,a),c.push(f.filter((function(t){return!u[t]})))),s[s.length-1]===n){var p=s.map((function(t){return t}));l.push(p);g=s.pop();u[g]=!1,c.pop()}}else{var g=s.pop();u[g]=!1,c.pop()}}return l},X=function(t,e){for(var n=x(t,e),r=[],i=n.length,o=0;o<i;o+=1){r[o]=[];for(var a=0;a<i;a+=1)o===a?r[o][a]=0:0!==n[o][a]&&n[o][a]?r[o][a]=n[o][a]:r[o][a]=1/0}for(var s=0;s<i;s+=1)for(o=0;o<i;o+=1)for(a=0;a<i;a+=1)r[o][a]>r[o][s]+r[s][a]&&(r[o][a]=r[o][s]+r[s][a]);return r},Y=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e3);var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u={},c={};o.forEach((function(t,e){var n=k();t.clusterId=n,u[n]={id:n,nodes:[t]},c[t.id]={node:t,idx:e}}));var l=x(t,e),f=[],h={};l.forEach((function(t,e){var n=0,r=o[e].id;h[r]={},t.forEach((function(t,e){if(t){n+=t;var i=o[e].id;h[r][i]=t}})),f.push(n)}));for(var d=0,p=function(){var t=!1;if(o.forEach((function(e){var n={};Object.keys(h[e.id]).forEach((function(t){var r=h[e.id][t],i=c[t].node.clusterId;n[i]||(n[i]=0),n[i]+=r}));var r=-1/0,i=[];if(Object.keys(n).forEach((function(t){r<n[t]?(r=n[t],i=[t]):r===n[t]&&i.push(t)})),1!==i.length||i[0]!==e.clusterId){var o=i.indexOf(e.clusterId);if(o>=0&&i.splice(o,1),i&&i.length){t=!0;var a=u[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var l=Math.floor(Math.random()*i.length),f=u[i[l]];f.nodes.push(e),e.clusterId=f.id}}})),!t)return"break";d++};d<r;){if("break"===p())break}Object.keys(u).forEach((function(t){var e=u[t];e.nodes&&e.nodes.length||delete u[t]}));var g=[],v={};s.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=c[e].node.clusterId,a=c[r].node.clusterId,s="".concat(o,"---").concat(a);if(v[s])v[s].weight+=i,v[s].count++;else{var u={source:o,target:a,weight:i,count:1};v[s]=u,g.push(u)}}));var y=[];return Object.keys(u).forEach((function(t){y.push(u[t])})),{clusters:y,clusterEdges:g}},H=function(){function t(t){this.arr=t}return t.prototype.getArr=function(){return this.arr||[]},t.prototype.add=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]+r[o];return new t(i)}},t.prototype.subtract=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]-r[o];return new t(i)}},t.prototype.avg=function(e){var n=[];if(0!==e)for(var r in this.arr)n[r]=this.arr[r]/e;return new t(n)},t.prototype.negate=function(){var e=[];for(var n in this.arr)e[n]=-this.arr[n];return new t(e)},t.prototype.squareEuclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return r}},t.prototype.euclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return Math.sqrt(r)}console.error("The two vectors are unequal in length.")},t.prototype.normalize=function(){var e=[],n=Object(p.clone)(this.arr);n.sort((function(t,e){return t-e}));var r=n[n.length-1],i=n[0];for(var o in this.arr)e[o]=(this.arr[o]-i)/(r-i);return new t(e)},t.prototype.norm2=function(){var t;if(!(null===(t=this.arr)||void 0===t?void 0:t.length))return 0;var e=0;for(var n in this.arr)e+=Math.pow(this.arr[n],2);return Math.sqrt(e)},t.prototype.dot=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=this.arr[i]*t.arr[i];return r}console.error("The two vectors are unequal in length.")},t.prototype.equal=function(t){var e,n=t.arr;if((null===(e=this.arr)||void 0===e?void 0:e.length)!==(null==n?void 0:n.length))return!1;for(var r in this.arr)if(this.arr[r]!==n[r])return!1;return!0},t}(),q=function(t,e){void 0===e&&(e=void 0);var n=[];return t.forEach((function(t){void 0===e&&n.push(t),void 0!==t[e]&&n.push(t[e])})),n};!function(t){t.EuclideanDistance="euclideanDistance"}(U||(U={}));var K=function(t,e,n){var r=[];(null==e?void 0:e.length)?r=e:(t.forEach((function(t){r=r.concat(Object.keys(t))})),r=Object(p.uniq)(r));var i={};return r.forEach((function(e){var r=[];t.forEach((function(t){void 0!==t[e]&&""!==t[e]&&r.push(t[e])})),r.length&&!(null==n?void 0:n.includes(e))&&(i[e]=Object(p.uniq)(r))})),i},Z=function(t,e,n){var r=K(t,e,n),i=[];if(Object.keys(r).length)return t.forEach((function(t,e){var n=[];if(1===Object.keys(r).length){var o=Object.keys(r)[0];r[o].every((function(t){return!isNaN(Number(t))}))&&(n=[t[o]])}else Object.keys(r).forEach((function(e){for(var i=t[e],o=r[e],a=o.findIndex((function(t){return i===t})),s=[],u=0;u<o.length;u++)u===a?s.push(1):s.push(0);n=n.concat(s)}));i[e]=n})),i},Q=function(t,e,n,r){void 0===n&&(n=U.EuclideanDistance);var i=0;switch(n){case U.EuclideanDistance:i=new H(t).euclideanDistance(new H(e))}return i},$=function(t,e,n,r){for(var i=e.length,o=2*r,a=0,s=0;s<i;s++)for(var u=t[s].clusterId,c=0;c<i;c++){if(u===t[c].clusterId)a+=(e[s][c]||0)-(n[s]||0)*(n[c]||0)/o}return a*=1/o},J=function(t,e){void 0===t&&(t=[]);for(var n=t.length,r=new H([]),i=0;i<n;i++)r=r.add(new H(e[i]));var o=r.avg(n);o.normalize();var a=0;for(i=0;i<n;i++){a+=(u=new H(e[i])).squareEuclideanDistance(o)}var s=[];t.forEach((function(){s.push([])}));for(i=0;i<n;i++){var u=new H(e[i]);t[i].clusterInertial=0;for(var c=0;c<n;c++)if(i!==c){var l=new H(e[c]);s[i][c]=u.squareEuclideanDistance(l),t[i].clusterInertial+=s[i][c]}else s[i][c]=0}var f=0,h=2*n*a;for(i=0;i<n;i++){var d=t[i].clusterId;for(c=0;c<n;c++){var p=t[c].clusterId;if(i!==c&&d===p)f+=t[i].clusterInertial*t[c].clusterInertial/Math.pow(h,2)-s[i][c]/h}}return Number(f.toFixed(4))},tt=function(t,e,n,r,i,o,a,s,u){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e-4),void 0===i&&(i=!1),void 0===o&&(o=void 0),void 0===a&&(a=[]),void 0===s&&(s=["id"]),void 0===u&&(u=1);var c=t.nodes,l=void 0===c?[]:c,f=t.edges,h=void 0===f?[]:f,d=[];if(i){l.forEach((function(t,e){t.properties=t.properties||{},t.originIndex=e}));var g=[];l.every((function(t){return t.hasOwnProperty("nodeType")}))&&(g=Array.from(new Set(l.map((function(t){return t.nodeType})))),l.forEach((function(t){t.properties.nodeType=g.findIndex((function(e){return e===t.nodeType}))})));var v=q(l,o);d=Z(v,a,s)}var y=1,m={},b={};l.forEach((function(t,e){var n=String(y++);t.clusterId=n,m[n]={id:n,nodes:[t]},b[t.id]={node:t,idx:e}}));var _=x(t,e),w=[],E={},S=0;_.forEach((function(t,e){var n=0,r=l[e].id;E[r]={},t.forEach((function(t,e){if(t){n+=t;var i=l[e].id;E[r][i]=t,S+=t}})),w.push(n)})),S/=2;for(var O=1/0,M=1/0,k=0,A=[],C={};;){O=i&&l.every((function(t){return t.hasOwnProperty("properties")}))?$(l,_,w,S)+J(l,d)*u:$(l,_,w,S),0===k&&(M=O,A=l,C=m);var T=O>0&&O>M&&O-M<r;if(O>M&&(A=l.map((function(t){return{node:t,clusterId:t.clusterId}})),C=Object(p.clone)(m),M=O),T||k>100)break;k++,Object.keys(m).forEach((function(t){var e=0;h.forEach((function(r){var i=r.source,o=r.target,a=b[i].node.clusterId,s=b[o].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=r[n]||1)})),m[t].sumTot=e})),l.forEach((function(t,e){var r,o=m[t.clusterId],a=0,s=w[e]/(2*S),c=0,l=o.nodes;l.forEach((function(t){var n=b[t.id].idx;c+=_[e][n]||0}));var f=c-o.sumTot*s,p=l.filter((function(e){return e.id!==t.id})),g=[];p.forEach((function(t,e){g[e]=d[t.originIndex]}));var v=J(p,d)*u,y=E[t.id];if(Object.keys(y).forEach((function(n){var o=b[n].node.clusterId;if(o!==t.clusterId){var c=m[o],l=c.nodes;if(l&&l.length){var h=0;l.forEach((function(t){var n=b[t.id].idx;h+=_[e][n]||0}));var p=h-c.sumTot*s,g=l.concat([t]),y=[];g.forEach((function(t,e){y[e]=d[t.originIndex]}));var x=J(g,d)*u,w=p-f;i&&(w=p+x-(f+v)),w>a&&(a=w,r=c)}}})),a>0){r.nodes.push(t);var x=t.clusterId;t.clusterId=r.id;var O=o.nodes.indexOf(t);o.nodes.splice(O,1);var M=0,k=0;h.forEach((function(t){var e=t.source,i=t.target,o=b[e].node.clusterId,a=b[i].node.clusterId;(o===r.id&&a!==r.id||a===r.id&&o!==r.id)&&(M+=t[n]||1),(o===x&&a!==x||a===x&&o!==x)&&(k+=t[n]||1)})),r.sumTot=M,o.sumTot=k}}))}var I={},j=0;Object.keys(C).forEach((function(t){var e=C[t];if(e.nodes&&e.nodes.length){var n=String(j+1);n!==t&&(e.id=n,e.nodes=e.nodes.map((function(t){return{id:t.id,clusterId:n}})),C[n]=e,I[t]=n,delete C[t],j++)}else delete C[t]})),A.forEach((function(t){var e=t.node,n=t.clusterId;e.clusterId=n,e.clusterId&&I[e.clusterId]&&(e.clusterId=I[e.clusterId])}));var P=[],N={};h.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=b[e].node.clusterId,a=b[r].node.clusterId,s="".concat(o,"---").concat(a);if(N[s])N[s].weight+=i,N[s].count++;else{var u={source:o,target:a,weight:i,count:1};N[s]=u,P.push(u)}}));var D=[];return Object.keys(C).forEach((function(t){D.push(C[t])})),{clusters:D,clusterEdges:P}},et=function(t,e,n,r,i,o,a,s){return void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e-4),void 0===i&&(i=void 0),void 0===o&&(o=[]),void 0===a&&(a=["id"]),void 0===s&&(s=1),tt(t,e,n,r,!0,i,o,a,s)},nt=function(t,e){var n;void 0===e&&(e=1);for(var r=Object(p.clone)(t),i=r.nodes,o=void 0===i?[]:i,a=r.edges,s=void 0===a?[]:a,u=function(){var t=j({nodes:o,edges:s}),r=Object.keys(t);r.sort((function(e,n){var r,i;return(null===(r=t[e])||void 0===r?void 0:r.degree)-(null===(i=t[n])||void 0===i?void 0:i.degree)}));var i=r[0];if(!o.length||(null===(n=t[i])||void 0===n?void 0:n.degree)>=e)return"break";var a=o.findIndex((function(t){return t.id===i}));o.splice(a,1),s=s.filter((function(t){return!(t.source===i||t.target===i)}))};;){if("break"===u())break}return{nodes:o,edges:s}},rt=function(t,e,n){var r=[];switch(t){case U.EuclideanDistance:r=e[n];break;default:r=[]}return r},it=function(t,e,n,r,i,o){void 0===e&&(e=3),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=["id"]),void 0===o&&(o=U.EuclideanDistance);var a=t.nodes,s=t.edges;if(o===U.EuclideanDistance&&!a.every((function(t){return t.hasOwnProperty(n)})))return{clusters:[{id:"0",nodes:a}],clusterEdges:[]};var u=[],c=[];o===U.EuclideanDistance&&(u=q(a,n),c=Z(u,r,i));for(var l=0;l<a.length;l++)a[l].originIndex=l;var f=[],h=[],d=[];for(l=0;l<e;l++)if(0===l){var g=Math.floor(Math.random()*a.length);switch(o){case U.EuclideanDistance:f[l]=c[g];break;default:f[l]=[]}h.push(g),d[l]=[a[g]],a[g].clusterId=String(l)}else{for(var v=-1/0,y=0,m=function(t){if(!h.includes(t)){for(var e=0,n=0;n<f.length;n++){var r=0;switch(o){case U.EuclideanDistance:r=Q(c[a[t].originIndex],f[n],o)}e+=r}var i=e/f.length;i>v&&!f.find((function(e){return Object(p.isEqual)(e,rt(o,c,a[t].originIndex))}))&&(v=i,y=t)}},b=0;b<a.length;b++)m(b);f[l]=rt(o,c,y),h.push(y),d[l]=[a[y]],a[y].clusterId=String(l)}for(var x=0;;){for(l=0;l<a.length;l++){var _=0,w=1/0;if(0!==x||!h.includes(l)){for(var E=0;E<f.length;E++){var S=0;switch(o){case U.EuclideanDistance:S=Q(c[l],f[E],o)}S<w&&(w=S,_=E)}if(void 0!==a[l].clusterId)for(var O=d[Number(a[l].clusterId)].length-1;O>=0;O--)d[Number(a[l].clusterId)][O].id===a[l].id&&d[Number(a[l].clusterId)].splice(O,1);a[l].clusterId=String(_),d[_].push(a[l])}}var M=!1;for(l=0;l<d.length;l++){var k=d[l],A=new H([]);for(E=0;E<k.length;E++)A=A.add(new H(c[k[E].originIndex]));var C=A.avg(k.length);C.equal(new H(f[l]))||(M=!0,f[l]=C.getArr())}if(x++,a.every((function(t){return void 0!==t.clusterId}))&&M||x>=1e3)break}var T=[],I={};return s.forEach((function(t){var e,n,r=t.source,i=t.target,o=null===(e=a.find((function(t){return t.id===r})))||void 0===e?void 0:e.clusterId,s=null===(n=a.find((function(t){return t.id===i})))||void 0===n?void 0:n.clusterId,u="".concat(o,"---").concat(s);if(I[u])I[u].count++;else{var c={source:o,target:s,count:1};I[u]=c,T.push(c)}})),{clusters:d,clusterEdges:T}},ot=function(t,e){var n=new H(e),r=n.norm2(),i=new H(t),o=i.norm2(),a=n.dot(i),s=r*o,u=s?a/s:0;return u},at=function(t,e,n,r,i){void 0===t&&(t=[]),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=[]);var o=Object(p.clone)(t.filter((function(t){return t.id!==e.id}))),a=t.findIndex((function(t){return t.id===e.id})),s=q(t,n),u=Z(s,r,i),c=u[a],l=[];return o.forEach((function(t,n){if(t.id!==e.id){var r=u[n],i=ot(r,c);l.push(i),t.cosineSimilarity=i}})),o.sort((function(t,e){return e.cosineSimilarity-t.cosineSimilarity})),{allCosineSimilarity:l,similarNodes:o}},st=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,n=t;e<n.length;e++){var r=n[e];this.parent[r]=r}}return t.prototype.find=function(t){for(;this.parent[t]!==t;)t=this.parent[t];return t},t.prototype.union=function(t,e){var n=this.find(t),r=this.find(e);n!==r&&(n<r?(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]):(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]))},t.prototype.connected=function(t,e){return this.find(t)===this.find(e)},t}(),ut=function(t,e){return t-e},ct=function(){function t(t){void 0===t&&(t=ut),this.compareFn=t,this.list=[]}return t.prototype.getLeft=function(t){return 2*t+1},t.prototype.getRight=function(t){return 2*t+2},t.prototype.getParent=function(t){return 0===t?null:Math.floor((t-1)/2)},t.prototype.isEmpty=function(){return this.list.length<=0},t.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},t.prototype.delMin=function(){var t=this.top(),e=this.list.pop();return this.list.length>0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,n=t,r=this.getLeft(t),i=this.getRight(t),o=this.list.length;null!==r&&r<o&&this.compareFn(this.list[n],this.list[r])>0?n=r:null!==i&&i<o&&this.compareFn(this.list[n],this.list[i])>0&&(n=i),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},t}(),lt=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=i[0],u=new Set;u.add(s);var c=new ct((function(t,n){return e?t.weight-n.weight:0}));for(M(s.id,a).forEach((function(t){c.insert(t)}));!c.isEmpty();){var l=c.delMin(),f=l.source,h=l.target;u.has(f)&&u.has(h)||(n.push(l),u.has(f)||(u.add(f),M(f,a).forEach((function(t){c.insert(t)}))),u.has(h)||(u.add(h),M(h,a).forEach((function(t){c.insert(t)}))))}return n},ft=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=a.map((function(t){return t}));e&&s.sort((function(t,e){return t.weight-e.weight}));for(var u=new st(i.map((function(t){return t.id})));s.length>0;){var c=s.shift(),l=c.source,f=c.target;u.connected(l,f)||(n.push(c),u.union(l,f))}return n},ht=function(t,e,n){return n?{prim:lt,kruskal:ft}[n](t,e):ft(t,e)},dt=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,u=void 0===s?[]:s,c=t.edges,l=void 0===c?[]:c,f=u.length,h={},d={},p=0;p<f;++p){h[v=(_=u[p]).id]=1/f,d[v]=1/f}for(var g=j(t);a>0&&i>e;){o=0;for(p=0;p<f;++p){var v=(_=u[p]).id;if(r=0,0===g[_.id].inDegree)h[v]=0;else{for(var y=O(v,l,"source"),m=0;m<y.length;++m){var b=y[m],x=g[b].outDegree;x>0&&(r+=d[b]/x)}h[v]=n*r,o+=h[v]}}o=(1-o)/f,i=0;for(p=0;p<f;++p){var _;r=h[v=(_=u[p]).id]+o,i+=Math.abs(r-d[v]),d[v]=r}a-=1}return d},pt=function(t,e,n,r){void 0===t&&(t=-1),void 0===e&&(e=-1),void 0===n&&(n=-1),void 0===r&&(r="-1"),this.id=t,this.from=e,this.to=n,this.label=r},gt=function(){function t(t,e){void 0===t&&(t=-1),void 0===e&&(e="-1"),this.id=t,this.label=e,this.edges=[],this.edgeMap={}}return t.prototype.addEdge=function(t){this.edges.push(t),this.edgeMap[t.id]=t},t}(),vt=function(){function t(t,e,n){void 0===t&&(t=-1),void 0===e&&(e=!0),void 0===n&&(n=!1),this.id=t,this.edgeIdAutoIncrease=e,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return t.prototype.getNodeNum=function(){return this.nodes.length},t.prototype.addNode=function(t,e){if(!this.nodeMap[t]){var n=new gt(t,e);this.nodes.push(n),this.nodeMap[t]=n,this.nodeLabelMap[e]||(this.nodeLabelMap[e]=[]),this.nodeLabelMap[e].push(t)}},t.prototype.addEdge=function(t,e,n,r){if((this.edgeIdAutoIncrease||void 0===t)&&(t=this.counter++),!(this.nodeMap[e]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[t])){var i=new pt(t,e,n,r);if(this.edges.push(i),this.edgeMap[t]=i,this.nodeMap[e].addEdge(i),this.edgeLabelMap[r]||(this.edgeLabelMap[r]=[]),this.edgeLabelMap[r].push(i),!this.directed){var o=new pt(t,n,e,r);this.nodeMap[n].addEdge(o),this.edgeLabelMap[r].push(o)}}},t}(),yt=function(){function t(t,e,n,r,i){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:n||"-1",edgeLabel:r||"-1",nodeLabel2:i||"-1"}}return t.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t}(),mt=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(t){var e=this.dfsEdgeList.length;if(e!==t.length)return!1;for(var n=0;n<e;n++)if(this.dfsEdgeList[n]!==t[n])return!1;return!0},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t.prototype.pushBack=function(t,e,n,r,i){return this.dfsEdgeList.push(new yt(t,e,n,r,i)),this.dfsEdgeList},t.prototype.toGraph=function(t,e){void 0===t&&(t=-1),void 0===e&&(e=!1);var n=new vt(t,!0,e);return this.dfsEdgeList.forEach((function(t){var e=t.fromNode,r=t.toNode,i=t.nodeEdgeNodeLabel,o=i.nodeLabel1,a=i.edgeLabel,s=i.nodeLabel2;"-1"!==o&&n.addNode(e,o),"-1"!==s&&n.addNode(r,s),"-1"!==o&&s!==o&&n.addEdge(void 0,e,r,a)})),n},t.prototype.buildRmpath=function(){this.rmpath=[];for(var t=void 0,e=this.dfsEdgeList.length-1;e>=0;e--){var n=this.dfsEdgeList[e],r=n.fromNode,i=n.toNode;r<i&&(void 0===t||i===t)&&(this.rmpath.push(e),t=r)}return this.rmpath},t.prototype.getNodeNum=function(){var t={};return this.dfsEdgeList.forEach((function(e){t[e.fromNode]||(t[e.fromNode]=!0),t[e.toNode]||(t[e.toNode]=!0)})),Object.keys(t).length},t}(),bt=function(){function t(t){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],t){for(;t;){var e=t.edge;this.edges.push(e),this.nodesUsed[e.from]=1,this.nodesUsed[e.to]=1,this.edgesUsed[e.id]=1,t=t.preNode}this.edges=this.edges.reverse()}}return t.prototype.hasNode=function(t){return 1===this.nodesUsed[t.id]},t.prototype.hasEdge=function(t){return 1===this.edgesUsed[t.id]},t}(),xt=function(){function t(t){var e=t.graphs,n=t.minSupport,r=void 0===n?2:n,i=t.minNodeNum,o=void 0===i?1:i,a=t.maxNodeNum,s=void 0===a?4:a,u=t.top,c=void 0===u?10:u,l=t.directed,f=void 0!==l&&l,h=t.verbose,d=void 0!==h&&h;this.graphs=e,this.dfsCode=new mt,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=r,this.top=c,this.directed=f,this.counter=0,this.maxNodeNum=s,this.minNodeNum=o,this.verbose=d,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return t.prototype.findForwardRootEdges=function(t,e){var n=this,r=[],i=t.nodeMap;return e.edges.forEach((function(t){(n.directed||e.label<=i[t.to].label)&&r.push(t)})),r},t.prototype.findBackwardEdge=function(t,e,n,r){if(!this.directed&&e===n)return null;for(var i=t.nodeMap,o=i[n.to].edges,a=o.length,s=0;s<a;s++){var u=o[s];if(!r.hasEdge(u)&&u.to===e.from)if(this.directed){if(i[e.from].label<i[n.to].label||i[e.from].label===i[n.to].label&&e.label<=u.label)return u}else if(e.label<u.label||e.label===u.label&&i[e.to].label<=i[n.to].label)return u}return null},t.prototype.findForwardPureEdges=function(t,e,n,r){for(var i=[],o=e.to,a=t.nodeMap[o].edges,s=a.length,u=0;u<s;u++){var c=a[u],l=t.nodeMap[c.to];n<=l.label&&!r.hasNode(l)&&i.push(c)}return i},t.prototype.findForwardRmpathEdges=function(t,e,n,r){for(var i=[],o=t.nodeMap,a=o[e.to].label,s=o[e.from].edges,u=s.length,c=0;c<u;c++){var l=s[c],f=o[l.to].label;e.to===l.to||n>f||r.hasNode(o[l.to])||(e.label<l.label||e.label===l.label&&a<=f)&&i.push(l)}return i},t.prototype.getSupport=function(t){var e={};return t.forEach((function(t){e[t.graphId]||(e[t.graphId]=!0)})),Object.keys(e).length},t.prototype.findMinLabel=function(t){var e=void 0;return Object.keys(t).forEach((function(n){var r=t[n],i=r.nodeLabel1,o=r.edgeLabel,a=r.nodeLabel2;e?(i<e.nodeLabel1||i===e.nodeLabel1&&o<e.edgeLabel||i===e.nodeLabel1&&o===e.edgeLabel&&a<e.nodeLabel2)&&(e={nodeLabel1:i,edgeLabel:o,nodeLabel2:a}):e={nodeLabel1:i,edgeLabel:o,nodeLabel2:a}})),e},t.prototype.isMin=function(){var t=this,e=this.dfsCode;if(this.verbose&&console.log("isMin checking",e),1===e.dfsEdgeList.length)return!0;var n=this.directed,r=e.toGraph(-1,n),i=r.nodeMap,o=new mt,a={};r.nodes.forEach((function(e){t.findForwardRootEdges(r,e).forEach((function(t){var n=i[t.to],o="".concat(e.label,"-").concat(t.label,"-").concat(n.label);a[o]||(a[o]={projected:[],nodeLabel1:e.label,edgeLabel:t.label,nodeLabel2:n.label});var s={graphId:r.id,edge:t,preNode:null};a[o].projected.push(s)}))}));var s=this.findMinLabel(a);if(s){o.dfsEdgeList.push(new yt(0,1,s.nodeLabel1,s.edgeLabel,s.nodeLabel2));var u="".concat(s.nodeLabel1,"-").concat(s.edgeLabel,"-").concat(s.nodeLabel2);return function a(s){for(var u=o.buildRmpath(),c=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,l=o.dfsEdgeList[u[0]].toNode,f={},h=!1,d=0,p=n?-1:0,g=function(e){if(h)return"break";s.forEach((function(n){var i=new bt(n),a=t.findBackwardEdge(r,i.edges[u[e]],i.edges[u[0]],i);a&&(f[a.label]||(f[a.label]={projected:[],edgeLabel:a.label}),f[a.label].projected.push({graphId:r.id,edge:f,preNode:n}),d=o.dfsEdgeList[u[e]].fromNode,h=!0)}))},v=u.length-1;v>p;v--){if("break"===g(v))break}if(h){var y=t.findMinLabel(f);o.dfsEdgeList.push(new yt(l,d,"-1",y.edgeLabel,"-1"));var m=o.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[m]===o.dfsEdgeList[m]&&a(f[y.edgeLabel].projected)}var b={};h=!1;var x=0;s.forEach((function(e){var n=new bt(e),o=t.findForwardPureEdges(r,n.edges[u[0]],c,n);o.length>0&&(h=!0,x=l,o.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}));var _=u.length,w=function(e){if(h)return"break";var n=u[e];s.forEach((function(e){var a=new bt(e),s=t.findForwardRmpathEdges(r,a.edges[n],c,a);s.length>0&&(h=!0,x=o.dfsEdgeList[n].fromNode,s.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}))};for(v=0;v<_;v++){if("break"===w(v))break}if(!h)return!0;var E=t.findMinLabel(b);o.dfsEdgeList.push(new yt(x,l+1,"-1",E.edgeLabel,E.nodeLabel2));var S=o.dfsEdgeList.length-1;return e.dfsEdgeList[S]===o.dfsEdgeList[S]&&a(b["".concat(E.edgeLabel,"-").concat(E.nodeLabel2)].projected)}(a[u].projected)}},t.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var t=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Object(p.clone)(t))}},t.prototype.subGraphMining=function(t){var e=this;if(!(this.getSupport(t)<this.minSupport)&&this.isMin()){this.report();var n=this.dfsCode.getNodeNum(),r=this.dfsCode.buildRmpath(),i=this.dfsCode.dfsEdgeList[r[0]].toNode,o=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,a={},s={};t.forEach((function(t){for(var u=e.graphs[t.graphId],c=u.nodeMap,l=new bt(t),f=r.length-1;f>=0;f--){var h=e.findBackwardEdge(u,l.edges[r[f]],l.edges[r[0]],l);if(h){var d="".concat(e.dfsCode.dfsEdgeList[r[f]].fromNode,"-").concat(h.label);s[d]||(s[d]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[r[f]].fromNode,edgeLabel:h.label}),s[d].projected.push({graphId:t.graphId,edge:h,preNode:t})}}if(!(n>=e.maxNodeNum)){e.findForwardPureEdges(u,l.edges[r[0]],o,l).forEach((function(e){var n="".concat(i,"-").concat(e.label,"-").concat(c[e.to].label);a[n]||(a[n]={projected:[],fromNodeId:i,edgeLabel:e.label,nodeLabel2:c[e.to].label}),a[n].projected.push({graphId:t.graphId,edge:e,preNode:t})}));var p=function(n){e.findForwardRmpathEdges(u,l.edges[r[n]],o,l).forEach((function(i){var o="".concat(e.dfsCode.dfsEdgeList[r[n]].fromNode,"-").concat(i.label,"-").concat(c[i.to].label);a[o]||(a[o]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[r[n]].fromNode,edgeLabel:i.label,nodeLabel2:c[i.to].label}),a[o].projected.push({graphId:t.graphId,edge:i,preNode:t})}))};for(f=0;f<r.length;f++)p(f)}})),Object.keys(s).forEach((function(t){var n=s[t],r=n.toNodeId,o=n.edgeLabel;e.dfsCode.dfsEdgeList.push(new yt(i,r,"-1",o,"-1")),e.subGraphMining(s[t].projected),e.dfsCode.dfsEdgeList.pop()})),Object.keys(a).forEach((function(t){var n=a[t],r=n.fromNodeId,o=n.edgeLabel,s=n.nodeLabel2;e.dfsCode.dfsEdgeList.push(new yt(r,i+1,"-1",o,s)),e.subGraphMining(a[t].projected),e.dfsCode.dfsEdgeList.pop()}))}},t.prototype.generate1EdgeFrequentSubGraphs=function(){var t=this.graphs,e=this.directed,n=this.minSupport,r=this.frequentSize1Subgraphs,i={},o={},a={},s={};return Object.keys(t).forEach((function(n){var r=t[n],u=r.nodeMap;r.nodes.forEach((function(t,r){var c=t.label,l="".concat(n,"-").concat(c);if(!a[l]){var f=i[c]||0;f++,i[c]=f}a[l]={graphKey:n,label:c},t.edges.forEach((function(t){var r=c,i=u[t.to].label;if(!e&&r>i){var a=i;i=r,r=a}var l=t.label,f="".concat(n,"-").concat(r,"-").concat(l,"-").concat(i),h="".concat(r,"-").concat(l,"-").concat(i);if(!o[h]){var d=o[h]||0;d++,o[h]=d}s[f]={graphId:n,nodeLabel1:r,edgeLabel:l,nodeLabel2:i}}))}))})),Object.keys(i).forEach((function(t){if(!(i[t]<n)){var e={nodes:[],edges:[]};e.nodes.push({id:"0",label:t}),r.push(e)}})),r},t.prototype.run=function(){var t=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var e=this.graphs,n=(this.directed,{});Object.keys(e).forEach((function(r){var i=e[r],o=i.nodeMap;i.nodes.forEach((function(e){t.findForwardRootEdges(i,e).forEach((function(t){var i=o[t.to],a="".concat(e.label,"-").concat(t.label,"-").concat(i.label);n[a]||(n[a]={projected:[],nodeLabel1:e.label,edgeLabel:t.label,nodeLabel2:i.label});var s={graphId:r,edge:t,preNode:null};n[a].projected.push(s)}))}))})),Object.keys(n).forEach((function(e){var r=n[e],i=r.projected,o=r.nodeLabel1,a=r.edgeLabel,s=r.nodeLabel2;t.dfsCode.dfsEdgeList.push(new yt(0,1,o,a,s)),t.subGraphMining(i),t.dfsCode.dfsEdgeList.pop()}))}},t}(),_t=function(t){var e=t.graphs,n=t.directed,r=void 0!==n&&n,i=t.nodeLabelProp,o=void 0===i?"cluster":i,a=t.edgeLabelProp,s=void 0===a?"cluster":a,u=function(t,e,n,r){var i={};return Object.keys(t).forEach((function(o,a){var s=t[o],u=new vt(a,!0,e),c={};s.nodes.forEach((function(t,e){u.addNode(e,t[n]),c[t.id]=e})),s.edges.forEach((function(t,e){var n=c[t.source],i=c[t.target];u.addEdge(-1,n,i,t[r])})),u&&u.getNodeNum()&&(i[u.id]=u)})),i}(e,r,o,s),c=t.minSupport,l=t.maxNodeNum,f=t.minNodeNum,h=t.verbose,d=t.top,p=new xt({graphs:u,minSupport:c,maxNodeNum:l,minNodeNum:f,top:d,verbose:h,directed:r});return p.run(),function(t,e,n){var r=[];return t.forEach((function(t){var i={nodes:[],edges:[]};t.nodes.forEach((function(t){var n;i.nodes.push(((n={id:"".concat(t.id)})[e]=t.label,n))})),t.edges.forEach((function(t){var e;i.edges.push(((e={source:"".concat(t.from),target:"".concat(t.to)})[n]=t.label,e))})),r.push(i)})),r}(p.frequentSubgraphs,o,s)},wt=function(t,e,n,r){void 0===n&&(n="cluster"),void 0===r&&(r=2);var i=[],o=t.nodes;return e.forEach((function(t,e){i.push(Et(o,t,e,n,r))})),i},Et=function(t,e,n,r,i){var o=[n],a=[],s={};return e.forEach((function(e,u){if(e<=i&&n!==u){o.push(u),a.push(t[u]);var c=t[u][r];s[c]?(s[c].count++,s[c].dists.push(e)):s[c]={count:1,dists:[e]}}})),Object.keys(s).forEach((function(t){s[t].dists=s[t].dists.sort((function(t,e){return t-e}))})),{nodeIdx:n,nodeId:t[n].id,nodeIdxs:o,neighbors:a,neighborNum:o.length-1,nodeLabelCountMap:s}},St=function(t,e,n,r){var i=n.nodes;return r||(r={}),Object.keys(t).forEach((function(o){var a,s;if(!r||!r[o]){r[o]={nodes:[],edges:[]};var u=t[o],c=null===(a=e[u.start])||void 0===a?void 0:a.nodeIdxs,l=null===(s=e[u.end])||void 0===s?void 0:s.nodeIdxs;if(c&&l){var f=new Set(l),h=c.filter((function(t){return f.has(t)}));if(h&&h.length){for(var d={},p=h.length,g=0;g<p;g++){var v=i[h[g]];r[o].nodes.push(v),d[v.id]=!0}n.edges.forEach((function(t){d[t.source]&&d[t.target]&&r[o].edges.push(t)}))}}}})),r},Ot=function(t,e,n,r){var i,o,a={};t.nodes.forEach((function(t){a[t.id]=t}));var s=0;return!(null===(i=null==e?void 0:e.edges)||void 0===i?void 0:i.length)||(null===(o=null==e?void 0:e.nodes)||void 0===o?void 0:o.length)<2?0:(t.edges.forEach((function(t){var i=a[t.source][n],o=a[t.target][n],u=null==e?void 0:e.nodes[0][n],c=null==e?void 0:e.nodes[1][n],l=null==e?void 0:e.edges[0][r];t[r]===l&&(i===u&&o===c||i===c&&o===u)&&s++})),s)},Mt=function(t,e){var n={},r={};return t.forEach((function(t,i){n[t.id]={idx:i,node:t,degree:0,inDegree:0,outDegree:0};var o=t[e];r[o]||(r[o]=[]),r[o].push(t)})),{nodeMap:n,nodeLabelMap:r}},kt=function(t,e,n){var r={},i={};return t.forEach((function(t,o){r["".concat(k)]={idx:o,edge:t};var a=t[e];i[a]||(i[a]=[]),i[a].push(t);var s=n[t.source];s&&(s.degree++,s.outDegree++);var u=n[t.target];u&&(u.degree++,u.inDegree++)})),{edgeMap:r,edgeLabelMap:i}},At=function(t,e,n){var r=e.length,i={};return e.forEach((function(e,o){for(var a=n?0:o+1,s=t[o].id,u=a;u<r;u++)if(o!==u){var c=t[u].id,l=e[u];i["".concat(s,"-").concat(c)]=l,n||(i["".concat(c,"-").concat(s)]=l)}})),i},Ct=function(t,e,n,r,i,o,a,s,u,c,l){var f,h="".concat(e.id,"-").concat(n.id);if(c&&c[h])return c[h];var d=l?l[h]:void 0;if(!d){var p=((f={})[h]={start:r[e.id].idx,end:r[n.id].idx,distance:i},f);d=(l=St(p,o,t,l))[h]}return Ot(d,a,s,u)},Tt=function(t,e,n,r){var i,o,a,s=null===(i=t[e])||void 0===i?void 0:i.degree,u=null===(o=t[e])||void 0===o?void 0:o.inDegree,c=null===(a=t[e])||void 0===a?void 0:a.outDegree;return void 0===t[e]&&(s=1/0,u=1/0,c=1/0,r[e].forEach((function(t){var e=n[t.id].degree;s>e&&(s=e);var r=n[t.id].inDegree;u>r&&(u=r);var i=n[t.id].outDegree;c>i&&(c=i)})),t[e]={degree:s,inDegree:u,outDegree:c}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:c}},It=function(t,e,n,r,i,o,a){var s;if(void 0===n&&(n=!1),void 0===o&&(o="cluster"),void 0===a&&(a="cluster"),t&&t.nodes){var u=t.nodes.length;if(u){var c=X(t,n),l=X(e,n),f=At(t.nodes,c,n),h=At(e.nodes,l,n),p=Mt(t.nodes,o),g=p.nodeMap,v=p.nodeLabelMap,y=Mt(e.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;kt(t.edges,a,g);var x=kt(e.edges,a,m).edgeLabelMap,_=[];null==l||l.forEach((function(t){_=_.concat(t)})),i||(i=Math.max.apply(Math,Object(d.__spreadArray)(Object(d.__spreadArray)([],_,!1),[2],!1))),r||(r=i);var w=wt(t,c,o,r),E=wt(e,l,o,r),S=function(t,e,n,r,i){var o=Math.ceil(n/e),a={},s=0;return r.forEach((function(t,r){for(var u=0,c=0,l=t.nodeIdxs,f=t.neighborNum-1;u<o;){for(var h=l[1+Math.floor(Math.random()*f)],d=0;(a["".concat(r,"-").concat(h)]||a["".concat(h,"-").concat(r)])&&(h=Math.floor(Math.random()*e),!(++d>2*e)););if(d<2*e&&(a["".concat(r,"-").concat(h)]={start:r,end:h,distance:i[r][h]},u++,++s>=n))return a;if(++c>2*e)break}u<o&&(o=(o+(o-u))/(e-r-1))})),a}(0,u,Math.min(100,u*(u-1)/2),w,c),O=St(S,w,t),M=_t({graphs:O,nodeLabelProp:o,edgeLabelProp:a,minSupport:1,minNodeNum:1,maxNodeNum:4,directed:n}).slice(0,10),k=M.length,A=[];M.forEach((function(t,e){A[e]={},Object.keys(O).forEach((function(n){var r=O[n],i=Ot(r,t,o,a);A[e][n]=i}))}));var C=function(t,e,n){for(var r=1/0,i=0,o=function(e){var n=t[e],o=Object.keys(n).sort((function(t,e){return n[t]-n[e]})),a=[];o.forEach((function(t,e){a[e%10]||(a[e%10]={graphs:[],totalCount:0,aveCount:0}),a[e%10].graphs.push(t),a[e%10].totalCount+=n[t]}));var s=0,u=[];a.forEach((function(t){var e=t.totalCount/t.graphs.length;t.aveCount=e,u.push(e);var r=0,i=t.length;t.graphs.forEach((function(e,i){var o=n[e];t.graphs.forEach((function(t,e){i!==e&&(r+=Math.abs(o-n[t]))}))})),s+=r/=i*(i-1)/2})),s/=a.length;var c=0;u.forEach((function(t,e){u.forEach((function(n,r){e!==r&&(c+=Math.abs(t-n))})),c/=u.length*(u.length-1)/2}));var l=c-s;r<l&&(r=l,i=e)},a=0;a<e;a++)o(a);return{structure:n[i],structureCountMap:t[i]}}(A,k,M),T=C.structure,I=C.structureCountMap,j=e.nodes[0],P=[],N=null===(s=e.nodes[0])||void 0===s?void 0:s[o],D=-1/0;e.nodes.forEach((function(t){var e=t[o],n=v[e];(null==n?void 0:n.length)>D&&(D=n.length,P=n,N=e,j=t)}));var L={},R={},B={},F={},z={},U={};Object.keys(b).forEach((function(r,i){z[r]=[],n&&(U[r]=[]);var s=-1/0,u=b[r],c={};u.forEach((function(t){var e=h["".concat(j.id,"-").concat(t.id)];if(e&&z[r].push(e),s<e&&(s=e),c["".concat(j.id,"-").concat(t.id)]={start:0,end:m[t.id].idx,distance:e},n){var i=h["".concat(t.id,"-").concat(j.id)];i&&U[r].push(i)}})),z[r]=z[r].sort((function(t,e){return t-e})),n&&(U[r]=U[r].sort((function(t,e){return t-e}))),R=St(c,E,e,R);var l=[];if(Object.keys(c).forEach((function(t){if(B[t])l.push(B[t]);else{var e=R[t];B[t]=Ot(e,T,o,a),l.push(B[t])}})),l=l.sort((function(t,e){return e-t})),F["".concat(j.id,"-").concat(r)]=l,r!==N)for(var d=function(e){var n=P[e],i=w[g[n.id].idx],s=i.nodeLabelCountMap[r],u=b[r].length;if(!s||s.count<u)return P.splice(e,1),"continue";for(var c=!1,h=0;h<u;h++)if(s.dists[h]>z[r][h]){c=!0;break}if(c)return P.splice(e,1),"continue";var d={};i.neighbors.forEach((function(t){var e=f["".concat(n.id,"-").concat(t.id)];d["".concat(n.id,"-").concat(t.id)]={start:g[n.id].idx,end:g[t.id].idx,distance:e}})),O=St(d,w,t,O);var p=[];Object.keys(d).forEach((function(t){if(I[t])p.push(I[t]);else{var e=O[t];I[t]=Ot(e,T,o,a),p.push(I[t])}})),p=p.sort((function(t,e){return e-t}));var v=!1;for(h=0;h<u;h++)if(p[h]<l[h]){v=!0;break}return v?(P.splice(e,1),"continue"):void 0},p=((null==P?void 0:P.length)||0)-1;p>=0;p--)d(p)}));var V=[];null==P||P.forEach((function(r){for(var s=g[r.id].idx,u=Et(t.nodes,c[s],s,o,i).neighbors,l=!1,h=u.length-1;h>=0;h--){if(u.length+1<e.nodes.length)return void(l=!0);var d=u[h],p=d[o];if(b[p]&&b[p].length)if(z[p]&&z[p].length){var v="".concat(r.id,"-").concat(d.id),y=f[v],x=z[p].length-1;if(y>z[p][x])u.splice(h,1);else{if(n){var _="".concat(d.id,"-").concat(r.id),E=f[_];if(x=U[p].length-1,E>U[p][x]){u.splice(h,1);continue}}var S=I[v]?I[v]:Ct(t,r,d,g,y,w,T,o,a,I,O),M="".concat(j.id,"-").concat(p);if(S<F[M][F[M].length-1])u.splice(h,1);else{var k=Tt(L,p,m,b),A=k.minPatternNodeLabelDegree;k.minPatternNodeLabelInDegree,k.minPatternNodeLabelOutDegree;g[d.id].degree<A&&u.splice(h,1)}}}else u.splice(h,1);else u.splice(h,1)}l||V.push({nodes:[r].concat(u)})}));var W=G(e,j.id,!1).length,Y={};n?(Object.keys(W).forEach((function(t){var e=m[t].node[o];Y[e]?Y[e].push(W[t]):Y[e]=[W[t]]})),Object.keys(Y).forEach((function(t){Y[t].sort((function(t,e){return t-e}))}))):Y=z;for(var H=function(r){var i=V[r],s=i.nodes[0],u={},c={};i.nodes.forEach((function(t,e){c[t.id]={idx:e,node:t,degree:0,inDegree:0,outDegree:0};var n=t[o];u[n]?u[n]++:u[n]=1}));var l=[],f={};t.edges.forEach((function(t){c[t.source]&&c[t.target]&&(l.push(t),f[t[a]]?f[t[a]]++:f[t[a]]=1,c[t.source].degree++,c[t.target].degree++,c[t.source].outDegree++,c[t.target].inDegree++)}));for(var h=Object.keys(x).length,d=!1,p=0;p<h;p++){var v=Object.keys(x)[p];if(!f[v]||f[v]<x[v].length){d=!0;break}}if(d)return V.splice(r,1),"continue";var y=l.length;if(y<e.edges.length)return V.splice(r,1),"break";var _=!1,w=function(t){var e=l[t],r=e[a],i=x[r];if(!i||!i.length)return f[r]--,i&&f[r]<i.length?(_=!0,"break"):(l.splice(t,1),c[e.source].degree--,c[e.target].degree--,c[e.source].outDegree--,c[e.target].inDegree--,"continue");var s=c[e.source].node[o],u=c[e.target].node[o],h=!1;return i.forEach((function(t){var e=m[t.source].node,r=m[t.target].node;e[o]===s&&r[o]===u&&(h=!0),n||e[o]!==u||r[o]!==s||(h=!0)})),h?void 0:(f[r]--,i&&f[r]<i.length?(_=!0,"break"):(l.splice(t,1),c[e.source].degree--,c[e.target].degree--,c[e.source].outDegree--,c[e.target].inDegree--,"continue"))};for(p=y-1;p>=0;p--){if("break"===w(p))break}if(_)return V.splice(r,1),"continue";i.edges=l;var E=G(i,i.nodes[0].id,!1).length;if(Object.keys(E).reverse().forEach((function(t){if(t!==i.nodes[0].id&&!_){if(E[t]===1/0){var e=c[t].node[o];if(u[e]--,u[e]<b[e].length)return void(_=!0);var n=i.nodes.indexOf(c[t].node);return i.nodes.splice(n,1),void(c[t]=void 0)}var r=g[t].node[o];if(!Y[r]||!Y[r].length||E[t]>Y[r][Y[r].length-1]){e=c[t].node[o];if(u[e]--,u[e]<b[e].length)return void(_=!0);n=i.nodes.indexOf(c[t].node);i.nodes.splice(n,1),c[t]=void 0}}})),_)return V.splice(r,1),"continue";for(var S=!0,O=0;S&&!_;){if(S=!1,n?c[s.id].degree<m[j.id].degree||c[s.id].inDegree<m[j.id].inDegree||c[s.id].outDegree<m[j.id].outDegree:c[s.id].degree<m[j.id].degree){_=!0;break}if(u[s[o]]<b[s[o]].length){_=!0;break}for(var M=i.nodes.length-1;M>=0;M--){var k=i.nodes[M],A=c[k.id].degree,C=c[k.id].inDegree,T=c[k.id].outDegree,I=k[o],P=Tt(L,I,m,b),N=P.minPatternNodeLabelDegree,D=P.minPatternNodeLabelInDegree,R=P.minPatternNodeLabelOutDegree;if(n?A<N||C<D||T<R:A<N){if(u[k[o]]--,u[k[o]]<b[k[o]].length){_=!0;break}i.nodes.splice(M,1),c[k.id]=void 0,S=!0}}if(_||!S&&0!==O)break;for(var B=(y=l.length)-1;B>=0;B--){var F=l[B];if(!c[F.source]||!c[F.target]){l.splice(B,1);var z=F[a];if(f[z]--,c[F.source]&&(c[F.source].degree--,c[F.source].outDegree--),c[F.target]&&(c[F.target].degree--,c[F.target].inDegree--),x[z]&&f[z]<x[z].length){_=!0;break}S=!0}}O++}return _||_||i.nodes.length<e.nodes.length||l.length<e.edges.length?(V.splice(r,1),"continue"):void 0},q=V.length-1;q>=0;q--){if("break"===H(q))break}var K=V.length,Z=function(t){var e=V[t],n={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);n[e]?n[e]++:n[e]=1}));for(var r=function(t){var e=V[t],r={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1}));var i=!0;Object.keys(r).length!==Object.keys(n).length?i=!1:Object.keys(n).forEach((function(t){r[t]!==n[t]&&(i=!1)})),i&&V.splice(t,1)},i=K-1;i>t;i--)r(i);K=V.length};for(q=0;q<=K-1;q++)Z(q);return V}}},jt=function(){function t(t){void 0===t&&(t=10),this.linkedList=new E,this.maxStep=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map((function(t){return t.value}))},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),Pt=F,Nt={getAdjMatrix:x,breadthFirstSearch:A,connectedComponent:T,getDegree:j,getInDegree:P,getOutDegree:N,detectCycle:F,detectDirectedCycle:Pt,detectAllCycles:B,detectAllDirectedCycle:R,detectAllUndirectedCycle:L,depthFirstSearch:D,dijkstra:G,findAllPath:W,findShortestPath:V,floydWarshall:X,labelPropagation:Y,louvain:tt,iLouvain:et,kCore:nt,kMeans:it,cosineSimilarity:ot,nodesCosineSimilarity:at,minimumSpanningTree:ht,pageRank:dt,getNeighbors:O,Stack:jt,GADDI:It},Dt=b.a.transform,Lt=function(t){return function(e,n){return e[t]-n[t]}},Rt=function(t,e,n){return t>=e&&t<=n},Bt=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,u=r.x-n.x,c=r.y-n.y,l=a*c-s*u,f=1/l;if(l*l>1e-4*(a*a+s*s)*(u*u+c*c)){var h=(i*c-o*u)*f,d=(i*s-o*a)*f;return Rt(h,0,1)&&Rt(d,0,1)?{x:t.x+h*a,y:t.y+h*s}:null}return null},Ft=function(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=[],s={x:n+i/2,y:r+o/2};a.push({x:n,y:r}),a.push({x:n+i,y:r}),a.push({x:n+i,y:r+o}),a.push({x:n,y:r+o}),a.push({x:n,y:r});for(var u=null,c=1;c<a.length&&!(u=Bt(a[c-1],a[c],s,e));c++);return u},Gt=function(t,e){var n=t.x,r=t.y,i=t.r,o=e.x-n,a=e.y-r;if(o*o+a*a<i*i)return null;var s=Math.atan(a/o);return{x:n+Math.abs(i*Math.cos(s))*Math.sign(o),y:r+Math.abs(i*Math.sin(s))*Math.sign(a)}},zt=function(t,e){var n=t.rx,r=t.ry,i=t.x,o=t.y,a=e.x-i,s=e.y-o,u=Math.atan2(s/r,a/n);return u<0&&(u+=2*Math.PI),{x:i+n*Math.cos(u),y:o+r*Math.sin(u)}},Ut=function(t,e,n){void 0===n&&(n=1);var r=[t.x,t.y,n];return e&&!isNaN(e[0])||(e=[1,0,0,0,1,0,0,0,1]),b.d.transformMat3(r,r,e),{x:r[0],y:r[1]}},Vt=function(t,e,n){void 0===n&&(n=1),e&&!isNaN(e[0])||(e=[1,0,0,0,1,0,0,0,1]);var r=b.b.invert([1,0,0,0,1,0,0,0,1],e);r||(r=[1,0,0,0,1,0,0,0,1]);var i=[t.x,t.y,n];return b.d.transformMat3(i,i,r),{x:i[0],y:i[1]}},Wt=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=t.x-n.x,a=t.y-n.y,s=(t.x*t.x-e.x*e.x-e.y*e.y+t.y*t.y)/2,u=(t.x*t.x-n.x*n.x-n.y*n.y+t.y*t.y)/2,c=i*o-r*a;return{x:-(a*s-i*u)/c,y:-(r*u-o*s)/c}},Xt=function(t,e){var n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)},Yt=function(t,e){var n=[];return t.forEach((function(t){var r=[];t.forEach((function(t){r.push(t*e)})),n.push(r)})),n},Ht=function(t){for(var e=[],n=t.length,r=0;r<n;r+=1){e[r]=[];for(var i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(var o=0;o<n;o+=1)for(r=0;r<n;r+=1)for(i=0;i<n;i+=1)e[r][i]>e[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e},qt=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];i[a][s]=1,e||(i[s][a]=1)})),i},Kt=function(t,e){t.translate(e.x,e.y)},Zt=function(t,e,n,r){void 0===r&&(r={duration:500});var i=t.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var o=t.getCanvasBBox(),a=e.x-o.minX,s=e.y-o.minY;if(n){var u=a*i[0],c=s*i[4],l=0,f=0,h=0,d=0;t.animate((function(t){return i=Dt(i,[["t",(h=u*t)-l,(d=c*t)-f]]),l=h,f=d,{matrix:i}}),r)}else{var p=Dt(i,[["t",a,s]]);t.setMatrix(p)}},Qt=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e;Object(p.isArray)(e)||(r=[e,e]),Object(p.isArray)(e)&&1===e.length&&(r=[e[0],e[0]]),n=Dt(n,[["s",r[0],r[1]]]),t.setMatrix(n)},$t=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Dt(n,[["r",e]]),t.setMatrix(n)},Jt=function(t,e,n){for(var r=[],i=0;i<t;i++)r[i]=0;return n.forEach((function(t){t.source&&(r[e[t.source]]+=1),t.target&&(r[e[t.target]]+=1)})),r};function te(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}var ee=function(t,e,n){var r=!1,i=t.length;function o(t){return Math.abs(t)<1e-6?0:t<0?-1:1}if(i<=2)return!1;for(var a=0;a<i;a++){var s=t[a],u=t[(a+1)%i];if(te(s,u,[e,n]))return!0;o(s[1]-n)>0!=o(u[1]-n)>0&&o(e-(n-s[1])*(s[0]-u[0])/(s[1]-u[1])-s[0])<0&&(r=!r)}return r},ne=function(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)},re=function(t,e){var n=function(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]}));return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,n),maxY:Math.max.apply(null,n)}},r=function(t){for(var e=[],n=t.length,r=0;r<n-1;r++){var i=t[r],o=t[r+1];e.push({from:{x:i[0],y:i[1]},to:{x:o[0],y:o[1]}})}if(e.length>1){var a=t[0],s=t[n-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e};if(t.length<2||e.length<2)return!1;var i=n(t),o=n(e);if(!ne(i,o))return!1;var a=!1;if(Object(p.each)(e,(function(e){if(ee(t,e[0],e[1]))return a=!0,!1})),a)return!0;if(Object(p.each)(t,(function(t){if(ee(e,t[0],t[1]))return a=!0,!1})),a)return!0;var s=r(t),u=r(e),c=!1;return Object(p.each)(u,(function(t){if(function(t,e){var n=!1;return Object(p.each)(t,(function(t){if(Bt(t.from,t.to,e.from,e.to))return n=!0,!1})),n}(s,t))return c=!0,!1})),c},ie=function(){function t(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}return t.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:t,y:e,minX:t,minY:e,maxX:n,maxY:r,width:n-t,height:r-e}},t}(),oe=function(t,e){return{top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]}[e]},ae=function(t,e){var n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){var o=n/i,a=r/i;if(o>=0&&o<=1&&a>=0&&a<=1)return o}return Number.POSITIVE_INFINITY},se=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=0,o=[],a=0;a<4;a++){var s=oe(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3];o[a]=Bt({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:u,y:c},{x:l,y:f}),o[a]&&(i+=1)}return[o,i]},ue=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=Number.POSITIVE_INFINITY,o=0,a=0;a<4;a++){var s=oe(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3],h=ae(e,new ie(u,c,l,f));(h=Math.abs(h-.5))>=0&&h<=1&&(o+=1,i=h<i?h:i)}return 0===o?-1:i},ce=function(t){var e=0,n=0;if(t.length>0){for(var r=0,i=t;r<i.length;r++){var o=i[r];e+=o.x,n+=o.y}e/=t.length,n/=t.length}return{x:e,y:n}},le=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},fe=function(t,e){var n,r=e.x1,i=e.y1,o=e.x2-r,a=e.y2-i,s=t.x-r,u=t.y-i,c=s*o+u*a;n=c<=0||(c=(s=o-s)*o+(u=a-u)*a)<=0?0:c*c/(o*o+a*a);var l=s*s+u*u-n;return l<0&&(l=0),l},he=function(t,e,n){return void 0===n&&(n=.001),Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(n,2)},de=function(t,e){var n=t.x<e.x,r=t.x>e.x+e.width,i=t.y>e.y+e.height,o=t.y<e.y;if(!(n||r||i||o))return 0;if(i&&!n&&!r)return Math.pow(e.y+e.height-t.y,2);if(o&&!n&&!r)return Math.pow(t.y-e.y,2);if(n&&!i&&!o)return Math.pow(e.x-t.x,2);if(r&&!i&&!o)return Math.pow(e.x+e.width-t.x,2);var a=Math.min(Math.abs(e.x-t.x),Math.abs(e.x+e.width-t.x)),s=Math.min(Math.abs(e.y-t.y),Math.abs(e.y+e.height-t.y));return a*a+s*s},pe=function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=e.x,s=e.y,u=[i-n,o-r];if(b.c.exactEquals(u,[0,0]))return NaN;var c=[-u[1],u[0]];b.c.normalize(c,c);var l=[a-n,s-r];return Math.abs(b.c.dot(l,c))},ge=function(t,e,n){return t+(e-t)*n},ve="rgb(253, 253, 253)",ye="rgb(95, 149, 255)",me="rgb(95, 149, 255)",be="rgb(247, 250, 255)",xe="rgb(95, 149, 255)",_e="rgb(224, 224, 224)",we="rgb(95, 149, 255)",Ee="rgb(224, 224, 224)",Se="rgb(95, 149, 255)",Oe={version:"0.6.0-beta.2",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:ye,fill:"rgb(239, 244, 255)"},size:20,color:ye,linkPoints:{size:8,lineWidth:1,fill:be,stroke:me}},nodeStateStyles:{active:{fill:be,stroke:me,lineWidth:2,shadowColor:ye,shadowBlur:10},selected:{fill:"rgb(255, 255, 255)",stroke:xe,lineWidth:4,shadowColor:xe,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:"rgb(223, 234, 255)",stroke:"#4572d9",lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:"rgb(247, 250, 255)",stroke:"rgb(191, 213, 255)",lineWidth:1},disable:{fill:"rgb(250, 250, 250)",stroke:"rgb(224, 224, 224)",lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:_e,lineAppendWidth:2},color:_e},edgeStateStyles:{active:{stroke:"rgb(95, 149, 255)",lineWidth:1},selected:{stroke:we,lineWidth:2,shadowColor:we,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:"rgb(95, 149, 255)",lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:"rgb(234, 234, 234)",lineWidth:1},disable:{stroke:"rgb(245, 245, 245)",lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ve,lineWidth:1,stroke:Ee,r:5,width:20,height:10},size:[20,5],color:Ee,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:"rgb(95, 149, 255)",lineWidth:1,fill:"rgb(247, 250, 255)"},selected:{stroke:Se,lineWidth:2,fill:ve,shadowColor:Se,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:"#4572d9",lineWidth:2,fill:ve,"text-shape":{fontWeight:500}},inactive:{stroke:"rgb(224, 224, 224)",fill:ve,lineWidth:1},disable:{stroke:"rgb(234, 234, 234)",fill:"rgb(250, 250, 250)",lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},windowFontFamily:"undefined"!=typeof window&&window.getComputedStyle&&document.body&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},Me={" ":.3329986572265625,a:.5589996337890625,A:.6569992065429687,b:.58599853515625,B:.6769989013671875,c:.5469985961914062,C:.7279998779296875,d:.58599853515625,D:.705999755859375,e:.554998779296875,E:.63699951171875,f:.37299957275390627,F:.5769989013671875,g:.5909988403320312,G:.7479995727539063,h:.555999755859375,H:.7199996948242188,i:.255999755859375,I:.23699951171875,j:.26699981689453123,J:.5169998168945312,k:.5289993286132812,K:.6899993896484375,l:.23499908447265624,L:.5879989624023437,m:.854998779296875,M:.8819992065429687,n:.5589996337890625,N:.7189987182617188,o:.58599853515625,O:.7669998168945312,p:.58599853515625,P:.6419998168945312,q:.58599853515625,Q:.7669998168945312,r:.3649993896484375,R:.6759994506835938,s:.504998779296875,S:.6319992065429687,t:.354998779296875,T:.6189987182617187,u:.5599990844726562,U:.7139999389648437,v:.48199920654296874,V:.6389999389648438,w:.754998779296875,W:.929998779296875,x:.5089996337890625,X:.63699951171875,y:.4959991455078125,Y:.66199951171875,z:.48699951171875,Z:.6239990234375,0:.6,1:.40099945068359377,2:.6,3:.6,4:.6,5:.6,6:.6,7:.5469985961914062,8:.6,9:.6,"[":.3329986572265625,"]":.3329986572265625,",":.26399993896484375,".":.26399993896484375,";":.26399993896484375,":":.26399993896484375,"{":.3329986572265625,"}":.3329986572265625,"\\":.5,"|":.19499969482421875,"=":.604998779296875,"+":.604998779296875,"-":.604998779296875,_:.5,"`":.3329986572265625," ~":.8329986572265625,"!":.3329986572265625,"@":.8579986572265625,"#":.6,$:.6,"%":.9699996948242188,"^":.517999267578125,"&":.7259994506835937,"*":.505999755859375,"(":.3329986572265625,")":.3329986572265625,"<":.604998779296875,">":.604998779296875,"/":.5,"?":.53699951171875},ke=Math.PI,Ae=Math.sin,Ce=Math.cos,Te=Ae(ke/8),Ie=Ce(ke/8),je=function(t,e){var n=t.getBBox(),r={x:n.minX,y:n.minY},i={x:n.maxX,y:n.maxY};if(e){var o=e.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),r=Ut(r,o),i=Ut(i,o)}var a=r.x,s=r.y,u=i.x,c=i.y;return{x:a,y:s,minX:a,minY:s,maxX:u,maxY:c,width:u-a,height:c-s}},Pe=function(t){var e=t.sourceNode||t.targetNode,n=e.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e.getKeyShape().getBBox(),i=t.loopCfg||{},o=i.dist||2*Math.max(r.width,r.height),a=i.position||Oe.defaultLoopPosition,s=[n[6],n[7]],u=[t.startPoint.x,t.startPoint.y],c=[t.endPoint.x,t.endPoint.y],l=r.height/2,f=r.height/2,h=l*Te,d=l*Ie,p=f*Te,g=f*Ie;if(u[0]===c[0]&&u[1]===c[1]){switch(a){case"top":u=[s[0]-h,s[1]-d],c=[s[0]+p,s[1]-g];break;case"top-right":l=r.height/2,f=r.width/2,u=[s[0]+(h=l*Te),s[1]-(d=l*Ie)],c=[s[0]+(g=f*Ie),s[1]-(p=f*Te)];break;case"right":l=r.width/2,f=r.width/2,u=[s[0]+(d=l*Ie),s[1]-(h=l*Te)],c=[s[0]+(g=f*Ie),s[1]+(p=f*Te)];break;case"bottom-right":l=r.width/2,f=r.height/2,u=[s[0]+(d=l*Ie),s[1]+(h=l*Te)],c=[s[0]+(p=f*Te),s[1]+(g=f*Ie)];break;case"bottom":l=r.height/2,f=r.height/2,u=[s[0]+(h=l*Te),s[1]+(d=l*Ie)],c=[s[0]-(p=f*Te),s[1]+(g=f*Ie)];break;case"bottom-left":l=r.height/2,f=r.width/2,u=[s[0]-(h=l*Te),s[1]+(d=l*Ie)],c=[s[0]-(g=f*Ie),s[1]+(p=f*Te)];break;case"left":l=r.width/2,f=r.width/2,u=[s[0]-(d=l*Ie),s[1]+(h=l*Te)],c=[s[0]-(g=f*Ie),s[1]-(p=f*Te)];break;case"top-left":l=r.width/2,f=r.height/2,u=[s[0]-(d=l*Ie),s[1]-(h=l*Te)],c=[s[0]-(p=f*Te),s[1]-(g=f*Ie)];break;default:l=r.width/2,f=r.width/2,u=[s[0]-(h=l*Te),s[1]-(d=l*Ie)],c=[s[0]+(p=f*Te),s[1]-(g=f*Ie)]}if(!1===i.clockwise){var v=[u[0],u[1]];u=[c[0],c[1]],c=[v[0],v[1]]}}var y=[u[0]-s[0],u[1]-s[1]],m=(l+o)/l,x=(f+o)/f;!1===i.clockwise&&(m=(f+o)/f,x=(l+o)/l);var _=b.c.scale([0,0],y,m),w=[s[0]+_[0],s[1]+_[1]],E=[c[0]-s[0],c[1]-s[1]],S=b.c.scale([0,0],E,x),O=[s[0]+S[0],s[1]+S[1]];return t.startPoint={x:u[0],y:u[1]},t.endPoint={x:c[0],y:c[1]},t.controlPoints=[{x:w[0],y:w[1]},{x:O[0],y:O[1]}],t},Ne=function(t,e,n,r,i){var o=[],a=null==t?void 0:t.getPoint(e);if(!a)return{x:0,y:0,angle:0};if(e<1e-4)o=t.getStartTangent().reverse();else if(e>.9999)o=t.getEndTangent();else{var s=null==t?void 0:t.getPoint(e+1e-4);o.push([a.x,a.y]),o.push([s.x,s.y])}var u=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(u<0&&(u+=2*ke),n&&(a.x+=Ce(u)*n,a.y+=Ae(u)*n),r){var c=u-ke/2;u>.5*ke&&u<1.5*ke&&(c-=ke),a.x+=Ce(c)*r,a.y+=Ae(c)*r}var l={x:a.x,y:a.y,angle:u};return i?(u>.5*ke&&u<1.5*ke&&(u-=ke),Object(d.__assign)({rotate:u},l)):l},De=function t(e,n){if(!1===n(e))return!1;if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return!1;return!0},Le=function(t,e){"function"==typeof e&&De(t,e)},Re=function(t,e){"function"==typeof e&&function t(e,n){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return;return!1!==n(e)}(t,e)},Be=function(t,e){return e*(Me[t]||1)},Fe=function(t,e){var n=0,r=new RegExp("[一-龥]+");return t.split("").forEach((function(t){r.test(t)?n+=e:n+=Be(t,e)})),[n,e]},Ge=function(t,e){var n=[],r={},i={};t.forEach((function(t){i[t.id]=t})),t.forEach((function(t,e){var o=Object(p.clone)(t);o.itemType="combo",o.children=void 0,o.parentId===o.id?(console.warn("The parentId for combo ".concat(o.id," can not be the same as the combo's id")),delete o.parentId):o.parentId&&!i[o.parentId]&&(console.warn("The parent combo for combo ".concat(o.id," does not exist!")),delete o.parentId);var a=r[o.id];if(a){if(o.children=a.children,r[o.id]=o,!(a=o).parentId)return void n.push(a);var s=r[a.parentId];if(s)s.children?s.children.push(o):s.children=[o];else{var u={id:a.parentId,children:[a]};r[a.parentId]=u,r[o.id]=o}}else if(Object(p.isString)(t.parentId)){var c=r[t.parentId];if(c)c.children?c.children.push(o):c.children=[o],r[o.id]=o;else{var l={id:t.parentId,children:[o]};r[l.id]=l,r[o.id]=o}}else n.push(o),r[o.id]=o}));var o={};(e||[]).forEach((function(t){o[t.id]=t;var e=r[t.comboId];if(e){var n={id:t.id,comboId:t.comboId};e.children?e.children.push(n):e.children=[n],n.itemType="node",r[t.id]=n}}));var a=0;return n.forEach((function(t){t.depth=a+10,De(t,(function(t){var e,n=r[t.id].itemType;e="node"===n?r[t.comboId]:r[t.parentId],t.depth=e&&"node"===n?a+1:a+10,a<t.depth&&(a=t.depth);var i=o[t.id];return i&&(i.depth=t.depth),!0}))})),n},ze=function(t,e,n){var r,i,o=t,a={root:{children:t}},s=!1,u="root";(t||[]).forEach((function(t){if(!s)return t.id===e?(i=t,"combo"===t.itemType?i.parentId=n:i.comboId=n,void(s=!0)):void Le(t,(function(t){var r;return a[t.id]={children:(null==t?void 0:t.children)||[]},o=null===(r=a[t.parentId||t.comboId||"root"])||void 0===r?void 0:r.children,!t||!t.removed&&e!==t.id||!o||(u=t.parentId||t.comboId||"root",i=t,"combo"===t.itemType?i.parentId=n:i.comboId=n,s=!0,!1)}))}));var c=(o=null===(r=a[u])||void 0===r?void 0:r.children)?o.indexOf(i):-1;if(c>-1&&o.splice(c,1),s||(i={id:e,itemType:"node",comboId:n},a[e]={children:void 0}),e){var l=!1;if(n){var f=0;(t||[]).forEach((function(t){l||Le(t,(function(t){return n!==t.id||(l=!0,t.children?t.children.push(i):t.children=[i],f=t.depth,"node"===i.itemType?i.depth=f+2:i.depth=f+1,!1)}))}))}else n&&l||"node"===i.itemType||t.push(i);var h=i.depth;Le(i,(function(t){return"node"===t.itemType?h+=2:h+=1,t.depth=h,!0}))}return t},Ue=function(t,e,n){var r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||0===t.length){var i=(null==n?void 0:n.getModel())||{},o=i.x,a=i.y;return{minX:o,minY:a,maxX:o,maxY:a,x:o,y:a,width:void 0,height:void 0}}return t.forEach((function(t){var n=e.findById(t.id);if(n&&n.isVisible()){n.set("bboxCanvasCache",void 0);var i=n.getCanvasBBox();i.x&&r.minX>i.minX&&(r.minX=i.minX),i.y&&r.minY>i.minY&&(r.minY=i.minY),i.x&&r.maxX<i.maxX&&(r.maxX=i.maxX),i.y&&r.maxY<i.maxY&&(r.maxY=i.maxY)}})),r.x=(r.minX+r.maxX)/2,r.y=(r.minY+r.maxY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.centerX=(r.minX+r.maxX)/2,r.centerY=(r.minY+r.maxY)/2,Object.keys(r).forEach((function(t){r[t]!==1/0&&r[t]!==-1/0||(r[t]=void 0)})),r},Ve=function(t){var e=Object(p.isNumber)(t.x)||Object(p.isNumber)(t.y)||t.type||t.anchorPoints||t.size;return t.style&&(e=e||Object(p.isNumber)(t.style.r)||Object(p.isNumber)(t.style.width)||Object(p.isNumber)(t.style.height)||Object(p.isNumber)(t.style.rx)||Object(p.isNumber)(t.style.ry)),e},We=function(t){var e={};return Object.keys(t).forEach((function(n){var r=t[n];if(Object(p.isObject)(r)&&!Object(p.isArray)(r)){var i={};Object.keys(r).forEach((function(t){var e=r[t];("img"!==t||Object(p.isString)(e))&&(i[t]=Object(p.clone)(e))})),e[n]=i}else e[n]=Object(p.clone)(r)})),e},Xe=function(t){var e;if(!t)return console.error("G6 Error Tips: the data must be defined"),!1;var n=t.nodes,r=t.edges,i=t.combos,o=void 0===i?[]:i;if(!n&&!r){var a=!0;return Le(t,(function(t){return!!Object(p.isString)(t.id)||(a=!1,!1)})),a}var s=(n||[]).find((function(t){return!Object(p.isString)(t.id)}));if(s)return console.warn("G6 Warning Tips: missing 'id' property, or %c".concat(s.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1;var u=(n||[]).map((function(t){return t.id})),c=null===(e=o)||void 0===e?void 0:e.map((function(t){return t.id})),l=Object(d.__spreadArray)(Object(d.__spreadArray)([],u,!0),c,!0),f=(r||[]).find((function(t){return!l.includes(t.source)||!l.includes(t.target)}));return!f||(console.warn("G6 Warning Tips: The source %c".concat(f.source,"%c or the target %c").concat(f.target,"%c of the edge do not exist in the nodes or combos."),"font-size: 20px; color: red;","","font-size: 20px; color: red;",""),!1)},Ye=function(){function t(t){this.graph=t,this.destroyed=!1,this.modes=t.get("modes")||{default:[]},this.formatModes(),this.mode=t.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return t.prototype.formatModes=function(){var t=this.modes;Object(p.each)(t,(function(t){Object(p.each)(t,(function(e,n){Object(p.isString)(e)&&(t[n]={type:e})}))}))},t.prototype.setBehaviors=function(t){var e,n=this.graph,r=this.modes[t],i=[];Object(p.each)(r||[],(function(t){var r=v.getBehavior(t.type||t);r&&(e=new r(t))&&(e.bind(n),i.push(e))})),this.currentBehaves=i},t.mergeBehaviors=function(t,e){return Object(p.each)(e,(function(e){t.indexOf(e)<0&&(Object(p.isString)(e)&&(e={type:e}),t.push(e))})),t},t.filterBehaviors=function(t,e){var n=[];return t.forEach((function(t){var r="";r=Object(p.isString)(t)?t:t.type,e.indexOf(r)<0&&n.push(t)})),n},t.prototype.setMode=function(t){var e=this.modes,n=this.graph,r=t;e[r]&&(n.emit("beforemodechange",{mode:t}),Object(p.each)(this.currentBehaves,(function(t){t.delegate&&t.delegate.remove(),t.unbind(n)})),this.setBehaviors(r),n.emit("aftermodechange",{mode:t}),this.mode=t)},t.prototype.getMode=function(){return this.mode},t.prototype.manipulateBehaviors=function(e,n,r){var i,o=this;if(i=Object(p.isArray)(e)?e:[e],Object(p.isArray)(n))return Object(p.each)(n,(function(e){o.modes[e]?o.modes[e]=r?t.mergeBehaviors(o.modes[e]||[],i):t.filterBehaviors(o.modes[e]||[],i):r&&(o.modes[e]=i)})),this;var a=n;return n||(a=this.mode),this.modes[a]||r&&(this.modes[a]=i),this.modes[a]=r?t.mergeBehaviors(this.modes[a]||[],i):t.filterBehaviors(this.modes[a]||[],i),this.formatModes(),this.setMode(this.mode),this},t.prototype.updateBehavior=function(t,e,n){Object(p.isString)(t)&&(t={type:t});var r=[];if(n&&n!==this.mode&&"default"!==n){if(!(r=this.modes[n])||!r.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;var i=r.length;for(a=0;a<i;a++){if((s=r[a]).type===t.type||s===t.type)return s===t.type&&(s={type:s}),Object.assign(s,e),r[a]=s,this;a===i-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(!(r=this.currentBehaves)||!r.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var o=r.length,a=0;a<o;a++){var s;if((s=r[a]).type===t.type)return s.updateCfg(e),this;a===o-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},t.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},t}(),He=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.item=n.item,r.canvasX=n.canvasX,r.canvasY=n.canvasY,r.wheelDelta=n.wheelDelta,r.detail=n.detail,r}return Object(d.__extends)(e,t),e}(n(215).Event),qe=function(t){return"".concat(t,"-").concat(Math.random()).concat(Date.now())},Ke=function(t){if(Object(p.isArray)(t))switch(t.length){case 4:return t;case 3:return t.push(t[1]),t;case 2:return t.concat(t);case 1:return[t[0],t[0],t[0],t[0]];default:return[0,0,0,0]}if(Object(p.isNumber)(t))return[t,t,t,t];if(Object(p.isString)(t)){var e=parseInt(t,10);return[e,e,e,e]}return[0,0,0,0]},Ze=function(t){var e=new He(t.type,t);return e.clientX=t.clientX,e.clientY=t.clientY,e.x=t.x,e.y=t.y,e.target=t.target,e.currentTarget=t.currentTarget,e.bubbles=!0,e.item=t.item,e},Qe=function(t){if(!t)return!1;for(var e=[1,0,0,0,1,0,0,0,1],n=0;n<9;n++)if(t[n]!==e[n])return!0;return!1},$e=function(t){return Number.isNaN(Number(t))},Je=function(t){for(var e=1/0,n=-1/0,r=1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o].getBBox(),s=a.minX,u=a.minY,c=a.maxX,l=a.maxY;s<e&&(e=s),u<r&&(r=u),c>n&&(n=c),l>i&&(i=l)}return{x:Math.floor(e),y:Math.floor(r),width:Math.ceil(n)-Math.floor(e),height:Math.ceil(i)-Math.floor(r),minX:e,minY:r,maxX:n,maxY:i}},tn=function(t,e,n,r,i){void 0===e&&(e=15),void 0===n&&(n="quadratic"),void 0===r&&(r=void 0),void 0===i&&(i=void 0);for(var o=t.length,a=2*e,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],u={},c=[],l={},f=0;f<o;f++){var h=t[f],d=h.source,p=h.target,g="".concat(d,"-").concat(p);if(!c[f]){u[g]||(u[g]=[]),c[f]=!0,u[g].push(h);for(var v=0;v<o;v++)if(f!==v){var y=t[v],m=y.source,b=y.target;c[v]||(d===b&&p===m?(u[g].push(y),c[v]=!0,l["".concat(m,"|").concat(b,"|").concat(u[g].length-1)]=!0):d===m&&p===b&&(u[g].push(y),c[v]=!0))}}}for(var x in u)for(var _=u[x],w=_.length,E=0;E<w;E++){var S=_[E];if(S.source!==S.target)if(1===w&&r&&S.source!==S.target)S.type=r;else{S.type=n;var O=(E%2==0?1:-1)*(l["".concat(S.source,"|").concat(S.target,"|").concat(E)]?-1:1);S.curveOffset=w%2==1?O*Math.ceil(E/2)*a:O*(Math.floor(E/2)*a+e)}else i&&(S.type=i),S.loopCfg={position:s[E%8],dist:20*Math.floor(E/8)+50}}return t},en=function(){function t(t){this.destroyed=!1,this.graph=t,this.destroyed=!1}return t.prototype.getViewCenter=function(){var t=this.getFormatPadding(),e=this.graph,n=this.graph.get("width"),r=e.get("height");return{x:(n-t[1]-t[3])/2+t[3],y:(r-t[0]-t[2])/2+t[0]}},t.prototype.fitCenter=function(){var t=this.graph,e=t.get("group");e.resetMatrix();var n=e.getCanvasBBox();if(0!==n.width&&0!==n.height){var r=this.getViewCenter(),i=n.x+n.width/2,o=n.y+n.height/2;t.translate(r.x-i,r.y-o)}},t.prototype.fitView=function(){var t=this.graph,e=this.getFormatPadding(),n=t.get("width"),r=t.get("height"),i=t.get("group");i.resetMatrix();var o=i.getCanvasBBox();if(0!==o.width&&0!==o.height){var a=this.getViewCenter(),s=o.x+o.width/2,u=o.y+o.height/2;t.translate(a.x-s,a.y-u);var c=(n-e[1]-e[3])/o.width,l=(r-e[0]-e[2])/o.height,f=c;c>l&&(f=l),t.zoom(f,a)||console.warn("zoom failed, ratio out of range, ratio: %f",f)}},t.prototype.fitViewByRules=function(t){var e=t.onlyOutOfViewPort,n=void 0!==e&&e,r=t.direction,i=void 0===r?"both":r,o=t.ratioRule,a=void 0===o?"min":o,s=this.graph,u=this.getFormatPadding(),c=s.get("width"),l=s.get("height"),f=s.get("group");f.resetMatrix();var h=f.getCanvasBBox();if(0!==h.width&&0!==h.height){var d=this.getViewCenter(),p=h.x+h.width/2,g=h.y+h.height/2;s.translate(d.x-p,d.y-g);var v,y=(c-u[1]-u[3])/h.width,m=(l-u[0]-u[2])/h.height;v="x"===i?y:"y"===i?m:"max"===a?Math.max(y,m):Math.min(y,m),n&&(v=v<1?v:1);var b=s.getZoom()*v,x=s.get("minZoom");b<x&&(b=x,console.warn("fitview failed, ratio out of range, ratio: %f",v,"graph minzoom has been used instead")),s.zoomTo(b,d)}},t.prototype.getFormatPadding=function(){var t=this.graph.get("fitViewPadding");return Ke(t)},t.prototype.focusPoint=function(t,e,n){var r=this,i=this.getViewCenter(),o=this.getPointByCanvas(i.x,i.y),a=this.graph.get("group").getMatrix();if(a||(a=[1,0,0,0,1,0,0,0,1]),e){var s=(o.x-t.x)*a[0],u=(o.y-t.y)*a[4],c=0,l=0,f=0,h=0;this.graph.get("canvas").animate((function(t){f=s*t,h=u*t,r.graph.translate(f-c,h-l),c=f,l=h}),Object(d.__assign)({},n))}else this.graph.translate((o.x-t.x)*a[0],(o.y-t.y)*a[4])},t.prototype.getPointByCanvas=function(t,e){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Vt({x:t,y:e},n)},t.prototype.getPointByClient=function(t,e){var n=this.graph.get("canvas").getPointByClient(t,e);return this.getPointByCanvas(n.x,n.y)},t.prototype.getClientByPoint=function(t,e){var n=this.graph.get("canvas"),r=this.getCanvasByPoint(t,e),i=n.getClientByPoint(r.x,r.y);return{x:i.x,y:i.y}},t.prototype.getCanvasByPoint=function(t,e){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Ut({x:t,y:e},n)},t.prototype.focus=function(t,e,n){if(Object(p.isString)(t)&&(t=this.graph.findById(t)),t){var r=0,i=0;if(t.getType&&"edge"===t.getType()){var o=t.getSource().get("group").getMatrix(),a=t.getTarget().get("group").getMatrix();o&&a?(r=(o[6]+a[6])/2,i=(o[7]+a[7])/2):(o||a)&&(r=o?o[6]:a[6],i=o?o[7]:a[7])}else{var s=t.get("group").getMatrix();s||(s=[1,0,0,0,1,0,0,0,1]),r=s[6],i=s[7]}this.focusPoint({x:r,y:i},e,n)}},t.prototype.changeSize=function(t,e){var n=this.graph;if(!Object(p.isNumber)(t)||!Object(p.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:t,height:e}),n.get("canvas").changeSize(t,e),n.get("plugins").forEach((function(t){t.get("gridContainer")&&t.positionInit()}))},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function nn(t){return(nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rn(t){if("string"!=typeof t)return t;var e=function(t){if("string"!=typeof t)return t;try{return JSON.parse(t.trim())}catch(e){return t.trim()}},n=e(t);if("string"!=typeof n)return n;for(var r=function(t){return t[t.length-1]},i=t.trim(),o=[],a=[],s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.some((function(t){return r(a)===t}))},u=null,c=0,l="";c<i.length;){var f=i[c],h=s('"',"'");if(h||f.trim()){var d="\\"===i[c-1],p=s("}"),g=s("]"),v=s(","),y=r(o);if(h)if(r(a)!==f||d)l+=f;else{a.pop();var m=e(l);y.push(m),u=m,l=""}else if(g&&","===f)l&&(y.push(e(l)),l="");else if(p&&":"===f)a.push(","),l&&(y.push(l),l="");else if(v&&","===f)l&&(y.push(e(l)),l=""),a.pop();else if("}"===f&&(p||v)){l&&(y.push(e(l)),l=""),v&&a.pop();for(var b={},x=1;x<y.length;x+=2)b[y[x-1]]=y[x];o.pop(),o.length&&r(o).push(b),a.pop(),u=b}else"]"===f&&g?(l&&(y.push(e(l)),l=""),o.pop(),o.length&&r(o).push(y),a.pop(),u=y):"{"===f?(o.push([]),a.push("}")):"["===f?(o.push([]),a.push("]")):'"'===f?a.push('"'):"'"===f?a.push("'"):l+=f;c+=1}else c+=1}return u||l}function on(t,e){var n;void 0===e&&(e={x:0,y:0});var r=Object(d.__assign)({x:0,y:0,width:0,height:0},e);if(null===(n=t.children)||void 0===n?void 0:n.length){var i=t.attrs,o=void 0===i?{}:i,a=o.marginTop,s=Object(d.__assign)({},e);a&&(s.y+=a);for(var u=0;u<t.children.length;u++){t.children[u].attrs.key="".concat(o.key||"root"," -").concat(u," ");var c=on(t.children[u],s);if(c.bbox){var l=c.bbox;"inline"===c.attrs.next?s.x+=c.bbox.width:s.y+=c.bbox.height,l.width+l.x>r.width&&(r.width=l.width+l.x),l.height+l.y>r.height&&(r.height=l.height+l.y)}}}return t.bbox=function(t,e,n){var r,i,o=t.attrs,a=void 0===o?{}:o,s={x:e.x||0,y:e.y||0,width:n.width||0,height:n.height||0};switch(t.type){case"maker":case"circle":a.r&&(i=2*a.r,r=2*a.r);break;case"text":a.text&&(i=Fe(a.text,a.fontSize||12)[0],r=16,s.y+=r,s.height=r,s.width=i,t.attrs=Object(d.__assign)({fontSize:12,fill:"#000"},a));break;default:a.width&&(i=a.width),a.height&&(r=a.height)}return r>=0&&(s.height=r),i>=0&&(s.width=i),a.marginTop&&(s.y+=a.marginTop),a.marginLeft&&(s.x+=a.marginLeft),s}(t,e,r),t.attrs=Object(d.__assign)(Object(d.__assign)({},t.attrs),t.bbox),t}function an(t){var e={},n=function(e){var n=function(t){return function(e){for(var n=t.length,r=[],i=0,o="";i<n;)if("{"===t[i]&&"{"===t[i+1])r.push(o),o="",i+=2;else if("}"===t[i]&&"}"===t[i+1]){if(r.length){var a=r.pop();o=Object(p.get)(e,o,a.endsWith("=")?'"{'.concat(o,'}"'):o),r.push(a+o)}i+=2,o=""}else o+=t[i],i+=1;return r.push(o),r.map((function(t,e){return r[e-1]&&r[e-1].endsWith("=")?'"{'.concat(t,'}"'):t})).join("")}}("function"==typeof t?t(e):t)(e),r=document.createElement("div");r.innerHTML=n;var i=on(function t(e,n){var r={},i=e.getAttributeNames&&e.getAttributeNames()||[],o=e.children&&Array.from(e.children).map((function(e){return t(e,n)})),a={},s=e.tagName?e.tagName.toLowerCase():"group";return"text"===s&&(r.text=e.innerText),a.type=s,"img"===s&&(a.type="image"),Array.from(i).forEach((function(t){var n=t.split("-").reduce((function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)})),i=e.getAttribute(t);try{if("style"===n||"attrs"===n){var o=rn(i);r=Object(d.__assign)(Object(d.__assign)({},r),o)}else a[n]=rn(i)}catch(t){if("style"===n)throw t;a[n]=i}})),a.attrs=r,n&&n.style&&a.name&&"object"===nn(n.style[a.name])&&(a.attrs=Object(d.__assign)(Object(d.__assign)({},a.attrs),n.style[a.name])),n&&n.style&&a.keyshape&&(a.attrs=Object(d.__assign)(Object(d.__assign)({},a.attrs),n.style)),o.length&&(a.children=o),a}(r.children[0],e));return r.remove(),i};return{draw:function(t,r){var i=n(t),o=r;return function t(e){var n=e.attrs,i=void 0===n?{}:n,a=e.bbox,s=e.type,u=e.children,c=Object(d.__rest)(e,["attrs","bbox","type","children"]);if("group"!==e.type){var l=r.addShape(e.type,Object(d.__assign)({attrs:i,origin:{bbox:a,type:s,children:u}},c));e.keyshape&&(o=l)}e.children&&e.children.forEach((function(e){return t(e)}))}(i),e[t.id]=[i],o},update:function(t,r){e[t.id]||(e[t.id]=[]);var i=r.getContainer(),o=i.get("children"),a=n(t),s=function t(e,n){var r,i,o,a,s=(e||{}).type,u=((null==n?void 0:n.attrs)||{}).key;if(u&&e&&(e.attrs.key=u),!e&&n)return{action:"delete",val:n,type:s,key:u};if(e&&!n)return{action:"add",val:e,type:s};if(!e&&!n)return{action:"same",type:s};var c=[];if((null===(r=e.children)||void 0===r?void 0:r.length)>0||(null===(i=n.children)||void 0===i?void 0:i.length)>0)for(var l=Math.max(null===(o=e.children)||void 0===o?void 0:o.length,null===(a=n.children)||void 0===a?void 0:a.length),f=n.children||[],h=e.children||[],d=0;d<l;d+=1)c.push(t(h[d],f[d]));var p=Object.keys(n.attrs),g=Object.keys(e.attrs);return n.type!==e.type?{action:"restructure",nowTarget:e,formerTarget:n,key:u,children:c}:p.filter((function(t){return"children"!==t})).some((function(t){return e.attrs[t]!==n.attrs[t]||!g.includes(t)}))?{action:"change",val:e,children:c,type:s,key:u}:{action:"same",children:c,type:s,key:u}}(a,e[t.id].pop()),u=function t(e){var n;"group"!==e.type&&i.addShape(e.type,{attrs:e.attrs}),(null===(n=e.children)||void 0===n?void 0:n.length)&&e.children.map((function(e){return t(e)}))},c=function t(e){var n,r=o.find((function(t){return t.attrs.key===e.attrs.key}));r&&i.removeChild(r),(null===(n=e.children)||void 0===n?void 0:n.length)&&e.children.map((function(e){return t(e)}))};!function t(e){var n=e.key;if("group"!==e.type){var i=o.find((function(t){return t.attrs.key===n}));switch(e.action){case"change":if(i){var a=e.val.keyshape?r.getOriginStyle():{};i.attr(Object(d.__assign)(Object(d.__assign)({},a),e.val.attrs))}break;case"add":u(e.val);break;case"delete":c(e.val);break;case"restructure":c(e.formerTarget),u(e.nowTarget)}}e.children&&e.children.forEach((function(e){return t(e)}))}(s),e[t.id].push(a)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var sn={};function un(t){return sn[t]||(sn[t]=Object(p.upperFirst)(t)),sn[t]}var cn={defaultShapeType:"defaultType",className:null,getShape:function(t){return this[t]||this[this.defaultShapeType]||this["simple-circle"]},draw:function(t,e,n){var r=this.getShape(t);n.shapeMap={};var i=r.draw(e,n);return r.afterDraw&&r.afterDraw(e,n,i),i},baseUpdate:function(t,e,n,r){var i,o,a=this.getShape(t);a.update&&(a.mergeStyle=null===(i=a.getOptions)||void 0===i?void 0:i.call(a,e,r),null===(o=a.update)||void 0===o||o.call(a,e,n,r)),a.afterUpdate&&a.afterUpdate(e,n)},setState:function(t,e,n,r){this.getShape(t).setState(e,n,r)},shouldUpdate:function(t){return!!this.getShape(t).update},getControlPoints:function(t,e){return this.getShape(t).getControlPoints(e)},getAnchorPoints:function(t,e){return this.getShape(t).getAnchorPoints(e)}},ln={options:{},draw:function(t,e){return this.drawShape(t,e)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e=this.options.anchorPoints;return t.anchorPoints||e}},fn=function(){function t(){}return t.registerFactory=function(e,n){var r=un(e),i=cn,o=Object(d.__assign)(Object(d.__assign)({},i),n);return t[r]=o,o.className=r,o},t.getFactory=function(e){return t[un(e)]},t.registerNode=function(e,n,r){var i,o=t.Node;if("string"==typeof n||"function"==typeof n){var a=an(n);i=Object(d.__assign)(Object(d.__assign)({},o.getShape("single-node")),a)}else if(n.jsx){a=an(n.jsx);i=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},o.getShape("single-node")),a),n)}else{o.getShape(r);var s=r?o.getShape(r):ln;i=Object(d.__assign)(Object(d.__assign)({},s),n)}return i.type=e,i.itemType="node",o[e]=i,i},t.registerEdge=function(e,n,r){var i=t.Edge,o=r?i.getShape(r):ln,a=Object(d.__assign)(Object(d.__assign)({},o),n);return a.type=e,a.itemType="edge",i[e]=a,a},t.registerCombo=function(e,n,r){var i=t.Combo,o=r?i.getShape(r):ln,a=Object(d.__assign)(Object(d.__assign)({},o),n);return a.type=e,a.itemType="combo",i[e]=a,a},t}(),hn=fn;fn.registerFactory("node",{defaultShapeType:"circle"}),fn.registerFactory("edge",{defaultShapeType:"line"}),fn.registerFactory("combo",{defaultShapeType:"circle"});var dn=function(){function t(t){this._cfg={},this.destroyed=!1;var e={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(e,this.getDefaultCfg(),t);var n=this.get("model"),r=n.id,i=this.get("type");r||(r=qe(i),this.get("model").id=r),this.set("id",r);var o=t.group;o&&(o.set("item",this),o.set("id",r)),this.init(),this.draw();var a=n.shape||n.type||("edge"===i?"line":"circle"),s=this.get("shapeFactory");if(s&&s[a]){var u=s[a].options;if(u&&u.stateStyles){var c=this.get("styles")||n.stateStyles;c=Object(p.deepMix)({},u.stateStyles,c),this.set("styles",c)}}}return t.prototype.calculateBBox=function(){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},t.prototype.calculateCanvasBBox=function(){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},t.prototype.drawInner=function(){var t=this.get("shapeFactory"),e=this.get("group"),n=this.get("model");e.clear();var r=n.visible;if(void 0===r||r||this.changeVisibility(r),t){this.updatePosition(n);var i=this.getShapeCfg(n),o=i.type,a=t.draw(o,i,e);a&&(this.set("keyShape",a),a.set("isKeyShape",!0),a.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",o),this.restoreStates(t,o)}},t.prototype.setOriginStyle=function(){var t=this.get("group"),e=t.get("children"),n=this.getKeyShape(),r=this,i=n.get("name");if(this.get("originStyle")){var o=this.get("originStyle");i&&!o[i]&&(o[i]={});var a=this.getCurrentStatesStyle(),s=function(t){var n=e[t],s=n.get("name"),u=n.attr();if(s&&s!==i){var c=a[s];o[s]||(o[s]={}),c?Object.keys(u).forEach((function(t){var e=u[t];e!==c[t]&&(o[s][t]=e)})):o[s]="image"!==n.get("type")?Object(p.clone)(u):r.getShapeStyleByName(s)}else{var l=n.attr(),f={};Object.keys(a).forEach((function(t){var e=a[t];t!==i&&Object(p.isPlainObject)(e)||(f[t]=e)})),Object.keys(l).forEach((function(t){var e=l[t];f[t]!==e&&(i?o[i][t]=e:o[t]=e)}))}};for(c=0;c<e.length;c++)s(c);delete o.path,delete o.matrix,delete o.x,delete o.y,o[i]&&(delete o[i].x,delete o[i].y,delete o[i].matrix,delete o[i].path),r.set("originStyle",o)}else{for(var u={},c=0;c<e.length;c++){var l=e[c],f=l.get("type"),h=l.get("name");if(h&&h!==i)u[h]="image"!==f?Object(p.clone)(l.attr()):r.getShapeStyleByName(h),"text"===f&&u[h]&&(delete u[h].x,delete u[h].y,delete u[h].matrix);else{var d=r.getShapeStyleByName();if(delete d.path,delete d.matrix,i)if(h)u[i]=d;else{var g=qe("shape");l.set("name",g),t.shapeMap[g]=l,u[g]="image"!==f?Object(p.clone)(l.attr()):r.getShapeStyleByName(h)}else Object.assign(u,d)}}r.set("originStyle",u)}},t.prototype.restoreStates=function(t,e){var n=this,r=n.get("states");Object(p.each)(r,(function(r){t.setState(e,r,!0,n)}))},t.prototype.init=function(){var t=hn.getFactory(this.get("type"));this.set("shapeFactory",t)},t.prototype.get=function(t){return this._cfg[t]},t.prototype.set=function(t,e){Object(p.isPlainObject)(t)?this._cfg=Object(d.__assign)(Object(d.__assign)({},this._cfg),t):this._cfg[t]=e},t.prototype.getDefaultCfg=function(){return{}},t.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null)},t.prototype.beforeDraw=function(){},t.prototype.afterDraw=function(){},t.prototype.afterUpdate=function(){},t.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},t.prototype.getShapeStyleByName=function(t){var e,n=this.get("group");if(e=t?n.shapeMap[t]:this.getKeyShape()){var r={};return Object(p.each)(e.attr(),(function(t,e){("img"!==e||Object(p.isString)(t))&&(r[e]=t)})),r}return{}},t.prototype.getShapeCfg=function(t,e){var n=this.get("styles");if(n){var r=t;return r.style=Object(d.__assign)(Object(d.__assign)({},n),t.style),r}return t},t.prototype.getStateStyle=function(t){var e=this.get("styles");return e&&e[t]},t.prototype.getOriginStyle=function(){return this.get("originStyle")},t.prototype.getCurrentStatesStyle=function(){var t=this,e={},n=t.getStates();return n&&n.length?(Object(p.each)(t.getStates(),(function(n){e=Object.assign(e,t.getStateStyle(n))})),e):this.get("originStyle")},t.prototype.setState=function(t,e){var n=this.get("states"),r=this.get("shapeFactory"),i=t,o=t;Object(p.isString)(e)&&(i="".concat(t,":").concat(e),o="".concat(t,":"));var a=n;if(Object(p.isBoolean)(e)){var s=n.indexOf(o);if(e){if(s>-1)return;n.push(i)}else s>-1&&n.splice(s,1)}else if(Object(p.isString)(e)){var u=n.filter((function(t){return t.includes(o)}));u.length>0&&this.clearStates(u),(a=a.filter((function(t){return!t.includes(o)}))).push(i),this.set("states",a)}if(r){var c=this.get("model").type;r.setState(c,t,e,this)}},t.prototype.clearStates=function(t){var e=this,n=e.getStates(),r=e.get("shapeFactory"),i=e.get("model").type;t||(t=n),Object(p.isString)(t)&&(t=[t]);var o=n.filter((function(e){return-1===t.indexOf(e)}));e.set("states",o),t.forEach((function(t){r.setState(i,t,!1,e)}))},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(t){return this.getStates().indexOf(t)>=0},t.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(t){},t.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model");if("move"===e)this.updatePosition(t);else{var r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o={x:n.x,y:n.y};t.x=isNaN(+t.x)?n.x:+t.x,t.y=isNaN(+t.y)?n.y:+t.y;var a=this.get("styles");if(t.stateStyles){var s=t.stateStyles;Object(p.mix)(a,s),delete t.stateStyles}Object.assign(n,t),o.x===t.x&&o.y===t.y||this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(t){var e=this.get("shapeFactory"),n=this.get("model"),r=n.type;if(e.shouldUpdate(r)&&r===this.get("currentShape")){var i=this.getShapeCfg(n,t);e.baseUpdate(r,i,this,t),"move"!==t&&this.setOriginStyle()}else this.draw();this.restoreStates(e,r)},t.prototype.updatePosition=function(t){var e=this.get("model"),n=isNaN(+t.x)?+e.x:+t.x,r=isNaN(+t.y)?+e.y:+t.y,i=this.get("group");if(isNaN(n)||isNaN(r))return!1;e.x=n,e.y=r;var o=i.getMatrix();return(!o||o[6]!==n||o[7]!==r)&&(i.resetMatrix(),Kt(i,{x:n,y:r}),this.clearCache(),!0)},t.prototype.getBBox=function(){var t=this.get("bboxCache");return t||(t=this.calculateBBox(),this.set("bboxCache",t)),t},t.prototype.getCanvasBBox=function(){var t=this.get("bboxCanvasCache");return t||(t=this.calculateCanvasBBox(),this.set("bboxCanvasCache",t)),t},t.prototype.toFront=function(){this.get("group").toFront()},t.prototype.toBack=function(){this.get("group").toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},t.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},t}(),pn={source:"start",target:"end"},gn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,e){var n=pn[t]+"Point",r=t+"Node",i=this.get(r);i&&!i.destroyed&&i.removeEdge(this),Object(p.isPlainObject)(e)?(this.set(n,e),this.set(r,null)):e&&(e.addEdge(this),this.set(r,e),this.set(n,null))},e.prototype.getLinkPoint=function(t,e,n){var r=pn[t]+"Point",i=t+"Node",o=this.get(r);if(!o){var a=this.get(i),s=t+"Anchor",u=this.getPrePoint(t,n),c=e[s];Object(p.isNil)(c)||(o=a.getLinkPointByAnchor(c)),o=o||a.getLinkPoint(u),Object(p.isNil)(o.index)||this.set("".concat(t,"AnchorIndex"),o.index)}return o},e.prototype.getPrePoint=function(t,e){if(e&&e.length)return e["source"===t?0:e.length-1];var n="source"===t?"target":"source";return this.getEndPoint(n)},e.prototype.getEndPoint=function(t){var e=t+"Node",n=pn[t]+"Point",r=this.get(e);return r?r.get("model"):this.get(n)},e.prototype.getControlPointsByCenter=function(t){var e=this.getEndPoint("source"),n=this.getEndPoint("target"),r=this.get("shapeFactory"),i=t.type;return r.getControlPoints(i,{startPoint:e,endPoint:n})},e.prototype.getEndCenter=function(t){var e=t+"Node",n=pn[t]+"Point",r=this.get(e);if(r){var i=r.getBBox();return{x:i.centerX,y:i.centerY}}return this.get(n)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(e,n){var r=this.get("linkCenter"),i=(null==n?void 0:n.includes("move"))?e:t.prototype.getShapeCfg.call(this,e);if(r)i.startPoint=this.getEndCenter("source"),i.endPoint=this.getEndCenter("target");else{var o=i.controlPoints||this.getControlPointsByCenter(i);i.startPoint=this.getLinkPoint("source",e,o),i.endPoint=this.getLinkPoint("target",e,o)}return i.sourceNode=this.get("sourceNode"),i.targetNode=this.get("targetNode"),i},e.prototype.getModel=function(){var t=this.get("model"),e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));return e?delete t["source".concat("Node")]:t.source=this.get("start".concat("Point")),n?delete t["target".concat("Node")]:t.target=this.get("end".concat("Point")),Object(p.isString)(t.source)||Object(p.isPlainObject)(t.source)||(t.source=t.source.getID()),Object(p.isString)(t.target)||Object(p.isPlainObject)(t.target)||(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model"),r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o=this.get("styles");if(t.stateStyles){var a=t.stateStyles;Object(p.mix)(o,a),delete t.stateStyles}Object.assign(n,t),this.updateShape(e),this.afterUpdate(),this.clearCache()},e.prototype.destroy=function(){var e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));e&&!e.destroyed&&e.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),t.prototype.destroy.call(this)},e}(dn),vn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getNearestPoint=function(t,e){for(var n=0,r=t[0],i=Xt(t[0],e),o=0;o<t.length;o++){var a=t[o],s=Xt(a,e);s<i&&(r=a,i=s,n=o)}return r.anchorIndex=n,r},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var t=this;return this.get("edges").filter((function(e){return e.get("target")===t}))},e.prototype.getOutEdges=function(){var t=this;return this.get("edges").filter((function(e){return e.get("source")===t}))},e.prototype.getNeighbors=function(t){var e=this,n=this.get("edges");if("target"===t){return n.filter((function(t){return t.getSource()===e})).map((function(t){return t.getTarget()}))}if("source"===t){return n.filter((function(t){return t.getTarget()===e})).map((function(t){return t.getSource()}))}return n.map((function(t){return t.getSource()===e?t.getTarget():t.getSource()}))},e.prototype.getLinkPointByAnchor=function(t){return this.getAnchorPoints()[t]},e.prototype.getLinkPoint=function(t){var e,n,r=this.get("keyShape").get("type"),i=this.get("type"),o=this.getBBox();"combo"===i?(e=o.centerX||(o.maxX+o.minX)/2,n=o.centerY||(o.maxY+o.minY)/2):(e=o.centerX,n=o.centerY);var a,s=this.getAnchorPoints();switch(r){case"circle":a=Gt({x:e,y:n,r:o.width/2},t);break;case"ellipse":a=zt({x:e,y:n,rx:o.width/2,ry:o.height/2},t);break;default:a=Ft(o,t)}var u=a;return s.length&&(u||(u=t),u=this.getNearestPoint(s,u)),u||(u={x:e,y:n}),u},e.prototype.getAnchorPoints=function(){var t=this.get("anchorPointsCache");if(!t){t=[];var e=this.get("shapeFactory"),n=this.getBBox(),r=this.get("model"),i=this.getShapeCfg(r),o=r.type,a=e.getAnchorPoints(o,i)||[];Object(p.each)(a,(function(e,r){var i={x:n.minX+e[0]*n.width,y:n.minY+e[1]*n.height,anchorIndex:r};t.push(i)})),this.set("anchorPointsCache",t)}return t},e.prototype.addEdge=function(t){this.get("edges").push(t)},e.prototype.lock=function(){this.set("locked",!0)},e.prototype.unlock=function(){this.set("locked",!1)},e.prototype.hasLocked=function(){return this.get("locked")},e.prototype.removeEdge=function(t){var e=this.getEdges(),n=e.indexOf(t);n>-1&&e.splice(n,1)},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("anchorPointsCache",null)},e.prototype.getUpdateType=function(t){var e,n,r,i,o;if(t){var a=!Object(p.isNil)(t.x),s=!Object(p.isNil)(t.y),u=Object.keys(t);return 1===u.length&&(a||s)||2===u.length&&a&&s?"move":Object(p.isNumber)(t.x)||Object(p.isNumber)(t.y)||t.type||t.anchorPoints||t.size||(null==t?void 0:t.style)&&((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.r)||(null===(n=null==t?void 0:t.style)||void 0===n?void 0:n.width)||(null===(r=null==t?void 0:t.style)||void 0===r?void 0:r.height)||(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.rx)||(null===(o=null==t?void 0:t.style)||void 0===o?void 0:o.ry))?"bbox|label":u.includes("label")||u.includes("labelCfg")?"style|label":"style"}},e}(dn),yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(t){var e=this.get("styles"),n=this.get("bbox");if(e&&n){var r=t,i={r:Math.hypot(n.height,n.width)/2||Oe.defaultCombo.size[0]/2,width:n.width||Oe.defaultCombo.size[0],height:n.height||Oe.defaultCombo.size[1]};r.style=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},e),t.style),i);var o=t.padding||Oe.defaultCombo.padding;return Object(p.isNumber)(o)?(i.r+=o,i.width+=2*o,i.height+=2*o):(i.r+=o[0],i.width+=o[1]+o[3]||2*o[1],i.height+=o[0]+o[2]||2*o[0]),this.set("sizeCache",i),r}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;var r=this.get("sizeCache"),i=this.get("bboxCache")||{},o=i.x,a=i.x;if(r)r.width=Math.max(r.width,n.width),r.height=Math.max(r.height,n.height),"circle"===t.get("type")?(n.width=2*r.r,n.height=2*r.r):(n.width=r.width,n.height=r.height),n.minX=n.centerX-n.width/2,n.minY=n.centerY-n.height/2,n.maxX=n.centerX+n.width/2,n.maxY=n.centerY+n.height/2;else n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;return n.x=n.minX,n.y=n.minY,n.x===o&&n.y===a||this.set("anchorPointsCache",null),n}},e.prototype.getChildren=function(){return{nodes:this.getNodes(),combos:this.getCombos()}},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.addChild=function(t){switch(t.getType()){case"node":this.addNode(t);break;case"combo":this.addCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.addCombo=function(t){return this.get("combos").push(t),!0},e.prototype.addNode=function(t){return this.get("nodes").push(t),!0},e.prototype.removeChild=function(t){switch(t.getType()){case"node":this.removeNode(t);break;case"combo":this.removeCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.removeCombo=function(t){if(t){var e=this.getCombos(),n=e.indexOf(t);return n>-1&&(e.splice(n,1),!0)}},e.prototype.removeNode=function(t){if(t){var e=this.getNodes(),n=e.indexOf(t);return n>-1&&(e.splice(n,1),!0)}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){return this.set("bboxCanvasCache",null),this.calculateCanvasBBox()},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null),this.set("anchorPointsCache",null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),this.set("sizeCache",null),this.set("bbox",null),e.remove(),this._cfg=null,this.destroyed=!0}},e}(vn),mn=function(){function t(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Object(p.throttle)((function(t){var n,r=e.graph;if(r&&!r.get("destroyed")){var i=e.edgeToBeUpdateMap;i&&(null===(n=Object.keys(i))||void 0===n?void 0:n.length)&&(Object.keys(i).forEach((function(t){var e=i[t].edge;if(e&&!e.destroyed){var n=e.getSource(),r=e.getTarget();n&&!n.destroyed&&r&&!r.destroyed&&e.refresh(i[t].updateType)}})),e.edgeToBeUpdateMap={})}}),16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return t.prototype.addItem=function(t,e){var n=this.graph,r="vedge"===t?"edge":t,i=n.get("".concat(r,"Group"))||n.get("group"),o=Object(p.upperFirst)(r),a=null,s=n.get(r+Object(p.upperFirst)("stateStyles"))||{},u=n.get("default"+o);e.stateStyles&&(s=e.stateStyles),u&&Object(p.each)(u,(function(t,n){Object(p.isObject)(t)&&!Object(p.isArray)(t)?e[n]=Object(p.deepMix)({},t,e[n]):Object(p.isArray)(t)?e[n]=e[n]||Object(p.clone)(u[n]):e[n]=e[n]||u[n]}));var c=n.get(r+"Mapper");if(c){var l=c(e);l.stateStyles&&(s=l.stateStyles,delete l.stateStyles),Object(p.each)(l,(function(t,n){Object(p.isObject)(t)&&!Object(p.isArray)(t)?e[n]=Object(p.deepMix)({},e[n],t):e[n]=l[n]||e[n]}))}if(n.emit("beforeadditem",{type:t,model:e}),"edge"===t||"vedge"===t){var f=void 0,h=void 0;if(f=e.source,h=e.target,f&&Object(p.isString)(f)&&(f=n.findById(f)),h&&Object(p.isString)(h)&&(h=n.findById(h)),!f||!h)return void console.warn("The source or target node of edge ".concat(e.id," does not exist!"));f.getType&&"combo"===f.getType()&&(e.isComboEdge=!0),h.getType&&"combo"===h.getType()&&(e.isComboEdge=!0),a=new gn({model:e,source:f,target:h,styles:s,linkCenter:n.get("linkCenter"),group:i.addGroup()})}else if("node"===t)a=new vn({model:e,styles:s,group:i.addGroup()});else if("combo"===t){var d=e.children,g=Ue(d,n),v=void 0,y=void 0;if(isNaN(g.x)?isNaN(e.x)&&(v=100*Math.random()):v=g.x,isNaN(g.y)?isNaN(e.y)&&(y=100*Math.random()):y=g.y,isNaN(e.x)||isNaN(e.y))e.x=v,e.y=y;else{var m=e.x-v,b=e.y-y;this.updateComboSucceeds(e.id,m,b,d)}var x=i.addGroup();x.setZIndex(e.depth);var _=(a=new yn({model:e,styles:s,bbox:e.collapsed?Ue([],n):g,group:x})).getModel();(d||[]).forEach((function(t){var e=n.findById(t.id);a.addChild(e),t.depth=_.depth+2})),e.collapsed&&setTimeout((function(){a.destroyed||n.collapseCombo(a)}),0)}if(a)return n.get("".concat(t,"s")).push(a),n.get("itemMap")[a.get("id")]=a,n.emit("afteradditem",{item:a,model:e}),a},t.prototype.updateItem=function(t,e){var n,r,i=this,o=this.graph;if(Object(p.isString)(t)&&(t=o.findById(t)),t&&!t.destroyed){var a="";t.getType&&(a=t.getType());var s=o.get(a+"Mapper"),u=t.getModel(),c=u.x,l=u.y,f=t.getUpdateType(e);if(s){var h=s(Object(p.deepMix)({},u,e)),g=Object(p.deepMix)({},u,h,e);h.stateStyles&&(t.set("styles",g.stateStyles),delete g.stateStyles),Object(p.each)(g,(function(t,n){e[n]=t}))}else Object(p.each)(e,(function(t,n){u[n]&&Object(p.isObject)(t)&&!Object(p.isArray)(t)&&(e[n]=Object(d.__assign)(Object(d.__assign)({},u[n]),e[n]))}));if(o.emit("beforeupdateitem",{item:t,cfg:e}),"edge"===a){if(e.source){var v=e.source;Object(p.isString)(v)&&(v=o.findById(v)),t.setSource(v)}if(e.target){var y=e.target;Object(p.isString)(y)&&(y=o.findById(y)),t.setTarget(y)}t.update(e)}else if("node"===a){t.update(e,f);var m=t.getEdges(),b=(null==f?void 0:f.includes("bbox"))||"move"===f;"move"===f?Object(p.each)(m,(function(t){i.edgeToBeUpdateMap[t.getID()]={edge:t,updateType:f},i.throttleRefresh()})):b&&Object(p.each)(m,(function(t){t.refresh(f)}))}else if("combo"===a){if(t.update(e,f),!isNaN(e.x)||!isNaN(e.y)){var x=e.x-c||0,_=e.y-l||0;this.updateComboSucceeds(u.id,x,_)}var w=t.getEdges();if((b=(null==f?void 0:f.includes("bbox"))||"move"===f)&&"combo"===a){var E=t.get("shapeFactory"),S=u.type||"circle";(void 0===u.animate||void 0===e.animate?null===(r=null===(n=E[S])||void 0===n?void 0:n.options)||void 0===r?void 0:r.animate:u.animate||e.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&Object(p.each)(w,(function(t){t&&!t.destroyed&&t.refresh()}))}}),201):Object(p.each)(w,(function(t){t.refresh()}))}}o.emit("afterupdateitem",{item:t,cfg:e})}},t.prototype.updateCombo=function(t,e,n){var r,i,o=this,a=this.graph;if(Object(p.isString)(t)&&(t=a.findById(t)),t&&!t.destroyed){var s=t.getModel(),u=Ue(e,a,t),c=u.x,l=u.y;t.set("bbox",u);var f=c,h=l;n?(f=isNaN(s.x)?c:s.x,h=isNaN(s.y)?l:s.y):(f=isNaN(c)?s.x:c,h=isNaN(l)?s.y:l),t.update({x:f,y:h});var d=t.get("shapeFactory"),g=s.type||"circle";(void 0===s.animate?null===(i=null===(r=d[g])||void 0===r?void 0:r.options)||void 0===i?void 0:i.animate:s.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&(t.getShapeCfg(s),o.updateComboEdges(t))}}),201):this.updateComboEdges(t)}},t.prototype.updateComboEdges=function(t){for(var e=t.getEdges()||[],n=0;n<e.length;n++){var r=e[n];if(r&&!r.destroyed){var i=r.get("shapeFactory"),o=r.getShapeCfg(r.getModel()),a=r.getContainer();a.clear();var s=i.draw(o.type,o,a);r.set("keyShape",s),s.set("isKeyShape",!0),s.set("draggable",!0),r.setOriginStyle()}}},t.prototype.collapseCombo=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t));var n=t.getChildren();n.nodes.forEach((function(t){e.hideItem(t)})),n.combos.forEach((function(t){e.hideItem(t)}))},t.prototype.updateComboSucceeds=function(t,e,n,r){var i=this;void 0===r&&(r=[]);var o=this.graph;if(e||n){var a=r;if(!(null==a?void 0:a.length)){var s=o.get("comboTrees");null==s||s.forEach((function(e){Le(e,(function(e){return e.id!==t||(a=e.children,!1)}))}))}null==a||a.forEach((function(t){var r=o.findById(t.id);if(r){var a=r.getModel();i.updateItem(t.id,{x:(a.x||0)+e,y:(a.y||0)+n})}}))}},t.prototype.expandCombo=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t));var n=t.getChildren();n.nodes.forEach((function(t){e.showItem(t)})),n.combos.forEach((function(t){t.getModel().collapsed?t.show():e.showItem(t)}))},t.prototype.removeItem=function(t){var e=this,n=this.graph;if(Object(p.isString)(t)&&(t=n.findById(t)),t&&!t.destroyed){var r=Object(p.clone)(t.getModel());n.emit("beforeremoveitem",{item:r});var i="";t.getType&&(i=t.getType());var o=n.get("".concat(i,"s")),a=o.indexOf(t);if(a>-1&&o.splice(a,1),"edge"===i){var s=n.get("v".concat(i,"s")),u=s.indexOf(t);u>-1&&s.splice(u,1)}var c=t.get("id");delete n.get("itemMap")[c];var l=n.get("comboTrees"),f=t.get("id");if("node"===i){var h=t.getModel().comboId;if(l&&h){var d=l,g=!1;l.forEach((function(t){g||Le(t,(function(t){if(t.id===f&&d){var e=d.indexOf(t);return d.splice(e,1),g=!0,!1}return d=t.children,!0}))}))}for(var v=(x=t.getEdges()).length-1;v>=0;v--)n.removeItem(x[v],!1);h&&n.updateCombo(h)}else if("combo"===i){var y,m=t.getModel().parentId,b=!1;(l||[]).forEach((function(t){b||Le(t,(function(t){return t.id!==f||(y=t,b=!0,!1)}))})),y.removed=!0,y&&y.children&&y.children.forEach((function(t){e.removeItem(t.id)}));var x;for(v=(x=t.getEdges()).length;v>=0;v--)n.removeItem(x[v],!1);m&&n.updateCombo(m)}t.destroy(),n.emit("afterremoveitem",{item:r,type:i})}},t.prototype.setItemState=function(t,e,n){var r=this.graph,i=e;Object(p.isString)(n)&&(i="".concat(e,":").concat(n)),t.hasState(i)===n&&n||Object(p.isString)(n)&&t.hasState(i)||(r.emit("beforeitemstatechange",{item:t,state:i,enabled:n}),t.setState(e,n),r.autoPaint(),r.emit("afteritemstatechange",{item:t,state:i,enabled:n}))},t.prototype.priorityState=function(t,e){var n=this.graph,r=t;Object(p.isString)(t)&&(r=n.findById(t)),this.setItemState(r,e,!1),this.setItemState(r,e,!0)},t.prototype.clearItemStates=function(t,e){var n=this.graph;Object(p.isString)(t)&&(t=n.findById(t)),n.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),n.emit("afteritemstatesclear",{item:t,states:e})},t.prototype.refreshItem=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},t.prototype.addCombos=function(t,e){var n=this,r=this.graph;(t||[]).forEach((function(t){Re(t,(function(t){var r;return e.forEach((function(e){e.id===t.id&&(e.children=t.children,e.depth=t.depth,r=e)})),r&&n.addItem("combo",r),!0}))}));var i=r.get("comboGroup");i&&i.sort()},t.prototype.changeItemVisibility=function(t,e){var n=this,r=this.graph;if(Object(p.isString)(t)&&(t=r.findById(t)),t){if(r.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&"node"===t.getType()){var i=t.getEdges();Object(p.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}else if(t.getType&&"combo"===t.getType()){var o=r.get("comboTrees"),a=t.get("id"),s=[],u=!1;(o||[]).forEach((function(t){u||t.children&&0!==t.children.length&&Le(t,(function(t){return t.id!==a||(s=t.children,u=!0,!1)}))})),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach((function(t){var i=r.findById(t.id);n.changeItemVisibility(i,e)}));i=t.getEdges();Object(p.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}return r.emit("afteritemvisibilitychange",{item:t,visible:e}),t}console.warn("The item to be shown or hidden does not exist!")},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),bn=null,xn=function(){function t(t){this.graph=t,this.cachedStates={enabled:{},disabled:{}},this.destroyed=!1}return t.checkCache=function(t,e,n){if(n[e]){var r=n[e].indexOf(t);r>=0&&n[e].splice(r,1)}},t.cacheState=function(t,e,n){n[e]||(n[e]=[]),n[e].push(t)},t.prototype.updateState=function(e,n,r){var i=this,o=t.checkCache,a=t.cacheState;if(!e.destroyed){var s=this.cachedStates,u=s.enabled,c=s.disabled;r?(o(e,n,c),a(e,n,u)):(o(e,n,u),a(e,n,c)),bn&&clearTimeout(bn),bn=setTimeout((function(){bn=null,i.updateGraphStates()}),16)}},t.prototype.updateStates=function(t,e,n){var r=this;Object(p.isString)(e)?this.updateState(t,e,n):e.forEach((function(e){r.updateState(t,e,n)}))},t.prototype.updateGraphStates=function(){var t=this.graph.get("states"),e=this.cachedStates;Object(p.each)(e.disabled,(function(e,n){t[n]&&(t[n]=t[n].filter((function(t){return e.indexOf(t)<0&&!e.destroyed})))})),Object(p.each)(e.enabled,(function(e,n){if(t[n]){var r={};t[n].forEach((function(t){t.destroyed||(r[t.get("id")]=!0)})),e.forEach((function(e){if(!e.destroyed){var i=e.get("id");r[i]||(r[i]=!0,t[n].push(e))}}))}else t[n]=e})),this.graph.emit("graphstatechange",{states:t}),this.cachedStates={enabled:{},disabled:{}}},t.prototype.destroy=function(){this.graph=null,this.cachedStates=null,bn&&clearTimeout(bn),bn=null,this.destroyed=!0},t}(),_n=n(36),wn=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){if("\\"===t.charAt(0))return t.slice(1);var r=e[n];return 0===r&&(r="0"),r||""})):t},En=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var n=0,r=t;n<r.length;n++){var i=r[n],o=i.x,a=i.y;e.push(o),e.push(a)}var s=Object(_n.a)(e);return s.unshift(["M",t[0].x,t[0].y]),s},Sn=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i={x:(1-n)*t.x+n*e.x,y:(1-n)*t.y+n*e.y},o=[0,0];b.c.normalize(o,[e.x-t.x,e.y-t.y]),o&&(o[0]||o[1])||(o=[0,0]);var a=[-o[1]*r,o[0]*r];return i.x+=a[0],i.y+=a[1],i},On=function(t,e){var n=t.length;if(!n)return"";for(var r="",i=0;i<n;i++){var o=t[i];r+=wn(0===i?"M{x} {y}":"L{x} {y}",o)}return e&&(r+="Z"),r},Mn=function(t){var e=[];return t.forEach((function(t){if("A"!==t[0])for(var n=1;n<t.length;n+=2)e.push([t[n],t[n+1]]);else{var r=t.length;e.push([t[r-2],t[r-1]])}})),e},kn=function(t){if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));var e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(r),t.unshift(i),t.push(e),t.push(n);for(var o=[],a=1;a<t.length-2;a+=1){var s=t[a-1].x,u=t[a-1].y,c=t[a].x,l=t[a].y,f=t[a+1].x,h=t[a+1].y,d=c+(f-s)/6,p=l+(h-u)/6,g=f-((a!==t.length-2?t[a+2].x:f)-c)/6,v=h-((a!==t.length-2?t[a+2].y:h)-l)/6;o.push(["C",d,p,g,v,f,h])}return o.unshift(["M",r.x,r.y]),o},An=function(t,e){return b.c.scale([0,0],b.c.normalize([0,0],t),e)},Cn=function(t,e){var n=[t[1]-e[1],e[0]-t[0]],r=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(0===r)throw new Error("p0 should not be equal to p1");return[n[0]/r,n[1]/r]},Tn=function(t,e){return[e[0]-t[0],e[1]-t[1]]};function In(t,e){if(!t||t.length<1)return"";if(1===t.length)return function(t){var n=[t[0][0],t[0][1]-e],r=[t[0][0],t[0][1]+e];return"M ".concat(n," A ").concat(e,",").concat(e,",0,0,0,").concat(r," A ").concat(e,",").concat(e,",0,0,0,").concat(n)}(t);if(2===t.length)return function(t){var n=b.c.scale([0,0],Cn(t[0],t[1]),e),r=b.c.scale([0,0],n,-1),i=b.c.add([0,0],t[0],n),o=b.c.add([0,0],t[1],n),a=b.c.add([0,0],t[1],r),s=b.c.add([0,0],t[0],r);return"M ".concat(i," L ").concat(o," A ").concat([e,e,"0,0,0",a].join(",")," L ").concat(s," A ").concat([e,e,"0,0,0",i].join(","))}(t);for(var n=new Array(t.length),r=0;r<n.length;++r){var i=0===r?t[t.length-1]:t[r-1],o=t[r],a=b.c.scale([0,0],Cn(i,o),e);n[r]=[b.c.add([0,0],i,a),b.c.add([0,0],o,a)]}var s="A ".concat([e,e,"0,0,0,"].join(","));return(n=n.map((function(t,e){var r="";return 0===e&&(r="M ".concat(n[n.length-1][1]," ")),r+="".concat(s+t[0]," L ").concat(t[1])}))).join(" ")}function jn(t,e){var n,r,i,o=t.length;if(!t||o<1)return"";if(1===o)return r=[(n=t)[0][0],n[0][1]-e],i=[n[0][0],n[0][1]+e],"M ".concat(r," A ").concat([e,e,"0,0,0",i].join(",")," A ").concat([e,e,"0,0,0",r].join(","));if(2===o)return function(t){var n=Tn(t[0],t[1]),r=An(n,e),i=b.c.add([0,0],t[0],b.c.scale([0,0],r,-1)),o=b.c.add([0,0],t[1],r),a=1.2*e,s=An(b.c.normalize([0,0],n),a),u=b.c.scale([0,0],s,-1),c=b.c.add([0,0],i,u),l=b.c.add([0,0],o,u),f=b.c.add([0,0],i,s);return"M ".concat(i," C ").concat([c,l,o].join(",")," S ").concat([f,i].join(",")," Z")}(t);for(var a=t.map((function(e,n){var r=t[(n+1)%o];return{p:e,v:b.c.normalize([0,0],Tn(e,r))}})),s=0;s<a.length;++s){var u=s>0?s-1:o-1,c=b.c.normalize([0,0],b.c.add([0,0],a[u].v,b.c.scale([0,0],a[s].v,-1)));a[s].p=b.c.add([0,0],a[s].p,b.c.scale([0,0],c,e))}return a.map((function(t){var e=t.p;return{x:e[0],y:e[1]}}))}var Pn=function(t,e,n){return(t.y-n.y)*(e.x-n.x)-(t.x-n.x)*(e.y-n.y)},Nn=function(t){var e=t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}}));if(e.sort((function(t,e){return t.x===e.x?t.y-e.y:t.x-e.x})),1===e.length)return e;for(var n=[],r=0;r<e.length;r++){for(;n.length>=2&&Pn(n[n.length-2],n[n.length-1],e[r])<=0;)n.pop();n.push(e[r])}var i=[];for(r=e.length-1;r>=0;r--){for(;i.length>=2&&Pn(i[i.length-2],i[i.length-1],e[r])<=0;)i.pop();i.push(e[r])}return i.pop(),n.pop(),n.concat(i)},Dn={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function Ln(t,e,n){var r=!1,i=function(t,n){return e.cells[t+n*e.width]},o=function(t,e){var r=0;return i(t-1,e-1)>=n&&(r+=1),i(t,e-1)>n&&(r+=2),i(t-1,e)>n&&(r+=4),i(t,e)>n&&(r+=8),r},a=function(n,r){for(var i,a,s=n,u=r,c=0;c<e.width*e.height;c++){if(i=s,a=u,t.findIndex((function(t){return t.x===s&&t.y===u}))>-1){if(t[0].x===s&&t[0].y===u)return!0}else t.push({x:s,y:u});var l=o(s,u);switch(l){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:s++;break;case 12:case 14:case 4:s--;break;case 6:0===i&&(-1===a?s-=1:s+=1);break;case 1:case 13:case 5:u--;break;case 9:1===i&&(0===a?u-=1:u+=1);break;case 10:case 8:case 11:u++;break;default:return console.warn("Marching squares invalid state: ".concat(l)),!0}}};this.march=function(){for(var t=0;t<e.width&&!r;t+=1)for(var s=0;s<e.height&&!r;s+=1)i(t,s)>n&&15!==o(t,s)&&(r=a(t,s));return r}}var Rn=function(t,e){var n=Number.POSITIVE_INFINITY,r=null;return t.forEach((function(t){var i=ue(t,e);i>=0&&i<n&&(r=t,n=i)})),r};function Bn(t,e,n,r,i){var o=function(t,e,n){var r=null,i=Number.POSITIVE_INFINITY;return e.forEach((function(e){var o={x:t.getModel().x,y:t.getModel().y},a={x:e.getModel().x,y:e.getModel().y},s=le(o,a),u=new ie(o.x,o.y,a.x,a.y),c=n.reduce((function(t,e){return ue(e,u)>0?t+1:t}),0);s*Math.pow(c+1,2)<i&&(r=e,i=s*Math.pow(c+1,2))})),r}(t,n,e);if(null===o)return[];return function(t){for(var n=[];t.length>0;){var r=t.pop();if(0===t.length){n.push(r);break}var i=t.pop(),o=new ie(r.x1,r.y1,i.x2,i.y2);Rn(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(function(t,e,n,r){var i=[],o=[];o.push(t);for(var a=!0,s=0,u=function(t,e){var n=!1;return e.forEach((function(e){n||(he(t,{x:e.x1,y:e.y1})||he(t,{x:e.x2,y:e.y2}))&&(n=!0)})),n},c=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n].getBBox(),o=[[i.x,i.y],[i.x+i.width,i.y],[i.x,i.y+i.height],[i.x+i.width,i.y+i.height]];if(ee(o,t.x,t.y))return!0}return!1};a&&s<n;){a=!1;for(var l=function(){var t=o.pop(),n=Rn(e,t);if(n){var l=se(n,t),f=l[0];if(2===l[1]){var h=function(s){for(var l=r,h=zn(n,l,f,s),d=u(h,o)||u(h,i),p=c(h,e);!d&&p&&l>=1;)h=zn(n,l/=1.5,f,s),d=u(h,o)||u(h,i),p=c(h,e);!h||d||s&&p||(o.push(new ie(t.x1,t.y1,h.x,h.y)),o.push(new ie(h.x,h.y,t.x2,t.y2)),a=!0)};h(!0),a||h(!1)}}a||i.push(t),s+=1};!a&&o.length;)l()}for(;o.length;)i.push(o.pop());return i}(new ie(t.getModel().x,t.getModel().y,o.getModel().x,o.getModel().y),e,r,i))}var Fn=function(t,e,n){var r=Object.assign(Dn,n),i=ce(t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}})));t=t.sort((function(t,e){return le({x:t.getModel().x,y:t.getModel().y},i)-le({x:e.getModel().x,y:e.getModel().y},i)}));var o=[],a=[];t.forEach((function(t){Bn(t,e,o,r.maxRoutingIterations,r.morphBuffer).forEach((function(t){a.push(t)})),o.push(t)}));for(var s,u,c,l,f,h=function(t,e,n){var r={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},i=[];t.forEach((function(t){i.push(t.getBBox())})),e.forEach((function(t){i.push(t.getBBox())}));for(var o=0,a=i;o<a.length;o++){var s=a[o];r.minX=(s.minX<r.minX?s.minX:r.minX)-n,r.minY=(s.minY<r.minY?s.minY:r.minY)-n,r.maxX=(s.maxX>r.maxX?s.maxX:r.maxX)+n,r.maxY=(s.maxY>r.maxY?s.maxY:r.maxY)+n}return r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.x=r.minX,r.y=r.minY,r}(t,a,r.nodeR0),d=(s=h.width,u=h.height,c=r.pixelGroupSize,l=Math.ceil(s/c),f=Math.ceil(u/c),{cells:new Float32Array(Math.max(0,l*f)).fill(0),width:l,height:f}),p=[],g=[],v=0;v<r.maxMarchingIterations;v++)if(Gn(t,e,a,h,d,r),g=[],new Ln(p=[],d,r.threshold).march()){var y=p.map((function(t){return{x:Math.round(t.x*r.pixelGroupSize+h.minX),y:Math.round(t.y*r.pixelGroupSize+h.minY)}}));if(y){var m=y.length;if(r.skip>1)for(m=Math.floor(y.length/r.skip);m<3&&r.skip>1;)r.skip-=1,m=Math.floor(y.length/r.skip);for(var b=0,x=0;x<m;x+=1,b+=r.skip)g.push({x:y[b].x,y:y[b].y})}if(g&&function(){for(var e=0,n=t;e<n.length;e++){var r=n[e],i=g.map((function(t){return[t.x,t.y]}));if(!ee(i,r.getBBox().centerX,r.getBBox().centerY))return!1}return!0}())return g;if(r.threshold*=.9,v<=.5*r.maxMarchingIterations)r.memberInfluenceFactor*=1.2,r.edgeInfluenceFactor*=1.2;else{if(!(0!==r.nonMemberInfluenceFactor&&e.length>0))break;r.nonMemberInfluenceFactor*=.8}}return g};function Gn(t,e,n,r,i,o){function a(t,e){var n=Math.floor((t-e)/o.pixelGroupSize);return n<0?0:n}function s(t,e){return t*o.pixelGroupSize+e}var u=(o.nodeR0-o.nodeR1)*(o.nodeR0-o.nodeR1),c=(o.edgeR0-o.edgeR1)*(o.edgeR0-o.edgeR1),l=function(t,e){return[Math.min(a(t.minX,e+r.minX),i.width),Math.min(a(t.minY,e+r.minY),i.height),Math.min(a(t.maxX,-e+r.minX),i.width),Math.min(a(t.maxY,-e+r.minY),i.height)]},f=function(t,e){for(var n=t.getBBox(),a=l(n,o.nodeR1),u=a[0],c=a[1],f=a[2],h=a[3],d=c;d<h;d+=1)for(var p=u;p<f;p+=1)if(!(e<0&&i[p+d*i.width]<=0)){var g=s(p,r.minX),v=s(d,r.minY),y=de({x:g,y:v},{x:n.minX,y:n.minY,width:n.width,height:n.height});if(y<Math.pow(o.nodeR1,2)){var m=Math.sqrt(y)-o.nodeR1;i.cells[p+d*i.width]+=e*m*m}}};o.nodeInfluenceFactor&&t.forEach((function(t){f(t,o.nodeInfluenceFactor/u)})),o.edgeInfluenceFactor&&n.forEach((function(t){!function(t,e){for(var n=t.getBBox(),a=l(n,o.edgeR1),u=a[0],c=a[1],f=a[2],h=a[3],d=c;d<h;d+=1)for(var p=u;p<f;p+=1)if(!(e<0&&i.cells[p+d*i.width]<=0)){var g=s(p,r.minX),v=s(d,r.minY),y=fe({x:g,y:v},t);if(y<Math.pow(o.edgeR1,2)){var m=Math.sqrt(y)-o.edgeR1;i.cells[p+d*i.width]+=e*m*m}}}(t,o.edgeInfluenceFactor/c)})),o.negativeNodeInfluenceFactor&&e.forEach((function(t){f(t,o.negativeNodeInfluenceFactor/u)}))}function zn(t,e,n,r){var i=t.getBBox(),o=n[0],a=n[1],s=n[2],u=n[3],c={topLeft:{x:i.minX-e,y:i.minY-e},topRight:{x:i.maxX+e,y:i.minY-e},bottomLeft:{x:i.minX-e,y:i.maxY+e},bottomRight:{x:i.maxX+e,y:i.maxY+e}},l=i.height*i.width;function f(t,e){return i.width*(.5*(t.y-i.minY+(e.y-i.minY)))}if(a)return o?r?c.topLeft:c.bottomRight:s?r?c.bottomLeft:c.topRight:f(a,u)<.5*l?a.y>u.y?r?c.topLeft:c.bottomRight:r?c.topRight:c.bottomLeft:a.y<u.y?r?c.bottomLeft:c.topRight:r?c.bottomRight:c.topLeft;if(u){if(o)return r?c.topRight:c.bottomLeft;if(s)return r?c.bottomRight:c.topLeft}return f(o,s)<.5*l?o.x>s.x?r?c.topLeft:c.bottomRight:r?c.bottomLeft:c.topRight:o.x<s.x?r?c.topRight:c.bottomLeft:r?c.bottomRight:c.topLeft}var Un=function(){function t(t,e){this.cfg=Object(p.deepMix)(this.getDefaultCfg(),e),this.graph=t,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map((function(e){return Object(p.isString)(e)?t.findById(e):e})),this.nonMembers=this.cfg.nonMembers.map((function(e){return Object(p.isString)(e)?t.findById(e):e})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return t.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},t.prototype.setPadding=function(){var t=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},t.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),"round-convex"!==this.type&&"smooth-convex"!==this.type&&"bubble"!==this.type&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},t.prototype.calcPath=function(t,e){var n,r,i;switch(this.type){case"round-convex":i=In((n=Nn(t)).map((function(t){return[t.x,t.y]})),this.padding),r=Object(_n.b)(i);break;case"smooth-convex":2===(n=Nn(t)).length?(i=In(n.map((function(t){return[t.x,t.y]})),this.padding),r=Object(_n.b)(i)):n.length>2&&(i=jn(n.map((function(t){return[t.x,t.y]})),this.padding),r=kn(i));break;case"bubble":r=(n=Fn(t,e,this.cfg.bubbleCfg)).length>=2&&kn(n)}return r},t.prototype.render=function(){this.group.addShape("path",{attrs:Object(d.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1&&(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.removeNonMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1&&(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.updateData=function(t,e){var n=this;this.group.findById(this.id).remove(),t&&(this.members=t.map((function(t){return Object(p.isString)(t)?n.graph.findById(t):t}))),e&&(this.nonMembers=e.map((function(t){return Object(p.isString)(t)?n.graph.findById(t):t}))),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(t){this.group.findById(this.id).attr(Object(d.__assign)({},t))},t.prototype.updateCfg=function(t){var e=this;this.cfg=Object(p.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map((function(t){return Object(p.isString)(t)?e.graph.findById(t):t}))),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map((function(t){return Object(p.isString)(t)?e.graph.findById(t):t}))),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(t){var e,n,r=this,i=(e=Object(p.isString)(t)?this.graph.findById(t):t).getKeyShape();if("path"===e.get("type"))n=Mn(i.attr("path"));else{var o=i.getCanvasBBox();n=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return n=n.map((function(t){var e=r.graph.getPointByCanvas(t[0],t[1]);return[e.x,e.y]})),re(n,Mn(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),Vn=b.a.transform,Wn=function(t){function e(e){var n=t.call(this)||this;return n.cfg=Object(p.deepMix)(n.getDefaultCfg(),e),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new jt(n.cfg.maxStep),n.redoStack=new jt(n.cfg.maxStep)),n}return Object(d.__extends)(e,t),e.prototype.init=function(){this.initCanvas();var t=new en(this),e=new Ye(this),n=new mn(this),r=new xn(this);this.set({viewController:t,modeController:e,itemController:n,stateController:r}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var e=(t.get("el")||{}).id,n=void 0===e?"g6":e,r=t.addGroup({id:"".concat(n,"-root"),className:Oe.rootContainerClassName});if(this.get("groupByTypes")){var i=r.addGroup({id:"".concat(n,"-edge"),className:Oe.edgeContainerClassName}),o=r.addGroup({id:"".concat(n,"-node"),className:Oe.nodeContainerClassName}),a=r.addGroup({id:"".concat(n,"-combo"),className:Oe.comboContainerClassName});a.toBack(),this.set({nodeGroup:o,edgeGroup:i,comboGroup:a})}var s=r.addGroup({id:"".concat(n,"-delegate"),className:Oe.delegateContainerClassName});this.set({delegateGroup:s}),this.set("group",r)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.2,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[]}},e.prototype.set=function(t,e){return Object(p.isPlainObject)(t)?this.cfg=Object(d.__assign)(Object(d.__assign)({},this.cfg),t):this.cfg[t]=e,"enabledStack"!==t||!e||this.undoStack||this.redoStack||(this.undoStack=new jt(this.cfg.maxStep),this.redoStack=new jt(this.cfg.maxStep)),this},e.prototype.get=function(t){var e;return null===(e=this.cfg)||void 0===e?void 0:e[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,e){Object(p.isString)(t)&&(t=this.findById(t));var n=this.get("itemController");e||(e=t.get("states")),n.clearItemStates(t,e),this.get("stateController").updateStates(t,e,!1)},e.prototype.node=function(t){"function"==typeof t&&this.set("nodeMapper",t)},e.prototype.edge=function(t){"function"==typeof t&&this.set("edgeMapper",t)},e.prototype.combo=function(t){"function"==typeof t&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,e){var n,r=this.get("".concat(t,"s"));return Object(p.each)(r,(function(t,r){if(e(t,r))return n=t})),n},e.prototype.findAll=function(t,e){var n=[];return Object(p.each)(this.get("".concat(t,"s")),(function(t,r){e(t,r)&&n.push(t)})),n},e.prototype.findAllByState=function(t,e){return this.findAll(t,(function(t){return t.hasState(e)}))},e.prototype.getAnimateCfgWithCallback=function(t){var e,n=t.animateCfg,r=t.callback;if(n)if(e=Object(p.clone)(n),n.callback){var i=n.callback;e.callback=function(){r(),i()}}else e.callback=r;else e={duration:500,callback:r};return e},e.prototype.translate=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(p.clone)(o.getMatrix());if(a||(a=[1,0,0,0,1,0,0,0,1]),n){var s=this.getAnimateCfgWithCallback({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});Zt(o,{x:o.getCanvasBBox().x+t,y:o.getCanvasBBox().y+e},n,s||{duration:500,easing:"easeCubic"})}else a=Vn(a,[["t",t,e]]),o.setMatrix(a),this.emit("viewportchange",{action:"translate",matrix:a}),this.autoPaint()},e.prototype.moveTo=function(t,e,n,r){var i=this.get("group");Zt(i,{x:t,y:e},n,r||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:i.getMatrix()})},e.prototype.fitView=function(t,e){t&&this.set("fitViewPadding",t);var n=this.get("viewController");e?n.fitViewByRules(e):n.fitView(),this.autoPaint()},e.prototype.fitCenter=function(){this.get("viewController").fitCenter(),this.autoPaint()},e.prototype.addBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!0),this},e.prototype.removeBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!1),this},e.prototype.updateBehavior=function(t,e,n){return this.get("modeController").updateBehavior(t,e,n),this},e.prototype.zoom=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(p.clone)(o.getMatrix()),s=this.get("minZoom"),u=this.get("maxZoom");if(a||(a=[1,0,0,0,1,0,0,0,1]),a=Vn(a,e?[["t",-e.x,-e.y],["s",t,t],["t",e.x,e.y]]:[["s",t,t]]),s&&a[0]<s||u&&a[0]>u)return!1;if(n){var c=Object(p.clone)(o.getMatrix());c||(c=[1,0,0,0,1,0,0,0,1]);var l=c[0],f=l*t,h=this.getAnimateCfgWithCallback({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate((function(t){if(1===t)c=a;else{var n=ge(l,f,t)/c[0];c=Vn(c,e?[["t",-e.x,-e.y],["s",n,n],["t",e.x,e.y]]:[["s",n,n]])}return{matrix:c}}),h)}else o.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint();return!0},e.prototype.zoomTo=function(t,e,n,r){var i=t/this.getZoom();return this.zoom(i,e,n,r)},e.prototype.focusItem=function(t,e,n){var r=this.get("viewController"),i=!1;e?i=!0:void 0===e&&(i=this.get("animate"));var o={};n?o=n:void 0===n&&(o=this.get("animateCfg")),r.focus(t,i,o),this.autoPaint()},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,e){return this.get("viewController").getPointByClient(t,e)},e.prototype.getClientByPoint=function(t,e){return this.get("viewController").getClientByPoint(t,e)},e.prototype.getPointByCanvas=function(t,e){return this.get("viewController").getPointByCanvas(t,e)},e.prototype.getCanvasByPoint=function(t,e){return this.get("viewController").getCanvasByPoint(t,e)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!0);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!1}],o.nodes=[{id:r,visible:!0}];break;case"edge":i.nodes=[{id:r,visible:!1}],o.edges=[{id:r,visible:!0}];break;case"combo":i.nodes=[{id:r,visible:!1}],o.combos=[{id:r,visible:!0}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.hideItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!1);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!0}],o.nodes=[{id:r,visible:!1}];break;case"edge":i.nodes=[{id:r,visible:!0}],o.edges=[{id:r,visible:!1}];break;case"combo":i.nodes=[{id:r,visible:!0}],o.combos=[{id:r,visible:!1}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.refreshItem=function(t){this.get("itemController").refreshItem(t)},e.prototype.setAutoPaint=function(t){this.set("autoPaint",t),this.get("canvas").set("autoDraw",t)},e.prototype.remove=function(t,e){void 0===e&&(e=!0),this.removeItem(t,e)},e.prototype.removeItem=function(t,e){void 0===e&&(e=!0);var n=t;if(Object(p.isString)(t)&&(n=this.findById(t)),!n&&Object(p.isString)(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(n){var r="";if(n.getType&&(r=n.getType()),e&&this.get("enabledStack")){var i=Object(d.__assign)(Object(d.__assign)({},n.getModel()),{itemType:r}),o={};switch(r){case"node":o.nodes=[i],o.edges=[];for(var a=n.getEdges(),s=a.length-1;s>=0;s--)o.edges.push(Object(d.__assign)(Object(d.__assign)({},a[s].getModel()),{itemType:"edge"}));break;case"edge":o.edges=[i];break;case"combo":o.combos=[i]}this.pushStack("delete",{before:o,after:{}})}if("node"===r)n.getModel().comboId&&this.updateComboTree(n,void 0,!1);if(this.get("itemController").removeItem(n),"combo"===r){var u=ze(this.get("comboTrees"));this.set("comboTrees",u)}}},e.prototype.addItem=function(t,e,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!r);var o=this.get("itemController");if(!function(t,e){if("node"===t||"combo"===t){if(e.id&&!Object(p.isString)(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(!("edge"!==t||e.source&&e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0}(t,e))return!1;if(!e.id||!this.findById(e.id)){var a,s=this.get("comboTrees")||[];if("combo"===t){var u=this.get("itemMap"),c=!1;if(s.forEach((function(n){c||Re(n,(function(n){if(e.parentId===n.id){c=!0;var r=Object(d.__assign)({id:e.id,depth:n.depth+2},e);n.children?n.children.push(r):n.children=[r],e.depth=r.depth,a=o.addItem(t,e)}var i=u[n.id];return c&&i&&i.getType&&"combo"===i.getType()&&o.updateCombo(i,n.children),!0}))})),!c){var l=Object(d.__assign)({id:e.id,depth:0},e);e.depth=l.depth,s.push(l),a=o.addItem(t,e)}this.set("comboTrees",s)}else if("node"===t&&Object(p.isString)(e.comboId)&&s){var f;(f=this.findById(e.comboId))&&f.getType&&"combo"!==f.getType()&&console.warn("'".concat(e.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=o.addItem(t,e);var h=this.get("itemMap"),g=!1,v=!1;s.forEach((function(t){v||g||Re(t,(function(t){if(t.id===e.id)return v=!0,!1;if(e.comboId===t.id&&!v){g=!0;var n=Object(p.clone)(e);n.itemType="node",t.children?t.children.push(n):t.children=[n],n.depth=t.depth+1}return g&&h[t.id].getType&&"combo"===h[t.id].getType()&&o.updateCombo(h[t.id],t.children),!0}))}))}else a=o.addItem(t,e);if("node"===t&&e.comboId||"combo"===t&&e.parentId)(f=this.findById(e.comboId||e.parentId))&&f.getType&&"combo"===f.getType()&&f.addChild(a);var y=this.get("combos");if(y&&y.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var m=Object(d.__assign)(Object(d.__assign)({},a.getModel()),{itemType:t}),b={};switch(t){case"node":b.nodes=[m];break;case"edge":b.edges=[m];break;case"combo":b.combos=[m]}this.pushStack("add",{before:{},after:b})}return a}console.warn("This item exists already. Be sure the id %c".concat(e.id,"%c is unique."),"font-size: 20px; color: red;","")},e.prototype.add=function(t,e,n,r){return void 0===n&&(n=!0),void 0===r&&(r=!0),this.addItem(t,e,n,r)},e.prototype.updateItem=function(t,e,n){var r=this;void 0===n&&(n=!0);var i,o=this.get("itemController");i=Object(p.isString)(t)?this.findById(t):t;var a=Object(p.clone)(i.getModel()),s="";i.getType&&(s=i.getType());var u=Object(d.__spreadArray)([],i.getStates(),!0);if("combo"===s&&Object(p.each)(u,(function(t){return r.setItemState(i,t,!1)})),o.updateItem(i,e),"combo"===s&&Object(p.each)(u,(function(t){return r.setItemState(i,t,!0)})),n&&this.get("enabledStack")){var c={nodes:[],edges:[],combos:[]},l={nodes:[],edges:[],combos:[]},f=Object(d.__assign)({id:a.id},e);switch(s){case"node":c.nodes.push(a),l.nodes.push(f);break;case"edge":c.edges.push(a),l.edges.push(f);break;case"combo":c.combos.push(a),l.combos.push(f)}"node"===s&&c.nodes.push(a),this.pushStack("update",{before:c,after:l})}},e.prototype.update=function(t,e,n){void 0===n&&(n=!0),this.updateItem(t,e,n)},e.prototype.setItemState=function(t,e,n){Object(p.isString)(t)&&(t=this.findById(t)),this.get("itemController").setItemState(t,e,n);var r=this.get("stateController");Object(p.isString)(n)?r.updateState(t,"".concat(e,":").concat(n),!0):r.updateState(t,e,n)},e.prototype.priorityState=function(t,e){this.get("itemController").priorityState(t,e)},e.prototype.data=function(t){Xe(t),this.set("data",t)},e.prototype.render=function(){var t=this;this.set("comboSorted",!1);var e=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!e)throw new Error("data must be defined first");var n=e.nodes,r=void 0===n?[]:n,i=e.edges,o=void 0===i?[]:i,a=e.combos,s=void 0===a?[]:a;if(this.clear(!0),this.emit("beforerender"),Object(p.each)(r,(function(e){t.add("node",e,!1,!1)})),0!==(null==s?void 0:s.length)){var u=Ge(s,r);this.set("comboTrees",u),t.addCombos(s)}Object(p.each)(o,(function(e){t.add("edge",e,!1,!1)}));var c=t.get("animate");(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",!1);var l=t.get("layoutController");if(l){if(l.layout((function(){t.get("fitView")?t.fitView():t.get("fitCenter")&&t.fitCenter();t.autoPaint(),t.emit("afterrender"),(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",c)})),this.destroyed)return}else t.get("fitView")&&t.fitView(),t.get("fitCenter")&&t.fitCenter(),t.emit("afterrender"),t.set("animate",c);this.get("groupByTypes")||(s&&0!==s.length?this.sortCombos():e.nodes&&e.edges&&e.nodes.length<e.edges.length?this.getNodes().forEach((function(t){t.toFront()})):this.getEdges().forEach((function(t){t.toBack()})));this.get("enabledStack")&&this.pushStack("render")},e.prototype.read=function(t){this.data(t),this.render()},e.prototype.diffItems=function(t,e,n){var r,i=this,o=this.get("itemMap");Object(p.each)(n,(function(n){if(r=o[n.id]){if(i.get("animate")&&"node"===t){var a=r.getContainer().getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]),r.set("originAttrs",{x:a[6],y:a[7]})}i.updateItem(r,n,!1)}else r=i.addItem(t,n,!1);r&&e["".concat(t,"s")].push(r)}))},e.prototype.changeData=function(t,e){void 0===e&&(e=!0);var n=this,r=t||n.get("data");if(!Xe(r))return this;e&&this.get("enabledStack")&&this.pushStack("changedata",{before:n.save(),after:r}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map((function(t){return n.clearItemStates(t)})),this.getEdges().map((function(t){return n.clearItemStates(t)}));var i=this.get("canvas"),o=i.get("localRefresh");i.set("localRefresh",!1),n.get("data")||(n.data(r),n.render());var a=this.get("itemMap"),s={nodes:[],edges:[]},u=r.combos;if(u){var c=Ge(u,r.nodes);this.set("comboTrees",c)}else this.set("comboTrees",[]);this.diffItems("node",s,r.nodes),Object(p.each)(a,(function(t,e){a[e].getModel().depth=0,t.getType&&"edge"===t.getType()||(t.getType&&"combo"===t.getType()?(delete a[e],t.destroy()):s.nodes.indexOf(t)<0&&(delete a[e],n.remove(t,!1)))}));for(var l=this.getCombos(),f=l.length-1;f>=0;f--)l[f].destroyed&&l.splice(f,1);u&&(n.addCombos(u),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",s,r.edges),Object(p.each)(a,(function(t,e){(!t.getType||"node"!==t.getType()&&"combo"!==t.getType())&&s.edges.indexOf(t)<0&&(delete a[e],n.remove(t,!1))})),this.set({nodes:s.nodes,edges:s.edges});var h=this.get("layoutController");return h&&(h.changeData(),n.get("animate")&&!h.getLayoutType()?n.positionsAnimate():n.autoPaint()),setTimeout((function(){i.set("localRefresh",o)}),16),this},e.prototype.addCombos=function(t){var e=this.get("comboTrees");this.get("itemController").addCombos(e,t)},e.prototype.createCombo=function(t,e){var n=this;this.set("comboSorted",!1);var r,i="";if(t){if(Object(p.isString)(t))i=t,r={id:t};else{if(!(i=t.id))return void console.warn("Create combo failed. Please assign a unique string id for the adding combo.");r=t}var o=e.map((function(t){var e=n.findById(t),r=e.getModel(),o="";e.getType&&(o=e.getType());var a={id:e.getID(),itemType:o};return"combo"===o?(a.parentId=i,r.parentId=i):"node"===o&&(a.comboId=i,r.comboId=i),a}));r.children=o,this.addItem("combo",r,!1),this.set("comboSorted",!1);var a=this.get("comboTrees");(a||[]).forEach((function(t){Re(t,(function(t){return t.id!==i||(t.itemType="combo",t.children=o,!1)}))})),a&&this.sortCombos()}},e.prototype.uncombo=function(t){var e,n=this,r=t;if(Object(p.isString)(t)&&(r=this.findById(t)),!r||r.getType&&"combo"!==r.getType())console.warn("The item is not a combo!");else{var i=r.getModel().parentId,o=this.get("comboTrees");o||(o=[]);var a,s=this.get("itemMap"),u=r.get("id"),c=[],l=this.get("combos"),f=this.findById(i);if(o.forEach((function(t){a||Re(t,(function(t){var e;if(t.id===u){a=t,r.getEdges().map((function(t){return t.getID()})).forEach((function(t){n.removeItem(t,!1)}));var o=l.indexOf(r);l.splice(o,1),delete s[u],r.destroy(),n.emit("afterremoveitem",{item:r,type:"combo"})}return!i||!a||t.id!==i||(f.removeCombo(r),-1!==(o=(c=t.children).indexOf(a))&&c.splice(o,1),null===(e=a.children)||void 0===e||e.forEach((function(t){var e=n.findById(t.id),r=e.getModel();e.getType&&"combo"===e.getType()?(t.parentId=i,delete t.comboId,r.parentId=i,delete r.comboId):e.getType&&"node"===e.getType()&&(t.comboId=i,r.comboId=i),f.addChild(e),c.push(t)})),!1)}))})),!i&&a){var h=o.indexOf(a);o.splice(h,1),null===(e=a.children)||void 0===e||e.forEach((function(t){t.parentId=void 0;var e=n.findById(t.id).getModel();delete e.parentId,delete e.comboId,"node"!==t.itemType&&o.push(t)}))}}},e.prototype.updateCombos=function(t){var e=this;void 0===t&&(t=!1);var n=this.get("comboTrees"),r=this.get("itemController"),i=this.get("itemMap");(n||[]).forEach((function(n){Re(n,(function(n){if(!n)return!0;var o=i[n.id];if(o&&o.getType&&"combo"===o.getType()){var a=Object(d.__spreadArray)([],o.getStates(),!0);Object(p.each)(a,(function(t){return e.setItemState(o,t,!1)})),r.updateCombo(o,n.children,t),Object(p.each)(a,(function(t){return e.setItemState(o,t,!0)}))}return!0}))})),this.sortCombos()},e.prototype.updateCombo=function(t){var e,n=this,r=t;if(Object(p.isString)(t)&&(r=this.findById(t)),!r||r.getType&&"combo"!==r.getType())console.warn("The item to be updated is not a combo!");else{e=r.get("id");var i=this.get("comboTrees"),o=this.get("itemController"),a=this.get("itemMap");(i||[]).forEach((function(t){Re(t,(function(t){if(!t)return!0;var r=a[t.id];if(e===t.id&&r&&r.getType&&"combo"===r.getType()){var i=Object(d.__spreadArray)([],r.getStates(),!0);Object(p.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!1)})),o.updateCombo(r,t.children),Object(p.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!0)})),e&&(e=t.parentId)}return!0}))}))}},e.prototype.updateComboTree=function(t,e,n){void 0===n&&(n=!0);var r;this.set("comboSorted",!1);var i,o=(r=Object(p.isString)(t)?this.findById(t):t).getModel(),a=o.comboId||o.parentId,s="";if(r.getType&&(s=r.getType()),e&&"combo"===s){var u,c=this.get("comboTrees"),l=!0;if((c||[]).forEach((function(t){u||Le(t,(function(t){if(!u)return t.id===r.getID()&&(u=t),!0}))})),Le(u,(function(t){return t.id!==e||(l=!1,!1)})),!l)return void console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!")}if(n&&this.get("enabledStack")){var f={},h={};"combo"===s?(f.combos=[{id:o.id,parentId:o.parentId}],h.combos=[{id:o.id,parentId:e}]):"node"===s&&(f.nodes=[{id:o.id,parentId:o.comboId}],h.nodes=[{id:o.id,parentId:e}]),this.pushStack("updateComboTree",{before:f,after:h})}if(o.parentId||o.comboId){var d=this.findById(o.parentId||o.comboId);d&&d.removeChild(r)}("combo"===s?o.parentId=e:"node"===s&&(o.comboId=e),e)&&((i=this.findById(e))&&i.addChild(r));a&&((i=this.findById(a))&&i.removeChild(r));var g=ze(this.get("comboTrees"),o.id,e);this.set("comboTrees",g),this.updateCombos()},e.prototype.save=function(){var t=[],e=[],n=[];return Object(p.each)(this.get("nodes"),(function(e){t.push(e.getModel())})),Object(p.each)(this.get("edges"),(function(t){e.push(t.getModel())})),Object(p.each)(this.get("combos"),(function(t){n.push(t.getModel())})),{nodes:t,edges:e,combos:n}},e.prototype.changeSize=function(t,e){return this.get("viewController").changeSize(t,e),this},e.prototype.refresh=function(){if(this.emit("beforegraphrefresh"),this.get("animate"))this.positionsAnimate();else{var t=this.get("nodes"),e=this.get("edges"),n=this.get("edges");Object(p.each)(t,(function(t){t.refresh()})),Object(p.each)(e,(function(t){t.refresh()})),Object(p.each)(n,(function(t){t.refresh()}))}this.emit("aftergraphrefresh"),this.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if(Object(p.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType()))return t.getChildren();console.warn("The combo does not exist!")},e.prototype.positionsAnimate=function(t){var e=this;e.emit("beforeanimate");var n=e.get("animateCfg"),r=n.onFrame,i=t?e.getNodes().concat(e.getCombos()):e.getNodes(),o=i.map((function(t){var e=t.getModel();return{id:e.id,x:e.x,y:e.y}}));e.isAnimating()&&e.stopAnimate(),e.get("canvas").animate((function(n){Object(p.each)(o,(function(t){var i=e.findById(t.id);if(i&&!i.destroyed){var o=i.get("originAttrs"),a=i.get("model");if(!o){var s=i.getContainer().getMatrix();s||(s=[1,0,0,0,1,0,0,0,1]),o={x:s[6],y:s[7]},i.set("originAttrs",o)}if(r){var u=r(i,n,t,o);i.set("model",Object.assign(a,u))}else a.x=o.x+(t.x-o.x)*n,a.y=o.y+(t.y-o.y)*n}})),e.refreshPositions(t)}),{duration:n.duration,easing:n.easing,callback:function(){Object(p.each)(i,(function(t){t.set("originAttrs",null)})),n.callback&&n.callback(),e.emit("afteranimate"),e.animating=!1}})},e.prototype.refreshPositions=function(t){this.emit("beforegraphrefreshposition");var e,n=this.get("nodes"),r=this.get("edges"),i=this.get("vedges"),o=this.get("combos"),a={},s=function(t){Object(p.each)(t,(function(t){e=t.getModel();var n=t.get("originAttrs");if(!n||e.x!==n.x||e.y!==n.y){var r=t.updatePosition({x:e.x,y:e.y});a[e.id]=r,e.comboId&&(a[e.comboId]=a[e.comboId]||r)}}))};s(n),o&&0!==o.length&&(this.updateCombos(),t&&s(o)),Object(p.each)(r,(function(t){var e=t.getSource().getModel(),n=t.getTarget();if(!Object(p.isPlainObject)(n)){var r=n.getModel();(a[e.id]||a[r.id]||t.getModel().isComboEdge)&&t.refresh()}})),Object(p.each)(i,(function(t){t.refresh()})),this.emit("aftergraphrefreshposition"),this.autoPaint()},e.prototype.stopAnimate=function(){this.get("canvas").stopAnimate()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){return this.get("modeController").getMode()},e.prototype.setMode=function(t){return this.get("modeController").setMode(t),this},e.prototype.clear=function(t){var e;return void 0===t&&(t=!1),null===(e=this.get("canvas"))||void 0===e||e.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,e,n){var r=this,i=this.get("layoutController");if(Object(p.isString)(t)&&(t={type:t}),e){var o=n;o||(o="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),o=this.getPointByCanvas(o.x,o.y);var a=["force","gForce","fruchterman"];a.includes(t.type)||!t.type&&a.includes(null==i?void 0:i.layoutType)?t.center=[o.x,o.y]:this.once("afterlayout",(function(t){var n=r.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];o.x=o.x*n[0]+n[6],o.y=o.y*n[0]+n[7];var i=r.getGroup().getCanvasBBox(),a=i.minX,s=i.maxX,u=i.minY,c={x:(a+s)/2,y:(u+i.maxY)/2};"begin"===e&&(c.x=a,c.y=u),r.translate(o.x-c.x,o.y-c.y)}))}var s=this.get("layout"),u={};Object.assign(u,s,t),this.set("layout",u),i.isLayoutTypeSame(u)&&u.gpuEnabled===s.gpuEnabled?i.updateLayoutCfg(u):i.changeLayout(u)},e.prototype.destroyLayout=function(){this.get("layoutController").destroyLayout()},e.prototype.layout=function(){var t=this.get("layoutController"),e=this.get("layout");e&&t&&(e.workerEnabled?t.layout():t.layoutMethod?t.relayout(!0):t.layout())},e.prototype.collapseCombo=function(t){var e=this;if(!this.destroyed)if(Object(p.isString)(t)&&(t=this.findById(t)),t){this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var n=t.getModel();this.get("itemController").collapseCombo(t),n.collapsed=!0;var r=this.getEdges().concat(this.get("vedges")),i=[],o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Le(t,(function(t){if(s&&t.depth<=n.depth)return!1;if(n.id===t.id&&(s=!0),s){var r=e.findById(t.id);r&&r.getType&&"combo"===r.getType()&&(i=i.concat(r.getNodes()),o=o.concat(r.getCombos()))}return!0}))}));var u={},c=[];r.forEach((function(t){if(!t.isVisible()||t.getModel().isVEdge){var r=t.getSource(),a=t.getTarget();if((i.includes(r)||o.includes(r))&&!i.includes(a)&&!o.includes(a)||r.getModel().id===n.id){if((h=t.getModel()).isVEdge)return void e.removeItem(t,!1);for(var s=a.getModel();!a.isVisible();){if(!(a=e.findById(s.parentId||s.comboId))||!s.parentId&&!s.comboId)return;s=a.getModel()}var l=s.id;if(u["".concat(n.id,"-").concat(l)])return void(u["".concat(n.id,"-").concat(l)]+=h.size||1);var f=e.addItem("vedge",{source:n.id,target:l,isVEdge:!0},!1);u["".concat(n.id,"-").concat(l)]=h.size||1,c.push(f)}else if(!i.includes(r)&&!o.includes(r)&&(i.includes(a)||o.includes(a))||a.getModel().id===n.id){var h;if((h=t.getModel()).isVEdge)return void e.removeItem(t,!1);for(var d=r.getModel();!r.isVisible();){if(!(r=e.findById(d.parentId||d.comboId))||!d.parentId&&!d.comboId)return;d=r.getModel()}var p=d.id;if(u["".concat(p,"-").concat(n.id)])return void(u["".concat(p,"-").concat(n.id)]+=h.size||1);f=e.addItem("vedge",{target:n.id,source:p,isVEdge:!0},!1);u["".concat(p,"-").concat(n.id)]=h.size||1,c.push(f)}}})),c.forEach((function(t){var n=t.getModel();e.updateItem(t,{size:u["".concat(n.source,"-").concat(n.target)]},!1)})),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}else console.warn("The combo to be collapsed does not exist!")},e.prototype.expandCombo=function(t){var e=this;if(Object(p.isString)(t)&&(t=this.findById(t)),!t||t.getType&&"combo"!==t.getType())console.warn("The combo to be collapsed does not exist!");else{this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var n=t.getModel();this.get("itemController").expandCombo(t),n.collapsed=!1;var r=this.getEdges().concat(this.get("vedges")),i=[],o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Le(t,(function(t){if(s&&t.depth<=n.depth)return!1;if(n.id===t.id&&(s=!0),s){var r=e.findById(t.id);r&&r.getType&&"combo"===r.getType()&&(i=i.concat(r.getNodes()),o=o.concat(r.getCombos()))}return!0}))}));var u={},c={};r.forEach((function(t){if(!t.isVisible()||t.getModel().isVEdge){var r=t.getSource(),a=t.getTarget(),s=r.get("id"),l=a.get("id");if((i.includes(r)||o.includes(r))&&!i.includes(a)&&!o.includes(a)||s===n.id){if(t.getModel().isVEdge)return void e.removeItem(t,!1);for(var f=a.getModel();!a.isVisible();){if(!(a=e.findById(f.comboId||f.parentId))||!f.parentId&&!f.comboId)return;f=a.getModel()}l=f.id;for(var h=r.getModel();!r.isVisible();){if(!(r=e.findById(h.comboId||h.parentId))||!h.parentId&&!h.comboId)return;if(h.comboId===n.id||h.parentId===n.id)break;h=r.getModel()}if(s=h.id,l){var d="".concat(s,"-").concat(l);if(u[d])return u[d]+=t.getModel().size||1,void e.updateItem(c[d],{size:u[d]},!1);var p=e.addItem("vedge",{source:s,target:l,isVEdge:!0},!1);u[d]=t.getModel().size||1,c[d]=p}}else if(!i.includes(r)&&!o.includes(r)&&(i.includes(a)||o.includes(a))||l===n.id){if(t.getModel().isVEdge)return void e.removeItem(t,!1);for(h=r.getModel();!r.isVisible();){if(!(r=e.findById(h.comboId||h.parentId))||!h.parentId&&!h.comboId)return;h=r.getModel()}s=h.id;for(f=a.getModel();!a.isVisible();){if(!(a=e.findById(f.comboId||f.parentId))||!f.parentId&&!f.comboId)return;if(f.comboId===n.id||f.parentId===n.id)break;f=a.getModel()}if(l=f.id,s){d="".concat(s,"-").concat(l);if(u[d])return u[d]+=t.getModel().size||1,void e.updateItem(c[d],{size:u[d]},!1);p=e.addItem("vedge",{target:l,source:s,isVEdge:!0},!1);u[d]=t.getModel().size||1,c[d]=p}}else(i.includes(r)||o.includes(r))&&(i.includes(a)||o.includes(a))&&r.isVisible()&&a.isVisible()&&t.show()}})),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})}},e.prototype.collapseExpandCombo=function(t){if(Object(p.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType())){for(var e=t.getModel(),n=this.findById(e.parentId);n;){var r=n.getModel();if(r.collapsed)return console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),void(n=void 0);n=this.findById(r.parentId)}e.collapsed?this.expandCombo(t):this.collapseCombo(t),this.updateCombo(t)}},e.prototype.sortCombos=function(){var t=this;if(!this.get("comboSorted")){this.set("comboSorted",!0);var e=[],n={};(this.get("comboTrees")||[]).forEach((function(t){Le(t,(function(t){return e[t.depth]?e[t.depth].push(t.id):e[t.depth]=[t.id],n[t.id]=t.depth,!0}))})),(this.getEdges().concat(this.get("vedges"))||[]).forEach((function(t){var r=t.getModel(),i=n[r.source]||0,o=n[r.target]||0,a=Math.max(i,o);e[a]?e[a].push(r.id):e[a]=[r.id]})),e.forEach((function(e){if(e&&e.length)for(var n=e.length-1;n>=0;n--){var r=t.findById(e[n]);r&&r.toFront()}}))}},e.prototype.getNeighbors=function(t,e){var n=t;return Object(p.isString)(t)&&(n=this.findById(t)),n.getNeighbors(e)},e.prototype.getNodeDegree=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=!1);var r=t;Object(p.isString)(t)&&(r=this.findById(t));var i=this.get("degrees");i&&!n||(i=j(this.save()),this.set("degrees",i));var o=i[r.getID()],a=0;if(!o)return 0;switch(e){case"in":a=o.inDegree;break;case"out":a=o.outDegree;break;case"all":a=o;break;default:a=o.degree}return a},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear())},e.prototype.pushStack=function(t,e,n){if(void 0===t&&(t="update"),void 0===n&&(n="undo"),this.get("enabledStack")){var r=e?Object(p.clone)(e):{before:{},after:Object(p.clone)(this.save())};"redo"===n?this.redoStack.push({action:t,data:r}):this.undoStack.push({action:t,data:r}),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack})}else console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !")},e.prototype.getAdjMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix");return n&&t||(n=x(this.save(),e),this.set("adjMatrix",n)),n},e.prototype.getShortestPathMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix"),r=this.get("shortestPathMatrix");return n&&t||(n=x(this.save(),e),this.set("adjMatrix",n)),r&&t||(r=X(this.save(),e),this.set("shortestPathMatrix",r)),r},e.prototype.on=function(e,n,r){return t.prototype.on.call(this,e,n,r)},e.prototype.destroy=function(){var t,e,n,r,i;this.clear(),this.clearStack(),null===(t=this.get("itemController"))||void 0===t||t.destroy(),null===(e=this.get("modeController"))||void 0===e||e.destroy(),null===(n=this.get("viewController"))||void 0===n||n.destroy(),null===(r=this.get("stateController"))||void 0===r||r.destroy(),null===(i=this.get("canvas"))||void 0===i||i.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null},e.prototype.createHull=function(t){if(t.members&&!(t.members.length<1)){var e=this.get("hullGroup"),n=this.get("hullMap");if(n||(n={},this.set("hullMap",n)),e&&!e.get("destroyed")||((e=this.get("group").addGroup({id:"hullGroup"})).toBack(),this.set("hullGroup",e)),n[t.id])return console.warn("Existed hull id."),n[t.id];var r=e.addGroup({id:"".concat(t.id,"-container")}),i=new Un(this,Object(d.__assign)(Object(d.__assign)({},t),{group:r}));return n[i.id]=i,i}console.warn("Create hull failed! The members is empty.")},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var e,n;n=Object(p.isString)(t)?this.getHullById(t):t,null===(e=this.get("hullMap"))||void 0===e||delete e[n.id],n.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();t&&Object.keys(t).length&&(Object.keys(t).forEach((function(e){t[e].destroy()})),this.set("hullMap",{}))},e}(m.a);function Xn(t){return(Xn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Yn=b.a.transform,Hn=["startArrow","endArrow"],qn={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},Kn={edge:{lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},node:qn,combo:qn},Zn={options:{labelCfg:{style:{fontFamily:Oe.windowFontFamily}},descriptionCfg:{style:{fontFamily:Oe.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return"move"===e||(null==e?void 0:e.includes("bbox"))?{}:Object(p.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var n=this.drawShape(t,e);if(n.set("className",this.itemType+"-shape"),e.shapeMap[this.itemType+"-shape"]=n,t.label){var r=this.drawLabel(t,e);r.set("className",this.itemType+"-label"),e.shapeMap[this.itemType+"-label"]=r}return n},afterDraw:function(t,e,n){},drawShape:function(t,e){return null},drawLabel:function(t,e){var n=(this.mergeStyle||this.getOptions(t)||{}).labelCfg||{},r=this.getLabelStyle(t,n,e),i=r.rotate;delete r.rotate;var o=e.addShape("text",{attrs:r,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&""!==i){var a=o.getBBox(),s=[1,0,0,0,1,0,0,0,1];if(r.rotateCenter)switch(r.rotateCenter){case"center":s=Yn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]]);break;case"lefttop":s=Yn(s,[["t",-r.x,-r.y],["r",i],["t",r.x,r.y]]);break;case"leftcenter":s=Yn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);break;default:s=Yn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]])}else s=Yn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);o.setMatrix(s)}if(r.background){var u=this.drawLabelBg(t,e,o),c=this.itemType+"-label-bg";u.set("classname",c),e.shapeMap[c]=u,o.toFront()}return o},drawLabelBg:function(t,e,n){var r=this.options.labelCfg,i=Object(p.mix)({},r,t.labelCfg),o=this.getLabelBgStyleByPosition(n,i),a=e.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return e.shapeMap["text-bg-shape"]=a,a},getLabelStyleByPosition:function(t,e,n){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,n){var r=this.getLabelStyleByPosition(t,e,n),i="".concat(this.itemType,"Label"),o=Oe[i]?Oe[i].style:null;return Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},o),r),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,n){this.updateShapeStyle(t,e,n),this.updateLabel(t,e,n)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=e.getKeyShape(),a=Object(p.mix)({},o.attr(),t.style),s=function(t){var e,n=a[t];if(Object(p.isPlainObject)(n)){var s=(null===(r=i.shapeMap)||void 0===r?void 0:r[t])||i.find((function(e){return e.get("name")===t}));null==s||s.attr(n)}else o.attr(((e={})[t]=n,e))};for(var u in a)s(u)},updateLabel:function(t,e,n){var r,i;if(t.label||""===t.label){var o=e.getContainer(),a=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,s=void 0===a?{}:a,u=this.itemType+"-label",c=o.shapeMap[u]||o.find((function(t){return t.get("className")===u})),l=this.itemType+"-label-bg",f=o.shapeMap[l]||o.find((function(t){return t.get("className")===l}));if(c){(!n||"bbox|label"===n||"edge"===this.itemType&&"style"!==n)&&(s=Object(p.deepMix)(s,t.labelCfg));var h=this.getLabelStyleByPosition(t,s,o),g=null===(r=t.labelCfg)||void 0===r?void 0:r.style,v=Object(d.__assign)(Object(d.__assign)({},h),g),y=v.rotate;if(delete v.rotate,isNaN(y)||""===y)1!==(null===(i=c.getMatrix())||void 0===i?void 0:i[4])&&c.resetMatrix(),c.attr(v);else{var m=[1,0,0,0,1,0,0,0,1];m=Yn(m,[["t",-v.x,-v.y],["r",y],["t",v.x,v.y]]),v.matrix=m,c.attr(v)}if(f)if(v.background){var b=this.getLabelBgStyleByPosition(c,s);f.attr(b)}else o.removeChild(f);else v.background&&((f=this.drawLabelBg(t,o,c)).set("classname",l),o.shapeMap[l]=f,c.toFront())}else{var x=this.drawLabel(t,o);x.set("className",u),o.shapeMap[u]=x}}},afterUpdate:function(t,e){},setState:function(t,e,n){var r,i,o,a=n.get("keyShape");if(a&&!a.destroyed){var s=n.getType(),u=Object(p.isBoolean)(e)?t:"".concat(t,":").concat(e),c=this.getStateStyle(u,n),l=n.getStateStyle(u);if(l||c){var f=Object(p.mix)({},l||c),h=n.getContainer(),d={x:1,y:1,cx:1,cy:1,matrix:1};if("combo"===s&&(d.r=1,d.width=1,d.height=1),e){var g=function(t){var e,n=f[t];if(Object(p.isPlainObject)(n)&&!Hn.includes(t)){var r=(null===(o=h.shapeMap)||void 0===o?void 0:o[t])||h.find((function(e){return e.get("name")===t}));null==r||r.attr(n)}else a.attr(((e={})[t]=n,e))};for(var v in f)g(v)}else{var y=We(n.getCurrentStatesStyle()),m=n.getModel(),b=Object(p.mix)({},m.style,We(n.getOriginStyle())),x=a.get("name"),_=a.attr(),w={};Object.keys(_).forEach((function(t){if("img"!==t){var e=_[t];e&&"object"===Xn(e)?w[t]=Object(p.clone)(e):w[t]=e}}));var E={},S=function(t){var e=f[t];if(Object(p.isPlainObject)(e)&&!Hn.includes(t)){var n=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));if(n){var r=We(n.attr());Object(p.each)(e,(function(e,i){if(t===x&&w[i]&&!d[i]){delete w[i];var o=b[t][i]||Kn[s][i];a.attr(i,o)}else if(r[i]||0===r[i]){delete r[i];var u=b[t][i]||Kn[s][i];n.attr(i,u)}})),E[t]=r}}else if(w[t]&&!d[t]){delete w[t];var i=b[t]||(b[x]?b[x][t]:void 0)||Kn[s][t];a.attr(t,i)}};for(var O in f)S(O);for(var v in x?E[x]=w:Object(p.mix)(E,w),y)if(!d[v]){var M=y[v];Object(p.isPlainObject)(M)&&!Hn.includes(v)||(x?(Object(p.mix)(b[x],((i={})[v]=M,i)),delete b[v]):Object(p.mix)(b,((r={})[v]=M,r)),delete y[v])}var k={};Object(p.deepMix)(k,b,E,y);var A=!1,C=function(t){var e,n,r=k[t];if(Object(p.isPlainObject)(r)&&!Hn.includes(t)){var i=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));i&&(("text"===i.get("type")||i.get("labelRelated"))&&(delete r.x,delete r.y,delete r.matrix),t===x&&("combo"===s&&(delete r.r,delete r.width,delete r.height),A=!0),i.attr(r))}else if(!A){var o=r||Kn[s][t];"combo"===s?x||a.attr(((e={})[t]=o,e)):a.attr(((n={})[t]=o,n))}};for(var T in k)C(T)}}}},getStateStyle:function(t,e){var n=e.getModel(),r=e.getType(),i=this.getOptions(n),o=i.stateStyles,a=i.style,s=void 0===a?{}:a,u=n.stateStyles?n.stateStyles[t]:o&&o[t];return"combo"===r?Object(p.clone)(u):Object(p.mix)({},s,u)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,n;return(null==t?void 0:t.anchorPoints)||(null===(e=this.getCustomConfig(t))||void 0===e?void 0:e.anchorPoints)||(null===(n=this.options)||void 0===n?void 0:n.anchorPoints)}},Qn={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:Oe.nodeLabel.offset,getSize:function(t){var e,n=(null===(e=this.mergeStyle)||void 0===e?void 0:e.size)||t.size||this.getOptions({}).size||Oe.defaultNode.size;return Object(p.isArray)(n)&&1===n.length&&(n=[n[0],n[0]]),Object(p.isArray)(n)||(n=[n,n]),n},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition;if("center"===n)return{x:0,y:0,text:t.label};var r=e.offset;Object(p.isNil)(r)&&(r=this.offset);var i,o=this.getSize(t);switch(n){case"top":i={x:0,y:-o[1]/2-r,textBaseline:"bottom"};break;case"bottom":i={x:0,y:o[1]/2+r,textBaseline:"top"};break;case"left":i={x:-o[0]/2-r,y:0,textAlign:"right"};break;default:i={x:o[0]/2+r,y:0,textAlign:"left"}}return i.text=t.label,i},getLabelBgStyleByPosition:function(t,e){var n;if(!t)return{};var r=null===(n=e.style)||void 0===n?void 0:n.background;if(!r)return{};var i=t.getBBox(),o=Ke(r.padding),a=i.width+o[1]+o[3],s=i.height+o[0]+o[2];return Object(d.__assign)(Object(d.__assign)({x:i.minX-o[3],y:i.minY-o[0]},r),{width:a,height:s})},drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t),i=e.addShape(n,{attrs:r,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=i,i},updateLinkPoints:function(t,e){var n,r=(this.mergeStyle||this.getOptions(t)).linkPoints,i=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),o=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),a=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),s=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")}));i&&(n=i.attr()),o&&!n&&(n=o.attr()),a&&!n&&(n=a.attr()),s&&!n&&(n=s.attr()),n||(n=r);var u=Object(p.mix)({},n,t.linkPoints),c=u.fill,l=u.stroke,f=u.lineWidth,h=u.size/2;h||(h=u.r);var g=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},v=g.left,y=g.right,m=g.top,b=g.bottom,x=this.getSize(t),_=x[0],w=x[1],E={r:h,fill:c,stroke:l,lineWidth:f};if(i)v||void 0===v?i.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:-_/2,y:0})):(i.remove(),delete e.shapeMap["link-point-left"]);else if(v){var S="link-point-left";e.shapeMap[S]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:-_/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(o)y||void 0===y||(o.remove(),delete e.shapeMap["link-point-right"]),o.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:_/2,y:0}));else if(y){var O="link-point-right";e.shapeMap[O]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:_/2,y:0}),className:O,name:O,isAnchorPoint:!0})}if(a)m||void 0===m||(a.remove(),delete e.shapeMap["link-point-top"]),a.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:-w/2}));else if(m){var M="link-point-top";e.shapeMap[M]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:-w/2}),className:M,name:M,isAnchorPoint:!0})}if(s)b||void 0===b?s.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:w/2})):(s.remove(),delete e.shapeMap["link-point-bottom"]);else if(b){var k="link-point-bottom";e.shapeMap[k]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:w/2}),className:k,name:k,isAnchorPoint:!0})}},updateShape:function(t,e,n,r,i){e.get("keyShape").attr(Object(d.__assign)({},n)),this.updateLabel(t,e,i),r&&this.updateIcon(t,e)},updateIcon:function(t,e){var n=this,r=e.getContainer(),i=(this.mergeStyle||this.getOptions(t)).icon,o=t.icon?t.icon:{show:void 0,text:void 0},a=o.show,s=o.text,u=r.shapeMap["".concat(this.type,"-icon")]||r.find((function(t){return t.get("name")==="".concat(n.type,"-icon")}));if(u)if(a||void 0===a){var c=Object(p.mix)({},u.attr(),i),l=c.width,f=void 0===l?20:l,h=c.height,g=void 0===h?20:h;("iconfont"===c.fontFamily||c.hasOwnProperty("text"))&&(f=0,g=0),u.attr(Object(d.__assign)(Object(d.__assign)({},c),{x:-f/2,y:-g/2}))}else u.remove();else if(a){var v="".concat(this.type,"-icon");if(s)r.shapeMap[v]=r.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:v,name:v});else{f=i.width,g=i.height;r.shapeMap[v]=r.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},i),{x:-f/2,y:-g/2}),className:v,name:v})}var y=r.shapeMap["node-label"]||r.find((function(t){return"node-label"===t.get("name")}));y&&y.toFront()}}},$n=Object(d.__assign)(Object(d.__assign)({},Zn),Qn);hn.registerNode("single-node",$n);var Jn={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:Oe.defaultEdge.size,style:{x:0,y:0,stroke:Oe.defaultEdge.style.stroke,lineAppendWidth:Oe.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Oe.edgeLabel.style.fill,fontSize:Oe.edgeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.edgeStateStyles)},getPath:function(t){var e=[];return Object(p.each)(t,(function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(p.mix)({},e,n,t.style),i=t.size||Oe.defaultEdge.size,o=(t=this.getPathPoints(t)).startPoint,a=t.endPoint,s=this.getControlPoints(t),u=[o];s&&(u=u.concat(s)),u.push(a);var c=this.getPath(u);return Object(p.mix)({},Oe.defaultEdge.style,{stroke:Oe.defaultEdge.color,lineWidth:i,path:c},r)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=(null===(r=e.getKeyShape)||void 0===r?void 0:r.call(e))||i.shapeMap["edge-shape"],a=t.size,s=(t=this.getPathPoints(t)).startPoint,u=t.endPoint,c=this.getControlPoints(t),l=[s];c&&(l=l.concat(c)),l.push(u);var f=o.attr(),h=t.style||{};void 0===h.stroke&&(h.stroke=t.color);var g=t.sourceNode,v=t.targetNode,y={radius:h.radius};c||(y={source:g,target:v,offset:h.offset,radius:h.radius});var m=this.getPath(l,y),b={};"move"===n?b={path:m}:(f.endArrow&&!1===h.endArrow&&(t.style.endArrow={path:""}),f.startArrow&&!1===h.startArrow&&(t.style.startArrow={path:""}),void 0===(b=Object(d.__assign)({},t.style)).lineWidth&&(b.lineWdith=(Object(p.isNumber)(a)?a:null==a?void 0:a[0])||f.lineWidth),void 0===b.path&&(b.path=m),void 0===b.stroke&&(b.stroke=f.stroke||t.color)),o&&o.attr(b)},getLabelStyleByPosition:function(t,e,n){var r,i=e.position||this.labelPosition,o={},a=null==n?void 0:n.shapeMap["edge-shape"];r="start"===i?0:"end"===i?1:.5;var s,u=e.refX||this.refX,c=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return o.x=t.startPoint.x+u,o.y=t.startPoint.y+c,o.text=t.label,o;s=Object(p.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate;var l=Ne(a,r,u,c,s);return o.x=l.x,o.y=l.y,o.rotate=l.rotate,o.textAlign=this._getTextAlign(i,l.angle),o.text=t.label,o},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var n=t.getBBox(),r=e.style&&e.style.background;if(!r)return{};var i=r.padding,o=n.width+i[1]+i[3],a=n.height+i[0]+i[2],s=Object(d.__assign)(Object(d.__assign)({},r),{width:o,height:a,x:n.minX-i[3],y:n.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]});return(Object(p.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate)&&(s.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),s},_getTextAlign:function(t,e){var n="center";return e?(e%=2*Math.PI,"center"!==t&&(n=e>=0&&e<=Math.PI/2||e>=1.5*Math.PI&&e<2*Math.PI?t:function(t){var e=t;return"start"===t?e="end":"end"===t&&(e="start"),e}(t)),n):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},drawLabel:function(t,e){var n=this.options.labelCfg,r=Object(p.deepMix)({},n,t.labelCfg),i=this.getLabelStyle(t,r,e),o=i.rotate;delete i.rotate;var a=e.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=a,isNaN(o)||""===o||a.rotateAtStart(o),i.background){var s=this.drawLabelBg(t,e,a,i,o),u=this.itemType+"-label-bg";s.set("classname",u),e.shapeMap[u]=s,a.toFront()}return a},drawLabelBg:function(t,e,n,r,i){var o=this.options.labelCfg,a=Object(p.deepMix)({},o,t.labelCfg),s=this.getLabelBgStyleByPosition(n,a),u=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=u,u}},tr=Object(d.__assign)(Object(d.__assign)({},Zn),Jn);hn.registerEdge("single-edge",tr),hn.registerEdge("line",{getControlPoints:function(){}},"single-edge"),hn.registerEdge("spline",{getPath:function(t){return En(t)}},"single-edge"),hn.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e,n,r=t.startPoint,i=t.endPoint,o=(r.x+i.x)/2,a=(r.y+i.y)/2;if(void 0!==t.controlPoints){if(n=t.controlPoints[0],e=Wt(r,n,i),r.x<=i.x&&r.y>i.y?this.clockwise=e.x>n.x?0:1:r.x<=i.x&&r.y<i.y?this.clockwise=e.x>n.x?1:0:r.x>i.x&&r.y<=i.y?this.clockwise=e.y<n.y?0:1:this.clockwise=e.y<n.y?1:0,(n.x-r.x)/(n.y-r.y)==(i.x-r.x)/(i.y-r.y))return[]}else{void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),Object(p.isArray)(t.curveOffset)&&(t.curveOffset=t.curveOffset[0]),t.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:i.x-r.x,y:i.y-r.y},u=Math.atan2(s.y,s.x);n={x:t.curveOffset*Math.cos(-Math.PI/2+u)+o,y:t.curveOffset*Math.sin(-Math.PI/2+u)+a},e=Wt(r,n,i)}var c=Xt(r,e);return[{x:c,y:c}]},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),2===t.length?e.push(["L",t[1].x,t[1].y]):e.push(["A",t[1].x,t[1].y,0,0,this.clockwise,t[2].x,t[2].y]),e}},"single-edge"),hn.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(t){var e=t.controlPoints;if(!e||!e.length){var n=t.startPoint,r=t.endPoint;void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),Object(p.isArray)(this.curveOffset)&&(t.curveOffset=t.curveOffset[0]),Object(p.isArray)(this.curvePosition)&&(t.curvePosition=t.curveOffset[0]),e=[Sn(n,r,t.curvePosition,t.curveOffset)]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["Q",t[1].x,t[1].y,t[2].x,t[2].y]),e}},"single-edge"),hn.registerEdge("cubic",{curvePosition:[.5,.5],curveOffset:[-20,20],getControlPoints:function(t){var e=t.controlPoints;if(void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]),!e||!e.length||e.length<2){var n=t.startPoint,r=t.endPoint;e=[Sn(n,r,t.curvePosition[0],t.curveOffset[0]),Sn(n,r,t.curvePosition[1],t.curveOffset[1])]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["C",t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y]),e}},"single-edge"),hn.registerEdge("cubic-vertical",{curvePosition:[.5,.5],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.minCurveOffset&&(t.minCurveOffset=this.minCurveOffset),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var r=n.y-e.y,i=[0,0];return t.curveOffset?i=t.curveOffset:Math.abs(r)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset),[{x:e.x,y:e.y+r*this.curvePosition[0]+i[0]},{x:n.x,y:n.y-r*this.curvePosition[1]+i[1]}]}},"cubic"),hn.registerEdge("cubic-horizontal",{curvePosition:[.5,.5],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.minCurveOffset&&(t.minCurveOffset=this.minCurveOffset),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var r=n.x-e.x,i=[0,0];return t.curveOffset?i=t.curveOffset:Math.abs(r)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset),[{x:e.x+r*this.curvePosition[0]+i[0],y:e.y},{x:n.x-r*this.curvePosition[1]+i[1],y:n.y}]}},"cubic"),hn.registerEdge("loop",{getPathPoints:function(t){return Pe(t)},getControlPoints:function(t){return t.controlPoints},afterDraw:function(t){t.controlPoints=void 0},afterUpdate:function(t){t.controlPoints=void 0}},"cubic");var er={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:Oe.comboLabel.refX,refY:Oe.comboLabel.refY,options:{style:{stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},getSize:function(t){var e=Object(p.clone)(t.size||this.options.size||Oe.defaultCombo.size);return Object(p.isArray)(e)&&1===e.length&&(e=[e[0],e[0]]),Object(p.isArray)(e)||(e=[e,e]),e},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,r=t.style,i=t.padding||this.options.padding;Object(p.isArray)(i)&&(i=i[0]);var o=e.refX,a=e.refY;Object(p.isNil)(o)&&(o=this.refX),Object(p.isNil)(a)&&(a=this.refY);var s,u=this.getSize(t),c=(Math.max(r.r,u[0]/2)||u[0]/2)+i;switch(n){case"top":s={x:0,y:-c-a,textBaseline:"bottom",textAlign:"center"};break;case"bottom":s={x:0,y:c+a,textBaseline:"bottom",textAlign:"center"};break;case"left":s={x:-c+o,y:0,textAlign:"left"};break;case"center":s={x:0,y:0,text:t.label,textAlign:"center"};break;default:s={x:c+o,y:0,textAlign:"right"}}return s.text=t.label,s},drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t);return e.addShape(n,{attrs:r,draggable:!0,name:"combo-shape"})},updateShape:function(t,e,n){var r=e.get("keyShape");(void 0===t.animate?this.options.animate:t.animate)&&r.animate?r.animate(n,{duration:200,easing:"easeLinear"}):r.attr(Object(d.__assign)({},n)),this.updateLabel(t,e)}},nr=Object(d.__assign)(Object(d.__assign)({},Zn),er);hn.registerCombo("single-combo",nr),hn.registerCombo("circle",{options:{size:[Oe.defaultCombo.size[0],Oe.defaultCombo.size[0]],padding:Oe.defaultCombo.padding[0],animate:!0,style:{stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},shapeType:"circle",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t);return delete n.height,delete n.width,e.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0})},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;Object(p.isArray)(n)&&(n=n[0]);var r,i={stroke:t.color},o=Object(p.mix)({},e,i,t.style);if(t.fixSize)r=Object(p.isNumber)(t.fixSize)?t.fixSize:t.fixSize[0];else{var a=this.getSize(t);r=!Object(p.isNumber)(o.r)||isNaN(o.r)?a[0]/2||Oe.defaultCombo.style.r:Math.max(o.r,a[0]/2)||a[0]/2}o.r=r+n;var s=Object(d.__assign)({x:0,y:0},o);return t.style?t.style.r=r:t.style={r:r},s},update:function(t,e){var n=this.getSize(t),r=t.padding||this.options.padding;Object(p.isArray)(r)&&(r=r[0]);var i,o=Object(p.clone)(t.style);i=t.fixSize?Object(p.isNumber)(t.fixSize)?t.fixSize:t.fixSize[0]:Math.max(o.r,n[0]/2)||n[0]/2,o.r=i+r;var a=e.get("sizeCache");a&&(a.r=o.r);var s={stroke:t.color},u=e.get("keyShape"),c=Object(p.mix)({},u.attr(),s,o);t.style?t.style.r=i:t.style={r:i},this.updateShape(t,e,c,!0)}},"single-combo"),hn.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},shapeType:"rect",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t);return e.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0})},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,r=t.style,i=t.padding||this.options.padding;Object(p.isNumber)(i)&&(i=[i,i,i,i]);var o=e.refX,a=e.refY;Object(p.isNil)(o)&&(o=this.refX),Object(p.isNil)(a)&&(a=this.refY);var s,u=r.width/2+i[3],c=r.height/2+i[0];switch(n){case"top":s={x:0-u+o,y:0-c+a,textBaseline:"top",textAlign:"left"};break;case"bottom":s={x:0,y:c+a,textBaseline:"bottom",textAlign:"center"};break;case"left":s={x:0-u+a,y:0,textAlign:"left"};break;case"center":s={x:0,y:0,text:t.label,textAlign:"center"};break;default:s={x:u+o,y:0,textAlign:"right"}}return s.text=t.label,s},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;Object(p.isNumber)(n)&&(n=[n,n,n,n]);var r,i,o={stroke:t.color},a=Object(p.mix)({},e,o,t.style),s=this.getSize(t),u=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;u?Object(p.isNumber)(u)?(r=u,i=u):(r=u[0],i=u[1]):(r=!Object(p.isNumber)(a.width)||isNaN(a.width)?s[0]||Oe.defaultCombo.style.width:Math.max(a.width,s[0])||s[0],i=!Object(p.isNumber)(a.height)||isNaN(a.height)?s[1]||Oe.defaultCombo.style.height:Math.max(a.height,s[1])||s[1]);var c=-r/2-n[3],l=-i/2-n[0];a.width=r+n[1]+n[3],a.height=i+n[0]+n[2];var f=Object(d.__assign)({x:c,y:l},a);return t.style?(t.style.width=r,t.style.height=i):t.style={width:r,height:i},f},update:function(t,e){var n=this.getSize(t),r=t.padding||this.options.padding;Object(p.isNumber)(r)&&(r=[r,r,r,r]);var i,o,a=Object(p.clone)(t.style),s=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;s?Object(p.isNumber)(s)?(i=s,o=s):(i=s[0],o=s[1]):(i=Math.max(a.width,n[0])||n[0],o=Math.max(a.height,n[1])||n[1]),a.width=i+r[1]+r[3],a.height=o+r[0]+r[2];var u=e.get("sizeCache");u&&(u.width=a.width,u.height=a.height),a.x=-i/2-r[3],a.y=-o/2-r[0];var c={stroke:t.color},l=e.get("keyShape"),f=Object(p.mix)({},l.attr(),c,a);t.style?(t.style.width=i,t.style.height=o):t.style={width:i,height:o},this.updateShape(t,e,f,!1)},updateShape:function(t,e,n){var r=e.get("keyShape");(void 0===t.animate?this.options.animate:t.animate)&&r.animate?r.animate(n,{duration:200,easing:"easeLinear"}):r.attr(Object(d.__assign)({},n)),this.updateLabel(t,e)}},"single-combo"),hn.registerNode("simple-circle",{options:{size:Oe.defaultNode.size,style:{x:0,y:0,stroke:Oe.defaultNode.style.stroke,fill:Oe.defaultNode.style.fill,lineWidth:Oe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Oe.nodeLabel.style.fill,fontSize:Oe.nodeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(t,e){var n=this.getShapeStyle(t),r="".concat(this.type,"-keyShape"),i=e.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:r,draggable:!0});return e.shapeMap[r]=i,i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.deepMix)({},e,n),i=this.getSize(t)[0]/2;return Object(d.__assign)({x:0,y:0,r:i},r)},update:function(t,e,n){var r=this.getSize(t),i={stroke:t.color,r:r[0]/2},o=e.get("keyShape"),a=Object(p.deepMix)({},o.attr(),i,t.style);this.updateShape(t,e,a,!0,n)}},"single-node"),hn.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:Oe.defaultNode.style.stroke,fill:Oe.defaultNode.style.fill,lineWidth:Oe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Oe.nodeLabel.style.fill,fontSize:Oe.nodeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},Oe.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);return e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0})},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e,n){e.getContainer();var r=(this.mergeStyle||this.getOptions(t)).style,i=this.getSize(t),o=e.get("keyShape");t.size||(i[0]=o.attr("width")||r.width,i[1]=o.attr("height")||r.height);var a={stroke:t.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},s=Object(p.mix)({},r,o.attr(),a);s=Object(p.mix)(s,t.style),this.updateShape(t,e,s,!1,n)}},"single-node"),hn.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:Oe.windowFontFamily}},clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t);delete r.fill;var i=e.addShape(n,{attrs:r,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(t,i),i},drawClip:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).clipCfg;if(n.show){var r=n.type,i=n.x,o=n.y,a=n.style;if("circle"===r){var s=n.r;e.setClip({type:"circle",attrs:Object(d.__assign)({r:s,x:i,y:o},a)})}else if("rect"===r){var u=n.width,c=n.height,l=i-u/2,f=o-c/2;e.setClip({type:"rect",attrs:Object(d.__assign)({x:l,y:f,width:u,height:c},a)})}else if("ellipse"===r){var h=n.rx,p=n.ry;e.setClip({type:"ellipse",attrs:Object(d.__assign)({x:i,y:o,rx:h,ry:p},a)})}else if("polygon"===r){var g=n.points;e.setClip({type:"polygon",attrs:Object(d.__assign)({points:g},a)})}else if("path"===r){var v=n.path;e.setClip({type:"path",attrs:Object(d.__assign)({path:v},a)})}}},getShapeStyle:function(t){var e=this.mergeStyle||this.getOptions(t),n=e.style,r=e.img,i=this.getSize(t),o=i[0],a=i[1];return n&&(o=n.width||i[0],a=n.height||i[1]),Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a,img:r},n)},updateShapeStyle:function(t,e){var n=e.getContainer(),r="".concat(this.itemType,"-shape"),i=n.shapeMap[r]||n.find((function(t){return t.get("className")===r}))||e.getKeyShape(),o=this.getShapeStyle(t);i&&!i.destroyed&&i.attr(o)}},"single-node");var rr,ir={triangle:function(t,e,n){void 0===t&&(t=10),void 0===e&&(e=15),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 L ").concat(r+e,",-").concat(t/2," L ").concat(r+e,",").concat(t/2," Z")},vee:function(t,e,n){void 0===t&&(t=15),void 0===e&&(e=20),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 L ").concat(r+e,",-").concat(t/2,"\n L ").concat(r+2*e/3,",0 L ").concat(r+e,",").concat(t/2," Z")},circle:function(t,e){return void 0===t&&(t=5),void 0===e&&(e=0),"M ".concat(2*e,", 0\n a ").concat(t,",").concat(t," 0 1,0 ").concat(2*t,",0\n a ").concat(t,",").concat(t," 0 1,0 ").concat(2*-t,",0")},rect:function(t,e,n){void 0===t&&(t=10),void 0===e&&(e=10),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",").concat(-t/2," \n L ").concat(r+e,",").concat(-t/2," \n L ").concat(r+e,",").concat(t/2," \n L ").concat(r,",").concat(t/2," Z")},diamond:function(t,e,n){void 0===t&&(t=15),void 0===e&&(e=15),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 \n L ").concat(r+e/2,",").concat(-t/2," \n L ").concat(r+e,",0 \n L ").concat(r+e/2,",").concat(t/2," Z")},triangleRect:function(t,e,n,r,i,o){void 0===t&&(t=15),void 0===e&&(e=15),void 0===n&&(n=15),void 0===r&&(r=3),void 0===i&&(i=5),void 0===o&&(o=0);var a=2*o,s=a+e+i;return"M ".concat(a,",0 L ").concat(a+e,",-").concat(t/2," L ").concat(a+e,",").concat(t/2," Z\n M ").concat(s,", -").concat(n/2,"\n L ").concat(s+r," -").concat(n/2,"\n L ").concat(s+r," ").concat(n/2,"\n L ").concat(s," ").concat(n/2,"\n Z")}},or={collapse:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0],["M",t-n+4,e],["L",t+n-4,e]]},expand:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0],["M",t-n+4,e],["L",t-n+2*n-4,e],["M",t-n+n,e-n+4],["L",t,e+n-4]]},upTriangle:function(t,e,n){var r=n*Math.cos(Math.PI/6),i=n*Math.sin(Math.PI/6);return[["M",t-r,e+i],["L",t+r,e+i],["L",t,e-n],["Z"]]},downTriangle:function(t,e,n){var r=n*Math.cos(Math.PI/6),i=n*Math.sin(Math.PI/6);return[["M",t-r,e-i],["L",t+r,e-i],["L",t,e+n],["Z"]]}},ar=hn,sr=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"],ur=b.a.transform,cr=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},a),o),s),i),u),{transform:ur,mat3:b.b}),lr=function(){function t(t){this.graph=t,this.layoutCfg=t.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return t.prototype.initLayout=function(){},t.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},t.prototype.getLayoutCfgType=function(t){var e=t.type;if(e)return e;var n=t.pipes;return Array.isArray(n)?n.map((function(t){return(null==t?void 0:t.type)||""})):null},t.prototype.isLayoutTypeSame=function(t){var e=this.getLayoutCfgType(t);return Array.isArray(this.layoutType)?this.layoutType.every((function(t,n){return t===e[n]})):(null==t?void 0:t.type)===this.layoutType},t.prototype.refreshLayout=function(){var t=this.graph,e=this.layoutType;this.data;t&&(t.get("animate")?t.positionsAnimate("comboCombined"===e):t.refreshPositions("comboCombined"===e))},t.prototype.changeLayout=function(t){this.layoutCfg=t,this.destoryLayoutMethods(),this.layout()},t.prototype.changeData=function(){this.destoryLayoutMethods(),this.layout()},t.prototype.destoryLayoutMethods=function(){var t=this.layoutMethods;null==t||t.forEach((function(t){t.destroy()})),this.layoutMethods=[]},t.prototype.destroyLayout=function(){var t=this.graph;this.destoryLayoutMethods(),t.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},t.prototype.setDataFromGraph=function(){for(var t=[],e=[],n=[],r=[],i=[],o=[],a=this.graph.getNodes(),s=this.graph.getEdges(),u=this.graph.getCombos(),c=a.length,l=0;l<c;l++){var f=a[l];if(f&&!f.destroyed){var h=f.getModel();f.isVisible()?t.push(h):e.push(h)}}var d=s.length;for(l=0;l<d;l++){var p=s[l];if(p&&!p.destroyed){h=p.getModel();p.isVisible()?h.isComboEdge?i.push(h):n.push(h):r.push(h)}}var g=u.length;for(l=0;l<g;l++){var v=u[l];if(!v.destroyed){h=v.getModel();v.isVisible()?o.push(h):r.push(h)}}return{nodes:t,hiddenNodes:e,edges:n,hiddenEdges:r,combos:o,hiddenCombos:[],comboEdges:i}},t.prototype.reLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){var o=n.graph,a=null==e?void 0:e.type;e.onLayoutEnd=function(){o.emit("aftersublayout",{type:a}),r()},t.init(n.data),"force"===a&&(t.ticking=!1,t.forceSimulation.stop()),o.emit("beforesublayout",{type:a}),t.execute(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd()}))},t.prototype.relayout=function(t){var e=this,n=this.graph,r=this.layoutMethods,i=this.layoutCfg;if(t){this.data=this.setDataFromGraph();var o=this.data.nodes;if(!o)return!1;this.initPositions(i.center,o)}n.emit("beforelayout");var a=Promise.resolve();null==r||r.forEach((function(t,n){var r=i[n];a=a.then((function(){return e.reLayoutMethod(t,r)}))})),(null==r?void 0:r.length)&&a.then((function(){i.onAllLayoutEnd&&i.onAllLayoutEnd()})).catch((function(t){console.warn("relayout failed",t)}))},t.prototype.filterLayoutData=function(t,e){var n,r,i=t.nodes,o=t.edges,a=Object(d.__rest)(t,["nodes","edges"]);if(!i)return t;n=Object(p.isFunction)(null==e?void 0:e.nodesFilter)?e.nodesFilter:function(){return!0};var s=i.filter(n);if(Object(p.isFunction)(null==e?void 0:e.edgesFilter))r=e.edgesFilter;else{var u=s.reduce((function(t,e){return t[e.id]=!0,t}),{});r=function(t){return u[t.source]&&u[t.target]}}return Object(d.__assign)({nodes:s,edges:o.filter(r)},a)},t.prototype.getLayoutBBox=function(t){var e=this.graph,n=Object(p.groupBy)(e.getNodes(),(function(t){return t.getModel().layoutOrder})),r=Object.values(n).map((function(t){var e=Je(t);return e.size=[e.width,e.height],e}));return{groupNodes:Object.values(Object(p.groupBy)(t,"layoutOrder")),layoutNodes:r}},t.prototype.layoutAnimate=function(){},t.prototype.moveToZero=function(){var t=this.graph.get("data").nodes;if(void 0!==t[0].x&&null!==t[0].x&&!$e(t[0].x)){for(var e=[0,0],n=t.length,r=0;r<n;r++){var i=t[r];e[0]+=i.x,e[1]+=i.y}e[0]/=t.length,e[1]/=t.length;for(r=0;r<n;r++){(i=t[r]).x-=e[0],i.y-=e[1]}}},t.prototype.initPositions=function(t,e){var n=this.graph;if(!e)return!1;var r=e?e.length:0;if(r){var i=.85*n.get("width"),o=.85*n.get("height"),a=Math.ceil(Math.sqrt(r)*(i/o)),s=i/(a-1),u=o/(Math.ceil(r/a)-1);isFinite(s)&&s||(s=0),isFinite(u)&&s||(u=0);for(var c=t[0]-i/2,l=t[1]-o/2,f=!0,h=0;h<r;h++){var d=e[h];$e(+d.x)&&(f=!1,d.x=h%a*s+c),$e(+d.y)&&(f=!1,d.y=Math.floor(h/a)*u+l)}return f}},t.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},t}(),fr=function(t){this.graph=t,this.destroyed=!1,this.initEvents()};!function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.MOUSEDOWN="mousedown",t.MOUDEUP="mouseup",t.CONTEXTMENU="contextmenu",t.MOUSEENTER="mouseenter",t.MOUSEOUT="mouseout",t.MOUSEOVER="mouseover",t.MOUSEMOVE="mousemove",t.MOUSELEAVE="mouseleave",t.DRAGSTART="dragstart",t.DRAGEND="dragend",t.DRAG="drag",t.DRAGENTER="dragenter",t.DRAGLEAVE="dragleave",t.DRAGOVER="dragover",t.DRAGOUT="dragout",t.DDROP="drop",t.KEYUP="keyup",t.KEYDOWN="keydown",t.WHEEL="wheel",t.FOCUS="focus",t.BLUR="blur",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.CANVAS_TOUCHSTART="canvas:touchstart",t.CANVAS_TOUCHMOVE="canvas:touchmove",t.CANVAS_TOUCHEND="canvas:touchend",t.NODE_TOUCHSTART="node:touchstart",t.NODE_TOUCHMOVE="node:touchmove",t.NODE_TOUCHEND="node:touchend",t.COMBO_TOUCHSTART="combo:touchstart",t.COMBO_TOUCHMOVE="combo:touchmove",t.COMBO_TOUCHEND="combo:touchend",t.EDGE_TOUCHSTART="edge:touchstart",t.EDGE_TOUCHMOVE="edge:touchmove",t.EDGE_TOUCHEND="edge:touchend",t.NODE_CONTEXTMENU="node:contextmenu",t.NODE_CLICK="node:click",t.NODE_DBLCLICK="node:dblclick",t.NODE_MOUSEDOWN="node:mousedown",t.NODE_MOUSEUP="node:mouseup",t.NODE_MOUSEENTER="node:mouseenter",t.NODE_MOUSELEAVE="node:mouseleave",t.NODE_MOUSEMOVE="node:mousemove",t.NODE_MOUSEOUT="node:mouseout",t.NODE_MOUSEOVER="node:mouseover",t.NODE_DROP="node:drop",t.NODE_DRAGOVER="node:dragover",t.NODE_DRAGENTER="node:dragenter",t.NODE_DRAGLEAVE="node:dragleave",t.NODE_DRAGSTART="node:dragstart",t.NODE_DRAG="node:drag",t.NODE_DRAGEND="node:dragend",t.NODE_TAP="node:tap",t.NODE_PANSTART="node:panstart",t.NODE_PANMOVE="node:panmove",t.NODE_PANEND="node:panend",t.COMBO_CONTEXTMENU="combo:contextmenu",t.COMBO_CLICK="combo:click",t.COMBO_DBLCLICK="combo:dblclick",t.COMBO_MOUSEDOWN="combo:mousedown",t.COMBO_MOUSEUP="combo:mouseup",t.COMBO_MOUSEENTER="combo:mouseenter",t.COMBO_MOUSELEAVE="combo:mouseleave",t.COMBO_MOUSEMOVE="combo:mousemove",t.COMBO_MOUSEOUT="combo:mouseout",t.COMBO_MOUSEOVER="combo:mouseover",t.COMBO_DROP="combo:drop",t.COMBO_DRAGOVER="combo:dragover",t.COMBO_DRAGENTER="combo:dragenter",t.COMBO_DRAGLEAVE="combo:dragleave",t.COMBO_DRAGSTART="combo:dragstart",t.COMBO_DRAG="combo:drag",t.COMBO_DRAGEND="combo:dragend",t.COMBO_TAP="combo:tap",t.COMBO_PANSTART="combo:panstart",t.COMBO_PANMOVE="combo:panmove",t.COMBO_PANEND="combo:panend",t.EDGE_CONTEXTMENU="edge:contextmenu",t.EDGE_CLICK="edge:click",t.EDGE_DBLCLICK="edge:dblclick",t.EDGE_MOUSEDOWN="edge:mousedown",t.EDGE_MOUSEUP="edge:mouseup",t.EDGE_MOUSEENTER="edge:mouseenter",t.EDGE_MOUSELEAVE="edge:mouseleave",t.EDGE_MOUSEMOVE="edge:mousemove",t.EDGE_MOUSEOUT="edge:mouseout",t.EDGE_MOUSEOVER="edge:mouseover",t.EDGE_DROP="edge:drop",t.EDGE_DRAGOVER="edge:dragover",t.EDGE_DRAGENTER="edge:dragenter",t.EDGE_DRAGLEAVE="edge:dragleave",t.CANVAS_CONTEXTMENU="canvas:contextmenu",t.CANVAS_CLICK="canvas:click",t.CANVAS_DBLCLICK="canvas:dblclick",t.CANVAS_MOUSEDOWN="canvas:mousedown",t.CANVAS_MOUSEUP="canvas:mouseup",t.CANVAS_MOUSEENTER="canvas:mouseenter",t.CANVAS_MOUSELEAVE="canvas:mouseleave",t.CANVAS_MOUSEMOVE="canvas:mousemove",t.CANVAS_MOUSEOUT="canvas:mouseout",t.CANVAS_MOUSEOVER="canvas:mouseover",t.CANVAS_DROP="canvas:drop",t.CANVAS_DRAGENTER="canvas:dragenter",t.CANVAS_DRAGLEAVE="canvas:dragleave",t.CANVAS_DRAGSTART="canvas:dragstart",t.CANVAS_DRAG="canvas:drag",t.CANVAS_DRAGEND="canvas:dragend",t.CANVAS_TAP="canvas:tap",t.CANVAS_PANSTART="canvas:panstart",t.CANVAS_PANMOVE="canvas:panmove",t.CANVAS_PANEND="canvas:panend",t.BEFORERENDER="beforerender",t.AFTERRENDER="afterrender",t.BEFOREADDITEM="beforeadditem",t.AFTERADDITEM="afteradditem",t.BEFOREREMOVEITEM="beforeremoveitem",t.AFTERREMOVEITEM="afterremoveitem",t.BEFOREUPDATEITEM="beforeupdateitem",t.AFTERUPDATEITEM="afterupdateitem",t.BEFOREITEMVISIBILITYCHANGE="beforeitemvisibilitychange",t.AFTERITEMVISIBILITYCHANGE="afteritemvisibilitychange",t.BEFOREITEMSTATECHANGE="beforeitemstatechange",t.AFTERITEMSTATECHANGE="afteritemstatechange",t.BEFOREITEMREFRESH="beforeitemrefresh",t.AFTERITEMREFRESH="afteritemrefresh",t.BEFOREITEMSTATESCLEAR="beforeitemstatesclear",t.AFTERITEMSTATESCLEAR="afteritemstatesclear",t.BEFOREMODECHANGE="beforemodechange",t.AFTERMODECHANGE="aftermodechange",t.BEFORELAYOUT="beforelayout",t.AFTERLAYOUT="afterlayout",t.BEFORECREATEEDGE="beforecreateedge",t.AFTERCREATEEDGE="aftercreateedge",t.BEFOREGRAPHREFRESHPOSITION="beforegraphrefreshposition",t.AFTERGRAPHREFRESHPOSITION="aftergraphrefreshposition",t.BEFOREGRAPHREFRESH="beforegraphrefresh",t.AFTERGRAPHREFRESH="aftergraphrefresh",t.BEFOREANIMATE="beforeanimate",t.AFTERANIMATE="afteranimate",t.BEFOREPAINT="beforepaint",t.AFTERPAINT="afterpaint",t.BEFORECOLLAPSEEXPANDCOMBO="beforecollapseexpandcombo",t.AFTERCOLLAPSEEXPANDCOMBO="aftercollapseexpandcombo",t.GRAPHSTATECHANGE="graphstatechange",t.AFTERACTIVATERELATIONS="afteractivaterelations",t.NODESELECTCHANGE="nodeselectchange",t.TOOLTIPCHANGE="tooltipchange",t.WHEELZOOM="wheelzoom",t.VIEWPORTCHANGE="viewportchange",t.DRAGNODEEND="dragnodeend",t.STACKCHANGE="stackchange",t.TAP="tap",t.PINCHSTART="pinchstart",t.PINCHMOVE="pinchmove",t.PANSTART="panstart",t.PANMOVE="panmove",t.PANEND="panend"}(rr||(rr={}));var hr=ar.registerNode,dr=ar.registerEdge,pr=ar.registerCombo,gr=y.registerBehavior,vr=Oe,yr=(ar.registerNode,ar.registerEdge,ar.registerCombo,y.registerBehavior,n(217)),mr=n(46),br=n(58),xr=n(77),_r=n.n(xr),wr=n(81),Er=n.n(wr),Sr=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function Or(t,e,n){var r;return(r=Math.round(t.h)>=60&&Math.round(t.h)<=240?n?Math.round(t.h)-2*e:Math.round(t.h)+2*e:n?Math.round(t.h)+2*e:Math.round(t.h)-2*e)<0?r+=360:r>=360&&(r-=360),r}function Mr(t,e,n){return 0===t.h&&0===t.s?t.s:((r=n?t.s-.16*e:4===e?t.s+.16:t.s+.05*e)>1&&(r=1),n&&5===e&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function kr(t,e,n){var r;return(r=n?t.v+.05*e:t.v-.15*e)>1&&(r=1),Number(r.toFixed(2))}function Ar(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=Er()(t),i=5;i>0;i-=1){var o=r.toHsv(),a=Er()({h:Or(o,i,!0),s:Mr(o,i,!0),v:kr(o,i,!0)}).toHexString();n.push(a)}n.push(r.toHexString());for(var s=1;s<=4;s+=1){var u=r.toHsv(),c=Er()({h:Or(u,s),s:Mr(u,s),v:kr(u,s)}).toHexString();n.push(c)}return"dark"===e.theme?Sr.map((function(t){var r=t.index,i=t.opacity;return Er.a.mix(e.backgroundColor||"#141414",n[r],100*i).toHexString()})):n}var Cr={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Tr={},Ir={};Object.keys(Cr).forEach((function(t){Tr[t]=Ar(Cr[t]),Tr[t].primary=Tr[t][5],Ir[t]=Ar(Cr[t],{theme:"dark",backgroundColor:"#141414"}),Ir[t].primary=Ir[t][5]}));Tr.red,Tr.volcano,Tr.gold,Tr.orange,Tr.yellow,Tr.lime,Tr.green,Tr.cyan,Tr.blue,Tr.geekblue,Tr.purple,Tr.magenta,Tr.grey;var jr,Pr,Nr,Dr,Lr=function(t,e,n){var r=_r()(t),i=_r()(e);return _r()([(1-n)*r.red()+n*i.red(),(1-n)*r.green()+n*i.green(),(1-n)*r.blue()+n*i.blue()]).rgb()},Rr=function(t,e,n,r){return void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)"),"default"===n?function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="rgb(150, 150, 150)");var r=Lr(e,t,.05).rgb().toString(),i=Lr(e,t,.1).rgb().toString(),o=Lr(e,t,.2).rgb().toString(),a=Lr(e,t,.4).rgb().toString(),s=Lr(e,n,.02).rgb().toString(),u=Lr(e,n,.05).rgb().toString(),c=Lr(e,n,.1).rgb().toString(),l=Lr(e,n,.2).rgb().toString(),f=Lr(e,n,.3).rgb().toString(),h=Ar(t,{theme:"default",backgroundColor:e}),d=_r()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:t,mainFill:i,activeStroke:t,activeFill:r,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:e,highlightStroke:g,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:f,edgeActiveStroke:t,edgeInactiveStroke:l,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:f,comboMainFill:s,comboActiveStroke:t,comboActiveFill:r,comboInactiveStroke:f,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:s,comboDisableStroke:l,comboDisableFill:u}}(t,e,"rgb(150, 150, 150)"):function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="#777");var r=Lr(e,t,.2).rgb().toString(),i=Lr(e,t,.3).rgb().toString(),o=Lr(e,t,.6).rgb().toString(),a=Lr(e,t,.8).rgb().toString(),s=Lr(e,n,.2).rgb().toString(),u=Lr(e,n,.25).rgb().toString(),c=Lr(e,n,.3).rgb().toString(),l=Lr(e,n,.4).rgb().toString(),f=Lr(e,n,.5).rgb().toString(),h=Ar(t,{theme:"dark",backgroundColor:e}),d=_r()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:a,mainFill:r,activeStroke:t,activeFill:i,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:r,highlightStroke:t,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:n,edgeActiveStroke:t,edgeInactiveStroke:n,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:l,comboMainFill:u,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:l,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:l,comboDisableFill:s}}(t,e,"#777")},Br=function(t,e,n,r){void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)");var i=[];return t.forEach((function(t){i.push(Rr(t,e,n,r))})),i},Fr=Rr("rgb(95, 149, 255)","rgb(255, 255, 255)"),Gr={version:"0.6.0-beta.2",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:Fr.mainStroke,fill:Fr.mainFill},size:20,color:Fr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Fr.activeFill,stroke:Fr.activeStroke}},nodeStateStyles:{active:{fill:Fr.activeFill,stroke:Fr.activeStroke,lineWidth:2,shadowColor:Fr.mainStroke,shadowBlur:10},selected:{fill:Fr.selectedFill,stroke:Fr.selectedStroke,lineWidth:4,shadowColor:Fr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Fr.highlightFill,stroke:Fr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Fr.inactiveFill,stroke:Fr.inactiveStroke,lineWidth:1},disable:{fill:Fr.disableFill,stroke:Fr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Fr.edgeMainStroke,lineAppendWidth:2},color:Fr.edgeMainStroke},edgeStateStyles:{active:{stroke:Fr.edgeActiveStroke,lineWidth:1},selected:{stroke:Fr.edgeSelectedStroke,lineWidth:2,shadowColor:Fr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Fr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Fr.edgeInactiveStroke,lineWidth:1},disable:{stroke:Fr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Fr.comboMainFill,lineWidth:1,stroke:Fr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Fr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Fr.comboActiveStroke,lineWidth:1,fill:Fr.comboActiveFill},selected:{stroke:Fr.comboSelectedStroke,lineWidth:2,fill:Fr.comboSelectedFill,shadowColor:Fr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Fr.comboHighlightStroke,lineWidth:2,fill:Fr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Fr.comboInactiveStroke,fill:Fr.comboInactiveFill,lineWidth:1},disable:{stroke:Fr.comboDisableStroke,fill:Fr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function zr(t,e,n){if(t){if("function"==typeof t.addEventListener)return t.addEventListener(e,n,!1),{remove:function(){t.removeEventListener(e,n,!1)}};if("function"==typeof t.attachEvent)return t.attachEvent("on"+e,n),{remove:function(){t.detachEvent("on"+e,n)}}}}function Ur(t){jr||(jr=document.createElement("table"),Pr=document.createElement("tr"),Nr=/^\s*<(\w+|!)[^>]*>/,Dr={tr:document.createElement("tbody"),tbody:jr,thead:jr,tfoot:jr,td:Pr,th:Pr,"*":document.createElement("div")});var e=Nr.test(t)&&RegExp.$1;e&&e in Dr||(e="*");var n=Dr[e];t="string"==typeof t?t.replace(/(^\s*)|(\s*$)/g,""):t,n.innerHTML=""+t;var r=n.childNodes[0];return r&&n.contains(r)&&n.removeChild(r),r}function Vr(t,e){if(t)for(var n in e)e.hasOwnProperty(n)&&(t.style[n]=e[n]);return t}var Wr=cr.cloneEvent,Xr=cr.isViewportChanged,Yr=function(t){function e(e){var n=t.call(this,e)||this;return n.extendEvents=[],n.dragging=!1,n.preItem=null,n.graph=e,n.destroyed=!1,n.initEvents(),n}return Object(d.__extends)(e,t),e.prototype.initEvents=function(){var t=this.graph,e=this.extendEvents,n=void 0===e?[]:e,r=t.get("canvas"),i=r.get("el"),o=Object(p.wrapBehavior)(this,"onCanvasEvents"),a=Object(p.wrapBehavior)(this,"onExtendEvents"),s=Object(p.wrapBehavior)(this,"onWheelEvent");r.off("*").on("*",o),this.canvasHandler=o,n.push(zr(i,"DOMMouseScroll",s)),n.push(zr(i,"mousewheel",s)),"undefined"!=typeof window&&(n.push(zr(window,"keydown",a)),n.push(zr(window,"keyup",a)),n.push(zr(window,"focus",a)))},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this.graph,r=n.get("canvas"),i=t.target,o=t.type;t.canvasX=t.x,t.canvasY=t.y;var a={x:t.canvasX,y:t.canvasY},s=n.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),Xr(s)&&(a=n.getPointByClient(t.clientX,t.clientY)),t.x=a.x,t.y=a.y,t.currentTarget=n,i===r)return"mousemove"!==o&&"mouseleave"!==o||this.handleMouseMove(t,"canvas"),t.target=r,t.item=null,n.emit(o,t),void n.emit("canvas:".concat(o),t);var u=e.getItemRoot(i);if(u){var c=u.get("item");if(!c.destroyed){var l=c.getType();if(t.target=i,t.item=c,t.canvasX===t.x&&t.canvasY===t.y){var f=n.getCanvasByPoint(t.x,t.y);t.canvasX=f.x,t.canvasY=f.y}n.emit(o,t),t.name&&!t.name.includes(":")?n.emit("".concat(l,":").concat(o),t):n.emit(t.name,t),"dragstart"===o&&(this.dragging=!0),"dragend"===o&&(this.dragging=!1),"mousemove"===o&&this.handleMouseMove(t,l)}}else n.emit(o,t)},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){Object(p.isNil)(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,e){var n=this.graph,r=this.preItem,i=n.get("canvas"),o=t.target===i?null:t.item;t=Wr(t),r&&r!==o&&!r.destroyed&&(t.item=r,this.emitCustomEvent(r.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(r.getType(),"dragleave",t)),o&&r!==o&&(t.item=o,this.emitCustomEvent(e,"mouseenter",t),this.dragging&&this.emitCustomEvent(e,"dragenter",t)),this.preItem=o},e.prototype.emitCustomEvent=function(t,e,n){n.type=e,this.graph.emit("".concat(t,":").concat(e),n)},e.prototype.destroy=function(){var t=this.graph,e=this.canvasHandler,n=this.extendEvents;t.get("canvas").off("*",e),Object(p.each)(n,(function(t){t.remove()})),this.dragging=!1,this.preItem=null,this.extendEvents.length=0,this.canvasHandler=null,this.destroyed=!0},e}(fr),Hr=n(22),qr=n(75),Kr=n.n(qr),Zr=cr.traverseTree,Qr=function(t,e){return t?Object(p.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},$r=function(t,e){var n=[],r=[],i={},o=0;for(o=0;o<t.length;o++){var a=t[o];i[a.id]=o,n.push(a.x),n.push(a.y),n.push(0),n.push(0),r.push([])}for(o=0;o<e.length;o++){var s=e[o];r[i[s.source]].push(i[s.target]),r[i[s.target]].push(i[s.source])}var u=0;for(o=0;o<t.length;o++){var c=n.length,l=r[o],f=l.length;n[4*o+2]=c,n[4*o+3]=l.length,u=Math.max(u,l.length);for(var h=0;h<f;++h){var d=l[h];n.push(+d)}}for(;n.length%4!=0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:u}},Jr=function(t,e,n){var r=[],i=[],o={},a=0;for(a=0;a<t.length;a++){var s=t[a];o[s.id]=a,r.push(s.x),r.push(s.y),r.push(0),r.push(0),i.push([])}for(a=0;a<e.length;a++){var u=e[a];i[o[u.source]].push(o[u.target]),i[o[u.source]].push(n(u)),i[o[u.target]].push(o[u.source]),i[o[u.target]].push(n(u))}var c=0;for(a=0;a<t.length;a++){var l=r.length,f=i[a],h=f.length;r[4*a+2]=l,r[4*a+3]=h/2,c=Math.max(c,h/2);for(var d=0;d<h;++d){var p=f[d];r.push(+p)}}for(;r.length%4!=0;)r.push(0);return{array:new Float32Array(r),maxEdgePerVetex:c}},ti=function(t,e,n,r){var i=[],o=[],a={},s=0;for(s=0;s<t.length;s++){var u=t[s];a[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),o.push([])}for(s=0;s<e.length;s++){var c=e[s];o[a[c.source]].push(a[c.target]),o[a[c.source]].push(n(c)),o[a[c.source]].push(r(c)),o[a[c.source]].push(0),o[a[c.target]].push(a[c.source]),o[a[c.target]].push(n(c)),o[a[c.target]].push(r(c)),o[a[c.target]].push(0)}var l=0;for(s=0;s<t.length;s++){var f=i.length,h=o[s],d=h.length;i[4*s+2]=f+1048576*d/4,i[4*s+3]=0,l=Math.max(l,d/4);for(var p=0;p<d;++p){var g=h[p];i.push(+g)}}for(;i.length%4!=0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:l}},ei=function(t,e){var n=[],r=t.length,i={};return e.forEach((function(e){t.forEach((function(t,o){if(void 0===i[e[t]]&&(i[e[t]]=Object.keys(i).length),n.push(i[e[t]]),o===r-1)for(;n.length%4!=0;)n.push(0)}))})),{array:new Float32Array(n),count:Object.keys(i).length}},ni=function(t){for(var e=[],n=t.length,r=t[0].length,i=function(r){t.forEach((function(t,i){if(e.push(t[r]),i===n-1)for(;e.length%4!=0;)e.push(0)}))},o=0;o<r;o++)i(o);return new Float32Array(e)},ri=function(t,e){var n={x:1/0,y:1/0},r={x:-1/0,y:-1/0},i="x",o="y";e&&["V","TB","BT"].indexOf(e)>=0&&(o="x",i="y");var a=0;Zr(t,(function(t){return a++,t.x>r.x&&(r.x=t.x),t.x<n.x&&(n.x=t.x),t.y>r.y&&(r.y=t.y),t.y<n.y&&(n.y=t.y),!0}));var s=2*Math.PI/a,u=r[o]-n[o];return 0===u||Zr(t,(function(e){var r=(e[o]-n[o])/u*(2*Math.PI-s)+s,a=Math.abs("x"===i?e.x-t.x:e.y-t.y);return e.x=a*Math.cos(r),e.y=a*Math.sin(r),!0})),t},ii=function t(){return"undefined"==typeof window||"undefined"==typeof document?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join("\n")),t},addGetWebGLMessage:function(e){var n=void 0!==(e=e||{}).parent?e.parent:document.body,r=void 0!==e.id?e.id:"oldie",i=t().getWebGLErrorMessage();i.id=r,n.appendChild(i)}}},oi=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},cr),c),l),f),ai=oi.radialLayout,si=function(){function t(t){this.type=t.type,this.radial=t.radial,this.config=t}return t.prototype.init=function(t){var e=this;this.data=t,this.radial?this.layoutMethod=function(t){var n=Kr.a[e.type](t,e.config);return ai(n),n}:this.layoutMethod=function(t){return Kr.a[e.type](t,e.config)}},t.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},t.prototype.layout=function(t){return this.init(t),this.execute()},t}();Object(Hr.registerLayout)("grid",Hr.GridLayout),Object(Hr.registerLayout)("random",Hr.RandomLayout),Object(Hr.registerLayout)("force",Hr.ForceLayout),Object(Hr.registerLayout)("circular",Hr.CircularLayout),Object(Hr.registerLayout)("dagre",Hr.DagreLayout),Object(Hr.registerLayout)("radial",Hr.RadialLayout),Object(Hr.registerLayout)("concentric",Hr.ConcentricLayout),Object(Hr.registerLayout)("mds",Hr.MDSLayout),Object(Hr.registerLayout)("fruchterman",Hr.FruchtermanLayout),Object(Hr.registerLayout)("fruchterman-gpu",Hr.FruchtermanGPULayout),Object(Hr.registerLayout)("gForce",Hr.GForceLayout),Object(Hr.registerLayout)("gForce-gpu",Hr.GForceGPULayout),Object(Hr.registerLayout)("comboForce",Hr.ComboForceLayout),Object(Hr.registerLayout)("comboCombined",Hr.ComboCombinedLayout),Object(Hr.registerLayout)("forceAtlas2",Hr.ForceAtlas2Layout);var ui=function(t,e){e.isCustomLayout=!0,Hr.Layouts[t]=Object(Hr.registerLayout)(t,e)},ci=function(t,e){var n=t.toString(),r=new Blob(["importScripts('".concat(e,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(r))},li=function(t){return void 0===t&&(t="https://unpkg.com/@antv/layout@latest/dist/layout.min.js"),new ci((function(){var t="LAYOUT_RUN",e="LAYOUT_END",n="LAYOUT_ERROR",r="GPU_LAYOUT_RUN";layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout),onmessage=function(i){(function(e){var n=e.data.type;return n===t||n===r})(i)&&function(i){var o=this;switch(i.data.type){case t:var a,s=i.data,u=s.nodes,c=s.edges,l=s.layoutCfg,f=(v=void 0===l?{}:l).type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}v.onLayoutEnd=function(){o.postMessage({type:e,nodes:u}),null==a||a.destroy()},(a=new h(v)).init({nodes:u,edges:c}),a.execute();break;case r:var h,d=i.data,p=d.nodes,g=(c=d.edges,d.layoutCfg),v=void 0===g?{}:g,y=d.canvas;f=v.type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}if("gpu"!==f.split("-")[1]){this.postMessage({type:n,message:"layout ".concat(f," does not support GPU")});break}var m=new h(v);m.init({nodes:p,edges:c}),m.executeWithWorker(y,this)}}(i)}}),t)},fi="LAYOUT_RUN",hi="LAYOUT_END",di="LAYOUT_ERROR",pi="LAYOUT_TICK",gi="GPU_LAYOUT_RUN",vi="GPU_LAYOUT_END";function yi(t){return(yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var mi=function(t){return setTimeout(t,16)},bi=function(t){return clearTimeout(t)},xi=function(t){return("undefined"!=typeof window&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||mi)(t)},_i=function(t){return("undefined"!=typeof window&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||bi)(t)},wi=["fruchterman","gForce"],Ei=["force","grid","circular"],Si=function(t){function e(e){var n=t.call(this,e)||this;return n.graph=e,n.layoutCfg=e.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return Object(d.__extends)(e,t),e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker||("undefined"==typeof Worker?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=li(this.layoutCfg.workerScriptURL)),this.worker},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(_i(t.requestId),t.requestId=null),t.requestId2&&(_i(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(d.__awaiter)(n,void 0,void 0,(function(){var n,o,a,s,u,c,l;return Object(d.__generator)(this,(function(f){switch(f.label){case 0:if(!(n=this.graph)||n.get("destroyed"))return[2];o=t.type,t.onLayoutEnd=function(){n.emit("aftersublayout",{type:o}),r()},o&&this.isGPU&&(this.hasGPUVersion(o)?o="".concat(o,"-gpu"):console.warn("The '".concat(o,"' layout does not support GPU calculation for now, it will run in CPU."))),"force"===o||"g6force"===o||"gForce"===o?(a=t.onTick,c=function(){a&&a(),n.refreshPositions()},t.tick=c):"comboForce"!==o&&"comboCombined"!==o||(t.comboTrees=n.get("comboTrees")),!1;try{s=new Hr.Layouts[o](t)}catch(t){console.warn("The layout method: '".concat(o,"' does not exist! Please specify it first.")),i()}return s.enableTick&&(u=t.onTick,c=function(){u&&u(),n.refreshPositions()},s.tick=c),function(t,e){var n;if(!(null===(n=null==t?void 0:t.nodes)||void 0===n?void 0:n.length))return;t.nodes.forEach((function(t){t.layoutOrder=e}))}(l=this.filterLayoutData(this.data,t),e),s.init(l),n.emit("beforesublayout",{type:o}),[4,s.execute()];case 1:return f.sent(),s.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),this.layoutMethods[e]=s,[2]}}))}))}))},e.prototype.updateLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(d.__awaiter)(n,void 0,void 0,(function(){var n,i,o;return Object(d.__generator)(this,(function(a){switch(a.label){case 0:return n=this.graph,i=null==e?void 0:e.type,e.onLayoutEnd=function(){n.emit("aftersublayout",{type:i}),r()},o=this.filterLayoutData(this.data,e),t.init(o),t.updateCfg(e),n.emit("beforesublayout",{type:i}),[4,t.execute()];case 1:return a.sent(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}}))}))}))},e.prototype.layout=function(t){var e=this,n=this.graph;this.data=this.setDataFromGraph();var r=this.data,i=r.nodes,o=r.hiddenNodes;if(!i)return!1;var a=n.get("width"),s=n.get("height"),u={};Object.assign(u,{width:a,height:s,center:[a/2,s/2]},this.layoutCfg),this.layoutCfg=u,this.destoryLayoutMethods(),n.emit("beforelayout"),this.initPositions(u.center,i),this.initPositions(u.center,o);var c=u.type;c&&"gpu"===c.split("-")[1]&&(c=c.split("-")[0],u.gpuEnabled=!0);var l=!1;u.gpuEnabled&&(l=!0,ii().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),l=!1)),this.isGPU=l;var f=u.onLayoutEnd,h=u.layoutEndFormatted,p=u.adjust;if(h||(u.layoutEndFormatted=!0,u.onAllLayoutEnd=function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return f&&f(),this.refreshLayout(),p&&u.pipes?[4,this.adjustPipesBox(this.data,p)]:[3,2];case 1:t.sent(),this.refreshLayout(),t.label=2;case 2:return n.emit("afterlayout"),[2]}}))}))}),this.stopWorker(),u.workerEnabled&&this.layoutWithWorker(this.data))return!0;var g=Promise.resolve(),v=!1;return u.type?(v=!0,g=g.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.execLayoutMethod(u,0)];case 1:return[2,t.sent()]}}))}))}))):u.pipes&&(v=!0,u.pipes.forEach((function(t,n){g=g.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.execLayoutMethod(t,n)];case 1:return[2,e.sent()]}}))}))}))}))),v&&g.then((function(){u.onAllLayoutEnd&&u.onAllLayoutEnd(),t&&t()})).catch((function(t){console.warn("graph layout failed,",t)})),!1},e.prototype.layoutWithWorker=function(t){var e=this,n=this.layoutCfg,r=this.graph,i=this.getWorker(),o=this.workerData;if(!i)return!1;o.requestId=null,o.requestId2=null,o.currentTick=null,o.currentTickData=null,r.emit("beforelayout");var a=Promise.resolve(),s=!1;if(n.type)s=!0,a=a.then((function(){return e.runWebworker(i,t,n)}));else if(n.pipes){s=!0;for(var u=function(n){a=a.then((function(){return e.runWebworker(i,t,n)}))},c=0,l=n.pipes;c<l.length;c++){u(l[c])}}return s&&a.then((function(){n.onAllLayoutEnd&&n.onAllLayoutEnd()})).catch((function(t){console.error("layout failed",t)})),!0},e.prototype.runWebworker=function(t,e,n){var r=this,i=this.isGPU,o=this.filterLayoutData(e,n),a=o.nodes,s=o.edges,u=document.createElement("canvas"),c=i&&"undefined"!=typeof window&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in u,l=function(t,e){var n={};if(t&&"object"===yi(t))return Object.keys(t).forEach((function(r){t.hasOwnProperty(r)&&e(t[r])&&(n[r]=t[r])})),n;return t}(n,(function(t){return"function"!=typeof t}));if(c){var f=u.transferControlToOffscreen();l.type="".concat(l.type,"-gpu"),t.postMessage({type:gi,nodes:a,edges:s,layoutCfg:l,canvas:f},[f])}else t.postMessage({type:fi,nodes:a,edges:s,layoutCfg:l});return new Promise((function(e,i){t.onmessage=function(t){r.handleWorkerMessage(e,i,t,o,n)}}))},e.prototype.handleWorkerMessage=function(t,e,n,r,i){var o=this.graph,a=this.workerData,s=n.data,u=s.type,c=function(){i.onTick&&i.onTick()};switch(u){case pi:a.currentTick=s.currentTick,a.currentTickData=s,a.requestId||(a.requestId=xi((function(){Oi(r,s),o.refreshPositions(),c(),s.currentTick===s.totalTicks?t():a.currentTick===s.totalTicks&&(a.requestId2=xi((function(){Oi(r,a.currentTickData),o.refreshPositions(),a.requestId2=null,c(),t()}))),a.requestId=null})));break;case hi:null==a.currentTick&&(Oi(r,s),t());break;case vi:null==a.currentTick&&(!function(t,e){for(var n=t.nodes,r=e.vertexEdgeData,i=n.length,o=0;o<i;o++){var a=n[o],s=r[4*o],u=r[4*o+1];a.x=s,a.y=u}}(r,s),t());break;case di:console.warn("Web-Worker layout error!",s.message),e();break;default:e()}},e.prototype.updateLayoutCfg=function(t){var e=this,n=this.graph,r=this.layoutMethods,i=Object(p.mix)({},this.layoutCfg,t);if(this.layoutCfg=i,null==r?void 0:r.length){if(this.data=this.setDataFromGraph(),this.stopWorker(),!t.workerEnabled||!this.layoutWithWorker(this.data)){n.emit("beforelayout");var o=Promise.resolve(),a=!1;1===r.length?(a=!0,o=o.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.updateLayoutMethod(r[0],i)];case 1:return[2,t.sent()]}}))}))}))):(a=!0,null==r||r.forEach((function(t,n){var r=i.pipes[n];o=o.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.updateLayoutMethod(t,r)];case 1:return[2,e.sent()]}}))}))}))}))),a&&o.then((function(){i.onAllLayoutEnd&&i.onAllLayoutEnd()})).catch((function(t){console.warn("layout failed",t)}))}}else this.layout()},e.prototype.adjustPipesBox=function(t,e){var n=this;return new Promise((function(r){var i=t.nodes;(null==i?void 0:i.length)||r(),Ei.includes(e)||(console.warn("The adjust type ".concat(e," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),r());var o={center:n.layoutCfg.center,nodeSize:function(t){return Math.max(t.height,t.width)},preventOverlap:!0,onLayoutEnd:function(){}},a=n.getLayoutBBox(i),s=a.groupNodes,u=a.layoutNodes,c=Object(p.clone)(u);o.onLayoutEnd=function(){null==u||u.forEach((function(t,e){var n,r,i,o=t.x-(null===(n=c[e])||void 0===n?void 0:n.x),a=t.y-(null===(r=c[e])||void 0===r?void 0:r.y);null===(i=s[e])||void 0===i||i.forEach((function(t){t.x+=o,t.y+=a}))})),r()},new Hr.Layouts[e](o).layout({nodes:u})}))},e.prototype.hasGPUVersion=function(t){return wi.includes(t)},e.prototype.destroy=function(){this.destoryLayoutMethods();var t=this.worker;t&&(t.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},e}(lr);function Oi(t,e){for(var n=t.nodes,r=e.nodes,i=n.length,o=0;o<i;o++){var a=n[o];a.x=r[o].x,a.y=r[o].y}}var Mi,ki=b.a.transform,Ai=function(t){function e(e){var n=t.call(this,e)||this,r=n.get("defaultNode");return r||n.set("defaultNode",{type:"circle"}),r.type||(r.type="circle",n.set("defaultNode",r)),n.destroyed=!1,n}return Object(d.__extends)(e,t),e.prototype.initLayoutController=function(){var t=new Si(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new Yr(this);this.set({eventController:t})},e.prototype.initCanvas=function(){var t=this.get("container");if("string"==typeof t&&(t=document.getElementById(t),this.set("container",t)),!t)throw new Error("invalid container");var e,n=t.clientWidth,r=t.clientHeight,i=this.get("width")||n,o=this.get("height")||r;if(this.get("width")||this.get("height")||(this.set("width",n),this.set("height",r)),"svg"===this.get("renderer"))e=new br.Canvas({container:t,width:i,height:o});else{var a={container:t,width:i,height:o},s=this.get("pixelRatio");s&&(a.pixelRatio=s),e=new mr.Canvas(a)}this.set("canvas",e)},e.prototype.initPlugins=function(){var t=this;Object(p.each)(t.get("plugins"),(function(e){!e.destroyed&&e.initPlugin&&e.initPlugin(t)}))},e.prototype.downloadImageWatermark=function(t,e,n,r){return Object(d.__awaiter)(this,void 0,void 0,(function(){var i,o,a;return Object(d.__generator)(this,(function(s){switch(s.label){case 0:return i=t.style.backgroundImage,o=i.slice(5,i.length-2),(a=new Image).src=o,[4,new Promise((function(t){a.onload=function(){var i=e.createPattern(a,"repeat");e.rect(0,0,n,r),e.fillStyle=i,e.fill(),t("")}}))];case 1:return s.sent(),[2]}}))}))},e.prototype.asyncToDataUrl=function(t,e,n,r,i,o){var a=this,s=document.querySelector(".g6-graph-watermarker"),u=this.get("canvas"),c=u.getRenderer(),l=o||u.get("el"),f="";t||(t="image/png"),setTimeout((function(){return Object(d.__awaiter)(a,void 0,void 0,(function(){var o,a,u,h,p,g,v,y,m,b;return Object(d.__generator)(this,(function(d){switch(d.label){case 0:return"svg"!==c?[3,1]:(o=l.cloneNode(!0),a=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),(u=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",a)).replaceChild(o,u.documentElement),h=(new XMLSerializer).serializeToString(u),f="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(h)),[3,4]);case 1:return p=void 0,g=l.getContext("2d"),v=r||this.get("width"),y=i||this.get("height"),m=void 0,s?[4,this.downloadImageWatermark(s,g,v,y)]:[3,3];case 2:d.sent(),d.label=3;case 3:if(e){b="undefined"!=typeof window?window.devicePixelRatio:1;try{p=g.getImageData(0,0,v*b,y*b),m=g.globalCompositeOperation,g.globalCompositeOperation="destination-over",g.fillStyle=e,g.fillRect(0,0,v,y)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}f=l.toDataURL(t),e&&(g.clearRect(0,0,v,y),g.putImageData(p,0,0),g.globalCompositeOperation=m),d.label=4;case 4:return n&&n(f),[2]}}))}))}),16)},e.prototype.toDataURL=function(t,e){var n=this.get("canvas"),r=n.getRenderer(),i=n.get("el");t||(t="image/png");var o="";if("svg"===r){var a=i.cloneNode(!0),s=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),u=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",s);u.replaceChild(a,u.documentElement);var c=(new XMLSerializer).serializeToString(u);o="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(c))}else{var l=void 0,f=i.getContext("2d"),h=this.get("width"),d=this.get("height"),p=void 0;if(e){var g="undefined"!=typeof window?window.devicePixelRatio:1;try{l=f.getImageData(0,0,h*g,d*g),p=f.globalCompositeOperation,f.globalCompositeOperation="destination-over",f.fillStyle=e,f.fillRect(0,0,h,d)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}o=i.toDataURL(t),e&&(f.clearRect(0,0,h,d),f.putImageData(l,0,0),f.globalCompositeOperation=p)}return o},e.prototype.toFullDataURL=function(t,e,n){var r=this.get("group").getCanvasBBox(),i=r.height,o=r.width,a=this.get("renderer"),s=Ur('<div id="virtual-image"></div>'),u=n?n.backgroundColor:void 0,c=n?n.padding:void 0;c?Object(p.isNumber)(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var l=i+c[0]+c[2],f=o+c[1]+c[3],h={container:s,height:l,width:f,quickHit:!0},d="svg"===a?new br.Canvas(h):new mr.Canvas(h),g=this.get("group").clone(),v=Object(p.clone)(g.getMatrix());v||(v=[1,0,0,0,1,0,0,0,1]);var y=(r.maxX+r.minX)/2,m=(r.maxY+r.minY)/2;v=ki(v,[["t",-y,-m],["t",o/2+c[3],i/2+c[0]]]),g.resetMatrix(),g.setMatrix(v),d.add(g);var b=d.get("el"),x="";e||(e="image/png"),setTimeout((function(){if("svg"===a){var n=b.cloneNode(!0),r=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",r);i.replaceChild(n,i.documentElement);var o=(new XMLSerializer).serializeToString(i);x="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(o))}else{var s=void 0,c=b.getContext("2d"),h=void 0;if(u){var d="undefined"!=typeof window?window.devicePixelRatio:1;try{s=c.getImageData(0,0,f*d,l*d),h=c.globalCompositeOperation,c.globalCompositeOperation="destination-over",c.fillStyle=u,c.fillRect(0,0,f,l)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}x=b.toDataURL(e),u&&(c.clearRect(0,0,f,l),c.putImageData(s,0,0),c.globalCompositeOperation=h)}t&&t(x)}),16)},e.prototype.downloadFullImage=function(t,e,n){var r=this,i=this.get("group").getCanvasBBox(),o=i.height,a=i.width,s=this.get("renderer"),u=Ur('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),l=n?n.backgroundColor:void 0,f=n?n.padding:void 0;f?Object(p.isNumber)(f)&&(f=[f,f,f,f]):f=[0,0,0,0];var h=o+f[0]+f[2],d=a+f[1]+f[3];if(c){var g=this.get("graphWaterMarker").cfg||{},v=g.width,y=g.height;h=Math.ceil(h/y)*y,d=Math.ceil(d/v)*v}var m={container:u,height:h,width:d},b="svg"===s?new br.Canvas(m):new mr.Canvas(m),x=this.get("group").clone(),_=Object(p.clone)(x.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var w=(i.maxX+i.minX)/2,E=(i.maxY+i.minY)/2;_=ki(_,[["t",-w,-E],["t",a/2+f[3],o/2+f[0]]]),x.resetMatrix(),x.setMatrix(_),b.add(x);var S=b.get("el");e||(e="image/png"),this.asyncToDataUrl(e,l,(function(n){var i=document.createElement("a"),o=(t||"graph")+("svg"===s?".svg":".".concat(e.split("/")[1]));r.dataURLToImage(n,s,i,o);var a=document.createEvent("MouseEvents");a.initEvent("click",!1,!1),i.dispatchEvent(a)}),d,h,S)},e.prototype.downloadImage=function(t,e,n){var r=this;this.isAnimating()&&this.stopAnimate();var i=this.get("canvas").getRenderer();e||(e="image/png");var o=(t||"graph")+("svg"===i?".svg":e.split("/")[1]),a=document.createElement("a");this.asyncToDataUrl(e,n,(function(t){r.dataURLToImage(t,i,a,o);var e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),a.dispatchEvent(e)}))},e.prototype.dataURLToImage=function(t,e,n,r){if(t&&"data:"!==t){if("undefined"!=typeof window)if(window.Blob&&window.URL&&"svg"!==e){var i=t.split(","),o="";if(i&&i.length>0){var a=i[0].match(/:(.*?);/);a&&a.length>=2&&(o=a[1])}for(var s=atob(i[1]),u=s.length,c=new Uint8Array(u);u--;)c[u]=s.charCodeAt(u);var l=new Blob([c],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(l,r):n.addEventListener("click",(function(){n.download=r,n.href=window.URL.createObjectURL(l)}))}else n.addEventListener("click",(function(){n.download=r,n.href=t}))}else console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items")},e.prototype.addPlugin=function(t){t.destroyed||(this.get("plugins").push(t),t.initPlugin(this))},e.prototype.removePlugin=function(t){var e=this.get("plugins"),n=e.indexOf(t);n>=0&&(t.destroyPlugin(),e.splice(n,1))},e.prototype.setImageWaterMarker=function(t,e){void 0===t&&(t=Gr.waterMarkerImage);var n=this.get("container");Object(p.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(p.deepMix)({},Gr.imageWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.image;if(!r){var c={container:n,width:o,height:a,capture:!1},l=this.get("pixelRatio");l&&(c.pixelRatio=l),r=new mr.Canvas(c),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var f=r.get("context"),h=u.rotate,d=u.x,g=u.y;f.rotate(-h*Math.PI/180);var v=new Image;v.crossOrigin="anonymous",v.src=t,v.onload=function(){if(f.drawImage(v,d,g,u.width,u.height),f.rotate(h*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var t=document.querySelector(".g6-graph-watermarker");t||((t=document.createElement("div")).className="g6-graph-watermarker"),t.className="g6-graph-watermarker",r.destroyed||(t.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),n.appendChild(t))}}},e.prototype.setTextWaterMarker=function(t,e){var n=this.get("container");Object(p.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(p.deepMix)({},Gr.textWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.text;if(!r){var c={container:n,width:o,height:a,capture:!1},l=this.get("pixelRatio");l&&(c.pixelRatio=l),r=new mr.Canvas(c),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var f=r.get("context"),h=u.rotate,d=u.fill,g=u.fontFamily,v=u.fontSize,y=u.baseline,m=u.x,b=u.y,x=u.lineHeight;f.rotate(-h*Math.PI/180),f.font="".concat(v,"px ").concat(g),f.fillStyle=d,f.textBaseline=y;for(var _=t.length-1;_>=0;_--)f.fillText(t[_],m,b+_*x);if(f.rotate(h*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var w=document.querySelector(".g6-graph-watermarker");w||((w=document.createElement("div")).className="g6-graph-watermarker"),w.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),n.appendChild(w)}},e.prototype.destroy=function(){var e,n,r,i;Object(p.each)(this.get("plugins"),(function(t){t.destroyPlugin()}));var o=this.get("tooltips");if(o)for(var a=0;a<o.length;a++){var s=o[a];if(s){var u=s.parentElement;u&&u.removeChild(s)}}null===(e=this.get("eventController"))||void 0===e||e.destroy(),null===(n=this.get("layoutController"))||void 0===n||n.destroy(),null===(r=this.get("graphWaterMarker"))||void 0===r||r.destroy(),null===(i=document.querySelector(".g6-graph-watermarker"))||void 0===i||i.remove(),t.prototype.destroy.call(this)},e}(Wn),Ci=oi.radialLayout,Ti=oi.traverseTree,Ii=function(t){function e(e){var n=t.call(this,e)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return Object(d.__extends)(e,t),e.prototype.getLayout=function(){var t=this.get("layout");return t?"function"==typeof t?t:(t.type||(t.type="dendrogram"),t.direction||(t.direction="TB"),t.radial?function(e){var n=Kr.a[t.type](e,t);return Ci(n),n}:function(e){return Kr.a[t.type](e,t)}):null},e.indexOfChild=function(t,e){var n=-1;return Object(p.each)(t,(function(t,r){if(e===t.id)return n=r,!1})),n},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.animate=!0,e},e.prototype.innerAddChild=function(t,e,n){var r=this,i=t.data;i&&(i.x=t.x,i.y=t.y,i.depth=t.depth);var o=r.addItem("node",i,!1);if(e){if(o.set("parent",e),n){var a=e.get("originAttrs");if(a)o.set("originAttrs",a);else{var s=e.getModel();o.set("originAttrs",{x:s.x,y:s.y})}}var u=e.get("children");u?u.push(o):e.set("children",[o]),r.addItem("edge",{source:e.get("id"),target:o.get("id"),id:"".concat(e.get("id"),":").concat(o.get("id"))},!1)}return Object(p.each)(t.children||[],(function(t){r.innerAddChild(t,o,n)})),r.emit("afteraddchild",{item:o,parent:e}),o},e.prototype.innerUpdateChild=function(t,n,r){var i=this,o=i.findById(t.id);if(o){Object(p.each)(t.children||[],(function(t){i.innerUpdateChild(t,o,r)}));var a,s,u=o.get("children");if(u)if(u.length>0)for(var c=u.length-1;c>=0;c--){var l=u[c].getModel();-1===e.indexOfChild(t.children||[],l.id)&&(i.innerRemoveChild(l.id,{x:t.x,y:t.y},r),u.splice(c,1))}o.get("originAttrs")&&(a=o.get("originAttrs").x,s=o.get("originAttrs").y);var f=o.getModel();r&&o.set("originAttrs",{x:f.x,y:f.y}),o.set("model",t.data),a===t.x&&s===t.y||o.updatePosition({x:t.x,y:t.y})}else i.innerAddChild(t,n,r)},e.prototype.innerRemoveChild=function(t,e,n){var r=this,i=r.findById(t);if(i)if(Object(p.each)(i.get("children"),(function(t){r.innerRemoveChild(t.getModel().id,e,n)})),n){var o=i.getModel();i.set("to",e),i.set("originAttrs",{x:o.x,y:o.y}),r.get("removeList").push(i)}else r.removeItem(i,!1)},e.prototype.changeData=function(t){var e=this;this.getNodes().map((function(t){return e.clearItemStates(t)})),this.getEdges().map((function(t){return e.clearItemStates(t)})),t?(e.data(t),e.render()):e.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");this.updateLayout(t)},e.prototype.updateLayout=function(t){t?(this.set("layout",t),this.set("layoutMethod",this.getLayout()),this.layout()):console.warn("layout cannot be null")},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");this.layout(t)},e.prototype.layout=function(t){var e=this.get("data"),n=this.get("layoutMethod"),r=n?n(e,this.get("layout")):e,i=this.get("animate");(this.emit("beforerefreshlayout",{data:e,layoutData:r}),this.emit("beforelayout"),this.innerUpdateChild(r,void 0,i),t)&&this.get("viewController").fitView();i?this.layoutAnimate(r):(this.refresh(),this.paint()),this.emit("afterrefreshlayout",{data:e,layoutData:r}),this.emit("afterlayout")},e.prototype.addChild=function(t,e){this.emit("beforeaddchild",{model:t,parent:e}),Object(p.isString)(e)||(e=e.get("id"));var n=this.findDataById(e);n&&(n.children||(n.children=[]),n.children.push(t),this.changeData())},e.prototype.updateChildren=function(t,e){e&&this.findById(e)?(this.findDataById(e).children=t,this.changeData()):console.warn("Update children failed! There is no node with id '".concat(e,"'"))},e.prototype.updateChild=function(t,n){if(n&&this.findById(n)){var r=this.findDataById(n),i=this.findById(t.id);if(r.children||(r.children=[]),i){var o=e.indexOfChild(r.children,t.id);r.children[o]=t}else r.children.push(t);this.changeData()}else this.changeData(t)},e.prototype.removeChild=function(t){var n=this.findById(t);if(n){var r=n.get("parent");if(r&&!r.destroyed){var i=this.findDataById(r.get("id")),o=i&&i.children||[],a=n.getModel(),s=e.indexOfChild(o,a.id);o.splice(s,1)}this.changeData()}},e.prototype.findDataById=function(t,e){var n=this;if(e||(e=n.get("data")),t===e.id)return e;var r=null;return Object(p.each)(e.children||[],(function(e){return e.id===t?(r=e,!1):!(r=n.findDataById(t,e))&&void 0})),r},e.prototype.layoutAnimate=function(t,e){var n=this,r=this.get("animateCfg");n.emit("beforeanimate",{data:t}),n.getEdges().forEach((function(t){var e=t.get("model");e.sourceAnchor||(e.sourceAnchor=t.get("sourceAnchorIndex"))})),this.get("canvas").animate((function(r){Ti(t,(function(i){var o=n.findById(i.id);if(o){var a=o.get("originAttrs"),s=o.get("model");if(a||(a={x:s.x,y:s.y},o.set("originAttrs",a)),e){var u=e(o,r,a,t);o.set("model",Object.assign(s,u))}else s.x=a.x+(i.x-a.x)*r,s.y=a.y+(i.y-a.y)*r}return!0})),Object(p.each)(n.get("removeList"),(function(t){var e=t.getModel(),n=t.get("originAttrs"),i=t.get("to");e.x=n.x+(i.x-n.x)*r,e.y=n.y+(i.y-n.y)*r})),n.refreshPositions()}),{duration:r.duration,easing:r.ease,callback:function(){Object(p.each)(n.getNodes(),(function(t){t.set("originAttrs",null)})),Object(p.each)(n.get("removeList"),(function(t){n.removeItem(t)})),n.set("removeList",[]),r.callback&&r.callback(),n.emit("afteranimate",{data:t})},delay:r.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(){var t=this.get("data");if(!t||!Object(p.isObject)(t)||!Object.keys(t).length)throw new Error("data must be defined first");this.clear(),this.emit("beforerender"),this.layout(this.get("fitView")),this.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e}(Ai),ji=function(){function t(t){this._cfgs=Object(p.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return t.prototype.getDefaultCfgs=function(){return{}},t.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var n=e.getEvents(),r={};Object(p.each)(n,(function(n,i){var o=Object(p.wrapBehavior)(e,n);r[i]=o,t.on(i,o)})),this._events=r,this.init()},t.prototype.getEvents=function(){return{}},t.prototype.get=function(t){var e;return null===(e=this._cfgs)||void 0===e?void 0:e[t]},t.prototype.set=function(t,e){this._cfgs[t]=e},t.prototype.destroy=function(){},t.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;Object(p.each)(e,(function(e,n){t.off(n,e)})),this._events=null,this._cfgs=null,this.destroyed=!0},t}(),Pi=(Mi=function(t,e){return(Mi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Mi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),Ni="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Di=function(t){function e(e){return t.call(this,e)||this}return Pi(e,t),e.prototype.getDefaultCfgs=function(){return{img:Ni,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),e=t.get("container"),n=t.get("canvas").get("el"),r=this.get("img")||Ni,i=Ur("<div class='g6-grid-container' style=\"position:absolute;overflow:hidden;z-index: -1;\"></div>"),o=Ur("<div\n class='g6-grid'\n style='position:absolute;\n background-image: ".concat(r,";\n user-select: none\n '></div>"));this.set("container",i),this.set("gridContainer",o),this.positionInit(),i.appendChild(o),e.insertBefore(i,n)},e.prototype.positionInit=function(){var t=this.get("graph"),e=t.get("minZoom"),n=t.get("width"),r=t.get("height");Vr(this.get("container"),{width:"".concat(n,"px"),height:"".concat(r,"px")});var i=80*n/e,o=80*r/e;Vr(this.get("gridContainer"),{width:"".concat(i,"px"),height:"".concat(o,"px"),left:"-".concat(i/2,"px"),top:"-".concat(o/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var e=this.get("gridContainer"),n=t.matrix;n||(n=[1,0,0,0,1,0,0,0,1]);var r=this.get("follow");Vr(e,{transform:"matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(r?n[6]:"0",", ").concat(r?n[7]:"0",")")})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(ji),Li=n(72),Ri=n.n(Li),Bi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-contextmenu {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .g6-contextmenu-ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n");var Fi=function(t){function e(e){return t.call(this,e)||this}return Bi(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(t){return"\n <ul class='g6-contextmenu-ul'>\n <li>菜单项1</li>\n <li>菜单项2</li>\n </ul>\n "},shouldBegin:function(t){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),e=Ur("<div class=".concat(t||"g6-component-contextmenu","></div>"));Vr(e,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),Object(p.isString)(n)&&(n=document.getElementById(n)),n.appendChild(e),this.set("menu",e)},e.prototype.onMenuShow=function(t){var e=this;t.preventDefault();var n=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&-1===n.indexOf(t.item.getType()))return void e.onMenuHide()}else if(-1===n.indexOf("canvas"))return void e.onMenuHide();if(this.get("shouldBegin")(t)){var r=this.get("menu"),i=this.get("getContent"),o=this.get("graph"),a=i(t,o);Object(p.isString)(a)?r.innerHTML=a:r.innerHTML=a.outerHTML,this.removeMenuEventListener();var s=this.get("handleMenuClick");if(s){var u=function(e){s(e.target,t.item,o)};this.set("handleMenuClickWrapper",u),r.addEventListener("click",u)}var c=o.get("width"),l=o.get("height"),f=r.getBoundingClientRect(),h=this.get("offsetX")||0,d=this.get("offsetY")||0,g=o.getContainer().offsetTop,v=o.getContainer().offsetLeft,y=t.canvasX+v+h,m=t.canvasY+g+d;y+f.width>c&&(y=t.canvasX-f.width-h+v),m+f.height>l&&(m=t.canvasY-f.height-d+g),Vr(r,{top:"".concat(m,"px"),left:"".concat(y,"px"),visibility:"visible"});var b="click"===this.get("trigger"),x=function(t){b?b=!1:e.onMenuHide()};document.body.addEventListener("click",x),this.set("handler",x)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),e=this.get("handler");t&&(this.get("menu").removeEventListener("click",t),this.set("handleMenuClickWrapper",null));e&&document.body.removeEventListener("click",e)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&Vr(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ji),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),zi=function(){return(zi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Ui=Math.max,Vi=b.a.transform,Wi=function(t){function e(e){var n=t.call(this,e)||this;return n.handleUpdateCanvas=Object(p.debounce)((function(t){var e=n;e.destroyed||e.updateCanvas()}),100,!1),n}return Gi(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,n=e.size,r=e.graph;if(!this.destroyed){var i=this.get("canvas").get("container"),o=Ur("\n <div\n class=".concat(e.viewportClassName,"\n style='position:absolute;\n left:0;\n top:0;\n box-sizing:border-box;\n outline: 2px solid #1980ff'\n draggable=true>\n </div>")),a=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,s=0,u=0,c=!1,l=0,f=0,h=0,d=0,g=0,v=0;o.addEventListener("dragstart",(function(i){var a,p;if(i.dataTransfer){var y=new Image;y.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null===(p=(a=i.dataTransfer).setDragImage)||void 0===p||p.call(a,y,0,0);try{i.dataTransfer.setData("text/html","view-port-minimap")}catch(t){i.dataTransfer.setData("text","view-port-minimap")}}if(e.refresh=!1,i.target===o){var m=o.style;l=parseInt(m.left,10),f=parseInt(m.top,10),h=parseInt(m.width,10),d=parseInt(m.height,10),h>n[0]||d>n[1]||(v=r.getZoom(),g=t.get("ratio"),c=!0,s=i.clientX,u=i.clientY)}}),!1),o.addEventListener(a?"dragover":"drag",(function(t){if(c&&!Object(p.isNil)(t.clientX)&&!Object(p.isNil)(t.clientY)){var e=s-t.clientX,i=u-t.clientY;(l-e<0||l-e+h>=n[0])&&(e=0),(f-i<0||f-i+d>=n[1])&&(i=0),f-=i,Vr(o,{left:"".concat(l-=e,"px"),top:"".concat(f,"px")}),r.translate(e*v/g,i*v/g),s=t.clientX,u=t.clientY}}),!1),o.addEventListener("dragend",(function(){c=!1,e.refresh=!0}),!1),this.set("viewport",o),i.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=(this.get("dx"),this.get("dy"),this.get("totaldx")),n=this.get("totaldy"),r=this.get("graph"),i=this.get("size"),o=r.get("width"),a=r.get("height"),s=r.getPointByCanvas(0,0),u=r.getPointByCanvas(o,a),c=this.get("viewport");c||this.initViewport();var l=(u.x-s.x)*t,f=(u.y-s.y)*t,h=s.x*t+e,d=s.y*t+n,p=h+l,g=d+f;h<0&&(l+=h,h=0),p>i[0]&&(l-=p-i[0]),d<0&&(f+=d,d=0),g>i[1]&&(f-=g-i[1]),this.set("ratio",t),Vr(c,{left:"".concat(h,"px"),top:"".concat(d,"px"),width:"".concat(l,"px"),height:"".concat(f,"px")})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,e=this.get("canvas"),n=t.get("group");if(!n.destroyed){var r=n.clone();r.resetMatrix(),e.clear(),e.add(r),"svg"===t.get("renderer")&&this.updateVisible(r)}},e.prototype.updateVisible=function(t){var e=this;if(t.isGroup()||t.get("visible")){var n=t.get("children");if(!n||!n.length)return;n.forEach((function(t){t.get("visible")||t.hide(),e.updateVisible(t)}))}else t.hide()},e.prototype.updateKeyShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();Object(p.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(p.each)(e.getNodes(),(function(e){t.updateOneNodeKeyShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(p.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,e){if(!this.destroyed){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?s=Object.assign(a,s):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)}},e.prototype.updateOneNodeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?s=Object.assign(a,s):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateDelegateShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();Object(p.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(p.each)(e.getNodes(),(function(e){t.updateOneNodeDelegateShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(p.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},e=Object.keys(t);if(e&&0!==e.length)for(var n=e.length-1;n>=0;n--){var r=t[e[n]],i=r.exist;r.exist=!1,i||(r.remove(),delete t[e[n]])}},e.prototype.updateOneEdgeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")];if(r){var i=t.get("keyShape").attr("path");r.attr("path",i)}else r=t.get("keyShape").clone(),e.add(r);t.isVisible()?r.show():r.hide(),r.exist=!0,n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateOneNodeDelegateShape=function(t,e){var n=this.get("delegateStyle"),r=this.get("itemMap")||{},i=r[t.get("id")],o=t.getBBox();if(i){var a={x:o.minX,y:o.minY,width:o.width,height:o.height};i.attr(a)}else i=e.addShape("rect",{attrs:zi({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});t.isVisible()?i.show():i.hide(),i.exist=!0,r[t.get("id")]=i,this.set("itemMap",r)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this.get("graph"),e=this.get("size"),n=this.get("className"),r=this.get("container"),i=Ur("<div class='".concat(n,"' style='width: ").concat(e[0],"px; height: ").concat(e[1],"px; overflow: hidden'></div>"));Object(p.isString)(r)&&(r=document.getElementById(r)),r?r.appendChild(i):t.get("container").appendChild(i),this.set("container",i);var o,a=Ur('<div class="g6-minimap-container" style="position: relative;"></div>');i.appendChild(a),a.addEventListener("dragenter",(function(t){t.preventDefault()})),a.addEventListener("dragover",(function(t){t.preventDefault()})),o="svg"===t.get("renderer")?new br.Canvas({container:a,width:e[0],height:e[1]}):new mr.Canvas({container:a,width:e[0],height:e[1]}),this.set("canvas",o),this.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed&&this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("size"),n=this.get("canvas"),r=this.get("type"),i=this.get("padding");if(!n.destroyed){switch(r){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var o=n.get("children")[0];if(o){o.resetMatrix();var a=o.getCanvasBBox(),s=t.get("canvas").getCanvasBBox(),u=t.getZoom()||1,c=s.width/u,l=s.height/u;Number.isFinite(a.width)&&(c=Ui(a.width,c),l=Ui(a.height,l)),c+=2*i,l+=2*i;var f=Math.min(e[0]/c,e[1]/l),h=[1,0,0,0,1,0,0,0,1],d=0,p=0;Number.isFinite(a.minX)&&(d=-a.minX),Number.isFinite(a.minY)&&(p=-a.minY);var g=(e[0]-(c-2*i)*f)/2,v=(e[1]-(l-2*i)*f)/2;h=Vi(h,[["t",d,p],["s",f,f],["t",g,v]]),o.setMatrix(h),this.set("ratio",f),this.set("totaldx",g+d*f),this.set("totaldy",v+p*f),this.set("dx",g),this.set("dy",v),this.updateViewport()}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("container");(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)},e}(ji),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Yi(t,e,n){var r=t.x-e.x,i=t.y-e.y;return!n||Math.abs(r)>n||Math.abs(i)>n?Math.sqrt(r*r+i*i):n}function Hi(t,e){var n=(e.source.y-e.target.y)/(e.source.x-e.target.x),r=(n*n*e.source.x+n*(t.y-e.source.y)+t.x)/(n*n+1);return{x:r,y:n*(r-e.source.x)+e.source.y}}var qi=function(t){function e(e){return t.call(this,e)||this}return Xi(e,t),e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),e=this.get("onTick");this.set("tick",(function(){e&&e(),t.refreshPositions()}))},e.prototype.bundling=function(t){var e=this;if(e.set("data",t),!e.isTicking()){var n=t.edges||[],r=t.nodes||[],i={},o=!1;if(r.forEach((function(t){null!==t.x&&null!==!t.y&&void 0!==t.x&&void 0!==!t.y||(o=!0),i[t.id]=t})),o)throw new Error("please layout the graph or assign x and y for nodes first");e.set("nodeIdMap",i);var a=e.get("divisions"),s=e.get("divRate"),u=e.divideEdges(a);e.set("edgePoints",u);var c=e.getEdgeBundles();e.set("edgeBundles",c);for(var l=e.get("cycles"),f=e.get("iterations"),h=e.get("iterRate"),d=e.get("lambda"),p=0;p<l;p++){for(var g=function(t){var r=[];n.forEach((function(t,n){if(t.source!==t.target){var o=i[t.source],s=i[t.target];r[n]=e.getEdgeForces({source:o,target:s},n,a,d);for(var c=0;c<a+1;c++)u[n][c].x+=r[n][c].x,u[n][c].y+=r[n][c].y}}))},v=0;v<f;v++)g();d/=2,a*=s,f*=h,u=e.divideEdges(a),e.set("edgePoints",u)}n.forEach((function(t,e){t.source!==t.target&&(t.type="polyline",t.controlPoints=u[e].slice(1,u[e].length-1))})),e.get("graph").refresh()}},e.prototype.updateBundling=function(t){var e=this,n=t.data;if(n&&e.set("data",n),e.get("ticking")&&e.set("ticking",!1),Object.keys(t).forEach((function(n){e.set(n,t[n])})),t.onTick){var r=this.get("graph");e.set("tick",(function(){t.onTick(),r.refresh()}))}e.bundling(n)},e.prototype.divideEdges=function(t){var e=this,n=e.get("data").edges,r=e.get("nodeIdMap"),i=e.get("edgePoints");return i&&void 0!==i||(i=[]),n.forEach((function(n,o){i[o]&&void 0!==i[o]||(i[o]=[]);var a=r[n.source],s=r[n.target];if(1===t)i[o].push({x:a.x,y:a.y}),i[o].push({x:.5*(a.x+s.x),y:.5*(a.y+s.y)}),i[o].push({x:s.x,y:s.y});else{var u=(i[o]&&i[o]!==[]?e.getEdgeLength(i[o]):Yi({x:a.x,y:a.y},{x:s.x,y:s.y}))/(t+1),c=u,l=[{x:a.x,y:a.y}];i[o].forEach((function(t,e){if(0!==e){for(var n=Yi(t,i[o][e-1]);n>c;){var r=c/n,a={x:i[o][e-1].x,y:i[o][e-1].y};a.x+=r*(t.x-i[o][e-1].x),a.y+=r*(t.y-i[o][e-1].y),l.push(a),n-=c,c=u}c-=n}})),l.push({x:s.x,y:s.y}),i[o]=l}})),i},e.prototype.getEdgeLength=function(t){var e=0;return t.forEach((function(n,r){0!==r&&(e+=Yi(n,t[r-1]))})),e},e.prototype.getEdgeBundles=function(){var t=this,e=t.get("data").edges||[],n=t.get("bundleThreshold"),r=t.get("nodeIdMap"),i=t.get("edgeBundles");return i||(i=[]),e.forEach((function(t,e){i[e]&&void 0!==i[e]||(i[e]=[])})),e.forEach((function(o,a){var s=r[o.source],u=r[o.target];e.forEach((function(e,o){if(!(o<=a)){var c=r[e.source],l=r[e.target];t.getBundleScore({source:s,target:u},{source:c,target:l})>=n&&(i[a].push(o),i[o].push(a))}}))})),i},e.prototype.getBundleScore=function(t,e){return t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,t.length=Yi({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),e.length=Yi({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),this.getAngleScore(t,e)*this.getScaleScore(t,e)*this.getPositionScore(t,e)*this.getVisibilityScore(t,e)},e.prototype.getAngleScore=function(t,e){return function(t,e){return t.x*e.x+t.y*e.y}({x:t.vx,y:t.vy},{x:e.vx,y:e.vy})/(t.length*e.length)},e.prototype.getScaleScore=function(t,e){var n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},e.prototype.getPositionScore=function(t,e){var n=(t.length+e.length)/2;return n/(n+Yi({x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},{x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2}))},e.prototype.getVisibilityScore=function(t,e){var n=this.getEdgeVisibility(t,e),r=this.getEdgeVisibility(e,t);return n<r?n:r},e.prototype.getEdgeVisibility=function(t,e){var n=Hi(e.source,t),r=Hi(e.target,t),i={x:(n.x+r.x)/2,y:(n.y+r.y)/2},o={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2};return Math.max(0,1-2*Yi(i,o)/Yi(n,r))},e.prototype.getEdgeForces=function(t,e,n,r){for(var i=this.get("edgePoints"),o=this.get("K")/(Yi(t.source,t.target)*(n+1)),a=[{x:0,y:0}],s=1;s<n;s++){var u={x:0,y:0},c=this.getSpringForce({pre:i[e][s-1],cur:i[e][s],next:i[e][s+1]},o),l=this.getElectrostaticForce(s,e);u.x=r*(c.x+l.x),u.y=r*(c.y+l.y),a.push(u)}return a.push({x:0,y:0}),a},e.prototype.getSpringForce=function(t,e){var n=t.pre.x+t.next.x-2*t.cur.x,r=t.pre.y+t.next.y-2*t.cur.y;return{x:n*=e,y:r*=e}},e.prototype.getElectrostaticForce=function(t,e){var n=this.get("eps"),r=this.get("edgeBundles"),i=this.get("edgePoints"),o=r[e],a={x:0,y:0};return o.forEach((function(r){var o={x:i[r][t].x-i[e][t].x,y:i[r][t].y-i[e][t].y};if(Math.abs(o.x)>n||Math.abs(o.y)>n){var s=1/Yi(i[r][t],i[e][t]);a.x+=o.x*s,a.y+=o.y*s}})),a},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),t.prototype.destroy.call(this)},e}(ji),Ki=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi=function(){return(Zi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Qi={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},$i=function(t){function e(e){return t.call(this,e)||this}return Ki(e,t),e.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Object(p.clone)(Qi),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"magnify"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"magnify"}}return t},e.prototype.init=function(){var t=this.get("r");this.set("cachedMagnifiedModels",[]),this.set("cachedOriginPositions",{}),this.set("r2",t*t);var e=this.get("d");this.set("molecularParam",(e+1)*t)},e.prototype.createDelegate=function(t){var e=this,n=this,r=n.get("delegate");r&&!r.destroyed||(n.magnify(t),(r=n.get("delegate")).on("dragstart",(function(t){n.set("delegateCenterDiff",{x:r.attr("x")-t.x,y:r.attr("y")-t.y})})),r.on("drag",(function(t){n.magnify(t)})),"wheel"===this.get("scaleDBy")&&r.on("mousewheel",(function(t){e.scaleDByWheel(t)})),"wheel"===this.get("scaleRBy")&&r.on("mousewheel",(function(t){n.scaleRByWheel(t)})))},e.prototype.scaleRByWheel=function(t){if(t&&t.originalEvent){t.preventDefault&&t.preventDefault();var e,n=this.get("graph"),r=this.get("delegate"),i=(r?{x:r.attr("x"),y:r.attr("y")}:void 0)||n.getPointByClient(t.clientX,t.clientY);e=t.originalEvent.wheelDelta<0?.95:1/.95;var o=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(o||n.get("height"))&&e>1||s<(a||.05*n.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.set("delegateCenterDiff",void 0),this.magnify(t,i)}},e.prototype.scaleRByDrag=function(t){if(t){var e,n=this.get("dragPrePos"),r=this.get("graph"),i=r.getPointByClient(t.clientX,t.clientY);e=t.x-n.x<0?.95:1/.95;var o=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(o||r.get("height"))&&e>1||s<(a||.05*r.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.magnify(t,i),this.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){if(t||t.originalEvent){t.preventDefault&&t.preventDefault();var e=0;e=t.originalEvent.wheelDelta<0?-.1:.1;var n=this.get("d")+e,r=this.get("maxD"),i=this.get("minD");if(n<r&&n>i){this.set("d",n);var o=this.get("r");this.set("molecularParam",(n+1)*o);var a=this.get("delegate"),s=a?{x:a.attr("x"),y:a.attr("y")}:void 0;this.set("delegateCenterDiff",void 0),this.magnify(t,s)}}},e.prototype.scaleDByDrag=function(t){var e=this.get("dragPrePos"),n=t.x-e.x>0?.1:-.1,r=this.get("d")+n,i=this.get("maxD"),o=this.get("minD");if(r<i&&r>o){this.set("d",r);var a=this.get("r");this.set("molecularParam",(r+1)*a),this.magnify(t)}this.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,e){this.restoreCache();var n=this.get("graph"),r=this.get("cachedMagnifiedModels"),i=this.get("cachedOriginPositions"),o=this.get("showLabel"),a=this.get("r"),s=this.get("r2"),u=this.get("d"),c=this.get("molecularParam"),l=n.getNodes(),f=l.length,h=e?{x:e.x,y:e.y}:{x:t.x,y:t.y};!this.get("dragging")||"mousemove"!==this.get("trigger")&&"click"!==this.get("trigger")||(h=this.get("cacheCenter"));var d=this.get("delegateCenterDiff");d&&(h.x+=d.x,h.y+=d.y),this.updateDelegate(h,a);for(var p=0;p<f;p++){var g=l[p].getModel(),v=g.x,y=g.y;if(!isNaN(v)&&!isNaN(y)){var m=(v-h.x)*(v-h.x)+(y-h.y)*(y-h.y);if(!isNaN(m)&&m<s&&0!==m){var b=Math.sqrt(m),x=c*b/(u*b+a),_=(v-h.x)/b,w=(y-h.y)/b;if(g.x=_*x+h.x,g.y=w*x+h.y,i[g.id]||(i[g.id]={x:v,y:y,texts:[]}),r.push(g),o&&2*b<a)for(var E=l[p].getContainer().getChildren(),S=E.length,O=0;O<S;O++){var M=E[O];"text"===M.get("type")&&(i[g.id].texts.push({visible:M.get("visible"),shape:M}),M.set("visible",!0))}}}}n.refreshPositions()},e.prototype.restoreCache=function(){for(var t=this.get("cachedMagnifiedModels"),e=this.get("cachedOriginPositions"),n=t.length,r=0;r<n;r++){var i=t[r],o=e[i.id];i.x=o.x,i.y=o.y;for(var a=o.texts.length,s=0;s<a;s++){var u=o.texts[s];u.shape.set("visible",u.visible)}}this.set("cachedMagnifiedModels",[]),this.set("cachedOriginPositions",{})},e.prototype.updateParams=function(t){var e=t.r,n=t.d,r=t.trigger,i=t.minD,o=t.maxD,a=t.minR,s=t.maxR,u=t.scaleDBy,c=t.scaleRBy;isNaN(t.r)||(this.set("r",e),this.set("r2",e*e)),isNaN(n)||this.set("d",n),isNaN(o)||this.set("maxD",o),isNaN(i)||this.set("minD",i),isNaN(s)||this.set("maxR",s),isNaN(a)||this.set("minR",a);var l,f=this.get("d"),h=this.get("r");(this.set("molecularParam",(f+1)*h),"mousemove"!==r&&"click"!==r&&"drag"!==r||this.set("trigger",r),"drag"===u||"wheel"===u||"unset"===u)&&(this.set("scaleDBy",u),this.get("delegate").remove(),this.get("delegate").destroy(),(l=this.get("dPercentText"))&&(l.remove(),l.destroy()));"drag"!==c&&"wheel"!==c&&"unset"!==c||(this.set("scaleRBy",c),this.get("delegate").remove(),this.get("delegate").destroy(),(l=this.get("dPercentText"))&&(l.remove(),l.destroy()))},e.prototype.updateDelegate=function(t,e){var n=this,r=this,i=r.get("graph"),o=r.get("delegate");if(!o||o.destroyed){var a=i.get("group"),s=r.get("delegateStyle")||Qi;o=a.addShape("circle",{attrs:Zi({r:e/1.5,x:t.x,y:t.y},s),name:"lens-shape",draggable:!0}),"drag"!==this.get("trigger")&&("wheel"===this.get("scaleRBy")?o.on("mousewheel",(function(t){r.scaleRByWheel(t)})):"drag"===this.get("scaleRBy")&&(o.on("dragstart",(function(t){r.set("dragging",!0),r.set("cacheCenter",{x:t.x,y:t.y}),r.set("dragPrePos",{x:t.x,y:t.y})})),o.on("drag",(function(t){r.scaleRByDrag(t)})),o.on("dragend",(function(t){r.set("dragging",!1)}))),"wheel"===this.get("scaleDBy")?o.on("mousewheel",(function(t){n.scaleDByWheel(t)})):"drag"===this.get("scaleDBy")&&(o.on("dragstart",(function(t){r.set("dragging",!0),r.set("cacheCenter",{x:t.x,y:t.y}),r.set("dragPrePos",{x:t.x,y:t.y})})),o.on("drag",(function(t){n.scaleDByDrag(t)})),o.on("dragend",(function(t){r.set("dragging",!1)}))))}else o.attr({x:t.x,y:t.y,r:e/1.5});if(r.get("showDPercent")){var u=Math.round((r.get("d")-r.get("minD"))/(r.get("maxD")-r.get("minD"))*100),c=r.get("dPercentText"),l=t.y+e/1.5+16;if(!c||c.destroyed)c=i.get("group").addShape("text",{attrs:{text:"".concat(u,"%"),x:t.x,y:l,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),r.set("dPercentText",c);else c.attr({text:"".concat(u,"%"),x:t.x,y:l})}r.set("delegate",o)},e.prototype.clear=function(){var t=this.get("graph");this.restoreCache(),t.refreshPositions();var e=this.get("delegate");e&&!e.destroyed&&(e.remove(),e.destroy());var n=this.get("dPercentText");n&&!n.destroyed&&(n.remove(),n.destroy())},e.prototype.destroy=function(){this.clear()},e}(ji),Ji=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-toolbar {\n position: absolute;\n list-style-type: none;\n padding: 6px;\n left: 0px;\n top: 0px;\n background-color: rgba(255, 255, 255, 0.9);\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n margin: 0;\n }\n .g6-component-toolbar li {\n float: left;\n text-align: center;\n width: 35px;\n height: 24px;\n cursor: pointer;\n\t\tlist-style-type:none;\n list-style: none;\n margin-left: 0px;\n }\n .g6-component-toolbar li .icon {\n opacity: 0.7;\n }\n .g6-component-toolbar li .icon:hover {\n opacity: 1;\n }\n");var to=function(t){function e(e){return t.call(this,e)||this}return Ji(e,t),e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(t){return'\n <ul class=\'g6-component-toolbar\'>\n <li code=\'redo\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>\n </svg>\n </li>\n <li code=\'undo\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>\n </svg>\n </li>\n <li code=\'zoomOut\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>\n </svg>\n </li>\n <li code=\'zoomIn\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>\n </svg>\n </li>\n <li code=\'realZoom\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">\n <path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>\n </svg>\n </li>\n <li code=\'autoZoom\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">\n <path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>\n </svg>\n </li>\n </ul>\n '},zoomSensitivity:2}},e.prototype.init=function(){var t=this,e=this.get("graph"),n=this.get("getContent")(e),r=n;Object(p.isString)(n)&&(r=Ur(n));var i=this.get("className");r.setAttribute("class",i||"g6-component-toolbar");var o=this.get("container");o||(o=this.get("graph").get("container")),Object(p.isString)(o)&&(o=document.getElementById(o)),o.appendChild(r),this.set("toolBar",r);var a=this.get("handleClick");r.addEventListener("click",(function(n){var r=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;){if(e.push(n),"HTML"===n.tagName)return e.push(document,window),e;n=n.parentElement}return e}(n).filter((function(t){return"LI"===t.nodeName}));if(0!==r.length){var i=r[0].getAttribute("code");i&&(a?a(i,e):t.handleDefaultOperator(i,e))}}));var s=this.get("position");s&&Vr(r,{top:"".concat(s.y,"px"),left:"".concat(s.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),e=document.querySelector('.g6-component-toolbar li[code="undo"]'),n=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),r=document.querySelector('.g6-component-toolbar li[code="redo"]'),i=document.querySelector('.g6-component-toolbar li[code="redo"] svg');e&&n&&r&&i&&t.on("stackchange",(function(t){var o=t.undoStack,a=t.redoStack,s=o.length,u=a.length;1===s?(e.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(e.removeAttribute("style"),n.removeAttribute("style")),0===u?(r.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),i.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),e=t.getUndoStack();if(e&&1!==e.length){var n=e.pop();if(n){var r=n.action;t.pushStack(r,Object(p.clone)(n.data),"redo");var i=n.data.before;if("add"===r&&(i=n.data.after),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateItem(e.id,e,!1)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.removeItem(e.id,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}))}}}},e.prototype.redo=function(){var t=this.get("graph"),e=t.getRedoStack();if(e&&0!==e.length){var n=e.pop();if(n){var r=n.action,i=n.data.after;if(t.pushStack(r,Object(p.clone)(n.data)),"delete"===r&&(i=n.data.before),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateItem(e.id,e,!1)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":i.edges&&i.edges.forEach((function(e){t.removeItem(e.id,!1)})),i.nodes&&i.nodes.forEach((function(e){t.removeItem(e.id,!1)})),i.combos&&i.combos.forEach((function(e){t.removeItem(e.id,!1)}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}))}}}},e.prototype.handleDefaultOperator=function(t,e){var n=e.getZoom();switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":var r=1/(1-.05*this.get("zoomSensitivity"));if(r*n>(this.get("maxZoom")||e.get("maxZoom")))return;e.zoomTo(n*r);break;case"zoomIn":var i=1-.05*this.get("zoomSensitivity");if(i*n<(this.get("minZoom")||e.get("minZoom")))return;e.zoomTo(n*i);break;case"realZoom":e.zoomTo(1);break;case"autoZoom":e.fitView([20,20])}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}var n=this.get("handleClick");n&&t.removeEventListener("click",n)},e}(ji),eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-tooltip {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .tooltip-type {\n padding: 0;\n margin: 0;\n }\n .tooltip-id {\n color: #531dab;\n }\n");var no=function(t){function e(e){return t.call(this,e)||this}return eo(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(t){return"\n <h4 class='tooltip-type'>类型:".concat(t.item.getType(),"</h4>\n <span class='tooltip-id'>ID:").concat(t.item.getID(),"</span>\n ")},shouldBegin:function(t){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,e=t.get("className")||"g6-component-tooltip",n=Ur("<div class=".concat(e,"></div>")),r=t.get("container");r||(r=t.get("graph").get("container")),Object(p.isString)(r)&&(r=document.getElementById(r)),Vr(n,{position:"absolute",visibility:"hidden",display:"none"}),r.appendChild(n),"click"!==t.get("trigger")&&(n.addEventListener("mouseenter",(function(t){Vr(n,{visibility:"visible",display:"unset"})})),n.addEventListener("mouseleave",(function(e){t.hideTooltip()}))),t.set("tooltip",n)},e.prototype.onClick=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),r.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var e=this.get("itemTypes");t.item&&t.item.getType&&-1===e.indexOf(t.item.getType())||this.currentTarget&&t.item===this.currentTarget&&this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip(),this.get("graph").emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var e=this.get("itemTypes");if(!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=this.get("tooltip"),r=this.get("getContent")(t);Object(p.isString)(r)?n.innerHTML=r:(this.clearContainer(),n.appendChild(r)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&Vr(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var e=this.get("shouldBegin"),n=this.get("tooltip");if(e(t)){var r=this.get("graph"),i=r.get("width"),o=r.get("height"),a=this.get("offsetX")||0,s=this.get("offsetY")||0,u=r.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),l=t.item;if(l.getType&&"node"===l.getType()&&c&&Object(p.isArray)(c)&&c.length>=2){var f=l.getBBox();u={x:f.minX+f.width*c[0],y:f.minY+f.height*c[1]}}var h=r.getCanvasByPoint(u.x,u.y),d=h.x,g=h.y,v=r.getContainer(),y={x:d+v.offsetLeft+a,y:g+v.offsetTop+s};Vr(n,{visibility:"visible",display:"unset"});var m=n.getBoundingClientRect();d+m.width+a>i&&(y.x-=m.width+a),g+m.height+s>o&&(y.y-=m.height+s),Vr(n,{left:"".concat(y.x,"px"),top:"".concat(y.y,"px")})}else Vr(n,{visibility:"hidden",display:"none"})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ji),ro={};function io(t,e){ro[t]=e}var oo=function(){function t(t){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=t,this.initCfg(),this.init()}return t.prototype.translate=function(t){return t},t.prototype.change=function(t){Object(p.assign)(this.__cfg__,t),this.init()},t.prototype.clone=function(){return this.constructor(this.__cfg__)},t.prototype.getTicks=function(){var t=this;return Object(p.map)(this.ticks,(function(e,n){return Object(p.isObject)(e)?e:{text:t.getText(e,n),tickValue:e,value:t.scale(e)}}))},t.prototype.getText=function(t,e){var n=this.formatter,r=n?n(t,e):t;return Object(p.isNil)(r)||!Object(p.isFunction)(r.toString)?"":r.toString()},t.prototype.getConfig=function(t){return this.__cfg__[t]},t.prototype.init=function(){Object(p.assign)(this,this.__cfg__),this.setDomain(),Object(p.isEmpty)(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},t.prototype.initCfg=function(){},t.prototype.setDomain=function(){},t.prototype.calculateTicks=function(){var t=this.tickMethod,e=[];if(Object(p.isString)(t)){var n=ro[t];if(!n)throw new Error("There is no method to to calculate ticks!");e=n(this)}else Object(p.isFunction)(t)&&(e=t(this));return e},t.prototype.rangeMin=function(){return this.range[0]},t.prototype.rangeMax=function(){return this.range[1]},t.prototype.calcPercent=function(t,e,n){return Object(p.isNumber)(t)?(t-e)/(n-e):NaN},t.prototype.calcValue=function(t,e,n){return e+t*(n-e)},t}(),ao=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cat",e.isCategory=!0,e}return Object(d.__extends)(e,t),e.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var t=0;t<this.values.length;t++)this.translateIndexMap.set(this.values[t],t)}},e.prototype.translate=function(t){this.buildIndexMap();var e=this.translateIndexMap.get(t);return void 0===e&&(e=Object(p.isNumber)(t)?t:NaN),e},e.prototype.scale=function(t){var e=this.translate(t),n=this.calcPercent(e,this.min,this.max);return this.calcValue(n,this.rangeMin(),this.rangeMax())},e.prototype.invert=function(t){var e=this.max-this.min,n=this.calcPercent(t,this.rangeMin(),this.rangeMax()),r=Math.round(e*n)+this.min;return r<this.min||r>this.max?NaN:this.values[r]},e.prototype.getText=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=e;return Object(p.isNumber)(e)&&!this.values.includes(e)&&(i=this.values[i]),t.prototype.getText.apply(this,Object(d.__spreadArray)([i],n,!1))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(Object(p.isNil)(this.getConfig("min"))&&(this.min=0),Object(p.isNil)(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(oo),so=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,uo="[^\\s]+",co=/\[([^]*?)\]/gm;function lo(t,e){for(var n=[],r=0,i=t.length;r<i;r++)n.push(t[r].substr(0,e));return n}var fo=function(t){return function(e,n){var r=n[t].map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase());return r>-1?r:null}};function ho(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,i=e;r<i.length;r++){var o=i[r];for(var a in o)t[a]=o[a]}return t}var po=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],go=["January","February","March","April","May","June","July","August","September","October","November","December"],vo=lo(go,3),yo={dayNamesShort:lo(po,3),dayNames:po,monthNamesShort:vo,monthNames:go,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10?1:0)*t%10]}},mo=ho({},yo),bo=function(t){return mo=ho(mo,t)},xo=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},_o=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t},wo={D:function(t){return String(t.getDate())},DD:function(t){return _o(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return _o(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return _o(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return _o(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return _o(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return _o(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return _o(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return _o(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return _o(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return _o(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return _o(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+_o(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+_o(Math.floor(Math.abs(e)/60),2)+":"+_o(Math.abs(e)%60,2)}},Eo=function(t){return+t-1},So=[null,"[1-9]\\d?"],Oo=[null,uo],Mo=["isPm",uo,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],ko=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],Ao={D:["day","[1-9]\\d?"],DD:["day","\\d\\d"],Do:["day","[1-9]\\d?"+uo,function(t){return parseInt(t,10)}],M:["month","[1-9]\\d?",Eo],MM:["month","\\d\\d",Eo],YY:["year","\\d\\d",function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour","[1-9]\\d?",void 0,"isPm"],hh:["hour","\\d\\d",void 0,"isPm"],H:["hour","[1-9]\\d?"],HH:["hour","\\d\\d"],m:["minute","[1-9]\\d?"],mm:["minute","\\d\\d"],s:["second","[1-9]\\d?"],ss:["second","\\d\\d"],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond","\\d\\d",function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:So,dd:So,ddd:Oo,dddd:Oo,MMM:["month",uo,fo("monthNamesShort")],MMMM:["month",uo,fo("monthNames")],a:Mo,A:Mo,ZZ:ko,Z:ko},Co={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},To=function(t){return ho(Co,t)},Io=function(t,e,n){if(void 0===e&&(e=Co.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var r=[];e=(e=Co[e]||e).replace(co,(function(t,e){return r.push(e),"@@@"}));var i=ho(ho({},mo),n);return(e=e.replace(so,(function(e){return wo[e](t,i)}))).replace(/@@@/g,(function(){return r.shift()}))};function jo(t,e,n){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=Co[e]||e,t.length>1e3)return null;var r={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},i=[],o=[],a=e.replace(co,(function(t,e){return o.push(xo(e)),"@@@"})),s={},u={};a=xo(a).replace(so,(function(t){var e=Ao[t],n=e[0],r=e[1],o=e[3];if(s[n])throw new Error("Invalid format. "+n+" specified twice in format");return s[n]=!0,o&&(u[o]=!0),i.push(e),"("+r+")"})),Object.keys(u).forEach((function(t){if(!s[t])throw new Error("Invalid format. "+t+" is required in specified format")})),a=a.replace(/@@@/g,(function(){return o.shift()}));var c=t.match(new RegExp(a,"i"));if(!c)return null;for(var l=ho(ho({},mo),n),f=1;f<c.length;f++){var h=i[f-1],d=h[0],p=h[2],g=p?p(c[f],l):+c[f];if(null==g)return null;r[d]=g}1===r.isPm&&null!=r.hour&&12!=+r.hour?r.hour=+r.hour+12:0===r.isPm&&12==+r.hour&&(r.hour=0);for(var v=new Date(r.year,r.month,r.day,r.hour,r.minute,r.second,r.millisecond),y=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],m=(f=0,y.length);f<m;f++)if(s[y[f][0]]&&r[y[f][0]]!==v[y[f][1]]())return null;return null==r.timezoneOffset?v:new Date(Date.UTC(r.year,r.month,r.day,r.hour,r.minute-r.timezoneOffset,r.second,r.millisecond))}var Po={format:Io,parse:jo,defaultI18n:yo,setGlobalDateI18n:bo,setGlobalDateMasks:To};function No(t,e){return(h.format||Po.format)(t,e)}function Do(t){return Object(p.isString)(t)&&(t=t.indexOf("T")>0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),Object(p.isDate)(t)&&(t=t.getTime()),t}var Lo=36e5,Ro=24*Lo,Bo=31*Ro,Fo=[["HH:mm:ss",1e3],["HH:mm:ss",1e4],["HH:mm:ss",3e4],["HH:mm",6e4],["HH:mm",6e5],["HH:mm",18e5],["HH",Lo],["HH",6*Lo],["HH",12*Lo],["YYYY-MM-DD",Ro],["YYYY-MM-DD",4*Ro],["YYYY-WW",7*Ro],["YYYY-MM",Bo],["YYYY-MM",4*Bo],["YYYY-MM",6*Bo],["YYYY",380*Ro]];function Go(t,e,n){var r,i=(r=function(t){return t[1]},function(t,e,n,i){for(var o=Object(p.isNil)(n)?0:n,a=Object(p.isNil)(i)?t.length:i;o<a;){var s=o+a>>>1;r(t[s])>e?a=s:o=s+1}return o})(Fo,(e-t)/n)-1,o=Fo[i];return i<0?o=Fo[0]:i>=Fo.length&&(o=Object(p.last)(Fo)),o}var zo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeCat",e}return Object(d.__extends)(e,t),e.prototype.translate=function(t){t=Do(t);var e=this.values.indexOf(t);return-1===e&&(e=Object(p.isNumber)(t)&&t<this.values.length?t:NaN),e},e.prototype.getText=function(t,e){var n=this.translate(t);if(n>-1){var r=this.values[n],i=this.formatter;return r=i?i(r,e):No(r,this.mask)}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var e=this.values;Object(p.each)(e,(function(t,n){e[n]=Do(t)})),e.sort((function(t,e){return t-e})),t.prototype.setDomain.call(this)},e}(ao),Uo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isContinuous=!0,e}return Object(d.__extends)(e,t),e.prototype.scale=function(t){if(Object(p.isNil)(t))return NaN;var e=this.rangeMin(),n=this.rangeMax();return this.max===this.min?e:e+this.getScalePercent(t)*(n-e)},e.prototype.init=function(){t.prototype.init.call(this);var e=this.ticks,n=Object(p.head)(e),r=Object(p.last)(e);n<this.min&&(this.min=n),r>this.max&&(this.max=r),Object(p.isNil)(this.minLimit)||(this.min=n),Object(p.isNil)(this.maxLimit)||(this.max=r)},e.prototype.setDomain=function(){var t=Object(p.getRange)(this.values),e=t.min,n=t.max;Object(p.isNil)(this.min)&&(this.min=e),Object(p.isNil)(this.max)&&(this.max=n),this.min>this.max&&(this.min=e,this.max=n)},e.prototype.calculateTicks=function(){var e=this,n=t.prototype.calculateTicks.call(this);return this.nice||(n=Object(p.filter)(n,(function(t){return t>=e.min&&t<=e.max}))),n},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;return(t-n)/(e-n)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(oo),Vo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t);return this.min+e*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(Uo);function Wo(t,e){var n=Math.E;return e>=0?Math.pow(n,Math.log(e)/t):-1*Math.pow(n,Math.log(-e)/t)}function Xo(t,e){return 1===t?1:Math.log(e)/Math.log(t)}function Yo(t,e,n){Object(p.isNil)(n)&&(n=Math.max.apply(null,t));var r=n;return Object(p.each)(t,(function(t){t>0&&t<r&&(r=t)})),r===n&&(r=n/e),r>1&&(r=1),r}var Ho=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e,n=this.base,r=Xo(n,this.max),i=this.rangeMin(),o=this.rangeMax()-i,a=this.positiveMin;if(a){if(0===t)return 0;var s=1/(r-(e=Xo(n,a/n)))*o;if(t<s)return t/s*a}else e=Xo(n,this.min);var u=(t-i)/o*(r-e)+e;return Math.pow(n,u)},e.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},e.prototype.setDomain=function(){t.prototype.setDomain.call(this);var e=this.min;if(e<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");0===e&&(this.positiveMin=Yo(this.values,this.base,this.max))},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;if(e===n)return 0;if(t<=0)return 0;var r=this.base,i=this.positiveMin;return i&&(n=1*i/r),t<i?t/i/(Xo(r,e)-Xo(r,n)):(Xo(r,t)-Xo(r,n))/(Xo(r,e)-Xo(r,n))},e}(Uo),qo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="pow",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t),n=this.exponent,r=Wo(n,this.max),i=Wo(n,this.min),o=e*(r-i)+i,a=o>=0?1:-1;return Math.pow(o,n)*a},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;if(e===n)return 0;var r=this.exponent;return(Wo(r,t)-Wo(r,n))/(Wo(r,e)-Wo(r,n))},e}(Uo),Ko=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="time",e}return Object(d.__extends)(e,t),e.prototype.getText=function(t,e){var n=this.translate(t),r=this.formatter;return r?r(n,e):No(n,this.mask)},e.prototype.scale=function(e){var n=e;return(Object(p.isString)(n)||Object(p.isDate)(n))&&(n=this.translate(n)),t.prototype.scale.call(this,n)},e.prototype.translate=function(t){return Do(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,e=this.getConfig("min"),n=this.getConfig("max");if(Object(p.isNil)(e)&&Object(p.isNumber)(e)||(this.min=this.translate(this.min)),Object(p.isNil)(n)&&Object(p.isNumber)(n)||(this.max=this.translate(this.max)),t&&t.length){var r=[],i=1/0,o=i,a=0;Object(p.each)(t,(function(t){var e=Do(t);if(isNaN(e))throw new TypeError("Invalid Time: "+t+" in time scale!");i>e?(o=i,i=e):o>e&&(o=e),a<e&&(a=e),r.push(e)})),t.length>1&&(this.minTickInterval=o-i),Object(p.isNil)(e)&&(this.min=i),Object(p.isNil)(n)&&(this.max=a)}},e}(Vo),Zo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantize",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.ticks,n=e.length,r=this.getInvertPercent(t),i=Math.floor(r*(n-1));if(i>=n-1)return Object(p.last)(e);if(i<0)return Object(p.head)(e);var o=e[i],a=i/(n-1);return o+(r-a)/((i+1)/(n-1)-a)*(e[i+1]-o)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var e=t.prototype.calculateTicks.call(this);return this.nice||(Object(p.last)(e)!==this.max&&e.push(this.max),Object(p.head)(e)!==this.min&&e.unshift(this.min)),e},e.prototype.getScalePercent=function(t){var e=this.ticks;if(t<Object(p.head)(e))return 0;if(t>Object(p.last)(e))return 1;var n=0;return Object(p.each)(e,(function(e,r){if(!(t>=e))return!1;n=r})),n/(e.length-1)},e}(Uo),Qo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantile",e}return Object(d.__extends)(e,t),e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(Zo),$o={};function Jo(t,e){if(function(t){return $o[t]}(t))throw new Error("type '"+t+"' existed.");$o[t]=e}var ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return Object(d.__extends)(e,t),e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&Object(p.isNumber)(t)?t:this.range[0]},e.prototype.invert=function(t){var e=this.range;return t<e[0]||t>e[1]?NaN:this.values[0]},e}(oo);function ea(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}var na=[1,5,2,2.5,4,3],ra=100*Number.EPSILON;function ia(t,e,n,r,i,o){var a=Object(p.size)(e),s=Object(p.indexOf)(e,t),u=0,c=function(t,e){return(t%e+e)%e}(r,o);return(c<ra||o-c<ra)&&r<=0&&i>=0&&(u=1),1-s/(a-1)-n+u}function oa(t,e,n){var r=Object(p.size)(e);return 1-Object(p.indexOf)(e,t)/(r-1)-n+1}function aa(t,e,n,r,i,o){var a=(t-1)/(o-i),s=(e-1)/(Math.max(o,r)-Math.min(n,i));return 2-Math.max(a/s,s/a)}function sa(t,e){return t>=e?2-(t-1)/(e-1):1}function ua(t,e,n,r){var i=e-t;return 1-.5*(Math.pow(e-r,2)+Math.pow(t-n,2))/Math.pow(.1*i,2)}function ca(t,e,n){var r=e-t;if(n>r){var i=(n-r)/2;return 1-Math.pow(i,2)/Math.pow(.1*r,2)}return 1}function la(t,e,n,r,i,o){void 0===n&&(n=5),void 0===r&&(r=!0),void 0===i&&(i=na),void 0===o&&(o=[.25,.2,.5,.05]);var a=n<0?0:Math.round(n);if(Number.isNaN(t)||Number.isNaN(e)||"number"!=typeof t||"number"!=typeof e||!a)return{min:0,max:0,ticks:[]};if(e-t<1e-15||1===a)return{min:t,max:e,ticks:[t]};for(var s={score:-2,lmin:0,lmax:0,lstep:0},u=1;u<1/0;){for(var c=0;c<i.length;c+=1){var l=i[c],f=oa(l,i,u);if(o[0]*f+o[1]+o[2]+o[3]<s.score){u=1/0;break}for(var h=2;h<1/0;){var d=sa(h,a);if(o[0]*f+o[1]+o[2]*d+o[3]<s.score)break;for(var g=(e-t)/(h+1)/u/l,v=Math.ceil(Math.log10(g));v<1/0;){var y=u*l*Math.pow(10,v),m=ca(t,e,y*(h-1));if(o[0]*f+o[1]*m+o[2]*d+o[3]<s.score)break;var b=Math.floor(e/y)*u-(h-1)*u,x=Math.ceil(t/y)*u;if(b<=x)for(var _=x-b,w=0;w<=_;w+=1){var E=(b+w)*(y/u),S=E+y*(h-1),O=y,M=ia(l,i,u,E,S,O),k=ua(t,e,E,S),A=aa(h,a,t,e,E,S),C=o[0]*M+o[1]*k+o[2]*A+1*o[3];C>s.score&&(!r||E<=t&&S>=e)&&(s.lmin=E,s.lmax=S,s.lstep=O,s.score=C)}v+=1}h+=1}}u+=1}var T=ea(s.lmax),I=ea(s.lmin),j=ea(s.lstep),P=Math.floor(function(t){return Math.round(1e12*t)/1e12}((T-I)/j))+1,N=new Array(P);N[0]=ea(I);for(c=1;c<P;c++)N[c]=ea(N[c-1]+j);return{min:Math.min(t,Object(p.head)(N)),max:Math.max(e,Object(p.last)(N)),ticks:N}}function fa(t){var e=t.values,n=t.tickInterval,r=t.tickCount,i=e;if(Object(p.isNumber)(n))return Object(p.filter)(i,(function(t,e){return e%n==0}));var o=t.min,a=t.max;if(Object(p.isNil)(o)&&(o=0),Object(p.isNil)(a)&&(a=e.length-1),Object(p.isNumber)(r)&&r<a-o){var s=la(o,a,r,!1,[1,2,5,3,4,7,6,8,9]).ticks;return Object(p.filter)(s,(function(t){return t>=o&&t<=a})).map((function(t){return e[t]}))}return e.slice(o,a+1)}var ha=Math.sqrt(50),da=Math.sqrt(10),pa=Math.sqrt(2),ga=function(){function t(){this._domain=[0,1]}return t.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},t.prototype.nice=function(t){var e,n;void 0===t&&(t=5);var r,i=this._domain.slice(),o=0,a=this._domain.length-1,s=this._domain[o],u=this._domain[a];return u<s&&(s=(e=[u,s])[0],u=e[1],o=(n=[a,o])[0],a=n[1]),(r=va(s,u,t))>0?r=va(s=Math.floor(s/r)*r,u=Math.ceil(u/r)*r,t):r<0&&(r=va(s=Math.ceil(s*r)/r,u=Math.floor(u*r)/r,t)),r>0?(i[o]=Math.floor(s/r)*r,i[a]=Math.ceil(u/r)*r,this.domain(i)):r<0&&(i[o]=Math.ceil(s*r)/r,i[a]=Math.floor(u*r)/r,this.domain(i)),this},t.prototype.ticks=function(t){return void 0===t&&(t=5),function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];(r=e<t)&&(i=t,t=e,e=i);if(0===(a=va(t,e,n))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s<i;)o[s]=(t+s)*a;else for(t=Math.floor(t*a),e=Math.ceil(e*a),o=new Array(i=Math.ceil(t-e+1));++s<i;)o[s]=(t-s)/a;r&&o.reverse();return o}(this._domain[0],this._domain[this._domain.length-1],t||5)},t}();function va(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=ha?10:o>=da?5:o>=pa?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ha?10:o>=da?5:o>=pa?2:1)}function ya(t,e,n){return("ceil"===n?Math.ceil(t/e):"floor"===n?Math.floor(t/e):Math.round(t/e))*e}function ma(t,e,n){var r=ya(t,n,"floor"),i=ya(e,n,"ceil");r=Object(p.fixedBase)(r,n),i=Object(p.fixedBase)(i,n);for(var o=[],a=r;a<=i;a+=n){var s=Object(p.fixedBase)(a,n);o.push(s)}return{min:r,max:i,ticks:o}}function ba(t,e,n){var r,i=t.minLimit,o=t.maxLimit,a=t.min,s=t.max,u=t.tickCount,c=void 0===u?5:u,l=Object(p.isNil)(i)?Object(p.isNil)(e)?a:e:i,f=Object(p.isNil)(o)?Object(p.isNil)(n)?s:n:o;if(l>f&&(f=(r=[l,f])[0],l=r[1]),c<=2)return[l,f];for(var h=(f-l)/(c-1),d=[],g=0;g<c;g++)d.push(l+h*g);return d}function xa(t,e,n){if(void 0===n&&(n=5),t===e)return{max:e,min:t,ticks:[t]};var r=n<0?0:Math.round(n);if(0===r)return{max:e,min:t,ticks:[]};var i=(e-t)/r,o=Math.pow(10,Math.floor(Math.log10(i))),a=o;2*o-i<1.5*(i-a)&&5*o-i<2.75*(i-(a=2*o))&&10*o-i<1.5*(i-(a=5*o))&&(a=10*o);for(var s=Math.ceil(e/a),u=Math.floor(t/a),c=Math.max(s*a,e),l=Math.min(u*a,t),f=Math.floor((c-l)/a)+1,h=new Array(f),d=0;d<f;d++)h[d]=ea(l+d*a);return{min:l,max:c,ticks:h}}function _a(t,e){var n=t.length*e;return 1===e?t[t.length-1]:0===e?t[0]:n%1!=0?t[Math.ceil(n)-1]:t.length%2==0?(t[n-1]+t[n])/2:t[n]}function wa(t){return new Date(t).getFullYear()}function Ea(t){return new Date(t,0,1).getTime()}function Sa(t){return new Date(t).getMonth()}function Oa(t,e){return new Date(t,e,1).getTime()}io("cat",fa),io("time-cat",(function(t){var e=fa(t),n=Object(p.last)(t.values);return n!==Object(p.last)(e)&&e.push(n),e})),io("wilkinson-extended",(function(t){var e=t.min,n=t.max,r=t.tickCount,i=t.nice,o=t.tickInterval,a=t.minLimit,s=t.maxLimit,u=la(e,n,r,i).ticks;return Object(p.isNil)(a)&&Object(p.isNil)(s)?o?ma(e,n,o).ticks:u:ba(t,Object(p.head)(u),Object(p.last)(u))})),io("r-pretty",(function(t){var e=t.min,n=t.max,r=t.tickCount,i=t.tickInterval,o=t.minLimit,a=t.maxLimit,s=xa(e,n,r).ticks;return Object(p.isNil)(o)&&Object(p.isNil)(a)?i?ma(e,n,i).ticks:s:ba(t,Object(p.head)(s),Object(p.last)(s))})),io("time",(function(t){var e=t.min,n=t.max,r=t.minTickInterval,i=t.tickInterval,o=t.tickCount;if(i)o=Math.ceil((n-e)/i);else{var a=(n-e)/(i=Go(e,n,o)[1])/o;a>1&&(i*=Math.ceil(a)),r&&i<r&&(i=r)}for(var s=[],u=e;u<n+i;u+=i)s.push(u);return s})),io("time-pretty",(function(t){var e=t.min,n=t.max,r=t.minTickInterval,i=t.tickCount,o=t.tickInterval,a=[];o||(o=(n-e)/i,r&&o<r&&(o=r));var s=wa(e);if(o>31536e6)for(var u=wa(n),c=Math.ceil(o/31536e6),l=s;l<=u+c;l+=c)a.push(Ea(l));else if(o>Bo){var f=Math.ceil(o/Bo),h=Sa(e),d=function(t,e){var n=wa(t),r=wa(e),i=Sa(t);return 12*(r-n)+(Sa(e)-i)%12}(e,n);for(l=0;l<=d+f;l+=f)a.push(Oa(s,l+h))}else if(o>Ro){var p=(b=new Date(e)).getFullYear(),g=b.getMonth(),v=b.getDate(),y=Math.ceil(o/Ro),m=function(t,e){return Math.ceil((e-t)/Ro)}(e,n);for(l=0;l<m+y;l+=y)a.push(new Date(p,g,v+l).getTime())}else if(o>Lo){p=(b=new Date(e)).getFullYear(),g=b.getMonth(),y=b.getDate();var b,x=b.getHours(),_=Math.ceil(o/Lo),w=function(t,e){return Math.ceil((e-t)/Lo)}(e,n);for(l=0;l<=w+_;l+=_)a.push(new Date(p,g,y,x+l).getTime())}else if(o>6e4){var E=function(t,e){return Math.ceil((e-t)/6e4)}(e,n),S=Math.ceil(o/6e4);for(l=0;l<=E+S;l+=S)a.push(e+6e4*l)}else{var O=o;O<1e3&&(O=1e3);var M=1e3*Math.floor(e/1e3),k=Math.ceil((n-e)/1e3),A=Math.ceil(O/1e3);for(l=0;l<k+A;l+=A)a.push(M+1e3*l)}return a.length>=512&&console.warn("Notice: current ticks length("+a.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+o+") is too small, increase the value to solve the problem!"),a})),io("log",(function(t){var e,n=t.base,r=t.tickCount,i=t.min,o=t.max,a=t.values,s=Xo(n,o);if(i>0)e=Math.floor(Xo(n,i));else{var u=Yo(a,n,o);e=Math.floor(Xo(n,u))}for(var c=s-e,l=Math.ceil(c/r),f=[],h=e;h<s+l;h+=l)f.push(Math.pow(n,h));return i<=0&&f.unshift(0),f})),io("pow",(function(t){var e=t.exponent,n=t.tickCount,r=Math.ceil(Wo(e,t.max));return xa(Math.floor(Wo(e,t.min)),r,n).ticks.map((function(t){var n=t>=0?1:-1;return Math.pow(t,e)*n}))})),io("quantile",(function(t){var e=t.tickCount,n=t.values;if(!n||!n.length)return[];for(var r=n.slice().sort((function(t,e){return t-e})),i=[],o=0;o<e;o++){var a=o/(e-1);i.push(_a(r,a))}return i})),io("d3-linear",(function(t){var e=t.min,n=t.max,r=t.tickInterval,i=t.minLimit,o=t.maxLimit,a=function(t){var e=t.min,n=t.max,r=t.nice,i=t.tickCount,o=new ga;return o.domain([e,n]),r&&o.nice(i),o.ticks(i)}(t);return Object(p.isNil)(i)&&Object(p.isNil)(o)?r?ma(e,n,r).ticks:a:ba(t,Object(p.head)(a),Object(p.last)(a))})),Jo("cat",ao),Jo("category",ao),Jo("identity",ta),Jo("linear",Vo),Jo("log",Ho),Jo("pow",qo),Jo("time",Ko),Jo("timeCat",zo),Jo("quantize",Zo),Jo("quantile",Qo);var Ma=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function ka(t){return function(t){return Object(p.map)(t,(function(t,e){return[0===e?"M":"L",t[0],t[1]]}))}(t)}function Aa(t,e,n,r){void 0===r&&(r=!0);var i=new Vo({values:t}),o=new ao({values:Object(p.map)(t,(function(t,e){return e}))}),a=Object(p.map)(t,(function(t,r){return[o.scale(r)*e,n-i.scale(t)*n]}));return r?function(t){if(t.length<=2)return ka(t);var e=[];Object(p.each)(t,(function(t){Object(p.isEqual)(t,e.slice(e.length-2))||e.push(t[0],t[1])}));var n=_n.a(e,!1),r=Object(p.head)(t),i=r[0],o=r[1];return n.unshift(["M",i,o]),n}(a):ka(a)}function Ca(t,e,n,r){void 0===r&&(r=5);for(var i=new Vo({values:t}),o=new ao({values:Object(p.map)(t,(function(t,e){return e}))}),a=Object(p.map)(t,(function(t,r){return[o.scale(r)*e,n-i.scale(t)*n]})),s=[],u=0;u<a.length;u++){var c=a[u],l=Ia({x:c[0],y:c[1],y0:n,size:r});s.push.apply(s,l)}return function(t,e){void 0===e&&(e=!0);var n=[],r=t[0];n.push(["M",r.x,r.y]);for(var i=1,o=t.length;i<o;i++)n.push(["L",t[i].x,t[i].y]);e&&(n.push(["L",r.x,r.y]),n.push(["z"]));return n}(s)}function Ta(t,e,n,r){var i=Ma([],t,!0),o=function(t,e){var n=new Vo({values:t}),r=Math.max(0,n.min);return e-n.scale(r)*e}(r,n);return i.push(["L",e,o]),i.push(["L",0,o]),i.push(["Z"]),i}function Ia(t){var e,n,r,i,o=t.x,a=t.y,s=t.y0,u=t.size;Object(p.isArray)(a)?(e=a[0],n=a[1]):(e=s,n=a),Object(p.isArray)(o)?(r=o[0],i=o[1]):(r=o-u/2,i=o+u/2);var c=[{x:r,y:e},{x:r,y:n}];return c.push({x:i,y:n},{x:i,y:e}),c}var ja=function(){return(ja=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Pa={stroke:"#C5C5C5",strokeOpacity:.85},Na={fill:"#CACED4",opacity:.85},Da=function(){function t(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=void 0===o?200:o,s=t.height,u=void 0===s?26:s,c=t.smooth,l=void 0===c||c,f=t.isArea,h=void 0!==f&&f,d=t.data,p=void 0===d?[]:d,g=t.lineStyle,v=t.areaStyle,y=t.group,m=t.interval,b=void 0===m?null:m;this.group=y,this.x=n,this.y=i,this.width=a,this.height=u,this.data=p,this.smooth=l,this.isArea=h,this.lineStyle=Object.assign({},Pa,g),this.areaStyle=Object.assign({},Na,v),this.intervalConfig=b,this.renderLine()}return t.prototype.renderLine=function(){var t=this,e=t.x,n=t.y,r=t.width,i=t.height,o=(t.barWidth,t.data),a=t.smooth,s=t.isArea,u=t.lineStyle,c=t.areaStyle,l=this.group.addGroup({name:"trend-group"});if(o){var f=Aa(o,r,i,a);if(l.addShape("path",{attrs:ja({path:f},u),name:"trend-line"}),s){var h=Ta(f,r,i,o);l.addShape("path",{attrs:ja({path:h},c),name:"trend-area"})}}this.intervalConfig&&l.addShape("path",{attrs:ja({path:Ca(this.intervalConfig.data,r,i,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),l.move(e,n)},t.prototype.destory=function(){this.group.destroy()},t}(),La=function(){return(La=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Ra={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},Ba={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize"},Fa=function(){function t(t){var e=t.group,n=t.name,r=t.type,i=t.x,o=void 0===i?0:i,a=t.y,s=void 0===a?0:a,u=t.width,c=void 0===u?2:u,l=t.height,f=void 0===l?24:l,h=t.style,d=void 0===h?{}:h;this.group=e,this.name=n,this.handleType=r,this.x=o,this.y=s,this.width=c,this.height=f,"trend"===r?this.style=La(La({},Ra),d):"simple"===r&&(this.style=La(La({},Ba),d)),this.renderHandle()}return t.prototype.setX=function(t){this.setXY(t,void 0)},t.prototype.setY=function(t){this.setXY(void 0,t)},t.prototype.setXY=function(t,e){Object(p.isNumber)(t)&&(this.x=t),Object(p.isNumber)(e)&&(this.y=e),this.updateXY()},t.prototype.renderHandle=function(){var t=this.width,e=this.height,n=this.style,r=this.name,i=n.fill,o=n.stroke,a=n.radius,s=n.opacity,u=n.cursor;this.handleGroup=this.group.addGroup(),"trend"===this.handleType?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:t,height:e,fill:i,stroke:o,radius:a,opacity:s,cursor:u},name:"".concat(r,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:0,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u,lineAppendWidth:12},name:"".concat(r,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:e,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u},name:"".concat(r,"-handler")})):"simple"===this.handleType&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:e/2,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u,lineWidth:2},name:"".concat(r,"-handler")})),this.updateXY(),"trend"===this.handleType?this.bindTrendEvents():"simple"===this.handleType&&this.bindSimpleEvents()},t.prototype.bindSimpleEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),(function(){var e=t.style.highLightFill;t.topCircle.attr("fill",e)})),this.handleGroup.on("".concat(e,"-handler:mouseleave"),(function(){var e=t.style.fill;t.topCircle.attr("fill",e)}))},t.prototype.bindTrendEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),(function(){var e=t.style.highLightFill;t.verticalLine.attr("fill",e),t.topCircle.attr("fill",e),t.bottomCircle.attr("fill",e)})),this.handleGroup.on("".concat(e,"-handler:mouseleave"),(function(){var e=t.style.fill;t.verticalLine.attr("fill",e),t.topCircle.attr("fill",e),t.bottomCircle.attr("fill",e)}))},t.prototype.show=function(){this.handleGroup.show()},t.prototype.hide=function(){this.handleGroup.hide()},t.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},t}(),Ga=function(){return(Ga=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},za=function(){function t(t){this.config=Object(p.deepMix)({},t),this.init()}return t.prototype.update=function(t){this.config=Object(p.deepMix)({},this.config,t),this.updateElement(),this.renderMarker()},t.prototype.init=function(){this.initElement(),this.renderMarker()},t.prototype.initElement=function(){var t=this.config,e=t.group,n=t.style,r=n.scale,i=void 0===r?1:r,o=n.offsetX,a=void 0===o?0:o,s=n.offsetY,u=void 0===s?0:s,c=this.config.x+a,l=this.config.y+u,f=e.addGroup({name:"playPauseBtn"});this.startMarkerGroup=f.addGroup({name:"playPauseBtn"}),this.circle=e.addShape("circle",{attrs:Ga({x:c,y:l,r:this.config.r*i},n),name:"playPauseBtn"}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(c,l,i),fill:n.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=f.addGroup({name:"playPauseBtn"});var h=.25*this.config.r*i,d=.5*this.config.r*Math.sqrt(3)*i;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c-.375*this.config.r*i,y:l-d/2,width:h,height:d,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c+1/8*this.config.r*i,y:l-d/2,width:h,height:d,fill:n.stroke||"#aaa",lineWidth:0}})},t.prototype.updateElement=function(){var t=this.config.style,e=t.scale,n=void 0===e?1:e,r=t.offsetX,i=void 0===r?0:r,o=t.offsetY,a=void 0===o?0:o,s=this.config.x+i,u=this.config.y+a;this.circle.attr("x",s),this.circle.attr("y",u),this.circle.attr("r",this.config.r*n),this.startMarker.attr("path",this.getStartMarkerPath(s,u,n));var c=.25*this.config.r*n,l=.5*this.config.r*Math.sqrt(3)*n;this.pauseLeftMarker.attr("x",s-.375*this.config.r*n),this.pauseLeftMarker.attr("y",u-l/2),this.pauseLeftMarker.attr("width",c),this.pauseLeftMarker.attr("height",l),this.pauseRightMarker.attr("x",s+1/8*this.config.r*n),this.pauseRightMarker.attr("y",u-l/2),this.pauseRightMarker.attr("width",c),this.pauseRightMarker.attr("height",l)},t.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},t.prototype.getStartMarkerPath=function(t,e,n){var r=.5*this.config.r*Math.sqrt(3)*n;return[["M",t-r/Math.sqrt(3)/2,e-r/2],["L",t+r/Math.sqrt(3),e],["L",t-r/Math.sqrt(3)/2,e+r/2]]},t}(),Ua=function(){return(Ua=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Va=b.a.transform,Wa={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},Xa={fill:"#fff"},Ya={fill:"green"},Ha={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},qa={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},Ka={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:Ha,timeTypeControllerStyle:qa},Za=function(){function t(t){this.controllerCfg=Object(p.deepMix)({},Ka,t),this.group=t.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType="range",this.fontFamily=t.fontFamily||"Arial, sans-serif",this.init()}return t.prototype.init=function(){this.renderPlayButton()},t.prototype.getNextMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t+n,e],["L",t,e+n],["Z",t,e-n],["M",t,e],["L",t-n,e-n],["L",t-n,e+n],["Z"]]},t.prototype.getPreMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t-n,e],["L",t,e+n],["L",t,e-n],["M",t,e],["L",t+n,e-n],["L",t+n,e+n],["Z"]]},t.prototype.renderPlayButton=function(){var t=this.controllerCfg,e=t.width,n=t.height,r=t.x,i=t.y,o=t.hideTimeTypeController,a=t.fill,s=void 0===a?"#aaa":a,u=t.stroke,c=void 0===u?"green":u,l=t.containerStyle,f=void 0===l?{}:l,h=Ua(Ua({},Wa),t.playBtnStyle||{}),d=Ua(Ua({},Xa),t.preBtnStyle||{}),p=Ua(Ua({},Ya),t.nextBtnStyle||{}),g=n/2-5,v=i+10,y=this.controllerGroup.addShape("rect",{attrs:Ua({x:r,y:v,width:e,height:n,stroke:c,fill:s},f),name:"container-rect"});this.playButton?this.playButton.update({x:e/2,y:v,r:g}):this.playButton=new za({group:this.controllerGroup,x:e/2,y:v+g+5,r:g,isPlay:this.isPlay,style:h});var m=d.offsetX||0,b=d.offsetY||0,x=(d.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Ua({path:this.getPreMarkerPath(e/2-5*g+m,v+g+5+b,.5*x)},d),name:"preStepBtn"});var _=p.offsetX||0,w=p.offsetY||0,E=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Ua({path:this.getNextMarkerPath(e/2+5*g+_,v+g+5+w,.5*E)},p),name:"nextStepBtn"}),y.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var S=this.controllerCfg.scale,O=void 0===S?1:S,M=this.controllerGroup.getCanvasBBox(),k=(M.maxX+M.minX)/2,A=(M.maxY+M.minY)/2,C=Va([1,0,0,0,1,0,0,0,1],[["t",-k,-A],["s",O,O],["t",k,A]]);this.controllerGroup.setMatrix(C)},t.prototype.renderSpeedBtn=function(){var t=this.controllerCfg,e=t.y,n=t.width,r=t.hideTimeTypeController,i=Ua(Ua({},Ha),this.controllerCfg.speedControllerStyle||{}),o=i.scroller,a=void 0===o?{}:o,s=i.text,u=void 0===s?{}:s,c=i.pointer,l=void 0===c?{}:c,f=i.scale,h=void 0===f?1:f,d=i.offsetX,p=void 0===d?0:d,g=i.offsetY,v=void 0===g?0:g,y=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=y;var m=[],b=5;this.speedAxisY=[19,22,26,32,39];for(var x=0;x<5;x++){var _=e+this.speedAxisY[x],w=n-(r?50:110);y.addShape("line",{attrs:Ua({x1:w,x2:w+15,y1:_,y2:_},a),speed:b,name:"speed-rect"}),this.speedAxisY[x]=_,m.push(b),b-=1}this.speedText=y.addShape("text",{attrs:Ua({x:n-(r?50:110)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},u),name:"speed-text"}),this.speedPoint=y.addShape("path",{attrs:Ua({path:this.getPointerPath(n-(r?50:110),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},l),name:"speed-pointer"});var E=this.speedGroup.getCanvasBBox(),S=(E.maxX+E.minX)/2,O=(E.maxY+E.minY)/2,M=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];M=Va(M,[["t",-S,-O],["s",h,h],["t",S+p*h,O+v*h]]),this.speedGroup.setMatrix(M)},t.prototype.getPointerPath=function(t,e){return[["M",t,e],["L",t-10,e-4],["L",t-10,e+4],["Z"]]},t.prototype.renderToggleTime=function(){var t,e=this.controllerCfg.width,n=Ua(Ua({},qa),this.controllerCfg.timeTypeControllerStyle||{}),r=n.scale,i=void 0===r?1:r,o=n.offsetX,a=void 0===o?0:o,s=n.offsetY,u=void 0===s?0:s,c=n.box,l=void 0===c?{}:c,f=n.check,h=void 0===f?{}:f,d=n.text,p=void 0===d?{}:d;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"}),this.toggleGroup.addShape("rect",{attrs:Ua({x:e-50,y:this.speedAxisY[0]+3.5},l),isChecked:!1,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Ua({path:[["M",e-50+3,this.speedAxisY[1]+6],["L",e-50+7,this.speedAxisY[1]+10],["L",e-50+12,this.speedAxisY[1]+4]]},h),capture:!1,name:"check-icon"}),this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Ua({text:(null===(t=this.controllerCfg)||void 0===t?void 0:t.timePointControllerText)||"单一时间",x:e-50+15,y:this.speedAxisY[0]+4,fontFamily:"undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},p),name:"checked-text"});var g=this.toggleGroup.getCanvasBBox(),v=(g.maxX+g.minX)/2,y=(g.maxY+g.minY)/2,m=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];m=Va(m,[["t",-v,-y],["s",i,i],["t",v+a*i,y+u*i]]),this.toggleGroup.setMatrix(m)},t.prototype.bindEvent=function(){var t=this;this.speedGroup.on("speed-rect:click",(function(e){var n=e.target.attr("y1"),r=t.speedPoint.attr("matrix"),i=t.speedAxisY.indexOf(r[7]||0),o=t.speedAxisY.indexOf(n),a=t.speedAxisY[o]-t.speedAxisY[i];r=Va(r,[["t",0,a]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-o,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})})),this.speedGroup.on("mousewheel",(function(e){e.preventDefault();var n=t.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],r=n[7],i=t.speedAxisY.indexOf(r);if(-1===i){var o=1/0;t.speedAxisY.forEach((function(t,e){var n=Math.abs(t-r);o>n&&(o=n,i=e)}))}i=e.originalEvent.deltaY>0?Math.max(0,i-1):Math.min(t.speedAxisY.length-1,i+1);var a=t.speedAxisY[i]-r;n=Va(n,[["t",0,a]]),t.speedPoint.setMatrix(n),t.currentSpeed=t.speedAxisY.length-i,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})})),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",(function(e){var n,r,i=e.target.get("isChecked");i?(t.checkedIcon.hide(),t.checkedText.attr("text",(null===(r=t.controllerCfg)||void 0===r?void 0:r.timePointControllerText)||"单一时间"),t.currentType="range"):(t.checkedIcon.show(),t.checkedText.attr("text",(null===(n=t.controllerCfg)||void 0===n?void 0:n.timeRangeControllerText)||"时间范围"),t.currentType="single"),e.target.set("isChecked",!i),t.group.emit("timebarConfigChanged",{type:t.currentType,speed:t.currentSpeed})}))},t.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},t}(),Qa=function(){return(Qa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},$a=b.a.transform,Ja={fill:"#416180",opacity:.05},ts={fill:"#416180",opacity:.15,radius:5},es={fill:"#5B8FF9",opacity:.3,cursor:"grab"},ns={width:2,height:24},rs={textBaseline:"middle",fill:"#000",opacity:.45},is={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},os={lineWidth:1,stroke:"#ccc"},as=function(){function t(t){var e=this;this.prevX=0,this.onMouseDown=function(t){return function(n){e.currentHandler=t;var r=n.originalEvent;r.stopPropagation(),r.preventDefault(),e.prevX=Object(p.get)(r,"touches.0.pageX",r.pageX);var i=e.canvas.get("container");i.addEventListener("mousemove",e.onMouseMove),i.addEventListener("mouseup",e.onMouseUp),i.addEventListener("mouseleave",e.onMouseUp),i.addEventListener("touchmove",e.onMouseMove),i.addEventListener("touchend",e.onMouseUp),i.addEventListener("touchcancel",e.onMouseUp)}},this.onMouseMove=function(t){t.stopPropagation(),t.preventDefault();var n=Object(p.get)(t,"touches.0.pageX",t.pageX),r=n-e.prevX,i=e.adjustOffsetRange(r/e.width);e.updateStartEnd(i),e.updateUI(),e.prevX=n},this.onMouseUp=function(){e.currentHandler&&(e.currentHandler=void 0);var t=e.canvas.get("container");t&&(t.removeEventListener("mousemove",e.onMouseMove),t.removeEventListener("mouseup",e.onMouseUp),t.removeEventListener("mouseleave",e.onMouseUp),t.removeEventListener("touchmove",e.onMouseMove),t.removeEventListener("touchend",e.onMouseUp),t.removeEventListener("touchcancel",e.onMouseUp))};var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,a=t.width,s=void 0===a?100:a,u=t.height,c=t.padding,l=void 0===c?10:c,f=t.trendCfg,h=t.controllerCfg,d=void 0===h?{speed:1}:h,g=t.backgroundStyle,v=void 0===g?{}:g,y=t.foregroundStyle,m=void 0===y?{}:y,b=t.handlerStyle,x=void 0===b?{}:b,_=t.textStyle,w=void 0===_?{}:_,E=t.start,S=void 0===E?0:E,O=t.end,M=void 0===O?1:O,k=t.minText,A=void 0===k?"":k,C=t.maxText,T=void 0===C?"":C,I=t.group,j=t.graph,P=t.canvas,N=t.tick,D=void 0===N?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(t){return t},ticks:[]}:N,L=t.type;this.graph=j,this.canvas=P,this.group=I,this.timeBarType=L,this.x=r,this.y=o,this.width=s,this.height=u,this.padding=l,this.ticks=D.ticks,this.trendCfg=f,this.controllerCfg=d,this.currentSpeed=d.speed||1,this.tickLabelFormatter=D.tickLabelFormatter,"trend"===L?this.backgroundStyle=Qa(Qa({},Ja),v):"simple"===L&&(this.backgroundStyle=Qa(Qa({},ts),v)),this.foregroundStyle=Qa(Qa({},es),m),this.handlerStyle=Qa(Qa({},ns),x),this.textStyle=Qa(Qa({},rs),w),this.tickLabelStyle=Qa(Qa({},is),D.tickLabelStyle),this.tickLineStyle=Qa(Qa({},os),D.tickLineStyle),this.currentMode="range",this.start=S,this.end=M,this.minText=A,this.maxText=T,this.fontFamily="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return t.prototype.update=function(t){var e=t.x,n=t.y,r=t.width,i=t.height,o=t.minText,a=t.maxText,s=t.start,u=t.end;this.start=Math.min(1,Math.max(s,0)),this.end=Math.min(1,Math.max(u,0)),Object(p.assign)(this,{x:e,y:n,width:r,height:i,minText:o,maxText:a}),this.updateUI()},t.prototype.setText=function(t,e){this.minTextShape.attr("text",t),this.maxTextShape.attr("text",e)},t.prototype.renderSlider=function(){var t=this,e=this.width,n=this.height,r=this.timeBarType;if("trend"===r&&Object(p.size)(Object(p.get)(this.trendCfg,"data"))){var i=new Da(Qa(Qa({x:this.x,y:this.y,width:e,height:n},this.trendCfg),{group:this.group}));this.trendComponent=i}var o=this.group.addGroup({name:"slider-group"});o.addShape("rect",{attrs:Qa({x:0,y:0,width:e,height:n},this.backgroundStyle),name:"background"});var a=this.group.addGroup();"trend"===r?(this.minTextShape=a.addShape("text",{attrs:Qa({x:0,y:n/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=a.addShape("text",{attrs:Qa({y:n/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})):(this.minTextShape=a.addShape("text",{attrs:Qa({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=a.addShape("text",{attrs:Qa({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:Qa({x:0,y:this.y,height:n},this.foregroundStyle),name:"foreground-shape"}),this.foregroundShape.on("mousedown",(function(t){t.target.attr("cursor","grabbing")})),this.foregroundShape.on("mouseup",(function(e){e.target.attr("cursor",t.foregroundStyle.cursor||"grab")}));var s=Object(p.get)(this.handlerStyle,"width",2),u=Object(p.get)(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new Fa({name:"minHandlerShape",group:c,type:r,x:this.x,y:this.y,width:s,height:u,style:this.handlerStyle});var l=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new Fa({name:"maxHandlerShape",group:l,type:r,x:this.x,y:this.y,width:s,height:u,style:this.handlerStyle});var f=this.ticks,h=e/(f.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach((function(t){t.destroy()}));var d=-1/0,g=this.tickLabelStyle.rotate;delete this.tickLabelStyle.rotate,this.textList=f.map((function(e,r){var i;t.tickPosList.push(t.x+r*h),t.tickLabelFormatter?(i=t.tickLabelFormatter(e),!Object(p.isString)(i)&&i&&(i=e.date)):i=e.date;var o=t.x+r*h,a=t.y+n+5,s=t.group.addShape("text",{attrs:Qa({x:o,y:a,text:i,fontFamily:t.fontFamily||"Arial, sans-serif"},t.tickLabelStyle),name:"tick-label"});if(Object(p.isNumber)(g)&&r!==f.length-1){var u=$a([1,0,0,0,1,0,0,0,1],[["t",-o,-a],["r",g],["t",o-5,a+2]]);s.attr({textAlign:"left",matrix:u})}0===r?s.attr({textAlign:"left"}):r!==f.length-1&&s.attr({textAlign:"right"});var c=t.group.addShape("line",{attrs:Qa({x1:t.x+r*h,y1:t.y+n+2,x2:t.x+r*h,y2:t.y+n+6},t.tickLineStyle),name:"tick-line"});c.toBack();var l=s.getBBox();return l.minX>d?(s.show(),c.show(),d=l.minX+l.width+10):(s.hide(),c.hide()),s})),this.controllerBtnGroup=new Za(Qa({group:this.group,x:this.x,y:this.y+n+25,width:e,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),o.move(this.x,this.y),this.bindEvents()},t.prototype.bindEvents=function(){var t=this,e=this.group.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat("playPauseBtn",":click"),(function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()})),this.group.on("".concat("nextStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()})),this.group.on("".concat("preStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()})),this.group.on("timebarConfigChanged",(function(e){var n=e.type,r=e.speed;t.currentSpeed=r,t.currentMode=n,"single"===n?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):"range"===n&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())}))},t.prototype.adjustTickIndex=function(t){for(var e=0;e<this.tickPosList.length-1;e++)if(this.tickPosList[e]<=t&&t<=this.tickPosList[e+1])return Math.abs(this.tickPosList[e]-t)<Math.abs(t-this.tickPosList[e+1])?e:e+1;return 0},t.prototype.adjustOffsetRange=function(t){switch(this.currentHandler){case this.minHandlerShape:var e=0-this.start,n=1-this.start;return Math.min(n,Math.max(e,t));case this.maxHandlerShape:e=0-this.end,n=1-this.end;return Math.min(n,Math.max(e,t));case this.foregroundShape:e=0-this.start,n=1-this.end;return Math.min(n,Math.max(e,t));default:return 0}},t.prototype.updateStartEnd=function(t){var e=this.ticks[this.adjustTickIndex(this.start*this.width)],n=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler)return this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):null==e?void 0:e.date,void(this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):null==n?void 0:n.date);switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=t,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=t,this.end+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date}},t.prototype.updateUI=function(){var t=this;this.start<0&&(this.start=0),this.end>1&&(this.end=1);var e=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",n-e);var r=Object(p.get)(this.handlerStyle,"width",2);this.setText(this.minText,this.maxText);var i=this.dodgeText([e,n]),o=i[0],a=i[1];this.minHandlerShape.setX(e-r/2),Object(p.each)(o,(function(e,n){return t.minTextShape.attr(n,e)})),this.maxHandlerShape.setX(n-r/2),Object(p.each)(a,(function(e,n){return t.maxTextShape.attr(n,e)})),"range"===this.currentMode?this.graph.emit("valuechange",{value:[this.start,this.end].sort()}):"single"===this.currentMode&&this.graph.emit("valuechange",{value:[this.end,this.end]})},t.prototype.dodgeText=function(t){var e,n,r=Object(p.get)(this.handlerStyle,"width",2),i=this.minTextShape,o=this.maxTextShape,a=t[0],s=t[1],u=!1;a>s&&(a=(e=[s,a])[0],s=e[1],i=(n=[o,i])[0],o=n[1],u=!0);var c=i.getBBox(),l=o.getBBox(),f=null,h=null;return"trend"===this.timeBarType?(f=a-c.width<this.x+2?{x:a+r/2+2,textAlign:"left"}:{x:a-r/2-2,textAlign:"right"},h=s+l.width>this.x+this.width?{x:s-r/2-2,textAlign:"right"}:{x:s+r/2+2,textAlign:"left"}):"simple"===this.timeBarType&&(f=i.attr("x")>c.width?{x:a,textAlign:"center"}:{x:a,textAlign:"left"},h=o.attr("x")>this.width-l.width?{x:s,textAlign:"right"}:{x:s,textAlign:"center"}),u?[h,f]:[f,h]},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame((function(){var e=t,n=e.ticks,r=e.width,i=t.currentSpeed,o=r/n.length/(1e3*(10-i)/60),a=t.adjustOffsetRange(o/t.width);t.updateStartEnd(a),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())})):void 0},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.destory=function(){this.graph.off("valuechange");var t=this.group,e=t.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var n=t.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),t.destroy(),this.trendComponent&&this.trendComponent.destory()},t}(),ss=function(){function t(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.container,a=t.text,s=t.padding,u=void 0===s?[4,4,4,4]:s,c=t.className,l=void 0===c?"g6-component-timebar-tooltip":c,f=t.backgroundColor,h=void 0===f?"#000":f,d=t.textColor,p=void 0===d?"#fff":d,g=t.opacity,v=void 0===g?.8:g,y=t.fontSize,m=void 0===y?12:y;this.container=o,this.className=l,this.backgroundColor=h,this.textColor=p,this.x=n,this.y=i,this.text=a,this.padding=u,this.opacity=v,this.fontSize=m,this.render()}return t.prototype.render=function(){var t=this.className,e=(this.x,this.y,this.backgroundColor),n=this.textColor,r=this.text,i=this.padding,o=this.opacity,a=this.fontSize,s=this.container,u=Ur("<div class='".concat(t,"' style=\"position: absolute; width: fit-content; height: fit-content; opacity: ").concat(o,'"></div>'));Object(p.isString)(s)&&(s=document.getElementById(s)),s.appendChild(u),this.parentHeight=s.offsetHeight,this.parentWidth=s.offsetWidth,Vr(u,{visibility:"hidden",top:0,left:0});var c=Ur("\n <div style='position: absolute; white-space:nowrap; background-color: ".concat(e,"; font-size: ").concat(a,"px; border-radius: 4px; width: fit-content; height: fit-content; color: ").concat(n,"; padding: ").concat(i[0],"px ").concat(i[1],"px ").concat(i[2],"px ").concat(i[3],"px'></div>"));c.innerHTML=r,u.appendChild(c),this.backgroundDOM=c;var l=Ur("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(e,"'></div>"));u.appendChild(l),this.arrowDOM=l,this.container=u},t.prototype.show=function(t){var e=t.text,n=t.x;t.y,t.clientX,t.clientY;this.backgroundDOM.innerHTML=e;var r=this.backgroundDOM.offsetWidth,i=this.backgroundDOM.offsetHeight,o=this.arrowDOM.offsetWidth,a=this.arrowDOM.offsetHeight;Vr(this.container,{top:"".concat(-i-a,"px"),left:"".concat(n,"px"),visibility:"visible"}),Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2,"px")}),Vr(this.arrowDOM,{marginLeft:"".concat(-o/2,"px"),top:"".concat(i,"px")});var s=n-r/2,u=n+r/2;s<0?Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2-s,"px")}):u>this.parentWidth&&Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2-u+this.parentWidth+12,"px")})},t.prototype.hide=function(){Vr(this.container,{top:0,left:0,visibility:"hidden"})},t}(),us=function(){return(us=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},cs=b.a.transform,ls={fill:"#5B8FF9"},fs={fill:"#e6e8e9"},hs=function(){function t(t){this.frameCount=0,this.fontFamily="Arial, sans-serif";var e=t.graph,n=t.canvas,r=t.group,i=t.width,o=t.height,a=t.padding,s=t.data,u=t.start,c=t.end,l=t.x,f=void 0===l?0:l,h=t.y,d=void 0===h?0:h,p=t.tickLabelFormatter,g=t.selectedTickStyle,v=void 0===g?ls:g,y=t.unselectedTickStyle,m=void 0===y?fs:y,b=t.tooltipBackgroundColor,x=t.tooltipFomatter,_=t.tickLabelStyle;this.graph=e,this.group=r,this.sliceGroup=r.addGroup({name:"slice-group"}),this.canvas=n,this.width=i,this.height=o,this.padding=a,this.data=s,this.start=u,this.end=c,this.tickLabelFormatter=p,this.tickLabelStyle=_||{},this.selectedTickStyle=v,this.unselectedTickStyle=m,this.x=f,this.y=d,this.tooltipBackgroundColor=b,this.tooltipFomatter=x,this.fontFamily="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return t.prototype.renderSlices=function(){var t=this,e=this,n=e.width,r=e.height,i=e.padding,o=e.data,a=e.start,s=e.end,u=e.tickLabelFormatter,c=e.selectedTickStyle,l=e.unselectedTickStyle,f=e.tickLabelStyle,h=n-2*i,d=r-(3*i+4+10)-2*i,g=o.length,v=(h-2*(g-1))/g;this.tickWidth=v;var y=this.sliceGroup,m=[],b=[],x=Math.round(g*a),_=Math.round(g*s);this.startTickRectId=x,this.endTickRectId=_;var w=f.rotate;delete f.rotate,o.forEach((function(e,r){var o=r>=x&&r<=_?c:l,a=y.addShape("rect",{attrs:us({x:i+r*(v+2),y:i,width:v,height:d},o),draggable:!0,name:"tick-rect-".concat(r)}),s=y.addShape("rect",{attrs:{x:i+r*v+2*(2*r-1)/2,y:i,width:0===r||r===g-1?v+1:v+2,height:d,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(r)});s.toFront();var h,E=a.getBBox(),S=(E.minX+E.maxX)/2;if(m.push({rect:a,pickRect:s,value:e.date,x:S,y:E.minY}),u?(h=u(e),!Object(p.isString)(h)&&h&&(h=e.date)):r%Math.round(g/10)==0&&(h=e.date),h){b.push(h);var O=E.maxY+2*i;y.addShape("line",{attrs:{stroke:"#BFBFBF",x1:S,y1:O,x2:S,y2:O+4},name:"tick-line"});var M=O+4+i,k=y.addShape("text",{attrs:us({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:S,y:M,textAlign:"center",text:h,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},f),capture:!1,name:"tick-label"}),A=k.getBBox();if(A.maxX>n?k.attr("textAlign","right"):A.minX<0&&k.attr("textAlign","left"),Object(p.isNumber)(w)&&10!==b.length){var C=cs([1,0,0,0,1,0,0,0,1],[["t",-S,-M],["r",w],["t",S-5,M+2]]);k.attr({textAlign:"left",matrix:C})}1===b.length?k.attr({textAlign:"left"}):10===b.length&&k.attr({textAlign:"right"})}})),this.tickRects=m;var E=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Za({group:E,x:this.x,y:this.y+r+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"})},t.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",(function(e){var n=e.target;if("rect"===n.get("type")&&n.get("name")){var r=parseInt(n.get("name").split("-")[2],10);if(!isNaN(r)){var i=t.tickRects,o=t.unselectedTickStyle;i.forEach((function(t){t.rect.attr(o)}));var a=t.selectedTickStyle;i[r].rect.attr(a),t.startTickRectId=r,t.endTickRectId=r;var s=r/i.length;t.graph.emit("valuechange",{value:[s,s]})}}})),e.on("dragstart",(function(e){var n=t.tickRects,r=t.unselectedTickStyle;n.forEach((function(t){t.rect.attr(r)}));var i=e.target,o=parseInt(i.get("name").split("-")[2],10),a=t.selectedTickStyle;n[o].rect.attr(a),t.startTickRectId=o;var s=o/n.length;t.graph.emit("valuechange",{value:[s,s]}),t.dragging=!0})),e.on("dragover",(function(e){if(t.dragging&&"rect"===e.target.get("type")){for(var n=parseInt(e.target.get("name").split("-")[2],10),r=t.startTickRectId,i=t.tickRects,o=t.selectedTickStyle,a=t.unselectedTickStyle,s=0;s<i.length;s++){var u=s>=r&&s<=n?o:a;i[s].rect.attr(u)}var c=i.length;t.endTickRectId=n;var l=r/c,f=n/c;t.graph.emit("valuechange",{value:[l,f]})}})),e.on("drop",(function(e){if(t.dragging&&(t.dragging=!1,"rect"===e.target.get("type"))){var n=t.startTickRectId,r=parseInt(e.target.get("name").split("-")[2],10);if(!(r<n)){var i=t.selectedTickStyle,o=t.tickRects;o[r].rect.attr(i),t.endTickRectId=r;var a=o.length,s=n/a,u=r/a;t.graph.emit("valuechange",{value:[s,u]})}}}));var n=this.tooltipBackgroundColor,r=this.tooltipFomatter,i=this.canvas,o=new ss({container:i.get("container"),backgroundColor:n}),a=this.tickRects;a.forEach((function(t){var e=t.pickRect;e.on("mouseenter",(function(t){var e=t.target;if("rect"===e.get("type")){var n=parseInt(e.get("name").split("-")[2],10),s=i.getClientByPoint(a[n].x,a[n].y);o.show({x:a[n].x,y:a[n].y,clientX:s.x,clientY:s.y,text:r?r(a[n].value):a[n].value})}})),e.on("mouseleave",(function(t){o.hide()}))}));var s=this.group;s.on("".concat("playPauseBtn",":click"),(function(){t.isPlay=!t.isPlay,t.changePlayStatus()})),s.on("".concat("nextStepBtn",":click"),(function(){t.updateStartEnd(1)})),s.on("".concat("preStepBtn",":click"),(function(){t.updateStartEnd(-1)})),s.on("timebarConfigChanged",(function(e){e.type;var n=e.speed;t.currentSpeed=n}))},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame((function(){var e=t.currentSpeed;t.frameCount%(60/e)==0&&(t.frameCount=0,t.updateStartEnd(1)),t.frameCount++,t.isPlay&&(t.playHandler=t.startPlay())})):void 0},t.prototype.updateStartEnd=function(t){var e=this.tickRects,n=e.length,r=this.unselectedTickStyle,i=this.selectedTickStyle,o=this.endTickRectId;if(t>0?this.endTickRectId++:(e[this.endTickRectId].rect.attr(r),this.endTickRectId--),o!==this.startTickRectId)this.endTickRectId<this.startTickRectId&&(this.startTickRectId=this.endTickRectId);else{for(var a=this.startTickRectId;a<=this.endTickRectId-1;a++)e[a].rect.attr(r);this.startTickRectId=this.endTickRectId}if(e[this.endTickRectId]){e[this.endTickRectId].rect.attr(i);var s=this.startTickRectId/n,u=this.endTickRectId/n;this.graph.emit("valuechange",{value:[s,u]})}},t.prototype.destory=function(){this.graph.off("valuechange");var t=this.sliceGroup;t.off("click"),t.off("dragstart"),t.off("dragover"),t.off("drop"),this.tickRects.forEach((function(t){var e=t.pickRect;e.off("mouseenter"),e.off("mouseleave")})),this.tickRects.length=0,t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),this.sliceGroup.destroy()},t}(),ds=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ps=function(){return(ps=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},gs=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n},vs=function(t){function e(e){return t.call(this,e)||this}return ds(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1,filterItemTypes:["node"],containerCSS:{}}},e.prototype.initContainer=function(){var t,e,n=this.get("graph"),r=this._cfgs,i=r.width,o=r.height,a=this.get("className")||"g6-component-timebar",s=this.get("container"),u=this.get("graph").get("container");s?(Object(p.isString)(s)&&(s=document.getElementById(s)),t=s):Vr(t=Ur("<div class='".concat(a,"'></div>")),{position:"relative"}),u.appendChild(t),this.set("timeBarContainer",t),e="SVG"===n.get("renderer")?new br.Canvas({container:t,width:i,height:o}):new mr.Canvas({container:t,width:i,height:o}),this.get("containerCSS")&&Vr(t,this.get("containerCSS")),this.set("canvas",e)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas").addGroup({name:"timebar-group"});this.set("timeBarGroup",t),this.renderTrend(),this.initEvent();var e="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",e)},e.prototype.renderTrend=function(){var t=this,e=this._cfgs,n=e.width,r=e.x,i=e.y,o=e.padding,a=e.type,s=e.trend,u=e.slider,c=e.controllerCfg,l=e.textStyle,f=e.tick,h=e.backgroundStyle,d=e.foregroundStyle,p=s.data,g=gs(s,["data"]),v=n-2*o,y="trend"===a?26:4,m=this.get("graph"),b=this.get("timeBarGroup"),x=this.get("canvas"),_=null;if("trend"===a||"simple"===a){var w=this.get("getValue");_=new as(ps(ps({graph:m,canvas:x,group:b,type:a,x:r+o,y:"trend"===a?i+o:i+o+15,width:v,height:y,padding:o,backgroundStyle:h,foregroundStyle:d,trendCfg:ps(ps({},g),{data:p.map((function(t){return(null==w?void 0:w(t))||t.value}))})},u),{tick:{ticks:p,tickLabelFormatter:f.tickLabelFormatter,tickLabelStyle:f.tickLabelStyle,tickLineStyle:f.tickLineStyle},handlerStyle:ps(ps({},u.handlerStyle),{height:u.height||y}),controllerCfg:c,textStyle:l}))}else"tick"===a&&(_=new hs(ps({graph:m,canvas:x,group:b,x:r+o,y:i+o,width:n,height:42,padding:2},f)));var E=function e(){var n=t.get("timebar");n.draggingHandler=!1,n.isPlay&&(n.isPlay=!1,n.currentHandler=n.maxHandlerShape,n.changePlayStatus()),document.removeEventListener("mouseup",e)};x.on("mousedown",(function(t){"maxHandlerShape-handler"!==t.target.get("name")&&"minHandlerShape-handler"!==t.target.get("name")&&t.target!==_.foregroundShape||document.addEventListener("mouseup",E)})),this.set("timebar",_)},e.prototype.filterData=function(t){var e,n=t.value,r=null,i=this._cfgs.type;if("trend"===i||"simple"===i?r=this._cfgs.trend.data:"tick"===i&&(r=this._cfgs.tick.data),r&&0!==r.length){var o=this.get("rangeChange"),a=this.get("graph"),s=Math.round(r.length*n[0]),u=Math.round(r.length*n[1]);u=u>=r.length?r.length-1:u,s=s>=r.length?r.length-1:s;var c=null===(e=this._cfgs.tick)||void 0===e?void 0:e.tickLabelFormatter,l=c?c(r[s]):r[s].date,f=c?c(r[u]):r[u].date;if("tick"!==i)this.get("timebar").setText(l,f);if(o)o(a,l,f);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&0===this.cacheGraphData.nodes.length)&&(this.cacheGraphData=a.get("data"));var h=this.get("filterItemTypes"),d=this.get("changeData"),p=this.get("getDate"),g=this.get("shouldIgnore"),v=r[s].date,y=r[u].date;if(d||void 0===d){var m=this.cacheGraphData.nodes,b=this.cacheGraphData.edges;if(h.includes("node")){var x=(m=m.filter((function(t){var e=+((null==p?void 0:p(t))||t.date);return e>=v&&e<=y||(null==g?void 0:g("node",t,{min:v,max:y}))}))).map((function(t){return t.id}));b&&(b=b.filter((function(t){return x.includes(t.source)&&x.includes(t.target)||(null==g?void 0:g("edge",t,{min:v,max:y}))})))}(this.get("filterEdge")||h.includes("edge"))&&(b=b.filter((function(t){var e=+((null==p?void 0:p(t))||t.date);return e>=v&&e<=y||(null==g?void 0:g("edge",t,{min:v,max:y}))}))),a.changeData({nodes:m,edges:b})}else h.includes("node")&&a.getNodes().forEach((function(t){var e=t.getModel();if(!(null==g?void 0:g("node",e,{min:v,max:y}))){var n=+((null==p?void 0:p(e))||e.date);n<v||n>y?a.hideItem(t):a.showItem(t)}})),(this.get("filterEdge")||h.includes("edge"))&&a.getEdges().forEach((function(t){var e=t.getModel();if(!(null==g?void 0:g("edge",e,{min:r[s].date,max:r[u].date}))){var n=+((null==p?void 0:p(e))||e.date);n<r[s].date||n>r[u].date?a.hideItem(t):a.showItem(t)}}))}}else console.warn("请配置 TimeBar 组件的数据")},e.prototype.initEvent=function(){var t=this,e=0,n=0,r=this._cfgs.type;r&&"trend"!==r&&"simple"!==r?"tick"===r&&(e=this._cfgs.tick.start,n=this._cfgs.tick.end):(e=this._cfgs.slider.start,n=this._cfgs.slider.end);var i=this.get("graph");i.on("afterrender",(function(r){t.filterData({value:[e,n]})})),i.on("valuechange",Object(p.throttle)((function(e){t.filterData(e)}),200,{trailing:!0,leading:!0}))},e.prototype.destroy=function(){var e=this.get("timebar");e&&e.destory&&e.destory(),t.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var r=this.get("container");r||(r=this.get("graph").get("container")),Object(p.isString)(r)&&(r=document.getElementById(r)),r.removeChild(n)}},e}(ji),ys=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ms=cr.applyMatrix;var bs=function(t){function e(e){return t.call(this,e)||this}return ys(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,n=e.graph;if(!this.destroyed){var r=this.get("container");Object(p.isString)(r)&&(r=document.getElementById(r));var i=Ur("<div class=".concat(e.viewportClassName,"\n style='position:absolute;\n left:0;\n top:0;\n box-sizing:border-box;\n border: 2px solid #1980ff'>\n </div>")),o=0,a=0,s=!1,u=0,c=0,l=0,f=0,h=0,d=0;r.addEventListener("mousedown",(function(r){if(e.refresh=!1,r.target===i){var u=i.style;l=parseInt(u.width,10),f=parseInt(u.height,10);var c=t.get("width"),p=t.get("height");l>c||f>p||(d=n.getZoom(),h=t.get("ratio"),s=!0,o=r.clientX,a=r.clientY)}}),!1),r.addEventListener("mousemove",(function(e){if(s&&!Object(p.isNil)(e.clientX)&&!Object(p.isNil)(e.clientY)){var r=t.get("width"),g=t.get("height"),v=i.style;u=parseInt(v.left,10),c=parseInt(v.top,10),l=parseInt(v.width,10),f=parseInt(v.height,10);var y=o-e.clientX,m=a-e.clientY;u-y<0?y=u:u-y+l>=r&&(y=0),c-m<0?m=c:c-m+f>=g&&(m=0),c-=m,Vr(i,{left:"".concat(u-=y,"px"),top:"".concat(c,"px")}),n.translate(y*d/h,m*d/h),o=e.clientX,a=e.clientY}}),!1),r.addEventListener("mouseleave",(function(){s=!1,e.refresh=!0}),!1),r.addEventListener("mouseup",(function(){s=!1,e.refresh=!0}),!1),this.set("viewport",i),r.appendChild(i)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("width"),n=this.get("height"),r=this.get("graph"),i=r.get("width"),o=i/r.get("height"),a=r.getGroup(),s=a.getCanvasBBox(),u=[(s.minX+s.maxX)/2,(s.minY+s.maxY)/2],c=[s.maxX-s.minX,s.maxY-s.minY],l={centerX:u[0],centerY:u[1],width:0,height:0,minX:0,minY:0};s[0]/s[1]>o?(l.width=c[0],l.height=l.width/o):(l.height=c[1],l.width=l.height*o),l.minX=u[0]-l.width/2,l.minY=u[1]-l.height/2;var f=a.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]);var h=b.b.invert([1,0,0,0,1,0,0,0,1],f),d=ms({x:l.minX,y:l.minY},h),p=r.getCanvasByPoint(d.x,d.y),g=this.get("viewport");g||this.initViewport();var v=i/l.width,y=v*e,m=v*n,x=e*-p.x/l.width,_=n*-p.y/l.height,w=x+y,E=_+m;x<0&&(y+=x,x=0),w>e&&(y-=w-e),_<0&&(m+=_,_=0),E>n&&(m-=E-n),this.set("ratio",t),Vr(g,{left:"".concat(x,"px"),top:"".concat(_,"px"),width:"".concat(y,"px"),height:"".concat(m,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this.get("graph"),e=t.get("width"),n=t.get("height")/e,r=this.get("className"),i=this.get("container"),o=this.get("width"),a=this.get("height");o||a||(o=200),o?(a=n*o,this.set("height",a)):(o=1/n*a,this.set("width",o));var s=Ur("<div class='".concat(r,"' style='width: ").concat(o,"px; height: ").concat(a,"px; overflow: hidden; position: relative;'></div>"));Object(p.isString)(i)&&(i=document.getElementById(i)),i?i.appendChild(s):t.get("container").appendChild(s),this.set("container",s);var u=Ur('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');s.appendChild(u);var c=Ur('<span style="display: table-cell; vertical-align: middle; "></span>');u.appendChild(c),this.set("containerDOM",u),this.set("containerSpan",c);var l=Ur('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));this.set("imgDOM",l),this.updateImgSize(),c.appendChild(l),this.updateCanvas()},e.prototype.updateImgSize=function(){var t=this.get("imgDOM"),e=this.get("width"),n=this.get("height");t.onload=function(){var r=function(t,e){var n,r;if(t.naturalWidth)n=t.naturalWidth,r=t.naturalHeight;else{var i=new Image;i.src=t.src,i.onload=function(){e&&e(i.width,i.height)}}return[n,r]}(t);r[0]>r[1]?t.width=e:t.height=n}},e.prototype.updateCanvas=function(){if(this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("width")/t.get("canvas").getCanvasBBox().width;this.set("ratio",e),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){this.get("imgDOM").remove(),this.set("graphImg",t);var e=Ur('<img alt="" src="'.concat(t,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));this.set("imgDOM",e),e.src=t,this.updateImgSize(),this.get("containerSpan").appendChild(e),this.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(ji),xs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_s=function(){return(_s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},ws=cr.distance,Es={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Ss=function(t){function e(e){return t.call(this,e)||this}return xs(e,t),e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Object(p.clone)(Es),showLabel:"edge",scaleRBy:"wheel"}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"filter"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"filter"}}return t},e.prototype.init=function(){var t=this.get("showLabel"),e="node"===t||"both"===t,n="edge"===t||"both"===t;this.set("showNodeLabel",e),this.set("showEdgeLabel",n),this.get("shouldShow")||this.set("shouldShow",(function(){return!0}))},e.prototype.createDelegate=function(t){var e=this,n=e.get("delegate");n&&!n.destroyed||(e.filter(t),(n=e.get("delegate")).on("dragstart",(function(t){})),n.on("drag",(function(t){e.filter(t)})),"wheel"===this.get("scaleRBy")&&n.on("mousewheel",(function(t){e.scaleRByWheel(t)})))},e.prototype.scaleRByWheel=function(t){if(t&&t.originalEvent){t.preventDefault&&t.preventDefault();var e,n=this.get("graph"),r=this.get("delegate");(r?{x:r.attr("x"),y:r.attr("y")}:void 0)||n.getPointByClient(t.clientX,t.clientY);e=t.originalEvent.wheelDelta<0?.95:1/.95;var i=this.get("maxR"),o=this.get("minR"),a=this.get("r");(a>(i||n.get("height"))&&e>1||a<(o||.05*n.get("height"))&&e<1)&&(e=1),a*=e,this.set("r",a),this.filter(t)}},e.prototype.filter=function(t){var e=this.get("graph"),n=e.getNodes(),r={},i=this.get("r"),o=this.get("type"),a={x:t.x,y:t.y};this.updateDelegate(a,i);var s=this.get("shouldShow"),u=this.get("vShapes");u&&u.forEach((function(t){t.remove(),t.destroy()})),u=[],n.forEach((function(t){var e=t.getModel(),n=e.x,o=e.y;ws({x:n,y:o},a)<i&&(r[e.id]=t)}));var c=e.getEdges(),l=[];c.forEach((function(t){var e=t.getModel(),n=e.source,i=e.target;s(e)&&("only-source"===o||"one"===o?r[n]&&!r[i]&&l.push(t):"only-target"===o||"one"===o?r[i]&&!r[n]&&l.push(t):"both"===o&&r[n]&&r[i]&&l.push(t))}));var f=this.get("showNodeLabel"),h=this.get("showEdgelabel"),d=e.get("group");l.forEach((function(t){t.get("group").get("children").forEach((function(t){var e=t.get("type"),n=d.addShape(e,{attrs:t.attr()});u.push(n),f&&"text"===e&&n.set("visible",!0)}))})),Object.keys(r).forEach((function(t){var e=r[t].get("group").clone();if(d.add(e),u.push(e),h)for(var n=e.get("children"),i=0;i<n.length;i++){var o=n[i];"text"===o.get("type")&&o.set("visible",!0)}})),this.set("vShapes",u)},e.prototype.updateParams=function(t){var e=t.r,n=t.trigger,r=t.minR,i=t.maxR,o=t.scaleRBy,a=t.showLabel,s=t.shouldShow;if(isNaN(t.r)||this.set("r",e),isNaN(i)||this.set("maxR",i),isNaN(r)||this.set("minR",r),"mousemove"!==n&&"click"!==n||this.set("trigger",n),"wheel"===o||"unset"===o){this.set("scaleRBy",o),this.get("delegate").remove(),this.get("delegate").destroy();var u=this.get("dPercentText");u&&(u.remove(),u.destroy())}"node"!==a&&"both"!==a||this.set("showNodeLabel",!0),"edge"!==a&&"both"!==a||this.set("showEdgeLabel",!0),s&&this.set("shouldShow",s)},e.prototype.updateDelegate=function(t,e){var n=this,r=n.get("graph"),i=n.get("delegate");if(!i||i.destroyed){var o=r.get("group"),a=n.get("delegateStyle")||Es;i=o.addShape("circle",{attrs:_s({r:e,x:t.x,y:t.y},a),name:"lens-shape",draggable:!0}),"drag"!==this.get("trigger")&&"wheel"===this.get("scaleRBy")&&i.on("mousewheel",(function(t){n.scaleRByWheel(t)}))}else i.attr({x:t.x,y:t.y,r:e});n.set("delegate",i)},e.prototype.clear=function(){var t=this.get("vShapes");t&&t.forEach((function(t){t.remove(),t.destroy()})),t=[],this.set("vShapes",t);var e=this.get("delegate");e&&!e.destroyed&&(e.remove(),e.destroy())},e.prototype.destroy=function(){this.clear()},e}(ji),Os=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ms=cr.pointLineDistance,ks={stroke:"#FA8C16",lineWidth:1},As=function(t){function e(e){return t.call(this,e)||this}return Os(e,t),e.prototype.getDefaultCfgs=function(){return{line:ks,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},e.prototype.init=function(){},e.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},e.prototype.onDragStart=function(){this.initBoxLine()},e.prototype.onDrag=function(t){var e=t.item,n=(e.get("delegateShape")||e).getBBox(),r=e.getModel(),i=r.x-n.x,o=r.y-n.y;this.show({x:n.minX+i,y:n.minY+o},{width:n.width,height:n.height})},e.prototype.onDragEnd=function(){this.destory()},e.prototype.initBoxLine=function(){var t=this._cfgs,e=t.horizontalLines,n=t.verticalLines,r=t.itemAlignType;this.get("graph").getNodes().forEach((function(t){var i=t.getBBox(),o=t.get("id");!0===r||"horizontal"===r?(e["".concat(o,"tltr")]=[i.minX,i.minY,i.maxX,i.minY,t],e["".concat(o,"lcrc")]=[i.minX,i.centerY,i.maxX,i.centerY,t],e["".concat(o,"blbr")]=[i.minX,i.maxY,i.maxX,i.maxY,t]):"center"===r&&(e["".concat(o,"lcrc")]=[i.minX,i.centerY,i.maxX,i.centerY,t]),!0===r||"vertical"===r?(n["".concat(o,"tlbl")]=[i.minX,i.minY,i.minX,i.maxY,t],n["".concat(o,"tcbc")]=[i.centerX,i.minY,i.centerX,i.maxY,t],n["".concat(o,"trbr")]=[i.maxX,i.minY,i.maxX,i.maxY,t]):"center"===r&&(n["".concat(o,"tcbc")]=[i.centerX,i.minY,i.centerX,i.maxY,t])}))},e.prototype.show=function(t,e){var n=Object(p.mix)({},t);return this.itemAlign(t,e,n),t},e.prototype.itemAlign=function(t,e,n){var r=this,i=this._cfgs,o=i.horizontalLines,a=i.verticalLines,s=i.tolerance,u={x:n.x+e.width/2,y:n.y},c={x:n.x+e.width/2,y:n.y+e.height/2},l={x:n.x+e.width/2,y:n.y+e.height},f={x:n.x,y:n.y+e.height/2},h={x:n.x+e.width,y:n.y+e.height/2},d=[],g=[],v=null;if(this.clearAlignLine(),Object(p.each)(o,(function(t){t[4].isVisible&&(d.push(r.getLineDisObject(t,u)),d.push(r.getLineDisObject(t,c)),d.push(r.getLineDisObject(t,l)))})),Object(p.each)(a,(function(t){t[4].isVisible&&(g.push(r.getLineDisObject(t,f)),g.push(r.getLineDisObject(t,c)),g.push(r.getLineDisObject(t,h)))})),d.sort((function(t,e){return t.dis-e.dis})),g.sort((function(t,e){return t.dis-e.dis})),0!==d.length&&d[0].dis<s){t.y=d[0].line[1]-d[0].point.y+n.y,v={type:"item",horizontals:[d[0]]};for(var y=1;y<3;y++)d[0].dis===d[y].dis&&v.horizontals.push(d[y])}if(0!==g.length&&g[0].dis<s){t.x=g[0].line[0]-g[0].point.x+n.x,v?v.verticals=[g[0]]:v={type:"item",verticals:[g[0]]};for(y=1;y<3;y++)g[0].dis===g[y].dis&&v.verticals.push(g[y])}v&&(v.bbox=e,this.addAlignLine(v))},e.prototype.addAlignLine=function(t){var e=t.bbox,n=t.type,r=t.horizontals,i=t.verticals,o=this._cfgs,a=o.line,s=o.alignLines,u=this.get("graph").get("group");"item"===n&&(r&&Object(p.each)(r,(function(t){var n,r,i=t.line,o=t.point,c=(i[0]+i[2])/2;o.x<c?(n=o.x-e.width/2,r=Math.max(i[0],i[2])):(n=o.x+e.width/2,r=Math.min(i[0],i[2]));var l=Object(p.mix)({x1:n,y1:i[1],x2:r,y2:i[1]},a),f=u.addShape("line",{attrs:l,capture:!1});s.push(f)})),i&&Object(p.each)(i,(function(t){var n,r,i=t.line,o=t.point,c=(i[1]+i[3])/2;o.y<c?(n=o.y-e.height/2,r=Math.max(i[1],i[3])):(n=o.y+e.height/2,r=Math.min(i[1],i[3]));var l=Object(p.mix)({x1:i[0],y1:n,x2:i[0],y2:r},a),f=u.addShape("line",{attrs:l,capture:!1});s.push(f)})))},e.prototype.getLineDisObject=function(t,e){return{line:t,point:e,dis:Ms(t,e)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;Object(p.each)(t,(function(t){t.remove()})),t.length=0},e.prototype.destory=function(){var t=this._cfgs,e=t.horizontalLines,n=t.verticalLines;this.get("graph").getNodes().forEach((function(t){var r=t.get("id");delete e["".concat(r,"tltr")],delete e["".concat(r,"lcrc")],delete e["".concat(r,"blbr")],delete n["".concat(r,"tlbl")],delete n["".concat(r,"tcbc")],delete n["".concat(r,"trbr")]})),this.clearAlignLine()},e}(ji),Cs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ts=function(){return(Ts=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Is=["click","mouseenter"],js={PluginBase:ji,Menu:Fi,Grid:Di,Minimap:Wi,Bundling:qi,ToolBar:to,Tooltip:no,Fisheye:$i,TimeBar:vs,ImageMinimap:bs,EdgeFilterLens:Ss,SnapLine:As,Legend:function(t){function e(e){return t.call(this,e)||this}return Cs(e,t),e.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},e.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var t=this.get("filter")||{};t.multiple&&"mouseenter"===t.trigger&&this.set("multiple",!1);var e=this.get("align");if(!e){var n=this.get("position").split("-");n.includes("left")&&(e="left"),e=n.includes("right")?"right":"center",this.set("align",e)}var r=this.get("graph").get("container"),i=Ur("<div class='g6-legend-container' style=\"position: absolute;\"></div>");r.appendChild(i),this.set("container",i);var o=this.render();Vr(i,this.getContainerPos(o)),this.bindEvents()},e.prototype.getContainerPos=function(t){void 0===t&&(t=[0,0]);var e=this.get("graph"),n=this.get("offsetX"),r=this.get("offsetY"),i=this.get("margin"),o=this.get("position").split("-"),a={top:0,right:1,bottom:2,left:3},s={left:(e.getWidth()-t[0])/2+0,top:(e.getHeight()-t[1])/2+0};return o.forEach((function(n){var r=i[a[n]],o=n;switch(n){case"top":case"left":r+=0;break;case"bottom":r=e.getHeight()-t[1]-r+0,o="top";break;default:r=e.getWidth()-t[0]-r+0,o="left"}s[o]=r})),s.top+=r+e.getContainer().offsetTop,s.left+=n+e.getContainer().offsetLeft,Object.keys(s).forEach((function(t){s[t]="".concat(s[t],"px")})),s},e.prototype.bindEvents=function(){var t=this,e=t.get("filter");if(e&&e.enable){var n=e.trigger||"click";Is.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var r=t.get("legendCanvas");"mouseenter"===n?(r.on("node-container:mouseenter",(function(e){return t.filterData(e)})),r.on("node-container:mouseleave",(function(e){t.clearFilter(),t.clearActiveLegend()}))):(r.on("node-container:click",(function(e){return t.filterData(e)})),r.on("click",(function(e){e.target&&e.target.isCanvas&&e.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())})))}},e.prototype.changeData=function(t){this.set("data",t);var e=this.render();Vr(this.get("container"),this.getContainerPos(e))},e.prototype.activateLegend=function(t){var e=this.get("filter");(null==e?void 0:e.multiple)||this.clearActiveLegend();var n=t.get("parent");n.get("active")?(n.set("active",!1),this.findLegendItemsByState("active").length&&n.set("inactive",!0)):(n.set("inactive",!1),n.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach((function(t){t.set("inactive",!0)})):this.clearActiveLegend();var r=(null==e?void 0:e.lengedStateStyles)||{},i=(null==r?void 0:r.inactive)||{opacity:.5,"text-shape":{opacity:.5}},o=i["text-shape"]||{};this.findLegendItemsByState("inactive").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Ts(Ts({},n.get("oriAttrs")),i)),r.attr(Ts(Ts({},r.get("oriAttrs")),o))}));var a=(null==r?void 0:r.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},s=a["text-shape"]||{};this.findLegendItemsByState("active").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Ts(Ts({},n.get("oriAttrs")),a)),r.attr(Ts(Ts({},r.get("oriAttrs")),s))}))},e.prototype.findLegendItemsByState=function(t,e,n){void 0===e&&(e="all"),void 0===n&&(n=!0);var r=this.get("legendCanvas").find((function(t){return"root"===t.get("name")})),i=r.find((function(t){return"node-group"===t.get("name")})),o=r.find((function(t){return"edge-group"===t.get("name")}));return"node"===e?i.get("children").filter((function(e){return!!e.get(t)===n})):"edge"===e?o.get("children").filter((function(e){return!!e.get(t)===n})):i.get("children").filter((function(e){return!!e.get(t)===n})).concat(o.get("children").filter((function(e){return!!e.get(t)===n})))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas").find((function(t){return"root"===t.get("name")}));[t.find((function(t){return"node-group"===t.get("name")})),t.find((function(t){return"edge-group"===t.get("name")}))].forEach((function(t){t.get("children").forEach((function(t){t.set("active",!1),t.set("inactive",!1);var e=t.get("children"),n=e[0],r=e[1];n.attr(n.get("oriAttrs")),r.attr(r.get("oriAttrs"))}))}))},e.prototype.filterData=function(t){var e=this.get("filter"),n=null==e?void 0:e.filterFunctions;if(e&&n){var r=this.get("legendCanvas"),i=this.get("graph"),o=e.graphActiveState||"active",a=e.graphInactiveState||"inactive",s=e.multiple;this.clearFilter(),s||this.clearActiveLegend(),this.activateLegend(t.target);var u=r.find((function(t){return"root"===t.get("name")})),c=u.find((function(t){return"node-group"===t.get("name")})),l=u.find((function(t){return"edge-group"===t.get("name")})),f=c.get("children").filter((function(t){return t.get("active")})),h=l.get("children").filter((function(t){return t.get("active")})),d=0,p=["getNodes","getEdges"];p.forEach((function(t){i[t]().forEach((function(e){var r=!1;("getNodes"===t?f:h).forEach((function(t){var i=n[t.get("id")];r=r||i(e.getModel())})),r?(i.setItemState(e,a,!1),i.setItemState(e,o,!0),d++):(i.setItemState(e,o,!1),i.setItemState(e,a,!0))}))})),d||p.forEach((function(t){i[t]().forEach((function(t){i.clearItemStates(t,[a])}))}))}},e.prototype.clearFilter=function(){var t=this.get("graph"),e=this.get("filter");if(e){var n=e.graphActiveState||"active",r=e.graphInactiveState||"inactive";t.getNodes().forEach((function(e){t.clearItemStates(e,[n,r])})),t.getEdges().forEach((function(e){t.clearItemStates(e,[n,r])}))}},e.prototype.render=function(){var t=this;this.processData();var e=this.get("legendCanvas");if(!e){var n=(e=new mr.Canvas({container:this.get("container"),width:200,height:200})).addGroup({name:"root"});n.addGroup({name:"node-group"}),n.addGroup({name:"edge-group"}),this.set("legendCanvas",e)}var r=e.find((function(t){return"root"===t.get("name")})),i=r.find((function(t){return"node-group"===t.get("name")})),o=r.find((function(t){return"edge-group"===t.get("name")})),a=this.get("itemsData"),s=[i,o];["nodes","edges"].forEach((function(e,n){a[e].forEach((function(r){var i,o,a=s[n].addGroup({id:r.id,name:"node-container"}),u=r.type,c=t.getShapeSize(r),l=c.width,f=c.height,h=c.r,d=t.getStyle(e.substr(0,4),r);switch(r.type){case"circle":o={r:h,x:0,y:0};break;case"rect":o={width:l,height:f,x:-l/2,y:-f/2};break;case"ellipse":o={r1:l,r2:f,x:0,y:0};break;case"line":o={x1:-l/2,y1:0,x2:l/2,y2:0},u="line";break;case"quadratic":o={path:[["M",-l/2,0],["Q",0,l/2,l/2,0]]},u="path";break;case"cubic":o={path:[["M",-l/2,0],["C",-l/6,l/2,l/6,-l/2,l/2,0]]},u="path";break;default:o={r:h,x:0,y:0}}var p=a.addShape(u,{attrs:Ts(Ts({},o),d),name:"".concat(r.type,"-node-keyShape"),oriAttrs:Ts({opacity:1},d)});if(r.label){var g=p.getBBox(),v=(null===(i=r.labelCfg)||void 0===i?void 0:i.style)||{},y=Ts({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},v);a.addShape("text",{attrs:Ts({x:g.maxX+4,y:0,text:r.label},y),className:"legend-label",name:"".concat(r.type,"-node-text"),oriAttrs:y})}}))}));var u,c=this.get("padding"),l=r.find((function(t){return"title-container"===t.get("name")})),f={height:0,maxY:0,width:0};if(this.get("title")){l||(l=r.addGroup({name:"title-container"}));var h={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:c[0]},d=this.get("titleConfig")||{},p=Object.assign(h,d.style||{});u=l.addShape("text",{attrs:Ts({text:this.get("title")},p)}),f=l.getCanvasBBox(),l.setMatrix([1,0,0,0,1,0,d.offsetX,d.offsetY,1])}this.layoutItems();var g=r.getCanvasBBox(),v=i.getCanvasBBox(),y=v.minX<0?Math.abs(v.minX)+c[3]:c[3],m=f.maxY<v.minY?Math.abs(f.maxY-v.minY)+c[0]:f.maxY+c[0],b=[1,0,0,0,1,0,y,m,1];i.setMatrix(b);var x=[(g=r.getCanvasBBox()).minX+g.width+c[1],g.minY+g.height+c[2]];if(u){d=Ts({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));f=l.getCanvasBBox();var _=l.getMatrix()||[1,0,0,0,1,0,0,0,1];"center"===d.position?_[6]=x[0]/2+d.offsetX:"right"===d.position?(_[6]=x[0]-c[3]+d.offsetX,u.attr({textAlign:"right"})):(_[6]=c[3]+d.offsetX,u.attr({textAlign:"left"})),l.setMatrix(_),f=l.getCanvasBBox(),b=[1,0,0,0,1,0,y=v.minX<0?Math.abs(v.minX)+c[3]:c[3],m=v.minY<f.maxY?Math.abs(f.maxY-v.minY)+c[0]:f.maxY+c[0],1],i.setMatrix(b);var w=[1,0,0,0,1,0,y,m,1];"vertical"===this.get("layout")?w[6]+=v.maxX+this.get("horiSep"):w[7]+=v.maxY+this.get("vertiSep"),o.setMatrix(w)}else{v=i.getCanvasBBox();var E=[1,0,0,0,1,0,0,0,1];"vertical"===this.get("layout")?E[6]+=b[6]+v.maxX+this.get("horiSep"):E[7]+=b[7]+v.maxY+this.get("vertiSep"),o.setMatrix(E)}g=r.getCanvasBBox(),v=i.getCanvasBBox(),b=i.getMatrix()||[1,0,0,0,1,0,0,0,1];var S=o.getMatrix()||[1,0,0,0,1,0,0,0,1],O=o.getCanvasBBox();x=[Math.max(v.width+b[6],O.width+S[6])+c[1],Math.max(v.height+b[7],O.height+S[7])+c[2]],e.changeSize(x[0],x[1]);var M=this.get("containerStyle"),k=r.getMatrix()||[1,0,0,0,1,0,0,0,1],A=cr.invertMatrix({x:0,y:0},k);return r.addShape("rect",{attrs:Ts({x:A.x+(M.lineWidth||1),y:A.y+(M.lineWidth||1),width:x[0]-2*(M.lineWidth||1),height:x[1]-2*(M.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},M),name:"legend-back-rect",capture:!1}).toBack(),x},e.prototype.layoutItems=function(){var t=this.get("legendCanvas"),e=this.get("horiSep"),n=this.get("vertiSep"),r=this.get("layout"),i=this.get("align"),o=[0,0],a=t.find((function(t){return"root"===t.get("name")})),s=a.find((function(t){return"node-group"===t.get("name")})),u=a.find((function(t){return"edge-group"===t.get("name")})),c={min:0,max:-1/0},l=-1/0;s.get("children").forEach((function(t,i){0===i&&(c.min=o[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),f=u.width,h=u.height,d=0,p=0,g=0;"vertical"===r?(p=o[1],g=o[0]+f/2,o[0]=g+s.height+n,d=s.maxX+p+f/2):(p=o[0]+f/2,g=o[1],o[0]=p+s.width+e,d=s.maxY+g+h/2),o[0]>c.max&&(c.max=o[0]),d>l&&(l=d),t.setMatrix([1,0,0,0,1,0,p,g,1])}));var f=c.max-c.min,h={min:0,max:-1/0},d=s.getCanvasBBox();o[0]=0,o[1]="vertical"===r?d.maxX+e:d.maxY+n,u.get("children").forEach((function(t,i){0===i&&(h.min=o[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),c=u.width,l=u.height,f=0,d=0;"vertical"===r?(f=o[1],d=o[0],o[0]=d+s.height+n,t.setMatrix([1,0,0,0,1,0,0,d+l/2,1])):(f=o[0],d=o[1],o[0]=f+s.width+e,t.setMatrix([1,0,0,0,1,0,f+c/2,0,1])),o[0]>h.max&&(h.max=o[0])}));var p=h.max-h.min;if(i&&""!==i&&"left"!==i){var g=f-p,v="center"===i?Math.abs(g)/2:Math.abs(g);(g<0?s:u).get("children").forEach((function(t){var e=t.getMatrix()||[1,0,0,0,1,0,0,0,1];"vertical"===r?e[7]+=v:e[6]+=v,t.setMatrix(e)}))}},e.prototype.processData=function(){var t=this.get("data"),e={nodes:[],edges:[]};t.nodes&&(t.nodes.sort((function(t,e){return t.order-e.order})),t.nodes.forEach((function(t){var n,r,i,o,a,s=t.size||[(null===(n=t.style)||void 0===n?void 0:n.width)||(null===(r=t.style)||void 0===r?void 0:r.r)||8,(null===(i=t.style)||void 0===i?void 0:i.height)||(null===(o=t.style)||void 0===o?void 0:o.r)||8],u=(null===(a=t.labelCfg)||void 0===a?void 0:a.style)||{};e.nodes.push({id:t.id||Object(p.uniqueId)(),type:t.type||"circle",style:Ts({},t.style),order:t.order,label:t.label,itemType:"node",size:s,labelCfg:{position:"right",style:Ts({fontFamily:"Arial"},u)}})}))),t.edges&&(t.edges.sort((function(t,e){return t.order-e.order})),t.edges.forEach((function(t){var n,r,i=t.type||"line";"cubic-horizontal"===t.type&&(i="cubic");var o=(null===(n=t.labelCfg)||void 0===n?void 0:n.style)||{},a=t.size||[(null===(r=t.style)||void 0===r?void 0:r.width)||8,1];e.edges.push({id:t.id||Object(p.uniqueId)(),type:i,size:a,style:Ts({lineWidth:Object(p.isArray)(a)?a[1]:1},t.style),order:t.order,label:t.label,itemType:"edge",labelCfg:{position:"right",style:Ts({fontFamily:"Arial"},o)}})}))),this.set("itemsData",e)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var e=this.get(t);if(Object(p.isNumber)(e))this.set(t,[e,e,e,e]);else if(Object(p.isArray)(e))switch(e.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[e[0],e[0],e[0],e[0]]);break;case 2:this.set(t,[e[0],e[1],e[0],e[1]]);break;case 3:this.set(t,[e[0],e[1],e[2],e[1]])}return this.get(t)},e.prototype.getShapeSize=function(t){var e,n,r;return t.size&&(Object(p.isArray)(t.size)?(e=t.size[0],n=t.size[1]||t.size[0],r=t.size[0]/2):Object(p.isNumber)(t.size)&&(e=t.size,n=t.size,r=t.size/2)),t.style&&(t.style.width&&(e=t.style.width),t.style.height&&(n=t.style.height),t.style.r&&(r=t.style.r)),r||(r=5),e||(e=r),n||(n=r),{width:e,height:n,r:r}},e.prototype.getStyle=function(t,e){return Ts(Ts({},"node"===t?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1}),e.style||{})},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(ji)};hr("circle",{options:{size:vr.defaultNode.size,style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(p.deepMix)({},r,t.icon),a="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:i,className:a,name:a,draggable:!0});e.shapeMap[a]=s;var u=o.width,c=o.height,l=o.show,f=o.text;if(l){var h="".concat(this.type,"-icon");e.shapeMap[h]=f?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:h,name:h,draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-u/2,y:-c/2},o),className:h,name:h,draggable:!0})}return this.drawLinkPoints(t,e),s},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints;if(n){var r=n||{},i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t)[0]/2;if(o){var h="link-point-left";e.shapeMap[h]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-f,y:0,r:u/2||c||5}),className:h,name:h,isAnchorPoint:!0})}if(a){var p="link-point-right";e.shapeMap[p]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:f,y:0,r:u/2||c||5}),className:p,name:p,isAnchorPoint:!0})}if(i){var g="link-point-top";e.shapeMap[g]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-f,r:u/2||c||5}),className:g,name:g,isAnchorPoint:!0})}if(s){var v="link-point-bottom";e.shapeMap[v]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:f,r:u/2||c||5}),className:v,name:v,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.deepMix)({},e,n),i=this.getSize(t)[0]/2;return Object(d.__assign)({x:0,y:0,r:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getSize(t),o=Object(d.__assign)({},t.style);void 0===t.style.stroke&&t.color&&(o.stroke=t.color),void 0!==t.style.r||isNaN(i[0])||(o.r=i[0]/2),this.updateShape(t,e,o,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("rect",{options:{size:[100,30],style:{radius:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=r,this.drawLinkPoints(t,e),r},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a=e.get("keyShape");t.size||(o[0]=a.attr("width")||i.width,o[1]=a.attr("height")||i.height);var s={stroke:t.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},u=Object(p.mix)({},i,a.attr(),s);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!1,n),this.updateLinkPoints(t,r)}},"single-node"),hr("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0]/2,p=f[1]/2;o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=i[0]/2,a=i[1]/2;return Object(d.__assign)({x:0,y:0,rx:o,ry:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a={stroke:t.color,rx:o[0]/2,ry:o[1]/2},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("diamond",{options:{size:[80,80],style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),n=e[0],r=e[1];return[["M",0,-r/2],["L",n/2,0],["L",0,r/2],["L",-n/2,0],["Z"]]},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("triangle",{options:{size:40,direction:"up",style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.icon,i=void 0===r?{}:r,o=n.direction,a=this.getShapeStyle(t),s=t.direction||o,u=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=i.width,l=i.height,f=i.show,h=i.offset,p=i.text;if(f)if(p)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var g=-c/2,v=-l/2;"up"!==s&&"down"!==s||(v+=h),"left"!==s&&"right"!==s||(g+=h),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:Object(d.__assign)({x:g,y:v},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.linkPoints,i=void 0===r?{}:r,o=n.direction,a=t.direction||o,s=i.top,u=i.left,c=i.right,l=i.bottom,f=i.size,h=i.r,p=Object(d.__rest)(i,["top","left","right","bottom","size","r"]),g=this.getSize(t)[0];if(u){var v=null,y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?v=[-m,y]:"down"===a?v=[-m,-y]:"left"===a&&(v=[-m,m-y]),v&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:v[0],y:v[1],r:f/2||h||5}),className:"link-point-left",name:"link-point-left"}))}if(c){var b=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?b=[m,y]:"down"===a?b=[m,-y]:"right"===a&&(b=[m,m-y]),b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:b[0],y:b[1],r:f/2||h||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var x=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?x=[m-y,-y]:"left"===a?x=[m,-y]:"right"===a&&(x=[-m,-y]),x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:x[0],y:x[1],r:f/2||h||5}),className:"link-point-top",name:"link-point-top"}))}if(l){var _=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"down"===a?_=[-m+y,y]:"left"===a?_=[m,y]:"right"===a&&(_=[-m,y]),_&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:_[0],y:_[1],r:f/2||h||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,n=t.direction||e,r=this.getSize(t)[0],i=r*Math.sin(1/3*Math.PI),o=r*Math.sin(1/3*Math.PI),a=[["M",-o,i],["L",0,-i],["L",o,i],["Z"]];return"down"===n?a=[["M",-o,-i],["L",o,-i],["L",0,i],["Z"]]:"left"===n?a=[["M",-o,o-i],["L",o,-o],["L",o,o],["Z"]]:"right"===n&&(a=[["M",o,o-i],["L",-o,o],["L",-o,-o],["Z"]]),a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}),r=n.linkPoints,i=n.direction,o=t.direction||i,a=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),s=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),u=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),c=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")})),l=r,f=a||s||u||c;f&&(l=f.attr());var h=Object(p.mix)({},l,t.linkPoints),g=h.fill,v=h.stroke,y=h.lineWidth,m=h.size/2;m||(m=h.r);var b=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},x=b.left,_=b.right,w=b.top,E=b.bottom,S=this.getSize(t)[0],O={r:m,fill:g,stroke:v,lineWidth:y},M=null,k=S*Math.sin(1/3*Math.PI),A=S*Math.sin(1/3*Math.PI);"up"===o?M=[-A,k]:"down"===o?M=[-A,-k]:"left"===o&&(M=[-A,A-k]),M&&(a?x||void 0===x?a.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:M[0],y:M[1]})):(a.remove(),delete e.shapeMap["link-point-left"]):x&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:M[0],y:M[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var C=null;"up"===o?C=[A,k]:"down"===o?C=[A,-k]:"right"===o&&(C=[A,A-k]),C&&(s?_||void 0===_?s.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:C[0],y:C[1]})):(s.remove(),delete e.shapeMap["link-point-right"]):_&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:C[0],y:C[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var T=null;"up"===o?T=[A-k,-k]:"left"===o?T=[A,-k]:"right"===o&&(T=[-A,-k]),T&&(u?w||void 0===w?u.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:T[0],y:T[1]})):(u.remove(),delete e.shapeMap["link-point-top"]):w&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:T[0],y:T[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var I=null;"down"===o?I=[-A+k,k]:"left"===o?I=[A,k]:"right"===o&&(I=[-A,k]),I&&(c?E||void 0===E?c.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:I[0],y:I[1]})):(c.remove(),delete e.shapeMap["link-point-bottom"]):E&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:I[0],y:I[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),hr("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:vr.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:vr.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:vr.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).preRect,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=this.getSize(t),a=o[0],s=o[1],u=e.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=r.show,l=Object(d.__rest)(r,["show"]);return c&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:Object(d.__assign)({x:-a/2,y:-s/2,height:s},l),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),u},drawLogoIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).logoIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(d.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-logo-icon"]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:s||-i/2+o+c,y:u||-a/2,width:o,height:a}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).stateIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(d.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-state-icon"]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:s||i/2-o+c,y:u||-a/2,width:o,height:a}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var n=this.getOptions(t),r=n.labelCfg,i=void 0===r?{}:r,o=n.logoIcon,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t)[0],l=null,f=a.show,h=a.width,g=-c/2+i.offset;f&&(g=-c/2+h+i.offset);var v=i.style,y=u.style,m=u.paddingTop;return Object(p.isString)(t.description)?(l=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},v),{x:g,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l,e.shapeMap["rect-description"]=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},y),{x:g,y:17+(m||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(l=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},v),{x:g,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l),l},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.style,i=void 0===r?{}:r,o=n.labelCfg,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t),l=c[0],f=c[1];e.get("keyShape").attr(Object(d.__assign)(Object(d.__assign)({},i),{x:-l/2,y:-f/2,width:l,height:f}));var h=e.getContainer(),g=h.shapeMap["rect-logo-icon"]||h.find((function(t){return"rect-logo-icon"===t.get("className")})),v=g?g.attr():{},y=Object(p.mix)({},v,t.logoIcon),m=y.width;void 0===m&&(m=this.options.logoIcon.width);var b=t.logoIcon?t.logoIcon.show:void 0,x=a.offset,_=-l/2+m+x;b||void 0===b||(_=-l/2+x);var w=h.shapeMap["node-label"]||h.find((function(t){return"node-label"===t.get("className")})),E=h.shapeMap["rect-description"]||h.find((function(t){return"rect-description"===t.get("className")}));if(t.label)if(w){var S=t.labelCfg?t.labelCfg.style:{},O=Object(p.mix)({},w.attr(),S);t.label&&(O.text=t.label),O.x=_,Object(p.isString)(t.description)&&(O.y=-5),E&&(E.resetMatrix(),E.attr({x:_})),w.resetMatrix(),w.attr(O)}else h.shapeMap["node-label"]=h.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},a.style),{x:_,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});if(Object(p.isString)(t.description)){var M=u.paddingTop;if(E){S=t.descriptionCfg?t.descriptionCfg.style:{};var k=Object(p.mix)({},E.attr(),S);Object(p.isString)(t.description)&&(k.text=t.description),k.x=_,E.resetMatrix(),E.attr(Object(d.__assign)(Object(d.__assign)({},k),{y:17+(M||0)}))}else h.shapeMap["rect-description"]=h.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},u.style),{x:_,y:17+(M||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})}var A=h.shapeMap["pre-rect"]||h.find((function(t){return"pre-rect"===t.get("className")}));if(A&&!A.destroyed){var C=Object(p.mix)({},A.attr(),t.preRect);A.attr(Object(d.__assign)(Object(d.__assign)({},C),{x:-l/2,y:-f/2,height:f}))}if(g&&!g.destroyed)if(b||void 0===b){var T=y.width,I=y.height,j=y.x,P=y.y,N=y.offset,D=Object(d.__rest)(y,["width","height","x","y","offset"]);g.attr(Object(d.__assign)(Object(d.__assign)({},D),{x:j||-l/2+T+N,y:P||-I/2,width:T,height:I}))}else g.remove(),delete h.shapeMap["pre-rect"];else b&&this.drawLogoIcon(t,h);var L=h.shapeMap["rect-state-icon"]||h.find((function(t){return"rect-state-icon"===t.get("className")})),R=L?L.attr():{},B=Object(p.mix)({},R,t.stateIcon);if(L){B.show||void 0===B.show||(L.remove(),delete h.shapeMap["rect-state-icon"]);var F=B.width,G=(I=B.height,j=B.x,P=B.y,B.offset),z=Object(d.__rest)(B,["width","height","x","y","offset"]);L.attr(Object(d.__assign)(Object(d.__assign)({},z),{x:j||l/2-F+G,y:P||-I/2,width:F,height:I}))}else B.show&&this.drawStateIcon(t,h);this.updateLinkPoints(t,h)}},"single-node"),hr("star",{options:{size:60,style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.leftBottom,u=r.rightBottom,c=r.size,l=r.r,f=Object(d.__rest)(r,["top","left","right","leftBottom","rightBottom","size","r"]),h=this.getSize(t)[0];if(a){var p=Math.cos(.1*Math.PI)*h,g=Math.sin(.1*Math.PI)*h;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-right",name:"link-point-right"})}if(i){p=Math.cos(.5*Math.PI)*h,g=Math.sin(.5*Math.PI)*h;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-top",name:"link-point-top"})}if(o){p=Math.cos(.9*Math.PI)*h,g=Math.sin(.9*Math.PI)*h;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-left",name:"link-point-left"})}if(s){p=Math.cos(1.3*Math.PI)*h,g=Math.sin(1.3*Math.PI)*h;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(u){p=Math.cos(1.7*Math.PI)*h,g=Math.sin(1.7*Math.PI)*h;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){for(var e=this.getSize(t)[0],n=3*e/8,r=t.innerR||n,i=[],o=0;o<5;o++){var a=Math.cos((18+72*o)/180*Math.PI)*e,s=Math.sin((18+72*o)/180*Math.PI)*e,u=Math.cos((54+72*o)/180*Math.PI)*r,c=Math.sin((54+72*o)/180*Math.PI)*r;0===o?i.push(["M",a,-s]):i.push(["L",a,-s]),i.push(["L",u,-c])}return i.push(["Z"]),i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}).linkPoints,r=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),i=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),o=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),a=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-left-bottom"===t.get("className")})),s=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-right-bottom"===t.get("className")})),u=n,c=r||i||o||a||s;c&&(u=c.attr());var l=Object(p.mix)({},u,t.linkPoints),f=l.fill,h=l.stroke,g=l.lineWidth,v=l.size/2;v||(v=l.r);var y=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},m=y.left,b=y.right,x=y.top,_=y.leftBottom,w=y.rightBottom,E=this.getSize(t)[0],S={r:v,fill:f,stroke:h,lineWidth:g},O=Math.cos(.1*Math.PI)*E,M=Math.sin(.1*Math.PI)*E;i?b||void 0===b?i.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(i.remove(),delete e.shapeMap["link-point-right"]):b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),O=Math.cos(.5*Math.PI)*E,M=Math.sin(.5*Math.PI)*E,o?x||void 0===x?o.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(o.remove(),delete e.shapeMap["link-point-top"]):x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),O=Math.cos(.9*Math.PI)*E,M=Math.sin(.9*Math.PI)*E,r?m||void 0===m?r.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(r.remove(),delete e.shapeMap["link-point-left"]):m&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),O=Math.cos(1.3*Math.PI)*E,M=Math.sin(1.3*Math.PI)*E,a?_||void 0===_?a.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(a.remove(),delete e.shapeMap["link-point-left-bottom"]):_&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),O=Math.cos(1.7*Math.PI)*E,M=Math.sin(1.7*Math.PI)*E,s?w||void 0===w?s.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(a.remove(),delete e.shapeMap["link-point-right-bottom"]):w&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Ps=cr.defaultSubjectColors;hr("donut",{options:{size:vr.defaultNode.size,style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(p.deepMix)({},r,t.icon),a=e.addShape("circle",{attrs:i,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=a;var s=o.width,u=o.height,c=o.show,l=o.text;c&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-s/2,y:-u/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}));var f=a.attr("r"),h=.6*f,g=(f+h)/2,v=t,y=v.donutAttrs,m=void 0===y?{}:y,b=v.donutColorMap,x=void 0===b?{}:b,_=Object.keys(m).length;if(m&&_>1){var w=[],E=0;if(Object.keys(m).forEach((function(t){var e=m[t]||0;Object(p.isNumber)(e)&&(w.push({key:t,value:e,color:x[t]}),E+=e)})),E){var S=f-h;if(1===_)return void(e.shapeMap["fan-shape-0"]=e.addShape("circle",{attrs:{r:g,x:0,y:0,stroke:w[0].color||Ps[0],lineWidth:S},name:"fan-shape-0"}));var O=[g,0],M=0;w.forEach((function(t,n){var r=t.value/E;if(!(r<.001))if(r>.999&&(r=1),1!==r){t.percent=r,t.angle=r*Math.PI*2,t.beginAgnle=M,M+=t.angle,t.endAngle=M,t.arcBegin=O,t.arcEnd=[g*Math.cos(t.endAngle),-g*Math.sin(t.endAngle)];var i=t.angle>Math.PI?1:0,o=[["M",t.arcBegin[0],t.arcBegin[1]],["A",g,g,0,i,0,t.arcEnd[0],t.arcEnd[1]],["L",t.arcEnd[0],t.arcEnd[1]]];e.shapeMap["fan-shape-".concat(n)]=e.addShape("path",{attrs:{path:o,lineWidth:S,stroke:t.color||Ps[n%Ps.length]},name:"fan-shape-".concat(n)}),O=t.arcEnd}else e.shapeMap["fan-shape-".concat(n)]=e.addShape("circle",{attrs:{r:g,x:0,y:0,stroke:t.color||Ps[n%Ps.length],lineWidth:S},name:"fan-shape-".concat(n)})}))}}return this.drawLinkPoints(t,e),a},update:void 0},"circle");var Ns=function(t){var e=t.x,n=t.y;return{x:e,y:n,centerX:e,centerY:n,minX:e,minY:n,maxX:e,maxY:n,height:0,width:0}},Ds=function(t){for(var e=[],n={},r=t.length-1;r>=0;r--){var i=t[r];i.id="".concat(i.x,"|||").concat(i.y),n[i.id]=i,e.push(i)}return e},Ls=function(t){return Ds(t)},Rs=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},Bs=function(t,e,n){var r=function(t,e){var n=Math.abs(t.x-e.centerX),r=Math.abs(t.y-e.centerY);return 0===n&&0===r?0:n/e.width>r/e.height}(e,t);if(0===r){var i=t.centerX,o=t.centerY;return n.y<e.y?o=t.minY:n.x>e.x?i=t.maxX:n.x<e.x?i=t.minX:n.x===e.x&&(o=t.maxY),{x:i,y:o}}return r?{x:e.x>t.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},Fs=function(t,e){var n=Math.min(t.minX,e.minX),r=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),o=Math.max(t.maxY,e.maxY);return{centerX:(n+i)/2,centerY:(r+o)/2,minX:n,minY:r,maxX:i,maxY:o,height:o-r,width:i-n}},Gs=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},zs=function(t,e){var n=t.x,r=t.y;return n<e.minX||n>e.maxX||r<e.minY||r>e.maxY},Us=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Vs=function(t,e,n,r,i){return Us(t,e)+Us(t,n)+function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n}(t,[e,n,r,i])},Ws=function t(e,n,r,i,o){void 0===o&&(o=0),e.unshift(n[i]),r[i]&&r[i]!==i&&o<=100&&t(e,n,r,r[i],o+1)},Xs=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=r.x-t.x,s=r.y-t.y,u=n.x-e.x,c=n.y-e.y,l=r.x-e.x,f=r.y-e.y;return(i*s-o*a)*(u*f-c*l)<=0&&(i*c-o*u)*(a*f-s*l)<=0},Ys=function(t,e,n){if(n.width||n.height){var r=Gs(n),i=r[0],o=r[1],a=r[2],s=r[3];return Xs(t,e,i,o)||Xs(t,e,i,s)||Xs(t,e,o,a)||Xs(t,e,a,s)}return!1},Hs=function(t,e,n,r){var i=[];return t.forEach((function(t){if(t!==e&&(t.x===e.x||t.y===e.y)){if(Ys(t,e,n)||Ys(t,e,r))return;i.push(t)}})),Ds(i)},qs=function(t,e){var n=[],r=t[0];return n.push("M".concat(r.x," ").concat(r.y)),t.forEach((function(r,i){var o=t[i+1],a=t[i+2];if(o&&a)if(function(t,e,n){return!(t.x===e.x&&e.x===n.x||t.y===e.y&&e.y===n.y)}(r,o,a)){var s=function(t,e,n,r){var i=Us(t,e),o=Us(n,e);return i<r&&(r=i),o<r&&(r=o),[{x:e.x-r/i*(e.x-t.x),y:e.y-r/i*(e.y-t.y)},{x:e.x-r/o*(e.x-n.x),y:e.y-r/o*(e.y-n.y)}]}(r,o,a,e),u=s[0],c=s[1];n.push("L".concat(u.x," ").concat(u.y)),n.push("Q".concat(o.x," ").concat(o.y," ").concat(c.x," ").concat(c.y)),n.push("L".concat(c.x," ").concat(c.y))}else n.push("L".concat(o.x," ").concat(o.y));else o&&n.push("L".concat(o.x," ").concat(o.y))})),n.join("")},Ks=function(t,e,n,r,i){var o,a;if(n&&n.getType())if("combo"===n.getType()){(o=n.getKeyShape().getCanvasBBox()||Ns(t)).centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=n.getBBox();else o=Ns(t);if(r&&r.getType())if("combo"===r.getType()){var s=r.getKeyShape().getBBox();if(s){var u=r.getModel(),c=u.x,l=u.y;(a={x:c,y:l,width:s.width,height:s.height,minX:s.minX+c,maxX:s.maxX+c,minY:s.minY+l,maxY:s.maxY+l}).centerX=(a.minX+a.maxX)/2,a.centerY=(a.minY+a.maxY)/2}else a=Ns(e)}else a=r&&r.getBBox();else a=Ns(e);var f=Rs(o,i),h=Rs(a,i),d=Bs(f,t,e),p=Bs(h,e,t),g=function(t){void 0===t&&(t=[]);var e=[],n=[];t.forEach((function(t){e.push(t.x),n.push(t.y)}));var r=Math.min.apply(Math,e),i=Math.max.apply(Math,e),o=Math.min.apply(Math,n),a=Math.max.apply(Math,n);return{centerX:(r+i)/2,centerY:(o+a)/2,maxX:i,maxY:a,minX:r,minY:o,height:a-o,width:i-r}}([d,p]),v=Fs(f,g),y=Fs(h,g),m=[];m=m.concat(Gs(v)).concat(Gs(y));var b={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[g,v,y].forEach((function(t){m=m.concat(function(t,e){return function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x).concat(function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y))}(t,b).filter((function(t){return zs(t,f)&&zs(t,h)})))})),[{x:d.x,y:p.y},{x:p.x,y:d.y}].forEach((function(t){zs(t,f)&&zs(t,h)&&m.push(t)})),m.unshift(d),m.push(p);var x=function(t,e,n,r,i,o,a){var s=[],u=[e],c={},l={},f={};l[e.id]=0,f[e.id]=Vs(e,n,e);var h,d,p,g,v,y={};for(t.forEach((function(t){y[t.id]=t}));u.length;){if(h=void 0,d=1/0,u.forEach((function(t){f[t.id]<=d&&(d=f[t.id],h=t)})),h===n){var m=[];return Ws(m,y,c,n.id),m}g=h,v=void 0,(v=(p=u).indexOf(g))>-1&&p.splice(v,1),s.push(h),Hs(t,h,r,i).forEach((function(t){if(-1===s.indexOf(t)){-1===u.indexOf(t)&&u.push(t);var r=f[h.id]+Us(h,t);l[t.id]&&r>=l[t.id]||(c[t.id]=h.id,l[t.id]=r,f[t.id]=l[t.id]+Vs(t,n,e,o,a))}}))}return[e,n]}(m=Ds(m),d,p,o,a,t,e);return x.unshift(t),x.push(e),Ls(x)},Zs={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},fallbackRoute:function(t,e,n,r,i){return Ls(Ks(t,e,n,r,i.offset))}},Qs=(Math.PI,function(t,e){var n=Math.round(Math.abs(t/e));return n<0?0:(t<0?-1:1)*n}),$s=function(t,e){var n=e.x-t.x,r=e.y-t.y;return n||r?Math.atan2(r,n):0},Js=function(t,e){var n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n},tu=function(t,e,n){for(var r=1/0,i=0,o=e.length;i<o;i++){var a=n(t,e[i]);a<r&&(r=a)}return r},eu=function(t,e,n,r,i){var o=[];if(!n)return[t];var a=i.directions,s=i.offset,u=n.getBBox(),c=e.x>u.minX&&e.x<u.maxX&&e.y>u.minY&&e.y<u.maxY,l=Rs(u,s);for(var f in l)l[f]=Qs(l[f],i.gridSize);if(c){for(var h=0,d=a;h<d.length;h++){var p=d[h],g=[[{x:l.minX,y:l.minY},{x:l.maxX,y:l.minY}],[{x:l.minX,y:l.minY},{x:l.minX,y:l.maxY}],[{x:l.maxX,y:l.minY},{x:l.maxX,y:l.maxY}],[{x:l.minX,y:l.maxY},{x:l.maxX,y:l.maxY}]];for(f=0;f<4;f++){var v=g[f],y=cr.getLineIntersect(t,{x:t.x+p.stepX*l.width,y:t.y+p.stepY*l.height},v[0],v[1]);y&&!Ys(t,y,u)&&(y.id="".concat(y.x,"|||").concat(y.y),o.push(y))}}return o}var m=Bs(l,t,r);return m.id="".concat(m.x,"|||").concat(m.y),[m]},nu=function(t,e,n,r){var i=$s(t,e);if(!n[t.id]){var o=$s(r,t);return Js(o,i)}var a=$s({x:n[t.id].x,y:n[t.id].y},t);return Js(a,i)},ru=function(t,e,n,r,i,o,a){var s=[r],u=t.id,c=t.x,l=t.y,f={x:c,y:l,id:u};for(nu(f,o,e,n)&&s.unshift({x:o.x===r.x?r.x:f.x*a,y:o.y===r.y?r.y:f.y*a});e[u]&&e[u].id!==u;){var h={x:c,y:l,id:u},d=e[u].id,p=e[u].x,g=e[u].y,v={x:p,y:g,id:d};nu(v,h,e,n)&&s.unshift({x:v.x===h.x?s[0].x:v.x*a,y:v.y===h.y?s[0].y:v.y*a}),u=d,c=p,l=g}var y=c,m=l;return s[0].x=y===n.x?i.x:s[0].x,s[0].y=m===n.y?i.y:s[0].y,s.unshift(i),s},iu=function(t,e,n,r,i){if(isNaN(t.x)||isNaN(e.x))return[];var o=Object(p.deepMix)(Zs,i);o.obstacles=o.obstacles||[];var a=o.gridSize,s=function(t,e,n){var r={};return t.forEach((function(t){if(t)for(var i=Rs(t.getBBox(),n),o=Qs(i.minX,e);o<=Qs(i.maxX,e);o+=1)for(var a=Qs(i.minY,e);a<=Qs(i.maxY,e);a+=1)r["".concat(o,"|||").concat(a)]=!0})),r}(o.obstacles.concat([n,r]),a,o.offset),u={x:Qs(t.x,a),y:Qs(t.y,a)},c={x:Qs(e.x,a),y:Qs(e.y,a)};t.id="".concat(u.x,"|||").concat(u.y),e.id="".concat(c.x,"|||").concat(c.y);var l=eu(u,t,n,c,o),f=eu(c,e,r,u,o);l.forEach((function(t){delete s[t.id]})),f.forEach((function(t){delete s[t.id]}));for(var h={},d={},g={},v={},y={},m=0;m<l.length;m++){var b=l[m];h[b.id]=b,v[b.id]=0,y[b.id]=tu(b,f,o.distFunc)}for(var x,_,w,E,S,O,M,k=o.maximumLoops,A=o.penalties;Object.keys(h).length>0&&k>0&&(x=void 0,_=1/0,Object.keys(h).forEach((function(t){var e=h[t].id;y[e]<=_&&(_=y[e],x=h[e])})),x);){if(f.findIndex((function(t){return t.x===x.x&&t.y===x.y}))>-1)return ru(x,g,u,e,t,c,a);delete h[x.id],d[x.id]=!0;for(m=0;m<o.directions.length;m++)w=o.directions[m],d[(E={x:x.x+w.stepX,y:x.y+w.stepY,id:"".concat(Math.round(x.x)+w.stepX,"|||").concat(Math.round(x.y)+w.stepY)}).id]||(M=nu(x,E,g,u))>o.maxAllowedDirectionChange||s[E.id]||(h[E.id]||(h[E.id]=E),S=o.distFunc(x,E)+(isNaN(A[M])?a:A[M]),O=v[x.id]+S,v[E.id]&&O>=v[E.id]||(g[E.id]=x,v[E.id]=O,y[E.id]=O+tu(E,f,o.distFunc)));k-=1}return o.fallbackRoute(t,e,n,r,o)};dr("polyline",{options:{color:vr.defaultEdge.color,size:vr.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:vr.defaultEdge.style.stroke,lineAppendWidth:vr.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:vr.edgeLabel.style.fill,fontSize:vr.edgeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:Object(d.__assign)({},vr.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);0===n.radius&&delete n.radius;var r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(p.mix)({},e,n,t.style);t=this.getPathPoints(t),this.radius=r.radius,this.offset=r.offset;var i=t.startPoint,o=t.endPoint,a=this.getControlPoints(t),s=[i];a&&(s=s.concat(a)),s.push(o);var u=t.sourceNode,c=t.targetNode,l=r.radius,f=this.options.routeCfg,h=Object(p.mix)({},f,t.routeCfg);h.offset=r.offset;var d=this.getPath(s,u,c,l,h);return(Object(p.isArray)(d)&&d.length<=1||Object(p.isString)(d)&&-1===d.indexOf("L"))&&(d="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(o.x)||isNaN(o.y))&&(d="M0 0, L0 0"),Object(p.mix)({},vr.defaultEdge.style,r,{lineWidth:t.size,path:d})},updateShapeStyle:function(t,e){var n=e.getContainer();if(e.isVisible()){var r={stroke:t.color},i=n.shapeMap["edge-shape"]||n.find((function(t){return"edge-shape"===t.get("className")}))||e.getKeyShape(),o=t.size,a=(t=this.getPathPoints(t)).startPoint,s=t.endPoint,u=this.getControlPoints(t),c=[a];u&&(c=c.concat(u)),c.push(s);var l=i.attr(),f=Object(p.mix)({},r,l,t.style),h=t.sourceNode,d=t.targetNode,g=f.radius,v=this.options.routeCfg,y=Object(p.mix)({},v,t.routeCfg);y.offset=f.offset;var m=this.getPath(c,h,d,g,y);(Object(p.isArray)(m)&&m.length<=1||Object(p.isString)(m)&&-1===m.indexOf("L"))&&(m="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(s.x)||isNaN(s.y))&&(m="M0 0, L0 0"),l.endArrow&&!1===f.endArrow&&(t.style.endArrow={path:""}),l.startArrow&&!1===f.startArrow&&(t.style.startArrow={path:""});var b=Object(p.mix)(r,i.attr(),{lineWidth:o,path:m},t.style);i&&i.attr(b)}},getPath:function(t,e,n,r,i){var o=i.offset,a=i.simple;if(!o||t.length>2){if(r)return qs(t,r);var s=[];return Object(p.each)(t,(function(t,e){0===e?s.push(["M",t.x,t.y]):s.push(["L",t.x,t.y])})),s}var u=a?Ks(t[t.length-1],t[0],n,e,o):iu(t[0],t[t.length-1],e,n,i);return u&&u.length?r?qs(u,r):cr.pointsToPolygon(u):"M0 0, L0 0"}},"single-edge");var ou=oi.cloneEvent,au=oi.isNaN,su=Math.abs,uu=["shift","ctrl","alt","control"],cu={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,n=+t.clientX,r=+t.clientY;if(!au(n)&&!au(r)){var i=n-e.x,o=r-e.y;"x"===this.get("direction")?o=0:"y"===this.get("direction")&&(i=0),this.origin={x:n,y:r};var a=this.graph.get("width"),s=this.graph.get("height"),u=this.graph.get("canvas").getCanvasBBox(),c=this.scalableRange,l=this.scalableRange;c<1&&c>-1&&(c*=a,l*=s),(u.minX<=a+c&&u.minX+i>a+c||u.maxX+c>=0&&u.maxX+c+i<0)&&(i=0),(u.minY<=s+l&&u.minY+o>s+l||u.maxY+l>=0&&u.maxY+l+o<0)&&(o=0),this.graph.translate(i,o)}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];n&&r||(t.preventDefault(),this.onMouseDown(t))},onMouseDown:function(t){var e=t.originalEvent;if((!e||t.name===rr.TOUCHSTART||0===e.button)&&(t.name===rr.TOUCHSTART||"undefined"==typeof window||!window.event||window.event.buttons||window.event.button)&&this.shouldBegin.call(this,t)&&!this.keydown){var n=t.target,r=n&&n.isCanvas&&n.isCanvas();if((this.allowDragOnItem||r)&&(this.origin={x:t.clientX,y:t.clientY},this.dragging=!1,this.enableOptimize)){for(var i=this.graph,o=i.getEdges(),a=0,s=o.length;a<s;a++){var u=o[a].get("group").get("children");u&&u.forEach((function(t){t.set("ori-visibility",t.get("ori-visibility")||t.get("visible")),t.hide()}))}for(var c=i.getNodes(),l=0,f=c.length;l<f;l++)for(var h=0,d=c[l].getContainer().get("children");h<d.length;h++){var p=d[h];p.get("isKeyShape")||(p.set("ori-visibility",p.get("ori-visibility")||p.get("visible")),p.hide())}}}},onTouchMove:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];n&&r?this.onMouseUp(t):(t.preventDefault(),this.onMouseMove(t))},onMouseMove:function(t){var e=this.graph;if(!this.keydown){var n=t.target,r=n&&n.isCanvas&&n.isCanvas();if((this.allowDragOnItem||r)&&(t=ou(t),this.origin)){if(this.dragging)t.type="drag",e.emit("canvas:drag",t);else{if(su(this.origin.x-t.clientX)+su(this.origin.y-t.clientY)<10)return;this.shouldBegin.call(this,t)&&(t.type="dragstart",e.emit("canvas:dragstart",t),this.originPosition={x:t.clientX,y:t.clientY},this.dragging=!0)}this.shouldUpdate.call(this,t)&&this.updateViewport(t)}}},onMouseUp:function(t){var e,n,r=this.graph;if(!this.keydown){var i=r.getZoom(),o=r.get("modeController"),a=null===(n=null===(e=null==o?void 0:o.modes[o.mode])||void 0===e?void 0:e.filter((function(t){return"zoom-canvas"===t.type})))||void 0===n?void 0:n[0],s=a?a.optimizeZoom||.1:0;if(this.enableOptimize){for(var u=r.getEdges(),c=0,l=u.length;c<l;c++){var f=u[c].get("group").get("children");f&&f.forEach((function(t){t.get("ori-visibility")&&t.show()}))}if(i>s)for(var h=r.getNodes(),d=0,p=h.length;d<p;d++)for(var g=0,v=h[d].getContainer().get("children");g<v.length;g++){var y=v[g];if(!y.get("isKeyShape"))y.get("ori-visibility")&&y.show()}}this.dragging?(t=ou(t),this.shouldEnd.call(this,t)&&this.updateViewport(t),t.type="dragend",t.dx=t.clientX-this.originPosition.x,t.dy=t.clientY-this.originPosition.y,r.emit("canvas:dragend",t),this.endDrag()):this.origin=null}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1},onKeyDown:function(t){var e=t.key;e&&(uu.indexOf(e.toLowerCase())>-1?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1}},lu={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd"}},validationCombo:function(t){return!(!this.origin||!t||t.destroyed)&&"combo"===t.getType()},onTouchStart:function(t){if(t.item){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDragStart(t)}},onTouchMove:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return void this.onDragEnd(t);t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDrag(t)},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,this.shouldBegin.call(this,t)){var n=t.item;if(n&&!n.destroyed&&!n.hasLocked()){n.getContainer().set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n);var r=t.target;if(r)if(r.get("isAnchorPoint"))return;var i=this.graph;this.targets=[],this.targetCombo=null;var o=i.findAllByState("node",this.selectedState),a=n.get("id");0===o.filter((function(t){var e=t.get("id");return a===e})).length?this.targets.push(n):o.length>1?o.forEach((function(t){t.hasLocked()||e.targets.push(t)})):this.targets.push(n);var s=[];this.targets.forEach((function(t){s.push(Object(p.clone)(t.getModel()))})),this.set("beforeDragNodes",s),this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){t.isVisible()&&(e.hidenEdge[t.getID()]=!0,t.hide())}))})),this.origin={x:t.x,y:t.y},this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;this.origin&&this.shouldUpdate.call(this,t)&&(this.get("enableDelegate")?this.updateDelegate(t):this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge")}):this.targets.map((function(n){e.update(n,t)})))},onDragEnd:function(t){var e,n=this;if(this.origin){null===(e=this.cachedCaptureItems)||void 0===e||e.forEach((function(t){t.getContainer().set("capture",!0)})),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){n.hidenEdge[t.getID()]&&t.show(),t.refresh()}))})),this.hidenEdge={};var r=this.graph;if(r.get("enabledStack")&&this.enableStack){var i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach((function(t){i.before.nodes.push({id:t.id,x:t.x,y:t.y})})),this.targets.forEach((function(t){var e=t.getModel();i.after.nodes.push({id:e.id,x:e.x,y:e.y})})),r.pushStack("update",Object(p.clone)(i))}r.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd.call(this,t,e),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&this.validationCombo(e)){var n=this.graph;if(this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)n.updateCombos();else{var r=e.getModel();this.targets.map((function(t){t.getModel().comboId!==r.id&&n.updateComboTree(t,r.id)})),n.updateCombo(e)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd.call(this,t,void 0),this.updatePositions(t,!this.currentShouldEnd),this.targets&&0!==this.targets.length&&this.currentShouldEnd&&(this.onlyChangeComboSize?e.updateCombos():this.targets.map((function(t){t.getModel().comboId&&e.updateComboTree(t)})))},onDropNode:function(t){if(this.targets&&0!==this.targets.length){var e=t.item,n=this.graph,r=e.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,i),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){if(this.onlyChangeComboSize)n.updateCombos();else if(r){var o=n.findById(r);this.comboActiveState&&n.setItemState(o,this.comboActiveState,!1),this.targets.map((function(t){var e=t.getModel();r!==e.comboId&&n.updateComboTree(t,r)})),n.updateCombo(o)}else this.targets.map((function(t){t.getModel().comboId&&n.updateComboTree(t)}));n.emit("dragnodeend",{items:this.targets,targetItem:e})}}},onDragEnter:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var n=this;this.targets&&0!==this.targets.length&&(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),updateFunc:this.update}):e||this.targets.map((function(e){return n.update(e,t)})):this.targets.map((function(r){return n.update(r,t,e)})))},update:function(t,e,n){var r=this.origin,i=t.get("model"),o=t.get("id");this.point[o]||(this.point[o]={x:i.x||0,y:i.y||0});var a=e.x-r.x+this.point[o].x,s=e.y-r.y+this.point[o].y;n&&(a+=r.x-e.x,s+=r.y-e.y);var u={x:a,y:s};this.get("updateEdge")?this.graph.updateItem(t,u,!1):t.updatePosition(u)},debounceUpdate:Object(p.debounce)((function(t){var e=t.targets,n=t.graph,r=t.point,i=t.origin,o=t.evt,a=t.updateEdge;t.updateFunc;e.map((function(t){var e=t.get("model"),s=t.get("id");r[s]||(r[s]={x:e.x||0,y:e.y||0});var u={x:o.x-i.x+r[s].x,y:o.y-i.y+r[s].y};a?n.updateItem(t,u,!1):t.updatePosition(u)}))}),50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:n,y:r})}else{var i=e.get("group"),o=Object(p.deepMix)({},Gr.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),s=a.x,u=a.y,c=a.width,l=a.height,f=a.minX,h=a.minY;this.originPoint={x:s,y:u,width:c,height:l,minX:f,minY:h},this.delegateRect=i.addShape("rect",{attrs:Object(d.__assign)({width:c,height:l,x:s,y:u},o),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;0===e.length&&e.push(t.item);for(var n=1/0,r=-1/0,i=1/0,o=-1/0,a=0;a<e.length;a++){var s=e[a].getBBox(),u=s.minX,c=s.minY,l=s.maxX,f=s.maxY;u<n&&(n=u),c<i&&(i=c),l>r&&(r=l),f>o&&(o=f)}return{x:Math.floor(n),y:Math.floor(i),width:Math.ceil(r)-Math.floor(n),height:Math.ceil(o)-Math.floor(i),minX:n,minY:i}}},fu={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return"mouseenter"===this.get("trigger")?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.setAllItemStates(t)},clearOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.clearActiveState(t)},setAllItemStates:function(t){var e=t.item,n=this.graph;if(this.item=e,this.shouldUpdate(t.item,{event:t,action:"activate"})){for(var r=this.activeState,i=this.inactiveState,o=n.getNodes(),a=n.getCombos(),s=n.getEdges(),u=n.get("vedges"),c=o.length,l=a.length,f=s.length,h=u.length,d=0;d<c;d++){var p=o[d],g=p.hasState("selected");this.resetSelected&&g&&n.setItemState(p,"selected",!1),n.setItemState(p,r,!1),i&&n.setItemState(p,i,!0)}for(d=0;d<l;d++){var v=a[d];g=v.hasState("selected");this.resetSelected&&g&&n.setItemState(v,"selected",!1),n.setItemState(v,r,!1),i&&n.setItemState(v,i,!0)}for(d=0;d<f;d++){var y=s[d];n.setItemState(y,r,!1),i&&n.setItemState(y,i,!0)}for(d=0;d<h;d++){var m=u[d];n.setItemState(m,r,!1),i&&n.setItemState(m,i,!0)}i&&n.setItemState(e,i,!1),n.setItemState(e,r,!0);var b=e.getEdges(),x=b.length;for(d=0;d<x;d++){var _=void 0;_=(y=b[d]).getSource()===e?y.getTarget():y.getSource(),i&&n.setItemState(_,i,!1),n.setItemState(_,r,!0),n.setItemState(y,i,!1),n.setItemState(y,r,!0),y.toFront()}n.emit("afteractivaterelations",{item:t.item,action:"activate"})}},clearActiveState:function(t){var e=this.get("graph");if(this.shouldUpdate(t.item,{event:t,action:"deactivate"})){var n=this.activeState,r=this.inactiveState,i=e.get("autoPaint");e.setAutoPaint(!1);for(var o=e.getNodes()||[],a=e.getCombos()||[],s=e.getEdges()||[],u=e.get("vedges")||[],c=o.length,l=a.length,f=s.length,h=u.length,d=0;d<c;d++){var p=o[d];e.clearItemStates(p,[n,r])}for(d=0;d<l;d++){var g=a[d];e.clearItemStates(g,[n,r])}for(d=0;d<f;d++){var v=s[d];e.clearItemStates(v,[n,r,"deactivate"])}for(d=0;d<h;d++){var y=u[d];e.clearItemStates(y,[n,r,"deactivate"])}e.paint(),e.setAutoPaint(i),e.emit("afteractivaterelations",{item:t.item||this.get("item"),action:"deactivate"})}}},hu=Math.min,du=Math.max,pu=Math.abs,gu=["drag","shift","ctrl","alt","control"],vu={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return gu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,n=this.brush;e||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&this.updateBrush(t)},onMouseUp:function(t){this.graph;(this.brush||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this.graph,e=this.selectedState,n=t.findAllByState("node",e),r=t.findAllByState("edge",e);n.forEach((function(n){return t.setItemState(n,e,!1)})),r.forEach((function(n){return t.setItemState(n,e,!1)})),this.selectedNodes=[],this.selectedEdges=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedNodes:function(t){var e=this,n=this.graph,r=this.originPoint,i=this.shouldUpdate,o=this.selectedState,a={x:t.x,y:t.y},s=n.getPointByCanvas(r.x,r.y),u=hu(a.x,s.x),c=du(a.x,s.x),l=hu(a.y,s.y),f=du(a.y,s.y),h=[],d=[];n.getNodes().forEach((function(t){if(t.isVisible()){var e=t.getBBox();if(e.centerX>=u&&e.centerX<=c&&e.centerY>=l&&e.centerY<=f&&i(t,"select")){h.push(t);var r=t.getModel();d.push(r.id),n.setItemState(t,o,!0)}}}));var p=[];this.includeEdges&&h.forEach((function(t){t.getOutEdges().forEach((function(t){if(t.isVisible()){var r=t.getModel(),o=r.source,a=r.target;d.includes(o)&&d.includes(a)&&i(t,"select")&&(p.push(t),n.setItemState(t,e.selectedState,!0))}}))})),this.selectedEdges=p,this.selectedNodes=h,this.onSelect&&this.onSelect(h,p),n.emit("nodeselectchange",{selectedItems:{nodes:h,edges:p},select:!0})},createBrush:function(){var t=this.graph.get("canvas").addShape("rect",{attrs:this.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:pu(t.canvasX-e.x),height:pu(t.canvasY-e.y),x:hu(t.canvasX,e.x),y:hu(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.keydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},yu=["shift","ctrl","alt","control"],mu={getDefaultCfg:function(){return{multiple:!0,trigger:"shift",selectedState:"selected"}},getEvents:function(){return yu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.multiple?{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,n=t.item;if(n&&!n.destroyed){n.getType();var r=e.graph,i=e.keydown,o=e.multiple,a=e.shouldUpdate;if(e.shouldBegin.call(e,t)){if(!i||!o){var s=r.findAllByState("node",e.selectedState).concat(r.findAllByState("combo",e.selectedState));Object(p.each)(s,(function(t){t!==n&&r.setItemState(t,e.selectedState,!1)}))}if(n.hasState(e.selectedState)){a.call(e,t)&&r.setItemState(n,e.selectedState,!1);var u=r.findAllByState("node",e.selectedState),c=r.findAllByState("combo",e.selectedState);r.emit("nodeselectchange",{target:n,selectedItems:{nodes:u,combos:c},select:!1})}else{a.call(e,t)&&r.setItemState(n,e.selectedState,!0);u=r.findAllByState("node",e.selectedState),c=r.findAllByState("combo",e.selectedState);r.emit("nodeselectchange",{target:n,selectedItems:{nodes:u,combos:c},select:!0})}}}},onCanvasClick:function(t){var e=this,n=this.graph;if(this.shouldBegin.call(this,t)){var r=n.findAllByState("node",this.selectedState);Object(p.each)(r,(function(t){n.setItemState(t,e.selectedState,!1)}));var i=n.findAllByState("combo",this.selectedState);Object(p.each)(i,(function(t){n.setItemState(t,e.selectedState,!1)})),n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()||"control"===e.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1}},bu=b.a.transform,xu={getDefaultCfg:function(){return{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];t.preventDefault(),r&&(this.shouldBegin&&!this.shouldBegin.call(this,t)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,r&&(this.endPoint={pageX:r.pageX,pageY:r.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,n=e[0],r=e[1];if(r){this.endPoint||(this.endPoint={pageX:r.pageX,pageY:r.pageY});var i=function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)},o=i({x:n.pageX,y:n.pageY},{x:r.pageX,y:r.pageY})/i({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),a=this.originScale*o;this.currentScale=a;var s=this.get("minZoom")||this.graph.get("minZoom");if(!(a>(this.get("maxZoom")||this.graph.get("maxZoom"))||a<s)){var u=this.get("animate"),c=this.get("animateCfg"),l=this.graph.get("canvas").getPointByClient(t.clientX,t.clientY);this.graph.zoomTo(a,{x:l.x,y:l.y},u,c),this.graph.emit("wheelzoom",t)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(t){var e=this,n=this.graph,r=this.fixSelectedItems;if((!this.shouldBegin||this.shouldBegin.call(this,t))&&this.shouldUpdate.call(this,t)){t.preventDefault();var i,o=n.get("canvas").getPointByClient(t.clientX,t.clientY),a=this.get("sensitivity"),s=n.getZoom();i=s*(t.wheelDelta<0?1-.05*a:1/(1-.05*a));var u=this.get("minZoom")||n.get("minZoom");if(!(i>(this.get("maxZoom")||n.get("maxZoom"))||i<u)){if(this.get("enableOptimize")){var c=this.get("optimizeZoom"),l=this.get("optimized"),f=n.getNodes(),h=n.getEdges(),d=f.length,g=h.length;if(!l){for(var v=0;v<d;v++){if(!(M=f[v]).destroyed)for(var y=(q=M.get("group").get("children")).length,m=0;m<y;m++){(L=q[m]).destoryed||L.get("isKeyShape")||(L.set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide())}}for(var b=0;b<g;b++)for(y=(q=(H=h[b]).get("group").get("children")).length,m=0;m<y;m++){(L=q[m]).set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var x=setTimeout((function(){var t=n.getZoom();if(e.get("optimized")){e.set("optimized",!1);for(var r=0;r<d;r++){var i=f[r],o=(l=i.get("group").get("children")).length;if(t<c)(s=(p=i.getKeyShape()).get("ori-visibility"))&&p.show();else for(var a=0;a<o;a++){var s=(y=l[a]).get("ori-visibility");!y.get("visible")&&s&&s&&y.show()}}for(var u=0;u<g;u++){var l,p,v=h[u];o=(l=v.get("group").get("children")).length;if(t<c)(s=(p=v.getKeyShape()).get("ori-visibility"))&&p.show();else for(a=0;a<o;a++){var y;if(!(y=l[a]).get("visible"))(s=y.get("ori-visibility"))&&y.show()}}}}),100);this.set("timeout",x)}if(s<=1){var _=void 0,w=void 0;if(r.fixAll||r.fixLineWidth||r.fixLabel){_=n.findAllByState("node",r.fixState),w=n.findAllByState("edge",r.fixState);for(var E=s/i,S=_.length,O=0;O<S;O++){var M,k=(M=_[O]).getContainer(),A=M.getModel(),C=M.getOriginStyle(),T=M.getStateStyle(r.fixState),I=M.get("shapeFactory").getShape(A.type).getStateStyle(r.fixState,M)[r.fixState];if(r.fixAll){if(i<=1){var j=Object(p.clone)(k.getMatrix());j||(j=[1,0,0,0,1,0,0,0,1]);var P=M.getModel(),N=P.x,D=P.y;j=bu(j,[["t",-N,-D],["s",E,E],["t",N,D]]),k.setMatrix(j)}}else for(y=(q=k.get("children")).length,m=0;m<y;m++){var L=q[m],R=void 0,B=void 0;if(r.fixLabel)if("text"===L.get("type")){R=L.attr("fontSize")||12;var F=T[L.get("name")],G=I[L.get("name")],z=F?F.fontSize:12,U=G?G.fontSize:12,V=z||U||12;if(i<=1&&L.attr("fontSize",V/i),B)break}if(r.fixLineWidth&&L.get("isKeyShape")){B=L.attr("lineWidth")||0;var W=T.lineWidth||I.lineWidth||C.lineWidth||0;if(i<=1&&L.attr("lineWidth",W/i),R)break}}}for(var X=w.length,Y=0;Y<X;Y++){var H,q=(k=(H=w[Y]).getContainer()).get("children");for(A=H.getModel(),T=H.getStateStyle(r.fixState),I=H.get("shapeFactory").getShape(A.type).getStateStyle(r.fixState,H)[r.fixState],y=q.length,m=0;m<y;m++){L=q[m],R=void 0,B=void 0;if(r.fixLabel||r.fixAll)if("text"===L.get("type")){R=L.attr("fontSize")||12;F=T[L.get("name")],G=I[L.get("name")],z=F?F.fontSize:12,U=G?G.fontSize:12,V=z||U||12;if(i<=1&&L.attr("fontSize",V/i),B)break}if((r.fixLineWidth||r.fixAll)&&L.get("isKeyShape")){B=L.attr("lineWidth")||0;W=T.lineWidth||I.lineWidth||1;if(i<=1&&L.attr("lineWidth",W/i),R)break}}}}}var K=this.get("animate"),Z=this.get("animateCfg");n.zoomTo(i,{x:o.x,y:o.y},K,Z),n.emit("wheelzoom",t)}}}},_u={onMouseEnter:function(t){var e=t.item;this.currentTarget=e,this.showTooltip(t),this.graph.emit("tooltipchange",{item:t.item,action:"show"})},onMouseMove:function(t){this.shouldUpdate(t)?this.currentTarget&&t.item===this.currentTarget&&this.updatePosition(t):this.hideTooltip()},onMouseLeave:function(t){this.shouldEnd(t)&&(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(t){var e=this.container;if(t.item&&!t.item.destroyed){e||(e=this.createTooltip(this.graph.get("canvas")),this.container=e);var n=this.formatText(t.item.get("model"),t);e.innerHTML=n,Vr(this.container,{visibility:"visible"}),this.updatePosition(t)}},hideTooltip:function(){Vr(this.container,{visibility:"hidden"})},updatePosition:function(t){var e=this.get("shouldBegin"),n=this.width,r=this.height,i=this.container,o=this.graph;if(e(t)){var a=o.getPointByClient(t.clientX,t.clientY),s=o.getCanvasByPoint(a.x,a.y),u=s.x,c=s.y,l=i.getBoundingClientRect();u>n/2?u-=l.width:u+=this.offset,c>r/2?c-=l.height:c+=this.offset;var f="".concat(u,"px"),h="".concat(c,"px");Vr(this.container,{left:f,top:h,visibility:"visible"})}else Vr(i,{visibility:"hidden"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var n=Ur('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return e.parentNode.appendChild(n),Vr(n,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},wu=Object(d.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},_u),Eu=Object(d.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},_u),Su=["click","dblclick"],Ou={getDefaultCfg:function(){return{trigger:"click",onChange:function(){}}},getEvents:function(){var t,e;return Su.includes(this.trigger)?e=this.trigger:(e="click",console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=t.item;if(e){var n=this.graph.findDataById(e.get("id"));if(n){var r=n.children;if(r&&0!==r.length){var i=!n.collapsed;this.shouldBegin(t,i)&&(n.collapsed=i,e.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:t.item,collapsed:i}),this.shouldUpdate(t,i)&&(this.onChange(e,i),this.graph.layout()))}}}}},Mu=oi.calculationItemsBBox,ku={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected"}},getEvents:function(){return{"combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;return!(!e||e.destroyed)&&(!!this.shouldUpdate.call(this,t)&&"combo"===e.getType())},onDragStart:function(t){var e=this,n=this.graph,r=t.item;if(this.currentShouldEnd=!0,this.validationCombo(t)){this.targets=[];var i=n.findAllByState("combo",this.selectedState),o=r.get("id");0===i.filter((function(t){var e=t.get("id");return o===e})).length?this.targets.push(r):this.targets=i,this.activeState&&this.targets.map((function(t){var r=t.getModel();if(r.parentId){var i=n.findById(r.parentId);i&&n.setItemState(i,e.activeState,!0)}})),this.point={},this.originPoint={},this.origin={x:t.x,y:t.y},this.currentItemChildCombos=[],function t(e,n){if(!1!==n(e)&&e){var r=e.get("combos");if(0===r.length)return!1;Object(p.each)(r,(function(e){t(e,n)}))}}(r,(function(t){if(t.destroyed)return!1;var n=t.getModel();return e.currentItemChildCombos.push(n.id),!0}))}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var n=this.graph,r=t.item,i=r.getModel(),o=n.getCombos(),a=r.getBBox(),s=a.centerX,u=a.centerY,c=a.width;o.filter((function(t){var n=t.getModel();return i.parentId,n.id!==i.id&&!e.currentItemChildCombos.includes(n.id)})).map((function(t){var r=t.getBBox(),i=r.centerX,o=r.centerY,a=r.width,l=s-i,f=u-o,h=2*Math.sqrt(l*l+f*f);c+a-h>.8*c?n.setItemState(t,e.activeState,!0):n.setItemState(t,e.activeState,!1)}))}Object(p.each)(this.targets,(function(n){e.updateCombo(n,t)}))}},updatePositions:function(t,e){var n=this;(this.enableDelegate||e)&&Object(p.each)(this.targets,(function(r){n.updateCombo(r,t,e)}))},onDrop:function(t){var e=this,n=t.item;if(this.currentShouldEnd=this.shouldEnd.call(this,t,n),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&n&&this.targets&&!n.destroyed){var r=this.graph,i=n.getModel();this.targets.map((function(t){t.getModel().parentId!==i.id?(e.activeState&&r.setItemState(n,e.activeState,!1),e.onlyChangeComboSize?r.updateCombo(t):r.updateComboTree(t,i.id)):r.updateCombo(n)})),this.end(n,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(this.targets&&0!==this.targets.length){var n=this.graph,r=t.item.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,i),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){var o;if(r){if(this.activeState){var a=n.findById(r);n.setItemState(a,this.activeState,!1)}this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):r!==t.getID()&&(o=n.findById(r),r!==t.getModel().parentId&&n.updateComboTree(t,r))}))}else this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):t.getModel().comboId&&n.updateComboTree(t)}));this.endComparison=!0,this.end(o,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(this.targets&&0!==this.targets.length){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var n=this.getParentCombo(e.getModel().parentId),r=this.graph;n&&this.activeState&&r.setItemState(n,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var n=this;if(this.origin){var r=this.graph;if(this.delegateShape)r.get("delegateGroup").clear(),this.delegateShape=null;t&&this.activeState&&r.setItemState(t,this.activeState,!1),t||this.targets.map((function(t){n.onlyChangeComboSize?r.updateCombo(t):r.updateComboTree(t)})),this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e){var n=this;if(!1!==e(t)&&t){var r=t.get("combos");Object(p.each)(r,(function(t){n.traverse(t,e)}));var i=t.get("nodes");Object(p.each)(i,(function(t){n.traverse(t,e)}))}},updateCombo:function(t,e,n){var r=this;this.traverse(t,(function(t){return!t.destroyed&&(r.updateSignleItem(t,e,n),!0)}))},updateSignleItem:function(t,e,n){var r=this.origin,i=this.graph,o=t.getModel(),a=t.get("id");this.point[a]||(this.point[a]={x:o.x,y:o.y});var s=e.x-r.x+this.point[a].x,u=e.y-r.y+this.point[a].y;n&&(s+=r.x-e.x,u+=r.y-e.y),i.updateItem(t,{x:s,y:u})},getParentCombo:function(t){var e=this.graph;if(t){var n=e.findById(t);if(n)return n}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:n,y:r})}else{var i=e.get("delegateGroup"),o=null,a=(o=this.targets.length>1?Mu(this.targets):this.targets[0].getBBox()).x,s=o.y,u=o.width,c=o.height,l=o.minX,f=o.minY;this.originPoint={x:a,y:s,width:u,height:c,minX:l,minY:f};var h=Object(d.__assign)(Object(d.__assign)({},Gr.delegateStyle),this.delegateStyle);this.delegateShape=i.addShape("rect",{attrs:Object(d.__assign)({width:o.width,height:o.height,x:o.x,y:o.y},h),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}}},Au=["click","dblclick"],Cu={getDefaultCfg:function(){return{trigger:"dblclick",relayout:!0}},getEvents:function(){var t,e;return Au.includes(this.trigger)?e=this.trigger:(e="dblclick",console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,n=this.graph,r=this.relayout;if(e&&!e.destroyed&&"combo"===e.getType()){var i=e.getModel().id;i&&(n.collapseExpandCombo(i),r&&n.get("layout")?n.layout():n.refreshPositions())}}},Tu=oi.isPolygonsIntersect,Iu=oi.pathToPoints,ju=["drag","shift","ctrl","alt","control"],Pu=["click","drag"],Nu=["shift","ctrl","control","alt","meta",void 0],Du=["shift","ctrl","alt","control"],Lu=["shift","ctrl","alt","control"],Ru={"drag-canvas":cu,"zoom-canvas":xu,"drag-node":lu,"activate-relations":fu,"brush-select":vu,"click-select":mu,"lasso-select":{getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return ju.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior lasso-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso;t.item||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&(this.points.push({x:t.x,y:t.y}),this.updateLasso(t))},onDragEnd:function(t){(this.lasso||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach((function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(){var t=this.graph,e=this.selectedState,n=t.findAllByState("node",e),r=t.findAllByState("edge",e);n.forEach((function(n){return t.setItemState(n,e,!1)})),r.forEach((function(n){return t.setItemState(n,e,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this.graph,n=this.shouldUpdate,r=this.points.map((function(t){return[e.getCanvasByPoint(t.x,t.y).x,e.getCanvasByPoint(t.x,t.y).y]})),i=this.selectedState,o=[],a=[];e.getNodes().forEach((function(t){if(t.isVisible()&&function(t,e){var n,r=t.getKeyShape();if("path"===t.get("type"))n=Iu(r.attr("path"));else{var i=r.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return Tu(e,n)}(t,r)&&n(t,"select")){o.push(t);var s=t.getModel();a.push(s.id),e.setItemState(t,i,!0)}}));var s=[];this.includeEdges&&o.forEach((function(r){r.getOutEdges().forEach((function(r){if(r.isVisible()){var i=r.getModel(),o=i.source,u=i.target;a.includes(o)&&a.includes(u)&&n(r,"select")&&(s.push(r),e.setItemState(r,t.selectedState,!0))}}))})),this.selectedEdges=s,this.selectedNodes=o,this.onSelect&&this.onSelect(o,s),e.emit("nodeselectchange",{selectedItems:{nodes:o,edges:s},select:!0})},createLasso:function(){var t=this.graph.get("delegateGroup").addShape("path",{attrs:Object(d.__assign)({path:[]},this.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(t){this.lasso.attr({path:this.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},tooltip:wu,"edge-tooltip":Eu,"collapse-expand":Ou,"drag-combo":ku,"collapse-expand-combo":Cu,"create-edge":{getDefaultCfg:function(){return{trigger:"click",key:void 0,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t;return Pu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="click",console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),this.key&&-1===Nu.indexOf(this.key.toLowerCase())&&(this.trigger=void 0,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined")),"drag"===this.trigger?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:"click"===this.trigger&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),this.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(t){if(!this.key||this.keydown){var e=t.item;e&&e.getID()!==this.source&&"node"===e.getType()||this.cancelCreating({item:this.edge,x:t.x,y:t.y})}},onClick:function(t){if(!this.key||this.keydown){var e=t.item,n=this.graph,r=e.getModel(),i=this.getEdgeConfig;if(this.addingEdge&&this.edge){if(!this.shouldEnd.call(this,t))return;var o=void 0;o=i&&Object(p.isFunction)(i)?i({source:this.source,target:r.id}):this.edgeConfig;var a=Object(d.__assign)({target:r.id},o);if(this.source===r.id&&(a.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(this.edge,a,!1),n.get("enabledStack")){var s=Object(d.__assign)(Object(d.__assign)({},this.edge.getModel()),{itemType:"edge"}),u={};u.edges=[s],n.pushStack("add",{before:{},after:u})}n.emit("aftercreateedge",{edge:this.edge}),this.edge.getKeyShape().set("capture",!0),this.edge=null,this.addingEdge=!1}else{if(!this.shouldBegin.call(this,t))return;o=void 0;o=i&&Object(p.isFunction)(i)?i({source:r.id,target:r.id}):this.edgeConfig,this.edge=n.addItem("edge",Object(d.__assign)({source:r.id,target:r.id},o),!1),this.source=r.id,this.addingEdge=!0,this.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){if(!this.key||this.keydown){this.edge&&this.edge.destroyed&&this.cancelCreating({item:this.edge});var e={x:t.x,y:t.y};this.graph.findById(this.source)?this.addingEdge&&this.edge&&this.graph.updateItem(this.edge,{target:e},!1):this.addingEdge=!1}},cancelCreating:function(t){var e,n;if(!this.key||this.keydown){var r=this.graph,i=t.item;return this.addingEdge&&(this.edge===i||(null===(n=null===(e=t.target)||void 0===e?void 0:e.isCanvas)||void 0===n?void 0:n.call(e)))?(this.edge&&!this.edge.destroyed&&r.removeItem(this.edge,!1),this.edge=null,void(this.addingEdge=!1)):void 0}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.key.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.addingEdge&&this.edge&&(this.graph.removeItem(this.edge,!1),this.addingEdge=!1,this.edge=null),this.keydown=!1}},"shortcuts-call":{getDefaultCfg:function(){return{trigger:"ctrl",combinedKey:"1",functionName:"fitView",functionParams:[]}},getEvents:function(){return Du.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="ctrl",console.warn("Behavior shortcuts-fit-view 的 trigger 参数 '".concat(this.trigger,"' 不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.triggerKeydown||(this.triggerKeydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n);var i=this.graph;if(!i[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(!this.triggerKeydown||this.combinedKey){var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(r===o||"control"===r&&"ctrl"===o||"ctrl"===r&&"control"===o)&&(this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]())}else this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]()}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0}},getEvents:function(){return this.zoomKey&&-1!==Lu.indexOf(this.zoomKey)||(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this,n=this.graph,r=t["".concat(this.zoomKey,"Key")];if("control"===this.zoomKey&&(r=t.ctrlKey),r){var i=n.get("canvas").getPointByClient(t.clientX,t.clientY),o=n.getZoom();t.wheelDelta>0?o+=.05*o:o-=.05*o,n.zoomTo(o,{x:i.x,y:i.y})}else{var a=t.deltaX||t.movementX,s=t.deltaY||t.movementY;!s&&navigator.userAgent.indexOf("Firefox")>-1&&(s=125*-t.wheelDelta/3);var u=this.graph.get("width"),c=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),f=this.scalableRange,h=this.scalableRange;f<1&&f>-1&&(f*=u,h*=c);var d=l.minX,p=l.maxX,g=l.minY,v=l.maxY;a>0?p<-f?a=0:p-a<-f&&(a=p+f):a<0&&(d>u+f?a=0:d-a>u+f&&(a=d-(u+f))),s>0?v<-h?s=0:v-s<-h&&(s=v+h):s<0&&(g>c+h?s=0:g-s>c+h&&(s=g-(c+h))),"x"===this.get("direction")?s=0:"y"===this.get("direction")&&(a=0),n.translate(-a,-s)}if(t.preventDefault(),this.get("enableOptimize")){var y=this.get("optimizeZoom"),m=this.get("optimized"),b=n.getNodes(),x=n.getEdges(),_=b.length,w=x.length;if(!m){for(var E=0;E<_;E++){var S=b[E];if(!S.destroyed)for(var O=(A=S.get("group").get("children")).length,M=0;M<O;M++){(C=A[M]).destoryed||C.get("isKeyShape")||(C.set("ori-visibility",C.get("ori-visibility")||C.get("visible")),C.hide())}}for(var k=0;k<w;k++){var A;for(O=(A=x[k].get("group").get("children")).length,M=0;M<O;M++){var C;(C=A[M]).set("ori-visibility",C.get("ori-visibility")||C.get("visible")),C.hide()}}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var T=setTimeout((function(){var t=n.getZoom();if(e.get("optimized")){e.set("optimized",!1);for(var r=0;r<_;r++){var i=b[r],o=(c=i.get("group").get("children")).length;if(t<y)(s=(l=i.getKeyShape()).get("ori-visibility"))&&l.show();else for(var a=0;a<o;a++){var s=(h=c[a]).get("ori-visibility");!h.get("visible")&&s&&s&&h.show()}}for(var u=0;u<w;u++){var c,l,f=x[u];o=(c=f.get("group").get("children")).length;if(t<y)(s=(l=f.getKeyShape()).get("ori-visibility"))&&l.show();else for(a=0;a<o;a++){var h;if(!(h=c[a]).get("visible"))(s=h.get("ori-visibility"))&&h.show()}}}}),100);this.set("timeout",T)}}}};Object(p.each)(Ru,(function(t,e){gr(e,t)}));var Bu=Object(d.__assign)(Object(d.__assign)({},r),yr),Fu=js.Grid,Gu=js.Minimap,zu=js.Bundling,Uu=js.Menu,Vu=js.Fisheye,Wu=js.ToolBar,Xu=js.Tooltip,Yu=js.TimeBar,Hu=js.ImageMinimap,qu=js.EdgeFilterLens,Ku=js.SnapLine,Zu=js.Legend,Qu={version:Gr.version,Graph:Ai,TreeGraph:Ii,Util:oi,Layout:Hr.Layouts,TreeLayout:si,registerLayout:ui,Global:Gr,registerBehavior:gr,registerCombo:pr,registerEdge:dr,registerNode:hr,Minimap:js.Minimap,Grid:js.Grid,Bundling:js.Bundling,Menu:js.Menu,ToolBar:js.ToolBar,Tooltip:js.Tooltip,Legend:js.Legend,TimeBar:Yu,SnapLine:Ku,Fisheye:Vu,ImageMinimap:Hu,EdgeFilterLens:qu,Algorithm:Bu,Arrow:ir,Marker:or,Shape:ar};Qu.version="4.6.0-beta.2";e.default=Qu;var $u="4.6.0-beta.2"},,,function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.d(e,"a",(function(){return y}));var i,o,a=0,s=0,u=0,c=0,l=0,f=0,h="object"===("undefined"==typeof performance?"undefined":r(performance))&&performance.now?performance:Date,d="object"===("undefined"==typeof window?"undefined":r(window))&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return l||(d(g),l=h.now()+f)}function g(){l=0}function v(){this._call=this._time=this._next=null}function y(t,e,n){var r=new v;return r.restart(t,e,n),r}function m(){l=(c=h.now())+f,a=s=0;try{!function(){p(),++a;for(var t,e=i;e;)(t=l-e._time)>=0&&e._call.call(null,t),e=e._next;--a}()}finally{a=0,function(){var t,e,n=i,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:i=e);o=t,x(r)}(),l=0}}function b(){var t=h.now(),e=t-c;e>1e3&&(f-=e,c=t)}function x(t){a||(s&&(s=clearTimeout(s)),t-l>24?(t<1/0&&(s=setTimeout(m,t-h.now()-f)),u&&(u=clearInterval(u))):(u||(c=h.now(),u=setInterval(b,1e3)),a=1,d(m)))}v.prototype=y.prototype={constructor:v,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?p():+n)+(null==e?0:+e),this._next||o===this||(o?o._next=this:i=this,o=this),this._call=t,this._time=n,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}}}]).default}));
37
+ */(function(){var a="Expected a function",s="__lodash_placeholder__",u=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",l="[object Array]",f="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",g="[object GeneratorFunction]",v="[object Map]",y="[object Number]",m="[object Object]",b="[object RegExp]",x="[object Set]",_="[object String]",w="[object Symbol]",E="[object WeakMap]",S="[object ArrayBuffer]",O="[object DataView]",M="[object Float32Array]",k="[object Float64Array]",A="[object Int8Array]",C="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",j="[object Uint16Array]",P="[object Uint32Array]",N=/\b__p \+= '';/g,D=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,F=RegExp(R.source),G=RegExp(B.source),z=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,V=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Y=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,q=RegExp(H.source),K=/^\s+/,Z=/\s/,Q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,tt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,et=/[()=,{}\[\]\/\s]/,nt=/\\(\\)?/g,rt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,ot=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,st=/^\[object .+?Constructor\]$/,ut=/^0o[0-7]+$/i,ct=/^(?:0|[1-9]\d*)$/,lt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,ht=/['\n\r\u2028\u2029\\]/g,dt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",gt="[\\ud800-\\udfff]",vt="["+pt+"]",yt="["+dt+"]",mt="\\d+",bt="[\\u2700-\\u27bf]",xt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+pt+mt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",wt="\\ud83c[\\udffb-\\udfff]",Et="[^\\ud800-\\udfff]",St="(?:\\ud83c[\\udde6-\\uddff]){2}",Ot="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",kt="(?:"+xt+"|"+_t+")",At="(?:"+Mt+"|"+_t+")",Ct="(?:"+yt+"|"+wt+")"+"?",Tt="[\\ufe0e\\ufe0f]?"+Ct+("(?:\\u200d(?:"+[Et,St,Ot].join("|")+")[\\ufe0e\\ufe0f]?"+Ct+")*"),It="(?:"+[bt,St,Ot].join("|")+")"+Tt,jt="(?:"+[Et+yt+"?",yt,St,Ot,gt].join("|")+")",Pt=RegExp("['’]","g"),Nt=RegExp(yt,"g"),Dt=RegExp(wt+"(?="+wt+")|"+jt+Tt,"g"),Lt=RegExp([Mt+"?"+xt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[vt,Mt,"$"].join("|")+")",At+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[vt,Mt+kt,"$"].join("|")+")",Mt+"?"+kt+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Mt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mt,It].join("|"),"g"),Rt=RegExp("[\\u200d\\ud800-\\udfff"+dt+"\\ufe0e\\ufe0f]"),Bt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ft=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Gt=-1,zt={};zt[M]=zt[k]=zt[A]=zt[C]=zt[T]=zt[I]=zt["[object Uint8ClampedArray]"]=zt[j]=zt[P]=!0,zt[c]=zt[l]=zt[S]=zt[f]=zt[O]=zt[h]=zt[d]=zt[p]=zt[v]=zt[y]=zt[m]=zt[b]=zt[x]=zt[_]=zt[E]=!1;var Ut={};Ut[c]=Ut[l]=Ut[S]=Ut[O]=Ut[f]=Ut[h]=Ut[M]=Ut[k]=Ut[A]=Ut[C]=Ut[T]=Ut[v]=Ut[y]=Ut[m]=Ut[b]=Ut[x]=Ut[_]=Ut[w]=Ut[I]=Ut["[object Uint8ClampedArray]"]=Ut[j]=Ut[P]=!0,Ut[d]=Ut[p]=Ut[E]=!1;var Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Wt=parseFloat,Xt=parseInt,Yt="object"==(void 0===t?"undefined":o(t))&&t&&t.Object===Object&&t,Ht="object"==("undefined"==typeof self?"undefined":o(self))&&self&&self.Object===Object&&self,qt=Yt||Ht||Function("return this")(),Kt="object"==o(e)&&e&&!e.nodeType&&e,Zt=Kt&&"object"==o(r)&&r&&!r.nodeType&&r,Qt=Zt&&Zt.exports===Kt,$t=Qt&&Yt.process,Jt=function(){try{var t=Zt&&Zt.require&&Zt.require("util").types;return t||$t&&$t.binding&&$t.binding("util")}catch(t){}}(),te=Jt&&Jt.isArrayBuffer,ee=Jt&&Jt.isDate,ne=Jt&&Jt.isMap,re=Jt&&Jt.isRegExp,ie=Jt&&Jt.isSet,oe=Jt&&Jt.isTypedArray;function ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function se(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function ue(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function le(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function fe(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function he(t,e){return!!(null==t?0:t.length)&&we(t,e,0)>-1}function de(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function ge(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function ve(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ye(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function me(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var be=Me("length");function xe(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function _e(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function we(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):_e(t,Se,n)}function Ee(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Se(t){return t!=t}function Oe(t,e){var n=null==t?0:t.length;return n?Ce(t,e)/n:NaN}function Me(t){return function(e){return null==e?void 0:e[t]}}function ke(t){return function(e){return null==t?void 0:t[e]}}function Ae(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Ce(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Te(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ie(t){return t?t.slice(0,Ke(t)+1).replace(K,""):t}function je(t){return function(e){return t(e)}}function Pe(t,e){return pe(e,(function(e){return t[e]}))}function Ne(t,e){return t.has(e)}function De(t,e){for(var n=-1,r=t.length;++n<r&&we(e,t[n],0)>-1;);return n}function Le(t,e){for(var n=t.length;n--&&we(e,t[n],0)>-1;);return n}function Re(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Be=ke({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Fe=ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Ge(t){return"\\"+Vt[t]}function ze(t){return Rt.test(t)}function Ue(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function Ve(t,e){return function(n){return t(e(n))}}function We(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[i++]=n)}return o}function Xe(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function Ye(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function He(t){return ze(t)?function(t){var e=Dt.lastIndex=0;for(;Dt.test(t);)++e;return e}(t):be(t)}function qe(t){return ze(t)?function(t){return t.match(Dt)||[]}(t):function(t){return t.split("")}(t)}function Ke(t){for(var e=t.length;e--&&Z.test(t.charAt(e)););return e}var Ze=ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Qe=function t(e){var n,r=(e=null==e?qt:Qe.defaults(qt.Object(),e,Qe.pick(qt,Ft))).Array,i=e.Date,Z=e.Error,dt=e.Function,pt=e.Math,gt=e.Object,vt=e.RegExp,yt=e.String,mt=e.TypeError,bt=r.prototype,xt=dt.prototype,_t=gt.prototype,wt=e["__core-js_shared__"],Et=xt.toString,St=_t.hasOwnProperty,Ot=0,Mt=(n=/[^.]+$/.exec(wt&&wt.keys&&wt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",kt=_t.toString,At=Et.call(gt),Ct=qt._,Tt=vt("^"+Et.call(St).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=Qt?e.Buffer:void 0,jt=e.Symbol,Dt=e.Uint8Array,Rt=It?It.allocUnsafe:void 0,Vt=Ve(gt.getPrototypeOf,gt),Yt=gt.create,Ht=_t.propertyIsEnumerable,Kt=bt.splice,Zt=jt?jt.isConcatSpreadable:void 0,$t=jt?jt.iterator:void 0,Jt=jt?jt.toStringTag:void 0,be=function(){try{var t=eo(gt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ke=e.clearTimeout!==qt.clearTimeout&&e.clearTimeout,$e=i&&i.now!==qt.Date.now&&i.now,Je=e.setTimeout!==qt.setTimeout&&e.setTimeout,tn=pt.ceil,en=pt.floor,nn=gt.getOwnPropertySymbols,rn=It?It.isBuffer:void 0,on=e.isFinite,an=bt.join,sn=Ve(gt.keys,gt),un=pt.max,cn=pt.min,ln=i.now,fn=e.parseInt,hn=pt.random,dn=bt.reverse,pn=eo(e,"DataView"),gn=eo(e,"Map"),vn=eo(e,"Promise"),yn=eo(e,"Set"),mn=eo(e,"WeakMap"),bn=eo(gt,"create"),xn=mn&&new mn,_n={},wn=Co(pn),En=Co(gn),Sn=Co(vn),On=Co(yn),Mn=Co(mn),kn=jt?jt.prototype:void 0,An=kn?kn.valueOf:void 0,Cn=kn?kn.toString:void 0;function Tn(t){if(Ya(t)&&!Da(t)&&!(t instanceof Nn)){if(t instanceof Pn)return t;if(St.call(t,"__wrapped__"))return To(t)}return new Pn(t)}var In=function(){function t(){}return function(e){if(!Xa(e))return{};if(Yt)return Yt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function jn(){}function Pn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Nn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Dn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Bn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Rn;++e<n;)this.add(t[e])}function Fn(t){var e=this.__data__=new Ln(t);this.size=e.size}function Gn(t,e){var n=Da(t),r=!n&&Na(t),i=!n&&!r&&Fa(t),o=!n&&!r&&!i&&ts(t),a=n||r||i||o,s=a?Te(t.length,yt):[],u=s.length;for(var c in t)!e&&!St.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||uo(c,u))||s.push(c);return s}function zn(t){var e=t.length;return e?t[Br(0,e-1)]:void 0}function Un(t,e){return Mo(bi(t),Qn(e,0,t.length))}function Vn(t){return Mo(bi(t))}function Wn(t,e,n){(void 0!==n&&!Ia(t[e],n)||void 0===n&&!(e in t))&&Kn(t,e,n)}function Xn(t,e,n){var r=t[e];St.call(t,e)&&Ia(r,n)&&(void 0!==n||e in t)||Kn(t,e,n)}function Yn(t,e){for(var n=t.length;n--;)if(Ia(t[n][0],e))return n;return-1}function Hn(t,e,n,r){return nr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function qn(t,e){return t&&xi(e,ws(e),t)}function Kn(t,e,n){"__proto__"==e&&be?be(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Zn(t,e){for(var n=-1,i=e.length,o=r(i),a=null==t;++n<i;)o[n]=a?void 0:ys(t,e[n]);return o}function Qn(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function $n(t,e,n,r,i,o){var a,s=1&e,u=2&e,l=4&e;if(n&&(a=i?n(t,r,i,o):n(t)),void 0!==a)return a;if(!Xa(t))return t;var d=Da(t);if(d){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&St.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!s)return bi(t,a)}else{var E=io(t),N=E==p||E==g;if(Fa(t))return di(t,s);if(E==m||E==c||N&&!i){if(a=u||N?{}:ao(t),!s)return u?function(t,e){return xi(t,ro(t),e)}(t,function(t,e){return t&&xi(e,Es(e),t)}(a,t)):function(t,e){return xi(t,no(t),e)}(t,qn(a,t))}else{if(!Ut[E])return i?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case S:return pi(t);case f:case h:return new r(+t);case O:return function(t,e){var n=e?pi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case M:case k:case A:case C:case T:case I:case"[object Uint8ClampedArray]":case j:case P:return gi(t,n);case v:return new r;case y:case _:return new r(t);case b:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case x:return new r;case w:return i=t,An?gt(An.call(i)):{}}var i}(t,E,s)}}o||(o=new Fn);var D=o.get(t);if(D)return D;o.set(t,a),Qa(t)?t.forEach((function(r){a.add($n(r,e,n,r,t,o))})):Ha(t)&&t.forEach((function(r,i){a.set(i,$n(r,e,n,i,t,o))}));var L=d?void 0:(l?u?qi:Hi:u?Es:ws)(t);return ue(L||t,(function(r,i){L&&(r=t[i=r]),Xn(a,i,$n(r,e,n,i,t,o))})),a}function Jn(t,e,n){var r=n.length;if(null==t)return!r;for(t=gt(t);r--;){var i=n[r],o=e[i],a=t[i];if(void 0===a&&!(i in t)||!o(a))return!1}return!0}function tr(t,e,n){if("function"!=typeof t)throw new mt(a);return wo((function(){t.apply(void 0,n)}),e)}function er(t,e,n,r){var i=-1,o=he,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=pe(e,je(n))),r?(o=de,a=!1):e.length>=200&&(o=Ne,a=!1,e=new Bn(e));t:for(;++i<s;){var l=t[i],f=null==n?l:n(l);if(l=r||0!==l?l:0,a&&f==f){for(var h=c;h--;)if(e[h]===f)continue t;u.push(l)}else o(e,f,r)||u.push(l)}return u}Tn.templateSettings={escape:z,evaluate:U,interpolate:V,variable:"",imports:{_:Tn}},Tn.prototype=jn.prototype,Tn.prototype.constructor=Tn,Pn.prototype=In(jn.prototype),Pn.prototype.constructor=Pn,Nn.prototype=In(jn.prototype),Nn.prototype.constructor=Nn,Dn.prototype.clear=function(){this.__data__=bn?bn(null):{},this.size=0},Dn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Dn.prototype.get=function(t){var e=this.__data__;if(bn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return St.call(e,t)?e[t]:void 0},Dn.prototype.has=function(t){var e=this.__data__;return bn?void 0!==e[t]:St.call(e,t)},Dn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=bn&&void 0===e?"__lodash_hash_undefined__":e,this},Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(t){var e=this.__data__,n=Yn(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Ln.prototype.get=function(t){var e=this.__data__,n=Yn(e,t);return n<0?void 0:e[n][1]},Ln.prototype.has=function(t){return Yn(this.__data__,t)>-1},Ln.prototype.set=function(t,e){var n=this.__data__,r=Yn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Rn.prototype.clear=function(){this.size=0,this.__data__={hash:new Dn,map:new(gn||Ln),string:new Dn}},Rn.prototype.delete=function(t){var e=Ji(this,t).delete(t);return this.size-=e?1:0,e},Rn.prototype.get=function(t){return Ji(this,t).get(t)},Rn.prototype.has=function(t){return Ji(this,t).has(t)},Rn.prototype.set=function(t,e){var n=Ji(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Bn.prototype.add=Bn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Bn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.clear=function(){this.__data__=new Ln,this.size=0},Fn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Fn.prototype.get=function(t){return this.__data__.get(t)},Fn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ln){var r=n.__data__;if(!gn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Rn(r)}return n.set(t,e),this.size=n.size,this};var nr=Ei(lr),rr=Ei(fr,!0);function ir(t,e){var n=!0;return nr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function or(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===s?a==a&&!Ja(a):n(a,s)))var s=a,u=o}return u}function ar(t,e){var n=[];return nr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function sr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=so),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?sr(s,e-1,n,r,i):ge(i,s):r||(i[i.length]=s)}return i}var ur=Si(),cr=Si(!0);function lr(t,e){return t&&ur(t,e,ws)}function fr(t,e){return t&&cr(t,e,ws)}function hr(t,e){return fe(e,(function(e){return Ua(t[e])}))}function dr(t,e){for(var n=0,r=(e=ci(e,t)).length;null!=t&&n<r;)t=t[Ao(e[n++])];return n&&n==r?t:void 0}function pr(t,e,n){var r=e(t);return Da(t)?r:ge(r,n(t))}function gr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Jt&&Jt in gt(t)?function(t){var e=St.call(t,Jt),n=t[Jt];try{t[Jt]=void 0;var r=!0}catch(t){}var i=kt.call(t);r&&(e?t[Jt]=n:delete t[Jt]);return i}(t):function(t){return kt.call(t)}(t)}function vr(t,e){return t>e}function yr(t,e){return null!=t&&St.call(t,e)}function mr(t,e){return null!=t&&e in gt(t)}function br(t,e,n){for(var i=n?de:he,o=t[0].length,a=t.length,s=a,u=r(a),c=1/0,l=[];s--;){var f=t[s];s&&e&&(f=pe(f,je(e))),c=cn(f.length,c),u[s]=!n&&(e||o>=120&&f.length>=120)?new Bn(s&&f):void 0}f=t[0];var h=-1,d=u[0];t:for(;++h<o&&l.length<c;){var p=f[h],g=e?e(p):p;if(p=n||0!==p?p:0,!(d?Ne(d,g):i(l,g,n))){for(s=a;--s;){var v=u[s];if(!(v?Ne(v,g):i(t[s],g,n)))continue t}d&&d.push(g),l.push(p)}}return l}function xr(t,e,n){var r=null==(t=mo(t,e=ci(e,t)))?t:t[Ao(zo(e))];return null==r?void 0:ae(r,t,n)}function _r(t){return Ya(t)&&gr(t)==c}function wr(t,e,n,r,i){return t===e||(null==t||null==e||!Ya(t)&&!Ya(e)?t!=t&&e!=e:function(t,e,n,r,i,o){var a=Da(t),s=Da(e),u=a?l:io(t),p=s?l:io(e),g=(u=u==c?m:u)==m,E=(p=p==c?m:p)==m,M=u==p;if(M&&Fa(t)){if(!Fa(e))return!1;a=!0,g=!1}if(M&&!g)return o||(o=new Fn),a||ts(t)?Xi(t,e,n,r,i,o):function(t,e,n,r,i,o,a){switch(n){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case S:return!(t.byteLength!=e.byteLength||!o(new Dt(t),new Dt(e)));case f:case h:case y:return Ia(+t,+e);case d:return t.name==e.name&&t.message==e.message;case b:case _:return t==e+"";case v:var s=Ue;case x:var u=1&r;if(s||(s=Xe),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Xi(s(t),s(e),r,i,o,a);return a.delete(t),l;case w:if(An)return An.call(t)==An.call(e)}return!1}(t,e,u,n,r,i,o);if(!(1&n)){var k=g&&St.call(t,"__wrapped__"),A=E&&St.call(e,"__wrapped__");if(k||A){var C=k?t.value():t,T=A?e.value():e;return o||(o=new Fn),i(C,T,n,r,o)}}if(!M)return!1;return o||(o=new Fn),function(t,e,n,r,i,o){var a=1&n,s=Hi(t),u=s.length,c=Hi(e).length;if(u!=c&&!a)return!1;var l=u;for(;l--;){var f=s[l];if(!(a?f in e:St.call(e,f)))return!1}var h=o.get(t),d=o.get(e);if(h&&d)return h==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);var g=a;for(;++l<u;){f=s[l];var v=t[f],y=e[f];if(r)var m=a?r(y,v,f,e,t,o):r(v,y,f,t,e,o);if(!(void 0===m?v===y||i(v,y,n,r,o):m)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=e.constructor;b==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o)}(t,e,n,r,wr,i))}function Er(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=gt(t);i--;){var s=n[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var u=(s=n[i])[0],c=t[u],l=s[1];if(a&&s[2]){if(void 0===c&&!(u in t))return!1}else{var f=new Fn;if(r)var h=r(c,l,u,t,e,f);if(!(void 0===h?wr(l,c,3,r,f):h))return!1}}return!0}function Sr(t){return!(!Xa(t)||(e=t,Mt&&Mt in e))&&(Ua(t)?Tt:st).test(Co(t));var e}function Or(t){return"function"==typeof t?t:null==t?qs:"object"==o(t)?Da(t)?Ir(t[0],t[1]):Tr(t):ru(t)}function Mr(t){if(!po(t))return sn(t);var e=[];for(var n in gt(t))St.call(t,n)&&"constructor"!=n&&e.push(n);return e}function kr(t){if(!Xa(t))return function(t){var e=[];if(null!=t)for(var n in gt(t))e.push(n);return e}(t);var e=po(t),n=[];for(var r in t)("constructor"!=r||!e&&St.call(t,r))&&n.push(r);return n}function Ar(t,e){return t<e}function Cr(t,e){var n=-1,i=Ra(t)?r(t.length):[];return nr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Tr(t){var e=to(t);return 1==e.length&&e[0][2]?vo(e[0][0],e[0][1]):function(n){return n===t||Er(n,t,e)}}function Ir(t,e){return lo(t)&&go(e)?vo(Ao(t),e):function(n){var r=ys(n,t);return void 0===r&&r===e?ms(n,t):wr(e,r,3)}}function jr(t,e,n,r,i){t!==e&&ur(e,(function(o,a){if(i||(i=new Fn),Xa(o))!function(t,e,n,r,i,o,a){var s=xo(t,n),u=xo(e,n),c=a.get(u);if(c)return void Wn(t,n,c);var l=o?o(s,u,n+"",t,e,a):void 0,f=void 0===l;if(f){var h=Da(u),d=!h&&Fa(u),p=!h&&!d&&ts(u);l=u,h||d||p?Da(s)?l=s:Ba(s)?l=bi(s):d?(f=!1,l=di(u,!0)):p?(f=!1,l=gi(u,!0)):l=[]:Ka(u)||Na(u)?(l=s,Na(s)?l=us(s):Xa(s)&&!Ua(s)||(l=ao(u))):f=!1}f&&(a.set(u,l),i(l,u,r,o,a),a.delete(u));Wn(t,n,l)}(t,e,a,n,jr,r,i);else{var s=r?r(xo(t,a),o,a+"",t,e,i):void 0;void 0===s&&(s=o),Wn(t,a,s)}}),Es)}function Pr(t,e){var n=t.length;if(n)return uo(e+=e<0?n:0,n)?t[e]:void 0}function Nr(t,e,n){e=e.length?pe(e,(function(t){return Da(t)?function(e){return dr(e,1===t.length?t[0]:t)}:t})):[qs];var r=-1;return e=pe(e,je($i())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Cr(t,(function(t,n,i){return{criteria:pe(e,(function(e){return e(t)})),index:++r,value:t}})),(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;for(;++r<a;){var u=vi(i[r],o[r]);if(u){if(r>=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return t.index-e.index}(t,e,n)}))}function Dr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=dr(t,a);n(s,a)&&Vr(o,ci(a,t),s)}return o}function Lr(t,e,n,r){var i=r?Ee:we,o=-1,a=e.length,s=t;for(t===e&&(e=bi(e)),n&&(s=pe(t,je(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Kt.call(s,u,1),Kt.call(t,u,1);return t}function Rr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;uo(i)?Kt.call(t,i,1):ei(t,i)}}return t}function Br(t,e){return t+en(hn()*(e-t+1))}function Fr(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=en(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(yo(t,e,qs),t+"")}function zr(t){return zn(Is(t))}function Ur(t,e){var n=Is(t);return Mo(n,Qn(e,0,n.length))}function Vr(t,e,n,r){if(!Xa(t))return t;for(var i=-1,o=(e=ci(e,t)).length,a=o-1,s=t;null!=s&&++i<o;){var u=Ao(e[i]),c=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(i!=a){var l=s[u];void 0===(c=r?r(l,u,s):void 0)&&(c=Xa(l)?l:uo(e[i+1])?[]:{})}Xn(s,u,c),s=s[u]}return t}var Wr=xn?function(t,e){return xn.set(t,e),t}:qs,Xr=be?function(t,e){return be(t,"toString",{configurable:!0,enumerable:!1,value:Xs(e),writable:!0})}:qs;function Yr(t){return Mo(Is(t))}function Hr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=r(o);++i<o;)a[i]=t[i+e];return a}function qr(t,e){var n;return nr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function Kr(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!Ja(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return Zr(t,e,qs,n)}function Zr(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,s=null===e,u=Ja(e),c=void 0===e;i<o;){var l=en((i+o)/2),f=n(t[l]),h=void 0!==f,d=null===f,p=f==f,g=Ja(f);if(a)var v=r||p;else v=c?p&&(r||h):s?p&&h&&(r||!d):u?p&&h&&!d&&(r||!g):!d&&!g&&(r?f<=e:f<e);v?i=l+1:o=l}return cn(o,4294967294)}function Qr(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Ia(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function $r(t){return"number"==typeof t?t:Ja(t)?NaN:+t}function Jr(t){if("string"==typeof t)return t;if(Da(t))return pe(t,Jr)+"";if(Ja(t))return Cn?Cn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ti(t,e,n){var r=-1,i=he,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=de;else if(o>=200){var c=e?null:Fi(t);if(c)return Xe(c);a=!1,i=Ne,u=new Bn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],f=e?e(l):l;if(l=n||0!==l?l:0,a&&f==f){for(var h=u.length;h--;)if(u[h]===f)continue t;e&&u.push(f),s.push(l)}else i(u,f,n)||(u!==s&&u.push(f),s.push(l))}return s}function ei(t,e){return null==(t=mo(t,e=ci(e,t)))||delete t[Ao(zo(e))]}function ni(t,e,n,r){return Vr(t,e,n(dr(t,e)),r)}function ri(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?Hr(t,r?0:o,r?o+1:i):Hr(t,r?o+1:0,r?i:o)}function ii(t,e){var n=t;return n instanceof Nn&&(n=n.value()),ve(e,(function(t,e){return e.func.apply(e.thisArg,ge([t],e.args))}),n)}function oi(t,e,n){var i=t.length;if(i<2)return i?ti(t[0]):[];for(var o=-1,a=r(i);++o<i;)for(var s=t[o],u=-1;++u<i;)u!=o&&(a[o]=er(a[o]||s,t[u],e,n));return ti(sr(a,1),e,n)}function ai(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var s=r<o?e[r]:void 0;n(a,t[r],s)}return a}function si(t){return Ba(t)?t:[]}function ui(t){return"function"==typeof t?t:qs}function ci(t,e){return Da(t)?t:lo(t,e)?[t]:ko(cs(t))}var li=Gr;function fi(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:Hr(t,e,n)}var hi=ke||function(t){return qt.clearTimeout(t)};function di(t,e){if(e)return t.slice();var n=t.length,r=Rt?Rt(n):new t.constructor(n);return t.copy(r),r}function pi(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function gi(t,e){var n=e?pi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function vi(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Ja(t),a=void 0!==e,s=null===e,u=e==e,c=Ja(e);if(!s&&!c&&!o&&t>e||o&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!i)return 1;if(!r&&!o&&!c&&t<e||c&&n&&i&&!r&&!o||s&&n&&i||!a&&i||!u)return-1}return 0}function yi(t,e,n,i){for(var o=-1,a=t.length,s=n.length,u=-1,c=e.length,l=un(a-s,0),f=r(c+l),h=!i;++u<c;)f[u]=e[u];for(;++o<s;)(h||o<a)&&(f[n[o]]=t[o]);for(;l--;)f[u++]=t[o++];return f}function mi(t,e,n,i){for(var o=-1,a=t.length,s=-1,u=n.length,c=-1,l=e.length,f=un(a-u,0),h=r(f+l),d=!i;++o<f;)h[o]=t[o];for(var p=o;++c<l;)h[p+c]=e[c];for(;++s<u;)(d||o<a)&&(h[p+n[s]]=t[o++]);return h}function bi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function xi(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var s=e[o],u=r?r(n[s],t[s],s,n,t):void 0;void 0===u&&(u=t[s]),i?Kn(n,s,u):Xn(n,s,u)}return n}function _i(t,e){return function(n,r){var i=Da(n)?se:Hn,o=e?e():{};return i(n,t,$i(r,2),o)}}function wi(t){return Gr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&co(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=gt(e);++r<i;){var s=n[r];s&&t(e,s,r,o)}return e}))}function Ei(t,e){return function(n,r){if(null==n)return n;if(!Ra(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=gt(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Si(t){return function(e,n,r){for(var i=-1,o=gt(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Oi(t){return function(e){var n=ze(e=cs(e))?qe(e):void 0,r=n?n[0]:e.charAt(0),i=n?fi(n,1).join(""):e.slice(1);return r[t]()+i}}function Mi(t){return function(e){return ve(Us(Ns(e).replace(Pt,"")),t,"")}}function ki(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=In(t.prototype),r=t.apply(n,e);return Xa(r)?r:n}}function Ai(t){return function(e,n,r){var i=gt(e);if(!Ra(e)){var o=$i(n,3);e=ws(e),n=function(t){return o(i[t],t,i)}}var a=t(e,n,r);return a>-1?i[o?e[a]:a]:void 0}}function Ci(t){return Yi((function(e){var n=e.length,r=n,i=Pn.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new mt(a);if(i&&!s&&"wrapper"==Zi(o))var s=new Pn([],!0)}for(r=s?r:n;++r<n;){var u=Zi(o=e[r]),c="wrapper"==u?Ki(o):void 0;s=c&&fo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Zi(c[0])].apply(s,c[3]):1==o.length&&fo(o)?s[u]():s.thru(o)}return function(){var t=arguments,r=t[0];if(s&&1==t.length&&Da(r))return s.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Ti(t,e,n,i,o,a,s,u,c,l){var f=128&e,h=1&e,d=2&e,p=24&e,g=512&e,v=d?void 0:ki(t);return function y(){for(var m=arguments.length,b=r(m),x=m;x--;)b[x]=arguments[x];if(p)var _=Qi(y),w=Re(b,_);if(i&&(b=yi(b,i,o,p)),a&&(b=mi(b,a,s,p)),m-=w,p&&m<l){var E=We(b,_);return Ri(t,e,Ti,y.placeholder,n,b,E,u,c,l-m)}var S=h?n:this,O=d?S[t]:t;return m=b.length,u?b=bo(b,u):g&&m>1&&b.reverse(),f&&c<m&&(b.length=c),this&&this!==qt&&this instanceof y&&(O=v||ki(O)),O.apply(S,b)}}function Ii(t,e){return function(n,r){return function(t,e,n,r){return lr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function ji(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Jr(n),r=Jr(r)):(n=$r(n),r=$r(r)),i=t(n,r)}return i}}function Pi(t){return Yi((function(e){return e=pe(e,je($i())),Gr((function(n){var r=this;return t(e,(function(t){return ae(t,r,n)}))}))}))}function Ni(t,e){var n=(e=void 0===e?" ":Jr(e)).length;if(n<2)return n?Fr(e,t):e;var r=Fr(e,tn(t/He(e)));return ze(e)?fi(qe(r),0,t).join(""):r.slice(0,t)}function Di(t){return function(e,n,i){return i&&"number"!=typeof i&&co(e,n,i)&&(n=i=void 0),e=is(e),void 0===n?(n=e,e=0):n=is(n),function(t,e,n,i){for(var o=-1,a=un(tn((e-t)/(n||1)),0),s=r(a);a--;)s[i?a:++o]=t,t+=n;return s}(e,n,i=void 0===i?e<n?1:-1:is(i),t)}}function Li(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ss(e),n=ss(n)),t(e,n)}}function Ri(t,e,n,r,i,o,a,s,u,c){var l=8&e;e|=l?32:64,4&(e&=~(l?64:32))||(e&=-4);var f=[t,e,i,l?o:void 0,l?a:void 0,l?void 0:o,l?void 0:a,s,u,c],h=n.apply(void 0,f);return fo(t)&&_o(h,f),h.placeholder=r,So(h,t,e)}function Bi(t){var e=pt[t];return function(t,n){if(t=ss(t),(n=null==n?0:cn(os(n),292))&&on(t)){var r=(cs(t)+"e").split("e");return+((r=(cs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Fi=yn&&1/Xe(new yn([,-0]))[1]==1/0?function(t){return new yn(t)}:Js;function Gi(t){return function(e){var n=io(e);return n==v?Ue(e):n==x?Ye(e):function(t,e){return pe(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function zi(t,e,n,i,o,u,c,l){var f=2&e;if(!f&&"function"!=typeof t)throw new mt(a);var h=i?i.length:0;if(h||(e&=-97,i=o=void 0),c=void 0===c?c:un(os(c),0),l=void 0===l?l:os(l),h-=o?o.length:0,64&e){var d=i,p=o;i=o=void 0}var g=f?void 0:Ki(t),v=[t,e,n,i,o,d,p,u,c,l];if(g&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,a=128==r&&8==n||128==r&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?yi(c,u,e[4]):u,t[4]=c?We(t[3],s):e[4]}(u=e[5])&&(c=t[5],t[5]=c?mi(c,u,e[6]):u,t[6]=c?We(t[5],s):e[6]);(u=e[7])&&(t[7]=u);128&r&&(t[8]=null==t[8]?e[8]:cn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(v,g),t=v[0],e=v[1],n=v[2],i=v[3],o=v[4],!(l=v[9]=void 0===v[9]?f?0:t.length:un(v[9]-h,0))&&24&e&&(e&=-25),e&&1!=e)y=8==e||16==e?function(t,e,n){var i=ki(t);return function o(){for(var a=arguments.length,s=r(a),u=a,c=Qi(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:We(s,c);if((a-=l.length)<n)return Ri(t,e,Ti,o.placeholder,void 0,s,l,void 0,void 0,n-a);var f=this&&this!==qt&&this instanceof o?i:t;return ae(f,this,s)}}(t,e,l):32!=e&&33!=e||o.length?Ti.apply(void 0,v):function(t,e,n,i){var o=1&e,a=ki(t);return function e(){for(var s=-1,u=arguments.length,c=-1,l=i.length,f=r(l+u),h=this&&this!==qt&&this instanceof e?a:t;++c<l;)f[c]=i[c];for(;u--;)f[c++]=arguments[++s];return ae(h,o?n:this,f)}}(t,e,n,i);else var y=function(t,e,n){var r=1&e,i=ki(t);return function e(){var o=this&&this!==qt&&this instanceof e?i:t;return o.apply(r?n:this,arguments)}}(t,e,n);return So((g?Wr:_o)(y,v),t,e)}function Ui(t,e,n,r){return void 0===t||Ia(t,_t[n])&&!St.call(r,n)?e:t}function Vi(t,e,n,r,i,o){return Xa(t)&&Xa(e)&&(o.set(e,t),jr(t,e,void 0,Vi,o),o.delete(e)),t}function Wi(t){return Ka(t)?void 0:t}function Xi(t,e,n,r,i,o){var a=1&n,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=o.get(t),l=o.get(e);if(c&&l)return c==e&&l==t;var f=-1,h=!0,d=2&n?new Bn:void 0;for(o.set(t,e),o.set(e,t);++f<s;){var p=t[f],g=e[f];if(r)var v=a?r(g,p,f,e,t,o):r(p,g,f,t,e,o);if(void 0!==v){if(v)continue;h=!1;break}if(d){if(!me(e,(function(t,e){if(!Ne(d,e)&&(p===t||i(p,t,n,r,o)))return d.push(e)}))){h=!1;break}}else if(p!==g&&!i(p,g,n,r,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function Yi(t){return Eo(yo(t,void 0,Lo),t+"")}function Hi(t){return pr(t,ws,no)}function qi(t){return pr(t,Es,ro)}var Ki=xn?function(t){return xn.get(t)}:Js;function Zi(t){for(var e=t.name+"",n=_n[e],r=St.call(_n,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Qi(t){return(St.call(Tn,"placeholder")?Tn:t).placeholder}function $i(){var t=Tn.iteratee||Ks;return t=t===Ks?Or:t,arguments.length?t(arguments[0],arguments[1]):t}function Ji(t,e){var n,r,i=t.__data__;return("string"==(r=o(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function to(t){for(var e=ws(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,go(i)]}return e}function eo(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Sr(n)?n:void 0}var no=nn?function(t){return null==t?[]:(t=gt(t),fe(nn(t),(function(e){return Ht.call(t,e)})))}:au,ro=nn?function(t){for(var e=[];t;)ge(e,no(t)),t=Vt(t);return e}:au,io=gr;function oo(t,e,n){for(var r=-1,i=(e=ci(e,t)).length,o=!1;++r<i;){var a=Ao(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Wa(i)&&uo(a,i)&&(Da(t)||Na(t))}function ao(t){return"function"!=typeof t.constructor||po(t)?{}:In(Vt(t))}function so(t){return Da(t)||Na(t)||!!(Zt&&t&&t[Zt])}function uo(t,e){var n=o(t);return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ct.test(t))&&t>-1&&t%1==0&&t<e}function co(t,e,n){if(!Xa(n))return!1;var r=o(e);return!!("number"==r?Ra(n)&&uo(e,n.length):"string"==r&&e in n)&&Ia(n[e],t)}function lo(t,e){if(Da(t))return!1;var n=o(t);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ja(t))||(X.test(t)||!W.test(t)||null!=e&&t in gt(e))}function fo(t){var e=Zi(t),n=Tn[e];if("function"!=typeof n||!(e in Nn.prototype))return!1;if(t===n)return!0;var r=Ki(n);return!!r&&t===r[0]}(pn&&io(new pn(new ArrayBuffer(1)))!=O||gn&&io(new gn)!=v||vn&&"[object Promise]"!=io(vn.resolve())||yn&&io(new yn)!=x||mn&&io(new mn)!=E)&&(io=function(t){var e=gr(t),n=e==m?t.constructor:void 0,r=n?Co(n):"";if(r)switch(r){case wn:return O;case En:return v;case Sn:return"[object Promise]";case On:return x;case Mn:return E}return e});var ho=wt?Ua:su;function po(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function go(t){return t==t&&!Xa(t)}function vo(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in gt(n)))}}function yo(t,e,n){return e=un(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,a=un(i.length-e,0),s=r(a);++o<a;)s[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(s),ae(t,this,u)}}function mo(t,e){return e.length<2?t:dr(t,Hr(e,0,-1))}function bo(t,e){for(var n=t.length,r=cn(e.length,n),i=bi(t);r--;){var o=e[r];t[r]=uo(o,n)?i[o]:void 0}return t}function xo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var _o=Oo(Wr),wo=Je||function(t,e){return qt.setTimeout(t,e)},Eo=Oo(Xr);function So(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Q,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ue(u,(function(n){var r="_."+n[0];e&n[1]&&!he(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match($);return e?e[1].split(J):[]}(r),n)))}function Oo(t){var e=0,n=0;return function(){var r=ln(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Mo(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=Br(n,i),a=t[o];t[o]=t[n],t[n]=a}return t.length=e,t}var ko=function(t){var e=Oa(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Y,(function(t,n,r,i){e.push(r?i.replace(nt,"$1"):n||t)})),e}));function Ao(t){if("string"==typeof t||Ja(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Co(t){if(null!=t){try{return Et.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function To(t){if(t instanceof Nn)return t.clone();var e=new Pn(t.__wrapped__,t.__chain__);return e.__actions__=bi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Io=Gr((function(t,e){return Ba(t)?er(t,sr(e,1,Ba,!0)):[]})),jo=Gr((function(t,e){var n=zo(e);return Ba(n)&&(n=void 0),Ba(t)?er(t,sr(e,1,Ba,!0),$i(n,2)):[]})),Po=Gr((function(t,e){var n=zo(e);return Ba(n)&&(n=void 0),Ba(t)?er(t,sr(e,1,Ba,!0),void 0,n):[]}));function No(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:os(n);return i<0&&(i=un(r+i,0)),_e(t,$i(e,3),i)}function Do(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=os(n),i=n<0?un(r+i,0):cn(i,r-1)),_e(t,$i(e,3),i,!0)}function Lo(t){return(null==t?0:t.length)?sr(t,1):[]}function Ro(t){return t&&t.length?t[0]:void 0}var Bo=Gr((function(t){var e=pe(t,si);return e.length&&e[0]===t[0]?br(e):[]})),Fo=Gr((function(t){var e=zo(t),n=pe(t,si);return e===zo(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?br(n,$i(e,2)):[]})),Go=Gr((function(t){var e=zo(t),n=pe(t,si);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?br(n,void 0,e):[]}));function zo(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Uo=Gr(Vo);function Vo(t,e){return t&&t.length&&e&&e.length?Lr(t,e):t}var Wo=Yi((function(t,e){var n=null==t?0:t.length,r=Zn(t,e);return Rr(t,pe(e,(function(t){return uo(t,n)?+t:t})).sort(vi)),r}));function Xo(t){return null==t?t:dn.call(t)}var Yo=Gr((function(t){return ti(sr(t,1,Ba,!0))})),Ho=Gr((function(t){var e=zo(t);return Ba(e)&&(e=void 0),ti(sr(t,1,Ba,!0),$i(e,2))})),qo=Gr((function(t){var e=zo(t);return e="function"==typeof e?e:void 0,ti(sr(t,1,Ba,!0),void 0,e)}));function Ko(t){if(!t||!t.length)return[];var e=0;return t=fe(t,(function(t){if(Ba(t))return e=un(t.length,e),!0})),Te(e,(function(e){return pe(t,Me(e))}))}function Zo(t,e){if(!t||!t.length)return[];var n=Ko(t);return null==e?n:pe(n,(function(t){return ae(e,void 0,t)}))}var Qo=Gr((function(t,e){return Ba(t)?er(t,e):[]})),$o=Gr((function(t){return oi(fe(t,Ba))})),Jo=Gr((function(t){var e=zo(t);return Ba(e)&&(e=void 0),oi(fe(t,Ba),$i(e,2))})),ta=Gr((function(t){var e=zo(t);return e="function"==typeof e?e:void 0,oi(fe(t,Ba),void 0,e)})),ea=Gr(Ko);var na=Gr((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Zo(t,n)}));function ra(t){var e=Tn(t);return e.__chain__=!0,e}function ia(t,e){return e(t)}var oa=Yi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Zn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Nn&&uo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:ia,args:[i],thisArg:void 0}),new Pn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));var aa=_i((function(t,e,n){St.call(t,n)?++t[n]:Kn(t,n,1)}));var sa=Ai(No),ua=Ai(Do);function ca(t,e){return(Da(t)?ue:nr)(t,$i(e,3))}function la(t,e){return(Da(t)?ce:rr)(t,$i(e,3))}var fa=_i((function(t,e,n){St.call(t,n)?t[n].push(e):Kn(t,n,[e])}));var ha=Gr((function(t,e,n){var i=-1,o="function"==typeof e,a=Ra(t)?r(t.length):[];return nr(t,(function(t){a[++i]=o?ae(e,t,n):xr(t,e,n)})),a})),da=_i((function(t,e,n){Kn(t,n,e)}));function pa(t,e){return(Da(t)?pe:Cr)(t,$i(e,3))}var ga=_i((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var va=Gr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&co(t,e[0],e[1])?e=[]:n>2&&co(e[0],e[1],e[2])&&(e=[e[0]]),Nr(t,sr(e,1),[])})),ya=$e||function(){return qt.Date.now()};function ma(t,e,n){return e=n?void 0:e,zi(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ba(t,e){var n;if("function"!=typeof e)throw new mt(a);return t=os(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var xa=Gr((function(t,e,n){var r=1;if(n.length){var i=We(n,Qi(xa));r|=32}return zi(t,r,e,n,i)})),_a=Gr((function(t,e,n){var r=3;if(n.length){var i=We(n,Qi(_a));r|=32}return zi(e,r,t,n,i)}));function wa(t,e,n){var r,i,o,s,u,c,l=0,f=!1,h=!1,d=!0;if("function"!=typeof t)throw new mt(a);function p(e){var n=r,o=i;return r=i=void 0,l=e,s=t.apply(o,n)}function g(t){return l=t,u=wo(y,e),f?p(t):s}function v(t){var n=t-c;return void 0===c||n>=e||n<0||h&&t-l>=o}function y(){var t=ya();if(v(t))return m(t);u=wo(y,function(t){var n=e-(t-c);return h?cn(n,o-(t-l)):n}(t))}function m(t){return u=void 0,d&&r?p(t):(r=i=void 0,s)}function b(){var t=ya(),n=v(t);if(r=arguments,i=this,c=t,n){if(void 0===u)return g(c);if(h)return hi(u),u=wo(y,e),p(c)}return void 0===u&&(u=wo(y,e)),s}return e=ss(e)||0,Xa(n)&&(f=!!n.leading,o=(h="maxWait"in n)?un(ss(n.maxWait)||0,e):o,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==u&&hi(u),l=0,r=c=i=u=void 0},b.flush=function(){return void 0===u?s:m(ya())},b}var Ea=Gr((function(t,e){return tr(t,1,e)})),Sa=Gr((function(t,e,n){return tr(t,ss(e)||0,n)}));function Oa(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new mt(a);var n=function n(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Oa.Cache||Rn),n}function Ma(t){if("function"!=typeof t)throw new mt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Oa.Cache=Rn;var ka=li((function(t,e){var n=(e=1==e.length&&Da(e[0])?pe(e[0],je($i())):pe(sr(e,1),je($i()))).length;return Gr((function(r){for(var i=-1,o=cn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return ae(t,this,r)}))})),Aa=Gr((function(t,e){return zi(t,32,void 0,e,We(e,Qi(Aa)))})),Ca=Gr((function(t,e){return zi(t,64,void 0,e,We(e,Qi(Ca)))})),Ta=Yi((function(t,e){return zi(t,256,void 0,void 0,void 0,e)}));function Ia(t,e){return t===e||t!=t&&e!=e}var ja=Li(vr),Pa=Li((function(t,e){return t>=e})),Na=_r(function(){return arguments}())?_r:function(t){return Ya(t)&&St.call(t,"callee")&&!Ht.call(t,"callee")},Da=r.isArray,La=te?je(te):function(t){return Ya(t)&&gr(t)==S};function Ra(t){return null!=t&&Wa(t.length)&&!Ua(t)}function Ba(t){return Ya(t)&&Ra(t)}var Fa=rn||su,Ga=ee?je(ee):function(t){return Ya(t)&&gr(t)==h};function za(t){if(!Ya(t))return!1;var e=gr(t);return e==d||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ka(t)}function Ua(t){if(!Xa(t))return!1;var e=gr(t);return e==p||e==g||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Va(t){return"number"==typeof t&&t==os(t)}function Wa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Xa(t){var e=o(t);return null!=t&&("object"==e||"function"==e)}function Ya(t){return null!=t&&"object"==o(t)}var Ha=ne?je(ne):function(t){return Ya(t)&&io(t)==v};function qa(t){return"number"==typeof t||Ya(t)&&gr(t)==y}function Ka(t){if(!Ya(t)||gr(t)!=m)return!1;var e=Vt(t);if(null===e)return!0;var n=St.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Et.call(n)==At}var Za=re?je(re):function(t){return Ya(t)&&gr(t)==b};var Qa=ie?je(ie):function(t){return Ya(t)&&io(t)==x};function $a(t){return"string"==typeof t||!Da(t)&&Ya(t)&&gr(t)==_}function Ja(t){return"symbol"==o(t)||Ya(t)&&gr(t)==w}var ts=oe?je(oe):function(t){return Ya(t)&&Wa(t.length)&&!!zt[gr(t)]};var es=Li(Ar),ns=Li((function(t,e){return t<=e}));function rs(t){if(!t)return[];if(Ra(t))return $a(t)?qe(t):bi(t);if($t&&t[$t])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[$t]());var e=io(t);return(e==v?Ue:e==x?Xe:Is)(t)}function is(t){return t?(t=ss(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function os(t){var e=is(t),n=e%1;return e==e?n?e-n:e:0}function as(t){return t?Qn(os(t),0,4294967295):0}function ss(t){if("number"==typeof t)return t;if(Ja(t))return NaN;if(Xa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Xa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ie(t);var n=at.test(t);return n||ut.test(t)?Xt(t.slice(2),n?2:8):ot.test(t)?NaN:+t}function us(t){return xi(t,Es(t))}function cs(t){return null==t?"":Jr(t)}var ls=wi((function(t,e){if(po(e)||Ra(e))xi(e,ws(e),t);else for(var n in e)St.call(e,n)&&Xn(t,n,e[n])})),fs=wi((function(t,e){xi(e,Es(e),t)})),hs=wi((function(t,e,n,r){xi(e,Es(e),t,r)})),ds=wi((function(t,e,n,r){xi(e,ws(e),t,r)})),ps=Yi(Zn);var gs=Gr((function(t,e){t=gt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&co(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=Es(o),s=-1,u=a.length;++s<u;){var c=a[s],l=t[c];(void 0===l||Ia(l,_t[c])&&!St.call(t,c))&&(t[c]=o[c])}return t})),vs=Gr((function(t){return t.push(void 0,Vi),ae(Os,void 0,t)}));function ys(t,e,n){var r=null==t?void 0:dr(t,e);return void 0===r?n:r}function ms(t,e){return null!=t&&oo(t,e,mr)}var bs=Ii((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=kt.call(e)),t[e]=n}),Xs(qs)),xs=Ii((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=kt.call(e)),St.call(t,e)?t[e].push(n):t[e]=[n]}),$i),_s=Gr(xr);function ws(t){return Ra(t)?Gn(t):Mr(t)}function Es(t){return Ra(t)?Gn(t,!0):kr(t)}var Ss=wi((function(t,e,n){jr(t,e,n)})),Os=wi((function(t,e,n,r){jr(t,e,n,r)})),Ms=Yi((function(t,e){var n={};if(null==t)return n;var r=!1;e=pe(e,(function(e){return e=ci(e,t),r||(r=e.length>1),e})),xi(t,qi(t),n),r&&(n=$n(n,7,Wi));for(var i=e.length;i--;)ei(n,e[i]);return n}));var ks=Yi((function(t,e){return null==t?{}:function(t,e){return Dr(t,e,(function(e,n){return ms(t,n)}))}(t,e)}));function As(t,e){if(null==t)return{};var n=pe(qi(t),(function(t){return[t]}));return e=$i(e),Dr(t,n,(function(t,n){return e(t,n[0])}))}var Cs=Gi(ws),Ts=Gi(Es);function Is(t){return null==t?[]:Pe(t,ws(t))}var js=Mi((function(t,e,n){return e=e.toLowerCase(),t+(n?Ps(e):e)}));function Ps(t){return zs(cs(t).toLowerCase())}function Ns(t){return(t=cs(t))&&t.replace(lt,Be).replace(Nt,"")}var Ds=Mi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ls=Mi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Rs=Oi("toLowerCase");var Bs=Mi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Fs=Mi((function(t,e,n){return t+(n?" ":"")+zs(e)}));var Gs=Mi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),zs=Oi("toUpperCase");function Us(t,e,n){return t=cs(t),void 0===(e=n?void 0:e)?function(t){return Bt.test(t)}(t)?function(t){return t.match(Lt)||[]}(t):function(t){return t.match(tt)||[]}(t):t.match(e)||[]}var Vs=Gr((function(t,e){try{return ae(t,void 0,e)}catch(t){return za(t)?t:new Z(t)}})),Ws=Yi((function(t,e){return ue(e,(function(e){e=Ao(e),Kn(t,e,xa(t[e],t))})),t}));function Xs(t){return function(){return t}}var Ys=Ci(),Hs=Ci(!0);function qs(t){return t}function Ks(t){return Or("function"==typeof t?t:$n(t,1))}var Zs=Gr((function(t,e){return function(n){return xr(n,t,e)}})),Qs=Gr((function(t,e){return function(n){return xr(t,n,e)}}));function $s(t,e,n){var r=ws(e),i=hr(e,r);null!=n||Xa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=hr(e,ws(e)));var o=!(Xa(n)&&"chain"in n&&!n.chain),a=Ua(t);return ue(i,(function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=bi(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,ge([this.value()],arguments))})})),t}function Js(){}var tu=Pi(pe),eu=Pi(le),nu=Pi(me);function ru(t){return lo(t)?Me(Ao(t)):function(t){return function(e){return dr(e,t)}}(t)}var iu=Di(),ou=Di(!0);function au(){return[]}function su(){return!1}var uu=ji((function(t,e){return t+e}),0),cu=Bi("ceil"),lu=ji((function(t,e){return t/e}),1),fu=Bi("floor");var hu,du=ji((function(t,e){return t*e}),1),pu=Bi("round"),gu=ji((function(t,e){return t-e}),0);return Tn.after=function(t,e){if("function"!=typeof e)throw new mt(a);return t=os(t),function(){if(--t<1)return e.apply(this,arguments)}},Tn.ary=ma,Tn.assign=ls,Tn.assignIn=fs,Tn.assignInWith=hs,Tn.assignWith=ds,Tn.at=ps,Tn.before=ba,Tn.bind=xa,Tn.bindAll=Ws,Tn.bindKey=_a,Tn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Da(t)?t:[t]},Tn.chain=ra,Tn.chunk=function(t,e,n){e=(n?co(t,e,n):void 0===e)?1:un(os(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=r(tn(i/e));o<i;)s[a++]=Hr(t,o,o+=e);return s},Tn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Tn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return ge(Da(n)?bi(n):[n],sr(e,1))},Tn.cond=function(t){var e=null==t?0:t.length,n=$i();return t=e?pe(t,(function(t){if("function"!=typeof t[1])throw new mt(a);return[n(t[0]),t[1]]})):[],Gr((function(n){for(var r=-1;++r<e;){var i=t[r];if(ae(i[0],this,n))return ae(i[1],this,n)}}))},Tn.conforms=function(t){return function(t){var e=ws(t);return function(n){return Jn(n,t,e)}}($n(t,1))},Tn.constant=Xs,Tn.countBy=aa,Tn.create=function(t,e){var n=In(t);return null==e?n:qn(n,e)},Tn.curry=function t(e,n,r){var i=zi(e,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Tn.curryRight=function t(e,n,r){var i=zi(e,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Tn.debounce=wa,Tn.defaults=gs,Tn.defaultsDeep=vs,Tn.defer=Ea,Tn.delay=Sa,Tn.difference=Io,Tn.differenceBy=jo,Tn.differenceWith=Po,Tn.drop=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,(e=n||void 0===e?1:os(e))<0?0:e,r):[]},Tn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,0,(e=r-(e=n||void 0===e?1:os(e)))<0?0:e):[]},Tn.dropRightWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!0,!0):[]},Tn.dropWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!0):[]},Tn.fill=function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&co(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=os(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:os(r))<0&&(r+=i),r=n>r?0:as(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Tn.filter=function(t,e){return(Da(t)?fe:ar)(t,$i(e,3))},Tn.flatMap=function(t,e){return sr(pa(t,e),1)},Tn.flatMapDeep=function(t,e){return sr(pa(t,e),1/0)},Tn.flatMapDepth=function(t,e,n){return n=void 0===n?1:os(n),sr(pa(t,e),n)},Tn.flatten=Lo,Tn.flattenDeep=function(t){return(null==t?0:t.length)?sr(t,1/0):[]},Tn.flattenDepth=function(t,e){return(null==t?0:t.length)?sr(t,e=void 0===e?1:os(e)):[]},Tn.flip=function(t){return zi(t,512)},Tn.flow=Ys,Tn.flowRight=Hs,Tn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Tn.functions=function(t){return null==t?[]:hr(t,ws(t))},Tn.functionsIn=function(t){return null==t?[]:hr(t,Es(t))},Tn.groupBy=fa,Tn.initial=function(t){return(null==t?0:t.length)?Hr(t,0,-1):[]},Tn.intersection=Bo,Tn.intersectionBy=Fo,Tn.intersectionWith=Go,Tn.invert=bs,Tn.invertBy=xs,Tn.invokeMap=ha,Tn.iteratee=Ks,Tn.keyBy=da,Tn.keys=ws,Tn.keysIn=Es,Tn.map=pa,Tn.mapKeys=function(t,e){var n={};return e=$i(e,3),lr(t,(function(t,r,i){Kn(n,e(t,r,i),t)})),n},Tn.mapValues=function(t,e){var n={};return e=$i(e,3),lr(t,(function(t,r,i){Kn(n,r,e(t,r,i))})),n},Tn.matches=function(t){return Tr($n(t,1))},Tn.matchesProperty=function(t,e){return Ir(t,$n(e,1))},Tn.memoize=Oa,Tn.merge=Ss,Tn.mergeWith=Os,Tn.method=Zs,Tn.methodOf=Qs,Tn.mixin=$s,Tn.negate=Ma,Tn.nthArg=function(t){return t=os(t),Gr((function(e){return Pr(e,t)}))},Tn.omit=Ms,Tn.omitBy=function(t,e){return As(t,Ma($i(e)))},Tn.once=function(t){return ba(2,t)},Tn.orderBy=function(t,e,n,r){return null==t?[]:(Da(e)||(e=null==e?[]:[e]),Da(n=r?void 0:n)||(n=null==n?[]:[n]),Nr(t,e,n))},Tn.over=tu,Tn.overArgs=ka,Tn.overEvery=eu,Tn.overSome=nu,Tn.partial=Aa,Tn.partialRight=Ca,Tn.partition=ga,Tn.pick=ks,Tn.pickBy=As,Tn.property=ru,Tn.propertyOf=function(t){return function(e){return null==t?void 0:dr(t,e)}},Tn.pull=Uo,Tn.pullAll=Vo,Tn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Lr(t,e,$i(n,2)):t},Tn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Lr(t,e,void 0,n):t},Tn.pullAt=Wo,Tn.range=iu,Tn.rangeRight=ou,Tn.rearg=Ta,Tn.reject=function(t,e){return(Da(t)?fe:ar)(t,Ma($i(e,3)))},Tn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=$i(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return Rr(t,i),n},Tn.rest=function(t,e){if("function"!=typeof t)throw new mt(a);return Gr(t,e=void 0===e?e:os(e))},Tn.reverse=Xo,Tn.sampleSize=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:os(e),(Da(t)?Un:Ur)(t,e)},Tn.set=function(t,e,n){return null==t?t:Vr(t,e,n)},Tn.setWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Vr(t,e,n,r)},Tn.shuffle=function(t){return(Da(t)?Vn:Yr)(t)},Tn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&co(t,e,n)?(e=0,n=r):(e=null==e?0:os(e),n=void 0===n?r:os(n)),Hr(t,e,n)):[]},Tn.sortBy=va,Tn.sortedUniq=function(t){return t&&t.length?Qr(t):[]},Tn.sortedUniqBy=function(t,e){return t&&t.length?Qr(t,$i(e,2)):[]},Tn.split=function(t,e,n){return n&&"number"!=typeof n&&co(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=cs(t))&&("string"==typeof e||null!=e&&!Za(e))&&!(e=Jr(e))&&ze(t)?fi(qe(t),0,n):t.split(e,n):[]},Tn.spread=function(t,e){if("function"!=typeof t)throw new mt(a);return e=null==e?0:un(os(e),0),Gr((function(n){var r=n[e],i=fi(n,0,e);return r&&ge(i,r),ae(t,this,i)}))},Tn.tail=function(t){var e=null==t?0:t.length;return e?Hr(t,1,e):[]},Tn.take=function(t,e,n){return t&&t.length?Hr(t,0,(e=n||void 0===e?1:os(e))<0?0:e):[]},Tn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?Hr(t,(e=r-(e=n||void 0===e?1:os(e)))<0?0:e,r):[]},Tn.takeRightWhile=function(t,e){return t&&t.length?ri(t,$i(e,3),!1,!0):[]},Tn.takeWhile=function(t,e){return t&&t.length?ri(t,$i(e,3)):[]},Tn.tap=function(t,e){return e(t),t},Tn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new mt(a);return Xa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),wa(t,e,{leading:r,maxWait:e,trailing:i})},Tn.thru=ia,Tn.toArray=rs,Tn.toPairs=Cs,Tn.toPairsIn=Ts,Tn.toPath=function(t){return Da(t)?pe(t,Ao):Ja(t)?[t]:bi(ko(cs(t)))},Tn.toPlainObject=us,Tn.transform=function(t,e,n){var r=Da(t),i=r||Fa(t)||ts(t);if(e=$i(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Xa(t)&&Ua(o)?In(Vt(t)):{}}return(i?ue:lr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Tn.unary=function(t){return ma(t,1)},Tn.union=Yo,Tn.unionBy=Ho,Tn.unionWith=qo,Tn.uniq=function(t){return t&&t.length?ti(t):[]},Tn.uniqBy=function(t,e){return t&&t.length?ti(t,$i(e,2)):[]},Tn.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?ti(t,void 0,e):[]},Tn.unset=function(t,e){return null==t||ei(t,e)},Tn.unzip=Ko,Tn.unzipWith=Zo,Tn.update=function(t,e,n){return null==t?t:ni(t,e,ui(n))},Tn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ni(t,e,ui(n),r)},Tn.values=Is,Tn.valuesIn=function(t){return null==t?[]:Pe(t,Es(t))},Tn.without=Qo,Tn.words=Us,Tn.wrap=function(t,e){return Aa(ui(e),t)},Tn.xor=$o,Tn.xorBy=Jo,Tn.xorWith=ta,Tn.zip=ea,Tn.zipObject=function(t,e){return ai(t||[],e||[],Xn)},Tn.zipObjectDeep=function(t,e){return ai(t||[],e||[],Vr)},Tn.zipWith=na,Tn.entries=Cs,Tn.entriesIn=Ts,Tn.extend=fs,Tn.extendWith=hs,$s(Tn,Tn),Tn.add=uu,Tn.attempt=Vs,Tn.camelCase=js,Tn.capitalize=Ps,Tn.ceil=cu,Tn.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=ss(n))==n?n:0),void 0!==e&&(e=(e=ss(e))==e?e:0),Qn(ss(t),e,n)},Tn.clone=function(t){return $n(t,4)},Tn.cloneDeep=function(t){return $n(t,5)},Tn.cloneDeepWith=function(t,e){return $n(t,5,e="function"==typeof e?e:void 0)},Tn.cloneWith=function(t,e){return $n(t,4,e="function"==typeof e?e:void 0)},Tn.conformsTo=function(t,e){return null==e||Jn(t,e,ws(e))},Tn.deburr=Ns,Tn.defaultTo=function(t,e){return null==t||t!=t?e:t},Tn.divide=lu,Tn.endsWith=function(t,e,n){t=cs(t),e=Jr(e);var r=t.length,i=n=void 0===n?r:Qn(os(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},Tn.eq=Ia,Tn.escape=function(t){return(t=cs(t))&&G.test(t)?t.replace(B,Fe):t},Tn.escapeRegExp=function(t){return(t=cs(t))&&q.test(t)?t.replace(H,"\\$&"):t},Tn.every=function(t,e,n){var r=Da(t)?le:ir;return n&&co(t,e,n)&&(e=void 0),r(t,$i(e,3))},Tn.find=sa,Tn.findIndex=No,Tn.findKey=function(t,e){return xe(t,$i(e,3),lr)},Tn.findLast=ua,Tn.findLastIndex=Do,Tn.findLastKey=function(t,e){return xe(t,$i(e,3),fr)},Tn.floor=fu,Tn.forEach=ca,Tn.forEachRight=la,Tn.forIn=function(t,e){return null==t?t:ur(t,$i(e,3),Es)},Tn.forInRight=function(t,e){return null==t?t:cr(t,$i(e,3),Es)},Tn.forOwn=function(t,e){return t&&lr(t,$i(e,3))},Tn.forOwnRight=function(t,e){return t&&fr(t,$i(e,3))},Tn.get=ys,Tn.gt=ja,Tn.gte=Pa,Tn.has=function(t,e){return null!=t&&oo(t,e,yr)},Tn.hasIn=ms,Tn.head=Ro,Tn.identity=qs,Tn.includes=function(t,e,n,r){t=Ra(t)?t:Is(t),n=n&&!r?os(n):0;var i=t.length;return n<0&&(n=un(i+n,0)),$a(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&we(t,e,n)>-1},Tn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:os(n);return i<0&&(i=un(r+i,0)),we(t,e,i)},Tn.inRange=function(t,e,n){return e=is(e),void 0===n?(n=e,e=0):n=is(n),function(t,e,n){return t>=cn(e,n)&&t<un(e,n)}(t=ss(t),e,n)},Tn.invoke=_s,Tn.isArguments=Na,Tn.isArray=Da,Tn.isArrayBuffer=La,Tn.isArrayLike=Ra,Tn.isArrayLikeObject=Ba,Tn.isBoolean=function(t){return!0===t||!1===t||Ya(t)&&gr(t)==f},Tn.isBuffer=Fa,Tn.isDate=Ga,Tn.isElement=function(t){return Ya(t)&&1===t.nodeType&&!Ka(t)},Tn.isEmpty=function(t){if(null==t)return!0;if(Ra(t)&&(Da(t)||"string"==typeof t||"function"==typeof t.splice||Fa(t)||ts(t)||Na(t)))return!t.length;var e=io(t);if(e==v||e==x)return!t.size;if(po(t))return!Mr(t).length;for(var n in t)if(St.call(t,n))return!1;return!0},Tn.isEqual=function(t,e){return wr(t,e)},Tn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?wr(t,e,void 0,n):!!r},Tn.isError=za,Tn.isFinite=function(t){return"number"==typeof t&&on(t)},Tn.isFunction=Ua,Tn.isInteger=Va,Tn.isLength=Wa,Tn.isMap=Ha,Tn.isMatch=function(t,e){return t===e||Er(t,e,to(e))},Tn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:void 0,Er(t,e,to(e),n)},Tn.isNaN=function(t){return qa(t)&&t!=+t},Tn.isNative=function(t){if(ho(t))throw new Z("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Sr(t)},Tn.isNil=function(t){return null==t},Tn.isNull=function(t){return null===t},Tn.isNumber=qa,Tn.isObject=Xa,Tn.isObjectLike=Ya,Tn.isPlainObject=Ka,Tn.isRegExp=Za,Tn.isSafeInteger=function(t){return Va(t)&&t>=-9007199254740991&&t<=9007199254740991},Tn.isSet=Qa,Tn.isString=$a,Tn.isSymbol=Ja,Tn.isTypedArray=ts,Tn.isUndefined=function(t){return void 0===t},Tn.isWeakMap=function(t){return Ya(t)&&io(t)==E},Tn.isWeakSet=function(t){return Ya(t)&&"[object WeakSet]"==gr(t)},Tn.join=function(t,e){return null==t?"":an.call(t,e)},Tn.kebabCase=Ds,Tn.last=zo,Tn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=os(n))<0?un(r+i,0):cn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,Se,i,!0)},Tn.lowerCase=Ls,Tn.lowerFirst=Rs,Tn.lt=es,Tn.lte=ns,Tn.max=function(t){return t&&t.length?or(t,qs,vr):void 0},Tn.maxBy=function(t,e){return t&&t.length?or(t,$i(e,2),vr):void 0},Tn.mean=function(t){return Oe(t,qs)},Tn.meanBy=function(t,e){return Oe(t,$i(e,2))},Tn.min=function(t){return t&&t.length?or(t,qs,Ar):void 0},Tn.minBy=function(t,e){return t&&t.length?or(t,$i(e,2),Ar):void 0},Tn.stubArray=au,Tn.stubFalse=su,Tn.stubObject=function(){return{}},Tn.stubString=function(){return""},Tn.stubTrue=function(){return!0},Tn.multiply=du,Tn.nth=function(t,e){return t&&t.length?Pr(t,os(e)):void 0},Tn.noConflict=function(){return qt._===this&&(qt._=Ct),this},Tn.noop=Js,Tn.now=ya,Tn.pad=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Ni(en(i),n)+t+Ni(tn(i),n)},Tn.padEnd=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;return e&&r<e?t+Ni(e-r,n):t},Tn.padStart=function(t,e,n){t=cs(t);var r=(e=os(e))?He(t):0;return e&&r<e?Ni(e-r,n)+t:t},Tn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),fn(cs(t).replace(K,""),e||0)},Tn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&co(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=is(t),void 0===e?(e=t,t=0):e=is(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=hn();return cn(t+i*(e-t+Wt("1e-"+((i+"").length-1))),e)}return Br(t,e)},Tn.reduce=function(t,e,n){var r=Da(t)?ve:Ae,i=arguments.length<3;return r(t,$i(e,4),n,i,nr)},Tn.reduceRight=function(t,e,n){var r=Da(t)?ye:Ae,i=arguments.length<3;return r(t,$i(e,4),n,i,rr)},Tn.repeat=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:os(e),Fr(cs(t),e)},Tn.replace=function(){var t=arguments,e=cs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Tn.result=function(t,e,n){var r=-1,i=(e=ci(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[Ao(e[r])];void 0===o&&(r=i,o=n),t=Ua(o)?o.call(t):o}return t},Tn.round=pu,Tn.runInContext=t,Tn.sample=function(t){return(Da(t)?zn:zr)(t)},Tn.size=function(t){if(null==t)return 0;if(Ra(t))return $a(t)?He(t):t.length;var e=io(t);return e==v||e==x?t.size:Mr(t).length},Tn.snakeCase=Bs,Tn.some=function(t,e,n){var r=Da(t)?me:qr;return n&&co(t,e,n)&&(e=void 0),r(t,$i(e,3))},Tn.sortedIndex=function(t,e){return Kr(t,e)},Tn.sortedIndexBy=function(t,e,n){return Zr(t,e,$i(n,2))},Tn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=Kr(t,e);if(r<n&&Ia(t[r],e))return r}return-1},Tn.sortedLastIndex=function(t,e){return Kr(t,e,!0)},Tn.sortedLastIndexBy=function(t,e,n){return Zr(t,e,$i(n,2),!0)},Tn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=Kr(t,e,!0)-1;if(Ia(t[n],e))return n}return-1},Tn.startCase=Fs,Tn.startsWith=function(t,e,n){return t=cs(t),n=null==n?0:Qn(os(n),0,t.length),e=Jr(e),t.slice(n,n+e.length)==e},Tn.subtract=gu,Tn.sum=function(t){return t&&t.length?Ce(t,qs):0},Tn.sumBy=function(t,e){return t&&t.length?Ce(t,$i(e,2)):0},Tn.template=function(t,e,n){var r=Tn.templateSettings;n&&co(t,e,n)&&(e=void 0),t=cs(t),e=hs({},e,r,Ui);var i,o,a=hs({},e.imports,r.imports,Ui),s=ws(a),u=Pe(a,s),c=0,l=e.interpolate||ft,f="__p += '",h=vt((e.escape||ft).source+"|"+l.source+"|"+(l===V?rt:ft).source+"|"+(e.evaluate||ft).source+"|$","g"),d="//# sourceURL="+(St.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Gt+"]")+"\n";t.replace(h,(function(e,n,r,a,s,u){return r||(r=a),f+=t.slice(c,u).replace(ht,Ge),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(o=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=u+e.length,e})),f+="';\n";var p=St.call(e,"variable")&&e.variable;if(p){if(et.test(p))throw new Z("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(N,""):f).replace(D,"$1").replace(L,"$1;"),f="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=Vs((function(){return dt(s,d+"return "+f).apply(void 0,u)}));if(g.source=f,za(g))throw g;return g},Tn.times=function(t,e){if((t=os(t))<1||t>9007199254740991)return[];var n=4294967295,r=cn(t,4294967295);t-=4294967295;for(var i=Te(r,e=$i(e));++n<t;)e(n);return i},Tn.toFinite=is,Tn.toInteger=os,Tn.toLength=as,Tn.toLower=function(t){return cs(t).toLowerCase()},Tn.toNumber=ss,Tn.toSafeInteger=function(t){return t?Qn(os(t),-9007199254740991,9007199254740991):0===t?t:0},Tn.toString=cs,Tn.toUpper=function(t){return cs(t).toUpperCase()},Tn.trim=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return Ie(t);if(!t||!(e=Jr(e)))return t;var r=qe(t),i=qe(e);return fi(r,De(r,i),Le(r,i)+1).join("")},Tn.trimEnd=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return t.slice(0,Ke(t)+1);if(!t||!(e=Jr(e)))return t;var r=qe(t);return fi(r,0,Le(r,qe(e))+1).join("")},Tn.trimStart=function(t,e,n){if((t=cs(t))&&(n||void 0===e))return t.replace(K,"");if(!t||!(e=Jr(e)))return t;var r=qe(t);return fi(r,De(r,qe(e))).join("")},Tn.truncate=function(t,e){var n=30,r="...";if(Xa(e)){var i="separator"in e?e.separator:i;n="length"in e?os(e.length):n,r="omission"in e?Jr(e.omission):r}var o=(t=cs(t)).length;if(ze(t)){var a=qe(t);o=a.length}if(n>=o)return t;var s=n-He(r);if(s<1)return r;var u=a?fi(a,0,s).join(""):t.slice(0,s);if(void 0===i)return u+r;if(a&&(s+=u.length-s),Za(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=vt(i.source,cs(it.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,void 0===f?s:f)}}else if(t.indexOf(Jr(i),s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Tn.unescape=function(t){return(t=cs(t))&&F.test(t)?t.replace(R,Ze):t},Tn.uniqueId=function(t){var e=++Ot;return cs(t)+e},Tn.upperCase=Gs,Tn.upperFirst=zs,Tn.each=ca,Tn.eachRight=la,Tn.first=Ro,$s(Tn,(hu={},lr(Tn,(function(t,e){St.call(Tn.prototype,e)||(hu[e]=t)})),hu),{chain:!1}),Tn.VERSION="4.17.21",ue(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Tn[t].placeholder=Tn})),ue(["drop","take"],(function(t,e){Nn.prototype[t]=function(n){n=void 0===n?1:un(os(n),0);var r=this.__filtered__&&!e?new Nn(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},Nn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ue(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Nn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:$i(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ue(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Nn.prototype[t]=function(){return this[n](1).value()[0]}})),ue(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Nn.prototype[t]=function(){return this.__filtered__?new Nn(this):this[n](1)}})),Nn.prototype.compact=function(){return this.filter(qs)},Nn.prototype.find=function(t){return this.filter(t).head()},Nn.prototype.findLast=function(t){return this.reverse().find(t)},Nn.prototype.invokeMap=Gr((function(t,e){return"function"==typeof t?new Nn(this):this.map((function(n){return xr(n,t,e)}))})),Nn.prototype.reject=function(t){return this.filter(Ma($i(t)))},Nn.prototype.slice=function(t,e){t=os(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Nn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=os(e))<0?n.dropRight(-e):n.take(e-t)),n)},Nn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Nn.prototype.toArray=function(){return this.take(4294967295)},lr(Nn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=Tn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(Tn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof Nn,u=a[0],c=s||Da(e),l=function(t){var e=i.apply(Tn,ge([t],a));return r&&f?e[0]:e};c&&n&&"function"==typeof u&&1!=u.length&&(s=c=!1);var f=this.__chain__,h=!!this.__actions__.length,d=o&&!f,p=s&&!h;if(!o&&c){e=p?e:new Nn(this);var g=t.apply(e,a);return g.__actions__.push({func:ia,args:[l],thisArg:void 0}),new Pn(g,f)}return d&&p?t.apply(this,a):(g=this.thru(l),d?r?g.value()[0]:g.value():g)})})),ue(["pop","push","shift","sort","splice","unshift"],(function(t){var e=bt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Tn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Da(i)?i:[],t)}return this[n]((function(n){return e.apply(Da(n)?n:[],t)}))}})),lr(Nn.prototype,(function(t,e){var n=Tn[e];if(n){var r=n.name+"";St.call(_n,r)||(_n[r]=[]),_n[r].push({name:e,func:n})}})),_n[Ti(void 0,2).name]=[{name:"wrapper",func:void 0}],Nn.prototype.clone=function(){var t=new Nn(this.__wrapped__);return t.__actions__=bi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=bi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=bi(this.__views__),t},Nn.prototype.reverse=function(){if(this.__filtered__){var t=new Nn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Nn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Da(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=cn(e,t+a);break;case"takeRight":t=un(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,h=0,d=cn(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return ii(t,this.__actions__);var p=[];t:for(;u--&&h<d;){for(var g=-1,v=t[c+=e];++g<f;){var y=l[g],m=y.iteratee,b=y.type,x=m(v);if(2==b)v=x;else if(!x){if(1==b)continue t;break t}}p[h++]=v}return p},Tn.prototype.at=oa,Tn.prototype.chain=function(){return ra(this)},Tn.prototype.commit=function(){return new Pn(this.value(),this.__chain__)},Tn.prototype.next=function(){void 0===this.__values__&&(this.__values__=rs(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Tn.prototype.plant=function(t){for(var e,n=this;n instanceof jn;){var r=To(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},Tn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Nn){var e=t;return this.__actions__.length&&(e=new Nn(this)),(e=e.reverse()).__actions__.push({func:ia,args:[Xo],thisArg:void 0}),new Pn(e,this.__chain__)}return this.thru(Xo)},Tn.prototype.toJSON=Tn.prototype.valueOf=Tn.prototype.value=function(){return ii(this.__wrapped__,this.__actions__)},Tn.prototype.first=Tn.prototype.head,$t&&(Tn.prototype[$t]=function(){return this}),Tn}();"object"==o(n(152))&&n(152)?(qt._=Qe,void 0===(i=function(){return Qe}.call(e,n,e,r))||(r.exports=i)):Zt?((Zt.exports=Qe)._=Qe,Kt._=Qe):qt._=Qe}).call(this)}).call(this,n(151),n(120)(t))},function(t,e){t.exports="2.1.4"},function(t,e,n){var r=n(44),i=n(119);function o(t){return r.map(t.nodes(),(function(e){var n=t.node(e),i=t.parent(e),o={v:e};return r.isUndefined(n)||(o.value=n),r.isUndefined(i)||(o.parent=i),o}))}function a(t){return r.map(t.edges(),(function(e){var n=t.edge(e),i={v:e.v,w:e.w};return r.isUndefined(e.name)||(i.name=e.name),r.isUndefined(n)||(i.value=n),i}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:o(t),edges:a(t)};r.isUndefined(t.graph())||(e.value=r.clone(t.graph()));return e},read:function(t){var e=new i(t.options).setGraph(t.value);return r.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),r.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},function(t,e,n){t.exports={components:n(269),dijkstra:n(153),dijkstraAll:n(270),findCycles:n(271),floydWarshall:n(272),isAcyclic:n(273),postorder:n(274),preorder:n(275),prim:n(276),tarjan:n(155),topsort:n(156)}},function(t,e,n){var r=n(44);t.exports=function(t){var e,n={},i=[];function o(i){r.has(n,i)||(n[i]=!0,e.push(i),r.each(t.successors(i),o),r.each(t.predecessors(i),o))}return r.each(t.nodes(),(function(t){e=[],o(t),e.length&&i.push(e)})),i}},function(t,e,n){var r=n(153),i=n(44);t.exports=function(t,e,n){return i.transform(t.nodes(),(function(i,o){i[o]=r(t,o,e,n)}),{})}},function(t,e,n){var r=n(44),i=n(155);t.exports=function(t){return r.filter(i(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},function(t,e,n){var r=n(44);t.exports=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)}))}))})),r}(t,e||i,n||function(e){return t.outEdges(e)})};var i=r.constant(1)},function(t,e,n){var r=n(156);t.exports=function(t){try{r(t)}catch(t){if(t instanceof r.CycleException)return!1;throw t}return!0}},function(t,e,n){var r=n(157);t.exports=function(t,e){return r(t,e,"post")}},function(t,e,n){var r=n(157);t.exports=function(t,e){return r(t,e,"pre")}},function(t,e,n){var r=n(44),i=n(119),o=n(154);t.exports=function(t,e){var n,a=new i,s={},u=new o;function c(t){var r=t.v===n?t.w:t.v,i=u.priority(r);if(void 0!==i){var o=e(t);o<i&&(s[r]=n,u.decrease(r,o))}}if(0===t.nodeCount())return a;r.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),u.decrease(t.nodes()[0],0);var l=!1;for(;u.size()>0;){if(n=u.removeMin(),r.has(s,n))a.setEdge(n,s[n]);else{if(l)throw new Error("Input graph is not connected: "+t);l=!0}t.nodeEdges(n).forEach(c)}return a}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(n(278)),u=a(n(281)),c=a(n(282)),l=o(n(45)),f=a(n(284)),h=a(n(285)),d=a(n(286)),p=a(n(287)),g=a(n(288)),v=a(n(297)),y=a(n(52)),m=a(n(299)),b=y.default.Graph,x=function(t,e,n){e(" removeSelfEdges",(function(){z(t)})),e(" acyclic",(function(){s.default.run(t)})),e(" nestingGraph.run",(function(){h.default.run(t)})),e(" rank",(function(){(0,c.default)(l.default.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){P(t)})),e(" removeEmptyRanks",(function(){(0,l.removeEmptyRanks)(t)})),e(" nestingGraph.cleanup",(function(){h.default.cleanup(t)})),e(" normalizeRanks",(function(){(0,l.normalizeRanks)(t)})),e(" assignRankMinMax",(function(){N(t)})),e(" removeEdgeLabelProxies",(function(){D(t)})),e(" normalize.run",(function(){u.default.run(t)})),e(" parentDummyChains",(function(){(0,f.default)(t)})),e(" addBorderSegments",(function(){(0,d.default)(t)})),n&&n.keepNodeOrder&&e(" initDataOrder",(function(){(0,m.default)(t,n.nodeOrder)})),e(" order",(function(){(0,g.default)(t)})),e(" insertSelfEdges",(function(){U(t)})),e(" adjustCoordinateSystem",(function(){p.default.adjust(t)})),e(" position",(function(){(0,v.default)(t)})),e(" positionSelfEdges",(function(){V(t)})),e(" removeBorderNodes",(function(){G(t)})),e(" normalize.undo",(function(){u.default.undo(t)})),e(" fixupEdgeLabelCoords",(function(){B(t)})),e(" undoCoordinateSystem",(function(){p.default.undo(t)})),e(" translateGraph",(function(){L(t)})),e(" assignNodeIntersects",(function(){R(t)})),e(" reversePoints",(function(){F(t)})),e(" acyclic.undo",(function(){s.default.undo(t)}))},_=function(t,e){var n=e._nodes||{};t.nodes().forEach((function(e){var r=t.node(e);void 0!==n[e]?(r.fixorder=n[e]._order,delete n[e]._order):delete r.fixorder}))},w=function(t,e){t.nodes().forEach((function(n){var r,i=t.node(n),o=e.node(n);i&&(i.x=o.x,i.y=o.y,i._order=o.order,i._rank=o.rank,(null===(r=e.children(n))||void 0===r?void 0:r.length)&&(i.width=o.width,i.height=o.height))})),t.edges().forEach((function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,i.hasOwnProperty("x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height},E=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},O=["acyclicer","ranker","rankdir","align"],M=["width","height","layer","fixorder"],k={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],C={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"],I=function(t){var e=new b({multigraph:!0,compound:!0}),n=X(t.graph()),r={};return null==O||O.forEach((function(t){void 0!==n[t]&&(r[t]=n[t])})),e.setGraph(Object.assign({},S,W(n,E),r)),t.nodes().forEach((function(n){var r=X(t.node(n)),i=W(r,M);Object.keys(k).forEach((function(t){void 0===i[t]&&(i[t]=k[t])})),e.setNode(n,i),e.setParent(n,t.parent(n))})),t.edges().forEach((function(n){var r=X(t.edge(n)),i={};null==T||T.forEach((function(t){void 0!==r[t]&&(i[t]=r[t])})),e.setEdge(n,Object.assign({},C,W(r,A),i))})),e},j=function(t){var e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach((function(e){var n=t.node(e);isNaN(n.layer)||(n.layer?n.layer*=2:n.layer=0)})),t.edges().forEach((function(n){var r,i=t.edge(n);i.minlen*=2,"c"!==(null===(r=i.labelpos)||void 0===r?void 0:r.toLowerCase())&&("TB"===e.rankdir||"BT"===e.rankdir?i.width+=i.labeloffset:i.height+=i.labeloffset)}))},P=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={e:e,rank:(t.node(e.w).rank-r.rank)/2+r.rank};l.default.addDummyNode(t,"edge-proxy",i,"_ep")}}))},N=function(t){var e=0;t.nodes().forEach((function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank||-1/0))})),t.graph().maxRank=e},D=function(t){t.nodes().forEach((function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))},L=function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0,u=function(t){if(t){var o=t.x,a=t.y,s=t.width,u=t.height;isNaN(o)||isNaN(s)||(e=Math.min(e,o-s/2),n=Math.max(n,o+s/2)),isNaN(a)||isNaN(u)||(r=Math.min(r,a-u/2),i=Math.max(i,a+u/2))}};t.nodes().forEach((function(e){u(t.node(e))})),t.edges().forEach((function(e){var n=t.edge(e);n.hasOwnProperty("x")&&u(n)})),e-=a,r-=s,t.nodes().forEach((function(n){var i=t.node(n);i.x-=e,i.y-=r})),t.edges().forEach((function(n){var i,o=t.edge(n);null===(i=o.points)||void 0===i||i.forEach((function(t){t.x-=e,t.y-=r})),o.hasOwnProperty("x")&&(o.x-=e),o.hasOwnProperty("y")&&(o.y-=r)})),o.width=n-e+a,o.height=i-r+s},R=function(t){t.edges().forEach((function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(l.default.intersectRect(o,n)),i.points.push(l.default.intersectRect(a,r))}))},B=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.hasOwnProperty("x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))},F=function(t){t.edges().forEach((function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))},G=function(t){t.nodes().forEach((function(e){var n,r,i;if(null===(n=t.children(e))||void 0===n?void 0:n.length){var o=t.node(e),a=t.node(o.borderTop),s=t.node(o.borderBottom),u=t.node(o.borderLeft[(null===(r=o.borderLeft)||void 0===r?void 0:r.length)-1]),c=t.node(o.borderRight[(null===(i=o.borderRight)||void 0===i?void 0:i.length)-1]);o.width=Math.abs((null==c?void 0:c.x)-(null==u?void 0:u.x))||10,o.height=Math.abs((null==s?void 0:s.y)-(null==a?void 0:a.y))||10,o.x=((null==u?void 0:u.x)||0)+o.width/2,o.y=((null==a?void 0:a.y)||0)+o.height/2}})),t.nodes().forEach((function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))},z=function(t){t.edges().forEach((function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))},U=function(t){var e=l.default.buildLayerMatrix(t);null==e||e.forEach((function(e){var n=0;null==e||e.forEach((function(e,r){var i,o=t.node(e);o.order=r+n,null===(i=o.selfEdges)||void 0===i||i.forEach((function(e){l.default.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete o.selfEdges}))}))},V=function(t){t.nodes().forEach((function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{y:o,x:i+a},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))},W=function(t,e){var n={};return null==e||e.forEach((function(e){void 0!==t[e]&&(n[e]=+t[e])})),n},X=function(t){var e={};return Object.keys(t).forEach((function(n){var r=t[n];e[n.toLowerCase()]=r})),e};e.default=function(t,e){var n=e&&e.debugTiming?l.default.time:l.default.notime;n("layout",(function(){e&&!e.keepNodeOrder&&e.prevGraph&&n(" inheritOrder",(function(){_(t,e.prevGraph)}));var r=n(" buildLayoutGraph",(function(){return I(t)}));e&&!1===e.edgeLabelSpace||n(" makeSpaceForEdgeLabels",(function(){j(r)}));try{n(" runLayout",(function(){x(r,n,e)}))}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}n(" updateInputGraph",(function(){w(t,r)}))}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(279)),o=function(t){var e=[],n={},r={};return t.nodes().forEach((function i(o){var a;r.hasOwnProperty(o)||(r[o]=!0,n[o]=!0,null===(a=t.outEdges(o))||void 0===a||a.forEach((function(t){n.hasOwnProperty(t.w)?e.push(t):i(t.w)})),delete n[o])})),e};e.default={run:function(t){var e="greedy"===t.graph().acyclicer?(0,i.default)(t,function(t){return function(e){return t.edge(e).weight}}(t)):o(t);null==e||e.forEach((function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,"rev-"+Math.random())}))},undo:function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(52)),o=r(n(280)),a=i.default.Graph,s=function(){return 1},u=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)c(t,e,n,r);for(;r=o.dequeue();)c(t,e,n,r);if(t.nodeCount())for(var s=e.length-2;s>0;--s)if(r=e[s].dequeue()){i=i.concat(c(t,e,n,r,!0));break}}return i},c=function(t,e,n,r,i){var o,a,s=i?[]:void 0;return null===(o=t.inEdges(r.v))||void 0===o||o.forEach((function(r){var o=t.edge(r),a=t.node(r.v);i&&s.push({v:r.v,w:r.w}),void 0===a.out&&(a.out=0),a.out-=o,f(e,n,a)})),null===(a=t.outEdges(r.v))||void 0===a||a.forEach((function(r){var i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,f(e,n,a)})),t.removeNode(r.v),s},l=function(t,e){var n=new a,r=0,i=0;t.nodes().forEach((function(t){n.setNode(t,{v:t,in:0,out:0})})),t.edges().forEach((function(t){var o=n.edge(t.v,t.w)||0,a=null==e?void 0:e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));for(var s=[],u=i+r+3,c=0;c<u;c++)s.push(new o.default);var l=r+1;return n.nodes().forEach((function(t){f(s,l,n.node(t))})),{buckets:s,zeroIdx:l,graph:n}},f=function(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)};e.default=function(t,e){var n;if(t.nodeCount()<=1)return[];var r=l(t,e||s);return null===(n=u(r.graph,r.buckets,r.zeroIdx).map((function(e){return t.outEdges(e.v,e.w)})))||void 0===n?void 0:n.flat()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev},i=function(t,e){if("_next"!==t&&"_prev"!==t)return e},o=function(){function t(){var t={};t._next=t._prev=t,this.isentinel=t}return t.prototype.dequeue=function(){var t=this.isentinel,e=t._prev;if(e!==t)return r(e),e},t.prototype.enqueue=function(){var t=this.isentinel,e=t._prev;if(e!==t)return r(e),e},t.prototype.toString=function(){for(var t=[],e=this.isentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,i)),n=n._prev;return"["+t.join(", ")+"]"},t}();e.default=o},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e){var n,r,o=e.v,a=t.node(o).rank,s=e.w,u=t.node(s).rank,c=e.name,l=t.edge(e),f=l.labelRank;if(u!==a+1){var h,d,p;for(t.removeEdge(e),p=0,++a;a<u;++p,++a)l.points=[],d={edgeLabel:l,width:0,height:0,edgeObj:e,rank:a},h=i.default.addDummyNode(t,"edge",d,"_d"),a===f&&(d.width=l.width,d.height=l.height,d.dummy="edge-label",d.labelpos=l.labelpos),t.setEdge(o,h,{weight:l.weight},c),0===p&&(t.graph().dummyChains||(t.graph().dummyChains=[]),null===(r=null===(n=t.graph())||void 0===n?void 0:n.dummyChains)||void 0===r||r.push(h)),o=h;t.setEdge(o,s,{weight:l.weight},c)}};e.default={run:function(t){t.graph().dummyChains=[],t.edges().forEach((function(e){return o(t,e)}))},undo:function(t){var e;null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var n,r,i=t.node(e),o=i.edgeLabel;i.edgeObj&&t.setEdge(i.edgeObj,o);for(var a=e;i.dummy;)r=null===(n=t.successors(a))||void 0===n?void 0:n[0],t.removeNode(a),o.points.push({x:i.x,y:i.y}),"edge-label"===i.dummy&&(o.x=i.x,o.y=i.y,o.width=i.width,o.height=i.height),a=r,i=t.node(a)}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(121),o=n(158),a=r(n(283)),s=i.longestPath,u=function(t){(0,i.longestPathWithLayer)(t),(0,o.feasibleTreeWithLayer)(t)},c=function(t){(0,a.default)(t)};e.default=function(t){switch(t.graph().ranker){case"network-simplex":c(t);break;case"tight-tree":u(t);break;case"longest-path":s(t);break;default:u(t)}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(158),o=n(121),a=n(45),s=r(n(52)).default.alg,u=s.preorder,c=s.postorder,l=function(t){t=(0,a.simplify)(t),(0,o.longestPath)(t);var e,n,r=(0,i.feasibleTree)(t);for(p(r),f(r,t);e=v(r);)n=y(r,t,e),m(r,t,e,n)},f=function(t,e){var n=c(t,t.nodes());null==(n=null==n?void 0:n.slice(0,(null==n?void 0:n.length)-1))||n.forEach((function(n){h(t,e,n)}))},h=function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=d(t,e,n)},d=function(t,e,n){var r,i=t.node(n).parent,o=!0,a=e.edge(n,i),s=0;return a||(o=!1,a=e.edge(i,n)),s=a.weight,null===(r=e.nodeEdges(n))||void 0===r||r.forEach((function(r){var a=r.v===n,u=a?r.w:r.v;if(u!==i){var c=a===o,l=e.edge(r).weight;if(s+=c?l:-l,x(t,n,u)){var f=t.edge(n,u).cutvalue;s+=c?-f:f}}})),s},p=function(t,e){void 0!==e&&(e=t.nodes()[0]),g(t,{},1,e)},g=function t(e,n,r,i,o){var a,s=r,u=r,c=e.node(i);return n[i]=!0,null===(a=e.neighbors(i))||void 0===a||a.forEach((function(r){n.hasOwnProperty(r)||(u=t(e,n,u,r,i))})),c.low=s,c.lim=u++,o?c.parent=o:delete c.parent,u},v=function(t){return t.edges().find((function(e){return t.edge(e).cutvalue<0}))},y=function(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var s=t.node(r),u=t.node(i),c=s,l=!1;s.lim>u.lim&&(c=u,l=!0);var f=e.edges().filter((function(e){return l===_(t,t.node(e.v),c)&&l!==_(t,t.node(e.w),c)}));return(0,a.minBy)(f,(function(t){return(0,o.slack)(e,t)}))},m=function(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),p(t),f(t,e),b(t,e)},b=function(t,e){var n=t.nodes().find((function(t){return!e.node(t).parent})),r=u(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},x=function(t,e,n){return t.hasEdge(e,n)},_=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};l.initLowLimValues=p,l.initCutValues=f,l.calcCutValue=d,l.leaveEdge=v,l.enterEdge=y,l.exchangeEdges=m,e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e,n,r){var i,o,a=[],s=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>u||c>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)s.push(i);return{lca:o,path:a.concat(s.reverse())}},i=function(t){var e,n={},r=0;return null===(e=t.children())||void 0===e||e.forEach((function e(i){var o,a=r;null===(o=t.children(i))||void 0===o||o.forEach(e),n[i]={low:a,lim:r++}})),n};e.default=function(t){var e,n=i(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var i,o,a=t.node(e),s=a.edgeObj;if(s)for(var u=r(t,n,s.v,s.w),c=u.path,l=u.lca,f=0,h=c[f],d=!0;e!==s.w;){if(a=t.node(e),d){for(;(h=c[f])!==l&&t.node(h).maxRank<a.rank;)f++;h===l&&(d=!1)}if(!d){for(;f<c.length-1&&(null===(i=t.node(h=c[f+1]))||void 0===i?void 0:i.minRank)<=a.rank;)f++;h=c[f]}t.setParent(e,h),e=null===(o=t.successors(e))||void 0===o?void 0:o[0]}}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function t(e,n,r,o,a,s,u){var c=e.children(u);if(null==c?void 0:c.length){var l=i.default.addBorderNode(e,"_bt"),f=i.default.addBorderNode(e,"_bb"),h=e.node(u);e.setParent(l,u),h.borderTop=l,e.setParent(f,u),h.borderBottom=f,null==c||c.forEach((function(i){t(e,n,r,o,a,s,i);var c=e.node(i),h=c.borderTop?c.borderTop:i,d=c.borderBottom?c.borderBottom:i,p=c.borderTop?o:2*o,g=h!==d?1:a-s[u]+1;e.setEdge(l,h,{minlen:g,weight:p,nestingEdge:!0}),e.setEdge(d,f,{minlen:g,weight:p,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,l,{weight:0,minlen:a+s[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})},a=function(t){var e,n={};return null===(e=t.children())||void 0===e||e.forEach((function(e){return function e(r,i){var o=t.children(r);null==o||o.forEach((function(t){return e(t,i+1)})),n[r]=i}(e,1)})),n},s=function(t){var e=0;return t.edges().forEach((function(n){e+=t.edge(n).weight})),e};e.default={run:function(t){var e,n=i.default.addDummyNode(t,"root",{},"_root"),r=a(t),u=Math.max.apply(Math,Object.values(r))-1,c=2*u+1;t.graph().nestingRoot=n,t.edges().forEach((function(e){t.edge(e).minlen*=c}));var l=s(t)+1;null===(e=t.children())||void 0===e||e.forEach((function(e){o(t,n,c,l,u,r,e)})),t.graph().nodeRankFactor=c},cleanup:function(t){var e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach((function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e,n,r,o,a){var s={rank:a,width:0,height:0,borderType:e},u=o[e][a-1],c=i.default.addDummyNode(t,"border",s,n);o[e][a]=c,t.setParent(c,r),u&&t.setEdge(u,c,{weight:1})};e.default=function(t){var e;null===(e=t.children())||void 0===e||e.forEach((function(e){return function e(n){var r=t.children(n),i=t.node(n);if((null==r?void 0:r.length)&&r.forEach((function(t){return e(t)})),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)o(t,"borderLeft","_bl",n,i,a),o(t,"borderRight","_br",n,i,a)}}(e)}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){t.nodes().forEach((function(e){i(t.node(e))})),t.edges().forEach((function(e){i(t.edge(e))}))},i=function(t){var e=t.width;t.width=t.height,t.height=e},o=function(t){t.nodes().forEach((function(e){a(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return a(t)})),r.hasOwnProperty("y")&&a(r)}))},a=function(t){t.y=-t.y},s=function(t){t.nodes().forEach((function(e){u(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return u(t)})),r.hasOwnProperty("x")&&u(r)}))},u=function(t){var e=t.x;t.x=t.y,t.y=e};e.default={adjust:function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"lr"!==n&&"rl"!==n||r(t)},undo:function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"bt"!==n&&"rl"!==n||o(t),"lr"!==n&&"rl"!==n||(s(t),r(t))}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(289)),o=r(n(290)),a=r(n(291)),s=r(n(292)),u=r(n(293)),c=r(n(52)),l=r(n(45)),f=n(32),h=c.default.Graph,d=function(t,e,n){return e.map((function(e){return(0,a.default)(t,e,n)}))},p=function(t,e,n){var r=new h;null==t||t.forEach((function(t){for(var i,o=t.graph().root,a=(0,u.default)(t,o,r,e,n),c=0;c<(null===(i=a.vs)||void 0===i?void 0:i.length);c++)t.node(a.vs[c]).order=c;(0,s.default)(t,r,a.vs)}))},g=function(t,e){null==e||e.forEach((function(e){null==e||e.forEach((function(e,n){t.node(e).order=n}))}))};e.default=function(t){for(var e=l.default.maxRank(t),n=[],r=[],a=1;a<e+1;a++)n.push(a);for(a=e-1;a>-1;a--)r.push(a);var s=d(t,n,"inEdges"),u=d(t,r,"outEdges"),c=(0,i.default)(t);g(t,c);for(var h,v=Number.POSITIVE_INFINITY,y=(a=0,0);y<4;++a,++y){p(a%2?s:u,a%4>=2),c=l.default.buildLayerMatrix(t),(m=(0,o.default)(t,c))<v&&(y=0,h=(0,f.clone)(c),v=m)}c=(0,i.default)(t),g(t,c);for(a=0,y=0;y<4;++a,++y){var m;p(a%2?s:u,a%4>=2,!0),c=l.default.buildLayerMatrix(t),(m=(0,o.default)(t,c))<v&&(y=0,h=(0,f.clone)(c),v=m)}g(t,h)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t){for(var e={},n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=[],a=0;a<i+1;a++)o.push([]);var s=n.sort((function(e,n){return t.node(e).rank-t.node(n).rank})),u=s.filter((function(e){return void 0!==t.node(e).fixorder})).sort((function(e,n){return t.node(e).fixorder-t.node(n).fixorder}));return null==u||u.forEach((function(n){isNaN(t.node(n).rank)||o[t.node(n).rank].push(n),e[n]=!0})),null==s||s.forEach((function n(r){var i;if(!e.hasOwnProperty(r)){e[r]=!0;var a=t.node(r);isNaN(a.rank)||o[a.rank].push(r),null===(i=t.successors(r))||void 0===i||i.forEach((function(t){return n(t)}))}})),o}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(45),i=function(t,e,n){for(var i=(0,r.zipObject)(n,n.map((function(t,e){return e}))),o=e.map((function(e){var n,r=null===(n=t.outEdges(e))||void 0===n?void 0:n.map((function(e){return{pos:i[e.w]||0,weight:t.edge(e).weight}}));return null==r?void 0:r.sort((function(t,e){return t.pos-e.pos}))})).flat().filter((function(t){return void 0!==t})),a=1;a<n.length;)a<<=1;var s=2*a-1;a-=1;var u=Array(s).fill(0,0,s),c=0;return null==o||o.forEach((function(t){var e=t.pos+a;u[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*n})),c};e.default=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);++r)n+=i(t,e[r-1],e[r]);return n}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(52)).default.Graph,o=function(t){for(var e;t.hasNode(e="_root"+Math.random()););return e};e.default=function(t,e,n){var r=o(t),a=new i({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return t.nodes().forEach((function(i){var o=t.node(i),s=t.parent(i);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||r),t[n](i).forEach((function(e){var n=e.v===i?e.w:e.v,r=a.edge(n,i),o=void 0!==r?r.weight:0;a.setEdge(n,i,{weight:t.edge(e).weight+o})})),o.hasOwnProperty("minRank")&&a.setNode(i,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))})),a}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e,n){var r,i={};null==n||n.forEach((function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(294)),o=r(n(295)),a=r(n(296)),s=function(t,e){null==t||t.forEach((function(t){var n,r=null===(n=t.vs)||void 0===n?void 0:n.map((function(t){return e[t]?e[t].vs:t}));t.vs=r.flat()}))},u=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};e.default=function t(e,n,r,c,l){var f,h,d,p,g=e.children(n),v=e.node(n),y=v?v.borderLeft:void 0,m=v?v.borderRight:void 0,b={};y&&(g=null==g?void 0:g.filter((function(t){return t!==y&&t!==m})));var x=(0,i.default)(e,g||[]);null==x||x.forEach((function(n){var i;if(null===(i=e.children(n.v))||void 0===i?void 0:i.length){var o=t(e,n.v,r,c);b[n.v]=o,o.hasOwnProperty("barycenter")&&u(n,o)}}));var _=(0,o.default)(x,r);s(_,b),null===(f=_.filter((function(t){var e;return!!t.vs||(null===(e=t.vs)||void 0===e?void 0:e.length)>0})))||void 0===f||f.forEach((function(t){var n=e.node(t.vs[0]);t.fixorder=n.fixorder,t.order=n.order}));var w=(0,a.default)(_,c,l);if(y&&(w.vs=[y,w.vs,m].flat(),null===(h=e.predecessors(y))||void 0===h?void 0:h.length)){var E=e.node((null===(d=e.predecessors(y))||void 0===d?void 0:d[0])||{}),S=e.node((null===(p=e.predecessors(m))||void 0===p?void 0:p[0])||{});w.hasOwnProperty("barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+E.order+S.order)/(w.weight+2),w.weight+=2}return w}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e){return e.map((function(e){var n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};var r={sum:0,weight:0};return null==n||n.forEach((function(e){var n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){for(var e,n,r=[],o=function(){var o=t.pop();r.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((function(t){return(e=o,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&i(e,t)})(t);var e})),null===(n=o.out)||void 0===n||n.forEach((function(e){return(n=o,function(e){e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))};null==t?void 0:t.length;)o();var a=r.filter((function(t){return!t.merged})),s=["vs","i","barycenter","weight"];return a.map((function(t){var e={};return null==s||s.forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),e}))},i=function(t,e){var n,r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};e.default=function(t,e){var n,i,o,a={};null==t||t.forEach((function(t,e){var n=a[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.edges())||void 0===n||n.forEach((function(t){var e=a[t.v],n=a[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(a[t.w]))}));var s=null===(o=(i=Object.values(a)).filter)||void 0===o?void 0:o.call(i,(function(t){return!t.indegree}));return r(s)}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=function(t,e,n){for(var r,i=n;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},a=function(t,e){return function(n,r){if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i}};e.default=function(t,e,n){var r=i.default.partition(t,(function(t){return t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder)||t.hasOwnProperty("barycenter")})),s=r.lhs,u=r.rhs.sort((function(t,e){return-t.i- -e.i})),c=[],l=0,f=0,h=0;null==s||s.sort(a(!!e,!!n)),h=o(c,u,h),null==s||s.forEach((function(t){var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,c.push(t.vs),l+=t.barycenter*t.weight,f+=t.weight,h=o(c,u,h)}));var d={vs:c.flat()};return f&&(d.barycenter=l/f,d.weight=f),d}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(45)),o=n(298);e.default=function(t){var e;!function(t){var e=i.default.buildLayerMatrix(t),n=t.graph().ranksep,r=0;null==e||e.forEach((function(e){var i=e.map((function(e){return t.node(e).height})),o=Math.max.apply(Math,i);null==e||e.forEach((function(e){t.node(e).y=r+o/2})),r+=o+n}))}(t=i.default.asNonCompoundGraph(t));var n=function(t){var e,n=i.default.buildLayerMatrix(t),r=Object.assign((0,o.findType1Conflicts)(t,n),(0,o.findType2Conflicts)(t,n)),a={};["u","d"].forEach((function(i){e="u"===i?n:Object.values(n).reverse(),["l","r"].forEach((function(n){"r"===n&&(e=e.map((function(t){return Object.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),u=(0,o.verticalAlignment)(t,e,r,s),c=(0,o.horizontalCompaction)(t,e,u.root,u.align,"r"===n);"r"===n&&Object.keys(c).forEach((function(t){return c[t]=-c[t]})),a[i+n]=c}))}));var s=(0,o.findSmallestWidthAlignment)(t,a);return s&&(0,o.alignCoordinates)(a,s),(0,o.balance)(a,t.graph().align)}(t);null===(e=Object.keys(n))||void 0===e||e.forEach((function(e){t.node(e).x=n[e]}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.balance=e.findSmallestWidthAlignment=e.alignCoordinates=e.horizontalCompaction=e.verticalAlignment=e.hasConflict=e.addConflict=e.findType2Conflicts=e.findType1Conflicts=e.positionX=void 0;var i=r(n(52)),o=r(n(45)),a=i.default.Graph,s=function(t,e){var n={};return(null==e?void 0:e.length)&&e.reduce((function(e,r){var i=0,o=0,a=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((function(e,u){var f,h=c(t,e),d=h?t.node(h).order:a;(h||e===s)&&(null===(f=r.slice(o,u+1))||void 0===f||f.forEach((function(e){var r;null===(r=t.predecessors(e))||void 0===r||r.forEach((function(r){var o=t.node(r),a=o.order;!(a<i||d<a)||o.dummy&&t.node(e).dummy||l(n,r,e)}))})),o=u+1,i=d)})),r})),n};e.findType1Conflicts=s;var u=function(t,e){var n={},r=function(e,r,i,o,a){for(var s,u=[],c=r;c<i;c++)u.push(c);u.forEach((function(r){var i;s=e[r],t.node(s).dummy&&(null===(i=t.predecessors(s))||void 0===i||i.forEach((function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&l(n,e,s)})))}))};return(null==e?void 0:e.length)&&e.reduce((function(e,n){var i,o=-1,a=0;return null==n||n.forEach((function(s,u){if("border"===t.node(s).dummy){var c=t.predecessors(s)||[];c.length&&(i=t.node(c[0]).order,r(n,a,u,o,i),a=u,o=i)}r(n,a,n.length,i,e.length)})),n})),n};e.findType2Conflicts=u;var c=function(t,e){var n;if(t.node(e).dummy)return null===(n=t.predecessors(e))||void 0===n?void 0:n.find((function(e){return t.node(e).dummy}))},l=function(t,e,n){var r=e,i=n;if(r>i){var o=r;r=i,i=o}var a=t[r];a||(t[r]=a={}),a[i]=!0};e.addConflict=l;var f=function(t,e,n){var r=e,i=n;r>i&&(r=i,i=e);return t[r]&&t[r].hasOwnProperty(i)};e.hasConflict=f;var h=function(t,e,n,r){var i={},o={},a={};return null==e||e.forEach((function(t){null==t||t.forEach((function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((function(t){var e=-1;null==t||t.forEach((function(t){var s=r(t);if(s.length)for(var u=((s=s.sort((function(t,e){return a[t]-a[e]}))).length-1)/2,c=Math.floor(u),l=Math.ceil(u);c<=l;++c){var h=s[c];o[t]===t&&e<a[h]&&!f(n,t,h)&&(o[h]=t,o[t]=i[t]=i[h],e=a[h])}}))})),{root:i,align:o}};e.verticalAlignment=h;var d=function(t,e,n,r,i){var o,a={},s=p(t,e,n,i),u=i?"borderLeft":"borderRight",c=function(t,e){for(var n=s.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()};return c((function(t){a[t]=(s.inEdges(t)||[]).reduce((function(t,e){return Math.max(t,(a[e.v]||0)+s.edge(e))}),0)}),s.predecessors.bind(s)),c((function(e){var n=(s.outEdges(e)||[]).reduce((function(t,e){return Math.min(t,(a[e.w]||0)-s.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(a[e]=Math.max(a[e],n))}),s.successors.bind(s)),null===(o=Object.values(r))||void 0===o||o.forEach((function(t){a[t]=a[n[t]]})),a};e.horizontalCompaction=d;var p=function(t,e,n,r){var i=new a,o=t.graph(),s=b(o.nodesep,o.edgesep,r);return null==e||e.forEach((function(e){var r;null==e||e.forEach((function(e){var o=n[e];if(i.setNode(o),r){var a=n[r],u=i.edge(a,o);i.setEdge(a,o,Math.max(s(t,e,r),u||0))}r=e}))})),i},g=function(t,e){return o.default.minBy(Object.values(e),(function(e){var n,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((function(n){var o=e[n],a=x(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i}))};function v(t,e){var n=Object.values(e),r=Math.min.apply(Math,n),i=Math.max.apply(Math,n);["u","d"].forEach((function(n){["l","r"].forEach((function(o){var a,s=n+o,u=t[s];if(u!==e){var c=Object.values(u);(a="l"===o?r-Math.min.apply(Math,c):i-Math.max.apply(Math,c))&&(t[s]={},Object.keys(u).forEach((function(e){t[s][e]=u[e]+a})))}}))}))}e.findSmallestWidthAlignment=g,e.alignCoordinates=v;var y=function(t,e){var n={};return Object.keys(t.ul).forEach((function(r){if(e)n[r]=t[e.toLowerCase()][r];else{var i=Object.values(t).map((function(t){return t[r]})).sort((function(t,e){return t-e}));n[r]=(i[1]+i[2])/2}})),n};e.balance=y;var m=function(t){var e,n=o.default.buildLayerMatrix(t),r=Object.assign(s(t,n),u(t,n)),i={};["u","d"].forEach((function(o){e="u"===o?n:Object.values(n).reverse(),["l","r"].forEach((function(n){"r"===n&&(e=e.map((function(t){return Object.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),s=h(0,e,r,a),u=d(t,e,s.root,s.align,"r"===n);"r"===n&&(u=Object.values(u).map((function(t){return-t}))),i[o+n]=u}))}));var a=g(t,i);return v(i,a),y(i,t.graph().align)};e.positionX=m;var b=function(t,e,n){return function(r,i,o){var a,s=r.node(i),u=r.node(o),c=0;if(c+=s.width/2,s.hasOwnProperty("labelpos"))switch((s.labelpos||"").toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(u.dummy?e:t)/2,c+=u.width/2,u.hasOwnProperty("labelpos"))switch((u.labelpos||"").toLowerCase()){case"l":a=u.width/2;break;case"r":a=-u.width/2}return a&&(c+=n?a:-a),a=0,c}},x=function(t,e){var n;return(null===(n=t.node(e))||void 0===n?void 0:n.width)||0};e.default={positionX:m,findType1Conflicts:s,findType2Conflicts:u,addConflict:l,hasConflict:f,verticalAlignment:h,horizontalCompaction:d,alignCoordinates:v,findSmallestWidthAlignment:g,balance:y}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e){for(var n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})).map((function(e){return t.node(e).rank})),r=Math.max.apply(Math,n),i=[],o=0;o<r+1;o++)i.push([]);null==e||e.forEach((function(e){var n=t.node(e);n&&!n.dummy&&(isNaN(n.rank)||(n.fixorder=i[n.rank].length,i[n.rank].push(e)))}))}},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RadialLayout=void 0;var a=n(32),s=n(34),u=o(n(301)),c=o(n(302));function l(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var f=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges||[];if(e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var r=t.center;if(1===e.length)return e[0].x=r[0],e[0].y=r[1],void(t.onLayoutEnd&&t.onLayoutEnd());var i=t.linkDistance,o=null;if((0,a.isString)(t.focusNode)){for(var s=!1,l=0;l<e.length;l++)e[l].id===t.focusNode&&(o=e[l],t.focusNode=o,s=!0,l=e.length);s||(o=null)}else o=t.focusNode;o||(o=e[0],t.focusNode=o);var f,h,d,p=(f=e,h=o.id,d=-1,f.forEach((function(t,e){t.id===h&&(d=e)})),d);p<0&&(p=0),t.focusIndex=p;var g=(0,a.getAdjMatrix)({nodes:e,edges:n},!1),v=(0,a.floydWarshall)(g),y=t.maxToFocus(v,p);t.handleInfinity(v,p,y+1),t.distances=v;var m=v[p],b=t.width||500,x=t.height||500,_=b-r[0]>r[0]?r[0]:b-r[0],w=x-r[1]>r[1]?r[1]:x-r[1];0===_&&(_=b/2),0===w&&(w=x/2);var E=w>_?_:w,S=Math.max.apply(Math,m),O=[];m.forEach((function(e,n){t.unitRadius||(t.unitRadius=E/S),O[n]=e*t.unitRadius})),t.radii=O;var M=t.eIdealDisMatrix();t.eIdealDistances=M;var k=function(t){for(var e=t.length,n=t[0].length,r=[],i=0;i<e;i++){for(var o=[],a=0;a<n;a++)0!==t[i][a]?o.push(1/(t[i][a]*t[i][a])):o.push(0);r.push(o)}return r}(M);t.weights=k;var A=new u.default({linkDistance:i,distances:M}).layout();A.forEach((function(t){(0,a.isNaN)(t[0])&&(t[0]=Math.random()*i),(0,a.isNaN)(t[1])&&(t[1]=Math.random()*i)})),t.positions=A,A.forEach((function(t,n){e[n].x=t[0]+r[0],e[n].y=t[1]+r[1]})),A.forEach((function(t){t[0]-=A[p][0],t[1]-=A[p][1]})),t.run();var C,T=t.preventOverlap,I=t.nodeSize,j=t.strictRadial;if(T){var P,N=t.nodeSpacing;P=(0,a.isNumber)(N)?function(){return N}:(0,a.isFunction)(N)?N:function(){return 0},C=I?(0,a.isArray)(I)?function(t){return(I[0]>I[1]?I[0]:I[1])+P(t)}:function(t){return I+P(t)}:function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+P(t):(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+P(t):t.size+P(t):10+P(t)};var D={nodes:e,nodeSizeFunc:C,adjMatrix:g,positions:A,radii:O,height:x,width:b,strictRadial:j,focusID:p,iterations:t.maxPreventOverlapIteration||200,k:A.length/4.5},L=new c.default(D);A=L.layout()}return A.forEach((function(t,n){e[n].x=t[0]+r[0],e[n].y=t[1]+r[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:n}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){for(var t=this.maxIteration,e=this.positions||[],n=this.weights||[],r=this.eIdealDistances||[],i=this.radii||[],o=0;o<=t;o++){var a=o/t;this.oneIteration(a,e,i,r,n)}},e.prototype.oneIteration=function(t,e,n,r,i){var o=1-t,a=this.focusIndex;e.forEach((function(s,u){var c=l(s,[0,0]),f=0===c?0:1/c;if(u!==a){var h=0,d=0,p=0;e.forEach((function(t,e){if(u!==e){var n=l(s,t),o=0===n?0:1/n,a=r[e][u];p+=i[u][e],h+=i[u][e]*(t[0]+a*(s[0]-t[0])*o),d+=i[u][e]*(t[1]+a*(s[1]-t[1])*o)}}));var g=0===n[u]?0:1/n[u];p*=o,p+=t*g*g,h*=o,h+=t*g*s[0]*f,s[0]=h/p,d*=o,d+=t*g*s[1]*f,s[1]=d/p}}))},e.prototype.eIdealDisMatrix=function(){var t=this,e=t.nodes;if(!e)return[];var n=t.distances,r=t.linkDistance,i=t.radii||[],o=t.unitRadius||50,s=[];return n&&n.forEach((function(n,u){var c=[];n.forEach((function(n,s){if(u===s)c.push(0);else if(i[u]===i[s])if("data"===t.sortBy)c.push(n*(Math.abs(u-s)*t.sortStrength)/(i[u]/o));else if(t.sortBy){var l=e[u][t.sortBy]||0,f=e[s][t.sortBy]||0;(0,a.isString)(l)&&(l=l.charCodeAt(0)),(0,a.isString)(f)&&(f=f.charCodeAt(0)),c.push(n*(Math.abs(l-f)*t.sortStrength)/(i[u]/o))}else c.push(n*r/(i[u]/o));else{var h=(r+o)/2;c.push(n*h)}})),s.push(c)})),s},e.prototype.handleInfinity=function(t,e,n){for(var r=t.length,i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(var o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(i=0;i<r;i++)if(i!==e)for(o=0;o<r;o++)if(t[i][o]===1/0){var a=Math.abs(t[e][i]-t[e][o]);a=0===a?1:a,t[i][o]=a}},e.prototype.maxToFocus=function(t,e){for(var n=0,r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},e.prototype.getType=function(){return"radial"},e}(s.Base);e.RadialLayout=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(207),i=function(){function t(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return t.prototype.layout=function(){var t=this.dimension,e=this.distances,n=this.linkDistance;try{var i=r.Matrix.mul(r.Matrix.pow(e,2),-.5),o=i.mean("row"),a=i.mean("column"),s=i.mean();i.add(s).subRowVector(o).subColumnVector(a);var u=new r.SingularValueDecomposition(i),c=r.Matrix.sqrt(u.diagonalMatrix).diagonal();return u.leftSingularVectors.toJSON().map((function(e){return r.Matrix.mul([e],[c]).toJSON()[0].splice(0,t)}))}catch(t){for(var l=[],f=0;f<e.length;f++){var h=Math.random()*n,d=Math.random()*n;l.push([h,d])}return l}},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return t.prototype.layout=function(){var t=this.positions,e=[],n=this.iterations,r=this.width/10;this.maxDisplace=r,this.disp=e;for(var i=0;i<n;i++)t.forEach((function(t,n){e[n]={x:0,y:0}})),this.getRepulsion(),this.updatePositions();return t},t.prototype.getRepulsion=function(){var t=this,e=t.positions,n=t.nodes,r=t.disp,i=t.k,o=t.radii||[];e.forEach((function(a,s){r[s]={x:0,y:0},e.forEach((function(e,u){if(s!==u&&o[s]===o[u]){var c=a[0]-e[0],l=a[1]-e[1],f=Math.sqrt(c*c+l*l);if(0===f){f=1;var h=s>u?1:-1;c=.01*h,l=.01*h}if(f<t.nodeSizeFunc(n[s])/2+t.nodeSizeFunc(n[u])/2){var d=i*i/f;r[s].x+=c/f*d,r[s].y+=l/f*d}}}))}))},t.prototype.updatePositions=function(){var t=this.positions,e=this.disp,n=this.speed,r=this.strictRadial,i=this.focusID,o=this.maxDisplace||this.width/10;r&&e.forEach((function(e,n){var r=t[n][0]-t[i][0],o=t[n][1]-t[i][1],a=Math.sqrt(r*r+o*o),s=o/a,u=-r/a,c=Math.sqrt(e.x*e.x+e.y*e.y),l=Math.acos((s*e.x+u*e.y)/c);l>Math.PI/2&&(l-=Math.PI/2,s*=-1,u*=-1);var f=Math.cos(l)*c;e.x=s*f,e.y=u*f}));var a=this.radii;t.forEach((function(s,u){if(u!==i){var c=Math.sqrt(e[u].x*e[u].x+e[u].y*e[u].y);if(c>0&&u!==i){var l=Math.min(o*(n/800),c);if(s[0]+=e[u].x/c*l,s[1]+=e[u].y/c*l,r){var f=s[0]-t[i][0],h=s[1]-t[i][1],d=Math.sqrt(f*f+h*h);f=f/d*a[u],h=h/d*a[u],s[0]=t[i][0]+f,s[1]=t[i][1]+h}}}}))},t}();e.default=r},function(t,e,n){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return M()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var g={};u(g,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(O([])));y&&y!==n&&r.call(y,o)&&(g=y);var m=p.prototype=h.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,n){var i;this._invoke=function(o,a){function s(){return new n((function(i,s){!function i(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"===e(h)&&r.call(h,"__await")?n.resolve(h.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):n.resolve(h).then((function(t){f.value=t,s(f)}),(function(t){return i("throw",t,s,u)}))}u(c.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:M}}function M(){return{value:void 0,done:!0}}return d.prototype=p,u(m,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,s,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new x(c(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,s,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}("object"===e(t)?t.exports:{});try{regeneratorRuntime=n}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}).call(this,n(120)(t))},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var s=n(308),u=n(42),c=n(53),l=n(33),f=n(167),h=n(309),d=n(316),p=n(318),g=n(60),v=n(78),y=n(321),m=n(322),b=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!==r(e))throw new Error(""+u.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=c.BindingScopeEnum.Transient;else if(e.defaultScope!==c.BindingScopeEnum.Singleton&&e.defaultScope!==c.BindingScopeEnum.Transient&&e.defaultScope!==c.BindingScopeEnum.Request)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=g.id(),this._bindingDictionary=new m.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=new t,s=a([e,n],r).map((function(t){return h.getBindingDictionary(t)})),u=h.getBindingDictionary(o);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return s.forEach((function(t){c(t,u)})),o},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i(this,void 0,void 0,(function(){var e,n,r,i,a;return o(this,(function(o){switch(o.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,o.label=1;case 1:return n<r.length?(i=r[n],a=e(i.id),[4,i.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||c.BindingScopeEnum.Transient,n=new s.Binding(t,e);return this._bindingDictionary.add(t,n),new p.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(u.CANNOT_UNBIND+" "+v.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new m.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,l.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=h.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(y.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(u.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,c.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,c.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,l.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,c.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,c.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,l.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw new Error(u.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=h.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),d.resolve(n)}},t}();e.Container=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(53),i=n(60),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(310),i=n(42),o=n(53),a=n(33),s=n(168),u=n(78),c=n(311),l=n(48),f=n(312),h=n(313),d=n(315),p=n(170);function g(t){return t._bindingDictionary}function v(t,e,n,o,a){var s=y(n.container,a.serviceIdentifier),c=[];return s.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),s=y(n.container,a.serviceIdentifier)),c=e?s:s.filter((function(t){var e=new d.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=u.getServiceIdentifierAsString(t),s=i.NOT_REGISTERED;throw s+=u.listMetadataForTarget(a,n),s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;a=u.getServiceIdentifierAsString(t),s=i.AMBIGUOUS_MATCH+" "+a;throw s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s)}}(a.serviceIdentifier,c,a,n.container),c}function y(t,e){var n=[],r=g(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=y(t.parent,e)),n}e.getBindingDictionary=g,e.plan=function(t,e,n,r,g,y,m,b){void 0===b&&(b=!1);var x=new c.Context(e),_=function(t,e,n,r,i,o){var s=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,u=new l.Metadata(s,n),c=new p.Target(e,r,n,u);if(void 0!==i){var f=new l.Metadata(i,o);c.metadata.push(f)}return c}(n,r,g,"",y,m);try{return function t(e,n,r,a,s,u){var c,l;if(null===s){c=v(e,n,a,null,u),l=new d.Request(r,a,null,c,u);var p=new f.Plan(a,l);a.addPlan(p)}else c=v(e,n,a,s,u),l=s.addChildRequest(u.serviceIdentifier,c,u);c.forEach((function(n){var r=null;if(u.isArray())r=l.addChildRequest(n.serviceIdentifier,n,u);else{if(n.cache)return;r=l}if(n.type===o.BindingTypeEnum.Instance&&null!==n.implementationType){var s=h.getDependencies(e,n.implementationType);if(!a.container.options.skipBaseClassChecks){var c=h.getBaseClassDependencyCount(e,n.implementationType);if(s.length<c){var f=i.ARGUMENTS_LENGTH_MISMATCH(h.getFunctionName(n.implementationType));throw new Error(f)}}s.forEach((function(n){t(e,!1,n.serviceIdentifier,a,r,n)}))}}))}(t,b,g,x,null,_),x}catch(t){throw s.isStackOverflowExeption(t)&&x.plan&&u.circularDependencyToException(x.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new l.Metadata(n,r)),a=new c.Context(t);return new d.Request(e,a,null,[],i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0;e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(60),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;var r=function(t,e){this.parentContext=t,this.rootRequest=e};e.Plan=r},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(169),o=n(42),a=n(53),s=n(33),u=n(78);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return u.getFunctionName}});var c=n(170);function l(t,e,n,i){var s=t.getConstructorMetadata(n),u=s.compilerGeneratedMetadata;if(void 0===u){var l=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(l)}var d=s.userGeneratedMetadata,p=Object.keys(d),g=0===n.length&&p.length>0,v=p.length>n.length,y=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var s=f(a,t,e,n,r);null!==s&&o.push(s)}return o}(i,e,u,d,g||v?p.length:n.length),m=function t(e,n){for(var i=e.getPropertiesMetadata(n),o=[],s=Object.keys(i),u=0,l=s;u<l.length;u++){var f=l[u],d=i[f],p=h(i[f]),g=p.targetName||f,v=p.inject||p.multiInject,y=new c.Target(a.TargetTypeEnum.ClassProperty,g,v);y.metadata=d,o.push(y)}var m=Object.getPrototypeOf(n.prototype).constructor;if(m!==Object){var b=t(e,m);o=r(r([],o),b)}return o}(t,n);return r(r([],y),m)}function f(t,e,n,r,s){var u=s[t.toString()]||[],l=h(u),f=!0!==l.unmanaged,d=r[t],p=l.inject||l.multiInject;if((d=p||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),f){if(!e&&(d===Object||d===Function||void 0===d)){var g=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(g)}var v=new c.Target(a.TargetTypeEnum.ConstructorArgument,l.targetName,d);return v.metadata=u,v}return null}function h(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[s.INJECT_TAG],multiInject:e[s.MULTI_INJECT_TAG],targetName:e[s.NAME_TAG],unmanaged:e[s.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return l(t,u.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=l(e,u.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===s.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var r=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(60),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(42),i=n(53),o=n(168),a=n(78),s=n(317),u=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}};e.resolve=function(t){return function t(e){return function(n){n.parentContext.setCurrentRequest(n);var o=n.bindings,c=n.childRequests,l=n.target&&n.target.isArray(),f=!(n.parentRequest&&n.parentRequest.target&&n.target&&n.parentRequest.target.matchesArray(n.target.serviceIdentifier));if(l&&f)return c.map((function(n){return t(e)(n)}));var h=null;if(!n.target.isOptional()||0!==o.length){var d=o[0],p=d.scope===i.BindingScopeEnum.Singleton,g=d.scope===i.BindingScopeEnum.Request;if(p&&d.activated)return d.cache;if(g&&null!==e&&e.has(d.id))return e.get(d.id);if(d.type===i.BindingTypeEnum.ConstantValue)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Function)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Constructor)h=d.implementationType;else if(d.type===i.BindingTypeEnum.DynamicValue&&null!==d.dynamicValue)h=u("toDynamicValue",d.serviceIdentifier,(function(){return d.dynamicValue(n.parentContext)}));else if(d.type===i.BindingTypeEnum.Factory&&null!==d.factory)h=u("toFactory",d.serviceIdentifier,(function(){return d.factory(n.parentContext)}));else if(d.type===i.BindingTypeEnum.Provider&&null!==d.provider)h=u("toProvider",d.serviceIdentifier,(function(){return d.provider(n.parentContext)}));else{if(d.type!==i.BindingTypeEnum.Instance||null===d.implementationType){var v=a.getServiceIdentifierAsString(n.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+v)}h=s.resolveInstance(d.implementationType,c,t(e))}return"function"==typeof d.onActivation&&(h=d.onActivation(n.parentContext,h)),p&&(d.cache=h,d.activated=!0),g&&null!==e&&!e.has(d.id)&&e.set(d.id,h),h}}}(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(42),o=n(53),a=n(33);e.resolveInstance=function(t,e,n){var s,u,c=null;if(e.length>0){var l=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n);u=l,c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((s=t).bind.apply(s,r([void 0],u))),e,n)}else c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(42),i=n(53),o=n(319),a=n(171),s=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(320),i=n(122),o=n(123),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(53),i=n(171),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var r=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(42),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(60),i=function(t){this.id=r.id(),this.registry=t};e.ContainerModule=i;var o=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(42),i=n(33);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(48),i=n(56);e.tagged=function(t,e){return function(n,o,a){var s=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,s):i.tagProperty(n,o,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(33),i=n(48),o=n(56);e.named=function(t){return function(e,n,a){var s=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(33),i=n(48),o=n(56);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(33),i=n(48),o=n(56);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(33),i=n(48),o=n(56);e.multiInject=function(t){return function(e,n,a){var s=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(33),i=n(48),o=n(56);e.targetName=function(t){return function(e,n,a){var s=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(42),i=n(33),o=n(48);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0;e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Symbol.for("INJECTION");function i(t,e,n,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(r,this,e)&&Reflect.defineMetadata(r,n(),this,e),Reflect.hasMetadata(r,this,e)?Reflect.getMetadata(r,this,e):n()},set:function(t){Reflect.defineMetadata(r,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,r){return function(o,a){i(o,a,(function(){return t.getNamed(n,r)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,r,o){return function(a,s){i(a,s,(function(){return t.getTagged(n,r,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.getAll(n)}),e)}}}},function(t,e,n){var r=n(166);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){var e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e}},function(t,e){t.exports=function(t,e){var n=new Float32Array(2);return n[0]=t,n[1]=e,n}},function(t,e){t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},function(t,e,n){t.exports=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r*Math.max(1,Math.abs(i),Math.abs(a))};var r=n(188)},function(t,e){t.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},function(t,e,n){t.exports=n(124)},function(t,e,n){t.exports=n(192)},function(t,e,n){t.exports=n(193)},function(t,e){t.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){var r=Math.cos(n),i=Math.sin(n),o=e[0],a=e[1];return t[0]=o*r-a*i,t[1]=o*i+a*r,t}},function(t,e){t.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}},function(t,e,n){t.exports=n(194)},function(t,e,n){t.exports=n(195)},function(t,e,n){t.exports=n(196)},function(t,e,n){t.exports=n(197)},function(t,e){t.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t}},function(t,e){t.exports=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}},function(t,e){t.exports=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}},function(t,e){t.exports=function(t,e){e=e||1;var n=2*Math.random()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}},function(t,e,n){t.exports=function(t,e,n,i,o,a){var s,u;e||(e=2);n||(n=0);u=i?Math.min(i*e+n,t.length):t.length;for(s=n;s<u;s+=e)r[0]=t[s],r[1]=t[s+1],o(r,r,a),t[s]=r[0],t[s+1]=r[1];return t};var r=n(189)()},function(t,e){t.exports=function(t,e,n){var r=e[0]*e[0]+e[1]*e[1];if(r>n*n){var i=Math.sqrt(r);t[0]=e[0]/i*n,t[1]=e[1]/i*n}else t[0]=e[0],t[1]=e[1];return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.clusterBundle=e.clusterCode=e.fruchtermanBundle=e.fruchtermanCode=void 0,e.fruchtermanCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass Fruchterman {\n @in @out\n u_Data: vec4[];\n @in\n u_K: float;\n @in\n u_K2: float;\n \n @in\n u_Center: vec2;\n @in\n u_Gravity: float;\n @in\n u_ClusterGravity: float;\n @in\n u_Speed: float;\n @in\n u_MaxDisplace: float;\n @in\n u_Clustering: float;\n @in\n u_AttributeArray: vec4[];\n @in\n u_ClusterCenters: vec4[];\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = (xDist * xDist + yDist * yDist) + 0.01;\n let param = this.u_K2 / dist;\n \n if (dist > 0.0) {\n dx += param * xDist;\n dy += param * yDist;\n if (xDist == 0 && yDist == 0) {\n const sign = i < j ? 1 : -1;\n dx += param * sign;\n dy += param * sign;\n }\n }\n }\n }\n return [dx, dy];\n }\n calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // \n let dx = 0, dy = 0;\n const vx = currentNode[0] - this.u_Center[0];\n const vy = currentNode[1] - this.u_Center[1];\n const gf = 0.01 * this.u_K * this.u_Gravity;\n dx = gf * vx;\n dy = gf * vy;\n if (this.u_Clustering == 1) {\n const clusterIdx = int(nodeAttributes[0]);\n const center = this.u_ClusterCenters[clusterIdx];\n const cvx = currentNode[0] - center[0];\n const cvy = currentNode[1] - center[1];\n const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;\n const parma = this.u_K * this.u_ClusterGravity / dist;\n dx += parma * cvx;\n dy += parma * cvy;\n }\n return [dx, dy];\n }\n calcAttractive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n const arr_offset = int(floor(currentNode[2] + 0.5));\n const length = int(floor(currentNode[3] + 0.5));\n const node_buffer: vec4;\n for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + p;\n // when arr_idx % 4 == 0 update currentNodedx_buffer\n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)];\n }\n const float_j = buf_offset == 0 ? node_buffer[0] :\n buf_offset == 1 ? node_buffer[1] :\n buf_offset == 2 ? node_buffer[2] :\n node_buffer[3];\n const nextNode = this.u_Data[int(float_j)];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;\n let attractiveF = dist / this.u_K;\n \n if (dist > 0.0) {\n dx -= xDist * attractiveF;\n dy -= yDist * attractiveF;\n if (xDist == 0 && yDist == 0) {\n const sign = i < int(float_j) ? 1 : -1;\n dx -= sign * attractiveF;\n dy -= sign * attractiveF;\n }\n }\n }\n return [dx, dy];\n }\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n let dx = 0, dy = 0;\n if (i >= VERTEX_COUNT) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // [gravity, fx, fy, 0]\n const nodeAttributes = this.u_AttributeArray[i];\n\n if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {\n // the node is fixed\n this.u_Data[i] = [\n nodeAttributes[1],\n nodeAttributes[2],\n currentNode[2],\n currentNode[3]\n ];\n return;\n }\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n dx += repulsive[0];\n dy += repulsive[1];\n // attractive\n const attractive = this.calcAttractive(i, currentNode);\n dx += attractive[0];\n dy += attractive[1];\n // gravity\n const gravity = this.calcGravity(currentNode, nodeAttributes);\n dx -= gravity[0];\n dy -= gravity[1];\n // speed\n dx *= this.u_Speed;\n dy *= this.u_Speed;\n\n // move\n const distLength = sqrt(dx * dx + dy * dy);\n if (distLength > 0.0) {\n const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);\n this.u_Data[i] = [\n currentNode[0] + dx / distLength * limitedDist,\n currentNode[1] + dy / distLength * limitedDist,\n currentNode[2],\n currentNode[3]\n ];\n }\n }\n}\n",e.fruchtermanBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2<f32>;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2<f32>","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.clusterCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst VERTEX_COUNT;\nconst CLUSTER_COUNT;\n@numthreads(1, 1, 1)\nclass CalcCenter {\n @in\n u_Data: vec4[];\n @in\n u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]\n @in @out\n u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]\n @main\n compute() {\n const i = globalInvocationID.x;\n const center = this.u_ClusterCenters[i];\n let sumx = 0;\n let sumy = 0;\n let count = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n const attributes = this.u_NodeAttributes[j];\n const clusterIdx = int(attributes[0]);\n const vertex = this.u_Data[j];\n if (clusterIdx == i) {\n sumx += vertex.x;\n sumy += vertex.y;\n count += 1;\n }\n }\n this.u_ClusterCenters[i] = [\n sumx / count,\n sumy / count,\n count,\n i\n ];\n }\n}\n",e.clusterBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.aveMovementBundle=e.aveMovementCode=e.gForceBundle=e.gForceCode=void 0,e.gForceCode="\nimport { globalInvocationID } from 'g-webgpu';\n\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\nconst SHIFT_20 = 1048576;\n\n@numthreads(1, 1, 1)\nclass GGForce {\n @in @out\n u_Data: vec4[];\n\n @in\n u_damping: float;\n \n @in\n u_maxSpeed: float;\n\n @in\n u_minMovement: float;\n\n @in\n u_AveMovement: vec4[];\n\n @in\n u_coulombDisScale: float;\n\n @in\n u_factor: float;\n\n @in\n u_NodeAttributeArray1: vec4[];\n\n @in\n u_NodeAttributeArray2: vec4[];\n\n @in\n u_interval: float;\n\n unpack_float(packedValue: float): ivec2 {\n const packedIntValue = int(packedValue);\n const v0 = packedIntValue / SHIFT_20;\n return [v0, packedIntValue - v0 * SHIFT_20];\n }\n\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let ax = 0, ay = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const vx = currentNode[0] - nextNode[0];\n const vy = currentNode[1] - nextNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const n_dist = (dist + 0.1) * this.u_coulombDisScale;\n const direx = vx / dist;\n const direy = vy / dist;\n const attributesi = this.u_NodeAttributeArray1[i];\n const attributesj = this.u_NodeAttributeArray1[j];\n const massi = attributesi[0];\n const nodeStrengthi = attributesi[2];\n const nodeStrengthj = attributesj[2];\n const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;\n // const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);\n const param = nodeStrength * this.u_factor / (n_dist * n_dist);\n ax += direx * param;\n ay += direy * param;\n }\n }\n return [ax, ay];\n }\n\n calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {\n // note: attributes2 = [centerX, centerY, gravity, 0]\n\n const vx = currentNode[0] - attributes2[0];\n const vy = currentNode[1] - attributes2[1];\n \n const ax = vx * attributes2[2];\n const ay = vy * attributes2[2];\n \n return [ax, ay];\n }\n\n calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {\n // note: attributes1 = [mass, degree, nodeSterngth, 0]\n\n const mass = attributes1[0];\n let ax = 0, ay = 0;\n // const arr_offset = int(floor(currentNode[2] + 0.5));\n // const length = int(floor(currentNode[3] + 0.5));\n\n const compressed = this.unpack_float(currentNode[2]);\n const length = compressed[0];\n const arr_offset = compressed[1];\n\n const node_buffer: vec4;\n for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置\n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4,\n }\n\n let float_j: float = node_buffer[0];\n\n const nextNode = this.u_Data[int(float_j)];\n const vx = nextNode[0] - currentNode[0];\n const vy = nextNode[1] - currentNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const direx = vx / dist;\n const direy = vy / dist;\n const edgeLength = node_buffer[1];\n const edgeStrength = node_buffer[2];\n const diff: float = edgeLength - dist;//edgeLength\n // const param = diff * this.u_stiffness / mass; //\n const param = diff * edgeStrength / mass; // \n ax -= direx * param;\n ay -= direy * param;\n }\n return [ax, ay];\n }\n\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n const movement = u_AveMovement[0];\n let ax = 0, ay = 0;\n\n if (i >= VERTEX_COUNT || movement.x < u_minMovement) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // 每个节点属性占两个数组中各一格\n // [mass, degree, nodeStrength, fx]\n const nodeAttributes1 = this.u_NodeAttributeArray1[i];\n // [centerX, centerY, centerGravity, fy]\n const nodeAttributes2 = this.u_NodeAttributeArray2[i];\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n ax += repulsive[0];\n ay += repulsive[1];\n\n // attractive\n const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);\n ax += attractive[0];\n ay += attractive[1];\n\n // gravity\n const gravity = this.calcGravity(i, currentNode, nodeAttributes2);\n ax -= gravity[0];\n ay -= gravity[1];\n\n // speed\n const param = this.u_interval * this.u_damping;\n let vx = ax * param;\n let vy = ay * param;\n const vlength = sqrt(vx * vx + vy * vy) + 0.0001;\n if (vlength > this.u_maxSpeed) {\n const param2 = this.u_maxSpeed / vlength;\n vx = param2 * vx;\n vy = param2 * vy;\n }\n\n // move\n if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {\n this.u_Data[i] = [\n nodeAttributes1[3],\n nodeAttributes2[3],\n currentNode[2],\n 0\n ];\n } else {\n const distx = vx * this.u_interval;\n const disty = vy * this.u_interval;\n const distLength = sqrt(distx * distx + disty * disty);\n this.u_Data[i] = [\n currentNode[0] + distx,\n currentNode[1] + disty,\n currentNode[2],\n distLength\n ];\n }\n \n // the avarage move distance\n // need to share memory\n \n }\n}\n",e.gForceBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {float mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.aveMovementCode="\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass CalcAveMovement {\n @in\n u_Data: vec4[];\n @in\n u_iter: float;\n @in @out\n u_AveMovement: vec4[];\n @main\n compute() {\n let movement = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n const vertex = this.u_Data[j];\n movement += vertex[3];\n }\n movement = movement / float(VERTEX_COUNT);\n this.u_AveMovement[0] = [movement, 0, 0, 0];\n }\n}\n",e.aveMovementBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n);r=r<1e-4?1e-4:r;var i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var n=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/n,ry:(this.ry*this.mass+e.ry*e.mass)/n,mass:n,degree:this.degree+e.degree})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))},t}();e.default=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var u=a(n(125)),c=s(n(375)),l=s(n(377)),f=n(118);e.default=function(t,e){var n=t.nodes,i=t.edges,o=e.width,a=e.height;if(!(null==n?void 0:n.length))return Promise.resolve();var s=[];n.forEach((function(t){if(i.filter((function(e){return e.source===t.id||e.target===t.id})).length>1){var e=r({},t);delete e.size,s.push(e)}}));var h=[];i.forEach((function(t){var e=s.find((function(e){return e.id===t.source})),n=s.find((function(e){return e.id===t.target}));e&&n&&h.push(t)}));var d=new f.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:s,edges:h}).nodes;n.forEach((function(t){var e=(d||[]).find((function(e){return e.id===t.id}));t.x=(null==e?void 0:e.x)||o/2,t.y=(null==e?void 0:e.y)||a/2}));var p=JSON.parse(JSON.stringify(n)),g=JSON.parse(JSON.stringify(i)),v=u.forceSimulation().nodes(p).force("link",u.forceLink(g).id((function(t){return t.id})).distance((function(t){return h.find((function(e){return e.source===t.source&&e.target===t.target}))?30:20}))).force("charge",u.forceManyBody()).force("center",u.forceCenter(o/2,a/2)).force("x",u.forceX(o/2)).force("y",u.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001);return new Promise((function(t){v.on("end",(function(){n.forEach((function(t){var e=p.find((function(e){return e.id===t.id}));e&&(t.x=e.x,t.y=e.y)}));var r=Math.min.apply(Math,n.map((function(t){return t.x}))),s=Math.max.apply(Math,n.map((function(t){return t.x}))),u=Math.min.apply(Math,n.map((function(t){return t.y}))),f=Math.max.apply(Math,n.map((function(t){return t.y}))),h=o/(s-r),d=a/(f-u);n.forEach((function(t){void 0!==t.x&&h<1&&(t.x=(t.x-r)*h),void 0!==t.y&&d<1&&(t.y=(t.y-u)*d)})),n.forEach((function(t){t.sizeTemp=t.size,t.size=[10,10]})),(0,l.default)(n,i),n.forEach((function(t){t.size=t.sizeTemp||[],delete t.sizeTemp})),(0,c.default)({nodes:n,edges:i},e),t()}))}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(376));e.default=function(t,e){if(!t.nodes||0===t.nodes.length)return t;var n=e.width,r=e.height,o=e.nodeMinGap,a=1e4,s=1e4;t.nodes.forEach((function(t){var e=t.size[0]||50,n=t.size[1]||50;a=Math.min(e,a),s=Math.min(n,s)}));var u=new i.default;u.init(n,r,{CELL_H:s,CELL_W:a}),t.nodes.forEach((function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)}));for(var c=0;c<t.nodes.length;c++){var l=t.nodes[c],f=u.findGridByNodeId(l.id);if(!f)throw new Error("can not find node cell");var h=f.column,d=f.row;if(l.size[0]+o>a){for(var p=v=Math.ceil((l.size[0]+o)/a)-1,g=0;g<v;g++){if(!(u.additionColumn.indexOf(h+g+1)>-1)||u.cells[h+g+1][d].node)break;p--}u.insertColumn(h,p)}if(l.size[1]+o>s){var v;for(p=v=Math.ceil((l.size[1]+o)/s)-1,g=0;g<v;g++){if(!(u.additionRow.indexOf(d+g+1)>-1)||u.cells[h][d+g+1].node)break;p--}u.insertRow(d,p)}}for(c=0;c<u.columnNum;c++){var y=function(e){var n=u.cells[c][e];if(n.node){var r=t.nodes.find((function(t){var e;return t.id===(null===(e=null==n?void 0:n.node)||void 0===e?void 0:e.id)}));r&&(r.x=n.x+r.size[0]/2,r.y=n.y+r.size[1]/2)}};for(g=0;g<u.rowNum;g++)y(g)}}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(e,n,r){this.cells=[],this.CELL_W=r.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=r.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(n/this.CELL_H),t.MIN_DIST=Math.pow(e,2)+Math.pow(n,2);for(var i=0;i<this.columnNum;i++){for(var o=[],a=0;a<this.rowNum;a++){var s={dx:i,dy:a,x:i*this.CELL_W,y:a*this.CELL_H,occupied:!1};o.push(s)}this.cells.push(o)}},t.prototype.findGridByNodeId=function(t){for(var e,n,r=0;r<this.columnNum;r++)for(var i=0;i<this.rowNum;i++)if(this.cells[r][i].node&&(null===(n=null===(e=this.cells[r][i])||void 0===e?void 0:e.node)||void 0===n?void 0:n.id)===t)return{column:r,row:i};return null},t.prototype.sqdist=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},t.prototype.occupyNearest=function(e){for(var n,r=t.MIN_DIST,i=null,o=0;o<this.columnNum;o++)for(var a=0;a<this.rowNum;a++)!this.cells[o][a].occupied&&(n=this.sqdist(e,this.cells[o][a]))<r&&(r=n,i=this.cells[o][a]);return i&&(i.occupied=!0),i},t.prototype.insertColumn=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++){this.cells[n+this.columnNum]=[];for(var i=0;i<this.rowNum;i++)this.cells[n+this.columnNum][i]={dx:n,dy:i,x:n*this.CELL_W,y:i*this.CELL_H,occupied:!1,node:null}}for(n=this.columnNum-1;n>t;n--)for(i=0;i<this.rowNum;i++)this.cells[n+e][i]=r(r({},this.cells[n][i]),{x:(n+e)*this.CELL_W,y:i*this.CELL_H}),this.cells[n][i]={x:n*this.CELL_W,y:i*this.CELL_H,occupied:!0,node:null};for(i=0;i<this.additionColumn.length;i++)this.additionColumn[i]>=t&&(this.additionColumn[i]+=e);for(n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}},t.prototype.insertRow=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++)for(var i=0;i<this.columnNum;i++)this.cells[i][n+this.rowNum]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(i=0;i<this.columnNum;i++)for(n=this.rowNum-1;n>t;n--)this.cells[i][n+e]=r(r({},this.cells[i][n]),{dx:i,dy:n+e,x:i*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(i=0;i<e;i++)this.additionRow.push(t+i+1);this.rowNum+=e}},t.prototype.getNodes=function(){for(var t=[],e=0;e<this.columnNum;e++)for(var n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=1.5707963267948966,i=new Map,o=.8;function a(t,e){var n=(i.get(t.id)||[]).find((function(t){return t.source===e.id||t.target===e.id})),o=t.size[0]*t.size[1],a=e.size[0]*e.size[1],s=o>a?e:t,u=o>a?t:e,c=s.x-s.size[0]/2,l=s.y-s.size[1]/2,f=s.x+s.size[0]/2,h=s.y+s.size[1]/2,d=u.x-u.size[0]/2,p=u.y-u.size[1]/2,g=u.x+u.size[0]/2,v=u.y+u.size[1]/2,y=s.x,m=s.y,b=u.x,x=u.y,_=0,w=0;if(f>=d&&g>=c&&h>=p&&v>=l){0===(w=Math.sqrt(Math.pow(b-y,2)+Math.pow(x-m,2)))&&(w=1e-7),_=10/w*100+((f<g?f:g)-(c>d?c:d))*((h<v?h:v)-(l>p?l:p)),_*=1e7}else{var E=!1,S=function(t,e,n){var i=t.x-t.size[0]/2,o=t.y-t.size[1]/2,a=t.x+t.size[0]/2,s=t.y+t.size[1]/2,u=e.x-e.size[0]/2,c=e.y-e.size[1]/2,l=e.x+e.size[0]/2,f=e.y+e.size[1]/2,h=t.x,d=t.y,p=e.x,g=e.y,v=p-h,y=Math.atan2(v,g-d),m=0,b=0,x=0,_=0;y>r?(b=o-f,m=u-a,x=parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)),_=parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2))):x=_=0<y&&y<=r?(b=c-s)>(m=u-a)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):y<-r?(b=o-f)>(m=-(l-i))?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):(b=c-s)>(m=Math.abs(v)>(a-i)/2?i-l:v)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m&&0!==y?(m/Math.sin(y)).toFixed(2):b.toFixed(2));var w=parseFloat(y.toFixed(2)),E=n;return n&&(E=1.1780972450961724<w&&w<1.9634954084936207),{distance:Math.abs(x<_?x:_),isHoriz:E}}(s,u,E);w=S.distance,E=S.isHoriz,w<=10?_+=0!==w?n?10+1e7/w:10+1e8/w:1e7:(_+=w,n&&(_+=w*w))}return _}function s(t){for(var e=0,n=0;n<t.length;n++){var r=t[n];(r.x<0||r.y<0||r.x>1200||r.y>800)&&(e+=1e12);for(var i=n+1;i<t.length;i++)e+=a(r,t[i])}return e}function u(t,e,n,r){var i=new Map;n.forEach((function(t,e){i.set(t.id,t)}));var o=r.filter((function(e){return e.source===t.id||e.target===t.id}))||[],a=[];o.forEach((function(e){var n=e.source===t.id?e.target:e.source,r=i.get(n);r&&a.push(r)}));for(var s=!0,u=0;u<a.length;u++){var c=a[u],l=180*Math.atan((t.y-c.y)/(c.x-t.y)),f=180*Math.atan((e.y-c.y)/(c.x-e.y)),h=l>70&&l<110,d=f>70&&f<110;if((l<30||l>150)&&!(f<30||f>150)||l*f<0){s=!1;break}if(h&&!d||l*f<0){s=!1;break}if((c.x-t.x)*(c.x-e.x)<0){s=!1;break}if((c.y-t.y)*(c.y-e.y)<0){s=!1;break}}return s}function c(t,e){for(var n=!1,r=[10,-10,0,0],i=[0,0,10,-10],a=0;a<t.length;++a)for(var c=t[a],f=l(c,t),h=0;h<r.length;h++){if(u(c,{x:c.x+r[h],y:c.y+i[h]},t,e)){c.x+=r[h],c.y+=i[h];var d=l(c,t),p=Math.random();d<f||p<o&&p>.1?(f=d,n=!0):(c.x-=r[h],c.y-=i[h])}}return o>.1&&(o*=.5),n?s(t):0}function l(t,e){var n=0;(t.x<0||t.y<0||t.x+t.size[0]+20>1200||t.y+t.size[1]+20>800)&&(n+=1e12);for(var r=0;r<e.length;++r)t.id!==e[r].id&&(n+=a(t,e[r]));return n}e.default=function(t,e){if(0===t.length)return{nodes:t,edges:e};t.forEach((function(t){var n=e.filter((function(e){return e.source===t.id||e.target===t.id}));i.set(t,n)})),t.sort((function(t,e){var n,r;return(null===(n=i.get(t.id))||void 0===n?void 0:n.length)-(null===(r=i.get(e.id))||void 0===r?void 0:r.length)}));for(var n=s(t),r=20,o=1,a=0,u=0;r>0&&!(++u>=50);){var l=c(t,e);0!==l&&(a=l),o=a-n,n=a,0===o?--r:r=20}return t.forEach((function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2})),{nodes:t,edges:e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Layouts=e.Layout=void 0;var r=n(142),i=n(146),o=n(147),a=n(148),s=n(149),u=n(150),c=n(118),l=n(159),f=n(160),h=n(161),d=n(162),p=n(163),g=n(201),v=n(202),y=n(203),m=n(204),b=n(205),x=function(){function t(t){var e=(0,r.getLayoutByName)(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.layoutInstance.init(t)},t.prototype.execute=function(){this.layoutInstance.execute()},t.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},t.prototype.destroy=function(){return this.layoutInstance.destroy()},t}();e.Layout=x,e.Layouts={force:s.ForceLayout,fruchterman:d.FruchtermanLayout,forceAtlas2:m.ForceAtlas2Layout,gForce:a.GForceLayout,dagre:c.DagreLayout,circular:u.CircularLayout,radial:l.RadialLayout,concentric:f.ConcentricLayout,grid:i.GridLayout,mds:h.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:y.ComboCombinedLayout,random:o.RandomLayout,"gForce-gpu":g.GForceGPULayout,"fruchterman-gpu":p.FruchtermanGPULayout,er:b.ERLayout}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,n){"use strict";n.r(e),n.d(e,"G6GraphEvent",(function(){return He})),n.d(e,"G6Event",(function(){return rr})),n.d(e,"Node",(function(){return vn})),n.d(e,"Edge",(function(){return gn})),n.d(e,"Combo",(function(){return yn})),n.d(e,"Hull",(function(){return Un})),n.d(e,"registerNode",(function(){return hr})),n.d(e,"registerCombo",(function(){return pr})),n.d(e,"AbstractGraph",(function(){return Wn})),n.d(e,"registerEdge",(function(){return dr})),n.d(e,"registerBehavior",(function(){return gr})),n.d(e,"AbstractLayout",(function(){return lr})),n.d(e,"AbstractEvent",(function(){return fr})),n.d(e,"BaseGlobal",(function(){return vr})),n.d(e,"Graph",(function(){return Ai})),n.d(e,"TreeGraph",(function(){return Ii})),n.d(e,"Util",(function(){return oi})),n.d(e,"Layout",(function(){return Hr.Layouts})),n.d(e,"TreeLayout",(function(){return si})),n.d(e,"registerLayout",(function(){return ui})),n.d(e,"Global",(function(){return Gr})),n.d(e,"Minimap",(function(){return Gu})),n.d(e,"Grid",(function(){return Fu})),n.d(e,"Bundling",(function(){return zu})),n.d(e,"Menu",(function(){return Uu})),n.d(e,"Fisheye",(function(){return Vu})),n.d(e,"Algorithm",(function(){return Bu})),n.d(e,"ToolBar",(function(){return Wu})),n.d(e,"Tooltip",(function(){return Xu})),n.d(e,"TimeBar",(function(){return Yu})),n.d(e,"ImageMinimap",(function(){return Hu})),n.d(e,"EdgeFilterLens",(function(){return qu})),n.d(e,"SnapLine",(function(){return Ku})),n.d(e,"Legend",(function(){return Zu})),n.d(e,"Arrow",(function(){return ir})),n.d(e,"Marker",(function(){return or})),n.d(e,"Shape",(function(){return ar})),n.d(e,"version",(function(){return $u}));var r={};n.r(r),n.d(r,"getAdjMatrix",(function(){return x})),n.d(r,"breadthFirstSearch",(function(){return A})),n.d(r,"connectedComponent",(function(){return T})),n.d(r,"getDegree",(function(){return j})),n.d(r,"getInDegree",(function(){return P})),n.d(r,"getOutDegree",(function(){return N})),n.d(r,"detectCycle",(function(){return F})),n.d(r,"detectDirectedCycle",(function(){return Pt})),n.d(r,"detectAllCycles",(function(){return B})),n.d(r,"detectAllDirectedCycle",(function(){return R})),n.d(r,"detectAllUndirectedCycle",(function(){return L})),n.d(r,"depthFirstSearch",(function(){return D})),n.d(r,"dijkstra",(function(){return G})),n.d(r,"findAllPath",(function(){return W})),n.d(r,"findShortestPath",(function(){return V})),n.d(r,"floydWarshall",(function(){return X})),n.d(r,"labelPropagation",(function(){return Y})),n.d(r,"louvain",(function(){return tt})),n.d(r,"iLouvain",(function(){return et})),n.d(r,"kCore",(function(){return nt})),n.d(r,"kMeans",(function(){return it})),n.d(r,"cosineSimilarity",(function(){return ot})),n.d(r,"nodesCosineSimilarity",(function(){return at})),n.d(r,"minimumSpanningTree",(function(){return ht})),n.d(r,"pageRank",(function(){return dt})),n.d(r,"getNeighbors",(function(){return O})),n.d(r,"Stack",(function(){return jt})),n.d(r,"GADDI",(function(){return It})),n.d(r,"default",(function(){return Nt}));var i={};n.r(i),n.d(i,"compare",(function(){return Lt})),n.d(i,"getLineIntersect",(function(){return Bt})),n.d(i,"getRectIntersectByPoint",(function(){return Ft})),n.d(i,"getCircleIntersectByPoint",(function(){return Gt})),n.d(i,"getEllipseIntersectByPoint",(function(){return zt})),n.d(i,"applyMatrix",(function(){return Ut})),n.d(i,"invertMatrix",(function(){return Vt})),n.d(i,"getCircleCenterByPoints",(function(){return Wt})),n.d(i,"distance",(function(){return Xt})),n.d(i,"scaleMatrix",(function(){return Yt})),n.d(i,"floydWarshall",(function(){return Ht})),n.d(i,"getAdjMatrix",(function(){return qt})),n.d(i,"translate",(function(){return Kt})),n.d(i,"move",(function(){return Zt})),n.d(i,"scale",(function(){return Qt})),n.d(i,"rotate",(function(){return $t})),n.d(i,"getDegree",(function(){return Jt})),n.d(i,"isPointInPolygon",(function(){return ee})),n.d(i,"intersectBBox",(function(){return ne})),n.d(i,"isPolygonsIntersect",(function(){return re})),n.d(i,"Line",(function(){return ie})),n.d(i,"getBBoxBoundLine",(function(){return oe})),n.d(i,"itemIntersectByLine",(function(){return se})),n.d(i,"fractionToLine",(function(){return ue})),n.d(i,"getPointsCenter",(function(){return ce})),n.d(i,"squareDist",(function(){return le})),n.d(i,"pointLineSquareDist",(function(){return fe})),n.d(i,"isPointsOverlap",(function(){return he})),n.d(i,"pointRectSquareDist",(function(){return de})),n.d(i,"pointLineDistance",(function(){return pe})),n.d(i,"lerp",(function(){return ge}));var o={};n.r(o),n.d(o,"getBBox",(function(){return je})),n.d(o,"getLoopCfgs",(function(){return Pe})),n.d(o,"getLabelPosition",(function(){return Ne})),n.d(o,"traverseTree",(function(){return Le})),n.d(o,"traverseTreeUp",(function(){return Re})),n.d(o,"getLetterWidth",(function(){return Be})),n.d(o,"getTextSize",(function(){return Fe})),n.d(o,"plainCombosToTrees",(function(){return Ge})),n.d(o,"reconstructTree",(function(){return ze})),n.d(o,"getComboBBox",(function(){return Ue})),n.d(o,"shouldRefreshEdge",(function(){return Ve})),n.d(o,"cloneBesidesImg",(function(){return We}));var a={};n.r(a),n.d(a,"uniqueId",(function(){return qe})),n.d(a,"formatPadding",(function(){return Ke})),n.d(a,"cloneEvent",(function(){return Ze})),n.d(a,"isViewportChanged",(function(){return Qe})),n.d(a,"isNaN",(function(){return $e})),n.d(a,"calculationItemsBBox",(function(){return Je})),n.d(a,"processParallelEdges",(function(){return tn}));var s={};n.r(s),n.d(s,"getSpline",(function(){return En})),n.d(s,"getControlPoint",(function(){return Sn})),n.d(s,"pointsToPolygon",(function(){return On})),n.d(s,"pathToPoints",(function(){return Mn})),n.d(s,"getClosedSpline",(function(){return kn})),n.d(s,"roundedHull",(function(){return In})),n.d(s,"paddedHull",(function(){return jn}));var u={};n.r(u),n.d(u,"defaultSubjectColors",(function(){return sr}));var c={};n.r(c),n.d(c,"mixColor",(function(){return Lr})),n.d(c,"getColorsWithSubjectColor",(function(){return Rr})),n.d(c,"getColorSetsBySubjectColors",(function(){return Br}));var l={};n.r(l),n.d(l,"proccessToFunc",(function(){return Qr})),n.d(l,"buildTextureData",(function(){return $r})),n.d(l,"buildTextureDataWithOneEdgeAttr",(function(){return Jr})),n.d(l,"buildTextureDataWithTwoEdgeAttr",(function(){return ti})),n.d(l,"attributesToTextureData",(function(){return ei})),n.d(l,"arrayToTextureData",(function(){return ni})),n.d(l,"radialLayout",(function(){return ri}));var f={};n.r(f),n.d(f,"gpuDetector",(function(){return ii}));var h={};n.r(h),n.d(h,"default",(function(){return Po})),n.d(h,"assign",(function(){return ho})),n.d(h,"format",(function(){return Io})),n.d(h,"parse",(function(){return jo})),n.d(h,"defaultI18n",(function(){return yo})),n.d(h,"setGlobalDateI18n",(function(){return bo})),n.d(h,"setGlobalDateMasks",(function(){return To}));var d=n(1),p=n(0),g={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(t){return Object.assign(this,t),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(t){var e=this,n=this.events;this.graph=t,"drag-canvas"!==this.type&&"brush-select"!==this.type&&"lasso-select"!==this.type||t.get("canvas").set("draggable",!0),Object(p.each)(n,(function(e,n){t.on(n,e)})),document.addEventListener("visibilitychange",(function(){e.keydown=!1}))},unbind:function(t){var e=this.events,n=t.get("canvas").get("draggable");"drag-canvas"!==this.type&&"brush-select"!==this.type&&"lasso-select"!==this.type||t.get("canvas").set("draggable",!1),Object(p.each)(e,(function(e,n){t.off(n,e)})),t.get("canvas").set("draggable",n)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}},v=function(){function t(){}return t.registerBehavior=function(e,n){if(!n)throw new Error("please specify handler for this behavior: ".concat(e));var r=Object(p.clone)(g);Object.assign(r,n);var i=function(t){var e=this;Object.assign(this,this.getDefaultCfg(),t);var n=this.getEvents();this.events=null;var r={};n&&(Object(p.each)(n,(function(t,n){r[n]=Object(p.wrapBehavior)(e,t)})),this.events=r)};i.prototype=r,t.types[e]=i},t.hasBehavior=function(e){return!!t.types[e]},t.getBehavior=function(e){return t.types[e]},t.types={},t}(),y=v,m=n(69),b=n(14),x=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];!a&&0!==a||!s&&0!==s||(i[a][s]=1,e||(i[s][a]=1))})),i},_=function(t,e){return t===e},w=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),E=function(){function t(t){void 0===t&&(t=_),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new w(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new w(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach((function(t){return e.append(t)})),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map((function(e){return e.toString(t)})).toString()},t}(),S=function(){function t(){this.linkedList=new E}return t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},t.prototype.enqueue=function(t){this.linkedList.append(t)},t.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toString=function(t){return this.linkedList.toString(t)},t}(),O=function(t,e,n){void 0===e&&(e=[]);var r=e.filter((function(e){return e.source===t||e.target===t}));if("target"===n){return r.filter((function(e){return e.source===t})).map((function(t){return t.target}))}if("source"===n){return r.filter((function(e){return e.target===t})).map((function(t){return t.source}))}return r.map((function(e){return e.source===t?e.target:e.source}))},M=function(t,e){return e.filter((function(e){return e.source===t||e.target===t}))},k=function(t){void 0===t&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(n)};var A=function(t,e,n,r){void 0===r&&(r=!0);var i=function(t){void 0===t&&(t={});var e,n=t,r=function(){},i=(e={},function(t){var n=t.next;return!e[n]&&(e[n]=!0,!0)});return n.allowTraversal=t.allowTraversal||i,n.enter=t.enter||r,n.leave=t.leave||r,n}(n),o=new S,a=t.edges,s=void 0===a?[]:a;o.enqueue(e);for(var u="",c=function(){var t=o.dequeue();i.enter({current:t,previous:u}),O(t,s,r?"target":void 0).forEach((function(e){i.allowTraversal({previous:u,current:t,next:e})&&o.enqueue(e)})),i.leave({current:t,previous:u}),u=t};!o.isEmpty();)c()},C=function(t){for(var e=t.nodes,n=void 0===e?[]:e,r=t.edges,i=void 0===r?[]:r,o=[],a={},s={},u={},c=[],l=0,f=function t(e){s[e.id]=l,u[e.id]=l,l+=1,o.push(e),a[e.id]=!0;for(var r=O(e.id,i,"target").filter((function(t){return n.map((function(t){return t.id})).indexOf(t)>-1})),f=function(i){var o=r[i];if(s[o]||0===s[o])a[o]&&(u[e.id]=Math.min(u[e.id],s[o]));else{var c=n.filter((function(t){return t.id===o}));c.length>0&&t(c[0]),u[e.id]=Math.min(u[e.id],u[o])}},h=0;h<r.length;h++)f(h);if(u[e.id]===s[e.id]){for(var d=[];o.length>0;){var p=o.pop();if(a[p.id]=!1,d.push(p),p===e)break}d.length>0&&c.push(d)}},h=0,d=n;h<d.length;h++){var p=d[h];s[p.id]||0===s[p.id]||f(p)}return c};function T(t,e){return e?C(t):function(t){for(var e=t.nodes,n=void 0===e?[]:e,r=t.edges,i=void 0===r?[]:r,o=[],a={},s=[],u=function t(e){s.push(e),a[e.id]=!0;for(var r=O(e.id,i),o=function(e){var i=r[e];if(!a[i]){var o=n.filter((function(t){return t.id===i}));o.length>0&&t(o[0])}},u=0;u<r.length;++u)o(u)},c=0;c<n.length;c++){var l=n[c];if(!a[l.id]){u(l);for(var f=[];s.length>0;)f.push(s.pop());o.push(f)}}return o}(t)}var I=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach((function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}})),o.forEach((function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++})),e},j=I,P=function(t,e){return I(t)[e]?I(t)[e].inDegree:0},N=function(t,e){return I(t)[e]?I(t)[e].outDegree:0};function D(t,e,n){!function t(e,n,r,i){i.enter({current:n,previous:r});var o=e.edges;O(n,void 0===o?[]:o,"target").forEach((function(o){i.allowTraversal({previous:r,current:n,next:o})&&t(e,o,n,i)})),i.leave({current:n,previous:r})}(t,e,"",function(t){void 0===t&&(t={});var e,n=t,r=function(){},i=(e={},function(t){var n=t.next;return!e[n]&&(e[n]=!0,!0)});return n.allowTraversal=t.allowTraversal||i,n.enter=t.enter||r,n.leave=t.leave||r,n}(n))}var L=function(t,e,n){var r,i;void 0===n&&(n=!0);for(var o=[],a=0,s=T(t,!1);a<s.length;a++){var u=s[a];if(u.length)for(var c=u[0],l=c.id,f=[c],h=((r={})[l]=c,r),d=((i={})[l]=new Set,i);f.length>0;)for(var p=f.pop(),g=p.id,v=O(g,t.edges),y=function(r){var i,a=v[r],s=t.nodes.find((function(t){return t.id===a}));if(a===g)o.push(((i={})[a]=p,i));else if(a in d){if(!d[g].has(s)){for(var u=!0,c=[s,p],l=h[g];d[a].size&&!d[a].has(l)&&(c.push(l),l!==h[l.id]);)l=h[l.id];if(c.push(l),e&&n?(u=!1,c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!0)):e&&!n&&c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!1),u){for(var y={},m=1;m<c.length;m+=1)y[c[m-1].id]=c[m];c.length&&(y[c[c.length-1].id]=c[0]),o.push(y)}d[a].add(p)}}else h[a]=p,f.push(s),d[a]=new Set([p])},m=0;m<v.length;m+=1)y(m)}return o},R=function(t,e,n){void 0===n&&(n=!0);for(var r=[],i=new Set,o=[],a=[],s={},u={},c=function t(u,c,l){var f=!1;if(e&&!1===n&&e.indexOf(u.id)>-1)return f;r.push(u),i.add(u);for(var h=l[u.id],d=0;d<h.length;d+=1){if((v=s[h[d]])===c){for(var p={},g=1;g<r.length;g+=1)p[r[g-1].id]=r[g];r.length&&(p[r[r.length-1].id]=r[0]),a.push(p),f=!0}else i.has(v)||t(v,c,l)&&(f=!0)}if(f)!function(t){for(var e=[t];e.length>0;){var n=e.pop();i.has(n)&&(i.delete(n),o[n.id].forEach((function(t){e.push(t)})),o[n.id].clear())}}(u);else for(d=0;d<h.length;d+=1){var v=s[h[d]];o[v.id].has(u)||o[v.id].add(u)}return r.pop(),f},l=t.nodes,f=void 0===l?[]:l,h=0;h<f.length;h+=1){var d=f[h],p=d.id;u[p]=h,s[h]=d}if(e&&n){var g=function(t){var n=e[t];u[f[t].id]=u[n],u[n]=0,s[0]=f.find((function(t){return t.id===n})),s[u[f[t].id]]=f[t]};for(h=0;h<e.length;h++)g(h)}for(var v=function(r){for(var i,o,s=1/0,c=0;c<r.length;c+=1)for(var l=r[c],f=0;f<l.length;f++){var h=u[l[f].id];h<s&&(s=h,o=c)}var d=r[o],p=[];for(c=0;c<d.length;c+=1){var g=d[c];p[g.id]=[];for(var v=0,y=O(g.id,t.edges,"target").filter((function(t){return d.map((function(t){return t.id})).indexOf(t)>-1}));v<y.length;v++){var m=y[v];m!==g.id||!1===n&&e.indexOf(g.id)>-1?p[g.id].push(u[m]):a.push(((i={})[g.id]=g,i))}}return{component:d,adjList:p,minIdx:s}},y=0;y<f.length;){var m=f.filter((function(t){return u[t.id]>=y})),b=C({nodes:m,edges:t.edges}).filter((function(t){return t.length>1}));if(0===b.length)break;var x=v(b),_=x.minIdx,w=x.adjList,E=x.component;if(!(E.length>1))break;E.forEach((function(t){o[t.id]=new Set}));var S=s[_];if(e&&n&&-1===e.indexOf(S.id))return a;c(S,S,w),y=_+1}return a},B=function(t,e,n,r){return void 0===r&&(r=!0),e?R(t,n,r):L(t,n,r)},F=function(t){var e=null,n=t.nodes,r={},i={},o={},a={};(void 0===n?[]:n).forEach((function(t){i[t.id]=t}));for(var s={enter:function(t){var n=t.current,a=t.previous;if(o[n]){e={};for(var s=n,u=a;u!==n;)e[s]=u,s=u,u=r[u];e[s]=u}else o[n]=n,delete i[n],r[n]=a},leave:function(t){var e=t.current;a[e]=e,delete o[e]},allowTraversal:function(t){var n=t.next;return!e&&!a[n]}};Object.keys(i).length;){D(t,Object.keys(i)[0],s)}return e},G=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u=[],c={},l={},f={};o.forEach((function(t,n){var r=t.id;u.push(r),l[r]=1/0,r===e&&(l[r]=0)}));for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var a=e[o].id;!n[a]&&t[a]<=i&&(i=t[a],r=e[o])}return r}(l,o,c),i=e.id;if(c[i]=!0,l[i]===1/0)return"continue";(n?function(t,e){return e.filter((function(e){return e.source===t}))}(i,s):M(i,s)).forEach((function(t){var n=t.target,o=t.source,a=n===i?o:n,s=r&&t[r]?t[r]:1;l[a]>l[e.id]+s?(l[a]=l[e.id]+s,f[a]=[e.id]):l[a]===l[e.id]+s&&f[a].push(e.id)}))},p=0;p<h;p++)d();f[e]=[e];var g={};for(var v in l)l[v]!==1/0&&z(e,v,f,g);var y={};for(var v in g)y[v]=g[v][0];return{length:l,path:y,allPath:g}};function z(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,a=n[e];o<a.length;o++){var s=z(t,a[o],n,r);if(!s)return;for(var u=0,c=s;u<c.length;u++){var l=c[u];Object(p.isArray)(l)?i.push(Object(d.__spreadArray)(Object(d.__spreadArray)([],l,!0),[e],!1)):i.push([l,e])}}return r[e]=i,r[e]}var U,V=function(t,e,n,r,i){var o=G(t,e,r,i),a=o.length,s=o.path,u=o.allPath;return{length:a[n],path:s[n],allPath:u[n]}},W=function(t,e,n,r){var i;if(e===n)return[[e]];var o=t.edges,a=void 0===o?[]:o,s=[e],u=((i={})[e]=!0,i),c=[],l=[],f=r?O(e,a,"target"):O(e,a);for(c.push(f);s.length>0&&c.length>0;){var h=c[c.length-1];if(h.length){var d=h.shift();if(d&&(s.push(d),u[d]=!0,f=r?O(d,a,"target"):O(d,a),c.push(f.filter((function(t){return!u[t]})))),s[s.length-1]===n){var p=s.map((function(t){return t}));l.push(p);g=s.pop();u[g]=!1,c.pop()}}else{var g=s.pop();u[g]=!1,c.pop()}}return l},X=function(t,e){for(var n=x(t,e),r=[],i=n.length,o=0;o<i;o+=1){r[o]=[];for(var a=0;a<i;a+=1)o===a?r[o][a]=0:0!==n[o][a]&&n[o][a]?r[o][a]=n[o][a]:r[o][a]=1/0}for(var s=0;s<i;s+=1)for(o=0;o<i;o+=1)for(a=0;a<i;a+=1)r[o][a]>r[o][s]+r[s][a]&&(r[o][a]=r[o][s]+r[s][a]);return r},Y=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e3);var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u={},c={};o.forEach((function(t,e){var n=k();t.clusterId=n,u[n]={id:n,nodes:[t]},c[t.id]={node:t,idx:e}}));var l=x(t,e),f=[],h={};l.forEach((function(t,e){var n=0,r=o[e].id;h[r]={},t.forEach((function(t,e){if(t){n+=t;var i=o[e].id;h[r][i]=t}})),f.push(n)}));for(var d=0,p=function(){var t=!1;if(o.forEach((function(e){var n={};Object.keys(h[e.id]).forEach((function(t){var r=h[e.id][t],i=c[t].node.clusterId;n[i]||(n[i]=0),n[i]+=r}));var r=-1/0,i=[];if(Object.keys(n).forEach((function(t){r<n[t]?(r=n[t],i=[t]):r===n[t]&&i.push(t)})),1!==i.length||i[0]!==e.clusterId){var o=i.indexOf(e.clusterId);if(o>=0&&i.splice(o,1),i&&i.length){t=!0;var a=u[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var l=Math.floor(Math.random()*i.length),f=u[i[l]];f.nodes.push(e),e.clusterId=f.id}}})),!t)return"break";d++};d<r;){if("break"===p())break}Object.keys(u).forEach((function(t){var e=u[t];e.nodes&&e.nodes.length||delete u[t]}));var g=[],v={};s.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=c[e].node.clusterId,a=c[r].node.clusterId,s="".concat(o,"---").concat(a);if(v[s])v[s].weight+=i,v[s].count++;else{var u={source:o,target:a,weight:i,count:1};v[s]=u,g.push(u)}}));var y=[];return Object.keys(u).forEach((function(t){y.push(u[t])})),{clusters:y,clusterEdges:g}},H=function(){function t(t){this.arr=t}return t.prototype.getArr=function(){return this.arr||[]},t.prototype.add=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]+r[o];return new t(i)}},t.prototype.subtract=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]-r[o];return new t(i)}},t.prototype.avg=function(e){var n=[];if(0!==e)for(var r in this.arr)n[r]=this.arr[r]/e;return new t(n)},t.prototype.negate=function(){var e=[];for(var n in this.arr)e[n]=-this.arr[n];return new t(e)},t.prototype.squareEuclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return r}},t.prototype.euclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return Math.sqrt(r)}console.error("The two vectors are unequal in length.")},t.prototype.normalize=function(){var e=[],n=Object(p.clone)(this.arr);n.sort((function(t,e){return t-e}));var r=n[n.length-1],i=n[0];for(var o in this.arr)e[o]=(this.arr[o]-i)/(r-i);return new t(e)},t.prototype.norm2=function(){var t;if(!(null===(t=this.arr)||void 0===t?void 0:t.length))return 0;var e=0;for(var n in this.arr)e+=Math.pow(this.arr[n],2);return Math.sqrt(e)},t.prototype.dot=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=this.arr[i]*t.arr[i];return r}console.error("The two vectors are unequal in length.")},t.prototype.equal=function(t){var e,n=t.arr;if((null===(e=this.arr)||void 0===e?void 0:e.length)!==(null==n?void 0:n.length))return!1;for(var r in this.arr)if(this.arr[r]!==n[r])return!1;return!0},t}(),q=function(t,e){void 0===e&&(e=void 0);var n=[];return t.forEach((function(t){void 0===e&&n.push(t),void 0!==t[e]&&n.push(t[e])})),n};!function(t){t.EuclideanDistance="euclideanDistance"}(U||(U={}));var K=function(t,e,n){var r=[];(null==e?void 0:e.length)?r=e:(t.forEach((function(t){r=r.concat(Object.keys(t))})),r=Object(p.uniq)(r));var i={};return r.forEach((function(e){var r=[];t.forEach((function(t){void 0!==t[e]&&""!==t[e]&&r.push(t[e])})),r.length&&!(null==n?void 0:n.includes(e))&&(i[e]=Object(p.uniq)(r))})),i},Z=function(t,e,n){var r=K(t,e,n),i=[];if(Object.keys(r).length)return t.forEach((function(t,e){var n=[];if(1===Object.keys(r).length){var o=Object.keys(r)[0];r[o].every((function(t){return!isNaN(Number(t))}))&&(n=[t[o]])}else Object.keys(r).forEach((function(e){for(var i=t[e],o=r[e],a=o.findIndex((function(t){return i===t})),s=[],u=0;u<o.length;u++)u===a?s.push(1):s.push(0);n=n.concat(s)}));i[e]=n})),i},Q=function(t,e,n,r){void 0===n&&(n=U.EuclideanDistance);var i=0;switch(n){case U.EuclideanDistance:i=new H(t).euclideanDistance(new H(e))}return i},$=function(t,e,n,r){for(var i=e.length,o=2*r,a=0,s=0;s<i;s++)for(var u=t[s].clusterId,c=0;c<i;c++){if(u===t[c].clusterId)a+=(e[s][c]||0)-(n[s]||0)*(n[c]||0)/o}return a*=1/o},J=function(t,e){void 0===t&&(t=[]);for(var n=t.length,r=new H([]),i=0;i<n;i++)r=r.add(new H(e[i]));var o=r.avg(n);o.normalize();var a=0;for(i=0;i<n;i++){a+=(u=new H(e[i])).squareEuclideanDistance(o)}var s=[];t.forEach((function(){s.push([])}));for(i=0;i<n;i++){var u=new H(e[i]);t[i].clusterInertial=0;for(var c=0;c<n;c++)if(i!==c){var l=new H(e[c]);s[i][c]=u.squareEuclideanDistance(l),t[i].clusterInertial+=s[i][c]}else s[i][c]=0}var f=0,h=2*n*a;for(i=0;i<n;i++){var d=t[i].clusterId;for(c=0;c<n;c++){var p=t[c].clusterId;if(i!==c&&d===p)f+=t[i].clusterInertial*t[c].clusterInertial/Math.pow(h,2)-s[i][c]/h}}return Number(f.toFixed(4))},tt=function(t,e,n,r,i,o,a,s,u){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e-4),void 0===i&&(i=!1),void 0===o&&(o=void 0),void 0===a&&(a=[]),void 0===s&&(s=["id"]),void 0===u&&(u=1);var c=t.nodes,l=void 0===c?[]:c,f=t.edges,h=void 0===f?[]:f,d=[];if(i){l.forEach((function(t,e){t.properties=t.properties||{},t.originIndex=e}));var g=[];l.every((function(t){return t.hasOwnProperty("nodeType")}))&&(g=Array.from(new Set(l.map((function(t){return t.nodeType})))),l.forEach((function(t){t.properties.nodeType=g.findIndex((function(e){return e===t.nodeType}))})));var v=q(l,o);d=Z(v,a,s)}var y=1,m={},b={};l.forEach((function(t,e){var n=String(y++);t.clusterId=n,m[n]={id:n,nodes:[t]},b[t.id]={node:t,idx:e}}));var _=x(t,e),w=[],E={},S=0;_.forEach((function(t,e){var n=0,r=l[e].id;E[r]={},t.forEach((function(t,e){if(t){n+=t;var i=l[e].id;E[r][i]=t,S+=t}})),w.push(n)})),S/=2;for(var O=1/0,M=1/0,k=0,A=[],C={};;){O=i&&l.every((function(t){return t.hasOwnProperty("properties")}))?$(l,_,w,S)+J(l,d)*u:$(l,_,w,S),0===k&&(M=O,A=l,C=m);var T=O>0&&O>M&&O-M<r;if(O>M&&(A=l.map((function(t){return{node:t,clusterId:t.clusterId}})),C=Object(p.clone)(m),M=O),T||k>100)break;k++,Object.keys(m).forEach((function(t){var e=0;h.forEach((function(r){var i=r.source,o=r.target,a=b[i].node.clusterId,s=b[o].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=r[n]||1)})),m[t].sumTot=e})),l.forEach((function(t,e){var r,o=m[t.clusterId],a=0,s=w[e]/(2*S),c=0,l=o.nodes;l.forEach((function(t){var n=b[t.id].idx;c+=_[e][n]||0}));var f=c-o.sumTot*s,p=l.filter((function(e){return e.id!==t.id})),g=[];p.forEach((function(t,e){g[e]=d[t.originIndex]}));var v=J(p,d)*u,y=E[t.id];if(Object.keys(y).forEach((function(n){var o=b[n].node.clusterId;if(o!==t.clusterId){var c=m[o],l=c.nodes;if(l&&l.length){var h=0;l.forEach((function(t){var n=b[t.id].idx;h+=_[e][n]||0}));var p=h-c.sumTot*s,g=l.concat([t]),y=[];g.forEach((function(t,e){y[e]=d[t.originIndex]}));var x=J(g,d)*u,w=p-f;i&&(w=p+x-(f+v)),w>a&&(a=w,r=c)}}})),a>0){r.nodes.push(t);var x=t.clusterId;t.clusterId=r.id;var O=o.nodes.indexOf(t);o.nodes.splice(O,1);var M=0,k=0;h.forEach((function(t){var e=t.source,i=t.target,o=b[e].node.clusterId,a=b[i].node.clusterId;(o===r.id&&a!==r.id||a===r.id&&o!==r.id)&&(M+=t[n]||1),(o===x&&a!==x||a===x&&o!==x)&&(k+=t[n]||1)})),r.sumTot=M,o.sumTot=k}}))}var I={},j=0;Object.keys(C).forEach((function(t){var e=C[t];if(e.nodes&&e.nodes.length){var n=String(j+1);n!==t&&(e.id=n,e.nodes=e.nodes.map((function(t){return{id:t.id,clusterId:n}})),C[n]=e,I[t]=n,delete C[t],j++)}else delete C[t]})),A.forEach((function(t){var e=t.node,n=t.clusterId;e.clusterId=n,e.clusterId&&I[e.clusterId]&&(e.clusterId=I[e.clusterId])}));var P=[],N={};h.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=b[e].node.clusterId,a=b[r].node.clusterId,s="".concat(o,"---").concat(a);if(N[s])N[s].weight+=i,N[s].count++;else{var u={source:o,target:a,weight:i,count:1};N[s]=u,P.push(u)}}));var D=[];return Object.keys(C).forEach((function(t){D.push(C[t])})),{clusters:D,clusterEdges:P}},et=function(t,e,n,r,i,o,a,s){return void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e-4),void 0===i&&(i=void 0),void 0===o&&(o=[]),void 0===a&&(a=["id"]),void 0===s&&(s=1),tt(t,e,n,r,!0,i,o,a,s)},nt=function(t,e){var n;void 0===e&&(e=1);for(var r=Object(p.clone)(t),i=r.nodes,o=void 0===i?[]:i,a=r.edges,s=void 0===a?[]:a,u=function(){var t=j({nodes:o,edges:s}),r=Object.keys(t);r.sort((function(e,n){var r,i;return(null===(r=t[e])||void 0===r?void 0:r.degree)-(null===(i=t[n])||void 0===i?void 0:i.degree)}));var i=r[0];if(!o.length||(null===(n=t[i])||void 0===n?void 0:n.degree)>=e)return"break";var a=o.findIndex((function(t){return t.id===i}));o.splice(a,1),s=s.filter((function(t){return!(t.source===i||t.target===i)}))};;){if("break"===u())break}return{nodes:o,edges:s}},rt=function(t,e,n){var r=[];switch(t){case U.EuclideanDistance:r=e[n];break;default:r=[]}return r},it=function(t,e,n,r,i,o){void 0===e&&(e=3),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=["id"]),void 0===o&&(o=U.EuclideanDistance);var a=t.nodes,s=t.edges;if(o===U.EuclideanDistance&&!a.every((function(t){return t.hasOwnProperty(n)})))return{clusters:[{id:"0",nodes:a}],clusterEdges:[]};var u=[],c=[];o===U.EuclideanDistance&&(u=q(a,n),c=Z(u,r,i));for(var l=0;l<a.length;l++)a[l].originIndex=l;var f=[],h=[],d=[];for(l=0;l<e;l++)if(0===l){var g=Math.floor(Math.random()*a.length);switch(o){case U.EuclideanDistance:f[l]=c[g];break;default:f[l]=[]}h.push(g),d[l]=[a[g]],a[g].clusterId=String(l)}else{for(var v=-1/0,y=0,m=function(t){if(!h.includes(t)){for(var e=0,n=0;n<f.length;n++){var r=0;switch(o){case U.EuclideanDistance:r=Q(c[a[t].originIndex],f[n],o)}e+=r}var i=e/f.length;i>v&&!f.find((function(e){return Object(p.isEqual)(e,rt(o,c,a[t].originIndex))}))&&(v=i,y=t)}},b=0;b<a.length;b++)m(b);f[l]=rt(o,c,y),h.push(y),d[l]=[a[y]],a[y].clusterId=String(l)}for(var x=0;;){for(l=0;l<a.length;l++){var _=0,w=1/0;if(0!==x||!h.includes(l)){for(var E=0;E<f.length;E++){var S=0;switch(o){case U.EuclideanDistance:S=Q(c[l],f[E],o)}S<w&&(w=S,_=E)}if(void 0!==a[l].clusterId)for(var O=d[Number(a[l].clusterId)].length-1;O>=0;O--)d[Number(a[l].clusterId)][O].id===a[l].id&&d[Number(a[l].clusterId)].splice(O,1);a[l].clusterId=String(_),d[_].push(a[l])}}var M=!1;for(l=0;l<d.length;l++){var k=d[l],A=new H([]);for(E=0;E<k.length;E++)A=A.add(new H(c[k[E].originIndex]));var C=A.avg(k.length);C.equal(new H(f[l]))||(M=!0,f[l]=C.getArr())}if(x++,a.every((function(t){return void 0!==t.clusterId}))&&M||x>=1e3)break}var T=[],I={};return s.forEach((function(t){var e,n,r=t.source,i=t.target,o=null===(e=a.find((function(t){return t.id===r})))||void 0===e?void 0:e.clusterId,s=null===(n=a.find((function(t){return t.id===i})))||void 0===n?void 0:n.clusterId,u="".concat(o,"---").concat(s);if(I[u])I[u].count++;else{var c={source:o,target:s,count:1};I[u]=c,T.push(c)}})),{clusters:d,clusterEdges:T}},ot=function(t,e){var n=new H(e),r=n.norm2(),i=new H(t),o=i.norm2(),a=n.dot(i),s=r*o,u=s?a/s:0;return u},at=function(t,e,n,r,i){void 0===t&&(t=[]),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=[]);var o=Object(p.clone)(t.filter((function(t){return t.id!==e.id}))),a=t.findIndex((function(t){return t.id===e.id})),s=q(t,n),u=Z(s,r,i),c=u[a],l=[];return o.forEach((function(t,n){if(t.id!==e.id){var r=u[n],i=ot(r,c);l.push(i),t.cosineSimilarity=i}})),o.sort((function(t,e){return e.cosineSimilarity-t.cosineSimilarity})),{allCosineSimilarity:l,similarNodes:o}},st=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,n=t;e<n.length;e++){var r=n[e];this.parent[r]=r}}return t.prototype.find=function(t){for(;this.parent[t]!==t;)t=this.parent[t];return t},t.prototype.union=function(t,e){var n=this.find(t),r=this.find(e);n!==r&&(n<r?(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]):(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]))},t.prototype.connected=function(t,e){return this.find(t)===this.find(e)},t}(),ut=function(t,e){return t-e},ct=function(){function t(t){void 0===t&&(t=ut),this.compareFn=t,this.list=[]}return t.prototype.getLeft=function(t){return 2*t+1},t.prototype.getRight=function(t){return 2*t+2},t.prototype.getParent=function(t){return 0===t?null:Math.floor((t-1)/2)},t.prototype.isEmpty=function(){return this.list.length<=0},t.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},t.prototype.delMin=function(){var t=this.top(),e=this.list.pop();return this.list.length>0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,n=t,r=this.getLeft(t),i=this.getRight(t),o=this.list.length;null!==r&&r<o&&this.compareFn(this.list[n],this.list[r])>0?n=r:null!==i&&i<o&&this.compareFn(this.list[n],this.list[i])>0&&(n=i),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},t}(),lt=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=i[0],u=new Set;u.add(s);var c=new ct((function(t,n){return e?t.weight-n.weight:0}));for(M(s.id,a).forEach((function(t){c.insert(t)}));!c.isEmpty();){var l=c.delMin(),f=l.source,h=l.target;u.has(f)&&u.has(h)||(n.push(l),u.has(f)||(u.add(f),M(f,a).forEach((function(t){c.insert(t)}))),u.has(h)||(u.add(h),M(h,a).forEach((function(t){c.insert(t)}))))}return n},ft=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=a.map((function(t){return t}));e&&s.sort((function(t,e){return t.weight-e.weight}));for(var u=new st(i.map((function(t){return t.id})));s.length>0;){var c=s.shift(),l=c.source,f=c.target;u.connected(l,f)||(n.push(c),u.union(l,f))}return n},ht=function(t,e,n){return n?{prim:lt,kruskal:ft}[n](t,e):ft(t,e)},dt=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,u=void 0===s?[]:s,c=t.edges,l=void 0===c?[]:c,f=u.length,h={},d={},p=0;p<f;++p){h[v=(_=u[p]).id]=1/f,d[v]=1/f}for(var g=j(t);a>0&&i>e;){o=0;for(p=0;p<f;++p){var v=(_=u[p]).id;if(r=0,0===g[_.id].inDegree)h[v]=0;else{for(var y=O(v,l,"source"),m=0;m<y.length;++m){var b=y[m],x=g[b].outDegree;x>0&&(r+=d[b]/x)}h[v]=n*r,o+=h[v]}}o=(1-o)/f,i=0;for(p=0;p<f;++p){var _;r=h[v=(_=u[p]).id]+o,i+=Math.abs(r-d[v]),d[v]=r}a-=1}return d},pt=function(t,e,n,r){void 0===t&&(t=-1),void 0===e&&(e=-1),void 0===n&&(n=-1),void 0===r&&(r="-1"),this.id=t,this.from=e,this.to=n,this.label=r},gt=function(){function t(t,e){void 0===t&&(t=-1),void 0===e&&(e="-1"),this.id=t,this.label=e,this.edges=[],this.edgeMap={}}return t.prototype.addEdge=function(t){this.edges.push(t),this.edgeMap[t.id]=t},t}(),vt=function(){function t(t,e,n){void 0===t&&(t=-1),void 0===e&&(e=!0),void 0===n&&(n=!1),this.id=t,this.edgeIdAutoIncrease=e,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return t.prototype.getNodeNum=function(){return this.nodes.length},t.prototype.addNode=function(t,e){if(!this.nodeMap[t]){var n=new gt(t,e);this.nodes.push(n),this.nodeMap[t]=n,this.nodeLabelMap[e]||(this.nodeLabelMap[e]=[]),this.nodeLabelMap[e].push(t)}},t.prototype.addEdge=function(t,e,n,r){if((this.edgeIdAutoIncrease||void 0===t)&&(t=this.counter++),!(this.nodeMap[e]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[t])){var i=new pt(t,e,n,r);if(this.edges.push(i),this.edgeMap[t]=i,this.nodeMap[e].addEdge(i),this.edgeLabelMap[r]||(this.edgeLabelMap[r]=[]),this.edgeLabelMap[r].push(i),!this.directed){var o=new pt(t,n,e,r);this.nodeMap[n].addEdge(o),this.edgeLabelMap[r].push(o)}}},t}(),yt=function(){function t(t,e,n,r,i){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:n||"-1",edgeLabel:r||"-1",nodeLabel2:i||"-1"}}return t.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t}(),mt=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(t){var e=this.dfsEdgeList.length;if(e!==t.length)return!1;for(var n=0;n<e;n++)if(this.dfsEdgeList[n]!==t[n])return!1;return!0},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t.prototype.pushBack=function(t,e,n,r,i){return this.dfsEdgeList.push(new yt(t,e,n,r,i)),this.dfsEdgeList},t.prototype.toGraph=function(t,e){void 0===t&&(t=-1),void 0===e&&(e=!1);var n=new vt(t,!0,e);return this.dfsEdgeList.forEach((function(t){var e=t.fromNode,r=t.toNode,i=t.nodeEdgeNodeLabel,o=i.nodeLabel1,a=i.edgeLabel,s=i.nodeLabel2;"-1"!==o&&n.addNode(e,o),"-1"!==s&&n.addNode(r,s),"-1"!==o&&s!==o&&n.addEdge(void 0,e,r,a)})),n},t.prototype.buildRmpath=function(){this.rmpath=[];for(var t=void 0,e=this.dfsEdgeList.length-1;e>=0;e--){var n=this.dfsEdgeList[e],r=n.fromNode,i=n.toNode;r<i&&(void 0===t||i===t)&&(this.rmpath.push(e),t=r)}return this.rmpath},t.prototype.getNodeNum=function(){var t={};return this.dfsEdgeList.forEach((function(e){t[e.fromNode]||(t[e.fromNode]=!0),t[e.toNode]||(t[e.toNode]=!0)})),Object.keys(t).length},t}(),bt=function(){function t(t){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],t){for(;t;){var e=t.edge;this.edges.push(e),this.nodesUsed[e.from]=1,this.nodesUsed[e.to]=1,this.edgesUsed[e.id]=1,t=t.preNode}this.edges=this.edges.reverse()}}return t.prototype.hasNode=function(t){return 1===this.nodesUsed[t.id]},t.prototype.hasEdge=function(t){return 1===this.edgesUsed[t.id]},t}(),xt=function(){function t(t){var e=t.graphs,n=t.minSupport,r=void 0===n?2:n,i=t.minNodeNum,o=void 0===i?1:i,a=t.maxNodeNum,s=void 0===a?4:a,u=t.top,c=void 0===u?10:u,l=t.directed,f=void 0!==l&&l,h=t.verbose,d=void 0!==h&&h;this.graphs=e,this.dfsCode=new mt,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=r,this.top=c,this.directed=f,this.counter=0,this.maxNodeNum=s,this.minNodeNum=o,this.verbose=d,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return t.prototype.findForwardRootEdges=function(t,e){var n=this,r=[],i=t.nodeMap;return e.edges.forEach((function(t){(n.directed||e.label<=i[t.to].label)&&r.push(t)})),r},t.prototype.findBackwardEdge=function(t,e,n,r){if(!this.directed&&e===n)return null;for(var i=t.nodeMap,o=i[n.to].edges,a=o.length,s=0;s<a;s++){var u=o[s];if(!r.hasEdge(u)&&u.to===e.from)if(this.directed){if(i[e.from].label<i[n.to].label||i[e.from].label===i[n.to].label&&e.label<=u.label)return u}else if(e.label<u.label||e.label===u.label&&i[e.to].label<=i[n.to].label)return u}return null},t.prototype.findForwardPureEdges=function(t,e,n,r){for(var i=[],o=e.to,a=t.nodeMap[o].edges,s=a.length,u=0;u<s;u++){var c=a[u],l=t.nodeMap[c.to];n<=l.label&&!r.hasNode(l)&&i.push(c)}return i},t.prototype.findForwardRmpathEdges=function(t,e,n,r){for(var i=[],o=t.nodeMap,a=o[e.to].label,s=o[e.from].edges,u=s.length,c=0;c<u;c++){var l=s[c],f=o[l.to].label;e.to===l.to||n>f||r.hasNode(o[l.to])||(e.label<l.label||e.label===l.label&&a<=f)&&i.push(l)}return i},t.prototype.getSupport=function(t){var e={};return t.forEach((function(t){e[t.graphId]||(e[t.graphId]=!0)})),Object.keys(e).length},t.prototype.findMinLabel=function(t){var e=void 0;return Object.keys(t).forEach((function(n){var r=t[n],i=r.nodeLabel1,o=r.edgeLabel,a=r.nodeLabel2;e?(i<e.nodeLabel1||i===e.nodeLabel1&&o<e.edgeLabel||i===e.nodeLabel1&&o===e.edgeLabel&&a<e.nodeLabel2)&&(e={nodeLabel1:i,edgeLabel:o,nodeLabel2:a}):e={nodeLabel1:i,edgeLabel:o,nodeLabel2:a}})),e},t.prototype.isMin=function(){var t=this,e=this.dfsCode;if(this.verbose&&console.log("isMin checking",e),1===e.dfsEdgeList.length)return!0;var n=this.directed,r=e.toGraph(-1,n),i=r.nodeMap,o=new mt,a={};r.nodes.forEach((function(e){t.findForwardRootEdges(r,e).forEach((function(t){var n=i[t.to],o="".concat(e.label,"-").concat(t.label,"-").concat(n.label);a[o]||(a[o]={projected:[],nodeLabel1:e.label,edgeLabel:t.label,nodeLabel2:n.label});var s={graphId:r.id,edge:t,preNode:null};a[o].projected.push(s)}))}));var s=this.findMinLabel(a);if(s){o.dfsEdgeList.push(new yt(0,1,s.nodeLabel1,s.edgeLabel,s.nodeLabel2));var u="".concat(s.nodeLabel1,"-").concat(s.edgeLabel,"-").concat(s.nodeLabel2);return function a(s){for(var u=o.buildRmpath(),c=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,l=o.dfsEdgeList[u[0]].toNode,f={},h=!1,d=0,p=n?-1:0,g=function(e){if(h)return"break";s.forEach((function(n){var i=new bt(n),a=t.findBackwardEdge(r,i.edges[u[e]],i.edges[u[0]],i);a&&(f[a.label]||(f[a.label]={projected:[],edgeLabel:a.label}),f[a.label].projected.push({graphId:r.id,edge:f,preNode:n}),d=o.dfsEdgeList[u[e]].fromNode,h=!0)}))},v=u.length-1;v>p;v--){if("break"===g(v))break}if(h){var y=t.findMinLabel(f);o.dfsEdgeList.push(new yt(l,d,"-1",y.edgeLabel,"-1"));var m=o.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[m]===o.dfsEdgeList[m]&&a(f[y.edgeLabel].projected)}var b={};h=!1;var x=0;s.forEach((function(e){var n=new bt(e),o=t.findForwardPureEdges(r,n.edges[u[0]],c,n);o.length>0&&(h=!0,x=l,o.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}));var _=u.length,w=function(e){if(h)return"break";var n=u[e];s.forEach((function(e){var a=new bt(e),s=t.findForwardRmpathEdges(r,a.edges[n],c,a);s.length>0&&(h=!0,x=o.dfsEdgeList[n].fromNode,s.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}))};for(v=0;v<_;v++){if("break"===w(v))break}if(!h)return!0;var E=t.findMinLabel(b);o.dfsEdgeList.push(new yt(x,l+1,"-1",E.edgeLabel,E.nodeLabel2));var S=o.dfsEdgeList.length-1;return e.dfsEdgeList[S]===o.dfsEdgeList[S]&&a(b["".concat(E.edgeLabel,"-").concat(E.nodeLabel2)].projected)}(a[u].projected)}},t.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var t=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Object(p.clone)(t))}},t.prototype.subGraphMining=function(t){var e=this;if(!(this.getSupport(t)<this.minSupport)&&this.isMin()){this.report();var n=this.dfsCode.getNodeNum(),r=this.dfsCode.buildRmpath(),i=this.dfsCode.dfsEdgeList[r[0]].toNode,o=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,a={},s={};t.forEach((function(t){for(var u=e.graphs[t.graphId],c=u.nodeMap,l=new bt(t),f=r.length-1;f>=0;f--){var h=e.findBackwardEdge(u,l.edges[r[f]],l.edges[r[0]],l);if(h){var d="".concat(e.dfsCode.dfsEdgeList[r[f]].fromNode,"-").concat(h.label);s[d]||(s[d]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[r[f]].fromNode,edgeLabel:h.label}),s[d].projected.push({graphId:t.graphId,edge:h,preNode:t})}}if(!(n>=e.maxNodeNum)){e.findForwardPureEdges(u,l.edges[r[0]],o,l).forEach((function(e){var n="".concat(i,"-").concat(e.label,"-").concat(c[e.to].label);a[n]||(a[n]={projected:[],fromNodeId:i,edgeLabel:e.label,nodeLabel2:c[e.to].label}),a[n].projected.push({graphId:t.graphId,edge:e,preNode:t})}));var p=function(n){e.findForwardRmpathEdges(u,l.edges[r[n]],o,l).forEach((function(i){var o="".concat(e.dfsCode.dfsEdgeList[r[n]].fromNode,"-").concat(i.label,"-").concat(c[i.to].label);a[o]||(a[o]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[r[n]].fromNode,edgeLabel:i.label,nodeLabel2:c[i.to].label}),a[o].projected.push({graphId:t.graphId,edge:i,preNode:t})}))};for(f=0;f<r.length;f++)p(f)}})),Object.keys(s).forEach((function(t){var n=s[t],r=n.toNodeId,o=n.edgeLabel;e.dfsCode.dfsEdgeList.push(new yt(i,r,"-1",o,"-1")),e.subGraphMining(s[t].projected),e.dfsCode.dfsEdgeList.pop()})),Object.keys(a).forEach((function(t){var n=a[t],r=n.fromNodeId,o=n.edgeLabel,s=n.nodeLabel2;e.dfsCode.dfsEdgeList.push(new yt(r,i+1,"-1",o,s)),e.subGraphMining(a[t].projected),e.dfsCode.dfsEdgeList.pop()}))}},t.prototype.generate1EdgeFrequentSubGraphs=function(){var t=this.graphs,e=this.directed,n=this.minSupport,r=this.frequentSize1Subgraphs,i={},o={},a={},s={};return Object.keys(t).forEach((function(n){var r=t[n],u=r.nodeMap;r.nodes.forEach((function(t,r){var c=t.label,l="".concat(n,"-").concat(c);if(!a[l]){var f=i[c]||0;f++,i[c]=f}a[l]={graphKey:n,label:c},t.edges.forEach((function(t){var r=c,i=u[t.to].label;if(!e&&r>i){var a=i;i=r,r=a}var l=t.label,f="".concat(n,"-").concat(r,"-").concat(l,"-").concat(i),h="".concat(r,"-").concat(l,"-").concat(i);if(!o[h]){var d=o[h]||0;d++,o[h]=d}s[f]={graphId:n,nodeLabel1:r,edgeLabel:l,nodeLabel2:i}}))}))})),Object.keys(i).forEach((function(t){if(!(i[t]<n)){var e={nodes:[],edges:[]};e.nodes.push({id:"0",label:t}),r.push(e)}})),r},t.prototype.run=function(){var t=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var e=this.graphs,n=(this.directed,{});Object.keys(e).forEach((function(r){var i=e[r],o=i.nodeMap;i.nodes.forEach((function(e){t.findForwardRootEdges(i,e).forEach((function(t){var i=o[t.to],a="".concat(e.label,"-").concat(t.label,"-").concat(i.label);n[a]||(n[a]={projected:[],nodeLabel1:e.label,edgeLabel:t.label,nodeLabel2:i.label});var s={graphId:r,edge:t,preNode:null};n[a].projected.push(s)}))}))})),Object.keys(n).forEach((function(e){var r=n[e],i=r.projected,o=r.nodeLabel1,a=r.edgeLabel,s=r.nodeLabel2;t.dfsCode.dfsEdgeList.push(new yt(0,1,o,a,s)),t.subGraphMining(i),t.dfsCode.dfsEdgeList.pop()}))}},t}(),_t=function(t){var e=t.graphs,n=t.directed,r=void 0!==n&&n,i=t.nodeLabelProp,o=void 0===i?"cluster":i,a=t.edgeLabelProp,s=void 0===a?"cluster":a,u=function(t,e,n,r){var i={};return Object.keys(t).forEach((function(o,a){var s=t[o],u=new vt(a,!0,e),c={};s.nodes.forEach((function(t,e){u.addNode(e,t[n]),c[t.id]=e})),s.edges.forEach((function(t,e){var n=c[t.source],i=c[t.target];u.addEdge(-1,n,i,t[r])})),u&&u.getNodeNum()&&(i[u.id]=u)})),i}(e,r,o,s),c=t.minSupport,l=t.maxNodeNum,f=t.minNodeNum,h=t.verbose,d=t.top,p=new xt({graphs:u,minSupport:c,maxNodeNum:l,minNodeNum:f,top:d,verbose:h,directed:r});return p.run(),function(t,e,n){var r=[];return t.forEach((function(t){var i={nodes:[],edges:[]};t.nodes.forEach((function(t){var n;i.nodes.push(((n={id:"".concat(t.id)})[e]=t.label,n))})),t.edges.forEach((function(t){var e;i.edges.push(((e={source:"".concat(t.from),target:"".concat(t.to)})[n]=t.label,e))})),r.push(i)})),r}(p.frequentSubgraphs,o,s)},wt=function(t,e,n,r){void 0===n&&(n="cluster"),void 0===r&&(r=2);var i=[],o=t.nodes;return e.forEach((function(t,e){i.push(Et(o,t,e,n,r))})),i},Et=function(t,e,n,r,i){var o=[n],a=[],s={};return e.forEach((function(e,u){if(e<=i&&n!==u){o.push(u),a.push(t[u]);var c=t[u][r];s[c]?(s[c].count++,s[c].dists.push(e)):s[c]={count:1,dists:[e]}}})),Object.keys(s).forEach((function(t){s[t].dists=s[t].dists.sort((function(t,e){return t-e}))})),{nodeIdx:n,nodeId:t[n].id,nodeIdxs:o,neighbors:a,neighborNum:o.length-1,nodeLabelCountMap:s}},St=function(t,e,n,r){var i=n.nodes;return r||(r={}),Object.keys(t).forEach((function(o){var a,s;if(!r||!r[o]){r[o]={nodes:[],edges:[]};var u=t[o],c=null===(a=e[u.start])||void 0===a?void 0:a.nodeIdxs,l=null===(s=e[u.end])||void 0===s?void 0:s.nodeIdxs;if(c&&l){var f=new Set(l),h=c.filter((function(t){return f.has(t)}));if(h&&h.length){for(var d={},p=h.length,g=0;g<p;g++){var v=i[h[g]];r[o].nodes.push(v),d[v.id]=!0}n.edges.forEach((function(t){d[t.source]&&d[t.target]&&r[o].edges.push(t)}))}}}})),r},Ot=function(t,e,n,r){var i,o,a={};t.nodes.forEach((function(t){a[t.id]=t}));var s=0;return!(null===(i=null==e?void 0:e.edges)||void 0===i?void 0:i.length)||(null===(o=null==e?void 0:e.nodes)||void 0===o?void 0:o.length)<2?0:(t.edges.forEach((function(t){var i=a[t.source][n],o=a[t.target][n],u=null==e?void 0:e.nodes[0][n],c=null==e?void 0:e.nodes[1][n],l=null==e?void 0:e.edges[0][r];t[r]===l&&(i===u&&o===c||i===c&&o===u)&&s++})),s)},Mt=function(t,e){var n={},r={};return t.forEach((function(t,i){n[t.id]={idx:i,node:t,degree:0,inDegree:0,outDegree:0};var o=t[e];r[o]||(r[o]=[]),r[o].push(t)})),{nodeMap:n,nodeLabelMap:r}},kt=function(t,e,n){var r={},i={};return t.forEach((function(t,o){r["".concat(k)]={idx:o,edge:t};var a=t[e];i[a]||(i[a]=[]),i[a].push(t);var s=n[t.source];s&&(s.degree++,s.outDegree++);var u=n[t.target];u&&(u.degree++,u.inDegree++)})),{edgeMap:r,edgeLabelMap:i}},At=function(t,e,n){var r=e.length,i={};return e.forEach((function(e,o){for(var a=n?0:o+1,s=t[o].id,u=a;u<r;u++)if(o!==u){var c=t[u].id,l=e[u];i["".concat(s,"-").concat(c)]=l,n||(i["".concat(c,"-").concat(s)]=l)}})),i},Ct=function(t,e,n,r,i,o,a,s,u,c,l){var f,h="".concat(e.id,"-").concat(n.id);if(c&&c[h])return c[h];var d=l?l[h]:void 0;if(!d){var p=((f={})[h]={start:r[e.id].idx,end:r[n.id].idx,distance:i},f);d=(l=St(p,o,t,l))[h]}return Ot(d,a,s,u)},Tt=function(t,e,n,r){var i,o,a,s=null===(i=t[e])||void 0===i?void 0:i.degree,u=null===(o=t[e])||void 0===o?void 0:o.inDegree,c=null===(a=t[e])||void 0===a?void 0:a.outDegree;return void 0===t[e]&&(s=1/0,u=1/0,c=1/0,r[e].forEach((function(t){var e=n[t.id].degree;s>e&&(s=e);var r=n[t.id].inDegree;u>r&&(u=r);var i=n[t.id].outDegree;c>i&&(c=i)})),t[e]={degree:s,inDegree:u,outDegree:c}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:c}},It=function(t,e,n,r,i,o,a){var s;if(void 0===n&&(n=!1),void 0===o&&(o="cluster"),void 0===a&&(a="cluster"),t&&t.nodes){var u=t.nodes.length;if(u){var c=X(t,n),l=X(e,n),f=At(t.nodes,c,n),h=At(e.nodes,l,n),p=Mt(t.nodes,o),g=p.nodeMap,v=p.nodeLabelMap,y=Mt(e.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;kt(t.edges,a,g);var x=kt(e.edges,a,m).edgeLabelMap,_=[];null==l||l.forEach((function(t){_=_.concat(t)})),i||(i=Math.max.apply(Math,Object(d.__spreadArray)(Object(d.__spreadArray)([],_,!1),[2],!1))),r||(r=i);var w=wt(t,c,o,r),E=wt(e,l,o,r),S=function(t,e,n,r,i){var o=Math.ceil(n/e),a={},s=0;return r.forEach((function(t,r){for(var u=0,c=0,l=t.nodeIdxs,f=t.neighborNum-1;u<o;){for(var h=l[1+Math.floor(Math.random()*f)],d=0;(a["".concat(r,"-").concat(h)]||a["".concat(h,"-").concat(r)])&&(h=Math.floor(Math.random()*e),!(++d>2*e)););if(d<2*e&&(a["".concat(r,"-").concat(h)]={start:r,end:h,distance:i[r][h]},u++,++s>=n))return a;if(++c>2*e)break}u<o&&(o=(o+(o-u))/(e-r-1))})),a}(0,u,Math.min(100,u*(u-1)/2),w,c),O=St(S,w,t),M=_t({graphs:O,nodeLabelProp:o,edgeLabelProp:a,minSupport:1,minNodeNum:1,maxNodeNum:4,directed:n}).slice(0,10),k=M.length,A=[];M.forEach((function(t,e){A[e]={},Object.keys(O).forEach((function(n){var r=O[n],i=Ot(r,t,o,a);A[e][n]=i}))}));var C=function(t,e,n){for(var r=1/0,i=0,o=function(e){var n=t[e],o=Object.keys(n).sort((function(t,e){return n[t]-n[e]})),a=[];o.forEach((function(t,e){a[e%10]||(a[e%10]={graphs:[],totalCount:0,aveCount:0}),a[e%10].graphs.push(t),a[e%10].totalCount+=n[t]}));var s=0,u=[];a.forEach((function(t){var e=t.totalCount/t.graphs.length;t.aveCount=e,u.push(e);var r=0,i=t.length;t.graphs.forEach((function(e,i){var o=n[e];t.graphs.forEach((function(t,e){i!==e&&(r+=Math.abs(o-n[t]))}))})),s+=r/=i*(i-1)/2})),s/=a.length;var c=0;u.forEach((function(t,e){u.forEach((function(n,r){e!==r&&(c+=Math.abs(t-n))})),c/=u.length*(u.length-1)/2}));var l=c-s;r<l&&(r=l,i=e)},a=0;a<e;a++)o(a);return{structure:n[i],structureCountMap:t[i]}}(A,k,M),T=C.structure,I=C.structureCountMap,j=e.nodes[0],P=[],N=null===(s=e.nodes[0])||void 0===s?void 0:s[o],D=-1/0;e.nodes.forEach((function(t){var e=t[o],n=v[e];(null==n?void 0:n.length)>D&&(D=n.length,P=n,N=e,j=t)}));var L={},R={},B={},F={},z={},U={};Object.keys(b).forEach((function(r,i){z[r]=[],n&&(U[r]=[]);var s=-1/0,u=b[r],c={};u.forEach((function(t){var e=h["".concat(j.id,"-").concat(t.id)];if(e&&z[r].push(e),s<e&&(s=e),c["".concat(j.id,"-").concat(t.id)]={start:0,end:m[t.id].idx,distance:e},n){var i=h["".concat(t.id,"-").concat(j.id)];i&&U[r].push(i)}})),z[r]=z[r].sort((function(t,e){return t-e})),n&&(U[r]=U[r].sort((function(t,e){return t-e}))),R=St(c,E,e,R);var l=[];if(Object.keys(c).forEach((function(t){if(B[t])l.push(B[t]);else{var e=R[t];B[t]=Ot(e,T,o,a),l.push(B[t])}})),l=l.sort((function(t,e){return e-t})),F["".concat(j.id,"-").concat(r)]=l,r!==N)for(var d=function(e){var n=P[e],i=w[g[n.id].idx],s=i.nodeLabelCountMap[r],u=b[r].length;if(!s||s.count<u)return P.splice(e,1),"continue";for(var c=!1,h=0;h<u;h++)if(s.dists[h]>z[r][h]){c=!0;break}if(c)return P.splice(e,1),"continue";var d={};i.neighbors.forEach((function(t){var e=f["".concat(n.id,"-").concat(t.id)];d["".concat(n.id,"-").concat(t.id)]={start:g[n.id].idx,end:g[t.id].idx,distance:e}})),O=St(d,w,t,O);var p=[];Object.keys(d).forEach((function(t){if(I[t])p.push(I[t]);else{var e=O[t];I[t]=Ot(e,T,o,a),p.push(I[t])}})),p=p.sort((function(t,e){return e-t}));var v=!1;for(h=0;h<u;h++)if(p[h]<l[h]){v=!0;break}return v?(P.splice(e,1),"continue"):void 0},p=((null==P?void 0:P.length)||0)-1;p>=0;p--)d(p)}));var V=[];null==P||P.forEach((function(r){for(var s=g[r.id].idx,u=Et(t.nodes,c[s],s,o,i).neighbors,l=!1,h=u.length-1;h>=0;h--){if(u.length+1<e.nodes.length)return void(l=!0);var d=u[h],p=d[o];if(b[p]&&b[p].length)if(z[p]&&z[p].length){var v="".concat(r.id,"-").concat(d.id),y=f[v],x=z[p].length-1;if(y>z[p][x])u.splice(h,1);else{if(n){var _="".concat(d.id,"-").concat(r.id),E=f[_];if(x=U[p].length-1,E>U[p][x]){u.splice(h,1);continue}}var S=I[v]?I[v]:Ct(t,r,d,g,y,w,T,o,a,I,O),M="".concat(j.id,"-").concat(p);if(S<F[M][F[M].length-1])u.splice(h,1);else{var k=Tt(L,p,m,b),A=k.minPatternNodeLabelDegree;k.minPatternNodeLabelInDegree,k.minPatternNodeLabelOutDegree;g[d.id].degree<A&&u.splice(h,1)}}}else u.splice(h,1);else u.splice(h,1)}l||V.push({nodes:[r].concat(u)})}));var W=G(e,j.id,!1).length,Y={};n?(Object.keys(W).forEach((function(t){var e=m[t].node[o];Y[e]?Y[e].push(W[t]):Y[e]=[W[t]]})),Object.keys(Y).forEach((function(t){Y[t].sort((function(t,e){return t-e}))}))):Y=z;for(var H=function(r){var i=V[r],s=i.nodes[0],u={},c={};i.nodes.forEach((function(t,e){c[t.id]={idx:e,node:t,degree:0,inDegree:0,outDegree:0};var n=t[o];u[n]?u[n]++:u[n]=1}));var l=[],f={};t.edges.forEach((function(t){c[t.source]&&c[t.target]&&(l.push(t),f[t[a]]?f[t[a]]++:f[t[a]]=1,c[t.source].degree++,c[t.target].degree++,c[t.source].outDegree++,c[t.target].inDegree++)}));for(var h=Object.keys(x).length,d=!1,p=0;p<h;p++){var v=Object.keys(x)[p];if(!f[v]||f[v]<x[v].length){d=!0;break}}if(d)return V.splice(r,1),"continue";var y=l.length;if(y<e.edges.length)return V.splice(r,1),"break";var _=!1,w=function(t){var e=l[t],r=e[a],i=x[r];if(!i||!i.length)return f[r]--,i&&f[r]<i.length?(_=!0,"break"):(l.splice(t,1),c[e.source].degree--,c[e.target].degree--,c[e.source].outDegree--,c[e.target].inDegree--,"continue");var s=c[e.source].node[o],u=c[e.target].node[o],h=!1;return i.forEach((function(t){var e=m[t.source].node,r=m[t.target].node;e[o]===s&&r[o]===u&&(h=!0),n||e[o]!==u||r[o]!==s||(h=!0)})),h?void 0:(f[r]--,i&&f[r]<i.length?(_=!0,"break"):(l.splice(t,1),c[e.source].degree--,c[e.target].degree--,c[e.source].outDegree--,c[e.target].inDegree--,"continue"))};for(p=y-1;p>=0;p--){if("break"===w(p))break}if(_)return V.splice(r,1),"continue";i.edges=l;var E=G(i,i.nodes[0].id,!1).length;if(Object.keys(E).reverse().forEach((function(t){if(t!==i.nodes[0].id&&!_){if(E[t]===1/0){var e=c[t].node[o];if(u[e]--,u[e]<b[e].length)return void(_=!0);var n=i.nodes.indexOf(c[t].node);return i.nodes.splice(n,1),void(c[t]=void 0)}var r=g[t].node[o];if(!Y[r]||!Y[r].length||E[t]>Y[r][Y[r].length-1]){e=c[t].node[o];if(u[e]--,u[e]<b[e].length)return void(_=!0);n=i.nodes.indexOf(c[t].node);i.nodes.splice(n,1),c[t]=void 0}}})),_)return V.splice(r,1),"continue";for(var S=!0,O=0;S&&!_;){if(S=!1,n?c[s.id].degree<m[j.id].degree||c[s.id].inDegree<m[j.id].inDegree||c[s.id].outDegree<m[j.id].outDegree:c[s.id].degree<m[j.id].degree){_=!0;break}if(u[s[o]]<b[s[o]].length){_=!0;break}for(var M=i.nodes.length-1;M>=0;M--){var k=i.nodes[M],A=c[k.id].degree,C=c[k.id].inDegree,T=c[k.id].outDegree,I=k[o],P=Tt(L,I,m,b),N=P.minPatternNodeLabelDegree,D=P.minPatternNodeLabelInDegree,R=P.minPatternNodeLabelOutDegree;if(n?A<N||C<D||T<R:A<N){if(u[k[o]]--,u[k[o]]<b[k[o]].length){_=!0;break}i.nodes.splice(M,1),c[k.id]=void 0,S=!0}}if(_||!S&&0!==O)break;for(var B=(y=l.length)-1;B>=0;B--){var F=l[B];if(!c[F.source]||!c[F.target]){l.splice(B,1);var z=F[a];if(f[z]--,c[F.source]&&(c[F.source].degree--,c[F.source].outDegree--),c[F.target]&&(c[F.target].degree--,c[F.target].inDegree--),x[z]&&f[z]<x[z].length){_=!0;break}S=!0}}O++}return _||_||i.nodes.length<e.nodes.length||l.length<e.edges.length?(V.splice(r,1),"continue"):void 0},q=V.length-1;q>=0;q--){if("break"===H(q))break}var K=V.length,Z=function(t){var e=V[t],n={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);n[e]?n[e]++:n[e]=1}));for(var r=function(t){var e=V[t],r={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1}));var i=!0;Object.keys(r).length!==Object.keys(n).length?i=!1:Object.keys(n).forEach((function(t){r[t]!==n[t]&&(i=!1)})),i&&V.splice(t,1)},i=K-1;i>t;i--)r(i);K=V.length};for(q=0;q<=K-1;q++)Z(q);return V}}},jt=function(){function t(t){void 0===t&&(t=10),this.linkedList=new E,this.maxStep=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map((function(t){return t.value}))},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),Pt=F,Nt={getAdjMatrix:x,breadthFirstSearch:A,connectedComponent:T,getDegree:j,getInDegree:P,getOutDegree:N,detectCycle:F,detectDirectedCycle:Pt,detectAllCycles:B,detectAllDirectedCycle:R,detectAllUndirectedCycle:L,depthFirstSearch:D,dijkstra:G,findAllPath:W,findShortestPath:V,floydWarshall:X,labelPropagation:Y,louvain:tt,iLouvain:et,kCore:nt,kMeans:it,cosineSimilarity:ot,nodesCosineSimilarity:at,minimumSpanningTree:ht,pageRank:dt,getNeighbors:O,Stack:jt,GADDI:It},Dt=b.a.transform,Lt=function(t){return function(e,n){return e[t]-n[t]}},Rt=function(t,e,n){return t>=e&&t<=n},Bt=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,u=r.x-n.x,c=r.y-n.y,l=a*c-s*u,f=1/l;if(l*l>1e-4*(a*a+s*s)*(u*u+c*c)){var h=(i*c-o*u)*f,d=(i*s-o*a)*f;return Rt(h,0,1)&&Rt(d,0,1)?{x:t.x+h*a,y:t.y+h*s}:null}return null},Ft=function(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=[],s={x:n+i/2,y:r+o/2};a.push({x:n,y:r}),a.push({x:n+i,y:r}),a.push({x:n+i,y:r+o}),a.push({x:n,y:r+o}),a.push({x:n,y:r});for(var u=null,c=1;c<a.length&&!(u=Bt(a[c-1],a[c],s,e));c++);return u},Gt=function(t,e){var n=t.x,r=t.y,i=t.r,o=e.x-n,a=e.y-r;if(o*o+a*a<i*i)return null;var s=Math.atan(a/o);return{x:n+Math.abs(i*Math.cos(s))*Math.sign(o),y:r+Math.abs(i*Math.sin(s))*Math.sign(a)}},zt=function(t,e){var n=t.rx,r=t.ry,i=t.x,o=t.y,a=e.x-i,s=e.y-o,u=Math.atan2(s/r,a/n);return u<0&&(u+=2*Math.PI),{x:i+n*Math.cos(u),y:o+r*Math.sin(u)}},Ut=function(t,e,n){void 0===n&&(n=1);var r=[t.x,t.y,n];return e&&!isNaN(e[0])||(e=[1,0,0,0,1,0,0,0,1]),b.d.transformMat3(r,r,e),{x:r[0],y:r[1]}},Vt=function(t,e,n){void 0===n&&(n=1),e&&!isNaN(e[0])||(e=[1,0,0,0,1,0,0,0,1]);var r=b.b.invert([1,0,0,0,1,0,0,0,1],e);r||(r=[1,0,0,0,1,0,0,0,1]);var i=[t.x,t.y,n];return b.d.transformMat3(i,i,r),{x:i[0],y:i[1]}},Wt=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=t.x-n.x,a=t.y-n.y,s=(t.x*t.x-e.x*e.x-e.y*e.y+t.y*t.y)/2,u=(t.x*t.x-n.x*n.x-n.y*n.y+t.y*t.y)/2,c=i*o-r*a;return{x:-(a*s-i*u)/c,y:-(r*u-o*s)/c}},Xt=function(t,e){var n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)},Yt=function(t,e){var n=[];return t.forEach((function(t){var r=[];t.forEach((function(t){r.push(t*e)})),n.push(r)})),n},Ht=function(t){for(var e=[],n=t.length,r=0;r<n;r+=1){e[r]=[];for(var i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(var o=0;o<n;o+=1)for(r=0;r<n;r+=1)for(i=0;i<n;i+=1)e[r][i]>e[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e},qt=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];i[a][s]=1,e||(i[s][a]=1)})),i},Kt=function(t,e){t.translate(e.x,e.y)},Zt=function(t,e,n,r){void 0===r&&(r={duration:500});var i=t.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var o=t.getCanvasBBox(),a=e.x-o.minX,s=e.y-o.minY;if(n){var u=a*i[0],c=s*i[4],l=0,f=0,h=0,d=0;t.animate((function(t){return i=Dt(i,[["t",(h=u*t)-l,(d=c*t)-f]]),l=h,f=d,{matrix:i}}),r)}else{var p=Dt(i,[["t",a,s]]);t.setMatrix(p)}},Qt=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e;Object(p.isArray)(e)||(r=[e,e]),Object(p.isArray)(e)&&1===e.length&&(r=[e[0],e[0]]),n=Dt(n,[["s",r[0],r[1]]]),t.setMatrix(n)},$t=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Dt(n,[["r",e]]),t.setMatrix(n)},Jt=function(t,e,n){for(var r=[],i=0;i<t;i++)r[i]=0;return n.forEach((function(t){t.source&&(r[e[t.source]]+=1),t.target&&(r[e[t.target]]+=1)})),r};function te(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}var ee=function(t,e,n){var r=!1,i=t.length;function o(t){return Math.abs(t)<1e-6?0:t<0?-1:1}if(i<=2)return!1;for(var a=0;a<i;a++){var s=t[a],u=t[(a+1)%i];if(te(s,u,[e,n]))return!0;o(s[1]-n)>0!=o(u[1]-n)>0&&o(e-(n-s[1])*(s[0]-u[0])/(s[1]-u[1])-s[0])<0&&(r=!r)}return r},ne=function(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)},re=function(t,e){var n=function(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]}));return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,n),maxY:Math.max.apply(null,n)}},r=function(t){for(var e=[],n=t.length,r=0;r<n-1;r++){var i=t[r],o=t[r+1];e.push({from:{x:i[0],y:i[1]},to:{x:o[0],y:o[1]}})}if(e.length>1){var a=t[0],s=t[n-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e};if(t.length<2||e.length<2)return!1;var i=n(t),o=n(e);if(!ne(i,o))return!1;var a=!1;if(Object(p.each)(e,(function(e){if(ee(t,e[0],e[1]))return a=!0,!1})),a)return!0;if(Object(p.each)(t,(function(t){if(ee(e,t[0],t[1]))return a=!0,!1})),a)return!0;var s=r(t),u=r(e),c=!1;return Object(p.each)(u,(function(t){if(function(t,e){var n=!1;return Object(p.each)(t,(function(t){if(Bt(t.from,t.to,e.from,e.to))return n=!0,!1})),n}(s,t))return c=!0,!1})),c},ie=function(){function t(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}return t.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:t,y:e,minX:t,minY:e,maxX:n,maxY:r,width:n-t,height:r-e}},t}(),oe=function(t,e){return{top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]}[e]},ae=function(t,e){var n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){var o=n/i,a=r/i;if(o>=0&&o<=1&&a>=0&&a<=1)return o}return Number.POSITIVE_INFINITY},se=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=0,o=[],a=0;a<4;a++){var s=oe(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3];o[a]=Bt({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:u,y:c},{x:l,y:f}),o[a]&&(i+=1)}return[o,i]},ue=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=Number.POSITIVE_INFINITY,o=0,a=0;a<4;a++){var s=oe(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3],h=ae(e,new ie(u,c,l,f));(h=Math.abs(h-.5))>=0&&h<=1&&(o+=1,i=h<i?h:i)}return 0===o?-1:i},ce=function(t){var e=0,n=0;if(t.length>0){for(var r=0,i=t;r<i.length;r++){var o=i[r];e+=o.x,n+=o.y}e/=t.length,n/=t.length}return{x:e,y:n}},le=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},fe=function(t,e){var n,r=e.x1,i=e.y1,o=e.x2-r,a=e.y2-i,s=t.x-r,u=t.y-i,c=s*o+u*a;n=c<=0||(c=(s=o-s)*o+(u=a-u)*a)<=0?0:c*c/(o*o+a*a);var l=s*s+u*u-n;return l<0&&(l=0),l},he=function(t,e,n){return void 0===n&&(n=.001),Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(n,2)},de=function(t,e){var n=t.x<e.x,r=t.x>e.x+e.width,i=t.y>e.y+e.height,o=t.y<e.y;if(!(n||r||i||o))return 0;if(i&&!n&&!r)return Math.pow(e.y+e.height-t.y,2);if(o&&!n&&!r)return Math.pow(t.y-e.y,2);if(n&&!i&&!o)return Math.pow(e.x-t.x,2);if(r&&!i&&!o)return Math.pow(e.x+e.width-t.x,2);var a=Math.min(Math.abs(e.x-t.x),Math.abs(e.x+e.width-t.x)),s=Math.min(Math.abs(e.y-t.y),Math.abs(e.y+e.height-t.y));return a*a+s*s},pe=function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=e.x,s=e.y,u=[i-n,o-r];if(b.c.exactEquals(u,[0,0]))return NaN;var c=[-u[1],u[0]];b.c.normalize(c,c);var l=[a-n,s-r];return Math.abs(b.c.dot(l,c))},ge=function(t,e,n){return t+(e-t)*n},ve="rgb(253, 253, 253)",ye="rgb(95, 149, 255)",me="rgb(95, 149, 255)",be="rgb(247, 250, 255)",xe="rgb(95, 149, 255)",_e="rgb(224, 224, 224)",we="rgb(95, 149, 255)",Ee="rgb(224, 224, 224)",Se="rgb(95, 149, 255)",Oe={version:"0.6.0-beta.3",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:ye,fill:"rgb(239, 244, 255)"},size:20,color:ye,linkPoints:{size:8,lineWidth:1,fill:be,stroke:me}},nodeStateStyles:{active:{fill:be,stroke:me,lineWidth:2,shadowColor:ye,shadowBlur:10},selected:{fill:"rgb(255, 255, 255)",stroke:xe,lineWidth:4,shadowColor:xe,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:"rgb(223, 234, 255)",stroke:"#4572d9",lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:"rgb(247, 250, 255)",stroke:"rgb(191, 213, 255)",lineWidth:1},disable:{fill:"rgb(250, 250, 250)",stroke:"rgb(224, 224, 224)",lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:_e,lineAppendWidth:2},color:_e},edgeStateStyles:{active:{stroke:"rgb(95, 149, 255)",lineWidth:1},selected:{stroke:we,lineWidth:2,shadowColor:we,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:"rgb(95, 149, 255)",lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:"rgb(234, 234, 234)",lineWidth:1},disable:{stroke:"rgb(245, 245, 245)",lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ve,lineWidth:1,stroke:Ee,r:5,width:20,height:10},size:[20,5],color:Ee,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:"rgb(95, 149, 255)",lineWidth:1,fill:"rgb(247, 250, 255)"},selected:{stroke:Se,lineWidth:2,fill:ve,shadowColor:Se,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:"#4572d9",lineWidth:2,fill:ve,"text-shape":{fontWeight:500}},inactive:{stroke:"rgb(224, 224, 224)",fill:ve,lineWidth:1},disable:{stroke:"rgb(234, 234, 234)",fill:"rgb(250, 250, 250)",lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},windowFontFamily:"undefined"!=typeof window&&window.getComputedStyle&&document.body&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},Me={" ":.3329986572265625,a:.5589996337890625,A:.6569992065429687,b:.58599853515625,B:.6769989013671875,c:.5469985961914062,C:.7279998779296875,d:.58599853515625,D:.705999755859375,e:.554998779296875,E:.63699951171875,f:.37299957275390627,F:.5769989013671875,g:.5909988403320312,G:.7479995727539063,h:.555999755859375,H:.7199996948242188,i:.255999755859375,I:.23699951171875,j:.26699981689453123,J:.5169998168945312,k:.5289993286132812,K:.6899993896484375,l:.23499908447265624,L:.5879989624023437,m:.854998779296875,M:.8819992065429687,n:.5589996337890625,N:.7189987182617188,o:.58599853515625,O:.7669998168945312,p:.58599853515625,P:.6419998168945312,q:.58599853515625,Q:.7669998168945312,r:.3649993896484375,R:.6759994506835938,s:.504998779296875,S:.6319992065429687,t:.354998779296875,T:.6189987182617187,u:.5599990844726562,U:.7139999389648437,v:.48199920654296874,V:.6389999389648438,w:.754998779296875,W:.929998779296875,x:.5089996337890625,X:.63699951171875,y:.4959991455078125,Y:.66199951171875,z:.48699951171875,Z:.6239990234375,0:.6,1:.40099945068359377,2:.6,3:.6,4:.6,5:.6,6:.6,7:.5469985961914062,8:.6,9:.6,"[":.3329986572265625,"]":.3329986572265625,",":.26399993896484375,".":.26399993896484375,";":.26399993896484375,":":.26399993896484375,"{":.3329986572265625,"}":.3329986572265625,"\\":.5,"|":.19499969482421875,"=":.604998779296875,"+":.604998779296875,"-":.604998779296875,_:.5,"`":.3329986572265625," ~":.8329986572265625,"!":.3329986572265625,"@":.8579986572265625,"#":.6,$:.6,"%":.9699996948242188,"^":.517999267578125,"&":.7259994506835937,"*":.505999755859375,"(":.3329986572265625,")":.3329986572265625,"<":.604998779296875,">":.604998779296875,"/":.5,"?":.53699951171875},ke=Math.PI,Ae=Math.sin,Ce=Math.cos,Te=Ae(ke/8),Ie=Ce(ke/8),je=function(t,e){var n=t.getBBox(),r={x:n.minX,y:n.minY},i={x:n.maxX,y:n.maxY};if(e){var o=e.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),r=Ut(r,o),i=Ut(i,o)}var a=r.x,s=r.y,u=i.x,c=i.y;return{x:a,y:s,minX:a,minY:s,maxX:u,maxY:c,width:u-a,height:c-s}},Pe=function(t){var e=t.sourceNode||t.targetNode,n=e.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e.getKeyShape().getBBox(),i=t.loopCfg||{},o=i.dist||2*Math.max(r.width,r.height),a=i.position||Oe.defaultLoopPosition,s=[n[6],n[7]],u=[t.startPoint.x,t.startPoint.y],c=[t.endPoint.x,t.endPoint.y],l=r.height/2,f=r.height/2,h=l*Te,d=l*Ie,p=f*Te,g=f*Ie;if(u[0]===c[0]&&u[1]===c[1]){switch(a){case"top":u=[s[0]-h,s[1]-d],c=[s[0]+p,s[1]-g];break;case"top-right":l=r.height/2,f=r.width/2,u=[s[0]+(h=l*Te),s[1]-(d=l*Ie)],c=[s[0]+(g=f*Ie),s[1]-(p=f*Te)];break;case"right":l=r.width/2,f=r.width/2,u=[s[0]+(d=l*Ie),s[1]-(h=l*Te)],c=[s[0]+(g=f*Ie),s[1]+(p=f*Te)];break;case"bottom-right":l=r.width/2,f=r.height/2,u=[s[0]+(d=l*Ie),s[1]+(h=l*Te)],c=[s[0]+(p=f*Te),s[1]+(g=f*Ie)];break;case"bottom":l=r.height/2,f=r.height/2,u=[s[0]+(h=l*Te),s[1]+(d=l*Ie)],c=[s[0]-(p=f*Te),s[1]+(g=f*Ie)];break;case"bottom-left":l=r.height/2,f=r.width/2,u=[s[0]-(h=l*Te),s[1]+(d=l*Ie)],c=[s[0]-(g=f*Ie),s[1]+(p=f*Te)];break;case"left":l=r.width/2,f=r.width/2,u=[s[0]-(d=l*Ie),s[1]+(h=l*Te)],c=[s[0]-(g=f*Ie),s[1]-(p=f*Te)];break;case"top-left":l=r.width/2,f=r.height/2,u=[s[0]-(d=l*Ie),s[1]-(h=l*Te)],c=[s[0]-(p=f*Te),s[1]-(g=f*Ie)];break;default:l=r.width/2,f=r.width/2,u=[s[0]-(h=l*Te),s[1]-(d=l*Ie)],c=[s[0]+(p=f*Te),s[1]-(g=f*Ie)]}if(!1===i.clockwise){var v=[u[0],u[1]];u=[c[0],c[1]],c=[v[0],v[1]]}}var y=[u[0]-s[0],u[1]-s[1]],m=(l+o)/l,x=(f+o)/f;!1===i.clockwise&&(m=(f+o)/f,x=(l+o)/l);var _=b.c.scale([0,0],y,m),w=[s[0]+_[0],s[1]+_[1]],E=[c[0]-s[0],c[1]-s[1]],S=b.c.scale([0,0],E,x),O=[s[0]+S[0],s[1]+S[1]];return t.startPoint={x:u[0],y:u[1]},t.endPoint={x:c[0],y:c[1]},t.controlPoints=[{x:w[0],y:w[1]},{x:O[0],y:O[1]}],t},Ne=function(t,e,n,r,i){var o=[],a=null==t?void 0:t.getPoint(e);if(!a)return{x:0,y:0,angle:0};if(e<1e-4)o=t.getStartTangent().reverse();else if(e>.9999)o=t.getEndTangent();else{var s=null==t?void 0:t.getPoint(e+1e-4);o.push([a.x,a.y]),o.push([s.x,s.y])}var u=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(u<0&&(u+=2*ke),n&&(a.x+=Ce(u)*n,a.y+=Ae(u)*n),r){var c=u-ke/2;u>.5*ke&&u<1.5*ke&&(c-=ke),a.x+=Ce(c)*r,a.y+=Ae(c)*r}var l={x:a.x,y:a.y,angle:u};return i?(u>.5*ke&&u<1.5*ke&&(u-=ke),Object(d.__assign)({rotate:u},l)):l},De=function t(e,n){if(!1===n(e))return!1;if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return!1;return!0},Le=function(t,e){"function"==typeof e&&De(t,e)},Re=function(t,e){"function"==typeof e&&function t(e,n){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return;return!1!==n(e)}(t,e)},Be=function(t,e){return e*(Me[t]||1)},Fe=function(t,e){var n=0,r=new RegExp("[一-龥]+");return t.split("").forEach((function(t){r.test(t)?n+=e:n+=Be(t,e)})),[n,e]},Ge=function(t,e){var n=[],r={},i={};t.forEach((function(t){i[t.id]=t})),t.forEach((function(t,e){var o=Object(p.clone)(t);o.itemType="combo",o.children=void 0,o.parentId===o.id?(console.warn("The parentId for combo ".concat(o.id," can not be the same as the combo's id")),delete o.parentId):o.parentId&&!i[o.parentId]&&(console.warn("The parent combo for combo ".concat(o.id," does not exist!")),delete o.parentId);var a=r[o.id];if(a){if(o.children=a.children,r[o.id]=o,!(a=o).parentId)return void n.push(a);var s=r[a.parentId];if(s)s.children?s.children.push(o):s.children=[o];else{var u={id:a.parentId,children:[a]};r[a.parentId]=u,r[o.id]=o}}else if(Object(p.isString)(t.parentId)){var c=r[t.parentId];if(c)c.children?c.children.push(o):c.children=[o],r[o.id]=o;else{var l={id:t.parentId,children:[o]};r[l.id]=l,r[o.id]=o}}else n.push(o),r[o.id]=o}));var o={};(e||[]).forEach((function(t){o[t.id]=t;var e=r[t.comboId];if(e){var n={id:t.id,comboId:t.comboId};e.children?e.children.push(n):e.children=[n],n.itemType="node",r[t.id]=n}}));var a=0;return n.forEach((function(t){t.depth=a+10,De(t,(function(t){var e,n=r[t.id].itemType;e="node"===n?r[t.comboId]:r[t.parentId],t.depth=e&&"node"===n?a+1:a+10,a<t.depth&&(a=t.depth);var i=o[t.id];return i&&(i.depth=t.depth),!0}))})),n},ze=function(t,e,n){var r,i,o=t,a={root:{children:t}},s=!1,u="root";(t||[]).forEach((function(t){if(!s)return t.id===e?(i=t,"combo"===t.itemType?i.parentId=n:i.comboId=n,void(s=!0)):void Le(t,(function(t){var r;return a[t.id]={children:(null==t?void 0:t.children)||[]},o=null===(r=a[t.parentId||t.comboId||"root"])||void 0===r?void 0:r.children,!t||!t.removed&&e!==t.id||!o||(u=t.parentId||t.comboId||"root",i=t,"combo"===t.itemType?i.parentId=n:i.comboId=n,s=!0,!1)}))}));var c=(o=null===(r=a[u])||void 0===r?void 0:r.children)?o.indexOf(i):-1;if(c>-1&&o.splice(c,1),s||(i={id:e,itemType:"node",comboId:n},a[e]={children:void 0}),e){var l=!1;if(n){var f=0;(t||[]).forEach((function(t){l||Le(t,(function(t){return n!==t.id||(l=!0,t.children?t.children.push(i):t.children=[i],f=t.depth,"node"===i.itemType?i.depth=f+2:i.depth=f+1,!1)}))}))}else n&&l||"node"===i.itemType||t.push(i);var h=i.depth;Le(i,(function(t){return"node"===t.itemType?h+=2:h+=1,t.depth=h,!0}))}return t},Ue=function(t,e,n){var r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||0===t.length){var i=(null==n?void 0:n.getModel())||{},o=i.x,a=i.y;return{minX:o,minY:a,maxX:o,maxY:a,x:o,y:a,width:void 0,height:void 0}}return t.forEach((function(t){var n=e.findById(t.id);if(n&&n.isVisible()){n.set("bboxCanvasCache",void 0);var i=n.getCanvasBBox();i.x&&r.minX>i.minX&&(r.minX=i.minX),i.y&&r.minY>i.minY&&(r.minY=i.minY),i.x&&r.maxX<i.maxX&&(r.maxX=i.maxX),i.y&&r.maxY<i.maxY&&(r.maxY=i.maxY)}})),r.x=(r.minX+r.maxX)/2,r.y=(r.minY+r.maxY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.centerX=(r.minX+r.maxX)/2,r.centerY=(r.minY+r.maxY)/2,Object.keys(r).forEach((function(t){r[t]!==1/0&&r[t]!==-1/0||(r[t]=void 0)})),r},Ve=function(t){var e=Object(p.isNumber)(t.x)||Object(p.isNumber)(t.y)||t.type||t.anchorPoints||t.size;return t.style&&(e=e||Object(p.isNumber)(t.style.r)||Object(p.isNumber)(t.style.width)||Object(p.isNumber)(t.style.height)||Object(p.isNumber)(t.style.rx)||Object(p.isNumber)(t.style.ry)),e},We=function(t){var e={};return Object.keys(t).forEach((function(n){var r=t[n];if(Object(p.isObject)(r)&&!Object(p.isArray)(r)){var i={};Object.keys(r).forEach((function(t){var e=r[t];("img"!==t||Object(p.isString)(e))&&(i[t]=Object(p.clone)(e))})),e[n]=i}else e[n]=Object(p.clone)(r)})),e},Xe=function(t){var e;if(!t)return console.error("G6 Error Tips: the data must be defined"),!1;var n=t.nodes,r=t.edges,i=t.combos,o=void 0===i?[]:i;if(!n&&!r){var a=!0;return Le(t,(function(t){return!!Object(p.isString)(t.id)||(a=!1,!1)})),a}var s=(n||[]).find((function(t){return!Object(p.isString)(t.id)}));if(s)return console.warn("G6 Warning Tips: missing 'id' property, or %c".concat(s.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1;var u=(n||[]).map((function(t){return t.id})),c=null===(e=o)||void 0===e?void 0:e.map((function(t){return t.id})),l=Object(d.__spreadArray)(Object(d.__spreadArray)([],u,!0),c,!0),f=(r||[]).find((function(t){return!l.includes(t.source)||!l.includes(t.target)}));return!f||(console.warn("G6 Warning Tips: The source %c".concat(f.source,"%c or the target %c").concat(f.target,"%c of the edge do not exist in the nodes or combos."),"font-size: 20px; color: red;","","font-size: 20px; color: red;",""),!1)},Ye=function(){function t(t){this.graph=t,this.destroyed=!1,this.modes=t.get("modes")||{default:[]},this.formatModes(),this.mode=t.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return t.prototype.formatModes=function(){var t=this.modes;Object(p.each)(t,(function(t){Object(p.each)(t,(function(e,n){Object(p.isString)(e)&&(t[n]={type:e})}))}))},t.prototype.setBehaviors=function(t){var e,n=this.graph,r=this.modes[t],i=[];Object(p.each)(r||[],(function(t){var r=v.getBehavior(t.type||t);r&&(e=new r(t))&&(e.bind(n),i.push(e))})),this.currentBehaves=i},t.mergeBehaviors=function(t,e){return Object(p.each)(e,(function(e){t.indexOf(e)<0&&(Object(p.isString)(e)&&(e={type:e}),t.push(e))})),t},t.filterBehaviors=function(t,e){var n=[];return t.forEach((function(t){var r="";r=Object(p.isString)(t)?t:t.type,e.indexOf(r)<0&&n.push(t)})),n},t.prototype.setMode=function(t){var e=this.modes,n=this.graph,r=t;e[r]&&(n.emit("beforemodechange",{mode:t}),Object(p.each)(this.currentBehaves,(function(t){t.delegate&&t.delegate.remove(),t.unbind(n)})),this.setBehaviors(r),n.emit("aftermodechange",{mode:t}),this.mode=t)},t.prototype.getMode=function(){return this.mode},t.prototype.manipulateBehaviors=function(e,n,r){var i,o=this;if(i=Object(p.isArray)(e)?e:[e],Object(p.isArray)(n))return Object(p.each)(n,(function(e){o.modes[e]?o.modes[e]=r?t.mergeBehaviors(o.modes[e]||[],i):t.filterBehaviors(o.modes[e]||[],i):r&&(o.modes[e]=i)})),this;var a=n;return n||(a=this.mode),this.modes[a]||r&&(this.modes[a]=i),this.modes[a]=r?t.mergeBehaviors(this.modes[a]||[],i):t.filterBehaviors(this.modes[a]||[],i),this.formatModes(),this.setMode(this.mode),this},t.prototype.updateBehavior=function(t,e,n){Object(p.isString)(t)&&(t={type:t});var r=[];if(n&&n!==this.mode&&"default"!==n){if(!(r=this.modes[n])||!r.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;var i=r.length;for(a=0;a<i;a++){if((s=r[a]).type===t.type||s===t.type)return s===t.type&&(s={type:s}),Object.assign(s,e),r[a]=s,this;a===i-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(!(r=this.currentBehaves)||!r.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var o=r.length,a=0;a<o;a++){var s;if((s=r[a]).type===t.type)return s.updateCfg(e),this;a===o-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},t.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},t}(),He=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.item=n.item,r.canvasX=n.canvasX,r.canvasY=n.canvasY,r.wheelDelta=n.wheelDelta,r.detail=n.detail,r}return Object(d.__extends)(e,t),e}(n(215).Event),qe=function(t){return"".concat(t,"-").concat(Math.random()).concat(Date.now())},Ke=function(t){if(Object(p.isArray)(t))switch(t.length){case 4:return t;case 3:return t.push(t[1]),t;case 2:return t.concat(t);case 1:return[t[0],t[0],t[0],t[0]];default:return[0,0,0,0]}if(Object(p.isNumber)(t))return[t,t,t,t];if(Object(p.isString)(t)){var e=parseInt(t,10);return[e,e,e,e]}return[0,0,0,0]},Ze=function(t){var e=new He(t.type,t);return e.clientX=t.clientX,e.clientY=t.clientY,e.x=t.x,e.y=t.y,e.target=t.target,e.currentTarget=t.currentTarget,e.bubbles=!0,e.item=t.item,e},Qe=function(t){if(!t)return!1;for(var e=[1,0,0,0,1,0,0,0,1],n=0;n<9;n++)if(t[n]!==e[n])return!0;return!1},$e=function(t){return Number.isNaN(Number(t))},Je=function(t){for(var e=1/0,n=-1/0,r=1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o].getBBox(),s=a.minX,u=a.minY,c=a.maxX,l=a.maxY;s<e&&(e=s),u<r&&(r=u),c>n&&(n=c),l>i&&(i=l)}return{x:Math.floor(e),y:Math.floor(r),width:Math.ceil(n)-Math.floor(e),height:Math.ceil(i)-Math.floor(r),minX:e,minY:r,maxX:n,maxY:i}},tn=function(t,e,n,r,i){void 0===e&&(e=15),void 0===n&&(n="quadratic"),void 0===r&&(r=void 0),void 0===i&&(i=void 0);for(var o=t.length,a=2*e,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],u={},c=[],l={},f=0;f<o;f++){var h=t[f],d=h.source,p=h.target,g="".concat(d,"-").concat(p);if(!c[f]){u[g]||(u[g]=[]),c[f]=!0,u[g].push(h);for(var v=0;v<o;v++)if(f!==v){var y=t[v],m=y.source,b=y.target;c[v]||(d===b&&p===m?(u[g].push(y),c[v]=!0,l["".concat(m,"|").concat(b,"|").concat(u[g].length-1)]=!0):d===m&&p===b&&(u[g].push(y),c[v]=!0))}}}for(var x in u)for(var _=u[x],w=_.length,E=0;E<w;E++){var S=_[E];if(S.source!==S.target)if(1===w&&r&&S.source!==S.target)S.type=r;else{S.type=n;var O=(E%2==0?1:-1)*(l["".concat(S.source,"|").concat(S.target,"|").concat(E)]?-1:1);S.curveOffset=w%2==1?O*Math.ceil(E/2)*a:O*(Math.floor(E/2)*a+e)}else i&&(S.type=i),S.loopCfg={position:s[E%8],dist:20*Math.floor(E/8)+50}}return t},en=function(){function t(t){this.destroyed=!1,this.graph=t,this.destroyed=!1}return t.prototype.getViewCenter=function(){var t=this.getFormatPadding(),e=this.graph,n=this.graph.get("width"),r=e.get("height");return{x:(n-t[1]-t[3])/2+t[3],y:(r-t[0]-t[2])/2+t[0]}},t.prototype.fitCenter=function(){var t=this.graph,e=t.get("group");e.resetMatrix();var n=e.getCanvasBBox();if(0!==n.width&&0!==n.height){var r=this.getViewCenter(),i=n.x+n.width/2,o=n.y+n.height/2;t.translate(r.x-i,r.y-o)}},t.prototype.fitView=function(){var t=this.graph,e=this.getFormatPadding(),n=t.get("width"),r=t.get("height"),i=t.get("group");i.resetMatrix();var o=i.getCanvasBBox();if(0!==o.width&&0!==o.height){var a=this.getViewCenter(),s=o.x+o.width/2,u=o.y+o.height/2;t.translate(a.x-s,a.y-u);var c=(n-e[1]-e[3])/o.width,l=(r-e[0]-e[2])/o.height,f=c;c>l&&(f=l),t.zoom(f,a)||console.warn("zoom failed, ratio out of range, ratio: %f",f)}},t.prototype.fitViewByRules=function(t){var e=t.onlyOutOfViewPort,n=void 0!==e&&e,r=t.direction,i=void 0===r?"both":r,o=t.ratioRule,a=void 0===o?"min":o,s=this.graph,u=this.getFormatPadding(),c=s.get("width"),l=s.get("height"),f=s.get("group");f.resetMatrix();var h=f.getCanvasBBox();if(0!==h.width&&0!==h.height){var d=this.getViewCenter(),p=h.x+h.width/2,g=h.y+h.height/2;s.translate(d.x-p,d.y-g);var v,y=(c-u[1]-u[3])/h.width,m=(l-u[0]-u[2])/h.height;v="x"===i?y:"y"===i?m:"max"===a?Math.max(y,m):Math.min(y,m),n&&(v=v<1?v:1);var b=s.getZoom()*v,x=s.get("minZoom");b<x&&(b=x,console.warn("fitview failed, ratio out of range, ratio: %f",v,"graph minzoom has been used instead")),s.zoomTo(b,d)}},t.prototype.getFormatPadding=function(){var t=this.graph.get("fitViewPadding");return Ke(t)},t.prototype.focusPoint=function(t,e,n){var r=this,i=this.getViewCenter(),o=this.getPointByCanvas(i.x,i.y),a=this.graph.get("group").getMatrix();if(a||(a=[1,0,0,0,1,0,0,0,1]),e){var s=(o.x-t.x)*a[0],u=(o.y-t.y)*a[4],c=0,l=0,f=0,h=0;this.graph.get("canvas").animate((function(t){f=s*t,h=u*t,r.graph.translate(f-c,h-l),c=f,l=h}),Object(d.__assign)({},n))}else this.graph.translate((o.x-t.x)*a[0],(o.y-t.y)*a[4])},t.prototype.getPointByCanvas=function(t,e){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Vt({x:t,y:e},n)},t.prototype.getPointByClient=function(t,e){var n=this.graph.get("canvas").getPointByClient(t,e);return this.getPointByCanvas(n.x,n.y)},t.prototype.getClientByPoint=function(t,e){var n=this.graph.get("canvas"),r=this.getCanvasByPoint(t,e),i=n.getClientByPoint(r.x,r.y);return{x:i.x,y:i.y}},t.prototype.getCanvasByPoint=function(t,e){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Ut({x:t,y:e},n)},t.prototype.focus=function(t,e,n){if(Object(p.isString)(t)&&(t=this.graph.findById(t)),t){var r=0,i=0;if(t.getType&&"edge"===t.getType()){var o=t.getSource().get("group").getMatrix(),a=t.getTarget().get("group").getMatrix();o&&a?(r=(o[6]+a[6])/2,i=(o[7]+a[7])/2):(o||a)&&(r=o?o[6]:a[6],i=o?o[7]:a[7])}else{var s=t.get("group").getMatrix();s||(s=[1,0,0,0,1,0,0,0,1]),r=s[6],i=s[7]}this.focusPoint({x:r,y:i},e,n)}},t.prototype.changeSize=function(t,e){var n=this.graph;if(!Object(p.isNumber)(t)||!Object(p.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:t,height:e}),n.get("canvas").changeSize(t,e),n.get("plugins").forEach((function(t){t.get("gridContainer")&&t.positionInit()}))},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function nn(t){return(nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rn(t){if("string"!=typeof t)return t;var e=function(t){if("string"!=typeof t)return t;try{return JSON.parse(t.trim())}catch(e){return t.trim()}},n=e(t);if("string"!=typeof n)return n;for(var r=function(t){return t[t.length-1]},i=t.trim(),o=[],a=[],s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.some((function(t){return r(a)===t}))},u=null,c=0,l="";c<i.length;){var f=i[c],h=s('"',"'");if(h||f.trim()){var d="\\"===i[c-1],p=s("}"),g=s("]"),v=s(","),y=r(o);if(h)if(r(a)!==f||d)l+=f;else{a.pop();var m=e(l);y.push(m),u=m,l=""}else if(g&&","===f)l&&(y.push(e(l)),l="");else if(p&&":"===f)a.push(","),l&&(y.push(l),l="");else if(v&&","===f)l&&(y.push(e(l)),l=""),a.pop();else if("}"===f&&(p||v)){l&&(y.push(e(l)),l=""),v&&a.pop();for(var b={},x=1;x<y.length;x+=2)b[y[x-1]]=y[x];o.pop(),o.length&&r(o).push(b),a.pop(),u=b}else"]"===f&&g?(l&&(y.push(e(l)),l=""),o.pop(),o.length&&r(o).push(y),a.pop(),u=y):"{"===f?(o.push([]),a.push("}")):"["===f?(o.push([]),a.push("]")):'"'===f?a.push('"'):"'"===f?a.push("'"):l+=f;c+=1}else c+=1}return u||l}function on(t,e){var n;void 0===e&&(e={x:0,y:0});var r=Object(d.__assign)({x:0,y:0,width:0,height:0},e);if(null===(n=t.children)||void 0===n?void 0:n.length){var i=t.attrs,o=void 0===i?{}:i,a=o.marginTop,s=Object(d.__assign)({},e);a&&(s.y+=a);for(var u=0;u<t.children.length;u++){t.children[u].attrs.key="".concat(o.key||"root"," -").concat(u," ");var c=on(t.children[u],s);if(c.bbox){var l=c.bbox;"inline"===c.attrs.next?s.x+=c.bbox.width:s.y+=c.bbox.height,l.width+l.x>r.width&&(r.width=l.width+l.x),l.height+l.y>r.height&&(r.height=l.height+l.y)}}}return t.bbox=function(t,e,n){var r,i,o=t.attrs,a=void 0===o?{}:o,s={x:e.x||0,y:e.y||0,width:n.width||0,height:n.height||0};switch(t.type){case"maker":case"circle":a.r&&(i=2*a.r,r=2*a.r);break;case"text":a.text&&(i=Fe(a.text,a.fontSize||12)[0],r=16,s.y+=r,s.height=r,s.width=i,t.attrs=Object(d.__assign)({fontSize:12,fill:"#000"},a));break;default:a.width&&(i=a.width),a.height&&(r=a.height)}return r>=0&&(s.height=r),i>=0&&(s.width=i),a.marginTop&&(s.y+=a.marginTop),a.marginLeft&&(s.x+=a.marginLeft),s}(t,e,r),t.attrs=Object(d.__assign)(Object(d.__assign)({},t.attrs),t.bbox),t}function an(t){var e={},n=function(e){var n=function(t){return function(e){for(var n=t.length,r=[],i=0,o="";i<n;)if("{"===t[i]&&"{"===t[i+1])r.push(o),o="",i+=2;else if("}"===t[i]&&"}"===t[i+1]){if(r.length){var a=r.pop();o=Object(p.get)(e,o,a.endsWith("=")?'"{'.concat(o,'}"'):o),r.push(a+o)}i+=2,o=""}else o+=t[i],i+=1;return r.push(o),r.map((function(t,e){return r[e-1]&&r[e-1].endsWith("=")?'"{'.concat(t,'}"'):t})).join("")}}("function"==typeof t?t(e):t)(e),r=document.createElement("div");r.innerHTML=n;var i=on(function t(e,n){var r={},i=e.getAttributeNames&&e.getAttributeNames()||[],o=e.children&&Array.from(e.children).map((function(e){return t(e,n)})),a={},s=e.tagName?e.tagName.toLowerCase():"group";return"text"===s&&(r.text=e.innerText),a.type=s,"img"===s&&(a.type="image"),Array.from(i).forEach((function(t){var n=t.split("-").reduce((function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)})),i=e.getAttribute(t);try{if("style"===n||"attrs"===n){var o=rn(i);r=Object(d.__assign)(Object(d.__assign)({},r),o)}else a[n]=rn(i)}catch(t){if("style"===n)throw t;a[n]=i}})),a.attrs=r,n&&n.style&&a.name&&"object"===nn(n.style[a.name])&&(a.attrs=Object(d.__assign)(Object(d.__assign)({},a.attrs),n.style[a.name])),n&&n.style&&a.keyshape&&(a.attrs=Object(d.__assign)(Object(d.__assign)({},a.attrs),n.style)),o.length&&(a.children=o),a}(r.children[0],e));return r.remove(),i};return{draw:function(t,r){var i=n(t),o=r;return function t(e){var n=e.attrs,i=void 0===n?{}:n,a=e.bbox,s=e.type,u=e.children,c=Object(d.__rest)(e,["attrs","bbox","type","children"]);if("group"!==e.type){var l=r.addShape(e.type,Object(d.__assign)({attrs:i,origin:{bbox:a,type:s,children:u}},c));e.keyshape&&(o=l)}e.children&&e.children.forEach((function(e){return t(e)}))}(i),e[t.id]=[i],o},update:function(t,r){e[t.id]||(e[t.id]=[]);var i=r.getContainer(),o=i.get("children"),a=n(t),s=function t(e,n){var r,i,o,a,s=(e||{}).type,u=((null==n?void 0:n.attrs)||{}).key;if(u&&e&&(e.attrs.key=u),!e&&n)return{action:"delete",val:n,type:s,key:u};if(e&&!n)return{action:"add",val:e,type:s};if(!e&&!n)return{action:"same",type:s};var c=[];if((null===(r=e.children)||void 0===r?void 0:r.length)>0||(null===(i=n.children)||void 0===i?void 0:i.length)>0)for(var l=Math.max(null===(o=e.children)||void 0===o?void 0:o.length,null===(a=n.children)||void 0===a?void 0:a.length),f=n.children||[],h=e.children||[],d=0;d<l;d+=1)c.push(t(h[d],f[d]));var p=Object.keys(n.attrs),g=Object.keys(e.attrs);return n.type!==e.type?{action:"restructure",nowTarget:e,formerTarget:n,key:u,children:c}:p.filter((function(t){return"children"!==t})).some((function(t){return e.attrs[t]!==n.attrs[t]||!g.includes(t)}))?{action:"change",val:e,children:c,type:s,key:u}:{action:"same",children:c,type:s,key:u}}(a,e[t.id].pop()),u=function t(e){var n;"group"!==e.type&&i.addShape(e.type,{attrs:e.attrs}),(null===(n=e.children)||void 0===n?void 0:n.length)&&e.children.map((function(e){return t(e)}))},c=function t(e){var n,r=o.find((function(t){return t.attrs.key===e.attrs.key}));r&&i.removeChild(r),(null===(n=e.children)||void 0===n?void 0:n.length)&&e.children.map((function(e){return t(e)}))};!function t(e){var n=e.key;if("group"!==e.type){var i=o.find((function(t){return t.attrs.key===n}));switch(e.action){case"change":if(i){var a=e.val.keyshape?r.getOriginStyle():{};i.attr(Object(d.__assign)(Object(d.__assign)({},a),e.val.attrs))}break;case"add":u(e.val);break;case"delete":c(e.val);break;case"restructure":c(e.formerTarget),u(e.nowTarget)}}e.children&&e.children.forEach((function(e){return t(e)}))}(s),e[t.id].push(a)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var sn={};function un(t){return sn[t]||(sn[t]=Object(p.upperFirst)(t)),sn[t]}var cn={defaultShapeType:"defaultType",className:null,getShape:function(t){return this[t]||this[this.defaultShapeType]||this["simple-circle"]},draw:function(t,e,n){var r=this.getShape(t);n.shapeMap={};var i=r.draw(e,n);return r.afterDraw&&r.afterDraw(e,n,i),i},baseUpdate:function(t,e,n,r){var i,o,a=this.getShape(t);a.update&&(a.mergeStyle=null===(i=a.getOptions)||void 0===i?void 0:i.call(a,e,r),null===(o=a.update)||void 0===o||o.call(a,e,n,r)),a.afterUpdate&&a.afterUpdate(e,n)},setState:function(t,e,n,r){this.getShape(t).setState(e,n,r)},shouldUpdate:function(t){return!!this.getShape(t).update},getControlPoints:function(t,e){return this.getShape(t).getControlPoints(e)},getAnchorPoints:function(t,e){return this.getShape(t).getAnchorPoints(e)}},ln={options:{},draw:function(t,e){return this.drawShape(t,e)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e=this.options.anchorPoints;return t.anchorPoints||e}},fn=function(){function t(){}return t.registerFactory=function(e,n){var r=un(e),i=cn,o=Object(d.__assign)(Object(d.__assign)({},i),n);return t[r]=o,o.className=r,o},t.getFactory=function(e){return t[un(e)]},t.registerNode=function(e,n,r){var i,o=t.Node;if("string"==typeof n||"function"==typeof n){var a=an(n);i=Object(d.__assign)(Object(d.__assign)({},o.getShape("single-node")),a)}else if(n.jsx){a=an(n.jsx);i=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},o.getShape("single-node")),a),n)}else{o.getShape(r);var s=r?o.getShape(r):ln;i=Object(d.__assign)(Object(d.__assign)({},s),n)}return i.type=e,i.itemType="node",o[e]=i,i},t.registerEdge=function(e,n,r){var i=t.Edge,o=r?i.getShape(r):ln,a=Object(d.__assign)(Object(d.__assign)({},o),n);return a.type=e,a.itemType="edge",i[e]=a,a},t.registerCombo=function(e,n,r){var i=t.Combo,o=r?i.getShape(r):ln,a=Object(d.__assign)(Object(d.__assign)({},o),n);return a.type=e,a.itemType="combo",i[e]=a,a},t}(),hn=fn;fn.registerFactory("node",{defaultShapeType:"circle"}),fn.registerFactory("edge",{defaultShapeType:"line"}),fn.registerFactory("combo",{defaultShapeType:"circle"});var dn=function(){function t(t){this._cfg={},this.destroyed=!1;var e={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(e,this.getDefaultCfg(),t);var n=this.get("model"),r=n.id,i=this.get("type");r||(r=qe(i),this.get("model").id=r),this.set("id",r);var o=t.group;o&&(o.set("item",this),o.set("id",r)),this.init(),this.draw();var a=n.shape||n.type||("edge"===i?"line":"circle"),s=this.get("shapeFactory");if(s&&s[a]){var u=s[a].options;if(u&&u.stateStyles){var c=this.get("styles")||n.stateStyles;c=Object(p.deepMix)({},u.stateStyles,c),this.set("styles",c)}}}return t.prototype.calculateBBox=function(){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},t.prototype.calculateCanvasBBox=function(){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},t.prototype.drawInner=function(){var t=this.get("shapeFactory"),e=this.get("group"),n=this.get("model");e.clear();var r=n.visible;if(void 0===r||r||this.changeVisibility(r),t){this.updatePosition(n);var i=this.getShapeCfg(n),o=i.type,a=t.draw(o,i,e);a&&(this.set("keyShape",a),a.set("isKeyShape",!0),a.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",o),this.restoreStates(t,o)}},t.prototype.setOriginStyle=function(){var t=this.get("group"),e=t.get("children"),n=this.getKeyShape(),r=this,i=n.get("name");if(this.get("originStyle")){var o=this.get("originStyle");i&&!o[i]&&(o[i]={});var a=this.getCurrentStatesStyle(),s=function(t){var n=e[t],s=n.get("name"),u=n.attr();if(s&&s!==i){var c=a[s];o[s]||(o[s]={}),c?Object.keys(u).forEach((function(t){var e=u[t];e!==c[t]&&(o[s][t]=e)})):o[s]="image"!==n.get("type")?Object(p.clone)(u):r.getShapeStyleByName(s)}else{var l=n.attr(),f={};Object.keys(a).forEach((function(t){var e=a[t];t!==i&&Object(p.isPlainObject)(e)||(f[t]=e)})),Object.keys(l).forEach((function(t){var e=l[t];f[t]!==e&&(i?o[i][t]=e:o[t]=e)}))}};for(c=0;c<e.length;c++)s(c);delete o.path,delete o.matrix,delete o.x,delete o.y,o[i]&&(delete o[i].x,delete o[i].y,delete o[i].matrix,delete o[i].path),r.set("originStyle",o)}else{for(var u={},c=0;c<e.length;c++){var l=e[c],f=l.get("type"),h=l.get("name");if(h&&h!==i)u[h]="image"!==f?Object(p.clone)(l.attr()):r.getShapeStyleByName(h),"text"===f&&u[h]&&(delete u[h].x,delete u[h].y,delete u[h].matrix);else{var d=r.getShapeStyleByName();if(delete d.path,delete d.matrix,i)if(h)u[i]=d;else{var g=qe("shape");l.set("name",g),t.shapeMap[g]=l,u[g]="image"!==f?Object(p.clone)(l.attr()):r.getShapeStyleByName(h)}else Object.assign(u,d)}}r.set("originStyle",u)}},t.prototype.restoreStates=function(t,e){var n=this,r=n.get("states");Object(p.each)(r,(function(r){t.setState(e,r,!0,n)}))},t.prototype.init=function(){var t=hn.getFactory(this.get("type"));this.set("shapeFactory",t)},t.prototype.get=function(t){return this._cfg[t]},t.prototype.set=function(t,e){Object(p.isPlainObject)(t)?this._cfg=Object(d.__assign)(Object(d.__assign)({},this._cfg),t):this._cfg[t]=e},t.prototype.getDefaultCfg=function(){return{}},t.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null)},t.prototype.beforeDraw=function(){},t.prototype.afterDraw=function(){},t.prototype.afterUpdate=function(){},t.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},t.prototype.getShapeStyleByName=function(t){var e,n=this.get("group");if(e=t?n.shapeMap[t]:this.getKeyShape()){var r={};return Object(p.each)(e.attr(),(function(t,e){("img"!==e||Object(p.isString)(t))&&(r[e]=t)})),r}return{}},t.prototype.getShapeCfg=function(t,e){var n=this.get("styles");if(n){var r=t;return r.style=Object(d.__assign)(Object(d.__assign)({},n),t.style),r}return t},t.prototype.getStateStyle=function(t){var e=this.get("styles");return e&&e[t]},t.prototype.getOriginStyle=function(){return this.get("originStyle")},t.prototype.getCurrentStatesStyle=function(){var t=this,e={},n=t.getStates();return n&&n.length?(Object(p.each)(t.getStates(),(function(n){e=Object.assign(e,t.getStateStyle(n))})),e):this.get("originStyle")},t.prototype.setState=function(t,e){var n=this.get("states"),r=this.get("shapeFactory"),i=t,o=t;Object(p.isString)(e)&&(i="".concat(t,":").concat(e),o="".concat(t,":"));var a=n;if(Object(p.isBoolean)(e)){var s=n.indexOf(o);if(e){if(s>-1)return;n.push(i)}else s>-1&&n.splice(s,1)}else if(Object(p.isString)(e)){var u=n.filter((function(t){return t.includes(o)}));u.length>0&&this.clearStates(u),(a=a.filter((function(t){return!t.includes(o)}))).push(i),this.set("states",a)}if(r){var c=this.get("model").type;r.setState(c,t,e,this)}},t.prototype.clearStates=function(t){var e=this,n=e.getStates(),r=e.get("shapeFactory"),i=e.get("model").type;t||(t=n),Object(p.isString)(t)&&(t=[t]);var o=n.filter((function(e){return-1===t.indexOf(e)}));e.set("states",o),t.forEach((function(t){r.setState(i,t,!1,e)}))},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(t){return this.getStates().indexOf(t)>=0},t.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(t){},t.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model");if("move"===e)this.updatePosition(t);else{var r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o={x:n.x,y:n.y};t.x=isNaN(+t.x)?n.x:+t.x,t.y=isNaN(+t.y)?n.y:+t.y;var a=this.get("styles");if(t.stateStyles){var s=t.stateStyles;Object(p.mix)(a,s),delete t.stateStyles}Object.assign(n,t),o.x===t.x&&o.y===t.y||this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(t){var e=this.get("shapeFactory"),n=this.get("model"),r=n.type;if(e.shouldUpdate(r)&&r===this.get("currentShape")){var i=this.getShapeCfg(n,t);e.baseUpdate(r,i,this,t),"move"!==t&&this.setOriginStyle()}else this.draw();this.restoreStates(e,r)},t.prototype.updatePosition=function(t){var e=this.get("model"),n=isNaN(+t.x)?+e.x:+t.x,r=isNaN(+t.y)?+e.y:+t.y,i=this.get("group");if(isNaN(n)||isNaN(r))return!1;e.x=n,e.y=r;var o=i.getMatrix();return(!o||o[6]!==n||o[7]!==r)&&(i.resetMatrix(),Kt(i,{x:n,y:r}),this.clearCache(),!0)},t.prototype.getBBox=function(){var t=this.get("bboxCache");return t||(t=this.calculateBBox(),this.set("bboxCache",t)),t},t.prototype.getCanvasBBox=function(){var t=this.get("bboxCanvasCache");return t||(t=this.calculateCanvasBBox(),this.set("bboxCanvasCache",t)),t},t.prototype.toFront=function(){this.get("group").toFront()},t.prototype.toBack=function(){this.get("group").toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},t.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},t}(),pn={source:"start",target:"end"},gn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,e){var n=pn[t]+"Point",r=t+"Node",i=this.get(r);i&&!i.destroyed&&i.removeEdge(this),Object(p.isPlainObject)(e)?(this.set(n,e),this.set(r,null)):e&&(e.addEdge(this),this.set(r,e),this.set(n,null))},e.prototype.getLinkPoint=function(t,e,n){var r=pn[t]+"Point",i=t+"Node",o=this.get(r);if(!o){var a=this.get(i),s=t+"Anchor",u=this.getPrePoint(t,n),c=e[s];Object(p.isNil)(c)||(o=a.getLinkPointByAnchor(c)),o=o||a.getLinkPoint(u),Object(p.isNil)(o.index)||this.set("".concat(t,"AnchorIndex"),o.index)}return o},e.prototype.getPrePoint=function(t,e){if(e&&e.length)return e["source"===t?0:e.length-1];var n="source"===t?"target":"source";return this.getEndPoint(n)},e.prototype.getEndPoint=function(t){var e=t+"Node",n=pn[t]+"Point",r=this.get(e);return r?r.get("model"):this.get(n)},e.prototype.getControlPointsByCenter=function(t){var e=this.getEndPoint("source"),n=this.getEndPoint("target"),r=this.get("shapeFactory"),i=t.type;return r.getControlPoints(i,{startPoint:e,endPoint:n})},e.prototype.getEndCenter=function(t){var e=t+"Node",n=pn[t]+"Point",r=this.get(e);if(r){var i=r.getBBox();return{x:i.centerX,y:i.centerY}}return this.get(n)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(e,n){var r=this.get("linkCenter"),i=(null==n?void 0:n.includes("move"))?e:t.prototype.getShapeCfg.call(this,e);if(r)i.startPoint=this.getEndCenter("source"),i.endPoint=this.getEndCenter("target");else{var o=i.controlPoints||this.getControlPointsByCenter(i);i.startPoint=this.getLinkPoint("source",e,o),i.endPoint=this.getLinkPoint("target",e,o)}return i.sourceNode=this.get("sourceNode"),i.targetNode=this.get("targetNode"),i},e.prototype.getModel=function(){var t=this.get("model"),e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));return e?delete t["source".concat("Node")]:t.source=this.get("start".concat("Point")),n?delete t["target".concat("Node")]:t.target=this.get("end".concat("Point")),Object(p.isString)(t.source)||Object(p.isPlainObject)(t.source)||(t.source=t.source.getID()),Object(p.isString)(t.target)||Object(p.isPlainObject)(t.target)||(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model"),r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o=this.get("styles");if(t.stateStyles){var a=t.stateStyles;Object(p.mix)(o,a),delete t.stateStyles}Object.assign(n,t),this.updateShape(e),this.afterUpdate(),this.clearCache()},e.prototype.destroy=function(){var e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));e&&!e.destroyed&&e.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),t.prototype.destroy.call(this)},e}(dn),vn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getNearestPoint=function(t,e){for(var n=0,r=t[0],i=Xt(t[0],e),o=0;o<t.length;o++){var a=t[o],s=Xt(a,e);s<i&&(r=a,i=s,n=o)}return r.anchorIndex=n,r},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var t=this;return this.get("edges").filter((function(e){return e.get("target")===t}))},e.prototype.getOutEdges=function(){var t=this;return this.get("edges").filter((function(e){return e.get("source")===t}))},e.prototype.getNeighbors=function(t){var e=this,n=this.get("edges");if("target"===t){return n.filter((function(t){return t.getSource()===e})).map((function(t){return t.getTarget()}))}if("source"===t){return n.filter((function(t){return t.getTarget()===e})).map((function(t){return t.getSource()}))}return n.map((function(t){return t.getSource()===e?t.getTarget():t.getSource()}))},e.prototype.getLinkPointByAnchor=function(t){return this.getAnchorPoints()[t]},e.prototype.getLinkPoint=function(t){var e,n,r=this.get("keyShape").get("type"),i=this.get("type"),o=this.getBBox();"combo"===i?(e=o.centerX||(o.maxX+o.minX)/2,n=o.centerY||(o.maxY+o.minY)/2):(e=o.centerX,n=o.centerY);var a,s=this.getAnchorPoints();switch(r){case"circle":a=Gt({x:e,y:n,r:o.width/2},t);break;case"ellipse":a=zt({x:e,y:n,rx:o.width/2,ry:o.height/2},t);break;default:a=Ft(o,t)}var u=a;return s.length&&(u||(u=t),u=this.getNearestPoint(s,u)),u||(u={x:e,y:n}),u},e.prototype.getAnchorPoints=function(){var t=this.get("anchorPointsCache");if(!t){t=[];var e=this.get("shapeFactory"),n=this.getBBox(),r=this.get("model"),i=this.getShapeCfg(r),o=r.type,a=e.getAnchorPoints(o,i)||[];Object(p.each)(a,(function(e,r){var i={x:n.minX+e[0]*n.width,y:n.minY+e[1]*n.height,anchorIndex:r};t.push(i)})),this.set("anchorPointsCache",t)}return t},e.prototype.addEdge=function(t){this.get("edges").push(t)},e.prototype.lock=function(){this.set("locked",!0)},e.prototype.unlock=function(){this.set("locked",!1)},e.prototype.hasLocked=function(){return this.get("locked")},e.prototype.removeEdge=function(t){var e=this.getEdges(),n=e.indexOf(t);n>-1&&e.splice(n,1)},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("anchorPointsCache",null)},e.prototype.getUpdateType=function(t){var e,n,r,i,o;if(t){var a=!Object(p.isNil)(t.x),s=!Object(p.isNil)(t.y),u=Object.keys(t);return 1===u.length&&(a||s)||2===u.length&&a&&s?"move":Object(p.isNumber)(t.x)||Object(p.isNumber)(t.y)||t.type||t.anchorPoints||t.size||(null==t?void 0:t.style)&&((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.r)||(null===(n=null==t?void 0:t.style)||void 0===n?void 0:n.width)||(null===(r=null==t?void 0:t.style)||void 0===r?void 0:r.height)||(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.rx)||(null===(o=null==t?void 0:t.style)||void 0===o?void 0:o.ry))?"bbox|label":u.includes("label")||u.includes("labelCfg")?"style|label":"style"}},e}(dn),yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(d.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(t){var e=this.get("styles"),n=this.get("bbox");if(e&&n){var r=t,i={r:Math.hypot(n.height,n.width)/2||Oe.defaultCombo.size[0]/2,width:n.width||Oe.defaultCombo.size[0],height:n.height||Oe.defaultCombo.size[1]};r.style=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},e),t.style),i);var o=t.padding||Oe.defaultCombo.padding;return Object(p.isNumber)(o)?(i.r+=o,i.width+=2*o,i.height+=2*o):(i.r+=o[0],i.width+=o[1]+o[3]||2*o[1],i.height+=o[0]+o[2]||2*o[0]),this.set("sizeCache",i),r}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),e=this.get("group"),n=je(t,e);n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;var r=this.get("sizeCache"),i=this.get("bboxCache")||{},o=i.x,a=i.x;if(r)r.width=Math.max(r.width,n.width),r.height=Math.max(r.height,n.height),"circle"===t.get("type")?(n.width=2*r.r,n.height=2*r.r):(n.width=r.width,n.height=r.height),n.minX=n.centerX-n.width/2,n.minY=n.centerY-n.height/2,n.maxX=n.centerX+n.width/2,n.maxY=n.centerY+n.height/2;else n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;return n.x=n.minX,n.y=n.minY,n.x===o&&n.y===a||this.set("anchorPointsCache",null),n}},e.prototype.getChildren=function(){return{nodes:this.getNodes(),combos:this.getCombos()}},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.addChild=function(t){switch(t.getType()){case"node":this.addNode(t);break;case"combo":this.addCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.addCombo=function(t){return this.get("combos").push(t),!0},e.prototype.addNode=function(t){return this.get("nodes").push(t),!0},e.prototype.removeChild=function(t){switch(t.getType()){case"node":this.removeNode(t);break;case"combo":this.removeCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.removeCombo=function(t){if(t){var e=this.getCombos(),n=e.indexOf(t);return n>-1&&(e.splice(n,1),!0)}},e.prototype.removeNode=function(t){if(t){var e=this.getNodes(),n=e.indexOf(t);return n>-1&&(e.splice(n,1),!0)}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){return this.set("bboxCanvasCache",null),this.calculateCanvasBBox()},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null),this.set("anchorPointsCache",null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),this.set("sizeCache",null),this.set("bbox",null),e.remove(),this._cfg=null,this.destroyed=!0}},e}(vn),mn=function(){function t(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Object(p.throttle)((function(t){var n,r=e.graph;if(r&&!r.get("destroyed")){var i=e.edgeToBeUpdateMap;i&&(null===(n=Object.keys(i))||void 0===n?void 0:n.length)&&(Object.keys(i).forEach((function(t){var e=i[t].edge;if(e&&!e.destroyed){var n=e.getSource(),r=e.getTarget();n&&!n.destroyed&&r&&!r.destroyed&&e.refresh(i[t].updateType)}})),e.edgeToBeUpdateMap={})}}),16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return t.prototype.addItem=function(t,e){var n=this.graph,r="vedge"===t?"edge":t,i=n.get("".concat(r,"Group"))||n.get("group"),o=Object(p.upperFirst)(r),a=null,s=n.get(r+Object(p.upperFirst)("stateStyles"))||{},u=n.get("default"+o);e.stateStyles&&(s=e.stateStyles),u&&Object(p.each)(u,(function(t,n){Object(p.isObject)(t)&&!Object(p.isArray)(t)?e[n]=Object(p.deepMix)({},t,e[n]):Object(p.isArray)(t)?e[n]=e[n]||Object(p.clone)(u[n]):e[n]=e[n]||u[n]}));var c=n.get(r+"Mapper");if(c){var l=c(e);l.stateStyles&&(s=l.stateStyles,delete l.stateStyles),Object(p.each)(l,(function(t,n){Object(p.isObject)(t)&&!Object(p.isArray)(t)?e[n]=Object(p.deepMix)({},e[n],t):e[n]=l[n]||e[n]}))}if(n.emit("beforeadditem",{type:t,model:e}),"edge"===t||"vedge"===t){var f=void 0,h=void 0;if(f=e.source,h=e.target,f&&Object(p.isString)(f)&&(f=n.findById(f)),h&&Object(p.isString)(h)&&(h=n.findById(h)),!f||!h)return void console.warn("The source or target node of edge ".concat(e.id," does not exist!"));f.getType&&"combo"===f.getType()&&(e.isComboEdge=!0),h.getType&&"combo"===h.getType()&&(e.isComboEdge=!0),a=new gn({model:e,source:f,target:h,styles:s,linkCenter:n.get("linkCenter"),group:i.addGroup()})}else if("node"===t)a=new vn({model:e,styles:s,group:i.addGroup()});else if("combo"===t){var d=e.children,g=Ue(d,n),v=void 0,y=void 0;if(isNaN(g.x)?isNaN(e.x)&&(v=100*Math.random()):v=g.x,isNaN(g.y)?isNaN(e.y)&&(y=100*Math.random()):y=g.y,isNaN(e.x)||isNaN(e.y))e.x=v,e.y=y;else{var m=e.x-v,b=e.y-y;this.updateComboSucceeds(e.id,m,b,d)}var x=i.addGroup();x.setZIndex(e.depth);var _=(a=new yn({model:e,styles:s,bbox:e.collapsed?Ue([],n):g,group:x})).getModel();(d||[]).forEach((function(t){var e=n.findById(t.id);a.addChild(e),t.depth=_.depth+2})),e.collapsed&&setTimeout((function(){a.destroyed||n.collapseCombo(a)}),0)}if(a)return n.get("".concat(t,"s")).push(a),n.get("itemMap")[a.get("id")]=a,n.emit("afteradditem",{item:a,model:e}),a},t.prototype.updateItem=function(t,e){var n,r,i=this,o=this.graph;if(Object(p.isString)(t)&&(t=o.findById(t)),t&&!t.destroyed){var a="";t.getType&&(a=t.getType());var s=o.get(a+"Mapper"),u=t.getModel(),c=u.x,l=u.y,f=t.getUpdateType(e);if(s){var h=s(Object(p.deepMix)({},u,e)),g=Object(p.deepMix)({},u,h,e);h.stateStyles&&(t.set("styles",g.stateStyles),delete g.stateStyles),Object(p.each)(g,(function(t,n){e[n]=t}))}else Object(p.each)(e,(function(t,n){u[n]&&Object(p.isObject)(t)&&!Object(p.isArray)(t)&&(e[n]=Object(d.__assign)(Object(d.__assign)({},u[n]),e[n]))}));if(o.emit("beforeupdateitem",{item:t,cfg:e}),"edge"===a){if(e.source){var v=e.source;Object(p.isString)(v)&&(v=o.findById(v)),t.setSource(v)}if(e.target){var y=e.target;Object(p.isString)(y)&&(y=o.findById(y)),t.setTarget(y)}t.update(e)}else if("node"===a){t.update(e,f);var m=t.getEdges(),b=(null==f?void 0:f.includes("bbox"))||"move"===f;"move"===f?Object(p.each)(m,(function(t){i.edgeToBeUpdateMap[t.getID()]={edge:t,updateType:f},i.throttleRefresh()})):b&&Object(p.each)(m,(function(t){t.refresh(f)}))}else if("combo"===a){if(t.update(e,f),!isNaN(e.x)||!isNaN(e.y)){var x=e.x-c||0,_=e.y-l||0;this.updateComboSucceeds(u.id,x,_)}var w=t.getEdges();if((b=(null==f?void 0:f.includes("bbox"))||"move"===f)&&"combo"===a){var E=t.get("shapeFactory"),S=u.type||"circle";(void 0===u.animate||void 0===e.animate?null===(r=null===(n=E[S])||void 0===n?void 0:n.options)||void 0===r?void 0:r.animate:u.animate||e.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&Object(p.each)(w,(function(t){t&&!t.destroyed&&t.refresh()}))}}),201):Object(p.each)(w,(function(t){t.refresh()}))}}o.emit("afterupdateitem",{item:t,cfg:e})}},t.prototype.updateCombo=function(t,e,n){var r,i,o=this,a=this.graph;if(Object(p.isString)(t)&&(t=a.findById(t)),t&&!t.destroyed){var s=t.getModel(),u=Ue(e,a,t),c=u.x,l=u.y;t.set("bbox",u);var f=c,h=l;n?(f=isNaN(s.x)?c:s.x,h=isNaN(s.y)?l:s.y):(f=isNaN(c)?s.x:c,h=isNaN(l)?s.y:l),t.update({x:f,y:h});var d=t.get("shapeFactory"),g=s.type||"circle";(void 0===s.animate?null===(i=null===(r=d[g])||void 0===r?void 0:r.options)||void 0===i?void 0:i.animate:s.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&(t.getShapeCfg(s),o.updateComboEdges(t))}}),201):this.updateComboEdges(t)}},t.prototype.updateComboEdges=function(t){for(var e=t.getEdges()||[],n=0;n<e.length;n++){var r=e[n];if(r&&!r.destroyed){var i=r.get("shapeFactory"),o=r.getShapeCfg(r.getModel()),a=r.getContainer();a.clear();var s=i.draw(o.type,o,a);r.set("keyShape",s),s.set("isKeyShape",!0),s.set("draggable",!0),r.setOriginStyle()}}},t.prototype.collapseCombo=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t));var n=t.getChildren();n.nodes.forEach((function(t){e.hideItem(t)})),n.combos.forEach((function(t){e.hideItem(t)}))},t.prototype.updateComboSucceeds=function(t,e,n,r){var i=this;void 0===r&&(r=[]);var o=this.graph;if(e||n){var a=r;if(!(null==a?void 0:a.length)){var s=o.get("comboTrees");null==s||s.forEach((function(e){Le(e,(function(e){return e.id!==t||(a=e.children,!1)}))}))}null==a||a.forEach((function(t){var r=o.findById(t.id);if(r){var a=r.getModel();i.updateItem(t.id,{x:(a.x||0)+e,y:(a.y||0)+n})}}))}},t.prototype.expandCombo=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t));var n=t.getChildren();n.nodes.forEach((function(t){e.showItem(t)})),n.combos.forEach((function(t){t.getModel().collapsed?t.show():e.showItem(t)}))},t.prototype.removeItem=function(t){var e=this,n=this.graph;if(Object(p.isString)(t)&&(t=n.findById(t)),t&&!t.destroyed){var r=Object(p.clone)(t.getModel());n.emit("beforeremoveitem",{item:r});var i="";t.getType&&(i=t.getType());var o=n.get("".concat(i,"s")),a=o.indexOf(t);if(a>-1&&o.splice(a,1),"edge"===i){var s=n.get("v".concat(i,"s")),u=s.indexOf(t);u>-1&&s.splice(u,1)}var c=t.get("id");delete n.get("itemMap")[c];var l=n.get("comboTrees"),f=t.get("id");if("node"===i){var h=t.getModel().comboId;if(l&&h){var d=l,g=!1;l.forEach((function(t){g||Le(t,(function(t){if(t.id===f&&d){var e=d.indexOf(t);return d.splice(e,1),g=!0,!1}return d=t.children,!0}))}))}for(var v=(x=t.getEdges()).length-1;v>=0;v--)n.removeItem(x[v],!1);h&&n.updateCombo(h)}else if("combo"===i){var y,m=t.getModel().parentId,b=!1;(l||[]).forEach((function(t){b||Le(t,(function(t){return t.id!==f||(y=t,b=!0,!1)}))})),y.removed=!0,y&&y.children&&y.children.forEach((function(t){e.removeItem(t.id)}));var x;for(v=(x=t.getEdges()).length;v>=0;v--)n.removeItem(x[v],!1);m&&n.updateCombo(m)}t.destroy(),n.emit("afterremoveitem",{item:r,type:i})}},t.prototype.setItemState=function(t,e,n){var r=this.graph,i=e;Object(p.isString)(n)&&(i="".concat(e,":").concat(n)),t.hasState(i)===n&&n||Object(p.isString)(n)&&t.hasState(i)||(r.emit("beforeitemstatechange",{item:t,state:i,enabled:n}),t.setState(e,n),r.autoPaint(),r.emit("afteritemstatechange",{item:t,state:i,enabled:n}))},t.prototype.priorityState=function(t,e){var n=this.graph,r=t;Object(p.isString)(t)&&(r=n.findById(t)),this.setItemState(r,e,!1),this.setItemState(r,e,!0)},t.prototype.clearItemStates=function(t,e){var n=this.graph;Object(p.isString)(t)&&(t=n.findById(t)),n.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),n.emit("afteritemstatesclear",{item:t,states:e})},t.prototype.refreshItem=function(t){var e=this.graph;Object(p.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},t.prototype.addCombos=function(t,e){var n=this,r=this.graph;(t||[]).forEach((function(t){Re(t,(function(t){var r;return e.forEach((function(e){e.id===t.id&&(e.children=t.children,e.depth=t.depth,r=e)})),r&&n.addItem("combo",r),!0}))}));var i=r.get("comboGroup");i&&i.sort()},t.prototype.changeItemVisibility=function(t,e){var n=this,r=this.graph;if(Object(p.isString)(t)&&(t=r.findById(t)),t){if(r.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&"node"===t.getType()){var i=t.getEdges();Object(p.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}else if(t.getType&&"combo"===t.getType()){var o=r.get("comboTrees"),a=t.get("id"),s=[],u=!1;(o||[]).forEach((function(t){u||t.children&&0!==t.children.length&&Le(t,(function(t){return t.id!==a||(s=t.children,u=!0,!1)}))})),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach((function(t){var i=r.findById(t.id);n.changeItemVisibility(i,e)}));i=t.getEdges();Object(p.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}return r.emit("afteritemvisibilitychange",{item:t,visible:e}),t}console.warn("The item to be shown or hidden does not exist!")},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),bn=null,xn=function(){function t(t){this.graph=t,this.cachedStates={enabled:{},disabled:{}},this.destroyed=!1}return t.checkCache=function(t,e,n){if(n[e]){var r=n[e].indexOf(t);r>=0&&n[e].splice(r,1)}},t.cacheState=function(t,e,n){n[e]||(n[e]=[]),n[e].push(t)},t.prototype.updateState=function(e,n,r){var i=this,o=t.checkCache,a=t.cacheState;if(!e.destroyed){var s=this.cachedStates,u=s.enabled,c=s.disabled;r?(o(e,n,c),a(e,n,u)):(o(e,n,u),a(e,n,c)),bn&&clearTimeout(bn),bn=setTimeout((function(){bn=null,i.updateGraphStates()}),16)}},t.prototype.updateStates=function(t,e,n){var r=this;Object(p.isString)(e)?this.updateState(t,e,n):e.forEach((function(e){r.updateState(t,e,n)}))},t.prototype.updateGraphStates=function(){var t=this.graph.get("states"),e=this.cachedStates;Object(p.each)(e.disabled,(function(e,n){t[n]&&(t[n]=t[n].filter((function(t){return e.indexOf(t)<0&&!e.destroyed})))})),Object(p.each)(e.enabled,(function(e,n){if(t[n]){var r={};t[n].forEach((function(t){t.destroyed||(r[t.get("id")]=!0)})),e.forEach((function(e){if(!e.destroyed){var i=e.get("id");r[i]||(r[i]=!0,t[n].push(e))}}))}else t[n]=e})),this.graph.emit("graphstatechange",{states:t}),this.cachedStates={enabled:{},disabled:{}}},t.prototype.destroy=function(){this.graph=null,this.cachedStates=null,bn&&clearTimeout(bn),bn=null,this.destroyed=!0},t}(),_n=n(36),wn=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){if("\\"===t.charAt(0))return t.slice(1);var r=e[n];return 0===r&&(r="0"),r||""})):t},En=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var n=0,r=t;n<r.length;n++){var i=r[n],o=i.x,a=i.y;e.push(o),e.push(a)}var s=Object(_n.a)(e);return s.unshift(["M",t[0].x,t[0].y]),s},Sn=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i={x:(1-n)*t.x+n*e.x,y:(1-n)*t.y+n*e.y},o=[0,0];b.c.normalize(o,[e.x-t.x,e.y-t.y]),o&&(o[0]||o[1])||(o=[0,0]);var a=[-o[1]*r,o[0]*r];return i.x+=a[0],i.y+=a[1],i},On=function(t,e){var n=t.length;if(!n)return"";for(var r="",i=0;i<n;i++){var o=t[i];r+=wn(0===i?"M{x} {y}":"L{x} {y}",o)}return e&&(r+="Z"),r},Mn=function(t){var e=[];return t.forEach((function(t){if("A"!==t[0])for(var n=1;n<t.length;n+=2)e.push([t[n],t[n+1]]);else{var r=t.length;e.push([t[r-2],t[r-1]])}})),e},kn=function(t){if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));var e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(r),t.unshift(i),t.push(e),t.push(n);for(var o=[],a=1;a<t.length-2;a+=1){var s=t[a-1].x,u=t[a-1].y,c=t[a].x,l=t[a].y,f=t[a+1].x,h=t[a+1].y,d=c+(f-s)/6,p=l+(h-u)/6,g=f-((a!==t.length-2?t[a+2].x:f)-c)/6,v=h-((a!==t.length-2?t[a+2].y:h)-l)/6;o.push(["C",d,p,g,v,f,h])}return o.unshift(["M",r.x,r.y]),o},An=function(t,e){return b.c.scale([0,0],b.c.normalize([0,0],t),e)},Cn=function(t,e){var n=[t[1]-e[1],e[0]-t[0]],r=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(0===r)throw new Error("p0 should not be equal to p1");return[n[0]/r,n[1]/r]},Tn=function(t,e){return[e[0]-t[0],e[1]-t[1]]};function In(t,e){if(!t||t.length<1)return"";if(1===t.length)return function(t){var n=[t[0][0],t[0][1]-e],r=[t[0][0],t[0][1]+e];return"M ".concat(n," A ").concat(e,",").concat(e,",0,0,0,").concat(r," A ").concat(e,",").concat(e,",0,0,0,").concat(n)}(t);if(2===t.length)return function(t){var n=b.c.scale([0,0],Cn(t[0],t[1]),e),r=b.c.scale([0,0],n,-1),i=b.c.add([0,0],t[0],n),o=b.c.add([0,0],t[1],n),a=b.c.add([0,0],t[1],r),s=b.c.add([0,0],t[0],r);return"M ".concat(i," L ").concat(o," A ").concat([e,e,"0,0,0",a].join(",")," L ").concat(s," A ").concat([e,e,"0,0,0",i].join(","))}(t);for(var n=new Array(t.length),r=0;r<n.length;++r){var i=0===r?t[t.length-1]:t[r-1],o=t[r],a=b.c.scale([0,0],Cn(i,o),e);n[r]=[b.c.add([0,0],i,a),b.c.add([0,0],o,a)]}var s="A ".concat([e,e,"0,0,0,"].join(","));return(n=n.map((function(t,e){var r="";return 0===e&&(r="M ".concat(n[n.length-1][1]," ")),r+="".concat(s+t[0]," L ").concat(t[1])}))).join(" ")}function jn(t,e){var n,r,i,o=t.length;if(!t||o<1)return"";if(1===o)return r=[(n=t)[0][0],n[0][1]-e],i=[n[0][0],n[0][1]+e],"M ".concat(r," A ").concat([e,e,"0,0,0",i].join(",")," A ").concat([e,e,"0,0,0",r].join(","));if(2===o)return function(t){var n=Tn(t[0],t[1]),r=An(n,e),i=b.c.add([0,0],t[0],b.c.scale([0,0],r,-1)),o=b.c.add([0,0],t[1],r),a=1.2*e,s=An(b.c.normalize([0,0],n),a),u=b.c.scale([0,0],s,-1),c=b.c.add([0,0],i,u),l=b.c.add([0,0],o,u),f=b.c.add([0,0],i,s);return"M ".concat(i," C ").concat([c,l,o].join(",")," S ").concat([f,i].join(",")," Z")}(t);for(var a=t.map((function(e,n){var r=t[(n+1)%o];return{p:e,v:b.c.normalize([0,0],Tn(e,r))}})),s=0;s<a.length;++s){var u=s>0?s-1:o-1,c=b.c.normalize([0,0],b.c.add([0,0],a[u].v,b.c.scale([0,0],a[s].v,-1)));a[s].p=b.c.add([0,0],a[s].p,b.c.scale([0,0],c,e))}return a.map((function(t){var e=t.p;return{x:e[0],y:e[1]}}))}var Pn=function(t,e,n){return(t.y-n.y)*(e.x-n.x)-(t.x-n.x)*(e.y-n.y)},Nn=function(t){var e=t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}}));if(e.sort((function(t,e){return t.x===e.x?t.y-e.y:t.x-e.x})),1===e.length)return e;for(var n=[],r=0;r<e.length;r++){for(;n.length>=2&&Pn(n[n.length-2],n[n.length-1],e[r])<=0;)n.pop();n.push(e[r])}var i=[];for(r=e.length-1;r>=0;r--){for(;i.length>=2&&Pn(i[i.length-2],i[i.length-1],e[r])<=0;)i.pop();i.push(e[r])}return i.pop(),n.pop(),n.concat(i)},Dn={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function Ln(t,e,n){var r=!1,i=function(t,n){return e.cells[t+n*e.width]},o=function(t,e){var r=0;return i(t-1,e-1)>=n&&(r+=1),i(t,e-1)>n&&(r+=2),i(t-1,e)>n&&(r+=4),i(t,e)>n&&(r+=8),r},a=function(n,r){for(var i,a,s=n,u=r,c=0;c<e.width*e.height;c++){if(i=s,a=u,t.findIndex((function(t){return t.x===s&&t.y===u}))>-1){if(t[0].x===s&&t[0].y===u)return!0}else t.push({x:s,y:u});var l=o(s,u);switch(l){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:s++;break;case 12:case 14:case 4:s--;break;case 6:0===i&&(-1===a?s-=1:s+=1);break;case 1:case 13:case 5:u--;break;case 9:1===i&&(0===a?u-=1:u+=1);break;case 10:case 8:case 11:u++;break;default:return console.warn("Marching squares invalid state: ".concat(l)),!0}}};this.march=function(){for(var t=0;t<e.width&&!r;t+=1)for(var s=0;s<e.height&&!r;s+=1)i(t,s)>n&&15!==o(t,s)&&(r=a(t,s));return r}}var Rn=function(t,e){var n=Number.POSITIVE_INFINITY,r=null;return t.forEach((function(t){var i=ue(t,e);i>=0&&i<n&&(r=t,n=i)})),r};function Bn(t,e,n,r,i){var o=function(t,e,n){var r=null,i=Number.POSITIVE_INFINITY;return e.forEach((function(e){var o={x:t.getModel().x,y:t.getModel().y},a={x:e.getModel().x,y:e.getModel().y},s=le(o,a),u=new ie(o.x,o.y,a.x,a.y),c=n.reduce((function(t,e){return ue(e,u)>0?t+1:t}),0);s*Math.pow(c+1,2)<i&&(r=e,i=s*Math.pow(c+1,2))})),r}(t,n,e);if(null===o)return[];return function(t){for(var n=[];t.length>0;){var r=t.pop();if(0===t.length){n.push(r);break}var i=t.pop(),o=new ie(r.x1,r.y1,i.x2,i.y2);Rn(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(function(t,e,n,r){var i=[],o=[];o.push(t);for(var a=!0,s=0,u=function(t,e){var n=!1;return e.forEach((function(e){n||(he(t,{x:e.x1,y:e.y1})||he(t,{x:e.x2,y:e.y2}))&&(n=!0)})),n},c=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n].getBBox(),o=[[i.x,i.y],[i.x+i.width,i.y],[i.x,i.y+i.height],[i.x+i.width,i.y+i.height]];if(ee(o,t.x,t.y))return!0}return!1};a&&s<n;){a=!1;for(var l=function(){var t=o.pop(),n=Rn(e,t);if(n){var l=se(n,t),f=l[0];if(2===l[1]){var h=function(s){for(var l=r,h=zn(n,l,f,s),d=u(h,o)||u(h,i),p=c(h,e);!d&&p&&l>=1;)h=zn(n,l/=1.5,f,s),d=u(h,o)||u(h,i),p=c(h,e);!h||d||s&&p||(o.push(new ie(t.x1,t.y1,h.x,h.y)),o.push(new ie(h.x,h.y,t.x2,t.y2)),a=!0)};h(!0),a||h(!1)}}a||i.push(t),s+=1};!a&&o.length;)l()}for(;o.length;)i.push(o.pop());return i}(new ie(t.getModel().x,t.getModel().y,o.getModel().x,o.getModel().y),e,r,i))}var Fn=function(t,e,n){var r=Object.assign(Dn,n),i=ce(t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}})));t=t.sort((function(t,e){return le({x:t.getModel().x,y:t.getModel().y},i)-le({x:e.getModel().x,y:e.getModel().y},i)}));var o=[],a=[];t.forEach((function(t){Bn(t,e,o,r.maxRoutingIterations,r.morphBuffer).forEach((function(t){a.push(t)})),o.push(t)}));for(var s,u,c,l,f,h=function(t,e,n){var r={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},i=[];t.forEach((function(t){i.push(t.getBBox())})),e.forEach((function(t){i.push(t.getBBox())}));for(var o=0,a=i;o<a.length;o++){var s=a[o];r.minX=(s.minX<r.minX?s.minX:r.minX)-n,r.minY=(s.minY<r.minY?s.minY:r.minY)-n,r.maxX=(s.maxX>r.maxX?s.maxX:r.maxX)+n,r.maxY=(s.maxY>r.maxY?s.maxY:r.maxY)+n}return r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.x=r.minX,r.y=r.minY,r}(t,a,r.nodeR0),d=(s=h.width,u=h.height,c=r.pixelGroupSize,l=Math.ceil(s/c),f=Math.ceil(u/c),{cells:new Float32Array(Math.max(0,l*f)).fill(0),width:l,height:f}),p=[],g=[],v=0;v<r.maxMarchingIterations;v++)if(Gn(t,e,a,h,d,r),g=[],new Ln(p=[],d,r.threshold).march()){var y=p.map((function(t){return{x:Math.round(t.x*r.pixelGroupSize+h.minX),y:Math.round(t.y*r.pixelGroupSize+h.minY)}}));if(y){var m=y.length;if(r.skip>1)for(m=Math.floor(y.length/r.skip);m<3&&r.skip>1;)r.skip-=1,m=Math.floor(y.length/r.skip);for(var b=0,x=0;x<m;x+=1,b+=r.skip)g.push({x:y[b].x,y:y[b].y})}if(g&&function(){for(var e=0,n=t;e<n.length;e++){var r=n[e],i=g.map((function(t){return[t.x,t.y]}));if(!ee(i,r.getBBox().centerX,r.getBBox().centerY))return!1}return!0}())return g;if(r.threshold*=.9,v<=.5*r.maxMarchingIterations)r.memberInfluenceFactor*=1.2,r.edgeInfluenceFactor*=1.2;else{if(!(0!==r.nonMemberInfluenceFactor&&e.length>0))break;r.nonMemberInfluenceFactor*=.8}}return g};function Gn(t,e,n,r,i,o){function a(t,e){var n=Math.floor((t-e)/o.pixelGroupSize);return n<0?0:n}function s(t,e){return t*o.pixelGroupSize+e}var u=(o.nodeR0-o.nodeR1)*(o.nodeR0-o.nodeR1),c=(o.edgeR0-o.edgeR1)*(o.edgeR0-o.edgeR1),l=function(t,e){return[Math.min(a(t.minX,e+r.minX),i.width),Math.min(a(t.minY,e+r.minY),i.height),Math.min(a(t.maxX,-e+r.minX),i.width),Math.min(a(t.maxY,-e+r.minY),i.height)]},f=function(t,e){for(var n=t.getBBox(),a=l(n,o.nodeR1),u=a[0],c=a[1],f=a[2],h=a[3],d=c;d<h;d+=1)for(var p=u;p<f;p+=1)if(!(e<0&&i[p+d*i.width]<=0)){var g=s(p,r.minX),v=s(d,r.minY),y=de({x:g,y:v},{x:n.minX,y:n.minY,width:n.width,height:n.height});if(y<Math.pow(o.nodeR1,2)){var m=Math.sqrt(y)-o.nodeR1;i.cells[p+d*i.width]+=e*m*m}}};o.nodeInfluenceFactor&&t.forEach((function(t){f(t,o.nodeInfluenceFactor/u)})),o.edgeInfluenceFactor&&n.forEach((function(t){!function(t,e){for(var n=t.getBBox(),a=l(n,o.edgeR1),u=a[0],c=a[1],f=a[2],h=a[3],d=c;d<h;d+=1)for(var p=u;p<f;p+=1)if(!(e<0&&i.cells[p+d*i.width]<=0)){var g=s(p,r.minX),v=s(d,r.minY),y=fe({x:g,y:v},t);if(y<Math.pow(o.edgeR1,2)){var m=Math.sqrt(y)-o.edgeR1;i.cells[p+d*i.width]+=e*m*m}}}(t,o.edgeInfluenceFactor/c)})),o.negativeNodeInfluenceFactor&&e.forEach((function(t){f(t,o.negativeNodeInfluenceFactor/u)}))}function zn(t,e,n,r){var i=t.getBBox(),o=n[0],a=n[1],s=n[2],u=n[3],c={topLeft:{x:i.minX-e,y:i.minY-e},topRight:{x:i.maxX+e,y:i.minY-e},bottomLeft:{x:i.minX-e,y:i.maxY+e},bottomRight:{x:i.maxX+e,y:i.maxY+e}},l=i.height*i.width;function f(t,e){return i.width*(.5*(t.y-i.minY+(e.y-i.minY)))}if(a)return o?r?c.topLeft:c.bottomRight:s?r?c.bottomLeft:c.topRight:f(a,u)<.5*l?a.y>u.y?r?c.topLeft:c.bottomRight:r?c.topRight:c.bottomLeft:a.y<u.y?r?c.bottomLeft:c.topRight:r?c.bottomRight:c.topLeft;if(u){if(o)return r?c.topRight:c.bottomLeft;if(s)return r?c.bottomRight:c.topLeft}return f(o,s)<.5*l?o.x>s.x?r?c.topLeft:c.bottomRight:r?c.bottomLeft:c.topRight:o.x<s.x?r?c.topRight:c.bottomLeft:r?c.bottomRight:c.topLeft}var Un=function(){function t(t,e){this.cfg=Object(p.deepMix)(this.getDefaultCfg(),e),this.graph=t,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map((function(e){return Object(p.isString)(e)?t.findById(e):e})),this.nonMembers=this.cfg.nonMembers.map((function(e){return Object(p.isString)(e)?t.findById(e):e})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return t.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},t.prototype.setPadding=function(){var t=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},t.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),"round-convex"!==this.type&&"smooth-convex"!==this.type&&"bubble"!==this.type&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},t.prototype.calcPath=function(t,e){var n,r,i;switch(this.type){case"round-convex":i=In((n=Nn(t)).map((function(t){return[t.x,t.y]})),this.padding),r=Object(_n.b)(i);break;case"smooth-convex":2===(n=Nn(t)).length?(i=In(n.map((function(t){return[t.x,t.y]})),this.padding),r=Object(_n.b)(i)):n.length>2&&(i=jn(n.map((function(t){return[t.x,t.y]})),this.padding),r=kn(i));break;case"bubble":r=(n=Fn(t,e,this.cfg.bubbleCfg)).length>=2&&kn(n)}return r},t.prototype.render=function(){this.group.addShape("path",{attrs:Object(d.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1&&(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.removeNonMember=function(t){if(t){Object(p.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1&&(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.updateData=function(t,e){var n=this;this.group.findById(this.id).remove(),t&&(this.members=t.map((function(t){return Object(p.isString)(t)?n.graph.findById(t):t}))),e&&(this.nonMembers=e.map((function(t){return Object(p.isString)(t)?n.graph.findById(t):t}))),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(t){this.group.findById(this.id).attr(Object(d.__assign)({},t))},t.prototype.updateCfg=function(t){var e=this;this.cfg=Object(p.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map((function(t){return Object(p.isString)(t)?e.graph.findById(t):t}))),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map((function(t){return Object(p.isString)(t)?e.graph.findById(t):t}))),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(t){var e,n,r=this,i=(e=Object(p.isString)(t)?this.graph.findById(t):t).getKeyShape();if("path"===e.get("type"))n=Mn(i.attr("path"));else{var o=i.getCanvasBBox();n=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return n=n.map((function(t){var e=r.graph.getPointByCanvas(t[0],t[1]);return[e.x,e.y]})),re(n,Mn(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),Vn=b.a.transform,Wn=function(t){function e(e){var n=t.call(this)||this;return n.cfg=Object(p.deepMix)(n.getDefaultCfg(),e),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new jt(n.cfg.maxStep),n.redoStack=new jt(n.cfg.maxStep)),n}return Object(d.__extends)(e,t),e.prototype.init=function(){this.initCanvas();var t=new en(this),e=new Ye(this),n=new mn(this),r=new xn(this);this.set({viewController:t,modeController:e,itemController:n,stateController:r}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var e=(t.get("el")||{}).id,n=void 0===e?"g6":e,r=t.addGroup({id:"".concat(n,"-root"),className:Oe.rootContainerClassName});if(this.get("groupByTypes")){var i=r.addGroup({id:"".concat(n,"-edge"),className:Oe.edgeContainerClassName}),o=r.addGroup({id:"".concat(n,"-node"),className:Oe.nodeContainerClassName}),a=r.addGroup({id:"".concat(n,"-combo"),className:Oe.comboContainerClassName});a.toBack(),this.set({nodeGroup:o,edgeGroup:i,comboGroup:a})}var s=r.addGroup({id:"".concat(n,"-delegate"),className:Oe.delegateContainerClassName});this.set({delegateGroup:s}),this.set("group",r)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.2,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[]}},e.prototype.set=function(t,e){return Object(p.isPlainObject)(t)?this.cfg=Object(d.__assign)(Object(d.__assign)({},this.cfg),t):this.cfg[t]=e,"enabledStack"!==t||!e||this.undoStack||this.redoStack||(this.undoStack=new jt(this.cfg.maxStep),this.redoStack=new jt(this.cfg.maxStep)),this},e.prototype.get=function(t){var e;return null===(e=this.cfg)||void 0===e?void 0:e[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,e){Object(p.isString)(t)&&(t=this.findById(t));var n=this.get("itemController");e||(e=t.get("states")),n.clearItemStates(t,e),this.get("stateController").updateStates(t,e,!1)},e.prototype.node=function(t){"function"==typeof t&&this.set("nodeMapper",t)},e.prototype.edge=function(t){"function"==typeof t&&this.set("edgeMapper",t)},e.prototype.combo=function(t){"function"==typeof t&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,e){var n,r=this.get("".concat(t,"s"));return Object(p.each)(r,(function(t,r){if(e(t,r))return n=t})),n},e.prototype.findAll=function(t,e){var n=[];return Object(p.each)(this.get("".concat(t,"s")),(function(t,r){e(t,r)&&n.push(t)})),n},e.prototype.findAllByState=function(t,e){return this.findAll(t,(function(t){return t.hasState(e)}))},e.prototype.getAnimateCfgWithCallback=function(t){var e,n=t.animateCfg,r=t.callback;if(n)if(e=Object(p.clone)(n),n.callback){var i=n.callback;e.callback=function(){r(),i()}}else e.callback=r;else e={duration:500,callback:r};return e},e.prototype.translate=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(p.clone)(o.getMatrix());if(a||(a=[1,0,0,0,1,0,0,0,1]),n){var s=this.getAnimateCfgWithCallback({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});Zt(o,{x:o.getCanvasBBox().x+t,y:o.getCanvasBBox().y+e},n,s||{duration:500,easing:"easeCubic"})}else a=Vn(a,[["t",t,e]]),o.setMatrix(a),this.emit("viewportchange",{action:"translate",matrix:a}),this.autoPaint()},e.prototype.moveTo=function(t,e,n,r){var i=this.get("group");Zt(i,{x:t,y:e},n,r||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:i.getMatrix()})},e.prototype.fitView=function(t,e){t&&this.set("fitViewPadding",t);var n=this.get("viewController");e?n.fitViewByRules(e):n.fitView(),this.autoPaint()},e.prototype.fitCenter=function(){this.get("viewController").fitCenter(),this.autoPaint()},e.prototype.addBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!0),this},e.prototype.removeBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!1),this},e.prototype.updateBehavior=function(t,e,n){return this.get("modeController").updateBehavior(t,e,n),this},e.prototype.zoom=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(p.clone)(o.getMatrix()),s=this.get("minZoom"),u=this.get("maxZoom");if(a||(a=[1,0,0,0,1,0,0,0,1]),a=Vn(a,e?[["t",-e.x,-e.y],["s",t,t],["t",e.x,e.y]]:[["s",t,t]]),s&&a[0]<s||u&&a[0]>u)return!1;if(n){var c=Object(p.clone)(o.getMatrix());c||(c=[1,0,0,0,1,0,0,0,1]);var l=c[0],f=l*t,h=this.getAnimateCfgWithCallback({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate((function(t){if(1===t)c=a;else{var n=ge(l,f,t)/c[0];c=Vn(c,e?[["t",-e.x,-e.y],["s",n,n],["t",e.x,e.y]]:[["s",n,n]])}return{matrix:c}}),h)}else o.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint();return!0},e.prototype.zoomTo=function(t,e,n,r){var i=t/this.getZoom();return this.zoom(i,e,n,r)},e.prototype.focusItem=function(t,e,n){var r=this.get("viewController"),i=!1;e?i=!0:void 0===e&&(i=this.get("animate"));var o={};n?o=n:void 0===n&&(o=this.get("animateCfg")),r.focus(t,i,o),this.autoPaint()},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,e){return this.get("viewController").getPointByClient(t,e)},e.prototype.getClientByPoint=function(t,e){return this.get("viewController").getClientByPoint(t,e)},e.prototype.getPointByCanvas=function(t,e){return this.get("viewController").getPointByCanvas(t,e)},e.prototype.getCanvasByPoint=function(t,e){return this.get("viewController").getCanvasByPoint(t,e)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!0);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!1}],o.nodes=[{id:r,visible:!0}];break;case"edge":i.nodes=[{id:r,visible:!1}],o.edges=[{id:r,visible:!0}];break;case"combo":i.nodes=[{id:r,visible:!1}],o.combos=[{id:r,visible:!0}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.hideItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!1);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!0}],o.nodes=[{id:r,visible:!1}];break;case"edge":i.nodes=[{id:r,visible:!0}],o.edges=[{id:r,visible:!1}];break;case"combo":i.nodes=[{id:r,visible:!0}],o.combos=[{id:r,visible:!1}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.refreshItem=function(t){this.get("itemController").refreshItem(t)},e.prototype.setAutoPaint=function(t){this.set("autoPaint",t),this.get("canvas").set("autoDraw",t)},e.prototype.remove=function(t,e){void 0===e&&(e=!0),this.removeItem(t,e)},e.prototype.removeItem=function(t,e){void 0===e&&(e=!0);var n=t;if(Object(p.isString)(t)&&(n=this.findById(t)),!n&&Object(p.isString)(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(n){var r="";if(n.getType&&(r=n.getType()),e&&this.get("enabledStack")){var i=Object(d.__assign)(Object(d.__assign)({},n.getModel()),{itemType:r}),o={};switch(r){case"node":o.nodes=[i],o.edges=[];for(var a=n.getEdges(),s=a.length-1;s>=0;s--)o.edges.push(Object(d.__assign)(Object(d.__assign)({},a[s].getModel()),{itemType:"edge"}));break;case"edge":o.edges=[i];break;case"combo":o.combos=[i]}this.pushStack("delete",{before:o,after:{}})}if("node"===r)n.getModel().comboId&&this.updateComboTree(n,void 0,!1);if(this.get("itemController").removeItem(n),"combo"===r){var u=ze(this.get("comboTrees"));this.set("comboTrees",u)}}},e.prototype.addItem=function(t,e,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!r);var o=this.get("itemController");if(!function(t,e){if("node"===t||"combo"===t){if(e.id&&!Object(p.isString)(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(!("edge"!==t||e.source&&e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0}(t,e))return!1;if(!e.id||!this.findById(e.id)){var a,s=this.get("comboTrees")||[];if("combo"===t){var u=this.get("itemMap"),c=!1;if(s.forEach((function(n){c||Re(n,(function(n){if(e.parentId===n.id){c=!0;var r=Object(d.__assign)({id:e.id,depth:n.depth+2},e);n.children?n.children.push(r):n.children=[r],e.depth=r.depth,a=o.addItem(t,e)}var i=u[n.id];return c&&i&&i.getType&&"combo"===i.getType()&&o.updateCombo(i,n.children),!0}))})),!c){var l=Object(d.__assign)({id:e.id,depth:0},e);e.depth=l.depth,s.push(l),a=o.addItem(t,e)}this.set("comboTrees",s)}else if("node"===t&&Object(p.isString)(e.comboId)&&s){var f;(f=this.findById(e.comboId))&&f.getType&&"combo"!==f.getType()&&console.warn("'".concat(e.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=o.addItem(t,e);var h=this.get("itemMap"),g=!1,v=!1;s.forEach((function(t){v||g||Re(t,(function(t){if(t.id===e.id)return v=!0,!1;if(e.comboId===t.id&&!v){g=!0;var n=Object(p.clone)(e);n.itemType="node",t.children?t.children.push(n):t.children=[n],n.depth=t.depth+1}return g&&h[t.id].getType&&"combo"===h[t.id].getType()&&o.updateCombo(h[t.id],t.children),!0}))}))}else a=o.addItem(t,e);if("node"===t&&e.comboId||"combo"===t&&e.parentId)(f=this.findById(e.comboId||e.parentId))&&f.getType&&"combo"===f.getType()&&f.addChild(a);var y=this.get("combos");if(y&&y.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var m=Object(d.__assign)(Object(d.__assign)({},a.getModel()),{itemType:t}),b={};switch(t){case"node":b.nodes=[m];break;case"edge":b.edges=[m];break;case"combo":b.combos=[m]}this.pushStack("add",{before:{},after:b})}return a}console.warn("This item exists already. Be sure the id %c".concat(e.id,"%c is unique."),"font-size: 20px; color: red;","")},e.prototype.add=function(t,e,n,r){return void 0===n&&(n=!0),void 0===r&&(r=!0),this.addItem(t,e,n,r)},e.prototype.updateItem=function(t,e,n){var r=this;void 0===n&&(n=!0);var i,o=this.get("itemController");i=Object(p.isString)(t)?this.findById(t):t;var a=Object(p.clone)(i.getModel()),s="";i.getType&&(s=i.getType());var u=Object(d.__spreadArray)([],i.getStates(),!0);if("combo"===s&&Object(p.each)(u,(function(t){return r.setItemState(i,t,!1)})),o.updateItem(i,e),"combo"===s&&Object(p.each)(u,(function(t){return r.setItemState(i,t,!0)})),n&&this.get("enabledStack")){var c={nodes:[],edges:[],combos:[]},l={nodes:[],edges:[],combos:[]},f=Object(d.__assign)({id:a.id},e);switch(s){case"node":c.nodes.push(a),l.nodes.push(f);break;case"edge":c.edges.push(a),l.edges.push(f);break;case"combo":c.combos.push(a),l.combos.push(f)}"node"===s&&c.nodes.push(a),this.pushStack("update",{before:c,after:l})}},e.prototype.update=function(t,e,n){void 0===n&&(n=!0),this.updateItem(t,e,n)},e.prototype.setItemState=function(t,e,n){Object(p.isString)(t)&&(t=this.findById(t)),this.get("itemController").setItemState(t,e,n);var r=this.get("stateController");Object(p.isString)(n)?r.updateState(t,"".concat(e,":").concat(n),!0):r.updateState(t,e,n)},e.prototype.priorityState=function(t,e){this.get("itemController").priorityState(t,e)},e.prototype.data=function(t){Xe(t),this.set("data",t)},e.prototype.render=function(){var t=this;this.set("comboSorted",!1);var e=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!e)throw new Error("data must be defined first");var n=e.nodes,r=void 0===n?[]:n,i=e.edges,o=void 0===i?[]:i,a=e.combos,s=void 0===a?[]:a;if(this.clear(!0),this.emit("beforerender"),Object(p.each)(r,(function(e){t.add("node",e,!1,!1)})),0!==(null==s?void 0:s.length)){var u=Ge(s,r);this.set("comboTrees",u),t.addCombos(s)}Object(p.each)(o,(function(e){t.add("edge",e,!1,!1)}));var c=t.get("animate");(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",!1);var l=t.get("layoutController");if(l){if(l.layout((function(){t.get("fitView")?t.fitView():t.get("fitCenter")&&t.fitCenter();t.autoPaint(),t.emit("afterrender"),(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",c)})),this.destroyed)return}else t.get("fitView")&&t.fitView(),t.get("fitCenter")&&t.fitCenter(),t.emit("afterrender"),t.set("animate",c);this.get("groupByTypes")||(s&&0!==s.length?this.sortCombos():e.nodes&&e.edges&&e.nodes.length<e.edges.length?this.getNodes().forEach((function(t){t.toFront()})):this.getEdges().forEach((function(t){t.toBack()})));this.get("enabledStack")&&this.pushStack("render")},e.prototype.read=function(t){this.data(t),this.render()},e.prototype.diffItems=function(t,e,n){var r,i=this,o=this.get("itemMap");Object(p.each)(n,(function(n){if(r=o[n.id]){if(i.get("animate")&&"node"===t){var a=r.getContainer().getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]),r.set("originAttrs",{x:a[6],y:a[7]})}i.updateItem(r,n,!1)}else r=i.addItem(t,n,!1);r&&e["".concat(t,"s")].push(r)}))},e.prototype.changeData=function(t,e){void 0===e&&(e=!0);var n=this,r=t||n.get("data");if(!Xe(r))return this;e&&this.get("enabledStack")&&this.pushStack("changedata",{before:n.save(),after:r}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map((function(t){return n.clearItemStates(t)})),this.getEdges().map((function(t){return n.clearItemStates(t)}));var i=this.get("canvas"),o=i.get("localRefresh");i.set("localRefresh",!1),n.get("data")||(n.data(r),n.render());var a=this.get("itemMap"),s={nodes:[],edges:[]},u=r.combos;if(u){var c=Ge(u,r.nodes);this.set("comboTrees",c)}else this.set("comboTrees",[]);this.diffItems("node",s,r.nodes),Object(p.each)(a,(function(t,e){a[e].getModel().depth=0,t.getType&&"edge"===t.getType()||(t.getType&&"combo"===t.getType()?(delete a[e],t.destroy()):s.nodes.indexOf(t)<0&&(delete a[e],n.remove(t,!1)))}));for(var l=this.getCombos(),f=l.length-1;f>=0;f--)l[f].destroyed&&l.splice(f,1);u&&(n.addCombos(u),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",s,r.edges),Object(p.each)(a,(function(t,e){(!t.getType||"node"!==t.getType()&&"combo"!==t.getType())&&s.edges.indexOf(t)<0&&(delete a[e],n.remove(t,!1))})),this.set({nodes:s.nodes,edges:s.edges});var h=this.get("layoutController");return h&&(h.changeData(),n.get("animate")&&!h.getLayoutType()?n.positionsAnimate():n.autoPaint()),setTimeout((function(){i.set("localRefresh",o)}),16),this},e.prototype.addCombos=function(t){var e=this.get("comboTrees");this.get("itemController").addCombos(e,t)},e.prototype.createCombo=function(t,e){var n=this;this.set("comboSorted",!1);var r,i="";if(t){if(Object(p.isString)(t))i=t,r={id:t};else{if(!(i=t.id))return void console.warn("Create combo failed. Please assign a unique string id for the adding combo.");r=t}var o=e.map((function(t){var e=n.findById(t),r=e.getModel(),o="";e.getType&&(o=e.getType());var a={id:e.getID(),itemType:o};return"combo"===o?(a.parentId=i,r.parentId=i):"node"===o&&(a.comboId=i,r.comboId=i),a}));r.children=o,this.addItem("combo",r,!1),this.set("comboSorted",!1);var a=this.get("comboTrees");(a||[]).forEach((function(t){Re(t,(function(t){return t.id!==i||(t.itemType="combo",t.children=o,!1)}))})),a&&this.sortCombos()}},e.prototype.uncombo=function(t){var e,n=this,r=t;if(Object(p.isString)(t)&&(r=this.findById(t)),!r||r.getType&&"combo"!==r.getType())console.warn("The item is not a combo!");else{var i=r.getModel().parentId,o=this.get("comboTrees");o||(o=[]);var a,s=this.get("itemMap"),u=r.get("id"),c=[],l=this.get("combos"),f=this.findById(i);if(o.forEach((function(t){a||Re(t,(function(t){var e;if(t.id===u){a=t,r.getEdges().map((function(t){return t.getID()})).forEach((function(t){n.removeItem(t,!1)}));var o=l.indexOf(r);l.splice(o,1),delete s[u],r.destroy(),n.emit("afterremoveitem",{item:r,type:"combo"})}return!i||!a||t.id!==i||(f.removeCombo(r),-1!==(o=(c=t.children).indexOf(a))&&c.splice(o,1),null===(e=a.children)||void 0===e||e.forEach((function(t){var e=n.findById(t.id),r=e.getModel();e.getType&&"combo"===e.getType()?(t.parentId=i,delete t.comboId,r.parentId=i,delete r.comboId):e.getType&&"node"===e.getType()&&(t.comboId=i,r.comboId=i),f.addChild(e),c.push(t)})),!1)}))})),!i&&a){var h=o.indexOf(a);o.splice(h,1),null===(e=a.children)||void 0===e||e.forEach((function(t){t.parentId=void 0;var e=n.findById(t.id).getModel();delete e.parentId,delete e.comboId,"node"!==t.itemType&&o.push(t)}))}}},e.prototype.updateCombos=function(t){var e=this;void 0===t&&(t=!1);var n=this.get("comboTrees"),r=this.get("itemController"),i=this.get("itemMap");(n||[]).forEach((function(n){Re(n,(function(n){if(!n)return!0;var o=i[n.id];if(o&&o.getType&&"combo"===o.getType()){var a=Object(d.__spreadArray)([],o.getStates(),!0);Object(p.each)(a,(function(t){return e.setItemState(o,t,!1)})),r.updateCombo(o,n.children,t),Object(p.each)(a,(function(t){return e.setItemState(o,t,!0)}))}return!0}))})),this.sortCombos()},e.prototype.updateCombo=function(t){var e,n=this,r=t;if(Object(p.isString)(t)&&(r=this.findById(t)),!r||r.getType&&"combo"!==r.getType())console.warn("The item to be updated is not a combo!");else{e=r.get("id");var i=this.get("comboTrees"),o=this.get("itemController"),a=this.get("itemMap");(i||[]).forEach((function(t){Re(t,(function(t){if(!t)return!0;var r=a[t.id];if(e===t.id&&r&&r.getType&&"combo"===r.getType()){var i=Object(d.__spreadArray)([],r.getStates(),!0);Object(p.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!1)})),o.updateCombo(r,t.children),Object(p.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!0)})),e&&(e=t.parentId)}return!0}))}))}},e.prototype.updateComboTree=function(t,e,n){void 0===n&&(n=!0);var r;this.set("comboSorted",!1);var i,o=(r=Object(p.isString)(t)?this.findById(t):t).getModel(),a=o.comboId||o.parentId,s="";if(r.getType&&(s=r.getType()),e&&"combo"===s){var u,c=this.get("comboTrees"),l=!0;if((c||[]).forEach((function(t){u||Le(t,(function(t){if(!u)return t.id===r.getID()&&(u=t),!0}))})),Le(u,(function(t){return t.id!==e||(l=!1,!1)})),!l)return void console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!")}if(n&&this.get("enabledStack")){var f={},h={};"combo"===s?(f.combos=[{id:o.id,parentId:o.parentId}],h.combos=[{id:o.id,parentId:e}]):"node"===s&&(f.nodes=[{id:o.id,parentId:o.comboId}],h.nodes=[{id:o.id,parentId:e}]),this.pushStack("updateComboTree",{before:f,after:h})}if(o.parentId||o.comboId){var d=this.findById(o.parentId||o.comboId);d&&d.removeChild(r)}("combo"===s?o.parentId=e:"node"===s&&(o.comboId=e),e)&&((i=this.findById(e))&&i.addChild(r));a&&((i=this.findById(a))&&i.removeChild(r));var g=ze(this.get("comboTrees"),o.id,e);this.set("comboTrees",g),this.updateCombos()},e.prototype.save=function(){var t=[],e=[],n=[];return Object(p.each)(this.get("nodes"),(function(e){t.push(e.getModel())})),Object(p.each)(this.get("edges"),(function(t){e.push(t.getModel())})),Object(p.each)(this.get("combos"),(function(t){n.push(t.getModel())})),{nodes:t,edges:e,combos:n}},e.prototype.changeSize=function(t,e){return this.get("viewController").changeSize(t,e),this},e.prototype.refresh=function(){if(this.emit("beforegraphrefresh"),this.get("animate"))this.positionsAnimate();else{var t=this.get("nodes"),e=this.get("edges"),n=this.get("edges");Object(p.each)(t,(function(t){t.refresh()})),Object(p.each)(e,(function(t){t.refresh()})),Object(p.each)(n,(function(t){t.refresh()}))}this.emit("aftergraphrefresh"),this.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if(Object(p.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType()))return t.getChildren();console.warn("The combo does not exist!")},e.prototype.positionsAnimate=function(t){var e=this;e.emit("beforeanimate");var n=e.get("animateCfg"),r=n.onFrame,i=t?e.getNodes().concat(e.getCombos()):e.getNodes(),o=i.map((function(t){var e=t.getModel();return{id:e.id,x:e.x,y:e.y}}));e.isAnimating()&&e.stopAnimate(),e.get("canvas").animate((function(n){Object(p.each)(o,(function(t){var i=e.findById(t.id);if(i&&!i.destroyed){var o=i.get("originAttrs"),a=i.get("model"),s=i.getContainer().getMatrix();if(void 0===o&&i.set("originAttrs",s?{x:s[6],y:s[7]}:0),r){var u=r(i,n,t,o||{x:0,y:0});i.set("model",Object.assign(a,u))}else o?(a.x=o.x+(t.x-o.x)*n,a.y=o.y+(t.y-o.y)*n):(a.x=t.x,a.y=t.y)}})),e.refreshPositions(t)}),{duration:n.duration,easing:n.easing,callback:function(){Object(p.each)(i,(function(t){t.set("originAttrs",null)})),n.callback&&n.callback(),e.emit("afteranimate"),e.animating=!1}})},e.prototype.refreshPositions=function(t){this.emit("beforegraphrefreshposition");var e,n=this.get("nodes"),r=this.get("edges"),i=this.get("vedges"),o=this.get("combos"),a={},s=function(t){Object(p.each)(t,(function(t){e=t.getModel();var n=t.get("originAttrs");if(!n||e.x!==n.x||e.y!==n.y){var r=t.updatePosition({x:e.x,y:e.y});a[e.id]=r,e.comboId&&(a[e.comboId]=a[e.comboId]||r)}}))};s(n),o&&0!==o.length&&(this.updateCombos(),t&&s(o)),Object(p.each)(r,(function(t){var e=t.getSource().getModel(),n=t.getTarget();if(!Object(p.isPlainObject)(n)){var r=n.getModel();(a[e.id]||a[r.id]||t.getModel().isComboEdge)&&t.refresh()}})),Object(p.each)(i,(function(t){t.refresh()})),this.emit("aftergraphrefreshposition"),this.autoPaint()},e.prototype.stopAnimate=function(){this.get("canvas").stopAnimate()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){return this.get("modeController").getMode()},e.prototype.setMode=function(t){return this.get("modeController").setMode(t),this},e.prototype.clear=function(t){var e;return void 0===t&&(t=!1),null===(e=this.get("canvas"))||void 0===e||e.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,e,n){var r=this,i=this.get("layoutController");if(Object(p.isString)(t)&&(t={type:t}),e){var o=n;o||(o="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),o=this.getPointByCanvas(o.x,o.y);var a=["force","gForce","fruchterman"];a.includes(t.type)||!t.type&&a.includes(null==i?void 0:i.layoutType)?t.center=[o.x,o.y]:this.once("afterlayout",(function(t){var n=r.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];o.x=o.x*n[0]+n[6],o.y=o.y*n[0]+n[7];var i=r.getGroup().getCanvasBBox(),a=i.minX,s=i.maxX,u=i.minY,c={x:(a+s)/2,y:(u+i.maxY)/2};"begin"===e&&(c.x=a,c.y=u),r.translate(o.x-c.x,o.y-c.y)}))}var s=this.get("layout"),u={};Object.assign(u,s,t),this.set("layout",u),i.isLayoutTypeSame(u)&&u.gpuEnabled===s.gpuEnabled?i.updateLayoutCfg(u):i.changeLayout(u)},e.prototype.destroyLayout=function(){this.get("layoutController").destroyLayout()},e.prototype.layout=function(){var t=this.get("layoutController"),e=this.get("layout");e&&t&&(e.workerEnabled?t.layout():t.layoutMethod?t.relayout(!0):t.layout())},e.prototype.collapseCombo=function(t){var e=this;if(!this.destroyed)if(Object(p.isString)(t)&&(t=this.findById(t)),t){this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var n=t.getModel();this.get("itemController").collapseCombo(t),n.collapsed=!0;var r=this.getEdges().concat(this.get("vedges")),i=[],o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Le(t,(function(t){if(s&&t.depth<=n.depth)return!1;if(n.id===t.id&&(s=!0),s){var r=e.findById(t.id);r&&r.getType&&"combo"===r.getType()&&(i=i.concat(r.getNodes()),o=o.concat(r.getCombos()))}return!0}))}));var u={},c=[];r.forEach((function(t){if(!t.isVisible()||t.getModel().isVEdge){var r=t.getSource(),a=t.getTarget();if((i.includes(r)||o.includes(r))&&!i.includes(a)&&!o.includes(a)||r.getModel().id===n.id){if((h=t.getModel()).isVEdge)return void e.removeItem(t,!1);for(var s=a.getModel();!a.isVisible();){if(!(a=e.findById(s.parentId||s.comboId))||!s.parentId&&!s.comboId)return;s=a.getModel()}var l=s.id;if(u["".concat(n.id,"-").concat(l)])return void(u["".concat(n.id,"-").concat(l)]+=h.size||1);var f=e.addItem("vedge",{source:n.id,target:l,isVEdge:!0},!1);u["".concat(n.id,"-").concat(l)]=h.size||1,c.push(f)}else if(!i.includes(r)&&!o.includes(r)&&(i.includes(a)||o.includes(a))||a.getModel().id===n.id){var h;if((h=t.getModel()).isVEdge)return void e.removeItem(t,!1);for(var d=r.getModel();!r.isVisible();){if(!(r=e.findById(d.parentId||d.comboId))||!d.parentId&&!d.comboId)return;d=r.getModel()}var p=d.id;if(u["".concat(p,"-").concat(n.id)])return void(u["".concat(p,"-").concat(n.id)]+=h.size||1);f=e.addItem("vedge",{target:n.id,source:p,isVEdge:!0},!1);u["".concat(p,"-").concat(n.id)]=h.size||1,c.push(f)}}})),c.forEach((function(t){var n=t.getModel();e.updateItem(t,{size:u["".concat(n.source,"-").concat(n.target)]},!1)})),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}else console.warn("The combo to be collapsed does not exist!")},e.prototype.expandCombo=function(t){var e=this;if(Object(p.isString)(t)&&(t=this.findById(t)),!t||t.getType&&"combo"!==t.getType())console.warn("The combo to be collapsed does not exist!");else{this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var n=t.getModel();this.get("itemController").expandCombo(t),n.collapsed=!1;var r=this.getEdges().concat(this.get("vedges")),i=[],o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Le(t,(function(t){if(s&&t.depth<=n.depth)return!1;if(n.id===t.id&&(s=!0),s){var r=e.findById(t.id);r&&r.getType&&"combo"===r.getType()&&(i=i.concat(r.getNodes()),o=o.concat(r.getCombos()))}return!0}))}));var u={},c={};r.forEach((function(t){if(!t.isVisible()||t.getModel().isVEdge){var r=t.getSource(),a=t.getTarget(),s=r.get("id"),l=a.get("id");if((i.includes(r)||o.includes(r))&&!i.includes(a)&&!o.includes(a)||s===n.id){if(t.getModel().isVEdge)return void e.removeItem(t,!1);for(var f=a.getModel();!a.isVisible();){if(!(a=e.findById(f.comboId||f.parentId))||!f.parentId&&!f.comboId)return;f=a.getModel()}l=f.id;for(var h=r.getModel();!r.isVisible();){if(!(r=e.findById(h.comboId||h.parentId))||!h.parentId&&!h.comboId)return;if(h.comboId===n.id||h.parentId===n.id)break;h=r.getModel()}if(s=h.id,l){var d="".concat(s,"-").concat(l);if(u[d])return u[d]+=t.getModel().size||1,void e.updateItem(c[d],{size:u[d]},!1);var p=e.addItem("vedge",{source:s,target:l,isVEdge:!0},!1);u[d]=t.getModel().size||1,c[d]=p}}else if(!i.includes(r)&&!o.includes(r)&&(i.includes(a)||o.includes(a))||l===n.id){if(t.getModel().isVEdge)return void e.removeItem(t,!1);for(h=r.getModel();!r.isVisible();){if(!(r=e.findById(h.comboId||h.parentId))||!h.parentId&&!h.comboId)return;h=r.getModel()}s=h.id;for(f=a.getModel();!a.isVisible();){if(!(a=e.findById(f.comboId||f.parentId))||!f.parentId&&!f.comboId)return;if(f.comboId===n.id||f.parentId===n.id)break;f=a.getModel()}if(l=f.id,s){d="".concat(s,"-").concat(l);if(u[d])return u[d]+=t.getModel().size||1,void e.updateItem(c[d],{size:u[d]},!1);p=e.addItem("vedge",{target:l,source:s,isVEdge:!0},!1);u[d]=t.getModel().size||1,c[d]=p}}else(i.includes(r)||o.includes(r))&&(i.includes(a)||o.includes(a))&&r.isVisible()&&a.isVisible()&&t.show()}})),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})}},e.prototype.collapseExpandCombo=function(t){if(Object(p.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType())){for(var e=t.getModel(),n=this.findById(e.parentId);n;){var r=n.getModel();if(r.collapsed)return console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),void(n=void 0);n=this.findById(r.parentId)}e.collapsed?this.expandCombo(t):this.collapseCombo(t),this.updateCombo(t)}},e.prototype.sortCombos=function(){var t=this;if(!this.get("comboSorted")){this.set("comboSorted",!0);var e=[],n={};(this.get("comboTrees")||[]).forEach((function(t){Le(t,(function(t){return e[t.depth]?e[t.depth].push(t.id):e[t.depth]=[t.id],n[t.id]=t.depth,!0}))})),(this.getEdges().concat(this.get("vedges"))||[]).forEach((function(t){var r=t.getModel(),i=n[r.source]||0,o=n[r.target]||0,a=Math.max(i,o);e[a]?e[a].push(r.id):e[a]=[r.id]})),e.forEach((function(e){if(e&&e.length)for(var n=e.length-1;n>=0;n--){var r=t.findById(e[n]);r&&r.toFront()}}))}},e.prototype.getNeighbors=function(t,e){var n=t;return Object(p.isString)(t)&&(n=this.findById(t)),n.getNeighbors(e)},e.prototype.getNodeDegree=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=!1);var r=t;Object(p.isString)(t)&&(r=this.findById(t));var i=this.get("degrees");i&&!n||(i=j(this.save()),this.set("degrees",i));var o=i[r.getID()],a=0;if(!o)return 0;switch(e){case"in":a=o.inDegree;break;case"out":a=o.outDegree;break;case"all":a=o;break;default:a=o.degree}return a},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear())},e.prototype.pushStack=function(t,e,n){if(void 0===t&&(t="update"),void 0===n&&(n="undo"),this.get("enabledStack")){var r=e?Object(p.clone)(e):{before:{},after:Object(p.clone)(this.save())};"redo"===n?this.redoStack.push({action:t,data:r}):this.undoStack.push({action:t,data:r}),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack})}else console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !")},e.prototype.getAdjMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix");return n&&t||(n=x(this.save(),e),this.set("adjMatrix",n)),n},e.prototype.getShortestPathMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix"),r=this.get("shortestPathMatrix");return n&&t||(n=x(this.save(),e),this.set("adjMatrix",n)),r&&t||(r=X(this.save(),e),this.set("shortestPathMatrix",r)),r},e.prototype.on=function(e,n,r){return t.prototype.on.call(this,e,n,r)},e.prototype.destroy=function(){var t,e,n,r,i;this.clear(),this.clearStack(),null===(t=this.get("itemController"))||void 0===t||t.destroy(),null===(e=this.get("modeController"))||void 0===e||e.destroy(),null===(n=this.get("viewController"))||void 0===n||n.destroy(),null===(r=this.get("stateController"))||void 0===r||r.destroy(),null===(i=this.get("canvas"))||void 0===i||i.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null},e.prototype.createHull=function(t){if(t.members&&!(t.members.length<1)){var e=this.get("hullGroup"),n=this.get("hullMap");if(n||(n={},this.set("hullMap",n)),e&&!e.get("destroyed")||((e=this.get("group").addGroup({id:"hullGroup"})).toBack(),this.set("hullGroup",e)),n[t.id])return console.warn("Existed hull id."),n[t.id];var r=e.addGroup({id:"".concat(t.id,"-container")}),i=new Un(this,Object(d.__assign)(Object(d.__assign)({},t),{group:r}));return n[i.id]=i,i}console.warn("Create hull failed! The members is empty.")},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var e,n;n=Object(p.isString)(t)?this.getHullById(t):t,null===(e=this.get("hullMap"))||void 0===e||delete e[n.id],n.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();t&&Object.keys(t).length&&(Object.keys(t).forEach((function(e){t[e].destroy()})),this.set("hullMap",{}))},e}(m.a);function Xn(t){return(Xn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Yn=b.a.transform,Hn=["startArrow","endArrow"],qn={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},Kn={edge:{lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},node:qn,combo:qn},Zn={options:{labelCfg:{style:{fontFamily:Oe.windowFontFamily}},descriptionCfg:{style:{fontFamily:Oe.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return"move"===e||(null==e?void 0:e.includes("bbox"))?{}:Object(p.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var n=this.drawShape(t,e);if(n.set("className",this.itemType+"-shape"),e.shapeMap[this.itemType+"-shape"]=n,t.label){var r=this.drawLabel(t,e);r.set("className",this.itemType+"-label"),e.shapeMap[this.itemType+"-label"]=r}return n},afterDraw:function(t,e,n){},drawShape:function(t,e){return null},drawLabel:function(t,e){var n=(this.mergeStyle||this.getOptions(t)||{}).labelCfg||{},r=this.getLabelStyle(t,n,e),i=r.rotate;delete r.rotate;var o=e.addShape("text",{attrs:r,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&""!==i){var a=o.getBBox(),s=[1,0,0,0,1,0,0,0,1];if(r.rotateCenter)switch(r.rotateCenter){case"center":s=Yn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]]);break;case"lefttop":s=Yn(s,[["t",-r.x,-r.y],["r",i],["t",r.x,r.y]]);break;case"leftcenter":s=Yn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);break;default:s=Yn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]])}else s=Yn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);o.setMatrix(s)}if(r.background){var u=this.drawLabelBg(t,e,o),c=this.itemType+"-label-bg";u.set("classname",c),e.shapeMap[c]=u,o.toFront()}return o},drawLabelBg:function(t,e,n){var r=this.options.labelCfg,i=Object(p.mix)({},r,t.labelCfg),o=this.getLabelBgStyleByPosition(n,i),a=e.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return e.shapeMap["text-bg-shape"]=a,a},getLabelStyleByPosition:function(t,e,n){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,n){var r=this.getLabelStyleByPosition(t,e,n),i="".concat(this.itemType,"Label"),o=Oe[i]?Oe[i].style:null;return Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},o),r),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,n){this.updateShapeStyle(t,e,n),this.updateLabel(t,e,n)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=e.getKeyShape(),a=Object(p.mix)({},o.attr(),t.style),s=function(t){var e,n=a[t];if(Object(p.isPlainObject)(n)){var s=(null===(r=i.shapeMap)||void 0===r?void 0:r[t])||i.find((function(e){return e.get("name")===t}));null==s||s.attr(n)}else o.attr(((e={})[t]=n,e))};for(var u in a)s(u)},updateLabel:function(t,e,n){var r,i;if(t.label||""===t.label){var o=e.getContainer(),a=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,s=void 0===a?{}:a,u=this.itemType+"-label",c=o.shapeMap[u]||o.find((function(t){return t.get("className")===u})),l=this.itemType+"-label-bg",f=o.shapeMap[l]||o.find((function(t){return t.get("className")===l}));if(c){(!n||"bbox|label"===n||"edge"===this.itemType&&"style"!==n)&&(s=Object(p.deepMix)(s,t.labelCfg));var h=this.getLabelStyleByPosition(t,s,o),g=null===(r=t.labelCfg)||void 0===r?void 0:r.style,v=Object(d.__assign)(Object(d.__assign)({},h),g),y=v.rotate;if(delete v.rotate,isNaN(y)||""===y)1!==(null===(i=c.getMatrix())||void 0===i?void 0:i[4])&&c.resetMatrix(),c.attr(v);else{var m=[1,0,0,0,1,0,0,0,1];m=Yn(m,[["t",-v.x,-v.y],["r",y],["t",v.x,v.y]]),v.matrix=m,c.attr(v)}if(f)if(v.background){var b=this.getLabelBgStyleByPosition(c,s);f.attr(b)}else o.removeChild(f);else v.background&&((f=this.drawLabelBg(t,o,c)).set("classname",l),o.shapeMap[l]=f,c.toFront())}else{var x=this.drawLabel(t,o);x.set("className",u),o.shapeMap[u]=x}}},afterUpdate:function(t,e){},setState:function(t,e,n){var r,i,o,a=n.get("keyShape");if(a&&!a.destroyed){var s=n.getType(),u=Object(p.isBoolean)(e)?t:"".concat(t,":").concat(e),c=this.getStateStyle(u,n),l=n.getStateStyle(u);if(l||c){var f=Object(p.mix)({},l||c),h=n.getContainer(),d={x:1,y:1,cx:1,cy:1,matrix:1};if("combo"===s&&(d.r=1,d.width=1,d.height=1),e){var g=function(t){var e,n=f[t];if(Object(p.isPlainObject)(n)&&!Hn.includes(t)){var r=(null===(o=h.shapeMap)||void 0===o?void 0:o[t])||h.find((function(e){return e.get("name")===t}));null==r||r.attr(n)}else a.attr(((e={})[t]=n,e))};for(var v in f)g(v)}else{var y=We(n.getCurrentStatesStyle()),m=n.getModel(),b=Object(p.mix)({},m.style,We(n.getOriginStyle())),x=a.get("name"),_=a.attr(),w={};Object.keys(_).forEach((function(t){if("img"!==t){var e=_[t];e&&"object"===Xn(e)?w[t]=Object(p.clone)(e):w[t]=e}}));var E={},S=function(t){var e=f[t];if(Object(p.isPlainObject)(e)&&!Hn.includes(t)){var n=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));if(n){var r=We(n.attr());Object(p.each)(e,(function(e,i){if(t===x&&w[i]&&!d[i]){delete w[i];var o=b[t][i]||Kn[s][i];a.attr(i,o)}else if(r[i]||0===r[i]){delete r[i];var u=b[t][i]||Kn[s][i];n.attr(i,u)}})),E[t]=r}}else if(w[t]&&!d[t]){delete w[t];var i=b[t]||(b[x]?b[x][t]:void 0)||Kn[s][t];a.attr(t,i)}};for(var O in f)S(O);for(var v in x?E[x]=w:Object(p.mix)(E,w),y)if(!d[v]){var M=y[v];Object(p.isPlainObject)(M)&&!Hn.includes(v)||(x?(Object(p.mix)(b[x],((i={})[v]=M,i)),delete b[v]):Object(p.mix)(b,((r={})[v]=M,r)),delete y[v])}var k={};Object(p.deepMix)(k,b,E,y);var A=!1,C=function(t){var e,n,r=k[t];if(Object(p.isPlainObject)(r)&&!Hn.includes(t)){var i=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));i&&(("text"===i.get("type")||i.get("labelRelated"))&&(delete r.x,delete r.y,delete r.matrix),t===x&&("combo"===s&&(delete r.r,delete r.width,delete r.height),A=!0),i.attr(r))}else if(!A){var o=r||Kn[s][t];"combo"===s?x||a.attr(((e={})[t]=o,e)):a.attr(((n={})[t]=o,n))}};for(var T in k)C(T)}}}},getStateStyle:function(t,e){var n=e.getModel(),r=e.getType(),i=this.getOptions(n),o=i.stateStyles,a=i.style,s=void 0===a?{}:a,u=n.stateStyles?n.stateStyles[t]:o&&o[t];return"combo"===r?Object(p.clone)(u):Object(p.mix)({},s,u)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,n;return(null==t?void 0:t.anchorPoints)||(null===(e=this.getCustomConfig(t))||void 0===e?void 0:e.anchorPoints)||(null===(n=this.options)||void 0===n?void 0:n.anchorPoints)}},Qn={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:Oe.nodeLabel.offset,getSize:function(t){var e,n=(null===(e=this.mergeStyle)||void 0===e?void 0:e.size)||t.size||this.getOptions({}).size||Oe.defaultNode.size;return Object(p.isArray)(n)&&1===n.length&&(n=[n[0],n[0]]),Object(p.isArray)(n)||(n=[n,n]),n},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition;if("center"===n)return{x:0,y:0,text:t.label};var r=e.offset;Object(p.isNil)(r)&&(r=this.offset);var i,o=this.getSize(t);switch(n){case"top":i={x:0,y:-o[1]/2-r,textBaseline:"bottom"};break;case"bottom":i={x:0,y:o[1]/2+r,textBaseline:"top"};break;case"left":i={x:-o[0]/2-r,y:0,textAlign:"right"};break;default:i={x:o[0]/2+r,y:0,textAlign:"left"}}return i.text=t.label,i},getLabelBgStyleByPosition:function(t,e){var n;if(!t)return{};var r=null===(n=e.style)||void 0===n?void 0:n.background;if(!r)return{};var i=t.getBBox(),o=Ke(r.padding),a=i.width+o[1]+o[3],s=i.height+o[0]+o[2];return Object(d.__assign)(Object(d.__assign)({x:i.minX-o[3],y:i.minY-o[0]},r),{width:a,height:s})},drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t),i=e.addShape(n,{attrs:r,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=i,i},updateLinkPoints:function(t,e){var n,r=(this.mergeStyle||this.getOptions(t)).linkPoints,i=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),o=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),a=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),s=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")}));i&&(n=i.attr()),o&&!n&&(n=o.attr()),a&&!n&&(n=a.attr()),s&&!n&&(n=s.attr()),n||(n=r);var u=Object(p.mix)({},n,t.linkPoints),c=u.fill,l=u.stroke,f=u.lineWidth,h=u.size/2;h||(h=u.r);var g=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},v=g.left,y=g.right,m=g.top,b=g.bottom,x=this.getSize(t),_=x[0],w=x[1],E={r:h,fill:c,stroke:l,lineWidth:f};if(i)v||void 0===v?i.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:-_/2,y:0})):(i.remove(),delete e.shapeMap["link-point-left"]);else if(v){var S="link-point-left";e.shapeMap[S]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:-_/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(o)y||void 0===y||(o.remove(),delete e.shapeMap["link-point-right"]),o.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:_/2,y:0}));else if(y){var O="link-point-right";e.shapeMap[O]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:_/2,y:0}),className:O,name:O,isAnchorPoint:!0})}if(a)m||void 0===m||(a.remove(),delete e.shapeMap["link-point-top"]),a.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:-w/2}));else if(m){var M="link-point-top";e.shapeMap[M]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:-w/2}),className:M,name:M,isAnchorPoint:!0})}if(s)b||void 0===b?s.attr(Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:w/2})):(s.remove(),delete e.shapeMap["link-point-bottom"]);else if(b){var k="link-point-bottom";e.shapeMap[k]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},E),{x:0,y:w/2}),className:k,name:k,isAnchorPoint:!0})}},updateShape:function(t,e,n,r,i){e.get("keyShape").attr(Object(d.__assign)({},n)),this.updateLabel(t,e,i),r&&this.updateIcon(t,e)},updateIcon:function(t,e){var n=this,r=e.getContainer(),i=(this.mergeStyle||this.getOptions(t)).icon,o=t.icon?t.icon:{show:void 0,text:void 0},a=o.show,s=o.text,u=r.shapeMap["".concat(this.type,"-icon")]||r.find((function(t){return t.get("name")==="".concat(n.type,"-icon")}));if(u)if(a||void 0===a){var c=Object(p.mix)({},u.attr(),i),l=c.width,f=void 0===l?20:l,h=c.height,g=void 0===h?20:h;("iconfont"===c.fontFamily||c.hasOwnProperty("text"))&&(f=0,g=0),u.attr(Object(d.__assign)(Object(d.__assign)({},c),{x:-f/2,y:-g/2}))}else u.remove();else if(a){var v="".concat(this.type,"-icon");if(s)r.shapeMap[v]=r.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:v,name:v});else{f=i.width,g=i.height;r.shapeMap[v]=r.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},i),{x:-f/2,y:-g/2}),className:v,name:v})}var y=r.shapeMap["node-label"]||r.find((function(t){return"node-label"===t.get("name")}));y&&y.toFront()}}},$n=Object(d.__assign)(Object(d.__assign)({},Zn),Qn);hn.registerNode("single-node",$n);var Jn={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:Oe.defaultEdge.size,style:{x:0,y:0,stroke:Oe.defaultEdge.style.stroke,lineAppendWidth:Oe.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Oe.edgeLabel.style.fill,fontSize:Oe.edgeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.edgeStateStyles)},getPath:function(t){var e=[];return Object(p.each)(t,(function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(p.mix)({},e,n,t.style),i=t.size||Oe.defaultEdge.size,o=(t=this.getPathPoints(t)).startPoint,a=t.endPoint,s=this.getControlPoints(t),u=[o];s&&(u=u.concat(s)),u.push(a);var c=this.getPath(u);return Object(p.mix)({},Oe.defaultEdge.style,{stroke:Oe.defaultEdge.color,lineWidth:i,path:c},r)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=(null===(r=e.getKeyShape)||void 0===r?void 0:r.call(e))||i.shapeMap["edge-shape"],a=t.size,s=(t=this.getPathPoints(t)).startPoint,u=t.endPoint,c=this.getControlPoints(t),l=[s];c&&(l=l.concat(c)),l.push(u);var f=o.attr(),h=t.style||{};void 0===h.stroke&&(h.stroke=t.color);var g=t.sourceNode,v=t.targetNode,y={radius:h.radius};c||(y={source:g,target:v,offset:h.offset,radius:h.radius});var m=this.getPath(l,y),b={};"move"===n?b={path:m}:(f.endArrow&&!1===h.endArrow&&(t.style.endArrow={path:""}),f.startArrow&&!1===h.startArrow&&(t.style.startArrow={path:""}),void 0===(b=Object(d.__assign)({},t.style)).lineWidth&&(b.lineWdith=(Object(p.isNumber)(a)?a:null==a?void 0:a[0])||f.lineWidth),void 0===b.path&&(b.path=m),void 0===b.stroke&&(b.stroke=f.stroke||t.color)),o&&o.attr(b)},getLabelStyleByPosition:function(t,e,n){var r,i=e.position||this.labelPosition,o={},a=null==n?void 0:n.shapeMap["edge-shape"];r="start"===i?0:"end"===i?1:.5;var s,u=e.refX||this.refX,c=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return o.x=t.startPoint.x+u,o.y=t.startPoint.y+c,o.text=t.label,o;s=Object(p.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate;var l=Ne(a,r,u,c,s);return o.x=l.x,o.y=l.y,o.rotate=l.rotate,o.textAlign=this._getTextAlign(i,l.angle),o.text=t.label,o},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var n=t.getBBox(),r=e.style&&e.style.background;if(!r)return{};var i=r.padding,o=n.width+i[1]+i[3],a=n.height+i[0]+i[2],s=Object(d.__assign)(Object(d.__assign)({},r),{width:o,height:a,x:n.minX-i[3],y:n.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]});return(Object(p.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate)&&(s.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),s},_getTextAlign:function(t,e){var n="center";return e?(e%=2*Math.PI,"center"!==t&&(n=e>=0&&e<=Math.PI/2||e>=1.5*Math.PI&&e<2*Math.PI?t:function(t){var e=t;return"start"===t?e="end":"end"===t&&(e="start"),e}(t)),n):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},drawLabel:function(t,e){var n=this.options.labelCfg,r=Object(p.deepMix)({},n,t.labelCfg),i=this.getLabelStyle(t,r,e),o=i.rotate;delete i.rotate;var a=e.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=a,isNaN(o)||""===o||a.rotateAtStart(o),i.background){var s=this.drawLabelBg(t,e,a,i,o),u=this.itemType+"-label-bg";s.set("classname",u),e.shapeMap[u]=s,a.toFront()}return a},drawLabelBg:function(t,e,n,r,i){var o=this.options.labelCfg,a=Object(p.deepMix)({},o,t.labelCfg),s=this.getLabelBgStyleByPosition(n,a),u=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=u,u}},tr=Object(d.__assign)(Object(d.__assign)({},Zn),Jn);hn.registerEdge("single-edge",tr),hn.registerEdge("line",{getControlPoints:function(){}},"single-edge"),hn.registerEdge("spline",{getPath:function(t){return En(t)}},"single-edge"),hn.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e,n,r=t.startPoint,i=t.endPoint,o=(r.x+i.x)/2,a=(r.y+i.y)/2;if(void 0!==t.controlPoints){if(n=t.controlPoints[0],e=Wt(r,n,i),r.x<=i.x&&r.y>i.y?this.clockwise=e.x>n.x?0:1:r.x<=i.x&&r.y<i.y?this.clockwise=e.x>n.x?1:0:r.x>i.x&&r.y<=i.y?this.clockwise=e.y<n.y?0:1:this.clockwise=e.y<n.y?1:0,(n.x-r.x)/(n.y-r.y)==(i.x-r.x)/(i.y-r.y))return[]}else{void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),Object(p.isArray)(t.curveOffset)&&(t.curveOffset=t.curveOffset[0]),t.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:i.x-r.x,y:i.y-r.y},u=Math.atan2(s.y,s.x);n={x:t.curveOffset*Math.cos(-Math.PI/2+u)+o,y:t.curveOffset*Math.sin(-Math.PI/2+u)+a},e=Wt(r,n,i)}var c=Xt(r,e);return[{x:c,y:c}]},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),2===t.length?e.push(["L",t[1].x,t[1].y]):e.push(["A",t[1].x,t[1].y,0,0,this.clockwise,t[2].x,t[2].y]),e}},"single-edge"),hn.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(t){var e=t.controlPoints;if(!e||!e.length){var n=t.startPoint,r=t.endPoint;void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),Object(p.isArray)(this.curveOffset)&&(t.curveOffset=t.curveOffset[0]),Object(p.isArray)(this.curvePosition)&&(t.curvePosition=t.curveOffset[0]),e=[Sn(n,r,t.curvePosition,t.curveOffset)]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["Q",t[1].x,t[1].y,t[2].x,t[2].y]),e}},"single-edge"),hn.registerEdge("cubic",{curvePosition:[.5,.5],curveOffset:[-20,20],getControlPoints:function(t){var e=t.controlPoints;if(void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]),!e||!e.length||e.length<2){var n=t.startPoint,r=t.endPoint;e=[Sn(n,r,t.curvePosition[0],t.curveOffset[0]),Sn(n,r,t.curvePosition[1],t.curveOffset[1])]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["C",t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y]),e}},"single-edge"),hn.registerEdge("cubic-vertical",{curvePosition:[.5,.5],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.minCurveOffset&&(t.minCurveOffset=this.minCurveOffset),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var r=n.y-e.y,i=[0,0];return t.curveOffset?i=t.curveOffset:Math.abs(r)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset),[{x:e.x,y:e.y+r*this.curvePosition[0]+i[0]},{x:n.x,y:n.y-r*this.curvePosition[1]+i[1]}]}},"cubic"),hn.registerEdge("cubic-horizontal",{curvePosition:[.5,.5],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;void 0===t.curvePosition&&(t.curvePosition=this.curvePosition),void 0===t.curveOffset&&(t.curveOffset=this.curveOffset),void 0===t.minCurveOffset&&(t.minCurveOffset=this.minCurveOffset),Object(p.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),Object(p.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),Object(p.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var r=n.x-e.x,i=[0,0];return t.curveOffset?i=t.curveOffset:Math.abs(r)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset),[{x:e.x+r*this.curvePosition[0]+i[0],y:e.y},{x:n.x-r*this.curvePosition[1]+i[1],y:n.y}]}},"cubic"),hn.registerEdge("loop",{getPathPoints:function(t){return Pe(t)},getControlPoints:function(t){return t.controlPoints},afterDraw:function(t){t.controlPoints=void 0},afterUpdate:function(t){t.controlPoints=void 0}},"cubic");var er={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:Oe.comboLabel.refX,refY:Oe.comboLabel.refY,options:{style:{stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},getSize:function(t){var e=Object(p.clone)(t.size||this.options.size||Oe.defaultCombo.size);return Object(p.isArray)(e)&&1===e.length&&(e=[e[0],e[0]]),Object(p.isArray)(e)||(e=[e,e]),e},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,r=t.style,i=t.padding||this.options.padding;Object(p.isArray)(i)&&(i=i[0]);var o=e.refX,a=e.refY;Object(p.isNil)(o)&&(o=this.refX),Object(p.isNil)(a)&&(a=this.refY);var s,u=this.getSize(t),c=(Math.max(r.r,u[0]/2)||u[0]/2)+i;switch(n){case"top":s={x:0,y:-c-a,textBaseline:"bottom",textAlign:"center"};break;case"bottom":s={x:0,y:c+a,textBaseline:"bottom",textAlign:"center"};break;case"left":s={x:-c+o,y:0,textAlign:"left"};break;case"center":s={x:0,y:0,text:t.label,textAlign:"center"};break;default:s={x:c+o,y:0,textAlign:"right"}}return s.text=t.label,s},drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t);return e.addShape(n,{attrs:r,draggable:!0,name:"combo-shape"})},updateShape:function(t,e,n){var r=e.get("keyShape");(void 0===t.animate?this.options.animate:t.animate)&&r.animate?r.animate(n,{duration:200,easing:"easeLinear"}):r.attr(Object(d.__assign)({},n)),this.updateLabel(t,e)}},nr=Object(d.__assign)(Object(d.__assign)({},Zn),er);hn.registerCombo("single-combo",nr),hn.registerCombo("circle",{options:{size:[Oe.defaultCombo.size[0],Oe.defaultCombo.size[0]],padding:Oe.defaultCombo.padding[0],animate:!0,style:{stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},shapeType:"circle",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t);return delete n.height,delete n.width,e.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0})},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;Object(p.isArray)(n)&&(n=n[0]);var r,i={stroke:t.color},o=Object(p.mix)({},e,i,t.style);if(t.fixSize)r=Object(p.isNumber)(t.fixSize)?t.fixSize:t.fixSize[0];else{var a=this.getSize(t);r=!Object(p.isNumber)(o.r)||isNaN(o.r)?a[0]/2||Oe.defaultCombo.style.r:Math.max(o.r,a[0]/2)||a[0]/2}o.r=r+n;var s=Object(d.__assign)({x:0,y:0},o);return t.style?t.style.r=r:t.style={r:r},s},update:function(t,e){var n=this.getSize(t),r=t.padding||this.options.padding;Object(p.isArray)(r)&&(r=r[0]);var i,o=Object(p.clone)(t.style);i=t.fixSize?Object(p.isNumber)(t.fixSize)?t.fixSize:t.fixSize[0]:Math.max(o.r,n[0]/2)||n[0]/2,o.r=i+r;var a=e.get("sizeCache");a&&(a.r=o.r);var s={stroke:t.color},u=e.get("keyShape"),c=Object(p.mix)({},u.attr(),s,o);t.style?t.style.r=i:t.style={r:i},this.updateShape(t,e,c,!0)}},"single-combo"),hn.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:Oe.defaultCombo.style.stroke,fill:Oe.defaultCombo.style.fill,lineWidth:Oe.defaultCombo.style.lineWidth},labelCfg:{style:{fill:Oe.comboLabel.style.fill,fontSize:Oe.comboLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},Oe.comboStateStyles)},shapeType:"rect",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t);return e.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0})},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,r=t.style,i=t.padding||this.options.padding;Object(p.isNumber)(i)&&(i=[i,i,i,i]);var o=e.refX,a=e.refY;Object(p.isNil)(o)&&(o=this.refX),Object(p.isNil)(a)&&(a=this.refY);var s,u=r.width/2+i[3],c=r.height/2+i[0];switch(n){case"top":s={x:0-u+o,y:0-c+a,textBaseline:"top",textAlign:"left"};break;case"bottom":s={x:0,y:c+a,textBaseline:"bottom",textAlign:"center"};break;case"left":s={x:0-u+a,y:0,textAlign:"left"};break;case"center":s={x:0,y:0,text:t.label,textAlign:"center"};break;default:s={x:u+o,y:0,textAlign:"right"}}return s.text=t.label,s},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;Object(p.isNumber)(n)&&(n=[n,n,n,n]);var r,i,o={stroke:t.color},a=Object(p.mix)({},e,o,t.style),s=this.getSize(t),u=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;u?Object(p.isNumber)(u)?(r=u,i=u):(r=u[0],i=u[1]):(r=!Object(p.isNumber)(a.width)||isNaN(a.width)?s[0]||Oe.defaultCombo.style.width:Math.max(a.width,s[0])||s[0],i=!Object(p.isNumber)(a.height)||isNaN(a.height)?s[1]||Oe.defaultCombo.style.height:Math.max(a.height,s[1])||s[1]);var c=-r/2-n[3],l=-i/2-n[0];a.width=r+n[1]+n[3],a.height=i+n[0]+n[2];var f=Object(d.__assign)({x:c,y:l},a);return t.style?(t.style.width=r,t.style.height=i):t.style={width:r,height:i},f},update:function(t,e){var n=this.getSize(t),r=t.padding||this.options.padding;Object(p.isNumber)(r)&&(r=[r,r,r,r]);var i,o,a=Object(p.clone)(t.style),s=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;s?Object(p.isNumber)(s)?(i=s,o=s):(i=s[0],o=s[1]):(i=Math.max(a.width,n[0])||n[0],o=Math.max(a.height,n[1])||n[1]),a.width=i+r[1]+r[3],a.height=o+r[0]+r[2];var u=e.get("sizeCache");u&&(u.width=a.width,u.height=a.height),a.x=-i/2-r[3],a.y=-o/2-r[0];var c={stroke:t.color},l=e.get("keyShape"),f=Object(p.mix)({},l.attr(),c,a);t.style?(t.style.width=i,t.style.height=o):t.style={width:i,height:o},this.updateShape(t,e,f,!1)},updateShape:function(t,e,n){var r=e.get("keyShape");(void 0===t.animate?this.options.animate:t.animate)&&r.animate?r.animate(n,{duration:200,easing:"easeLinear"}):r.attr(Object(d.__assign)({},n)),this.updateLabel(t,e)}},"single-combo"),hn.registerNode("simple-circle",{options:{size:Oe.defaultNode.size,style:{x:0,y:0,stroke:Oe.defaultNode.style.stroke,fill:Oe.defaultNode.style.fill,lineWidth:Oe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Oe.nodeLabel.style.fill,fontSize:Oe.nodeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},stateStyles:Object(d.__assign)({},Oe.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(t,e){var n=this.getShapeStyle(t),r="".concat(this.type,"-keyShape"),i=e.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:r,draggable:!0});return e.shapeMap[r]=i,i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.deepMix)({},e,n),i=this.getSize(t)[0]/2;return Object(d.__assign)({x:0,y:0,r:i},r)},update:function(t,e,n){var r=this.getSize(t),i={stroke:t.color,r:r[0]/2},o=e.get("keyShape"),a=Object(p.deepMix)({},o.attr(),i,t.style);this.updateShape(t,e,a,!0,n)}},"single-node"),hn.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:Oe.defaultNode.style.stroke,fill:Oe.defaultNode.style.fill,lineWidth:Oe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Oe.nodeLabel.style.fill,fontSize:Oe.nodeLabel.style.fontSize,fontFamily:Oe.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},Oe.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);return e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0})},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e,n){e.getContainer();var r=(this.mergeStyle||this.getOptions(t)).style,i=this.getSize(t),o=e.get("keyShape");t.size||(i[0]=o.attr("width")||r.width,i[1]=o.attr("height")||r.height);var a={stroke:t.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},s=Object(p.mix)({},r,o.attr(),a);s=Object(p.mix)(s,t.style),this.updateShape(t,e,s,!1,n)}},"single-node"),hn.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:Oe.windowFontFamily}},clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t);delete r.fill;var i=e.addShape(n,{attrs:r,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(t,i),i},drawClip:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).clipCfg;if(n.show){var r=n.type,i=n.x,o=n.y,a=n.style;if("circle"===r){var s=n.r;e.setClip({type:"circle",attrs:Object(d.__assign)({r:s,x:i,y:o},a)})}else if("rect"===r){var u=n.width,c=n.height,l=i-u/2,f=o-c/2;e.setClip({type:"rect",attrs:Object(d.__assign)({x:l,y:f,width:u,height:c},a)})}else if("ellipse"===r){var h=n.rx,p=n.ry;e.setClip({type:"ellipse",attrs:Object(d.__assign)({x:i,y:o,rx:h,ry:p},a)})}else if("polygon"===r){var g=n.points;e.setClip({type:"polygon",attrs:Object(d.__assign)({points:g},a)})}else if("path"===r){var v=n.path;e.setClip({type:"path",attrs:Object(d.__assign)({path:v},a)})}}},getShapeStyle:function(t){var e=this.mergeStyle||this.getOptions(t),n=e.style,r=e.img,i=this.getSize(t),o=i[0],a=i[1];return n&&(o=n.width||i[0],a=n.height||i[1]),Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a,img:r},n)},updateShapeStyle:function(t,e){var n=e.getContainer(),r="".concat(this.itemType,"-shape"),i=n.shapeMap[r]||n.find((function(t){return t.get("className")===r}))||e.getKeyShape(),o=this.getShapeStyle(t);i&&!i.destroyed&&i.attr(o)}},"single-node");var rr,ir={triangle:function(t,e,n){void 0===t&&(t=10),void 0===e&&(e=15),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 L ").concat(r+e,",-").concat(t/2," L ").concat(r+e,",").concat(t/2," Z")},vee:function(t,e,n){void 0===t&&(t=15),void 0===e&&(e=20),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 L ").concat(r+e,",-").concat(t/2,"\n L ").concat(r+2*e/3,",0 L ").concat(r+e,",").concat(t/2," Z")},circle:function(t,e){return void 0===t&&(t=5),void 0===e&&(e=0),"M ".concat(2*e,", 0\n a ").concat(t,",").concat(t," 0 1,0 ").concat(2*t,",0\n a ").concat(t,",").concat(t," 0 1,0 ").concat(2*-t,",0")},rect:function(t,e,n){void 0===t&&(t=10),void 0===e&&(e=10),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",").concat(-t/2," \n L ").concat(r+e,",").concat(-t/2," \n L ").concat(r+e,",").concat(t/2," \n L ").concat(r,",").concat(t/2," Z")},diamond:function(t,e,n){void 0===t&&(t=15),void 0===e&&(e=15),void 0===n&&(n=0);var r=2*n;return"M ".concat(r,",0 \n L ").concat(r+e/2,",").concat(-t/2," \n L ").concat(r+e,",0 \n L ").concat(r+e/2,",").concat(t/2," Z")},triangleRect:function(t,e,n,r,i,o){void 0===t&&(t=15),void 0===e&&(e=15),void 0===n&&(n=15),void 0===r&&(r=3),void 0===i&&(i=5),void 0===o&&(o=0);var a=2*o,s=a+e+i;return"M ".concat(a,",0 L ").concat(a+e,",-").concat(t/2," L ").concat(a+e,",").concat(t/2," Z\n M ").concat(s,", -").concat(n/2,"\n L ").concat(s+r," -").concat(n/2,"\n L ").concat(s+r," ").concat(n/2,"\n L ").concat(s," ").concat(n/2,"\n Z")}},or={collapse:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0],["M",t-n+4,e],["L",t+n-4,e]]},expand:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0],["M",t-n+4,e],["L",t-n+2*n-4,e],["M",t-n+n,e-n+4],["L",t,e+n-4]]},upTriangle:function(t,e,n){var r=n*Math.cos(Math.PI/6),i=n*Math.sin(Math.PI/6);return[["M",t-r,e+i],["L",t+r,e+i],["L",t,e-n],["Z"]]},downTriangle:function(t,e,n){var r=n*Math.cos(Math.PI/6),i=n*Math.sin(Math.PI/6);return[["M",t-r,e-i],["L",t+r,e-i],["L",t,e+n],["Z"]]}},ar=hn,sr=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"],ur=b.a.transform,cr=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},a),o),s),i),u),{transform:ur,mat3:b.b}),lr=function(){function t(t){this.graph=t,this.layoutCfg=t.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return t.prototype.initLayout=function(){},t.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},t.prototype.getLayoutCfgType=function(t){var e=t.type;if(e)return e;var n=t.pipes;return Array.isArray(n)?n.map((function(t){return(null==t?void 0:t.type)||""})):null},t.prototype.isLayoutTypeSame=function(t){var e=this.getLayoutCfgType(t);return Array.isArray(this.layoutType)?this.layoutType.every((function(t,n){return t===e[n]})):(null==t?void 0:t.type)===this.layoutType},t.prototype.refreshLayout=function(){var t=this.graph,e=this.layoutType;this.data;t&&(t.get("animate")?t.positionsAnimate("comboCombined"===e):t.refreshPositions("comboCombined"===e))},t.prototype.changeLayout=function(t){this.layoutCfg=t,this.destoryLayoutMethods(),this.layout()},t.prototype.changeData=function(){this.destoryLayoutMethods(),this.layout()},t.prototype.destoryLayoutMethods=function(){var t=this.layoutMethods;null==t||t.forEach((function(t){t.destroy()})),this.layoutMethods=[]},t.prototype.destroyLayout=function(){var t=this.graph;this.destoryLayoutMethods(),t.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},t.prototype.setDataFromGraph=function(){for(var t=[],e=[],n=[],r=[],i=[],o=[],a=this.graph.getNodes(),s=this.graph.getEdges(),u=this.graph.getCombos(),c=a.length,l=0;l<c;l++){var f=a[l];if(f&&!f.destroyed){var h=f.getModel();f.isVisible()?t.push(h):e.push(h)}}var d=s.length;for(l=0;l<d;l++){var p=s[l];if(p&&!p.destroyed){h=p.getModel();p.isVisible()?h.isComboEdge?i.push(h):n.push(h):r.push(h)}}var g=u.length;for(l=0;l<g;l++){var v=u[l];if(!v.destroyed){h=v.getModel();v.isVisible()?o.push(h):r.push(h)}}return{nodes:t,hiddenNodes:e,edges:n,hiddenEdges:r,combos:o,hiddenCombos:[],comboEdges:i}},t.prototype.reLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){var o=n.graph,a=null==e?void 0:e.type;e.onLayoutEnd=function(){o.emit("aftersublayout",{type:a}),r()},t.init(n.data),"force"===a&&(t.ticking=!1,t.forceSimulation.stop()),o.emit("beforesublayout",{type:a}),t.execute(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd()}))},t.prototype.relayout=function(t){var e=this,n=this.graph,r=this.layoutMethods,i=this.layoutCfg;if(t){this.data=this.setDataFromGraph();var o=this.data.nodes;if(!o)return!1;this.initPositions(i.center,o)}n.emit("beforelayout");var a=Promise.resolve();null==r||r.forEach((function(t,n){var r=i[n];a=a.then((function(){return e.reLayoutMethod(t,r)}))})),(null==r?void 0:r.length)&&a.then((function(){i.onAllLayoutEnd&&i.onAllLayoutEnd()})).catch((function(t){console.warn("relayout failed",t)}))},t.prototype.filterLayoutData=function(t,e){var n,r,i=t.nodes,o=t.edges,a=Object(d.__rest)(t,["nodes","edges"]);if(!i)return t;n=Object(p.isFunction)(null==e?void 0:e.nodesFilter)?e.nodesFilter:function(){return!0};var s=i.filter(n);if(Object(p.isFunction)(null==e?void 0:e.edgesFilter))r=e.edgesFilter;else{var u=s.reduce((function(t,e){return t[e.id]=!0,t}),{});r=function(t){return u[t.source]&&u[t.target]}}return Object(d.__assign)({nodes:s,edges:o.filter(r)},a)},t.prototype.getLayoutBBox=function(t){var e=this.graph,n=Object(p.groupBy)(e.getNodes(),(function(t){return t.getModel().layoutOrder})),r=Object.values(n).map((function(t){var e=Je(t);return e.size=[e.width,e.height],e}));return{groupNodes:Object.values(Object(p.groupBy)(t,"layoutOrder")),layoutNodes:r}},t.prototype.layoutAnimate=function(){},t.prototype.moveToZero=function(){var t=this.graph.get("data").nodes;if(void 0!==t[0].x&&null!==t[0].x&&!$e(t[0].x)){for(var e=[0,0],n=t.length,r=0;r<n;r++){var i=t[r];e[0]+=i.x,e[1]+=i.y}e[0]/=t.length,e[1]/=t.length;for(r=0;r<n;r++){(i=t[r]).x-=e[0],i.y-=e[1]}}},t.prototype.initPositions=function(t,e){var n=this.graph;if(!e)return!1;var r=e?e.length:0;if(r){var i=.85*n.get("width"),o=.85*n.get("height"),a=Math.ceil(Math.sqrt(r)*(i/o)),s=i/(a-1),u=o/(Math.ceil(r/a)-1);isFinite(s)&&s||(s=0),isFinite(u)&&s||(u=0);for(var c=t[0]-i/2,l=t[1]-o/2,f=!0,h=0;h<r;h++){var d=e[h];$e(+d.x)&&(f=!1,d.x=h%a*s+c),$e(+d.y)&&(f=!1,d.y=Math.floor(h/a)*u+l)}return f}},t.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},t}(),fr=function(t){this.graph=t,this.destroyed=!1,this.initEvents()};!function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.MOUSEDOWN="mousedown",t.MOUDEUP="mouseup",t.CONTEXTMENU="contextmenu",t.MOUSEENTER="mouseenter",t.MOUSEOUT="mouseout",t.MOUSEOVER="mouseover",t.MOUSEMOVE="mousemove",t.MOUSELEAVE="mouseleave",t.DRAGSTART="dragstart",t.DRAGEND="dragend",t.DRAG="drag",t.DRAGENTER="dragenter",t.DRAGLEAVE="dragleave",t.DRAGOVER="dragover",t.DRAGOUT="dragout",t.DDROP="drop",t.KEYUP="keyup",t.KEYDOWN="keydown",t.WHEEL="wheel",t.FOCUS="focus",t.BLUR="blur",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.CANVAS_TOUCHSTART="canvas:touchstart",t.CANVAS_TOUCHMOVE="canvas:touchmove",t.CANVAS_TOUCHEND="canvas:touchend",t.NODE_TOUCHSTART="node:touchstart",t.NODE_TOUCHMOVE="node:touchmove",t.NODE_TOUCHEND="node:touchend",t.COMBO_TOUCHSTART="combo:touchstart",t.COMBO_TOUCHMOVE="combo:touchmove",t.COMBO_TOUCHEND="combo:touchend",t.EDGE_TOUCHSTART="edge:touchstart",t.EDGE_TOUCHMOVE="edge:touchmove",t.EDGE_TOUCHEND="edge:touchend",t.NODE_CONTEXTMENU="node:contextmenu",t.NODE_CLICK="node:click",t.NODE_DBLCLICK="node:dblclick",t.NODE_MOUSEDOWN="node:mousedown",t.NODE_MOUSEUP="node:mouseup",t.NODE_MOUSEENTER="node:mouseenter",t.NODE_MOUSELEAVE="node:mouseleave",t.NODE_MOUSEMOVE="node:mousemove",t.NODE_MOUSEOUT="node:mouseout",t.NODE_MOUSEOVER="node:mouseover",t.NODE_DROP="node:drop",t.NODE_DRAGOVER="node:dragover",t.NODE_DRAGENTER="node:dragenter",t.NODE_DRAGLEAVE="node:dragleave",t.NODE_DRAGSTART="node:dragstart",t.NODE_DRAG="node:drag",t.NODE_DRAGEND="node:dragend",t.NODE_TAP="node:tap",t.NODE_PANSTART="node:panstart",t.NODE_PANMOVE="node:panmove",t.NODE_PANEND="node:panend",t.COMBO_CONTEXTMENU="combo:contextmenu",t.COMBO_CLICK="combo:click",t.COMBO_DBLCLICK="combo:dblclick",t.COMBO_MOUSEDOWN="combo:mousedown",t.COMBO_MOUSEUP="combo:mouseup",t.COMBO_MOUSEENTER="combo:mouseenter",t.COMBO_MOUSELEAVE="combo:mouseleave",t.COMBO_MOUSEMOVE="combo:mousemove",t.COMBO_MOUSEOUT="combo:mouseout",t.COMBO_MOUSEOVER="combo:mouseover",t.COMBO_DROP="combo:drop",t.COMBO_DRAGOVER="combo:dragover",t.COMBO_DRAGENTER="combo:dragenter",t.COMBO_DRAGLEAVE="combo:dragleave",t.COMBO_DRAGSTART="combo:dragstart",t.COMBO_DRAG="combo:drag",t.COMBO_DRAGEND="combo:dragend",t.COMBO_TAP="combo:tap",t.COMBO_PANSTART="combo:panstart",t.COMBO_PANMOVE="combo:panmove",t.COMBO_PANEND="combo:panend",t.EDGE_CONTEXTMENU="edge:contextmenu",t.EDGE_CLICK="edge:click",t.EDGE_DBLCLICK="edge:dblclick",t.EDGE_MOUSEDOWN="edge:mousedown",t.EDGE_MOUSEUP="edge:mouseup",t.EDGE_MOUSEENTER="edge:mouseenter",t.EDGE_MOUSELEAVE="edge:mouseleave",t.EDGE_MOUSEMOVE="edge:mousemove",t.EDGE_MOUSEOUT="edge:mouseout",t.EDGE_MOUSEOVER="edge:mouseover",t.EDGE_DROP="edge:drop",t.EDGE_DRAGOVER="edge:dragover",t.EDGE_DRAGENTER="edge:dragenter",t.EDGE_DRAGLEAVE="edge:dragleave",t.CANVAS_CONTEXTMENU="canvas:contextmenu",t.CANVAS_CLICK="canvas:click",t.CANVAS_DBLCLICK="canvas:dblclick",t.CANVAS_MOUSEDOWN="canvas:mousedown",t.CANVAS_MOUSEUP="canvas:mouseup",t.CANVAS_MOUSEENTER="canvas:mouseenter",t.CANVAS_MOUSELEAVE="canvas:mouseleave",t.CANVAS_MOUSEMOVE="canvas:mousemove",t.CANVAS_MOUSEOUT="canvas:mouseout",t.CANVAS_MOUSEOVER="canvas:mouseover",t.CANVAS_DROP="canvas:drop",t.CANVAS_DRAGENTER="canvas:dragenter",t.CANVAS_DRAGLEAVE="canvas:dragleave",t.CANVAS_DRAGSTART="canvas:dragstart",t.CANVAS_DRAG="canvas:drag",t.CANVAS_DRAGEND="canvas:dragend",t.CANVAS_TAP="canvas:tap",t.CANVAS_PANSTART="canvas:panstart",t.CANVAS_PANMOVE="canvas:panmove",t.CANVAS_PANEND="canvas:panend",t.BEFORERENDER="beforerender",t.AFTERRENDER="afterrender",t.BEFOREADDITEM="beforeadditem",t.AFTERADDITEM="afteradditem",t.BEFOREREMOVEITEM="beforeremoveitem",t.AFTERREMOVEITEM="afterremoveitem",t.BEFOREUPDATEITEM="beforeupdateitem",t.AFTERUPDATEITEM="afterupdateitem",t.BEFOREITEMVISIBILITYCHANGE="beforeitemvisibilitychange",t.AFTERITEMVISIBILITYCHANGE="afteritemvisibilitychange",t.BEFOREITEMSTATECHANGE="beforeitemstatechange",t.AFTERITEMSTATECHANGE="afteritemstatechange",t.BEFOREITEMREFRESH="beforeitemrefresh",t.AFTERITEMREFRESH="afteritemrefresh",t.BEFOREITEMSTATESCLEAR="beforeitemstatesclear",t.AFTERITEMSTATESCLEAR="afteritemstatesclear",t.BEFOREMODECHANGE="beforemodechange",t.AFTERMODECHANGE="aftermodechange",t.BEFORELAYOUT="beforelayout",t.AFTERLAYOUT="afterlayout",t.BEFORECREATEEDGE="beforecreateedge",t.AFTERCREATEEDGE="aftercreateedge",t.BEFOREGRAPHREFRESHPOSITION="beforegraphrefreshposition",t.AFTERGRAPHREFRESHPOSITION="aftergraphrefreshposition",t.BEFOREGRAPHREFRESH="beforegraphrefresh",t.AFTERGRAPHREFRESH="aftergraphrefresh",t.BEFOREANIMATE="beforeanimate",t.AFTERANIMATE="afteranimate",t.BEFOREPAINT="beforepaint",t.AFTERPAINT="afterpaint",t.BEFORECOLLAPSEEXPANDCOMBO="beforecollapseexpandcombo",t.AFTERCOLLAPSEEXPANDCOMBO="aftercollapseexpandcombo",t.GRAPHSTATECHANGE="graphstatechange",t.AFTERACTIVATERELATIONS="afteractivaterelations",t.NODESELECTCHANGE="nodeselectchange",t.TOOLTIPCHANGE="tooltipchange",t.WHEELZOOM="wheelzoom",t.VIEWPORTCHANGE="viewportchange",t.DRAGNODEEND="dragnodeend",t.STACKCHANGE="stackchange",t.TAP="tap",t.PINCHSTART="pinchstart",t.PINCHMOVE="pinchmove",t.PANSTART="panstart",t.PANMOVE="panmove",t.PANEND="panend"}(rr||(rr={}));var hr=ar.registerNode,dr=ar.registerEdge,pr=ar.registerCombo,gr=y.registerBehavior,vr=Oe,yr=(ar.registerNode,ar.registerEdge,ar.registerCombo,y.registerBehavior,n(217)),mr=n(46),br=n(58),xr=n(77),_r=n.n(xr),wr=n(81),Er=n.n(wr),Sr=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function Or(t,e,n){var r;return(r=Math.round(t.h)>=60&&Math.round(t.h)<=240?n?Math.round(t.h)-2*e:Math.round(t.h)+2*e:n?Math.round(t.h)+2*e:Math.round(t.h)-2*e)<0?r+=360:r>=360&&(r-=360),r}function Mr(t,e,n){return 0===t.h&&0===t.s?t.s:((r=n?t.s-.16*e:4===e?t.s+.16:t.s+.05*e)>1&&(r=1),n&&5===e&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function kr(t,e,n){var r;return(r=n?t.v+.05*e:t.v-.15*e)>1&&(r=1),Number(r.toFixed(2))}function Ar(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=Er()(t),i=5;i>0;i-=1){var o=r.toHsv(),a=Er()({h:Or(o,i,!0),s:Mr(o,i,!0),v:kr(o,i,!0)}).toHexString();n.push(a)}n.push(r.toHexString());for(var s=1;s<=4;s+=1){var u=r.toHsv(),c=Er()({h:Or(u,s),s:Mr(u,s),v:kr(u,s)}).toHexString();n.push(c)}return"dark"===e.theme?Sr.map((function(t){var r=t.index,i=t.opacity;return Er.a.mix(e.backgroundColor||"#141414",n[r],100*i).toHexString()})):n}var Cr={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Tr={},Ir={};Object.keys(Cr).forEach((function(t){Tr[t]=Ar(Cr[t]),Tr[t].primary=Tr[t][5],Ir[t]=Ar(Cr[t],{theme:"dark",backgroundColor:"#141414"}),Ir[t].primary=Ir[t][5]}));Tr.red,Tr.volcano,Tr.gold,Tr.orange,Tr.yellow,Tr.lime,Tr.green,Tr.cyan,Tr.blue,Tr.geekblue,Tr.purple,Tr.magenta,Tr.grey;var jr,Pr,Nr,Dr,Lr=function(t,e,n){var r=_r()(t),i=_r()(e);return _r()([(1-n)*r.red()+n*i.red(),(1-n)*r.green()+n*i.green(),(1-n)*r.blue()+n*i.blue()]).rgb()},Rr=function(t,e,n,r){return void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)"),"default"===n?function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="rgb(150, 150, 150)");var r=Lr(e,t,.05).rgb().toString(),i=Lr(e,t,.1).rgb().toString(),o=Lr(e,t,.2).rgb().toString(),a=Lr(e,t,.4).rgb().toString(),s=Lr(e,n,.02).rgb().toString(),u=Lr(e,n,.05).rgb().toString(),c=Lr(e,n,.1).rgb().toString(),l=Lr(e,n,.2).rgb().toString(),f=Lr(e,n,.3).rgb().toString(),h=Ar(t,{theme:"default",backgroundColor:e}),d=_r()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:t,mainFill:i,activeStroke:t,activeFill:r,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:e,highlightStroke:g,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:f,edgeActiveStroke:t,edgeInactiveStroke:l,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:f,comboMainFill:s,comboActiveStroke:t,comboActiveFill:r,comboInactiveStroke:f,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:s,comboDisableStroke:l,comboDisableFill:u}}(t,e,"rgb(150, 150, 150)"):function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="#777");var r=Lr(e,t,.2).rgb().toString(),i=Lr(e,t,.3).rgb().toString(),o=Lr(e,t,.6).rgb().toString(),a=Lr(e,t,.8).rgb().toString(),s=Lr(e,n,.2).rgb().toString(),u=Lr(e,n,.25).rgb().toString(),c=Lr(e,n,.3).rgb().toString(),l=Lr(e,n,.4).rgb().toString(),f=Lr(e,n,.5).rgb().toString(),h=Ar(t,{theme:"dark",backgroundColor:e}),d=_r()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:a,mainFill:r,activeStroke:t,activeFill:i,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:r,highlightStroke:t,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:n,edgeActiveStroke:t,edgeInactiveStroke:n,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:l,comboMainFill:u,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:l,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:l,comboDisableFill:s}}(t,e,"#777")},Br=function(t,e,n,r){void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)");var i=[];return t.forEach((function(t){i.push(Rr(t,e,n,r))})),i},Fr=Rr("rgb(95, 149, 255)","rgb(255, 255, 255)"),Gr={version:"0.6.0-beta.3",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:Fr.mainStroke,fill:Fr.mainFill},size:20,color:Fr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Fr.activeFill,stroke:Fr.activeStroke}},nodeStateStyles:{active:{fill:Fr.activeFill,stroke:Fr.activeStroke,lineWidth:2,shadowColor:Fr.mainStroke,shadowBlur:10},selected:{fill:Fr.selectedFill,stroke:Fr.selectedStroke,lineWidth:4,shadowColor:Fr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Fr.highlightFill,stroke:Fr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Fr.inactiveFill,stroke:Fr.inactiveStroke,lineWidth:1},disable:{fill:Fr.disableFill,stroke:Fr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Fr.edgeMainStroke,lineAppendWidth:2},color:Fr.edgeMainStroke},edgeStateStyles:{active:{stroke:Fr.edgeActiveStroke,lineWidth:1},selected:{stroke:Fr.edgeSelectedStroke,lineWidth:2,shadowColor:Fr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Fr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Fr.edgeInactiveStroke,lineWidth:1},disable:{stroke:Fr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Fr.comboMainFill,lineWidth:1,stroke:Fr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Fr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Fr.comboActiveStroke,lineWidth:1,fill:Fr.comboActiveFill},selected:{stroke:Fr.comboSelectedStroke,lineWidth:2,fill:Fr.comboSelectedFill,shadowColor:Fr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Fr.comboHighlightStroke,lineWidth:2,fill:Fr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Fr.comboInactiveStroke,fill:Fr.comboInactiveFill,lineWidth:1},disable:{stroke:Fr.comboDisableStroke,fill:Fr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function zr(t,e,n){if(t){if("function"==typeof t.addEventListener)return t.addEventListener(e,n,!1),{remove:function(){t.removeEventListener(e,n,!1)}};if("function"==typeof t.attachEvent)return t.attachEvent("on"+e,n),{remove:function(){t.detachEvent("on"+e,n)}}}}function Ur(t){jr||(jr=document.createElement("table"),Pr=document.createElement("tr"),Nr=/^\s*<(\w+|!)[^>]*>/,Dr={tr:document.createElement("tbody"),tbody:jr,thead:jr,tfoot:jr,td:Pr,th:Pr,"*":document.createElement("div")});var e=Nr.test(t)&&RegExp.$1;e&&e in Dr||(e="*");var n=Dr[e];t="string"==typeof t?t.replace(/(^\s*)|(\s*$)/g,""):t,n.innerHTML=""+t;var r=n.childNodes[0];return r&&n.contains(r)&&n.removeChild(r),r}function Vr(t,e){if(t)for(var n in e)e.hasOwnProperty(n)&&(t.style[n]=e[n]);return t}var Wr=cr.cloneEvent,Xr=cr.isViewportChanged,Yr=function(t){function e(e){var n=t.call(this,e)||this;return n.extendEvents=[],n.dragging=!1,n.preItem=null,n.graph=e,n.destroyed=!1,n.initEvents(),n}return Object(d.__extends)(e,t),e.prototype.initEvents=function(){var t=this.graph,e=this.extendEvents,n=void 0===e?[]:e,r=t.get("canvas"),i=r.get("el"),o=Object(p.wrapBehavior)(this,"onCanvasEvents"),a=Object(p.wrapBehavior)(this,"onExtendEvents"),s=Object(p.wrapBehavior)(this,"onWheelEvent");r.off("*").on("*",o),this.canvasHandler=o,n.push(zr(i,"DOMMouseScroll",s)),n.push(zr(i,"mousewheel",s)),"undefined"!=typeof window&&(n.push(zr(window,"keydown",a)),n.push(zr(window,"keyup",a)),n.push(zr(window,"focus",a)))},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this.graph,r=n.get("canvas"),i=t.target,o=t.type;t.canvasX=t.x,t.canvasY=t.y;var a={x:t.canvasX,y:t.canvasY},s=n.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),Xr(s)&&(a=n.getPointByClient(t.clientX,t.clientY)),t.x=a.x,t.y=a.y,t.currentTarget=n,i===r)return"mousemove"!==o&&"mouseleave"!==o||this.handleMouseMove(t,"canvas"),t.target=r,t.item=null,n.emit(o,t),void n.emit("canvas:".concat(o),t);var u=e.getItemRoot(i);if(u){var c=u.get("item");if(!c.destroyed){var l=c.getType();if(t.target=i,t.item=c,t.canvasX===t.x&&t.canvasY===t.y){var f=n.getCanvasByPoint(t.x,t.y);t.canvasX=f.x,t.canvasY=f.y}n.emit(o,t),t.name&&!t.name.includes(":")?n.emit("".concat(l,":").concat(o),t):n.emit(t.name,t),"dragstart"===o&&(this.dragging=!0),"dragend"===o&&(this.dragging=!1),"mousemove"===o&&this.handleMouseMove(t,l)}}else n.emit(o,t)},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){Object(p.isNil)(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,e){var n=this.graph,r=this.preItem,i=n.get("canvas"),o=t.target===i?null:t.item;t=Wr(t),r&&r!==o&&!r.destroyed&&(t.item=r,this.emitCustomEvent(r.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(r.getType(),"dragleave",t)),o&&r!==o&&(t.item=o,this.emitCustomEvent(e,"mouseenter",t),this.dragging&&this.emitCustomEvent(e,"dragenter",t)),this.preItem=o},e.prototype.emitCustomEvent=function(t,e,n){n.type=e,this.graph.emit("".concat(t,":").concat(e),n)},e.prototype.destroy=function(){var t=this.graph,e=this.canvasHandler,n=this.extendEvents;t.get("canvas").off("*",e),Object(p.each)(n,(function(t){t.remove()})),this.dragging=!1,this.preItem=null,this.extendEvents.length=0,this.canvasHandler=null,this.destroyed=!0},e}(fr),Hr=n(22),qr=n(75),Kr=n.n(qr),Zr=cr.traverseTree,Qr=function(t,e){return t?Object(p.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},$r=function(t,e){var n=[],r=[],i={},o=0;for(o=0;o<t.length;o++){var a=t[o];i[a.id]=o,n.push(a.x),n.push(a.y),n.push(0),n.push(0),r.push([])}for(o=0;o<e.length;o++){var s=e[o];r[i[s.source]].push(i[s.target]),r[i[s.target]].push(i[s.source])}var u=0;for(o=0;o<t.length;o++){var c=n.length,l=r[o],f=l.length;n[4*o+2]=c,n[4*o+3]=l.length,u=Math.max(u,l.length);for(var h=0;h<f;++h){var d=l[h];n.push(+d)}}for(;n.length%4!=0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:u}},Jr=function(t,e,n){var r=[],i=[],o={},a=0;for(a=0;a<t.length;a++){var s=t[a];o[s.id]=a,r.push(s.x),r.push(s.y),r.push(0),r.push(0),i.push([])}for(a=0;a<e.length;a++){var u=e[a];i[o[u.source]].push(o[u.target]),i[o[u.source]].push(n(u)),i[o[u.target]].push(o[u.source]),i[o[u.target]].push(n(u))}var c=0;for(a=0;a<t.length;a++){var l=r.length,f=i[a],h=f.length;r[4*a+2]=l,r[4*a+3]=h/2,c=Math.max(c,h/2);for(var d=0;d<h;++d){var p=f[d];r.push(+p)}}for(;r.length%4!=0;)r.push(0);return{array:new Float32Array(r),maxEdgePerVetex:c}},ti=function(t,e,n,r){var i=[],o=[],a={},s=0;for(s=0;s<t.length;s++){var u=t[s];a[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),o.push([])}for(s=0;s<e.length;s++){var c=e[s];o[a[c.source]].push(a[c.target]),o[a[c.source]].push(n(c)),o[a[c.source]].push(r(c)),o[a[c.source]].push(0),o[a[c.target]].push(a[c.source]),o[a[c.target]].push(n(c)),o[a[c.target]].push(r(c)),o[a[c.target]].push(0)}var l=0;for(s=0;s<t.length;s++){var f=i.length,h=o[s],d=h.length;i[4*s+2]=f+1048576*d/4,i[4*s+3]=0,l=Math.max(l,d/4);for(var p=0;p<d;++p){var g=h[p];i.push(+g)}}for(;i.length%4!=0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:l}},ei=function(t,e){var n=[],r=t.length,i={};return e.forEach((function(e){t.forEach((function(t,o){if(void 0===i[e[t]]&&(i[e[t]]=Object.keys(i).length),n.push(i[e[t]]),o===r-1)for(;n.length%4!=0;)n.push(0)}))})),{array:new Float32Array(n),count:Object.keys(i).length}},ni=function(t){for(var e=[],n=t.length,r=t[0].length,i=function(r){t.forEach((function(t,i){if(e.push(t[r]),i===n-1)for(;e.length%4!=0;)e.push(0)}))},o=0;o<r;o++)i(o);return new Float32Array(e)},ri=function(t,e){var n={x:1/0,y:1/0},r={x:-1/0,y:-1/0},i="x",o="y";e&&["V","TB","BT"].indexOf(e)>=0&&(o="x",i="y");var a=0;Zr(t,(function(t){return a++,t.x>r.x&&(r.x=t.x),t.x<n.x&&(n.x=t.x),t.y>r.y&&(r.y=t.y),t.y<n.y&&(n.y=t.y),!0}));var s=2*Math.PI/a,u=r[o]-n[o];return 0===u||Zr(t,(function(e){var r=(e[o]-n[o])/u*(2*Math.PI-s)+s,a=Math.abs("x"===i?e.x-t.x:e.y-t.y);return e.x=a*Math.cos(r),e.y=a*Math.sin(r),!0})),t},ii=function t(){return"undefined"==typeof window||"undefined"==typeof document?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join("\n")),t},addGetWebGLMessage:function(e){var n=void 0!==(e=e||{}).parent?e.parent:document.body,r=void 0!==e.id?e.id:"oldie",i=t().getWebGLErrorMessage();i.id=r,n.appendChild(i)}}},oi=Object(d.__assign)(Object(d.__assign)(Object(d.__assign)(Object(d.__assign)({},cr),c),l),f),ai=oi.radialLayout,si=function(){function t(t){this.type=t.type,this.radial=t.radial,this.config=t}return t.prototype.init=function(t){var e=this;this.data=t,this.radial?this.layoutMethod=function(t){var n=Kr.a[e.type](t,e.config);return ai(n),n}:this.layoutMethod=function(t){return Kr.a[e.type](t,e.config)}},t.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},t.prototype.layout=function(t){return this.init(t),this.execute()},t}();Object(Hr.registerLayout)("grid",Hr.GridLayout),Object(Hr.registerLayout)("random",Hr.RandomLayout),Object(Hr.registerLayout)("force",Hr.ForceLayout),Object(Hr.registerLayout)("circular",Hr.CircularLayout),Object(Hr.registerLayout)("dagre",Hr.DagreLayout),Object(Hr.registerLayout)("radial",Hr.RadialLayout),Object(Hr.registerLayout)("concentric",Hr.ConcentricLayout),Object(Hr.registerLayout)("mds",Hr.MDSLayout),Object(Hr.registerLayout)("fruchterman",Hr.FruchtermanLayout),Object(Hr.registerLayout)("fruchterman-gpu",Hr.FruchtermanGPULayout),Object(Hr.registerLayout)("gForce",Hr.GForceLayout),Object(Hr.registerLayout)("gForce-gpu",Hr.GForceGPULayout),Object(Hr.registerLayout)("comboForce",Hr.ComboForceLayout),Object(Hr.registerLayout)("comboCombined",Hr.ComboCombinedLayout),Object(Hr.registerLayout)("forceAtlas2",Hr.ForceAtlas2Layout);var ui=function(t,e){e.isCustomLayout=!0,Hr.Layouts[t]=Object(Hr.registerLayout)(t,e)},ci=function(t,e){var n=t.toString(),r=new Blob(["importScripts('".concat(e,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(r))},li=function(t){return void 0===t&&(t="https://unpkg.com/@antv/layout@latest/dist/layout.min.js"),new ci((function(){var t="LAYOUT_RUN",e="LAYOUT_END",n="LAYOUT_ERROR",r="GPU_LAYOUT_RUN";layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout),onmessage=function(i){(function(e){var n=e.data.type;return n===t||n===r})(i)&&function(i){var o=this;switch(i.data.type){case t:var a,s=i.data,u=s.nodes,c=s.edges,l=s.layoutCfg,f=(v=void 0===l?{}:l).type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}v.onLayoutEnd=function(){o.postMessage({type:e,nodes:u}),null==a||a.destroy()},(a=new h(v)).init({nodes:u,edges:c}),a.execute();break;case r:var h,d=i.data,p=d.nodes,g=(c=d.edges,d.layoutCfg),v=void 0===g?{}:g,y=d.canvas;f=v.type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}if("gpu"!==f.split("-")[1]){this.postMessage({type:n,message:"layout ".concat(f," does not support GPU")});break}var m=new h(v);m.init({nodes:p,edges:c}),m.executeWithWorker(y,this)}}(i)}}),t)},fi="LAYOUT_RUN",hi="LAYOUT_END",di="LAYOUT_ERROR",pi="LAYOUT_TICK",gi="GPU_LAYOUT_RUN",vi="GPU_LAYOUT_END";function yi(t){return(yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var mi=function(t){return setTimeout(t,16)},bi=function(t){return clearTimeout(t)},xi=function(t){return("undefined"!=typeof window&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||mi)(t)},_i=function(t){return("undefined"!=typeof window&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||bi)(t)},wi=["fruchterman","gForce"],Ei=["force","grid","circular"],Si=function(t){function e(e){var n=t.call(this,e)||this;return n.graph=e,n.layoutCfg=e.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return Object(d.__extends)(e,t),e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker||("undefined"==typeof Worker?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=li(this.layoutCfg.workerScriptURL)),this.worker},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(_i(t.requestId),t.requestId=null),t.requestId2&&(_i(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(d.__awaiter)(n,void 0,void 0,(function(){var n,o,a,s,u,c,l;return Object(d.__generator)(this,(function(f){switch(f.label){case 0:if(!(n=this.graph)||n.get("destroyed"))return[2];o=t.type,t.onLayoutEnd=function(){n.emit("aftersublayout",{type:o}),r()},o&&this.isGPU&&(this.hasGPUVersion(o)?o="".concat(o,"-gpu"):console.warn("The '".concat(o,"' layout does not support GPU calculation for now, it will run in CPU."))),"force"===o||"g6force"===o||"gForce"===o?(a=t.onTick,c=function(){a&&a(),n.refreshPositions()},t.tick=c):"comboForce"!==o&&"comboCombined"!==o||(t.comboTrees=n.get("comboTrees")),!1;try{s=new Hr.Layouts[o](t)}catch(t){console.warn("The layout method: '".concat(o,"' does not exist! Please specify it first.")),i()}return s.enableTick&&(u=t.onTick,c=function(){u&&u(),n.refreshPositions()},s.tick=c),function(t,e){var n;if(!(null===(n=null==t?void 0:t.nodes)||void 0===n?void 0:n.length))return;t.nodes.forEach((function(t){t.layoutOrder=e}))}(l=this.filterLayoutData(this.data,t),e),s.init(l),n.emit("beforesublayout",{type:o}),[4,s.execute()];case 1:return f.sent(),s.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),this.layoutMethods[e]=s,[2]}}))}))}))},e.prototype.updateLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(d.__awaiter)(n,void 0,void 0,(function(){var n,i,o;return Object(d.__generator)(this,(function(a){switch(a.label){case 0:return n=this.graph,i=null==e?void 0:e.type,e.onLayoutEnd=function(){n.emit("aftersublayout",{type:i}),r()},o=this.filterLayoutData(this.data,e),t.init(o),t.updateCfg(e),n.emit("beforesublayout",{type:i}),[4,t.execute()];case 1:return a.sent(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}}))}))}))},e.prototype.layout=function(t){var e=this,n=this.graph;this.data=this.setDataFromGraph();var r=this.data,i=r.nodes,o=r.hiddenNodes;if(!i)return!1;var a=n.get("width"),s=n.get("height"),u={};Object.assign(u,{width:a,height:s,center:[a/2,s/2]},this.layoutCfg),this.layoutCfg=u,this.destoryLayoutMethods(),n.emit("beforelayout"),this.initPositions(u.center,i),this.initPositions(u.center,o);var c=u.type;c&&"gpu"===c.split("-")[1]&&(c=c.split("-")[0],u.gpuEnabled=!0);var l=!1;u.gpuEnabled&&(l=!0,ii().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),l=!1)),this.isGPU=l;var f=u.onLayoutEnd,h=u.layoutEndFormatted,p=u.adjust;if(h||(u.layoutEndFormatted=!0,u.onAllLayoutEnd=function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return f&&f(),this.refreshLayout(),p&&u.pipes?[4,this.adjustPipesBox(this.data,p)]:[3,2];case 1:t.sent(),this.refreshLayout(),t.label=2;case 2:return n.emit("afterlayout"),[2]}}))}))}),this.stopWorker(),u.workerEnabled&&this.layoutWithWorker(this.data))return!0;var g=Promise.resolve(),v=!1;return u.type?(v=!0,g=g.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.execLayoutMethod(u,0)];case 1:return[2,t.sent()]}}))}))}))):u.pipes&&(v=!0,u.pipes.forEach((function(t,n){g=g.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.execLayoutMethod(t,n)];case 1:return[2,e.sent()]}}))}))}))}))),v&&g.then((function(){u.onAllLayoutEnd&&u.onAllLayoutEnd(),t&&t()})).catch((function(t){console.warn("graph layout failed,",t)})),!1},e.prototype.layoutWithWorker=function(t){var e=this,n=this.layoutCfg,r=this.graph,i=this.getWorker(),o=this.workerData;if(!i)return!1;o.requestId=null,o.requestId2=null,o.currentTick=null,o.currentTickData=null,r.emit("beforelayout");var a=Promise.resolve(),s=!1;if(n.type)s=!0,a=a.then((function(){return e.runWebworker(i,t,n)}));else if(n.pipes){s=!0;for(var u=function(n){a=a.then((function(){return e.runWebworker(i,t,n)}))},c=0,l=n.pipes;c<l.length;c++){u(l[c])}}return s&&a.then((function(){n.onAllLayoutEnd&&n.onAllLayoutEnd()})).catch((function(t){console.error("layout failed",t)})),!0},e.prototype.runWebworker=function(t,e,n){var r=this,i=this.isGPU,o=this.filterLayoutData(e,n),a=o.nodes,s=o.edges,u=document.createElement("canvas"),c=i&&"undefined"!=typeof window&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in u,l=function(t,e){var n={};if(t&&"object"===yi(t))return Object.keys(t).forEach((function(r){t.hasOwnProperty(r)&&e(t[r])&&(n[r]=t[r])})),n;return t}(n,(function(t){return"function"!=typeof t}));if(c){var f=u.transferControlToOffscreen();l.type="".concat(l.type,"-gpu"),t.postMessage({type:gi,nodes:a,edges:s,layoutCfg:l,canvas:f},[f])}else t.postMessage({type:fi,nodes:a,edges:s,layoutCfg:l});return new Promise((function(e,i){t.onmessage=function(t){r.handleWorkerMessage(e,i,t,o,n)}}))},e.prototype.handleWorkerMessage=function(t,e,n,r,i){var o=this.graph,a=this.workerData,s=n.data,u=s.type,c=function(){i.onTick&&i.onTick()};switch(u){case pi:a.currentTick=s.currentTick,a.currentTickData=s,a.requestId||(a.requestId=xi((function(){Oi(r,s),o.refreshPositions(),c(),s.currentTick===s.totalTicks?t():a.currentTick===s.totalTicks&&(a.requestId2=xi((function(){Oi(r,a.currentTickData),o.refreshPositions(),a.requestId2=null,c(),t()}))),a.requestId=null})));break;case hi:null==a.currentTick&&(Oi(r,s),t());break;case vi:null==a.currentTick&&(!function(t,e){for(var n=t.nodes,r=e.vertexEdgeData,i=n.length,o=0;o<i;o++){var a=n[o],s=r[4*o],u=r[4*o+1];a.x=s,a.y=u}}(r,s),t());break;case di:console.warn("Web-Worker layout error!",s.message),e();break;default:e()}},e.prototype.updateLayoutCfg=function(t){var e=this,n=this.graph,r=this.layoutMethods,i=Object(p.mix)({},this.layoutCfg,t);if(this.layoutCfg=i,null==r?void 0:r.length){if(this.data=this.setDataFromGraph(),this.stopWorker(),!t.workerEnabled||!this.layoutWithWorker(this.data)){n.emit("beforelayout");var o=Promise.resolve(),a=!1;1===r.length?(a=!0,o=o.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.updateLayoutMethod(r[0],i)];case 1:return[2,t.sent()]}}))}))}))):(a=!0,null==r||r.forEach((function(t,n){var r=i.pipes[n];o=o.then((function(){return Object(d.__awaiter)(e,void 0,void 0,(function(){return Object(d.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.updateLayoutMethod(t,r)];case 1:return[2,e.sent()]}}))}))}))}))),a&&o.then((function(){i.onAllLayoutEnd&&i.onAllLayoutEnd()})).catch((function(t){console.warn("layout failed",t)}))}}else this.layout()},e.prototype.adjustPipesBox=function(t,e){var n=this;return new Promise((function(r){var i=t.nodes;(null==i?void 0:i.length)||r(),Ei.includes(e)||(console.warn("The adjust type ".concat(e," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),r());var o={center:n.layoutCfg.center,nodeSize:function(t){return Math.max(t.height,t.width)},preventOverlap:!0,onLayoutEnd:function(){}},a=n.getLayoutBBox(i),s=a.groupNodes,u=a.layoutNodes,c=Object(p.clone)(u);o.onLayoutEnd=function(){null==u||u.forEach((function(t,e){var n,r,i,o=t.x-(null===(n=c[e])||void 0===n?void 0:n.x),a=t.y-(null===(r=c[e])||void 0===r?void 0:r.y);null===(i=s[e])||void 0===i||i.forEach((function(t){t.x+=o,t.y+=a}))})),r()},new Hr.Layouts[e](o).layout({nodes:u})}))},e.prototype.hasGPUVersion=function(t){return wi.includes(t)},e.prototype.destroy=function(){this.destoryLayoutMethods();var t=this.worker;t&&(t.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},e}(lr);function Oi(t,e){for(var n=t.nodes,r=e.nodes,i=n.length,o=0;o<i;o++){var a=n[o];a.x=r[o].x,a.y=r[o].y}}var Mi,ki=b.a.transform,Ai=function(t){function e(e){var n=t.call(this,e)||this,r=n.get("defaultNode");return r||n.set("defaultNode",{type:"circle"}),r.type||(r.type="circle",n.set("defaultNode",r)),n.destroyed=!1,n}return Object(d.__extends)(e,t),e.prototype.initLayoutController=function(){var t=new Si(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new Yr(this);this.set({eventController:t})},e.prototype.initCanvas=function(){var t=this.get("container");if("string"==typeof t&&(t=document.getElementById(t),this.set("container",t)),!t)throw new Error("invalid container");var e,n=t.clientWidth,r=t.clientHeight,i=this.get("width")||n,o=this.get("height")||r;if(this.get("width")||this.get("height")||(this.set("width",n),this.set("height",r)),"svg"===this.get("renderer"))e=new br.Canvas({container:t,width:i,height:o});else{var a={container:t,width:i,height:o},s=this.get("pixelRatio");s&&(a.pixelRatio=s),e=new mr.Canvas(a)}this.set("canvas",e)},e.prototype.initPlugins=function(){var t=this;Object(p.each)(t.get("plugins"),(function(e){!e.destroyed&&e.initPlugin&&e.initPlugin(t)}))},e.prototype.downloadImageWatermark=function(t,e,n,r){return Object(d.__awaiter)(this,void 0,void 0,(function(){var i,o,a;return Object(d.__generator)(this,(function(s){switch(s.label){case 0:return i=t.style.backgroundImage,o=i.slice(5,i.length-2),(a=new Image).src=o,[4,new Promise((function(t){a.onload=function(){var i=e.createPattern(a,"repeat");e.rect(0,0,n,r),e.fillStyle=i,e.fill(),t("")}}))];case 1:return s.sent(),[2]}}))}))},e.prototype.asyncToDataUrl=function(t,e,n,r,i,o){var a=this,s=document.querySelector(".g6-graph-watermarker"),u=this.get("canvas"),c=u.getRenderer(),l=o||u.get("el"),f="";t||(t="image/png"),setTimeout((function(){return Object(d.__awaiter)(a,void 0,void 0,(function(){var o,a,u,h,p,g,v,y,m,b;return Object(d.__generator)(this,(function(d){switch(d.label){case 0:return"svg"!==c?[3,1]:(o=l.cloneNode(!0),a=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),(u=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",a)).replaceChild(o,u.documentElement),h=(new XMLSerializer).serializeToString(u),f="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(h)),[3,4]);case 1:return p=void 0,g=l.getContext("2d"),v=r||this.get("width"),y=i||this.get("height"),m=void 0,s?[4,this.downloadImageWatermark(s,g,v,y)]:[3,3];case 2:d.sent(),d.label=3;case 3:if(e){b="undefined"!=typeof window?window.devicePixelRatio:1;try{p=g.getImageData(0,0,v*b,y*b),m=g.globalCompositeOperation,g.globalCompositeOperation="destination-over",g.fillStyle=e,g.fillRect(0,0,v,y)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}f=l.toDataURL(t),e&&(g.clearRect(0,0,v,y),g.putImageData(p,0,0),g.globalCompositeOperation=m),d.label=4;case 4:return n&&n(f),[2]}}))}))}),16)},e.prototype.toDataURL=function(t,e){var n=this.get("canvas"),r=n.getRenderer(),i=n.get("el");t||(t="image/png");var o="";if("svg"===r){var a=i.cloneNode(!0),s=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),u=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",s);u.replaceChild(a,u.documentElement);var c=(new XMLSerializer).serializeToString(u);o="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(c))}else{var l=void 0,f=i.getContext("2d"),h=this.get("width"),d=this.get("height"),p=void 0;if(e){var g="undefined"!=typeof window?window.devicePixelRatio:1;try{l=f.getImageData(0,0,h*g,d*g),p=f.globalCompositeOperation,f.globalCompositeOperation="destination-over",f.fillStyle=e,f.fillRect(0,0,h,d)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}o=i.toDataURL(t),e&&(f.clearRect(0,0,h,d),f.putImageData(l,0,0),f.globalCompositeOperation=p)}return o},e.prototype.toFullDataURL=function(t,e,n){var r=this.get("group").getCanvasBBox(),i=r.height,o=r.width,a=this.get("renderer"),s=Ur('<div id="virtual-image"></div>'),u=n?n.backgroundColor:void 0,c=n?n.padding:void 0;c?Object(p.isNumber)(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var l=i+c[0]+c[2],f=o+c[1]+c[3],h={container:s,height:l,width:f,quickHit:!0},d="svg"===a?new br.Canvas(h):new mr.Canvas(h),g=this.get("group").clone(),v=Object(p.clone)(g.getMatrix());v||(v=[1,0,0,0,1,0,0,0,1]);var y=(r.maxX+r.minX)/2,m=(r.maxY+r.minY)/2;v=ki(v,[["t",-y,-m],["t",o/2+c[3],i/2+c[0]]]),g.resetMatrix(),g.setMatrix(v),d.add(g);var b=d.get("el"),x="";e||(e="image/png"),setTimeout((function(){if("svg"===a){var n=b.cloneNode(!0),r=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",r);i.replaceChild(n,i.documentElement);var o=(new XMLSerializer).serializeToString(i);x="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(o))}else{var s=void 0,c=b.getContext("2d"),h=void 0;if(u){var d="undefined"!=typeof window?window.devicePixelRatio:1;try{s=c.getImageData(0,0,f*d,l*d),h=c.globalCompositeOperation,c.globalCompositeOperation="destination-over",c.fillStyle=u,c.fillRect(0,0,f,l)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}x=b.toDataURL(e),u&&(c.clearRect(0,0,f,l),c.putImageData(s,0,0),c.globalCompositeOperation=h)}t&&t(x)}),16)},e.prototype.downloadFullImage=function(t,e,n){var r=this,i=this.get("group").getCanvasBBox(),o=i.height,a=i.width,s=this.get("renderer"),u=Ur('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),l=n?n.backgroundColor:void 0,f=n?n.padding:void 0;f?Object(p.isNumber)(f)&&(f=[f,f,f,f]):f=[0,0,0,0];var h=o+f[0]+f[2],d=a+f[1]+f[3];if(c){var g=this.get("graphWaterMarker").cfg||{},v=g.width,y=g.height;h=Math.ceil(h/y)*y,d=Math.ceil(d/v)*v}var m={container:u,height:h,width:d},b="svg"===s?new br.Canvas(m):new mr.Canvas(m),x=this.get("group").clone(),_=Object(p.clone)(x.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var w=(i.maxX+i.minX)/2,E=(i.maxY+i.minY)/2;_=ki(_,[["t",-w,-E],["t",a/2+f[3],o/2+f[0]]]),x.resetMatrix(),x.setMatrix(_),b.add(x);var S=b.get("el");e||(e="image/png"),this.asyncToDataUrl(e,l,(function(n){var i=document.createElement("a"),o=(t||"graph")+("svg"===s?".svg":".".concat(e.split("/")[1]));r.dataURLToImage(n,s,i,o);var a=document.createEvent("MouseEvents");a.initEvent("click",!1,!1),i.dispatchEvent(a)}),d,h,S)},e.prototype.downloadImage=function(t,e,n){var r=this;this.isAnimating()&&this.stopAnimate();var i=this.get("canvas").getRenderer();e||(e="image/png");var o=(t||"graph")+("svg"===i?".svg":e.split("/")[1]),a=document.createElement("a");this.asyncToDataUrl(e,n,(function(t){r.dataURLToImage(t,i,a,o);var e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),a.dispatchEvent(e)}))},e.prototype.dataURLToImage=function(t,e,n,r){if(t&&"data:"!==t){if("undefined"!=typeof window)if(window.Blob&&window.URL&&"svg"!==e){var i=t.split(","),o="";if(i&&i.length>0){var a=i[0].match(/:(.*?);/);a&&a.length>=2&&(o=a[1])}for(var s=atob(i[1]),u=s.length,c=new Uint8Array(u);u--;)c[u]=s.charCodeAt(u);var l=new Blob([c],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(l,r):n.addEventListener("click",(function(){n.download=r,n.href=window.URL.createObjectURL(l)}))}else n.addEventListener("click",(function(){n.download=r,n.href=t}))}else console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items")},e.prototype.addPlugin=function(t){t.destroyed||(this.get("plugins").push(t),t.initPlugin(this))},e.prototype.removePlugin=function(t){var e=this.get("plugins"),n=e.indexOf(t);n>=0&&(t.destroyPlugin(),e.splice(n,1))},e.prototype.setImageWaterMarker=function(t,e){void 0===t&&(t=Gr.waterMarkerImage);var n=this.get("container");Object(p.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(p.deepMix)({},Gr.imageWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.image;if(!r){var c={container:n,width:o,height:a,capture:!1},l=this.get("pixelRatio");l&&(c.pixelRatio=l),r=new mr.Canvas(c),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var f=r.get("context"),h=u.rotate,d=u.x,g=u.y;f.rotate(-h*Math.PI/180);var v=new Image;v.crossOrigin="anonymous",v.src=t,v.onload=function(){if(f.drawImage(v,d,g,u.width,u.height),f.rotate(h*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var t=document.querySelector(".g6-graph-watermarker");t||((t=document.createElement("div")).className="g6-graph-watermarker"),t.className="g6-graph-watermarker",r.destroyed||(t.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),n.appendChild(t))}}},e.prototype.setTextWaterMarker=function(t,e){var n=this.get("container");Object(p.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(p.deepMix)({},Gr.textWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.text;if(!r){var c={container:n,width:o,height:a,capture:!1},l=this.get("pixelRatio");l&&(c.pixelRatio=l),r=new mr.Canvas(c),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var f=r.get("context"),h=u.rotate,d=u.fill,g=u.fontFamily,v=u.fontSize,y=u.baseline,m=u.x,b=u.y,x=u.lineHeight;f.rotate(-h*Math.PI/180),f.font="".concat(v,"px ").concat(g),f.fillStyle=d,f.textBaseline=y;for(var _=t.length-1;_>=0;_--)f.fillText(t[_],m,b+_*x);if(f.rotate(h*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var w=document.querySelector(".g6-graph-watermarker");w||((w=document.createElement("div")).className="g6-graph-watermarker"),w.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),n.appendChild(w)}},e.prototype.destroy=function(){var e,n,r,i;Object(p.each)(this.get("plugins"),(function(t){t.destroyPlugin()}));var o=this.get("tooltips");if(o)for(var a=0;a<o.length;a++){var s=o[a];if(s){var u=s.parentElement;u&&u.removeChild(s)}}null===(e=this.get("eventController"))||void 0===e||e.destroy(),null===(n=this.get("layoutController"))||void 0===n||n.destroy(),null===(r=this.get("graphWaterMarker"))||void 0===r||r.destroy(),null===(i=document.querySelector(".g6-graph-watermarker"))||void 0===i||i.remove(),t.prototype.destroy.call(this)},e}(Wn),Ci=oi.radialLayout,Ti=oi.traverseTree,Ii=function(t){function e(e){var n=t.call(this,e)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return Object(d.__extends)(e,t),e.prototype.getLayout=function(){var t=this.get("layout");return t?"function"==typeof t?t:(t.type||(t.type="dendrogram"),t.direction||(t.direction="TB"),t.radial?function(e){var n=Kr.a[t.type](e,t);return Ci(n),n}:function(e){return Kr.a[t.type](e,t)}):null},e.indexOfChild=function(t,e){var n=-1;return Object(p.each)(t,(function(t,r){if(e===t.id)return n=r,!1})),n},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.animate=!0,e},e.prototype.innerAddChild=function(t,e,n){var r=this,i=t.data;i&&(i.x=t.x,i.y=t.y,i.depth=t.depth);var o=r.addItem("node",i,!1);if(e){if(o.set("parent",e),n){var a=e.get("originAttrs");if(a)o.set("originAttrs",a);else{var s=e.getModel();o.set("originAttrs",{x:s.x,y:s.y})}}var u=e.get("children");u?u.push(o):e.set("children",[o]),r.addItem("edge",{source:e.get("id"),target:o.get("id"),id:"".concat(e.get("id"),":").concat(o.get("id"))},!1)}return Object(p.each)(t.children||[],(function(t){r.innerAddChild(t,o,n)})),r.emit("afteraddchild",{item:o,parent:e}),o},e.prototype.innerUpdateChild=function(t,n,r){var i=this,o=i.findById(t.id);if(o){Object(p.each)(t.children||[],(function(t){i.innerUpdateChild(t,o,r)}));var a,s,u=o.get("children");if(u)if(u.length>0)for(var c=u.length-1;c>=0;c--){var l=u[c].getModel();-1===e.indexOfChild(t.children||[],l.id)&&(i.innerRemoveChild(l.id,{x:t.x,y:t.y},r),u.splice(c,1))}o.get("originAttrs")&&(a=o.get("originAttrs").x,s=o.get("originAttrs").y);var f=o.getModel();r&&o.set("originAttrs",{x:f.x,y:f.y}),o.set("model",t.data),a===t.x&&s===t.y||o.updatePosition({x:t.x,y:t.y})}else i.innerAddChild(t,n,r)},e.prototype.innerRemoveChild=function(t,e,n){var r=this,i=r.findById(t);if(i)if(Object(p.each)(i.get("children"),(function(t){r.innerRemoveChild(t.getModel().id,e,n)})),n){var o=i.getModel();i.set("to",e),i.set("originAttrs",{x:o.x,y:o.y}),r.get("removeList").push(i)}else r.removeItem(i,!1)},e.prototype.changeData=function(t){var e=this;this.getNodes().map((function(t){return e.clearItemStates(t)})),this.getEdges().map((function(t){return e.clearItemStates(t)})),t?(e.data(t),e.render()):e.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");this.updateLayout(t)},e.prototype.updateLayout=function(t){t?(this.set("layout",t),this.set("layoutMethod",this.getLayout()),this.layout()):console.warn("layout cannot be null")},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");this.layout(t)},e.prototype.layout=function(t){var e=this.get("data"),n=this.get("layoutMethod"),r=n?n(e,this.get("layout")):e,i=this.get("animate");(this.emit("beforerefreshlayout",{data:e,layoutData:r}),this.emit("beforelayout"),this.innerUpdateChild(r,void 0,i),t)&&this.get("viewController").fitView();i?this.layoutAnimate(r):(this.refresh(),this.paint()),this.emit("afterrefreshlayout",{data:e,layoutData:r}),this.emit("afterlayout")},e.prototype.addChild=function(t,e){this.emit("beforeaddchild",{model:t,parent:e}),Object(p.isString)(e)||(e=e.get("id"));var n=this.findDataById(e);n&&(n.children||(n.children=[]),n.children.push(t),this.changeData())},e.prototype.updateChildren=function(t,e){e&&this.findById(e)?(this.findDataById(e).children=t,this.changeData()):console.warn("Update children failed! There is no node with id '".concat(e,"'"))},e.prototype.updateChild=function(t,n){if(n&&this.findById(n)){var r=this.findDataById(n),i=this.findById(t.id);if(r.children||(r.children=[]),i){var o=e.indexOfChild(r.children,t.id);r.children[o]=t}else r.children.push(t);this.changeData()}else this.changeData(t)},e.prototype.removeChild=function(t){var n=this.findById(t);if(n){var r=n.get("parent");if(r&&!r.destroyed){var i=this.findDataById(r.get("id")),o=i&&i.children||[],a=n.getModel(),s=e.indexOfChild(o,a.id);o.splice(s,1)}this.changeData()}},e.prototype.findDataById=function(t,e){var n=this;if(e||(e=n.get("data")),t===e.id)return e;var r=null;return Object(p.each)(e.children||[],(function(e){return e.id===t?(r=e,!1):!(r=n.findDataById(t,e))&&void 0})),r},e.prototype.layoutAnimate=function(t,e){var n=this,r=this.get("animateCfg");n.emit("beforeanimate",{data:t}),n.getEdges().forEach((function(t){var e=t.get("model");e.sourceAnchor||(e.sourceAnchor=t.get("sourceAnchorIndex"))})),this.get("canvas").animate((function(r){Ti(t,(function(i){var o=n.findById(i.id);if(o){var a=o.get("originAttrs"),s=o.get("model");if(a||(a={x:s.x,y:s.y},o.set("originAttrs",a)),e){var u=e(o,r,a,t);o.set("model",Object.assign(s,u))}else s.x=a.x+(i.x-a.x)*r,s.y=a.y+(i.y-a.y)*r}return!0})),Object(p.each)(n.get("removeList"),(function(t){var e=t.getModel(),n=t.get("originAttrs"),i=t.get("to");e.x=n.x+(i.x-n.x)*r,e.y=n.y+(i.y-n.y)*r})),n.refreshPositions()}),{duration:r.duration,easing:r.ease,callback:function(){Object(p.each)(n.getNodes(),(function(t){t.set("originAttrs",null)})),Object(p.each)(n.get("removeList"),(function(t){n.removeItem(t)})),n.set("removeList",[]),r.callback&&r.callback(),n.emit("afteranimate",{data:t})},delay:r.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(){var t=this.get("data");if(!t||!Object(p.isObject)(t)||!Object.keys(t).length)throw new Error("data must be defined first");this.clear(),this.emit("beforerender"),this.layout(this.get("fitView")),this.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e}(Ai),ji=function(){function t(t){this._cfgs=Object(p.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return t.prototype.getDefaultCfgs=function(){return{}},t.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var n=e.getEvents(),r={};Object(p.each)(n,(function(n,i){var o=Object(p.wrapBehavior)(e,n);r[i]=o,t.on(i,o)})),this._events=r,this.init()},t.prototype.getEvents=function(){return{}},t.prototype.get=function(t){var e;return null===(e=this._cfgs)||void 0===e?void 0:e[t]},t.prototype.set=function(t,e){this._cfgs[t]=e},t.prototype.destroy=function(){},t.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;Object(p.each)(e,(function(e,n){t.off(n,e)})),this._events=null,this._cfgs=null,this.destroyed=!0},t}(),Pi=(Mi=function(t,e){return(Mi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Mi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),Ni="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Di=function(t){function e(e){return t.call(this,e)||this}return Pi(e,t),e.prototype.getDefaultCfgs=function(){return{img:Ni,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),e=t.get("container"),n=t.get("canvas").get("el"),r=this.get("img")||Ni,i=Ur("<div class='g6-grid-container' style=\"position:absolute;overflow:hidden;z-index: -1;\"></div>"),o=Ur("<div\n class='g6-grid'\n style='position:absolute;\n background-image: ".concat(r,";\n user-select: none\n '></div>"));this.set("container",i),this.set("gridContainer",o),this.positionInit(),i.appendChild(o),e.insertBefore(i,n)},e.prototype.positionInit=function(){var t=this.get("graph"),e=t.get("minZoom"),n=t.get("width"),r=t.get("height");Vr(this.get("container"),{width:"".concat(n,"px"),height:"".concat(r,"px")});var i=80*n/e,o=80*r/e;Vr(this.get("gridContainer"),{width:"".concat(i,"px"),height:"".concat(o,"px"),left:"-".concat(i/2,"px"),top:"-".concat(o/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var e=this.get("gridContainer"),n=t.matrix;n||(n=[1,0,0,0,1,0,0,0,1]);var r=this.get("follow");Vr(e,{transform:"matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(r?n[6]:"0",", ").concat(r?n[7]:"0",")")})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(ji),Li=n(72),Ri=n.n(Li),Bi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-contextmenu {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .g6-contextmenu-ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n");var Fi=function(t){function e(e){return t.call(this,e)||this}return Bi(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(t){return"\n <ul class='g6-contextmenu-ul'>\n <li>菜单项1</li>\n <li>菜单项2</li>\n </ul>\n "},shouldBegin:function(t){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),e=Ur("<div class=".concat(t||"g6-component-contextmenu","></div>"));Vr(e,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),Object(p.isString)(n)&&(n=document.getElementById(n)),n.appendChild(e),this.set("menu",e)},e.prototype.onMenuShow=function(t){var e=this;t.preventDefault();var n=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&-1===n.indexOf(t.item.getType()))return void e.onMenuHide()}else if(-1===n.indexOf("canvas"))return void e.onMenuHide();if(this.get("shouldBegin")(t)){var r=this.get("menu"),i=this.get("getContent"),o=this.get("graph"),a=i(t,o);Object(p.isString)(a)?r.innerHTML=a:r.innerHTML=a.outerHTML,this.removeMenuEventListener();var s=this.get("handleMenuClick");if(s){var u=function(e){s(e.target,t.item,o)};this.set("handleMenuClickWrapper",u),r.addEventListener("click",u)}var c=o.get("width"),l=o.get("height"),f=r.getBoundingClientRect(),h=this.get("offsetX")||0,d=this.get("offsetY")||0,g=o.getContainer().offsetTop,v=o.getContainer().offsetLeft,y=t.canvasX+v+h,m=t.canvasY+g+d;y+f.width>c&&(y=t.canvasX-f.width-h+v),m+f.height>l&&(m=t.canvasY-f.height-d+g),Vr(r,{top:"".concat(m,"px"),left:"".concat(y,"px"),visibility:"visible"});var b="click"===this.get("trigger"),x=function(t){b?b=!1:e.onMenuHide()};document.body.addEventListener("click",x),this.set("handler",x)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),e=this.get("handler");t&&(this.get("menu").removeEventListener("click",t),this.set("handleMenuClickWrapper",null));e&&document.body.removeEventListener("click",e)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&Vr(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ji),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),zi=function(){return(zi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Ui=Math.max,Vi=b.a.transform,Wi=function(t){function e(e){var n=t.call(this,e)||this;return n.handleUpdateCanvas=Object(p.debounce)((function(t){var e=n;e.destroyed||e.updateCanvas()}),100,!1),n}return Gi(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,n=e.size,r=e.graph;if(!this.destroyed){var i=this.get("canvas").get("container"),o=Ur("\n <div\n class=".concat(e.viewportClassName,"\n style='position:absolute;\n left:0;\n top:0;\n box-sizing:border-box;\n outline: 2px solid #1980ff'\n draggable=true>\n </div>")),a=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,s=0,u=0,c=!1,l=0,f=0,h=0,d=0,g=0,v=0;o.addEventListener("dragstart",(function(i){var a,p;if(i.dataTransfer){var y=new Image;y.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null===(p=(a=i.dataTransfer).setDragImage)||void 0===p||p.call(a,y,0,0);try{i.dataTransfer.setData("text/html","view-port-minimap")}catch(t){i.dataTransfer.setData("text","view-port-minimap")}}if(e.refresh=!1,i.target===o){var m=o.style;l=parseInt(m.left,10),f=parseInt(m.top,10),h=parseInt(m.width,10),d=parseInt(m.height,10),h>n[0]||d>n[1]||(v=r.getZoom(),g=t.get("ratio"),c=!0,s=i.clientX,u=i.clientY)}}),!1),o.addEventListener(a?"dragover":"drag",(function(t){if(c&&!Object(p.isNil)(t.clientX)&&!Object(p.isNil)(t.clientY)){var e=s-t.clientX,i=u-t.clientY;(l-e<0||l-e+h>=n[0])&&(e=0),(f-i<0||f-i+d>=n[1])&&(i=0),f-=i,Vr(o,{left:"".concat(l-=e,"px"),top:"".concat(f,"px")}),r.translate(e*v/g,i*v/g),s=t.clientX,u=t.clientY}}),!1),o.addEventListener("dragend",(function(){c=!1,e.refresh=!0}),!1),this.set("viewport",o),i.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=(this.get("dx"),this.get("dy"),this.get("totaldx")),n=this.get("totaldy"),r=this.get("graph"),i=this.get("size"),o=r.get("width"),a=r.get("height"),s=r.getPointByCanvas(0,0),u=r.getPointByCanvas(o,a),c=this.get("viewport");c||this.initViewport();var l=(u.x-s.x)*t,f=(u.y-s.y)*t,h=s.x*t+e,d=s.y*t+n,p=h+l,g=d+f;h<0&&(l+=h,h=0),p>i[0]&&(l-=p-i[0]),d<0&&(f+=d,d=0),g>i[1]&&(f-=g-i[1]),this.set("ratio",t),Vr(c,{left:"".concat(h,"px"),top:"".concat(d,"px"),width:"".concat(l,"px"),height:"".concat(f,"px")})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,e=this.get("canvas"),n=t.get("group");if(!n.destroyed){var r=n.clone();r.resetMatrix(),e.clear(),e.add(r),"svg"===t.get("renderer")&&this.updateVisible(r)}},e.prototype.updateVisible=function(t){var e=this;if(t.isGroup()||t.get("visible")){var n=t.get("children");if(!n||!n.length)return;n.forEach((function(t){t.get("visible")||t.hide(),e.updateVisible(t)}))}else t.hide()},e.prototype.updateKeyShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();Object(p.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(p.each)(e.getNodes(),(function(e){t.updateOneNodeKeyShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(p.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,e){if(!this.destroyed){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?s=Object.assign(a,s):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)}},e.prototype.updateOneNodeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?s=Object.assign(a,s):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateDelegateShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();Object(p.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(p.each)(e.getNodes(),(function(e){t.updateOneNodeDelegateShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(p.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},e=Object.keys(t);if(e&&0!==e.length)for(var n=e.length-1;n>=0;n--){var r=t[e[n]],i=r.exist;r.exist=!1,i||(r.remove(),delete t[e[n]])}},e.prototype.updateOneEdgeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")];if(r){var i=t.get("keyShape").attr("path");r.attr("path",i)}else r=t.get("keyShape").clone(),e.add(r);t.isVisible()?r.show():r.hide(),r.exist=!0,n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateOneNodeDelegateShape=function(t,e){var n=this.get("delegateStyle"),r=this.get("itemMap")||{},i=r[t.get("id")],o=t.getBBox();if(i){var a={x:o.minX,y:o.minY,width:o.width,height:o.height};i.attr(a)}else i=e.addShape("rect",{attrs:zi({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});t.isVisible()?i.show():i.hide(),i.exist=!0,r[t.get("id")]=i,this.set("itemMap",r)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this.get("graph"),e=this.get("size"),n=this.get("className"),r=this.get("container"),i=Ur("<div class='".concat(n,"' style='width: ").concat(e[0],"px; height: ").concat(e[1],"px; overflow: hidden'></div>"));Object(p.isString)(r)&&(r=document.getElementById(r)),r?r.appendChild(i):t.get("container").appendChild(i),this.set("container",i);var o,a=Ur('<div class="g6-minimap-container" style="position: relative;"></div>');i.appendChild(a),a.addEventListener("dragenter",(function(t){t.preventDefault()})),a.addEventListener("dragover",(function(t){t.preventDefault()})),o="svg"===t.get("renderer")?new br.Canvas({container:a,width:e[0],height:e[1]}):new mr.Canvas({container:a,width:e[0],height:e[1]}),this.set("canvas",o),this.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed&&this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("size"),n=this.get("canvas"),r=this.get("type"),i=this.get("padding");if(!n.destroyed){switch(r){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var o=n.get("children")[0];if(o){o.resetMatrix();var a=o.getCanvasBBox(),s=t.get("canvas").getCanvasBBox(),u=t.getZoom()||1,c=s.width/u,l=s.height/u;Number.isFinite(a.width)&&(c=Ui(a.width,c),l=Ui(a.height,l)),c+=2*i,l+=2*i;var f=Math.min(e[0]/c,e[1]/l),h=[1,0,0,0,1,0,0,0,1],d=0,p=0;Number.isFinite(a.minX)&&(d=-a.minX),Number.isFinite(a.minY)&&(p=-a.minY);var g=(e[0]-(c-2*i)*f)/2,v=(e[1]-(l-2*i)*f)/2;h=Vi(h,[["t",d,p],["s",f,f],["t",g,v]]),o.setMatrix(h),this.set("ratio",f),this.set("totaldx",g+d*f),this.set("totaldy",v+p*f),this.set("dx",g),this.set("dy",v),this.updateViewport()}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("container");(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)},e}(ji),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Yi(t,e,n){var r=t.x-e.x,i=t.y-e.y;return!n||Math.abs(r)>n||Math.abs(i)>n?Math.sqrt(r*r+i*i):n}function Hi(t,e){var n=(e.source.y-e.target.y)/(e.source.x-e.target.x),r=(n*n*e.source.x+n*(t.y-e.source.y)+t.x)/(n*n+1);return{x:r,y:n*(r-e.source.x)+e.source.y}}var qi=function(t){function e(e){return t.call(this,e)||this}return Xi(e,t),e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),e=this.get("onTick");this.set("tick",(function(){e&&e(),t.refreshPositions()}))},e.prototype.bundling=function(t){var e=this;if(e.set("data",t),!e.isTicking()){var n=t.edges||[],r=t.nodes||[],i={},o=!1;if(r.forEach((function(t){null!==t.x&&null!==!t.y&&void 0!==t.x&&void 0!==!t.y||(o=!0),i[t.id]=t})),o)throw new Error("please layout the graph or assign x and y for nodes first");e.set("nodeIdMap",i);var a=e.get("divisions"),s=e.get("divRate"),u=e.divideEdges(a);e.set("edgePoints",u);var c=e.getEdgeBundles();e.set("edgeBundles",c);for(var l=e.get("cycles"),f=e.get("iterations"),h=e.get("iterRate"),d=e.get("lambda"),p=0;p<l;p++){for(var g=function(t){var r=[];n.forEach((function(t,n){if(t.source!==t.target){var o=i[t.source],s=i[t.target];r[n]=e.getEdgeForces({source:o,target:s},n,a,d);for(var c=0;c<a+1;c++)u[n][c].x+=r[n][c].x,u[n][c].y+=r[n][c].y}}))},v=0;v<f;v++)g();d/=2,a*=s,f*=h,u=e.divideEdges(a),e.set("edgePoints",u)}n.forEach((function(t,e){t.source!==t.target&&(t.type="polyline",t.controlPoints=u[e].slice(1,u[e].length-1))})),e.get("graph").refresh()}},e.prototype.updateBundling=function(t){var e=this,n=t.data;if(n&&e.set("data",n),e.get("ticking")&&e.set("ticking",!1),Object.keys(t).forEach((function(n){e.set(n,t[n])})),t.onTick){var r=this.get("graph");e.set("tick",(function(){t.onTick(),r.refresh()}))}e.bundling(n)},e.prototype.divideEdges=function(t){var e=this,n=e.get("data").edges,r=e.get("nodeIdMap"),i=e.get("edgePoints");return i&&void 0!==i||(i=[]),n.forEach((function(n,o){i[o]&&void 0!==i[o]||(i[o]=[]);var a=r[n.source],s=r[n.target];if(1===t)i[o].push({x:a.x,y:a.y}),i[o].push({x:.5*(a.x+s.x),y:.5*(a.y+s.y)}),i[o].push({x:s.x,y:s.y});else{var u=(i[o]&&i[o]!==[]?e.getEdgeLength(i[o]):Yi({x:a.x,y:a.y},{x:s.x,y:s.y}))/(t+1),c=u,l=[{x:a.x,y:a.y}];i[o].forEach((function(t,e){if(0!==e){for(var n=Yi(t,i[o][e-1]);n>c;){var r=c/n,a={x:i[o][e-1].x,y:i[o][e-1].y};a.x+=r*(t.x-i[o][e-1].x),a.y+=r*(t.y-i[o][e-1].y),l.push(a),n-=c,c=u}c-=n}})),l.push({x:s.x,y:s.y}),i[o]=l}})),i},e.prototype.getEdgeLength=function(t){var e=0;return t.forEach((function(n,r){0!==r&&(e+=Yi(n,t[r-1]))})),e},e.prototype.getEdgeBundles=function(){var t=this,e=t.get("data").edges||[],n=t.get("bundleThreshold"),r=t.get("nodeIdMap"),i=t.get("edgeBundles");return i||(i=[]),e.forEach((function(t,e){i[e]&&void 0!==i[e]||(i[e]=[])})),e.forEach((function(o,a){var s=r[o.source],u=r[o.target];e.forEach((function(e,o){if(!(o<=a)){var c=r[e.source],l=r[e.target];t.getBundleScore({source:s,target:u},{source:c,target:l})>=n&&(i[a].push(o),i[o].push(a))}}))})),i},e.prototype.getBundleScore=function(t,e){return t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,t.length=Yi({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),e.length=Yi({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),this.getAngleScore(t,e)*this.getScaleScore(t,e)*this.getPositionScore(t,e)*this.getVisibilityScore(t,e)},e.prototype.getAngleScore=function(t,e){return function(t,e){return t.x*e.x+t.y*e.y}({x:t.vx,y:t.vy},{x:e.vx,y:e.vy})/(t.length*e.length)},e.prototype.getScaleScore=function(t,e){var n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},e.prototype.getPositionScore=function(t,e){var n=(t.length+e.length)/2;return n/(n+Yi({x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},{x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2}))},e.prototype.getVisibilityScore=function(t,e){var n=this.getEdgeVisibility(t,e),r=this.getEdgeVisibility(e,t);return n<r?n:r},e.prototype.getEdgeVisibility=function(t,e){var n=Hi(e.source,t),r=Hi(e.target,t),i={x:(n.x+r.x)/2,y:(n.y+r.y)/2},o={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2};return Math.max(0,1-2*Yi(i,o)/Yi(n,r))},e.prototype.getEdgeForces=function(t,e,n,r){for(var i=this.get("edgePoints"),o=this.get("K")/(Yi(t.source,t.target)*(n+1)),a=[{x:0,y:0}],s=1;s<n;s++){var u={x:0,y:0},c=this.getSpringForce({pre:i[e][s-1],cur:i[e][s],next:i[e][s+1]},o),l=this.getElectrostaticForce(s,e);u.x=r*(c.x+l.x),u.y=r*(c.y+l.y),a.push(u)}return a.push({x:0,y:0}),a},e.prototype.getSpringForce=function(t,e){var n=t.pre.x+t.next.x-2*t.cur.x,r=t.pre.y+t.next.y-2*t.cur.y;return{x:n*=e,y:r*=e}},e.prototype.getElectrostaticForce=function(t,e){var n=this.get("eps"),r=this.get("edgeBundles"),i=this.get("edgePoints"),o=r[e],a={x:0,y:0};return o.forEach((function(r){var o={x:i[r][t].x-i[e][t].x,y:i[r][t].y-i[e][t].y};if(Math.abs(o.x)>n||Math.abs(o.y)>n){var s=1/Yi(i[r][t],i[e][t]);a.x+=o.x*s,a.y+=o.y*s}})),a},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),t.prototype.destroy.call(this)},e}(ji),Ki=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi=function(){return(Zi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Qi={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},$i=function(t){function e(e){return t.call(this,e)||this}return Ki(e,t),e.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Object(p.clone)(Qi),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"magnify"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"magnify"}}return t},e.prototype.init=function(){var t=this.get("r");this.set("cachedMagnifiedModels",[]),this.set("cachedOriginPositions",{}),this.set("r2",t*t);var e=this.get("d");this.set("molecularParam",(e+1)*t)},e.prototype.createDelegate=function(t){var e=this,n=this,r=n.get("delegate");r&&!r.destroyed||(n.magnify(t),(r=n.get("delegate")).on("dragstart",(function(t){n.set("delegateCenterDiff",{x:r.attr("x")-t.x,y:r.attr("y")-t.y})})),r.on("drag",(function(t){n.magnify(t)})),"wheel"===this.get("scaleDBy")&&r.on("mousewheel",(function(t){e.scaleDByWheel(t)})),"wheel"===this.get("scaleRBy")&&r.on("mousewheel",(function(t){n.scaleRByWheel(t)})))},e.prototype.scaleRByWheel=function(t){if(t&&t.originalEvent){t.preventDefault&&t.preventDefault();var e,n=this.get("graph"),r=this.get("delegate"),i=(r?{x:r.attr("x"),y:r.attr("y")}:void 0)||n.getPointByClient(t.clientX,t.clientY);e=t.originalEvent.wheelDelta<0?.95:1/.95;var o=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(o||n.get("height"))&&e>1||s<(a||.05*n.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.set("delegateCenterDiff",void 0),this.magnify(t,i)}},e.prototype.scaleRByDrag=function(t){if(t){var e,n=this.get("dragPrePos"),r=this.get("graph"),i=r.getPointByClient(t.clientX,t.clientY);e=t.x-n.x<0?.95:1/.95;var o=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(o||r.get("height"))&&e>1||s<(a||.05*r.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.magnify(t,i),this.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){if(t||t.originalEvent){t.preventDefault&&t.preventDefault();var e=0;e=t.originalEvent.wheelDelta<0?-.1:.1;var n=this.get("d")+e,r=this.get("maxD"),i=this.get("minD");if(n<r&&n>i){this.set("d",n);var o=this.get("r");this.set("molecularParam",(n+1)*o);var a=this.get("delegate"),s=a?{x:a.attr("x"),y:a.attr("y")}:void 0;this.set("delegateCenterDiff",void 0),this.magnify(t,s)}}},e.prototype.scaleDByDrag=function(t){var e=this.get("dragPrePos"),n=t.x-e.x>0?.1:-.1,r=this.get("d")+n,i=this.get("maxD"),o=this.get("minD");if(r<i&&r>o){this.set("d",r);var a=this.get("r");this.set("molecularParam",(r+1)*a),this.magnify(t)}this.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,e){this.restoreCache();var n=this.get("graph"),r=this.get("cachedMagnifiedModels"),i=this.get("cachedOriginPositions"),o=this.get("showLabel"),a=this.get("r"),s=this.get("r2"),u=this.get("d"),c=this.get("molecularParam"),l=n.getNodes(),f=l.length,h=e?{x:e.x,y:e.y}:{x:t.x,y:t.y};!this.get("dragging")||"mousemove"!==this.get("trigger")&&"click"!==this.get("trigger")||(h=this.get("cacheCenter"));var d=this.get("delegateCenterDiff");d&&(h.x+=d.x,h.y+=d.y),this.updateDelegate(h,a);for(var p=0;p<f;p++){var g=l[p].getModel(),v=g.x,y=g.y;if(!isNaN(v)&&!isNaN(y)){var m=(v-h.x)*(v-h.x)+(y-h.y)*(y-h.y);if(!isNaN(m)&&m<s&&0!==m){var b=Math.sqrt(m),x=c*b/(u*b+a),_=(v-h.x)/b,w=(y-h.y)/b;if(g.x=_*x+h.x,g.y=w*x+h.y,i[g.id]||(i[g.id]={x:v,y:y,texts:[]}),r.push(g),o&&2*b<a)for(var E=l[p].getContainer().getChildren(),S=E.length,O=0;O<S;O++){var M=E[O];"text"===M.get("type")&&(i[g.id].texts.push({visible:M.get("visible"),shape:M}),M.set("visible",!0))}}}}n.refreshPositions()},e.prototype.restoreCache=function(){for(var t=this.get("cachedMagnifiedModels"),e=this.get("cachedOriginPositions"),n=t.length,r=0;r<n;r++){var i=t[r],o=e[i.id];i.x=o.x,i.y=o.y;for(var a=o.texts.length,s=0;s<a;s++){var u=o.texts[s];u.shape.set("visible",u.visible)}}this.set("cachedMagnifiedModels",[]),this.set("cachedOriginPositions",{})},e.prototype.updateParams=function(t){var e=t.r,n=t.d,r=t.trigger,i=t.minD,o=t.maxD,a=t.minR,s=t.maxR,u=t.scaleDBy,c=t.scaleRBy;isNaN(t.r)||(this.set("r",e),this.set("r2",e*e)),isNaN(n)||this.set("d",n),isNaN(o)||this.set("maxD",o),isNaN(i)||this.set("minD",i),isNaN(s)||this.set("maxR",s),isNaN(a)||this.set("minR",a);var l,f=this.get("d"),h=this.get("r");(this.set("molecularParam",(f+1)*h),"mousemove"!==r&&"click"!==r&&"drag"!==r||this.set("trigger",r),"drag"===u||"wheel"===u||"unset"===u)&&(this.set("scaleDBy",u),this.get("delegate").remove(),this.get("delegate").destroy(),(l=this.get("dPercentText"))&&(l.remove(),l.destroy()));"drag"!==c&&"wheel"!==c&&"unset"!==c||(this.set("scaleRBy",c),this.get("delegate").remove(),this.get("delegate").destroy(),(l=this.get("dPercentText"))&&(l.remove(),l.destroy()))},e.prototype.updateDelegate=function(t,e){var n=this,r=this,i=r.get("graph"),o=r.get("delegate");if(!o||o.destroyed){var a=i.get("group"),s=r.get("delegateStyle")||Qi;o=a.addShape("circle",{attrs:Zi({r:e/1.5,x:t.x,y:t.y},s),name:"lens-shape",draggable:!0}),"drag"!==this.get("trigger")&&("wheel"===this.get("scaleRBy")?o.on("mousewheel",(function(t){r.scaleRByWheel(t)})):"drag"===this.get("scaleRBy")&&(o.on("dragstart",(function(t){r.set("dragging",!0),r.set("cacheCenter",{x:t.x,y:t.y}),r.set("dragPrePos",{x:t.x,y:t.y})})),o.on("drag",(function(t){r.scaleRByDrag(t)})),o.on("dragend",(function(t){r.set("dragging",!1)}))),"wheel"===this.get("scaleDBy")?o.on("mousewheel",(function(t){n.scaleDByWheel(t)})):"drag"===this.get("scaleDBy")&&(o.on("dragstart",(function(t){r.set("dragging",!0),r.set("cacheCenter",{x:t.x,y:t.y}),r.set("dragPrePos",{x:t.x,y:t.y})})),o.on("drag",(function(t){n.scaleDByDrag(t)})),o.on("dragend",(function(t){r.set("dragging",!1)}))))}else o.attr({x:t.x,y:t.y,r:e/1.5});if(r.get("showDPercent")){var u=Math.round((r.get("d")-r.get("minD"))/(r.get("maxD")-r.get("minD"))*100),c=r.get("dPercentText"),l=t.y+e/1.5+16;if(!c||c.destroyed)c=i.get("group").addShape("text",{attrs:{text:"".concat(u,"%"),x:t.x,y:l,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),r.set("dPercentText",c);else c.attr({text:"".concat(u,"%"),x:t.x,y:l})}r.set("delegate",o)},e.prototype.clear=function(){var t=this.get("graph");this.restoreCache(),t.refreshPositions();var e=this.get("delegate");e&&!e.destroyed&&(e.remove(),e.destroy());var n=this.get("dPercentText");n&&!n.destroyed&&(n.remove(),n.destroy())},e.prototype.destroy=function(){this.clear()},e}(ji),Ji=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-toolbar {\n position: absolute;\n list-style-type: none;\n padding: 6px;\n left: 0px;\n top: 0px;\n background-color: rgba(255, 255, 255, 0.9);\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n margin: 0;\n }\n .g6-component-toolbar li {\n float: left;\n text-align: center;\n width: 35px;\n height: 24px;\n cursor: pointer;\n\t\tlist-style-type:none;\n list-style: none;\n margin-left: 0px;\n }\n .g6-component-toolbar li .icon {\n opacity: 0.7;\n }\n .g6-component-toolbar li .icon:hover {\n opacity: 1;\n }\n");var to=function(t){function e(e){return t.call(this,e)||this}return Ji(e,t),e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(t){return'\n <ul class=\'g6-component-toolbar\'>\n <li code=\'redo\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>\n </svg>\n </li>\n <li code=\'undo\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>\n </svg>\n </li>\n <li code=\'zoomOut\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>\n </svg>\n </li>\n <li code=\'zoomIn\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">\n <path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>\n </svg>\n </li>\n <li code=\'realZoom\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">\n <path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>\n </svg>\n </li>\n <li code=\'autoZoom\'>\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">\n <path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>\n </svg>\n </li>\n </ul>\n '},zoomSensitivity:2}},e.prototype.init=function(){var t=this,e=this.get("graph"),n=this.get("getContent")(e),r=n;Object(p.isString)(n)&&(r=Ur(n));var i=this.get("className");r.setAttribute("class",i||"g6-component-toolbar");var o=this.get("container");o||(o=this.get("graph").get("container")),Object(p.isString)(o)&&(o=document.getElementById(o)),o.appendChild(r),this.set("toolBar",r);var a=this.get("handleClick");r.addEventListener("click",(function(n){var r=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;){if(e.push(n),"HTML"===n.tagName)return e.push(document,window),e;n=n.parentElement}return e}(n).filter((function(t){return"LI"===t.nodeName}));if(0!==r.length){var i=r[0].getAttribute("code");i&&(a?a(i,e):t.handleDefaultOperator(i,e))}}));var s=this.get("position");s&&Vr(r,{top:"".concat(s.y,"px"),left:"".concat(s.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),e=document.querySelector('.g6-component-toolbar li[code="undo"]'),n=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),r=document.querySelector('.g6-component-toolbar li[code="redo"]'),i=document.querySelector('.g6-component-toolbar li[code="redo"] svg');e&&n&&r&&i&&t.on("stackchange",(function(t){var o=t.undoStack,a=t.redoStack,s=o.length,u=a.length;1===s?(e.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(e.removeAttribute("style"),n.removeAttribute("style")),0===u?(r.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),i.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),e=t.getUndoStack();if(e&&1!==e.length){var n=e.pop();if(n){var r=n.action;t.pushStack(r,Object(p.clone)(n.data),"redo");var i=n.data.before;if("add"===r&&(i=n.data.after),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateItem(e.id,e,!1)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.removeItem(e.id,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}))}}}},e.prototype.redo=function(){var t=this.get("graph"),e=t.getRedoStack();if(e&&0!==e.length){var n=e.pop();if(n){var r=n.action,i=n.data.after;if(t.pushStack(r,Object(p.clone)(n.data)),"delete"===r&&(i=n.data.before),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateItem(e.id,e,!1)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":i.edges&&i.edges.forEach((function(e){t.removeItem(e.id,!1)})),i.nodes&&i.nodes.forEach((function(e){t.removeItem(e.id,!1)})),i.combos&&i.combos.forEach((function(e){t.removeItem(e.id,!1)}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}))}}}},e.prototype.handleDefaultOperator=function(t,e){var n=e.getZoom();switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":var r=1/(1-.05*this.get("zoomSensitivity"));if(r*n>(this.get("maxZoom")||e.get("maxZoom")))return;e.zoomTo(n*r);break;case"zoomIn":var i=1-.05*this.get("zoomSensitivity");if(i*n<(this.get("minZoom")||e.get("minZoom")))return;e.zoomTo(n*i);break;case"realZoom":e.zoomTo(1);break;case"autoZoom":e.fitView([20,20])}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}var n=this.get("handleClick");n&&t.removeEventListener("click",n)},e}(ji),eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Ri()("\n .g6-component-tooltip {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .tooltip-type {\n padding: 0;\n margin: 0;\n }\n .tooltip-id {\n color: #531dab;\n }\n");var no=function(t){function e(e){return t.call(this,e)||this}return eo(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(t){return"\n <h4 class='tooltip-type'>类型:".concat(t.item.getType(),"</h4>\n <span class='tooltip-id'>ID:").concat(t.item.getID(),"</span>\n ")},shouldBegin:function(t){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,e=t.get("className")||"g6-component-tooltip",n=Ur("<div class=".concat(e,"></div>")),r=t.get("container");r||(r=t.get("graph").get("container")),Object(p.isString)(r)&&(r=document.getElementById(r)),Vr(n,{position:"absolute",visibility:"hidden",display:"none"}),r.appendChild(n),"click"!==t.get("trigger")&&(n.addEventListener("mouseenter",(function(t){Vr(n,{visibility:"visible",display:"unset"})})),n.addEventListener("mouseleave",(function(e){t.hideTooltip()}))),t.set("tooltip",n)},e.prototype.onClick=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),r.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var e=this.get("itemTypes");t.item&&t.item.getType&&-1===e.indexOf(t.item.getType())||this.currentTarget&&t.item===this.currentTarget&&this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip(),this.get("graph").emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var e=this.get("itemTypes");if(!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=this.get("tooltip"),r=this.get("getContent")(t);Object(p.isString)(r)?n.innerHTML=r:(this.clearContainer(),n.appendChild(r)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&Vr(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var e=this.get("shouldBegin"),n=this.get("tooltip");if(e(t)){var r=this.get("graph"),i=r.get("width"),o=r.get("height"),a=this.get("offsetX")||0,s=this.get("offsetY")||0,u=r.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),l=t.item;if(l.getType&&"node"===l.getType()&&c&&Object(p.isArray)(c)&&c.length>=2){var f=l.getBBox();u={x:f.minX+f.width*c[0],y:f.minY+f.height*c[1]}}var h=r.getCanvasByPoint(u.x,u.y),d=h.x,g=h.y,v=r.getContainer(),y={x:d+v.offsetLeft+a,y:g+v.offsetTop+s};Vr(n,{visibility:"visible",display:"unset"});var m=n.getBoundingClientRect();d+m.width+a>i&&(y.x-=m.width+a),g+m.height+s>o&&(y.y-=m.height+s),Vr(n,{left:"".concat(y.x,"px"),top:"".concat(y.y,"px")})}else Vr(n,{visibility:"hidden",display:"none"})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(p.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ji),ro={};function io(t,e){ro[t]=e}var oo=function(){function t(t){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=t,this.initCfg(),this.init()}return t.prototype.translate=function(t){return t},t.prototype.change=function(t){Object(p.assign)(this.__cfg__,t),this.init()},t.prototype.clone=function(){return this.constructor(this.__cfg__)},t.prototype.getTicks=function(){var t=this;return Object(p.map)(this.ticks,(function(e,n){return Object(p.isObject)(e)?e:{text:t.getText(e,n),tickValue:e,value:t.scale(e)}}))},t.prototype.getText=function(t,e){var n=this.formatter,r=n?n(t,e):t;return Object(p.isNil)(r)||!Object(p.isFunction)(r.toString)?"":r.toString()},t.prototype.getConfig=function(t){return this.__cfg__[t]},t.prototype.init=function(){Object(p.assign)(this,this.__cfg__),this.setDomain(),Object(p.isEmpty)(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},t.prototype.initCfg=function(){},t.prototype.setDomain=function(){},t.prototype.calculateTicks=function(){var t=this.tickMethod,e=[];if(Object(p.isString)(t)){var n=ro[t];if(!n)throw new Error("There is no method to to calculate ticks!");e=n(this)}else Object(p.isFunction)(t)&&(e=t(this));return e},t.prototype.rangeMin=function(){return this.range[0]},t.prototype.rangeMax=function(){return this.range[1]},t.prototype.calcPercent=function(t,e,n){return Object(p.isNumber)(t)?(t-e)/(n-e):NaN},t.prototype.calcValue=function(t,e,n){return e+t*(n-e)},t}(),ao=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cat",e.isCategory=!0,e}return Object(d.__extends)(e,t),e.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var t=0;t<this.values.length;t++)this.translateIndexMap.set(this.values[t],t)}},e.prototype.translate=function(t){this.buildIndexMap();var e=this.translateIndexMap.get(t);return void 0===e&&(e=Object(p.isNumber)(t)?t:NaN),e},e.prototype.scale=function(t){var e=this.translate(t),n=this.calcPercent(e,this.min,this.max);return this.calcValue(n,this.rangeMin(),this.rangeMax())},e.prototype.invert=function(t){var e=this.max-this.min,n=this.calcPercent(t,this.rangeMin(),this.rangeMax()),r=Math.round(e*n)+this.min;return r<this.min||r>this.max?NaN:this.values[r]},e.prototype.getText=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=e;return Object(p.isNumber)(e)&&!this.values.includes(e)&&(i=this.values[i]),t.prototype.getText.apply(this,Object(d.__spreadArray)([i],n,!1))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(Object(p.isNil)(this.getConfig("min"))&&(this.min=0),Object(p.isNil)(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(oo),so=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,uo="[^\\s]+",co=/\[([^]*?)\]/gm;function lo(t,e){for(var n=[],r=0,i=t.length;r<i;r++)n.push(t[r].substr(0,e));return n}var fo=function(t){return function(e,n){var r=n[t].map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase());return r>-1?r:null}};function ho(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,i=e;r<i.length;r++){var o=i[r];for(var a in o)t[a]=o[a]}return t}var po=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],go=["January","February","March","April","May","June","July","August","September","October","November","December"],vo=lo(go,3),yo={dayNamesShort:lo(po,3),dayNames:po,monthNamesShort:vo,monthNames:go,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10?1:0)*t%10]}},mo=ho({},yo),bo=function(t){return mo=ho(mo,t)},xo=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},_o=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t},wo={D:function(t){return String(t.getDate())},DD:function(t){return _o(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return _o(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return _o(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return _o(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return _o(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return _o(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return _o(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return _o(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return _o(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return _o(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return _o(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+_o(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+_o(Math.floor(Math.abs(e)/60),2)+":"+_o(Math.abs(e)%60,2)}},Eo=function(t){return+t-1},So=[null,"[1-9]\\d?"],Oo=[null,uo],Mo=["isPm",uo,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],ko=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],Ao={D:["day","[1-9]\\d?"],DD:["day","\\d\\d"],Do:["day","[1-9]\\d?"+uo,function(t){return parseInt(t,10)}],M:["month","[1-9]\\d?",Eo],MM:["month","\\d\\d",Eo],YY:["year","\\d\\d",function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour","[1-9]\\d?",void 0,"isPm"],hh:["hour","\\d\\d",void 0,"isPm"],H:["hour","[1-9]\\d?"],HH:["hour","\\d\\d"],m:["minute","[1-9]\\d?"],mm:["minute","\\d\\d"],s:["second","[1-9]\\d?"],ss:["second","\\d\\d"],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond","\\d\\d",function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:So,dd:So,ddd:Oo,dddd:Oo,MMM:["month",uo,fo("monthNamesShort")],MMMM:["month",uo,fo("monthNames")],a:Mo,A:Mo,ZZ:ko,Z:ko},Co={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},To=function(t){return ho(Co,t)},Io=function(t,e,n){if(void 0===e&&(e=Co.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var r=[];e=(e=Co[e]||e).replace(co,(function(t,e){return r.push(e),"@@@"}));var i=ho(ho({},mo),n);return(e=e.replace(so,(function(e){return wo[e](t,i)}))).replace(/@@@/g,(function(){return r.shift()}))};function jo(t,e,n){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=Co[e]||e,t.length>1e3)return null;var r={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},i=[],o=[],a=e.replace(co,(function(t,e){return o.push(xo(e)),"@@@"})),s={},u={};a=xo(a).replace(so,(function(t){var e=Ao[t],n=e[0],r=e[1],o=e[3];if(s[n])throw new Error("Invalid format. "+n+" specified twice in format");return s[n]=!0,o&&(u[o]=!0),i.push(e),"("+r+")"})),Object.keys(u).forEach((function(t){if(!s[t])throw new Error("Invalid format. "+t+" is required in specified format")})),a=a.replace(/@@@/g,(function(){return o.shift()}));var c=t.match(new RegExp(a,"i"));if(!c)return null;for(var l=ho(ho({},mo),n),f=1;f<c.length;f++){var h=i[f-1],d=h[0],p=h[2],g=p?p(c[f],l):+c[f];if(null==g)return null;r[d]=g}1===r.isPm&&null!=r.hour&&12!=+r.hour?r.hour=+r.hour+12:0===r.isPm&&12==+r.hour&&(r.hour=0);for(var v=new Date(r.year,r.month,r.day,r.hour,r.minute,r.second,r.millisecond),y=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],m=(f=0,y.length);f<m;f++)if(s[y[f][0]]&&r[y[f][0]]!==v[y[f][1]]())return null;return null==r.timezoneOffset?v:new Date(Date.UTC(r.year,r.month,r.day,r.hour,r.minute-r.timezoneOffset,r.second,r.millisecond))}var Po={format:Io,parse:jo,defaultI18n:yo,setGlobalDateI18n:bo,setGlobalDateMasks:To};function No(t,e){return(h.format||Po.format)(t,e)}function Do(t){return Object(p.isString)(t)&&(t=t.indexOf("T")>0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),Object(p.isDate)(t)&&(t=t.getTime()),t}var Lo=36e5,Ro=24*Lo,Bo=31*Ro,Fo=[["HH:mm:ss",1e3],["HH:mm:ss",1e4],["HH:mm:ss",3e4],["HH:mm",6e4],["HH:mm",6e5],["HH:mm",18e5],["HH",Lo],["HH",6*Lo],["HH",12*Lo],["YYYY-MM-DD",Ro],["YYYY-MM-DD",4*Ro],["YYYY-WW",7*Ro],["YYYY-MM",Bo],["YYYY-MM",4*Bo],["YYYY-MM",6*Bo],["YYYY",380*Ro]];function Go(t,e,n){var r,i=(r=function(t){return t[1]},function(t,e,n,i){for(var o=Object(p.isNil)(n)?0:n,a=Object(p.isNil)(i)?t.length:i;o<a;){var s=o+a>>>1;r(t[s])>e?a=s:o=s+1}return o})(Fo,(e-t)/n)-1,o=Fo[i];return i<0?o=Fo[0]:i>=Fo.length&&(o=Object(p.last)(Fo)),o}var zo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeCat",e}return Object(d.__extends)(e,t),e.prototype.translate=function(t){t=Do(t);var e=this.values.indexOf(t);return-1===e&&(e=Object(p.isNumber)(t)&&t<this.values.length?t:NaN),e},e.prototype.getText=function(t,e){var n=this.translate(t);if(n>-1){var r=this.values[n],i=this.formatter;return r=i?i(r,e):No(r,this.mask)}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var e=this.values;Object(p.each)(e,(function(t,n){e[n]=Do(t)})),e.sort((function(t,e){return t-e})),t.prototype.setDomain.call(this)},e}(ao),Uo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isContinuous=!0,e}return Object(d.__extends)(e,t),e.prototype.scale=function(t){if(Object(p.isNil)(t))return NaN;var e=this.rangeMin(),n=this.rangeMax();return this.max===this.min?e:e+this.getScalePercent(t)*(n-e)},e.prototype.init=function(){t.prototype.init.call(this);var e=this.ticks,n=Object(p.head)(e),r=Object(p.last)(e);n<this.min&&(this.min=n),r>this.max&&(this.max=r),Object(p.isNil)(this.minLimit)||(this.min=n),Object(p.isNil)(this.maxLimit)||(this.max=r)},e.prototype.setDomain=function(){var t=Object(p.getRange)(this.values),e=t.min,n=t.max;Object(p.isNil)(this.min)&&(this.min=e),Object(p.isNil)(this.max)&&(this.max=n),this.min>this.max&&(this.min=e,this.max=n)},e.prototype.calculateTicks=function(){var e=this,n=t.prototype.calculateTicks.call(this);return this.nice||(n=Object(p.filter)(n,(function(t){return t>=e.min&&t<=e.max}))),n},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;return(t-n)/(e-n)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(oo),Vo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t);return this.min+e*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(Uo);function Wo(t,e){var n=Math.E;return e>=0?Math.pow(n,Math.log(e)/t):-1*Math.pow(n,Math.log(-e)/t)}function Xo(t,e){return 1===t?1:Math.log(e)/Math.log(t)}function Yo(t,e,n){Object(p.isNil)(n)&&(n=Math.max.apply(null,t));var r=n;return Object(p.each)(t,(function(t){t>0&&t<r&&(r=t)})),r===n&&(r=n/e),r>1&&(r=1),r}var Ho=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e,n=this.base,r=Xo(n,this.max),i=this.rangeMin(),o=this.rangeMax()-i,a=this.positiveMin;if(a){if(0===t)return 0;var s=1/(r-(e=Xo(n,a/n)))*o;if(t<s)return t/s*a}else e=Xo(n,this.min);var u=(t-i)/o*(r-e)+e;return Math.pow(n,u)},e.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},e.prototype.setDomain=function(){t.prototype.setDomain.call(this);var e=this.min;if(e<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");0===e&&(this.positiveMin=Yo(this.values,this.base,this.max))},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;if(e===n)return 0;if(t<=0)return 0;var r=this.base,i=this.positiveMin;return i&&(n=1*i/r),t<i?t/i/(Xo(r,e)-Xo(r,n)):(Xo(r,t)-Xo(r,n))/(Xo(r,e)-Xo(r,n))},e}(Uo),qo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="pow",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t),n=this.exponent,r=Wo(n,this.max),i=Wo(n,this.min),o=e*(r-i)+i,a=o>=0?1:-1;return Math.pow(o,n)*a},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;if(e===n)return 0;var r=this.exponent;return(Wo(r,t)-Wo(r,n))/(Wo(r,e)-Wo(r,n))},e}(Uo),Ko=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="time",e}return Object(d.__extends)(e,t),e.prototype.getText=function(t,e){var n=this.translate(t),r=this.formatter;return r?r(n,e):No(n,this.mask)},e.prototype.scale=function(e){var n=e;return(Object(p.isString)(n)||Object(p.isDate)(n))&&(n=this.translate(n)),t.prototype.scale.call(this,n)},e.prototype.translate=function(t){return Do(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,e=this.getConfig("min"),n=this.getConfig("max");if(Object(p.isNil)(e)&&Object(p.isNumber)(e)||(this.min=this.translate(this.min)),Object(p.isNil)(n)&&Object(p.isNumber)(n)||(this.max=this.translate(this.max)),t&&t.length){var r=[],i=1/0,o=i,a=0;Object(p.each)(t,(function(t){var e=Do(t);if(isNaN(e))throw new TypeError("Invalid Time: "+t+" in time scale!");i>e?(o=i,i=e):o>e&&(o=e),a<e&&(a=e),r.push(e)})),t.length>1&&(this.minTickInterval=o-i),Object(p.isNil)(e)&&(this.min=i),Object(p.isNil)(n)&&(this.max=a)}},e}(Vo),Zo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantize",e}return Object(d.__extends)(e,t),e.prototype.invert=function(t){var e=this.ticks,n=e.length,r=this.getInvertPercent(t),i=Math.floor(r*(n-1));if(i>=n-1)return Object(p.last)(e);if(i<0)return Object(p.head)(e);var o=e[i],a=i/(n-1);return o+(r-a)/((i+1)/(n-1)-a)*(e[i+1]-o)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var e=t.prototype.calculateTicks.call(this);return this.nice||(Object(p.last)(e)!==this.max&&e.push(this.max),Object(p.head)(e)!==this.min&&e.unshift(this.min)),e},e.prototype.getScalePercent=function(t){var e=this.ticks;if(t<Object(p.head)(e))return 0;if(t>Object(p.last)(e))return 1;var n=0;return Object(p.each)(e,(function(e,r){if(!(t>=e))return!1;n=r})),n/(e.length-1)},e}(Uo),Qo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantile",e}return Object(d.__extends)(e,t),e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(Zo),$o={};function Jo(t,e){if(function(t){return $o[t]}(t))throw new Error("type '"+t+"' existed.");$o[t]=e}var ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return Object(d.__extends)(e,t),e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&Object(p.isNumber)(t)?t:this.range[0]},e.prototype.invert=function(t){var e=this.range;return t<e[0]||t>e[1]?NaN:this.values[0]},e}(oo);function ea(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}var na=[1,5,2,2.5,4,3],ra=100*Number.EPSILON;function ia(t,e,n,r,i,o){var a=Object(p.size)(e),s=Object(p.indexOf)(e,t),u=0,c=function(t,e){return(t%e+e)%e}(r,o);return(c<ra||o-c<ra)&&r<=0&&i>=0&&(u=1),1-s/(a-1)-n+u}function oa(t,e,n){var r=Object(p.size)(e);return 1-Object(p.indexOf)(e,t)/(r-1)-n+1}function aa(t,e,n,r,i,o){var a=(t-1)/(o-i),s=(e-1)/(Math.max(o,r)-Math.min(n,i));return 2-Math.max(a/s,s/a)}function sa(t,e){return t>=e?2-(t-1)/(e-1):1}function ua(t,e,n,r){var i=e-t;return 1-.5*(Math.pow(e-r,2)+Math.pow(t-n,2))/Math.pow(.1*i,2)}function ca(t,e,n){var r=e-t;if(n>r){var i=(n-r)/2;return 1-Math.pow(i,2)/Math.pow(.1*r,2)}return 1}function la(t,e,n,r,i,o){void 0===n&&(n=5),void 0===r&&(r=!0),void 0===i&&(i=na),void 0===o&&(o=[.25,.2,.5,.05]);var a=n<0?0:Math.round(n);if(Number.isNaN(t)||Number.isNaN(e)||"number"!=typeof t||"number"!=typeof e||!a)return{min:0,max:0,ticks:[]};if(e-t<1e-15||1===a)return{min:t,max:e,ticks:[t]};for(var s={score:-2,lmin:0,lmax:0,lstep:0},u=1;u<1/0;){for(var c=0;c<i.length;c+=1){var l=i[c],f=oa(l,i,u);if(o[0]*f+o[1]+o[2]+o[3]<s.score){u=1/0;break}for(var h=2;h<1/0;){var d=sa(h,a);if(o[0]*f+o[1]+o[2]*d+o[3]<s.score)break;for(var g=(e-t)/(h+1)/u/l,v=Math.ceil(Math.log10(g));v<1/0;){var y=u*l*Math.pow(10,v),m=ca(t,e,y*(h-1));if(o[0]*f+o[1]*m+o[2]*d+o[3]<s.score)break;var b=Math.floor(e/y)*u-(h-1)*u,x=Math.ceil(t/y)*u;if(b<=x)for(var _=x-b,w=0;w<=_;w+=1){var E=(b+w)*(y/u),S=E+y*(h-1),O=y,M=ia(l,i,u,E,S,O),k=ua(t,e,E,S),A=aa(h,a,t,e,E,S),C=o[0]*M+o[1]*k+o[2]*A+1*o[3];C>s.score&&(!r||E<=t&&S>=e)&&(s.lmin=E,s.lmax=S,s.lstep=O,s.score=C)}v+=1}h+=1}}u+=1}var T=ea(s.lmax),I=ea(s.lmin),j=ea(s.lstep),P=Math.floor(function(t){return Math.round(1e12*t)/1e12}((T-I)/j))+1,N=new Array(P);N[0]=ea(I);for(c=1;c<P;c++)N[c]=ea(N[c-1]+j);return{min:Math.min(t,Object(p.head)(N)),max:Math.max(e,Object(p.last)(N)),ticks:N}}function fa(t){var e=t.values,n=t.tickInterval,r=t.tickCount,i=e;if(Object(p.isNumber)(n))return Object(p.filter)(i,(function(t,e){return e%n==0}));var o=t.min,a=t.max;if(Object(p.isNil)(o)&&(o=0),Object(p.isNil)(a)&&(a=e.length-1),Object(p.isNumber)(r)&&r<a-o){var s=la(o,a,r,!1,[1,2,5,3,4,7,6,8,9]).ticks;return Object(p.filter)(s,(function(t){return t>=o&&t<=a})).map((function(t){return e[t]}))}return e.slice(o,a+1)}var ha=Math.sqrt(50),da=Math.sqrt(10),pa=Math.sqrt(2),ga=function(){function t(){this._domain=[0,1]}return t.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},t.prototype.nice=function(t){var e,n;void 0===t&&(t=5);var r,i=this._domain.slice(),o=0,a=this._domain.length-1,s=this._domain[o],u=this._domain[a];return u<s&&(s=(e=[u,s])[0],u=e[1],o=(n=[a,o])[0],a=n[1]),(r=va(s,u,t))>0?r=va(s=Math.floor(s/r)*r,u=Math.ceil(u/r)*r,t):r<0&&(r=va(s=Math.ceil(s*r)/r,u=Math.floor(u*r)/r,t)),r>0?(i[o]=Math.floor(s/r)*r,i[a]=Math.ceil(u/r)*r,this.domain(i)):r<0&&(i[o]=Math.ceil(s*r)/r,i[a]=Math.floor(u*r)/r,this.domain(i)),this},t.prototype.ticks=function(t){return void 0===t&&(t=5),function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];(r=e<t)&&(i=t,t=e,e=i);if(0===(a=va(t,e,n))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s<i;)o[s]=(t+s)*a;else for(t=Math.floor(t*a),e=Math.ceil(e*a),o=new Array(i=Math.ceil(t-e+1));++s<i;)o[s]=(t-s)/a;r&&o.reverse();return o}(this._domain[0],this._domain[this._domain.length-1],t||5)},t}();function va(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=ha?10:o>=da?5:o>=pa?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ha?10:o>=da?5:o>=pa?2:1)}function ya(t,e,n){return("ceil"===n?Math.ceil(t/e):"floor"===n?Math.floor(t/e):Math.round(t/e))*e}function ma(t,e,n){var r=ya(t,n,"floor"),i=ya(e,n,"ceil");r=Object(p.fixedBase)(r,n),i=Object(p.fixedBase)(i,n);for(var o=[],a=r;a<=i;a+=n){var s=Object(p.fixedBase)(a,n);o.push(s)}return{min:r,max:i,ticks:o}}function ba(t,e,n){var r,i=t.minLimit,o=t.maxLimit,a=t.min,s=t.max,u=t.tickCount,c=void 0===u?5:u,l=Object(p.isNil)(i)?Object(p.isNil)(e)?a:e:i,f=Object(p.isNil)(o)?Object(p.isNil)(n)?s:n:o;if(l>f&&(f=(r=[l,f])[0],l=r[1]),c<=2)return[l,f];for(var h=(f-l)/(c-1),d=[],g=0;g<c;g++)d.push(l+h*g);return d}function xa(t,e,n){if(void 0===n&&(n=5),t===e)return{max:e,min:t,ticks:[t]};var r=n<0?0:Math.round(n);if(0===r)return{max:e,min:t,ticks:[]};var i=(e-t)/r,o=Math.pow(10,Math.floor(Math.log10(i))),a=o;2*o-i<1.5*(i-a)&&5*o-i<2.75*(i-(a=2*o))&&10*o-i<1.5*(i-(a=5*o))&&(a=10*o);for(var s=Math.ceil(e/a),u=Math.floor(t/a),c=Math.max(s*a,e),l=Math.min(u*a,t),f=Math.floor((c-l)/a)+1,h=new Array(f),d=0;d<f;d++)h[d]=ea(l+d*a);return{min:l,max:c,ticks:h}}function _a(t,e){var n=t.length*e;return 1===e?t[t.length-1]:0===e?t[0]:n%1!=0?t[Math.ceil(n)-1]:t.length%2==0?(t[n-1]+t[n])/2:t[n]}function wa(t){return new Date(t).getFullYear()}function Ea(t){return new Date(t,0,1).getTime()}function Sa(t){return new Date(t).getMonth()}function Oa(t,e){return new Date(t,e,1).getTime()}io("cat",fa),io("time-cat",(function(t){var e=fa(t),n=Object(p.last)(t.values);return n!==Object(p.last)(e)&&e.push(n),e})),io("wilkinson-extended",(function(t){var e=t.min,n=t.max,r=t.tickCount,i=t.nice,o=t.tickInterval,a=t.minLimit,s=t.maxLimit,u=la(e,n,r,i).ticks;return Object(p.isNil)(a)&&Object(p.isNil)(s)?o?ma(e,n,o).ticks:u:ba(t,Object(p.head)(u),Object(p.last)(u))})),io("r-pretty",(function(t){var e=t.min,n=t.max,r=t.tickCount,i=t.tickInterval,o=t.minLimit,a=t.maxLimit,s=xa(e,n,r).ticks;return Object(p.isNil)(o)&&Object(p.isNil)(a)?i?ma(e,n,i).ticks:s:ba(t,Object(p.head)(s),Object(p.last)(s))})),io("time",(function(t){var e=t.min,n=t.max,r=t.minTickInterval,i=t.tickInterval,o=t.tickCount;if(i)o=Math.ceil((n-e)/i);else{var a=(n-e)/(i=Go(e,n,o)[1])/o;a>1&&(i*=Math.ceil(a)),r&&i<r&&(i=r)}for(var s=[],u=e;u<n+i;u+=i)s.push(u);return s})),io("time-pretty",(function(t){var e=t.min,n=t.max,r=t.minTickInterval,i=t.tickCount,o=t.tickInterval,a=[];o||(o=(n-e)/i,r&&o<r&&(o=r));var s=wa(e);if(o>31536e6)for(var u=wa(n),c=Math.ceil(o/31536e6),l=s;l<=u+c;l+=c)a.push(Ea(l));else if(o>Bo){var f=Math.ceil(o/Bo),h=Sa(e),d=function(t,e){var n=wa(t),r=wa(e),i=Sa(t);return 12*(r-n)+(Sa(e)-i)%12}(e,n);for(l=0;l<=d+f;l+=f)a.push(Oa(s,l+h))}else if(o>Ro){var p=(b=new Date(e)).getFullYear(),g=b.getMonth(),v=b.getDate(),y=Math.ceil(o/Ro),m=function(t,e){return Math.ceil((e-t)/Ro)}(e,n);for(l=0;l<m+y;l+=y)a.push(new Date(p,g,v+l).getTime())}else if(o>Lo){p=(b=new Date(e)).getFullYear(),g=b.getMonth(),y=b.getDate();var b,x=b.getHours(),_=Math.ceil(o/Lo),w=function(t,e){return Math.ceil((e-t)/Lo)}(e,n);for(l=0;l<=w+_;l+=_)a.push(new Date(p,g,y,x+l).getTime())}else if(o>6e4){var E=function(t,e){return Math.ceil((e-t)/6e4)}(e,n),S=Math.ceil(o/6e4);for(l=0;l<=E+S;l+=S)a.push(e+6e4*l)}else{var O=o;O<1e3&&(O=1e3);var M=1e3*Math.floor(e/1e3),k=Math.ceil((n-e)/1e3),A=Math.ceil(O/1e3);for(l=0;l<k+A;l+=A)a.push(M+1e3*l)}return a.length>=512&&console.warn("Notice: current ticks length("+a.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+o+") is too small, increase the value to solve the problem!"),a})),io("log",(function(t){var e,n=t.base,r=t.tickCount,i=t.min,o=t.max,a=t.values,s=Xo(n,o);if(i>0)e=Math.floor(Xo(n,i));else{var u=Yo(a,n,o);e=Math.floor(Xo(n,u))}for(var c=s-e,l=Math.ceil(c/r),f=[],h=e;h<s+l;h+=l)f.push(Math.pow(n,h));return i<=0&&f.unshift(0),f})),io("pow",(function(t){var e=t.exponent,n=t.tickCount,r=Math.ceil(Wo(e,t.max));return xa(Math.floor(Wo(e,t.min)),r,n).ticks.map((function(t){var n=t>=0?1:-1;return Math.pow(t,e)*n}))})),io("quantile",(function(t){var e=t.tickCount,n=t.values;if(!n||!n.length)return[];for(var r=n.slice().sort((function(t,e){return t-e})),i=[],o=0;o<e;o++){var a=o/(e-1);i.push(_a(r,a))}return i})),io("d3-linear",(function(t){var e=t.min,n=t.max,r=t.tickInterval,i=t.minLimit,o=t.maxLimit,a=function(t){var e=t.min,n=t.max,r=t.nice,i=t.tickCount,o=new ga;return o.domain([e,n]),r&&o.nice(i),o.ticks(i)}(t);return Object(p.isNil)(i)&&Object(p.isNil)(o)?r?ma(e,n,r).ticks:a:ba(t,Object(p.head)(a),Object(p.last)(a))})),Jo("cat",ao),Jo("category",ao),Jo("identity",ta),Jo("linear",Vo),Jo("log",Ho),Jo("pow",qo),Jo("time",Ko),Jo("timeCat",zo),Jo("quantize",Zo),Jo("quantile",Qo);var Ma=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function ka(t){return function(t){return Object(p.map)(t,(function(t,e){return[0===e?"M":"L",t[0],t[1]]}))}(t)}function Aa(t,e,n,r){void 0===r&&(r=!0);var i=new Vo({values:t}),o=new ao({values:Object(p.map)(t,(function(t,e){return e}))}),a=Object(p.map)(t,(function(t,r){return[o.scale(r)*e,n-i.scale(t)*n]}));return r?function(t){if(t.length<=2)return ka(t);var e=[];Object(p.each)(t,(function(t){Object(p.isEqual)(t,e.slice(e.length-2))||e.push(t[0],t[1])}));var n=_n.a(e,!1),r=Object(p.head)(t),i=r[0],o=r[1];return n.unshift(["M",i,o]),n}(a):ka(a)}function Ca(t,e,n,r){void 0===r&&(r=5);for(var i=new Vo({values:t}),o=new ao({values:Object(p.map)(t,(function(t,e){return e}))}),a=Object(p.map)(t,(function(t,r){return[o.scale(r)*e,n-i.scale(t)*n]})),s=[],u=0;u<a.length;u++){var c=a[u],l=Ia({x:c[0],y:c[1],y0:n,size:r});s.push.apply(s,l)}return function(t,e){void 0===e&&(e=!0);var n=[],r=t[0];n.push(["M",r.x,r.y]);for(var i=1,o=t.length;i<o;i++)n.push(["L",t[i].x,t[i].y]);e&&(n.push(["L",r.x,r.y]),n.push(["z"]));return n}(s)}function Ta(t,e,n,r){var i=Ma([],t,!0),o=function(t,e){var n=new Vo({values:t}),r=Math.max(0,n.min);return e-n.scale(r)*e}(r,n);return i.push(["L",e,o]),i.push(["L",0,o]),i.push(["Z"]),i}function Ia(t){var e,n,r,i,o=t.x,a=t.y,s=t.y0,u=t.size;Object(p.isArray)(a)?(e=a[0],n=a[1]):(e=s,n=a),Object(p.isArray)(o)?(r=o[0],i=o[1]):(r=o-u/2,i=o+u/2);var c=[{x:r,y:e},{x:r,y:n}];return c.push({x:i,y:n},{x:i,y:e}),c}var ja=function(){return(ja=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Pa={stroke:"#C5C5C5",strokeOpacity:.85},Na={fill:"#CACED4",opacity:.85},Da=function(){function t(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=void 0===o?200:o,s=t.height,u=void 0===s?26:s,c=t.smooth,l=void 0===c||c,f=t.isArea,h=void 0!==f&&f,d=t.data,p=void 0===d?[]:d,g=t.lineStyle,v=t.areaStyle,y=t.group,m=t.interval,b=void 0===m?null:m;this.group=y,this.x=n,this.y=i,this.width=a,this.height=u,this.data=p,this.smooth=l,this.isArea=h,this.lineStyle=Object.assign({},Pa,g),this.areaStyle=Object.assign({},Na,v),this.intervalConfig=b,this.renderLine()}return t.prototype.renderLine=function(){var t=this,e=t.x,n=t.y,r=t.width,i=t.height,o=(t.barWidth,t.data),a=t.smooth,s=t.isArea,u=t.lineStyle,c=t.areaStyle,l=this.group.addGroup({name:"trend-group"});if(o){var f=Aa(o,r,i,a);if(l.addShape("path",{attrs:ja({path:f},u),name:"trend-line"}),s){var h=Ta(f,r,i,o);l.addShape("path",{attrs:ja({path:h},c),name:"trend-area"})}}this.intervalConfig&&l.addShape("path",{attrs:ja({path:Ca(this.intervalConfig.data,r,i,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),l.move(e,n)},t.prototype.destory=function(){this.group.destroy()},t}(),La=function(){return(La=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Ra={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},Ba={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize"},Fa=function(){function t(t){var e=t.group,n=t.name,r=t.type,i=t.x,o=void 0===i?0:i,a=t.y,s=void 0===a?0:a,u=t.width,c=void 0===u?2:u,l=t.height,f=void 0===l?24:l,h=t.style,d=void 0===h?{}:h;this.group=e,this.name=n,this.handleType=r,this.x=o,this.y=s,this.width=c,this.height=f,"trend"===r?this.style=La(La({},Ra),d):"simple"===r&&(this.style=La(La({},Ba),d)),this.renderHandle()}return t.prototype.setX=function(t){this.setXY(t,void 0)},t.prototype.setY=function(t){this.setXY(void 0,t)},t.prototype.setXY=function(t,e){Object(p.isNumber)(t)&&(this.x=t),Object(p.isNumber)(e)&&(this.y=e),this.updateXY()},t.prototype.renderHandle=function(){var t=this.width,e=this.height,n=this.style,r=this.name,i=n.fill,o=n.stroke,a=n.radius,s=n.opacity,u=n.cursor;this.handleGroup=this.group.addGroup(),"trend"===this.handleType?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:t,height:e,fill:i,stroke:o,radius:a,opacity:s,cursor:u},name:"".concat(r,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:0,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u,lineAppendWidth:12},name:"".concat(r,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:e,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u},name:"".concat(r,"-handler")})):"simple"===this.handleType&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:e/2,r:2*t,fill:i,stroke:o,radius:a,opacity:s,cursor:u,lineWidth:2},name:"".concat(r,"-handler")})),this.updateXY(),"trend"===this.handleType?this.bindTrendEvents():"simple"===this.handleType&&this.bindSimpleEvents()},t.prototype.bindSimpleEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),(function(){var e=t.style.highLightFill;t.topCircle.attr("fill",e)})),this.handleGroup.on("".concat(e,"-handler:mouseleave"),(function(){var e=t.style.fill;t.topCircle.attr("fill",e)}))},t.prototype.bindTrendEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),(function(){var e=t.style.highLightFill;t.verticalLine.attr("fill",e),t.topCircle.attr("fill",e),t.bottomCircle.attr("fill",e)})),this.handleGroup.on("".concat(e,"-handler:mouseleave"),(function(){var e=t.style.fill;t.verticalLine.attr("fill",e),t.topCircle.attr("fill",e),t.bottomCircle.attr("fill",e)}))},t.prototype.show=function(){this.handleGroup.show()},t.prototype.hide=function(){this.handleGroup.hide()},t.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},t}(),Ga=function(){return(Ga=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},za=function(){function t(t){this.config=Object(p.deepMix)({},t),this.init()}return t.prototype.update=function(t){this.config=Object(p.deepMix)({},this.config,t),this.updateElement(),this.renderMarker()},t.prototype.init=function(){this.initElement(),this.renderMarker()},t.prototype.initElement=function(){var t=this.config,e=t.group,n=t.style,r=n.scale,i=void 0===r?1:r,o=n.offsetX,a=void 0===o?0:o,s=n.offsetY,u=void 0===s?0:s,c=this.config.x+a,l=this.config.y+u,f=e.addGroup({name:"playPauseBtn"});this.startMarkerGroup=f.addGroup({name:"playPauseBtn"}),this.circle=e.addShape("circle",{attrs:Ga({x:c,y:l,r:this.config.r*i},n),name:"playPauseBtn"}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(c,l,i),fill:n.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=f.addGroup({name:"playPauseBtn"});var h=.25*this.config.r*i,d=.5*this.config.r*Math.sqrt(3)*i;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c-.375*this.config.r*i,y:l-d/2,width:h,height:d,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c+1/8*this.config.r*i,y:l-d/2,width:h,height:d,fill:n.stroke||"#aaa",lineWidth:0}})},t.prototype.updateElement=function(){var t=this.config.style,e=t.scale,n=void 0===e?1:e,r=t.offsetX,i=void 0===r?0:r,o=t.offsetY,a=void 0===o?0:o,s=this.config.x+i,u=this.config.y+a;this.circle.attr("x",s),this.circle.attr("y",u),this.circle.attr("r",this.config.r*n),this.startMarker.attr("path",this.getStartMarkerPath(s,u,n));var c=.25*this.config.r*n,l=.5*this.config.r*Math.sqrt(3)*n;this.pauseLeftMarker.attr("x",s-.375*this.config.r*n),this.pauseLeftMarker.attr("y",u-l/2),this.pauseLeftMarker.attr("width",c),this.pauseLeftMarker.attr("height",l),this.pauseRightMarker.attr("x",s+1/8*this.config.r*n),this.pauseRightMarker.attr("y",u-l/2),this.pauseRightMarker.attr("width",c),this.pauseRightMarker.attr("height",l)},t.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},t.prototype.getStartMarkerPath=function(t,e,n){var r=.5*this.config.r*Math.sqrt(3)*n;return[["M",t-r/Math.sqrt(3)/2,e-r/2],["L",t+r/Math.sqrt(3),e],["L",t-r/Math.sqrt(3)/2,e+r/2]]},t}(),Ua=function(){return(Ua=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Va=b.a.transform,Wa={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},Xa={fill:"#fff"},Ya={fill:"green"},Ha={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},qa={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},Ka={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:Ha,timeTypeControllerStyle:qa},Za=function(){function t(t){this.controllerCfg=Object(p.deepMix)({},Ka,t),this.group=t.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType="range",this.fontFamily=t.fontFamily||"Arial, sans-serif",this.init()}return t.prototype.init=function(){this.renderPlayButton()},t.prototype.getNextMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t+n,e],["L",t,e+n],["Z",t,e-n],["M",t,e],["L",t-n,e-n],["L",t-n,e+n],["Z"]]},t.prototype.getPreMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t-n,e],["L",t,e+n],["L",t,e-n],["M",t,e],["L",t+n,e-n],["L",t+n,e+n],["Z"]]},t.prototype.renderPlayButton=function(){var t=this.controllerCfg,e=t.width,n=t.height,r=t.x,i=t.y,o=t.hideTimeTypeController,a=t.fill,s=void 0===a?"#aaa":a,u=t.stroke,c=void 0===u?"green":u,l=t.containerStyle,f=void 0===l?{}:l,h=Ua(Ua({},Wa),t.playBtnStyle||{}),d=Ua(Ua({},Xa),t.preBtnStyle||{}),p=Ua(Ua({},Ya),t.nextBtnStyle||{}),g=n/2-5,v=i+10,y=this.controllerGroup.addShape("rect",{attrs:Ua({x:r,y:v,width:e,height:n,stroke:c,fill:s},f),name:"container-rect"});this.playButton?this.playButton.update({x:e/2,y:v,r:g}):this.playButton=new za({group:this.controllerGroup,x:e/2,y:v+g+5,r:g,isPlay:this.isPlay,style:h});var m=d.offsetX||0,b=d.offsetY||0,x=(d.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Ua({path:this.getPreMarkerPath(e/2-5*g+m,v+g+5+b,.5*x)},d),name:"preStepBtn"});var _=p.offsetX||0,w=p.offsetY||0,E=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Ua({path:this.getNextMarkerPath(e/2+5*g+_,v+g+5+w,.5*E)},p),name:"nextStepBtn"}),y.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var S=this.controllerCfg.scale,O=void 0===S?1:S,M=this.controllerGroup.getCanvasBBox(),k=(M.maxX+M.minX)/2,A=(M.maxY+M.minY)/2,C=Va([1,0,0,0,1,0,0,0,1],[["t",-k,-A],["s",O,O],["t",k,A]]);this.controllerGroup.setMatrix(C)},t.prototype.renderSpeedBtn=function(){var t=this.controllerCfg,e=t.y,n=t.width,r=t.hideTimeTypeController,i=Ua(Ua({},Ha),this.controllerCfg.speedControllerStyle||{}),o=i.scroller,a=void 0===o?{}:o,s=i.text,u=void 0===s?{}:s,c=i.pointer,l=void 0===c?{}:c,f=i.scale,h=void 0===f?1:f,d=i.offsetX,p=void 0===d?0:d,g=i.offsetY,v=void 0===g?0:g,y=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=y;var m=[],b=5;this.speedAxisY=[19,22,26,32,39];for(var x=0;x<5;x++){var _=e+this.speedAxisY[x],w=n-(r?50:110);y.addShape("line",{attrs:Ua({x1:w,x2:w+15,y1:_,y2:_},a),speed:b,name:"speed-rect"}),this.speedAxisY[x]=_,m.push(b),b-=1}this.speedText=y.addShape("text",{attrs:Ua({x:n-(r?50:110)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},u),name:"speed-text"}),this.speedPoint=y.addShape("path",{attrs:Ua({path:this.getPointerPath(n-(r?50:110),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},l),name:"speed-pointer"});var E=this.speedGroup.getCanvasBBox(),S=(E.maxX+E.minX)/2,O=(E.maxY+E.minY)/2,M=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];M=Va(M,[["t",-S,-O],["s",h,h],["t",S+p*h,O+v*h]]),this.speedGroup.setMatrix(M)},t.prototype.getPointerPath=function(t,e){return[["M",t,e],["L",t-10,e-4],["L",t-10,e+4],["Z"]]},t.prototype.renderToggleTime=function(){var t,e=this.controllerCfg.width,n=Ua(Ua({},qa),this.controllerCfg.timeTypeControllerStyle||{}),r=n.scale,i=void 0===r?1:r,o=n.offsetX,a=void 0===o?0:o,s=n.offsetY,u=void 0===s?0:s,c=n.box,l=void 0===c?{}:c,f=n.check,h=void 0===f?{}:f,d=n.text,p=void 0===d?{}:d;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"}),this.toggleGroup.addShape("rect",{attrs:Ua({x:e-50,y:this.speedAxisY[0]+3.5},l),isChecked:!1,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Ua({path:[["M",e-50+3,this.speedAxisY[1]+6],["L",e-50+7,this.speedAxisY[1]+10],["L",e-50+12,this.speedAxisY[1]+4]]},h),capture:!1,name:"check-icon"}),this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Ua({text:(null===(t=this.controllerCfg)||void 0===t?void 0:t.timePointControllerText)||"单一时间",x:e-50+15,y:this.speedAxisY[0]+4,fontFamily:"undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},p),name:"checked-text"});var g=this.toggleGroup.getCanvasBBox(),v=(g.maxX+g.minX)/2,y=(g.maxY+g.minY)/2,m=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];m=Va(m,[["t",-v,-y],["s",i,i],["t",v+a*i,y+u*i]]),this.toggleGroup.setMatrix(m)},t.prototype.bindEvent=function(){var t=this;this.speedGroup.on("speed-rect:click",(function(e){var n=e.target.attr("y1"),r=t.speedPoint.attr("matrix"),i=t.speedAxisY.indexOf(r[7]||0),o=t.speedAxisY.indexOf(n),a=t.speedAxisY[o]-t.speedAxisY[i];r=Va(r,[["t",0,a]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-o,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})})),this.speedGroup.on("mousewheel",(function(e){e.preventDefault();var n=t.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],r=n[7],i=t.speedAxisY.indexOf(r);if(-1===i){var o=1/0;t.speedAxisY.forEach((function(t,e){var n=Math.abs(t-r);o>n&&(o=n,i=e)}))}i=e.originalEvent.deltaY>0?Math.max(0,i-1):Math.min(t.speedAxisY.length-1,i+1);var a=t.speedAxisY[i]-r;n=Va(n,[["t",0,a]]),t.speedPoint.setMatrix(n),t.currentSpeed=t.speedAxisY.length-i,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})})),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",(function(e){var n,r,i=e.target.get("isChecked");i?(t.checkedIcon.hide(),t.checkedText.attr("text",(null===(r=t.controllerCfg)||void 0===r?void 0:r.timePointControllerText)||"单一时间"),t.currentType="range"):(t.checkedIcon.show(),t.checkedText.attr("text",(null===(n=t.controllerCfg)||void 0===n?void 0:n.timeRangeControllerText)||"时间范围"),t.currentType="single"),e.target.set("isChecked",!i),t.group.emit("timebarConfigChanged",{type:t.currentType,speed:t.currentSpeed})}))},t.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},t}(),Qa=function(){return(Qa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},$a=b.a.transform,Ja={fill:"#416180",opacity:.05},ts={fill:"#416180",opacity:.15,radius:5},es={fill:"#5B8FF9",opacity:.3,cursor:"grab"},ns={width:2,height:24},rs={textBaseline:"middle",fill:"#000",opacity:.45},is={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},os={lineWidth:1,stroke:"#ccc"},as=function(){function t(t){var e=this;this.prevX=0,this.onMouseDown=function(t){return function(n){e.currentHandler=t;var r=n.originalEvent;r.stopPropagation(),r.preventDefault(),e.prevX=Object(p.get)(r,"touches.0.pageX",r.pageX);var i=e.canvas.get("container");i.addEventListener("mousemove",e.onMouseMove),i.addEventListener("mouseup",e.onMouseUp),i.addEventListener("mouseleave",e.onMouseUp),i.addEventListener("touchmove",e.onMouseMove),i.addEventListener("touchend",e.onMouseUp),i.addEventListener("touchcancel",e.onMouseUp)}},this.onMouseMove=function(t){t.stopPropagation(),t.preventDefault();var n=Object(p.get)(t,"touches.0.pageX",t.pageX),r=n-e.prevX,i=e.adjustOffsetRange(r/e.width);e.updateStartEnd(i),e.updateUI(),e.prevX=n},this.onMouseUp=function(){e.currentHandler&&(e.currentHandler=void 0);var t=e.canvas.get("container");t&&(t.removeEventListener("mousemove",e.onMouseMove),t.removeEventListener("mouseup",e.onMouseUp),t.removeEventListener("mouseleave",e.onMouseUp),t.removeEventListener("touchmove",e.onMouseMove),t.removeEventListener("touchend",e.onMouseUp),t.removeEventListener("touchcancel",e.onMouseUp))};var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,a=t.width,s=void 0===a?100:a,u=t.height,c=t.padding,l=void 0===c?10:c,f=t.trendCfg,h=t.controllerCfg,d=void 0===h?{speed:1}:h,g=t.backgroundStyle,v=void 0===g?{}:g,y=t.foregroundStyle,m=void 0===y?{}:y,b=t.handlerStyle,x=void 0===b?{}:b,_=t.textStyle,w=void 0===_?{}:_,E=t.start,S=void 0===E?0:E,O=t.end,M=void 0===O?1:O,k=t.minText,A=void 0===k?"":k,C=t.maxText,T=void 0===C?"":C,I=t.group,j=t.graph,P=t.canvas,N=t.tick,D=void 0===N?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(t){return t},ticks:[]}:N,L=t.type;this.graph=j,this.canvas=P,this.group=I,this.timeBarType=L,this.x=r,this.y=o,this.width=s,this.height=u,this.padding=l,this.ticks=D.ticks,this.trendCfg=f,this.controllerCfg=d,this.currentSpeed=d.speed||1,this.tickLabelFormatter=D.tickLabelFormatter,"trend"===L?this.backgroundStyle=Qa(Qa({},Ja),v):"simple"===L&&(this.backgroundStyle=Qa(Qa({},ts),v)),this.foregroundStyle=Qa(Qa({},es),m),this.handlerStyle=Qa(Qa({},ns),x),this.textStyle=Qa(Qa({},rs),w),this.tickLabelStyle=Qa(Qa({},is),D.tickLabelStyle),this.tickLineStyle=Qa(Qa({},os),D.tickLineStyle),this.currentMode="range",this.start=S,this.end=M,this.minText=A,this.maxText=T,this.fontFamily="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return t.prototype.update=function(t){var e=t.x,n=t.y,r=t.width,i=t.height,o=t.minText,a=t.maxText,s=t.start,u=t.end;this.start=Math.min(1,Math.max(s,0)),this.end=Math.min(1,Math.max(u,0)),Object(p.assign)(this,{x:e,y:n,width:r,height:i,minText:o,maxText:a}),this.updateUI()},t.prototype.setText=function(t,e){this.minTextShape.attr("text",t),this.maxTextShape.attr("text",e)},t.prototype.renderSlider=function(){var t=this,e=this.width,n=this.height,r=this.timeBarType;if("trend"===r&&Object(p.size)(Object(p.get)(this.trendCfg,"data"))){var i=new Da(Qa(Qa({x:this.x,y:this.y,width:e,height:n},this.trendCfg),{group:this.group}));this.trendComponent=i}var o=this.group.addGroup({name:"slider-group"});o.addShape("rect",{attrs:Qa({x:0,y:0,width:e,height:n},this.backgroundStyle),name:"background"});var a=this.group.addGroup();"trend"===r?(this.minTextShape=a.addShape("text",{attrs:Qa({x:0,y:n/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=a.addShape("text",{attrs:Qa({y:n/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})):(this.minTextShape=a.addShape("text",{attrs:Qa({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=a.addShape("text",{attrs:Qa({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:Qa({x:0,y:this.y,height:n},this.foregroundStyle),name:"foreground-shape"}),this.foregroundShape.on("mousedown",(function(t){t.target.attr("cursor","grabbing")})),this.foregroundShape.on("mouseup",(function(e){e.target.attr("cursor",t.foregroundStyle.cursor||"grab")}));var s=Object(p.get)(this.handlerStyle,"width",2),u=Object(p.get)(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new Fa({name:"minHandlerShape",group:c,type:r,x:this.x,y:this.y,width:s,height:u,style:this.handlerStyle});var l=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new Fa({name:"maxHandlerShape",group:l,type:r,x:this.x,y:this.y,width:s,height:u,style:this.handlerStyle});var f=this.ticks,h=e/(f.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach((function(t){t.destroy()}));var d=-1/0,g=this.tickLabelStyle.rotate;delete this.tickLabelStyle.rotate,this.textList=f.map((function(e,r){var i;t.tickPosList.push(t.x+r*h),t.tickLabelFormatter?(i=t.tickLabelFormatter(e),!Object(p.isString)(i)&&i&&(i=e.date)):i=e.date;var o=t.x+r*h,a=t.y+n+5,s=t.group.addShape("text",{attrs:Qa({x:o,y:a,text:i,fontFamily:t.fontFamily||"Arial, sans-serif"},t.tickLabelStyle),name:"tick-label"});if(Object(p.isNumber)(g)&&r!==f.length-1){var u=$a([1,0,0,0,1,0,0,0,1],[["t",-o,-a],["r",g],["t",o-5,a+2]]);s.attr({textAlign:"left",matrix:u})}0===r?s.attr({textAlign:"left"}):r!==f.length-1&&s.attr({textAlign:"right"});var c=t.group.addShape("line",{attrs:Qa({x1:t.x+r*h,y1:t.y+n+2,x2:t.x+r*h,y2:t.y+n+6},t.tickLineStyle),name:"tick-line"});c.toBack();var l=s.getBBox();return l.minX>d?(s.show(),c.show(),d=l.minX+l.width+10):(s.hide(),c.hide()),s})),this.controllerBtnGroup=new Za(Qa({group:this.group,x:this.x,y:this.y+n+25,width:e,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),o.move(this.x,this.y),this.bindEvents()},t.prototype.bindEvents=function(){var t=this,e=this.group.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat("playPauseBtn",":click"),(function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()})),this.group.on("".concat("nextStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()})),this.group.on("".concat("preStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()})),this.group.on("timebarConfigChanged",(function(e){var n=e.type,r=e.speed;t.currentSpeed=r,t.currentMode=n,"single"===n?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):"range"===n&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())}))},t.prototype.adjustTickIndex=function(t){for(var e=0;e<this.tickPosList.length-1;e++)if(this.tickPosList[e]<=t&&t<=this.tickPosList[e+1])return Math.abs(this.tickPosList[e]-t)<Math.abs(t-this.tickPosList[e+1])?e:e+1;return 0},t.prototype.adjustOffsetRange=function(t){switch(this.currentHandler){case this.minHandlerShape:var e=0-this.start,n=1-this.start;return Math.min(n,Math.max(e,t));case this.maxHandlerShape:e=0-this.end,n=1-this.end;return Math.min(n,Math.max(e,t));case this.foregroundShape:e=0-this.start,n=1-this.end;return Math.min(n,Math.max(e,t));default:return 0}},t.prototype.updateStartEnd=function(t){var e=this.ticks[this.adjustTickIndex(this.start*this.width)],n=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler)return this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):null==e?void 0:e.date,void(this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):null==n?void 0:n.date);switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=t,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=t,this.end+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date}},t.prototype.updateUI=function(){var t=this;this.start<0&&(this.start=0),this.end>1&&(this.end=1);var e=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",n-e);var r=Object(p.get)(this.handlerStyle,"width",2);this.setText(this.minText,this.maxText);var i=this.dodgeText([e,n]),o=i[0],a=i[1];this.minHandlerShape.setX(e-r/2),Object(p.each)(o,(function(e,n){return t.minTextShape.attr(n,e)})),this.maxHandlerShape.setX(n-r/2),Object(p.each)(a,(function(e,n){return t.maxTextShape.attr(n,e)})),"range"===this.currentMode?this.graph.emit("valuechange",{value:[this.start,this.end].sort()}):"single"===this.currentMode&&this.graph.emit("valuechange",{value:[this.end,this.end]})},t.prototype.dodgeText=function(t){var e,n,r=Object(p.get)(this.handlerStyle,"width",2),i=this.minTextShape,o=this.maxTextShape,a=t[0],s=t[1],u=!1;a>s&&(a=(e=[s,a])[0],s=e[1],i=(n=[o,i])[0],o=n[1],u=!0);var c=i.getBBox(),l=o.getBBox(),f=null,h=null;return"trend"===this.timeBarType?(f=a-c.width<this.x+2?{x:a+r/2+2,textAlign:"left"}:{x:a-r/2-2,textAlign:"right"},h=s+l.width>this.x+this.width?{x:s-r/2-2,textAlign:"right"}:{x:s+r/2+2,textAlign:"left"}):"simple"===this.timeBarType&&(f=i.attr("x")>c.width?{x:a,textAlign:"center"}:{x:a,textAlign:"left"},h=o.attr("x")>this.width-l.width?{x:s,textAlign:"right"}:{x:s,textAlign:"center"}),u?[h,f]:[f,h]},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame((function(){var e=t,n=e.ticks,r=e.width,i=t.currentSpeed,o=r/n.length/(1e3*(10-i)/60),a=t.adjustOffsetRange(o/t.width);t.updateStartEnd(a),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())})):void 0},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.destory=function(){this.graph.off("valuechange");var t=this.group,e=t.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var n=t.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),t.destroy(),this.trendComponent&&this.trendComponent.destory()},t}(),ss=function(){function t(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.container,a=t.text,s=t.padding,u=void 0===s?[4,4,4,4]:s,c=t.className,l=void 0===c?"g6-component-timebar-tooltip":c,f=t.backgroundColor,h=void 0===f?"#000":f,d=t.textColor,p=void 0===d?"#fff":d,g=t.opacity,v=void 0===g?.8:g,y=t.fontSize,m=void 0===y?12:y;this.container=o,this.className=l,this.backgroundColor=h,this.textColor=p,this.x=n,this.y=i,this.text=a,this.padding=u,this.opacity=v,this.fontSize=m,this.render()}return t.prototype.render=function(){var t=this.className,e=(this.x,this.y,this.backgroundColor),n=this.textColor,r=this.text,i=this.padding,o=this.opacity,a=this.fontSize,s=this.container,u=Ur("<div class='".concat(t,"' style=\"position: absolute; width: fit-content; height: fit-content; opacity: ").concat(o,'"></div>'));Object(p.isString)(s)&&(s=document.getElementById(s)),s.appendChild(u),this.parentHeight=s.offsetHeight,this.parentWidth=s.offsetWidth,Vr(u,{visibility:"hidden",top:0,left:0});var c=Ur("\n <div style='position: absolute; white-space:nowrap; background-color: ".concat(e,"; font-size: ").concat(a,"px; border-radius: 4px; width: fit-content; height: fit-content; color: ").concat(n,"; padding: ").concat(i[0],"px ").concat(i[1],"px ").concat(i[2],"px ").concat(i[3],"px'></div>"));c.innerHTML=r,u.appendChild(c),this.backgroundDOM=c;var l=Ur("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(e,"'></div>"));u.appendChild(l),this.arrowDOM=l,this.container=u},t.prototype.show=function(t){var e=t.text,n=t.x;t.y,t.clientX,t.clientY;this.backgroundDOM.innerHTML=e;var r=this.backgroundDOM.offsetWidth,i=this.backgroundDOM.offsetHeight,o=this.arrowDOM.offsetWidth,a=this.arrowDOM.offsetHeight;Vr(this.container,{top:"".concat(-i-a,"px"),left:"".concat(n,"px"),visibility:"visible"}),Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2,"px")}),Vr(this.arrowDOM,{marginLeft:"".concat(-o/2,"px"),top:"".concat(i,"px")});var s=n-r/2,u=n+r/2;s<0?Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2-s,"px")}):u>this.parentWidth&&Vr(this.backgroundDOM,{marginLeft:"".concat(-r/2-u+this.parentWidth+12,"px")})},t.prototype.hide=function(){Vr(this.container,{top:0,left:0,visibility:"hidden"})},t}(),us=function(){return(us=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},cs=b.a.transform,ls={fill:"#5B8FF9"},fs={fill:"#e6e8e9"},hs=function(){function t(t){this.frameCount=0,this.fontFamily="Arial, sans-serif";var e=t.graph,n=t.canvas,r=t.group,i=t.width,o=t.height,a=t.padding,s=t.data,u=t.start,c=t.end,l=t.x,f=void 0===l?0:l,h=t.y,d=void 0===h?0:h,p=t.tickLabelFormatter,g=t.selectedTickStyle,v=void 0===g?ls:g,y=t.unselectedTickStyle,m=void 0===y?fs:y,b=t.tooltipBackgroundColor,x=t.tooltipFomatter,_=t.tickLabelStyle;this.graph=e,this.group=r,this.sliceGroup=r.addGroup({name:"slice-group"}),this.canvas=n,this.width=i,this.height=o,this.padding=a,this.data=s,this.start=u,this.end=c,this.tickLabelFormatter=p,this.tickLabelStyle=_||{},this.selectedTickStyle=v,this.unselectedTickStyle=m,this.x=f,this.y=d,this.tooltipBackgroundColor=b,this.tooltipFomatter=x,this.fontFamily="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return t.prototype.renderSlices=function(){var t=this,e=this,n=e.width,r=e.height,i=e.padding,o=e.data,a=e.start,s=e.end,u=e.tickLabelFormatter,c=e.selectedTickStyle,l=e.unselectedTickStyle,f=e.tickLabelStyle,h=n-2*i,d=r-(3*i+4+10)-2*i,g=o.length,v=(h-2*(g-1))/g;this.tickWidth=v;var y=this.sliceGroup,m=[],b=[],x=Math.round(g*a),_=Math.round(g*s);this.startTickRectId=x,this.endTickRectId=_;var w=f.rotate;delete f.rotate,o.forEach((function(e,r){var o=r>=x&&r<=_?c:l,a=y.addShape("rect",{attrs:us({x:i+r*(v+2),y:i,width:v,height:d},o),draggable:!0,name:"tick-rect-".concat(r)}),s=y.addShape("rect",{attrs:{x:i+r*v+2*(2*r-1)/2,y:i,width:0===r||r===g-1?v+1:v+2,height:d,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(r)});s.toFront();var h,E=a.getBBox(),S=(E.minX+E.maxX)/2;if(m.push({rect:a,pickRect:s,value:e.date,x:S,y:E.minY}),u?(h=u(e),!Object(p.isString)(h)&&h&&(h=e.date)):r%Math.round(g/10)==0&&(h=e.date),h){b.push(h);var O=E.maxY+2*i;y.addShape("line",{attrs:{stroke:"#BFBFBF",x1:S,y1:O,x2:S,y2:O+4},name:"tick-line"});var M=O+4+i,k=y.addShape("text",{attrs:us({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:S,y:M,textAlign:"center",text:h,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},f),capture:!1,name:"tick-label"}),A=k.getBBox();if(A.maxX>n?k.attr("textAlign","right"):A.minX<0&&k.attr("textAlign","left"),Object(p.isNumber)(w)&&10!==b.length){var C=cs([1,0,0,0,1,0,0,0,1],[["t",-S,-M],["r",w],["t",S-5,M+2]]);k.attr({textAlign:"left",matrix:C})}1===b.length?k.attr({textAlign:"left"}):10===b.length&&k.attr({textAlign:"right"})}})),this.tickRects=m;var E=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Za({group:E,x:this.x,y:this.y+r+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"})},t.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",(function(e){var n=e.target;if("rect"===n.get("type")&&n.get("name")){var r=parseInt(n.get("name").split("-")[2],10);if(!isNaN(r)){var i=t.tickRects,o=t.unselectedTickStyle;i.forEach((function(t){t.rect.attr(o)}));var a=t.selectedTickStyle;i[r].rect.attr(a),t.startTickRectId=r,t.endTickRectId=r;var s=r/i.length;t.graph.emit("valuechange",{value:[s,s]})}}})),e.on("dragstart",(function(e){var n=t.tickRects,r=t.unselectedTickStyle;n.forEach((function(t){t.rect.attr(r)}));var i=e.target,o=parseInt(i.get("name").split("-")[2],10),a=t.selectedTickStyle;n[o].rect.attr(a),t.startTickRectId=o;var s=o/n.length;t.graph.emit("valuechange",{value:[s,s]}),t.dragging=!0})),e.on("dragover",(function(e){if(t.dragging&&"rect"===e.target.get("type")){for(var n=parseInt(e.target.get("name").split("-")[2],10),r=t.startTickRectId,i=t.tickRects,o=t.selectedTickStyle,a=t.unselectedTickStyle,s=0;s<i.length;s++){var u=s>=r&&s<=n?o:a;i[s].rect.attr(u)}var c=i.length;t.endTickRectId=n;var l=r/c,f=n/c;t.graph.emit("valuechange",{value:[l,f]})}})),e.on("drop",(function(e){if(t.dragging&&(t.dragging=!1,"rect"===e.target.get("type"))){var n=t.startTickRectId,r=parseInt(e.target.get("name").split("-")[2],10);if(!(r<n)){var i=t.selectedTickStyle,o=t.tickRects;o[r].rect.attr(i),t.endTickRectId=r;var a=o.length,s=n/a,u=r/a;t.graph.emit("valuechange",{value:[s,u]})}}}));var n=this.tooltipBackgroundColor,r=this.tooltipFomatter,i=this.canvas,o=new ss({container:i.get("container"),backgroundColor:n}),a=this.tickRects;a.forEach((function(t){var e=t.pickRect;e.on("mouseenter",(function(t){var e=t.target;if("rect"===e.get("type")){var n=parseInt(e.get("name").split("-")[2],10),s=i.getClientByPoint(a[n].x,a[n].y);o.show({x:a[n].x,y:a[n].y,clientX:s.x,clientY:s.y,text:r?r(a[n].value):a[n].value})}})),e.on("mouseleave",(function(t){o.hide()}))}));var s=this.group;s.on("".concat("playPauseBtn",":click"),(function(){t.isPlay=!t.isPlay,t.changePlayStatus()})),s.on("".concat("nextStepBtn",":click"),(function(){t.updateStartEnd(1)})),s.on("".concat("preStepBtn",":click"),(function(){t.updateStartEnd(-1)})),s.on("timebarConfigChanged",(function(e){e.type;var n=e.speed;t.currentSpeed=n}))},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame((function(){var e=t.currentSpeed;t.frameCount%(60/e)==0&&(t.frameCount=0,t.updateStartEnd(1)),t.frameCount++,t.isPlay&&(t.playHandler=t.startPlay())})):void 0},t.prototype.updateStartEnd=function(t){var e=this.tickRects,n=e.length,r=this.unselectedTickStyle,i=this.selectedTickStyle,o=this.endTickRectId;if(t>0?this.endTickRectId++:(e[this.endTickRectId].rect.attr(r),this.endTickRectId--),o!==this.startTickRectId)this.endTickRectId<this.startTickRectId&&(this.startTickRectId=this.endTickRectId);else{for(var a=this.startTickRectId;a<=this.endTickRectId-1;a++)e[a].rect.attr(r);this.startTickRectId=this.endTickRectId}if(e[this.endTickRectId]){e[this.endTickRectId].rect.attr(i);var s=this.startTickRectId/n,u=this.endTickRectId/n;this.graph.emit("valuechange",{value:[s,u]})}},t.prototype.destory=function(){this.graph.off("valuechange");var t=this.sliceGroup;t.off("click"),t.off("dragstart"),t.off("dragover"),t.off("drop"),this.tickRects.forEach((function(t){var e=t.pickRect;e.off("mouseenter"),e.off("mouseleave")})),this.tickRects.length=0,t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),this.sliceGroup.destroy()},t}(),ds=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ps=function(){return(ps=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},gs=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n},vs=function(t){function e(e){return t.call(this,e)||this}return ds(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1,filterItemTypes:["node"],containerCSS:{}}},e.prototype.initContainer=function(){var t,e,n=this.get("graph"),r=this._cfgs,i=r.width,o=r.height,a=this.get("className")||"g6-component-timebar",s=this.get("container"),u=this.get("graph").get("container");s?(Object(p.isString)(s)&&(s=document.getElementById(s)),t=s):Vr(t=Ur("<div class='".concat(a,"'></div>")),{position:"relative"}),u.appendChild(t),this.set("timeBarContainer",t),e="SVG"===n.get("renderer")?new br.Canvas({container:t,width:i,height:o}):new mr.Canvas({container:t,width:i,height:o}),this.get("containerCSS")&&Vr(t,this.get("containerCSS")),this.set("canvas",e)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas").addGroup({name:"timebar-group"});this.set("timeBarGroup",t),this.renderTrend(),this.initEvent();var e="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",e)},e.prototype.renderTrend=function(){var t=this,e=this._cfgs,n=e.width,r=e.x,i=e.y,o=e.padding,a=e.type,s=e.trend,u=e.slider,c=e.controllerCfg,l=e.textStyle,f=e.tick,h=e.backgroundStyle,d=e.foregroundStyle,p=s.data,g=gs(s,["data"]),v=n-2*o,y="trend"===a?26:4,m=this.get("graph"),b=this.get("timeBarGroup"),x=this.get("canvas"),_=null;if("trend"===a||"simple"===a){var w=this.get("getValue");_=new as(ps(ps({graph:m,canvas:x,group:b,type:a,x:r+o,y:"trend"===a?i+o:i+o+15,width:v,height:y,padding:o,backgroundStyle:h,foregroundStyle:d,trendCfg:ps(ps({},g),{data:p.map((function(t){return(null==w?void 0:w(t))||t.value}))})},u),{tick:{ticks:p,tickLabelFormatter:f.tickLabelFormatter,tickLabelStyle:f.tickLabelStyle,tickLineStyle:f.tickLineStyle},handlerStyle:ps(ps({},u.handlerStyle),{height:u.height||y}),controllerCfg:c,textStyle:l}))}else"tick"===a&&(_=new hs(ps({graph:m,canvas:x,group:b,x:r+o,y:i+o,width:n,height:42,padding:2},f)));var E=function e(){var n=t.get("timebar");n.draggingHandler=!1,n.isPlay&&(n.isPlay=!1,n.currentHandler=n.maxHandlerShape,n.changePlayStatus()),document.removeEventListener("mouseup",e)};x.on("mousedown",(function(t){"maxHandlerShape-handler"!==t.target.get("name")&&"minHandlerShape-handler"!==t.target.get("name")&&t.target!==_.foregroundShape||document.addEventListener("mouseup",E)})),this.set("timebar",_)},e.prototype.filterData=function(t){var e,n=t.value,r=null,i=this._cfgs.type;if("trend"===i||"simple"===i?r=this._cfgs.trend.data:"tick"===i&&(r=this._cfgs.tick.data),r&&0!==r.length){var o=this.get("rangeChange"),a=this.get("graph"),s=Math.round(r.length*n[0]),u=Math.round(r.length*n[1]);u=u>=r.length?r.length-1:u,s=s>=r.length?r.length-1:s;var c=null===(e=this._cfgs.tick)||void 0===e?void 0:e.tickLabelFormatter,l=c?c(r[s]):r[s].date,f=c?c(r[u]):r[u].date;if("tick"!==i)this.get("timebar").setText(l,f);if(o)o(a,l,f);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&0===this.cacheGraphData.nodes.length)&&(this.cacheGraphData=a.get("data"));var h=this.get("filterItemTypes"),d=this.get("changeData"),p=this.get("getDate"),g=this.get("shouldIgnore"),v=r[s].date,y=r[u].date;if(d||void 0===d){var m=this.cacheGraphData.nodes,b=this.cacheGraphData.edges;if(h.includes("node")){var x=(m=m.filter((function(t){var e=+((null==p?void 0:p(t))||t.date);return e>=v&&e<=y||(null==g?void 0:g("node",t,{min:v,max:y}))}))).map((function(t){return t.id}));b&&(b=b.filter((function(t){return x.includes(t.source)&&x.includes(t.target)||(null==g?void 0:g("edge",t,{min:v,max:y}))})))}(this.get("filterEdge")||h.includes("edge"))&&(b=b.filter((function(t){var e=+((null==p?void 0:p(t))||t.date);return e>=v&&e<=y||(null==g?void 0:g("edge",t,{min:v,max:y}))}))),a.changeData({nodes:m,edges:b})}else h.includes("node")&&a.getNodes().forEach((function(t){var e=t.getModel();if(!(null==g?void 0:g("node",e,{min:v,max:y}))){var n=+((null==p?void 0:p(e))||e.date);n<v||n>y?a.hideItem(t):a.showItem(t)}})),(this.get("filterEdge")||h.includes("edge"))&&a.getEdges().forEach((function(t){var e=t.getModel();if(!(null==g?void 0:g("edge",e,{min:r[s].date,max:r[u].date}))){var n=+((null==p?void 0:p(e))||e.date);n<r[s].date||n>r[u].date?a.hideItem(t):a.showItem(t)}}))}}else console.warn("请配置 TimeBar 组件的数据")},e.prototype.initEvent=function(){var t=this,e=0,n=0,r=this._cfgs.type;r&&"trend"!==r&&"simple"!==r?"tick"===r&&(e=this._cfgs.tick.start,n=this._cfgs.tick.end):(e=this._cfgs.slider.start,n=this._cfgs.slider.end);var i=this.get("graph");i.on("afterrender",(function(r){t.filterData({value:[e,n]})})),i.on("valuechange",Object(p.throttle)((function(e){t.filterData(e)}),200,{trailing:!0,leading:!0}))},e.prototype.destroy=function(){var e=this.get("timebar");e&&e.destory&&e.destory(),t.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var r=this.get("container");r||(r=this.get("graph").get("container")),Object(p.isString)(r)&&(r=document.getElementById(r)),r.removeChild(n)}},e}(ji),ys=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ms=cr.applyMatrix;var bs=function(t){function e(e){return t.call(this,e)||this}return ys(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,n=e.graph;if(!this.destroyed){var r=this.get("container");Object(p.isString)(r)&&(r=document.getElementById(r));var i=Ur("<div class=".concat(e.viewportClassName,"\n style='position:absolute;\n left:0;\n top:0;\n box-sizing:border-box;\n border: 2px solid #1980ff'>\n </div>")),o=0,a=0,s=!1,u=0,c=0,l=0,f=0,h=0,d=0;r.addEventListener("mousedown",(function(r){if(e.refresh=!1,r.target===i){var u=i.style;l=parseInt(u.width,10),f=parseInt(u.height,10);var c=t.get("width"),p=t.get("height");l>c||f>p||(d=n.getZoom(),h=t.get("ratio"),s=!0,o=r.clientX,a=r.clientY)}}),!1),r.addEventListener("mousemove",(function(e){if(s&&!Object(p.isNil)(e.clientX)&&!Object(p.isNil)(e.clientY)){var r=t.get("width"),g=t.get("height"),v=i.style;u=parseInt(v.left,10),c=parseInt(v.top,10),l=parseInt(v.width,10),f=parseInt(v.height,10);var y=o-e.clientX,m=a-e.clientY;u-y<0?y=u:u-y+l>=r&&(y=0),c-m<0?m=c:c-m+f>=g&&(m=0),c-=m,Vr(i,{left:"".concat(u-=y,"px"),top:"".concat(c,"px")}),n.translate(y*d/h,m*d/h),o=e.clientX,a=e.clientY}}),!1),r.addEventListener("mouseleave",(function(){s=!1,e.refresh=!0}),!1),r.addEventListener("mouseup",(function(){s=!1,e.refresh=!0}),!1),this.set("viewport",i),r.appendChild(i)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("width"),n=this.get("height"),r=this.get("graph"),i=r.get("width"),o=i/r.get("height"),a=r.getGroup(),s=a.getCanvasBBox(),u=[(s.minX+s.maxX)/2,(s.minY+s.maxY)/2],c=[s.maxX-s.minX,s.maxY-s.minY],l={centerX:u[0],centerY:u[1],width:0,height:0,minX:0,minY:0};s[0]/s[1]>o?(l.width=c[0],l.height=l.width/o):(l.height=c[1],l.width=l.height*o),l.minX=u[0]-l.width/2,l.minY=u[1]-l.height/2;var f=a.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]);var h=b.b.invert([1,0,0,0,1,0,0,0,1],f),d=ms({x:l.minX,y:l.minY},h),p=r.getCanvasByPoint(d.x,d.y),g=this.get("viewport");g||this.initViewport();var v=i/l.width,y=v*e,m=v*n,x=e*-p.x/l.width,_=n*-p.y/l.height,w=x+y,E=_+m;x<0&&(y+=x,x=0),w>e&&(y-=w-e),_<0&&(m+=_,_=0),E>n&&(m-=E-n),this.set("ratio",t),Vr(g,{left:"".concat(x,"px"),top:"".concat(_,"px"),width:"".concat(y,"px"),height:"".concat(m,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this.get("graph"),e=t.get("width"),n=t.get("height")/e,r=this.get("className"),i=this.get("container"),o=this.get("width"),a=this.get("height");o||a||(o=200),o?(a=n*o,this.set("height",a)):(o=1/n*a,this.set("width",o));var s=Ur("<div class='".concat(r,"' style='width: ").concat(o,"px; height: ").concat(a,"px; overflow: hidden; position: relative;'></div>"));Object(p.isString)(i)&&(i=document.getElementById(i)),i?i.appendChild(s):t.get("container").appendChild(s),this.set("container",s);var u=Ur('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');s.appendChild(u);var c=Ur('<span style="display: table-cell; vertical-align: middle; "></span>');u.appendChild(c),this.set("containerDOM",u),this.set("containerSpan",c);var l=Ur('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));this.set("imgDOM",l),this.updateImgSize(),c.appendChild(l),this.updateCanvas()},e.prototype.updateImgSize=function(){var t=this.get("imgDOM"),e=this.get("width"),n=this.get("height");t.onload=function(){var r=function(t,e){var n,r;if(t.naturalWidth)n=t.naturalWidth,r=t.naturalHeight;else{var i=new Image;i.src=t.src,i.onload=function(){e&&e(i.width,i.height)}}return[n,r]}(t);r[0]>r[1]?t.width=e:t.height=n}},e.prototype.updateCanvas=function(){if(this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("width")/t.get("canvas").getCanvasBBox().width;this.set("ratio",e),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){this.get("imgDOM").remove(),this.set("graphImg",t);var e=Ur('<img alt="" src="'.concat(t,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));this.set("imgDOM",e),e.src=t,this.updateImgSize(),this.get("containerSpan").appendChild(e),this.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(ji),xs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_s=function(){return(_s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},ws=cr.distance,Es={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Ss=function(t){function e(e){return t.call(this,e)||this}return xs(e,t),e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Object(p.clone)(Es),showLabel:"edge",scaleRBy:"wheel"}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"filter"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"filter"}}return t},e.prototype.init=function(){var t=this.get("showLabel"),e="node"===t||"both"===t,n="edge"===t||"both"===t;this.set("showNodeLabel",e),this.set("showEdgeLabel",n),this.get("shouldShow")||this.set("shouldShow",(function(){return!0}))},e.prototype.createDelegate=function(t){var e=this,n=e.get("delegate");n&&!n.destroyed||(e.filter(t),(n=e.get("delegate")).on("dragstart",(function(t){})),n.on("drag",(function(t){e.filter(t)})),"wheel"===this.get("scaleRBy")&&n.on("mousewheel",(function(t){e.scaleRByWheel(t)})))},e.prototype.scaleRByWheel=function(t){if(t&&t.originalEvent){t.preventDefault&&t.preventDefault();var e,n=this.get("graph"),r=this.get("delegate");(r?{x:r.attr("x"),y:r.attr("y")}:void 0)||n.getPointByClient(t.clientX,t.clientY);e=t.originalEvent.wheelDelta<0?.95:1/.95;var i=this.get("maxR"),o=this.get("minR"),a=this.get("r");(a>(i||n.get("height"))&&e>1||a<(o||.05*n.get("height"))&&e<1)&&(e=1),a*=e,this.set("r",a),this.filter(t)}},e.prototype.filter=function(t){var e=this.get("graph"),n=e.getNodes(),r={},i=this.get("r"),o=this.get("type"),a={x:t.x,y:t.y};this.updateDelegate(a,i);var s=this.get("shouldShow"),u=this.get("vShapes");u&&u.forEach((function(t){t.remove(),t.destroy()})),u=[],n.forEach((function(t){var e=t.getModel(),n=e.x,o=e.y;ws({x:n,y:o},a)<i&&(r[e.id]=t)}));var c=e.getEdges(),l=[];c.forEach((function(t){var e=t.getModel(),n=e.source,i=e.target;s(e)&&("only-source"===o||"one"===o?r[n]&&!r[i]&&l.push(t):"only-target"===o||"one"===o?r[i]&&!r[n]&&l.push(t):"both"===o&&r[n]&&r[i]&&l.push(t))}));var f=this.get("showNodeLabel"),h=this.get("showEdgelabel"),d=e.get("group");l.forEach((function(t){t.get("group").get("children").forEach((function(t){var e=t.get("type"),n=d.addShape(e,{attrs:t.attr()});u.push(n),f&&"text"===e&&n.set("visible",!0)}))})),Object.keys(r).forEach((function(t){var e=r[t].get("group").clone();if(d.add(e),u.push(e),h)for(var n=e.get("children"),i=0;i<n.length;i++){var o=n[i];"text"===o.get("type")&&o.set("visible",!0)}})),this.set("vShapes",u)},e.prototype.updateParams=function(t){var e=t.r,n=t.trigger,r=t.minR,i=t.maxR,o=t.scaleRBy,a=t.showLabel,s=t.shouldShow;if(isNaN(t.r)||this.set("r",e),isNaN(i)||this.set("maxR",i),isNaN(r)||this.set("minR",r),"mousemove"!==n&&"click"!==n||this.set("trigger",n),"wheel"===o||"unset"===o){this.set("scaleRBy",o),this.get("delegate").remove(),this.get("delegate").destroy();var u=this.get("dPercentText");u&&(u.remove(),u.destroy())}"node"!==a&&"both"!==a||this.set("showNodeLabel",!0),"edge"!==a&&"both"!==a||this.set("showEdgeLabel",!0),s&&this.set("shouldShow",s)},e.prototype.updateDelegate=function(t,e){var n=this,r=n.get("graph"),i=n.get("delegate");if(!i||i.destroyed){var o=r.get("group"),a=n.get("delegateStyle")||Es;i=o.addShape("circle",{attrs:_s({r:e,x:t.x,y:t.y},a),name:"lens-shape",draggable:!0}),"drag"!==this.get("trigger")&&"wheel"===this.get("scaleRBy")&&i.on("mousewheel",(function(t){n.scaleRByWheel(t)}))}else i.attr({x:t.x,y:t.y,r:e});n.set("delegate",i)},e.prototype.clear=function(){var t=this.get("vShapes");t&&t.forEach((function(t){t.remove(),t.destroy()})),t=[],this.set("vShapes",t);var e=this.get("delegate");e&&!e.destroyed&&(e.remove(),e.destroy())},e.prototype.destroy=function(){this.clear()},e}(ji),Os=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ms=cr.pointLineDistance,ks={stroke:"#FA8C16",lineWidth:1},As=function(t){function e(e){return t.call(this,e)||this}return Os(e,t),e.prototype.getDefaultCfgs=function(){return{line:ks,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},e.prototype.init=function(){},e.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},e.prototype.onDragStart=function(){this.initBoxLine()},e.prototype.onDrag=function(t){var e=t.item,n=(e.get("delegateShape")||e).getBBox(),r=e.getModel(),i=r.x-n.x,o=r.y-n.y;this.show({x:n.minX+i,y:n.minY+o},{width:n.width,height:n.height})},e.prototype.onDragEnd=function(){this.destory()},e.prototype.initBoxLine=function(){var t=this._cfgs,e=t.horizontalLines,n=t.verticalLines,r=t.itemAlignType;this.get("graph").getNodes().forEach((function(t){var i=t.getBBox(),o=t.get("id");!0===r||"horizontal"===r?(e["".concat(o,"tltr")]=[i.minX,i.minY,i.maxX,i.minY,t],e["".concat(o,"lcrc")]=[i.minX,i.centerY,i.maxX,i.centerY,t],e["".concat(o,"blbr")]=[i.minX,i.maxY,i.maxX,i.maxY,t]):"center"===r&&(e["".concat(o,"lcrc")]=[i.minX,i.centerY,i.maxX,i.centerY,t]),!0===r||"vertical"===r?(n["".concat(o,"tlbl")]=[i.minX,i.minY,i.minX,i.maxY,t],n["".concat(o,"tcbc")]=[i.centerX,i.minY,i.centerX,i.maxY,t],n["".concat(o,"trbr")]=[i.maxX,i.minY,i.maxX,i.maxY,t]):"center"===r&&(n["".concat(o,"tcbc")]=[i.centerX,i.minY,i.centerX,i.maxY,t])}))},e.prototype.show=function(t,e){var n=Object(p.mix)({},t);return this.itemAlign(t,e,n),t},e.prototype.itemAlign=function(t,e,n){var r=this,i=this._cfgs,o=i.horizontalLines,a=i.verticalLines,s=i.tolerance,u={x:n.x+e.width/2,y:n.y},c={x:n.x+e.width/2,y:n.y+e.height/2},l={x:n.x+e.width/2,y:n.y+e.height},f={x:n.x,y:n.y+e.height/2},h={x:n.x+e.width,y:n.y+e.height/2},d=[],g=[],v=null;if(this.clearAlignLine(),Object(p.each)(o,(function(t){t[4].isVisible&&(d.push(r.getLineDisObject(t,u)),d.push(r.getLineDisObject(t,c)),d.push(r.getLineDisObject(t,l)))})),Object(p.each)(a,(function(t){t[4].isVisible&&(g.push(r.getLineDisObject(t,f)),g.push(r.getLineDisObject(t,c)),g.push(r.getLineDisObject(t,h)))})),d.sort((function(t,e){return t.dis-e.dis})),g.sort((function(t,e){return t.dis-e.dis})),0!==d.length&&d[0].dis<s){t.y=d[0].line[1]-d[0].point.y+n.y,v={type:"item",horizontals:[d[0]]};for(var y=1;y<3;y++)d[0].dis===d[y].dis&&v.horizontals.push(d[y])}if(0!==g.length&&g[0].dis<s){t.x=g[0].line[0]-g[0].point.x+n.x,v?v.verticals=[g[0]]:v={type:"item",verticals:[g[0]]};for(y=1;y<3;y++)g[0].dis===g[y].dis&&v.verticals.push(g[y])}v&&(v.bbox=e,this.addAlignLine(v))},e.prototype.addAlignLine=function(t){var e=t.bbox,n=t.type,r=t.horizontals,i=t.verticals,o=this._cfgs,a=o.line,s=o.alignLines,u=this.get("graph").get("group");"item"===n&&(r&&Object(p.each)(r,(function(t){var n,r,i=t.line,o=t.point,c=(i[0]+i[2])/2;o.x<c?(n=o.x-e.width/2,r=Math.max(i[0],i[2])):(n=o.x+e.width/2,r=Math.min(i[0],i[2]));var l=Object(p.mix)({x1:n,y1:i[1],x2:r,y2:i[1]},a),f=u.addShape("line",{attrs:l,capture:!1});s.push(f)})),i&&Object(p.each)(i,(function(t){var n,r,i=t.line,o=t.point,c=(i[1]+i[3])/2;o.y<c?(n=o.y-e.height/2,r=Math.max(i[1],i[3])):(n=o.y+e.height/2,r=Math.min(i[1],i[3]));var l=Object(p.mix)({x1:i[0],y1:n,x2:i[0],y2:r},a),f=u.addShape("line",{attrs:l,capture:!1});s.push(f)})))},e.prototype.getLineDisObject=function(t,e){return{line:t,point:e,dis:Ms(t,e)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;Object(p.each)(t,(function(t){t.remove()})),t.length=0},e.prototype.destory=function(){var t=this._cfgs,e=t.horizontalLines,n=t.verticalLines;this.get("graph").getNodes().forEach((function(t){var r=t.get("id");delete e["".concat(r,"tltr")],delete e["".concat(r,"lcrc")],delete e["".concat(r,"blbr")],delete n["".concat(r,"tlbl")],delete n["".concat(r,"tcbc")],delete n["".concat(r,"trbr")]})),this.clearAlignLine()},e}(ji),Cs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ts=function(){return(Ts=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Is=["click","mouseenter"],js={PluginBase:ji,Menu:Fi,Grid:Di,Minimap:Wi,Bundling:qi,ToolBar:to,Tooltip:no,Fisheye:$i,TimeBar:vs,ImageMinimap:bs,EdgeFilterLens:Ss,SnapLine:As,Legend:function(t){function e(e){return t.call(this,e)||this}return Cs(e,t),e.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},e.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var t=this.get("filter")||{};t.multiple&&"mouseenter"===t.trigger&&this.set("multiple",!1);var e=this.get("align");if(!e){var n=this.get("position").split("-");n.includes("left")&&(e="left"),e=n.includes("right")?"right":"center",this.set("align",e)}var r=this.get("graph").get("container"),i=Ur("<div class='g6-legend-container' style=\"position: absolute;\"></div>");r.appendChild(i),this.set("container",i);var o=this.render();Vr(i,this.getContainerPos(o)),this.bindEvents()},e.prototype.getContainerPos=function(t){void 0===t&&(t=[0,0]);var e=this.get("graph"),n=this.get("offsetX"),r=this.get("offsetY"),i=this.get("margin"),o=this.get("position").split("-"),a={top:0,right:1,bottom:2,left:3},s={left:(e.getWidth()-t[0])/2+0,top:(e.getHeight()-t[1])/2+0};return o.forEach((function(n){var r=i[a[n]],o=n;switch(n){case"top":case"left":r+=0;break;case"bottom":r=e.getHeight()-t[1]-r+0,o="top";break;default:r=e.getWidth()-t[0]-r+0,o="left"}s[o]=r})),s.top+=r+e.getContainer().offsetTop,s.left+=n+e.getContainer().offsetLeft,Object.keys(s).forEach((function(t){s[t]="".concat(s[t],"px")})),s},e.prototype.bindEvents=function(){var t=this,e=t.get("filter");if(e&&e.enable){var n=e.trigger||"click";Is.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var r=t.get("legendCanvas");"mouseenter"===n?(r.on("node-container:mouseenter",(function(e){return t.filterData(e)})),r.on("node-container:mouseleave",(function(e){t.clearFilter(),t.clearActiveLegend()}))):(r.on("node-container:click",(function(e){return t.filterData(e)})),r.on("click",(function(e){e.target&&e.target.isCanvas&&e.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())})))}},e.prototype.changeData=function(t){this.set("data",t);var e=this.render();Vr(this.get("container"),this.getContainerPos(e))},e.prototype.activateLegend=function(t){var e=this.get("filter");(null==e?void 0:e.multiple)||this.clearActiveLegend();var n=t.get("parent");n.get("active")?(n.set("active",!1),this.findLegendItemsByState("active").length&&n.set("inactive",!0)):(n.set("inactive",!1),n.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach((function(t){t.set("inactive",!0)})):this.clearActiveLegend();var r=(null==e?void 0:e.lengedStateStyles)||{},i=(null==r?void 0:r.inactive)||{opacity:.5,"text-shape":{opacity:.5}},o=i["text-shape"]||{};this.findLegendItemsByState("inactive").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Ts(Ts({},n.get("oriAttrs")),i)),r.attr(Ts(Ts({},r.get("oriAttrs")),o))}));var a=(null==r?void 0:r.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},s=a["text-shape"]||{};this.findLegendItemsByState("active").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Ts(Ts({},n.get("oriAttrs")),a)),r.attr(Ts(Ts({},r.get("oriAttrs")),s))}))},e.prototype.findLegendItemsByState=function(t,e,n){void 0===e&&(e="all"),void 0===n&&(n=!0);var r=this.get("legendCanvas").find((function(t){return"root"===t.get("name")})),i=r.find((function(t){return"node-group"===t.get("name")})),o=r.find((function(t){return"edge-group"===t.get("name")}));return"node"===e?i.get("children").filter((function(e){return!!e.get(t)===n})):"edge"===e?o.get("children").filter((function(e){return!!e.get(t)===n})):i.get("children").filter((function(e){return!!e.get(t)===n})).concat(o.get("children").filter((function(e){return!!e.get(t)===n})))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas").find((function(t){return"root"===t.get("name")}));[t.find((function(t){return"node-group"===t.get("name")})),t.find((function(t){return"edge-group"===t.get("name")}))].forEach((function(t){t.get("children").forEach((function(t){t.set("active",!1),t.set("inactive",!1);var e=t.get("children"),n=e[0],r=e[1];n.attr(n.get("oriAttrs")),r.attr(r.get("oriAttrs"))}))}))},e.prototype.filterData=function(t){var e=this.get("filter"),n=null==e?void 0:e.filterFunctions;if(e&&n){var r=this.get("legendCanvas"),i=this.get("graph"),o=e.graphActiveState||"active",a=e.graphInactiveState||"inactive",s=e.multiple;this.clearFilter(),s||this.clearActiveLegend(),this.activateLegend(t.target);var u=r.find((function(t){return"root"===t.get("name")})),c=u.find((function(t){return"node-group"===t.get("name")})),l=u.find((function(t){return"edge-group"===t.get("name")})),f=c.get("children").filter((function(t){return t.get("active")})),h=l.get("children").filter((function(t){return t.get("active")})),d=0,p=["getNodes","getEdges"];p.forEach((function(t){i[t]().forEach((function(e){var r=!1;("getNodes"===t?f:h).forEach((function(t){var i=n[t.get("id")];r=r||i(e.getModel())})),r?(i.setItemState(e,a,!1),i.setItemState(e,o,!0),d++):(i.setItemState(e,o,!1),i.setItemState(e,a,!0))}))})),d||p.forEach((function(t){i[t]().forEach((function(t){i.clearItemStates(t,[a])}))}))}},e.prototype.clearFilter=function(){var t=this.get("graph"),e=this.get("filter");if(e){var n=e.graphActiveState||"active",r=e.graphInactiveState||"inactive";t.getNodes().forEach((function(e){t.clearItemStates(e,[n,r])})),t.getEdges().forEach((function(e){t.clearItemStates(e,[n,r])}))}},e.prototype.render=function(){var t=this;this.processData();var e=this.get("legendCanvas");if(!e){var n=(e=new mr.Canvas({container:this.get("container"),width:200,height:200})).addGroup({name:"root"});n.addGroup({name:"node-group"}),n.addGroup({name:"edge-group"}),this.set("legendCanvas",e)}var r=e.find((function(t){return"root"===t.get("name")})),i=r.find((function(t){return"node-group"===t.get("name")})),o=r.find((function(t){return"edge-group"===t.get("name")})),a=this.get("itemsData"),s=[i,o];["nodes","edges"].forEach((function(e,n){a[e].forEach((function(r){var i,o,a=s[n].addGroup({id:r.id,name:"node-container"}),u=r.type,c=t.getShapeSize(r),l=c.width,f=c.height,h=c.r,d=t.getStyle(e.substr(0,4),r);switch(r.type){case"circle":o={r:h,x:0,y:0};break;case"rect":o={width:l,height:f,x:-l/2,y:-f/2};break;case"ellipse":o={r1:l,r2:f,x:0,y:0};break;case"line":o={x1:-l/2,y1:0,x2:l/2,y2:0},u="line";break;case"quadratic":o={path:[["M",-l/2,0],["Q",0,l/2,l/2,0]]},u="path";break;case"cubic":o={path:[["M",-l/2,0],["C",-l/6,l/2,l/6,-l/2,l/2,0]]},u="path";break;default:o={r:h,x:0,y:0}}var p=a.addShape(u,{attrs:Ts(Ts({},o),d),name:"".concat(r.type,"-node-keyShape"),oriAttrs:Ts({opacity:1},d)});if(r.label){var g=p.getBBox(),v=(null===(i=r.labelCfg)||void 0===i?void 0:i.style)||{},y=Ts({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},v);a.addShape("text",{attrs:Ts({x:g.maxX+4,y:0,text:r.label},y),className:"legend-label",name:"".concat(r.type,"-node-text"),oriAttrs:y})}}))}));var u,c=this.get("padding"),l=r.find((function(t){return"title-container"===t.get("name")})),f={height:0,maxY:0,width:0};if(this.get("title")){l||(l=r.addGroup({name:"title-container"}));var h={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:c[0]},d=this.get("titleConfig")||{},p=Object.assign(h,d.style||{});u=l.addShape("text",{attrs:Ts({text:this.get("title")},p)}),f=l.getCanvasBBox(),l.setMatrix([1,0,0,0,1,0,d.offsetX,d.offsetY,1])}this.layoutItems();var g=r.getCanvasBBox(),v=i.getCanvasBBox(),y=v.minX<0?Math.abs(v.minX)+c[3]:c[3],m=f.maxY<v.minY?Math.abs(f.maxY-v.minY)+c[0]:f.maxY+c[0],b=[1,0,0,0,1,0,y,m,1];i.setMatrix(b);var x=[(g=r.getCanvasBBox()).minX+g.width+c[1],g.minY+g.height+c[2]];if(u){d=Ts({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));f=l.getCanvasBBox();var _=l.getMatrix()||[1,0,0,0,1,0,0,0,1];"center"===d.position?_[6]=x[0]/2+d.offsetX:"right"===d.position?(_[6]=x[0]-c[3]+d.offsetX,u.attr({textAlign:"right"})):(_[6]=c[3]+d.offsetX,u.attr({textAlign:"left"})),l.setMatrix(_),f=l.getCanvasBBox(),b=[1,0,0,0,1,0,y=v.minX<0?Math.abs(v.minX)+c[3]:c[3],m=v.minY<f.maxY?Math.abs(f.maxY-v.minY)+c[0]:f.maxY+c[0],1],i.setMatrix(b);var w=[1,0,0,0,1,0,y,m,1];"vertical"===this.get("layout")?w[6]+=v.maxX+this.get("horiSep"):w[7]+=v.maxY+this.get("vertiSep"),o.setMatrix(w)}else{v=i.getCanvasBBox();var E=[1,0,0,0,1,0,0,0,1];"vertical"===this.get("layout")?E[6]+=b[6]+v.maxX+this.get("horiSep"):E[7]+=b[7]+v.maxY+this.get("vertiSep"),o.setMatrix(E)}g=r.getCanvasBBox(),v=i.getCanvasBBox(),b=i.getMatrix()||[1,0,0,0,1,0,0,0,1];var S=o.getMatrix()||[1,0,0,0,1,0,0,0,1],O=o.getCanvasBBox();x=[Math.max(v.width+b[6],O.width+S[6])+c[1],Math.max(v.height+b[7],O.height+S[7])+c[2]],e.changeSize(x[0],x[1]);var M=this.get("containerStyle"),k=r.getMatrix()||[1,0,0,0,1,0,0,0,1],A=cr.invertMatrix({x:0,y:0},k);return r.addShape("rect",{attrs:Ts({x:A.x+(M.lineWidth||1),y:A.y+(M.lineWidth||1),width:x[0]-2*(M.lineWidth||1),height:x[1]-2*(M.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},M),name:"legend-back-rect",capture:!1}).toBack(),x},e.prototype.layoutItems=function(){var t=this.get("legendCanvas"),e=this.get("horiSep"),n=this.get("vertiSep"),r=this.get("layout"),i=this.get("align"),o=[0,0],a=t.find((function(t){return"root"===t.get("name")})),s=a.find((function(t){return"node-group"===t.get("name")})),u=a.find((function(t){return"edge-group"===t.get("name")})),c={min:0,max:-1/0},l=-1/0;s.get("children").forEach((function(t,i){0===i&&(c.min=o[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),f=u.width,h=u.height,d=0,p=0,g=0;"vertical"===r?(p=o[1],g=o[0]+f/2,o[0]=g+s.height+n,d=s.maxX+p+f/2):(p=o[0]+f/2,g=o[1],o[0]=p+s.width+e,d=s.maxY+g+h/2),o[0]>c.max&&(c.max=o[0]),d>l&&(l=d),t.setMatrix([1,0,0,0,1,0,p,g,1])}));var f=c.max-c.min,h={min:0,max:-1/0},d=s.getCanvasBBox();o[0]=0,o[1]="vertical"===r?d.maxX+e:d.maxY+n,u.get("children").forEach((function(t,i){0===i&&(h.min=o[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),c=u.width,l=u.height,f=0,d=0;"vertical"===r?(f=o[1],d=o[0],o[0]=d+s.height+n,t.setMatrix([1,0,0,0,1,0,0,d+l/2,1])):(f=o[0],d=o[1],o[0]=f+s.width+e,t.setMatrix([1,0,0,0,1,0,f+c/2,0,1])),o[0]>h.max&&(h.max=o[0])}));var p=h.max-h.min;if(i&&""!==i&&"left"!==i){var g=f-p,v="center"===i?Math.abs(g)/2:Math.abs(g);(g<0?s:u).get("children").forEach((function(t){var e=t.getMatrix()||[1,0,0,0,1,0,0,0,1];"vertical"===r?e[7]+=v:e[6]+=v,t.setMatrix(e)}))}},e.prototype.processData=function(){var t=this.get("data"),e={nodes:[],edges:[]};t.nodes&&(t.nodes.sort((function(t,e){return t.order-e.order})),t.nodes.forEach((function(t){var n,r,i,o,a,s=t.size||[(null===(n=t.style)||void 0===n?void 0:n.width)||(null===(r=t.style)||void 0===r?void 0:r.r)||8,(null===(i=t.style)||void 0===i?void 0:i.height)||(null===(o=t.style)||void 0===o?void 0:o.r)||8],u=(null===(a=t.labelCfg)||void 0===a?void 0:a.style)||{};e.nodes.push({id:t.id||Object(p.uniqueId)(),type:t.type||"circle",style:Ts({},t.style),order:t.order,label:t.label,itemType:"node",size:s,labelCfg:{position:"right",style:Ts({fontFamily:"Arial"},u)}})}))),t.edges&&(t.edges.sort((function(t,e){return t.order-e.order})),t.edges.forEach((function(t){var n,r,i=t.type||"line";"cubic-horizontal"===t.type&&(i="cubic");var o=(null===(n=t.labelCfg)||void 0===n?void 0:n.style)||{},a=t.size||[(null===(r=t.style)||void 0===r?void 0:r.width)||8,1];e.edges.push({id:t.id||Object(p.uniqueId)(),type:i,size:a,style:Ts({lineWidth:Object(p.isArray)(a)?a[1]:1},t.style),order:t.order,label:t.label,itemType:"edge",labelCfg:{position:"right",style:Ts({fontFamily:"Arial"},o)}})}))),this.set("itemsData",e)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var e=this.get(t);if(Object(p.isNumber)(e))this.set(t,[e,e,e,e]);else if(Object(p.isArray)(e))switch(e.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[e[0],e[0],e[0],e[0]]);break;case 2:this.set(t,[e[0],e[1],e[0],e[1]]);break;case 3:this.set(t,[e[0],e[1],e[2],e[1]])}return this.get(t)},e.prototype.getShapeSize=function(t){var e,n,r;return t.size&&(Object(p.isArray)(t.size)?(e=t.size[0],n=t.size[1]||t.size[0],r=t.size[0]/2):Object(p.isNumber)(t.size)&&(e=t.size,n=t.size,r=t.size/2)),t.style&&(t.style.width&&(e=t.style.width),t.style.height&&(n=t.style.height),t.style.r&&(r=t.style.r)),r||(r=5),e||(e=r),n||(n=r),{width:e,height:n,r:r}},e.prototype.getStyle=function(t,e){return Ts(Ts({},"node"===t?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1}),e.style||{})},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(ji)};hr("circle",{options:{size:vr.defaultNode.size,style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(p.deepMix)({},r,t.icon),a="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:i,className:a,name:a,draggable:!0});e.shapeMap[a]=s;var u=o.width,c=o.height,l=o.show,f=o.text;if(l){var h="".concat(this.type,"-icon");e.shapeMap[h]=f?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:h,name:h,draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-u/2,y:-c/2},o),className:h,name:h,draggable:!0})}return this.drawLinkPoints(t,e),s},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints;if(n){var r=n||{},i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t)[0]/2;if(o){var h="link-point-left";e.shapeMap[h]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-f,y:0,r:u/2||c||5}),className:h,name:h,isAnchorPoint:!0})}if(a){var p="link-point-right";e.shapeMap[p]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:f,y:0,r:u/2||c||5}),className:p,name:p,isAnchorPoint:!0})}if(i){var g="link-point-top";e.shapeMap[g]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-f,r:u/2||c||5}),className:g,name:g,isAnchorPoint:!0})}if(s){var v="link-point-bottom";e.shapeMap[v]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:f,r:u/2||c||5}),className:v,name:v,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.deepMix)({},e,n),i=this.getSize(t)[0]/2;return Object(d.__assign)({x:0,y:0,r:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getSize(t),o=Object(d.__assign)({},t.style);void 0===t.style.stroke&&t.color&&(o.stroke=t.color),void 0!==t.style.r||isNaN(i[0])||(o.r=i[0]/2),this.updateShape(t,e,o,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("rect",{options:{size:[100,30],style:{radius:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=r,this.drawLinkPoints(t,e),r},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a=e.get("keyShape");t.size||(o[0]=a.attr("width")||i.width,o[1]=a.attr("height")||i.height);var s={stroke:t.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},u=Object(p.mix)({},i,a.attr(),s);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!1,n),this.updateLinkPoints(t,r)}},"single-node"),hr("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0]/2,p=f[1]/2;o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=i[0]/2,a=i[1]/2;return Object(d.__assign)({x:0,y:0,rx:o,ry:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a={stroke:t.color,rx:o[0]/2,ry:o[1]/2},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("diamond",{options:{size:[80,80],style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),n=e[0],r=e[1];return[["M",0,-r/2],["L",n/2,0],["L",0,r/2],["L",-n/2,0],["Z"]]},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),hr("triangle",{options:{size:40,direction:"up",style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.icon,i=void 0===r?{}:r,o=n.direction,a=this.getShapeStyle(t),s=t.direction||o,u=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=i.width,l=i.height,f=i.show,h=i.offset,p=i.text;if(f)if(p)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var g=-c/2,v=-l/2;"up"!==s&&"down"!==s||(v+=h),"left"!==s&&"right"!==s||(g+=h),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:Object(d.__assign)({x:g,y:v},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.linkPoints,i=void 0===r?{}:r,o=n.direction,a=t.direction||o,s=i.top,u=i.left,c=i.right,l=i.bottom,f=i.size,h=i.r,p=Object(d.__rest)(i,["top","left","right","bottom","size","r"]),g=this.getSize(t)[0];if(u){var v=null,y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?v=[-m,y]:"down"===a?v=[-m,-y]:"left"===a&&(v=[-m,m-y]),v&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:v[0],y:v[1],r:f/2||h||5}),className:"link-point-left",name:"link-point-left"}))}if(c){var b=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?b=[m,y]:"down"===a?b=[m,-y]:"right"===a&&(b=[m,m-y]),b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:b[0],y:b[1],r:f/2||h||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var x=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"up"===a?x=[m-y,-y]:"left"===a?x=[m,-y]:"right"===a&&(x=[-m,-y]),x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:x[0],y:x[1],r:f/2||h||5}),className:"link-point-top",name:"link-point-top"}))}if(l){var _=null;y=g*Math.sin(1/3*Math.PI),m=g*Math.sin(1/3*Math.PI);"down"===a?_=[-m+y,y]:"left"===a?_=[m,y]:"right"===a&&(_=[-m,y]),_&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},p),{x:_[0],y:_[1],r:f/2||h||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,n=t.direction||e,r=this.getSize(t)[0],i=r*Math.sin(1/3*Math.PI),o=r*Math.sin(1/3*Math.PI),a=[["M",-o,i],["L",0,-i],["L",o,i],["Z"]];return"down"===n?a=[["M",-o,-i],["L",o,-i],["L",0,i],["Z"]]:"left"===n?a=[["M",-o,o-i],["L",o,-o],["L",o,o],["Z"]]:"right"===n&&(a=[["M",o,o-i],["L",-o,o],["L",-o,-o],["Z"]]),a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}),r=n.linkPoints,i=n.direction,o=t.direction||i,a=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),s=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),u=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),c=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")})),l=r,f=a||s||u||c;f&&(l=f.attr());var h=Object(p.mix)({},l,t.linkPoints),g=h.fill,v=h.stroke,y=h.lineWidth,m=h.size/2;m||(m=h.r);var b=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},x=b.left,_=b.right,w=b.top,E=b.bottom,S=this.getSize(t)[0],O={r:m,fill:g,stroke:v,lineWidth:y},M=null,k=S*Math.sin(1/3*Math.PI),A=S*Math.sin(1/3*Math.PI);"up"===o?M=[-A,k]:"down"===o?M=[-A,-k]:"left"===o&&(M=[-A,A-k]),M&&(a?x||void 0===x?a.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:M[0],y:M[1]})):(a.remove(),delete e.shapeMap["link-point-left"]):x&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:M[0],y:M[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var C=null;"up"===o?C=[A,k]:"down"===o?C=[A,-k]:"right"===o&&(C=[A,A-k]),C&&(s?_||void 0===_?s.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:C[0],y:C[1]})):(s.remove(),delete e.shapeMap["link-point-right"]):_&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:C[0],y:C[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var T=null;"up"===o?T=[A-k,-k]:"left"===o?T=[A,-k]:"right"===o&&(T=[-A,-k]),T&&(u?w||void 0===w?u.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:T[0],y:T[1]})):(u.remove(),delete e.shapeMap["link-point-top"]):w&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:T[0],y:T[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var I=null;"down"===o?I=[-A+k,k]:"left"===o?I=[A,k]:"right"===o&&(I=[-A,k]),I&&(c?E||void 0===E?c.attr(Object(d.__assign)(Object(d.__assign)({},O),{x:I[0],y:I[1]})):(c.remove(),delete e.shapeMap["link-point-bottom"]):E&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},O),{x:I[0],y:I[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),hr("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:vr.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:vr.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:vr.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).preRect,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=this.getSize(t),a=o[0],s=o[1],u=e.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=r.show,l=Object(d.__rest)(r,["show"]);return c&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:Object(d.__assign)({x:-a/2,y:-s/2,height:s},l),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),u},drawLogoIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).logoIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(d.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-logo-icon"]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:s||-i/2+o+c,y:u||-a/2,width:o,height:a}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).stateIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(d.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-state-icon"]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:s||i/2-o+c,y:u||-a/2,width:o,height:a}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(d.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:-p/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},l),{x:0,y:p/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var n=this.getOptions(t),r=n.labelCfg,i=void 0===r?{}:r,o=n.logoIcon,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t)[0],l=null,f=a.show,h=a.width,g=-c/2+i.offset;f&&(g=-c/2+h+i.offset);var v=i.style,y=u.style,m=u.paddingTop;return Object(p.isString)(t.description)?(l=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},v),{x:g,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l,e.shapeMap["rect-description"]=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},y),{x:g,y:17+(m||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(l=e.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},v),{x:g,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l),l},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(d.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.style,i=void 0===r?{}:r,o=n.labelCfg,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t),l=c[0],f=c[1];e.get("keyShape").attr(Object(d.__assign)(Object(d.__assign)({},i),{x:-l/2,y:-f/2,width:l,height:f}));var h=e.getContainer(),g=h.shapeMap["rect-logo-icon"]||h.find((function(t){return"rect-logo-icon"===t.get("className")})),v=g?g.attr():{},y=Object(p.mix)({},v,t.logoIcon),m=y.width;void 0===m&&(m=this.options.logoIcon.width);var b=t.logoIcon?t.logoIcon.show:void 0,x=a.offset,_=-l/2+m+x;b||void 0===b||(_=-l/2+x);var w=h.shapeMap["node-label"]||h.find((function(t){return"node-label"===t.get("className")})),E=h.shapeMap["rect-description"]||h.find((function(t){return"rect-description"===t.get("className")}));if(t.label)if(w){var S=t.labelCfg?t.labelCfg.style:{},O=Object(p.mix)({},w.attr(),S);t.label&&(O.text=t.label),O.x=_,Object(p.isString)(t.description)&&(O.y=-5),E&&(E.resetMatrix(),E.attr({x:_})),w.resetMatrix(),w.attr(O)}else h.shapeMap["node-label"]=h.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},a.style),{x:_,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});if(Object(p.isString)(t.description)){var M=u.paddingTop;if(E){S=t.descriptionCfg?t.descriptionCfg.style:{};var k=Object(p.mix)({},E.attr(),S);Object(p.isString)(t.description)&&(k.text=t.description),k.x=_,E.resetMatrix(),E.attr(Object(d.__assign)(Object(d.__assign)({},k),{y:17+(M||0)}))}else h.shapeMap["rect-description"]=h.addShape("text",{attrs:Object(d.__assign)(Object(d.__assign)({},u.style),{x:_,y:17+(M||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})}var A=h.shapeMap["pre-rect"]||h.find((function(t){return"pre-rect"===t.get("className")}));if(A&&!A.destroyed){var C=Object(p.mix)({},A.attr(),t.preRect);A.attr(Object(d.__assign)(Object(d.__assign)({},C),{x:-l/2,y:-f/2,height:f}))}if(g&&!g.destroyed)if(b||void 0===b){var T=y.width,I=y.height,j=y.x,P=y.y,N=y.offset,D=Object(d.__rest)(y,["width","height","x","y","offset"]);g.attr(Object(d.__assign)(Object(d.__assign)({},D),{x:j||-l/2+T+N,y:P||-I/2,width:T,height:I}))}else g.remove(),delete h.shapeMap["pre-rect"];else b&&this.drawLogoIcon(t,h);var L=h.shapeMap["rect-state-icon"]||h.find((function(t){return"rect-state-icon"===t.get("className")})),R=L?L.attr():{},B=Object(p.mix)({},R,t.stateIcon);if(L){B.show||void 0===B.show||(L.remove(),delete h.shapeMap["rect-state-icon"]);var F=B.width,G=(I=B.height,j=B.x,P=B.y,B.offset),z=Object(d.__rest)(B,["width","height","x","y","offset"]);L.attr(Object(d.__assign)(Object(d.__assign)({},z),{x:j||l/2-F+G,y:P||-I/2,width:F,height:I}))}else B.show&&this.drawStateIcon(t,h);this.updateLinkPoints(t,h)}},"single-node"),hr("star",{options:{size:60,style:{stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.leftBottom,u=r.rightBottom,c=r.size,l=r.r,f=Object(d.__rest)(r,["top","left","right","leftBottom","rightBottom","size","r"]),h=this.getSize(t)[0];if(a){var p=Math.cos(.1*Math.PI)*h,g=Math.sin(.1*Math.PI)*h;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-right",name:"link-point-right"})}if(i){p=Math.cos(.5*Math.PI)*h,g=Math.sin(.5*Math.PI)*h;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-top",name:"link-point-top"})}if(o){p=Math.cos(.9*Math.PI)*h,g=Math.sin(.9*Math.PI)*h;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-left",name:"link-point-left"})}if(s){p=Math.cos(1.3*Math.PI)*h,g=Math.sin(1.3*Math.PI)*h;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(u){p=Math.cos(1.7*Math.PI)*h,g=Math.sin(1.7*Math.PI)*h;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},f),{x:p,y:-g,r:c/2||l||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){for(var e=this.getSize(t)[0],n=3*e/8,r=t.innerR||n,i=[],o=0;o<5;o++){var a=Math.cos((18+72*o)/180*Math.PI)*e,s=Math.sin((18+72*o)/180*Math.PI)*e,u=Math.cos((54+72*o)/180*Math.PI)*r,c=Math.sin((54+72*o)/180*Math.PI)*r;0===o?i.push(["M",a,-s]):i.push(["L",a,-s]),i.push(["L",u,-c])}return i.push(["Z"]),i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(p.mix)({},e,n),i=this.getPath(t);return Object(d.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(p.mix)({},i,s.attr(),a);u=Object(p.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}).linkPoints,r=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),i=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),o=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),a=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-left-bottom"===t.get("className")})),s=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-right-bottom"===t.get("className")})),u=n,c=r||i||o||a||s;c&&(u=c.attr());var l=Object(p.mix)({},u,t.linkPoints),f=l.fill,h=l.stroke,g=l.lineWidth,v=l.size/2;v||(v=l.r);var y=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},m=y.left,b=y.right,x=y.top,_=y.leftBottom,w=y.rightBottom,E=this.getSize(t)[0],S={r:v,fill:f,stroke:h,lineWidth:g},O=Math.cos(.1*Math.PI)*E,M=Math.sin(.1*Math.PI)*E;i?b||void 0===b?i.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(i.remove(),delete e.shapeMap["link-point-right"]):b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),O=Math.cos(.5*Math.PI)*E,M=Math.sin(.5*Math.PI)*E,o?x||void 0===x?o.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(o.remove(),delete e.shapeMap["link-point-top"]):x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),O=Math.cos(.9*Math.PI)*E,M=Math.sin(.9*Math.PI)*E,r?m||void 0===m?r.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(r.remove(),delete e.shapeMap["link-point-left"]):m&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),O=Math.cos(1.3*Math.PI)*E,M=Math.sin(1.3*Math.PI)*E,a?_||void 0===_?a.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(a.remove(),delete e.shapeMap["link-point-left-bottom"]):_&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),O=Math.cos(1.7*Math.PI)*E,M=Math.sin(1.7*Math.PI)*E,s?w||void 0===w?s.attr(Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M})):(a.remove(),delete e.shapeMap["link-point-right-bottom"]):w&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(d.__assign)(Object(d.__assign)({},S),{x:O,y:-M}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Ps=cr.defaultSubjectColors;hr("donut",{options:{size:vr.defaultNode.size,style:{x:0,y:0,stroke:vr.defaultNode.style.stroke,fill:vr.defaultNode.style.fill,lineWidth:vr.defaultNode.style.lineWidth},labelCfg:{style:{fill:vr.nodeLabel.style.fill,fontSize:vr.nodeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vr.defaultNode.linkPoints.size,lineWidth:vr.defaultNode.linkPoints.lineWidth,fill:vr.defaultNode.linkPoints.fill,stroke:vr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(d.__assign)({},vr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(p.deepMix)({},r,t.icon),a=e.addShape("circle",{attrs:i,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=a;var s=o.width,u=o.height,c=o.show,l=o.text;c&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:Object(d.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(d.__assign)({x:-s/2,y:-u/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}));var f=a.attr("r"),h=.6*f,g=(f+h)/2,v=t,y=v.donutAttrs,m=void 0===y?{}:y,b=v.donutColorMap,x=void 0===b?{}:b,_=Object.keys(m).length;if(m&&_>1){var w=[],E=0;if(Object.keys(m).forEach((function(t){var e=m[t]||0;Object(p.isNumber)(e)&&(w.push({key:t,value:e,color:x[t]}),E+=e)})),E){var S=f-h;if(1===_)return void(e.shapeMap["fan-shape-0"]=e.addShape("circle",{attrs:{r:g,x:0,y:0,stroke:w[0].color||Ps[0],lineWidth:S},name:"fan-shape-0"}));var O=[g,0],M=0;w.forEach((function(t,n){var r=t.value/E;if(!(r<.001))if(r>.999&&(r=1),1!==r){t.percent=r,t.angle=r*Math.PI*2,t.beginAgnle=M,M+=t.angle,t.endAngle=M,t.arcBegin=O,t.arcEnd=[g*Math.cos(t.endAngle),-g*Math.sin(t.endAngle)];var i=t.angle>Math.PI?1:0,o=[["M",t.arcBegin[0],t.arcBegin[1]],["A",g,g,0,i,0,t.arcEnd[0],t.arcEnd[1]],["L",t.arcEnd[0],t.arcEnd[1]]];e.shapeMap["fan-shape-".concat(n)]=e.addShape("path",{attrs:{path:o,lineWidth:S,stroke:t.color||Ps[n%Ps.length]},name:"fan-shape-".concat(n)}),O=t.arcEnd}else e.shapeMap["fan-shape-".concat(n)]=e.addShape("circle",{attrs:{r:g,x:0,y:0,stroke:t.color||Ps[n%Ps.length],lineWidth:S},name:"fan-shape-".concat(n)})}))}}return this.drawLinkPoints(t,e),a},update:void 0},"circle");var Ns=function(t){var e=t.x,n=t.y;return{x:e,y:n,centerX:e,centerY:n,minX:e,minY:n,maxX:e,maxY:n,height:0,width:0}},Ds=function(t){for(var e=[],n={},r=t.length-1;r>=0;r--){var i=t[r];i.id="".concat(i.x,"|||").concat(i.y),n[i.id]=i,e.push(i)}return e},Ls=function(t){return Ds(t)},Rs=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},Bs=function(t,e,n){var r=function(t,e){var n=Math.abs(t.x-e.centerX),r=Math.abs(t.y-e.centerY);return 0===n&&0===r?0:n/e.width>r/e.height}(e,t);if(0===r){var i=t.centerX,o=t.centerY;return n.y<e.y?o=t.minY:n.x>e.x?i=t.maxX:n.x<e.x?i=t.minX:n.x===e.x&&(o=t.maxY),{x:i,y:o}}return r?{x:e.x>t.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},Fs=function(t,e){var n=Math.min(t.minX,e.minX),r=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),o=Math.max(t.maxY,e.maxY);return{centerX:(n+i)/2,centerY:(r+o)/2,minX:n,minY:r,maxX:i,maxY:o,height:o-r,width:i-n}},Gs=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},zs=function(t,e){var n=t.x,r=t.y;return n<e.minX||n>e.maxX||r<e.minY||r>e.maxY},Us=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Vs=function(t,e,n,r,i){return Us(t,e)+Us(t,n)+function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n}(t,[e,n,r,i])},Ws=function t(e,n,r,i,o){void 0===o&&(o=0),e.unshift(n[i]),r[i]&&r[i]!==i&&o<=100&&t(e,n,r,r[i],o+1)},Xs=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=r.x-t.x,s=r.y-t.y,u=n.x-e.x,c=n.y-e.y,l=r.x-e.x,f=r.y-e.y;return(i*s-o*a)*(u*f-c*l)<=0&&(i*c-o*u)*(a*f-s*l)<=0},Ys=function(t,e,n){if(n.width||n.height){var r=Gs(n),i=r[0],o=r[1],a=r[2],s=r[3];return Xs(t,e,i,o)||Xs(t,e,i,s)||Xs(t,e,o,a)||Xs(t,e,a,s)}return!1},Hs=function(t,e,n,r){var i=[];return t.forEach((function(t){if(t!==e&&(t.x===e.x||t.y===e.y)){if(Ys(t,e,n)||Ys(t,e,r))return;i.push(t)}})),Ds(i)},qs=function(t,e){var n=[],r=t[0];return n.push("M".concat(r.x," ").concat(r.y)),t.forEach((function(r,i){var o=t[i+1],a=t[i+2];if(o&&a)if(function(t,e,n){return!(t.x===e.x&&e.x===n.x||t.y===e.y&&e.y===n.y)}(r,o,a)){var s=function(t,e,n,r){var i=Us(t,e),o=Us(n,e);return i<r&&(r=i),o<r&&(r=o),[{x:e.x-r/i*(e.x-t.x),y:e.y-r/i*(e.y-t.y)},{x:e.x-r/o*(e.x-n.x),y:e.y-r/o*(e.y-n.y)}]}(r,o,a,e),u=s[0],c=s[1];n.push("L".concat(u.x," ").concat(u.y)),n.push("Q".concat(o.x," ").concat(o.y," ").concat(c.x," ").concat(c.y)),n.push("L".concat(c.x," ").concat(c.y))}else n.push("L".concat(o.x," ").concat(o.y));else o&&n.push("L".concat(o.x," ").concat(o.y))})),n.join("")},Ks=function(t,e,n,r,i){var o,a;if(n&&n.getType())if("combo"===n.getType()){(o=n.getKeyShape().getCanvasBBox()||Ns(t)).centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=n.getBBox();else o=Ns(t);if(r&&r.getType())if("combo"===r.getType()){var s=r.getKeyShape().getBBox();if(s){var u=r.getModel(),c=u.x,l=u.y;(a={x:c,y:l,width:s.width,height:s.height,minX:s.minX+c,maxX:s.maxX+c,minY:s.minY+l,maxY:s.maxY+l}).centerX=(a.minX+a.maxX)/2,a.centerY=(a.minY+a.maxY)/2}else a=Ns(e)}else a=r&&r.getBBox();else a=Ns(e);var f=Rs(o,i),h=Rs(a,i),d=Bs(f,t,e),p=Bs(h,e,t),g=function(t){void 0===t&&(t=[]);var e=[],n=[];t.forEach((function(t){e.push(t.x),n.push(t.y)}));var r=Math.min.apply(Math,e),i=Math.max.apply(Math,e),o=Math.min.apply(Math,n),a=Math.max.apply(Math,n);return{centerX:(r+i)/2,centerY:(o+a)/2,maxX:i,maxY:a,minX:r,minY:o,height:a-o,width:i-r}}([d,p]),v=Fs(f,g),y=Fs(h,g),m=[];m=m.concat(Gs(v)).concat(Gs(y));var b={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[g,v,y].forEach((function(t){m=m.concat(function(t,e){return function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x).concat(function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y))}(t,b).filter((function(t){return zs(t,f)&&zs(t,h)})))})),[{x:d.x,y:p.y},{x:p.x,y:d.y}].forEach((function(t){zs(t,f)&&zs(t,h)&&m.push(t)})),m.unshift(d),m.push(p);var x=function(t,e,n,r,i,o,a){var s=[],u=[e],c={},l={},f={};l[e.id]=0,f[e.id]=Vs(e,n,e);var h,d,p,g,v,y={};for(t.forEach((function(t){y[t.id]=t}));u.length;){if(h=void 0,d=1/0,u.forEach((function(t){f[t.id]<=d&&(d=f[t.id],h=t)})),h===n){var m=[];return Ws(m,y,c,n.id),m}g=h,v=void 0,(v=(p=u).indexOf(g))>-1&&p.splice(v,1),s.push(h),Hs(t,h,r,i).forEach((function(t){if(-1===s.indexOf(t)){-1===u.indexOf(t)&&u.push(t);var r=f[h.id]+Us(h,t);l[t.id]&&r>=l[t.id]||(c[t.id]=h.id,l[t.id]=r,f[t.id]=l[t.id]+Vs(t,n,e,o,a))}}))}return[e,n]}(m=Ds(m),d,p,o,a,t,e);return x.unshift(t),x.push(e),Ls(x)},Zs={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},fallbackRoute:function(t,e,n,r,i){return Ls(Ks(t,e,n,r,i.offset))}},Qs=(Math.PI,function(t,e){var n=Math.round(Math.abs(t/e));return n<0?0:(t<0?-1:1)*n}),$s=function(t,e){var n=e.x-t.x,r=e.y-t.y;return n||r?Math.atan2(r,n):0},Js=function(t,e){var n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n},tu=function(t,e,n){for(var r=1/0,i=0,o=e.length;i<o;i++){var a=n(t,e[i]);a<r&&(r=a)}return r},eu=function(t,e,n,r,i){var o=[];if(!n)return[t];var a=i.directions,s=i.offset,u=n.getBBox(),c=e.x>u.minX&&e.x<u.maxX&&e.y>u.minY&&e.y<u.maxY,l=Rs(u,s);for(var f in l)l[f]=Qs(l[f],i.gridSize);if(c){for(var h=0,d=a;h<d.length;h++){var p=d[h],g=[[{x:l.minX,y:l.minY},{x:l.maxX,y:l.minY}],[{x:l.minX,y:l.minY},{x:l.minX,y:l.maxY}],[{x:l.maxX,y:l.minY},{x:l.maxX,y:l.maxY}],[{x:l.minX,y:l.maxY},{x:l.maxX,y:l.maxY}]];for(f=0;f<4;f++){var v=g[f],y=cr.getLineIntersect(t,{x:t.x+p.stepX*l.width,y:t.y+p.stepY*l.height},v[0],v[1]);y&&!Ys(t,y,u)&&(y.id="".concat(y.x,"|||").concat(y.y),o.push(y))}}return o}var m=Bs(l,t,r);return m.id="".concat(m.x,"|||").concat(m.y),[m]},nu=function(t,e,n,r){var i=$s(t,e);if(!n[t.id]){var o=$s(r,t);return Js(o,i)}var a=$s({x:n[t.id].x,y:n[t.id].y},t);return Js(a,i)},ru=function(t,e,n,r,i,o,a){var s=[r],u=t.id,c=t.x,l=t.y,f={x:c,y:l,id:u};for(nu(f,o,e,n)&&s.unshift({x:o.x===r.x?r.x:f.x*a,y:o.y===r.y?r.y:f.y*a});e[u]&&e[u].id!==u;){var h={x:c,y:l,id:u},d=e[u].id,p=e[u].x,g=e[u].y,v={x:p,y:g,id:d};nu(v,h,e,n)&&s.unshift({x:v.x===h.x?s[0].x:v.x*a,y:v.y===h.y?s[0].y:v.y*a}),u=d,c=p,l=g}var y=c,m=l;return s[0].x=y===n.x?i.x:s[0].x,s[0].y=m===n.y?i.y:s[0].y,s.unshift(i),s},iu=function(t,e,n,r,i){if(isNaN(t.x)||isNaN(e.x))return[];var o=Object(p.deepMix)(Zs,i);o.obstacles=o.obstacles||[];var a=o.gridSize,s=function(t,e,n){var r={};return t.forEach((function(t){if(t)for(var i=Rs(t.getBBox(),n),o=Qs(i.minX,e);o<=Qs(i.maxX,e);o+=1)for(var a=Qs(i.minY,e);a<=Qs(i.maxY,e);a+=1)r["".concat(o,"|||").concat(a)]=!0})),r}(o.obstacles.concat([n,r]),a,o.offset),u={x:Qs(t.x,a),y:Qs(t.y,a)},c={x:Qs(e.x,a),y:Qs(e.y,a)};t.id="".concat(u.x,"|||").concat(u.y),e.id="".concat(c.x,"|||").concat(c.y);var l=eu(u,t,n,c,o),f=eu(c,e,r,u,o);l.forEach((function(t){delete s[t.id]})),f.forEach((function(t){delete s[t.id]}));for(var h={},d={},g={},v={},y={},m=0;m<l.length;m++){var b=l[m];h[b.id]=b,v[b.id]=0,y[b.id]=tu(b,f,o.distFunc)}for(var x,_,w,E,S,O,M,k=o.maximumLoops,A=o.penalties;Object.keys(h).length>0&&k>0&&(x=void 0,_=1/0,Object.keys(h).forEach((function(t){var e=h[t].id;y[e]<=_&&(_=y[e],x=h[e])})),x);){if(f.findIndex((function(t){return t.x===x.x&&t.y===x.y}))>-1)return ru(x,g,u,e,t,c,a);delete h[x.id],d[x.id]=!0;for(m=0;m<o.directions.length;m++)w=o.directions[m],d[(E={x:x.x+w.stepX,y:x.y+w.stepY,id:"".concat(Math.round(x.x)+w.stepX,"|||").concat(Math.round(x.y)+w.stepY)}).id]||(M=nu(x,E,g,u))>o.maxAllowedDirectionChange||s[E.id]||(h[E.id]||(h[E.id]=E),S=o.distFunc(x,E)+(isNaN(A[M])?a:A[M]),O=v[x.id]+S,v[E.id]&&O>=v[E.id]||(g[E.id]=x,v[E.id]=O,y[E.id]=O+tu(E,f,o.distFunc)));k-=1}return o.fallbackRoute(t,e,n,r,o)};dr("polyline",{options:{color:vr.defaultEdge.color,size:vr.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:vr.defaultEdge.style.stroke,lineAppendWidth:vr.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:vr.edgeLabel.style.fill,fontSize:vr.edgeLabel.style.fontSize,fontFamily:vr.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:Object(d.__assign)({},vr.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);0===n.radius&&delete n.radius;var r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(p.mix)({},e,n,t.style);t=this.getPathPoints(t),this.radius=r.radius,this.offset=r.offset;var i=t.startPoint,o=t.endPoint,a=this.getControlPoints(t),s=[i];a&&(s=s.concat(a)),s.push(o);var u=t.sourceNode,c=t.targetNode,l=r.radius,f=this.options.routeCfg,h=Object(p.mix)({},f,t.routeCfg);h.offset=r.offset;var d=this.getPath(s,u,c,l,h);return(Object(p.isArray)(d)&&d.length<=1||Object(p.isString)(d)&&-1===d.indexOf("L"))&&(d="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(o.x)||isNaN(o.y))&&(d="M0 0, L0 0"),Object(p.mix)({},vr.defaultEdge.style,r,{lineWidth:t.size,path:d})},updateShapeStyle:function(t,e){var n=e.getContainer();if(e.isVisible()){var r={stroke:t.color},i=n.shapeMap["edge-shape"]||n.find((function(t){return"edge-shape"===t.get("className")}))||e.getKeyShape(),o=t.size,a=(t=this.getPathPoints(t)).startPoint,s=t.endPoint,u=this.getControlPoints(t),c=[a];u&&(c=c.concat(u)),c.push(s);var l=i.attr(),f=Object(p.mix)({},r,l,t.style),h=t.sourceNode,d=t.targetNode,g=f.radius,v=this.options.routeCfg,y=Object(p.mix)({},v,t.routeCfg);y.offset=f.offset;var m=this.getPath(c,h,d,g,y);(Object(p.isArray)(m)&&m.length<=1||Object(p.isString)(m)&&-1===m.indexOf("L"))&&(m="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(s.x)||isNaN(s.y))&&(m="M0 0, L0 0"),l.endArrow&&!1===f.endArrow&&(t.style.endArrow={path:""}),l.startArrow&&!1===f.startArrow&&(t.style.startArrow={path:""});var b=Object(p.mix)(r,i.attr(),{lineWidth:o,path:m},t.style);i&&i.attr(b)}},getPath:function(t,e,n,r,i){var o=i.offset,a=i.simple;if(!o||t.length>2){if(r)return qs(t,r);var s=[];return Object(p.each)(t,(function(t,e){0===e?s.push(["M",t.x,t.y]):s.push(["L",t.x,t.y])})),s}var u=a?Ks(t[t.length-1],t[0],n,e,o):iu(t[0],t[t.length-1],e,n,i);return u&&u.length?r?qs(u,r):cr.pointsToPolygon(u):"M0 0, L0 0"}},"single-edge");var ou=oi.cloneEvent,au=oi.isNaN,su=Math.abs,uu=["shift","ctrl","alt","control"],cu={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,n=+t.clientX,r=+t.clientY;if(!au(n)&&!au(r)){var i=n-e.x,o=r-e.y;"x"===this.get("direction")?o=0:"y"===this.get("direction")&&(i=0),this.origin={x:n,y:r};var a=this.graph.get("width"),s=this.graph.get("height"),u=this.graph.get("canvas").getCanvasBBox(),c=this.scalableRange,l=this.scalableRange;c<1&&c>-1&&(c*=a,l*=s),(u.minX<=a+c&&u.minX+i>a+c||u.maxX+c>=0&&u.maxX+c+i<0)&&(i=0),(u.minY<=s+l&&u.minY+o>s+l||u.maxY+l>=0&&u.maxY+l+o<0)&&(o=0),this.graph.translate(i,o)}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];n&&r||(t.preventDefault(),this.onMouseDown(t))},onMouseDown:function(t){var e=t.originalEvent;if((!e||t.name===rr.TOUCHSTART||0===e.button)&&(t.name===rr.TOUCHSTART||"undefined"==typeof window||!window.event||window.event.buttons||window.event.button)&&this.shouldBegin.call(this,t)&&!this.keydown){var n=t.target,r=n&&n.isCanvas&&n.isCanvas();if((this.allowDragOnItem||r)&&(this.origin={x:t.clientX,y:t.clientY},this.dragging=!1,this.enableOptimize)){for(var i=this.graph,o=i.getEdges(),a=0,s=o.length;a<s;a++){var u=o[a].get("group").get("children");u&&u.forEach((function(t){t.set("ori-visibility",t.get("ori-visibility")||t.get("visible")),t.hide()}))}for(var c=i.getNodes(),l=0,f=c.length;l<f;l++)for(var h=0,d=c[l].getContainer().get("children");h<d.length;h++){var p=d[h];p.get("isKeyShape")||(p.set("ori-visibility",p.get("ori-visibility")||p.get("visible")),p.hide())}}}},onTouchMove:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];n&&r?this.onMouseUp(t):(t.preventDefault(),this.onMouseMove(t))},onMouseMove:function(t){var e=this.graph;if(!this.keydown){var n=t.target,r=n&&n.isCanvas&&n.isCanvas();if((this.allowDragOnItem||r)&&(t=ou(t),this.origin)){if(this.dragging)t.type="drag",e.emit("canvas:drag",t);else{if(su(this.origin.x-t.clientX)+su(this.origin.y-t.clientY)<10)return;this.shouldBegin.call(this,t)&&(t.type="dragstart",e.emit("canvas:dragstart",t),this.originPosition={x:t.clientX,y:t.clientY},this.dragging=!0)}this.shouldUpdate.call(this,t)&&this.updateViewport(t)}}},onMouseUp:function(t){var e,n,r=this.graph;if(!this.keydown){var i=r.getZoom(),o=r.get("modeController"),a=null===(n=null===(e=null==o?void 0:o.modes[o.mode])||void 0===e?void 0:e.filter((function(t){return"zoom-canvas"===t.type})))||void 0===n?void 0:n[0],s=a?a.optimizeZoom||.1:0;if(this.enableOptimize){for(var u=r.getEdges(),c=0,l=u.length;c<l;c++){var f=u[c].get("group").get("children");f&&f.forEach((function(t){t.get("ori-visibility")&&t.show()}))}if(i>s)for(var h=r.getNodes(),d=0,p=h.length;d<p;d++)for(var g=0,v=h[d].getContainer().get("children");g<v.length;g++){var y=v[g];if(!y.get("isKeyShape"))y.get("ori-visibility")&&y.show()}}this.dragging?(t=ou(t),this.shouldEnd.call(this,t)&&this.updateViewport(t),t.type="dragend",t.dx=t.clientX-this.originPosition.x,t.dy=t.clientY-this.originPosition.y,r.emit("canvas:dragend",t),this.endDrag()):this.origin=null}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1},onKeyDown:function(t){var e=t.key;e&&(uu.indexOf(e.toLowerCase())>-1?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1}},lu={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd"}},validationCombo:function(t){return!(!this.origin||!t||t.destroyed)&&"combo"===t.getType()},onTouchStart:function(t){if(t.item){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDragStart(t)}},onTouchMove:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return void this.onDragEnd(t);t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDrag(t)},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,this.shouldBegin.call(this,t)){var n=t.item;if(n&&!n.destroyed&&!n.hasLocked()){n.getContainer().set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n);var r=t.target;if(r)if(r.get("isAnchorPoint"))return;var i=this.graph;this.targets=[],this.targetCombo=null;var o=i.findAllByState("node",this.selectedState),a=n.get("id");0===o.filter((function(t){var e=t.get("id");return a===e})).length?this.targets.push(n):o.length>1?o.forEach((function(t){t.hasLocked()||e.targets.push(t)})):this.targets.push(n);var s=[];this.targets.forEach((function(t){s.push(Object(p.clone)(t.getModel()))})),this.set("beforeDragNodes",s),this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){t.isVisible()&&(e.hidenEdge[t.getID()]=!0,t.hide())}))})),this.origin={x:t.x,y:t.y},this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;this.origin&&this.shouldUpdate.call(this,t)&&(this.get("enableDelegate")?this.updateDelegate(t):this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge")}):this.targets.map((function(n){e.update(n,t)})))},onDragEnd:function(t){var e,n=this;if(this.origin){null===(e=this.cachedCaptureItems)||void 0===e||e.forEach((function(t){t.getContainer().set("capture",!0)})),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){n.hidenEdge[t.getID()]&&t.show(),t.refresh()}))})),this.hidenEdge={};var r=this.graph;if(r.get("enabledStack")&&this.enableStack){var i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach((function(t){i.before.nodes.push({id:t.id,x:t.x,y:t.y})})),this.targets.forEach((function(t){var e=t.getModel();i.after.nodes.push({id:e.id,x:e.x,y:e.y})})),r.pushStack("update",Object(p.clone)(i))}r.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd.call(this,t,e),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&this.validationCombo(e)){var n=this.graph;if(this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)n.updateCombos();else{var r=e.getModel();this.targets.map((function(t){t.getModel().comboId!==r.id&&n.updateComboTree(t,r.id)})),n.updateCombo(e)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd.call(this,t,void 0),this.updatePositions(t,!this.currentShouldEnd),this.targets&&0!==this.targets.length&&this.currentShouldEnd&&(this.onlyChangeComboSize?e.updateCombos():this.targets.map((function(t){t.getModel().comboId&&e.updateComboTree(t)})))},onDropNode:function(t){if(this.targets&&0!==this.targets.length){var e=t.item,n=this.graph,r=e.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,i),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){if(this.onlyChangeComboSize)n.updateCombos();else if(r){var o=n.findById(r);this.comboActiveState&&n.setItemState(o,this.comboActiveState,!1),this.targets.map((function(t){var e=t.getModel();r!==e.comboId&&n.updateComboTree(t,r)})),n.updateCombo(o)}else this.targets.map((function(t){t.getModel().comboId&&n.updateComboTree(t)}));n.emit("dragnodeend",{items:this.targets,targetItem:e})}}},onDragEnter:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var n=this;this.targets&&0!==this.targets.length&&(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),updateFunc:this.update}):e||this.targets.map((function(e){return n.update(e,t)})):this.targets.map((function(r){return n.update(r,t,e)})))},update:function(t,e,n){var r=this.origin,i=t.get("model"),o=t.get("id");this.point[o]||(this.point[o]={x:i.x||0,y:i.y||0});var a=e.x-r.x+this.point[o].x,s=e.y-r.y+this.point[o].y;n&&(a+=r.x-e.x,s+=r.y-e.y);var u={x:a,y:s};this.get("updateEdge")?this.graph.updateItem(t,u,!1):t.updatePosition(u)},debounceUpdate:Object(p.debounce)((function(t){var e=t.targets,n=t.graph,r=t.point,i=t.origin,o=t.evt,a=t.updateEdge;t.updateFunc;e.map((function(t){var e=t.get("model"),s=t.get("id");r[s]||(r[s]={x:e.x||0,y:e.y||0});var u={x:o.x-i.x+r[s].x,y:o.y-i.y+r[s].y};a?n.updateItem(t,u,!1):t.updatePosition(u)}))}),50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:n,y:r})}else{var i=e.get("group"),o=Object(p.deepMix)({},Gr.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),s=a.x,u=a.y,c=a.width,l=a.height,f=a.minX,h=a.minY;this.originPoint={x:s,y:u,width:c,height:l,minX:f,minY:h},this.delegateRect=i.addShape("rect",{attrs:Object(d.__assign)({width:c,height:l,x:s,y:u},o),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;0===e.length&&e.push(t.item);for(var n=1/0,r=-1/0,i=1/0,o=-1/0,a=0;a<e.length;a++){var s=e[a].getBBox(),u=s.minX,c=s.minY,l=s.maxX,f=s.maxY;u<n&&(n=u),c<i&&(i=c),l>r&&(r=l),f>o&&(o=f)}return{x:Math.floor(n),y:Math.floor(i),width:Math.ceil(r)-Math.floor(n),height:Math.ceil(o)-Math.floor(i),minX:n,minY:i}}},fu={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return"mouseenter"===this.get("trigger")?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.setAllItemStates(t)},clearOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.clearActiveState(t)},setAllItemStates:function(t){var e=t.item,n=this.graph;if(this.item=e,this.shouldUpdate(t.item,{event:t,action:"activate"})){for(var r=this.activeState,i=this.inactiveState,o=n.getNodes(),a=n.getCombos(),s=n.getEdges(),u=n.get("vedges"),c=o.length,l=a.length,f=s.length,h=u.length,d=0;d<c;d++){var p=o[d],g=p.hasState("selected");this.resetSelected&&g&&n.setItemState(p,"selected",!1),n.setItemState(p,r,!1),i&&n.setItemState(p,i,!0)}for(d=0;d<l;d++){var v=a[d];g=v.hasState("selected");this.resetSelected&&g&&n.setItemState(v,"selected",!1),n.setItemState(v,r,!1),i&&n.setItemState(v,i,!0)}for(d=0;d<f;d++){var y=s[d];n.setItemState(y,r,!1),i&&n.setItemState(y,i,!0)}for(d=0;d<h;d++){var m=u[d];n.setItemState(m,r,!1),i&&n.setItemState(m,i,!0)}i&&n.setItemState(e,i,!1),n.setItemState(e,r,!0);var b=e.getEdges(),x=b.length;for(d=0;d<x;d++){var _=void 0;_=(y=b[d]).getSource()===e?y.getTarget():y.getSource(),i&&n.setItemState(_,i,!1),n.setItemState(_,r,!0),n.setItemState(y,i,!1),n.setItemState(y,r,!0),y.toFront()}n.emit("afteractivaterelations",{item:t.item,action:"activate"})}},clearActiveState:function(t){var e=this.get("graph");if(this.shouldUpdate(t.item,{event:t,action:"deactivate"})){var n=this.activeState,r=this.inactiveState,i=e.get("autoPaint");e.setAutoPaint(!1);for(var o=e.getNodes()||[],a=e.getCombos()||[],s=e.getEdges()||[],u=e.get("vedges")||[],c=o.length,l=a.length,f=s.length,h=u.length,d=0;d<c;d++){var p=o[d];e.clearItemStates(p,[n,r])}for(d=0;d<l;d++){var g=a[d];e.clearItemStates(g,[n,r])}for(d=0;d<f;d++){var v=s[d];e.clearItemStates(v,[n,r,"deactivate"])}for(d=0;d<h;d++){var y=u[d];e.clearItemStates(y,[n,r,"deactivate"])}e.paint(),e.setAutoPaint(i),e.emit("afteractivaterelations",{item:t.item||this.get("item"),action:"deactivate"})}}},hu=Math.min,du=Math.max,pu=Math.abs,gu=["drag","shift","ctrl","alt","control"],vu={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return gu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,n=this.brush;e||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&this.updateBrush(t)},onMouseUp:function(t){this.graph;(this.brush||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this.graph,e=this.selectedState,n=t.findAllByState("node",e),r=t.findAllByState("edge",e);n.forEach((function(n){return t.setItemState(n,e,!1)})),r.forEach((function(n){return t.setItemState(n,e,!1)})),this.selectedNodes=[],this.selectedEdges=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedNodes:function(t){var e=this,n=this.graph,r=this.originPoint,i=this.shouldUpdate,o=this.selectedState,a={x:t.x,y:t.y},s=n.getPointByCanvas(r.x,r.y),u=hu(a.x,s.x),c=du(a.x,s.x),l=hu(a.y,s.y),f=du(a.y,s.y),h=[],d=[];n.getNodes().forEach((function(t){if(t.isVisible()){var e=t.getBBox();if(e.centerX>=u&&e.centerX<=c&&e.centerY>=l&&e.centerY<=f&&i(t,"select")){h.push(t);var r=t.getModel();d.push(r.id),n.setItemState(t,o,!0)}}}));var p=[];this.includeEdges&&h.forEach((function(t){t.getOutEdges().forEach((function(t){if(t.isVisible()){var r=t.getModel(),o=r.source,a=r.target;d.includes(o)&&d.includes(a)&&i(t,"select")&&(p.push(t),n.setItemState(t,e.selectedState,!0))}}))})),this.selectedEdges=p,this.selectedNodes=h,this.onSelect&&this.onSelect(h,p),n.emit("nodeselectchange",{selectedItems:{nodes:h,edges:p},select:!0})},createBrush:function(){var t=this.graph.get("canvas").addShape("rect",{attrs:this.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:pu(t.canvasX-e.x),height:pu(t.canvasY-e.y),x:hu(t.canvasX,e.x),y:hu(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.keydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},yu=["shift","ctrl","alt","control"],mu={getDefaultCfg:function(){return{multiple:!0,trigger:"shift",selectedState:"selected"}},getEvents:function(){return yu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.multiple?{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,n=t.item;if(n&&!n.destroyed){n.getType();var r=e.graph,i=e.keydown,o=e.multiple,a=e.shouldUpdate;if(e.shouldBegin.call(e,t)){if(!i||!o){var s=r.findAllByState("node",e.selectedState).concat(r.findAllByState("combo",e.selectedState));Object(p.each)(s,(function(t){t!==n&&r.setItemState(t,e.selectedState,!1)}))}if(n.hasState(e.selectedState)){a.call(e,t)&&r.setItemState(n,e.selectedState,!1);var u=r.findAllByState("node",e.selectedState),c=r.findAllByState("combo",e.selectedState);r.emit("nodeselectchange",{target:n,selectedItems:{nodes:u,combos:c},select:!1})}else{a.call(e,t)&&r.setItemState(n,e.selectedState,!0);u=r.findAllByState("node",e.selectedState),c=r.findAllByState("combo",e.selectedState);r.emit("nodeselectchange",{target:n,selectedItems:{nodes:u,combos:c},select:!0})}}}},onCanvasClick:function(t){var e=this,n=this.graph;if(this.shouldBegin.call(this,t)){var r=n.findAllByState("node",this.selectedState);Object(p.each)(r,(function(t){n.setItemState(t,e.selectedState,!1)}));var i=n.findAllByState("combo",this.selectedState);Object(p.each)(i,(function(t){n.setItemState(t,e.selectedState,!1)})),n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()||"control"===e.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1}},bu=b.a.transform,xu={getDefaultCfg:function(){return{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];t.preventDefault(),r&&(this.shouldBegin&&!this.shouldBegin.call(this,t)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,r&&(this.endPoint={pageX:r.pageX,pageY:r.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,n=e[0],r=e[1];if(r){this.endPoint||(this.endPoint={pageX:r.pageX,pageY:r.pageY});var i=function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)},o=i({x:n.pageX,y:n.pageY},{x:r.pageX,y:r.pageY})/i({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),a=this.originScale*o;this.currentScale=a;var s=this.get("minZoom")||this.graph.get("minZoom");if(!(a>(this.get("maxZoom")||this.graph.get("maxZoom"))||a<s)){var u=this.get("animate"),c=this.get("animateCfg"),l=this.graph.get("canvas").getPointByClient(t.clientX,t.clientY);this.graph.zoomTo(a,{x:l.x,y:l.y},u,c),this.graph.emit("wheelzoom",t)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(t){var e=this,n=this.graph,r=this.fixSelectedItems;if((!this.shouldBegin||this.shouldBegin.call(this,t))&&this.shouldUpdate.call(this,t)){t.preventDefault();var i,o=n.get("canvas").getPointByClient(t.clientX,t.clientY),a=this.get("sensitivity"),s=n.getZoom();i=s*(t.wheelDelta<0?1-.05*a:1/(1-.05*a));var u=this.get("minZoom")||n.get("minZoom");if(!(i>(this.get("maxZoom")||n.get("maxZoom"))||i<u)){if(this.get("enableOptimize")){var c=this.get("optimizeZoom"),l=this.get("optimized"),f=n.getNodes(),h=n.getEdges(),d=f.length,g=h.length;if(!l){for(var v=0;v<d;v++){if(!(M=f[v]).destroyed)for(var y=(q=M.get("group").get("children")).length,m=0;m<y;m++){(L=q[m]).destoryed||L.get("isKeyShape")||(L.set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide())}}for(var b=0;b<g;b++)for(y=(q=(H=h[b]).get("group").get("children")).length,m=0;m<y;m++){(L=q[m]).set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var x=setTimeout((function(){var t=n.getZoom();if(e.get("optimized")){e.set("optimized",!1);for(var r=0;r<d;r++){var i=f[r],o=(l=i.get("group").get("children")).length;if(t<c)(s=(p=i.getKeyShape()).get("ori-visibility"))&&p.show();else for(var a=0;a<o;a++){var s=(y=l[a]).get("ori-visibility");!y.get("visible")&&s&&s&&y.show()}}for(var u=0;u<g;u++){var l,p,v=h[u];o=(l=v.get("group").get("children")).length;if(t<c)(s=(p=v.getKeyShape()).get("ori-visibility"))&&p.show();else for(a=0;a<o;a++){var y;if(!(y=l[a]).get("visible"))(s=y.get("ori-visibility"))&&y.show()}}}}),100);this.set("timeout",x)}if(s<=1){var _=void 0,w=void 0;if(r.fixAll||r.fixLineWidth||r.fixLabel){_=n.findAllByState("node",r.fixState),w=n.findAllByState("edge",r.fixState);for(var E=s/i,S=_.length,O=0;O<S;O++){var M,k=(M=_[O]).getContainer(),A=M.getModel(),C=M.getOriginStyle(),T=M.getStateStyle(r.fixState),I=M.get("shapeFactory").getShape(A.type).getStateStyle(r.fixState,M)[r.fixState];if(r.fixAll){if(i<=1){var j=Object(p.clone)(k.getMatrix());j||(j=[1,0,0,0,1,0,0,0,1]);var P=M.getModel(),N=P.x,D=P.y;j=bu(j,[["t",-N,-D],["s",E,E],["t",N,D]]),k.setMatrix(j)}}else for(y=(q=k.get("children")).length,m=0;m<y;m++){var L=q[m],R=void 0,B=void 0;if(r.fixLabel)if("text"===L.get("type")){R=L.attr("fontSize")||12;var F=T[L.get("name")],G=I[L.get("name")],z=F?F.fontSize:12,U=G?G.fontSize:12,V=z||U||12;if(i<=1&&L.attr("fontSize",V/i),B)break}if(r.fixLineWidth&&L.get("isKeyShape")){B=L.attr("lineWidth")||0;var W=T.lineWidth||I.lineWidth||C.lineWidth||0;if(i<=1&&L.attr("lineWidth",W/i),R)break}}}for(var X=w.length,Y=0;Y<X;Y++){var H,q=(k=(H=w[Y]).getContainer()).get("children");for(A=H.getModel(),T=H.getStateStyle(r.fixState),I=H.get("shapeFactory").getShape(A.type).getStateStyle(r.fixState,H)[r.fixState],y=q.length,m=0;m<y;m++){L=q[m],R=void 0,B=void 0;if(r.fixLabel||r.fixAll)if("text"===L.get("type")){R=L.attr("fontSize")||12;F=T[L.get("name")],G=I[L.get("name")],z=F?F.fontSize:12,U=G?G.fontSize:12,V=z||U||12;if(i<=1&&L.attr("fontSize",V/i),B)break}if((r.fixLineWidth||r.fixAll)&&L.get("isKeyShape")){B=L.attr("lineWidth")||0;W=T.lineWidth||I.lineWidth||1;if(i<=1&&L.attr("lineWidth",W/i),R)break}}}}}var K=this.get("animate"),Z=this.get("animateCfg");n.zoomTo(i,{x:o.x,y:o.y},K,Z),n.emit("wheelzoom",t)}}}},_u={onMouseEnter:function(t){var e=t.item;this.currentTarget=e,this.showTooltip(t),this.graph.emit("tooltipchange",{item:t.item,action:"show"})},onMouseMove:function(t){this.shouldUpdate(t)?this.currentTarget&&t.item===this.currentTarget&&this.updatePosition(t):this.hideTooltip()},onMouseLeave:function(t){this.shouldEnd(t)&&(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(t){var e=this.container;if(t.item&&!t.item.destroyed){e||(e=this.createTooltip(this.graph.get("canvas")),this.container=e);var n=this.formatText(t.item.get("model"),t);e.innerHTML=n,Vr(this.container,{visibility:"visible"}),this.updatePosition(t)}},hideTooltip:function(){Vr(this.container,{visibility:"hidden"})},updatePosition:function(t){var e=this.get("shouldBegin"),n=this.width,r=this.height,i=this.container,o=this.graph;if(e(t)){var a=o.getPointByClient(t.clientX,t.clientY),s=o.getCanvasByPoint(a.x,a.y),u=s.x,c=s.y,l=i.getBoundingClientRect();u>n/2?u-=l.width:u+=this.offset,c>r/2?c-=l.height:c+=this.offset;var f="".concat(u,"px"),h="".concat(c,"px");Vr(this.container,{left:f,top:h,visibility:"visible"})}else Vr(i,{visibility:"hidden"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var n=Ur('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return e.parentNode.appendChild(n),Vr(n,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},wu=Object(d.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},_u),Eu=Object(d.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},_u),Su=["click","dblclick"],Ou={getDefaultCfg:function(){return{trigger:"click",onChange:function(){}}},getEvents:function(){var t,e;return Su.includes(this.trigger)?e=this.trigger:(e="click",console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=t.item;if(e){var n=this.graph.findDataById(e.get("id"));if(n){var r=n.children;if(r&&0!==r.length){var i=!n.collapsed;this.shouldBegin(t,i)&&(n.collapsed=i,e.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:t.item,collapsed:i}),this.shouldUpdate(t,i)&&(this.onChange(e,i),this.graph.layout()))}}}}},Mu=oi.calculationItemsBBox,ku={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected"}},getEvents:function(){return{"combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;return!(!e||e.destroyed)&&(!!this.shouldUpdate.call(this,t)&&"combo"===e.getType())},onDragStart:function(t){var e=this,n=this.graph,r=t.item;if(this.currentShouldEnd=!0,this.validationCombo(t)){this.targets=[];var i=n.findAllByState("combo",this.selectedState),o=r.get("id");0===i.filter((function(t){var e=t.get("id");return o===e})).length?this.targets.push(r):this.targets=i,this.activeState&&this.targets.map((function(t){var r=t.getModel();if(r.parentId){var i=n.findById(r.parentId);i&&n.setItemState(i,e.activeState,!0)}})),this.point={},this.originPoint={},this.origin={x:t.x,y:t.y},this.currentItemChildCombos=[],function t(e,n){if(!1!==n(e)&&e){var r=e.get("combos");if(0===r.length)return!1;Object(p.each)(r,(function(e){t(e,n)}))}}(r,(function(t){if(t.destroyed)return!1;var n=t.getModel();return e.currentItemChildCombos.push(n.id),!0}))}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var n=this.graph,r=t.item,i=r.getModel(),o=n.getCombos(),a=r.getBBox(),s=a.centerX,u=a.centerY,c=a.width;o.filter((function(t){var n=t.getModel();return i.parentId,n.id!==i.id&&!e.currentItemChildCombos.includes(n.id)})).map((function(t){var r=t.getBBox(),i=r.centerX,o=r.centerY,a=r.width,l=s-i,f=u-o,h=2*Math.sqrt(l*l+f*f);c+a-h>.8*c?n.setItemState(t,e.activeState,!0):n.setItemState(t,e.activeState,!1)}))}Object(p.each)(this.targets,(function(n){e.updateCombo(n,t)}))}},updatePositions:function(t,e){var n=this;(this.enableDelegate||e)&&Object(p.each)(this.targets,(function(r){n.updateCombo(r,t,e)}))},onDrop:function(t){var e=this,n=t.item;if(this.currentShouldEnd=this.shouldEnd.call(this,t,n),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&n&&this.targets&&!n.destroyed){var r=this.graph,i=n.getModel();this.targets.map((function(t){t.getModel().parentId!==i.id?(e.activeState&&r.setItemState(n,e.activeState,!1),e.onlyChangeComboSize?r.updateCombo(t):r.updateComboTree(t,i.id)):r.updateCombo(n)})),this.end(n,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(this.targets&&0!==this.targets.length){var n=this.graph,r=t.item.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,i),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){var o;if(r){if(this.activeState){var a=n.findById(r);n.setItemState(a,this.activeState,!1)}this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):r!==t.getID()&&(o=n.findById(r),r!==t.getModel().parentId&&n.updateComboTree(t,r))}))}else this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):t.getModel().comboId&&n.updateComboTree(t)}));this.endComparison=!0,this.end(o,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(this.targets&&0!==this.targets.length){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var n=this.getParentCombo(e.getModel().parentId),r=this.graph;n&&this.activeState&&r.setItemState(n,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var n=this;if(this.origin){var r=this.graph;if(this.delegateShape)r.get("delegateGroup").clear(),this.delegateShape=null;t&&this.activeState&&r.setItemState(t,this.activeState,!1),t||this.targets.map((function(t){n.onlyChangeComboSize?r.updateCombo(t):r.updateComboTree(t)})),this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e){var n=this;if(!1!==e(t)&&t){var r=t.get("combos");Object(p.each)(r,(function(t){n.traverse(t,e)}));var i=t.get("nodes");Object(p.each)(i,(function(t){n.traverse(t,e)}))}},updateCombo:function(t,e,n){var r=this;this.traverse(t,(function(t){return!t.destroyed&&(r.updateSignleItem(t,e,n),!0)}))},updateSignleItem:function(t,e,n){var r=this.origin,i=this.graph,o=t.getModel(),a=t.get("id");this.point[a]||(this.point[a]={x:o.x,y:o.y});var s=e.x-r.x+this.point[a].x,u=e.y-r.y+this.point[a].y;n&&(s+=r.x-e.x,u+=r.y-e.y),i.updateItem(t,{x:s,y:u})},getParentCombo:function(t){var e=this.graph;if(t){var n=e.findById(t);if(n)return n}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:n,y:r})}else{var i=e.get("delegateGroup"),o=null,a=(o=this.targets.length>1?Mu(this.targets):this.targets[0].getBBox()).x,s=o.y,u=o.width,c=o.height,l=o.minX,f=o.minY;this.originPoint={x:a,y:s,width:u,height:c,minX:l,minY:f};var h=Object(d.__assign)(Object(d.__assign)({},Gr.delegateStyle),this.delegateStyle);this.delegateShape=i.addShape("rect",{attrs:Object(d.__assign)({width:o.width,height:o.height,x:o.x,y:o.y},h),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}}},Au=["click","dblclick"],Cu={getDefaultCfg:function(){return{trigger:"dblclick",relayout:!0}},getEvents:function(){var t,e;return Au.includes(this.trigger)?e=this.trigger:(e="dblclick",console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,n=this.graph,r=this.relayout;if(e&&!e.destroyed&&"combo"===e.getType()){var i=e.getModel().id;i&&(n.collapseExpandCombo(i),r&&n.get("layout")?n.layout():n.refreshPositions())}}},Tu=oi.isPolygonsIntersect,Iu=oi.pathToPoints,ju=["drag","shift","ctrl","alt","control"],Pu=["click","drag"],Nu=["shift","ctrl","control","alt","meta",void 0],Du=["shift","ctrl","alt","control"],Lu=["shift","ctrl","alt","control"],Ru={"drag-canvas":cu,"zoom-canvas":xu,"drag-node":lu,"activate-relations":fu,"brush-select":vu,"click-select":mu,"lasso-select":{getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return ju.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior lasso-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso;t.item||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&(this.points.push({x:t.x,y:t.y}),this.updateLasso(t))},onDragEnd:function(t){(this.lasso||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach((function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(){var t=this.graph,e=this.selectedState,n=t.findAllByState("node",e),r=t.findAllByState("edge",e);n.forEach((function(n){return t.setItemState(n,e,!1)})),r.forEach((function(n){return t.setItemState(n,e,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this.graph,n=this.shouldUpdate,r=this.points.map((function(t){return[e.getCanvasByPoint(t.x,t.y).x,e.getCanvasByPoint(t.x,t.y).y]})),i=this.selectedState,o=[],a=[];e.getNodes().forEach((function(t){if(t.isVisible()&&function(t,e){var n,r=t.getKeyShape();if("path"===t.get("type"))n=Iu(r.attr("path"));else{var i=r.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return Tu(e,n)}(t,r)&&n(t,"select")){o.push(t);var s=t.getModel();a.push(s.id),e.setItemState(t,i,!0)}}));var s=[];this.includeEdges&&o.forEach((function(r){r.getOutEdges().forEach((function(r){if(r.isVisible()){var i=r.getModel(),o=i.source,u=i.target;a.includes(o)&&a.includes(u)&&n(r,"select")&&(s.push(r),e.setItemState(r,t.selectedState,!0))}}))})),this.selectedEdges=s,this.selectedNodes=o,this.onSelect&&this.onSelect(o,s),e.emit("nodeselectchange",{selectedItems:{nodes:o,edges:s},select:!0})},createLasso:function(){var t=this.graph.get("delegateGroup").addShape("path",{attrs:Object(d.__assign)({path:[]},this.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(t){this.lasso.attr({path:this.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},tooltip:wu,"edge-tooltip":Eu,"collapse-expand":Ou,"drag-combo":ku,"collapse-expand-combo":Cu,"create-edge":{getDefaultCfg:function(){return{trigger:"click",key:void 0,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t;return Pu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="click",console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),this.key&&-1===Nu.indexOf(this.key.toLowerCase())&&(this.trigger=void 0,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined")),"drag"===this.trigger?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:"click"===this.trigger&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),this.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(t){if(!this.key||this.keydown){var e=t.item;e&&e.getID()!==this.source&&"node"===e.getType()||this.cancelCreating({item:this.edge,x:t.x,y:t.y})}},onClick:function(t){if(!this.key||this.keydown){var e=t.item,n=this.graph,r=e.getModel(),i=this.getEdgeConfig;if(this.addingEdge&&this.edge){if(!this.shouldEnd.call(this,t))return;var o=void 0;o=i&&Object(p.isFunction)(i)?i({source:this.source,target:r.id}):this.edgeConfig;var a=Object(d.__assign)({target:r.id},o);if(this.source===r.id&&(a.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(this.edge,a,!1),n.get("enabledStack")){var s=Object(d.__assign)(Object(d.__assign)({},this.edge.getModel()),{itemType:"edge"}),u={};u.edges=[s],n.pushStack("add",{before:{},after:u})}n.emit("aftercreateedge",{edge:this.edge}),this.edge.getKeyShape().set("capture",!0),this.edge=null,this.addingEdge=!1}else{if(!this.shouldBegin.call(this,t))return;o=void 0;o=i&&Object(p.isFunction)(i)?i({source:r.id,target:r.id}):this.edgeConfig,this.edge=n.addItem("edge",Object(d.__assign)({source:r.id,target:r.id},o),!1),this.source=r.id,this.addingEdge=!0,this.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){if(!this.key||this.keydown){this.edge&&this.edge.destroyed&&this.cancelCreating({item:this.edge});var e={x:t.x,y:t.y};this.graph.findById(this.source)?this.addingEdge&&this.edge&&this.graph.updateItem(this.edge,{target:e},!1):this.addingEdge=!1}},cancelCreating:function(t){var e,n;if(!this.key||this.keydown){var r=this.graph,i=t.item;return this.addingEdge&&(this.edge===i||(null===(n=null===(e=t.target)||void 0===e?void 0:e.isCanvas)||void 0===n?void 0:n.call(e)))?(this.edge&&!this.edge.destroyed&&r.removeItem(this.edge,!1),this.edge=null,void(this.addingEdge=!1)):void 0}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.key.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.addingEdge&&this.edge&&(this.graph.removeItem(this.edge,!1),this.addingEdge=!1,this.edge=null),this.keydown=!1}},"shortcuts-call":{getDefaultCfg:function(){return{trigger:"ctrl",combinedKey:"1",functionName:"fitView",functionParams:[]}},getEvents:function(){return Du.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="ctrl",console.warn("Behavior shortcuts-fit-view 的 trigger 参数 '".concat(this.trigger,"' 不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.triggerKeydown||(this.triggerKeydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n);var i=this.graph;if(!i[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(!this.triggerKeydown||this.combinedKey){var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(r===o||"control"===r&&"ctrl"===o||"ctrl"===r&&"control"===o)&&(this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]())}else this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]()}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0}},getEvents:function(){return this.zoomKey&&-1!==Lu.indexOf(this.zoomKey)||(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this,n=this.graph,r=t["".concat(this.zoomKey,"Key")];if("control"===this.zoomKey&&(r=t.ctrlKey),r){var i=n.get("canvas").getPointByClient(t.clientX,t.clientY),o=n.getZoom();t.wheelDelta>0?o+=.05*o:o-=.05*o,n.zoomTo(o,{x:i.x,y:i.y})}else{var a=t.deltaX||t.movementX,s=t.deltaY||t.movementY;!s&&navigator.userAgent.indexOf("Firefox")>-1&&(s=125*-t.wheelDelta/3);var u=this.graph.get("width"),c=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),f=this.scalableRange,h=this.scalableRange;f<1&&f>-1&&(f*=u,h*=c);var d=l.minX,p=l.maxX,g=l.minY,v=l.maxY;a>0?p<-f?a=0:p-a<-f&&(a=p+f):a<0&&(d>u+f?a=0:d-a>u+f&&(a=d-(u+f))),s>0?v<-h?s=0:v-s<-h&&(s=v+h):s<0&&(g>c+h?s=0:g-s>c+h&&(s=g-(c+h))),"x"===this.get("direction")?s=0:"y"===this.get("direction")&&(a=0),n.translate(-a,-s)}if(t.preventDefault(),this.get("enableOptimize")){var y=this.get("optimizeZoom"),m=this.get("optimized"),b=n.getNodes(),x=n.getEdges(),_=b.length,w=x.length;if(!m){for(var E=0;E<_;E++){var S=b[E];if(!S.destroyed)for(var O=(A=S.get("group").get("children")).length,M=0;M<O;M++){(C=A[M]).destoryed||C.get("isKeyShape")||(C.set("ori-visibility",C.get("ori-visibility")||C.get("visible")),C.hide())}}for(var k=0;k<w;k++){var A;for(O=(A=x[k].get("group").get("children")).length,M=0;M<O;M++){var C;(C=A[M]).set("ori-visibility",C.get("ori-visibility")||C.get("visible")),C.hide()}}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var T=setTimeout((function(){var t=n.getZoom();if(e.get("optimized")){e.set("optimized",!1);for(var r=0;r<_;r++){var i=b[r],o=(c=i.get("group").get("children")).length;if(t<y)(s=(l=i.getKeyShape()).get("ori-visibility"))&&l.show();else for(var a=0;a<o;a++){var s=(h=c[a]).get("ori-visibility");!h.get("visible")&&s&&s&&h.show()}}for(var u=0;u<w;u++){var c,l,f=x[u];o=(c=f.get("group").get("children")).length;if(t<y)(s=(l=f.getKeyShape()).get("ori-visibility"))&&l.show();else for(a=0;a<o;a++){var h;if(!(h=c[a]).get("visible"))(s=h.get("ori-visibility"))&&h.show()}}}}),100);this.set("timeout",T)}}}};Object(p.each)(Ru,(function(t,e){gr(e,t)}));var Bu=Object(d.__assign)(Object(d.__assign)({},r),yr),Fu=js.Grid,Gu=js.Minimap,zu=js.Bundling,Uu=js.Menu,Vu=js.Fisheye,Wu=js.ToolBar,Xu=js.Tooltip,Yu=js.TimeBar,Hu=js.ImageMinimap,qu=js.EdgeFilterLens,Ku=js.SnapLine,Zu=js.Legend,Qu={version:Gr.version,Graph:Ai,TreeGraph:Ii,Util:oi,Layout:Hr.Layouts,TreeLayout:si,registerLayout:ui,Global:Gr,registerBehavior:gr,registerCombo:pr,registerEdge:dr,registerNode:hr,Minimap:js.Minimap,Grid:js.Grid,Bundling:js.Bundling,Menu:js.Menu,ToolBar:js.ToolBar,Tooltip:js.Tooltip,Legend:js.Legend,TimeBar:Yu,SnapLine:Ku,Fisheye:Vu,ImageMinimap:Hu,EdgeFilterLens:qu,Algorithm:Bu,Arrow:ir,Marker:or,Shape:ar};Qu.version="4.6.0-beta.3";e.default=Qu;var $u="4.6.0-beta.3"},,,function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.d(e,"a",(function(){return y}));var i,o,a=0,s=0,u=0,c=0,l=0,f=0,h="object"===("undefined"==typeof performance?"undefined":r(performance))&&performance.now?performance:Date,d="object"===("undefined"==typeof window?"undefined":r(window))&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return l||(d(g),l=h.now()+f)}function g(){l=0}function v(){this._call=this._time=this._next=null}function y(t,e,n){var r=new v;return r.restart(t,e,n),r}function m(){l=(c=h.now())+f,a=s=0;try{!function(){p(),++a;for(var t,e=i;e;)(t=l-e._time)>=0&&e._call.call(null,t),e=e._next;--a}()}finally{a=0,function(){var t,e,n=i,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:i=e);o=t,x(r)}(),l=0}}function b(){var t=h.now(),e=t-c;e>1e3&&(f-=e,c=t)}function x(t){a||(s&&(s=clearTimeout(s)),t-l>24?(t<1/0&&(s=setTimeout(m,t-h.now()-f)),u&&(u=clearInterval(u))):(u||(c=h.now(),u=setInterval(b,1e3)),a=1,d(m)))}v.prototype=y.prototype={constructor:v,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?p():+n)+(null==e?0:+e),this._next||o===this||(o?o._next=this:i=this,o=this),this._call=t,this._time=n,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}}}]).default}));
38
38
  //# sourceMappingURL=g6.min.js.map