0&&l.length>0;){var d=l[l.length-1];if(d.length){var p=d.shift();if(p&&(u.push(p),c[p]=!0,f=r?(0,o.getNeighbors)(p,s,"target"):(0,o.getNeighbors)(p,s),l.push(f.filter((function(t){return!c[t]})))),u[u.length-1]===n){var g=u.map((function(t){return t}));h.push(g);m=u.pop();c[m]=!1,l.pop()}}else{var m=u.pop();c[m]=!1,l.pop()}}return h}},75033:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,i=(r=n(62238))&&r.__esModule?r:{default:r};var o=function(t,e){for(var n=(0,i.default)(t,e),r=[],o=n.length,a=0;a =0;ot--){if("break"===it(ot))break}var at=et.length,st=function(t){var e=et[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=et[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&&et.splice(t,1)},i=at-1;i>t;i--)r(i);at=et.length};for(ot=0;ot<=at-1;ot++)st(ot);return et}}};e.default=y},5170:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,i=(r=n(62238))&&r.__esModule?r:{default:r},o=n(70643);var a=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e3);var a=t.nodes,s=void 0===a?[]:a,u=t.edges,c=void 0===u?[]:u,l={},h={};s.forEach((function(t,e){var n=(0,o.uniqueId)();t.clusterId=n,l[n]={id:n,nodes:[t]},h[t.id]={node:t,idx:e}}));var f=(0,i.default)(t,e),d=[],p={};f.forEach((function(t,e){var n=0,r=s[e].id;p[r]={},t.forEach((function(t,e){if(t){n+=t;var i=s[e].id;p[r][i]=t}})),d.push(n)}));for(var g=0,m=function(){var t=!1;if(s.forEach((function(e){var n={};Object.keys(p[e.id]).forEach((function(t){var r=p[e.id][t],i=h[t].node.clusterId;n[i]||(n[i]=0),n[i]+=r}));var r=-1/0,i=[];if(Object.keys(n).forEach((function(t){r - ".concat(a," x -1?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,n,r=t.target,i=r&&r.isCanvas&&r.isCanvas();if((0,M.isBoolean)(this.allowDragOnItem)&&!this.allowDragOnItem&&!i)return!1;if((0,M.isObject)(this.allowDragOnItem)){var o=this.allowDragOnItem,a=o.node,s=o.edge,u=o.combo,c=null===(n=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===n?void 0:n.call(e);if(!a&&"node"===c)return!1;if(!s&&"edge"===c)return!1;if(!u&&"combo"===c)return!1}return!0}},Ny={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"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.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,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)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},"undefined"==typeof window||this.windowEventBinded||(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(t){var e,n;"node"===(null===(n=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===n?void 0:n.call(e))?this.mousedown&&(this.dragstart?this.onDrag(w(w({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t))):this.onDragEnd()},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,this.shouldBegin(w(w({},t),this.mousedown),this)){var n=this.mousedown,r=n.item,i=n.target;if(r&&!r.destroyed&&!r.hasLocked()){if(r.getContainer().set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(r),i)if(i.get("isAnchorPoint"))return;var o=this.graph;this.targets=[],this.targetCombo=null;var a=o.findAllByState("node",this.selectedState),s=r.get("id"),u=a.filter((function(t){var e=t.get("id");return s===e}));if(0===u.length?this.targets.push(r):a.length>1?a.forEach((function(t){t.hasLocked()||e.targets.push(t)})):this.targets.push(r),this.graph.get("enabledStack")&&this.enableStack){var c=[];this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,i=e.id;c.push({x:n,y:r,id:i})})),this.set("beforeDragNodes",c)}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=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(this.mousedown&&this.origin&&this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map((function(r){e.update(r,t);var i=r.getModel().comboId;i&&(n[i]=e.graph.findById(i))})),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e,n=this;if(this.mousedown=!1,this.dragstart=!1,"undefined"!=typeof window&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),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(t)})),this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,o=e.id;i.after.nodes.push({x:n,y:r,id:o})})),r.pushStack("update",(0,M.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(t,e,this),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(t,void 0,this),this.updatePositions(t,!this.currentShouldEnd),this.targets&&0!==this.targets.length&&this.currentShouldEnd&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map((function(t){t.getModel().comboId&&e.updateComboTree(t)})))},onDropNode:function(t){if(this.targets&&0!==this.targets.length){var e=this,n=t.item,r=e.graph,i=n.getModel().comboId,o=i?r.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd(t,o,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(i){var a=r.findById(i);e.comboActiveState&&r.setItemState(a,e.comboActiveState,!1),this.targets.map((function(t){var e=t.getModel();i!==e.comboId&&r.updateComboTree(t,i)})),r.updateCombo(a)}else this.targets.map((function(t){t.getModel().comboId&&r.updateComboTree(t)}));r.emit("dragnodeend",{items:this.targets,targetItem:n})}}},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"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):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:(0,M.debounce)((function(t){var e=t.targets,n=t.graph,r=t.point,i=t.origin,o=t.evt,a=t.updateEdge,s=t.onlyChangeComboSize,u=t.updateParentCombos;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)})),s&&u(n,e)}),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=(0,M.deepMix)({},Bf.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),s=a.x,u=a.y,c=a.width,l=a.height,h=a.minX,f=a.minY;this.originPoint={x:s,y:u,width:c,height:l,minX:h,minY:f},this.delegateRect=i.addShape("rect",{attrs:w({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 p&&(n.judgingDistance=p);break;default:a+=p}})),this.currentMinY=u,this.currentMaxY=c,i&&"mean"!==i||(n.judgingDistance=a/r.length)}else this.judgingDistance=0},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,e=t.nodeClusterBy,n=t.nodes,r=t.edges,i=t.nodeMap,o=t.degreesMap;if(null==n?void 0:n.length){var a={};return n.forEach((function(t,n){1===o[t.id].all&&(a[t.id]=(0,s.getCoreNodeAndRelativeLeafNodes)("leaf",t,r,e,o,i))})),a}},e}(a.Base);e.Force2Layout=l},19712:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=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=n},48564: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])},r(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.ForceAtlas2Layout=void 0;var a=n(62329),s=n(49784),u=o(n(19712)),c=o(n(51638)),l=o(n(62732)),h=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.onLayoutEnd,r=t.prune,i=t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);for(var o=[],a=e.length,u=0;u250&&(t.barnesHut=!0),void 0===t.prune&&a>100&&(t.prune=!0),0!==this.maxIteration||t.prune?0===this.maxIteration&&r&&(i=100,a<=200&&a>100?i=500:a>200&&(i=950),this.maxIteration=i):(i=250,a<=200&&a>100?i=1e3:a>200&&(i=1200),this.maxIteration=i),t.kr||(t.kr=50,a>100&&a<=500?t.kr=20:a>500&&(t.kr=1)),t.kg||(t.kg=20,a>100&&a<=500?t.kg=10:a>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(o),n()},e.prototype.updateNodesByForces=function(t){for(var e=this,n=e.edges,r=e.maxIteration,i=e.nodes,o=n.filter((function(t){return(0,s.getEdgeTerminal)(t,"source")!==(0,s.getEdgeTerminal)(t,"target")})),a=i.length,u=o.length,c=[],l={},h={},f=[],d=0;d0;){for(y=0;y=0;d--){if("break"===x(d))break}if(m)return et.splice(r,1),"continue";i.edges=c;var w=(0,a.default)(i,i.nodes[0].id,!1).length;if(Object.keys(w).reverse().forEach((function(t){if(t!==i.nodes[0].id&&!m){if(w[t]===1/0){var e=u[t].node[y];if(s[e]--,s[e]
=0&&y=0?[i]:[]}function Sa(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function Ea(t,e,n,r,i,o,a){var s=wa(t,n,i,a),u=wa(e,r,o,a),c=ba.pointAt(t,e,n,r,a),l=ba.pointAt(n,r,i,o,a);return[[t,e,c.x,c.y,s,u],[s,u,l.x,l.y,i,o]]}function Ma(t,e,n,r,i,o,a){if(0===a)return(ga(t,e,n,r)+ga(n,r,i,o)+ga(t,e,i,o))/2;var s=Ea(t,e,n,r,i,o,.5),u=s[0],c=s[1];return u.push(a-1),c.push(a-1),Ma.apply(null,u)+Ma.apply(null,c)}var Ta={box:function(t,e,n,r,i,o){var a=_a(t,n,i)[0],s=_a(e,r,o)[0],u=[t,i],c=[e,o];return void 0!==a&&u.push(wa(t,n,i,a)),void 0!==s&&c.push(wa(e,r,o,s)),va(u,c)},length:function(t,e,n,r,i,o){return Ma(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return xa([t,n,i],[e,r,o],a,s,wa)},pointDistance:function(t,e,n,r,i,o,a,s){var u=this.nearestPoint(t,e,n,r,i,o,a,s);return ga(u.x,u.y,a,s)},interpolationAt:wa,pointAt:function(t,e,n,r,i,o,a){return{x:wa(t,n,i,a),y:wa(e,r,o,a)}},divide:function(t,e,n,r,i,o,a){return Ea(t,e,n,r,i,o,a)},tangentAngle:function(t,e,n,r,i,o,a){var s=Sa(t,n,i,a),u=Sa(e,r,o,a);return ya(Math.atan2(u,s))}};function Aa(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Ca(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function ka(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,c=3*e-3*t,l=[];if(ma(s,0))ma(u,0)||(i=-c/u)>=0&&i<=1&&l.push(i);else{var h=u*u-4*s*c;ma(h,0)?l.push(-u/(2*s)):h>0&&(o=(-u-(a=Math.sqrt(h)))/(2*s),(i=(-u+a)/(2*s))>=0&&i<=1&&l.push(i),o>=0&&o<=1&&l.push(o))}return l}function Na(t,e,n,r,i,o,a,s,u){var c=Aa(t,n,i,a,u),l=Aa(e,r,o,s,u),h=ba.pointAt(t,e,n,r,u),f=ba.pointAt(n,r,i,o,u),d=ba.pointAt(i,o,a,s,u),p=ba.pointAt(h.x,h.y,f.x,f.y,u),g=ba.pointAt(f.x,f.y,d.x,d.y,u);return[[t,e,h.x,h.y,p.x,p.y,c,l],[c,l,g.x,g.y,d.x,d.y,a,s]]}function Oa(t,e,n,r,i,o,a,s,u){if(0===u)return function(t,e){for(var n=0,r=t.length,i=0;iu&&(h=u/c,f=!0),a=Cu(a,e?[["t",-e.x,-e.y],["s",h,h],["t",e.x,e.y]]:[["s",h,h]]),n){var d=(0,M.clone)(o.getMatrix());d||(d=[1,0,0,0,1,0,0,0,1]);var p=d[0],g=p*h,m=On({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate((function(t){if(1===t)d=a;else{var n=$e(p,g,t)/d[0];d=Cu(d,e?[["t",-e.x,-e.y],["s",n,n],["t",e.x,e.y]]:[["s",n,n]])}return{matrix:d}}),m)}else o.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint();return!f},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.focusItems=function(t,e,n,r){this.get("viewController").focusItems(t,e,n,r)},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((0,M.isString)(t)&&(n=this.findById(t)),!n&&(0,M.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=P(P({},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(P(P({},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=An(this.get("comboTrees"));this.set("comboTrees",u)}}},e.prototype.innerAddItem=function(t,e,n){if(!function(t,e){if("node"===t||"combo"===t){if(e.id&&!(0,M.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 r,i=this.get("comboTrees")||[];if("combo"===t){var o=this.get("itemMap"),a=!1;if(i.forEach((function(i){a||_n(i,(function(i){if(e.parentId===i.id){a=!0;var s=P({id:e.id,depth:i.depth+2},e);i.children?i.children.push(s):i.children=[s],e.depth=s.depth,r=n.addItem(t,e)}var u=o[i.id];return a&&u&&u.getType&&"combo"===u.getType()&&n.updateCombo(u,i.children),!0}))})),!a){var s=P({id:e.id,depth:0},e);e.depth=s.depth,i.push(s),r=n.addItem(t,e)}this.set("comboTrees",i),e.collapsed&&(this.collapseCombo(r,!1),this.updateCombo(r))}else if("node"===t&&(0,M.isString)(e.comboId)&&i){var u;(u=this.findById(e.comboId))&&u.getType&&"combo"!==u.getType()&&console.warn("'".concat(e.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),r=n.addItem(t,e);var c=this.get("itemMap"),l=!1,h=!1;i.forEach((function(t){h||l||_n(t,(function(t){if(t.id===e.id)return h=!0,!1;if(e.comboId===t.id&&!h){l=!0;var r=(0,M.clone)(e);r.itemType="node",t.children?t.children.push(r):t.children=[r],r.depth=t.depth+1}return l&&c[t.id].getType&&"combo"===c[t.id].getType()&&n.updateCombo(c[t.id],t.children),!0}))}))}else r=n.addItem(t,e);if("node"===t&&e.comboId||"combo"===t&&e.parentId)(u=this.findById(e.comboId||e.parentId))&&u.getType&&"combo"===u.getType()&&u.addChild(r);return r}console.warn("This item exists already. Be sure the id %c".concat(e.id,"%c is unique."),"font-size: 20px; color: red;","")},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"),a=this.innerAddItem(t,e,o);if(!1===a||!0===a)return a;var s=this.get("combos");if(s&&s.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var u=P(P({},a.getModel()),{itemType:t}),c={};switch(t){case"node":c.nodes=[u];break;case"edge":c.edges=[u];break;case"combo":c.combos=[u]}this.pushStack("add",{before:{},after:c})}return a},e.prototype.addItems=function(t,e,n){void 0===t&&(t=[]),void 0===e&&(e=!0),void 0===n&&(n=!0);var r=this.get("comboSorted");this.set("comboSorted",r&&!n);for(var i=this.get("itemController"),o=[],a=0;a
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].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)}}},id=function(){var t=navigator.userAgent.toLowerCase();return t.indexOf("firefox")>-1?"firefox":t.indexOf("safari")>-1?"safari":t.indexOf("opr")>-1?"opera":t.indexOf("chrome")>-1?"chrome":t.indexOf("trident")>-1?"ie 11":t.indexOf("ie")>-1?"ie":"unknown"},od=w(w(w(w(w({},Ju),p),g),m),v),ad=od.radialLayout,sd=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=qf()[e.type](t,e.config);return ad(n),n}:this.layoutMethod=function(t){return qf()[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}();(0,Wf.registerLayout)("grid",Wf.GridLayout),(0,Wf.registerLayout)("random",Wf.RandomLayout),(0,Wf.registerLayout)("force",Wf.ForceLayout),(0,Wf.registerLayout)("circular",Wf.CircularLayout),(0,Wf.registerLayout)("dagre",Wf.DagreLayout),(0,Wf.registerLayout)("dagreCompound",Wf.DagreCompoundLayout),(0,Wf.registerLayout)("radial",Wf.RadialLayout),(0,Wf.registerLayout)("concentric",Wf.ConcentricLayout),(0,Wf.registerLayout)("mds",Wf.MDSLayout),(0,Wf.registerLayout)("fruchterman",Wf.FruchtermanLayout),(0,Wf.registerLayout)("fruchterman-gpu",Wf.FruchtermanGPULayout),(0,Wf.registerLayout)("gForce",Wf.GForceLayout),(0,Wf.registerLayout)("force2",Wf.Force2Layout),(0,Wf.registerLayout)("gForce-gpu",Wf.GForceGPULayout),(0,Wf.registerLayout)("comboForce",Wf.ComboForceLayout),(0,Wf.registerLayout)("comboCombined",Wf.ComboCombinedLayout),(0,Wf.registerLayout)("forceAtlas2",Wf.ForceAtlas2Layout);var ud=function(t,e){var n=t.toString(),r=new Blob(["importScripts('".concat(e,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(r))},cd=function(t){void 0===t&&(t="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");var e=new ud((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("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),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,h=(m=void 0===l?{}:l).type;if(!(f=layout.getLayoutByName(h))){this.postMessage({type:n,message:"layout ".concat(h," not found")});break}m.onLayoutEnd=function(){o.postMessage({type:e,nodes:u}),null==a||a.destroy()},(a=new f(m)).init({nodes:u,edges:c}),a.execute();break;case r:var f,d=i.data,p=d.nodes,g=(c=d.edges,d.layoutCfg),m=void 0===g?{}:g,v=d.canvas;if(h=m.type,!(f=layout.getLayoutByName(h))){this.postMessage({type:n,message:"layout ".concat(h," not found")});break}if("gpu"!==h.split("-")[1]){this.postMessage({type:n,message:"layout ".concat(h," does not support GPU")});break}var y=new f(m);y.init({nodes:p,edges:c}),y.executeWithWorker(v,this)}}(i)}}),t);return e},ld="LAYOUT_RUN",hd="LAYOUT_END",fd="LAYOUT_ERROR",dd="LAYOUT_TICK",pd="GPU_LAYOUT_RUN",gd="GPU_LAYOUT_END";function md(t){return md="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},md(t)}var vd=function(t){return setTimeout(t,16)},yd=function(t){return clearTimeout(t)},bd=function(t){return("undefined"!=typeof window&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||vd)(t)},xd=function(t){return("undefined"!=typeof window&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||yd)(t)},wd=["fruchterman","gForce"],_d=["force","grid","circular"],Sd=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 x(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=cd(this.layoutCfg.workerScriptURL)),this.worker},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(xd(t.requestId),t.requestId=null),t.requestId2&&(xd(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return S(n,void 0,void 0,(function(){var n,o,a,s,u,c,l,h,f;return E(this,(function(d){switch(d.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&&(Td(o)?o="".concat(o,"-gpu"):console.warn("The '".concat(o,"' layout does not support GPU calculation for now, it will run in CPU."))),Ju.isForce(o)?(a=t.onTick,s=t.animate,u=void 0===s&&("force"===o||"force2"===o),h=function(){a&&a(),(s||u)&&n.refreshPositions()},t.tick=h):"comboForce"!==o&&"comboCombined"!==o||(t.comboTrees=n.get("comboTrees")),!1;try{c=new Wf.Layouts[o](t),this.layoutMethods[e]&&this.layoutMethods[e].destroy(),this.layoutMethods[e]=c}catch(t){console.warn("The layout method: '".concat(o,"' does not exist! Please specify it first.")),i()}return c.enableTick&&(l=t.onTick,h=function(){l&&l(),n.refreshPositions()},c.tick=h),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}))}(f=this.filterLayoutData(this.data,t),e),c.init(f),n.emit("beforesublayout",{type:o}),[4,c.execute()];case 1:return d.sent(),c.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}}))}))}))},e.prototype.updateLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return S(n,void 0,void 0,(function(){var n,i,o,a,s,u,c;return E(this,(function(l){switch(l.label){case 0:return n=this.graph,i=null==e?void 0:e.type,e.onLayoutEnd=function(){n.emit("aftersublayout",{type:i}),r()},Ju.isForce(i)&&(o=e.onTick,a=e.animate,s=void 0===a&&("force"===i||"force2"===i),u=function(){null==o||o(),(a||s)&&n.refreshPositions()},e.tick=u),c=this.filterLayoutData(this.data,e),t.init(c),t.updateCfg(e),n.emit("beforesublayout",{type:i}),[4,t.execute()];case 1:return l.sent(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}}))}))}))},e.prototype.layout=function(t){var e,n=this,r=this.graph;if(r&&!r.get("destroyed")){this.data=this.setDataFromGraph();var i=this.data,o=i.nodes,a=i.hiddenNodes;if(!o)return!1;var s=r.get("width"),u=r.get("height"),c={};Object.assign(c,{width:s,height:u,center:[s/2,u/2]},this.layoutCfg),this.layoutCfg=c;var l=c.type,h=!1;null===(e=this.layoutMethods)||void 0===e||e.forEach((function(t){var e;return h=!!(null===(e=t.nodes)||void 0===e?void 0:e.length)||h}));var f=this.destoryLayoutMethods();r.emit("beforelayout");var d=Promise.resolve();h&&l&&1===(null==f?void 0:f.length)&&f[0]===l?this.tweakInit():d=this.initPositions(c.center,o),this.initPositions(c.center,a).then(),this.isGPU=Ad(c,l);var p=c.onLayoutEnd,g=c.layoutEndFormatted,m=c.adjust;if(g||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return S(n,void 0,void 0,(function(){return E(this,(function(t){switch(t.label){case 0:return p&&p(o),this.refreshLayout(),m&&c.pipes?[4,this.adjustPipesBox(this.data,m)]:[3,2];case 1:t.sent(),this.refreshLayout(),t.label=2;case 2:return r.emit("afterlayout"),[2]}}))}))}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var v=!1;return c.type?(v=!0,d=d.then((function(){return S(n,void 0,void 0,(function(){return E(this,(function(t){switch(t.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,t.sent()]}}))}))}))):c.pipes&&(v=!0,c.pipes.forEach((function(t,e){d=d.then((function(){return S(n,void 0,void 0,(function(){return E(this,(function(n){switch(n.label){case 0:return[4,this.execLayoutMethod(t,e)];case 1:return[2,n.sent()]}}))}))}))}))),v?d.then((function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()})).catch((function(t){console.warn("graph layout failed,",t)})):(r.refreshPositions(),null==t||t()),!1}},e.prototype.tweakInit=function(){var t=this.data,e=this.graph,n=t.nodes,r=t.edges;if(null==n?void 0:n.length){var i={};n.forEach((function(t){var e=t.x,n=t.y;isNaN(e)||isNaN(n)||(i[t.id]={x:e,y:n},t.mass=t.mass||2)})),r.forEach((function(t){var e=t.source,n=t.target,r=i[e],o=i[n];!r&&o?i[e]={x:o.x+80*(Math.random()-.5),y:o.y+80*(Math.random()-.5)}:!o&&r&&(i[n]={x:r.x+80*(Math.random()-.5),y:r.y+80*(Math.random()-.5)})}));var o=e.get("width"),a=e.get("height");n.forEach((function(t){var e=i[t.id]||{x:o/2+20*(Math.random()-.5),y:a/2+20*(Math.random()-.5)};t.x=e.x,t.y=e.y}))}},e.prototype.initWithPreset=function(t,e){var n=this;return new Promise((function(r,i){return S(n,void 0,void 0,(function(){var n,i,o,a,s,u,c;return E(this,(function(l){switch(l.label){case 0:return i=(n=this).layoutCfg,o=n.data,(null==(a=i.preset)?void 0:a.type)&&Wf.Layouts[null==a?void 0:a.type]?(s=Ad(a,a.type),u=s?"".concat(a.type,"-gpu"):a.type,c=new Wf.Layouts[u](a),delete i.preset,c.init(o),[4,c.execute()]):(null==e||e(),r(),[2,!1]);case 1:return l.sent(),null==t||t(),r(),[2,!0]}}))}))}))},e.prototype.layoutWithWorker=function(t,e){var n=this,r=this.layoutCfg,i=this.graph,o=this.getWorker(),a=this.workerData;if(!o)return!1;a.requestId=null,a.requestId2=null,a.currentTick=null,a.currentTickData=null,i.emit("beforelayout");var s=Promise.resolve(),u=!1;if(r.type)u=!0,s=s.then((function(){return n.runWebworker(o,t,r)}));else if(r.pipes){u=!0;for(var c=function(e){s=s.then((function(){return n.runWebworker(o,t,e)}))},l=0,h=r.pipes;l").concat(i,"
\n ").concat(c,"\n ").concat("0||t.wheelDelta<0?1-Hy*o:1/(1-Hy*o):t.wheelDelta<0?1-Hy*o:1/(1-Hy*o));var u=this.get("minZoom")||n.get("minZoom"),c=this.get("maxZoom")||n.get("maxZoom");if(s>c?s=c:sr/2?c-=h.width:c+=this.offset,l>i/2?l-=h.height:l+=this.offset;var f="".concat(c,"px"),d="".concat(l,"px");Fd(this.container,{left:f,top:d,visibility:"visible"})}else Fd(o,{visibility:"hidden"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var n=Uh(''));return e.parentNode.appendChild(n),Fd(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}},Wy=w({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"}}},Zy),Yy=w({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"}}},Zy),qy="click",Xy=["click","dblclick"],Ky={getDefaultCfg:function(){return{trigger:qy,onChange:function(){}}},getEvents:function(){var t,e;return Xy.includes(this.trigger)?e=this.trigger:(e=qy,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if("click"===this.trigger){if(this.timer)return clearTimeout(this.timer),void(this.timer=0);this.timer=setTimeout((function(){e.toggle(t),clearTimeout(e.timer),e.timer=0}),200)}else this.toggle(t)},toggle: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,this)&&(n.collapsed=i,e.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:t.item,collapsed:i}),this.shouldUpdate(t,i,this)&&(this.onChange(e,i,this),this.graph.layout()))}}}}},$y=od.calculationItemsBBox,Qy=function t(e,n){if(!1!==n(e)&&e){var r=e.get("combos");if(0===r.length)return!1;(0,M.each)(r,(function(e){t(e,n)}))}},Jy={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","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(t,this)&&"combo"===e.getType())},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},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"),a=i.filter((function(t){var e=t.get("id");return o===e}));0===a.length?this.targets.push(r):this.targets=i;var s=[];this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,i=e.id;s.push({x:n,y:r,id:i})})),this.set("beforeDragItems",s),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.currentItemChildCombos=[],Qy(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,l=o.filter((function(t){var n=t.getModel();return i.parentId,n.id!==i.id&&!e.currentItemChildCombos.includes(n.id)}));l.map((function(t){var r=t.getBBox(),i=r.centerX,o=r.centerY,a=r.width,l=s-i,h=u-o,f=2*Math.sqrt(l*l+h*h);c+a-f>.8*c?n.setItemState(t,e.activeState,!0):n.setItemState(t,e.activeState,!1)}))}(0,M.each)(this.targets,(function(n){e.updateCombo(n,t)})),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var n=this;(this.enableDelegate||e)&&(0,M.each)(this.targets,(function(r){n.updateCombo(r,t,e)}))},onDrop:function(t){var e=this,n=t.item;if(this.currentShouldEnd=this.shouldEnd(t,n,this),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,!1)):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(t,i,this),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,!1))}))}else this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):t.getModel().comboId&&n.updateComboTree(t,void 0,!1)}));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;if(t&&this.activeState&&r.setItemState(t,this.activeState,!1),!t){var i=r.get("enabledStack")&&this.enableStack,o={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map((function(t){if(n.onlyChangeComboSize){r.updateCombo(t);var e=t.getModel(),a=e.x,s=e.y,u=e.id;o.after.combos.push({x:a,y:s,id:u}),r.pushStack("update",o)}else r.updateComboTree(t,void 0,i)}))}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e,n){var r=this;if(void 0===n&&(n={}),!1!==e(t,n)&&t){var i=t.get("combos");(0,M.each)(i,(function(t){r.traverse(t,e,n)}));var o=t.get("nodes");(0,M.each)(o,(function(t){r.traverse(t,e,n)}))}},updateCombo:function(t,e,n){this.updateSingleItem(t,e,n);var r={};this.traverse(t,(function(t,e){return!t.destroyed&&(t.getEdges().forEach((function(t){return e[t.getID()]=t})),!0)}),r),Object.values(r).forEach((function(t){return t.refresh()}))},updateSingleItem: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},!1)},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?$y(this.targets):this.targets[0].getBBox()).x,s=o.y,u=o.width,c=o.height,l=o.minX,h=o.minY;this.originPoint={x:a,y:s,width:u,height:c,minX:l,minY:h};var f=w(w({},Bf.delegateStyle),this.delegateStyle);this.delegateShape=i.addShape("rect",{attrs:w({width:o.width,height:o.height,x:o.x,y:o.y},f),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var t=this.graph,e=this.targets,n={};null==e||e.forEach((function(e){var r=e.getModel().parentId;r&&(n[r]=t.findById(r))})),Object.values(n).forEach((function(e){e&&t.updateCombo(e)}))}},tb="dblclick",eb=["click","dblclick"],nb={getDefaultCfg:function(){return{trigger:tb,relayout:!0}},getEvents:function(){var t,e;return eb.includes(this.trigger)?e=this.trigger:(e=tb,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())}}},rb=od.isPolygonsIntersect,ib=od.pathToPoints,ob="shift",ab=["drag","shift","ctrl","alt","control"],sb={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:ob,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return ab.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=ob,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("dragstart"),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(t){void 0===t&&(t="canvas:click");var e=this,n=e.graph,r=e.selectedState,i=e.shouldDeselect,o=n.findAllByState("node",r),a=n.findAllByState("edge",r);i&&!i({action:t,nodes:o,edges:a})||(o.forEach((function(t){return n.setItemState(t,r,!1)})),a.forEach((function(t){return n.setItemState(t,r,!1)}))),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],n.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(s){if(s.isVisible()&&function(t,e){var n,r=t.getKeyShape();if("path"===t.get("type"))n=ib(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 rb(e,n)}(s,r)&&n(s,"select",t)){o.push(s);var u=s.getModel();a.push(u.id),e.setItemState(s,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",t)&&(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:w({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}},ub="click",cb=["click","drag"],lb=void 0,hb=["shift","ctrl","control","alt","meta",void 0],fb={getDefaultCfg:function(){return{trigger:ub,key:lb,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t,e=this;return cb.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=ub,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&-1===hb.indexOf(e.key.toLowerCase())&&(e.trigger=lb,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined")),"drag"===e.trigger?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:"click"===e.trigger&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(t){var e=this;if(!e.key||e.keydown){var n=t.item;n&&n.getID()!==e.source&&"node"===n.getType()||e.cancelCreating({item:e.edge,x:t.x,y:t.y})}},onClick:function(t){var e=this;if(!e.key||e.keydown){var n=t.item,r=e.graph,i=n.getModel(),o=e.getEdgeConfig;if(e.addingEdge&&e.edge){if(!e.shouldEnd(t,e))return;var a=void 0;a=o&&(0,M.isFunction)(o)?o({source:e.source,target:i.id},e):e.edgeConfig;var s=w({target:i.id},a);if(e.source===i.id&&(s.type="loop"),r.emit("beforecreateedge",{}),r.updateItem(e.edge,s,!1),r.get("enabledStack")){var u=w(w({},e.edge.getModel()),{itemType:"edge"}),c={};c.edges=[u],r.pushStack("add",{before:{},after:c})}r.emit("aftercreateedge",{edge:e.edge}),e.edge.getKeyShape().set("capture",!0),e.edge=null,e.addingEdge=!1}else{if(!e.shouldBegin(t,e))return;a=void 0;a=o&&(0,M.isFunction)(o)?o({source:i.id,target:i.id},e):e.edgeConfig,e.edge=r.addItem("edge",w({source:i.id,target:i.id},a),!1),e.source=i.id,e.addingEdge=!0,e.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){var e=this;if(!e.key||e.keydown){e.edge&&e.edge.destroyed&&e.cancelCreating({item:e.edge});var n={x:t.x,y:t.y};e.graph.findById(e.source)?e.addingEdge&&e.edge&&e.graph.updateItem(e.edge,{target:n},!1):e.addingEdge=!1}},cancelCreating:function(t){var e,n,r=this;if(!r.key||r.keydown){var i=r.graph,o=t.item;return r.addingEdge&&(r.edge===o||(null===(n=null===(e=t.target)||void 0===e?void 0:e.isCanvas)||void 0===n?void 0:n.call(e)))?(r.edge&&!r.edge.destroyed&&i.removeItem(r.edge,!1),r.edge=null,void(r.addingEdge=!1)):void 0}},onKeyDown:function(t){var e=this,n=t.key;n&&(n.toLowerCase()===e.key.toLowerCase()?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.addingEdge&&t.edge&&(t.graph.removeItem(t.edge,!1),t.addingEdge=!1,t.edge=null),this.keydown=!1}},db="ctrl",pb=["shift","ctrl","alt","control"],gb={getDefaultCfg:function(){return{trigger:db,combinedKey:"1",functionName:"fitView",functionParams:[]}},getEvents:function(){return pb.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=db,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}},mb=["shift","ctrl","alt","control","meta"],vb={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return this.zoomKey&&-1!==mb.indexOf(this.zoomKey)||(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(this.allowDrag(t)){var n=this.graph,r=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];if(r.includes("control")&&r.push("ctrl"),r.some((function(e){return t["".concat(e,"Key")]}))){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(),h=this.scalableRange,f=this.scalableRange;h<1&&h>-1&&(h*=u,f*=c);var d=l.minX,p=l.maxX,g=l.minY,m=l.maxY;a>0?p<-h?a=0:p-a<-h&&(a=p+h):a<0&&(d>u+h?a=0:d-a>u+h&&(a=d-(u+h))),s>0?m<-f?s=0:m-s<-f&&(s=m+f):s<0&&(g>c+f?s=0:g-s>c+f&&(s=g-(c+f))),"x"===this.get("direction")?s=0:"y"===this.get("direction")&&(a=0),n.translate(-a,-s)}if(t.preventDefault(),this.get("enableOptimize")){var v=this.get("optimizeZoom"),y=this.get("optimized"),b=n.getNodes(),x=n.getEdges(),w=b.length,_=x.length;if(!y){for(var S=0;Se[r])return 1;if(t[r]1&&r.forEach((function(n,a){if("node"===n.itemType)return!1;var u=e[n.id];u&&r.forEach((function(r,c){if(a<=c)return!1;if("node"===r.itemType)return!1;var l=e[r.id];if(!l)return!1;var h=u.cx-l.cx||.005,f=u.cy-l.cy||.005,d=h*h+f*f,p=u.r||1,g=l.r||1,m=p+g,v=g*g,y=p*p;if(d0;--s)if(r=e[s].dequeue()){i=i.concat(f(t,e,n,r,!0));break}}return i},f=function(t,e,n,r,i){var o,a,s=[];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,in:0,out:0}),void 0===a.out&&(a.out=0),a.out-=o,p(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,p(e,n,a)})),t.removeNode(r.v),i?s:void 0},d=function(t,e){var n=new c,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)||0,a=(null==e?void 0:e(t))||1,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 o=[],a=i+r+3,s=0;s0;)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+=1)n+=i(t,e[r-1],e[r]);return n}},19597: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(15697)),o=r(n(32957)),a=r(n(77006)),s=r(n(80314)),u=r(n(99455)),c=n(49784),l=n(27652),h=n(69209),f=function(t,e,n){return e.map((function(e){return(0,a.default)(t,e,n)}))},d=function(t,e,n,r){var i=new l.Graph;null==t||t.forEach((function(t){for(var o,a=t.graph().root,c=(0,u.default)(t,a,i,e,n,r),l=0;l<(null===(o=c.vs)||void 0===o?void 0:o.length);l++){var h=t.node(c.vs[l]);h&&(h.order=l)}(0,s.default)(t,i,c.vs)}))},p=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,e){for(var n=(0,h.maxRank)(t),r=[],a=[],s=1;su.lim&&(c=u,l=!0);var h=e.edges().filter((function(e){return l===d(t,t.node(e.v),c)&&l!==d(t,t.node(e.w),c)}));return(0,o.minBy)(h,(function(t){return(0,i.slack)(e,t)}))};e.exchangeEdges=function(t,n,r,i){var o=r.v,a=r.w;t.removeEdge(o,a),t.setEdge(i.v,i.w,{}),(0,e.initLowLimValues)(t),(0,e.initCutValues)(t,n),h(t,n)};var h=function(t,e){var n=t.nodes().find((function(t){var n;return!(null===(n=e.node(t))||void 0===n?void 0:n.parent)})),r=s(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edgeFromArgs(n,r),o=!1;i||(i=e.edgeFromArgs(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},f=function(t,e,n){return t.hasEdge(e,n)},d=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};e.default=function(t){var n=(0,o.simplify)(t);(0,i.longestPath)(n);var a,s,u=(0,r.feasibleTree)(n);for((0,e.initLowLimValues)(u),(0,e.initCutValues)(u,n);a=(0,e.leaveEdge)(u);)s=(0,e.enterEdge)(u,n,a),(0,e.exchangeEdges)(u,n,a,s)}},37323:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.slack=e.longestPathWithLayer=e.longestPath=void 0;var n=function(t){var e,n={},r=function(e){var i,o,a=t.node(e);return a?n[e]?a.rank:(n[e]=!0,null===(i=t.outEdges(e))||void 0===i||i.forEach((function(e){var n=r(e.w)-t.edge(e).minlen;n&&(void 0===o||ni.maxSpeed){var c=i.maxSpeed/u;a*=c,s*=c}e[2*r]=a,e[2*r+1]=s}))},e.prototype.updatePosition=function(t,e,n){n.forEach((function(n,r){if((0,a.isNumber)(n.fx)&&(0,a.isNumber)(n.fy))return n.x=n.fx,void(n.y=n.fy);var i=t[2*r]*e,o=t[2*r+1]*e;n.x+=i,n.y+=o}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(o.Base);e.GForceLayout=u},87745: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])},r(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.__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())}))},a=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(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1] 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":"","GLSL450":"","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=0;o--){for(i=0;i=0;n--){for(t=0;t0&&(o=-o),e[s]=h*o,a-=i*o,n[s-1]=i-o,u=0;uc){x=0;do{for(x+=1,i=n[c],h=(n[c+1]-i)/(2*e[c]),f=B(h,1),h<0&&(f=-f),n[c]=e[c]/(h+f),n[c+1]=e[c]*(h+f),d=n[c+1],o=i-n[c],a=c+2;a=0){for(N=T>=0?T+N:T-N,n[x-1]=f+N,n[x]=n[x-1],0!==N&&(n[x]=f-h/N),e[x-1]=0,e[x]=0,f=i.get(x,x-1),k=Math.abs(f)+Math.abs(N),T=f/k,A=N/k,C=Math.sqrt(T*T+A*A),T/=C,A/=C,a=x-1;ac+2&&i.set(o,o-3,0);for(s=c;s<=x-1&&(y=s!==x-1,s!==c&&(T=i.get(s,s-1),A=i.get(s+1,s-1),C=y?i.get(s+2,s-1):0,f=Math.abs(T)+Math.abs(A)+Math.abs(C),0!==f&&(T/=f,A/=f,C/=f)),0!==f);s++)if(k=Math.sqrt(T*T+A*A+C*C),T<0&&(k=-k),0!==k){for(s!==c?i.set(s,s-1,-k*f):u!==c&&i.set(s,s-1,-i.get(s,s-1)),T+=k,f=T/k,d=A/k,N=C/k,A/=T,C/=T,a=s;a