/** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/d3-hierarchy@3.1.2/src/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ function n(n,r){return n.parent===r.parent?1:2}function r(n,r){return n+r.x}function t(n,r){return Math.max(n,r.y)}function e(){var e=n,u=1,i=1,o=!1;function a(n){var a,f=0;n.eachAfter((function(n){var u=n.children;u?(n.x=function(n){return n.reduce(r,0)/n.length}(u),n.y=function(n){return 1+n.reduce(t,0)}(u)):(n.x=a?f+=e(n,a):0,n.y=0,a=n)}));var c=function(n){for(var r;r=n.children;)n=r[0];return n}(n),h=function(n){for(var r;r=n.children;)n=r[r.length-1];return n}(n),l=c.x-e(c,h)/2,p=h.x+e(h,c)/2;return n.eachAfter(o?function(r){r.x=(r.x-n.x)*u,r.y=(n.y-r.y)*i}:function(r){r.x=(r.x-l)/(p-l)*u,r.y=(1-(n.y?r.y/n.y:1))*i})}return a.separation=function(n){return arguments.length?(e=n,a):e},a.size=function(n){return arguments.length?(o=!1,u=+n[0],i=+n[1],a):o?null:[u,i]},a.nodeSize=function(n){return arguments.length?(o=!0,u=+n[0],i=+n[1],a):o?[u,i]:null},a}function u(n){var r=0,t=n.children,e=t&&t.length;if(e)for(;--e>=0;)r+=t[e].value;else r=1;n.value=r}function i(n,r){n instanceof Map?(n=[void 0,n],void 0===r&&(r=a)):void 0===r&&(r=o);for(var t,e,u,i,f,l=new h(n),p=[l];t=p.pop();)if((u=r(t.data))&&(f=(u=Array.from(u)).length))for(t.children=u,i=f-1;i>=0;--i)p.push(e=u[i]=new h(u[i])),e.parent=t,e.depth=t.depth+1;return l.eachBefore(c)}function o(n){return n.children}function a(n){return Array.isArray(n)?n[1]:null}function f(n){void 0!==n.data.value&&(n.value=n.data.value),n.data=n.data.data}function c(n){var r=0;do{n.height=r}while((n=n.parent)&&n.height<++r)}function h(n){this.data=n,this.depth=this.height=0,this.parent=null}function l(n){return null==n?null:p(n)}function p(n){if("function"!=typeof n)throw new Error;return n}function s(){return 0}function d(n){return function(){return n}}h.prototype=i.prototype={constructor:h,count:function(){return this.eachAfter(u)},each:function(n,r){let t=-1;for(const e of this)n.call(r,e,++t,this);return this},eachAfter:function(n,r){for(var t,e,u,i=this,o=[i],a=[],f=-1;i=o.pop();)if(a.push(i),t=i.children)for(e=0,u=t.length;e=0;--e)i.push(t[e]);return this},find:function(n,r){let t=-1;for(const e of this)if(n.call(r,e,++t,this))return e},sum:function(n){return this.eachAfter((function(r){for(var t=+n(r.data)||0,e=r.children,u=e&&e.length;--u>=0;)t+=e[u].value;r.value=t}))},sort:function(n){return this.eachBefore((function(r){r.children&&r.children.sort(n)}))},path:function(n){for(var r=this,t=function(n,r){if(n===r)return n;var t=n.ancestors(),e=r.ancestors(),u=null;n=t.pop(),r=e.pop();for(;n===r;)u=n,n=t.pop(),r=e.pop();return u}(r,n),e=[r];r!==t;)r=r.parent,e.push(r);for(var u=e.length;n!==t;)e.splice(u,0,n),n=n.parent;return e},ancestors:function(){for(var n=this,r=[n];n=n.parent;)r.push(n);return r},descendants:function(){return Array.from(this)},leaves:function(){var n=[];return this.eachBefore((function(r){r.children||n.push(r)})),n},links:function(){var n=this,r=[];return n.each((function(t){t!==n&&r.push({source:t.parent,target:t})})),r},copy:function(){return i(this).eachBefore(f)},[Symbol.iterator]:function*(){var n,r,t,e,u=this,i=[u];do{for(n=i.reverse(),i=[];u=n.pop();)if(yield u,r=u.children)for(t=0,e=r.length;t(n=(v*n+x)%y)/y}function m(n){return w(n,g())}function w(n,r){for(var t,e,u=0,i=(n=function(n,r){let t,e,u=n.length;for(;u;)e=r()*u--|0,t=n[u],n[u]=n[e],n[e]=t;return n}(Array.from(n),r)).length,o=[];u0&&t*t>e*e+u*u}function B(n,r){for(var t=0;t1e-6?(E+Math.sqrt(E*E-4*q*b))/(2*q):b/E);return{x:e+M+z*S,y:u+B+A*S,r:S}}function b(n,r,t){var e,u,i,o,a=n.x-r.x,f=n.y-r.y,c=a*a+f*f;c?(u=r.r+t.r,u*=u,o=n.r+t.r,u>(o*=o)?(e=(c+o-u)/(2*c),i=Math.sqrt(Math.max(0,o/c-e*e)),t.x=n.x-e*a-i*f,t.y=n.y-e*f+i*a):(e=(c+u-o)/(2*c),i=Math.sqrt(Math.max(0,u/c-e*e)),t.x=r.x+e*a-i*f,t.y=r.y+e*f+i*a)):(t.x=r.x+t.r,t.y=r.y)}function S(n,r){var t=n.r+r.r-1e-6,e=r.x-n.x,u=r.y-n.y;return t>0&&t*t>e*e+u*u}function k(n){var r=n._,t=n.next._,e=r.r+t.r,u=(r.x*t.r+t.x*r.r)/e,i=(r.y*t.r+t.y*r.r)/e;return u*u+i*i}function I(n){this._=n,this.next=null,this.previous=null}function O(n,r){if(!(o=(t=n,n="object"==typeof t&&"length"in t?t:Array.from(t)).length))return 0;var t,e,u,i,o,a,f,c,h,l,p,s;if((e=n[0]).x=0,e.y=0,!(o>1))return e.r;if(u=n[1],e.x=-u.r,u.x=e.r,u.y=0,!(o>2))return e.r+u.r;b(u,e,i=n[2]),e=new I(e),u=new I(u),i=new I(i),e.next=i.previous=u,u.next=e.previous=i,i.next=u.previous=e;n:for(c=3;cfunction(n){n=`${n}`;let r=n.length;V(n,r-1)&&!V(n,r-2)&&(n=n.slice(0,-1));return"/"===n[0]?n:`/${n}`}(n(r,t,e)))),t=r.map(U),u=new Set(r).add("");for(const n of t)u.has(n)||(u.add(n),r.push(n),t.push(U(n)),d.push(J));v=(n,t)=>r[t],x=(n,r)=>t[r]}for(o=0,u=d.length;o=0&&(l=d[n]).data===J;--n)l.data=null}if(a.parent=G,a.eachBefore((function(n){n.depth=n.parent.depth+1,--u})).eachBefore(c),a.parent=null,u>0)throw new Error("cycle");return a}return e.id=function(n){return arguments.length?(r=l(n),e):r},e.parentId=function(n){return arguments.length?(t=l(n),e):t},e.path=function(r){return arguments.length?(n=l(r),e):n},e}function U(n){let r=n.length;if(r<2)return"";for(;--r>1&&!V(n,r););return n.slice(0,r)}function V(n,r){if("/"===n[r]){let t=0;for(;r>0&&"\\"===n[--r];)++t;if(0==(1&t))return!0}return!1}function W(n,r){return n.parent===r.parent?1:2}function X(n){var r=n.children;return r?r[0]:n.t}function Y(n){var r=n.children;return r?r[r.length-1]:n.t}function Z(n,r,t){var e=t/(r.i-n.i);r.c-=e,r.s+=t,n.c+=e,r.z+=t,r.m+=t}function nn(n,r,t){return n.a.parent===r.parent?n.a:t}function rn(n,r){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=r}function tn(){var n=W,r=1,t=1,e=null;function u(u){var f=function(n){for(var r,t,e,u,i,o=new rn(n,0),a=[o];r=a.pop();)if(e=r._.children)for(r.children=new Array(i=e.length),u=i-1;u>=0;--u)a.push(t=r.children[u]=new rn(e[u],u)),t.parent=r;return(o.parent=new rn(null,0)).children=[o],o}(u);if(f.eachAfter(i),f.parent.m=-f.z,f.eachBefore(o),e)u.eachBefore(a);else{var c=u,h=u,l=u;u.eachBefore((function(n){n.xh.x&&(h=n),n.depth>l.depth&&(l=n)}));var p=c===h?1:n(c,h)/2,s=p-c.x,d=r/(h.x+p+s),v=t/(l.depth||1);u.eachBefore((function(n){n.x=(n.x+s)*d,n.y=n.depth*v}))}return u}function i(r){var t=r.children,e=r.parent.children,u=r.i?e[r.i-1]:null;if(t){!function(n){for(var r,t=0,e=0,u=n.children,i=u.length;--i>=0;)(r=u[i]).z+=t,r.m+=t,t+=r.s+(e+=r.c)}(r);var i=(t[0].z+t[t.length-1].z)/2;u?(r.z=u.z+n(r._,u._),r.m=r.z-i):r.z=i}else u&&(r.z=u.z+n(r._,u._));r.parent.A=function(r,t,e){if(t){for(var u,i=r,o=r,a=t,f=i.parent.children[0],c=i.m,h=o.m,l=a.m,p=f.m;a=Y(a),i=X(i),a&&i;)f=X(f),(o=Y(o)).a=r,(u=a.z+l-i.z-c+n(a._,i._))>0&&(Z(nn(a,r,e),r,u),c+=u,h+=u),l+=a.m,c+=i.m,p+=f.m,h+=o.m;a&&!Y(o)&&(o.t=a,o.m+=l-h),i&&!X(f)&&(f.t=i,f.m+=c-p,e=r)}return e}(r,u,r.parent.A||e[0])}function o(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function a(n){n.x*=r,n.y=n.depth*t}return u.separation=function(r){return arguments.length?(n=r,u):n},u.size=function(n){return arguments.length?(e=!1,r=+n[0],t=+n[1],u):e?null:[r,t]},u.nodeSize=function(n){return arguments.length?(e=!0,r=+n[0],t=+n[1],u):e?[r,t]:null},u}function en(n,r,t,e,u){for(var i,o=n.children,a=-1,f=o.length,c=n.value&&(u-t)/n.value;++ap&&(p=a),x=h*h*v,(s=Math.max(p/x,x/l))>d){h-=a;break}d=s}y.push(o={value:h,dice:f1?r:1)},t}(un);function fn(){var n=an,r=!1,t=1,e=1,u=[0],i=s,o=s,a=s,f=s,c=s;function h(n){return n.x0=n.y0=0,n.x1=t,n.y1=e,n.eachBefore(l),u=[0],r&&n.eachBefore(N),n}function l(r){var t=u[r.depth],e=r.x0+t,h=r.y0+t,l=r.x1-t,p=r.y1-t;l=t-1){var h=a[r];return h.x0=u,h.y0=i,h.x1=o,void(h.y1=f)}var l=c[r],p=e/2+l,s=r+1,d=t-1;for(;s>>1;c[v]f-i){var g=e?(u*y+o*x)/e:o;n(r,s,x,u,i,g,f),n(s,t,y,g,i,o,f)}else{var m=e?(i*y+f*x)/e:f;n(r,s,x,u,i,o,m),n(s,t,y,u,m,o,f)}}(0,f,n.value,r,t,e,u)}function hn(n,r,t,e,u){(1&n.depth?en:C)(n,r,t,e,u)}var ln=function n(r){function t(n,t,e,u,i){if((o=n._squarify)&&o.ratio===r)for(var o,a,f,c,h,l=-1,p=o.length,s=n.value;++l1?r:1)},t}(un);export{h as Node,e as cluster,i as hierarchy,j as pack,m as packEnclose,R as packSiblings,F as partition,Q as stratify,tn as tree,fn as treemap,cn as treemapBinary,C as treemapDice,ln as treemapResquarify,en as treemapSlice,hn as treemapSliceDice,an as treemapSquarify};export default null;