-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathinet-henge.min.js
More file actions
3 lines (3 loc) · 32 KB
/
inet-henge.min.js
File metadata and controls
3 lines (3 loc) · 32 KB
1
2
3
/*! For license information please see inet-henge.min.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("d3"),require("cola"));else if("function"==typeof define&&define.amd)define(["d3","cola"],e);else{var s="object"==typeof exports?e(require("d3"),require("cola")):e(t.d3,t.cola);for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(self,(t,e)=>(()=>{var s={21:function(t,e,s){var i;t.exports=(i=i||function(t){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),"undefined"!=typeof self&&self.crypto&&(e=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(e=globalThis.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&void 0!==s.g&&s.g.crypto&&(e=s.g.crypto),!e)try{e=s(477)}catch(t){}var i=function(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},n=Object.create||function(){function t(){}return function(e){var s;return t.prototype=e,s=new t,t.prototype=null,s}}(),r={},a=r.lib={},o=a.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},h=a.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,s=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var r=0;r<n;r++){var a=s[r>>>2]>>>24-r%4*8&255;e[i+r>>>2]|=a<<24-(i+r)%4*8}else for(var o=0;o<n;o+=4)e[i+o>>>2]=s[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,s=this.sigBytes;e[s>>>2]&=4294967295<<32-s%4*8,e.length=t.ceil(s/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],s=0;s<t;s+=4)e.push(i());return new h.init(e,t)}}),l=r.enc={},c=l.Hex={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],n=0;n<s;n++){var r=e[n>>>2]>>>24-n%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i+=2)s[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new h.init(s,e/2)}},d=l.Latin1={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],n=0;n<s;n++){var r=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new h.init(s,e)}},u=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(d.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return d.parse(unescape(encodeURIComponent(t)))}},p=a.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var s,i=this._data,n=i.words,r=i.sigBytes,a=this.blockSize,o=r/(4*a),l=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,c=t.min(4*l,r);if(l){for(var d=0;d<l;d+=a)this._doProcessBlock(n,d);s=n.splice(0,l),i.sigBytes-=c}return new h.init(s,c)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(a.Hasher=p.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,s){return new t.init(s).finalize(e)}},_createHmacHelper:function(t){return function(e,s){return new f.HMAC.init(t,s).finalize(e)}}}),r.algo={});return r}(Math),i)},109:t=>{"use strict";t.exports=e},477:()=>{},636:function(t,e,s){var i;t.exports=(i=s(21),function(t){var e=i,s=e.lib,n=s.WordArray,r=s.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var h=a.MD5=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var i=e+s,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var r=this._hash.words,a=t[e+0],h=t[e+1],p=t[e+2],f=t[e+3],g=t[e+4],m=t[e+5],y=t[e+6],x=t[e+7],v=t[e+8],b=t[e+9],k=t[e+10],w=t[e+11],$=t[e+12],C=t[e+13],M=t[e+14],O=t[e+15],B=r[0],T=r[1],I=r[2],S=r[3];B=l(B,T,I,S,a,7,o[0]),S=l(S,B,T,I,h,12,o[1]),I=l(I,S,B,T,p,17,o[2]),T=l(T,I,S,B,f,22,o[3]),B=l(B,T,I,S,g,7,o[4]),S=l(S,B,T,I,m,12,o[5]),I=l(I,S,B,T,y,17,o[6]),T=l(T,I,S,B,x,22,o[7]),B=l(B,T,I,S,v,7,o[8]),S=l(S,B,T,I,b,12,o[9]),I=l(I,S,B,T,k,17,o[10]),T=l(T,I,S,B,w,22,o[11]),B=l(B,T,I,S,$,7,o[12]),S=l(S,B,T,I,C,12,o[13]),I=l(I,S,B,T,M,17,o[14]),B=c(B,T=l(T,I,S,B,O,22,o[15]),I,S,h,5,o[16]),S=c(S,B,T,I,y,9,o[17]),I=c(I,S,B,T,w,14,o[18]),T=c(T,I,S,B,a,20,o[19]),B=c(B,T,I,S,m,5,o[20]),S=c(S,B,T,I,k,9,o[21]),I=c(I,S,B,T,O,14,o[22]),T=c(T,I,S,B,g,20,o[23]),B=c(B,T,I,S,b,5,o[24]),S=c(S,B,T,I,M,9,o[25]),I=c(I,S,B,T,f,14,o[26]),T=c(T,I,S,B,v,20,o[27]),B=c(B,T,I,S,C,5,o[28]),S=c(S,B,T,I,p,9,o[29]),I=c(I,S,B,T,x,14,o[30]),B=d(B,T=c(T,I,S,B,$,20,o[31]),I,S,m,4,o[32]),S=d(S,B,T,I,v,11,o[33]),I=d(I,S,B,T,w,16,o[34]),T=d(T,I,S,B,M,23,o[35]),B=d(B,T,I,S,h,4,o[36]),S=d(S,B,T,I,g,11,o[37]),I=d(I,S,B,T,x,16,o[38]),T=d(T,I,S,B,k,23,o[39]),B=d(B,T,I,S,C,4,o[40]),S=d(S,B,T,I,a,11,o[41]),I=d(I,S,B,T,f,16,o[42]),T=d(T,I,S,B,y,23,o[43]),B=d(B,T,I,S,b,4,o[44]),S=d(S,B,T,I,$,11,o[45]),I=d(I,S,B,T,O,16,o[46]),B=u(B,T=d(T,I,S,B,p,23,o[47]),I,S,a,6,o[48]),S=u(S,B,T,I,x,10,o[49]),I=u(I,S,B,T,M,15,o[50]),T=u(T,I,S,B,m,21,o[51]),B=u(B,T,I,S,$,6,o[52]),S=u(S,B,T,I,f,10,o[53]),I=u(I,S,B,T,k,15,o[54]),T=u(T,I,S,B,h,21,o[55]),B=u(B,T,I,S,v,6,o[56]),S=u(S,B,T,I,O,10,o[57]),I=u(I,S,B,T,y,15,o[58]),T=u(T,I,S,B,C,21,o[59]),B=u(B,T,I,S,g,6,o[60]),S=u(S,B,T,I,w,10,o[61]),I=u(I,S,B,T,p,15,o[62]),T=u(T,I,S,B,b,21,o[63]),r[0]=r[0]+B|0,r[1]=r[1]+T|0,r[2]=r[2]+I|0,r[3]=r[3]+S|0},_doFinalize:function(){var e=this._data,s=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;s[n>>>5]|=128<<24-n%32;var r=t.floor(i/4294967296),a=i;s[15+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),s[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(s.length+1),this._process();for(var o=this._hash,h=o.words,l=0;l<4;l++){var c=h[l];h[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function l(t,e,s,i,n,r,a){var o=t+(e&s|~e&i)+n+a;return(o<<r|o>>>32-r)+e}function c(t,e,s,i,n,r,a){var o=t+(e&i|s&~i)+n+a;return(o<<r|o>>>32-r)+e}function d(t,e,s,i,n,r,a){var o=t+(e^s^i)+n+a;return(o<<r|o>>>32-r)+e}function u(t,e,s,i,n,r,a){var o=t+(s^(e|~i))+n+a;return(o<<r|o>>>32-r)+e}e.MD5=r._createHelper(h),e.HmacMD5=r._createHmacHelper(h)}(Math),i.MD5)},811:()=>{function t(t,e,s){void 0===s&&(s=1),function(t,e,s,i){var n=function(t,e){var s={},i=function(t,e){void 0===s[t]&&(s[t]={}),s[t][e]={}};return t.forEach(function(t){var s=e.getSourceIndex(t),n=e.getTargetIndex(t);i(s,n),i(n,s)}),s}(t,i);t.forEach(function(t){var s=n[i.getSourceIndex(t)],r=n[i.getTargetIndex(t)];i.setLength(t,1+e*function(t,e){return Math.min(Object.keys(t).length,Object.keys(e).length)<1.1?0:1-function(t,e){var s=0;for(var i in t)void 0!==e[i]&&++s;return s}(t,e)/function(t,e){var s={};for(var i in t)s[i]={};for(var i in e)s[i]={};return Object.keys(s).length}(t,e)}(s,r))})}(t,s,0,e)}cola.Layout.prototype.jaccardLinkLengths=function(e,s){var i=this;return void 0===s&&(s=1),this.linkDistance(function(t){return e*t.length}),this._linkLengthCalculator=function(){return t(i._links,i.linkAccessor,s)},this}},893:e=>{"use strict";e.exports=t}},i={};function n(t){var e=i[t];if(void 0!==e)return e.exports;var r=i[t]={exports:{}};return s[t].call(r.exports,r,r.exports,n),r.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{Diagram:()=>L}),n(811);var t=n(893);class e{constructor(t,e){this.id=e,this.links=t,this.color="#7a4e4e",this.width=2,this.space=4}static divide(t){e.groups={};for(const s of t)if(s.bundle){const t=this.groupKey(s);(e.groups[t]||(e.groups[t]=[])).push(s.id)}return Object.values(e.groups).map((s,i)=>new e(s.map(e=>t[e]),i))}static groupKey(t){return JSON.stringify([t.source,t.target,t.bundle])}static render(t,e){return t.selectAll(".bundle").data(e).enter().append("g").attr("class",t=>t.class()).append("path").attr("d",t=>t.d()).attr("stroke",t=>t.color).attr("stroke-width",t=>t.width).attr("fill","none").attr("id",t=>t.bundleId())}static reset(){e.groups=null}static sortByBundle(t){return t.sort((t,e)=>{switch(!0){case!!t.bundle&&!e.bundle:return-1;case!t.bundle&&!!e.bundle:return 1;case!t.bundle&&!e.bundle:return 0;case t.bundle.toString()<e.bundle.toString():return-1;case t.bundle.toString()>e.bundle.toString():return 1;default:return 0}})}d(){const t=this.links[0].centerCoordinates(),e=this.links[this.links.length-1].centerCoordinates(),s=Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2));if(0===s)return"";const i=this.links[0].angle()+90,n=[(t[0]-e[0])*this.space/s+t[0],(t[1]-e[1])*this.space/s+t[1]],r=[(e[0]-t[0])*this.space/s+e[0],(e[1]-t[1])*this.space/s+e[1]];return`M ${n[0]} ${n[1]} A ${s/2+10},5 ${i} 1,0 ${r[0]} ${r[1]}`}shiftMultiplier(){if(!this._shiftMultiplier){const t=this.links[0].group()||[];this._shiftMultiplier=this.links.reduce((e,s)=>e+(s.id-(t.length-1)/2),0)/2}return this._shiftMultiplier}static shiftBundle(t){t.attr("d",t=>t.d())}class(){return this.links[0].class().replace(/^link/,"bundle")}bundleId(){return`bundle${this.id}`}}function s(t){return t.replace(" ","-").toLowerCase()}class i{constructor(t,e){this.name=t,this.options=e,this.padding=e.padding}transform(){return`translate(${this.bounds.x}, ${this.bounds.y})`}groupWidth(){return this.bounds.width()}groupHeight(){return this.bounds.height()}static divide(t,e,s){const i={},n=(t,e,n)=>{const r=`${n}:${t}`;i[r]=i[r]||new d(t,s),i[r].push(e)};return t.forEach(t=>{let s=null;e&&(s=t.name.match(e),s&&n(s[1]||s[0],t)),t.group.forEach(e=>n(e,t,String(s)))}),Object.values(i)}static render(t,e){const i=t.selectAll(".group").data(e).enter().append("g").attr("class",t=>`group ${s(t.name)}`).attr("transform",t=>t.transform());return i.append("rect").attr("rx",8).attr("ry",8).attr("width",t=>t.groupWidth()).attr("height",t=>t.groupHeight()).style("fill",(t,e)=>t.options.color(e.toString())),i.append("text").text(t=>t.name),i}static tick(t){t.attr("transform",t=>t.transform()),t.selectAll("rect").attr("width",t=>t.groupWidth()).attr("height",t=>t.groupHeight())}static setPosition(t,e){t.attr("transform",(t,s)=>(t.bounds.x=e[s].x,t.bounds.y=e[s].y,t.transform())),t.selectAll("rect").attr("width",(t,s)=>e[s].width).attr("height",(t,s)=>e[s].height)}}const a=t=>class extends t{constructor(t,e){super(t,e),this.leaves=[]}push(t){this.leaves.push(t.id)}},o=e=>class extends e{constructor(e,s){super(e,s),this.dispatch=t.dispatch("rendered")}static render(t,e){const s=super.render(t,e);return s.each(function(t){t.dispatch.rendered(this)}),s}on(t,e){this.dispatch.on(t,e)}},h=t=>{class e extends t{constructor(t,s){super(t,s);for(const i of e.pluginConstructors)i.bind(this)(t,s)}static registerConstructor(t){e.pluginConstructors.push(t)}}return e.pluginConstructors=[],e};class l extends(a(i)){}class c extends(o(l)){}class d extends(h(c)){}class u{constructor(t,e){this.data=t,this.extraKey=e}get(t){return this.slice(t).filter(t=>"string"==typeof t.value)}slice(t){return this.data?this.extraKey?this.sliceWithExtraKey(t):this.sliceWithoutExtraKey(t):[]}sliceWithExtraKey(t){const e=[];return t.forEach(t=>{this.data[t]&&this.data[t][this.extraKey]&&e.push({class:t,value:this.data[t][this.extraKey]})}),e}sliceWithoutExtraKey(t){const e=[];return t.forEach(t=>{this.data[t]&&e.push({class:t,value:this.data[t]})}),e}}class p{constructor(t,e,s){this.id=e,this.options=s,this.name=t.name,this.group="string"==typeof t.group?[t.group]:t.group||[],this.icon=t.icon,this.metaList=new u(t.meta).get(s.metaKeys),this.meta=t.meta,this.extraClass=t.class||"",this.width=s.width||60,this.height=s.height||40,this.padding=3,this.tspanOffset="1.1em",this.register(e)}register(t){y.all=y.all||{},y.all[this.name]=t}transform(){return`translate(${this.x-this.width/2+this.padding}, ${this.y-this.height/2+this.padding})`}nodeWidth(){return this.width-2*this.padding}nodeHeight(){return this.height-2*this.padding}xForText(){return this.nodeWidth()/2}yForText(){return this.height/2}static idByName(t){if(void 0===y.all[t])throw`Unknown node "${t}"`;return y.all[t]}nodeId(){return s(this.name)}static render(t,e){const s=t.selectAll(".node").data(e).enter().append("g").attr("id",t=>t.nodeId()).attr("name",t=>t.name).attr("transform",t=>t.transform());return s.each(function(t){t.icon?y.appendImage(this):y.appendRect(this),y.appendText(this)}),s}static appendText(e){const s=t.select(e).append("text").attr("text-anchor","middle").attr("x",t=>t.xForText()).attr("y",t=>t.yForText());s.append("tspan").text(t=>t.name).attr("x",t=>t.xForText()),s.each(t=>{t.options.tooltip||y.appendMetaText(s,t.metaList)})}static appendMetaText(t,e){e.forEach(e=>{t.append("tspan").attr("x",t=>t.xForText()).attr("dy",t=>t.tspanOffset).attr("class",e.class).text(e.value)})}static appendImage(e){t.select(e).attr("class",t=>`node image ${s(t.name)} ${t.extraClass}`).append("image").attr("xlink:href",t=>t.icon).attr("width",t=>t.nodeWidth()).attr("height",t=>t.nodeHeight())}static appendRect(e){t.select(e).attr("class",t=>`node rect ${s(t.name)} ${t.extraClass}`).append("rect").attr("width",t=>t.nodeWidth()).attr("height",t=>t.nodeHeight()).attr("rx",5).attr("ry",5).style("fill",t=>t.options.color(void 0))}static tick(t){t.attr("transform",t=>t.transform())}static setPosition(t,e){t.attr("transform",(t,s)=>{var i,n,r,a;return null!==(null===(i=e[s])||void 0===i?void 0:i.x)&&void 0!==(null===(n=e[s])||void 0===n?void 0:n.x)&&null!==(null===(r=e[s])||void 0===r?void 0:r.y)&&void 0!==(null===(a=e[s])||void 0===a?void 0:a.y)&&(t.x=e[s].x,t.y=e[s].y),t.transform()})}static reset(){y.all=null}}const f=e=>class extends e{constructor(e,s,i){super(e,s,i),this.dispatch=t.dispatch("rendered")}static render(t,e){const s=super.render(t,e);return s.each(function(t){t.dispatch.rendered(this)}),s}on(t,e){this.dispatch.on(t,e)}},g=t=>{class e extends t{constructor(t,s,i){super(t,s,i);for(const n of e.pluginConstructors)n.bind(this)(t,s,i)}static registerConstructor(t){e.pluginConstructors.push(t)}}return e.pluginConstructors=[],e};class m extends(f(p)){}class y extends(g(m)){}class x{constructor(t,e,s){this.id=e,this.options=s,this.source=y.idByName(t.source),this.target=y.idByName(t.target),this.bundle=t.bundle,this.metaList=new u(t.meta).get(s.metaKeys),this.sourceMeta=new u(t.meta,"source").get(s.metaKeys),this.targetMeta=new u(t.meta,"target").get(s.metaKeys),this.extraClass=t.class||"","function"==typeof s.linkWidth?this.width=s.linkWidth(t.meta)||3:this.width=s.linkWidth||3,this.defaultMargin=15,this.labelXOffset=20,this.labelYOffset=1.5,this.color="#7a4e4e",this.register(e)}register(t){w.groups=w.groups||{};const e=[this.source,this.target].sort().toString();(w.groups[e]||(w.groups[e]=[])).push(t)}isLabelledPath(){return this.metaList.length>0}isReversePath(){return this.targetMeta.length>0}d(){return`M ${this.source.x} ${this.source.y} L ${this.target.x} ${this.target.y}`}pathId(){return`path${this.id}`}linkId(){return`link${this.id}`}margin(){if(!this._margin){const t=window.getComputedStyle(document.getElementById(this.linkId())).margin;this._margin=t&&"0px"!==t?parseInt(t):this.defaultMargin}return this._margin}isLabelVisible(){const e=document.getElementById(this.pathId()).getTotalLength(),s=Array.from(document.getElementsByClassName(this.pathId())).some(t=>{const s=t.firstChild;return s.classList.contains("center")?s.getComputedTextLength()>e:s.getComputedTextLength()+this.labelXOffset>e});return t.selectAll(`text.${this.pathId()}`).classed("short",s),w.scale>1.5&&!s}group(){return w.groups[[this.source.id,this.target.id].sort().toString()]}tspanXOffset(){switch(!0){case this.isLabelledPath():return 0;case this.isReversePath():return-this.labelXOffset;default:return this.labelXOffset}}tspanYOffset(){return this.isLabelledPath()?.7-this.labelYOffset+"em":`${this.labelYOffset}em`}rotate(t){return this.source.x>this.target.x?`rotate(180 ${t.x+t.width/2} ${t.y+t.height/2})`:"rotate(0)"}split(){if(!this.metaList&&!this.sourceMeta&&!this.targetMeta)return[this];const t=[];return["metaList","sourceMeta","targetMeta"].forEach((e,s,i)=>{if(this[e]){const s=Object.assign(Object.create(this),this);i.filter(t=>t!==e).forEach(t=>s[t]=[]),t.push(s)}}),t}hasMeta(){return this.metaList.length>0||this.sourceMeta.length>0||this.targetMeta.length>0}class(){return`link ${s(this.source.name)} ${s(this.target.name)} ${s(this.source.name)}-${s(this.target.name)} ${this.extraClass}`}centerCoordinates(){const e=t.select(`.link #${this.linkId()}`).node(),s=e.getBBox(),i=e.transform.baseVal.consolidate();return[s.x+s.width/2+((null==i?void 0:i.matrix.e)||0),s.y+s.height/2+((null==i?void 0:i.matrix.f)||0)]}angle(){const e=t.select(`.link #${this.linkId()}`).node();return 180*Math.atan2(e.y2.baseVal.value-e.y1.baseVal.value,e.x2.baseVal.value-e.x1.baseVal.value)/Math.PI}static render(t,e,s){const i=t.selectAll(".link").data(s).enter().append("g").attr("class",t=>t.class()),n=i.append("line").attr("x1",t=>t.source.x).attr("y1",t=>t.source.y).attr("x2",t=>t.target.x).attr("y2",t=>t.target.y).attr("stroke",t=>t.color).attr("stroke-width",t=>t.width).attr("id",t=>t.linkId()).on("mouseover.line",t=>a.selectAll(`text.${t.pathId()}`).classed("hover",!0)).on("mouseout.line",t=>a.selectAll(`text.${t.pathId()}`).classed("hover",!1)),r=i.append("path").attr("d",t=>t.d()).attr("id",t=>t.pathId()),a=e.selectAll(".link").data(s).enter().append("g").attr("class",t=>t.class()),o=a.selectAll("text").data(t=>t.split().filter(t=>t.hasMeta())).enter().append("text").attr("class",t=>t.pathId());return o.append("textPath").attr("xlink:href",t=>`#${t.pathId()}`).each(function(t){w.appendMetaText(this,t.metaList),w.appendMetaText(this,t.sourceMeta),w.appendMetaText(this,t.targetMeta),t.isLabelledPath()&&w.center(this),t.isReversePath()&&w.theOtherEnd(this)}),w.zoom(),[n,r,o]}static theOtherEnd(e){t.select(e).attr("class","reverse").attr("text-anchor","end").attr("startOffset","100%")}static center(e){t.select(e).attr("class","center").attr("text-anchor","middle").attr("startOffset","50%")}static appendMetaText(e,s){s.forEach(s=>{t.select(e).append("tspan").attr("x",t=>t.tspanXOffset()).attr("dy",t=>t.tspanYOffset()).attr("class",s.class).text(s.value)})}static tick(e,s,i){e.attr("x1",t=>t.source.x).attr("y1",t=>t.source.y).attr("x2",t=>t.target.x).attr("y2",t=>t.target.y),s&&s.attr("d",t=>t.d()),i&&i.attr("transform",function(t){return t.rotate(this.getBBox())}),t.selectAll(".link text").style("visibility",t=>t.isLabelVisible()?"visible":"hidden")}static zoom(e){w.scale=e,t.selectAll(".link text").style("visibility",t=>t.isLabelVisible()?"visible":"hidden")}static setPosition(t,e){t.attr("x1",(t,s)=>e[s].x1).attr("y1",(t,s)=>e[s].y1).attr("x2",(t,s)=>e[s].x2).attr("y2",(t,s)=>e[s].y2)}shiftMultiplier(){if(!this._shiftMultiplier){const t=this.group()||[];this._shiftMultiplier=t.indexOf(this.id)-(t.length-1)/2}return this._shiftMultiplier}static shiftBundle(t,s,i,n){const r=t=>t.shiftBundle(t.shiftMultiplier());t.attr("transform",r),s.attr("transform",r),i.attr("transform",r),e.shiftBundle(n)}shiftBundle(t){const e=this.margin()*t,s=this.target.x-this.source.x,i=this.target.y-this.source.y,n=Math.sqrt(Math.pow(s,2)+Math.pow(i,2));return`translate(${-e*i/n}, ${e*s/n})`}static reset(){w.groups=null}}const v=e=>class extends e{constructor(e,s,i){super(e,s,i),this.dispatch=t.dispatch("rendered")}static render(t,e,s){const[i,n,r]=super.render(t,e,s);return i.each(function(t){t.dispatch.rendered(this)}),[i,n,r]}on(t,e){this.dispatch.on(t,e)}},b=t=>{class e extends t{constructor(t,s,i){super(t,s,i);for(const n of e.pluginConstructors)n.bind(this)(t,s,i)}static registerConstructor(t){e.pluginConstructors.push(t)}}return e.pluginConstructors=[],e};class k extends(v(x)){}class w extends(b(k)){}class ${constructor(t,e={}){this.eventType=t,this.offsetX=void 0!==e.offsetX?e.offsetX:30,this.visibility="hidden"}tspanOffsetY(t){return t?"2em":"1.1em"}transform(){throw new Error("not implemented")}class(){return`tooltip ${this.constructor.type}-tooltip ${this.objectId()}`}setVisibility(t){this.visibility="visible"===t?"visible":"hidden"}toggleVisibility(){return this.visibility="hidden"===this.visibility?"visible":"hidden",this.visibility}toggleVisibilityCallback(e){return()=>{t.event.defaultPrevented||t.select(e).attr("visibility",function(t){return t.setVisibility(this.getAttribute("visibility")),t.toggleVisibility()}).style("opacity",function(t){return"visible"===t.visibility?1:null})}}configureObjectClickCallback(e){t.select(`#${this.objectId(!0)}`).on("click.tooltip",this.toggleVisibilityCallback(e))}configureObjectHoverCallback(e){t.select(`#${this.objectId(!0)}`).on("mouseenter.tooltip",this.toggleVisibilityCallback(e)),t.select(`#${this.objectId(!0)}`).on("mouseleave.tooltip",this.toggleVisibilityCallback(e))}disableZoom(e){t.select(e).on("mousedown.tooltip",()=>{t.event.stopPropagation()})}static setHref(t){t&&(this.href=t)}static render(t,e){const s=this,i=t.selectAll(`.tooltip.${s.type}-tooltip`).data(e).enter().append("g").attr("visibility",t=>t.visibility).attr("class",t=>t.class()).attr("transform",t=>t.transform());return i.each(function(t){s.appendText(this),"function"==typeof t.constructor.href&&s.appendExternalLinkIcon(this),"hover"===t.eventType?t.configureObjectHoverCallback(this):t.configureObjectClickCallback(this),t.disableZoom(this)}),i}static fill(t){if(getComputedStyle(t).fill.match(/\(0,\s*0,\s*0\)/))return"#f8f1e9"}static pathD(t,e,s,i){return`M ${t},${e} L ${t+20},${e-10} ${t+20},${e-20}Q ${t+20},${e-20-8} ${t+20+8},${e-20-8}L ${t+20+s-8},${e-20-8}Q ${t+20+s},${e-20-8} ${t+20+s},${e-20}L ${t+20+s},${e-20+i}Q ${t+20+s},${e-20+i+8} ${t+20+s-8},${e-20+i+8}L ${t+20+8},${e-20+i+8}Q ${t+20},${e-20+i+8} ${t+20},${e-20+i}L ${t+20},${e+10} Z`}static appendText(t){throw new Error("not implemented")}static appendNameValue(t,e,s,i){t.append("tspan").attr("x",t=>t.offsetX+40).attr("dy",t=>void 0===i?void 0:t.tspanOffsetY(i)).attr("class","name").text(`${e}:`),t.append("tspan").attr("dx",10).attr("class","value").text(s)}static appendExternalLinkIcon(e){const s=e.getBBox(),i=t.select(e).append("a").attr("href",t=>t.constructor.href(t,t.constructor.type)).append("svg").attr("x",t=>s.width+t.offsetX-2-20).attr("y",s.height-30-20).attr("width",20).attr("height",20).attr("viewBox","0 0 24 24").attr("stroke-width",2).attr("fill","none").attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("class","icon external-link");i.append("path").attr("d","M0 0h24v24H0z").attr("stroke","none").attr("fill","#fff").attr("fill-opacity",0),i.append("path").attr("d","M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"),i.append("path").attr("d","M11 13l9 -9"),i.append("path").attr("d","M15 4h5v5")}static followObject(t){t.attr("transform",t=>t.transform())}}class C extends ${constructor(t,e){super(e,{offsetX:10}),this.link=t}transform(){const[t,e]=this.link.centerCoordinates();return`translate(${t}, ${e})`}objectId(t=!1){let e=s(this.link.linkId());return t&&(e=CSS.escape(e)),e}static appendText(e){const s=t.select(e).append("path"),i=t.select(e).append("text");C.appendNameValue(i,"source",t=>t.link.source.name),i.each(function(t){t.link.sourceMeta.forEach(t=>{C.appendNameValue(i,t.class,t.value,!1)})}),C.appendNameValue(i,"target",t=>t.link.target.name,!0),i.each(function(t){t.link.targetMeta.forEach(t=>{C.appendNameValue(i,t.class,t.value,!1)})}),i.each(function(t){t.link.metaList.forEach((t,e)=>{C.appendNameValue(i,t.class,t.value,0===e)});const e=this.getBBox();s.attr("d",t=>C.pathD(t.offsetX,0,e.width+40,e.height+20)).style("fill",function(){return C.fill(this)})})}}C.type="link";class M extends ${constructor(t,e){super(e),this.node=t}transform(){return`translate(${this.node.x}, ${this.node.y})`}objectId(t=!1){let e=this.node.nodeId();return t&&(e=CSS.escape(e)),e}static appendText(e){const s=t.select(e).append("path"),i=t.select(e).append("text");M.appendNameValue(i,"node",t=>t.node.name),i.each(function(t){t.node.metaList.forEach((t,e)=>{M.appendNameValue(i,t.class,t.value,0===e)});const e=this.getBBox();s.attr("d",t=>M.pathD(t.offsetX,0,e.width+40,e.height+20)).style("fill",function(){return M.fill(this)})})}}M.type="node";var O=n(636);class B{constructor(t,e,s){this.data=t,this.pop=e,this.cachedMd5=s}static getAll(){return JSON.parse(localStorage.getItem("positionCache"))||{}}static key(){return`${location.pathname}${location.search}`}static get(){return this.getAll()[this.key()]||{}}save(t,e,s){const i=B.getAll();i[B.key()]={md5:this.md5(),group:this.groupPosition(t),node:this.nodePosition(e),link:this.linkPosition(s)},localStorage.setItem("positionCache",JSON.stringify(i))}md5(t,e){return(t=structuredClone(t||this.data)).pop=String(e||this.pop),"undefined"===t.pop&&(t.pop="null"),t.nodes&&t.nodes.forEach(t=>{delete t.icon,delete t.meta}),t.links&&t.links.forEach(t=>{delete t.meta}),O(JSON.stringify(t)).toString()}groupPosition(t){const e=[];return t.each(t=>{e.push({x:t.bounds.x,y:t.bounds.y,width:t.bounds.width(),height:t.bounds.height()})}),e}nodePosition(t){const e=[];return t.each(t=>{e.push({x:t.x,y:t.y})}),e}linkPosition(t){const e=[];return t.each(t=>{e.push({x1:t.source.x,y1:t.source.y,x2:t.target.x,y2:t.target.y})}),e}match(t,e){return this.cachedMd5===this.md5(t,e)}static load(t,e){const s=this.get();if(s){const i=new B(t,e,s.md5);if(i.match(t,e))return i.group=s.group,i.node=s.node,i.link=s.link,i}}}const T=n(109);class I{constructor(e,s,i){i||(i={}),this.options=Object.assign({},i),this.options.selector=e,this.options.urlOrData=s,this.options.groupPattern=i.pop,this.options.width=i.width||960,this.options.height=i.height||600,this.options.positionHint=i.positionHint||{},this.options.positionConstraints=i.positionConstraints||[],this.options.color=t.scale.category20(),this.options.initialTicks=i.initialTicks||0,this.options.maxTicks=i.ticks||1e3,this.options.positionCache=!("positionCache"in i)||i.positionCache,this.options.bundle="bundle"in i&&i.bundle,this.options.tooltip=i.tooltip,this.setDistance=this.linkDistance(i.distance||150),M.setHref(i.href),C.setHref(i.href)}init(...e){this.options.meta=e,this.cola=this.initCola(),this.svg=this.initSvg(),this.displayLoadMessage(),"object"==typeof this.options.urlOrData?setTimeout(()=>{this.render(this.options.urlOrData)}):t.json(this.url(),(t,e)=>{t&&(console.error(t),this.showMessage(`Failed to load "${this.url()}"`)),this.render(e)})}initCola(){return T.d3adaptor().avoidOverlaps(!0).handleDisconnected(!1).size([this.options.width,this.options.height])}initSvg(){this.zoom=t.behavior.zoom();const e=t.select(this.options.selector).append("svg").attr("width",this.options.width).attr("height",this.options.height).append("g").call(this.zoom.on("zoom",()=>this.zoomCallback(e))).append("g");return e.append("rect").attr("width",10*this.options.width).attr("height",10*this.options.height).attr("transform",`translate(-${5*this.options.width}, -${5*this.options.height})`).style("opacity",0),e}render(t){try{const s=t.nodes?t.nodes.map((t,e)=>new y(t,e,{width:this.options.nodeWidth,height:this.options.nodeHeight,metaKeys:this.options.meta,color:this.options.color,tooltip:!!this.options.tooltip})):[],i=t.links?e.sortByBundle(t.links).map((t,e)=>new w(t,e,{metaKeys:this.options.meta,linkWidth:this.getLinkWidth})):[],n=d.divide(s,this.options.groupPattern,{color:this.options.color,padding:this.options.groupPadding}),r=s.map(t=>new M(t,this.options.tooltip)),a=i.map(t=>new C(t,this.options.tooltip)),o=e.divide(i);this.cola.nodes(s).links(i).groups(n),this.applyConstraints(this.options.positionConstraints,s),this.setDistance(this.cola),this.cola.start(this.options.initialTicks);const h=this.svg.append("g").attr("id","groups"),l=this.svg.append("g").attr("id","links"),c=this.svg.append("g").attr("id","nodes"),u=this.svg.append("g").attr("id","link-labels"),p=this.svg.append("g").attr("id","tooltips"),[f,g,m]=w.render(l,u,i),x=e.render(l,o),v=d.render(h,n).call(this.cola.drag().on("dragstart",I.dragstartCallback).on("drag",()=>{this.options.bundle&&w.shiftBundle(f,g,m,x),M.followObject(k),C.followObject($)})),b=y.render(c,s).call(this.cola.drag().on("dragstart",I.dragstartCallback).on("drag",()=>{this.options.bundle&&w.shiftBundle(f,g,m,x),M.followObject(k),C.followObject($)}));this.configureTick(v,b,f),this.positionCache=B.load(t,this.options.groupPattern),this.options.positionCache&&this.positionCache?(d.setPosition(v,this.positionCache.group),y.setPosition(b,this.positionCache.node),w.setPosition(f,this.positionCache.link)):(this.options.positionHint.nodeCallback&&(y.setPosition(b,b.data().map(t=>this.options.positionHint.nodeCallback(t))),this.cola.start()),this.ticksForward(),this.positionCache=new B(t,this.options.groupPattern),this.savePosition(v,b,f)),this.hideLoadMessage(),this.configureTick(v,b,f,g,m),this.removeConstraints(),this.cola.start(),this.options.bundle&&w.shiftBundle(f,g,m,x),g.attr("d",t=>t.d()),I.freeze(b);const k=M.render(p,r),$=C.render(p,a);"fixed"===this.options.positionCache&&this.cola.on("end",()=>{this.savePosition(v,b,f)})}catch(t){throw this.showMessage(t),t}}linkWidth(t){this.getLinkWidth=t}attr(e,s){this.initialTranslate||this.saveInitialTranslate(),this.svg.attr(e,s);const i=t.transform(this.svg.attr("transform"));this.zoom.scale(i.scale[0]),this.zoom.translate(i.translate)}destroy(){t.select("body svg").remove(),y.reset(),w.reset(),e.reset()}static freeze(t){t.each(t=>t.fixed=!0)}static dragstartCallback(){t.event.sourceEvent.stopPropagation()}linkDistance(t){return"function"==typeof t?t:e=>e.linkDistance(t)}url(){return this.uniqueUrl||(this.uniqueUrl=`${this.options.urlOrData}?${(new Date).getTime()}`),this.uniqueUrl}configureTick(t,e,s,i,n){this.tickCallback=()=>{y.tick(e),w.tick(s,i,n),d.tick(t)},this.cola.on("tick",this.tickCallback)}ticksForward(t){t=t||this.options.maxTicks;for(let e=0;e<t;e++)this.cola.tick()}zoomCallback(e){this.initialTranslate||this.saveInitialTranslate();const s=t.event;s.scale*=this.initialScale,s.translate[0]+=this.initialTranslate[0],s.translate[1]+=this.initialTranslate[1],w.zoom(s.scale),e.attr("transform",`translate(${s.translate}) scale(${s.scale})`)}displayLoadMessage(){this.indicator=this.svg.append("text").attr("x",this.options.width/2).attr("y",this.options.height/2).attr("dy",".35em").style("text-anchor","middle").text("Simulating. Just a moment ...")}hideLoadMessage(){this.indicator&&this.indicator.remove()}showMessage(t){this.indicator&&this.indicator.text(t)}saveInitialTranslate(){const e=t.transform(this.svg.attr("transform"));this.initialScale=e.scale[0],this.initialTranslate=e.translate}savePosition(t,e,s){this.positionCache.save(t,e,s)}applyConstraints(t,e){const s=[];for(const i of t)for(const t of i.nodesCallback(e))s.push({type:"alignment",axis:i.axis,offsets:t.map(t=>({node:t.id,offset:0}))});this.cola.constraints(s)}removeConstraints(){this.cola.constraints([])}}const S=e=>class extends e{constructor(e,s,i){super(e,s,i),this.dispatch=t.dispatch("rendered")}render(t){super.render(t),this.dispatch.rendered()}on(t,e){this.dispatch.on(t,e)}};class _ extends((t=>class extends t{static plugin(t,e={}){t.load(d,y,w,e)}})(I)){}class L extends(S(_)){}})(),r})());
//# sourceMappingURL=inet-henge.min.js.map