@antv/g6 5.0.0-alpha.2 → 5.0.0-alpha.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
@@ -16,4 +16,4 @@ ${Ex}columns: ${t.columns}
16
16
  background: rgba(0, 0, 255, 0.1);
17
17
  cursor:move'
18
18
  draggable=${!a&&!o}
19
- </div>`);let u=0,c=0,h=!1;p.addEventListener(a||o?"mousedown":"dragstart",(e=>{var t,n;if(e.dataTransfer){var r=new Image;r.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null!=(n=(t=e.dataTransfer).setDragImage)&&n.call(t,r,0,0);try{e.dataTransfer.setData("text/html","view-port-minimap")}catch(t){e.dataTransfer.setData("text","view-port-minimap")}}this.options.refresh=!1,e.target===p&&(h=!0,u=e.clientX,c=e.clientY)}).bind(this),!1);var s=n=>{if(h&&!Pu(n.clientX)&&!Pu(n.clientY)){var r=this["ratio"],i=d.getZoom();let t=u-n.clientX,e=c-n.clientY;var o=p["style"],a=parseInt(o.left,10),s=parseInt(o.top,10),l=parseInt(o.width,10),o=parseInt(o.height,10);(a-t<0||a-t+l>=f[0])&&(t=0),(s-e<0||s-e+o>=f[1])&&(e=0),d.translate({dx:t*i/r,dy:e*i/r}).then(()=>{this.updateViewport()}),u=n.clientX,c=n.clientY}},l=(a||o||p.addEventListener("drag",s.bind(this),!1),()=>{h=!1,this.options.refresh=!0});p.addEventListener(a||o?"mouseup":"dragend",l.bind(this),!1);p.addEventListener("wheel",t=>{},!1),i.addEventListener("mouseleave",l.bind(this)),i.addEventListener("mouseup",l.bind(this)),(a||o)&&i.addEventListener("mousemove",s.bind(this),!1),this.viewport=p,i.appendChild(p)}}updateViewport(){if(!this.destroyed){this.viewport||this.initViewport();var{options:i,graph:o,dx:a,dy:s,ratio:l,viewport:u}=this,i=i["size"],c=o.canvas.context.config.canvas,[h=(null==c?void 0:c.scrollWidth)||500,c=(null==c?void 0:c.scrollHeight)||500]=o.getSize(),d=o.getZoom(),f=o.canvas.getRoot().getRenderBounds(),p=o.getViewportByCanvas({x:f.min[0],y:f.min[1]}),o=o.getViewportByCanvas({x:f.max[0],y:f.max[1]});let t=h*l/d,e=c*l/d,n=0,r=0;p.x<0?(n=-p.x/h*t+a,o.x<h&&(t=i[0]-n)):t-=p.x/h*t-a,p.y<0?(r=-p.y/c*e+s,o.y<c&&(e=i[1]-r)):e-=p.y/c*e-s;var f=t+n,l=(f>i[0]&&(t-=f-i[0]),e+r),g=(l>i[1]&&(e-=l-i[1]),u),m={left:n+"px",top:r+"px",width:t+"px",height:e+"px"};if(g)for(var v in m)m.hasOwnProperty(v)&&(g.style[v]=m[v])}}updateGraphShapes(){var{graph:t,options:n,canvas:r}=this,t=t.canvas.getRoot();if(!t.destroyed){r.removeChildren();let e;n=n["hideEdge"];n?(e=new fs,r.appendChild(e),t.children.forEach(t=>{"edge-group"!==t.id&&e.appendChild(t.cloneNode(!0))})):(e=t.cloneNode(!0),r.appendChild(e))}}updateKeyShapes(){var{graph:t,options:e,canvas:n}=this,e=e["hideEdge"];const r=n.getRoot(),i=(e||Lu(t.getAllEdgesData(),t=>{this.updateOneEdgeKeyShape(t,r)}),Lu(t.getAllNodesData(),t=>{this.updateOneNodeKeyShape(t,r)}),t.getAllCombosData());if(i&&i.length){let e=r.find(t=>"combo-group"===t.id);e||(e=new fs({id:"combo-group"}),r.appendChild(e)),setTimeout(()=>{this.destroyed||(Lu(i,t=>{this.updateOneNodeKeyShape(t,e)}),null!==e&&void 0!==e&&e.sort(),null!==e&&void 0!==e&&e.toBack(),this.updateCanvas())},250)}this.clearDestroyedShapes()}updateOneNodeKeyShape(n,r){var{itemMap:i={},graph:o}=this,a=o.canvas.getRoot().find(t=>"node-group"===t.id);if(a){let{minimapItem:e,graphItem:t}=i[n.id]||{};e&&!e.destroyed||(t=null==(a=a.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:a.find(t=>"keyShape"===t.id),(e=t.cloneNode()).id="minimap-keyShape-"+n.id,r.appendChild(e),i[n.id]={graphItem:t,minimapItem:e});a=t.getRenderBounds();if(a){r=t.attributes;const s=Object.assign(Object.assign({},r),{cx:a.center[0],cy:a.center[1]});e.toFront();r=e.get("type"),r=("rect"!==r&&"image"!==r&&"text"!==r||(s.x=a.min[0],s.y=a.min[1]),Object.keys(s).forEach(t=>{e.style[t]=s[t]}),o.getItemVisible(n.id)?e.show():e.hide(),n.data.depth);isNaN(r)||e.set("zIndex",r),this.itemMap=i}}}updateDelegateShapes(){var{graph:t,options:e,canvas:n}=this,e=e["hideEdge"];const r=n.getRoot(),i=(e||Lu(t.getAllEdgesData(),t=>{this.updateOneEdgeKeyShape(t,r)}),Lu(t.getAllNodesData(),t=>{this.updateOneNodeDelegateShape(t,r)}),t.getAllCombosData());if(i&&i.length){const o=r.find(t=>"comboGroup"===t.get("name"))||r.addGroup({name:"comboGroup"});setTimeout(()=>{this.destroyed||(Lu(i,t=>{this.updateOneNodeKeyShape(t,o)}),null!==o&&void 0!==o&&o.sort(),null!==o&&void 0!==o&&o.toBack(),this.updateCanvas())},250)}this.clearDestroyedShapes()}clearDestroyedShapes(){var{itemMap:e={}}=this,n=Object.keys(e);if(n&&0!==n.length)for(let t=n.length-1;0<=t;t--){var{minimapItem:r,graphItem:i}=e[n[t]]||{};i.destroyed&&r&&(r.remove(),delete e[n[t]])}}updateOneEdgeKeyShape(n,r){var i,{itemMap:o={},graph:a}=this,s=a.canvas.getRoot().find(t=>"edge-group"===t.id);if(s){let{minimapItem:t,graphItem:e}=o[n.id]||{};t&&!t.destroyed?(i=e.style.path,t.style.path=i):(e=null==(i=s.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:i.find(t=>"keyShape"===t.id),(t=e.cloneNode()).id="minimap-keyShape-"+n.id,r.appendChild(t)),a.getItemVisible(n.id)?t.show():t.hide(),o[n.id]={graphItem:e,minimapItem:t},this.itemMap=o}}updateOneNodeDelegateShape(n,r){var{itemMap:i={},options:o,graph:a}=this,o=o["delegateStyle"],s=a.canvas.getRoot().find(t=>"node-group"===t.id);if(s){let{minimapItem:e,graphItem:t}=i[n.id]||{};s=(t=t||(null==(s=s.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:s.find(t=>"keyShape"===t.id))).getRenderBounds();const l=Object.assign({x:s.min[0],y:s.min[1],width:s.max[0]-s.min[0],height:s.max[1]-s.min[1]},o);!e||e.destroyed?(e=new Rs({style:Object.assign(Object.assign(Object.assign({},t.attributes),l),o),id:"minimap-delegate-"+n.id}),r.appendChild(e)):Object.keys(l).forEach(t=>e.style[t]=l[t]),e.toFront(),a.getItemVisible(n.id)?e.show():e.hide(),i[n.id]={graphItem:t,minimapItem:e},this.itemMap=i}}init(t){super.init(t),this.initContainer().then(()=>this.updateCanvas())}initContainer(){var{graph:t,options:e}=this,{size:n,className:r}=e;let i=e.container;e=Ow(`<div class='${r}' style='width: ${n[0]}px; height: ${n[1]}px; overflow: hidden;'></div>`),((i=ku(i)?document.getElementById(i):i)||t.container).appendChild(e),this.container&&(this.container.remove(),null!=(r=this.viewport)&&r.remove(),this.viewport=void 0,null!=(r=this.canvas))&&r.destroy(),this.container=e,r=Ow('<div class="g6-minimap-container" style="position: relative;"></div>'),e.appendChild(r),r.addEventListener("dragenter",t=>{t.preventDefault()}),r.addEventListener("dragover",t=>{t.preventDefault()}),e=t.canvas;return this.canvas=Mv("canvas",r,n[0],n[1],e.devicePixelRatio),this.canvas.ready}updateCanvas(){if(!this.destroyed){var{graph:t,canvas:e,options:n}=this,{refresh:n,size:r,padding:i,mode:o}=n;if(n&&!t.destroyed&&!e.destroyed){switch(o){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var n=e.getRoot();n&&(o=n.getRenderBounds(),t=(n=t.canvas.getRoot().getRenderBounds()).max[0]-n.min[0],n=n.max[1]-n.min[1],t=Math.min((r[0]-2*i)/t,(r[1]-2*i)/n),r=e.viewport2Canvas({x:0,y:0}),{x:i,y:n}=(e.getCamera().setFocalPoint(r.x,r.y),e.getCamera().setPosition(r.x,r.y),e.getCamera().setZoom(t),e.getCamera().setPosition(o.center[0],o.center[1]),e.getCamera().setFocalPoint(o.center[0],o.center[1]),e.canvas2Viewport({x:o.min[0],y:o.min[1]})),this.ratio=t,this.dx=i,this.dy=n,this.updateViewport())}}}getCanvas(){return this.canvas}getViewport(){return this.viewport}getContainer(){return this.container}destroy(){super.destroy(),null!=(t=this.canvas)&&t.destroy();var t=this.container;null!=t&&t.parentNode&&t.parentNode.removeChild(t)}},legend:class extends Iw{constructor(t){super(t)}getDefaultCfgs(){return{container:null,className:"g6-category-legend",orientation:"horizontal",selectedState:"selected",activeState:"active"}}getEvents(){return{afterrender:this.updateLegend}}init(t){super.init(t);var{size:e="fit-content",orientation:n}=this.options,t=t.getSize();this.size=e,this.selectedTypes={node:new Set,edge:new Set},this.activeType={node:void 0,edge:void 0},this.selectedIds={node:new Set,edge:new Set},this.activeIds={node:new Set,edge:new Set},this.styleCache={node:{},edge:{}},"fit-content"===e&&(this.size=["horizontal"===n?t[0]:"fit-content","horizontal"===n?"fit-content":t[1]]),e[0].includes("%")?(n=Number(e[0].replace("%"))/100||1,this.size[0]=t[0]*n):"number"==typeof e[0]&&(this.size[0]=e[0]),"100%"===e[1]?(n=Number(e[0].replace("%"))/100||1,this.size[1]=t[1]*n):"number"==typeof e[1]&&(this.size[1]=e[1])}updateLegend(){var t=this.size;this.wrapper||(this.wrapper=this.createWrapper()),this.canvas||(t=["fit-content"===t[0]?0:t[0],"fit-content"===t[1]?0:t[1]],this.canvas=Mv("canvas",this.wrapper,t[0],t[1]),this.canvas.context.config.canvas.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.canvas.addEventListener("click",t=>{var e,n,r;"document"===(null==(t=t.target)?void 0:t.nodeName)&&({graph:t,options:n}=this,{activeState:n,selectedState:e}=n,this.activeIds.node.size&&t.clearItemState(Array.from(this.activeIds.node),n),this.activeIds.edge.size&&t.clearItemState(Array.from(this.activeIds.edge),n),this.activeIds={node:new Set,edge:new Set},e&&({node:n,edge:r}=this.selectedIds,t.clearItemState(Array.from(n),e),t.clearItemState(Array.from(r),e),this.selectedIds={node:new Set,edge:new Set}),this.selectedTypes.node.forEach(t=>{var e=this.canvas.getRoot().querySelector("#marker-node-"+t);e&&(t=this.styleCache.node[t].lineWidth,e.style.lineWidth=t)}),this.selectedTypes.edge.forEach(t=>{var e=this.canvas.getRoot().querySelector("#marker-edge-"+t);e&&(t=this.styleCache.edge[t].lineWidth,e.style.lineWidth=t)}),this.selectedTypes={node:new Set,edge:new Set},this.activeType={node:void 0,edge:void 0})})),this.canvas.ready.then(()=>{this.nodeLegend=this.upsertLegend("node"),this.edgeLegend=this.upsertLegend("edge"),this.updateLayout()})}createWrapper(){var{options:t,graph:e,size:n}=this,{container:t,className:r}=t;let i=t;i=(i="string"==typeof t?document.getElementById(t):i)||e.container;t=["fit-content"===n[0]?0:n[0],"fit-content"===n[1]?0:n[1]],e=HTMLDivElement=Ow(`<div class='${r}' style='width: ${t[0]}px; height: ${t[1]}px; overflow: hidden;'></div>`);return i.appendChild(e),e}upsertLegend(i="node"){var{graph:t,options:e,canvas:n}=this,{node:e,edge:r,orientation:o}=e,e="node"===i?e:r;if(null==e||!e.enable)return;const{title:a,typeField:s,labelFormatter:l,rows:u=1,cols:c=4,colPadding:h=5,rowPadding:d=8,padding:f=[0,0,0,0],labelStyle:p={},markerStyle:g}=e,m={shape:"node"===i?"circle":"line",size:10,color:"#ccc",fillOpacity:.3};r=Jv(f);const v={};Object.keys(p).forEach(t=>{v["itemLabel"+function(t){t=Gu(t);return t.charAt(0).toUpperCase()+t.substring(1)}(t)]=p[t]});var e=v.itemLabelSpacing,{size:y,grid:E}=this.getLegendSize(u,c,r);const _="node"===i?t.getAllNodesData():t.getAllEdgesData(),b=new Set,x={},S=(_.map(t=>{var e;t.data[s]&&(e=t.data[s],b.add(e),x[e]||(x[e]=t))}),Array.from(b));var w=S.map(t=>({typeValue:t,label:l?l(t):t}));const T={};let A;if(g){const M=Object.assign({},m,g||{}),R=M["shape"],N=I(M,["shape"]);A=this.getShapeConfig(i,R),Object.keys(N).forEach(t=>{const e=N[t];let n=e;"object"==typeof e?n=t=>e[t.typeValue]||e[t.typeValue].size||10:Cu(e)&&(n=t=>e(t.typeValue)),"color"===t?(T.itemMarkerFill=T.itemMarkerFill||n,T.itemMarkerStroke=T.itemMarkerStroke||n):T["itemMarker"+rA(t)]=n})}else{t=t.canvas.getRoot();const C=t.getElementById(i+"-group")||t,P={},O={x1:-10,y1:0,x2:10,y2:0};S.forEach(e=>{var t=C.find(t=>t.getAttribute("data-item-id")===x[e].id).querySelector("#keyShape");P[e]={shape:t.nodeName,style:Object.assign(Object.assign({},t.attributes),O)}}),["fill","stroke","fillOpacity","opacity","lineWidth","shadow","shadowBlur","size"].forEach(n=>{T["itemMarker"+rA(n)]=t=>{t=t.typeValue;let e=n;return"size"===n&&(P[t].style.r&&(e="r"),e="width"),P[t].style[e]||m[n]}}),A=t=>{var t=t["typeValue"],e=P[t].shape||m.shape;return{Shape:Xv[e],style:P[t].style}}}t=new eA({style:Object.assign(Object.assign(Object.assign({x:r[3],y:r[0],data:w,layout:"flex",orientation:o,gridRow:E[0],gridCol:E[1],colPadding:h,rowPadding:d,width:y[0],height:y[1],titleText:a,itemSpacing:e},v),T),{itemMarker:t=>{const{Shape:e,style:n}=A(t),r=t["typeValue"];return this.styleCache[i][r]=n,()=>new e({style:n,id:`marker-${i}-`+r})},mouseenter:t=>this.handleMouseEnter(t,S,s,i,_),mouseleave:t=>this.handleMouseLeave(t,S,s,i),click:t=>this.handleClick(t,S,s,i,_)})});return n.appendChild(t),t}updateLayout(){var{nodeLegend:n,edgeLegend:r,options:i,size:t}=this;if(n&&r){var{node:i,edge:o,orientation:a}=i,{order:i=1,padding:s}=i,{order:o=2,padding:l}=o;let t,e;i<o?(t={padding:Jv(s),legend:n},e={padding:Jv(l),legend:r}):(e={padding:Jv(s),legend:n},t={padding:Jv(l),legend:r});i=t.legend.getRenderBounds();"horizontal"===a?(t.legend.translateLocal([0,-i.min[1]+t.padding[0]]),o=t.legend.childNodes[1].childNodes[0].childNodes[0].getRenderBounds().max[1]+t.padding[2],e.legend.translateLocal([0,o])):(t.legend.translateLocal([-i.min[0]+t.padding[3],0]),s=t.legend.childNodes[1].childNodes[0].childNodes[0].childNodes[1].getRenderBounds().max[0]+t.padding[1],e.legend.translateLocal([s,0]))}"fit-content"!==t[0]&&"fit-content"!==t[1]||(n=this.canvas.getRoot().getRenderBounds(),l=["fit-content"===t[0]?n.max[0]-n.min[0]:t[0],"fit-content"===t[1]?n.max[1]-n.min[1]:t[1]],this.canvas.resize(l[0],l[1]),this.wrapper.style.width=l[1]+"px",this.wrapper.style.height=l[0]+"px")}getShapeConfig(t,n){const r="node"===t?ls:Es,i="node"===t?{r:10,width:20,height:20,lineWidth:1}:{lineWidth:4,x1:-10,y1:0,x2:10,y2:0};if("string"!=typeof n)return t=>{var e,t=n[t.typeValue];return"string"==typeof t?{Shape:Xv[t],style:i}:({type:t,style:e}=t,{Shape:Xv[t]||r,style:Object.assign(Object.assign({},i),e)})};{const e=Xv[n]||r;return()=>({Shape:e,style:i})}}getLegendSize(t,e,n){var{graph:r,options:i,size:o}=this,i=i["orientation"];let[a,s]=o,l=[t,e];var[r,u]=r.getSize();return"horizontal"===i?("fit-content"===o[0]&&(a=r),"fit-content"===o[1]&&(s=50)):("fit-content"===o[0]&&(a=50),"fit-content"===o[1]&&(s=u),l=[e,t]),a+=n[1]+n[3],s+=n[0]+n[2],{size:[a,s],grid:l}}handleMouseEnter(t,e,n,r,i){var{graph:o,options:a}=this,a=a["activeState"];if(a){var s=t.__data__["index"];const l=e[s];this.activeType[n]=l;e=i.filter(t=>t.data[n]===l).map(t=>t.id);o.setItemState(e,a,!0),e.forEach(t=>this.activeIds[r].add(t)),t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][l].lineWidth+2||4}}handleMouseLeave(t,e,n,r){var i,{graph:o,options:a}=this,a=a["activeState"];a&&(this.activeType[n]=void 0,n=o.findIdByState(r,a,!0),i=t.__data__["index"],e=e[i],this.selectedTypes[r].has(e)?t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][e].lineWidth+4||6:t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][e].lineWidth||1,o.setItemState(n,a,!1),n.forEach(t=>this.activeIds[r].delete(t)))}handleClick(t,e,n,r,i){var{graph:o,options:a}=this,a=a["selectedState"];if(a){var s=t.__data__["index"];const l=e[s];e=i.filter(t=>t.data[n]===l).map(t=>t.id);this.selectedTypes[r].has(l)?(this.selectedTypes[r].delete(l),e.forEach(t=>this.selectedIds[r].delete(t)),o.setItemState(e,a,!1),t.querySelector(".legend-category-item-marker").style.lineWidth=4):(this.selectedTypes[r].add(l),e.forEach(t=>this.selectedIds[r].add(t)),o.setItemState(e,a,!0),t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][l].lineWidth+4||6)}}destroy(){super.destroy(),this.canvas.destroy()}}},nodes:{"circle-node":class extends SS{constructor(t){super(t),this.defaultStyles={keyShape:{r:16,x:0,y:0}}}draw(t,e,n,r){var i,{data:o={}}=t;let a={keyShape:void 0};return a.keyShape=this.drawKeyShape(t,e,n),o.haloShape&&this.drawHaloShape&&(a.haloShape=this.drawHaloShape(t,e,n)),o.labelShape&&(a.labelShape=this.drawLabelShape(t,e,n)),o.labelBackgroundShape&&(a.labelBackgroundShape=this.drawLabelBackgroundShape(t,e,n)),o.anchorShapes&&(i=this.drawAnchorShapes(t,e,n,r),a=Object.assign(Object.assign({},a),i)),o.iconShape&&(a.iconShape=this.drawIconShape(t,e,n)),o.badgeShapes&&(i=this.drawBadgeShapes(t,e,n,r),a=Object.assign(Object.assign({},a),i)),a=o.otherShapes&&this.drawOtherShapes?Object.assign(Object.assign({},a),this.drawOtherShapes(t,e,n)):a}drawKeyShape(t,e,n,r){return this.upsertShape("circle","keyShape",this.mergedStyles.keyShape,e,t)}},"sphere-node":class extends MS{constructor(t){super(t),this.defaultStyles={keyShape:{r:5,latitudeBands:32,longitudeBands:32,x:0,y:0,z:0}}}draw(t,e,n,r){var{data:i={}}=t;let o={keyShape:void 0};return o.keyShape=this.drawKeyShape(t,e,n),i.haloShape&&this.drawHaloShape&&(o.haloShape=this.drawHaloShape(t,e,n)),i.labelShape&&(o.labelShape=this.drawLabelShape(t,e,n)),i.labelBackgroundShape&&(o.labelBackgroundShape=this.drawLabelBackgroundShape(t,e,n)),i.iconShape&&(o.iconShape=this.drawIconShape(t,e,n)),i.badgeShapes&&(r=this.drawBadgeShapes(t,e,n,r),o=Object.assign(Object.assign({},o),r)),o=i.otherShapes&&this.drawOtherShapes?Object.assign(Object.assign({},o),this.drawOtherShapes(t,e,n)):o}drawKeyShape(t,e,n,r){return this.upsertShape("sphere","keyShape",this.mergedStyles.keyShape,e)}}},edges:{"line-edge":class extends class{constructor(t){this.defaultStyles={},this.zoomCache={hiddenShape:{},balanceRatio:1,zoom:1,zoomLevel:0,levelShapes:{},wordWrapWidth:50,animateConfig:Bv.zoom,firstRender:!0},this.onZoom=(e,t)=>{var n,r,i;if(this.balanceShapeSize(e,t),!this.lodStrategy)return;var o=this.lodStrategy["levels"];const{levelShapes:a,hiddenShape:s,animateConfig:l,firstRender:u=!0,zoomLevel:c}=this.zoomCache;var o=xS(o,t),h=Object.keys(a).map(Number),d=Math.max(...h),f=Math.min(...h);if(o<c)if(u)for(let t=o+1;t<=d;t++)null!=(n=a[String(t)])&&n.forEach(t=>{return null==(t=e[t])?void 0:t.hide()});else for(let t=o+1;t<=d;t++)null!=(r=a[String(t)])&&r.forEach(t=>zv(t,e[t],s,l));else if(c<o)for(let t=o;t>=f;t--)null!=(i=a[String(t)])&&i.forEach(t=>jv(t,e[t],this.mergedStyles[t]||this.mergedStyles[t.replace("Background","")],s,l));this.zoomCache.zoom=t,this.zoomCache.zoomLevel=o,this.zoomCache.firstRender=!1};var{themeStyles:t,lodStrategy:e,zoom:n}=t;t&&(this.themeStyles=t),this.lodStrategy=e,this.boundsCache={},this.zoomCache.zoom=n,this.zoomCache.balanceRatio=1/n,this.zoomCache.animateConfig=Object.assign(Object.assign({},Bv.zoom),null==e?void 0:e.animateCfg)}mergeStyles(t){this.mergedStyles=this.getMergedStyles(t)}getMergedStyles(t){const n=t["data"],r={};Object.keys(n).forEach(e=>{Rv.includes(e)?r[e]=n[e]:e===Nv&&Object.keys(n[e]).forEach(t=>r[t]=n[e][t])});var t=ty([this.themeStyles,this.defaultStyles,r]),e=null==(e=t.labelBackgroundShape)?void 0:e.padding;return e&&(t.labelBackgroundShape.padding=Jv(e,Cv)),t}updateCache(n){["labelShape","labelBackgroundShape"].forEach(t=>{var e=n[t];null!=e&&e.getAttribute(Kv)&&(this.boundsCache[t+"Geometry"]=e.getGeometryBounds(),this.boundsCache[t+"Transform"]=e.style.transform,e.setAttribute(Kv,!1))});const{levelShapes:r,zoom:t}=this.zoomCache;Object.keys(n).forEach(t=>{var e=n[t].attributes["lod"];void 0!==e&&(r[e]=r[e]||[],r[e].push(t))});var{maxWidth:e="60%"}=this.mergedStyles.labelShape||{};this.zoomCache.wordWrapWidth=ES([this.sourcePoint,this.targetPoint],e,1),this.zoomCache.zoom=1,this.zoomCache.zoomLevel=0,1!==t&&this.onZoom(n,t)}afterDraw(t,e,n){return{}}drawLabelShape(t,e,n,r){var i=e["keyShape"],o=this.mergedStyles["labelShape"],{position:a,offsetX:s,offsetY:l,autoRotate:u=!0,maxWidth:c}=o,o=I(o,["position","offsetX","offsetY","autoRotate","maxWidth"]),h={textAlign:"center",offsetX:0,offsetY:0,pointRatio:[.5,.501]};switch(Fu(a)&&(h.pointRatio=[a,a+.01]),a){case"start":h.pointRatio=[0,.01],h.textAlign="left",h.offsetX=4;break;case"end":h.pointRatio=[.99,1],h.textAlign="right",h.offsetX=-4}var d=i.getPoint(h.pointRatio[0]);let f={x:d.x,y:d.y},p=!1;u&&(u=i.getPoint(h.pointRatio[1]),i=Math.atan((d.y-u.y)/(d.x-u.x)),(p=u.x<d.x)&&("start"===a?(h.textAlign="right",h.offsetX=-4):"end"===a&&(h.textAlign="left",h.offsetX=4)),u=void 0===l?h.offsetY:l,l={x:d.x+(a=void 0===s?h.offsetX:s)*Math.cos(i),y:d.y+a*Math.sin(i)},f={x:l.x+u*Math.cos(Math.PI-i),y:l.y+u*Math.sin(Math.PI-i),transform:`rotate(${i/Math.PI*180})`}),this.labelPosition=Object.assign(Object.assign({},f),{isRevert:p});s=ES([this.sourcePoint,this.targetPoint],c,this.zoomCache.zoom),d=Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultStyles.labelShape),{textAlign:h.textAlign,wordWrapWidth:s}),f),o);return this.upsertShape("text","labelShape",d,e,t)}drawLabelBackgroundShape(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p=e["labelShape"];if(p&&t.data.labelShape)return{labelBackgroundShape:f,labelShape:i}=this.mergedStyles,p=this.boundsCache.labelShapeGeometry||p.getGeometryBounds(),{x:o,y:a,transform:s,isRevert:l}=this.labelPosition,u=f["padding"],f=I(f,["padding"]),{balanceRatio:c=1}=this.zoomCache,h=p.max[0]-p.min[0],d=p.max[1]-p.min[1],f=Object.assign(Object.assign({fill:"#fff"},f),{x:p.min[0]-u[3]+o,y:p.min[1]-u[0]/c+a,width:h+u[1]+u[3],height:d+(u[0]+u[2])/c,transform:s}),"start"===i.position?f.transformOrigin=l?f.width-u[1]+" "+f.height/2:u[3]+" "+f.height/2:"end"===i.position?f.transformOrigin=l?u[3]+" "+f.height/2:f.width-u[1]+" "+f.height/2:f.transformOrigin=h/2+u[3]+" "+(d/2+u[0]),this.upsertShape("rect","labelBackgroundShape",f,e,t)}drawIconShape(t,e,n,r){var i,o,a,s,{labelShape:l,labelBackgroundShape:u,keyShape:c}=e,{iconShape:h,labelShape:d}=this.mergedStyles,{width:f,height:p,fontSize:g,text:m,offsetX:v=0,offsetY:y=0}=h,f=f||g,p=p||g,g=m?"text":"image";return"text"==g?(h.textAlign="left",h.textBaseline="top",h.fontSize=f):(h.width=f,h.height=p),d?(m=u||l,{min:d,max:u,halfExtents:i}=this.boundsCache.labelBackgroundShapeGeometry||this.boundsCache.labelShapeGeometry||m.getGeometryBounds(),o=u[1]-d[1],u=u[0]-d[0],{x:m,y:a,transform:s}=m.attributes,l=l.attributes["textAlign"],h.x=d[0]-f+4+m+v,h.y=d[1]+(o-p)/2+a+y,s&&(h.transform=s,h.transformOrigin="right"===l?u/2-f/2+4+i[0]-v+" "+(p/2-y):"left"===l?f+4-v+" "+(p/2-y):(f+u)/2-v+" "+(p/2-y))):(m=c.getPoint(.5),h.x=m.x+v,h.y=m.y+y),this.upsertShape(g,"iconShape",h,e,t)}drawHaloShape(t,e,n,r){var i,o=e["keyShape"],a=this.mergedStyles["haloShape"];if(!1!==a.visible)return{nodeName:o,attributes:i}=o,this.upsertShape(o,"haloShape",Object.assign(Object.assign(Object.assign({},i),{stroke:i.stroke}),a),e,t)}balanceShapeSize(t,e){var{labelShape:t,labelBackgroundShape:n}=t,r=1/e||1,i=(this.zoomCache.balanceRatio=r,this.mergedStyles)["labelShape"],{position:i="bottom"}=i;t&&(t.style.transformOrigin="bottom"===i?"0":"",i=this.boundsCache.labelShapeTransform,t.style.transform=i+` scale(${r}, ${r})`,i=this.zoomCache.wordWrapWidth*e,t.style.wordWrapWidth=i,n)&&(e=this.boundsCache.labelBackgroundShapeTransform,n.style.transform=e+` scale(${r}, ${r})`)}setSourcePoint(t){this.sourcePoint=t}setTargetPoint(t){this.targetPoint=t}upsertShape(t,e,n,r,i){return Zv(t,e,n,r,i)}}{constructor(t){super(t),this.type="line-edge",this.defaultStyles={keyShape:{x1:0,y1:0,z1:0,x2:0,y2:0,z2:0,isBillboard:!0}}}draw(t,e,n,r,i,o){var{data:a={}}=t,s={keyShape:void 0};return s.keyShape=this.drawKeyShape(t,e,n,r,i),a.haloShape&&(s.haloShape=this.drawHaloShape(t,r,i)),a.labelShape&&(s.labelShape=this.drawLabelShape(t,r,i)),a.labelBackgroundShape&&(s.labelBackgroundShape=this.drawLabelBackgroundShape(t,r,i)),a.iconShape&&(s.iconShape=this.drawIconShape(t,r,i)),s}drawKeyShape(t,e,n,r,i,o){var a=this.mergedStyles["keyShape"];return this.upsertShape("line","keyShape",Object.assign(Object.assign({},a),{x1:e.x,y1:e.y,z1:e.z,x2:n.x,y2:n.y,z2:n.z}),r,t)}}},combos:{}};var vA,yA;const EA={rectSelector:(e,t,n)=>{var[t,r]=t;const i=Math.min(t.x,r.x),o=Math.max(t.x,r.x),a=Math.min(t.y,r.y),s=Math.max(t.y,r.y),l=[],u=[];let c=[];return n.includes("node")&&e.getAllNodesData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Pw(e,t,i,o,a,s)&&l.push(t)}),n.includes("combo")&&e.getAllCombosData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Pw(e,t,i,o,a,s)&&u.push(t)}),n.includes("edge")&&(c=iS(e,l.concat(u))),{nodes:l,edges:c,combos:u}},lassoSelector:(e,t,n)=>{const r=t.map(t=>[t.x,t.y]),i=[];let o=[];const a=[];return n.includes("node")&&e.getAllNodesData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Mw(e,t,r)&&i.push(t)}),n.includes("combo")&&e.getAllCombosData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Mw(e,t,r)&&a.push(t)}),n.includes("edge")&&(o=iS(e,i.concat(a))),{nodes:i,edges:o,combos:a}}},_A={useLib:{transforms:{},themes:{},layouts:{},behaviors:{},plugins:{},nodes:{},edges:{},combos:{}}};const bA=(t,e,n)=>{return"function"==typeof t?t:(t="string"==typeof t?t:t.type,null==(e=e[n+"s"])?void 0:e[t])};class xA{constructor(t){this.extensions=[],this.graph=t,this.tap()}findData(t,e){const n=this["graphCore"];var r=typeof e,i=Ou(e);if("string"==r||"number"==r||i){var o=i?e:[e];switch(t){case"node":return o.map(t=>n.hasNode(t)?n.getNode(t):void 0);case"edge":return o.map(t=>n.hasEdge(t)?n.getEdge(t):void 0);case"combo":return}}else if("function"==r)return("node"===t?n.getAllNodes:n.getAllEdges)().filter(t=>e(t))}findAllData(t){if(!this.graphCore)return[];switch(t){case"node":return this.graphCore.getAllNodes();case"edge":return this.graphCore.getAllEdges();default:return[]}}findRelatedEdgeIds(t,e="both"){return this.graphCore.getRelatedEdges(t,e)}findNeighborNodeIds(t,e="both"){return"in"===e?this.graphCore.getAncestors(t):"out"===e?this.graphCore.getSuccessors(t):this.graphCore.getNeighbors(t)}tap(){this.extensions=this.getExtensions(),this.graph.hooks.datachange.tap(this.onDataChange.bind(this))}getExtensions(){var{transform:t=[]}=this.graph.getSpecification();return t.map(t=>({config:t,func:bA(t,_A.useLib,"transform")})).filter(t=>!!t.func)}onDataChange(t){const{data:e,type:n}=t;var t=()=>{switch(n){case"remove":this.removeData(e);break;case"update":this.updateData(e);break;default:this.changeData(e,n)}},r=this["userGraphCore"];r?r.batch(t):t()}changeData(t,e){const n=this["userGraphCore"];if("replace"===e){this.userGraphCore=new fy(Object.assign(Object.assign({},t),{onChanged:t=>this.updateGraphCore(t)}));var r=this.transformData()["data"];this.graphCore=new fy(Object.assign({},r))}else{var r=n.getAllNodes(),{nodes:t,edges:i}=t;if(r.length){if("mergeReplace"===e){const o=t.map(t=>t.id);r.forEach(t=>{o.includes(t.id)||n.removeNode(t.id)})}t.forEach(t=>{n.hasNode(t.id)?n.mergeNodeData(t.id,t.data):n.addNode(t)})}else n.addNodes(t);r=n.getAllEdges();if(r.length){if("mergeReplace"===e){const a=i.map(t=>t.id);r.forEach(t=>{a.includes(t.id)||n.removeEdge(t.id)})}i.forEach(t=>{n.hasEdge(t.id)?n.mergeEdgeData(t.id,t.data):n.addEdge(t)})}else n.addEdges(i)}}removeData(t){var e=this["userGraphCore"],{nodes:t,edges:n}=t,r=e.getAllNodes(),i=e.getAllEdges();r.length&&t.length&&e.removeNodes(t.map(t=>t.id)),i.length&&n.length&&e.removeEdges(n.map(t=>t.id))}updateData(t){const a=this["userGraphCore"];var{nodes:t,edges:e}=t,n=a.getAllNodes(),r=a.getAllEdges();n.length&&t.forEach(t=>{var{id:e,data:n}=t;n&&(n=TA(a.getNode(e),t),a.mergeNodeData(e,n))}),r.length&&e.forEach(t=>{var e,n,r,i,o=a.getEdge(t.id);o&&({id:e,source:i,target:n,data:r}=t,i&&o.source!==i&&a.updateEdgeSource(e,i),n&&o.target!==n&&a.updateEdgeTarget(e,n),r)&&(i=TA(a.getEdge(e),t),a.mergeEdgeData(e,i))})}updateGraphCore(e){const u=this["graphCore"],{data:t,idMaps:n}=this.transformData(),{nodes:i,edges:c}=t,h=u.getAllNodes(),d=(t,e,n,r,i=[])=>{r?e.data&&u.updateNodeData(t,e.data):(i.includes("data")&&u.updateEdgeData(t,e.data),i.includes("source")&&u.updateEdgeSource(t,e.source),i.includes("target")&&u.updateEdgeTarget(t,e.target))};u.batch(()=>{if(null!==n&&void 0!==n&&n.length&&n.length===this.extensions.length){const o={},a={},s={},l=(i.concat(c).forEach(t=>{o[t.id]=SA(t.id,n),a[t.id]=t}),h.concat(u.getAllEdges()).forEach(t=>{s[t.id]=t}),{});var t=e["changes"];t.forEach(t=>{var{value:t,id:e,type:n}=t;["TreeStructureAttached","TreeStructureDetached","TreeStructureChanged"].includes(n)||(e=e||t.id,l[e]=l[e]||[],l[e].push(n.toLawerCase()))}),Object.keys(a).forEach(t=>{var e=o[t],n=a[t],r=s[t],i=u.hasNode(t);n&&!r?(i?u.addNode:u.addEdge)(n):!n&&r?(i?u.removeNode:u.removeEdge)(t):null!=e&&e.length?null!=(e=l[e[0]])&&e.length&&d(t,n,0,i):null!=(e=wA(n,r,i))&&e.length&&d(t,n,0,i,e)})}else{const r={};i.forEach(t=>r[t.id]={type:"node",model:t}),c.forEach(t=>r[t.id]={type:"edge",model:t}),h.forEach(t=>{var e=t["id"],n=(r[e]||{})["model"];n?null!=(t=wA(n,t,!0))&&t.length&&d(e,n,0,!0):u.removeNode(e),delete r[e]}),u.getAllEdges().forEach(t=>{var e=t["id"],n=(r[e]||{})["model"];n?null!=(t=wA(n,t,!1))&&t.length&&d(e,n,0,!1,t):u.removeEdge(e),delete r[e]}),Object.values(r).forEach(({type:t,model:e})=>{"node"===t?u.addNode(e):"edge"===t&&u.addEdge(e)})}})}transformData(){var t=this["userGraphCore"],t={nodes:t.getAllNodes(),edges:t.getAllEdges()};let n=Wu(t);const r=[];return this.extensions.forEach(({func:t,config:e})=>{t=t(n,e),n=t.data,e=t.idMap;e&&r.push(e)}),{data:n,idMaps:r}}}const SA=(t,e,n=e.length-1)=>{let r=[];return null!=(t=e[n][t])&&t.forEach(t=>{0===n?r.push(t):r=r.concat(SA(t,e,n-1))}),r},wA=(e,n,t)=>{var r=[];if(t||(e.source!==n.source&&r.push("source"),e.target!==n.target&&r.push("target")),e.data){var i=Object.keys(e.data),t=Object.keys(n.data);if(0!==t.length||t.length!==i.length){if(t.length!==i.length)return r.concat("data");for(let t=0;t<i.length;t++){var o=i[t],a=e.data[o],o=n.data[o],s=Iu(a),l=Iu(o);if(s!==l)return r.concat("data");if(s&&l){if(JSON.stringify(a)!==JSON.stringify(o))return r.concat("data")}else if(a!==o)return r.concat("data")}}}return r},TA=(t,e)=>{const n=e["data"],r=t["data"],i={};return Object.keys(n).forEach(t=>{!Ou(r[t])&&!Ou(n[t])&&"object"==typeof r[t]&&"object"==typeof n[t]?i[t]=Object.assign(Object.assign({},r[t]),n[t]):i[t]=n[t]}),i},AA=((e=vA=vA||{}).pointerover="pointerover",e.pointerenter="pointerenter",e.pointerdown="pointerdown",e.pointermove="pointermove",e.pointerup="pointerup",e.pointerleave="pointerleave",e.click="click",e.wheel="wheel",(l=yA=yA||{}).focus="focus",l.blur="blur",l.keyup="keyup",l.keydown="keydown",l.keypress="keypress",t=>{var e;if("document"===t.nodeName)return{itemType:"canvas",itemId:void 0,groupElement:t};let n=t;for(;n&&(null==(e=n.getAttribute)||!e.call(n,"data-item-type"));)n=n.parentElement;return n?{itemType:n.getAttribute("data-item-type"),itemId:n.getAttribute("data-item-id"),groupElement:n}:null});class MA{constructor(t){this.behaviorMap=new Map,this.listenersMap={},this.tap=()=>{this.graph.hooks.init.tap(()=>this.onModeChange({mode:"default"})),this.onModeChange({mode:"default"}),this.graph.hooks.modechange.tap(this.onModeChange),this.graph.hooks.behaviorchange.tap(this.onBehaviorChange)},this.validateMode=t=>{var e;return"default"===t||(e=this.graph.getSpecification().modes||{},Object.keys(e).includes(t))},this.initBehavior=t=>{var e="string"==typeof t?t:t.key||t.type;if(this.behaviorMap.has(e))console.error(`G6: Failed to add behavior with key or type "${e}"! It was already added.`);else try{var n=new(bA(t,_A.useLib,"behavior"))("string"==typeof t?{}:t);return n.graph=this.graph,n&&this.behaviorMap.set(e,n),n}catch(t){return console.error(`G6: Failed to initialize behavior with key or type "${e}"!`,t),null}},this.destroyBehavior=(e,t)=>{try{t.destroy()}catch(t){console.error(`G6: Failed to destroy behavior with key or type "${e}"!`,t)}},this.addListeners=(o,a)=>{const s=a.getEvents();this.listenersMap[o]={},Object.keys(s).forEach(t=>{e=o,n=t,r=s[t].bind(a);var e,n,r,i=t=>{try{r(t)}catch(t){throw console.error(`G6: Error occurred in "${n}" phase of the behavior "${e}"!`),t}};this.graph.on(t,i),this.listenersMap[o][t]=i})},this.removeListeners=n=>{Object.keys(this.listenersMap[n]||{}).forEach(t=>{var e=this.listenersMap[n][t];this.graph.off(t,e)})},this.onModeChange=t=>{var e,t=t["mode"];this.mode!==t&&(this.validateMode(t)||console.warn(`G6: Mode "${t}" was not specified in current graph.`),this.mode=t,this.behaviorMap.forEach((t,e)=>{this.removeListeners(e),this.destroyBehavior(e,t)}),this.behaviorMap.clear(),((null==(e=this.graph.getSpecification().modes)?void 0:e[t])||[]).forEach(t=>{this.initBehavior(t)}),this.listenersMap={},this.behaviorMap.forEach((t,e)=>{this.addListeners(e,t)}))},this.onBehaviorChange=t=>{const{action:e,modes:n,behaviors:r}=t;n.forEach(t=>{t===this.mode&&("add"===e?r.forEach(t=>{var e="string"==typeof t?t:t.key||t.type,t=this.initBehavior(t);t&&this.addListeners(e,t)}):"remove"===e?r.forEach(t=>{var t="string"==typeof t?t:t.key||t.type,e=this.behaviorMap.get(t);e&&(this.removeListeners(t),this.destroyBehavior(t,e))}):"update"===e&&r.forEach(t=>{var e="string"==typeof t?t:t.key||t.type,e=this.behaviorMap.get(e);e&&e.updateConfig(t)}))})},this.initEvents=()=>{Object.values(vA).forEach(t=>{this.graph.canvas.document.addEventListener(t,this.handleCanvasEvent)}),Object.values(yA).forEach(t=>{this.graph.canvas.getContextService().getDomElement().addEventListener(t,this.handleDOMEvent)})},this.handleCanvasEvent=t=>{var e,n=AA(t.target);n&&({itemType:n,itemId:e}=n,"click"===(e=Object.assign(Object.assign({},t),{itemType:n,itemId:e,gEvent:t,currentTarget:this.graph})).type&&2===e.detail&&this.handleCanvasEvent(Object.assign(Object.assign({},t),{type:"dblclick"})),"canvas"===e.itemType?("pointermove"===e.type&&this.handlePointerMove(e),this.graph.emit("canvas:"+t.type,e),this.graph.emit(""+t.type,e)):"node"!==n&&"edge"!==n||("pointermove"!==e.type&&"pointerleave"!==e.type||this.handlePointerMove(e),this.graph.emit(n+":"+t.type,e),this.graph.emit(""+t.type,e)))},this.handlePointerMove=t=>{var e,n=this.prevItemInfo,r=AA(t.target);(null==n?void 0:n.itemId)!==(null==r?void 0:r.itemId)&&(n&&(e=n.itemType,this.graph.emit(e+":pointerleave",Object.assign(Object.assign({},t),{itemId:n.itemId,itemType:n.itemType,type:"pointerleave",target:n.groupElement}))),r)&&(e=r.itemType,this.graph.emit(e+":pointerenter",Object.assign(Object.assign({},t),{type:"pointerenter",target:r.groupElement}))),this.prevItemInfo=r},this.handleDOMEvent=t=>{this.graph.emit(t.type,t)},this.graph=t,this.initEvents(),this.tap()}}const RA=t=>Boolean(t.fields&&t.formatter),NA={node:t=>{var{id:t,data:e}=t,{color:n,label:r,icon:i,badges:o,anchorPoints:a}=e,e=Object.assign(Object.assign({},e),{keyShape:{}});return n&&(e.keyShape.fill=n),r&&(e.labelShape={text:r}),i&&(e.iconShape=i),o&&(e.badgeShapes=o),a&&(e.anchorShapes=a.map(t=>({position:t}))),{id:t,data:e}},edge:t=>{var{id:t,source:e,target:n,data:r}=t,{color:i,label:o,icon:a,badge:s}=r,r=Object.assign(Object.assign({},r),{keyShape:{}});return i&&(r.keyShape.stroke=i),o&&(r.labelShape={text:o}),a&&(r.iconShape=a),s&&(r.badgeShape=s),{id:t,source:e,target:n,data:r}},combo:t=>t};class CA{constructor(t){this.destroyed=!1,this.visible=!0,this.states=[],this.shapeMap={keyShape:void 0},this.afterDrawShapeMap={},this.transient=!1,this.stateDirtyMap={},this.cacheStateStyles={},this.cacheHiddenShape={},this.animateFrameListener=Hu(t=>{var e;null!=(e=this.onframe)&&e.call(this,t)},16,{trailing:!0,leading:!0}),this.device=t.device,this.onframe=t.onframe}init(t){var{model:e,containerGroup:n,mapper:r,stateMapper:i,renderExtensions:o,zoom:a=1,theme:s={}}=t;this.group=new fs,this.group.setAttribute("data-item-type",this.type),this.group.setAttribute("data-item-id",t.model.id),n.appendChild(this.group),this.model=e,this.mapper=r,this.zoom=a,this.stateMapper=i,this.displayModel=this.getDisplayModelAndChanges(e).model,this.renderExtensions=o;const{type:l="node"===this.type?"circle-node":"line-edge",lodStrategy:u}=this.displayModel.data;t=o.find(t=>t.type===l),this.themeStyles=s.styles,n=u?bS(u):s.lodStrategy;this.renderExt=new t({themeStyles:this.themeStyles.default,lodStrategy:n,device:this.device,zoom:this.zoom})}draw(t,e,n,r=0){var i,o;this.afterDrawShapeMap=(null==(o=(i=this.renderExt).afterDraw)?void 0:o.call(i,t,Object.assign(Object.assign({},this.shapeMap),this.afterDrawShapeMap)))||{},this.shapeMap=Qv(this.shapeMap,this.afterDrawShapeMap,this.group,!1,t=>!Rv.includes(t)||(console.warn(`Shape with id ${t} is reserved and should be returned in draw function, if the shape with ${t} returned by afterDraw is a new one, it will not be added to the group.`),!1)),this.changedStates=[]}update(t,e,n,r,i,o){this.model=t,r&&(this.themeStyles=r.styles);var{model:t,typeChange:n}=this.getDisplayModelAndChanges(this.model,e,n);if(this.displayModel=t,this.lodStrategy=t.data.lodStrategy?bS(t.data.lodStrategy):(null==r?void 0:r.lodStrategy)||this.lodStrategy,i)this.updatePosition(t,e,o);else{if(n){Object.values(this.shapeMap).forEach(t=>t.destroy()),this.shapeMap={keyShape:void 0};const{type:a="node"===this.type?"circle-node":"line-edge"}=t.data;r=this.renderExtensions.find(t=>t.type===a);this.renderExt=new r({themeStyles:this.themeStyles.default,lodStrategy:this.lodStrategy,device:this.device,zoom:this.zoom})}else this.renderExt.themeStyles=this.themeStyles.default,this.renderExt.lodStrategy=this.lodStrategy;null!=(i=this.states)&&i.length?this.drawWithStates(this.states,o):this.draw(this.displayModel,e,void 0,o),this.stateDirtyMap={},this.states.forEach(({name:t})=>this.stateDirtyMap[t]=!0)}}updatePosition(t,e,n){}getDisplayModelAndChanges(a,e,t){const{mapper:s,type:n}=this;var r=NA[n],i=a["data"],o=I(a,["data"]),{current:e=i}=e||{};if(!s){this.displayModel=r(a);let t=!1;return e&&(t=Boolean(e.type)),{model:this.displayModel,typeChange:t}}if(Cu(s))return{model:Object.assign(Object.assign({},r(a)),s(a))};const l=t?void 0:Object.keys(e).concat(Object.keys(o));let u=!1;i=I(a,["data"]);const c=r(a).data;return Object.keys(s).forEach(n=>{let r=s[n];var t=Rv.includes(n),e=Rv.includes(n)||n===Nv;if(e&&RA(r)||!e)if(c.hasOwnProperty(n))"type"!==n||l&&!l.includes("type")||(u=!0);else{var{changed:i,value:o}=PA({innerModel:a,mapper:s,fieldName:n,dataChangedFields:l});if(e){if(!o)return;r=o}else c[n]=o;i&&"type"===n&&(u=!0)}t?(c[n]=c[n]||{},OA({innerModel:a,mapper:r,dataChangedFields:l,shapeConfig:c[n]})):n===Nv&&(c[n]=c[n]||{},Object.keys(r).forEach(t=>{var e;null!=(e=c[n])&&e.hasOwnProperty(t)||(c[n][t]=c[n][t]||{},e=r[t],OA({innerModel:a,mapper:e,dataChangedFields:l,shapeConfig:c[n][t]}))}))}),{model:Object.assign(Object.assign({},i),{data:c}),typeChange:u}}getID(){return this.model.id}getType(){return this.type}show(t=!0){this.stopAnimations();var{animates:e={}}=this.displayModel.data;if(t&&null!=(t=e.show)&&t.length){const i={},o=(Object.values(e.show).forEach(t=>{var{shapeId:e="group"}=t;i[e]=(i[e]||[]).concat(t.fields)}),{});Object.keys(this.shapeMap).forEach(e=>{const n=this.shapeMap[e];if(!this.cacheHiddenShape[e]){if(i[e]){o[e]=o[e]||{};const r=kv(n);i[e].forEach(t=>{r.hasOwnProperty(t)&&(o[e][t]=n.style[t],n.style[t]=r[t])})}n.show()}}),i.group&&i.group.forEach(t=>{t="size"===t?"transform":t;Dv[0].hasOwnProperty(t)&&(this.group.style[t]=Dv[0][t])}),this.animations=this.runWithAnimates(e,"show",o)}else Object.keys(this.shapeMap).forEach(t=>{var e=this.shapeMap[t];this.cacheHiddenShape[t]||e.show()});this.visible=!0}hide(t=!0){this.stopAnimations();var e=()=>{Object.keys(this.shapeMap).forEach(t=>{var e=this.shapeMap[t];this.visible&&!e.isVisible()&&(this.cacheHiddenShape[t]=!0),e.hide()})},{animates:n={}}=this.displayModel.data;t&&null!=(t=n.hide)&&t.length?this.animations=this.runWithAnimates(n,"hide",void 0,e):e(),this.visible=!1}isVisible(){return this.visible}toFront(){this.group.toFront()}toBack(){this.group.toBack()}hasState(e){var t=this.states.find(t=>t.name===e);return(null==t?void 0:t.value)||!1}setState(e,t){var n=Wu(this.states),r=this.states.find(t=>t.name===e);t?r?r.value=t:this.states.push({name:e,value:t}):(r=this.states.indexOf(r),this.states.splice(r,1)),this.renderExt.constructor.prototype.hasOwnProperty("setState")?this.renderExt.setState(e,t,this.shapeMap):(this.changedStates=[e],this.drawWithStates(n))}clearStates(e){var t=Wu(this.states);const n=[];let r=[];e?this.states.filter(t=>{(e.includes(t.name)?r:n).push(t)}):r=this.states.map(({name:t})=>({name:t,value:!1})),this.states=n,this.changedStates=r.map(t=>t.name),this.renderExt.constructor.prototype.hasOwnProperty("setState")?r.forEach(({name:t,value:e})=>this.renderExt.setState(t,e,this.shapeMap)):this.drawWithStates(t)}getStates(){return this.states}runWithAnimates(t,e,n,r=()=>{}){let i={};return n?i=n:Object.keys(this.shapeMap).forEach(t=>{i[t]=kv(this.shapeMap[t])}),Vv(t,i,this.shapeMap,this.group,e,[],()=>{},r)}drawWithStates(t,e){const n=this.themeStyles,o=I(n,["default"]),a=this.displayModel["data"];let s={};this.states.forEach(({name:t,value:e})=>{var n;const r=this.cacheStateStyles[t]||{},i=null==(n=this.stateMapper)?void 0:n[t];(i||null!==o&&void 0!==o&&o[t])&&(i&&e&&(!this.stateDirtyMap.hasOwnProperty(t)||this.stateDirtyMap[t])&&(this.stateDirtyMap[t]=!1,Object.keys(i).forEach(e=>{r[e]=Object.assign({},a[e]),Rv.includes(e)?OA({innerModel:this.model,mapper:i[e],dataChangedFields:void 0,shapeConfig:r[e]}):e===Nv&&i[e]&&Object.keys(i[e]).forEach(t=>{r[e]=r[e]||{},r[e][t]=r[e][t]||{},OA({innerModel:this.model,mapper:i[e][t],dataChangedFields:void 0,shapeConfig:r[e][t]})})})),this.cacheStateStyles[t]=r,n=ty([o[t],r]),s=ty([s,n]))}),this.draw(Object.assign(Object.assign({},this.displayModel),{data:ty([a,s])}),void 0,{previous:t,current:this.states},e)}getKeyBBox(){var t=this.shapeMap["keyShape"];return(null==t?void 0:t.getRenderBounds())||{center:[0,0,0]}}getLocalKeyBBox(){var t=this.shapeMap["keyShape"];return(null==t?void 0:t.getLocalBounds())||{center:[0,0,0]}}getBBox(){return this.group.getRenderBounds()}stopAnimations(){var t;null!=(t=this.animations)&&t.forEach(t=>{var e=t.effect.getTiming();"running"===t.playState&&(t.currentTime=Number(e.duration)+Number(e.delay||0),t.cancel())}),this.animations=[]}updateZoom(t){this.zoom=t,this.renderExt.onZoom(this.shapeMap,t)}destroy(){var t,e=()=>{this.group.destroy(),this.model=null,this.displayModel=null,this.destroyed=!0},n=(this.stopAnimations(),this.displayModel.data)["animates"];null!=(t=null==n?void 0:n.buildOut)&&t.length&&!this.transient?this.animations=this.runWithAnimates(n,"buildOut",void 0,e):e()}}const PA=({innerModel:t,fieldName:e,mapper:n,dataChangedFields:r})=>{var i,n=n[e]||"";return RA(n)?({fields:e,formatter:i}=n,!r||Pv(r,e)?{changed:!0,value:i(t)||""}:{changed:!1}):{changed:!0,value:n}},OA=({innerModel:n,mapper:r,dataChangedFields:i,shapeConfig:o})=>{Object.keys(r).forEach(t=>{var e=PA({innerModel:n,mapper:r,fieldName:t,dataChangedFields:i})["value"];o[t]=e})};class IA extends CA{constructor(t){super(t),this.type="node",this.init(t),this.draw(this.displayModel,void 0,void 0,t.onfinish)}draw(t,e,n,r=()=>{}){const{group:i,renderExt:o,shapeMap:a,model:s}=this;o.mergeStyles(t),this.group.setAttribute("data-item-type","node"),this.group.setAttribute("data-item-id",s.id);var l=!(null!=(l=this.shapeMap)&&l.keyShape),u=o.draw(t,this.shapeMap,e,n),{animates:u,disableAnimate:c,x:h=0,y:d=0,z:f=0}=(this.shapeMap=Qv(a,u,i),t.data),{haloShape:h,labelBackgroundShape:d}=(l?i.setLocalPosition(h,d,f):this.updatePosition(t,e,r),this.shapeMap);null!=h&&h.toBack(),null!=d&&d.toBack(),super.draw(t,e,n,r),this.anchorPointsCache=void 0,o.updateCache(this.shapeMap),l&&o.onZoom(this.shapeMap,this.zoom),this.stopAnimations(),!c&&u&&(f=(t=>{if(!t.update)return t;const o=[];return t.update.forEach(e=>{var{shapeId:n,fields:r}=e;if((n=n)&&"group"!==n)o.push(e);else{var i,n=r;let t=!1;r.includes("x")&&(i=n.indexOf("x"),n.splice(i,1),t=!0),r.includes("y")&&(i=n.indexOf("y"),n.splice(i,1),t=!0),t?0!==n.length&&o.push(Object.assign(Object.assign({},e),{fields:n})):o.push(e)}}),Object.assign(Object.assign({},t),{update:o})})(u),this.animations=Vv(f,o.mergedStyles,this.shapeMap,i,l?"buildIn":"update",this.changedStates,this.animateFrameListener,()=>r(s.id)))}update(t,e,n,r,i,o){super.update(t,e,n,r,i,o)}updatePosition(t,e,n=()=>{}){var r=this["group"],{x:i=0,y:o=0,z:a=0,animates:s,disableAnimate:l}=t.data;if(!l&&null!=s&&s.update){l=s.update.filter(({shapeId:t,fields:e})=>(!t||"group"===t)&&(e.includes("x")||e.includes("y")));if(l.length)return void Vv({update:l},{group:{x:i,y:o,z:a}},this.shapeMap,r,"update",[],this.animateFrameListener,()=>n(t.id))}r.setLocalPosition(i,o,a)}clone(t,e,n){var r,i;if(e)return e=this.shapeMap.keyShape.cloneNode(),{x:o,y:r}=this.group.attributes,(i=new fs).setPosition([o,r]),i.appendChild(e),t.appendChild(i),i;var o=Wu(this.model);o.data.disableAnimate=n;const a=new IA({model:o,renderExtensions:this.renderExtensions,containerGroup:t,mapper:this.mapper,stateMapper:this.stateMapper,zoom:this.zoom,theme:{styles:this.themeStyles,lodStrategy:this.lodStrategy}});return Object.keys(this.shapeMap).forEach(t=>{this.shapeMap[t].isVisible()||a.shapeMap[t].hide()}),a}getAnchorPoint(t){var e=this.shapeMap["keyShape"],{x:e,y:n,z:r}=(e.nodeName,this.model.data);return{x:e,y:n,z:r}}}class LA extends CA{constructor(t){super(t),this.destroyed=!1,this.type="edge",this.forceUpdate=Hu(()=>{this.destroyed||this.draw(this.displayModel)},16,{leading:!0,trailing:!0}),this.type="edge",this.init(t);var{sourceItem:t,targetItem:e}=t;this.sourceItem=t,this.targetItem=e,this.draw(this.displayModel)}draw(t,e,n,r=()=>{}){var{x:i,y:o,z:a}=this.sourceItem.model.data,{x:s,y:l,z:u}=this.targetItem.model.data,s=this.sourceItem.getAnchorPoint({x:s,y:l,z:u}),l=this.targetItem.getAnchorPoint({x:i,y:o,z:a}),i=(this.renderExt.mergeStyles(t),!(null!=(u=this.shapeMap)&&u.keyShape)),o=(this.renderExt.setSourcePoint(s),this.renderExt.setTargetPoint(l),this.renderExt.draw(t,s,l,this.shapeMap,e,n)),{animates:a,disableAnimate:u}=(this.shapeMap=Qv(this.shapeMap,o,this.group),t.data),s=Object.assign({},a),l=this.renderExt.mergedStyles,{haloShape:o,labelShape:a}=this.shapeMap,o=(null!=o&&o.toBack(),null!=a&&a.toFront(),super.draw(t,e,n),this.renderExt.updateCache(this.shapeMap),i&&this.renderExt.onZoom(this.shapeMap,this.zoom),this.stopAnimations(),i?"buildIn":"update");!u&&null!=(a=s[o])&&a.length&&(this.animations=Vv(s,l,this.shapeMap,this.group,i?"buildIn":"update",this.changedStates,this.animateFrameListener,()=>r(t.id)))}updateEnd(t,e){"source"===t?this.sourceItem=e:"target"===t&&(this.targetItem=e),this.draw(this.displayModel)}clone(t,e,n,r,i){var o;if(r)return r=this.shapeMap.keyShape.cloneNode(),(o=new fs).appendChild(r),t.appendChild(o),o;r=Wu(this.model);r.data.disableAnimate=i;const a=new LA({model:r,renderExtensions:this.renderExtensions,sourceItem:e,targetItem:n,containerGroup:t,mapper:this.mapper,stateMapper:this.stateMapper,zoom:this.zoom,theme:{styles:this.themeStyles,lodStrategy:this.lodStrategy}});return Object.keys(this.shapeMap).forEach(t=>{this.shapeMap[t].isVisible()||a.shapeMap[t].hide()}),a}}class kA{constructor(t){this.nodeExtensions=[],this.edgeExtensions=[],this.comboExtensions=[],this.itemMap={},this.nodeDataTypeSet=new Set,this.edgeDataTypeSet=new Set,this.transientObjectMap={},this.transientItemMap={},this.onViewportChange=Vu(({transform:t})=>{t=t.zoom;if(t){const e=this.graph.getZoom();Object.values(this.itemMap).forEach(t=>t.updateZoom(e)),this.zoom=e}},500,!1),this.onThemeChange=({theme:t})=>{if(t){const{nodeDataTypeSet:o,edgeDataTypeSet:a}=this,{node:s,edge:l}=t;Object.values(this.itemMap).forEach(t=>{var e=t.getType(),n="node"===e?s:l,e="node"===e?o:a,r=n["dataTypeField"];let i;r&&(i=t.model.data[r]);e=DA(e,r,i,n);t.update(t.model,void 0,!1,e)})}},this.onDestroy=()=>{Object.values(this.itemMap).forEach(t=>t.destroy())};var{node:t,edge:e,combo:n,nodeState:r,edgeState:i,comboState:o}=(this.graph=t).getSpecification();this.nodeMapper=t,this.edgeMapper=e,this.comboMapper=n,this.nodeStateMapper=r,this.edgeStateMapper=i,this.comboStateMapper=o,this.tap()}tap(){var t=this.getExtensions();this.nodeExtensions=t.node,this.edgeExtensions=t.edge,this.comboExtensions=t.combo,this.graph.hooks.render.tap(this.onRender.bind(this)),this.graph.hooks.itemchange.tap(this.onChange.bind(this)),this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this)),this.graph.hooks.itemvisibilitychange.tap(this.onItemVisibilityChange.bind(this)),this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this)),this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this)),this.graph.hooks.themechange.tap(this.onThemeChange.bind(this)),this.graph.hooks.destroy.tap(this.onDestroy.bind(this))}getExtensions(){this.graph.getSpecification();var t=Object.keys(_A.useLib.nodes),e=Object.keys(_A.useLib.edges),n=Object.keys(_A.useLib.combos);return{node:t.map(t=>bA(t,_A.useLib,"node")).filter(Boolean),edge:e.map(t=>bA(t,_A.useLib,"edge")).filter(Boolean),combo:n.map(t=>bA(t,_A.useLib,"combo")).filter(Boolean)}}onRender(t){var{graphCore:t,theme:e={},transientCanvas:n}=t,r=this["graph"],i=(r.canvas.removeChildren(),new fs({id:"edge-group"})),o=new fs({id:"node-group"}),i=(r.canvas.appendChild(i),r.canvas.appendChild(o),this.nodeGroup=o,this.edgeGroup=i,n.removeChildren(),this.transientEdgeGroup=new fs({id:"edge-group"}),this.transientNodeGroup=new fs({id:"node-group"}),n.appendChild(this.transientEdgeGroup),n.appendChild(this.transientNodeGroup),"webgl-3d"===r.rendererType&&(o=new bv({style:{fill:"white",intensity:2*Math.PI}}),i=new Sv({style:{fill:"white",direction:[-1,0,1],intensity:.7*Math.PI}}),{width:n,height:o}=(r.canvas.appendChild(o),r.canvas.appendChild(i),r.canvas.getConfig()),r.canvas.getCamera().setPerspective(.1,5e4,45,n/o)),t.getAllNodes()),r=t.getAllEdges();this.renderNodes(i,e.node),this.renderEdges(r,e.edge)}onChange(t){const{changes:e,graphCore:s,theme:n={},action:l}=t,r={NodeRemoved:[],EdgeRemoved:[],NodeAdded:[],EdgeAdded:[],NodeDataUpdated:[],EdgeUpdated:[],EdgeDataUpdated:[]},u=(e.forEach(t=>{var e=t["type"];r[e].push(t)}),this)["itemMap"],{node:c={},edge:a={}}=(r.EdgeRemoved.concat(r.NodeRemoved).forEach(({value:t})=>{var t=t["id"],e=u[t];e&&(e.destroy(),delete u[t])}),n);if(r.NodeAdded.length&&this.renderNodes(r.NodeAdded.map(t=>t.value),c),r.EdgeAdded.length&&this.renderEdges(r.EdgeAdded.map(t=>t.value),a),r.NodeDataUpdated.length){const h={},d=(r.NodeDataUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n,oldValue:r}=t;h[t]=h[t]||{previous:{},current:{}},e?(h[t].previous[e]=r,h[t].current[e]=n):h[t]={isReplace:!0,previous:r,current:n}}),c)["dataTypeField"],f={},p=Hu(()=>{Object.keys(f).forEach(t=>{t=u[t];t&&!t.destroyed&&t.forceUpdate()})},16,{leading:!0,trailing:!0});Object.keys(h).forEach(t=>{var{isReplace:e,previous:n,current:r}=h[t];let i;d&&n[d]!==r[d]&&(i=DA(this.nodeDataTypeSet,d,r[d],c));const o=u[t];var a=s.getNode(t);o.onframe=p,o.update(a,{previous:n,current:r},e,i,"updateNodePosition"===l,()=>{o.onframe=void 0}),s.getRelatedEdges(t).forEach(t=>{f[t.id]=t})}),p()}if(r.EdgeDataUpdated.length){const g={},m=(r.EdgeDataUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n,oldValue:r}=t;g[t]=g[t]||{previous:{},current:{}},e?(g[t].previous[e]=r,g[t].current[e]=n):g[t]={isReplace:!0,previous:r,current:n}}),a)["dataTypeField"];Object.keys(g).forEach(t=>{var{isReplace:e,current:n,previous:r}=g[t];let i;r[m]!==n[m]&&(i=DA(this.edgeDataTypeSet,m,n[m],a));var o=u[t],t=s.getEdge(t);o.update(t,{current:n,previous:r},e,i)})}if(r.EdgeUpdated.length){const i={};r.EdgeUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n}=t;i[t]=i[t]||{},i[t][e]=n}),Object.keys(i).forEach(t=>{var{source:e,target:n}=i[t],t=u[t];void 0!==e&&t.updateEnd("source",this.itemMap[e]),void 0!==n&&t.updateEnd("target",this.itemMap[n])})}}onItemStateChange(t){const{ids:e,states:n,value:r}=t;e.forEach(t=>{const e=this.itemMap[t];e?n&&r?n.forEach(t=>e.setState(t,r)):e.clearStates(n):console.warn(`Fail to set state for item ${t}, which is not exist.`)})}onItemVisibilityChange(t){const{ids:e,value:n,animate:r=!0}=t;e.forEach(t=>{var e=this.itemMap[t];e?n?e.show(r):e.hide(r):console.warn(`Fail to set visibility for item ${t}, which is not exist.`)})}onTransientUpdate(t){var e=this["transientObjectMap"],{type:t,id:n,config:r={},canvas:i}=t,{style:r={},data:o={},capture:a,action:s,onlyDrawKeyShape:l}=r,u="node"===t||"edge"===t||"combo"===t;return"remove"===s?u?((s=this.transientItemMap[n])&&!s.destroyed&&s.destroy(),void delete this.transientItemMap[n]):((s=e[n])&&!s.destroyed&&s.destroy(),void delete e[n]):u?(s=this.itemMap[n])?(u=oS(s,this.transientNodeGroup,this.transientEdgeGroup,this.transientItemMap,l),void(l?"node"===t&&o.hasOwnProperty("x")&&o.hasOwnProperty("y")&&({x:s,y:l}=o,u.setPosition([s,l])):(s=u).update(Object.assign(Object.assign({},s.model),{data:Object.assign(Object.assign({},s.model.data),o)})))):void console.warn(`Fail to draw transient item of ${n}, which is not exist.`):((l=Zv(t,String(n),r,e)).style.pointerEvents=a?"auto":"none",void i.getRoot().appendChild(l))}getTransient(t){return this.transientObjectMap[t]}renderNodes(t,r={}){const{nodeExtensions:i,nodeGroup:o,nodeDataTypeSet:a,graph:s}=this,l=r["dataTypeField"],u=s.getZoom();t.forEach(t=>{let e;l&&(e=t.data[l]);var n=DA(a,l,e,r);this.itemMap[t.id]=new IA({model:t,renderExtensions:i,containerGroup:o,mapper:this.nodeMapper,stateMapper:this.nodeStateMapper,zoom:u,theme:n,device:"webgl-3d"===s.rendererType?s.canvas.context.deviceRendererPlugin.getDevice():void 0})})}renderEdges(t,a={}){const{edgeExtensions:s,edgeGroup:l,itemMap:u,edgeDataTypeSet:c,graph:e}=this,h=a["dataTypeField"],d=e.getZoom();t.forEach(t=>{var{source:e,target:n,id:r}=t,i=u[e],n=u[n];i||console.warn(`The source node ${e} is not exist in the graph for edge ${r}, please add the node first`),n||console.warn(`The source node ${e} is not exist in the graph for edge ${r}, please add the node first`);let o;h&&(o=t.data[h]);e=DA(c,h,o,a);u[r]=new LA({model:t,renderExtensions:s,containerGroup:l,mapper:this.edgeMapper,stateMapper:this.edgeStateMapper,sourceItem:i,targetItem:n,zoom:d,theme:e})})}findIdByState(e,n,r=!0){const i=[];return Object.values(this.itemMap).forEach(t=>{t.getType()===e&&t.hasState(n)===r&&i.push(t.getID())}),i}getItemState(t,e){var n=this.itemMap[t];return n?n.hasState(e):(console.warn(`Fail to get item state, the item with id ${t} does not exist.`),!1)}getItemById(t){return this.itemMap[t]}getItemBBox(t,e=!1){var n=this.itemMap[t];return n?e?n.getKeyBBox():n.getBBox():(console.warn(`Fail to get item bbox, the item with id ${t} does not exist.`),!1)}getItemVisible(t){var e=this.itemMap[t];return e?e.isVisible():(console.warn(`Fail to get item visible, the item with id ${t} does not exist.`),!1)}}const DA=(t,e,n,r)=>{var{styles:r,lodStrategy:i}=r,i=bS(i);if(!e)return{styles:(Ou(r)?r:Object.values(r))[0],lodStrategy:i};t.add(n);let o;return Ou(r)?(e=r.length,t=Array.from(t).indexOf(n),o=r[t%e]):Iu(r)&&(o=r[n]||r.others),{styles:o,lodStrategy:i}};function BA(t){return!!t.execute}function FA(t){return-1<["circular","random","grid","mds","concentric","radial","fruchterman","fruchtermanGPU","d3force","force","gforce","forceAtlas2"].indexOf(t.type)}class UA{constructor(t){this.extensions={},this.graph=t,this.animatedDisplayObject=new as({}),this.tap()}tap(){this.graph.hooks.layout.tap(this.onLayout.bind(this))}onLayout(t){return s(this,void 0,void 0,function*(){let e;this.stopLayout();var{graphCore:n,options:r}=t;if(this.graph.emit("startlayout"),BA(r)){var{animated:i=!1,animationEffectTiming:o={duration:1e3},execute:a}=r,s=I(r,["animated","animationEffectTiming","execute"]);e=yield a(n,s),i&&(yield this.animateLayoutWithoutIterations(e,o))}else{var{type:a="grid",animated:s=!1,animationEffectTiming:i={duration:1e3},iterations:o=300}=r,l=I(r,["type","animated","animationEffectTiming","iterations"]);let{workerEnabled:t=!1}=r;var u=mA.layouts[a];if(!u)throw new Error("Unknown layout algorithm: "+a);a=new u(l);this.currentLayout=a,(t=FA(r)?t:!1)?(u=new Qy(n,a,{iterations:o}),this.currentSupervisor=u,e=yield u.execute()):Jx(a)?e=s?yield a.execute(n,{onTick:t=>{this.updateNodesPosition(t),this.graph.emit("tick",t)}}):(a.execute(n),a.stop(),a.tick(o)):(e=yield a.execute(n),s&&(yield this.animateLayoutWithoutIterations(e,i)))}this.graph.emit("endlayout"),this.updateNodesPosition(e)})}stopLayout(){this.currentLayout&&Jx(this.currentLayout)&&(this.currentLayout.stop(),this.currentLayout=null),this.currentSupervisor&&(this.currentSupervisor.stop(),this.currentSupervisor=null),this.currentAnimation&&(this.currentAnimation.finish(),this.currentAnimation=null)}destroy(){this.stopLayout(),this.currentSupervisor&&this.currentSupervisor.kill()}updateNodesPosition(t){this.graph.updateNodePosition(t.nodes)}animateLayoutWithoutIterations(a,t){return s(this,void 0,void 0,function*(){t.iterations=1;const e=a.nodes.map(t=>Object.assign({},this.graph.getNodeData(""+t.id)));this.animatedDisplayObject.isConnected||(yield this.graph.canvas.ready,this.graph.canvas.appendChild(this.animatedDisplayObject)),this.currentAnimation=this.animatedDisplayObject.animate([{opacity:0},{opacity:1}],t),this.currentAnimation.onframe=t=>{const o=t.target.effect.getComputedTiming().progress;t=e.map(({id:t,data:e},n)=>{var{x:e=0,y:r=0}=e,{x:n,y:i}=a.nodes[n].data;return{id:t,data:{x:e+(n-e)*o,y:r+(i-r)*o}}});this.updateNodesPosition({nodes:t,edges:[]})},yield this.currentAnimation.finished})}}let GA=0;class WA{constructor(t){this.graph=t,this.tap()}tap(){this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this))}onViewportChange({transform:x,effectTiming:S}){return s(this,void 0,void 0,function*(){const e=this.graph.canvas.getCamera(),n=this.graph.transientCanvas.getCamera();var{translate:t,rotate:r,zoom:i,origin:o=this.graph.getViewportCenter()}=x,a=e.getZoom();if(S){const{duration:v=1e3,easing:y="linear",easingFunction:E}=S;var s,l,u,c,h,d,f,p,g,m={};t&&({dx:s=0,dy:l=0,dz:u=0}=t,[p,g,c]=e.getPosition(),[h,d,f]=e.getFocalPoint(),m.position=[p-s,g-l,c-u],m.focalPoint=[h-s,d-l,f-u]),i&&(p=i["ratio"],m.zoom=a*p),r&&(g=r["angle"],m.roll=e.getRoll()+g);const _=e.createLandmark("mark"+GA++,m),b=n.createLandmark("mark"+GA,m);return new Promise(t=>{n.gotoLandmark(b,{duration:Number(v),easing:y,easingFunction:E}),e.gotoLandmark(_,{duration:Number(v),easing:y,easingFunction:E,onfinish:()=>{t(void 0)}})})}t&&({dx:c=0,dy:h=0}=t,e.pan(-c/a,-h/a),n.pan(-c/a,-h/a)),r&&(s=r["angle"],[d,l]=e.getPosition(),o&&(e.setPosition(o.x,o.y),e.setFocalPoint(o.x,o.y),n.setPosition(o.x,o.y),n.setFocalPoint(o.x,o.y)),e.rotate(0,0,s),n.rotate(0,0,s),o)&&(e.pan(d-o.x,l-o.y),n.pan(d-o.x,l-o.y)),i&&(f=i["ratio"],e.setZoomByViewportPoint(a*f,[o.x,o.y]),n.setZoomByViewportPoint(a*f,[o.x,o.y]))})}destroy(){}}class VA{constructor(t){this.graph=t,this.tap()}tap(){this.extension=this.getExtension(),this.themes=this.getThemes(),this.graph.hooks.init.tap(this.onInit.bind(this)),this.graph.hooks.themechange.tap(this.onThemeChange.bind(this))}getExtension(){var{theme:t={}}=this.graph.getSpecification();return(this.themeConfig=t)?bA(t,_A.useLib,"themeSolver"):void 0}getThemes(){return _A.useLib["theme"+"s"]}onInit({canvases:t}){if(this.extension){this.solver=new this.extension(this.themeConfig,this.themes),this.specification=this.solver.specification;const e=this.specification["canvas"],n=t.background.getContextService().getDomElement();Object.keys(e).forEach(t=>n.style[t]=e[t])}}onThemeChange({canvases:t}){t&&(this.extension=this.getExtension(),this.onInit({canvases:t}))}}class jA{constructor(t){this.extensions={},this.graph=t}}class zA{constructor(t){this.extensions=[],this.pluginMap=new Map,this.listenersMap={},this.addListeners=(o,a)=>{const s=a.getEvents();this.listenersMap[o]={},Object.keys(s).forEach(t=>{e=o,n=t,r=s[t].bind(a);var e,n,r,i=t=>{try{r(t)}catch(t){throw console.error(`G6: Error occurred in "${n}" phase of the plugin "${e}"!`),t}};this.graph.on(t,i),this.listenersMap[o][t]=i})},this.removeListeners=t=>{const n=this.listenersMap[t];Object.keys(n).forEach(t=>{var e=n[t];e&&this.graph.off(t,e)})},this.graph=t,this.tap()}tap(){this.graph.hooks.init.tap(this.onPluginInit.bind(this)),this.graph.hooks.pluginchange.tap(this.onPluginChange.bind(this)),this.graph.hooks.destroy.tap(this.onDestroy.bind(this))}onPluginInit(){this.pluginMap.clear();var t=this["graph"];(t.getSpecification().plugins||[]).forEach(t=>{this.initPlugin(t)}),this.listenersMap={},this.pluginMap.forEach((t,e)=>{t=t.plugin;this.addListeners(e,t)})}initPlugin(t){var e=this["graph"],n=bA(t,_A.useLib,"plugin"),r="string"==typeof t?t:t.type,i="string"==typeof t?t:t.key||r,n=new n("string"==typeof t?{}:t);return n.init(e),this.pluginMap.set(i,{type:r,plugin:n}),{key:i,type:r,plugin:n}}onPluginChange(t){var{action:t,plugins:e}=t;"add"===t?e.forEach(t=>{var{key:t,plugin:e}=this.initPlugin(t);this.addListeners(t,e)}):"remove"===t?e.forEach(t=>{var t="string"==typeof t?t:t.key||t.type,e=this.pluginMap.get(t);e&&(e=e["plugin"],this.removeListeners(t),e.destroy(),this.pluginMap.delete(t))}):"update"===t&&e.forEach(t=>{var e,n;"string"!=typeof t&&(e=t.key||t.type,n=this.pluginMap.get(e))&&(n=n["plugin"],n.updateCfgs(t),this.removeListeners(e),this.addListeners(e,n))})}onDestroy(){this.pluginMap.forEach(t=>{t=t.plugin;t.destroy()})}destroy(){}}class HA{constructor(t){this.listeners=[];t=t.name;this.name=t}tap(t){this.listeners.push(t)}unTap(t){t=this.listeners.indexOf(t);-1<t&&this.listeners.splice(t,1)}emit(e){this.listeners.forEach(t=>t(e))}emitLinearAsync(e){return s(this,void 0,void 0,function*(){for(const t of this.listeners)yield t(e)})}}ct.enableCSSParsing=!1;class XA extends G{constructor(t){super(),this.defaultSpecification={theme:{type:"spec",base:"light"}},this.specification=Object.assign({},this.defaultSpecification,t),this.initHooks(),this.initCanvas(),this.initControllers(),this.hooks.init.emit({canvases:{background:this.backgroundCanvas,main:this.canvas,transient:this.transientCanvas}});t=t.data;t&&this.read(t)}initControllers(){this.dataController=new xA(this),this.interactionController=new MA(this),this.layoutController=new UA(this),this.themeController=new VA(this),this.itemController=new kA(this),this.viewportController=new WA(this),this.extensionController=new jA(this),this.pluginController=new zA(this)}initCanvas(){var{renderer:t,container:e,width:n,height:r}=this.specification;let i;t&&!ku(t)?(this.rendererType=t.type||"canvas",i=t.pixelRatio):this.rendererType=t||"canvas";t=ku(e)?document.getElementById(e):e;t?(this.container=t,void 0===(e=[n,r])[0]&&(e[0]=t.scrollWidth),void 0===e[1]&&(e[1]=t.scrollHeight),this.backgroundCanvas=Mv(this.rendererType,t,e[0],e[1],i),this.canvas=Mv(this.rendererType,t,e[0],e[1],i),this.transientCanvas=Mv(this.rendererType,t,e[0],e[1],i,!0,{pointerEvents:"none"}),Promise.all([this.backgroundCanvas,this.canvas,this.transientCanvas].map(t=>t.ready)).then(()=>this.canvasReady=!0)):(console.error(`Create graph failed. The container for graph ${t} is not exist.`),this.destroy())}changeRenderer(e){this.rendererType=e||"canvas";{e=this.rendererType;var n=this.canvas;let t;switch(e.toLowerCase()){case"svg":t=new kd;break;case"webgl-3d":case"webgl":(t=new hv).registerPlugin(new Av);break;default:t=new Ih}n.setRenderer(t)}}initHooks(){this.hooks={init:new HA({name:"init"}),datachange:new HA({name:"datachange"}),itemchange:new HA({name:"itemchange"}),render:new HA({name:"render"}),layout:new HA({name:"layout"}),viewportchange:new HA({name:"viewport"}),modechange:new HA({name:"modechange"}),behaviorchange:new HA({name:"behaviorchange"}),itemstatechange:new HA({name:"itemstatechange"}),itemvisibilitychange:new HA({name:"itemvisibilitychange"}),transientupdate:new HA({name:"transientupdate"}),pluginchange:new HA({name:"pluginchange"}),themechange:new HA({name:"init"}),destroy:new HA({name:"destroy"})}}updateSpecification(t){return Object.assign(this.specification,t)}updateTheme(t){this.specification.theme=t,this.hooks.themechange.emit({canvases:{background:this.backgroundCanvas,main:this.canvas,transient:this.transientCanvas}}),this.hooks.themechange.emit({theme:this.themeController.specification})}getSpecification(){return this.specification}read(e){return s(this,void 0,void 0,function*(){this.hooks.datachange.emit({data:e,type:"replace"});var t=()=>s(this,void 0,void 0,function*(){this.hooks.render.emit({graphCore:this.dataController.graphCore,theme:this.themeController.specification,transientCanvas:this.transientCanvas}),this.emit("afterrender"),yield this.layout()});this.canvasReady||(yield Promise.all([this.backgroundCanvas,this.canvas,this.transientCanvas].map(t=>t.ready))),yield t()})}changeData(t,e="mergeReplace"){return s(this,void 0,void 0,function*(){this.hooks.datachange.emit({data:t,type:e}),this.hooks.render.emit({graphCore:this.dataController.graphCore,theme:this.themeController.specification,transientCanvas:this.transientCanvas}),this.emit("afterrender"),yield this.layout()})}clear(){}getViewportCenter(){var{width:t,height:e}=this.canvas.getConfig();return{x:t/2,y:e/2}}transform(t,e){return s(this,void 0,void 0,function*(){yield this.hooks.viewportchange.emitLinearAsync({transform:t,effectTiming:e}),this.emit("viewportchange",t)})}stopTransformTransition(){this.canvas.getCamera().cancelLandmarkAnimation()}translate(t,e){return s(this,void 0,void 0,function*(){yield this.transform({translate:t},e)})}translateTo({x:n,y:r},i){return s(this,void 0,void 0,function*(){var{x:t,y:e}=this.getViewportCenter();yield this.translate({dx:t-n,dy:e-r},i)})}zoom(t,e,n){return s(this,void 0,void 0,function*(){yield this.transform({zoom:{ratio:t},origin:e},n)})}zoomTo(t,e,n){return s(this,void 0,void 0,function*(){yield this.zoom(t/this.canvas.getCamera().getZoom(),e,n)})}getZoom(){return this.canvas.getCamera().getZoom()}rotate(t,e,n){return s(this,void 0,void 0,function*(){yield this.transform({rotate:{angle:t},origin:e},n)})}rotateTo(t,e,n){return s(this,void 0,void 0,function*(){yield this.rotate(t-this.canvas.getCamera().getRoll(),e,n)})}fitView(d,f){return s(this,void 0,void 0,function*(){var{padding:t,rules:e}=d||{},[t,n,r,i]=t?Jv(t):[0,0,0,0],{direction:e="both",ratioRule:o="min"}=e||{},{center:[a,s],halfExtents:l}=this.canvas.document.documentElement.getBounds(),a=this.canvas.canvas2Viewport({x:a,y:s}),{width:s,height:u}=this.canvas.getConfig(),c=2*l[0],l=2*l[1],i=this.canvas.viewport2Canvas({x:i,y:t}),t=this.canvas.viewport2Canvas({x:s-n,y:u-r}),n=(t.x-i.x)/c,r=(t.y-i.y)/l;let h;h="x"===e?n:"y"===e?r:"max"===o?Math.max(n,r):Math.min(n,r),yield this.transform({translate:{dx:s/2-a.x,dy:u/2-a.y},zoom:{ratio:h}},f)})}fitCenter(n){return s(this,void 0,void 0,function*(){var[t,e]=this.canvas.document.documentElement.getBounds()["center"];yield this.translateTo(this.canvas.canvas2Viewport({x:t,y:e}),n)})}focusItem(o,a){return s(this,void 0,void 0,function*(){let t=null;for(const i of Ou(o)?o:[o]){var e=this.itemController.getItemById(i);e&&(e=e.group.getBounds(),t?t.add(e):t=e)}var n,r;t&&([n,r]=t["center"],yield this.translateTo(this.canvas.canvas2Viewport({x:n,y:r}),a))})}getSize(){var{width:t=500,height:e=500}=this.specification;return[t,e]}setSize(t){!Ou(t)||t.length<2?console.warn(`Failed to setSize. The parameter size: ${t} is invalid. It must be an array with 2 number elements.`):(this.specification.width=t[0],this.specification.height=t[1],this.canvas.resize(t[0],t[1]))}getCanvasByViewport(t){return this.canvas.viewport2Canvas(t)}getViewportByCanvas(t){return this.canvas.canvas2Viewport(t)}getClientByCanvas(t){t=this.canvas.canvas2Viewport(t);return this.canvas.viewport2Client(t)}getCanvasByClient(t){t=this.canvas.client2Viewport(t);return this.canvas.viewport2Canvas(t)}getNodeData(t){var t=ku(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("node",t))?void 0:t[0]}getEdgeData(t){var t=ku(t)||Fu(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("edge",t))?void 0:t[0]}getComboData(t){var t=ku(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("combo",t))?void 0:t[0]}getAllNodesData(){return this.dataController.findAllData("node")}getAllEdgesData(){return this.dataController.findAllData("edge")}getAllCombosData(){return this.dataController.findAllData("combo")}getRelatedEdgesData(t,e="both"){return this.dataController.findRelatedEdgeIds(t,e)}getNeighborNodesData(t,e="both"){return this.dataController.findNeighborNodeIds(t,e)}findIdByState(t,e,n=!0,r){let i=this.itemController.findIdByState(t,e,n);if(r){const o="node"===t?this.getNodeData:this.getEdgeData;i=i.filter(t=>r(o(t)))}return i}addData(e,n,t){const r=this.dataController["graphCore"],i=this.themeController["specification"];r.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:e,changes:r.reduceChanges(t.changes),graphCore:r,theme:i}),this.emit("afteritemchange",{type:e,action:"add",models:n}))});var o=Ou(n)?n:[n],a={nodes:[],edges:[],combos:[]},a=(a[e+"s"]=o,this.hooks.datachange.emit({data:a,type:"union"}),this.dataController.findData(e,o.map(t=>t.id)));return Ou(n)?a:a[0]}removeData(e,n,t){var r=Ou(n)?n:[n],i={nodes:[],edges:[],combos:[]};const{userGraphCore:o,graphCore:a}=this.dataController,s=this.themeController["specification"],l="edge"===e?o.getEdge:o.getNode;i[e+"s"]=r.map(t=>l.bind(o)(t)),a.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:e,changes:t.changes,graphCore:a,theme:s}),this.emit("afteritemchange",{type:e,action:"remove",ids:n}))}),this.hooks.datachange.emit({data:i,type:"remove"})}updateData(e,n,t){var r=Ou(n)?n:[n],i={nodes:[],edges:[],combos:[]};i[e+"s"]=r;const o=this.dataController["graphCore"],a=this.themeController["specification"];o.once("changed",t=>{this.hooks.itemchange.emit({type:e,changes:t.changes,graphCore:o,theme:a}),this.emit("afteritemchange",{type:e,action:"update",models:n})}),this.hooks.datachange.emit({data:i,type:"update"});i=this.dataController.findData(e,r.map(t=>t.id));return Ou(n)?i:i[0]}updateNodePosition(e,t){var n=Ou(e)?e:[e];const r=this.dataController["graphCore"],i=this.themeController["specification"];r.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:"node",changes:t.changes,graphCore:r,theme:i,action:"updateNodePosition"}),this.emit("afteritemchange",{type:"node",action:"updateNodePosition",models:e}))}),this.hooks.datachange.emit({data:{nodes:n,edges:[]},type:"update"});n=this.dataController.findData("node",n.map(t=>t.id));return Ou(e)?n:n[0]}showItem(t,e){t=Ou(t)?t:[t];this.hooks.itemvisibilitychange.emit({ids:t,value:!0,animate:!e})}hideItem(t,e){t=Ou(t)?t:[t];this.hooks.itemvisibilitychange.emit({ids:t,value:!1,animate:!e})}setItemState(t,e,n){var r=Ou(t)?t:[t],i=Ou(e)?e:[e];this.hooks.itemstatechange.emit({ids:r,states:i,value:n}),this.emit("afteritemstatechange",{ids:t,states:e,value:n})}getItemState(t,e){return this.itemController.getItemState(t,e)}clearItemState(t,e){var n=Ou(t)?t:[t];this.hooks.itemstatechange.emit({ids:n,states:e,value:!1}),this.emit("afteritemstatechange",{ids:t,states:e,value:!1})}getRenderBBox(t){return t?this.itemController.getItemBBox(t):this.canvas.getRoot().getRenderBounds()}getItemVisible(t){return this.itemController.getItemVisible(t)}createCombo(t,e,n){}uncombo(t,e){}collapseCombo(t,e){}expandCombo(t,e){}layout(n){return s(this,void 0,void 0,function*(){var t=this.dataController["graphCore"],e=Object.assign(Object.assign({},this.getSpecification().layout),n);n||this.getSpecification().layout||(t.getAllNodes().every(t=>Pu(t.data.x)&&Pu(t.data.y))?e.type="grid":e.execute=t=>s(this,void 0,void 0,function*(){return{nodes:t.getAllNodes().map(t=>({id:t.id,data:{x:Number(t.data.x)||0,y:Number(t.data.y)||0}})),edges:[]}})),yield this.hooks.layout.emitLinearAsync({graphCore:t,options:e}),this.emit("afterlayout")})}stopLayout(){this.layoutController.stopLayout()}setMode(t){this.hooks.modechange.emit({mode:t})}addBehaviors(t,e){e=Ou(e)?e:[e];const n=Ou(t)?t:[t];this.hooks.behaviorchange.emit({action:"add",modes:e,behaviors:n}),e.forEach(t=>{this.specification.modes[t]=this.specification.modes[t].concat(n)})}removeBehaviors(t,e){e=Ou(e)?e:[e];this.hooks.behaviorchange.emit({action:"remove",modes:e,behaviors:t}),e.forEach(n=>{t.forEach(e=>{var t=this.specification.modes[n].find(t=>Iu(t)&&t.key===e),t=this.specification.modes[n].indexOf(t);this.specification.modes[n].splice(t,1)})})}updateBehavior(t,e){this.hooks.behaviorchange.emit({action:"update",modes:[e],behaviors:[t]})}addPlugins(t){t=Ou(t)?t:[t];this.specification.plugins||(this.specification.plugins=[]);const n=this.specification.plugins,r=[];t.forEach(e=>{n.find(t=>"string"!=typeof t&&"string"!=typeof e&&t.key===e.key)?console.warn(`Add plugin with key ${e.key} failed, the key is duplicated to the existing plugins on the graph.`):r.push(e)}),this.specification.plugins=n.concat(r),this.hooks.pluginchange.emit({action:"add",plugins:r})}removePlugins(e){this.hooks.pluginchange.emit({action:"remove",plugins:e});var t=this.specification["plugins"];this.specification.plugins=null==t?void 0:t.filter(t=>Iu(t)?!e.includes(t.key):!e.includes(t))}updatePlugin(t){const e=t["key"];var n,r,i;e?(n=this.specification.plugins,n?(r=null==n?void 0:n.find(t=>"string"==typeof t?t===e:t.key===e))?(i=n.indexOf(r),n[i]=Object.assign(Object.assign({},r),t),this.hooks.pluginchange.emit({action:"update",plugins:[t]})):console.warn("Update plugin failed, the key for the plugin to be updated should be assign."):console.warn("Update plugin failed, the plugin to be updated does not exist.")):console.warn("Update plugin failed, the key for the plugin to be updated should be assign.")}drawTransient(t,e,n){return this.hooks.transientupdate.emit({type:t,id:e,config:n,canvas:this.transientCanvas}),this.itemController.getTransient(String(e))}destroy(t){setTimeout(()=>{this.canvas.destroy(),this.backgroundCanvas.destroy(),this.transientCanvas.destroy(),null!=t&&t()},500),this.hooks.destroy.emit({}),this.destroyed=!0}}r=XA,YA=mA,Object.keys(YA).forEach(e=>{_A.useLib[e]=Object.assign({},_A.useLib[e],YA[e]||{}),Object.keys(_A.useLib[e]).forEach(t=>{_A.useLib[e][t].type=t})});var YA,t=r,e1={Graph:t,stdLib:mA};N.Graph=t,N.default=e1,N.isImmediatelyInvokedLayoutOptions=BA,N.isLayoutWorkerized=FA,N.stdLib=mA,Object.defineProperty(N,"__esModule",{value:!0})});
19
+ </div>`);let u=0,c=0,h=!1;p.addEventListener(a||o?"mousedown":"dragstart",(e=>{var t,n;if(e.dataTransfer){var r=new Image;r.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null!=(n=(t=e.dataTransfer).setDragImage)&&n.call(t,r,0,0);try{e.dataTransfer.setData("text/html","view-port-minimap")}catch(t){e.dataTransfer.setData("text","view-port-minimap")}}this.options.refresh=!1,e.target===p&&(h=!0,u=e.clientX,c=e.clientY)}).bind(this),!1);var s=n=>{if(h&&!Pu(n.clientX)&&!Pu(n.clientY)){var r=this["ratio"],i=d.getZoom();let t=u-n.clientX,e=c-n.clientY;var o=p["style"],a=parseInt(o.left,10),s=parseInt(o.top,10),l=parseInt(o.width,10),o=parseInt(o.height,10);(a-t<0||a-t+l>=f[0])&&(t=0),(s-e<0||s-e+o>=f[1])&&(e=0),d.translate({dx:t*i/r,dy:e*i/r}).then(()=>{this.updateViewport()}),u=n.clientX,c=n.clientY}},l=(a||o||p.addEventListener("drag",s.bind(this),!1),()=>{h=!1,this.options.refresh=!0});p.addEventListener(a||o?"mouseup":"dragend",l.bind(this),!1);p.addEventListener("wheel",t=>{},!1),i.addEventListener("mouseleave",l.bind(this)),i.addEventListener("mouseup",l.bind(this)),(a||o)&&i.addEventListener("mousemove",s.bind(this),!1),this.viewport=p,i.appendChild(p)}}updateViewport(){if(!this.destroyed){this.viewport||this.initViewport();var{options:i,graph:o,dx:a,dy:s,ratio:l,viewport:u}=this,i=i["size"],c=o.canvas.context.config.canvas,[h=(null==c?void 0:c.scrollWidth)||500,c=(null==c?void 0:c.scrollHeight)||500]=o.getSize(),d=o.getZoom(),f=o.canvas.getRoot().getRenderBounds(),p=o.getViewportByCanvas({x:f.min[0],y:f.min[1]}),o=o.getViewportByCanvas({x:f.max[0],y:f.max[1]});let t=h*l/d,e=c*l/d,n=0,r=0;p.x<0?(n=-p.x/h*t+a,o.x<h&&(t=i[0]-n)):t-=p.x/h*t-a,p.y<0?(r=-p.y/c*e+s,o.y<c&&(e=i[1]-r)):e-=p.y/c*e-s;var f=t+n,l=(f>i[0]&&(t-=f-i[0]),e+r),g=(l>i[1]&&(e-=l-i[1]),u),m={left:n+"px",top:r+"px",width:t+"px",height:e+"px"};if(g)for(var v in m)m.hasOwnProperty(v)&&(g.style[v]=m[v])}}updateGraphShapes(){var{graph:t,options:n,canvas:r}=this,t=t.canvas.getRoot();if(!t.destroyed){r.removeChildren();let e;n=n["hideEdge"];n?(e=new fs,r.appendChild(e),t.children.forEach(t=>{"edge-group"!==t.id&&e.appendChild(t.cloneNode(!0))})):(e=t.cloneNode(!0),r.appendChild(e))}}updateKeyShapes(){var{graph:t,options:e,canvas:n}=this,e=e["hideEdge"];const r=n.getRoot(),i=(e||Lu(t.getAllEdgesData(),t=>{this.updateOneEdgeKeyShape(t,r)}),Lu(t.getAllNodesData(),t=>{this.updateOneNodeKeyShape(t,r)}),t.getAllCombosData());if(i&&i.length){let e=r.find(t=>"combo-group"===t.id);e||(e=new fs({id:"combo-group"}),r.appendChild(e)),setTimeout(()=>{this.destroyed||(Lu(i,t=>{this.updateOneNodeKeyShape(t,e)}),null!==e&&void 0!==e&&e.sort(),null!==e&&void 0!==e&&e.toBack(),this.updateCanvas())},250)}this.clearDestroyedShapes()}updateOneNodeKeyShape(n,r){var{itemMap:i={},graph:o}=this,a=o.canvas.getRoot().find(t=>"node-group"===t.id);if(a){let{minimapItem:e,graphItem:t}=i[n.id]||{};e&&!e.destroyed||(t=null==(a=a.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:a.find(t=>"keyShape"===t.id),(e=t.cloneNode()).id="minimap-keyShape-"+n.id,r.appendChild(e),i[n.id]={graphItem:t,minimapItem:e});a=t.getRenderBounds();if(a){r=t.attributes;const s=Object.assign(Object.assign({},r),{cx:a.center[0],cy:a.center[1]});e.toFront();r=e.get("type"),r=("rect"!==r&&"image"!==r&&"text"!==r||(s.x=a.min[0],s.y=a.min[1]),Object.keys(s).forEach(t=>{e.style[t]=s[t]}),o.getItemVisible(n.id)?e.show():e.hide(),n.data.depth);isNaN(r)||e.set("zIndex",r),this.itemMap=i}}}updateDelegateShapes(){var{graph:t,options:e,canvas:n}=this,e=e["hideEdge"];const r=n.getRoot(),i=(e||Lu(t.getAllEdgesData(),t=>{this.updateOneEdgeKeyShape(t,r)}),Lu(t.getAllNodesData(),t=>{this.updateOneNodeDelegateShape(t,r)}),t.getAllCombosData());if(i&&i.length){const o=r.find(t=>"comboGroup"===t.get("name"))||r.addGroup({name:"comboGroup"});setTimeout(()=>{this.destroyed||(Lu(i,t=>{this.updateOneNodeKeyShape(t,o)}),null!==o&&void 0!==o&&o.sort(),null!==o&&void 0!==o&&o.toBack(),this.updateCanvas())},250)}this.clearDestroyedShapes()}clearDestroyedShapes(){var{itemMap:e={}}=this,n=Object.keys(e);if(n&&0!==n.length)for(let t=n.length-1;0<=t;t--){var{minimapItem:r,graphItem:i}=e[n[t]]||{};i.destroyed&&r&&(r.remove(),delete e[n[t]])}}updateOneEdgeKeyShape(n,r){var i,{itemMap:o={},graph:a}=this,s=a.canvas.getRoot().find(t=>"edge-group"===t.id);if(s){let{minimapItem:t,graphItem:e}=o[n.id]||{};t&&!t.destroyed?(i=e.style.path,t.style.path=i):(e=null==(i=s.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:i.find(t=>"keyShape"===t.id),(t=e.cloneNode()).id="minimap-keyShape-"+n.id,r.appendChild(t)),a.getItemVisible(n.id)?t.show():t.hide(),o[n.id]={graphItem:e,minimapItem:t},this.itemMap=o}}updateOneNodeDelegateShape(n,r){var{itemMap:i={},options:o,graph:a}=this,o=o["delegateStyle"],s=a.canvas.getRoot().find(t=>"node-group"===t.id);if(s){let{minimapItem:e,graphItem:t}=i[n.id]||{};s=(t=t||(null==(s=s.find(t=>t.getAttribute("data-item-id")===n.id))?void 0:s.find(t=>"keyShape"===t.id))).getRenderBounds();const l=Object.assign({x:s.min[0],y:s.min[1],width:s.max[0]-s.min[0],height:s.max[1]-s.min[1]},o);!e||e.destroyed?(e=new Rs({style:Object.assign(Object.assign(Object.assign({},t.attributes),l),o),id:"minimap-delegate-"+n.id}),r.appendChild(e)):Object.keys(l).forEach(t=>e.style[t]=l[t]),e.toFront(),a.getItemVisible(n.id)?e.show():e.hide(),i[n.id]={graphItem:t,minimapItem:e},this.itemMap=i}}init(t){super.init(t),this.initContainer().then(()=>this.updateCanvas())}initContainer(){var{graph:t,options:e}=this,{size:n,className:r}=e;let i=e.container;e=Ow(`<div class='${r}' style='width: ${n[0]}px; height: ${n[1]}px; overflow: hidden;'></div>`),((i=ku(i)?document.getElementById(i):i)||t.container).appendChild(e),this.container&&(this.container.remove(),null!=(r=this.viewport)&&r.remove(),this.viewport=void 0,null!=(r=this.canvas))&&r.destroy(),this.container=e,r=Ow('<div class="g6-minimap-container" style="position: relative;"></div>'),e.appendChild(r),r.addEventListener("dragenter",t=>{t.preventDefault()}),r.addEventListener("dragover",t=>{t.preventDefault()}),e=t.canvas;return this.canvas=Mv("canvas",r,n[0],n[1],e.devicePixelRatio),this.canvas.ready}updateCanvas(){if(!this.destroyed){var{graph:t,canvas:e,options:n}=this,{refresh:n,size:r,padding:i,mode:o}=n;if(n&&!t.destroyed&&!e.destroyed){switch(o){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var n=e.getRoot();n&&(o=n.getRenderBounds(),t=(n=t.canvas.getRoot().getRenderBounds()).max[0]-n.min[0],n=n.max[1]-n.min[1],t=Math.min((r[0]-2*i)/t,(r[1]-2*i)/n),r=e.viewport2Canvas({x:0,y:0}),{x:i,y:n}=(e.getCamera().setFocalPoint(r.x,r.y),e.getCamera().setPosition(r.x,r.y),e.getCamera().setZoom(t),e.getCamera().setPosition(o.center[0],o.center[1]),e.getCamera().setFocalPoint(o.center[0],o.center[1]),e.canvas2Viewport({x:o.min[0],y:o.min[1]})),this.ratio=t,this.dx=i,this.dy=n,this.updateViewport())}}}getCanvas(){return this.canvas}getViewport(){return this.viewport}getContainer(){return this.container}destroy(){super.destroy(),null!=(t=this.canvas)&&t.destroy();var t=this.container;null!=t&&t.parentNode&&t.parentNode.removeChild(t)}},legend:class extends Iw{constructor(t){super(t)}getDefaultCfgs(){return{container:null,className:"g6-category-legend",orientation:"horizontal",selectedState:"selected",activeState:"active"}}getEvents(){return{afterrender:this.updateLegend}}init(t){super.init(t);var{size:e="fit-content",orientation:n}=this.options,t=t.getSize();this.size=e,this.selectedTypes={node:new Set,edge:new Set},this.activeType={node:void 0,edge:void 0},this.selectedIds={node:new Set,edge:new Set},this.activeIds={node:new Set,edge:new Set},this.styleCache={node:{},edge:{}},"fit-content"===e&&(this.size=["horizontal"===n?t[0]:"fit-content","horizontal"===n?"fit-content":t[1]]),e[0].includes("%")?(n=Number(e[0].replace("%"))/100||1,this.size[0]=t[0]*n):"number"==typeof e[0]&&(this.size[0]=e[0]),"100%"===e[1]?(n=Number(e[0].replace("%"))/100||1,this.size[1]=t[1]*n):"number"==typeof e[1]&&(this.size[1]=e[1])}updateLegend(){var t=this.size;this.wrapper||(this.wrapper=this.createWrapper()),this.canvas||(t=["fit-content"===t[0]?0:t[0],"fit-content"===t[1]?0:t[1]],this.canvas=Mv("canvas",this.wrapper,t[0],t[1]),this.canvas.context.config.canvas.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.canvas.addEventListener("click",t=>{var e,n,r;"document"===(null==(t=t.target)?void 0:t.nodeName)&&({graph:t,options:n}=this,{activeState:n,selectedState:e}=n,this.activeIds.node.size&&t.clearItemState(Array.from(this.activeIds.node),n),this.activeIds.edge.size&&t.clearItemState(Array.from(this.activeIds.edge),n),this.activeIds={node:new Set,edge:new Set},e&&({node:n,edge:r}=this.selectedIds,t.clearItemState(Array.from(n),e),t.clearItemState(Array.from(r),e),this.selectedIds={node:new Set,edge:new Set}),this.selectedTypes.node.forEach(t=>{var e=this.canvas.getRoot().querySelector("#marker-node-"+t);e&&(t=this.styleCache.node[t].lineWidth,e.style.lineWidth=t)}),this.selectedTypes.edge.forEach(t=>{var e=this.canvas.getRoot().querySelector("#marker-edge-"+t);e&&(t=this.styleCache.edge[t].lineWidth,e.style.lineWidth=t)}),this.selectedTypes={node:new Set,edge:new Set},this.activeType={node:void 0,edge:void 0})})),this.canvas.ready.then(()=>{this.nodeLegend=this.upsertLegend("node"),this.edgeLegend=this.upsertLegend("edge"),this.updateLayout()})}createWrapper(){var{options:t,graph:e,size:n}=this,{container:t,className:r}=t;let i=t;i=(i="string"==typeof t?document.getElementById(t):i)||e.container;t=["fit-content"===n[0]?0:n[0],"fit-content"===n[1]?0:n[1]],e=HTMLDivElement=Ow(`<div class='${r}' style='width: ${t[0]}px; height: ${t[1]}px; overflow: hidden;'></div>`);return i.appendChild(e),e}upsertLegend(i="node"){var{graph:t,options:e,canvas:n}=this,{node:e,edge:r,orientation:o}=e,e="node"===i?e:r;if(null==e||!e.enable)return;const{title:a,typeField:s,labelFormatter:l,rows:u=1,cols:c=4,colPadding:h=5,rowPadding:d=8,padding:f=[0,0,0,0],labelStyle:p={},markerStyle:g}=e,m={shape:"node"===i?"circle":"line",size:10,color:"#ccc",fillOpacity:.3};r=Jv(f);const v={};Object.keys(p).forEach(t=>{v["itemLabel"+function(t){t=Gu(t);return t.charAt(0).toUpperCase()+t.substring(1)}(t)]=p[t]});var e=v.itemLabelSpacing,{size:y,grid:E}=this.getLegendSize(u,c,r);const _="node"===i?t.getAllNodesData():t.getAllEdgesData(),b=new Set,x={},S=(_.map(t=>{var e;t.data[s]&&(e=t.data[s],b.add(e),x[e]||(x[e]=t))}),Array.from(b));var w=S.map(t=>({typeValue:t,label:l?l(t):t}));const T={};let A;if(g){const M=Object.assign({},m,g||{}),R=M["shape"],N=I(M,["shape"]);A=this.getShapeConfig(i,R),Object.keys(N).forEach(t=>{const e=N[t];let n=e;"object"==typeof e?n=t=>e[t.typeValue]||e[t.typeValue].size||10:Cu(e)&&(n=t=>e(t.typeValue)),"color"===t?(T.itemMarkerFill=T.itemMarkerFill||n,T.itemMarkerStroke=T.itemMarkerStroke||n):T["itemMarker"+rA(t)]=n})}else{t=t.canvas.getRoot();const C=t.getElementById(i+"-group")||t,P={},O={x1:-10,y1:0,x2:10,y2:0};S.forEach(e=>{var t=C.find(t=>t.getAttribute("data-item-id")===x[e].id).querySelector("#keyShape");P[e]={shape:t.nodeName,style:Object.assign(Object.assign({},t.attributes),O)}}),["fill","stroke","fillOpacity","opacity","lineWidth","shadow","shadowBlur","size"].forEach(n=>{T["itemMarker"+rA(n)]=t=>{t=t.typeValue;let e=n;return"size"===n&&(P[t].style.r&&(e="r"),e="width"),P[t].style[e]||m[n]}}),A=t=>{var t=t["typeValue"],e=P[t].shape||m.shape;return{Shape:Xv[e],style:P[t].style}}}t=new eA({style:Object.assign(Object.assign(Object.assign({x:r[3],y:r[0],data:w,layout:"flex",orientation:o,gridRow:E[0],gridCol:E[1],colPadding:h,rowPadding:d,width:y[0],height:y[1],titleText:a,itemSpacing:e},v),T),{itemMarker:t=>{const{Shape:e,style:n}=A(t),r=t["typeValue"];return this.styleCache[i][r]=n,()=>new e({style:n,id:`marker-${i}-`+r})},mouseenter:t=>this.handleMouseEnter(t,S,s,i,_),mouseleave:t=>this.handleMouseLeave(t,S,s,i),click:t=>this.handleClick(t,S,s,i,_)})});return n.appendChild(t),t}updateLayout(){var{nodeLegend:n,edgeLegend:r,options:i,size:t}=this;if(n&&r){var{node:i,edge:o,orientation:a}=i,{order:i=1,padding:s}=i,{order:o=2,padding:l}=o;let t,e;i<o?(t={padding:Jv(s),legend:n},e={padding:Jv(l),legend:r}):(e={padding:Jv(s),legend:n},t={padding:Jv(l),legend:r});i=t.legend.getRenderBounds();"horizontal"===a?(t.legend.translateLocal([0,-i.min[1]+t.padding[0]]),o=t.legend.childNodes[1].childNodes[0].childNodes[0].getRenderBounds().max[1]+t.padding[2],e.legend.translateLocal([0,o])):(t.legend.translateLocal([-i.min[0]+t.padding[3],0]),s=t.legend.childNodes[1].childNodes[0].childNodes[0].childNodes[1].getRenderBounds().max[0]+t.padding[1],e.legend.translateLocal([s,0]))}"fit-content"!==t[0]&&"fit-content"!==t[1]||(n=this.canvas.getRoot().getRenderBounds(),l=["fit-content"===t[0]?n.max[0]-n.min[0]:t[0],"fit-content"===t[1]?n.max[1]-n.min[1]:t[1]],this.canvas.resize(l[0],l[1]),this.wrapper.style.width=l[1]+"px",this.wrapper.style.height=l[0]+"px")}getShapeConfig(t,n){const r="node"===t?ls:Es,i="node"===t?{r:10,width:20,height:20,lineWidth:1}:{lineWidth:4,x1:-10,y1:0,x2:10,y2:0};if("string"!=typeof n)return t=>{var e,t=n[t.typeValue];return"string"==typeof t?{Shape:Xv[t],style:i}:({type:t,style:e}=t,{Shape:Xv[t]||r,style:Object.assign(Object.assign({},i),e)})};{const e=Xv[n]||r;return()=>({Shape:e,style:i})}}getLegendSize(t,e,n){var{graph:r,options:i,size:o}=this,i=i["orientation"];let[a,s]=o,l=[t,e];var[r,u]=r.getSize();return"horizontal"===i?("fit-content"===o[0]&&(a=r),"fit-content"===o[1]&&(s=50)):("fit-content"===o[0]&&(a=50),"fit-content"===o[1]&&(s=u),l=[e,t]),a+=n[1]+n[3],s+=n[0]+n[2],{size:[a,s],grid:l}}handleMouseEnter(t,e,n,r,i){var{graph:o,options:a}=this,a=a["activeState"];if(a){var s=t.__data__["index"];const l=e[s];this.activeType[n]=l;e=i.filter(t=>t.data[n]===l).map(t=>t.id);o.setItemState(e,a,!0),e.forEach(t=>this.activeIds[r].add(t)),t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][l].lineWidth+2||4}}handleMouseLeave(t,e,n,r){var i,{graph:o,options:a}=this,a=a["activeState"];a&&(this.activeType[n]=void 0,n=o.findIdByState(r,a,!0),i=t.__data__["index"],e=e[i],this.selectedTypes[r].has(e)?t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][e].lineWidth+4||6:t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][e].lineWidth||1,o.setItemState(n,a,!1),n.forEach(t=>this.activeIds[r].delete(t)))}handleClick(t,e,n,r,i){var{graph:o,options:a}=this,a=a["selectedState"];if(a){var s=t.__data__["index"];const l=e[s];e=i.filter(t=>t.data[n]===l).map(t=>t.id);this.selectedTypes[r].has(l)?(this.selectedTypes[r].delete(l),e.forEach(t=>this.selectedIds[r].delete(t)),o.setItemState(e,a,!1),t.querySelector(".legend-category-item-marker").style.lineWidth=4):(this.selectedTypes[r].add(l),e.forEach(t=>this.selectedIds[r].add(t)),o.setItemState(e,a,!0),t.querySelector(".legend-category-item-marker").style.lineWidth=this.styleCache[r][l].lineWidth+4||6)}}destroy(){super.destroy(),this.canvas.destroy()}}},nodes:{"circle-node":class extends SS{constructor(t){super(t),this.defaultStyles={keyShape:{r:16,x:0,y:0}}}draw(t,e,n,r){var i,{data:o={}}=t;let a={keyShape:void 0};return a.keyShape=this.drawKeyShape(t,e,n),o.haloShape&&this.drawHaloShape&&(a.haloShape=this.drawHaloShape(t,e,n)),o.labelShape&&(a.labelShape=this.drawLabelShape(t,e,n)),o.labelBackgroundShape&&(a.labelBackgroundShape=this.drawLabelBackgroundShape(t,e,n)),o.anchorShapes&&(i=this.drawAnchorShapes(t,e,n,r),a=Object.assign(Object.assign({},a),i)),o.iconShape&&(a.iconShape=this.drawIconShape(t,e,n)),o.badgeShapes&&(i=this.drawBadgeShapes(t,e,n,r),a=Object.assign(Object.assign({},a),i)),a=o.otherShapes&&this.drawOtherShapes?Object.assign(Object.assign({},a),this.drawOtherShapes(t,e,n)):a}drawKeyShape(t,e,n,r){return this.upsertShape("circle","keyShape",this.mergedStyles.keyShape,e,t)}},"sphere-node":class extends MS{constructor(t){super(t),this.defaultStyles={keyShape:{r:5,latitudeBands:32,longitudeBands:32,x:0,y:0,z:0}}}draw(t,e,n,r){var{data:i={}}=t;let o={keyShape:void 0};return o.keyShape=this.drawKeyShape(t,e,n),i.haloShape&&this.drawHaloShape&&(o.haloShape=this.drawHaloShape(t,e,n)),i.labelShape&&(o.labelShape=this.drawLabelShape(t,e,n)),i.labelBackgroundShape&&(o.labelBackgroundShape=this.drawLabelBackgroundShape(t,e,n)),i.iconShape&&(o.iconShape=this.drawIconShape(t,e,n)),i.badgeShapes&&(r=this.drawBadgeShapes(t,e,n,r),o=Object.assign(Object.assign({},o),r)),o=i.otherShapes&&this.drawOtherShapes?Object.assign(Object.assign({},o),this.drawOtherShapes(t,e,n)):o}drawKeyShape(t,e,n,r){return this.upsertShape("sphere","keyShape",this.mergedStyles.keyShape,e)}}},edges:{"line-edge":class extends class{constructor(t){this.defaultStyles={},this.zoomCache={hiddenShape:{},balanceRatio:1,zoom:1,zoomLevel:0,levelShapes:{},wordWrapWidth:50,animateConfig:Bv.zoom,firstRender:!0},this.onZoom=(e,t)=>{var n,r,i;if(this.balanceShapeSize(e,t),!this.lodStrategy)return;var o=this.lodStrategy["levels"];const{levelShapes:a,hiddenShape:s,animateConfig:l,firstRender:u=!0,zoomLevel:c}=this.zoomCache;var o=xS(o,t),h=Object.keys(a).map(Number),d=Math.max(...h),f=Math.min(...h);if(o<c)if(u)for(let t=o+1;t<=d;t++)null!=(n=a[String(t)])&&n.forEach(t=>{return null==(t=e[t])?void 0:t.hide()});else for(let t=o+1;t<=d;t++)null!=(r=a[String(t)])&&r.forEach(t=>zv(t,e[t],s,l));else if(c<o)for(let t=o;t>=f;t--)null!=(i=a[String(t)])&&i.forEach(t=>jv(t,e[t],this.mergedStyles[t]||this.mergedStyles[t.replace("Background","")],s,l));this.zoomCache.zoom=t,this.zoomCache.zoomLevel=o,this.zoomCache.firstRender=!1};var{themeStyles:t,lodStrategy:e,zoom:n}=t;t&&(this.themeStyles=t),this.lodStrategy=e,this.boundsCache={},this.zoomCache.zoom=n,this.zoomCache.balanceRatio=1/n,this.zoomCache.animateConfig=Object.assign(Object.assign({},Bv.zoom),null==e?void 0:e.animateCfg)}mergeStyles(t){this.mergedStyles=this.getMergedStyles(t)}getMergedStyles(t){const n=t["data"],r={};Object.keys(n).forEach(e=>{Rv.includes(e)?r[e]=n[e]:e===Nv&&Object.keys(n[e]).forEach(t=>r[t]=n[e][t])});var t=ty([this.themeStyles,this.defaultStyles,r]),e=null==(e=t.labelBackgroundShape)?void 0:e.padding;return e&&(t.labelBackgroundShape.padding=Jv(e,Cv)),t}updateCache(n){["labelShape","labelBackgroundShape"].forEach(t=>{var e=n[t];null!=e&&e.getAttribute(Kv)&&(this.boundsCache[t+"Geometry"]=e.getGeometryBounds(),this.boundsCache[t+"Transform"]=e.style.transform,e.setAttribute(Kv,!1))});const{levelShapes:r,zoom:t}=this.zoomCache;Object.keys(n).forEach(t=>{var e=n[t].attributes["lod"];void 0!==e&&(r[e]=r[e]||[],r[e].push(t))});var{maxWidth:e="60%"}=this.mergedStyles.labelShape||{};this.zoomCache.wordWrapWidth=ES([this.sourcePoint,this.targetPoint],e,1),this.zoomCache.zoom=1,this.zoomCache.zoomLevel=0,1!==t&&this.onZoom(n,t)}afterDraw(t,e,n){return{}}drawLabelShape(t,e,n,r){var i=e["keyShape"],o=this.mergedStyles["labelShape"],{position:a,offsetX:s,offsetY:l,autoRotate:u=!0,maxWidth:c}=o,o=I(o,["position","offsetX","offsetY","autoRotate","maxWidth"]),h={textAlign:"center",offsetX:0,offsetY:0,pointRatio:[.5,.501]};switch(Fu(a)&&(h.pointRatio=[a,a+.01]),a){case"start":h.pointRatio=[0,.01],h.textAlign="left",h.offsetX=4;break;case"end":h.pointRatio=[.99,1],h.textAlign="right",h.offsetX=-4}var d=i.getPoint(h.pointRatio[0]);let f={x:d.x,y:d.y},p=!1;u&&(u=i.getPoint(h.pointRatio[1]),i=Math.atan((d.y-u.y)/(d.x-u.x)),(p=u.x<d.x)&&("start"===a?(h.textAlign="right",h.offsetX=-4):"end"===a&&(h.textAlign="left",h.offsetX=4)),u=void 0===l?h.offsetY:l,l={x:d.x+(a=void 0===s?h.offsetX:s)*Math.cos(i),y:d.y+a*Math.sin(i)},f={x:l.x+u*Math.cos(Math.PI-i),y:l.y+u*Math.sin(Math.PI-i),transform:`rotate(${i/Math.PI*180})`}),this.labelPosition=Object.assign(Object.assign({},f),{isRevert:p});s=ES([this.sourcePoint,this.targetPoint],c,this.zoomCache.zoom),d=Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultStyles.labelShape),{textAlign:h.textAlign,wordWrapWidth:s}),f),o);return this.upsertShape("text","labelShape",d,e,t)}drawLabelBackgroundShape(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p=e["labelShape"];if(p&&t.data.labelShape)return{labelBackgroundShape:f,labelShape:i}=this.mergedStyles,p=this.boundsCache.labelShapeGeometry||p.getGeometryBounds(),{x:o,y:a,transform:s,isRevert:l}=this.labelPosition,u=f["padding"],f=I(f,["padding"]),{balanceRatio:c=1}=this.zoomCache,h=p.max[0]-p.min[0],d=p.max[1]-p.min[1],f=Object.assign(Object.assign({fill:"#fff"},f),{x:p.min[0]-u[3]+o,y:p.min[1]-u[0]/c+a,width:h+u[1]+u[3],height:d+(u[0]+u[2])/c,transform:s}),"start"===i.position?f.transformOrigin=l?f.width-u[1]+" "+f.height/2:u[3]+" "+f.height/2:"end"===i.position?f.transformOrigin=l?u[3]+" "+f.height/2:f.width-u[1]+" "+f.height/2:f.transformOrigin=h/2+u[3]+" "+(d/2+u[0]),this.upsertShape("rect","labelBackgroundShape",f,e,t)}drawIconShape(t,e,n,r){var i,o,a,s,{labelShape:l,labelBackgroundShape:u,keyShape:c}=e,{iconShape:h,labelShape:d}=this.mergedStyles,{width:f,height:p,fontSize:g,text:m,offsetX:v=0,offsetY:y=0}=h,f=f||g,p=p||g,g=m?"text":"image";return"text"==g?(h.textAlign="left",h.textBaseline="top",h.fontSize=f):(h.width=f,h.height=p),d?(m=u||l,{min:d,max:u,halfExtents:i}=this.boundsCache.labelBackgroundShapeGeometry||this.boundsCache.labelShapeGeometry||m.getGeometryBounds(),o=u[1]-d[1],u=u[0]-d[0],{x:m,y:a,transform:s}=m.attributes,l=l.attributes["textAlign"],h.x=d[0]-f+4+m+v,h.y=d[1]+(o-p)/2+a+y,s&&(h.transform=s,h.transformOrigin="right"===l?u/2-f/2+4+i[0]-v+" "+(p/2-y):"left"===l?f+4-v+" "+(p/2-y):(f+u)/2-v+" "+(p/2-y))):(m=c.getPoint(.5),h.x=m.x+v,h.y=m.y+y),this.upsertShape(g,"iconShape",h,e,t)}drawHaloShape(t,e,n,r){var i,o=e["keyShape"],a=this.mergedStyles["haloShape"];if(!1!==a.visible)return{nodeName:o,attributes:i}=o,this.upsertShape(o,"haloShape",Object.assign(Object.assign(Object.assign({},i),{stroke:i.stroke}),a),e,t)}balanceShapeSize(t,e){var{labelShape:t,labelBackgroundShape:n}=t,r=1/e||1,i=(this.zoomCache.balanceRatio=r,this.mergedStyles)["labelShape"],{position:i="bottom"}=i;t&&(t.style.transformOrigin="bottom"===i?"0":"",i=this.boundsCache.labelShapeTransform,t.style.transform=i+` scale(${r}, ${r})`,i=this.zoomCache.wordWrapWidth*e,t.style.wordWrapWidth=i,n)&&(e=this.boundsCache.labelBackgroundShapeTransform,n.style.transform=e+` scale(${r}, ${r})`)}setSourcePoint(t){this.sourcePoint=t}setTargetPoint(t){this.targetPoint=t}upsertShape(t,e,n,r,i){return Zv(t,e,n,r,i)}}{constructor(t){super(t),this.type="line-edge",this.defaultStyles={keyShape:{x1:0,y1:0,z1:0,x2:0,y2:0,z2:0,isBillboard:!0}}}draw(t,e,n,r,i,o){var{data:a={}}=t,s={keyShape:void 0};return s.keyShape=this.drawKeyShape(t,e,n,r,i),a.haloShape&&(s.haloShape=this.drawHaloShape(t,r,i)),a.labelShape&&(s.labelShape=this.drawLabelShape(t,r,i)),a.labelBackgroundShape&&(s.labelBackgroundShape=this.drawLabelBackgroundShape(t,r,i)),a.iconShape&&(s.iconShape=this.drawIconShape(t,r,i)),s}drawKeyShape(t,e,n,r,i,o){var a=this.mergedStyles["keyShape"];return this.upsertShape("line","keyShape",Object.assign(Object.assign({},a),{x1:e.x,y1:e.y,z1:e.z,x2:n.x,y2:n.y,z2:n.z}),r,t)}}},combos:{}};var vA,yA;const EA={rectSelector:(e,t,n)=>{var[t,r]=t;const i=Math.min(t.x,r.x),o=Math.max(t.x,r.x),a=Math.min(t.y,r.y),s=Math.max(t.y,r.y),l=[],u=[];let c=[];return n.includes("node")&&e.getAllNodesData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Pw(e,t,i,o,a,s)&&l.push(t)}),n.includes("combo")&&e.getAllCombosData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Pw(e,t,i,o,a,s)&&u.push(t)}),n.includes("edge")&&(c=iS(e,l.concat(u))),{nodes:l,edges:c,combos:u}},lassoSelector:(e,t,n)=>{const r=t.map(t=>[t.x,t.y]),i=[];let o=[];const a=[];return n.includes("node")&&e.getAllNodesData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Mw(e,t,r)&&i.push(t)}),n.includes("combo")&&e.getAllCombosData().forEach(t=>{t=t.id;e.getItemVisible(t)&&Mw(e,t,r)&&a.push(t)}),n.includes("edge")&&(o=iS(e,i.concat(a))),{nodes:i,edges:o,combos:a}}},_A={useLib:{transforms:{},themes:{},layouts:{},behaviors:{},plugins:{},nodes:{},edges:{},combos:{}}},bA=(t,e,n)=>{n+="s";return Cu(t)?t:(t="string"==typeof t?t:t.type,null==(e=e[n])?void 0:e[t])};class xA{constructor(t){this.extensions=[],this.graph=t,this.tap()}findData(t,e){const n=this["graphCore"];var r=typeof e,i=Ou(e);if("string"==r||"number"==r||i){var o=i?e:[e];switch(t){case"node":return o.map(t=>n.hasNode(t)?n.getNode(t):void 0);case"edge":return o.map(t=>n.hasEdge(t)?n.getEdge(t):void 0);case"combo":return}}else if("function"==r)return("node"===t?n.getAllNodes:n.getAllEdges)().filter(t=>e(t))}findAllData(t){if(!this.graphCore)return[];switch(t){case"node":return this.graphCore.getAllNodes();case"edge":return this.graphCore.getAllEdges();default:return[]}}findRelatedEdgeIds(t,e="both"){return this.graphCore.getRelatedEdges(t,e)}findNeighborNodeIds(t,e="both"){return"in"===e?this.graphCore.getAncestors(t):"out"===e?this.graphCore.getSuccessors(t):this.graphCore.getNeighbors(t)}tap(){this.extensions=this.getExtensions(),this.graph.hooks.datachange.tap(this.onDataChange.bind(this))}getExtensions(){var{transform:t=[]}=this.graph.getSpecification();return t.map(t=>({config:t,func:bA(t,_A.useLib,"transform")})).filter(t=>!!t.func)}onDataChange(t){const{data:e,type:n}=t;var t=()=>{switch(n){case"remove":this.removeData(e);break;case"update":this.updateData(e);break;default:this.changeData(e,n)}},r=this["userGraphCore"];r?r.batch(t):t()}changeData(t,e){const n=this["userGraphCore"];if("replace"===e){this.userGraphCore=new fy(Object.assign(Object.assign({},t),{onChanged:t=>this.updateGraphCore(t)}));var r=this.transformData()["data"];this.graphCore=new fy(Object.assign({},r))}else{var r=n.getAllNodes(),{nodes:t,edges:i}=t;if(r.length){if("mergeReplace"===e){const o=t.map(t=>t.id);r.forEach(t=>{o.includes(t.id)||n.removeNode(t.id)})}t.forEach(t=>{n.hasNode(t.id)?n.mergeNodeData(t.id,t.data):n.addNode(t)})}else n.addNodes(t);r=n.getAllEdges();if(r.length){if("mergeReplace"===e){const a=i.map(t=>t.id);r.forEach(t=>{a.includes(t.id)||n.removeEdge(t.id)})}i.forEach(t=>{n.hasEdge(t.id)?n.mergeEdgeData(t.id,t.data):n.addEdge(t)})}else n.addEdges(i)}}removeData(t){var e=this["userGraphCore"],{nodes:t,edges:n}=t,r=e.getAllNodes(),i=e.getAllEdges();r.length&&t.length&&e.removeNodes(t.map(t=>t.id)),i.length&&n.length&&e.removeEdges(n.map(t=>t.id))}updateData(t){const a=this["userGraphCore"];var{nodes:t,edges:e}=t,n=a.getAllNodes(),r=a.getAllEdges();n.length&&t.forEach(t=>{var{id:e,data:n}=t;n&&(n=TA(a.getNode(e),t),a.mergeNodeData(e,n))}),r.length&&e.forEach(t=>{var e,n,r,i,o=a.getEdge(t.id);o&&({id:e,source:i,target:n,data:r}=t,i&&o.source!==i&&a.updateEdgeSource(e,i),n&&o.target!==n&&a.updateEdgeTarget(e,n),r)&&(i=TA(a.getEdge(e),t),a.mergeEdgeData(e,i))})}updateGraphCore(e){const u=this["graphCore"],{data:t,idMaps:n}=this.transformData(),{nodes:i,edges:c}=t,h=u.getAllNodes(),d=(t,e,n,r,i=[])=>{r?e.data&&u.updateNodeData(t,e.data):(i.includes("data")&&u.updateEdgeData(t,e.data),i.includes("source")&&u.updateEdgeSource(t,e.source),i.includes("target")&&u.updateEdgeTarget(t,e.target))};u.batch(()=>{if(null!==n&&void 0!==n&&n.length&&n.length===this.extensions.length){const o={},a={},s={},l=(i.concat(c).forEach(t=>{o[t.id]=SA(t.id,n),a[t.id]=t}),h.concat(u.getAllEdges()).forEach(t=>{s[t.id]=t}),{});var t=e["changes"];t.forEach(t=>{var{value:t,id:e,type:n}=t;["TreeStructureAttached","TreeStructureDetached","TreeStructureChanged"].includes(n)||(e=e||t.id,l[e]=l[e]||[],l[e].push(n.toLawerCase()))}),Object.keys(a).forEach(t=>{var e=o[t],n=a[t],r=s[t],i=u.hasNode(t);n&&!r?(i?u.addNode:u.addEdge)(n):!n&&r?(i?u.removeNode:u.removeEdge)(t):null!=e&&e.length?null!=(e=l[e[0]])&&e.length&&d(t,n,0,i):null!=(e=wA(n,r,i))&&e.length&&d(t,n,0,i,e)})}else{const r={};i.forEach(t=>r[t.id]={type:"node",model:t}),c.forEach(t=>r[t.id]={type:"edge",model:t}),h.forEach(t=>{var e=t["id"],n=(r[e]||{})["model"];n?null!=(t=wA(n,t,!0))&&t.length&&d(e,n,0,!0):u.removeNode(e),delete r[e]}),u.getAllEdges().forEach(t=>{var e=t["id"],n=(r[e]||{})["model"];n?null!=(t=wA(n,t,!1))&&t.length&&d(e,n,0,!1,t):u.removeEdge(e),delete r[e]}),Object.values(r).forEach(({type:t,model:e})=>{"node"===t?u.addNode(e):"edge"===t&&u.addEdge(e)})}})}transformData(){var t=this["userGraphCore"],t={nodes:t.getAllNodes(),edges:t.getAllEdges()};let n=Wu(t);const r=[];return this.extensions.forEach(({func:t,config:e})=>{t=t(n,e),n=t.data,e=t.idMap;e&&r.push(e)}),{data:n,idMaps:r}}}const SA=(t,e,n=e.length-1)=>{let r=[];return null!=(t=e[n][t])&&t.forEach(t=>{0===n?r.push(t):r=r.concat(SA(t,e,n-1))}),r},wA=(e,n,t)=>{var r=[];if(t||(e.source!==n.source&&r.push("source"),e.target!==n.target&&r.push("target")),e.data){var i=Object.keys(e.data),t=Object.keys(n.data);if(0!==t.length||t.length!==i.length){if(t.length!==i.length)return r.concat("data");for(let t=0;t<i.length;t++){var o=i[t],a=e.data[o],o=n.data[o],s=Iu(a),l=Iu(o);if(s!==l)return r.concat("data");if(s&&l){if(JSON.stringify(a)!==JSON.stringify(o))return r.concat("data")}else if(a!==o)return r.concat("data")}}}return r},TA=(t,e)=>{const n=e["data"],r=t["data"],i={};return Object.keys(n).forEach(t=>{!Ou(r[t])&&!Ou(n[t])&&"object"==typeof r[t]&&"object"==typeof n[t]?i[t]=Object.assign(Object.assign({},r[t]),n[t]):i[t]=n[t]}),i},AA=((e=vA=vA||{}).pointerover="pointerover",e.pointerenter="pointerenter",e.pointerdown="pointerdown",e.pointermove="pointermove",e.pointerup="pointerup",e.pointerleave="pointerleave",e.click="click",e.wheel="wheel",(l=yA=yA||{}).focus="focus",l.blur="blur",l.keyup="keyup",l.keydown="keydown",l.keypress="keypress",t=>{var e;if("document"===t.nodeName)return{itemType:"canvas",itemId:void 0,groupElement:t};let n=t;for(;n&&(null==(e=n.getAttribute)||!e.call(n,"data-item-type"));)n=n.parentElement;return n?{itemType:n.getAttribute("data-item-type"),itemId:n.getAttribute("data-item-id"),groupElement:n}:null});class MA{constructor(t){this.behaviorMap=new Map,this.listenersMap={},this.tap=()=>{this.graph.hooks.init.tap(()=>this.onModeChange({mode:"default"})),this.onModeChange({mode:"default"}),this.graph.hooks.modechange.tap(this.onModeChange),this.graph.hooks.behaviorchange.tap(this.onBehaviorChange)},this.validateMode=t=>{var e;return"default"===t||(e=this.graph.getSpecification().modes||{},Object.keys(e).includes(t))},this.initBehavior=t=>{var e="string"==typeof t?t:t.key||t.type;if(this.behaviorMap.has(e))console.error(`G6: Failed to add behavior with key or type "${e}"! It was already added.`);else try{var n=new(bA(t,_A.useLib,"behavior"))("string"==typeof t?{}:t);return n.graph=this.graph,n&&this.behaviorMap.set(e,n),n}catch(t){return console.error(`G6: Failed to initialize behavior with key or type "${e}"!`,t),null}},this.destroyBehavior=(e,t)=>{try{t.destroy()}catch(t){console.error(`G6: Failed to destroy behavior with key or type "${e}"!`,t)}},this.addListeners=(o,a)=>{const s=a.getEvents();this.listenersMap[o]={},Object.keys(s).forEach(t=>{e=o,n=t,r=s[t].bind(a);var e,n,r,i=t=>{try{r(t)}catch(t){throw console.error(`G6: Error occurred in "${n}" phase of the behavior "${e}"!`),t}};this.graph.on(t,i),this.listenersMap[o][t]=i})},this.removeListeners=n=>{Object.keys(this.listenersMap[n]||{}).forEach(t=>{var e=this.listenersMap[n][t];this.graph.off(t,e)})},this.onModeChange=t=>{var e,t=t["mode"];this.mode!==t&&(this.validateMode(t)||console.warn(`G6: Mode "${t}" was not specified in current graph.`),this.mode=t,this.behaviorMap.forEach((t,e)=>{this.removeListeners(e),this.destroyBehavior(e,t)}),this.behaviorMap.clear(),((null==(e=this.graph.getSpecification().modes)?void 0:e[t])||[]).forEach(t=>{this.initBehavior(t)}),this.listenersMap={},this.behaviorMap.forEach((t,e)=>{this.addListeners(e,t)}))},this.onBehaviorChange=t=>{const{action:e,modes:n,behaviors:r}=t;n.forEach(t=>{t===this.mode&&("add"===e?r.forEach(t=>{var e="string"==typeof t?t:t.key||t.type,t=this.initBehavior(t);t&&this.addListeners(e,t)}):"remove"===e?r.forEach(t=>{var t="string"==typeof t?t:t.key||t.type,e=this.behaviorMap.get(t);e&&(this.removeListeners(t),this.destroyBehavior(t,e))}):"update"===e&&r.forEach(t=>{var e="string"==typeof t?t:t.key||t.type,e=this.behaviorMap.get(e);e&&e.updateConfig(t)}))})},this.initEvents=()=>{Object.values(vA).forEach(t=>{this.graph.canvas.document.addEventListener(t,this.handleCanvasEvent)}),Object.values(yA).forEach(t=>{this.graph.canvas.getContextService().getDomElement().addEventListener(t,this.handleDOMEvent)})},this.handleCanvasEvent=t=>{var e,n=AA(t.target);n&&({itemType:n,itemId:e}=n,"click"===(e=Object.assign(Object.assign({},t),{itemType:n,itemId:e,gEvent:t,currentTarget:this.graph})).type&&2===e.detail&&this.handleCanvasEvent(Object.assign(Object.assign({},t),{type:"dblclick"})),"canvas"===e.itemType?("pointermove"===e.type&&this.handlePointerMove(e),this.graph.emit("canvas:"+t.type,e),this.graph.emit(""+t.type,e)):"node"!==n&&"edge"!==n||("pointermove"!==e.type&&"pointerleave"!==e.type||this.handlePointerMove(e),this.graph.emit(n+":"+t.type,e),this.graph.emit(""+t.type,e)))},this.handlePointerMove=t=>{var e,n=this.prevItemInfo,r=AA(t.target);(null==n?void 0:n.itemId)!==(null==r?void 0:r.itemId)&&(n&&(e=n.itemType,this.graph.emit(e+":pointerleave",Object.assign(Object.assign({},t),{itemId:n.itemId,itemType:n.itemType,type:"pointerleave",target:n.groupElement}))),r)&&(e=r.itemType,this.graph.emit(e+":pointerenter",Object.assign(Object.assign({},t),{type:"pointerenter",target:r.groupElement}))),this.prevItemInfo=r},this.handleDOMEvent=t=>{this.graph.emit(t.type,t)},this.graph=t,this.initEvents(),this.tap()}}const RA=t=>Boolean(t.fields&&t.formatter),NA={node:t=>{var{id:t,data:e}=t,{color:n,label:r,icon:i,badges:o,anchorPoints:a}=e,e=Object.assign(Object.assign({},e),{keyShape:{}});return n&&(e.keyShape.fill=n),r&&(e.labelShape={text:r}),i&&(e.iconShape=i),o&&(e.badgeShapes=o),a&&(e.anchorShapes=a.map(t=>({position:t}))),{id:t,data:e}},edge:t=>{var{id:t,source:e,target:n,data:r}=t,{color:i,label:o,icon:a,badge:s}=r,r=Object.assign(Object.assign({},r),{keyShape:{}});return i&&(r.keyShape.stroke=i),o&&(r.labelShape={text:o}),a&&(r.iconShape=a),s&&(r.badgeShape=s),{id:t,source:e,target:n,data:r}},combo:t=>t};class CA{constructor(t){this.destroyed=!1,this.visible=!0,this.states=[],this.shapeMap={keyShape:void 0},this.afterDrawShapeMap={},this.transient=!1,this.stateDirtyMap={},this.cacheStateStyles={},this.cacheHiddenShape={},this.animateFrameListener=Hu(t=>{var e;null!=(e=this.onframe)&&e.call(this,t)},16,{trailing:!0,leading:!0}),this.device=t.device,this.onframe=t.onframe}init(t){var{model:e,containerGroup:n,mapper:r,stateMapper:i,renderExtensions:o,zoom:a=1,theme:s={}}=t;this.group=new fs,this.group.setAttribute("data-item-type",this.type),this.group.setAttribute("data-item-id",t.model.id),n.appendChild(this.group),this.model=e,this.mapper=r,this.zoom=a,this.stateMapper=i,this.displayModel=this.getDisplayModelAndChanges(e).model,this.renderExtensions=o;const{type:l="node"===this.type?"circle-node":"line-edge",lodStrategy:u}=this.displayModel.data;t=o.find(t=>t.type===l),this.themeStyles=s.styles,n=u?bS(u):s.lodStrategy;this.renderExt=new t({themeStyles:this.themeStyles.default,lodStrategy:n,device:this.device,zoom:this.zoom})}draw(t,e,n,r=0){var i,o;this.afterDrawShapeMap=(null==(o=(i=this.renderExt).afterDraw)?void 0:o.call(i,t,Object.assign(Object.assign({},this.shapeMap),this.afterDrawShapeMap)))||{},this.shapeMap=Qv(this.shapeMap,this.afterDrawShapeMap,this.group,!1,t=>!Rv.includes(t)||(console.warn(`Shape with id ${t} is reserved and should be returned in draw function, if the shape with ${t} returned by afterDraw is a new one, it will not be added to the group.`),!1)),this.changedStates=[]}update(t,e,n,r,i,o){this.model=t,r&&(this.themeStyles=r.styles);var{model:t,typeChange:n}=this.getDisplayModelAndChanges(this.model,e,n);if(this.displayModel=t,this.lodStrategy=t.data.lodStrategy?bS(t.data.lodStrategy):(null==r?void 0:r.lodStrategy)||this.lodStrategy,i)this.updatePosition(t,e,o);else{if(n){Object.values(this.shapeMap).forEach(t=>t.destroy()),this.shapeMap={keyShape:void 0};const{type:a="node"===this.type?"circle-node":"line-edge"}=t.data;r=this.renderExtensions.find(t=>t.type===a);this.renderExt=new r({themeStyles:this.themeStyles.default,lodStrategy:this.lodStrategy,device:this.device,zoom:this.zoom})}else this.renderExt.themeStyles=this.themeStyles.default,this.renderExt.lodStrategy=this.lodStrategy;null!=(i=this.states)&&i.length?this.drawWithStates(this.states,o):this.draw(this.displayModel,e,void 0,o),this.stateDirtyMap={},this.states.forEach(({name:t})=>this.stateDirtyMap[t]=!0)}}updatePosition(t,e,n){}getDisplayModelAndChanges(a,e,t){const{mapper:s,type:n}=this;var r=NA[n],i=a["data"],o=I(a,["data"]),{current:e=i}=e||{};if(!s){this.displayModel=r(a);let t=!1;return e&&(t=Boolean(e.type)),{model:this.displayModel,typeChange:t}}if(Cu(s))return{model:Object.assign(Object.assign({},r(a)),s(a))};const l=t?void 0:Object.keys(e).concat(Object.keys(o));let u=!1;i=I(a,["data"]);const c=r(a).data;return Object.keys(s).forEach(n=>{let r=s[n];var t=Rv.includes(n),e=Rv.includes(n)||n===Nv;if(e&&RA(r)||!e)if(c.hasOwnProperty(n))"type"!==n||l&&!l.includes("type")||(u=!0);else{var{changed:i,value:o}=PA({innerModel:a,mapper:s,fieldName:n,dataChangedFields:l});if(e){if(!o)return;r=o}else c[n]=o;i&&"type"===n&&(u=!0)}t?(c[n]=c[n]||{},OA({innerModel:a,mapper:r,dataChangedFields:l,shapeConfig:c[n]})):n===Nv&&(c[n]=c[n]||{},Object.keys(r).forEach(t=>{var e;null!=(e=c[n])&&e.hasOwnProperty(t)||(c[n][t]=c[n][t]||{},e=r[t],OA({innerModel:a,mapper:e,dataChangedFields:l,shapeConfig:c[n][t]}))}))}),{model:Object.assign(Object.assign({},i),{data:c}),typeChange:u}}getID(){return this.model.id}getType(){return this.type}show(t=!0){this.stopAnimations();var{animates:e={}}=this.displayModel.data;if(t&&null!=(t=e.show)&&t.length){const i={},o=(Object.values(e.show).forEach(t=>{var{shapeId:e="group"}=t;i[e]=(i[e]||[]).concat(t.fields)}),{});Object.keys(this.shapeMap).forEach(e=>{const n=this.shapeMap[e];if(!this.cacheHiddenShape[e]){if(i[e]){o[e]=o[e]||{};const r=kv(n);i[e].forEach(t=>{r.hasOwnProperty(t)&&(o[e][t]=n.style[t],n.style[t]=r[t])})}n.show()}}),i.group&&i.group.forEach(t=>{t="size"===t?"transform":t;Dv[0].hasOwnProperty(t)&&(this.group.style[t]=Dv[0][t])}),this.animations=this.runWithAnimates(e,"show",o)}else Object.keys(this.shapeMap).forEach(t=>{var e=this.shapeMap[t];this.cacheHiddenShape[t]||e.show()});this.visible=!0}hide(t=!0){this.stopAnimations();var e=()=>{Object.keys(this.shapeMap).forEach(t=>{var e=this.shapeMap[t];this.visible&&!e.isVisible()&&(this.cacheHiddenShape[t]=!0),e.hide()})},{animates:n={}}=this.displayModel.data;t&&null!=(t=n.hide)&&t.length?this.animations=this.runWithAnimates(n,"hide",void 0,e):e(),this.visible=!1}isVisible(){return this.visible}toFront(){this.group.toFront()}toBack(){this.group.toBack()}hasState(e){var t=this.states.find(t=>t.name===e);return(null==t?void 0:t.value)||!1}setState(e,t){var n=Wu(this.states),r=this.states.find(t=>t.name===e);t?r?r.value=t:this.states.push({name:e,value:t}):(r=this.states.indexOf(r),this.states.splice(r,1)),this.renderExt.constructor.prototype.hasOwnProperty("setState")?this.renderExt.setState(e,t,this.shapeMap):(this.changedStates=[e],this.drawWithStates(n))}clearStates(e){var t=Wu(this.states);const n=[];let r=[];e?this.states.filter(t=>{(e.includes(t.name)?r:n).push(t)}):r=this.states.map(({name:t})=>({name:t,value:!1})),this.states=n,this.changedStates=r.map(t=>t.name),this.renderExt.constructor.prototype.hasOwnProperty("setState")?r.forEach(({name:t,value:e})=>this.renderExt.setState(t,e,this.shapeMap)):this.drawWithStates(t)}getStates(){return this.states}runWithAnimates(t,e,n,r=()=>{}){let i={};return n?i=n:Object.keys(this.shapeMap).forEach(t=>{i[t]=kv(this.shapeMap[t])}),Vv(t,i,this.shapeMap,this.group,e,[],()=>{},r)}drawWithStates(t,e){const n=this.themeStyles,o=I(n,["default"]),a=this.displayModel["data"];let s={};this.states.forEach(({name:t,value:e})=>{var n;const r=this.cacheStateStyles[t]||{},i=null==(n=this.stateMapper)?void 0:n[t];(i||null!==o&&void 0!==o&&o[t])&&(i&&e&&(!this.stateDirtyMap.hasOwnProperty(t)||this.stateDirtyMap[t])&&(this.stateDirtyMap[t]=!1,Object.keys(i).forEach(e=>{r[e]=Object.assign({},a[e]),Rv.includes(e)?OA({innerModel:this.model,mapper:i[e],dataChangedFields:void 0,shapeConfig:r[e]}):e===Nv&&i[e]&&Object.keys(i[e]).forEach(t=>{r[e]=r[e]||{},r[e][t]=r[e][t]||{},OA({innerModel:this.model,mapper:i[e][t],dataChangedFields:void 0,shapeConfig:r[e][t]})})})),this.cacheStateStyles[t]=r,n=ty([o[t],r]),s=ty([s,n]))}),this.draw(Object.assign(Object.assign({},this.displayModel),{data:ty([a,s])}),void 0,{previous:t,current:this.states},e)}getKeyBBox(){var t=this.shapeMap["keyShape"];return(null==t?void 0:t.getRenderBounds())||{center:[0,0,0]}}getLocalKeyBBox(){var t=this.shapeMap["keyShape"];return(null==t?void 0:t.getLocalBounds())||{center:[0,0,0]}}getBBox(){return this.group.getRenderBounds()}stopAnimations(){var t;null!=(t=this.animations)&&t.forEach(t=>{var e=t.effect.getTiming();"running"===t.playState&&(t.currentTime=Number(e.duration)+Number(e.delay||0),t.cancel())}),this.animations=[]}updateZoom(t){this.zoom=t,this.renderExt.onZoom(this.shapeMap,t)}destroy(){var t,e=()=>{this.group.destroy(),this.model=null,this.displayModel=null,this.destroyed=!0},n=(this.stopAnimations(),this.displayModel.data)["animates"];null!=(t=null==n?void 0:n.buildOut)&&t.length&&!this.transient?this.animations=this.runWithAnimates(n,"buildOut",void 0,e):e()}}const PA=({innerModel:t,fieldName:e,mapper:n,dataChangedFields:r})=>{var i,n=n[e]||"";return RA(n)?({fields:e,formatter:i}=n,!r||Pv(r,e)?{changed:!0,value:i(t)||""}:{changed:!1}):{changed:!0,value:n}},OA=({innerModel:n,mapper:r,dataChangedFields:i,shapeConfig:o})=>{Object.keys(r).forEach(t=>{var e=PA({innerModel:n,mapper:r,fieldName:t,dataChangedFields:i})["value"];o[t]=e})};class IA extends CA{constructor(t){super(t),this.type="node",this.init(t),this.draw(this.displayModel,void 0,void 0,t.onfinish)}draw(t,e,n,r=()=>{}){const{group:i,renderExt:o,shapeMap:a,model:s}=this;o.mergeStyles(t),this.group.setAttribute("data-item-type","node"),this.group.setAttribute("data-item-id",s.id);var l=!(null!=(l=this.shapeMap)&&l.keyShape),u=o.draw(t,this.shapeMap,e,n),{animates:u,disableAnimate:c,x:h=0,y:d=0,z:f=0}=(this.shapeMap=Qv(a,u,i),t.data),{haloShape:h,labelBackgroundShape:d}=(l?i.setLocalPosition(h,d,f):this.updatePosition(t,e,r),this.shapeMap);null!=h&&h.toBack(),null!=d&&d.toBack(),super.draw(t,e,n,r),this.anchorPointsCache=void 0,o.updateCache(this.shapeMap),l&&o.onZoom(this.shapeMap,this.zoom),this.stopAnimations(),!c&&u&&(f=(t=>{if(!t.update)return t;const o=[];return t.update.forEach(e=>{var{shapeId:n,fields:r}=e;if((n=n)&&"group"!==n)o.push(e);else{var i,n=r;let t=!1;r.includes("x")&&(i=n.indexOf("x"),n.splice(i,1),t=!0),r.includes("y")&&(i=n.indexOf("y"),n.splice(i,1),t=!0),t?0!==n.length&&o.push(Object.assign(Object.assign({},e),{fields:n})):o.push(e)}}),Object.assign(Object.assign({},t),{update:o})})(u),this.animations=Vv(f,o.mergedStyles,this.shapeMap,i,l?"buildIn":"update",this.changedStates,this.animateFrameListener,()=>r(s.id)))}update(t,e,n,r,i,o){super.update(t,e,n,r,i,o)}updatePosition(t,e,n=()=>{}){var r=this["group"],{x:i=0,y:o=0,z:a=0,animates:s,disableAnimate:l}=t.data;if(!l&&null!=s&&s.update){l=s.update.filter(({shapeId:t,fields:e})=>(!t||"group"===t)&&(e.includes("x")||e.includes("y")));if(l.length)return void Vv({update:l},{group:{x:i,y:o,z:a}},this.shapeMap,r,"update",[],this.animateFrameListener,()=>n(t.id))}r.setLocalPosition(i,o,a)}clone(t,e,n){var r,i;if(e)return e=this.shapeMap.keyShape.cloneNode(),{x:o,y:r}=this.group.attributes,(i=new fs).setPosition([o,r]),i.appendChild(e),t.appendChild(i),i;var o=Wu(this.model);o.data.disableAnimate=n;const a=new IA({model:o,renderExtensions:this.renderExtensions,containerGroup:t,mapper:this.mapper,stateMapper:this.stateMapper,zoom:this.zoom,theme:{styles:this.themeStyles,lodStrategy:this.lodStrategy}});return Object.keys(this.shapeMap).forEach(t=>{this.shapeMap[t].isVisible()||a.shapeMap[t].hide()}),a}getAnchorPoint(t){var e=this.shapeMap["keyShape"],{x:e,y:n,z:r}=(e.nodeName,this.model.data);return{x:e,y:n,z:r}}}class LA extends CA{constructor(t){super(t),this.destroyed=!1,this.type="edge",this.forceUpdate=Hu(()=>{this.destroyed||this.draw(this.displayModel)},16,{leading:!0,trailing:!0}),this.type="edge",this.init(t);var{sourceItem:t,targetItem:e}=t;this.sourceItem=t,this.targetItem=e,this.draw(this.displayModel)}draw(t,e,n,r=()=>{}){var{x:i,y:o,z:a}=this.sourceItem.model.data,{x:s,y:l,z:u}=this.targetItem.model.data,s=this.sourceItem.getAnchorPoint({x:s,y:l,z:u}),l=this.targetItem.getAnchorPoint({x:i,y:o,z:a}),i=(this.renderExt.mergeStyles(t),!(null!=(u=this.shapeMap)&&u.keyShape)),o=(this.renderExt.setSourcePoint(s),this.renderExt.setTargetPoint(l),this.renderExt.draw(t,s,l,this.shapeMap,e,n)),{animates:a,disableAnimate:u}=(this.shapeMap=Qv(this.shapeMap,o,this.group),t.data),s=Object.assign({},a),l=this.renderExt.mergedStyles,{haloShape:o,labelShape:a}=this.shapeMap,o=(null!=o&&o.toBack(),null!=a&&a.toFront(),super.draw(t,e,n),this.renderExt.updateCache(this.shapeMap),i&&this.renderExt.onZoom(this.shapeMap,this.zoom),this.stopAnimations(),i?"buildIn":"update");!u&&null!=(a=s[o])&&a.length&&(this.animations=Vv(s,l,this.shapeMap,this.group,i?"buildIn":"update",this.changedStates,this.animateFrameListener,()=>r(t.id)))}updateEnd(t,e){"source"===t?this.sourceItem=e:"target"===t&&(this.targetItem=e),this.draw(this.displayModel)}clone(t,e,n,r,i){var o;if(r)return r=this.shapeMap.keyShape.cloneNode(),(o=new fs).appendChild(r),t.appendChild(o),o;r=Wu(this.model);r.data.disableAnimate=i;const a=new LA({model:r,renderExtensions:this.renderExtensions,sourceItem:e,targetItem:n,containerGroup:t,mapper:this.mapper,stateMapper:this.stateMapper,zoom:this.zoom,theme:{styles:this.themeStyles,lodStrategy:this.lodStrategy}});return Object.keys(this.shapeMap).forEach(t=>{this.shapeMap[t].isVisible()||a.shapeMap[t].hide()}),a}}class kA{constructor(t){this.nodeExtensions=[],this.edgeExtensions=[],this.comboExtensions=[],this.itemMap={},this.nodeDataTypeSet=new Set,this.edgeDataTypeSet=new Set,this.transientObjectMap={},this.transientItemMap={},this.onViewportChange=Vu(({transform:t})=>{t=t.zoom;if(t){const e=this.graph.getZoom();Object.values(this.itemMap).forEach(t=>t.updateZoom(e)),this.zoom=e}},500,!1),this.onThemeChange=({theme:t})=>{if(t){const{nodeDataTypeSet:o,edgeDataTypeSet:a}=this,{node:s,edge:l}=t;Object.values(this.itemMap).forEach(t=>{var e=t.getType(),n="node"===e?s:l,e="node"===e?o:a,r=n["dataTypeField"];let i;r&&(i=t.model.data[r]);e=DA(e,r,i,n);t.update(t.model,void 0,!1,e)})}},this.onDestroy=()=>{Object.values(this.itemMap).forEach(t=>t.destroy())};var{node:t,edge:e,combo:n,nodeState:r,edgeState:i,comboState:o}=(this.graph=t).getSpecification();this.nodeMapper=t,this.edgeMapper=e,this.comboMapper=n,this.nodeStateMapper=r,this.edgeStateMapper=i,this.comboStateMapper=o,this.tap()}tap(){var t=this.getExtensions();this.nodeExtensions=t.node,this.edgeExtensions=t.edge,this.comboExtensions=t.combo,this.graph.hooks.render.tap(this.onRender.bind(this)),this.graph.hooks.itemchange.tap(this.onChange.bind(this)),this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this)),this.graph.hooks.itemvisibilitychange.tap(this.onItemVisibilityChange.bind(this)),this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this)),this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this)),this.graph.hooks.themechange.tap(this.onThemeChange.bind(this)),this.graph.hooks.destroy.tap(this.onDestroy.bind(this))}getExtensions(){this.graph.getSpecification();var t=Object.keys(_A.useLib.nodes),e=Object.keys(_A.useLib.edges),n=Object.keys(_A.useLib.combos);return{node:t.map(t=>bA(t,_A.useLib,"node")).filter(Boolean),edge:e.map(t=>bA(t,_A.useLib,"edge")).filter(Boolean),combo:n.map(t=>bA(t,_A.useLib,"combo")).filter(Boolean)}}onRender(t){var{graphCore:t,theme:e={},transientCanvas:n}=t,r=this["graph"],i=(r.canvas.removeChildren(),new fs({id:"edge-group"})),o=new fs({id:"node-group"}),i=(r.canvas.appendChild(i),r.canvas.appendChild(o),this.nodeGroup=o,this.edgeGroup=i,n.removeChildren(),this.transientEdgeGroup=new fs({id:"edge-group"}),this.transientNodeGroup=new fs({id:"node-group"}),n.appendChild(this.transientEdgeGroup),n.appendChild(this.transientNodeGroup),"webgl-3d"===r.rendererType&&(o=new bv({style:{fill:"white",intensity:2*Math.PI}}),i=new Sv({style:{fill:"white",direction:[-1,0,1],intensity:.7*Math.PI}}),{width:n,height:o}=(r.canvas.appendChild(o),r.canvas.appendChild(i),r.canvas.getConfig()),r.canvas.getCamera().setPerspective(.1,5e4,45,n/o)),t.getAllNodes()),r=t.getAllEdges();this.renderNodes(i,e.node),this.renderEdges(r,e.edge)}onChange(t){const{changes:e,graphCore:s,theme:n={},action:l}=t,r={NodeRemoved:[],EdgeRemoved:[],NodeAdded:[],EdgeAdded:[],NodeDataUpdated:[],EdgeUpdated:[],EdgeDataUpdated:[]},u=(e.forEach(t=>{var e=t["type"];r[e].push(t)}),this)["itemMap"],{node:c={},edge:a={}}=(r.EdgeRemoved.concat(r.NodeRemoved).forEach(({value:t})=>{var t=t["id"],e=u[t];e&&(e.destroy(),delete u[t])}),n);if(r.NodeAdded.length&&this.renderNodes(r.NodeAdded.map(t=>t.value),c),r.EdgeAdded.length&&this.renderEdges(r.EdgeAdded.map(t=>t.value),a),r.NodeDataUpdated.length){const h={},d=(r.NodeDataUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n,oldValue:r}=t;h[t]=h[t]||{previous:{},current:{}},e?(h[t].previous[e]=r,h[t].current[e]=n):h[t]={isReplace:!0,previous:r,current:n}}),c)["dataTypeField"],f={},p=Hu(()=>{Object.keys(f).forEach(t=>{t=u[t];t&&!t.destroyed&&t.forceUpdate()})},16,{leading:!0,trailing:!0});Object.keys(h).forEach(t=>{var{isReplace:e,previous:n,current:r}=h[t];let i;d&&n[d]!==r[d]&&(i=DA(this.nodeDataTypeSet,d,r[d],c));const o=u[t];var a=s.getNode(t);o.onframe=p,o.update(a,{previous:n,current:r},e,i,"updateNodePosition"===l,()=>{o.onframe=void 0}),s.getRelatedEdges(t).forEach(t=>{f[t.id]=t})}),p()}if(r.EdgeDataUpdated.length){const g={},m=(r.EdgeDataUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n,oldValue:r}=t;g[t]=g[t]||{previous:{},current:{}},e?(g[t].previous[e]=r,g[t].current[e]=n):g[t]={isReplace:!0,previous:r,current:n}}),a)["dataTypeField"];Object.keys(g).forEach(t=>{var{isReplace:e,current:n,previous:r}=g[t];let i;r[m]!==n[m]&&(i=DA(this.edgeDataTypeSet,m,n[m],a));var o=u[t],t=s.getEdge(t);o.update(t,{current:n,previous:r},e,i)})}if(r.EdgeUpdated.length){const i={};r.EdgeUpdated.forEach(t=>{var{id:t,propertyName:e,newValue:n}=t;i[t]=i[t]||{},i[t][e]=n}),Object.keys(i).forEach(t=>{var{source:e,target:n}=i[t],t=u[t];void 0!==e&&t.updateEnd("source",this.itemMap[e]),void 0!==n&&t.updateEnd("target",this.itemMap[n])})}}onItemStateChange(t){const{ids:e,states:n,value:r}=t;e.forEach(t=>{const e=this.itemMap[t];e?n&&r?n.forEach(t=>e.setState(t,r)):e.clearStates(n):console.warn(`Fail to set state for item ${t}, which is not exist.`)})}onItemVisibilityChange(t){const{ids:e,value:n,animate:r=!0}=t;e.forEach(t=>{var e=this.itemMap[t];e?n?e.show(r):e.hide(r):console.warn(`Fail to set visibility for item ${t}, which is not exist.`)})}onTransientUpdate(t){var e=this["transientObjectMap"],{type:t,id:n,config:r={},canvas:i}=t,{style:r={},data:o={},capture:a,action:s,onlyDrawKeyShape:l}=r,u="node"===t||"edge"===t||"combo"===t;return"remove"===s?u?((s=this.transientItemMap[n])&&!s.destroyed&&s.destroy(),void delete this.transientItemMap[n]):((s=e[n])&&!s.destroyed&&s.destroy(),void delete e[n]):u?(s=this.itemMap[n])?(u=oS(s,this.transientNodeGroup,this.transientEdgeGroup,this.transientItemMap,l),void(l?"node"===t&&o.hasOwnProperty("x")&&o.hasOwnProperty("y")&&({x:s,y:l}=o,u.setPosition([s,l])):(s=u).update(Object.assign(Object.assign({},s.model),{data:Object.assign(Object.assign({},s.model.data),o)})))):void console.warn(`Fail to draw transient item of ${n}, which is not exist.`):((l=Zv(t,String(n),r,e)).style.pointerEvents=a?"auto":"none",void i.getRoot().appendChild(l))}getTransient(t){return this.transientObjectMap[t]}renderNodes(t,r={}){const{nodeExtensions:i,nodeGroup:o,nodeDataTypeSet:a,graph:s}=this,l=r["dataTypeField"],u=s.getZoom();t.forEach(t=>{let e;l&&(e=t.data[l]);var n=DA(a,l,e,r);this.itemMap[t.id]=new IA({model:t,renderExtensions:i,containerGroup:o,mapper:this.nodeMapper,stateMapper:this.nodeStateMapper,zoom:u,theme:n,device:"webgl-3d"===s.rendererType?s.canvas.context.deviceRendererPlugin.getDevice():void 0})})}renderEdges(t,a={}){const{edgeExtensions:s,edgeGroup:l,itemMap:u,edgeDataTypeSet:c,graph:e}=this,h=a["dataTypeField"],d=e.getZoom();t.forEach(t=>{var{source:e,target:n,id:r}=t,i=u[e],n=u[n];i||console.warn(`The source node ${e} is not exist in the graph for edge ${r}, please add the node first`),n||console.warn(`The source node ${e} is not exist in the graph for edge ${r}, please add the node first`);let o;h&&(o=t.data[h]);e=DA(c,h,o,a);u[r]=new LA({model:t,renderExtensions:s,containerGroup:l,mapper:this.edgeMapper,stateMapper:this.edgeStateMapper,sourceItem:i,targetItem:n,zoom:d,theme:e})})}findIdByState(e,n,r=!0){const i=[];return Object.values(this.itemMap).forEach(t=>{t.getType()===e&&t.hasState(n)===r&&i.push(t.getID())}),i}getItemState(t,e){var n=this.itemMap[t];return n?n.hasState(e):(console.warn(`Fail to get item state, the item with id ${t} does not exist.`),!1)}getItemById(t){return this.itemMap[t]}getItemBBox(t,e=!1){var n=this.itemMap[t];return n?e?n.getKeyBBox():n.getBBox():(console.warn(`Fail to get item bbox, the item with id ${t} does not exist.`),!1)}getItemVisible(t){var e=this.itemMap[t];return e?e.isVisible():(console.warn(`Fail to get item visible, the item with id ${t} does not exist.`),!1)}}const DA=(t,e,n,r)=>{var{styles:r,lodStrategy:i}=r,i=bS(i);if(!e)return{styles:(Ou(r)?r:Object.values(r))[0],lodStrategy:i};t.add(n);let o;return Ou(r)?(e=r.length,t=Array.from(t).indexOf(n),o=r[t%e]):Iu(r)&&(o=r[n]||r.others),{styles:o,lodStrategy:i}};function BA(t){return!!t.execute}function FA(t){return-1<["circular","random","grid","mds","concentric","radial","fruchterman","fruchtermanGPU","d3force","force","gforce","forceAtlas2"].indexOf(t.type)}class UA{constructor(t){this.extensions={},this.graph=t,this.animatedDisplayObject=new as({}),this.tap()}tap(){this.graph.hooks.layout.tap(this.onLayout.bind(this))}onLayout(t){return s(this,void 0,void 0,function*(){let e;this.stopLayout();var{graphCore:n,options:r}=t;if(this.graph.emit("startlayout"),BA(r)){var{animated:i=!1,animationEffectTiming:o={duration:1e3},execute:a}=r,s=I(r,["animated","animationEffectTiming","execute"]);e=yield a(n,s),i&&(yield this.animateLayoutWithoutIterations(e,o))}else{var{type:a="grid",animated:s=!1,animationEffectTiming:i={duration:1e3},iterations:o=300}=r,l=I(r,["type","animated","animationEffectTiming","iterations"]);let{workerEnabled:t=!1}=r;var u=mA.layouts[a];if(!u)throw new Error("Unknown layout algorithm: "+a);a=new u(l);this.currentLayout=a,(t=FA(r)?t:!1)?(u=new Qy(n,a,{iterations:o}),this.currentSupervisor=u,e=yield u.execute()):Jx(a)?e=s?yield a.execute(n,{onTick:t=>{this.updateNodesPosition(t),this.graph.emit("tick",t)}}):(a.execute(n),a.stop(),a.tick(o)):(e=yield a.execute(n),s&&(yield this.animateLayoutWithoutIterations(e,i)))}this.graph.emit("endlayout"),this.updateNodesPosition(e)})}stopLayout(){this.currentLayout&&Jx(this.currentLayout)&&(this.currentLayout.stop(),this.currentLayout=null),this.currentSupervisor&&(this.currentSupervisor.stop(),this.currentSupervisor=null),this.currentAnimation&&(this.currentAnimation.finish(),this.currentAnimation=null)}destroy(){this.stopLayout(),this.currentSupervisor&&this.currentSupervisor.kill()}updateNodesPosition(t){this.graph.updateNodePosition(t.nodes)}animateLayoutWithoutIterations(a,t){return s(this,void 0,void 0,function*(){t.iterations=1;const e=a.nodes.map(t=>Object.assign({},this.graph.getNodeData(""+t.id)));this.animatedDisplayObject.isConnected||(yield this.graph.canvas.ready,this.graph.canvas.appendChild(this.animatedDisplayObject)),this.currentAnimation=this.animatedDisplayObject.animate([{opacity:0},{opacity:1}],t),this.currentAnimation.onframe=t=>{const o=t.target.effect.getComputedTiming().progress;t=e.map(({id:t,data:e},n)=>{var{x:e=0,y:r=0}=e,{x:n,y:i}=a.nodes[n].data;return{id:t,data:{x:e+(n-e)*o,y:r+(i-r)*o}}});this.updateNodesPosition({nodes:t,edges:[]})},yield this.currentAnimation.finished})}}let GA=0;class WA{constructor(t){this.graph=t,this.tap()}tap(){this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this))}onViewportChange({transform:x,effectTiming:S}){return s(this,void 0,void 0,function*(){const e=this.graph.canvas.getCamera(),n=this.graph.transientCanvas.getCamera();var{translate:t,rotate:r,zoom:i,origin:o=this.graph.getViewportCenter()}=x,a=e.getZoom();if(S){const{duration:v=1e3,easing:y="linear",easingFunction:E}=S;var s,l,u,c,h,d,f,p,g,m={};t&&({dx:s=0,dy:l=0,dz:u=0}=t,[p,g,c]=e.getPosition(),[h,d,f]=e.getFocalPoint(),m.position=[p-s,g-l,c-u],m.focalPoint=[h-s,d-l,f-u]),i&&(p=i["ratio"],m.zoom=a*p),r&&(g=r["angle"],m.roll=e.getRoll()+g);const _=e.createLandmark("mark"+GA++,m),b=n.createLandmark("mark"+GA,m);return new Promise(t=>{n.gotoLandmark(b,{duration:Number(v),easing:y,easingFunction:E}),e.gotoLandmark(_,{duration:Number(v),easing:y,easingFunction:E,onfinish:()=>{t(void 0)}})})}t&&({dx:c=0,dy:h=0}=t,e.pan(-c/a,-h/a),n.pan(-c/a,-h/a)),r&&(s=r["angle"],[d,l]=e.getPosition(),o&&(e.setPosition(o.x,o.y),e.setFocalPoint(o.x,o.y),n.setPosition(o.x,o.y),n.setFocalPoint(o.x,o.y)),e.rotate(0,0,s),n.rotate(0,0,s),o)&&(e.pan(d-o.x,l-o.y),n.pan(d-o.x,l-o.y)),i&&(f=i["ratio"],e.setZoomByViewportPoint(a*f,[o.x,o.y]),n.setZoomByViewportPoint(a*f,[o.x,o.y]))})}destroy(){}}class VA{constructor(t){this.graph=t,this.tap()}tap(){this.extension=this.getExtension(),this.themes=this.getThemes(),this.graph.hooks.init.tap(this.onInit.bind(this)),this.graph.hooks.themechange.tap(this.onThemeChange.bind(this))}getExtension(){var{theme:t={}}=this.graph.getSpecification();return(this.themeConfig=t)?bA(t,_A.useLib,"themeSolver"):void 0}getThemes(){return _A.useLib["theme"+"s"]}onInit({canvases:t}){if(this.extension){this.solver=new this.extension(this.themeConfig,this.themes),this.specification=this.solver.specification;const e=this.specification["canvas"],n=t.background.getContextService().getDomElement();Object.keys(e).forEach(t=>n.style[t]=e[t])}}onThemeChange({canvases:t}){t&&(this.extension=this.getExtension(),this.onInit({canvases:t}))}}class jA{constructor(t){this.extensions={},this.graph=t}}class zA{constructor(t){this.extensions=[],this.pluginMap=new Map,this.listenersMap={},this.addListeners=(o,a)=>{const s=a.getEvents();this.listenersMap[o]={},Object.keys(s).forEach(t=>{e=o,n=t,r=s[t].bind(a);var e,n,r,i=t=>{try{r(t)}catch(t){throw console.error(`G6: Error occurred in "${n}" phase of the plugin "${e}"!`),t}};this.graph.on(t,i),this.listenersMap[o][t]=i})},this.removeListeners=t=>{const n=this.listenersMap[t];Object.keys(n).forEach(t=>{var e=n[t];e&&this.graph.off(t,e)})},this.graph=t,this.tap()}tap(){this.graph.hooks.init.tap(this.onPluginInit.bind(this)),this.graph.hooks.pluginchange.tap(this.onPluginChange.bind(this)),this.graph.hooks.destroy.tap(this.onDestroy.bind(this))}onPluginInit(){this.pluginMap.clear();var t=this["graph"];(t.getSpecification().plugins||[]).forEach(t=>{this.initPlugin(t)}),this.listenersMap={},this.pluginMap.forEach((t,e)=>{t=t.plugin;this.addListeners(e,t)})}initPlugin(t){var e=this["graph"],n=bA(t,_A.useLib,"plugin"),r="string"==typeof t?t:t.type,i="string"==typeof t?t:t.key||r,n=new n("string"==typeof t?{}:t);return n.init(e),this.pluginMap.set(i,{type:r,plugin:n}),{key:i,type:r,plugin:n}}onPluginChange(t){var{action:t,plugins:e}=t;"add"===t?e.forEach(t=>{var{key:t,plugin:e}=this.initPlugin(t);this.addListeners(t,e)}):"remove"===t?e.forEach(t=>{var t="string"==typeof t?t:t.key||t.type,e=this.pluginMap.get(t);e&&(e=e["plugin"],this.removeListeners(t),e.destroy(),this.pluginMap.delete(t))}):"update"===t&&e.forEach(t=>{var e,n;"string"!=typeof t&&(e=t.key||t.type,n=this.pluginMap.get(e))&&(n=n["plugin"],n.updateCfgs(t),this.removeListeners(e),this.addListeners(e,n))})}onDestroy(){this.pluginMap.forEach(t=>{t=t.plugin;t.destroy()})}destroy(){}}class HA{constructor(t){this.listeners=[];t=t.name;this.name=t}tap(t){this.listeners.push(t)}unTap(t){t=this.listeners.indexOf(t);-1<t&&this.listeners.splice(t,1)}emit(e){this.listeners.forEach(t=>t(e))}emitLinearAsync(e){return s(this,void 0,void 0,function*(){for(const t of this.listeners)yield t(e)})}}ct.enableCSSParsing=!1;class XA extends G{constructor(t){super(),this.defaultSpecification={theme:{type:"spec",base:"light"}},this.specification=Object.assign({},this.defaultSpecification,t),this.initHooks(),this.initCanvas(),this.initControllers(),this.hooks.init.emit({canvases:{background:this.backgroundCanvas,main:this.canvas,transient:this.transientCanvas}});t=t.data;t&&this.read(t)}initControllers(){this.dataController=new xA(this),this.interactionController=new MA(this),this.layoutController=new UA(this),this.themeController=new VA(this),this.itemController=new kA(this),this.viewportController=new WA(this),this.extensionController=new jA(this),this.pluginController=new zA(this)}initCanvas(){var{renderer:t,container:e,width:n,height:r}=this.specification;let i;t&&!ku(t)?(this.rendererType=t.type||"canvas",i=t.pixelRatio):this.rendererType=t||"canvas";t=ku(e)?document.getElementById(e):e;t?(this.container=t,void 0===(e=[n,r])[0]&&(e[0]=t.scrollWidth),void 0===e[1]&&(e[1]=t.scrollHeight),this.backgroundCanvas=Mv(this.rendererType,t,e[0],e[1],i),this.canvas=Mv(this.rendererType,t,e[0],e[1],i),this.transientCanvas=Mv(this.rendererType,t,e[0],e[1],i,!0,{pointerEvents:"none"}),Promise.all([this.backgroundCanvas,this.canvas,this.transientCanvas].map(t=>t.ready)).then(()=>this.canvasReady=!0)):(console.error(`Create graph failed. The container for graph ${t} is not exist.`),this.destroy())}changeRenderer(e){this.rendererType=e||"canvas";{e=this.rendererType;var n=this.canvas;let t;switch(e.toLowerCase()){case"svg":t=new kd;break;case"webgl-3d":case"webgl":(t=new hv).registerPlugin(new Av);break;default:t=new Ih}n.setRenderer(t)}}initHooks(){this.hooks={init:new HA({name:"init"}),datachange:new HA({name:"datachange"}),itemchange:new HA({name:"itemchange"}),render:new HA({name:"render"}),layout:new HA({name:"layout"}),viewportchange:new HA({name:"viewport"}),modechange:new HA({name:"modechange"}),behaviorchange:new HA({name:"behaviorchange"}),itemstatechange:new HA({name:"itemstatechange"}),itemvisibilitychange:new HA({name:"itemvisibilitychange"}),transientupdate:new HA({name:"transientupdate"}),pluginchange:new HA({name:"pluginchange"}),themechange:new HA({name:"init"}),destroy:new HA({name:"destroy"})}}updateSpecification(t){return Object.assign(this.specification,t)}updateTheme(t){this.specification.theme=t,this.hooks.themechange.emit({canvases:{background:this.backgroundCanvas,main:this.canvas,transient:this.transientCanvas}}),this.hooks.themechange.emit({theme:this.themeController.specification})}getSpecification(){return this.specification}read(e){return s(this,void 0,void 0,function*(){this.hooks.datachange.emit({data:e,type:"replace"});var t=()=>s(this,void 0,void 0,function*(){this.hooks.render.emit({graphCore:this.dataController.graphCore,theme:this.themeController.specification,transientCanvas:this.transientCanvas}),this.emit("afterrender"),yield this.layout()});this.canvasReady||(yield Promise.all([this.backgroundCanvas,this.canvas,this.transientCanvas].map(t=>t.ready))),yield t()})}changeData(t,e="mergeReplace"){return s(this,void 0,void 0,function*(){this.hooks.datachange.emit({data:t,type:e}),this.hooks.render.emit({graphCore:this.dataController.graphCore,theme:this.themeController.specification,transientCanvas:this.transientCanvas}),this.emit("afterrender"),yield this.layout()})}clear(){}getViewportCenter(){var{width:t,height:e}=this.canvas.getConfig();return{x:t/2,y:e/2}}transform(t,e){return s(this,void 0,void 0,function*(){yield this.hooks.viewportchange.emitLinearAsync({transform:t,effectTiming:e}),this.emit("viewportchange",t)})}stopTransformTransition(){this.canvas.getCamera().cancelLandmarkAnimation()}translate(t,e){return s(this,void 0,void 0,function*(){yield this.transform({translate:t},e)})}translateTo({x:n,y:r},i){return s(this,void 0,void 0,function*(){var{x:t,y:e}=this.getViewportCenter();yield this.translate({dx:t-n,dy:e-r},i)})}zoom(t,e,n){return s(this,void 0,void 0,function*(){yield this.transform({zoom:{ratio:t},origin:e},n)})}zoomTo(t,e,n){return s(this,void 0,void 0,function*(){yield this.zoom(t/this.canvas.getCamera().getZoom(),e,n)})}getZoom(){return this.canvas.getCamera().getZoom()}rotate(t,e,n){return s(this,void 0,void 0,function*(){yield this.transform({rotate:{angle:t},origin:e},n)})}rotateTo(t,e,n){return s(this,void 0,void 0,function*(){yield this.rotate(t-this.canvas.getCamera().getRoll(),e,n)})}fitView(d,f){return s(this,void 0,void 0,function*(){var{padding:t,rules:e}=d||{},[t,n,r,i]=t?Jv(t):[0,0,0,0],{direction:e="both",ratioRule:o="min"}=e||{},{center:[a,s],halfExtents:l}=this.canvas.document.documentElement.getBounds(),a=this.canvas.canvas2Viewport({x:a,y:s}),{width:s,height:u}=this.canvas.getConfig(),c=2*l[0],l=2*l[1],i=this.canvas.viewport2Canvas({x:i,y:t}),t=this.canvas.viewport2Canvas({x:s-n,y:u-r}),n=(t.x-i.x)/c,r=(t.y-i.y)/l;let h;h="x"===e?n:"y"===e?r:"max"===o?Math.max(n,r):Math.min(n,r),yield this.transform({translate:{dx:s/2-a.x,dy:u/2-a.y},zoom:{ratio:h}},f)})}fitCenter(n){return s(this,void 0,void 0,function*(){var[t,e]=this.canvas.document.documentElement.getBounds()["center"];yield this.translateTo(this.canvas.canvas2Viewport({x:t,y:e}),n)})}focusItem(o,a){return s(this,void 0,void 0,function*(){let t=null;for(const i of Ou(o)?o:[o]){var e=this.itemController.getItemById(i);e&&(e=e.group.getBounds(),t?t.add(e):t=e)}var n,r;t&&([n,r]=t["center"],yield this.translateTo(this.canvas.canvas2Viewport({x:n,y:r}),a))})}getSize(){var{width:t=500,height:e=500}=this.specification;return[t,e]}setSize(t){!Ou(t)||t.length<2?console.warn(`Failed to setSize. The parameter size: ${t} is invalid. It must be an array with 2 number elements.`):(this.specification.width=t[0],this.specification.height=t[1],this.canvas.resize(t[0],t[1]))}getCanvasByViewport(t){return this.canvas.viewport2Canvas(t)}getViewportByCanvas(t){return this.canvas.canvas2Viewport(t)}getClientByCanvas(t){t=this.canvas.canvas2Viewport(t);return this.canvas.viewport2Client(t)}getCanvasByClient(t){t=this.canvas.client2Viewport(t);return this.canvas.viewport2Canvas(t)}getNodeData(t){var t=ku(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("node",t))?void 0:t[0]}getEdgeData(t){var t=ku(t)||Fu(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("edge",t))?void 0:t[0]}getComboData(t){var t=ku(t)||Fu(t)?[t]:t;return null==(t=this.dataController.findData("combo",t))?void 0:t[0]}getAllNodesData(){return this.dataController.findAllData("node")}getAllEdgesData(){return this.dataController.findAllData("edge")}getAllCombosData(){return this.dataController.findAllData("combo")}getRelatedEdgesData(t,e="both"){return this.dataController.findRelatedEdgeIds(t,e)}getNeighborNodesData(t,e="both"){return this.dataController.findNeighborNodeIds(t,e)}findIdByState(t,e,n=!0,r){let i=this.itemController.findIdByState(t,e,n);if(r){const o="node"===t?this.getNodeData:this.getEdgeData;i=i.filter(t=>r(o(t)))}return i}addData(e,n,t){const r=this.dataController["graphCore"],i=this.themeController["specification"];r.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:e,changes:r.reduceChanges(t.changes),graphCore:r,theme:i}),this.emit("afteritemchange",{type:e,action:"add",models:n}))});var o=Ou(n)?n:[n],a={nodes:[],edges:[],combos:[]},a=(a[e+"s"]=o,this.hooks.datachange.emit({data:a,type:"union"}),this.dataController.findData(e,o.map(t=>t.id)));return Ou(n)?a:a[0]}removeData(e,n,t){var r=Ou(n)?n:[n],i={nodes:[],edges:[],combos:[]};const{userGraphCore:o,graphCore:a}=this.dataController,s=this.themeController["specification"],l="edge"===e?o.getEdge:o.getNode;i[e+"s"]=r.map(t=>l.bind(o)(t)),a.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:e,changes:t.changes,graphCore:a,theme:s}),this.emit("afteritemchange",{type:e,action:"remove",ids:n}))}),this.hooks.datachange.emit({data:i,type:"remove"})}updateData(e,n,t){var r=Ou(n)?n:[n],i={nodes:[],edges:[],combos:[]};i[e+"s"]=r;const o=this.dataController["graphCore"],a=this.themeController["specification"];o.once("changed",t=>{this.hooks.itemchange.emit({type:e,changes:t.changes,graphCore:o,theme:a}),this.emit("afteritemchange",{type:e,action:"update",models:n})}),this.hooks.datachange.emit({data:i,type:"update"});i=this.dataController.findData(e,r.map(t=>t.id));return Ou(n)?i:i[0]}updateNodePosition(e,t){var n=Ou(e)?e:[e];const r=this.dataController["graphCore"],i=this.themeController["specification"];r.once("changed",t=>{t.changes.length&&(this.hooks.itemchange.emit({type:"node",changes:t.changes,graphCore:r,theme:i,action:"updateNodePosition"}),this.emit("afteritemchange",{type:"node",action:"updateNodePosition",models:e}))}),this.hooks.datachange.emit({data:{nodes:n,edges:[]},type:"update"});n=this.dataController.findData("node",n.map(t=>t.id));return Ou(e)?n:n[0]}showItem(t,e){t=Ou(t)?t:[t];this.hooks.itemvisibilitychange.emit({ids:t,value:!0,animate:!e})}hideItem(t,e){t=Ou(t)?t:[t];this.hooks.itemvisibilitychange.emit({ids:t,value:!1,animate:!e})}setItemState(t,e,n){var r=Ou(t)?t:[t],i=Ou(e)?e:[e];this.hooks.itemstatechange.emit({ids:r,states:i,value:n}),this.emit("afteritemstatechange",{ids:t,states:e,value:n})}getItemState(t,e){return this.itemController.getItemState(t,e)}clearItemState(t,e){var n=Ou(t)?t:[t];this.hooks.itemstatechange.emit({ids:n,states:e,value:!1}),this.emit("afteritemstatechange",{ids:t,states:e,value:!1})}getRenderBBox(t){return t?this.itemController.getItemBBox(t):this.canvas.getRoot().getRenderBounds()}getItemVisible(t){return this.itemController.getItemVisible(t)}createCombo(t,e,n){}uncombo(t,e){}collapseCombo(t,e){}expandCombo(t,e){}layout(n){return s(this,void 0,void 0,function*(){var t=this.dataController["graphCore"],e=Object.assign(Object.assign({},this.getSpecification().layout),n);n||this.getSpecification().layout||(t.getAllNodes().every(t=>Pu(t.data.x)&&Pu(t.data.y))?e.type="grid":e.execute=t=>s(this,void 0,void 0,function*(){return{nodes:t.getAllNodes().map(t=>({id:t.id,data:{x:Number(t.data.x)||0,y:Number(t.data.y)||0}})),edges:[]}})),yield this.hooks.layout.emitLinearAsync({graphCore:t,options:e}),this.emit("afterlayout")})}stopLayout(){this.layoutController.stopLayout()}setMode(t){this.hooks.modechange.emit({mode:t})}addBehaviors(t,e){e=Ou(e)?e:[e];const n=Ou(t)?t:[t];this.hooks.behaviorchange.emit({action:"add",modes:e,behaviors:n}),e.forEach(t=>{this.specification.modes[t]=this.specification.modes[t].concat(n)})}removeBehaviors(t,e){e=Ou(e)?e:[e];this.hooks.behaviorchange.emit({action:"remove",modes:e,behaviors:t}),e.forEach(n=>{t.forEach(e=>{var t=this.specification.modes[n].find(t=>Iu(t)&&t.key===e),t=this.specification.modes[n].indexOf(t);this.specification.modes[n].splice(t,1)})})}updateBehavior(t,e){this.hooks.behaviorchange.emit({action:"update",modes:[e],behaviors:[t]})}addPlugins(t){t=Ou(t)?t:[t];this.specification.plugins||(this.specification.plugins=[]);const n=this.specification.plugins,r=[];t.forEach(e=>{n.find(t=>"string"!=typeof t&&"string"!=typeof e&&t.key===e.key)?console.warn(`Add plugin with key ${e.key} failed, the key is duplicated to the existing plugins on the graph.`):r.push(e)}),this.specification.plugins=n.concat(r),this.hooks.pluginchange.emit({action:"add",plugins:r})}removePlugins(e){this.hooks.pluginchange.emit({action:"remove",plugins:e});var t=this.specification["plugins"];this.specification.plugins=null==t?void 0:t.filter(t=>Iu(t)?!e.includes(t.key):!e.includes(t))}updatePlugin(t){const e=t["key"];var n,r,i;e?(n=this.specification.plugins,n?(r=null==n?void 0:n.find(t=>"string"==typeof t?t===e:t.key===e))?(i=n.indexOf(r),n[i]=Object.assign(Object.assign({},r),t),this.hooks.pluginchange.emit({action:"update",plugins:[t]})):console.warn("Update plugin failed, the key for the plugin to be updated should be assign."):console.warn("Update plugin failed, the plugin to be updated does not exist.")):console.warn("Update plugin failed, the key for the plugin to be updated should be assign.")}drawTransient(t,e,n){return this.hooks.transientupdate.emit({type:t,id:e,config:n,canvas:this.transientCanvas}),this.itemController.getTransient(String(e))}destroy(t){setTimeout(()=>{this.canvas.destroy(),this.backgroundCanvas.destroy(),this.transientCanvas.destroy(),null!=t&&t()},500),this.hooks.destroy.emit({}),this.destroyed=!0}}r=XA,YA=mA,Object.keys(YA).forEach(e=>{_A.useLib[e]=Object.assign({},_A.useLib[e],YA[e]||{}),Object.keys(_A.useLib[e]).forEach(t=>{_A.useLib[e][t].type=t})});var YA,t=r,e1={Graph:t,stdLib:mA};N.Graph=t,N.default=e1,N.isImmediatelyInvokedLayoutOptions=BA,N.isLayoutWorkerized=FA,N.stdLib=mA,Object.defineProperty(N,"__esModule",{value:!0})});
@@ -1,4 +1,4 @@
1
- import { isFunction } from 'util';
1
+ import { isFunction } from '@antv/util';
2
2
  /**
3
3
  * Get one extension from a (std)lib.
4
4
  * @param config extension's config
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"src/","sources":["util/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAkC,EAClC,GAAG,EACH,GAAmB,EACnB,EAAE;;IACF,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,2CAA2C;IAC3C,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAc,CAAC,IAAI,CAAC;IACxE,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,MAAM,CAAC,0CAAG,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAmB,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC"}
1
+ {"version":3,"file":"extension.js","sourceRoot":"src/","sources":["util/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAkC,EAClC,GAAG,EACH,GAAmB,EACnB,EAAE;;IACF,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,2CAA2C;IAC3C,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAc,CAAC,IAAI,CAAC;IACxE,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,MAAM,CAAC,0CAAG,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAmB,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCatExtensions = exports.getExtension = void 0;
4
- const util_1 = require("util");
4
+ const util_1 = require("@antv/util");
5
5
  /**
6
6
  * Get one extension from a (std)lib.
7
7
  * @param config extension's config
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"src/","sources":["util/extension.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAGlC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAC1B,MAAkC,EAClC,GAAG,EACH,GAAmB,EACnB,EAAE;;IACF,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,2CAA2C;IAC3C,IAAI,IAAA,iBAAU,EAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAc,CAAC,IAAI,CAAC;IACxE,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,MAAM,CAAC,0CAAG,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEK,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAmB,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B"}
1
+ {"version":3,"file":"extension.js","sourceRoot":"src/","sources":["util/extension.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AAGxC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAC1B,MAAkC,EAClC,GAAG,EACH,GAAmB,EACnB,EAAE;;IACF,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,2CAA2C;IAC3C,IAAI,IAAA,iBAAU,EAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAc,CAAC,IAAI,CAAC;IACxE,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,MAAM,CAAC,0CAAG,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEK,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAmB,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g6",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.3",
4
4
  "description": "A Graph Visualization Framework in JavaScript",
5
5
  "keywords": [
6
6
  "antv",
@@ -1,4 +1,4 @@
1
- import { isFunction } from 'util';
1
+ import { isFunction } from '@antv/util';
2
2
  import { StdLibCategory } from '../types/stdlib';
3
3
 
4
4
  /**