d3plus-network
Advanced tools
Comparing version 0.6.0 to 0.6.1
/* | ||
d3plus-network v0.6.0 | ||
d3plus-network v0.6.1 | ||
Javascript network visualizations built upon d3 modules. | ||
@@ -7,2 +7,2 @@ Copyright (c) 2020 D3plus - https://d3plus.org | ||
*/ | ||
(function(e){typeof define==="function"&&define.amd?define(e):e()})(function(){"use strict";var e=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function t(e,t){return t={exports:{}},e(t,t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e};var l=n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof e=="object"&&e)||Function("return this")();var o=function(e){try{return!!e()}catch(e){return true}};var d=!o(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7});var r={}.propertyIsEnumerable;var i=Object.getOwnPropertyDescriptor;var a=i&&!r.call({1:2},1);var u=a?function e(t){var n=i(this,t);return!!n&&n.enumerable}:r;var v={f:u};var s=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}};var c={}.toString;var f=function(e){return c.call(e).slice(8,-1)};var h="".split;var k=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return f(e)=="String"?h.call(e,""):Object(e)}:Object;var p=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e};var _=function(e){return k(p(e))};var g=function(e){return typeof e==="object"?e!==null:typeof e==="function"};var y=function(e,t){if(!g(e))return e;var n,r;if(t&&typeof(n=e.toString)=="function"&&!g(r=n.call(e)))return r;if(typeof(n=e.valueOf)=="function"&&!g(r=n.call(e)))return r;if(!t&&typeof(n=e.toString)=="function"&&!g(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")};var m={}.hasOwnProperty;var b=function(e,t){return m.call(e,t)};var x=l.document;var z=g(x)&&g(x.createElement);var S=function(e){return z?x.createElement(e):{}};var w=!d&&!o(function(){return Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a!=7});var M=Object.getOwnPropertyDescriptor;var O=d?M:function e(t,n){t=_(t);n=y(n,true);if(w)try{return M(t,n)}catch(e){}if(b(t,n))return s(!v.f.call(t,n),t[n])};var E={f:O};var P=function(e){if(!g(e)){throw TypeError(String(e)+" is not an object")}return e};var C=Object.defineProperty;var j=d?C:function e(t,n,r){P(t);n=y(n,true);P(r);if(w)try{return C(t,n,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");if("value"in r)t[n]=r.value;return t};var A={f:j};var L=d?function(e,t,n){return A.f(e,t,s(1,n))}:function(e,t,n){e[t]=n;return e};var q=function(t,n){try{L(l,t,n)}catch(e){l[t]=n}return n};var B="__core-js_shared__";var T=l[B]||q(B,{});var D=T;var G=Function.toString;if(typeof D.inspectSource!="function"){D.inspectSource=function(e){return G.call(e)}}var R=D.inspectSource;var I=l.WeakMap;var W=typeof I==="function"&&/native code/.test(R(I));var N=t(function(e){(e.exports=function(e,t){return D[e]||(D[e]=t!==undefined?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})});var V=0;var F=Math.random();var X=function(e){return"Symbol("+String(e===undefined?"":e)+")_"+(++V+F).toString(36)};var Y=N("keys");var H=function(e){return Y[e]||(Y[e]=X(e))};var U={};var J=l.WeakMap;var K,Z,Q;var $=function(e){return Q(e)?Z(e):K(e,{})};var ee=function(n){return function(e){var t;if(!g(e)||(t=Z(e)).type!==n){throw TypeError("Incompatible receiver, "+n+" required")}return t}};if(W){var te=new J;var ne=te.get;var re=te.has;var ie=te.set;K=function(e,t){ie.call(te,e,t);return t};Z=function(e){return ne.call(te,e)||{}};Q=function(e){return re.call(te,e)}}else{var ae=H("state");U[ae]=true;K=function(e,t){L(e,ae,t);return t};Z=function(e){return b(e,ae)?e[ae]:{}};Q=function(e){return b(e,ae)}}var oe={set:K,get:Z,has:Q,enforce:$,getterFor:ee};var ue=t(function(e){var t=oe.get;var u=oe.enforce;var s=String(String).split("String");(e.exports=function(e,t,n,r){var i=r?!!r.unsafe:false;var a=r?!!r.enumerable:false;var o=r?!!r.noTargetGet:false;if(typeof n=="function"){if(typeof t=="string"&&!b(n,"name"))L(n,"name",t);u(n).source=s.join(typeof t=="string"?t:"")}if(e===l){if(a)e[t]=n;else q(t,n);return}else if(!i){delete e[t]}else if(!o&&e[t]){a=true}if(a)e[t]=n;else L(e,t,n)})(Function.prototype,"toString",function e(){return typeof this=="function"&&t(this).source||R(this)})});var se=l;var ce=function(e){return typeof e=="function"?e:undefined};var fe=function(e,t){return arguments.length<2?ce(se[e])||ce(l[e]):se[e]&&se[e][t]||l[e]&&l[e][t]};var le=Math.ceil;var he=Math.floor;var de=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)};var ve=Math.min;var pe=function(e){return e>0?ve(de(e),9007199254740991):0};var _e=Math.max;var ge=Math.min;var ye=function(e,t){var n=de(e);return n<0?_e(n+t,0):ge(n,t)};var me=function(u){return function(e,t,n){var r=_(e);var i=pe(r.length);var a=ye(n,i);var o;if(u&&t!=t)while(i>a){o=r[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in r)&&r[a]===t)return u||a||0}return!u&&-1}};var ke={includes:me(true),indexOf:me(false)};var be=ke.indexOf;var xe=function(e,t){var n=_(e);var r=0;var i=[];var a;for(a in n)!b(U,a)&&b(n,a)&&i.push(a);while(t.length>r)if(b(n,a=t[r++])){~be(i,a)||i.push(a)}return i};var ze=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var Se=ze.concat("length","prototype");var we=Object.getOwnPropertyNames||function e(t){return xe(t,Se)};var Me={f:we};var Oe=Object.getOwnPropertySymbols;var Ee={f:Oe};var Pe=fe("Reflect","ownKeys")||function e(t){var n=Me.f(P(t));var r=Ee.f;return r?n.concat(r(t)):n};var Ce=function(e,t){var n=Pe(t);var r=A.f;var i=E.f;for(var a=0;a<n.length;a++){var o=n[a];if(!b(e,o))r(e,o,i(t,o))}};var je=/#|\.prototype\./;var Ae=function(e,t){var n=qe[Le(e)];return n==Te?true:n==Be?false:typeof t=="function"?o(t):!!t};var Le=Ae.normalize=function(e){return String(e).replace(je,".").toLowerCase()};var qe=Ae.data={};var Be=Ae.NATIVE="N";var Te=Ae.POLYFILL="P";var De=Ae;var Ge=E.f;var Re=function(e,t){var n=e.target;var r=e.global;var i=e.stat;var a,o,u,s,c,f;if(r){o=l}else if(i){o=l[n]||q(n,{})}else{o=(l[n]||{}).prototype}if(o)for(u in t){c=t[u];if(e.noTargetGet){f=Ge(o,u);s=f&&f.value}else s=o[u];a=De(r?u:n+(i?".":"#")+u,e.forced);if(!a&&s!==undefined){if(typeof c===typeof s)continue;Ce(c,s)}if(e.sham||s&&s.sham){L(c,"sham",true)}ue(o,u,c,e)}};var Ie=function(e){if(typeof e!="function"){throw TypeError(String(e)+" is not a function")}return e};var We=function(r,i,e){Ie(r);if(i===undefined)return r;switch(e){case 0:return function(){return r.call(i)};case 1:return function(e){return r.call(i,e)};case 2:return function(e,t){return r.call(i,e,t)};case 3:return function(e,t,n){return r.call(i,e,t,n)}}return function(){return r.apply(i,arguments)}};var Ne=function(e){return Object(p(e))};var Ve=Array.isArray||function e(t){return f(t)=="Array"};var Fe=!!Object.getOwnPropertySymbols&&!o(function(){return!String(Symbol())});var Xe=Fe&&!Symbol.sham&&typeof Symbol.iterator=="symbol";var Ye=N("wks");var He=l.Symbol;var Ue=Xe?He:He&&He.withoutSetter||X;var Je=function(e){if(!b(Ye,e)){if(Fe&&b(He,e))Ye[e]=He[e];else Ye[e]=Ue("Symbol."+e)}return Ye[e]};var Ke=Je("species");var Ze=function(e,t){var n;if(Ve(e)){n=e.constructor;if(typeof n=="function"&&(n===Array||Ve(n.prototype)))n=undefined;else if(g(n)){n=n[Ke];if(n===null)n=undefined}}return new(n===undefined?Array:n)(t===0?0:t)};var Qe=[].push;var $e=function(d){var v=d==1;var p=d==2;var _=d==3;var g=d==4;var y=d==6;var m=d==5||y;return function(e,t,n,r){var i=Ne(e);var a=k(i);var o=We(t,n,3);var u=pe(a.length);var s=0;var c=r||Ze;var f=v?c(e,u):p?c(e,0):undefined;var l,h;for(;u>s;s++)if(m||s in a){l=a[s];h=o(l,s,i);if(d){if(v)f[s]=h;else if(h)switch(d){case 3:return true;case 5:return l;case 6:return s;case 2:Qe.call(f,l)}else if(g)return false}}return y?-1:_||g?g:f}};var et={forEach:$e(0),map:$e(1),filter:$e(2),some:$e(3),every:$e(4),find:$e(5),findIndex:$e(6)};var tt=Object.keys||function e(t){return xe(t,ze)};var nt=d?Object.defineProperties:function e(t,n){P(t);var r=tt(n);var i=r.length;var a=0;var o;while(i>a)A.f(t,o=r[a++],n[o]);return t};var rt=fe("document","documentElement");var it=">";var at="<";var ot="prototype";var ut="script";var st=H("IE_PROTO");var ct=function(){};var ft=function(e){return at+ut+it+e+at+"/"+ut+it};var lt=function(e){e.write(ft(""));e.close();var t=e.parentWindow.Object;e=null;return t};var ht=function(){var e=S("iframe");var t="java"+ut+":";var n;e.style.display="none";rt.appendChild(e);e.src=String(t);n=e.contentWindow.document;n.open();n.write(ft("document.F=Object"));n.close();return n.F};var dt;var vt=function(){try{dt=document.domain&&new ActiveXObject("htmlfile")}catch(e){}vt=dt?lt(dt):ht();var e=ze.length;while(e--)delete vt[ot][ze[e]];return vt()};U[st]=true;var pt=Object.create||function e(t,n){var r;if(t!==null){ct[ot]=P(t);r=new ct;ct[ot]=null;r[st]=t}else r=vt();return n===undefined?r:nt(r,n)};var _t=Je("unscopables");var gt=Array.prototype;if(gt[_t]==undefined){A.f(gt,_t,{configurable:true,value:pt(null)})}var yt=function(e){gt[_t][e]=true};var mt=Object.defineProperty;var kt={};var bt=function(e){throw e};var xt=function(e,t){if(b(kt,e))return kt[e];if(!t)t={};var n=[][e];var r=b(t,"ACCESSORS")?t.ACCESSORS:false;var i=b(t,0)?t[0]:bt;var a=b(t,1)?t[1]:undefined;return kt[e]=!!n&&!o(function(){if(r&&!d)return true;var e={length:-1};if(r)mt(e,1,{enumerable:true,get:bt});else e[1]=1;n.call(e,i,a)})};var zt=et.find;var St="find";var wt=true;var Mt=xt(St);if(St in[])Array(1)[St](function(){wt=false});Re({target:"Array",proto:true,forced:wt||!Mt},{find:function e(t){return zt(this,t,arguments.length>1?arguments[1]:undefined)}});yt(St);var Ot=ke.includes;var Et=xt("indexOf",{ACCESSORS:true,1:0});Re({target:"Array",proto:true,forced:!Et},{includes:function e(t){return Ot(this,t,arguments.length>1?arguments[1]:undefined)}});yt("includes");var Pt=Object.assign;var Ct=Object.defineProperty;var jt=!Pt||o(function(){if(d&&Pt({b:1},Pt(Ct({},"a",{enumerable:true,get:function(){Ct(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var e={};var t={};var n=Symbol();var r="abcdefghijklmnopqrst";e[n]=7;r.split("").forEach(function(e){t[e]=e});return Pt({},e)[n]!=7||tt(Pt({},t)).join("")!=r})?function e(t,n){var r=Ne(t);var i=arguments.length;var a=1;var o=Ee.f;var u=v.f;while(i>a){var s=k(arguments[a++]);var c=o?tt(s).concat(o(s)):tt(s);var f=c.length;var l=0;var h;while(f>l){h=c[l++];if(!d||u.call(s,h))r[h]=s[h]}}return r}:Pt;Re({target:"Object",stat:true,forced:Object.assign!==jt},{assign:jt});var At=Je("match");var Lt=function(e){var t;return g(e)&&((t=e[At])!==undefined?!!t:f(e)=="RegExp")};var qt=function(e){if(Lt(e)){throw TypeError("The method doesn't accept regular expressions")}return e};var Bt=Je("match");var Tt=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{n[Bt]=false;return"/./"[t](n)}catch(e){}}return false};Re({target:"String",proto:true,forced:!Tt("includes")},{includes:function e(t){return!!~String(p(this)).indexOf(qt(t),arguments.length>1?arguments[1]:undefined)}});var Dt=E.f;var Gt="".startsWith;var Rt=Math.min;var It=Tt("startsWith");var Wt=!It&&!!function(){var e=Dt(String.prototype,"startsWith");return e&&!e.writable}();Re({target:"String",proto:true,forced:!Wt&&!It},{startsWith:function e(t){var n=String(p(this));qt(t);var r=pe(Rt(arguments.length>1?arguments[1]:undefined,n.length));var i=String(t);return Gt?Gt.call(n,i,r):n.slice(r,r+i.length)===i}});if(typeof window!=="undefined"){(function(){try{if(typeof SVGElement==="undefined"||Boolean(SVGElement.prototype.innerHTML)){return}}catch(e){return}function n(e){switch(e.nodeType){case 1:return i(e);case 3:return t(e);case 8:return r(e)}}function t(e){return e.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function r(e){return"\x3c!--"+e.nodeValue+"--\x3e"}function i(e){var t="";t+="<"+e.tagName;if(e.hasAttributes()){[].forEach.call(e.attributes,function(e){t+=" "+e.name+'="'+e.value+'"'})}t+=">";if(e.hasChildNodes()){[].forEach.call(e.childNodes,function(e){t+=n(e)})}t+="</"+e.tagName+">";return t}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t="";[].forEach.call(this.childNodes,function(e){t+=n(e)});return t},set:function(e){while(this.firstChild){this.removeChild(this.firstChild)}try{var t=new DOMParser;t.async=false;var n="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+e+"</svg>";var r=t.parseFromString(n,"text/xml").documentElement;[].forEach.call(r.childNodes,function(e){this.appendChild(this.ownerDocument.importNode(e,true))}.bind(this))}catch(e){throw new Error("Error parsing markup string")}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(e){this.innerHTML=e}})})()}});(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?t(exports,require("d3-array"),require("d3-collection"),require("d3-force"),require("d3-polygon"),require("d3-scale"),require("d3-zoom"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3plus-color"),require("d3-sankey")):typeof define==="function"&&define.amd?define("d3plus-network",["exports","d3-array","d3-collection","d3-force","d3-polygon","d3-scale","d3-zoom","d3plus-common","d3plus-shape","d3plus-viz","d3plus-color","d3-sankey"],t):(e=e||self,t(e.d3plus={},e.d3Array,e.d3Collection,e.d3Force,e.d3Polygon,e.scales,e.d3Zoom,e.d3plusCommon,e.shapes,e.d3plusViz,e.d3plusColor,e.d3Sankey))})(this,function(e,H,U,J,K,Z,f,Q,$,a,R,n){"use strict";function ee(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){ee=function(e){return typeof e}}else{ee=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return ee(e)}function r(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function o(e,t,n){if(t)i(e.prototype,t);if(n)i(e,n);return e}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)s(e,t)}function te(e){te=Object.setPrototypeOf?Object.getPrototypeOf:function e(t){return t.__proto__||Object.getPrototypeOf(t)};return te(e)}function s(e,t){s=Object.setPrototypeOf||function e(t,n){t.__proto__=n;return t};return s(e,t)}function t(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function l(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function c(e,t){if(t&&(typeof t==="object"||typeof t==="function")){return t}return l(e)}function h(i){var a=t();return function e(){var t=te(i),n;if(a){var r=te(this).constructor;n=Reflect.construct(t,arguments,r)}else{n=t.apply(this,arguments)}return c(this,n)}}function d(e,t){while(!Object.prototype.hasOwnProperty.call(e,t)){e=te(e);if(e===null)break}return e}function ne(e,t,n){if(typeof Reflect!=="undefined"&&Reflect.get){ne=Reflect.get}else{ne=function e(t,n,r){var i=d(t,n);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,n);if(a.get){return a.get.call(r)}return a.value}}return ne(e,t,n||e)}var v=function(e){u(Y,e);var t=h(Y);function Y(){var c;r(this,Y);c=t.call(this);c._links=[];c._linkSize=Q.constant(1);c._linkSizeMin=1;c._linkSizeScale="sqrt";c._noDataMessage=false;c._nodes=[];c._on["click.shape"]=function(e,t){c._tooltipClass.data([]).render();if(c._hover&&c._drawDepth>=c._groupBy.length-1){var n="".concat(c._nodeGroupBy&&c._nodeGroupBy[c._drawDepth](e,t)?c._nodeGroupBy[c._drawDepth](e,t):c._id(e,t));if(c._focus&&c._focus===n){c.active(false);c._on.mouseenter.bind(l(c))(e,t);c._focus=undefined;c._zoomToBounds(null)}else{c.hover(false);var r=c._linkLookup[n],i=c._nodeLookup[n];var a=[n];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.active(function(e,t){if(e.source&&e.target)return e.source.id===n||e.target.id===n;else return a.includes("".concat(c._ids(e,t)[c._drawDepth]))});c._focus=n;var s=f.zoomTransform(c._container.node());o=o.map(function(e){return e*s.k+s.x});u=u.map(function(e){return e*s.k+s.y});c._zoomToBounds([[o[0],u[0]],[o[1],u[1]]])}}};c._on["click.legend"]=function(e,t){var n=c._id(e);var r=c._ids(e);r=r[r.length-1];if(c._hover&&c._drawDepth>=c._groupBy.length-1){if(c._focus&&c._focus===n){c.active(false);c._focus=undefined;c._zoomToBounds(null)}else{c.hover(false);var i=n.map(function(e){return c._nodeLookup[e]});var a=["".concat(r)];var o=[i[0].x-i[0].r,i[0].x+i[0].r],u=[i[0].y-i[0].r,i[0].y+i[0].r];i.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.active(function(e,t){if(e.source&&e.target)return a.includes(e.source.id)&&a.includes(e.target.id);else{var n=c._ids(e,t);return a.includes("".concat(n[n.length-1]))}});c._focus=n;var s=f.zoomTransform(c._container.node());o=o.map(function(e){return e*s.k+s.x});u=u.map(function(e){return e*s.k+s.y});c._zoomToBounds([[o[0],u[0]],[o[1],u[1]]])}c._on.mouseenter.bind(l(c))(e,t);c._on["mousemove.legend"].bind(l(c))(e,t)}};c._on.mouseenter=function(){};c._on["mouseleave.shape"]=function(){c.hover(false)};var s=c._on["mousemove.shape"];c._on["mousemove.shape"]=function(e,t){s(e,t);var n="".concat(c._nodeGroupBy&&c._nodeGroupBy[c._drawDepth](e,t)?c._nodeGroupBy[c._drawDepth](e,t):c._id(e,t)),r=c._linkLookup[n],i=c._nodeLookup[n];var a=[n];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.hover(function(e,t){if(e.source&&e.target)return e.source.id===n||e.target.id===n;else return a.includes("".concat(c._ids(e,t)[c._drawDepth]))})};c._sizeMin=5;c._sizeScale="sqrt";c._shape=Q.constant("Circle");c._shapeConfig=Q.assign(c._shapeConfig,{ariaLabel:function e(t,n){var r=c._size?", ".concat(c._size(t,n)):"";return"".concat(c._drawLabel(t,n)).concat(r,".")},labelConfig:{duration:0,fontMin:1,fontResize:true,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:false,stroke:"#eee"}});c._x=Q.accessor("x");c._y=Q.accessor("y");c._zoom=true;return c}o(Y,[{key:"_draw",value:function e(t){var i=this;ne(te(Y.prototype),"_draw",this).call(this,t);var n=this._height-this._margin.top-this._margin.bottom,r="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),a=this._transition,o=this._width-this._margin.left-this._margin.right;var u=this._filteredData.reduce(function(e,t,n){e[i._id(t,n)]=t;return e},{});var s=this._nodes.reduce(function(e,t,n){e[i._nodeGroupBy?i._nodeGroupBy[i._drawDepth](t,n):t.id]=t;return e},{});s=Array.from(new Set(Object.keys(u).concat(Object.keys(s)))).map(function(e,t){var n=u[e],r=s[e];if(r===undefined)return false;return{__d3plus__:true,data:n||r,i:t,id:e,fx:n!==undefined&&i._x(n)!==undefined?i._x(n):i._x(r),fy:n!==undefined&&i._y(n)!==undefined?i._y(n):i._y(r),node:r,r:i._size?n!==undefined&&i._size(n)!==undefined?i._size(n):i._size(r):i._sizeMin,shape:n!==undefined&&i._shape(n)!==undefined?i._shape(n):i._shape(r)}}).filter(function(e){return e});var c=this._nodeLookup=s.reduce(function(e,t){e[t.id]=t;return e},{});var f=s.map(function(e){return e.node});var l=this._links.map(function(e){var t=ee(e.source);return{size:i._linkSize(e),source:t==="number"?s[f.indexOf(i._nodes[e.source])]:t==="string"?c[e.source]:c[e.source.id],target:t==="number"?s[f.indexOf(i._nodes[e.target])]:t==="string"?c[e.target]:c[e.target.id]}});this._linkLookup=l.reduce(function(e,t){if(!e[t.source.id])e[t.source.id]=[];e[t.source.id].push(t.target);if(!e[t.target.id])e[t.target.id]=[];e[t.target.id].push(t.source);return e},{});var h=s.some(function(e){return e.fx===undefined||e.fy===undefined});if(h){var d=Z.scaleLinear().domain(H.extent(l,function(e){return e.size})).range([.1,.5]);var v=J.forceSimulation().force("link",J.forceLink(l).id(function(e){return e.id}).distance(1).strength(function(e){return d(e.size)}).iterations(4)).force("charge",J.forceManyBody().strength(-1)).stop();var p=300;var _=.001;var g=1-Math.pow(_,1/p);v.velocityDecay(0);v.alphaMin(_);v.alphaDecay(g);v.alphaDecay(0);v.nodes(s);v.tick(p).stop();var y=K.polygonHull(s.map(function(e){return[e.vx,e.vy]}));var m=$.largestRect(y),k=m.angle,b=m.cx,x=m.cy;s.forEach(function(e){var t=$.pointRotate([e.vx,e.vy],-1*(Math.PI/180*k),[b,x]);e.fx=t[0];e.fy=t[1]})}var z=H.extent(s.map(function(e){return e.fx})),S=H.extent(s.map(function(e){return e.fy}));var w=Z.scaleLinear().domain(z).range([0,o]),M=Z.scaleLinear().domain(S).range([0,n]);var O=(z[1]-z[0])/(S[1]-S[0]),E=o/n;if(O>E){var P=n*E/O;M.range([(n-P)/2,n-(n-P)/2])}else{var C=o*O/E;w.range([(o-C)/2,o-(o-C)/2])}s.forEach(function(e){e.x=w(e.fx);e.y=M(e.fy)});var j=H.extent(s.map(function(e){return e.r}));var A=this._sizeMax||H.max([1,H.min(H.merge(s.map(function(t){return s.map(function(e){return t===e?null:$.pointDistance([t.x,t.y],[e.x,e.y])})})))/2]);var L=Z["scale".concat(this._sizeScale.charAt(0).toUpperCase()).concat(this._sizeScale.slice(1))]().domain(j).range([j[0]===j[1]?A:H.min([A/2,this._sizeMin]),A]),q=w.domain(),B=M.domain();var T=q[1]-q[0],D=B[1]-B[0];s.forEach(function(e){var t=L(e.r);if(q[0]>w.invert(e.x-t))q[0]=w.invert(e.x-t);if(q[1]<w.invert(e.x+t))q[1]=w.invert(e.x+t);if(B[0]>M.invert(e.y-t))B[0]=M.invert(e.y-t);if(B[1]<M.invert(e.y+t))B[1]=M.invert(e.y+t)});var G=q[1]-q[0],R=B[1]-B[0];A*=H.min([T/G,D/R]);L.range([j[0]===j[1]?A:H.min([A/2,this._sizeMin]),A]);w.domain(q);M.domain(B);s.forEach(function(e){e.x=w(e.fx);e.fx=e.x;e.y=M(e.fy);e.fy=e.y;e.r=L(e.r);e.width=e.r*2;e.height=e.r*2});this._container=this._select.selectAll("svg.d3plus-network").data([0]);this._container=this._container.enter().append("svg").attr("class","d3plus-network").attr("opacity",0).attr("width",o).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color","transparent").merge(this._container);this._container.transition(this._transition).attr("opacity",1).attr("width",o).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top);var I=this._container.selectAll("rect.d3plus-network-hitArea").data([0]);I.enter().append("rect").attr("class","d3plus-network-hitArea").merge(I).attr("width",o).attr("height",n).attr("fill","transparent").on("click",function(){if(i._focus){i.active(false);i._focus=undefined;i._zoomToBounds(null)}});this._zoomGroup=this._container.selectAll("g.d3plus-network-zoomGroup").data([0]);var W=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup);var N=H.extent(l,function(e){return e.size});if(N[0]!==N[1]){var V=Z["scale".concat(this._linkSizeScale.charAt(0).toUpperCase()).concat(this._linkSizeScale.slice(1))]().domain(N).range([this._linkSizeMin,L.range()[0]]);l.forEach(function(e){e.size=V(e.size)})}var F=Q.configPrep.bind(this)(this._shapeConfig,"edge","Path");delete F.on;this._shapes.push((new $.Path).config(F).strokeWidth(function(e){return e.size}).activeStyle({"stroke-width":function e(t){return t.size}}).d(function(e){return"M".concat(e.source.x,",").concat(e.source.y," ").concat(e.target.x,",").concat(e.target.y)}).data(l).select(Q.elem("g.d3plus-network-links",{parent:W,transition:a,enter:{transform:r},update:{transform:r}}).node()).render());var X={label:function e(t){return s.length<=i._dataCutoff||i._hover&&i._hover(t)||i._active&&i._active(t)?i._drawLabel(t.data||t.node,t.i):false},select:Q.elem("g.d3plus-network-nodes",{parent:W,transition:a,enter:{transform:r},update:{transform:r}}).node()};U.nest().key(function(e){return e.shape}).entries(s).forEach(function(e){i._shapes.push((new $[e.key]).config(Q.configPrep.bind(i)(i._shapeConfig,"shape",e.key)).config(X).config(X[e.key]||{}).data(e.values).render())});return this}},{key:"hover",value:function e(t){this._hover=t;if(this._nodes.length<this._dataCutoff){this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t)}return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linkSize",value:function e(t){return arguments.length?(this._linkSize=typeof t==="function"?t:Q.constant(t),this):this._linkSize}},{key:"linkSizeMin",value:function e(t){return arguments.length?(this._linkSizeMin=t,this):this._linkSizeMin}},{key:"linkSizeScale",value:function e(t){return arguments.length?(this._linkSizeScale=t,this):this._linkSizeScale}},{key:"nodeGroupBy",value:function e(t){var n=this;if(!arguments.length)return this._nodeGroupBy;if(!(t instanceof Array))t=[t];return this._nodeGroupBy=t.map(function(e){if(typeof e==="function")return e;else{if(!n._aggs[e]){n._aggs[e]=function(e,t){var n=Array.from(new Set(e.map(t)));return n.length===1?n[0]:n}}return Q.accessor(e)}}),this}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"size",value:function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:Q.accessor(t),this):this._size}},{key:"sizeMax",value:function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax}},{key:"sizeMin",value:function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin}},{key:"sizeScale",value:function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale}},{key:"x",value:function e(t){if(arguments.length){if(typeof t==="function")this._x=t;else{this._x=Q.accessor(t);if(!this._aggs[t])this._aggs[t]=H.mean}return this}else return this._x}},{key:"y",value:function e(t){if(arguments.length){if(typeof t==="function")this._y=t;else{this._y=Q.accessor(t);if(!this._aggs[t])this._aggs[t]=H.mean}return this}else return this._y}}]);return Y}(a.Viz);var p=function(e){u(G,e);var t=h(G);function G(){var s;r(this,G);s=t.call(this);s._links=[];s._linkSize=Q.constant(1);s._linkSizeMin=1;s._linkSizeScale="sqrt";s._noDataMessage=false;s._nodes=[];s._on.mouseenter=function(){};s._on["mouseleave.shape"]=function(){s.hover(false)};var c=s._on["mousemove.shape"];s._on["mousemove.shape"]=function(e,t){c(e,t);if(s._focus&&s._focus===e.id){s.hover(false);s._on.mouseenter.bind(l(s))(e,t);s._focus=undefined}else{var n=s._nodeGroupBy&&s._nodeGroupBy[s._drawDepth](e,t)?s._nodeGroupBy[s._drawDepth](e,t):s._id(e,t),r=s._linkLookup[n],i=s._nodeLookup[n];var a=[i.id];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});s.hover(function(e,t){if(e.source&&e.target)return e.source.id===i.id||e.target.id===i.id;else return a.includes(s._ids(e,t)[s._drawDepth])})}};s._on["click.shape"]=function(e){s._center=e.id;s._margin={bottom:0,left:0,right:0,top:0};s._padding={bottom:0,left:0,right:0,top:0};s._draw()};s._sizeMin=5;s._sizeScale="sqrt";s._shape=Q.constant("Circle");s._shapeConfig=Q.assign(s._shapeConfig,{ariaLabel:function e(t,n){var r=s._size?", ".concat(s._size(t,n)):"";return"".concat(s._drawLabel(t,n)).concat(r,".")},labelConfig:{duration:0,fontMin:1,fontResize:true,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:false,stroke:"#eee",strokeWidth:1}});return s}o(G,[{key:"_draw",value:function e(t){var c=this;ne(te(G.prototype),"_draw",this).call(this,t);var i=this._filteredData.reduce(function(e,t,n){e[c._id(t,n)]=t;return e},{});var f=this._nodes;if(!this._nodes.length&&this._links.length){var n=Array.from(new Set(this._links.reduce(function(e,t){return e.concat([t.source,t.target])},[])));f=n.map(function(e){return ee(e)==="object"?e:{id:e}})}f=f.reduce(function(e,t,n){e[c._nodeGroupBy?c._nodeGroupBy[c._drawDepth](t,n):c._id(t,n)]=t;return e},{});f=Array.from(new Set(Object.keys(i).concat(Object.keys(f)))).map(function(e,t){var n=i[e],r=f[e];if(r===undefined)return false;return{__d3plus__:true,data:n||r,i:t,id:e,node:r,shape:n!==undefined&&c._shape(n)!==undefined?c._shape(n):c._shape(r)}}).filter(function(e){return e});var r=this._nodeLookup=f.reduce(function(e,t){e[t.id]=t;return e},{});var a=this._links.map(function(n){var e=["source","target"];var t=e.reduce(function(e,t){e[t]=typeof n[t]==="number"?f[n[t]]:r[n[t].id||n[t]];return e},{});t.size=c._linkSize(n);return t});var o=a.reduce(function(e,t){if(!e[t.source.id]){e[t.source.id]=[]}e[t.source.id].push(t);if(!e[t.target.id]){e[t.target.id]=[]}e[t.target.id].push(t);return e},{});var l=this._height-this._margin.top-this._margin.bottom,u="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),s=this._transition,h=this._width-this._margin.left-this._margin.right;var d=[],v=H.min([l,h])/2,p=v/3;var _=p,g=p*2;var y=r[this._center];y.x=h/2;y.y=l/2;y.r=this._sizeMin?H.max([this._sizeMin,_*.65]):this._sizeMax?H.min([this._sizeMax,_*.65]):_*.65;var m=[y],k=[];o[this._center].forEach(function(e){var t=e.source.id===c._center?e.target:e.source;t.edges=o[t.id].filter(function(e){return e.source.id!==c._center||e.target.id!==c._center});t.edge=e;m.push(t);k.push(t)});k.sort(function(e,t){return e.edges.length-t.edges.length});var b=[];var x=0;k.forEach(function(e){var i=e.id;e.edges=e.edges.filter(function(e){return!m.includes(e.source)&&e.target.id===i||!m.includes(e.target)&&e.source.id===i});x+=e.edges.length||1;e.edges.forEach(function(e){var t=e.source,n=e.target;var r=n.id===i?t:n;m.push(r)})});var z=Math.PI*2;var S=0;k.forEach(function(a,e){var o=a.edges.length||1;var t=z/x*o;if(e===0){S-=t/2}var u=S+t/2-z/4;a.radians=u;a.x=h/2+_*Math.cos(u);a.y=l/2+_*Math.sin(u);S+=t;a.edges.forEach(function(e,t){var n=e.source.id===a.id?e.target:e.source;var r=z/x;var i=u-r*o/2+r/2+r*t;n.radians=i;n.x=h/2+g*Math.cos(i);n.y=l/2+g*Math.sin(i);b.push(n)})});var w=p/2;var M=p/4;var O=w/2-4;if(w/2-4<8){O=H.min([w/2,8])}var E=M/2-4;if(M/2-4<4){E=H.min([M/2,4])}if(E>p/10){E=p/10}if(E>O&&E>10){E=O*.75}if(O>E*1.5){O=E*1.5}O=Math.floor(O);E=Math.floor(E);var P;if(this._size){var C=H.extent(i,function(e){return e.size});if(C[0]===C[1]){C[0]=0}P=Z.scaleLinear().domain(C).rangeRound([3,H.min([O,E])]);var j=y.size;y.r=P(j)}else{P=Z.scaleLinear().domain([1,2]).rangeRound([O,E])}b.forEach(function(e){e.ring=2;var t=c._size?e.size:2;e.r=c._sizeMin?H.max([c._sizeMin,P(t)]):c._sizeMax?H.min([c._sizeMax,P(t)]):P(t)});k.forEach(function(e){e.ring=1;var t=c._size?e.size:1;e.r=c._sizeMin?H.max([c._sizeMin,P(t)]):c._sizeMax?H.min([c._sizeMax,P(t)]):P(t)});f=[y].concat(k).concat(b);k.forEach(function(s){var e=["source","target"];var n=s.edge;e.forEach(function(t){n[t]=f.find(function(e){return e.id===n[t].id})});d.push(n);o[s.id].forEach(function(r){var t=r.source.id===s.id?r.target:r.source;if(t.id!==y.id){var i=b.find(function(e){return e.id===t.id});if(!i){i=k.find(function(e){return e.id===t.id})}if(i){r.spline=true;var a=h/2;var o=l/2;var u=_+(g-_)*.5;var e=["source","target"];e.forEach(function(t,e){r["".concat(t,"X")]=r[t].x+Math.cos(r[t].ring===2?r[t].radians+Math.PI:r[t].radians)*r[t].r;r["".concat(t,"Y")]=r[t].y+Math.sin(r[t].ring===2?r[t].radians+Math.PI:r[t].radians)*r[t].r;r["".concat(t,"BisectX")]=a+u*Math.cos(r[t].radians);r["".concat(t,"BisectY")]=o+u*Math.sin(r[t].radians);r[t]=f.find(function(e){return e.id===r[t].id});if(r[t].edges===undefined)r[t].edges={};var n=e===0?r.target.id:r.source.id;if(r[t].id===s.id){r[t].edges[n]={angle:s.radians+Math.PI,radius:p/2}}else{r[t].edges[n]={angle:i.radians,radius:p/2}}});d.push(r)}}})});f.forEach(function(e){if(e.id!==c._center){var t=c._shapeConfig.labelConfig.fontSize&&c._shapeConfig.labelConfig.fontSize(e)||11;var n=t*1.4;var r=n*2;var i=5;var a=p-e.r;var o=e.radians*(180/Math.PI);var u=e.r+i;var s="start";if(o<-90||o>90){u=-e.r-a-i;s="end";o+=180}e.labelBounds={x:u,y:-n/2,width:a,height:r};e.rotate=o;e.textAnchor=s}else{e.labelBounds={x:-_/2,y:-_/2,width:_,height:_}}});this._linkLookup=a.reduce(function(e,t){if(!e[t.source.id])e[t.source.id]=[];e[t.source.id].push(t.target);if(!e[t.target.id])e[t.target.id]=[];e[t.target.id].push(t.source);return e},{});var A=H.extent(a,function(e){return e.size});if(A[0]!==A[1]){var L=H.min(f,function(e){return e.r});var q=Z["scale".concat(this._linkSizeScale.charAt(0).toUpperCase()).concat(this._linkSizeScale.slice(1))]().domain(A).range([this._linkSizeMin,L]);a.forEach(function(e){e.size=q(e.size)})}var B=Q.configPrep.bind(this)(this._shapeConfig,"edge","Path");delete B.on;this._shapes.push((new $.Path).config(B).strokeWidth(function(e){return e.size}).id(function(e){return"".concat(e.source.id,"_").concat(e.target.id)}).d(function(e){return e.spline?"M".concat(e.sourceX,",").concat(e.sourceY,"C").concat(e.sourceBisectX,",").concat(e.sourceBisectY," ").concat(e.targetBisectX,",").concat(e.targetBisectY," ").concat(e.targetX,",").concat(e.targetY):"M".concat(e.source.x,",").concat(e.source.y," ").concat(e.target.x,",").concat(e.target.y)}).data(d).select(Q.elem("g.d3plus-rings-links",{parent:this._select,transition:s,enter:{transform:u},update:{transform:u}}).node()).render());var T=this;var D={label:function e(t){return f.length<=c._dataCutoff||c._hover&&c._hover(t)||c._active&&c._active(t)?c._drawLabel(t.data||t.node,t.i):false},labelBounds:function e(t){return t.labelBounds},labelConfig:{fontColor:function e(t){return t.id===c._center?Q.configPrep.bind(T)(T._shapeConfig,"shape",t.key).labelConfig.fontColor(t):R.colorLegible(Q.configPrep.bind(T)(T._shapeConfig,"shape",t.key).fill(t))},fontResize:function e(t){return t.id===c._center},padding:0,textAnchor:function e(t){return r[t.id].textAnchor||Q.configPrep.bind(T)(T._shapeConfig,"shape",t.key).labelConfig.textAnchor},verticalAlign:function e(t){return t.id===c._center?"middle":"top"}},rotate:function e(t){return r[t.id].rotate||0},select:Q.elem("g.d3plus-rings-nodes",{parent:this._select,transition:s,enter:{transform:u},update:{transform:u}}).node()};U.nest().key(function(e){return e.shape}).entries(f).forEach(function(e){c._shapes.push((new $[e.key]).config(Q.configPrep.bind(c)(c._shapeConfig,"shape",e.key)).config(D).data(e.values).render())});return this}},{key:"center",value:function e(t){return arguments.length?(this._center=t,this):this._center}},{key:"hover",value:function e(t){this._hover=t;this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t);return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linkSize",value:function e(t){return arguments.length?(this._linkSize=typeof t==="function"?t:Q.constant(t),this):this._linkSize}},{key:"linkSizeMin",value:function e(t){return arguments.length?(this._linkSizeMin=t,this):this._linkSizeMin}},{key:"linkSizeScale",value:function e(t){return arguments.length?(this._linkSizeScale=t,this):this._linkSizeScale}},{key:"nodeGroupBy",value:function e(t){var n=this;if(!arguments.length)return this._nodeGroupBy;if(!(t instanceof Array))t=[t];return this._nodeGroupBy=t.map(function(e){if(typeof e==="function")return e;else{if(!n._aggs[e]){n._aggs[e]=function(e,t){var n=Array.from(new Set(e.map(t)));return n.length===1?n[0]:n}}return Q.accessor(e)}}),this}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"size",value:function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:Q.accessor(t),this):this._size}},{key:"sizeMax",value:function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax}},{key:"sizeMin",value:function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin}},{key:"sizeScale",value:function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale}}]);return G}(a.Viz);var _={center:n.sankeyCenter,justify:n.sankeyJustify,left:n.sankeyLeft,right:n.sankeyRight};var g=function(e){u(f,e);var t=h(f);function f(){var u;r(this,f);u=t.call(this);u._nodeId=Q.accessor("id");u._links=Q.accessor("links");u._linksSource="source";u._linksTarget="target";u._noDataMessage=false;u._nodes=Q.accessor("nodes");u._nodeAlign=_.justify;u._nodePadding=8;u._nodeWidth=30;u._on.mouseenter=function(){};u._on["mouseleave.shape"]=function(){u.hover(false)};var s=u._on["mousemove.shape"];u._on["mousemove.shape"]=function(e,t){s(e,t);if(u._focus&&u._focus===e.id){u.hover(false);u._on.mouseenter.bind(l(u))(e,t);u._focus=undefined}else{var n=u._nodeId(e,t),r=u._nodeLookup[n],i=Object.keys(u._nodeLookup).reduce(function(e,t){e[u._nodeLookup[t]]=!isNaN(t)?parseInt(t,10):t;return e},{});var a=u._linkLookup[r];var o=[n];a.forEach(function(e){o.push(i[e])});u.hover(function(e,t){if(e.source&&e.target){return e.source.id===n||e.target.id===n}else{return o.includes(u._nodeId(e,t))}})}};u._path=n.sankeyLinkHorizontal();u._sankey=n.sankey();u._shape=Q.constant("Rect");u._shapeConfig=Q.assign(u._shapeConfig,{Path:{fill:"none",hoverStyle:{"stroke-width":function e(t){return Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)}},label:false,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:function e(t){return Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)}},Rect:{}});u._value=Q.constant(1);return u}o(f,[{key:"_draw",value:function e(t){var i=this;ne(te(f.prototype),"_draw",this).call(this,t);var n=this._height-this._margin.top-this._margin.bottom,r=this._width-this._margin.left-this._margin.right;var a=Array.isArray(this._nodes)?this._nodes:this._links.reduce(function(e,t){if(!e.includes(t[i._linksSource]))e.push(t[i._linksSource]);if(!e.includes(t[i._linksTarget]))e.push(t[i._linksTarget]);return e},[]).map(function(e){return{id:e}});var o=a.map(function(e,t){return{__d3plus__:true,data:e,i:t,id:i._nodeId(e,t),node:e,shape:"Rect"}});var u=this._nodeLookup=o.reduce(function(e,t,n){e[t.id]=n;return e},{});var s=this._links.map(function(n,e){var t=[i._linksSource,i._linksTarget];var r=t.reduce(function(e,t){e[t]=u[n[t]];return e},{});return{source:r[i._linksSource],target:r[i._linksTarget],value:i._value(n,e)}});this._linkLookup=s.reduce(function(e,t){if(!e[t.source])e[t.source]=[];e[t.source].push(t.target);if(!e[t.target])e[t.target]=[];e[t.target].push(t.source);return e},{});var c="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(o).links(s).size([r,n])();this._shapes.push((new $.Path).config(this._shapeConfig.Path).data(s).d(this._path).select(Q.elem("g.d3plus-Links",{parent:this._select,enter:{transform:c},update:{transform:c}}).node()).render());U.nest().key(function(e){return e.shape}).entries(o).forEach(function(e){i._shapes.push((new $[e.key]).data(e.values).height(function(e){return e.y1-e.y0}).width(function(e){return e.x1-e.x0}).x(function(e){return(e.x1+e.x0)/2}).y(function(e){return(e.y1+e.y0)/2}).select(Q.elem("g.d3plus-sankey-nodes",{parent:i._select,enter:{transform:c},update:{transform:c}}).node()).config(Q.configPrep.bind(i)(i._shapeConfig,"shape",e.key)).render())});return this}},{key:"hover",value:function e(t){this._hover=t;this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t);return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linksSource",value:function e(t){return arguments.length?(this._linksSource=t,this):this._linksSource}},{key:"linksTarget",value:function e(t){return arguments.length?(this._linksTarget=t,this):this._linksTarget}},{key:"nodeAlign",value:function e(t){return arguments.length?(this._nodeAlign=typeof t==="function"?t:_[t],this):this._nodeAlign}},{key:"nodeId",value:function e(t){return arguments.length?(this._nodeId=typeof t==="function"?t:Q.accessor(t),this):this._nodeId}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"nodePadding",value:function e(t){return arguments.length?(this._nodePadding=t,this):this._nodePadding}},{key:"nodeWidth",value:function e(t){return arguments.length?(this._nodeWidth=t,this):this._nodeWidth}},{key:"value",value:function e(t){return arguments.length?(this._value=typeof t==="function"?t:Q.accessor(t),this):this._value}}]);return f}(a.Viz);e.Network=v;e.Rings=p;e.Sankey=g;Object.defineProperty(e,"__esModule",{value:true})}); | ||
(function(e){typeof define==="function"&&define.amd?define(e):e()})(function(){"use strict";var e=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function t(e,t){return t={exports:{}},e(t,t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e};var l=n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof e=="object"&&e)||Function("return this")();var o=function(e){try{return!!e()}catch(e){return true}};var d=!o(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7});var r={}.propertyIsEnumerable;var i=Object.getOwnPropertyDescriptor;var a=i&&!r.call({1:2},1);var u=a?function e(t){var n=i(this,t);return!!n&&n.enumerable}:r;var v={f:u};var s=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}};var c={}.toString;var f=function(e){return c.call(e).slice(8,-1)};var h="".split;var k=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return f(e)=="String"?h.call(e,""):Object(e)}:Object;var p=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e};var _=function(e){return k(p(e))};var g=function(e){return typeof e==="object"?e!==null:typeof e==="function"};var y=function(e,t){if(!g(e))return e;var n,r;if(t&&typeof(n=e.toString)=="function"&&!g(r=n.call(e)))return r;if(typeof(n=e.valueOf)=="function"&&!g(r=n.call(e)))return r;if(!t&&typeof(n=e.toString)=="function"&&!g(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")};var m={}.hasOwnProperty;var b=function(e,t){return m.call(e,t)};var x=l.document;var z=g(x)&&g(x.createElement);var S=function(e){return z?x.createElement(e):{}};var w=!d&&!o(function(){return Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a!=7});var M=Object.getOwnPropertyDescriptor;var O=d?M:function e(t,n){t=_(t);n=y(n,true);if(w)try{return M(t,n)}catch(e){}if(b(t,n))return s(!v.f.call(t,n),t[n])};var E={f:O};var P=function(e){if(!g(e)){throw TypeError(String(e)+" is not an object")}return e};var C=Object.defineProperty;var j=d?C:function e(t,n,r){P(t);n=y(n,true);P(r);if(w)try{return C(t,n,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");if("value"in r)t[n]=r.value;return t};var A={f:j};var L=d?function(e,t,n){return A.f(e,t,s(1,n))}:function(e,t,n){e[t]=n;return e};var q=function(t,n){try{L(l,t,n)}catch(e){l[t]=n}return n};var B="__core-js_shared__";var T=l[B]||q(B,{});var D=T;var G=Function.toString;if(typeof D.inspectSource!="function"){D.inspectSource=function(e){return G.call(e)}}var R=D.inspectSource;var I=l.WeakMap;var W=typeof I==="function"&&/native code/.test(R(I));var N=t(function(e){(e.exports=function(e,t){return D[e]||(D[e]=t!==undefined?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})});var V=0;var F=Math.random();var X=function(e){return"Symbol("+String(e===undefined?"":e)+")_"+(++V+F).toString(36)};var Y=N("keys");var H=function(e){return Y[e]||(Y[e]=X(e))};var U={};var J=l.WeakMap;var K,Z,Q;var $=function(e){return Q(e)?Z(e):K(e,{})};var ee=function(n){return function(e){var t;if(!g(e)||(t=Z(e)).type!==n){throw TypeError("Incompatible receiver, "+n+" required")}return t}};if(W){var te=new J;var ne=te.get;var re=te.has;var ie=te.set;K=function(e,t){ie.call(te,e,t);return t};Z=function(e){return ne.call(te,e)||{}};Q=function(e){return re.call(te,e)}}else{var ae=H("state");U[ae]=true;K=function(e,t){L(e,ae,t);return t};Z=function(e){return b(e,ae)?e[ae]:{}};Q=function(e){return b(e,ae)}}var oe={set:K,get:Z,has:Q,enforce:$,getterFor:ee};var ue=t(function(e){var t=oe.get;var u=oe.enforce;var s=String(String).split("String");(e.exports=function(e,t,n,r){var i=r?!!r.unsafe:false;var a=r?!!r.enumerable:false;var o=r?!!r.noTargetGet:false;if(typeof n=="function"){if(typeof t=="string"&&!b(n,"name"))L(n,"name",t);u(n).source=s.join(typeof t=="string"?t:"")}if(e===l){if(a)e[t]=n;else q(t,n);return}else if(!i){delete e[t]}else if(!o&&e[t]){a=true}if(a)e[t]=n;else L(e,t,n)})(Function.prototype,"toString",function e(){return typeof this=="function"&&t(this).source||R(this)})});var se=l;var ce=function(e){return typeof e=="function"?e:undefined};var fe=function(e,t){return arguments.length<2?ce(se[e])||ce(l[e]):se[e]&&se[e][t]||l[e]&&l[e][t]};var le=Math.ceil;var he=Math.floor;var de=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)};var ve=Math.min;var pe=function(e){return e>0?ve(de(e),9007199254740991):0};var _e=Math.max;var ge=Math.min;var ye=function(e,t){var n=de(e);return n<0?_e(n+t,0):ge(n,t)};var me=function(u){return function(e,t,n){var r=_(e);var i=pe(r.length);var a=ye(n,i);var o;if(u&&t!=t)while(i>a){o=r[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in r)&&r[a]===t)return u||a||0}return!u&&-1}};var ke={includes:me(true),indexOf:me(false)};var be=ke.indexOf;var xe=function(e,t){var n=_(e);var r=0;var i=[];var a;for(a in n)!b(U,a)&&b(n,a)&&i.push(a);while(t.length>r)if(b(n,a=t[r++])){~be(i,a)||i.push(a)}return i};var ze=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var Se=ze.concat("length","prototype");var we=Object.getOwnPropertyNames||function e(t){return xe(t,Se)};var Me={f:we};var Oe=Object.getOwnPropertySymbols;var Ee={f:Oe};var Pe=fe("Reflect","ownKeys")||function e(t){var n=Me.f(P(t));var r=Ee.f;return r?n.concat(r(t)):n};var Ce=function(e,t){var n=Pe(t);var r=A.f;var i=E.f;for(var a=0;a<n.length;a++){var o=n[a];if(!b(e,o))r(e,o,i(t,o))}};var je=/#|\.prototype\./;var Ae=function(e,t){var n=qe[Le(e)];return n==Te?true:n==Be?false:typeof t=="function"?o(t):!!t};var Le=Ae.normalize=function(e){return String(e).replace(je,".").toLowerCase()};var qe=Ae.data={};var Be=Ae.NATIVE="N";var Te=Ae.POLYFILL="P";var De=Ae;var Ge=E.f;var Re=function(e,t){var n=e.target;var r=e.global;var i=e.stat;var a,o,u,s,c,f;if(r){o=l}else if(i){o=l[n]||q(n,{})}else{o=(l[n]||{}).prototype}if(o)for(u in t){c=t[u];if(e.noTargetGet){f=Ge(o,u);s=f&&f.value}else s=o[u];a=De(r?u:n+(i?".":"#")+u,e.forced);if(!a&&s!==undefined){if(typeof c===typeof s)continue;Ce(c,s)}if(e.sham||s&&s.sham){L(c,"sham",true)}ue(o,u,c,e)}};var Ie=function(e){if(typeof e!="function"){throw TypeError(String(e)+" is not a function")}return e};var We=function(r,i,e){Ie(r);if(i===undefined)return r;switch(e){case 0:return function(){return r.call(i)};case 1:return function(e){return r.call(i,e)};case 2:return function(e,t){return r.call(i,e,t)};case 3:return function(e,t,n){return r.call(i,e,t,n)}}return function(){return r.apply(i,arguments)}};var Ne=function(e){return Object(p(e))};var Ve=Array.isArray||function e(t){return f(t)=="Array"};var Fe=!!Object.getOwnPropertySymbols&&!o(function(){return!String(Symbol())});var Xe=Fe&&!Symbol.sham&&typeof Symbol.iterator=="symbol";var Ye=N("wks");var He=l.Symbol;var Ue=Xe?He:He&&He.withoutSetter||X;var Je=function(e){if(!b(Ye,e)){if(Fe&&b(He,e))Ye[e]=He[e];else Ye[e]=Ue("Symbol."+e)}return Ye[e]};var Ke=Je("species");var Ze=function(e,t){var n;if(Ve(e)){n=e.constructor;if(typeof n=="function"&&(n===Array||Ve(n.prototype)))n=undefined;else if(g(n)){n=n[Ke];if(n===null)n=undefined}}return new(n===undefined?Array:n)(t===0?0:t)};var Qe=[].push;var $e=function(d){var v=d==1;var p=d==2;var _=d==3;var g=d==4;var y=d==6;var m=d==5||y;return function(e,t,n,r){var i=Ne(e);var a=k(i);var o=We(t,n,3);var u=pe(a.length);var s=0;var c=r||Ze;var f=v?c(e,u):p?c(e,0):undefined;var l,h;for(;u>s;s++)if(m||s in a){l=a[s];h=o(l,s,i);if(d){if(v)f[s]=h;else if(h)switch(d){case 3:return true;case 5:return l;case 6:return s;case 2:Qe.call(f,l)}else if(g)return false}}return y?-1:_||g?g:f}};var et={forEach:$e(0),map:$e(1),filter:$e(2),some:$e(3),every:$e(4),find:$e(5),findIndex:$e(6)};var tt=Object.keys||function e(t){return xe(t,ze)};var nt=d?Object.defineProperties:function e(t,n){P(t);var r=tt(n);var i=r.length;var a=0;var o;while(i>a)A.f(t,o=r[a++],n[o]);return t};var rt=fe("document","documentElement");var it=">";var at="<";var ot="prototype";var ut="script";var st=H("IE_PROTO");var ct=function(){};var ft=function(e){return at+ut+it+e+at+"/"+ut+it};var lt=function(e){e.write(ft(""));e.close();var t=e.parentWindow.Object;e=null;return t};var ht=function(){var e=S("iframe");var t="java"+ut+":";var n;e.style.display="none";rt.appendChild(e);e.src=String(t);n=e.contentWindow.document;n.open();n.write(ft("document.F=Object"));n.close();return n.F};var dt;var vt=function(){try{dt=document.domain&&new ActiveXObject("htmlfile")}catch(e){}vt=dt?lt(dt):ht();var e=ze.length;while(e--)delete vt[ot][ze[e]];return vt()};U[st]=true;var pt=Object.create||function e(t,n){var r;if(t!==null){ct[ot]=P(t);r=new ct;ct[ot]=null;r[st]=t}else r=vt();return n===undefined?r:nt(r,n)};var _t=Je("unscopables");var gt=Array.prototype;if(gt[_t]==undefined){A.f(gt,_t,{configurable:true,value:pt(null)})}var yt=function(e){gt[_t][e]=true};var mt=Object.defineProperty;var kt={};var bt=function(e){throw e};var xt=function(e,t){if(b(kt,e))return kt[e];if(!t)t={};var n=[][e];var r=b(t,"ACCESSORS")?t.ACCESSORS:false;var i=b(t,0)?t[0]:bt;var a=b(t,1)?t[1]:undefined;return kt[e]=!!n&&!o(function(){if(r&&!d)return true;var e={length:-1};if(r)mt(e,1,{enumerable:true,get:bt});else e[1]=1;n.call(e,i,a)})};var zt=et.find;var St="find";var wt=true;var Mt=xt(St);if(St in[])Array(1)[St](function(){wt=false});Re({target:"Array",proto:true,forced:wt||!Mt},{find:function e(t){return zt(this,t,arguments.length>1?arguments[1]:undefined)}});yt(St);var Ot=ke.includes;var Et=xt("indexOf",{ACCESSORS:true,1:0});Re({target:"Array",proto:true,forced:!Et},{includes:function e(t){return Ot(this,t,arguments.length>1?arguments[1]:undefined)}});yt("includes");var Pt=Object.assign;var Ct=Object.defineProperty;var jt=!Pt||o(function(){if(d&&Pt({b:1},Pt(Ct({},"a",{enumerable:true,get:function(){Ct(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var e={};var t={};var n=Symbol();var r="abcdefghijklmnopqrst";e[n]=7;r.split("").forEach(function(e){t[e]=e});return Pt({},e)[n]!=7||tt(Pt({},t)).join("")!=r})?function e(t,n){var r=Ne(t);var i=arguments.length;var a=1;var o=Ee.f;var u=v.f;while(i>a){var s=k(arguments[a++]);var c=o?tt(s).concat(o(s)):tt(s);var f=c.length;var l=0;var h;while(f>l){h=c[l++];if(!d||u.call(s,h))r[h]=s[h]}}return r}:Pt;Re({target:"Object",stat:true,forced:Object.assign!==jt},{assign:jt});var At=Je("match");var Lt=function(e){var t;return g(e)&&((t=e[At])!==undefined?!!t:f(e)=="RegExp")};var qt=function(e){if(Lt(e)){throw TypeError("The method doesn't accept regular expressions")}return e};var Bt=Je("match");var Tt=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{n[Bt]=false;return"/./"[t](n)}catch(e){}}return false};Re({target:"String",proto:true,forced:!Tt("includes")},{includes:function e(t){return!!~String(p(this)).indexOf(qt(t),arguments.length>1?arguments[1]:undefined)}});var Dt=E.f;var Gt="".startsWith;var Rt=Math.min;var It=Tt("startsWith");var Wt=!It&&!!function(){var e=Dt(String.prototype,"startsWith");return e&&!e.writable}();Re({target:"String",proto:true,forced:!Wt&&!It},{startsWith:function e(t){var n=String(p(this));qt(t);var r=pe(Rt(arguments.length>1?arguments[1]:undefined,n.length));var i=String(t);return Gt?Gt.call(n,i,r):n.slice(r,r+i.length)===i}});if(typeof window!=="undefined"){(function(){try{if(typeof SVGElement==="undefined"||Boolean(SVGElement.prototype.innerHTML)){return}}catch(e){return}function n(e){switch(e.nodeType){case 1:return i(e);case 3:return t(e);case 8:return r(e)}}function t(e){return e.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function r(e){return"\x3c!--"+e.nodeValue+"--\x3e"}function i(e){var t="";t+="<"+e.tagName;if(e.hasAttributes()){[].forEach.call(e.attributes,function(e){t+=" "+e.name+'="'+e.value+'"'})}t+=">";if(e.hasChildNodes()){[].forEach.call(e.childNodes,function(e){t+=n(e)})}t+="</"+e.tagName+">";return t}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t="";[].forEach.call(this.childNodes,function(e){t+=n(e)});return t},set:function(e){while(this.firstChild){this.removeChild(this.firstChild)}try{var t=new DOMParser;t.async=false;var n="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+e+"</svg>";var r=t.parseFromString(n,"text/xml").documentElement;[].forEach.call(r.childNodes,function(e){this.appendChild(this.ownerDocument.importNode(e,true))}.bind(this))}catch(e){throw new Error("Error parsing markup string")}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(e){this.innerHTML=e}})})()}});(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?t(exports,require("d3-array"),require("d3-collection"),require("d3-force"),require("d3-polygon"),require("d3-scale"),require("d3-zoom"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3plus-color"),require("d3-sankey")):typeof define==="function"&&define.amd?define("d3plus-network",["exports","d3-array","d3-collection","d3-force","d3-polygon","d3-scale","d3-zoom","d3plus-common","d3plus-shape","d3plus-viz","d3plus-color","d3-sankey"],t):(e=e||self,t(e.d3plus={},e.d3Array,e.d3Collection,e.d3Force,e.d3Polygon,e.scales,e.d3Zoom,e.d3plusCommon,e.shapes,e.d3plusViz,e.d3plusColor,e.d3Sankey))})(this,function(e,J,K,Z,Q,$,f,ee,te,a,R,n){"use strict";function ne(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){ne=function(e){return typeof e}}else{ne=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return ne(e)}function r(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function o(e,t,n){if(t)i(e.prototype,t);if(n)i(e,n);return e}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)s(e,t)}function re(e){re=Object.setPrototypeOf?Object.getPrototypeOf:function e(t){return t.__proto__||Object.getPrototypeOf(t)};return re(e)}function s(e,t){s=Object.setPrototypeOf||function e(t,n){t.__proto__=n;return t};return s(e,t)}function t(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function l(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function c(e,t){if(t&&(typeof t==="object"||typeof t==="function")){return t}return l(e)}function h(i){var a=t();return function e(){var t=re(i),n;if(a){var r=re(this).constructor;n=Reflect.construct(t,arguments,r)}else{n=t.apply(this,arguments)}return c(this,n)}}function d(e,t){while(!Object.prototype.hasOwnProperty.call(e,t)){e=re(e);if(e===null)break}return e}function ie(e,t,n){if(typeof Reflect!=="undefined"&&Reflect.get){ie=Reflect.get}else{ie=function e(t,n,r){var i=d(t,n);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,n);if(a.get){return a.get.call(r)}return a.value}}return ie(e,t,n||e)}var v=function(e){u(U,e);var t=h(U);function U(){var c;r(this,U);c=t.call(this);c._links=[];c._linkSize=ee.constant(1);c._linkSizeMin=1;c._linkSizeScale="sqrt";c._noDataMessage=false;c._nodes=[];c._on["click.shape"]=function(e,t){c._tooltipClass.data([]).render();if(c._hover&&c._drawDepth>=c._groupBy.length-1){var n="".concat(c._nodeGroupBy&&c._nodeGroupBy[c._drawDepth](e,t)?c._nodeGroupBy[c._drawDepth](e,t):c._id(e,t));if(c._focus&&c._focus===n){c.active(false);c._on.mouseenter.bind(l(c))(e,t);c._focus=undefined;c._zoomToBounds(null)}else{c.hover(false);var r=c._linkLookup[n],i=c._nodeLookup[n];var a=[n];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.active(function(e,t){if(e.source&&e.target)return e.source.id===n||e.target.id===n;else return a.includes("".concat(c._ids(e,t)[c._drawDepth]))});c._focus=n;var s=f.zoomTransform(c._container.node());o=o.map(function(e){return e*s.k+s.x});u=u.map(function(e){return e*s.k+s.y});c._zoomToBounds([[o[0],u[0]],[o[1],u[1]]])}}};c._on["click.legend"]=function(e,t){var n=c._id(e);var r=c._ids(e);r=r[r.length-1];if(c._hover&&c._drawDepth>=c._groupBy.length-1){if(c._focus&&c._focus===n){c.active(false);c._focus=undefined;c._zoomToBounds(null)}else{c.hover(false);var i=n.map(function(e){return c._nodeLookup[e]});var a=["".concat(r)];var o=[i[0].x-i[0].r,i[0].x+i[0].r],u=[i[0].y-i[0].r,i[0].y+i[0].r];i.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.active(function(e,t){if(e.source&&e.target)return a.includes(e.source.id)&&a.includes(e.target.id);else{var n=c._ids(e,t);return a.includes("".concat(n[n.length-1]))}});c._focus=n;var s=f.zoomTransform(c._container.node());o=o.map(function(e){return e*s.k+s.x});u=u.map(function(e){return e*s.k+s.y});c._zoomToBounds([[o[0],u[0]],[o[1],u[1]]])}c._on.mouseenter.bind(l(c))(e,t);c._on["mousemove.legend"].bind(l(c))(e,t)}};c._on.mouseenter=function(){};c._on["mouseleave.shape"]=function(){c.hover(false)};var s=c._on["mousemove.shape"];c._on["mousemove.shape"]=function(e,t){s(e,t);var n="".concat(c._nodeGroupBy&&c._nodeGroupBy[c._drawDepth](e,t)?c._nodeGroupBy[c._drawDepth](e,t):c._id(e,t)),r=c._linkLookup[n]||[],i=c._nodeLookup[n];var a=[n];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});c.hover(function(e,t){if(e.source&&e.target)return e.source.id===n||e.target.id===n;else return a.includes("".concat(c._ids(e,t)[c._drawDepth]))})};c._sizeMin=5;c._sizeScale="sqrt";c._shape=ee.constant("Circle");c._shapeConfig=ee.assign(c._shapeConfig,{ariaLabel:function e(t,n){var r=c._size?", ".concat(c._size(t,n)):"";return"".concat(c._drawLabel(t,n)).concat(r,".")},labelConfig:{duration:0,fontMin:1,fontResize:true,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:false,stroke:"#eee"}});c._x=ee.accessor("x");c._y=ee.accessor("y");c._zoom=true;return c}o(U,[{key:"_draw",value:function e(t){var i=this;ie(re(U.prototype),"_draw",this).call(this,t);var n=this._height-this._margin.top-this._margin.bottom,r="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),a=this._transition,o=this._width-this._margin.left-this._margin.right;var u=this._filteredData.reduce(function(e,t,n){e[i._id(t,n)]=t;return e},{});var s=this._nodes.reduce(function(e,t,n){e[i._nodeGroupBy?i._nodeGroupBy[i._drawDepth](t,n):t.id]=t;return e},{});s=Array.from(new Set(Object.keys(u).concat(Object.keys(s)))).map(function(e,t){var n=u[e],r=s[e];if(r===undefined)return false;return{__d3plus__:true,data:n||r,i:t,id:e,fx:n!==undefined&&i._x(n)!==undefined?i._x(n):i._x(r),fy:n!==undefined&&i._y(n)!==undefined?i._y(n):i._y(r),node:r,r:i._size?n!==undefined&&i._size(n)!==undefined?i._size(n):i._size(r):i._sizeMin,shape:n!==undefined&&i._shape(n)!==undefined?i._shape(n):i._shape(r)}}).filter(function(e){return e});var c=this._nodeLookup=s.reduce(function(e,t){e[t.id]=t;return e},{});var f=s.map(function(e){return e.node});var l=this._links.map(function(e){var t=ne(e.source);return{size:i._linkSize(e),source:t==="number"?s[f.indexOf(i._nodes[e.source])]:t==="string"?c[e.source]:c[e.source.id],target:t==="number"?s[f.indexOf(i._nodes[e.target])]:t==="string"?c[e.target]:c[e.target.id]}});this._linkLookup=l.reduce(function(e,t){if(!e[t.source.id])e[t.source.id]=[];e[t.source.id].push(t.target);if(!e[t.target.id])e[t.target.id]=[];e[t.target.id].push(t.source);return e},{});var h=s.some(function(e){return e.fx===undefined||e.fy===undefined});if(h){var d=$.scaleLinear().domain(J.extent(l,function(e){return e.size})).range([.1,.5]);var v=Z.forceSimulation().force("link",Z.forceLink(l).id(function(e){return e.id}).distance(1).strength(function(e){return d(e.size)}).iterations(4)).force("charge",Z.forceManyBody().strength(-1)).stop();var p=300;var _=.001;var g=1-Math.pow(_,1/p);v.velocityDecay(0);v.alphaMin(_);v.alphaDecay(g);v.alphaDecay(0);v.nodes(s);v.tick(p).stop();var y=s.map(function(e){return[e.vx,e.vy]});var m=0,k=0,b=0;if(y.length===2){m=100}else if(y.length>2){var x=Q.polygonHull(y);var z=te.largestRect(x,{verbose:true});m=z.angle;k=z.cx;b=z.cy}s.forEach(function(e){var t=te.pointRotate([e.vx,e.vy],-1*(Math.PI/180*m),[k,b]);e.fx=t[0];e.fy=t[1]})}var S=J.extent(s.map(function(e){return e.fx})),w=J.extent(s.map(function(e){return e.fy}));var M=$.scaleLinear().domain(S).range([0,o]),O=$.scaleLinear().domain(w).range([0,n]);var E=(S[1]-S[0])/(w[1]-w[0])||1,P=o/n;if(E>P){var C=n*P/E;O.range([(n-C)/2,n-(n-C)/2])}else{var j=o*E/P;M.range([(o-j)/2,o-(o-j)/2])}s.forEach(function(e){e.x=M(e.fx);e.y=O(e.fy)});var A=J.extent(s.map(function(e){return e.r}));var L=this._sizeMax||J.max([1,J.min(J.merge(s.map(function(t){return s.map(function(e){return t===e?null:te.pointDistance([t.x,t.y],[e.x,e.y])})})))/2]);var q=$["scale".concat(this._sizeScale.charAt(0).toUpperCase()).concat(this._sizeScale.slice(1))]().domain(A).range([A[0]===A[1]?L:J.min([L/2,this._sizeMin]),L]),B=M.domain(),T=O.domain();var D=B[1]-B[0],G=T[1]-T[0];s.forEach(function(e){var t=q(e.r);if(B[0]>M.invert(e.x-t))B[0]=M.invert(e.x-t);if(B[1]<M.invert(e.x+t))B[1]=M.invert(e.x+t);if(T[0]>O.invert(e.y-t))T[0]=O.invert(e.y-t);if(T[1]<O.invert(e.y+t))T[1]=O.invert(e.y+t)});var R=B[1]-B[0],I=T[1]-T[0];L*=J.min([D/R,G/I]);q.range([A[0]===A[1]?L:J.min([L/2,this._sizeMin]),L]);M.domain(B);O.domain(T);var W=(E>P?o:n)/2;s.forEach(function(e){e.x=M(e.fx);e.fx=e.x;e.y=O(e.fy);e.fy=e.y;e.r=q(e.r)||W;e.width=e.r*2;e.height=e.r*2});this._container=this._select.selectAll("svg.d3plus-network").data([0]);this._container=this._container.enter().append("svg").attr("class","d3plus-network").attr("opacity",0).attr("width",o).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color","transparent").merge(this._container);this._container.transition(this._transition).attr("opacity",1).attr("width",o).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top);var N=this._container.selectAll("rect.d3plus-network-hitArea").data([0]);N.enter().append("rect").attr("class","d3plus-network-hitArea").merge(N).attr("width",o).attr("height",n).attr("fill","transparent").on("click",function(){if(i._focus){i.active(false);i._focus=undefined;i._zoomToBounds(null)}});this._zoomGroup=this._container.selectAll("g.d3plus-network-zoomGroup").data([0]);var V=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup);var F=J.extent(l,function(e){return e.size});if(F[0]!==F[1]){var X=$["scale".concat(this._linkSizeScale.charAt(0).toUpperCase()).concat(this._linkSizeScale.slice(1))]().domain(F).range([this._linkSizeMin,q.range()[0]]);l.forEach(function(e){e.size=X(e.size)})}var Y=ee.configPrep.bind(this)(this._shapeConfig,"edge","Path");delete Y.on;this._shapes.push((new te.Path).config(Y).strokeWidth(function(e){return e.size}).activeStyle({"stroke-width":function e(t){return t.size}}).d(function(e){return"M".concat(e.source.x,",").concat(e.source.y," ").concat(e.target.x,",").concat(e.target.y)}).data(l).select(ee.elem("g.d3plus-network-links",{parent:V,transition:a,enter:{transform:r},update:{transform:r}}).node()).render());var H={label:function e(t){return s.length<=i._dataCutoff||i._hover&&i._hover(t)||i._active&&i._active(t)?i._drawLabel(t.data||t.node,t.i):false},select:ee.elem("g.d3plus-network-nodes",{parent:V,transition:a,enter:{transform:r},update:{transform:r}}).node()};K.nest().key(function(e){return e.shape}).entries(s).forEach(function(e){i._shapes.push((new te[e.key]).config(ee.configPrep.bind(i)(i._shapeConfig,"shape",e.key)).config(H).config(H[e.key]||{}).data(e.values).render())});return this}},{key:"hover",value:function e(t){this._hover=t;if(this._nodes.length<this._dataCutoff){this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t)}return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linkSize",value:function e(t){return arguments.length?(this._linkSize=typeof t==="function"?t:ee.constant(t),this):this._linkSize}},{key:"linkSizeMin",value:function e(t){return arguments.length?(this._linkSizeMin=t,this):this._linkSizeMin}},{key:"linkSizeScale",value:function e(t){return arguments.length?(this._linkSizeScale=t,this):this._linkSizeScale}},{key:"nodeGroupBy",value:function e(t){var n=this;if(!arguments.length)return this._nodeGroupBy;if(!(t instanceof Array))t=[t];return this._nodeGroupBy=t.map(function(e){if(typeof e==="function")return e;else{if(!n._aggs[e]){n._aggs[e]=function(e,t){var n=Array.from(new Set(e.map(t)));return n.length===1?n[0]:n}}return ee.accessor(e)}}),this}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"size",value:function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:ee.accessor(t),this):this._size}},{key:"sizeMax",value:function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax}},{key:"sizeMin",value:function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin}},{key:"sizeScale",value:function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale}},{key:"x",value:function e(t){if(arguments.length){if(typeof t==="function")this._x=t;else{this._x=ee.accessor(t);if(!this._aggs[t])this._aggs[t]=J.mean}return this}else return this._x}},{key:"y",value:function e(t){if(arguments.length){if(typeof t==="function")this._y=t;else{this._y=ee.accessor(t);if(!this._aggs[t])this._aggs[t]=J.mean}return this}else return this._y}}]);return U}(a.Viz);var p=function(e){u(G,e);var t=h(G);function G(){var s;r(this,G);s=t.call(this);s._links=[];s._linkSize=ee.constant(1);s._linkSizeMin=1;s._linkSizeScale="sqrt";s._noDataMessage=false;s._nodes=[];s._on.mouseenter=function(){};s._on["mouseleave.shape"]=function(){s.hover(false)};var c=s._on["mousemove.shape"];s._on["mousemove.shape"]=function(e,t){c(e,t);if(s._focus&&s._focus===e.id){s.hover(false);s._on.mouseenter.bind(l(s))(e,t);s._focus=undefined}else{var n=s._nodeGroupBy&&s._nodeGroupBy[s._drawDepth](e,t)?s._nodeGroupBy[s._drawDepth](e,t):s._id(e,t),r=s._linkLookup[n],i=s._nodeLookup[n];var a=[i.id];var o=[i.x-i.r,i.x+i.r],u=[i.y-i.r,i.y+i.r];r.forEach(function(e){a.push(e.id);if(e.x-e.r<o[0])o[0]=e.x-e.r;if(e.x+e.r>o[1])o[1]=e.x+e.r;if(e.y-e.r<u[0])u[0]=e.y-e.r;if(e.y+e.r>u[1])u[1]=e.y+e.r});s.hover(function(e,t){if(e.source&&e.target)return e.source.id===i.id||e.target.id===i.id;else return a.includes(s._ids(e,t)[s._drawDepth])})}};s._on["click.shape"]=function(e){s._center=e.id;s._margin={bottom:0,left:0,right:0,top:0};s._padding={bottom:0,left:0,right:0,top:0};s._draw()};s._sizeMin=5;s._sizeScale="sqrt";s._shape=ee.constant("Circle");s._shapeConfig=ee.assign(s._shapeConfig,{ariaLabel:function e(t,n){var r=s._size?", ".concat(s._size(t,n)):"";return"".concat(s._drawLabel(t,n)).concat(r,".")},labelConfig:{duration:0,fontMin:1,fontResize:true,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:false,stroke:"#eee",strokeWidth:1}});return s}o(G,[{key:"_draw",value:function e(t){var c=this;ie(re(G.prototype),"_draw",this).call(this,t);var i=this._filteredData.reduce(function(e,t,n){e[c._id(t,n)]=t;return e},{});var f=this._nodes;if(!this._nodes.length&&this._links.length){var n=Array.from(new Set(this._links.reduce(function(e,t){return e.concat([t.source,t.target])},[])));f=n.map(function(e){return ne(e)==="object"?e:{id:e}})}f=f.reduce(function(e,t,n){e[c._nodeGroupBy?c._nodeGroupBy[c._drawDepth](t,n):c._id(t,n)]=t;return e},{});f=Array.from(new Set(Object.keys(i).concat(Object.keys(f)))).map(function(e,t){var n=i[e],r=f[e];if(r===undefined)return false;return{__d3plus__:true,data:n||r,i:t,id:e,node:r,shape:n!==undefined&&c._shape(n)!==undefined?c._shape(n):c._shape(r)}}).filter(function(e){return e});var r=this._nodeLookup=f.reduce(function(e,t){e[t.id]=t;return e},{});var a=this._links.map(function(n){var e=["source","target"];var t=e.reduce(function(e,t){e[t]=typeof n[t]==="number"?f[n[t]]:r[n[t].id||n[t]];return e},{});t.size=c._linkSize(n);return t});var o=a.reduce(function(e,t){if(!e[t.source.id]){e[t.source.id]=[]}e[t.source.id].push(t);if(!e[t.target.id]){e[t.target.id]=[]}e[t.target.id].push(t);return e},{});var l=this._height-this._margin.top-this._margin.bottom,u="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),s=this._transition,h=this._width-this._margin.left-this._margin.right;var d=[],v=J.min([l,h])/2,p=v/3;var _=p,g=p*2;var y=r[this._center];y.x=h/2;y.y=l/2;y.r=this._sizeMin?J.max([this._sizeMin,_*.65]):this._sizeMax?J.min([this._sizeMax,_*.65]):_*.65;var m=[y],k=[];o[this._center].forEach(function(e){var t=e.source.id===c._center?e.target:e.source;t.edges=o[t.id].filter(function(e){return e.source.id!==c._center||e.target.id!==c._center});t.edge=e;m.push(t);k.push(t)});k.sort(function(e,t){return e.edges.length-t.edges.length});var b=[];var x=0;k.forEach(function(e){var i=e.id;e.edges=e.edges.filter(function(e){return!m.includes(e.source)&&e.target.id===i||!m.includes(e.target)&&e.source.id===i});x+=e.edges.length||1;e.edges.forEach(function(e){var t=e.source,n=e.target;var r=n.id===i?t:n;m.push(r)})});var z=Math.PI*2;var S=0;k.forEach(function(a,e){var o=a.edges.length||1;var t=z/x*o;if(e===0){S-=t/2}var u=S+t/2-z/4;a.radians=u;a.x=h/2+_*Math.cos(u);a.y=l/2+_*Math.sin(u);S+=t;a.edges.forEach(function(e,t){var n=e.source.id===a.id?e.target:e.source;var r=z/x;var i=u-r*o/2+r/2+r*t;n.radians=i;n.x=h/2+g*Math.cos(i);n.y=l/2+g*Math.sin(i);b.push(n)})});var w=p/2;var M=p/4;var O=w/2-4;if(w/2-4<8){O=J.min([w/2,8])}var E=M/2-4;if(M/2-4<4){E=J.min([M/2,4])}if(E>p/10){E=p/10}if(E>O&&E>10){E=O*.75}if(O>E*1.5){O=E*1.5}O=Math.floor(O);E=Math.floor(E);var P;if(this._size){var C=J.extent(i,function(e){return e.size});if(C[0]===C[1]){C[0]=0}P=$.scaleLinear().domain(C).rangeRound([3,J.min([O,E])]);var j=y.size;y.r=P(j)}else{P=$.scaleLinear().domain([1,2]).rangeRound([O,E])}b.forEach(function(e){e.ring=2;var t=c._size?e.size:2;e.r=c._sizeMin?J.max([c._sizeMin,P(t)]):c._sizeMax?J.min([c._sizeMax,P(t)]):P(t)});k.forEach(function(e){e.ring=1;var t=c._size?e.size:1;e.r=c._sizeMin?J.max([c._sizeMin,P(t)]):c._sizeMax?J.min([c._sizeMax,P(t)]):P(t)});f=[y].concat(k).concat(b);k.forEach(function(s){var e=["source","target"];var n=s.edge;e.forEach(function(t){n[t]=f.find(function(e){return e.id===n[t].id})});d.push(n);o[s.id].forEach(function(r){var t=r.source.id===s.id?r.target:r.source;if(t.id!==y.id){var i=b.find(function(e){return e.id===t.id});if(!i){i=k.find(function(e){return e.id===t.id})}if(i){r.spline=true;var a=h/2;var o=l/2;var u=_+(g-_)*.5;var e=["source","target"];e.forEach(function(t,e){r["".concat(t,"X")]=r[t].x+Math.cos(r[t].ring===2?r[t].radians+Math.PI:r[t].radians)*r[t].r;r["".concat(t,"Y")]=r[t].y+Math.sin(r[t].ring===2?r[t].radians+Math.PI:r[t].radians)*r[t].r;r["".concat(t,"BisectX")]=a+u*Math.cos(r[t].radians);r["".concat(t,"BisectY")]=o+u*Math.sin(r[t].radians);r[t]=f.find(function(e){return e.id===r[t].id});if(r[t].edges===undefined)r[t].edges={};var n=e===0?r.target.id:r.source.id;if(r[t].id===s.id){r[t].edges[n]={angle:s.radians+Math.PI,radius:p/2}}else{r[t].edges[n]={angle:i.radians,radius:p/2}}});d.push(r)}}})});f.forEach(function(e){if(e.id!==c._center){var t=c._shapeConfig.labelConfig.fontSize&&c._shapeConfig.labelConfig.fontSize(e)||11;var n=t*1.4;var r=n*2;var i=5;var a=p-e.r;var o=e.radians*(180/Math.PI);var u=e.r+i;var s="start";if(o<-90||o>90){u=-e.r-a-i;s="end";o+=180}e.labelBounds={x:u,y:-n/2,width:a,height:r};e.rotate=o;e.textAnchor=s}else{e.labelBounds={x:-_/2,y:-_/2,width:_,height:_}}});this._linkLookup=a.reduce(function(e,t){if(!e[t.source.id])e[t.source.id]=[];e[t.source.id].push(t.target);if(!e[t.target.id])e[t.target.id]=[];e[t.target.id].push(t.source);return e},{});var A=J.extent(a,function(e){return e.size});if(A[0]!==A[1]){var L=J.min(f,function(e){return e.r});var q=$["scale".concat(this._linkSizeScale.charAt(0).toUpperCase()).concat(this._linkSizeScale.slice(1))]().domain(A).range([this._linkSizeMin,L]);a.forEach(function(e){e.size=q(e.size)})}var B=ee.configPrep.bind(this)(this._shapeConfig,"edge","Path");delete B.on;this._shapes.push((new te.Path).config(B).strokeWidth(function(e){return e.size}).id(function(e){return"".concat(e.source.id,"_").concat(e.target.id)}).d(function(e){return e.spline?"M".concat(e.sourceX,",").concat(e.sourceY,"C").concat(e.sourceBisectX,",").concat(e.sourceBisectY," ").concat(e.targetBisectX,",").concat(e.targetBisectY," ").concat(e.targetX,",").concat(e.targetY):"M".concat(e.source.x,",").concat(e.source.y," ").concat(e.target.x,",").concat(e.target.y)}).data(d).select(ee.elem("g.d3plus-rings-links",{parent:this._select,transition:s,enter:{transform:u},update:{transform:u}}).node()).render());var T=this;var D={label:function e(t){return f.length<=c._dataCutoff||c._hover&&c._hover(t)||c._active&&c._active(t)?c._drawLabel(t.data||t.node,t.i):false},labelBounds:function e(t){return t.labelBounds},labelConfig:{fontColor:function e(t){return t.id===c._center?ee.configPrep.bind(T)(T._shapeConfig,"shape",t.key).labelConfig.fontColor(t):R.colorLegible(ee.configPrep.bind(T)(T._shapeConfig,"shape",t.key).fill(t))},fontResize:function e(t){return t.id===c._center},padding:0,textAnchor:function e(t){return r[t.id].textAnchor||ee.configPrep.bind(T)(T._shapeConfig,"shape",t.key).labelConfig.textAnchor},verticalAlign:function e(t){return t.id===c._center?"middle":"top"}},rotate:function e(t){return r[t.id].rotate||0},select:ee.elem("g.d3plus-rings-nodes",{parent:this._select,transition:s,enter:{transform:u},update:{transform:u}}).node()};K.nest().key(function(e){return e.shape}).entries(f).forEach(function(e){c._shapes.push((new te[e.key]).config(ee.configPrep.bind(c)(c._shapeConfig,"shape",e.key)).config(D).data(e.values).render())});return this}},{key:"center",value:function e(t){return arguments.length?(this._center=t,this):this._center}},{key:"hover",value:function e(t){this._hover=t;this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t);return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linkSize",value:function e(t){return arguments.length?(this._linkSize=typeof t==="function"?t:ee.constant(t),this):this._linkSize}},{key:"linkSizeMin",value:function e(t){return arguments.length?(this._linkSizeMin=t,this):this._linkSizeMin}},{key:"linkSizeScale",value:function e(t){return arguments.length?(this._linkSizeScale=t,this):this._linkSizeScale}},{key:"nodeGroupBy",value:function e(t){var n=this;if(!arguments.length)return this._nodeGroupBy;if(!(t instanceof Array))t=[t];return this._nodeGroupBy=t.map(function(e){if(typeof e==="function")return e;else{if(!n._aggs[e]){n._aggs[e]=function(e,t){var n=Array.from(new Set(e.map(t)));return n.length===1?n[0]:n}}return ee.accessor(e)}}),this}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"size",value:function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:ee.accessor(t),this):this._size}},{key:"sizeMax",value:function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax}},{key:"sizeMin",value:function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin}},{key:"sizeScale",value:function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale}}]);return G}(a.Viz);var _={center:n.sankeyCenter,justify:n.sankeyJustify,left:n.sankeyLeft,right:n.sankeyRight};var g=function(e){u(f,e);var t=h(f);function f(){var u;r(this,f);u=t.call(this);u._nodeId=ee.accessor("id");u._links=ee.accessor("links");u._linksSource="source";u._linksTarget="target";u._noDataMessage=false;u._nodes=ee.accessor("nodes");u._nodeAlign=_.justify;u._nodePadding=8;u._nodeWidth=30;u._on.mouseenter=function(){};u._on["mouseleave.shape"]=function(){u.hover(false)};var s=u._on["mousemove.shape"];u._on["mousemove.shape"]=function(e,t){s(e,t);if(u._focus&&u._focus===e.id){u.hover(false);u._on.mouseenter.bind(l(u))(e,t);u._focus=undefined}else{var n=u._nodeId(e,t),r=u._nodeLookup[n],i=Object.keys(u._nodeLookup).reduce(function(e,t){e[u._nodeLookup[t]]=!isNaN(t)?parseInt(t,10):t;return e},{});var a=u._linkLookup[r];var o=[n];a.forEach(function(e){o.push(i[e])});u.hover(function(e,t){if(e.source&&e.target){return e.source.id===n||e.target.id===n}else{return o.includes(u._nodeId(e,t))}})}};u._path=n.sankeyLinkHorizontal();u._sankey=n.sankey();u._shape=ee.constant("Rect");u._shapeConfig=ee.assign(u._shapeConfig,{Path:{fill:"none",hoverStyle:{"stroke-width":function e(t){return Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)}},label:false,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:function e(t){return Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)}},Rect:{}});u._value=ee.constant(1);return u}o(f,[{key:"_draw",value:function e(t){var i=this;ie(re(f.prototype),"_draw",this).call(this,t);var n=this._height-this._margin.top-this._margin.bottom,r=this._width-this._margin.left-this._margin.right;var a=Array.isArray(this._nodes)?this._nodes:this._links.reduce(function(e,t){if(!e.includes(t[i._linksSource]))e.push(t[i._linksSource]);if(!e.includes(t[i._linksTarget]))e.push(t[i._linksTarget]);return e},[]).map(function(e){return{id:e}});var o=a.map(function(e,t){return{__d3plus__:true,data:e,i:t,id:i._nodeId(e,t),node:e,shape:"Rect"}});var u=this._nodeLookup=o.reduce(function(e,t,n){e[t.id]=n;return e},{});var s=this._links.map(function(n,e){var t=[i._linksSource,i._linksTarget];var r=t.reduce(function(e,t){e[t]=u[n[t]];return e},{});return{source:r[i._linksSource],target:r[i._linksTarget],value:i._value(n,e)}});this._linkLookup=s.reduce(function(e,t){if(!e[t.source])e[t.source]=[];e[t.source].push(t.target);if(!e[t.target])e[t.target]=[];e[t.target].push(t.source);return e},{});var c="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(o).links(s).size([r,n])();this._shapes.push((new te.Path).config(this._shapeConfig.Path).data(s).d(this._path).select(ee.elem("g.d3plus-Links",{parent:this._select,enter:{transform:c},update:{transform:c}}).node()).render());K.nest().key(function(e){return e.shape}).entries(o).forEach(function(e){i._shapes.push((new te[e.key]).data(e.values).height(function(e){return e.y1-e.y0}).width(function(e){return e.x1-e.x0}).x(function(e){return(e.x1+e.x0)/2}).y(function(e){return(e.y1+e.y0)/2}).select(ee.elem("g.d3plus-sankey-nodes",{parent:i._select,enter:{transform:c},update:{transform:c}}).node()).config(ee.configPrep.bind(i)(i._shapeConfig,"shape",e.key)).render())});return this}},{key:"hover",value:function e(t){this._hover=t;this._shapes.forEach(function(e){return e.hover(t)});if(this._legend)this._legendClass.hover(t);return this}},{key:"links",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="links"});var i=[a.dataLoad.bind(this),t,n,"links"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._links}},{key:"linksSource",value:function e(t){return arguments.length?(this._linksSource=t,this):this._linksSource}},{key:"linksTarget",value:function e(t){return arguments.length?(this._linksTarget=t,this):this._linksTarget}},{key:"nodeAlign",value:function e(t){return arguments.length?(this._nodeAlign=typeof t==="function"?t:_[t],this):this._nodeAlign}},{key:"nodeId",value:function e(t){return arguments.length?(this._nodeId=typeof t==="function"?t:ee.accessor(t),this):this._nodeId}},{key:"nodes",value:function e(t,n){if(arguments.length){var r=this._queue.find(function(e){return e[3]==="nodes"});var i=[a.dataLoad.bind(this),t,n,"nodes"];if(r)this._queue[this._queue.indexOf(r)]=i;else this._queue.push(i);return this}return this._nodes}},{key:"nodePadding",value:function e(t){return arguments.length?(this._nodePadding=t,this):this._nodePadding}},{key:"nodeWidth",value:function e(t){return arguments.length?(this._nodeWidth=t,this):this._nodeWidth}},{key:"value",value:function e(t){return arguments.length?(this._value=typeof t==="function"?t:ee.accessor(t),this):this._value}}]);return f}(a.Viz);e.Network=v;e.Rings=p;e.Sankey=g;Object.defineProperty(e,"__esModule",{value:true})}); |
@@ -185,3 +185,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var id = "".concat(_this._nodeGroupBy && _this._nodeGroupBy[_this._drawDepth](d, i) ? _this._nodeGroupBy[_this._drawDepth](d, i) : _this._id(d, i)), | ||
links = _this._linkLookup[id], | ||
links = _this._linkLookup[id] || [], | ||
node = _this._nodeLookup[id]; | ||
@@ -324,10 +324,20 @@ var filterIds = [id]; | ||
simulation.tick(iterations).stop(); | ||
var hull = polygonHull(nodes.map(function (n) { | ||
var nodePositions = nodes.map(function (n) { | ||
return [n.vx, n.vy]; | ||
})); | ||
}); | ||
var angle = 0, | ||
cx = 0, | ||
cy = 0; | ||
var _shapes$largestRect = shapes.largestRect(hull), | ||
angle = _shapes$largestRect.angle, | ||
cx = _shapes$largestRect.cx, | ||
cy = _shapes$largestRect.cy; | ||
if (nodePositions.length === 2) { | ||
angle = 100; | ||
} else if (nodePositions.length > 2) { | ||
var hull = polygonHull(nodePositions); | ||
var rect = shapes.largestRect(hull, { | ||
verbose: true | ||
}); | ||
angle = rect.angle; | ||
cx = rect.cx; | ||
cy = rect.cy; | ||
} | ||
@@ -349,3 +359,3 @@ nodes.forEach(function (n) { | ||
y = scales.scaleLinear().domain(yExtent).range([0, height]); | ||
var nodeRatio = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]), | ||
var nodeRatio = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]) || 1, | ||
screenRatio = width / height; | ||
@@ -391,2 +401,3 @@ | ||
y.domain(yDomain); | ||
var fallbackRadius = (nodeRatio > screenRatio ? width : height) / 2; | ||
nodes.forEach(function (n) { | ||
@@ -397,3 +408,3 @@ n.x = x(n.fx); | ||
n.fy = n.y; | ||
n.r = r(n.r); | ||
n.r = r(n.r) || fallbackRadius; | ||
n.width = n.r * 2; | ||
@@ -400,0 +411,0 @@ n.height = n.r * 2; |
{ | ||
"name": "d3plus-network", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Javascript network visualizations built upon d3 modules.", | ||
@@ -5,0 +5,0 @@ "main": "build/d3plus-network.js", |
@@ -112,3 +112,3 @@ # d3plus-network | ||
<a name="Network.hover" href="#Network.hover">#</a> Network.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L469) | ||
<a name="Network.hover" href="#Network.hover">#</a> Network.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L480) | ||
@@ -121,3 +121,3 @@ If *value* is specified, sets the hover method to the specified function and returns the current class instance. | ||
<a name="Network.links" href="#Network.links">#</a> Network.**links**(*links*, [*formatter*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L492) | ||
<a name="Network.links" href="#Network.links">#</a> Network.**links**(*links*, [*formatter*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L503) | ||
@@ -141,3 +141,3 @@ A predefined *Array* of edges that connect each object passed to the [node](#Network.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways: | ||
<a name="Network.linkSize" href="#Network.linkSize">#</a> Network.**linkSize**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L509) | ||
<a name="Network.linkSize" href="#Network.linkSize">#</a> Network.**linkSize**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L520) | ||
@@ -150,3 +150,3 @@ Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale. | ||
<a name="Network.linkSizeMin" href="#Network.linkSizeMin">#</a> Network.**linkSizeMin**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L519) | ||
<a name="Network.linkSizeMin" href="#Network.linkSizeMin">#</a> Network.**linkSizeMin**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L530) | ||
@@ -159,3 +159,3 @@ Defines the minimum pixel stroke width used in link sizing. | ||
<a name="Network.linkSizeScale" href="#Network.linkSizeScale">#</a> Network.**linkSizeScale**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L529) | ||
<a name="Network.linkSizeScale" href="#Network.linkSizeScale">#</a> Network.**linkSizeScale**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L540) | ||
@@ -168,3 +168,3 @@ Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network. | ||
<a name="Network.nodeGroupBy" href="#Network.nodeGroupBy">#</a> Network.**nodeGroupBy**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L539) | ||
<a name="Network.nodeGroupBy" href="#Network.nodeGroupBy">#</a> Network.**nodeGroupBy**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L550) | ||
@@ -177,3 +177,3 @@ If *value* is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If *value* is not specified, returns the current node group accessor. | ||
<a name="Network.nodes" href="#Network.nodes">#</a> Network.**nodes**(*nodes*, [*formatter*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L565) | ||
<a name="Network.nodes" href="#Network.nodes">#</a> Network.**nodes**(*nodes*, [*formatter*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L576) | ||
@@ -194,3 +194,3 @@ The list of nodes to be used for drawing the network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded. | ||
<a name="Network.size" href="#Network.size">#</a> Network.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L582) | ||
<a name="Network.size" href="#Network.size">#</a> Network.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L593) | ||
@@ -203,3 +203,3 @@ If *value* is specified, sets the size accessor to the specified function or data key and returns the current class instance. If *value* is not specified, returns the current size accessor. | ||
<a name="Network.sizeMax" href="#Network.sizeMax">#</a> Network.**sizeMax**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L592) | ||
<a name="Network.sizeMax" href="#Network.sizeMax">#</a> Network.**sizeMax**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L603) | ||
@@ -212,3 +212,3 @@ Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes. | ||
<a name="Network.sizeMin" href="#Network.sizeMin">#</a> Network.**sizeMin**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L602) | ||
<a name="Network.sizeMin" href="#Network.sizeMin">#</a> Network.**sizeMin**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L613) | ||
@@ -221,3 +221,3 @@ Defines the minimum pixel radius used in size scaling. | ||
<a name="Network.sizeScale" href="#Network.sizeScale">#</a> Network.**sizeScale**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L612) | ||
<a name="Network.sizeScale" href="#Network.sizeScale">#</a> Network.**sizeScale**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L623) | ||
@@ -230,3 +230,3 @@ Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of nodes in the network. | ||
<a name="Network.x" href="#Network.x">#</a> Network.**x**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L622) | ||
<a name="Network.x" href="#Network.x">#</a> Network.**x**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L633) | ||
@@ -239,3 +239,3 @@ If *value* is specified, sets the x accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current x accessor. By default, the x and y positions are determined dynamically based on default force layout properties. | ||
<a name="Network.y" href="#Network.y">#</a> Network.**y**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L640) | ||
<a name="Network.y" href="#Network.y">#</a> Network.**y**([*value*]) [<>](https://github.com/d3plus/d3plus-network/blob/master/src/Network.js#L651) | ||
@@ -517,2 +517,2 @@ If *value* is specified, sets the y accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current y accessor. By default, the x and y positions are determined dynamically based on default force layout properties. | ||
###### <sub>Documentation generated on Tue, 14 Jul 2020 21:54:49 GMT</sub> | ||
###### <sub>Documentation generated on Tue, 08 Dec 2020 16:24:47 GMT</sub> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
369674
4156