@hpcc-js/tree 3.2.19 → 3.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,1399 @@
1
- var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{ITree as n}from"@hpcc-js/api";import{SVGWidget as r,rgb as i,d3Event as o,interpolateZoom as a,Utility as l,PropertyExt as s,SVGZoomWidget as c,select as u,Palette as h,HTMLWidget as p,Platform as d,max as f,scaleLinear as y,scaleSqrt as m,interpolate as g}from"@hpcc-js/common";const x="@hpcc-js/tree",_="3.2.19",b="3.24.0";function v(t,e){return t.parent===e.parent?1:2}function w(t){return t.reduce(S,0)/t.length}function S(t,e){return t+e.x}function z(t){return 1+t.reduce(C,0)}function C(t,e){return Math.max(t,e.y)}function k(t){for(var e;e=t.children;)t=e[0];return t}function M(t){for(var e;e=t.children;)t=e[e.length-1];return t}function T(){var t=v,n=1,r=1,i=!1;function o(e){var o,a=0;e.eachAfter(function(e){var n=e.children;n?(e.x=w(n),e.y=z(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var l=k(e),s=M(e),c=l.x-t(l,s)/2,u=s.x+t(s,l)/2;return e.eachAfter(i?function(t){t.x=(t.x-e.x)*n,t.y=(e.y-t.y)*r}:function(t){t.x=(t.x-c)/(u-c)*n,t.y=(1-(e.y?t.y/e.y:1))*r})}return e(o,"cluster"),o.separation=function(e){return arguments.length?(t=e,o):t},o.size=function(t){return arguments.length?(i=!1,n=+t[0],r=+t[1],o):i?null:[n,r]},o.nodeSize=function(t){return arguments.length?(i=!0,n=+t[0],r=+t[1],o):i?[n,r]:null},o}function D(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function A(){return this.eachAfter(D)}function I(t){var e,n,r,i,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r])}while(a.length);return this}function R(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this}function P(t){for(var e,n,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n]);for(;i=a.pop();)t(i);return this}function L(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})}function B(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function E(t){for(var e=this,n=N(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r}function N(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}function q(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function F(){var t=[];return this.each(function(e){t.push(e)}),t}function O(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function V(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function W(t,e){var n,r,i,o,a,l=new Z(t),s=+t.value&&(l.value=t.value),c=[l];for(null==e&&(e=j);n=c.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)c.push(r=n.children[o]=new Z(i[o])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(J)}function $(){return W(this).eachBefore(H)}function j(t){return t.children}function H(t){t.data=t.data.data}function J(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}e(v,"defaultSeparation$1"),e(w,"meanX"),e(S,"meanXReduce"),e(z,"maxY"),e(C,"maxYReduce"),e(k,"leafLeft"),e(M,"leafRight"),e(T,"d3Cluster"),e(D,"count"),e(A,"node_count"),e(I,"node_each"),e(R,"node_eachBefore"),e(P,"node_eachAfter"),e(L,"node_sum"),e(B,"node_sort"),e(E,"node_path"),e(N,"leastCommonAncestor"),e(q,"node_ancestors"),e(F,"node_descendants"),e(O,"node_leaves"),e(V,"node_links"),e(W,"hierarchy"),e($,"node_copy"),e(j,"defaultChildren"),e(H,"copyData"),e(J,"computeHeight"),e(Z,"Node$1"),Z.prototype=W.prototype={constructor:Z,count:A,each:I,eachAfter:P,eachBefore:R,sum:L,sort:B,path:E,ancestors:q,descendants:F,leaves:O,links:V,copy:$};var X=Array.prototype.slice;function Y(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}function K(t){for(var e,n,r=0,i=(t=Y(X.call(t))).length,o=[];r<i;)e=t[r],n&&U(n,e)?++r:(n=et(o=Q(o,e)),r=0);return n}function Q(t,e){var n,r;if(tt(e,t))return[e];for(n=0;n<t.length;++n)if(G(e,t[n])&&tt(rt(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(G(rt(t[n],t[r]),e)&&G(rt(t[n],e),t[r])&&G(rt(t[r],e),t[n])&&tt(it(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function G(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function U(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function tt(t,e){for(var n=0;n<e.length;++n)if(!U(t,e[n]))return!1;return!0}function et(t){switch(t.length){case 1:return nt(t[0]);case 2:return rt(t[0],t[1]);case 3:return it(t[0],t[1],t[2])}}function nt(t){return{x:t.x,y:t.y,r:t.r}}function rt(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,l=e.r,s=o-n,c=a-r,u=l-i,h=Math.sqrt(s*s+c*c);return{x:(n+o+s/h*u)/2,y:(r+a+c/h*u)/2,r:(h+i+l)/2}}function it(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,l=e.y,s=e.r,c=n.x,u=n.y,h=n.r,p=r-a,d=r-c,f=i-l,y=i-u,m=s-o,g=h-o,x=r*r+i*i-o*o,_=x-a*a-l*l+s*s,b=x-c*c-u*u+h*h,v=d*f-p*y,w=(f*b-y*_)/(2*v)-r,S=(y*m-f*g)/v,z=(d*_-p*b)/(2*v)-i,C=(p*g-d*m)/v,k=S*S+C*C-1,M=2*(o+w*S+z*C),T=w*w+z*z-o*o,D=-(k?(M+Math.sqrt(M*M-4*k*T))/(2*k):T/M);return{x:r+w+S*D,y:i+z+C*D,r:D}}function ot(t,e,n){var r,i,o,a,l=t.x-e.x,s=t.y-e.y,c=l*l+s*s;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*l-o*s,n.y=t.y-r*s+o*l):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*l-o*s,n.y=e.y+r*s+o*l)):(n.x=e.x+n.r,n.y=e.y)}function at(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function lt(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function st(t){this._=t,this.next=null,this.previous=null}function ct(t){if(!(i=t.length))return 0;var e,n,r,i,o,a,l,s,c,u,h;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;ot(n,e,r=t[2]),e=new st(e),n=new st(n),r=new st(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(l=3;l<i;++l){ot(e._,n._,r=t[l]),r=new st(r),s=n.next,c=e.previous,u=n._.r,h=e._.r;do{if(u<=h){if(at(s._,r._)){n=s,e.next=n,n.previous=e,--l;continue t}u+=s._.r,s=s.next}else{if(at(c._,r._)){(e=c).next=n,n.previous=e,--l;continue t}h+=c._.r,c=c.previous}}while(s!==c.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,o=lt(e);(r=r.next)!==n;)(a=lt(r))<o&&(e=r,o=a);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=K(e),l=0;l<i;++l)(e=t[l]).x-=r.x,e.y-=r.y;return r.r}function ut(t){return null==t?null:ht(t)}function ht(t){if("function"!=typeof t)throw new Error;return t}function pt(){return 0}function dt(t){return function(){return t}}function ft(t){return Math.sqrt(t.value)}function yt(){var t=null,n=1,r=1,i=pt;function o(e){return e.x=n/2,e.y=r/2,t?e.eachBefore(mt(t)).eachAfter(gt(i,.5)).eachBefore(xt(1)):e.eachBefore(mt(ft)).eachAfter(gt(pt,1)).eachAfter(gt(i,e.r/Math.min(n,r))).eachBefore(xt(Math.min(n,r)/(2*e.r))),e}return e(o,"pack"),o.radius=function(e){return arguments.length?(t=ut(e),o):t},o.size=function(t){return arguments.length?(n=+t[0],r=+t[1],o):[n,r]},o.padding=function(t){return arguments.length?(i="function"==typeof t?t:dt(+t),o):i},o}function mt(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function gt(t,e){return function(n){if(r=n.children){var r,i,o,a=r.length,l=t(n)*e||0;if(l)for(i=0;i<a;++i)r[i].r+=l;if(o=ct(r),l)for(i=0;i<a;++i)r[i].r-=l;n.r=o+l}}}function xt(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function _t(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function bt(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,c=t.value&&(r-e)/t.value;++l<s;)(o=a[l]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c}function vt(){var t=1,n=1,r=0,i=!1;function o(e){var o=e.height+1;return e.x0=e.y0=r,e.x1=t,e.y1=n/o,e.eachBefore(a(n,o)),i&&e.eachBefore(_t),e}function a(t,e){return function(n){n.children&&bt(n,n.x0,t*(n.depth+1)/e,n.x1,t*(n.depth+2)/e);var i=n.x0,o=n.y0,a=n.x1-r,l=n.y1-r;a<i&&(i=a=(i+a)/2),l<o&&(o=l=(o+l)/2),n.x0=i,n.y0=o,n.x1=a,n.y1=l}}return e(o,"partition"),e(a,"positionNode"),o.round=function(t){return arguments.length?(i=!!t,o):i},o.size=function(e){return arguments.length?(t=+e[0],n=+e[1],o):[t,n]},o.padding=function(t){return arguments.length?(r=+t,o):r},o}function wt(t,e){return t.parent===e.parent?1:2}function St(t){var e=t.children;return e?e[0]:t.t}function zt(t){var e=t.children;return e?e[e.length-1]:t.t}function Ct(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function kt(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Mt(t,e,n){return t.a.parent===e.parent?t.a:n}function Tt(t,e){this._=t,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=e}function Dt(t){for(var e,n,r,i,o,a=new Tt(t,0),l=[a];e=l.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)l.push(n=e.children[i]=new Tt(r[i],i)),n.parent=e;return(a.parent=new Tt(null,0)).children=[a],a}function At(){var t=wt,n=1,r=1,i=null;function o(e){var o=Dt(e);if(o.eachAfter(a),o.parent.m=-o.z,o.eachBefore(l),i)e.eachBefore(c);else{var s=e,u=e,h=e;e.eachBefore(function(t){t.x<s.x&&(s=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var p=s===u?1:t(s,u)/2,d=p-s.x,f=n/(u.x+p+d),y=r/(h.depth||1);e.eachBefore(function(t){t.x=(t.x+d)*f,t.y=t.depth*y})}return e}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){kt(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=s(e,i,e.parent.A||r[0])}function l(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(e,n,r){if(n){for(var i,o=e,a=e,l=n,s=o.parent.children[0],c=o.m,u=a.m,h=l.m,p=s.m;l=zt(l),o=St(o),l&&o;)s=St(s),(a=zt(a)).a=e,(i=l.z+h-o.z-c+t(l._,o._))>0&&(Ct(Mt(l,e,r),e,i),c+=i,u+=i),h+=l.m,c+=o.m,p+=s.m,u+=a.m;l&&!zt(a)&&(a.t=l,a.m+=h-u),o&&!St(s)&&(s.t=o,s.m+=c-p,r=e)}return r}function c(t){t.x*=n,t.y=t.depth*r}return e(o,"tree"),e(a,"firstWalk"),e(l,"secondWalk"),e(s,"apportion"),e(c,"sizeNode"),o.separation=function(e){return arguments.length?(t=e,o):t},o.size=function(t){return arguments.length?(i=!1,n=+t[0],r=+t[1],o):i?null:[n,r]},o.nodeSize=function(t){return arguments.length?(i=!0,n=+t[0],r=+t[1],o):i?[n,r]:null},o}function It(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,c=t.value&&(i-n)/t.value;++l<s;)(o=a[l]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c}e(Y,"shuffle"),e(K,"enclose"),e(Q,"extendBasis"),e(G,"enclosesNot"),e(U,"enclosesWeak"),e(tt,"enclosesWeakAll"),e(et,"encloseBasis"),e(nt,"encloseBasis1"),e(rt,"encloseBasis2"),e(it,"encloseBasis3"),e(ot,"place"),e(at,"intersects"),e(lt,"score"),e(st,"Node"),e(ct,"packEnclose"),e(ut,"optional"),e(ht,"required"),e(pt,"constantZero"),e(dt,"constant$1"),e(ft,"defaultRadius"),e(yt,"d3Pack"),e(mt,"radiusLeaf"),e(gt,"packChildren"),e(xt,"translateChild"),e(_t,"roundNode"),e(bt,"d3treemapDice"),e(vt,"d3Parition"),e(wt,"defaultSeparation"),e(St,"nextLeft"),e(zt,"nextRight"),e(Ct,"moveSubtree"),e(kt,"executeShifts"),e(Mt,"nextAncestor"),e(Tt,"TreeNode"),Tt.prototype=Object.create(Z.prototype),e(Dt,"treeRoot"),e(At,"d3Tree"),e(It,"d3treemapSlice");var Rt=(1+Math.sqrt(5))/2;function Pt(t,e,n,r,i,o){for(var a,l,s,c,u,h,p,d,f,y,m,g=[],x=e.children,_=0,b=0,v=x.length,w=e.value;_<v;){s=i-n,c=o-r;do{u=x[b++].value}while(!u&&b<v);for(h=p=u,m=u*u*(y=Math.max(c/s,s/c)/(w*t)),f=Math.max(p/m,m/h);b<v;++b){if(u+=l=x[b].value,l<h&&(h=l),l>p&&(p=l),m=u*u*y,(d=Math.max(p/m,m/h))>f){u-=l;break}f=d}g.push(a={value:u,dice:s<c,children:x.slice(_,b)}),a.dice?bt(a,n,r,i,w?r+=c*u/w:o):It(a,n,r,w?n+=s*u/w:i,o),w-=u,_=b}return g}e(Pt,"squarifyRatio");const Lt=/* @__PURE__ */e(function t(n){function r(t,e,r,i,o){Pt(n,t,e,r,i,o)}return e(r,"squarify"),r.ratio=function(e){return t((e=+e)>1?e:1)},r},"custom")(Rt);function Bt(){var t=Lt,n=!1,r=1,i=1,o=[0],a=pt,l=pt,s=pt,c=pt,u=pt;function h(t){return t.x0=t.y0=0,t.x1=r,t.y1=i,t.eachBefore(p),o=[0],n&&t.eachBefore(_t),t}function p(e){var n=o[e.depth],r=e.x0+n,i=e.y0+n,h=e.x1-n,p=e.y1-n;h<r&&(r=h=(r+h)/2),p<i&&(i=p=(i+p)/2),e.x0=r,e.y0=i,e.x1=h,e.y1=p,e.children&&(n=o[e.depth+1]=a(e)/2,r+=u(e)-n,i+=l(e)-n,(h-=s(e)-n)<r&&(r=h=(r+h)/2),(p-=c(e)-n)<i&&(i=p=(i+p)/2),t(e,r,i,h,p))}return e(h,"treemap"),e(p,"positionNode"),h.round=function(t){return arguments.length?(n=!!t,h):n},h.size=function(t){return arguments.length?(r=+t[0],i=+t[1],h):[r,i]},h.tile=function(e){return arguments.length?(t=ht(e),h):t},h.padding=function(t){return arguments.length?h.paddingInner(t).paddingOuter(t):h.paddingInner()},h.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:dt(+t),h):a},h.paddingOuter=function(t){return arguments.length?h.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):h.paddingTop()},h.paddingTop=function(t){return arguments.length?(l="function"==typeof t?t:dt(+t),h):l},h.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:dt(+t),h):s},h.paddingBottom=function(t){return arguments.length?(c="function"==typeof t?t:dt(+t),h):c},h.paddingLeft=function(t){return arguments.length?(u="function"==typeof t?t:dt(+t),h):u},h}function Et(t,n,r,i,o){var a,l,s=t.children,c=s.length,u=new Array(c+1);for(u[0]=l=a=0;a<c;++a)u[a+1]=l+=s[a].value;function h(t,e,n,r,i,o,a){if(t>=e-1){var l=s[t];return l.x0=r,l.y0=i,l.x1=o,void(l.y1=a)}for(var c=u[t],p=n/2+c,d=t+1,f=e-1;d<f;){var y=d+f>>>1;u[y]<p?d=y+1:f=y}p-u[d-1]<u[d]-p&&t+1<d&&--d;var m=u[d]-c,g=n-m;if(o-r>a-i){var x=(r*g+o*m)/n;h(t,d,m,r,i,x,a),h(d,e,g,x,i,o,a)}else{var _=(i*g+a*m)/n;h(t,d,m,r,i,o,_),h(d,e,g,r,_,o,a)}}h(0,c,t.value,n,r,i,o),e(h,"partition")}function Nt(t,e,n,r,i){(1&t.depth?It:bt)(t,e,n,r,i)}e(Bt,"d3Treemap"),e(Et,"d3treemapBinary"),e(Nt,"d3treemapSliceDice");const qt=/* @__PURE__ */e(function t(n){function r(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,l,s,c,u,h=-1,p=a.length,d=t.value;++h<p;){for(s=(l=a[h]).children,c=l.value=0,u=s.length;c<u;++c)l.value+=s[c].value;l.dice?bt(l,e,r,i,r+=(o-r)*l.value/d):It(l,e,r,e+=(i-e)*l.value/d,o),d-=l.value}else t._squarify=a=Pt(n,t,e,r,i,o),a.ratio=n}return e(r,"resquarify"),r.ratio=function(e){return t((e=+e)>1?e:1)},r},"custom")(Rt),Ft=class _CirclePacking extends r{diameter;pack;svg;_focus;circle;view;_node;constructor(){super(),n.call(this)}enter(t,e){this.diameter=Math.min(this.width(),this.height()),this.pack=yt().size([this.diameter-4,this.diameter-4]).padding(1.5),this.svg=e.append("g")}update(t,e){const n=this;this.diameter=Math.min(this.width(),this.height()),this.pack.size([this.diameter-4,this.diameter-4]).padding(1.5),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this.svg.selectAll("circle").remove(),this.svg.selectAll("text").remove();const r=W(this.data()).sum(function(t){return t&&t.size?t.size:1}).sort(function(t,e){return t.value<e.value?-1:t.value>e.value?1:0});this._focus=r,this.pack(r),this.circle=this.svg.selectAll("circle").data(r.descendants()).enter().append("circle").attr("class",function(t){return t.parent?t.children?"node":"node leaf":"node root"}).style("fill",function(t){return t.color=n.paletteDepthLevel_exists()&&t.depth>n.paletteDepthLevel()?i(t.parent.color)[n.paletteDepthVariant()](1):n._palette(t.data.label),t.color}).on("click",function(t){n.click(t.data,null,null)}).on("dblclick",function(t){this._focus!==t&&n.zoom(t),o().stopPropagation()}),this.circle.append("title").text(function(t){return t.data.label}),this.svg.selectAll("text").data(r.descendants()).enter().append("text").attr("class","label").style("fill-opacity",function(t){return t.parent===r?1:0}).style("display",function(t){return t.parent===r?null:"none"}).text(function(t){return t.data.label+(n.showSize()&&void 0!==t.data.size?" "+t.data.size:"")}),this._node=this.svg.selectAll("circle,text"),this.zoomTo([r.x,r.y,2*r.r])}zoom(t){this._focus=t;const n=this,r=this.svg.transition().duration(o().altKey?7500:750).tween("zoom",function(){const t=a(n.view,[n._focus.x,n._focus.y,2*n._focus.r]);return function(e){n.zoomTo(t(e))}});function i(t){return t===n._focus&&!t.children||t.parent===n._focus}e(i,"showText"),r.selectAll("text").filter(function(t){return i(t)||"inline"===this.style.display}).style("fill-opacity",function(t){return i(t)?1:0}).on("start",function(t){i(t)&&(this.style.display="inline")}).on("end",function(t){i(t)||(this.style.display="none")})}zoomTo(t){const e=this.diameter/t[2];this.view=t,this._node.attr("transform",function(n){return"translate("+(n.x-t[0])*e+","+(n.y-t[1])*e+")"}),this.circle.attr("r",function(t){return t.r*e})}};e(Ft,"CirclePacking");let Ot=Ft;Ot.prototype._class+=" tree_CirclePacking",Ot.prototype.implements(n.prototype),Ot.prototype.publish("showSize",!0,"boolean","Show size along with label"),Ot.prototype.publish("paletteDepthLevel",null,"number","If not null then beyond this depth number the child node colors are based on parent",null,{optional:!0}),Ot.prototype.publish("paletteDepthVariant","brighter","set","Determines paletteDepthLevel decendant color shade variant",["brighter","darker"],{disable:/* @__PURE__ */e(t=>t.paletteDepthLevel_exists(),"disable")}),Ot.prototype.publish("paletteID","default","set","Color palette for this widget",Ot.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ot.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const Vt=class _DendrogramColumn extends s{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};e(Vt,"DendrogramColumn");let Wt=Vt;Wt.prototype._class+=" tree_Dendrogram.DendrogramColumn",Wt.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const $t=class _Dendrogram extends c{Column;_d3LayoutCluster;_d3LayoutTree;_d3Layout;constructor(){super(),n.call(this),l.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this._d3LayoutCluster=T(),this._d3LayoutTree=At()}dendrogramData(){if(0===this.data().length)return[];if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()});function t(e){return{label:e.key,children:e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),origRows:e.values}}}enter(t,e){super.enter(t,e),this._renderElement.attr("opacity",0).transition().duration(500).attr("opacity",1),this._selection.widgetElement(this._renderElement)}update(t,n){super.update(t,n);const r=this,i="vertical"===this.orientation();this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Layout=this.dendrogram()?this._d3LayoutCluster:this._d3LayoutTree,this.radial()?(this._d3Layout.size([360,2*this.separation()]),this._d3Layout.separation(/* @__PURE__ */e(function(t,e){return(t.parent===e.parent?1:2)/t.depth},"separation"))):(this._d3Layout.nodeSize([14,this.separation()]),this._d3Layout.separation(/* @__PURE__ */e(function(t,e){return t.parent===e.parent?1:2},"separation")));const o=W(this.dendrogramData());this._d3Layout(o);const a=o.descendants(),l=o.descendants().slice(1);function s(t){return"M"+t.parent.x+","+t.parent.y+"C"+t.parent.x+","+(t.parent.y+t.y)/2+" "+t.x+","+(t.parent.y+t.y)/2+" "+t.x+","+t.y}function c(t){return"M"+t.y+","+t.x+"C"+(t.y+t.parent.y)/2+","+t.x+" "+(t.y+t.parent.y)/2+","+t.parent.x+" "+t.parent.y+","+t.parent.x}function h(t){return i?s(t):c(t)}function p(t,e){const n=(t-90)/180*Math.PI,r=e;return[r*Math.cos(n),r*Math.sin(n)]}function d(t){return"M"+p(t.x,t.y)+"C"+p(t.x,(t.y+t.parent.y)/2)+" "+p(t.parent.x,(t.y+t.parent.y)/2)+" "+p(t.parent.x,t.parent.y)}e(s,"linkVertical"),e(c,"linkHorizontal"),e(h,"diagonal"),e(p,"project"),e(d,"radialDiagonal");const f=this._renderCount?500:0,y=this._renderElement.selectAll(".link").data(l);y.enter().append("path").attr("class","link").attr("d",this.radial()?d:h),y.transition().duration(f).attr("d",this.radial()?d:h),y.exit().remove();const m=this.circleRadius()+2;function g(t){return r.radial()?"rotate("+(t.x-90)+")translate("+t.y+")":"horizontal"===r.orientation()?"translate("+t.y+","+t.x+")":"translate("+t.x+","+t.y+")"}e(g,"nodeTransform");const x=this._renderElement.selectAll(".node").data(a);x.transition().duration(f).attr("transform",g);const _=x.enter().append("g").attr("class","node").attr("transform",g).call(this._selection.enter.bind(this._selection)).on("click",function(t){let e=t;for(;e.children;)e=e.children[0];t.depth>0&&(e.origRows?r.click(r.rowToObj(e.origRows[0]),r.mappings()[t.depth-1].column(),!0):r.click(e.data,r.mappings()[t.depth-1].column(),!0))}).on("dblclick",function(t){let e=t;for(;e.children;)e=e.children[0];t.depth>0&&(e.origRows?r.dblclick(r.rowToObj(e.origRows[0]),r.mappings()[t.depth-1].column(),!0):r.dblclick(e.data,r.mappings()[t.depth-1].column(),!0))}).each(function(){const t=u(this);t.append("circle"),t.append("text")});_.merge(x).select("circle").attr("r",this.circleRadius()).style("fill",function(t){return r._palette(t.data.label)}).append("title").text(function(t){return t.data.label}),_.merge(x).select("text").attr("dx",function(t){return r.radial()?t.children?t.x<180?-m:m:t.x<180?m:-m:i?t.children?m:-m:t.children?-m:m}).attr("dy","0.25em").style("text-anchor",function(t){return r.radial()?t.children?t.x<180?"end":"start":t.x<180?"start":"end":i?t.children?"start":"end":t.children?"end":"start"}).attr("transform",function(t){return r.radial()?t.x<180?null:"rotate(180)":i?"rotate(-66)":null}).text(function(t){return t.data.label}),x.exit().remove(),this._renderCount||r.zoomToFit()}};e($t,"Dendrogram");let jt=$t;jt.prototype._class+=" tree_Dendrogram",jt.prototype.implements(n.prototype),jt.prototype.mixin(l.SimpleSelectionMixin),jt.prototype.Column=Wt,jt.prototype.publish("paletteID","default","set","Color palette for this widget",jt.prototype._palette.switch(),{tags:["Basic","Shared"]}),jt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),jt.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:Wt}),jt.prototype.publish("circleRadius",4.5,"number","Text offset from circle"),jt.prototype.publish("separation",240,"number","Leaf Separation"),jt.prototype.publish("dendrogram",!0,"boolean","Dendrogram"),jt.prototype.publish("radial",!1,"boolean","Radial"),jt.prototype.publish("orientation","horizontal","set","Orientation",["horizontal","vertical"],{tags:["Private"],disable:/* @__PURE__ */e(t=>t.radial(),"disable")});const Ht=class _DirectoryTree extends p{constructor(){super()}flattenData(t){const e=this,n=W(t),r=[];return this.omitRoot()?n.children&&n.children.forEach(i):i(n),r;function i(t){const n=t.data.markers&&t.data.markers.length?t.data.markers.length:"";r.push({label:t.data.label,depth:t.depth-(e.omitRoot()?1:0),content:t.data.content,isFolder:!!t.data.children,iconClass:t.data.iconClass,color:t.data.color,bold:t.data.bold,weightValue:n,markers:t.data.markers,selected:t.data.selected}),t.children&&t.children.forEach(i)}}iconClass(t){return"error"===t.label?"fa fa-exclamation":t.isFolder?this.folderIconOpen():this.textFileIcon()}calcRequiredWidth(){const t=this.flattenData(this.data());let e=0;const n=this.rowItemPadding(),r=this.iconSize()+2*n,i=d.getScrollbarWidth();return t.forEach(t=>{const o=t.depth*r+2*n,a=l.textSize(t.label,this.fontFamily(),this.fontSize(),!!t.bold).width+2*n+r+o+i;e<a&&(e=a)}),e}rowClick(t,e){}enter(t,e){super.enter(t,e),e.style("width","100%").style("height","100%")}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID()),e.style("overflow-y",this.verticalScroll()?"scroll":null);const n=this.flattenData(this.data()),r=f(n,t=>Number(t.weightValue));n.forEach(t=>{t.weightValue?t.weightColor=this._palette(t.weightValue,1,r):t.weightColor="transparent"});const i=this,o=this.rowItemPadding(),a=this.iconSize()+o,l=Math.max(i.iconSize(),i.fontSize()),s=e.selectAll(".directory-row").data(n),c=this.fontFamily(),p=this.fontSize(),d=f(n,t=>this.textSize(t.weightValue,c,p).width),y=`${o}px ${o}px ${o/2}px ${o}px`;s.enter().append("div").attr("class",t=>`directory-row directory-row-depth-${t.depth}`).style("display","flex").style("cursor","pointer").each(function(t){const n=u(this),r=t.color?t.color:i.fontColor(),s=t.weightColor?t.weightColor:"transparent",f=h.textColor(s),m=n.append("div").attr("class","row-weight").style("padding",y).style("color",f).style("box-shadow",`inset 0 0 100px ${s}`).style("font-weight",t.bold?"bold":"normal").style("font-family",c).style("font-size",p+"px").text(t.weightValue).attr("title",t.weightValue).style("overflow","hidden").style("width",d+2*o+"px").style("text-overflow","ellipsis").style("text-align","right").style("line-height",l+"px");n.append("div").attr("class","row-depth").style("width",i.depthSize()*t.depth+"px").style("opacity",1).style("line-height",l+"px");const g=n.append("div").attr("class","row-icon "+(t.iconClass?t.iconClass:i.iconClass(t))).style("width",a+"px").style("height",l+"px").style("color",r).style("background-color",t.selected?i.selectionBackgroundColor():"transparent").style("font-size",i.iconSize()+"px").style("padding",y).style("line-height",l+"px"),x=n.append("div").attr("class","row-label").style("padding",y).style("color",r).style("background-color",t.selected?i.selectionBackgroundColor():"transparent").style("font-weight",t.bold?"bold":"normal").style("font-family",i.fontFamily()).style("font-size",i.fontSize()+"px").text(t.label).attr("title",t.label).style("flex",1).style("overflow","hidden").style("text-overflow","ellipsis").style("line-height",l+"px");n.on("mouseenter",()=>{x.style("font-weight","bold")}).on("mouseleave",()=>{x.style("font-weight",t.bold?"bold":"normal")}),m.on("mouseenter",()=>{i.weight_mouseenter(t)}).on("mouseleave",()=>{i.weight_mouseleave(t)}),t.isFolder?n.on("click",function(t){let e=this.nextSibling;const r=n.classed("folder-closed");for(r?(n.classed("folder-closed",!1),n.classed("folder-open",!0),g.attr("class","row-icon "+i.folderIconOpen())):(n.classed("folder-closed",!0),n.classed("folder-open",!1),g.attr("class","row-icon "+i.folderIconClosed()));null!==e;){u(e).datum().depth>t.depth?(e.style.display=r?"flex":"none",e=e.nextSibling):e=null}}):n.on("click",()=>{e.selectAll(".row-label").style("background-color","transparent"),e.selectAll(".row-icon").style("background-color","transparent"),g.style("background-color",i.selectionBackgroundColor()),x.style("background-color",i.selectionBackgroundColor());const n=t.label.split(".").pop().toLowerCase();i.rowClick("json"===n?JSON.stringify(JSON.parse(t.content),null,4):t.content,t.markers)})}).merge(s).style("background-color",i.backgroundColor()),s.exit().remove()}weight_mouseenter(t){}weight_mouseleave(t){}};e(Ht,"DirectoryTree");let Jt=Ht;Jt.prototype._class+=" tree_DirectoryTree",Jt.prototype._palette=h.rainbow("Blues"),Jt.prototype.publish("depthSize",14,"number","Width of indentation per file or folder depth (pixels)"),Jt.prototype.publish("paletteID","Blues","set","Color palette for the weight backgrounds",Jt.prototype._palette.switch(),{tags:["Basic"]}),Jt.prototype.publish("omitRoot",!1,"boolean","If true, root node will not display"),Jt.prototype.publish("rowItemPadding",2,"number","Top, bottom, left and right row item padding"),Jt.prototype.publish("selectionBackgroundColor","#CCC","html-color","Background color of selected directory rows"),Jt.prototype.publish("backgroundColor","#FFF","html-color","Directory item background color"),Jt.prototype.publish("fontColor","#000","html-color","Directory item font color"),Jt.prototype.publish("fontFamily","Arial","string","Directory item font family"),Jt.prototype.publish("fontSize",12,"number","Directory item font size (pixels)"),Jt.prototype.publish("iconSize",12,"number","Directory folder and file icon size (pixels)"),Jt.prototype.publish("folderIconOpen","fa fa-folder-open","string","Open folder icon class"),Jt.prototype.publish("folderIconClosed","fa fa-folder","string","Closed folder icon class"),Jt.prototype.publish("textFileIcon","fa fa-file-text-o","string","Text file icon class"),Jt.prototype.publish("verticalScroll",!0,"boolean","If true, vertical scroll bar will be shown");const Zt=class _IndentedColumn extends s{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};e(Zt,"IndentedColumn");let Xt=Zt;Xt.prototype._class+=" tree_Dendrogram.IndentedColumn",Xt.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const Yt=class _Indented extends c{Column;_d3Tree;_xml;_svgLinks;_svgNodes;_treeData;_collapsed={};constructor(){super(),n.call(this),l.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this._d3Tree=At()}xmlToData(t,e=""){if(DOMParser){return Qt((new DOMParser).parseFromString(t,"text/xml"),e).children[0]}return[]}xml(t){return arguments.length?(this._xml=t,this.data(this.xmlToData(this._xml)),this):this._xml}IndentedData(){if(0===this.data().length)return[];if(this.xmlColumn_exists()){const t=this.columns().indexOf(this.xmlColumn()),e={label:this.xmlColumn(),children:this.data().map(function(e,n){return this.xmlToData(e[t],"["+n+"]")},this)};return 1===e.children.length?e.children[0]:e}if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()});function t(e){if(e.values instanceof Array){const n=e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),r={label:e.key};return n.length?r.children=n:r.size=22,r}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(t,e){super.enter(t,e),this._svgLinks=this._renderElement.append("g"),this._svgNodes=this._renderElement.append("g"),this._selection.widgetElement(this._svgNodes)}_prevDataChecksum;update(t,n){super.update(t,n);const r=this;this._d3Tree.nodeSize([0,this.barHeight()]);const i=this._db.dataChecksum();function o(t){return(t.parent?o(t.parent)+".":"")+t.data.label}this._prevDataChecksum!==i&&(this._treeData=this.IndentedData(),this._prevDataChecksum=i),e(o,"getID");const a=W(this.data()).sum(function(t){return t.size||50}).each(t=>{this._collapsed[o(t)]&&delete t.children}),l=this._d3Tree(a).descendants(),s=this._d3Tree(a).descendants().slice(1);let c=0;a.eachBefore(t=>{t.x=c*r.barHeight(),++c});const h=this.barHeight()-4,p=this._renderCount?500:0,d=this._svgLinks.selectAll(".link").data(s,function(t){return o(t)});function f(t){return"M"+t.parent.y+","+t.parent.x+"V"+t.x+", H"+t.y}d.enter().append("path").attr("class","link").attr("d",f),d.transition().duration(p).attr("d",f),d.exit().remove(),e(f,"elbow");const y=this._svgNodes.selectAll(".node").data(l,function(t){return o(t)});y.transition().duration(p).attr("transform",function(t){return"translate("+t.y+","+t.x+")"});const m=y.enter().append("g").attr("class","node").attr("transform",function(t){return"translate("+t.y+","+t.x+")"}).call(this._selection.enter.bind(this._selection)).each(function(){const t=u(this);t.append("rect").attr("height",h).attr("width",h).on("click",function(t){r._collapsed[o(t)]?delete r._collapsed[o(t)]:t.children&&(r._collapsed[o(t)]=!0),r.lazyRender()}),t.append("text")}).style("opacity",0);function g(t){return r._collapsed[o(t)]?"#3182bd":t.children?"#c6dbef":"#fd8d3c"}m.transition().style("opacity",1),m.merge(y).select("rect").attr("x",-h/2).attr("y",-h/2).style("fill",g),m.merge(y).select("text").attr("dx",h/2+4+"px").attr("dy","0.33em").text(function(t){return t.data.label}),y.exit().transition().style("opacity",0).remove(),this._renderCount||r.zoomToFit(),e(g,"color")}};e(Yt,"Indented");let Kt=Yt;function Qt(t,e=""){const n={id:e,label:"",attributes:{},children:[]};if(n.label=t.nodeName,1===t.nodeType){if(t.attributes.length>0)for(let r=0;r<t.attributes.length;r++){const e=t.attributes.item(r);n.attributes[e.nodeName]=e.nodeValue}}else 3===t.nodeType&&(n.label=t.nodeValue);if(t.hasChildNodes())for(let r=0;r<t.childNodes.length;r++){const i=Qt(t.childNodes.item(r),e+"["+n.children.length+"]");n.children.push(i)}return n}Kt.prototype._class+=" tree_Indented",Kt.prototype.implements(n.prototype),Kt.prototype.mixin(l.SimpleSelectionMixin),Kt.prototype.Column=Xt,Kt.prototype.publish("xmlColumn",null,"set","Field",function(){return this.columns()},{optional:!0}),Kt.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:Xt,disable:/* @__PURE__ */e(t=>t.xmlColumn_exists(),"disable")}),Kt.prototype.publish("barHeight",16,"number","Bar height"),e(Qt,"xmlToJson");var Gt=Math.PI,Ut=2*Gt,te=1e-6,ee=Ut-te;function ne(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function re(){return new ne}function ie(t){/* @__PURE__ */
2
- return e(function(){return t},"constant")}e(ne,"Path"),e(re,"path"),ne.prototype=re.prototype={constructor:ne,moveTo:/* @__PURE__ */e(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:/* @__PURE__ */e(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:/* @__PURE__ */e(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:/* @__PURE__ */e(function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},"quadraticCurveTo"),bezierCurveTo:/* @__PURE__ */e(function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},"bezierCurveTo"),arcTo:/* @__PURE__ */e(function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var o=this._x1,a=this._y1,l=n-t,s=r-e,c=o-t,u=a-e,h=c*c+u*u;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>te)if(Math.abs(u*l-s*c)>te&&i){var p=n-o,d=r-a,f=l*l+s*s,y=p*p+d*d,m=Math.sqrt(f),g=Math.sqrt(h),x=i*Math.tan((Gt-Math.acos((f+h-y)/(2*m*g)))/2),_=x/g,b=x/m;Math.abs(_-1)>te&&(this._+="L"+(t+_*c)+","+(e+_*u)),this._+="A"+i+","+i+",0,0,"+ +(u*p>c*d)+","+(this._x1=t+b*l)+","+(this._y1=e+b*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:/* @__PURE__ */e(function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),l=n*Math.sin(r),s=t+a,c=e+l,u=1^o,h=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+c:(Math.abs(this._x1-s)>te||Math.abs(this._y1-c)>te)&&(this._+="L"+s+","+c),n&&(h<0&&(h=h%Ut+Ut),h>ee?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-l)+"A"+n+","+n+",0,1,"+u+","+(this._x1=s)+","+(this._y1=c):h>te&&(this._+="A"+n+","+n+",0,"+ +(h>=Gt)+","+u+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},"arc"),rect:/* @__PURE__ */e(function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},"rect"),toString:/* @__PURE__ */e(function(){return this._},"toString")},e(ie,"constant");var oe=Math.abs,ae=Math.atan2,le=Math.cos,se=Math.max,ce=Math.min,ue=Math.sin,he=Math.sqrt,pe=1e-12,de=Math.PI,fe=de/2,ye=2*de;function me(t){return t>1?0:t<-1?de:Math.acos(t)}function ge(t){return t>=1?fe:t<=-1?-fe:Math.asin(t)}function xe(t){return t.innerRadius}function _e(t){return t.outerRadius}function be(t){return t.startAngle}function ve(t){return t.endAngle}function we(t){return t&&t.padAngle}function Se(t,e,n,r,i,o,a,l){var s=n-t,c=r-e,u=a-i,h=l-o,p=h*s-u*c;if(!(p*p<pe))return[t+(p=(u*(e-o)-h*(t-i))/p)*s,e+p*c]}function ze(t,e,n,r,i,o,a){var l=t-n,s=e-r,c=(a?o:-o)/he(l*l+s*s),u=c*s,h=-c*l,p=t+u,d=e+h,f=n+u,y=r+h,m=(p+f)/2,g=(d+y)/2,x=f-p,_=y-d,b=x*x+_*_,v=i-o,w=p*y-f*d,S=(_<0?-1:1)*he(se(0,v*v*b-w*w)),z=(w*_-x*S)/b,C=(-w*x-_*S)/b,k=(w*_+x*S)/b,M=(-w*x+_*S)/b,T=z-m,D=C-g,A=k-m,I=M-g;return T*T+D*D>A*A+I*I&&(z=k,C=M),{cx:z,cy:C,x01:-u,y01:-h,x11:z*(i/v-1),y11:C*(i/v-1)}}function Ce(){var t=xe,n=_e,r=ie(0),i=null,o=be,a=ve,l=we,s=null;function c(){var e,c,u=+t.apply(this,arguments),h=+n.apply(this,arguments),p=o.apply(this,arguments)-fe,d=a.apply(this,arguments)-fe,f=oe(d-p),y=d>p;if(s||(s=e=re()),h<u&&(c=h,h=u,u=c),h>pe)if(f>ye-pe)s.moveTo(h*le(p),h*ue(p)),s.arc(0,0,h,p,d,!y),u>pe&&(s.moveTo(u*le(d),u*ue(d)),s.arc(0,0,u,d,p,y));else{var m,g,x=p,_=d,b=p,v=d,w=f,S=f,z=l.apply(this,arguments)/2,C=z>pe&&(i?+i.apply(this,arguments):he(u*u+h*h)),k=ce(oe(h-u)/2,+r.apply(this,arguments)),M=k,T=k;if(C>pe){var D=ge(C/u*ue(z)),A=ge(C/h*ue(z));(w-=2*D)>pe?(b+=D*=y?1:-1,v-=D):(w=0,b=v=(p+d)/2),(S-=2*A)>pe?(x+=A*=y?1:-1,_-=A):(S=0,x=_=(p+d)/2)}var I=h*le(x),R=h*ue(x),P=u*le(v),L=u*ue(v);if(k>pe){var B,E=h*le(_),N=h*ue(_),q=u*le(b),F=u*ue(b);if(f<de&&(B=Se(I,R,q,F,E,N,P,L))){var O=I-B[0],V=R-B[1],W=E-B[0],$=N-B[1],j=1/ue(me((O*W+V*$)/(he(O*O+V*V)*he(W*W+$*$)))/2),H=he(B[0]*B[0]+B[1]*B[1]);M=ce(k,(u-H)/(j-1)),T=ce(k,(h-H)/(j+1))}}S>pe?T>pe?(m=ze(q,F,I,R,h,T,y),g=ze(E,N,P,L,h,T,y),s.moveTo(m.cx+m.x01,m.cy+m.y01),T<k?s.arc(m.cx,m.cy,T,ae(m.y01,m.x01),ae(g.y01,g.x01),!y):(s.arc(m.cx,m.cy,T,ae(m.y01,m.x01),ae(m.y11,m.x11),!y),s.arc(0,0,h,ae(m.cy+m.y11,m.cx+m.x11),ae(g.cy+g.y11,g.cx+g.x11),!y),s.arc(g.cx,g.cy,T,ae(g.y11,g.x11),ae(g.y01,g.x01),!y))):(s.moveTo(I,R),s.arc(0,0,h,x,_,!y)):s.moveTo(I,R),u>pe&&w>pe?M>pe?(m=ze(P,L,E,N,u,-M,y),g=ze(I,R,q,F,u,-M,y),s.lineTo(m.cx+m.x01,m.cy+m.y01),M<k?s.arc(m.cx,m.cy,M,ae(m.y01,m.x01),ae(g.y01,g.x01),!y):(s.arc(m.cx,m.cy,M,ae(m.y01,m.x01),ae(m.y11,m.x11),!y),s.arc(0,0,u,ae(m.cy+m.y11,m.cx+m.x11),ae(g.cy+g.y11,g.cx+g.x11),y),s.arc(g.cx,g.cy,M,ae(g.y11,g.x11),ae(g.y01,g.x01),!y))):s.arc(0,0,u,v,b,y):s.lineTo(P,L)}else s.moveTo(0,0);if(s.closePath(),e)return s=null,e+""||null}return e(c,"arc"),c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-de/2;return[le(r)*e,ue(r)*e]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:ie(+e),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:ie(+t),c):n},c.cornerRadius=function(t){return arguments.length?(r="function"==typeof t?t:ie(+t),c):r},c.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:ie(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ie(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ie(+t),c):a},c.padAngle=function(t){return arguments.length?(l="function"==typeof t?t:ie(+t),c):l},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}e(me,"acos"),e(ge,"asin"),e(xe,"arcInnerRadius"),e(_e,"arcOuterRadius"),e(be,"arcStartAngle"),e(ve,"arcEndAngle"),e(we,"arcPadAngle"),e(Se,"intersect"),e(ze,"cornerTangents"),e(Ce,"d3Arc");const ke=class _SunburstPartition extends r{svg;radius;_xScale;_yScale;partition;arc;_resetRoot;constructor(){super(),n.call(this)}data(t){const e=r.prototype.data.apply(this,arguments);return arguments.length&&(this._resetRoot=!0),e}enter(t,e){const n=this;this.radius=Math.min(this.width(),this.height())/2,this._xScale=y().range([0,2*Math.PI]),this._yScale=m().range([0,this.radius]),this.partition=vt(),this.arc=Ce().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,n._xScale(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,n._xScale(t.x1)))}).innerRadius(function(t){return Math.max(0,n._yScale(t.y0))}).outerRadius(function(t){return Math.max(0,n._yScale(t.y1))}),this.svg=e.append("g")}update(t,e){const n=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this.radius=Math.min(this.width(),this.height())/2,this._yScale.range([0,this.radius]);const r=W(this.data()).sum(function(t){return void 0!==t.size?t.size:1}),i=this.svg.selectAll("path").data(this.partition(r).descendants(),function(t,e){return void 0!==t.data.label?t.data.label:e});i.enter().append("path").on("click",function(t){n.click(t.data,null,null)}).on("dblclick",function(t){const e=o();e&&e.stopPropagation(),n.zoomTo(t)}).each(function(){u(this).append("title")}).merge(i).attr("d",this.arc).style("fill",function(t){return t.data.__viz_fill?t.data.__viz_fill:n._palette(t.data.label)}).style("stroke",function(t){return t.value>16?"white":"none"}).select("title").text(function(t){return t.data.label}),i.exit().remove(),this._resetRoot&&(this._resetRoot=!1,this.zoomTo(r))}zoomTo(t){const e=this;this.svg.transition().duration(750).tween("scale",function(){const n=g(e._xScale.domain(),[t.x0,t.x1]),r=g(e._yScale.domain(),[t.y0,1]),i=g(e._yScale.range(),[t.y0?20:0,e.radius]);return function(t){e._xScale.domain(n(t)),e._yScale.domain(r(t)).range(i(t))}}).selectAll("path").attrTween("d",function(t){return function(){return e.arc(t)}})}};e(ke,"SunburstPartition");let Me=ke;Me.prototype._class+=" tree_SunburstPartition",Me.prototype.implements(n.prototype),Me.prototype.publish("paletteID","default","set","Color palette for this widget",Me.prototype._palette.switch(),{tags:["Basic","Shared"]}),Me.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const Te=class _TreemapColumn extends s{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};e(Te,"TreemapColumn");let De=Te;De.prototype._class+=" tree_Dendrogram.TreemapColumn",De.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const Ae=class _Treemap extends p{Column;_d3Treemap;_elementDIV;_selection;constructor(){super(),n.call(this),l.SimpleSelectionMixin.call(this,!0)}getTilingMethod(){switch(this.tilingMethod()){case"treemapBinary":return Et;case"treemapDice":return bt;case"treemapSlice":return It;case"treemapSliceDice":return Nt;case"treemapResquarify":return qt;default:return Lt}}treemapData(){if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.aggregateView(this.mappings().map(function(t){return t.column()}),this.aggrType(),this.aggrColumn()).entries()});function t(e){if(e.values instanceof Array){const n=e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),r={label:e.key};return n.length?r.children=n:r.size=22,r}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(t,e){super.enter(t,e),this._d3Treemap=Bt(),this._elementDIV=e.append("div"),this._selection.widgetElement(this._elementDIV)}update(t,n){super.update(t,n);const r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const o=W(this.treemapData()).sum(this.nodeWeight);this._d3Treemap.size([this.width(),this.height()]).paddingInner(this.paddingInner()).paddingOuter(this.paddingOuter()).paddingTop(this.paddingTop()),-1!==["treemapSquarify","treemapResquarify"].indexOf(this.tilingMethod())?this._d3Treemap.tile(this.getTilingMethod().ratio(this.squarifyRatio())):this._d3Treemap.tile(this.getTilingMethod()),this._d3Treemap(o),this._elementDIV.style("font-size",this.fontSize_exists()?this.fontSize()+"px":null).style("line-height",this.fontSize_exists()?this.fontSize()+2+"px":null);const a=this._elementDIV.selectAll(".node").data(o.descendants());function l(t){if(t.children&&!r.enableParentTooltips())return null;let e=t.data.label+" ("+t.value+")";for(;t.parent&&t.parent.parent;)e=t.parent.data.label+" -> "+e,t=t.parent;return e}a.enter().append("div").attr("class","node").call(this._selection.enter.bind(this._selection)).on("click",function(t){if(t){let e="";r.mappings().forEach(function(t){t.column()&&(e=t.column())}),t.origRows?r.click(r.rowToObj(t.origRows[0]),e,r._selection.selected(this)):r.click(t.data,e,r._selection.selected(this))}}).on("dblclick",function(t){if(t){let e="";r.mappings().forEach(function(t){t.column()&&(e=t.column())}),t.origRows?r.dblclick(r.rowToObj(t.origRows[0]),e,r._selection.selected(this)):r.dblclick(t.data,e,r._selection.selected(this))}}).merge(a).style("left",function(t){return t.x0+Math.max(0,t.x1-t.x0)/2+"px"}).style("top",function(t){return t.y0+Math.max(0,t.y1-t.y0)/2+"px"}).style("width",function(){return"0px"}).style("height",function(){return"0px"}).style("font-size",function(t){return(t.children?r.parentFontSize():r.leafFontSize())+"px"}).style("line-height",function(t){return(t.children?r.parentFontSize():r.leafFontSize())+"px"}).attr("title",l).html(function(t){return r.showRoot()||0!==t.depth?t.children?r.enableParentLabels()?r.parentWeightHTML(t):null:r.leafWeightHTML(t):null}).style("background",function(t){if(!r.showRoot()&&0===t.depth)return this.style.color="transparent","transparent";const e=r.brighterLeafNodes()?"brighter":"darker";let n;return r.usePaletteOnParentNodes()?n=t.children?r._palette(t.data.label):i(r._palette(t.parent.data.label))[e](1):(n=t.depth>r.depthColorLimit()?i(t.parent.color)[e](1):r._palette(t.data.label),t.color=n),this.style.color=h.textColor(n),n}).transition().duration(this.transitionDuration()).style("pointer-events",function(t){return r.showRoot()||0!==t.depth?"all":"none"}).style("opacity",function(t){return t.children?1:null}).style("left",function(t){return t.x0+"px"}).style("top",function(t){return t.y0+"px"}).style("width",function(t){return Math.max(0,t.x1-t.x0)+"px"}).style("height",function(t){return Math.max(0,t.y1-t.y0)+"px"}).each(function(t){0===t.depth&&(this.style.color=r.showRoot()?"":"transparent",this.style.borderColor=r.showRoot()?"":"transparent")}),a.exit().transition().duration(this.transitionDuration()).style("opacity",0).remove(),e(l,"tooltip")}exit(t,e){super.exit(t,e)}nodeWeight(t){return t.size||1}parentWeightHTML(t){return this.showParentWeight()?`<span class="treemap-parent-label">${t.data.label}</span><span class="treemap-parent-value">${t.value}${this.weightSuffix()}</span>`:`<span class="treemap-parent-label">${t.data.label}</span>`}leafWeightHTML(t){return this.showLeafWeight()?`<span class="treemap-leaf-label">${t.data.label}</span><span class="treemap-leaf-value">${t.value}${this.weightSuffix()}</span>`:`<span class="treemap-leaf-label">${t.data.label}</span>`}};e(Ae,"Treemap");let Ie=Ae;Ie.prototype._class+=" tree_Treemap",Ie.prototype.implements(n.prototype),Ie.prototype.mixin(l.SimpleSelectionMixin),Ie.prototype.Column=De,Ie.prototype.publish("paletteID","default","set","Color palette for this widget",Ie.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ie.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ie.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:De}),Ie.prototype.publish("aggrType",null,"set","Aggregation Type",[null,"mean","median","sum","min","max"],{optional:!0}),Ie.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:/* @__PURE__ */e(t=>!t.aggrType(),"disable")}),Ie.prototype.publish("fontSize",null,"number","Font Size",null,{optional:!0}),Ie.prototype.publish("paddingInner",18.6,"number","Pixel spacing between each sibling node"),Ie.prototype.publish("paddingOuter",30,"number","Pixel padding of parent nodes"),Ie.prototype.publish("paddingTop",41.4,"number","Additional top pixel padding of parent nodes"),Ie.prototype.publish("showRoot",!1,"boolean","Show root element"),Ie.prototype.publish("parentFontSize",18,"number","Parent font-size"),Ie.prototype.publish("leafFontSize",16,"number","Leaf font-size"),Ie.prototype.publish("usePaletteOnParentNodes",!1,"boolean","Assign a color from the palette to every parent node"),Ie.prototype.publish("depthColorLimit",1,"number","Assign a color from the palette to node with depth lower than this value",null,{optional:!0,disable:/* @__PURE__ */e(t=>t.usePaletteOnParentNodes(),"disable")}),Ie.prototype.publish("squarifyRatio",1,"number","Specifies the desired aspect ratio of the generated rectangles (must be >= 1)",null,{optional:!0,disable:/* @__PURE__ */e(t=>-1===["treemapSquarify","treemapResquarify"].indexOf(t.tilingMethod()),"disable")}),Ie.prototype.publish("showParentWeight",!0,"boolean","Show weight of parent nodes"),Ie.prototype.publish("showLeafWeight",!0,"boolean","Show weight of leaf nodes"),Ie.prototype.publish("weightSuffix","","string","Weight suffix (ex: 'ms')"),Ie.prototype.publish("brighterLeafNodes",!1,"boolean","Brighter/darker leaf node color (false = darker)"),Ie.prototype.publish("enableParentLabels",!0,"boolean","Enable parent labels"),Ie.prototype.publish("enableParentTooltips",!0,"boolean","Enable parent tooltips"),Ie.prototype.publish("transitionDuration",250,"number","Transition Duration"),Ie.prototype.publish("tilingMethod","treemapSquarify","set","Transition Duration",["treemapBinary","treemapDice","treemapResquarify","treemapSlice","treemapSliceDice","treemapSquarify"]);export{b as BUILD_VERSION,Ot as CirclePacking,jt as Dendrogram,Wt as DendrogramColumn,Jt as DirectoryTree,Kt as Indented,Xt as IndentedColumn,x as PKG_NAME,_ as PKG_VERSION,Me as SunburstPartition,Ie as Treemap,De as TreemapColumn};
1
+ import { ITree as e } from "@hpcc-js/api";
2
+ import { HTMLWidget as t, Palette as n, Platform as r, PropertyExt as i, SVGWidget as a, SVGZoomWidget as o, Utility as s, d3Event as c, interpolate as l, interpolateZoom as u, max as d, rgb as f, scaleLinear as p, scaleSqrt as m, select as h } from "@hpcc-js/common";
3
+ //#region \0rolldown/runtime.js
4
+ var g = Object.defineProperty, __name = (e, t) => g(e, "name", {
5
+ value: t,
6
+ configurable: !0
7
+ }), _ = "@hpcc-js/tree", v = "3.2.20", y = "3.25.1";
8
+ //#endregion
9
+ //#region ../../node_modules/d3-hierarchy/src/cluster.js
10
+ function defaultSeparation$1(e, t) {
11
+ return e.parent === t.parent ? 1 : 2;
12
+ }
13
+ __name(defaultSeparation$1, "defaultSeparation");
14
+ function meanX(e) {
15
+ return e.reduce(meanXReduce, 0) / e.length;
16
+ }
17
+ function meanXReduce(e, t) {
18
+ return e + t.x;
19
+ }
20
+ function maxY(e) {
21
+ return 1 + e.reduce(maxYReduce, 0);
22
+ }
23
+ function maxYReduce(e, t) {
24
+ return Math.max(e, t.y);
25
+ }
26
+ function leafLeft(e) {
27
+ for (var t; t = e.children;) e = t[0];
28
+ return e;
29
+ }
30
+ function leafRight(e) {
31
+ for (var t; t = e.children;) e = t[t.length - 1];
32
+ return e;
33
+ }
34
+ __name(cluster_default, "default");
35
+ function cluster_default() {
36
+ var e = defaultSeparation$1, t = 1, n = 1, r = !1;
37
+ function cluster(i) {
38
+ var a, o = 0;
39
+ i.eachAfter(function(t) {
40
+ var n = t.children;
41
+ n ? (t.x = meanX(n), t.y = maxY(n)) : (t.x = a ? o += e(t, a) : 0, t.y = 0, a = t);
42
+ });
43
+ var s = leafLeft(i), c = leafRight(i), l = s.x - e(s, c) / 2, u = c.x + e(c, s) / 2;
44
+ return i.eachAfter(r ? function(e) {
45
+ e.x = (e.x - i.x) * t, e.y = (i.y - e.y) * n;
46
+ } : function(e) {
47
+ e.x = (e.x - l) / (u - l) * t, e.y = (1 - (i.y ? e.y / i.y : 1)) * n;
48
+ });
49
+ }
50
+ return cluster.separation = function(t) {
51
+ return arguments.length ? (e = t, cluster) : e;
52
+ }, cluster.size = function(e) {
53
+ return arguments.length ? (r = !1, t = +e[0], n = +e[1], cluster) : r ? null : [t, n];
54
+ }, cluster.nodeSize = function(e) {
55
+ return arguments.length ? (r = !0, t = +e[0], n = +e[1], cluster) : r ? [t, n] : null;
56
+ }, cluster;
57
+ }
58
+ //#endregion
59
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/count.js
60
+ function count(e) {
61
+ var t = 0, n = e.children, r = n && n.length;
62
+ if (!r) t = 1;
63
+ else for (; --r >= 0;) t += n[r].value;
64
+ e.value = t;
65
+ }
66
+ function count_default() {
67
+ return this.eachAfter(count);
68
+ }
69
+ __name(count_default, "default");
70
+ //#endregion
71
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/each.js
72
+ function each_default(e) {
73
+ var t = this, n, r = [t], i, a, o;
74
+ do
75
+ for (n = r.reverse(), r = []; t = n.pop();) if (e(t), i = t.children, i) for (a = 0, o = i.length; a < o; ++a) r.push(i[a]);
76
+ while (r.length);
77
+ return this;
78
+ }
79
+ __name(each_default, "default");
80
+ //#endregion
81
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
82
+ function eachBefore_default(e) {
83
+ for (var t = this, n = [t], r, i; t = n.pop();) if (e(t), r = t.children, r) for (i = r.length - 1; i >= 0; --i) n.push(r[i]);
84
+ return this;
85
+ }
86
+ __name(eachBefore_default, "default");
87
+ //#endregion
88
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
89
+ function eachAfter_default(e) {
90
+ for (var t = this, n = [t], r = [], i, a, o; t = n.pop();) if (r.push(t), i = t.children, i) for (a = 0, o = i.length; a < o; ++a) n.push(i[a]);
91
+ for (; t = r.pop();) e(t);
92
+ return this;
93
+ }
94
+ __name(eachAfter_default, "default");
95
+ //#endregion
96
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/sum.js
97
+ function sum_default(e) {
98
+ return this.eachAfter(function(t) {
99
+ for (var n = +e(t.data) || 0, r = t.children, i = r && r.length; --i >= 0;) n += r[i].value;
100
+ t.value = n;
101
+ });
102
+ }
103
+ __name(sum_default, "default");
104
+ //#endregion
105
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/sort.js
106
+ function sort_default(e) {
107
+ return this.eachBefore(function(t) {
108
+ t.children && t.children.sort(e);
109
+ });
110
+ }
111
+ __name(sort_default, "default");
112
+ //#endregion
113
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/path.js
114
+ function path_default(e) {
115
+ for (var t = this, n = leastCommonAncestor(t, e), r = [t]; t !== n;) t = t.parent, r.push(t);
116
+ for (var i = r.length; e !== n;) r.splice(i, 0, e), e = e.parent;
117
+ return r;
118
+ }
119
+ __name(path_default, "default");
120
+ function leastCommonAncestor(e, t) {
121
+ if (e === t) return e;
122
+ var n = e.ancestors(), r = t.ancestors(), i = null;
123
+ for (e = n.pop(), t = r.pop(); e === t;) i = e, e = n.pop(), t = r.pop();
124
+ return i;
125
+ }
126
+ //#endregion
127
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/ancestors.js
128
+ function ancestors_default() {
129
+ for (var e = this, t = [e]; e = e.parent;) t.push(e);
130
+ return t;
131
+ }
132
+ __name(ancestors_default, "default");
133
+ //#endregion
134
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/descendants.js
135
+ function descendants_default() {
136
+ var e = [];
137
+ return this.each(function(t) {
138
+ e.push(t);
139
+ }), e;
140
+ }
141
+ __name(descendants_default, "default");
142
+ //#endregion
143
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/leaves.js
144
+ function leaves_default() {
145
+ var e = [];
146
+ return this.eachBefore(function(t) {
147
+ t.children || e.push(t);
148
+ }), e;
149
+ }
150
+ __name(leaves_default, "default");
151
+ //#endregion
152
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/links.js
153
+ function links_default() {
154
+ var e = this, t = [];
155
+ return e.each(function(n) {
156
+ n !== e && t.push({
157
+ source: n.parent,
158
+ target: n
159
+ });
160
+ }), t;
161
+ }
162
+ __name(links_default, "default");
163
+ //#endregion
164
+ //#region ../../node_modules/d3-hierarchy/src/hierarchy/index.js
165
+ function hierarchy(e, t) {
166
+ var n = new Node$1(e), r = +e.value && (n.value = e.value), i, a = [n], o, s, c, l;
167
+ for (t ??= defaultChildren; i = a.pop();) if (r && (i.value = +i.data.value), (s = t(i.data)) && (l = s.length)) for (i.children = Array(l), c = l - 1; c >= 0; --c) a.push(o = i.children[c] = new Node$1(s[c])), o.parent = i, o.depth = i.depth + 1;
168
+ return n.eachBefore(computeHeight);
169
+ }
170
+ function node_copy() {
171
+ return hierarchy(this).eachBefore(copyData);
172
+ }
173
+ function defaultChildren(e) {
174
+ return e.children;
175
+ }
176
+ function copyData(e) {
177
+ e.data = e.data.data;
178
+ }
179
+ function computeHeight(e) {
180
+ var t = 0;
181
+ do
182
+ e.height = t;
183
+ while ((e = e.parent) && e.height < ++t);
184
+ }
185
+ function Node$1(e) {
186
+ this.data = e, this.depth = this.height = 0, this.parent = null;
187
+ }
188
+ __name(Node$1, "Node"), Node$1.prototype = hierarchy.prototype = {
189
+ constructor: Node$1,
190
+ count: count_default,
191
+ each: each_default,
192
+ eachAfter: eachAfter_default,
193
+ eachBefore: eachBefore_default,
194
+ sum: sum_default,
195
+ sort: sort_default,
196
+ path: path_default,
197
+ ancestors: ancestors_default,
198
+ descendants: descendants_default,
199
+ leaves: leaves_default,
200
+ links: links_default,
201
+ copy: node_copy
202
+ };
203
+ //#endregion
204
+ //#region ../../node_modules/d3-hierarchy/src/array.js
205
+ var b = Array.prototype.slice;
206
+ function shuffle(e) {
207
+ for (var t = e.length, n, r; t;) r = Math.random() * t-- | 0, n = e[t], e[t] = e[r], e[r] = n;
208
+ return e;
209
+ }
210
+ //#endregion
211
+ //#region ../../node_modules/d3-hierarchy/src/pack/enclose.js
212
+ function enclose_default(e) {
213
+ for (var t = 0, n = (e = shuffle(b.call(e))).length, r = [], i, a; t < n;) i = e[t], a && enclosesWeak(a, i) ? ++t : (a = encloseBasis(r = extendBasis(r, i)), t = 0);
214
+ return a;
215
+ }
216
+ __name(enclose_default, "default");
217
+ function extendBasis(e, t) {
218
+ var n, r;
219
+ if (enclosesWeakAll(t, e)) return [t];
220
+ for (n = 0; n < e.length; ++n) if (enclosesNot(t, e[n]) && enclosesWeakAll(encloseBasis2(e[n], t), e)) return [e[n], t];
221
+ for (n = 0; n < e.length - 1; ++n) for (r = n + 1; r < e.length; ++r) if (enclosesNot(encloseBasis2(e[n], e[r]), t) && enclosesNot(encloseBasis2(e[n], t), e[r]) && enclosesNot(encloseBasis2(e[r], t), e[n]) && enclosesWeakAll(encloseBasis3(e[n], e[r], t), e)) return [
222
+ e[n],
223
+ e[r],
224
+ t
225
+ ];
226
+ throw Error();
227
+ }
228
+ function enclosesNot(e, t) {
229
+ var n = e.r - t.r, r = t.x - e.x, i = t.y - e.y;
230
+ return n < 0 || n * n < r * r + i * i;
231
+ }
232
+ function enclosesWeak(e, t) {
233
+ var n = e.r - t.r + 1e-6, r = t.x - e.x, i = t.y - e.y;
234
+ return n > 0 && n * n > r * r + i * i;
235
+ }
236
+ function enclosesWeakAll(e, t) {
237
+ for (var n = 0; n < t.length; ++n) if (!enclosesWeak(e, t[n])) return !1;
238
+ return !0;
239
+ }
240
+ function encloseBasis(e) {
241
+ switch (e.length) {
242
+ case 1: return encloseBasis1(e[0]);
243
+ case 2: return encloseBasis2(e[0], e[1]);
244
+ case 3: return encloseBasis3(e[0], e[1], e[2]);
245
+ }
246
+ }
247
+ function encloseBasis1(e) {
248
+ return {
249
+ x: e.x,
250
+ y: e.y,
251
+ r: e.r
252
+ };
253
+ }
254
+ function encloseBasis2(e, t) {
255
+ var n = e.x, r = e.y, i = e.r, a = t.x, o = t.y, s = t.r, c = a - n, l = o - r, u = s - i, d = Math.sqrt(c * c + l * l);
256
+ return {
257
+ x: (n + a + c / d * u) / 2,
258
+ y: (r + o + l / d * u) / 2,
259
+ r: (d + i + s) / 2
260
+ };
261
+ }
262
+ function encloseBasis3(e, t, n) {
263
+ var r = e.x, i = e.y, a = e.r, o = t.x, s = t.y, c = t.r, l = n.x, u = n.y, d = n.r, f = r - o, p = r - l, m = i - s, h = i - u, g = c - a, _ = d - a, v = r * r + i * i - a * a, y = v - o * o - s * s + c * c, b = v - l * l - u * u + d * d, x = p * m - f * h, S = (m * b - h * y) / (x * 2) - r, C = (h * g - m * _) / x, w = (p * y - f * b) / (x * 2) - i, T = (f * _ - p * g) / x, E = C * C + T * T - 1, D = 2 * (a + S * C + w * T), O = S * S + w * w - a * a, k = -(E ? (D + Math.sqrt(D * D - 4 * E * O)) / (2 * E) : O / D);
264
+ return {
265
+ x: r + S + C * k,
266
+ y: i + w + T * k,
267
+ r: k
268
+ };
269
+ }
270
+ //#endregion
271
+ //#region ../../node_modules/d3-hierarchy/src/pack/siblings.js
272
+ function place(e, t, n) {
273
+ var r = e.x - t.x, i, a, o = e.y - t.y, s, c, l = r * r + o * o;
274
+ l ? (a = t.r + n.r, a *= a, c = e.r + n.r, c *= c, a > c ? (i = (l + c - a) / (2 * l), s = Math.sqrt(Math.max(0, c / l - i * i)), n.x = e.x - i * r - s * o, n.y = e.y - i * o + s * r) : (i = (l + a - c) / (2 * l), s = Math.sqrt(Math.max(0, a / l - i * i)), n.x = t.x + i * r - s * o, n.y = t.y + i * o + s * r)) : (n.x = t.x + n.r, n.y = t.y);
275
+ }
276
+ function intersects(e, t) {
277
+ var n = e.r + t.r - 1e-6, r = t.x - e.x, i = t.y - e.y;
278
+ return n > 0 && n * n > r * r + i * i;
279
+ }
280
+ function score(e) {
281
+ var t = e._, n = e.next._, r = t.r + n.r, i = (t.x * n.r + n.x * t.r) / r, a = (t.y * n.r + n.y * t.r) / r;
282
+ return i * i + a * a;
283
+ }
284
+ function Node(e) {
285
+ this._ = e, this.next = null, this.previous = null;
286
+ }
287
+ function packEnclose(e) {
288
+ if (!(i = e.length)) return 0;
289
+ var t = e[0], n, r, i, a, o, s, c, l, u, d;
290
+ if (t.x = 0, t.y = 0, !(i > 1)) return t.r;
291
+ if (n = e[1], t.x = -n.r, n.x = t.r, n.y = 0, !(i > 2)) return t.r + n.r;
292
+ place(n, t, r = e[2]), t = new Node(t), n = new Node(n), r = new Node(r), t.next = r.previous = n, n.next = t.previous = r, r.next = n.previous = t;
293
+ pack: for (s = 3; s < i; ++s) {
294
+ place(t._, n._, r = e[s]), r = new Node(r), c = n.next, l = t.previous, u = n._.r, d = t._.r;
295
+ do
296
+ if (u <= d) {
297
+ if (intersects(c._, r._)) {
298
+ n = c, t.next = n, n.previous = t, --s;
299
+ continue pack;
300
+ }
301
+ u += c._.r, c = c.next;
302
+ } else {
303
+ if (intersects(l._, r._)) {
304
+ t = l, t.next = n, n.previous = t, --s;
305
+ continue pack;
306
+ }
307
+ d += l._.r, l = l.previous;
308
+ }
309
+ while (c !== l.next);
310
+ for (r.previous = t, r.next = n, t.next = n.previous = n = r, a = score(t); (r = r.next) !== n;) (o = score(r)) < a && (t = r, a = o);
311
+ n = t.next;
312
+ }
313
+ for (t = [n._], r = n; (r = r.next) !== n;) t.push(r._);
314
+ for (r = enclose_default(t), s = 0; s < i; ++s) t = e[s], t.x -= r.x, t.y -= r.y;
315
+ return r.r;
316
+ }
317
+ //#endregion
318
+ //#region ../../node_modules/d3-hierarchy/src/accessors.js
319
+ function optional(e) {
320
+ return e == null ? null : required(e);
321
+ }
322
+ function required(e) {
323
+ if (typeof e != "function") throw Error();
324
+ return e;
325
+ }
326
+ //#endregion
327
+ //#region ../../node_modules/d3-hierarchy/src/constant.js
328
+ function constantZero() {
329
+ return 0;
330
+ }
331
+ function constant_default$1(e) {
332
+ return function() {
333
+ return e;
334
+ };
335
+ }
336
+ __name(constant_default$1, "default");
337
+ //#endregion
338
+ //#region ../../node_modules/d3-hierarchy/src/pack/index.js
339
+ function defaultRadius(e) {
340
+ return Math.sqrt(e.value);
341
+ }
342
+ function pack_default() {
343
+ var e = null, t = 1, n = 1, r = constantZero;
344
+ function pack(i) {
345
+ return i.x = t / 2, i.y = n / 2, e ? i.eachBefore(radiusLeaf(e)).eachAfter(packChildren(r, .5)).eachBefore(translateChild(1)) : i.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildren(constantZero, 1)).eachAfter(packChildren(r, i.r / Math.min(t, n))).eachBefore(translateChild(Math.min(t, n) / (2 * i.r))), i;
346
+ }
347
+ return pack.radius = function(t) {
348
+ return arguments.length ? (e = optional(t), pack) : e;
349
+ }, pack.size = function(e) {
350
+ return arguments.length ? (t = +e[0], n = +e[1], pack) : [t, n];
351
+ }, pack.padding = function(e) {
352
+ return arguments.length ? (r = typeof e == "function" ? e : constant_default$1(+e), pack) : r;
353
+ }, pack;
354
+ }
355
+ __name(pack_default, "default");
356
+ function radiusLeaf(e) {
357
+ return function(t) {
358
+ t.children || (t.r = Math.max(0, +e(t) || 0));
359
+ };
360
+ }
361
+ function packChildren(e, t) {
362
+ return function(n) {
363
+ if (r = n.children) {
364
+ var r, i, a = r.length, o = e(n) * t || 0, s;
365
+ if (o) for (i = 0; i < a; ++i) r[i].r += o;
366
+ if (s = packEnclose(r), o) for (i = 0; i < a; ++i) r[i].r -= o;
367
+ n.r = s + o;
368
+ }
369
+ };
370
+ }
371
+ function translateChild(e) {
372
+ return function(t) {
373
+ var n = t.parent;
374
+ t.r *= e, n && (t.x = n.x + e * t.x, t.y = n.y + e * t.y);
375
+ };
376
+ }
377
+ //#endregion
378
+ //#region ../../node_modules/d3-hierarchy/src/treemap/round.js
379
+ function round_default(e) {
380
+ e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
381
+ }
382
+ __name(round_default, "default");
383
+ //#endregion
384
+ //#region ../../node_modules/d3-hierarchy/src/treemap/dice.js
385
+ function dice_default(e, t, n, r, i) {
386
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (r - t) / e.value; ++s < c;) o = a[s], o.y0 = n, o.y1 = i, o.x0 = t, o.x1 = t += o.value * l;
387
+ }
388
+ __name(dice_default, "default");
389
+ //#endregion
390
+ //#region ../../node_modules/d3-hierarchy/src/partition.js
391
+ function partition_default() {
392
+ var e = 1, t = 1, n = 0, r = !1;
393
+ function partition(i) {
394
+ var a = i.height + 1;
395
+ return i.x0 = i.y0 = n, i.x1 = e, i.y1 = t / a, i.eachBefore(positionNode(t, a)), r && i.eachBefore(round_default), i;
396
+ }
397
+ function positionNode(e, t) {
398
+ return function(r) {
399
+ r.children && dice_default(r, r.x0, e * (r.depth + 1) / t, r.x1, e * (r.depth + 2) / t);
400
+ var i = r.x0, a = r.y0, o = r.x1 - n, s = r.y1 - n;
401
+ o < i && (i = o = (i + o) / 2), s < a && (a = s = (a + s) / 2), r.x0 = i, r.y0 = a, r.x1 = o, r.y1 = s;
402
+ };
403
+ }
404
+ return partition.round = function(e) {
405
+ return arguments.length ? (r = !!e, partition) : r;
406
+ }, partition.size = function(n) {
407
+ return arguments.length ? (e = +n[0], t = +n[1], partition) : [e, t];
408
+ }, partition.padding = function(e) {
409
+ return arguments.length ? (n = +e, partition) : n;
410
+ }, partition;
411
+ }
412
+ __name(partition_default, "default");
413
+ //#endregion
414
+ //#region ../../node_modules/d3-hierarchy/src/tree.js
415
+ function defaultSeparation(e, t) {
416
+ return e.parent === t.parent ? 1 : 2;
417
+ }
418
+ function nextLeft(e) {
419
+ var t = e.children;
420
+ return t ? t[0] : e.t;
421
+ }
422
+ function nextRight(e) {
423
+ var t = e.children;
424
+ return t ? t[t.length - 1] : e.t;
425
+ }
426
+ function moveSubtree(e, t, n) {
427
+ var r = n / (t.i - e.i);
428
+ t.c -= r, t.s += n, e.c += r, t.z += n, t.m += n;
429
+ }
430
+ function executeShifts(e) {
431
+ for (var t = 0, n = 0, r = e.children, i = r.length, a; --i >= 0;) a = r[i], a.z += t, a.m += t, t += a.s + (n += a.c);
432
+ }
433
+ function nextAncestor(e, t, n) {
434
+ return e.a.parent === t.parent ? e.a : n;
435
+ }
436
+ function TreeNode(e, t) {
437
+ this._ = e, 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 = t;
438
+ }
439
+ TreeNode.prototype = Object.create(Node$1.prototype);
440
+ function treeRoot(e) {
441
+ for (var t = new TreeNode(e, 0), n, r = [t], i, a, o, s; n = r.pop();) if (a = n._.children) for (n.children = Array(s = a.length), o = s - 1; o >= 0; --o) r.push(i = n.children[o] = new TreeNode(a[o], o)), i.parent = n;
442
+ return (t.parent = new TreeNode(null, 0)).children = [t], t;
443
+ }
444
+ function tree_default() {
445
+ var e = defaultSeparation, t = 1, n = 1, r = null;
446
+ function tree(i) {
447
+ var a = treeRoot(i);
448
+ if (a.eachAfter(firstWalk), a.parent.m = -a.z, a.eachBefore(secondWalk), r) i.eachBefore(sizeNode);
449
+ else {
450
+ var o = i, s = i, c = i;
451
+ i.eachBefore(function(e) {
452
+ e.x < o.x && (o = e), e.x > s.x && (s = e), e.depth > c.depth && (c = e);
453
+ });
454
+ var l = o === s ? 1 : e(o, s) / 2, u = l - o.x, d = t / (s.x + l + u), f = n / (c.depth || 1);
455
+ i.eachBefore(function(e) {
456
+ e.x = (e.x + u) * d, e.y = e.depth * f;
457
+ });
458
+ }
459
+ return i;
460
+ }
461
+ function firstWalk(t) {
462
+ var n = t.children, r = t.parent.children, i = t.i ? r[t.i - 1] : null;
463
+ if (n) {
464
+ executeShifts(t);
465
+ var a = (n[0].z + n[n.length - 1].z) / 2;
466
+ i ? (t.z = i.z + e(t._, i._), t.m = t.z - a) : t.z = a;
467
+ } else i && (t.z = i.z + e(t._, i._));
468
+ t.parent.A = apportion(t, i, t.parent.A || r[0]);
469
+ }
470
+ function secondWalk(e) {
471
+ e._.x = e.z + e.parent.m, e.m += e.parent.m;
472
+ }
473
+ function apportion(t, n, r) {
474
+ if (n) {
475
+ for (var i = t, a = t, o = n, s = i.parent.children[0], c = i.m, l = a.m, u = o.m, d = s.m, f; o = nextRight(o), i = nextLeft(i), o && i;) s = nextLeft(s), a = nextRight(a), a.a = t, f = o.z + u - i.z - c + e(o._, i._), f > 0 && (moveSubtree(nextAncestor(o, t, r), t, f), c += f, l += f), u += o.m, c += i.m, d += s.m, l += a.m;
476
+ o && !nextRight(a) && (a.t = o, a.m += u - l), i && !nextLeft(s) && (s.t = i, s.m += c - d, r = t);
477
+ }
478
+ return r;
479
+ }
480
+ function sizeNode(e) {
481
+ e.x *= t, e.y = e.depth * n;
482
+ }
483
+ return tree.separation = function(t) {
484
+ return arguments.length ? (e = t, tree) : e;
485
+ }, tree.size = function(e) {
486
+ return arguments.length ? (r = !1, t = +e[0], n = +e[1], tree) : r ? null : [t, n];
487
+ }, tree.nodeSize = function(e) {
488
+ return arguments.length ? (r = !0, t = +e[0], n = +e[1], tree) : r ? [t, n] : null;
489
+ }, tree;
490
+ }
491
+ __name(tree_default, "default");
492
+ //#endregion
493
+ //#region ../../node_modules/d3-hierarchy/src/treemap/slice.js
494
+ function slice_default(e, t, n, r, i) {
495
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (i - n) / e.value; ++s < c;) o = a[s], o.x0 = t, o.x1 = r, o.y0 = n, o.y1 = n += o.value * l;
496
+ }
497
+ __name(slice_default, "default");
498
+ //#endregion
499
+ //#region ../../node_modules/d3-hierarchy/src/treemap/squarify.js
500
+ var x = (1 + Math.sqrt(5)) / 2;
501
+ function squarifyRatio(e, t, n, r, i, a) {
502
+ for (var o = [], s = t.children, c, l, u = 0, d = 0, f = s.length, p, m, h = t.value, g, _, v, y, b, x, S; u < f;) {
503
+ p = i - n, m = a - r;
504
+ do
505
+ g = s[d++].value;
506
+ while (!g && d < f);
507
+ for (_ = v = g, x = Math.max(m / p, p / m) / (h * e), S = g * g * x, b = Math.max(v / S, S / _); d < f; ++d) {
508
+ if (g += l = s[d].value, l < _ && (_ = l), l > v && (v = l), S = g * g * x, y = Math.max(v / S, S / _), y > b) {
509
+ g -= l;
510
+ break;
511
+ }
512
+ b = y;
513
+ }
514
+ o.push(c = {
515
+ value: g,
516
+ dice: p < m,
517
+ children: s.slice(u, d)
518
+ }), c.dice ? dice_default(c, n, r, i, h ? r += m * g / h : a) : slice_default(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
519
+ }
520
+ return o;
521
+ }
522
+ var S = (function custom(e) {
523
+ function squarify(t, n, r, i, a) {
524
+ squarifyRatio(e, t, n, r, i, a);
525
+ }
526
+ return squarify.ratio = function(e) {
527
+ return custom((e = +e) > 1 ? e : 1);
528
+ }, squarify;
529
+ })(x);
530
+ //#endregion
531
+ //#region ../../node_modules/d3-hierarchy/src/treemap/index.js
532
+ function treemap_default() {
533
+ var e = S, t = !1, n = 1, r = 1, i = [0], a = constantZero, o = constantZero, s = constantZero, c = constantZero, l = constantZero;
534
+ function treemap(e) {
535
+ return e.x0 = e.y0 = 0, e.x1 = n, e.y1 = r, e.eachBefore(positionNode), i = [0], t && e.eachBefore(round_default), e;
536
+ }
537
+ function positionNode(t) {
538
+ var n = i[t.depth], r = t.x0 + n, u = t.y0 + n, d = t.x1 - n, f = t.y1 - n;
539
+ d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), t.x0 = r, t.y0 = u, t.x1 = d, t.y1 = f, t.children && (n = i[t.depth + 1] = a(t) / 2, r += l(t) - n, u += o(t) - n, d -= s(t) - n, f -= c(t) - n, d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), e(t, r, u, d, f));
540
+ }
541
+ return treemap.round = function(e) {
542
+ return arguments.length ? (t = !!e, treemap) : t;
543
+ }, treemap.size = function(e) {
544
+ return arguments.length ? (n = +e[0], r = +e[1], treemap) : [n, r];
545
+ }, treemap.tile = function(t) {
546
+ return arguments.length ? (e = required(t), treemap) : e;
547
+ }, treemap.padding = function(e) {
548
+ return arguments.length ? treemap.paddingInner(e).paddingOuter(e) : treemap.paddingInner();
549
+ }, treemap.paddingInner = function(e) {
550
+ return arguments.length ? (a = typeof e == "function" ? e : constant_default$1(+e), treemap) : a;
551
+ }, treemap.paddingOuter = function(e) {
552
+ return arguments.length ? treemap.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : treemap.paddingTop();
553
+ }, treemap.paddingTop = function(e) {
554
+ return arguments.length ? (o = typeof e == "function" ? e : constant_default$1(+e), treemap) : o;
555
+ }, treemap.paddingRight = function(e) {
556
+ return arguments.length ? (s = typeof e == "function" ? e : constant_default$1(+e), treemap) : s;
557
+ }, treemap.paddingBottom = function(e) {
558
+ return arguments.length ? (c = typeof e == "function" ? e : constant_default$1(+e), treemap) : c;
559
+ }, treemap.paddingLeft = function(e) {
560
+ return arguments.length ? (l = typeof e == "function" ? e : constant_default$1(+e), treemap) : l;
561
+ }, treemap;
562
+ }
563
+ __name(treemap_default, "default");
564
+ //#endregion
565
+ //#region ../../node_modules/d3-hierarchy/src/treemap/binary.js
566
+ function binary_default(e, t, n, r, i) {
567
+ var a = e.children, o, s = a.length, c, l = Array(s + 1);
568
+ for (l[0] = c = o = 0; o < s; ++o) l[o + 1] = c += a[o].value;
569
+ partition(0, s, e.value, t, n, r, i);
570
+ function partition(e, t, n, r, i, o, s) {
571
+ if (e >= t - 1) {
572
+ var c = a[e];
573
+ c.x0 = r, c.y0 = i, c.x1 = o, c.y1 = s;
574
+ return;
575
+ }
576
+ for (var u = l[e], d = n / 2 + u, f = e + 1, p = t - 1; f < p;) {
577
+ var m = f + p >>> 1;
578
+ l[m] < d ? f = m + 1 : p = m;
579
+ }
580
+ d - l[f - 1] < l[f] - d && e + 1 < f && --f;
581
+ var h = l[f] - u, g = n - h;
582
+ if (o - r > s - i) {
583
+ var _ = (r * g + o * h) / n;
584
+ partition(e, f, h, r, i, _, s), partition(f, t, g, _, i, o, s);
585
+ } else {
586
+ var v = (i * g + s * h) / n;
587
+ partition(e, f, h, r, i, o, v), partition(f, t, g, r, v, o, s);
588
+ }
589
+ }
590
+ }
591
+ __name(binary_default, "default");
592
+ //#endregion
593
+ //#region ../../node_modules/d3-hierarchy/src/treemap/sliceDice.js
594
+ function sliceDice_default(e, t, n, r, i) {
595
+ (e.depth & 1 ? slice_default : dice_default)(e, t, n, r, i);
596
+ }
597
+ __name(sliceDice_default, "default");
598
+ //#endregion
599
+ //#region ../../node_modules/d3-hierarchy/src/treemap/resquarify.js
600
+ var C = (function custom(e) {
601
+ function resquarify(t, n, r, i, a) {
602
+ if ((o = t._squarify) && o.ratio === e) for (var o, s, c, l, u = -1, d, f = o.length, p = t.value; ++u < f;) {
603
+ for (s = o[u], c = s.children, l = s.value = 0, d = c.length; l < d; ++l) s.value += c[l].value;
604
+ s.dice ? dice_default(s, n, r, i, r += (a - r) * s.value / p) : slice_default(s, n, r, n += (i - n) * s.value / p, a), p -= s.value;
605
+ }
606
+ else t._squarify = o = squarifyRatio(e, t, n, r, i, a), o.ratio = e;
607
+ }
608
+ return resquarify.ratio = function(e) {
609
+ return custom((e = +e) > 1 ? e : 1);
610
+ }, resquarify;
611
+ })(x), CirclePacking = class extends a {
612
+ diameter;
613
+ pack;
614
+ svg;
615
+ _focus;
616
+ circle;
617
+ view;
618
+ _node;
619
+ constructor() {
620
+ super(), e.call(this);
621
+ }
622
+ enter(e, t) {
623
+ this.diameter = Math.min(this.width(), this.height()), this.pack = pack_default().size([this.diameter - 4, this.diameter - 4]).padding(1.5), this.svg = t.append("g");
624
+ }
625
+ update(e, t) {
626
+ let n = this;
627
+ this.diameter = Math.min(this.width(), this.height()), this.pack.size([this.diameter - 4, this.diameter - 4]).padding(1.5), this._palette = this._palette.switch(this.paletteID()), this.useClonedPalette() && (this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id())), this.svg.selectAll("circle").remove(), this.svg.selectAll("text").remove();
628
+ let r = hierarchy(this.data()).sum(function(e) {
629
+ return e && e.size ? e.size : 1;
630
+ }).sort(function(e, t) {
631
+ return e.value < t.value ? -1 : +(e.value > t.value);
632
+ });
633
+ this._focus = r, this.pack(r), this.circle = this.svg.selectAll("circle").data(r.descendants()).enter().append("circle").attr("class", function(e) {
634
+ return e.parent ? e.children ? "node" : "node leaf" : "node root";
635
+ }).style("fill", function(e) {
636
+ return e.color = n.paletteDepthLevel_exists() && e.depth > n.paletteDepthLevel() ? f(e.parent.color)[n.paletteDepthVariant()](1) : n._palette(e.data.label), e.color;
637
+ }).on("click", function(e) {
638
+ n.click(e.data, null, null);
639
+ }).on("dblclick", function(e) {
640
+ this._focus !== e && n.zoom(e), c().stopPropagation();
641
+ }), this.circle.append("title").text(function(e) {
642
+ return e.data.label;
643
+ }), this.svg.selectAll("text").data(r.descendants()).enter().append("text").attr("class", "label").style("fill-opacity", function(e) {
644
+ return +(e.parent === r);
645
+ }).style("display", function(e) {
646
+ return e.parent === r ? null : "none";
647
+ }).text(function(e) {
648
+ return e.data.label + (n.showSize() && e.data.size !== void 0 ? " " + e.data.size : "");
649
+ }), this._node = this.svg.selectAll("circle,text"), this.zoomTo([
650
+ r.x,
651
+ r.y,
652
+ r.r * 2
653
+ ]);
654
+ }
655
+ zoom(e) {
656
+ this._focus = e;
657
+ let t = this, n = this.svg.transition().duration(c().altKey ? 7500 : 750).tween("zoom", function() {
658
+ let e = u(t.view, [
659
+ t._focus.x,
660
+ t._focus.y,
661
+ t._focus.r * 2
662
+ ]);
663
+ return function(n) {
664
+ t.zoomTo(e(n));
665
+ };
666
+ });
667
+ function showText(e) {
668
+ return e === t._focus && !e.children || e.parent === t._focus;
669
+ }
670
+ n.selectAll("text").filter(function(e) {
671
+ return showText(e) || this.style.display === "inline";
672
+ }).style("fill-opacity", function(e) {
673
+ return +!!showText(e);
674
+ }).on("start", function(e) {
675
+ showText(e) && (this.style.display = "inline");
676
+ }).on("end", function(e) {
677
+ showText(e) || (this.style.display = "none");
678
+ });
679
+ }
680
+ zoomTo(e) {
681
+ let t = this.diameter / e[2];
682
+ this.view = e, this._node.attr("transform", function(n) {
683
+ return "translate(" + (n.x - e[0]) * t + "," + (n.y - e[1]) * t + ")";
684
+ }), this.circle.attr("r", function(e) {
685
+ return e.r * t;
686
+ });
687
+ }
688
+ };
689
+ CirclePacking.prototype._class += " tree_CirclePacking", CirclePacking.prototype.implements(e.prototype), CirclePacking.prototype.publish("showSize", !0, "boolean", "Show size along with label"), CirclePacking.prototype.publish("paletteDepthLevel", null, "number", "If not null then beyond this depth number the child node colors are based on parent", null, { optional: !0 }), CirclePacking.prototype.publish("paletteDepthVariant", "brighter", "set", "Determines paletteDepthLevel decendant color shade variant", ["brighter", "darker"], { disable: (e) => e.paletteDepthLevel_exists() }), CirclePacking.prototype.publish("paletteID", "default", "set", "Color palette for this widget", CirclePacking.prototype._palette.switch(), { tags: ["Basic", "Shared"] }), CirclePacking.prototype.publish("useClonedPalette", !1, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
690
+ //#endregion
691
+ //#region src/Dendrogram.ts
692
+ var DendrogramColumn = class extends i {
693
+ _owner;
694
+ constructor() {
695
+ super();
696
+ }
697
+ owner(e) {
698
+ return arguments.length ? (this._owner = e, this) : this._owner;
699
+ }
700
+ valid() {
701
+ return !!this.column();
702
+ }
703
+ column;
704
+ };
705
+ DendrogramColumn.prototype._class += " tree_Dendrogram.DendrogramColumn", DendrogramColumn.prototype.publish("column", null, "set", "Field", function() {
706
+ return this._owner ? this._owner.columns() : [];
707
+ }, { optional: !0 });
708
+ var Dendrogram = class extends o {
709
+ Column;
710
+ _d3LayoutCluster;
711
+ _d3LayoutTree;
712
+ _d3Layout;
713
+ constructor() {
714
+ super(), e.call(this), s.SimpleSelectionMixin.call(this), this._drawStartPos = "origin", this._d3LayoutCluster = cluster_default(), this._d3LayoutTree = tree_default();
715
+ }
716
+ dendrogramData() {
717
+ if (this.data().length === 0) return [];
718
+ if (!this.mappings().filter((e) => e.valid()).length) return this.data();
719
+ return formatData({
720
+ key: "root",
721
+ values: this._db.rollupView(this.mappings().map(function(e) {
722
+ return e.column();
723
+ })).entries()
724
+ });
725
+ function formatData(e) {
726
+ return {
727
+ label: e.key,
728
+ children: e.values.filter(function(e) {
729
+ return !(e instanceof Array);
730
+ }).map(function(e) {
731
+ return formatData(e);
732
+ }),
733
+ origRows: e.values
734
+ };
735
+ }
736
+ }
737
+ enter(e, t) {
738
+ super.enter(e, t), this._renderElement.attr("opacity", 0).transition().duration(500).attr("opacity", 1), this._selection.widgetElement(this._renderElement);
739
+ }
740
+ update(e, t) {
741
+ super.update(e, t);
742
+ let n = this, r = this.orientation() === "vertical";
743
+ this._palette = this._palette.switch(this.paletteID()), this.useClonedPalette() && (this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id())), this._d3Layout = this.dendrogram() ? this._d3LayoutCluster : this._d3LayoutTree, this.radial() ? (this._d3Layout.size([360, this.separation() * 2]), this._d3Layout.separation(function separation(e, t) {
744
+ return (e.parent === t.parent ? 1 : 2) / e.depth;
745
+ })) : (this._d3Layout.nodeSize([14, this.separation()]), this._d3Layout.separation(function separation(e, t) {
746
+ return e.parent === t.parent ? 1 : 2;
747
+ }));
748
+ let i = hierarchy(this.dendrogramData());
749
+ this._d3Layout(i);
750
+ let a = i.descendants(), o = i.descendants().slice(1);
751
+ function linkVertical(e) {
752
+ return "M" + e.parent.x + "," + e.parent.y + "C" + e.parent.x + "," + (e.parent.y + e.y) / 2 + " " + e.x + "," + (e.parent.y + e.y) / 2 + " " + e.x + "," + e.y;
753
+ }
754
+ function linkHorizontal(e) {
755
+ return "M" + e.y + "," + e.x + "C" + (e.y + e.parent.y) / 2 + "," + e.x + " " + (e.y + e.parent.y) / 2 + "," + e.parent.x + " " + e.parent.y + "," + e.parent.x;
756
+ }
757
+ function diagonal(e) {
758
+ return r ? linkVertical(e) : linkHorizontal(e);
759
+ }
760
+ function project(e, t) {
761
+ let n = (e - 90) / 180 * Math.PI, r = t;
762
+ return [r * Math.cos(n), r * Math.sin(n)];
763
+ }
764
+ function radialDiagonal(e) {
765
+ return "M" + project(e.x, e.y) + "C" + project(e.x, (e.y + e.parent.y) / 2) + " " + project(e.parent.x, (e.y + e.parent.y) / 2) + " " + project(e.parent.x, e.parent.y);
766
+ }
767
+ let s = this._renderCount ? 500 : 0, c = this._renderElement.selectAll(".link").data(o);
768
+ c.enter().append("path").attr("class", "link").attr("d", this.radial() ? radialDiagonal : diagonal), c.transition().duration(s).attr("d", this.radial() ? radialDiagonal : diagonal), c.exit().remove();
769
+ let l = this.circleRadius() + 2;
770
+ function nodeTransform(e) {
771
+ return n.radial() ? "rotate(" + (e.x - 90) + ")translate(" + e.y + ")" : n.orientation() === "horizontal" ? "translate(" + e.y + "," + e.x + ")" : "translate(" + e.x + "," + e.y + ")";
772
+ }
773
+ let u = this._renderElement.selectAll(".node").data(a);
774
+ u.transition().duration(s).attr("transform", nodeTransform);
775
+ let d = u.enter().append("g").attr("class", "node").attr("transform", nodeTransform).call(this._selection.enter.bind(this._selection)).on("click", function(e) {
776
+ let t = e;
777
+ for (; t.children;) t = t.children[0];
778
+ e.depth > 0 && (t.origRows ? n.click(n.rowToObj(t.origRows[0]), n.mappings()[e.depth - 1].column(), !0) : n.click(t.data, n.mappings()[e.depth - 1].column(), !0));
779
+ }).on("dblclick", function(e) {
780
+ let t = e;
781
+ for (; t.children;) t = t.children[0];
782
+ e.depth > 0 && (t.origRows ? n.dblclick(n.rowToObj(t.origRows[0]), n.mappings()[e.depth - 1].column(), !0) : n.dblclick(t.data, n.mappings()[e.depth - 1].column(), !0));
783
+ }).each(function() {
784
+ let e = h(this);
785
+ e.append("circle"), e.append("text");
786
+ });
787
+ d.merge(u).select("circle").attr("r", this.circleRadius()).style("fill", function(e) {
788
+ return n._palette(e.data.label);
789
+ }).append("title").text(function(e) {
790
+ return e.data.label;
791
+ }), d.merge(u).select("text").attr("dx", function(e) {
792
+ return n.radial() ? e.children ? e.x < 180 ? -l : l : e.x < 180 ? l : -l : r ? e.children ? l : -l : e.children ? -l : l;
793
+ }).attr("dy", "0.25em").style("text-anchor", function(e) {
794
+ return n.radial() ? e.children ? e.x < 180 ? "end" : "start" : e.x < 180 ? "start" : "end" : r ? e.children ? "start" : "end" : e.children ? "end" : "start";
795
+ }).attr("transform", function(e) {
796
+ return n.radial() ? e.x < 180 ? null : "rotate(180)" : r ? "rotate(-66)" : null;
797
+ }).text(function(e) {
798
+ return e.data.label;
799
+ }), u.exit().remove(), this._renderCount || n.zoomToFit();
800
+ }
801
+ };
802
+ Dendrogram.prototype._class += " tree_Dendrogram", Dendrogram.prototype.implements(e.prototype), Dendrogram.prototype.mixin(s.SimpleSelectionMixin), Dendrogram.prototype.Column = DendrogramColumn, Dendrogram.prototype.publish("paletteID", "default", "set", "Color palette for this widget", Dendrogram.prototype._palette.switch(), { tags: ["Basic", "Shared"] }), Dendrogram.prototype.publish("useClonedPalette", !1, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }), Dendrogram.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: DendrogramColumn }), Dendrogram.prototype.publish("circleRadius", 4.5, "number", "Text offset from circle"), Dendrogram.prototype.publish("separation", 240, "number", "Leaf Separation"), Dendrogram.prototype.publish("dendrogram", !0, "boolean", "Dendrogram"), Dendrogram.prototype.publish("radial", !1, "boolean", "Radial"), Dendrogram.prototype.publish("orientation", "horizontal", "set", "Orientation", ["horizontal", "vertical"], {
803
+ tags: ["Private"],
804
+ disable: (e) => e.radial()
805
+ });
806
+ //#endregion
807
+ //#region src/DirectoryTree.ts
808
+ var DirectoryTree = class extends t {
809
+ constructor() {
810
+ super();
811
+ }
812
+ flattenData(e) {
813
+ let t = this, n = hierarchy(e), r = [];
814
+ return this.omitRoot() ? n.children && n.children.forEach(visitNode) : visitNode(n), r;
815
+ function visitNode(e) {
816
+ let n = e.data.markers && e.data.markers.length ? e.data.markers.length : "";
817
+ r.push({
818
+ label: e.data.label,
819
+ depth: e.depth - +!!t.omitRoot(),
820
+ content: e.data.content,
821
+ isFolder: !!e.data.children,
822
+ iconClass: e.data.iconClass,
823
+ color: e.data.color,
824
+ bold: e.data.bold,
825
+ weightValue: n,
826
+ markers: e.data.markers,
827
+ selected: e.data.selected
828
+ }), e.children && e.children.forEach(visitNode);
829
+ }
830
+ }
831
+ iconClass(e) {
832
+ return e.label === "error" ? "fa fa-exclamation" : e.isFolder ? this.folderIconOpen() : this.textFileIcon();
833
+ }
834
+ calcRequiredWidth() {
835
+ let e = this.flattenData(this.data()), t = 0, n = this.rowItemPadding(), i = this.iconSize() + n * 2, a = r.getScrollbarWidth();
836
+ return e.forEach((e) => {
837
+ let r = e.depth * i + n * 2, o = s.textSize(e.label, this.fontFamily(), this.fontSize(), !!e.bold).width + n * 2 + i + r + a;
838
+ t < o && (t = o);
839
+ }), t;
840
+ }
841
+ rowClick(e, t) {}
842
+ enter(e, t) {
843
+ super.enter(e, t), t.style("width", "100%").style("height", "100%");
844
+ }
845
+ update(e, t) {
846
+ super.update(e, t), this._palette = this._palette.switch(this.paletteID()), t.style("overflow-y", this.verticalScroll() ? "scroll" : null);
847
+ let r = this.flattenData(this.data()), i = d(r, (e) => Number(e.weightValue));
848
+ r.forEach((e) => {
849
+ e.weightValue ? e.weightColor = this._palette(e.weightValue, 1, i) : e.weightColor = "transparent";
850
+ });
851
+ let a = this, o = this.rowItemPadding(), s = this.iconSize() + o, c = Math.max(a.iconSize(), a.fontSize()), l = t.selectAll(".directory-row").data(r), u = this.fontFamily(), f = this.fontSize(), p = d(r, (e) => this.textSize(e.weightValue, u, f).width), m = `${o}px ${o}px ${o / 2}px ${o}px`;
852
+ l.enter().append("div").attr("class", (e) => `directory-row directory-row-depth-${e.depth}`).style("display", "flex").style("cursor", "pointer").each(function(e) {
853
+ let r = h(this), i = e.color ? e.color : a.fontColor(), l = e.weightColor ? e.weightColor : "transparent", d = n.textColor(l), g = r.append("div").attr("class", "row-weight").style("padding", m).style("color", d).style("box-shadow", `inset 0 0 100px ${l}`).style("font-weight", e.bold ? "bold" : "normal").style("font-family", u).style("font-size", f + "px").text(e.weightValue).attr("title", e.weightValue).style("overflow", "hidden").style("width", p + o * 2 + "px").style("text-overflow", "ellipsis").style("text-align", "right").style("line-height", c + "px");
854
+ r.append("div").attr("class", "row-depth").style("width", a.depthSize() * e.depth + "px").style("opacity", 1).style("line-height", c + "px");
855
+ let _ = r.append("div").attr("class", "row-icon " + (e.iconClass ? e.iconClass : a.iconClass(e))).style("width", s + "px").style("height", c + "px").style("color", i).style("background-color", e.selected ? a.selectionBackgroundColor() : "transparent").style("font-size", a.iconSize() + "px").style("padding", m).style("line-height", c + "px"), v = r.append("div").attr("class", "row-label").style("padding", m).style("color", i).style("background-color", e.selected ? a.selectionBackgroundColor() : "transparent").style("font-weight", e.bold ? "bold" : "normal").style("font-family", a.fontFamily()).style("font-size", a.fontSize() + "px").text(e.label).attr("title", e.label).style("flex", 1).style("overflow", "hidden").style("text-overflow", "ellipsis").style("line-height", c + "px");
856
+ r.on("mouseenter", () => {
857
+ v.style("font-weight", "bold");
858
+ }).on("mouseleave", () => {
859
+ v.style("font-weight", e.bold ? "bold" : "normal");
860
+ }), g.on("mouseenter", () => {
861
+ a.weight_mouseenter(e);
862
+ }).on("mouseleave", () => {
863
+ a.weight_mouseleave(e);
864
+ }), e.isFolder ? r.on("click", function(e) {
865
+ let t = this.nextSibling, n = r.classed("folder-closed");
866
+ for (n ? (r.classed("folder-closed", !1), r.classed("folder-open", !0), _.attr("class", "row-icon " + a.folderIconOpen())) : (r.classed("folder-closed", !0), r.classed("folder-open", !1), _.attr("class", "row-icon " + a.folderIconClosed())); t !== null;) h(t).datum().depth > e.depth ? (t.style.display = n ? "flex" : "none", t = t.nextSibling) : t = null;
867
+ }) : r.on("click", () => {
868
+ t.selectAll(".row-label").style("background-color", "transparent"), t.selectAll(".row-icon").style("background-color", "transparent"), _.style("background-color", a.selectionBackgroundColor()), v.style("background-color", a.selectionBackgroundColor());
869
+ let n = e.label.split(".").pop().toLowerCase();
870
+ a.rowClick(n === "json" ? JSON.stringify(JSON.parse(e.content), null, 4) : e.content, e.markers);
871
+ });
872
+ }).merge(l).style("background-color", a.backgroundColor()), l.exit().remove();
873
+ }
874
+ weight_mouseenter(e) {}
875
+ weight_mouseleave(e) {}
876
+ };
877
+ DirectoryTree.prototype._class += " tree_DirectoryTree", DirectoryTree.prototype._palette = n.rainbow("Blues"), DirectoryTree.prototype.publish("depthSize", 14, "number", "Width of indentation per file or folder depth (pixels)"), DirectoryTree.prototype.publish("paletteID", "Blues", "set", "Color palette for the weight backgrounds", DirectoryTree.prototype._palette.switch(), { tags: ["Basic"] }), DirectoryTree.prototype.publish("omitRoot", !1, "boolean", "If true, root node will not display"), DirectoryTree.prototype.publish("rowItemPadding", 2, "number", "Top, bottom, left and right row item padding"), DirectoryTree.prototype.publish("selectionBackgroundColor", "#CCC", "html-color", "Background color of selected directory rows"), DirectoryTree.prototype.publish("backgroundColor", "#FFF", "html-color", "Directory item background color"), DirectoryTree.prototype.publish("fontColor", "#000", "html-color", "Directory item font color"), DirectoryTree.prototype.publish("fontFamily", "Arial", "string", "Directory item font family"), DirectoryTree.prototype.publish("fontSize", 12, "number", "Directory item font size (pixels)"), DirectoryTree.prototype.publish("iconSize", 12, "number", "Directory folder and file icon size (pixels)"), DirectoryTree.prototype.publish("folderIconOpen", "fa fa-folder-open", "string", "Open folder icon class"), DirectoryTree.prototype.publish("folderIconClosed", "fa fa-folder", "string", "Closed folder icon class"), DirectoryTree.prototype.publish("textFileIcon", "fa fa-file-text-o", "string", "Text file icon class"), DirectoryTree.prototype.publish("verticalScroll", !0, "boolean", "If true, vertical scroll bar will be shown");
878
+ //#endregion
879
+ //#region src/Indented.ts
880
+ var IndentedColumn = class extends i {
881
+ _owner;
882
+ constructor() {
883
+ super();
884
+ }
885
+ owner(e) {
886
+ return arguments.length ? (this._owner = e, this) : this._owner;
887
+ }
888
+ valid() {
889
+ return !!this.column();
890
+ }
891
+ column;
892
+ };
893
+ IndentedColumn.prototype._class += " tree_Dendrogram.IndentedColumn", IndentedColumn.prototype.publish("column", null, "set", "Field", function() {
894
+ return this._owner ? this._owner.columns() : [];
895
+ }, { optional: !0 });
896
+ var Indented = class extends o {
897
+ Column;
898
+ _d3Tree;
899
+ _xml;
900
+ _svgLinks;
901
+ _svgNodes;
902
+ _treeData;
903
+ _collapsed = {};
904
+ constructor() {
905
+ super(), e.call(this), s.SimpleSelectionMixin.call(this), this._drawStartPos = "origin", this._d3Tree = tree_default();
906
+ }
907
+ xmlToData(e, t = "") {
908
+ return DOMParser ? xmlToJson(new DOMParser().parseFromString(e, "text/xml"), t).children[0] : [];
909
+ }
910
+ xml(e) {
911
+ return arguments.length ? (this._xml = e, this.data(this.xmlToData(this._xml)), this) : this._xml;
912
+ }
913
+ IndentedData() {
914
+ if (this.data().length === 0) return [];
915
+ if (this.xmlColumn_exists()) {
916
+ let e = this.columns().indexOf(this.xmlColumn()), t = {
917
+ label: this.xmlColumn(),
918
+ children: this.data().map(function(t, n) {
919
+ return this.xmlToData(t[e], "[" + n + "]");
920
+ }, this)
921
+ };
922
+ return t.children.length === 1 ? t.children[0] : t;
923
+ } else return this.mappings().filter((e) => e.valid()).length ? formatData({
924
+ key: "root",
925
+ values: this._db.rollupView(this.mappings().map(function(e) {
926
+ return e.column();
927
+ })).entries()
928
+ }) : this.data();
929
+ function formatData(e) {
930
+ if (e.values instanceof Array) {
931
+ let t = e.values.filter(function(e) {
932
+ return !(e instanceof Array);
933
+ }).map(function(e) {
934
+ return formatData(e);
935
+ }), n = { label: e.key };
936
+ return t.length ? n.children = t : n.size = 22, n;
937
+ }
938
+ return {
939
+ label: e.key,
940
+ size: e.values.aggregate,
941
+ origRows: e.values
942
+ };
943
+ }
944
+ }
945
+ enter(e, t) {
946
+ super.enter(e, t), this._svgLinks = this._renderElement.append("g"), this._svgNodes = this._renderElement.append("g"), this._selection.widgetElement(this._svgNodes);
947
+ }
948
+ _prevDataChecksum;
949
+ update(e, t) {
950
+ super.update(e, t);
951
+ let n = this;
952
+ this._d3Tree.nodeSize([0, this.barHeight()]);
953
+ let r = this._db.dataChecksum();
954
+ this._prevDataChecksum !== r && (this._treeData = this.IndentedData(), this._prevDataChecksum = r);
955
+ function getID(e) {
956
+ return (e.parent ? getID(e.parent) + "." : "") + e.data.label;
957
+ }
958
+ let i = hierarchy(this.data()).sum(function(e) {
959
+ return e.size || 50;
960
+ }).each((e) => {
961
+ this._collapsed[getID(e)] && delete e.children;
962
+ }), a = this._d3Tree(i).descendants(), o = this._d3Tree(i).descendants().slice(1), s = 0;
963
+ i.eachBefore((e) => {
964
+ e.x = s * n.barHeight(), ++s;
965
+ });
966
+ let c = this.barHeight() - 4, l = this._renderCount ? 500 : 0, u = this._svgLinks.selectAll(".link").data(o, function(e) {
967
+ return getID(e);
968
+ });
969
+ u.enter().append("path").attr("class", "link").attr("d", elbow), u.transition().duration(l).attr("d", elbow), u.exit().remove();
970
+ function elbow(e) {
971
+ return "M" + e.parent.y + "," + e.parent.x + "V" + e.x + ", H" + e.y;
972
+ }
973
+ let d = this._svgNodes.selectAll(".node").data(a, function(e) {
974
+ return getID(e);
975
+ });
976
+ d.transition().duration(l).attr("transform", function(e) {
977
+ return "translate(" + e.y + "," + e.x + ")";
978
+ });
979
+ let f = d.enter().append("g").attr("class", "node").attr("transform", function(e) {
980
+ return "translate(" + e.y + "," + e.x + ")";
981
+ }).call(this._selection.enter.bind(this._selection)).each(function() {
982
+ let e = h(this);
983
+ e.append("rect").attr("height", c).attr("width", c).on("click", function(e) {
984
+ n._collapsed[getID(e)] ? delete n._collapsed[getID(e)] : e.children && (n._collapsed[getID(e)] = !0), n.lazyRender();
985
+ }), e.append("text");
986
+ }).style("opacity", 0);
987
+ f.transition().style("opacity", 1), f.merge(d).select("rect").attr("x", -c / 2).attr("y", -c / 2).style("fill", color), f.merge(d).select("text").attr("dx", c / 2 + 4 + "px").attr("dy", "0.33em").text(function(e) {
988
+ return e.data.label;
989
+ }), d.exit().transition().style("opacity", 0).remove(), this._renderCount || n.zoomToFit();
990
+ function color(e) {
991
+ return n._collapsed[getID(e)] ? "#3182bd" : e.children ? "#c6dbef" : "#fd8d3c";
992
+ }
993
+ }
994
+ };
995
+ Indented.prototype._class += " tree_Indented", Indented.prototype.implements(e.prototype), Indented.prototype.mixin(s.SimpleSelectionMixin), Indented.prototype.Column = IndentedColumn, Indented.prototype.publish("xmlColumn", null, "set", "Field", function() {
996
+ return this.columns();
997
+ }, { optional: !0 }), Indented.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, {
998
+ autoExpand: IndentedColumn,
999
+ disable: (e) => e.xmlColumn_exists()
1000
+ }), Indented.prototype.publish("barHeight", 16, "number", "Bar height");
1001
+ function xmlToJson(e, t = "") {
1002
+ let n = {
1003
+ id: t,
1004
+ label: "",
1005
+ attributes: {},
1006
+ children: []
1007
+ };
1008
+ if (n.label = e.nodeName, e.nodeType === 1) {
1009
+ if (e.attributes.length > 0) for (let t = 0; t < e.attributes.length; t++) {
1010
+ let r = e.attributes.item(t);
1011
+ n.attributes[r.nodeName] = r.nodeValue;
1012
+ }
1013
+ } else e.nodeType === 3 && (n.label = e.nodeValue);
1014
+ if (e.hasChildNodes()) for (let r = 0; r < e.childNodes.length; r++) {
1015
+ let i = xmlToJson(e.childNodes.item(r), t + "[" + n.children.length + "]");
1016
+ n.children.push(i);
1017
+ }
1018
+ return n;
1019
+ }
1020
+ //#endregion
1021
+ //#region ../../node_modules/d3-path/src/path.js
1022
+ var w = Math.PI, T = 2 * w, E = 1e-6, D = T - E;
1023
+ function Path() {
1024
+ this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
1025
+ }
1026
+ function path() {
1027
+ return new Path();
1028
+ }
1029
+ Path.prototype = path.prototype = {
1030
+ constructor: Path,
1031
+ moveTo: function(e, t) {
1032
+ this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t);
1033
+ },
1034
+ closePath: function() {
1035
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
1036
+ },
1037
+ lineTo: function(e, t) {
1038
+ this._ += "L" + (this._x1 = +e) + "," + (this._y1 = +t);
1039
+ },
1040
+ quadraticCurveTo: function(e, t, n, r) {
1041
+ this._ += "Q" + +e + "," + +t + "," + (this._x1 = +n) + "," + (this._y1 = +r);
1042
+ },
1043
+ bezierCurveTo: function(e, t, n, r, i, a) {
1044
+ this._ += "C" + +e + "," + +t + "," + +n + "," + +r + "," + (this._x1 = +i) + "," + (this._y1 = +a);
1045
+ },
1046
+ arcTo: function(e, t, n, r, i) {
1047
+ e = +e, t = +t, n = +n, r = +r, i = +i;
1048
+ var a = this._x1, o = this._y1, s = n - e, c = r - t, l = a - e, u = o - t, d = l * l + u * u;
1049
+ if (i < 0) throw Error("negative radius: " + i);
1050
+ if (this._x1 === null) this._ += "M" + (this._x1 = e) + "," + (this._y1 = t);
1051
+ else if (d > E) if (!(Math.abs(u * s - c * l) > E) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);
1052
+ else {
1053
+ var f = n - a, p = r - o, m = s * s + c * c, h = f * f + p * p, g = Math.sqrt(m), _ = Math.sqrt(d), v = i * Math.tan((w - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;
1054
+ Math.abs(y - 1) > E && (this._ += "L" + (e + y * l) + "," + (t + y * u)), this._ += "A" + i + "," + i + ",0,0," + +(u * f > l * p) + "," + (this._x1 = e + b * s) + "," + (this._y1 = t + b * c);
1055
+ }
1056
+ },
1057
+ arc: function(e, t, n, r, i, a) {
1058
+ e = +e, t = +t, n = +n, a = !!a;
1059
+ var o = n * Math.cos(r), s = n * Math.sin(r), c = e + o, l = t + s, u = 1 ^ a, d = a ? r - i : i - r;
1060
+ if (n < 0) throw Error("negative radius: " + n);
1061
+ this._x1 === null ? this._ += "M" + c + "," + l : (Math.abs(this._x1 - c) > E || Math.abs(this._y1 - l) > E) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % T + T), d > D ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > E && (this._ += "A" + n + "," + n + ",0," + +(d >= w) + "," + u + "," + (this._x1 = e + n * Math.cos(i)) + "," + (this._y1 = t + n * Math.sin(i))));
1062
+ },
1063
+ rect: function(e, t, n, r) {
1064
+ this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t) + "h" + +n + "v" + +r + "h" + -n + "Z";
1065
+ },
1066
+ toString: function() {
1067
+ return this._;
1068
+ }
1069
+ };
1070
+ //#endregion
1071
+ //#region ../../node_modules/d3-shape/src/constant.js
1072
+ function constant_default(e) {
1073
+ return function constant() {
1074
+ return e;
1075
+ };
1076
+ }
1077
+ __name(constant_default, "default");
1078
+ //#endregion
1079
+ //#region ../../node_modules/d3-shape/src/math.js
1080
+ var O = Math.abs, k = Math.atan2, A = Math.cos, j = Math.max, M = Math.min, N = Math.sin, P = Math.sqrt, F = Math.PI, I = F / 2, ee = 2 * F;
1081
+ function acos(e) {
1082
+ return e > 1 ? 0 : e < -1 ? F : Math.acos(e);
1083
+ }
1084
+ function asin(e) {
1085
+ return e >= 1 ? I : e <= -1 ? -I : Math.asin(e);
1086
+ }
1087
+ //#endregion
1088
+ //#region ../../node_modules/d3-shape/src/arc.js
1089
+ function arcInnerRadius(e) {
1090
+ return e.innerRadius;
1091
+ }
1092
+ function arcOuterRadius(e) {
1093
+ return e.outerRadius;
1094
+ }
1095
+ function arcStartAngle(e) {
1096
+ return e.startAngle;
1097
+ }
1098
+ function arcEndAngle(e) {
1099
+ return e.endAngle;
1100
+ }
1101
+ function arcPadAngle(e) {
1102
+ return e && e.padAngle;
1103
+ }
1104
+ function intersect(e, t, n, r, i, a, o, s) {
1105
+ var c = n - e, l = r - t, u = o - i, d = s - a, f = d * c - u * l;
1106
+ if (!(f * f < 1e-12)) return f = (u * (t - a) - d * (e - i)) / f, [e + f * c, t + f * l];
1107
+ }
1108
+ function cornerTangents(e, t, n, r, i, a, o) {
1109
+ var s = e - n, c = t - r, l = (o ? a : -a) / P(s * s + c * c), u = l * c, d = -l * s, f = e + u, p = t + d, m = n + u, h = r + d, g = (f + m) / 2, _ = (p + h) / 2, v = m - f, y = h - p, b = v * v + y * y, x = i - a, S = f * h - m * p, C = (y < 0 ? -1 : 1) * P(j(0, x * x * b - S * S)), w = (S * y - v * C) / b, T = (-S * v - y * C) / b, E = (S * y + v * C) / b, D = (-S * v + y * C) / b, O = w - g, k = T - _, A = E - g, M = D - _;
1110
+ return O * O + k * k > A * A + M * M && (w = E, T = D), {
1111
+ cx: w,
1112
+ cy: T,
1113
+ x01: -u,
1114
+ y01: -d,
1115
+ x11: w * (i / x - 1),
1116
+ y11: T * (i / x - 1)
1117
+ };
1118
+ }
1119
+ function arc_default() {
1120
+ var e = arcInnerRadius, t = arcOuterRadius, n = constant_default(0), r = null, i = arcStartAngle, a = arcEndAngle, o = arcPadAngle, s = null;
1121
+ function arc() {
1122
+ var c, l, u = +e.apply(this, arguments), d = +t.apply(this, arguments), f = i.apply(this, arguments) - I, p = a.apply(this, arguments) - I, m = O(p - f), h = p > f;
1123
+ if (s ||= c = path(), d < u && (l = d, d = u, u = l), !(d > 1e-12)) s.moveTo(0, 0);
1124
+ else if (m > ee - 1e-12) s.moveTo(d * A(f), d * N(f)), s.arc(0, 0, d, f, p, !h), u > 1e-12 && (s.moveTo(u * A(p), u * N(p)), s.arc(0, 0, u, p, f, h));
1125
+ else {
1126
+ var g = f, _ = p, v = f, y = p, b = m, x = m, S = o.apply(this, arguments) / 2, C = S > 1e-12 && (r ? +r.apply(this, arguments) : P(u * u + d * d)), w = M(O(d - u) / 2, +n.apply(this, arguments)), T = w, E = w, D, j;
1127
+ if (C > 1e-12) {
1128
+ var L = asin(C / u * N(S)), R = asin(C / d * N(S));
1129
+ (b -= L * 2) > 1e-12 ? (L *= h ? 1 : -1, v += L, y -= L) : (b = 0, v = y = (f + p) / 2), (x -= R * 2) > 1e-12 ? (R *= h ? 1 : -1, g += R, _ -= R) : (x = 0, g = _ = (f + p) / 2);
1130
+ }
1131
+ var z = d * A(g), B = d * N(g), V = u * A(y), H = u * N(y);
1132
+ if (w > 1e-12) {
1133
+ var U = d * A(_), W = d * N(_), G = u * A(v), K = u * N(v), q;
1134
+ if (m < F && (q = intersect(z, B, G, K, U, W, V, H))) {
1135
+ var J = z - q[0], Y = B - q[1], X = U - q[0], Z = W - q[1], Q = 1 / N(acos((J * X + Y * Z) / (P(J * J + Y * Y) * P(X * X + Z * Z))) / 2), $ = P(q[0] * q[0] + q[1] * q[1]);
1136
+ T = M(w, (u - $) / (Q - 1)), E = M(w, (d - $) / (Q + 1));
1137
+ }
1138
+ }
1139
+ x > 1e-12 ? E > 1e-12 ? (D = cornerTangents(G, K, z, B, d, E, h), j = cornerTangents(U, W, V, H, d, E, h), s.moveTo(D.cx + D.x01, D.cy + D.y01), E < w ? s.arc(D.cx, D.cy, E, k(D.y01, D.x01), k(j.y01, j.x01), !h) : (s.arc(D.cx, D.cy, E, k(D.y01, D.x01), k(D.y11, D.x11), !h), s.arc(0, 0, d, k(D.cy + D.y11, D.cx + D.x11), k(j.cy + j.y11, j.cx + j.x11), !h), s.arc(j.cx, j.cy, E, k(j.y11, j.x11), k(j.y01, j.x01), !h))) : (s.moveTo(z, B), s.arc(0, 0, d, g, _, !h)) : s.moveTo(z, B), !(u > 1e-12) || !(b > 1e-12) ? s.lineTo(V, H) : T > 1e-12 ? (D = cornerTangents(V, H, U, W, u, -T, h), j = cornerTangents(z, B, G, K, u, -T, h), s.lineTo(D.cx + D.x01, D.cy + D.y01), T < w ? s.arc(D.cx, D.cy, T, k(D.y01, D.x01), k(j.y01, j.x01), !h) : (s.arc(D.cx, D.cy, T, k(D.y01, D.x01), k(D.y11, D.x11), !h), s.arc(0, 0, u, k(D.cy + D.y11, D.cx + D.x11), k(j.cy + j.y11, j.cx + j.x11), h), s.arc(j.cx, j.cy, T, k(j.y11, j.x11), k(j.y01, j.x01), !h))) : s.arc(0, 0, u, y, v, h);
1140
+ }
1141
+ if (s.closePath(), c) return s = null, c + "" || null;
1142
+ }
1143
+ return arc.centroid = function() {
1144
+ var n = (+e.apply(this, arguments) + +t.apply(this, arguments)) / 2, r = (+i.apply(this, arguments) + +a.apply(this, arguments)) / 2 - F / 2;
1145
+ return [A(r) * n, N(r) * n];
1146
+ }, arc.innerRadius = function(t) {
1147
+ return arguments.length ? (e = typeof t == "function" ? t : constant_default(+t), arc) : e;
1148
+ }, arc.outerRadius = function(e) {
1149
+ return arguments.length ? (t = typeof e == "function" ? e : constant_default(+e), arc) : t;
1150
+ }, arc.cornerRadius = function(e) {
1151
+ return arguments.length ? (n = typeof e == "function" ? e : constant_default(+e), arc) : n;
1152
+ }, arc.padRadius = function(e) {
1153
+ return arguments.length ? (r = e == null ? null : typeof e == "function" ? e : constant_default(+e), arc) : r;
1154
+ }, arc.startAngle = function(e) {
1155
+ return arguments.length ? (i = typeof e == "function" ? e : constant_default(+e), arc) : i;
1156
+ }, arc.endAngle = function(e) {
1157
+ return arguments.length ? (a = typeof e == "function" ? e : constant_default(+e), arc) : a;
1158
+ }, arc.padAngle = function(e) {
1159
+ return arguments.length ? (o = typeof e == "function" ? e : constant_default(+e), arc) : o;
1160
+ }, arc.context = function(e) {
1161
+ return arguments.length ? (s = e ?? null, arc) : s;
1162
+ }, arc;
1163
+ }
1164
+ __name(arc_default, "default");
1165
+ //#endregion
1166
+ //#region src/SunburstPartition.ts
1167
+ var SunburstPartition = class extends a {
1168
+ svg;
1169
+ radius;
1170
+ _xScale;
1171
+ _yScale;
1172
+ partition;
1173
+ arc;
1174
+ _resetRoot;
1175
+ constructor() {
1176
+ super(), e.call(this);
1177
+ }
1178
+ data(e) {
1179
+ let t = a.prototype.data.apply(this, arguments);
1180
+ return arguments.length && (this._resetRoot = !0), t;
1181
+ }
1182
+ enter(e, t) {
1183
+ let n = this;
1184
+ this.radius = Math.min(this.width(), this.height()) / 2, this._xScale = p().range([0, 2 * Math.PI]), this._yScale = m().range([0, this.radius]), this.partition = partition_default(), this.arc = arc_default().startAngle(function(e) {
1185
+ return Math.max(0, Math.min(2 * Math.PI, n._xScale(e.x0)));
1186
+ }).endAngle(function(e) {
1187
+ return Math.max(0, Math.min(2 * Math.PI, n._xScale(e.x1)));
1188
+ }).innerRadius(function(e) {
1189
+ return Math.max(0, n._yScale(e.y0));
1190
+ }).outerRadius(function(e) {
1191
+ return Math.max(0, n._yScale(e.y1));
1192
+ }), this.svg = t.append("g");
1193
+ }
1194
+ update(e, t) {
1195
+ let n = this;
1196
+ this._palette = this._palette.switch(this.paletteID()), this.useClonedPalette() && (this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id())), this.radius = Math.min(this.width(), this.height()) / 2, this._yScale.range([0, this.radius]);
1197
+ let r = hierarchy(this.data()).sum(function(e) {
1198
+ return e.size === void 0 ? 1 : e.size;
1199
+ }), i = this.svg.selectAll("path").data(this.partition(r).descendants(), function(e, t) {
1200
+ return e.data.label === void 0 ? t : e.data.label;
1201
+ });
1202
+ i.enter().append("path").on("click", function(e) {
1203
+ n.click(e.data, null, null);
1204
+ }).on("dblclick", function(e) {
1205
+ let t = c();
1206
+ t && t.stopPropagation(), n.zoomTo(e);
1207
+ }).each(function() {
1208
+ h(this).append("title");
1209
+ }).merge(i).attr("d", this.arc).style("fill", function(e) {
1210
+ return e.data.__viz_fill ? e.data.__viz_fill : n._palette(e.data.label);
1211
+ }).style("stroke", function(e) {
1212
+ return e.value > 16 ? "white" : "none";
1213
+ }).select("title").text(function(e) {
1214
+ return e.data.label;
1215
+ }), i.exit().remove(), this._resetRoot && (this._resetRoot = !1, this.zoomTo(r));
1216
+ }
1217
+ zoomTo(e) {
1218
+ let t = this;
1219
+ this.svg.transition().duration(750).tween("scale", function() {
1220
+ let n = l(t._xScale.domain(), [e.x0, e.x1]), r = l(t._yScale.domain(), [e.y0, 1]), i = l(t._yScale.range(), [e.y0 ? 20 : 0, t.radius]);
1221
+ return function(e) {
1222
+ t._xScale.domain(n(e)), t._yScale.domain(r(e)).range(i(e));
1223
+ };
1224
+ }).selectAll("path").attrTween("d", function(e) {
1225
+ return function() {
1226
+ return t.arc(e);
1227
+ };
1228
+ });
1229
+ }
1230
+ };
1231
+ SunburstPartition.prototype._class += " tree_SunburstPartition", SunburstPartition.prototype.implements(e.prototype), SunburstPartition.prototype.publish("paletteID", "default", "set", "Color palette for this widget", SunburstPartition.prototype._palette.switch(), { tags: ["Basic", "Shared"] }), SunburstPartition.prototype.publish("useClonedPalette", !1, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
1232
+ //#endregion
1233
+ //#region src/Treemap.ts
1234
+ var TreemapColumn = class extends i {
1235
+ _owner;
1236
+ constructor() {
1237
+ super();
1238
+ }
1239
+ owner(e) {
1240
+ return arguments.length ? (this._owner = e, this) : this._owner;
1241
+ }
1242
+ valid() {
1243
+ return !!this.column();
1244
+ }
1245
+ column;
1246
+ };
1247
+ TreemapColumn.prototype._class += " tree_Dendrogram.TreemapColumn", TreemapColumn.prototype.publish("column", null, "set", "Field", function() {
1248
+ return this._owner ? this._owner.columns() : [];
1249
+ }, { optional: !0 });
1250
+ var Treemap = class extends t {
1251
+ Column;
1252
+ _d3Treemap;
1253
+ _elementDIV;
1254
+ _selection;
1255
+ constructor() {
1256
+ super(), e.call(this), s.SimpleSelectionMixin.call(this, !0);
1257
+ }
1258
+ getTilingMethod() {
1259
+ switch (this.tilingMethod()) {
1260
+ case "treemapBinary": return binary_default;
1261
+ case "treemapDice": return dice_default;
1262
+ case "treemapSlice": return slice_default;
1263
+ case "treemapSliceDice": return sliceDice_default;
1264
+ case "treemapResquarify": return C;
1265
+ default: return S;
1266
+ }
1267
+ }
1268
+ treemapData() {
1269
+ if (!this.mappings().filter((e) => e.valid()).length) return this.data();
1270
+ return formatData({
1271
+ key: "root",
1272
+ values: this._db.aggregateView(this.mappings().map(function(e) {
1273
+ return e.column();
1274
+ }), this.aggrType(), this.aggrColumn()).entries()
1275
+ });
1276
+ function formatData(e) {
1277
+ if (e.values instanceof Array) {
1278
+ let t = e.values.filter(function(e) {
1279
+ return !(e instanceof Array);
1280
+ }).map(function(e) {
1281
+ return formatData(e);
1282
+ }), n = { label: e.key };
1283
+ return t.length ? n.children = t : n.size = 22, n;
1284
+ }
1285
+ return {
1286
+ label: e.key,
1287
+ size: e.values.aggregate,
1288
+ origRows: e.values
1289
+ };
1290
+ }
1291
+ }
1292
+ enter(e, t) {
1293
+ super.enter(e, t), this._d3Treemap = treemap_default(), this._elementDIV = t.append("div"), this._selection.widgetElement(this._elementDIV);
1294
+ }
1295
+ update(e, t) {
1296
+ super.update(e, t);
1297
+ let r = this;
1298
+ this._palette = this._palette.switch(this.paletteID()), this.useClonedPalette() && (this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()));
1299
+ let i = hierarchy(this.treemapData()).sum(this.nodeWeight);
1300
+ this._d3Treemap.size([this.width(), this.height()]).paddingInner(this.paddingInner()).paddingOuter(this.paddingOuter()).paddingTop(this.paddingTop()), ["treemapSquarify", "treemapResquarify"].indexOf(this.tilingMethod()) === -1 ? this._d3Treemap.tile(this.getTilingMethod()) : this._d3Treemap.tile(this.getTilingMethod().ratio(this.squarifyRatio())), this._d3Treemap(i), this._elementDIV.style("font-size", this.fontSize_exists() ? this.fontSize() + "px" : null).style("line-height", this.fontSize_exists() ? this.fontSize() + 2 + "px" : null);
1301
+ let a = this._elementDIV.selectAll(".node").data(i.descendants());
1302
+ a.enter().append("div").attr("class", "node").call(this._selection.enter.bind(this._selection)).on("click", function(e) {
1303
+ if (e) {
1304
+ let t = "";
1305
+ r.mappings().forEach(function(e) {
1306
+ e.column() && (t = e.column());
1307
+ }), e.origRows ? r.click(r.rowToObj(e.origRows[0]), t, r._selection.selected(this)) : r.click(e.data, t, r._selection.selected(this));
1308
+ }
1309
+ }).on("dblclick", function(e) {
1310
+ if (e) {
1311
+ let t = "";
1312
+ r.mappings().forEach(function(e) {
1313
+ e.column() && (t = e.column());
1314
+ }), e.origRows ? r.dblclick(r.rowToObj(e.origRows[0]), t, r._selection.selected(this)) : r.dblclick(e.data, t, r._selection.selected(this));
1315
+ }
1316
+ }).merge(a).style("left", function(e) {
1317
+ return e.x0 + Math.max(0, e.x1 - e.x0) / 2 + "px";
1318
+ }).style("top", function(e) {
1319
+ return e.y0 + Math.max(0, e.y1 - e.y0) / 2 + "px";
1320
+ }).style("width", function() {
1321
+ return "0px";
1322
+ }).style("height", function() {
1323
+ return "0px";
1324
+ }).style("font-size", function(e) {
1325
+ return (e.children ? r.parentFontSize() : r.leafFontSize()) + "px";
1326
+ }).style("line-height", function(e) {
1327
+ return (e.children ? r.parentFontSize() : r.leafFontSize()) + "px";
1328
+ }).attr("title", tooltip).html(function(e) {
1329
+ return !r.showRoot() && e.depth === 0 ? null : e.children ? r.enableParentLabels() ? r.parentWeightHTML(e) : null : r.leafWeightHTML(e);
1330
+ }).style("background", function(e) {
1331
+ if (!r.showRoot() && e.depth === 0) return this.style.color = "transparent", "transparent";
1332
+ let t = r.brighterLeafNodes() ? "brighter" : "darker", i;
1333
+ return r.usePaletteOnParentNodes() ? i = e.children ? r._palette(e.data.label) : f(r._palette(e.parent.data.label))[t](1) : (i = e.depth > r.depthColorLimit() ? f(e.parent.color)[t](1) : r._palette(e.data.label), e.color = i), this.style.color = n.textColor(i), i;
1334
+ }).transition().duration(this.transitionDuration()).style("pointer-events", function(e) {
1335
+ return !r.showRoot() && e.depth === 0 ? "none" : "all";
1336
+ }).style("opacity", function(e) {
1337
+ return e.children ? 1 : null;
1338
+ }).style("left", function(e) {
1339
+ return e.x0 + "px";
1340
+ }).style("top", function(e) {
1341
+ return e.y0 + "px";
1342
+ }).style("width", function(e) {
1343
+ return Math.max(0, e.x1 - e.x0) + "px";
1344
+ }).style("height", function(e) {
1345
+ return Math.max(0, e.y1 - e.y0) + "px";
1346
+ }).each(function(e) {
1347
+ e.depth === 0 && (this.style.color = r.showRoot() ? "" : "transparent", this.style.borderColor = r.showRoot() ? "" : "transparent");
1348
+ }), a.exit().transition().duration(this.transitionDuration()).style("opacity", 0).remove();
1349
+ function tooltip(e) {
1350
+ if (e.children && !r.enableParentTooltips()) return null;
1351
+ let t = e.data.label + " (" + e.value + ")";
1352
+ for (; e.parent && e.parent.parent;) t = e.parent.data.label + " -> " + t, e = e.parent;
1353
+ return t;
1354
+ }
1355
+ }
1356
+ exit(e, t) {
1357
+ super.exit(e, t);
1358
+ }
1359
+ nodeWeight(e) {
1360
+ return e.size || 1;
1361
+ }
1362
+ parentWeightHTML(e) {
1363
+ return this.showParentWeight() ? `<span class="treemap-parent-label">${e.data.label}</span><span class="treemap-parent-value">${e.value}${this.weightSuffix()}</span>` : `<span class="treemap-parent-label">${e.data.label}</span>`;
1364
+ }
1365
+ leafWeightHTML(e) {
1366
+ return this.showLeafWeight() ? `<span class="treemap-leaf-label">${e.data.label}</span><span class="treemap-leaf-value">${e.value}${this.weightSuffix()}</span>` : `<span class="treemap-leaf-label">${e.data.label}</span>`;
1367
+ }
1368
+ };
1369
+ Treemap.prototype._class += " tree_Treemap", Treemap.prototype.implements(e.prototype), Treemap.prototype.mixin(s.SimpleSelectionMixin), Treemap.prototype.Column = TreemapColumn, Treemap.prototype.publish("paletteID", "default", "set", "Color palette for this widget", Treemap.prototype._palette.switch(), { tags: ["Basic", "Shared"] }), Treemap.prototype.publish("useClonedPalette", !1, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }), Treemap.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: TreemapColumn }), Treemap.prototype.publish("aggrType", null, "set", "Aggregation Type", [
1370
+ null,
1371
+ "mean",
1372
+ "median",
1373
+ "sum",
1374
+ "min",
1375
+ "max"
1376
+ ], { optional: !0 }), Treemap.prototype.publish("aggrColumn", null, "set", "Aggregation Field", function() {
1377
+ return this.columns();
1378
+ }, {
1379
+ optional: !0,
1380
+ disable: (e) => !e.aggrType()
1381
+ }), Treemap.prototype.publish("fontSize", null, "number", "Font Size", null, { optional: !0 }), Treemap.prototype.publish("paddingInner", 18.6, "number", "Pixel spacing between each sibling node"), Treemap.prototype.publish("paddingOuter", 30, "number", "Pixel padding of parent nodes"), Treemap.prototype.publish("paddingTop", 41.4, "number", "Additional top pixel padding of parent nodes"), Treemap.prototype.publish("showRoot", !1, "boolean", "Show root element"), Treemap.prototype.publish("parentFontSize", 18, "number", "Parent font-size"), Treemap.prototype.publish("leafFontSize", 16, "number", "Leaf font-size"), Treemap.prototype.publish("usePaletteOnParentNodes", !1, "boolean", "Assign a color from the palette to every parent node"), Treemap.prototype.publish("depthColorLimit", 1, "number", "Assign a color from the palette to node with depth lower than this value", null, {
1382
+ optional: !0,
1383
+ disable: (e) => e.usePaletteOnParentNodes()
1384
+ }), Treemap.prototype.publish("squarifyRatio", 1, "number", "Specifies the desired aspect ratio of the generated rectangles (must be >= 1)", null, {
1385
+ optional: !0,
1386
+ disable: (e) => ["treemapSquarify", "treemapResquarify"].indexOf(e.tilingMethod()) === -1
1387
+ }), Treemap.prototype.publish("showParentWeight", !0, "boolean", "Show weight of parent nodes"), Treemap.prototype.publish("showLeafWeight", !0, "boolean", "Show weight of leaf nodes"), Treemap.prototype.publish("weightSuffix", "", "string", "Weight suffix (ex: 'ms')"), Treemap.prototype.publish("brighterLeafNodes", !1, "boolean", "Brighter/darker leaf node color (false = darker)"), Treemap.prototype.publish("enableParentLabels", !0, "boolean", "Enable parent labels"), Treemap.prototype.publish("enableParentTooltips", !0, "boolean", "Enable parent tooltips"), Treemap.prototype.publish("transitionDuration", 250, "number", "Transition Duration"), Treemap.prototype.publish("tilingMethod", "treemapSquarify", "set", "Transition Duration", [
1388
+ "treemapBinary",
1389
+ "treemapDice",
1390
+ "treemapResquarify",
1391
+ "treemapSlice",
1392
+ "treemapSliceDice",
1393
+ "treemapSquarify"
1394
+ ]);
1395
+ //#endregion
1396
+ export { y as BUILD_VERSION, CirclePacking, Dendrogram, DendrogramColumn, DirectoryTree, Indented, IndentedColumn, _ as PKG_NAME, v as PKG_VERSION, SunburstPartition, Treemap, TreemapColumn };
1397
+
3
1398
  //# sourceMappingURL=index.js.map
4
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".tree_CirclePacking circle{fill:#1f77b4;fill-opacity:.25;stroke:#1f77b4;stroke-width:1px}.tree_CirclePacking .leaf circle{fill:#ff7f0e;fill-opacity:1}.tree_CirclePacking .label{fill:#fff;text-anchor:middle}.tree_Dendrogram .node circle{fill:#dcf1ff;stroke:#1f77b4;stroke-width:1px}.tree_Dendrogram .node.selected circle{stroke:red}.tree_Dendrogram .node.over circle{stroke:orange}.tree_Dendrogram .node.selected.over circle{stroke:red}.tree_Dendrogram .node.selected text{fill:red}.tree_Dendrogram .node.over text{fill:orange}.tree_Dendrogram .node.selected.over text{fill:red}.tree_Dendrogram .node text{font-size:14px}.tree_Dendrogram .link{fill:none;stroke:#656565;stroke-width:1px}.tree_Indented .node rect{cursor:pointer;fill:#fff;stroke:#3182bd;stroke-width:1px}.tree_Indented .node text{font:10px sans-serif;pointer-events:none}.tree_Indented path.link{fill:none;stroke:#9ecae1;stroke-width:1.5px}.tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}.tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{border:solid 1px #333;overflow:hidden;text-overflow:ellipsis;position:absolute}.tree_Treemap .node.selected{border-color:red}.tree_Treemap .node.over{border-color:orange}.tree_Treemap .node.selected.over{border-color:red}.tree_Treemap .node>span.treemap-parent-label{font-weight:700;display:inline-block;margin:4px 4px 0}.tree_Treemap .node>span.treemap-parent-value{font-weight:400;font-style:italic;margin:4px 0 0}.tree_Treemap .node>span.treemap-singleton-label{font-weight:400;display:block;margin:4px 0 0 4px}.tree_Treemap .node>span.treemap-singleton-value{font-style:italic;display:block;margin:0 0 0 4px}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}}();
1399
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.tree_CirclePacking circle{fill:#1f77b4;fill-opacity:.25;stroke:#1f77b4;stroke-width:1px}.tree_CirclePacking .leaf circle{fill:#ff7f0e;fill-opacity:1}.tree_CirclePacking .label{fill:#fff;text-anchor:middle}.tree_Dendrogram .node circle{fill:#dcf1ff;stroke:#1f77b4;stroke-width:1px}.tree_Dendrogram .node.selected circle{stroke:red}.tree_Dendrogram .node.over circle{stroke:orange}.tree_Dendrogram .node.selected.over circle{stroke:red}.tree_Dendrogram .node.selected text{fill:red}.tree_Dendrogram .node.over text{fill:orange}.tree_Dendrogram .node.selected.over text{fill:red}.tree_Dendrogram .node text{font-size:14px}.tree_Dendrogram .link{fill:none;stroke:#656565;stroke-width:1px}.tree_Indented .node rect{cursor:pointer;fill:#fff;stroke:#3182bd;stroke-width:1px}.tree_Indented .node text{pointer-events:none;font:10px sans-serif}.tree_Indented path.link{fill:none;stroke:#9ecae1;stroke-width:1.5px}.tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}.tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{text-overflow:ellipsis;border:1px solid #333;position:absolute;overflow:hidden}.tree_Treemap .node.selected{border-color:red}.tree_Treemap .node.over{border-color:orange}.tree_Treemap .node.selected.over{border-color:red}.tree_Treemap .node>span.treemap-parent-label{margin:4px 4px 0;font-weight:700;display:inline-block}.tree_Treemap .node>span.treemap-parent-value{margin:4px 0 0;font-style:italic;font-weight:400}.tree_Treemap .node>span.treemap-singleton-label{margin:4px 0 0 4px;font-weight:400;display:block}.tree_Treemap .node>span.treemap-singleton-value{margin:0 0 0 4px;font-style:italic;display:block}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();