Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hpcc-js/tree

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hpcc-js/tree - npm Package Compare versions

Comparing version 2.7.11 to 2.7.12

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [2.7.12](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/tree@2.7.11...@hpcc-js/tree@2.7.12) (2019-06-27)
**Note:** Version bump only for package @hpcc-js/tree
## [2.7.11](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/tree@2.7.10...@hpcc-js/tree@2.7.11) (2019-06-26)

@@ -8,0 +16,0 @@

2

dist/index.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common"],e):e((t=t||self)["@hpcc-js/tree"]={},t["@hpcc-js/api"],t["@hpcc-js/common"])}(this,function(t,e,n){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e){return t.parent===e.parent?1:2}function a(t,e){return t+e.x}function l(t,e){return Math.max(t,e.y)}function s(){var t=o,e=1,n=1,r=!1;function i(i){var o,s=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(a,0)/t.length}(n),e.y=function(t){return 1+t.reduce(l,0)}(n)):(e.x=o?s+=t(e,o):0,e.y=0,o=e)});var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),h=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=u.x-t(u,h)/2,p=h.x+t(h,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(p-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function u(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 h(t,e){var n,r,i,o,a,l=new f(t),s=+t.value&&(l.value=t.value),u=[l];for(null==e&&(e=c);n=u.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)u.push(r=n.children[o]=new f(i[o])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(d)}function c(t){return t.children}function p(t){t.data=t.data.data}function d(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function f(t){this.data=t,this.depth=this.height=0,this.parent=null}function y(t){this._=t,this.next=null}function x(t){return function t(e,n){var r,i,o,a=null,l=e.head;switch(n.length){case 1:s=n[0],r={x:s.x,y:s.y,r:s.r};break;case 2:r=function(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,l=e.r,s=o-n,u=a-r,h=l-i,c=Math.sqrt(s*s+u*u);return{x:(n+o+s/c*h)/2,y:(r+a+u/c*h)/2,r:(c+i+l)/2}}(n[0],n[1]);break;case 3:r=function(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,l=e.y,s=e.r,u=n.x,h=n.y,c=n.r,p=2*(r-a),d=2*(i-l),f=2*(s-o),y=r*r+i*i-o*o-a*a-l*l+s*s,x=2*(r-u),_=2*(i-h),m=2*(c-o),g=r*r+i*i-o*o-u*u-h*h+c*c,v=x*d-p*_,b=(d*g-_*y)/v-r,w=(_*f-d*m)/v,T=(x*y-p*g)/v-i,M=(p*m-x*f)/v,S=w*w+M*M-1,z=2*(b*w+T*M+o),k=b*b+T*T-o*o,D=(-z-Math.sqrt(z*z-4*S*k))/(2*S);return{x:b+w*D+r,y:T+M*D+i,r:D}}(n[0],n[1],n[2])}var s;for(;l;)o=l._,i=l.next,r&&_(r,o)?a=l:(a?(e.tail=a,a.next=null):e.head=e.tail=null,n.push(o),r=t(e,n),n.pop(),e.head?(l.next=e.head,e.head=l):(l.next=null,e.head=e.tail=l),(a=e.tail).next=i),l=i;e.tail=a;return r}(function(t){for(var e=(t=t.slice()).length,n=null,r=n;e;){var i=new y(t[e-1]);r=r?r.next=i:n=i,t[void 0]=t[--e]}return{head:n,tail:r}}(t),[])}function _(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r-e.r;return i*i+1e-6>n*n+r*r}function m(t,e,n){var r=t.x,i=t.y,o=e.r+n.r,a=t.r+n.r,l=e.x-r,s=e.y-i,u=l*l+s*s;if(u){var h=.5+((a*=a)-(o*=o))/(2*u),c=Math.sqrt(Math.max(0,2*o*(a+u)-(a-=u)*a-o*o))/(2*u);n.x=r+h*l+c*s,n.y=i+h*s-c*l}else n.x=r+a,n.y=i}function g(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return i*i-1e-6>n*n+r*r}function v(t,e,n){var r=t._,i=t.next._,o=r.r+i.r,a=(r.x*i.r+i.x*r.r)/o-e,l=(r.y*i.r+i.y*r.r)/o-n;return a*a+l*l}function b(t){this._=t,this.next=null,this.previous=null}function w(t){if("function"!=typeof t)throw new Error;return t}function T(){return 0}function M(t){return function(){return t}}function S(t){return Math.sqrt(t.value)}function z(){var t=null,e=1,n=1,r=T;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(k(t)).eachAfter(D(r,.5)).eachBefore(C(1)):i.eachBefore(k(S)).eachAfter(D(T,1)).eachAfter(D(r,i.r/Math.min(e,n))).eachBefore(C(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=null==(n=e)?null:w(n),i):t;var n},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:M(+t),i):r},i}function k(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function D(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=function(t){if(!(i=t.length))return 0;var e,n,r,i;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;m(n,e,r=t[2]);var o,a,l,s,u,h,c,p=e.r*e.r,d=n.r*n.r,f=r.r*r.r,y=p+d+f,_=p*e.x+d*n.x+f*r.x,w=p*e.y+d*n.y+f*r.y;e=new b(e),n=new b(n),r=new b(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(l=3;l<i;++l){m(e._,n._,r=t[l]),r=new b(r),s=n.next,u=e.previous,h=n._.r,c=e._.r;do{if(h<=c){if(g(s._,r._)){n=s,e.next=n,n.previous=e,--l;continue t}h+=s._.r,s=s.next}else{if(g(u._,r._)){(e=u).next=n,n.previous=e,--l;continue t}c+=u._.r,u=u.previous}}while(s!==u.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,y+=f=r._.r*r._.r,p=v(e,o=(_+=f*r._.x)/y,a=(w+=f*r._.y)/y);(r=r.next)!==n;)(f=v(r,o,a))<p&&(e=r,p=f);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=x(e),l=0;l<i;++l)(e=t[l]).x-=r.x,e.y-=r.y;return r.r}(r),l)for(i=0;i<a;++i)r[i].r-=l;n.r=o+l}}}function C(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 P(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 A(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,u=t.value&&(r-e)/t.value;++l<s;)(o=a[l]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*u}function I(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&A(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,l=r.y1-n;a<i&&(i=a=(i+a)/2),l<o&&(o=l=(o+l)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=l}}(e,o)),r&&i.eachBefore(P),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i}function R(t,e){return t.parent===e.parent?1:2}function L(t){var e=t.children;return e?e[0]:t.t}function E(t){var e=t.children;return e?e[e.length-1]:t.t}function B(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 N(t,e,n){return t.a.parent===e.parent?t.a:n}function O(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 q(){var t=R,e=1,n=1,r=null;function i(i){var s=function(t){for(var e,n,r,i,o,a=new O(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 O(r[i],i)),n.parent=e;return(a.parent=new O(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(l);else{var u=i,h=i,c=i;i.eachBefore(function(t){t.x<u.x&&(u=t),t.x>h.x&&(h=t),t.depth>c.depth&&(c=t)});var p=u===h?1:t(u,h)/2,d=p-u.x,f=e/(h.x+p+d),y=n/(c.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*f,t.y=t.depth*y})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(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)}(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=function(e,n,r){if(n){for(var i,o=e,a=e,l=n,s=o.parent.children[0],u=o.m,h=a.m,c=l.m,p=s.m;l=E(l),o=L(o),l&&o;)s=L(s),(a=E(a)).a=e,(i=l.z+c-o.z-u+t(l._,o._))>0&&(B(N(l,e,r),e,i),u+=i,h+=i),c+=l.m,u+=o.m,p+=s.m,h+=a.m;l&&!E(a)&&(a.t=l,a.m+=c-h),o&&!L(s)&&(s.t=o,s.m+=u-p,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function V(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,u=t.value&&(i-n)/t.value;++l<s;)(o=a[l]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*u}f.prototype=h.prototype={constructor:f,count:function(){return this.eachAfter(u)},each:function(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},eachAfter:function(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},eachBefore:function(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},sum:function(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})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(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}(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},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return h(this).eachBefore(p)}},O.prototype=Object.create(f.prototype);var j=(1+Math.sqrt(5))/2;function W(t,e,n,r,i,o){for(var a,l,s,u,h,c,p,d,f,y,x,_=[],m=e.children,g=0,v=0,b=m.length,w=e.value;g<b;){s=i-n,u=o-r;do{h=m[v++].value}while(!h&&v<b);for(c=p=h,x=h*h*(y=Math.max(u/s,s/u)/(w*t)),f=Math.max(p/x,x/c);v<b;++v){if(h+=l=m[v].value,l<c&&(c=l),l>p&&(p=l),x=h*h*y,(d=Math.max(p/x,x/c))>f){h-=l;break}f=d}_.push(a={value:h,dice:s<u,children:m.slice(g,v)}),a.dice?A(a,n,r,i,w?r+=u*h/w:o):V(a,n,r,w?n+=s*h/w:i,o),w-=h,g=v}return _}var F=function t(e){function n(t,n,r,i,o){W(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(j);function H(t,e,n,r,i){var o,a,l=t.children,s=l.length,u=new Array(s+1);for(u[0]=a=o=0;o<s;++o)u[o+1]=a+=l[o].value;!function t(e,n,r,i,o,a,s){if(e>=n-1){var h=l[e];return h.x0=i,h.y0=o,h.x1=a,void(h.y1=s)}var c=u[e],p=r/2+c,d=e+1,f=n-1;for(;d<f;){var y=d+f>>>1;u[y]<p?d=y+1:f=y}p-u[d-1]<u[d]-p&&e+1<d&&--d;var x=u[d]-c,_=r-x;if(a-i>s-o){var m=(i*_+a*x)/r;t(e,d,x,i,o,m,s),t(d,n,_,m,o,a,s)}else{var g=(o*_+s*x)/r;t(e,d,x,i,o,a,g),t(d,n,_,i,g,a,s)}}(0,s,t.value,e,n,r,i)}function G(t,e,n,r,i){(1&t.depth?V:A)(t,e,n,r,i)}var U=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,l,s,u,h,c=-1,p=a.length,d=t.value;++c<p;){for(s=(l=a[c]).children,u=l.value=0,h=s.length;u<h;++u)l.value+=s[u].value;l.dice?A(l,n,r,i,r+=(o-r)*l.value/d):V(l,n,r,n+=(i-n)*l.value/d,o),d-=l.value}else t._squarify=a=W(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(j);function Z(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}Z(".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}");var K=function(t){function r(){var n=t.call(this)||this;return e.ITree.call(n),n}return i(r,t),r.prototype.enter=function(t,e){this.diameter=Math.min(this.width(),this.height()),this.pack=z().size([this.diameter-4,this.diameter-4]).padding(1.5),this.svg=e.append("g")},r.prototype.update=function(t,e){var r=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();var i=h(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=i,this.pack(i),this.circle=this.svg.selectAll("circle").data(i.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=r.paletteDepthLevel_exists()&&t.depth>r.paletteDepthLevel()?n.rgb(t.parent.color)[r.paletteDepthVariant()](1):r._palette(t.data.label),t.color}).on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){this._focus!==t&&r.zoom(t),n.event.stopPropagation()}),this.circle.append("title").text(function(t){return t.data.label}),this.svg.selectAll("text").data(i.descendants()).enter().append("text").attr("class","label").style("fill-opacity",function(t){return t.parent===i?1:0}).style("display",function(t){return t.parent===i?null:"none"}).text(function(t){return t.data.label+(r.showSize()&&void 0!==t.data.size?" "+t.data.size:"")}),this._node=this.svg.selectAll("circle,text"),this.zoomTo([i.x,i.y,2*i.r])},r.prototype.zoom=function(t){this._focus=t;var e=this;function r(t){return t===e._focus&&!t.children||t.parent===e._focus}this.svg.transition().duration(n.event.altKey?7500:750).tween("zoom",function(){var t=n.interpolateZoom(e.view,[e._focus.x,e._focus.y,2*e._focus.r]);return function(n){e.zoomTo(t(n))}}).selectAll("text").filter(function(t){return r(t)||"inline"===this.style.display}).style("fill-opacity",function(t){return r(t)?1:0}).on("start",function(t){r(t)&&(this.style.display="inline")}).on("end",function(t){r(t)||(this.style.display="none")})},r.prototype.zoomTo=function(t){var 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})},r}(n.SVGWidget);K.prototype._class+=" tree_CirclePacking",K.prototype.implements(e.ITree.prototype),K.prototype.publish("showSize",!0,"boolean","Show size along with label"),K.prototype.publish("paletteDepthLevel",null,"number","If not null then beyond this depth number the child node colors are based on parent",null,{optional:!0}),K.prototype.publish("paletteDepthVariant","brighter","set","Determines paletteDepthLevel decendant color shade variant",["brighter","darker"],{disable:function(t){return t.paletteDepthLevel_exists()}}),K.prototype.publish("paletteID","default","set","Color palette for this widget",K.prototype._palette.switch(),{tags:["Basic","Shared"]}),K.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});Z(".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}");var Q=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);Q.prototype._class+=" tree_Dendrogram.DendrogramColumn",Q.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var J=function(t){function r(){var r=t.call(this)||this;return e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r._drawStartPos="origin",r._d3LayoutCluster=s(),r._d3LayoutTree=q(),r}return i(r,t),r.prototype.dendrogramData=function(){return 0===this.data().length?[]:this.mappings().filter(function(t){return t.valid()}).length?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}}({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._renderElement.attr("opacity",0).transition().duration(500).attr("opacity",1),this._selection.widgetElement(this._renderElement)},r.prototype.update=function(e,r){t.prototype.update.call(this,e,r);var i=this,o="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(function(t,e){return(t.parent===e.parent?1:2)/t.depth})):(this._d3Layout.nodeSize([14,this.separation()]),this._d3Layout.separation(function(t,e){return t.parent===e.parent?1:2}));var a=h(this.dendrogramData());this._d3Layout(a);var l=a.descendants(),s=a.descendants().slice(1);function u(t){return o?function(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}(t):function(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}(t)}function c(t,e){var n=(t-90)/180*Math.PI,r=e;return[r*Math.cos(n),r*Math.sin(n)]}function p(t){return"M"+c(t.x,t.y)+"C"+c(t.x,(t.y+t.parent.y)/2)+" "+c(t.parent.x,(t.y+t.parent.y)/2)+" "+c(t.parent.x,t.parent.y)}var d=this._renderCount?500:0,f=this._renderElement.selectAll(".link").data(s);f.enter().append("path").attr("class","link").attr("d",this.radial()?p:u),f.transition().duration(d).attr("d",this.radial()?p:u),f.exit().remove();var y=this.circleRadius()+2;function x(t){return i.radial()?"rotate("+(t.x-90)+")translate("+t.y+")":"horizontal"===i.orientation()?"translate("+t.y+","+t.x+")":"translate("+t.x+","+t.y+")"}var _=this._renderElement.selectAll(".node").data(l);_.transition().duration(d).attr("transform",x);var m=_.enter().append("g").attr("class","node").attr("transform",x).call(this._selection.enter.bind(this._selection)).on("click",function(t){for(var e=t;e.children;)e=e.children[0];t.depth>0&&i.click(i.rowToObj(e.origRows[0]),i.mappings()[t.depth-1].column(),!0)}).on("dblclick",function(t){for(var e=t;e.children;)e=e.children[0];t.depth>0&&i.dblclick(i.rowToObj(e.origRows[0]),i.mappings()[t.depth-1].column(),!0)}).each(function(){var t=n.select(this);t.append("circle"),t.append("text")});m.merge(_).select("circle").attr("r",this.circleRadius()).style("fill",function(t){return i._palette(t.data.label)}).append("title").text(function(t){return t.data.label}),m.merge(_).select("text").attr("dx",function(t){return i.radial()?t.children?t.x<180?-y:y:t.x<180?y:-y:o?t.children?y:-y:t.children?-y:y}).attr("dy","0.25em").style("text-anchor",function(t){return i.radial()?t.children?t.x<180?"end":"start":t.x<180?"start":"end":o?t.children?"start":"end":t.children?"end":"start"}).attr("transform",function(t){return i.radial()?t.x<180?null:"rotate(180)":o?"rotate(-66)":null}).text(function(t){return t.data.label}),_.exit().remove(),this._renderCount||i.zoomToFit()},r}(n.SVGZoomWidget);J.prototype._class+=" tree_Dendrogram",J.prototype.implements(e.ITree.prototype),J.prototype.mixin(n.Utility.SimpleSelectionMixin),J.prototype.Column=Q,J.prototype.publish("paletteID","default","set","Color palette for this widget",J.prototype._palette.switch(),{tags:["Basic","Shared"]}),J.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),J.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:Q}),J.prototype.publish("circleRadius",4.5,"number","Text offset from circle"),J.prototype.publish("separation",240,"number","Leaf Separation"),J.prototype.publish("dendrogram",!0,"boolean","Dendrogram"),J.prototype.publish("radial",!1,"boolean","Radial"),J.prototype.publish("orientation","horizontal","set","Orientation",["horizontal","vertical"],{tags:["Private"],disable:function(t){return t.radial()}});Z(".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}");var X=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);X.prototype._class+=" tree_Dendrogram.IndentedColumn",X.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var Y=function(t){function r(){var r=t.call(this)||this;return r._collapsed={},e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r._drawStartPos="origin",r._d3Tree=q(),r}return i(r,t),r.prototype.xmlToData=function(t,e){return void 0===e&&(e=""),DOMParser?function t(e,n){void 0===n&&(n="");var r={id:n,label:"",attributes:{},children:[]};r.label=e.nodeName;if(1===e.nodeType){if(e.attributes.length>0)for(var i=0;i<e.attributes.length;i++){var o=e.attributes.item(i);r.attributes[o.nodeName]=o.nodeValue}}else 3===e.nodeType&&(r.label=e.nodeValue);if(e.hasChildNodes())for(var a=0;a<e.childNodes.length;a++){var l=e.childNodes.item(a),s=t(l,n+"["+r.children.length+"]");r.children.push(s)}return r}((new DOMParser).parseFromString(t,"text/xml"),e).children[0]:[]},r.prototype.xml=function(t){return arguments.length?(this._xml=t,this.data(this.xmlToData(this._xml)),this):this._xml},r.prototype.IndentedData=function(){if(0===this.data().length)return[];if(this.xmlColumn_exists()){var 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}return this.mappings().filter(function(t){return t.valid()}).length?function t(e){if(e.values instanceof Array){var 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}}({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._svgLinks=this._renderElement.append("g"),this._svgNodes=this._renderElement.append("g"),this._selection.widgetElement(this._svgNodes)},r.prototype.update=function(e,r){var i=this;t.prototype.update.call(this,e,r);var o=this;this._d3Tree.nodeSize([0,this.barHeight()]);var a=this._db.dataChecksum();function l(t){return(t.parent?l(t.parent)+".":"")+t.data.label}this._prevDataChecksum!==a&&(this._treeData=this.IndentedData(),this._prevDataChecksum=a);var s=h(this.data()).sum(function(t){return t.size||50}).each(function(t){i._collapsed[l(t)]&&delete t.children}),u=this._d3Tree(s).descendants(),c=this._d3Tree(s).descendants().slice(1),p=0;s.eachBefore(function(t){t.x=p*o.barHeight(),++p});var d=this.barHeight()-4,f=this._renderCount?500:0,y=this._svgLinks.selectAll(".link").data(c,function(t){return l(t)});function x(t){return"M"+t.parent.y+","+t.parent.x+"V"+t.x+", H"+t.y}y.enter().append("path").attr("class","link").attr("d",x),y.transition().duration(f).attr("d",x),y.exit().remove();var _=this._svgNodes.selectAll(".node").data(u,function(t){return l(t)});_.transition().duration(f).attr("transform",function(t){return"translate("+t.y+","+t.x+")"});var m=_.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(){var t=n.select(this);t.append("rect").attr("height",d).attr("width",d).on("click",function(t){o._collapsed[l(t)]?delete o._collapsed[l(t)]:t.children&&(o._collapsed[l(t)]=!0),o.lazyRender()}),t.append("text")}).style("opacity",0);m.transition().style("opacity",1),m.merge(_).select("rect").attr("x",-d/2).attr("y",-d/2).style("fill",function(t){return o._collapsed[l(t)]?"#3182bd":t.children?"#c6dbef":"#fd8d3c"}),m.merge(_).select("text").attr("dx",d/2+4+"px").attr("dy","0.33em").text(function(t){return t.data.label}),_.exit().transition().style("opacity",0).remove(),this._renderCount||o.zoomToFit()},r}(n.SVGZoomWidget);Y.prototype._class+=" tree_Indented",Y.prototype.implements(e.ITree.prototype),Y.prototype.mixin(n.Utility.SimpleSelectionMixin),Y.prototype.Column=X,Y.prototype.publish("xmlColumn",null,"set","Field",function(){return this.columns()},{optional:!0}),Y.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:X,disable:function(t){return t.xmlColumn_exists()}}),Y.prototype.publish("barHeight",16,"number","Bar height");var $=Math.PI,tt=2*$,et=tt-1e-6;function nt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function rt(){return new nt}function it(t){return function(){return t}}nt.prototype=rt.prototype={constructor:nt,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo: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,u=o-t,h=a-e,c=u*u+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>1e-6)if(Math.abs(h*l-s*u)>1e-6&&i){var p=n-o,d=r-a,f=l*l+s*s,y=p*p+d*d,x=Math.sqrt(f),_=Math.sqrt(c),m=i*Math.tan(($-Math.acos((f+c-y)/(2*x*_)))/2),g=m/_,v=m/x;Math.abs(g-1)>1e-6&&(this._+="L"+(t+g*u)+","+(e+g*h)),this._+="A"+i+","+i+",0,0,"+ +(h*p>u*d)+","+(this._x1=t+v*l)+","+(this._y1=e+v*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,o){t=+t,e=+e;var a=(n=+n)*Math.cos(r),l=n*Math.sin(r),s=t+a,u=e+l,h=1^o,c=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+u:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+s+","+u),n&&(c<0&&(c=c%tt+tt),c>et?this._+="A"+n+","+n+",0,1,"+h+","+(t-a)+","+(e-l)+"A"+n+","+n+",0,1,"+h+","+(this._x1=s)+","+(this._y1=u):c>1e-6&&(this._+="A"+n+","+n+",0,"+ +(c>=$)+","+h+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var ot=Math.abs,at=Math.atan2,lt=Math.cos,st=Math.max,ut=Math.min,ht=Math.sin,ct=Math.sqrt,pt=1e-12,dt=Math.PI,ft=dt/2,yt=2*dt;function xt(t){return t>=1?ft:t<=-1?-ft:Math.asin(t)}function _t(t){return t.innerRadius}function mt(t){return t.outerRadius}function gt(t){return t.startAngle}function vt(t){return t.endAngle}function bt(t){return t&&t.padAngle}function wt(t,e,n,r,i,o,a){var l=t-n,s=e-r,u=(a?o:-o)/ct(l*l+s*s),h=u*s,c=-u*l,p=t+h,d=e+c,f=n+h,y=r+c,x=(p+f)/2,_=(d+y)/2,m=f-p,g=y-d,v=m*m+g*g,b=i-o,w=p*y-f*d,T=(g<0?-1:1)*ct(st(0,b*b*v-w*w)),M=(w*g-m*T)/v,S=(-w*m-g*T)/v,z=(w*g+m*T)/v,k=(-w*m+g*T)/v,D=M-x,C=S-_,P=z-x,A=k-_;return D*D+C*C>P*P+A*A&&(M=z,S=k),{cx:M,cy:S,x01:-h,y01:-c,x11:M*(i/b-1),y11:S*(i/b-1)}}function Tt(){var t=_t,e=mt,n=it(0),r=null,i=gt,o=vt,a=bt,l=null;function s(){var s,u,h,c=+t.apply(this,arguments),p=+e.apply(this,arguments),d=i.apply(this,arguments)-ft,f=o.apply(this,arguments)-ft,y=ot(f-d),x=f>d;if(l||(l=s=rt()),p<c&&(u=p,p=c,c=u),p>pt)if(y>yt-pt)l.moveTo(p*lt(d),p*ht(d)),l.arc(0,0,p,d,f,!x),c>pt&&(l.moveTo(c*lt(f),c*ht(f)),l.arc(0,0,c,f,d,x));else{var _,m,g=d,v=f,b=d,w=f,T=y,M=y,S=a.apply(this,arguments)/2,z=S>pt&&(r?+r.apply(this,arguments):ct(c*c+p*p)),k=ut(ot(p-c)/2,+n.apply(this,arguments)),D=k,C=k;if(z>pt){var P=xt(z/c*ht(S)),A=xt(z/p*ht(S));(T-=2*P)>pt?(b+=P*=x?1:-1,w-=P):(T=0,b=w=(d+f)/2),(M-=2*A)>pt?(g+=A*=x?1:-1,v-=A):(M=0,g=v=(d+f)/2)}var I=p*lt(g),R=p*ht(g),L=c*lt(w),E=c*ht(w);if(k>pt){var B=p*lt(v),N=p*ht(v),O=c*lt(b),q=c*ht(b);if(y<dt){var V=T>pt?function(t,e,n,r,i,o,a,l){var s=n-t,u=r-e,h=a-i,c=l-o,p=(h*(e-o)-c*(t-i))/(c*s-h*u);return[t+p*s,e+p*u]}(I,R,O,q,B,N,L,E):[L,E],j=I-V[0],W=R-V[1],F=B-V[0],H=N-V[1],G=1/ht(((h=(j*F+W*H)/(ct(j*j+W*W)*ct(F*F+H*H)))>1?0:h<-1?dt:Math.acos(h))/2),U=ct(V[0]*V[0]+V[1]*V[1]);D=ut(k,(c-U)/(G-1)),C=ut(k,(p-U)/(G+1))}}M>pt?C>pt?(_=wt(O,q,I,R,p,C,x),m=wt(B,N,L,E,p,C,x),l.moveTo(_.cx+_.x01,_.cy+_.y01),C<k?l.arc(_.cx,_.cy,C,at(_.y01,_.x01),at(m.y01,m.x01),!x):(l.arc(_.cx,_.cy,C,at(_.y01,_.x01),at(_.y11,_.x11),!x),l.arc(0,0,p,at(_.cy+_.y11,_.cx+_.x11),at(m.cy+m.y11,m.cx+m.x11),!x),l.arc(m.cx,m.cy,C,at(m.y11,m.x11),at(m.y01,m.x01),!x))):(l.moveTo(I,R),l.arc(0,0,p,g,v,!x)):l.moveTo(I,R),c>pt&&T>pt?D>pt?(_=wt(L,E,B,N,c,-D,x),m=wt(I,R,O,q,c,-D,x),l.lineTo(_.cx+_.x01,_.cy+_.y01),D<k?l.arc(_.cx,_.cy,D,at(_.y01,_.x01),at(m.y01,m.x01),!x):(l.arc(_.cx,_.cy,D,at(_.y01,_.x01),at(_.y11,_.x11),!x),l.arc(0,0,c,at(_.cy+_.y11,_.cx+_.x11),at(m.cy+m.y11,m.cx+m.x11),x),l.arc(m.cx,m.cy,D,at(m.y11,m.x11),at(m.y01,m.x01),!x))):l.arc(0,0,c,w,b,x):l.lineTo(L,E)}else l.moveTo(0,0);if(l.closePath(),s)return l=null,s+""||null}return s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-dt/2;return[lt(r)*n,ht(r)*n]},s.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:it(+e),s):t},s.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:it(+t),s):e},s.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:it(+t),s):n},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:it(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:it(+t),s):i},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:it(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:it(+t),s):a},s.context=function(t){return arguments.length?(l=null==t?null:t,s):l},s}function Mt(t){return t<0?-1:1}function St(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),l=(o*i+a*r)/(r+i);return(Mt(o)+Mt(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(l))||0}function zt(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function kt(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,l=(o-r)/3;t._context.bezierCurveTo(r+l,i+l*e,o-l,a-l*n,o,a)}function Dt(t){this._context=t}function Ct(t){this._context=t}Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:kt(this,this._t0,zt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,kt(this,zt(this,n=St(this,t,e)),n);break;default:kt(this,this._t0,n=St(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(function(t){this._context=new Ct(t)}.prototype=Object.create(Dt.prototype)).point=function(t,e){Dt.prototype.point.call(this,e,t)},Ct.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};Z(".tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}");var Pt=function(t){function r(){var n=t.call(this)||this;return e.ITree.call(n),n}return i(r,t),r.prototype.data=function(t){var e=n.SVGWidget.prototype.data.apply(this,arguments);return arguments.length&&(this._resetRoot=!0),e},r.prototype.enter=function(t,e){var r=this;this.radius=Math.min(this.width(),this.height())/2,this._xScale=n.scaleLinear().range([0,2*Math.PI]),this._yScale=n.scaleSqrt().range([0,this.radius]),this.partition=I(),this.arc=Tt().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x1)))}).innerRadius(function(t){return Math.max(0,r._yScale(t.y0))}).outerRadius(function(t){return Math.max(0,r._yScale(t.y1))}),this.svg=e.append("g")},r.prototype.update=function(t,e){var r=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]);var i=h(this.data()).sum(function(t){return void 0!==t.size?t.size:1}),o=this.svg.selectAll("path").data(this.partition(i).descendants(),function(t,e){return void 0!==t.data.label?t.data.label:e});o.enter().append("path").on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){n.event&&n.event.stopPropagation(),r.zoomTo(t)}).each(function(){n.select(this).append("title")}).merge(o).attr("d",this.arc).style("fill",function(t){return t.data.__viz_fill?t.data.__viz_fill:r._palette(t.data.label)}).style("stroke",function(t){return t.value>16?"white":"none"}).select("title").text(function(t){return t.data.label}),o.exit().remove(),this._resetRoot&&(this._resetRoot=!1,this.zoomTo(i))},r.prototype.zoomTo=function(t){var e=this;this.svg.transition().duration(750).tween("scale",function(){var r=n.interpolate(e._xScale.domain(),[t.x0,t.x1]),i=n.interpolate(e._yScale.domain(),[t.y0,1]),o=n.interpolate(e._yScale.range(),[t.y0?20:0,e.radius]);return function(t){e._xScale.domain(r(t)),e._yScale.domain(i(t)).range(o(t))}}).selectAll("path").attrTween("d",function(t){return function(){return e.arc(t)}})},r}(n.SVGWidget);Pt.prototype._class+=" tree_SunburstPartition",Pt.prototype.implements(e.ITree.prototype),Pt.prototype.publish("paletteID","default","set","Color palette for this widget",Pt.prototype._palette.switch(),{tags:["Basic","Shared"]}),Pt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});Z(".tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{border:1px solid #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}");var At=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);At.prototype._class+=" tree_Dendrogram.TreemapColumn",At.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var It=function(t){function r(){var r=t.call(this)||this;return e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r}return i(r,t),r.prototype.getTilingMethod=function(){switch(this.tilingMethod()){case"treemapBinary":return H;case"treemapDice":return A;case"treemapSlice":return V;case"treemapSliceDice":return G;case"treemapResquarify":return U;case"treemapSquarify":default:return F}},r.prototype.treemapData=function(){return this.mappings().filter(function(t){return t.valid()}).length?function t(e){if(e.values instanceof Array){var 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}}({key:"root",values:this._db.aggregateView(this.mappings().map(function(t){return t.column()}),this.aggrType(),this.aggrColumn()).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._d3Treemap=function(){var t=F,e=!1,n=1,r=1,i=[0],o=T,a=T,l=T,s=T,u=T;function h(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(c),i=[0],e&&t.eachBefore(P),t}function c(e){var n=i[e.depth],r=e.x0+n,h=e.y0+n,c=e.x1-n,p=e.y1-n;c<r&&(r=c=(r+c)/2),p<h&&(h=p=(h+p)/2),e.x0=r,e.y0=h,e.x1=c,e.y1=p,e.children&&(n=i[e.depth+1]=o(e)/2,r+=u(e)-n,h+=a(e)-n,(c-=l(e)-n)<r&&(r=c=(r+c)/2),(p-=s(e)-n)<h&&(h=p=(h+p)/2),t(e,r,h,c,p))}return h.round=function(t){return arguments.length?(e=!!t,h):e},h.size=function(t){return arguments.length?(n=+t[0],r=+t[1],h):[n,r]},h.tile=function(e){return arguments.length?(t=w(e),h):t},h.padding=function(t){return arguments.length?h.paddingInner(t).paddingOuter(t):h.paddingInner()},h.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:M(+t),h):o},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?(a="function"==typeof t?t:M(+t),h):a},h.paddingRight=function(t){return arguments.length?(l="function"==typeof t?t:M(+t),h):l},h.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:M(+t),h):s},h.paddingLeft=function(t){return arguments.length?(u="function"==typeof t?t:M(+t),h):u},h}(),this._elementDIV=n.append("div"),this._selection.widgetElement(this._elementDIV)},r.prototype.update=function(e,r){t.prototype.update.call(this,e,r);var i=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var o=h(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);var a=this._elementDIV.selectAll(".node").data(o.descendants());a.enter().append("div").attr("class","node").call(this._selection.enter.bind(this._selection)).on("click",function(t){if(t&&t.origRows){var e="";i.mappings().forEach(function(t){t.column()&&(e=t.column())}),i.click(i.rowToObj(t.origRows[0]),e,i._selection.selected(this))}}).on("dblclick",function(t){if(t&&t.origRows){var e="";i.mappings().forEach(function(t){t.column()&&(e=t.column())}),i.dblclick(i.rowToObj(t.origRows[0]),e,i._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?i.parentFontSize():i.leafFontSize())+"px"}).style("line-height",function(t){return(t.children?i.parentFontSize():i.leafFontSize())+"px"}).attr("title",function(t){if(t.children&&!i.enableParentTooltips())return null;var e=t.data.label+" ("+t.value+")";for(;t.parent&&t.parent.parent;)e=t.parent.data.label+" -> "+e,t=t.parent;return e}).html(function(t){return i.showRoot()||0!==t.depth?t.children?i.enableParentLabels()?i.parentWeightHTML(t):null:i.leafWeightHTML(t):null}).style("background",function(t){if(!i.showRoot()&&0===t.depth)return this.style.color="transparent","transparent";var e,r=i.brighterLeafNodes()?"brighter":"darker";return i.usePaletteOnParentNodes()?e=t.children?i._palette(t.data.label):n.rgb(i._palette(t.parent.data.label))[r](1):(e=t.depth>i.depthColorLimit()?n.rgb(t.parent.color)[r](1):i._palette(t.data.label),t.color=e),this.style.color=n.Palette.textColor(e),e}).transition().duration(this.transitionDuration()).style("pointer-events",function(t){return i.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=i.showRoot()?"":"transparent",this.style.borderColor=i.showRoot()?"":"transparent")}),a.exit().transition().duration(this.transitionDuration()).style("opacity",0).remove()},r.prototype.exit=function(e,n){t.prototype.exit.call(this,e,n)},r.prototype.nodeWeight=function(t){return t.size||1},r.prototype.parentWeightHTML=function(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>"},r.prototype.leafWeightHTML=function(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>"},r}(n.HTMLWidget);It.prototype._class+=" tree_Treemap",It.prototype.implements(e.ITree.prototype),It.prototype.mixin(n.Utility.SimpleSelectionMixin),It.prototype.Column=At,It.prototype.publish("paletteID","default","set","Color palette for this widget",It.prototype._palette.switch(),{tags:["Basic","Shared"]}),It.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),It.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:At}),It.prototype.publish("aggrType",null,"set","Aggregation Type",[null,"mean","median","sum","min","max"],{optional:!0}),It.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:function(t){return!t.aggrType()}}),It.prototype.publish("fontSize",null,"number","Font Size",null,{optional:!0}),It.prototype.publish("paddingInner",18.6,"number","Pixel spacing between each sibling node"),It.prototype.publish("paddingOuter",30,"number","Pixel padding of parent nodes"),It.prototype.publish("paddingTop",41.4,"number","Additional top pixel padding of parent nodes"),It.prototype.publish("showRoot",!1,"boolean","Show root element"),It.prototype.publish("parentFontSize",18,"number","Parent font-size"),It.prototype.publish("leafFontSize",16,"number","Leaf font-size"),It.prototype.publish("usePaletteOnParentNodes",!1,"boolean","Assign a color from the palette to every parent node"),It.prototype.publish("depthColorLimit",1,"number","Assign a color from the palette to node with depth lower than this value",null,{optional:!0,disable:function(t){return t.usePaletteOnParentNodes()}}),It.prototype.publish("squarifyRatio",1,"number","Specifies the desired aspect ratio of the generated rectangles (must be >= 1)",null,{optional:!0,disable:function(t){return-1===["treemapSquarify","treemapResquarify"].indexOf(t.tilingMethod())}}),It.prototype.publish("showParentWeight",!0,"boolean","Show weight of parent nodes"),It.prototype.publish("showLeafWeight",!0,"boolean","Show weight of leaf nodes"),It.prototype.publish("weightSuffix","","string","Weight suffix (ex: 'ms')"),It.prototype.publish("brighterLeafNodes",!1,"boolean","Brighter/darker leaf node color (false = darker)"),It.prototype.publish("enableParentLabels",!0,"boolean","Enable parent labels"),It.prototype.publish("enableParentTooltips",!0,"boolean","Enable parent tooltips"),It.prototype.publish("transitionDuration",250,"number","Transition Duration"),It.prototype.publish("tilingMethod","treemapSquarify","set","Transition Duration",["treemapBinary","treemapDice","treemapResquarify","treemapSlice","treemapSliceDice","treemapSquarify"]),t.BUILD_VERSION="2.7.2",t.CirclePacking=K,t.Dendrogram=J,t.DendrogramColumn=Q,t.Indented=Y,t.IndentedColumn=X,t.PKG_NAME="@hpcc-js/tree",t.PKG_VERSION="2.7.11",t.SunburstPartition=Pt,t.Treemap=It,t.TreemapColumn=At,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common"],e):e((t=t||self)["@hpcc-js/tree"]={},t["@hpcc-js/api"],t["@hpcc-js/common"])}(this,function(t,e,n){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e){return t.parent===e.parent?1:2}function a(t,e){return t+e.x}function l(t,e){return Math.max(t,e.y)}function s(){var t=o,e=1,n=1,r=!1;function i(i){var o,s=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(a,0)/t.length}(n),e.y=function(t){return 1+t.reduce(l,0)}(n)):(e.x=o?s+=t(e,o):0,e.y=0,o=e)});var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),h=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=u.x-t(u,h)/2,p=h.x+t(h,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(p-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function u(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 h(t,e){var n,r,i,o,a,l=new f(t),s=+t.value&&(l.value=t.value),u=[l];for(null==e&&(e=c);n=u.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)u.push(r=n.children[o]=new f(i[o])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(d)}function c(t){return t.children}function p(t){t.data=t.data.data}function d(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function f(t){this.data=t,this.depth=this.height=0,this.parent=null}function y(t){this._=t,this.next=null}function x(t){return function t(e,n){var r,i,o,a=null,l=e.head;switch(n.length){case 1:s=n[0],r={x:s.x,y:s.y,r:s.r};break;case 2:r=function(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,l=e.r,s=o-n,u=a-r,h=l-i,c=Math.sqrt(s*s+u*u);return{x:(n+o+s/c*h)/2,y:(r+a+u/c*h)/2,r:(c+i+l)/2}}(n[0],n[1]);break;case 3:r=function(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,l=e.y,s=e.r,u=n.x,h=n.y,c=n.r,p=2*(r-a),d=2*(i-l),f=2*(s-o),y=r*r+i*i-o*o-a*a-l*l+s*s,x=2*(r-u),_=2*(i-h),m=2*(c-o),g=r*r+i*i-o*o-u*u-h*h+c*c,v=x*d-p*_,b=(d*g-_*y)/v-r,w=(_*f-d*m)/v,T=(x*y-p*g)/v-i,M=(p*m-x*f)/v,S=w*w+M*M-1,z=2*(b*w+T*M+o),k=b*b+T*T-o*o,D=(-z-Math.sqrt(z*z-4*S*k))/(2*S);return{x:b+w*D+r,y:T+M*D+i,r:D}}(n[0],n[1],n[2])}var s;for(;l;)o=l._,i=l.next,r&&_(r,o)?a=l:(a?(e.tail=a,a.next=null):e.head=e.tail=null,n.push(o),r=t(e,n),n.pop(),e.head?(l.next=e.head,e.head=l):(l.next=null,e.head=e.tail=l),(a=e.tail).next=i),l=i;e.tail=a;return r}(function(t){for(var e=(t=t.slice()).length,n=null,r=n;e;){var i=new y(t[e-1]);r=r?r.next=i:n=i,t[void 0]=t[--e]}return{head:n,tail:r}}(t),[])}function _(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r-e.r;return i*i+1e-6>n*n+r*r}function m(t,e,n){var r=t.x,i=t.y,o=e.r+n.r,a=t.r+n.r,l=e.x-r,s=e.y-i,u=l*l+s*s;if(u){var h=.5+((a*=a)-(o*=o))/(2*u),c=Math.sqrt(Math.max(0,2*o*(a+u)-(a-=u)*a-o*o))/(2*u);n.x=r+h*l+c*s,n.y=i+h*s-c*l}else n.x=r+a,n.y=i}function g(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return i*i-1e-6>n*n+r*r}function v(t,e,n){var r=t._,i=t.next._,o=r.r+i.r,a=(r.x*i.r+i.x*r.r)/o-e,l=(r.y*i.r+i.y*r.r)/o-n;return a*a+l*l}function b(t){this._=t,this.next=null,this.previous=null}function w(t){if("function"!=typeof t)throw new Error;return t}function T(){return 0}function M(t){return function(){return t}}function S(t){return Math.sqrt(t.value)}function z(){var t=null,e=1,n=1,r=T;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(k(t)).eachAfter(D(r,.5)).eachBefore(C(1)):i.eachBefore(k(S)).eachAfter(D(T,1)).eachAfter(D(r,i.r/Math.min(e,n))).eachBefore(C(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=null==(n=e)?null:w(n),i):t;var n},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:M(+t),i):r},i}function k(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function D(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=function(t){if(!(i=t.length))return 0;var e,n,r,i;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;m(n,e,r=t[2]);var o,a,l,s,u,h,c,p=e.r*e.r,d=n.r*n.r,f=r.r*r.r,y=p+d+f,_=p*e.x+d*n.x+f*r.x,w=p*e.y+d*n.y+f*r.y;e=new b(e),n=new b(n),r=new b(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(l=3;l<i;++l){m(e._,n._,r=t[l]),r=new b(r),s=n.next,u=e.previous,h=n._.r,c=e._.r;do{if(h<=c){if(g(s._,r._)){n=s,e.next=n,n.previous=e,--l;continue t}h+=s._.r,s=s.next}else{if(g(u._,r._)){(e=u).next=n,n.previous=e,--l;continue t}c+=u._.r,u=u.previous}}while(s!==u.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,y+=f=r._.r*r._.r,p=v(e,o=(_+=f*r._.x)/y,a=(w+=f*r._.y)/y);(r=r.next)!==n;)(f=v(r,o,a))<p&&(e=r,p=f);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=x(e),l=0;l<i;++l)(e=t[l]).x-=r.x,e.y-=r.y;return r.r}(r),l)for(i=0;i<a;++i)r[i].r-=l;n.r=o+l}}}function C(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 P(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 A(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,u=t.value&&(r-e)/t.value;++l<s;)(o=a[l]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*u}function I(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&A(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,l=r.y1-n;a<i&&(i=a=(i+a)/2),l<o&&(o=l=(o+l)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=l}}(e,o)),r&&i.eachBefore(P),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i}function R(t,e){return t.parent===e.parent?1:2}function L(t){var e=t.children;return e?e[0]:t.t}function E(t){var e=t.children;return e?e[e.length-1]:t.t}function B(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 N(t,e,n){return t.a.parent===e.parent?t.a:n}function O(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 q(){var t=R,e=1,n=1,r=null;function i(i){var s=function(t){for(var e,n,r,i,o,a=new O(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 O(r[i],i)),n.parent=e;return(a.parent=new O(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(l);else{var u=i,h=i,c=i;i.eachBefore(function(t){t.x<u.x&&(u=t),t.x>h.x&&(h=t),t.depth>c.depth&&(c=t)});var p=u===h?1:t(u,h)/2,d=p-u.x,f=e/(h.x+p+d),y=n/(c.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*f,t.y=t.depth*y})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(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)}(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=function(e,n,r){if(n){for(var i,o=e,a=e,l=n,s=o.parent.children[0],u=o.m,h=a.m,c=l.m,p=s.m;l=E(l),o=L(o),l&&o;)s=L(s),(a=E(a)).a=e,(i=l.z+c-o.z-u+t(l._,o._))>0&&(B(N(l,e,r),e,i),u+=i,h+=i),c+=l.m,u+=o.m,p+=s.m,h+=a.m;l&&!E(a)&&(a.t=l,a.m+=c-h),o&&!L(s)&&(s.t=o,s.m+=u-p,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function V(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,u=t.value&&(i-n)/t.value;++l<s;)(o=a[l]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*u}f.prototype=h.prototype={constructor:f,count:function(){return this.eachAfter(u)},each:function(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},eachAfter:function(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},eachBefore:function(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},sum:function(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})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(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}(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},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return h(this).eachBefore(p)}},O.prototype=Object.create(f.prototype);var j=(1+Math.sqrt(5))/2;function W(t,e,n,r,i,o){for(var a,l,s,u,h,c,p,d,f,y,x,_=[],m=e.children,g=0,v=0,b=m.length,w=e.value;g<b;){s=i-n,u=o-r;do{h=m[v++].value}while(!h&&v<b);for(c=p=h,x=h*h*(y=Math.max(u/s,s/u)/(w*t)),f=Math.max(p/x,x/c);v<b;++v){if(h+=l=m[v].value,l<c&&(c=l),l>p&&(p=l),x=h*h*y,(d=Math.max(p/x,x/c))>f){h-=l;break}f=d}_.push(a={value:h,dice:s<u,children:m.slice(g,v)}),a.dice?A(a,n,r,i,w?r+=u*h/w:o):V(a,n,r,w?n+=s*h/w:i,o),w-=h,g=v}return _}var F=function t(e){function n(t,n,r,i,o){W(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(j);function H(t,e,n,r,i){var o,a,l=t.children,s=l.length,u=new Array(s+1);for(u[0]=a=o=0;o<s;++o)u[o+1]=a+=l[o].value;!function t(e,n,r,i,o,a,s){if(e>=n-1){var h=l[e];return h.x0=i,h.y0=o,h.x1=a,void(h.y1=s)}var c=u[e],p=r/2+c,d=e+1,f=n-1;for(;d<f;){var y=d+f>>>1;u[y]<p?d=y+1:f=y}p-u[d-1]<u[d]-p&&e+1<d&&--d;var x=u[d]-c,_=r-x;if(a-i>s-o){var m=(i*_+a*x)/r;t(e,d,x,i,o,m,s),t(d,n,_,m,o,a,s)}else{var g=(o*_+s*x)/r;t(e,d,x,i,o,a,g),t(d,n,_,i,g,a,s)}}(0,s,t.value,e,n,r,i)}function G(t,e,n,r,i){(1&t.depth?V:A)(t,e,n,r,i)}var U=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,l,s,u,h,c=-1,p=a.length,d=t.value;++c<p;){for(s=(l=a[c]).children,u=l.value=0,h=s.length;u<h;++u)l.value+=s[u].value;l.dice?A(l,n,r,i,r+=(o-r)*l.value/d):V(l,n,r,n+=(i-n)*l.value/d,o),d-=l.value}else t._squarify=a=W(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(j);function Z(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}Z(".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}");var K=function(t){function r(){var n=t.call(this)||this;return e.ITree.call(n),n}return i(r,t),r.prototype.enter=function(t,e){this.diameter=Math.min(this.width(),this.height()),this.pack=z().size([this.diameter-4,this.diameter-4]).padding(1.5),this.svg=e.append("g")},r.prototype.update=function(t,e){var r=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();var i=h(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=i,this.pack(i),this.circle=this.svg.selectAll("circle").data(i.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=r.paletteDepthLevel_exists()&&t.depth>r.paletteDepthLevel()?n.rgb(t.parent.color)[r.paletteDepthVariant()](1):r._palette(t.data.label),t.color}).on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){this._focus!==t&&r.zoom(t),n.event.stopPropagation()}),this.circle.append("title").text(function(t){return t.data.label}),this.svg.selectAll("text").data(i.descendants()).enter().append("text").attr("class","label").style("fill-opacity",function(t){return t.parent===i?1:0}).style("display",function(t){return t.parent===i?null:"none"}).text(function(t){return t.data.label+(r.showSize()&&void 0!==t.data.size?" "+t.data.size:"")}),this._node=this.svg.selectAll("circle,text"),this.zoomTo([i.x,i.y,2*i.r])},r.prototype.zoom=function(t){this._focus=t;var e=this;function r(t){return t===e._focus&&!t.children||t.parent===e._focus}this.svg.transition().duration(n.event.altKey?7500:750).tween("zoom",function(){var t=n.interpolateZoom(e.view,[e._focus.x,e._focus.y,2*e._focus.r]);return function(n){e.zoomTo(t(n))}}).selectAll("text").filter(function(t){return r(t)||"inline"===this.style.display}).style("fill-opacity",function(t){return r(t)?1:0}).on("start",function(t){r(t)&&(this.style.display="inline")}).on("end",function(t){r(t)||(this.style.display="none")})},r.prototype.zoomTo=function(t){var 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})},r}(n.SVGWidget);K.prototype._class+=" tree_CirclePacking",K.prototype.implements(e.ITree.prototype),K.prototype.publish("showSize",!0,"boolean","Show size along with label"),K.prototype.publish("paletteDepthLevel",null,"number","If not null then beyond this depth number the child node colors are based on parent",null,{optional:!0}),K.prototype.publish("paletteDepthVariant","brighter","set","Determines paletteDepthLevel decendant color shade variant",["brighter","darker"],{disable:function(t){return t.paletteDepthLevel_exists()}}),K.prototype.publish("paletteID","default","set","Color palette for this widget",K.prototype._palette.switch(),{tags:["Basic","Shared"]}),K.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});Z(".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}");var Q=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);Q.prototype._class+=" tree_Dendrogram.DendrogramColumn",Q.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var J=function(t){function r(){var r=t.call(this)||this;return e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r._drawStartPos="origin",r._d3LayoutCluster=s(),r._d3LayoutTree=q(),r}return i(r,t),r.prototype.dendrogramData=function(){return 0===this.data().length?[]:this.mappings().filter(function(t){return t.valid()}).length?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}}({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._renderElement.attr("opacity",0).transition().duration(500).attr("opacity",1),this._selection.widgetElement(this._renderElement)},r.prototype.update=function(e,r){t.prototype.update.call(this,e,r);var i=this,o="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(function(t,e){return(t.parent===e.parent?1:2)/t.depth})):(this._d3Layout.nodeSize([14,this.separation()]),this._d3Layout.separation(function(t,e){return t.parent===e.parent?1:2}));var a=h(this.dendrogramData());this._d3Layout(a);var l=a.descendants(),s=a.descendants().slice(1);function u(t){return o?function(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}(t):function(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}(t)}function c(t,e){var n=(t-90)/180*Math.PI,r=e;return[r*Math.cos(n),r*Math.sin(n)]}function p(t){return"M"+c(t.x,t.y)+"C"+c(t.x,(t.y+t.parent.y)/2)+" "+c(t.parent.x,(t.y+t.parent.y)/2)+" "+c(t.parent.x,t.parent.y)}var d=this._renderCount?500:0,f=this._renderElement.selectAll(".link").data(s);f.enter().append("path").attr("class","link").attr("d",this.radial()?p:u),f.transition().duration(d).attr("d",this.radial()?p:u),f.exit().remove();var y=this.circleRadius()+2;function x(t){return i.radial()?"rotate("+(t.x-90)+")translate("+t.y+")":"horizontal"===i.orientation()?"translate("+t.y+","+t.x+")":"translate("+t.x+","+t.y+")"}var _=this._renderElement.selectAll(".node").data(l);_.transition().duration(d).attr("transform",x);var m=_.enter().append("g").attr("class","node").attr("transform",x).call(this._selection.enter.bind(this._selection)).on("click",function(t){for(var e=t;e.children;)e=e.children[0];t.depth>0&&i.click(i.rowToObj(e.origRows[0]),i.mappings()[t.depth-1].column(),!0)}).on("dblclick",function(t){for(var e=t;e.children;)e=e.children[0];t.depth>0&&i.dblclick(i.rowToObj(e.origRows[0]),i.mappings()[t.depth-1].column(),!0)}).each(function(){var t=n.select(this);t.append("circle"),t.append("text")});m.merge(_).select("circle").attr("r",this.circleRadius()).style("fill",function(t){return i._palette(t.data.label)}).append("title").text(function(t){return t.data.label}),m.merge(_).select("text").attr("dx",function(t){return i.radial()?t.children?t.x<180?-y:y:t.x<180?y:-y:o?t.children?y:-y:t.children?-y:y}).attr("dy","0.25em").style("text-anchor",function(t){return i.radial()?t.children?t.x<180?"end":"start":t.x<180?"start":"end":o?t.children?"start":"end":t.children?"end":"start"}).attr("transform",function(t){return i.radial()?t.x<180?null:"rotate(180)":o?"rotate(-66)":null}).text(function(t){return t.data.label}),_.exit().remove(),this._renderCount||i.zoomToFit()},r}(n.SVGZoomWidget);J.prototype._class+=" tree_Dendrogram",J.prototype.implements(e.ITree.prototype),J.prototype.mixin(n.Utility.SimpleSelectionMixin),J.prototype.Column=Q,J.prototype.publish("paletteID","default","set","Color palette for this widget",J.prototype._palette.switch(),{tags:["Basic","Shared"]}),J.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),J.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:Q}),J.prototype.publish("circleRadius",4.5,"number","Text offset from circle"),J.prototype.publish("separation",240,"number","Leaf Separation"),J.prototype.publish("dendrogram",!0,"boolean","Dendrogram"),J.prototype.publish("radial",!1,"boolean","Radial"),J.prototype.publish("orientation","horizontal","set","Orientation",["horizontal","vertical"],{tags:["Private"],disable:function(t){return t.radial()}});Z(".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}");var X=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);X.prototype._class+=" tree_Dendrogram.IndentedColumn",X.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var Y=function(t){function r(){var r=t.call(this)||this;return r._collapsed={},e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r._drawStartPos="origin",r._d3Tree=q(),r}return i(r,t),r.prototype.xmlToData=function(t,e){return void 0===e&&(e=""),DOMParser?function t(e,n){void 0===n&&(n="");var r={id:n,label:"",attributes:{},children:[]};r.label=e.nodeName;if(1===e.nodeType){if(e.attributes.length>0)for(var i=0;i<e.attributes.length;i++){var o=e.attributes.item(i);r.attributes[o.nodeName]=o.nodeValue}}else 3===e.nodeType&&(r.label=e.nodeValue);if(e.hasChildNodes())for(var a=0;a<e.childNodes.length;a++){var l=e.childNodes.item(a),s=t(l,n+"["+r.children.length+"]");r.children.push(s)}return r}((new DOMParser).parseFromString(t,"text/xml"),e).children[0]:[]},r.prototype.xml=function(t){return arguments.length?(this._xml=t,this.data(this.xmlToData(this._xml)),this):this._xml},r.prototype.IndentedData=function(){if(0===this.data().length)return[];if(this.xmlColumn_exists()){var 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}return this.mappings().filter(function(t){return t.valid()}).length?function t(e){if(e.values instanceof Array){var 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}}({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._svgLinks=this._renderElement.append("g"),this._svgNodes=this._renderElement.append("g"),this._selection.widgetElement(this._svgNodes)},r.prototype.update=function(e,r){var i=this;t.prototype.update.call(this,e,r);var o=this;this._d3Tree.nodeSize([0,this.barHeight()]);var a=this._db.dataChecksum();function l(t){return(t.parent?l(t.parent)+".":"")+t.data.label}this._prevDataChecksum!==a&&(this._treeData=this.IndentedData(),this._prevDataChecksum=a);var s=h(this.data()).sum(function(t){return t.size||50}).each(function(t){i._collapsed[l(t)]&&delete t.children}),u=this._d3Tree(s).descendants(),c=this._d3Tree(s).descendants().slice(1),p=0;s.eachBefore(function(t){t.x=p*o.barHeight(),++p});var d=this.barHeight()-4,f=this._renderCount?500:0,y=this._svgLinks.selectAll(".link").data(c,function(t){return l(t)});function x(t){return"M"+t.parent.y+","+t.parent.x+"V"+t.x+", H"+t.y}y.enter().append("path").attr("class","link").attr("d",x),y.transition().duration(f).attr("d",x),y.exit().remove();var _=this._svgNodes.selectAll(".node").data(u,function(t){return l(t)});_.transition().duration(f).attr("transform",function(t){return"translate("+t.y+","+t.x+")"});var m=_.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(){var t=n.select(this);t.append("rect").attr("height",d).attr("width",d).on("click",function(t){o._collapsed[l(t)]?delete o._collapsed[l(t)]:t.children&&(o._collapsed[l(t)]=!0),o.lazyRender()}),t.append("text")}).style("opacity",0);m.transition().style("opacity",1),m.merge(_).select("rect").attr("x",-d/2).attr("y",-d/2).style("fill",function(t){return o._collapsed[l(t)]?"#3182bd":t.children?"#c6dbef":"#fd8d3c"}),m.merge(_).select("text").attr("dx",d/2+4+"px").attr("dy","0.33em").text(function(t){return t.data.label}),_.exit().transition().style("opacity",0).remove(),this._renderCount||o.zoomToFit()},r}(n.SVGZoomWidget);Y.prototype._class+=" tree_Indented",Y.prototype.implements(e.ITree.prototype),Y.prototype.mixin(n.Utility.SimpleSelectionMixin),Y.prototype.Column=X,Y.prototype.publish("xmlColumn",null,"set","Field",function(){return this.columns()},{optional:!0}),Y.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:X,disable:function(t){return t.xmlColumn_exists()}}),Y.prototype.publish("barHeight",16,"number","Bar height");var $=Math.PI,tt=2*$,et=tt-1e-6;function nt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function rt(){return new nt}function it(t){return function(){return t}}nt.prototype=rt.prototype={constructor:nt,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo: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,u=o-t,h=a-e,c=u*u+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>1e-6)if(Math.abs(h*l-s*u)>1e-6&&i){var p=n-o,d=r-a,f=l*l+s*s,y=p*p+d*d,x=Math.sqrt(f),_=Math.sqrt(c),m=i*Math.tan(($-Math.acos((f+c-y)/(2*x*_)))/2),g=m/_,v=m/x;Math.abs(g-1)>1e-6&&(this._+="L"+(t+g*u)+","+(e+g*h)),this._+="A"+i+","+i+",0,0,"+ +(h*p>u*d)+","+(this._x1=t+v*l)+","+(this._y1=e+v*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,o){t=+t,e=+e;var a=(n=+n)*Math.cos(r),l=n*Math.sin(r),s=t+a,u=e+l,h=1^o,c=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+u:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+s+","+u),n&&(c<0&&(c=c%tt+tt),c>et?this._+="A"+n+","+n+",0,1,"+h+","+(t-a)+","+(e-l)+"A"+n+","+n+",0,1,"+h+","+(this._x1=s)+","+(this._y1=u):c>1e-6&&(this._+="A"+n+","+n+",0,"+ +(c>=$)+","+h+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var ot=Math.abs,at=Math.atan2,lt=Math.cos,st=Math.max,ut=Math.min,ht=Math.sin,ct=Math.sqrt,pt=1e-12,dt=Math.PI,ft=dt/2,yt=2*dt;function xt(t){return t>=1?ft:t<=-1?-ft:Math.asin(t)}function _t(t){return t.innerRadius}function mt(t){return t.outerRadius}function gt(t){return t.startAngle}function vt(t){return t.endAngle}function bt(t){return t&&t.padAngle}function wt(t,e,n,r,i,o,a){var l=t-n,s=e-r,u=(a?o:-o)/ct(l*l+s*s),h=u*s,c=-u*l,p=t+h,d=e+c,f=n+h,y=r+c,x=(p+f)/2,_=(d+y)/2,m=f-p,g=y-d,v=m*m+g*g,b=i-o,w=p*y-f*d,T=(g<0?-1:1)*ct(st(0,b*b*v-w*w)),M=(w*g-m*T)/v,S=(-w*m-g*T)/v,z=(w*g+m*T)/v,k=(-w*m+g*T)/v,D=M-x,C=S-_,P=z-x,A=k-_;return D*D+C*C>P*P+A*A&&(M=z,S=k),{cx:M,cy:S,x01:-h,y01:-c,x11:M*(i/b-1),y11:S*(i/b-1)}}function Tt(){var t=_t,e=mt,n=it(0),r=null,i=gt,o=vt,a=bt,l=null;function s(){var s,u,h,c=+t.apply(this,arguments),p=+e.apply(this,arguments),d=i.apply(this,arguments)-ft,f=o.apply(this,arguments)-ft,y=ot(f-d),x=f>d;if(l||(l=s=rt()),p<c&&(u=p,p=c,c=u),p>pt)if(y>yt-pt)l.moveTo(p*lt(d),p*ht(d)),l.arc(0,0,p,d,f,!x),c>pt&&(l.moveTo(c*lt(f),c*ht(f)),l.arc(0,0,c,f,d,x));else{var _,m,g=d,v=f,b=d,w=f,T=y,M=y,S=a.apply(this,arguments)/2,z=S>pt&&(r?+r.apply(this,arguments):ct(c*c+p*p)),k=ut(ot(p-c)/2,+n.apply(this,arguments)),D=k,C=k;if(z>pt){var P=xt(z/c*ht(S)),A=xt(z/p*ht(S));(T-=2*P)>pt?(b+=P*=x?1:-1,w-=P):(T=0,b=w=(d+f)/2),(M-=2*A)>pt?(g+=A*=x?1:-1,v-=A):(M=0,g=v=(d+f)/2)}var I=p*lt(g),R=p*ht(g),L=c*lt(w),E=c*ht(w);if(k>pt){var B=p*lt(v),N=p*ht(v),O=c*lt(b),q=c*ht(b);if(y<dt){var V=T>pt?function(t,e,n,r,i,o,a,l){var s=n-t,u=r-e,h=a-i,c=l-o,p=(h*(e-o)-c*(t-i))/(c*s-h*u);return[t+p*s,e+p*u]}(I,R,O,q,B,N,L,E):[L,E],j=I-V[0],W=R-V[1],F=B-V[0],H=N-V[1],G=1/ht(((h=(j*F+W*H)/(ct(j*j+W*W)*ct(F*F+H*H)))>1?0:h<-1?dt:Math.acos(h))/2),U=ct(V[0]*V[0]+V[1]*V[1]);D=ut(k,(c-U)/(G-1)),C=ut(k,(p-U)/(G+1))}}M>pt?C>pt?(_=wt(O,q,I,R,p,C,x),m=wt(B,N,L,E,p,C,x),l.moveTo(_.cx+_.x01,_.cy+_.y01),C<k?l.arc(_.cx,_.cy,C,at(_.y01,_.x01),at(m.y01,m.x01),!x):(l.arc(_.cx,_.cy,C,at(_.y01,_.x01),at(_.y11,_.x11),!x),l.arc(0,0,p,at(_.cy+_.y11,_.cx+_.x11),at(m.cy+m.y11,m.cx+m.x11),!x),l.arc(m.cx,m.cy,C,at(m.y11,m.x11),at(m.y01,m.x01),!x))):(l.moveTo(I,R),l.arc(0,0,p,g,v,!x)):l.moveTo(I,R),c>pt&&T>pt?D>pt?(_=wt(L,E,B,N,c,-D,x),m=wt(I,R,O,q,c,-D,x),l.lineTo(_.cx+_.x01,_.cy+_.y01),D<k?l.arc(_.cx,_.cy,D,at(_.y01,_.x01),at(m.y01,m.x01),!x):(l.arc(_.cx,_.cy,D,at(_.y01,_.x01),at(_.y11,_.x11),!x),l.arc(0,0,c,at(_.cy+_.y11,_.cx+_.x11),at(m.cy+m.y11,m.cx+m.x11),x),l.arc(m.cx,m.cy,D,at(m.y11,m.x11),at(m.y01,m.x01),!x))):l.arc(0,0,c,w,b,x):l.lineTo(L,E)}else l.moveTo(0,0);if(l.closePath(),s)return l=null,s+""||null}return s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-dt/2;return[lt(r)*n,ht(r)*n]},s.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:it(+e),s):t},s.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:it(+t),s):e},s.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:it(+t),s):n},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:it(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:it(+t),s):i},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:it(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:it(+t),s):a},s.context=function(t){return arguments.length?(l=null==t?null:t,s):l},s}function Mt(t){return t<0?-1:1}function St(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),l=(o*i+a*r)/(r+i);return(Mt(o)+Mt(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(l))||0}function zt(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function kt(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,l=(o-r)/3;t._context.bezierCurveTo(r+l,i+l*e,o-l,a-l*n,o,a)}function Dt(t){this._context=t}function Ct(t){this._context=t}Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:kt(this,this._t0,zt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,kt(this,zt(this,n=St(this,t,e)),n);break;default:kt(this,this._t0,n=St(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(function(t){this._context=new Ct(t)}.prototype=Object.create(Dt.prototype)).point=function(t,e){Dt.prototype.point.call(this,e,t)},Ct.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};Z(".tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}");var Pt=function(t){function r(){var n=t.call(this)||this;return e.ITree.call(n),n}return i(r,t),r.prototype.data=function(t){var e=n.SVGWidget.prototype.data.apply(this,arguments);return arguments.length&&(this._resetRoot=!0),e},r.prototype.enter=function(t,e){var r=this;this.radius=Math.min(this.width(),this.height())/2,this._xScale=n.scaleLinear().range([0,2*Math.PI]),this._yScale=n.scaleSqrt().range([0,this.radius]),this.partition=I(),this.arc=Tt().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x1)))}).innerRadius(function(t){return Math.max(0,r._yScale(t.y0))}).outerRadius(function(t){return Math.max(0,r._yScale(t.y1))}),this.svg=e.append("g")},r.prototype.update=function(t,e){var r=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]);var i=h(this.data()).sum(function(t){return void 0!==t.size?t.size:1}),o=this.svg.selectAll("path").data(this.partition(i).descendants(),function(t,e){return void 0!==t.data.label?t.data.label:e});o.enter().append("path").on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){n.event&&n.event.stopPropagation(),r.zoomTo(t)}).each(function(){n.select(this).append("title")}).merge(o).attr("d",this.arc).style("fill",function(t){return t.data.__viz_fill?t.data.__viz_fill:r._palette(t.data.label)}).style("stroke",function(t){return t.value>16?"white":"none"}).select("title").text(function(t){return t.data.label}),o.exit().remove(),this._resetRoot&&(this._resetRoot=!1,this.zoomTo(i))},r.prototype.zoomTo=function(t){var e=this;this.svg.transition().duration(750).tween("scale",function(){var r=n.interpolate(e._xScale.domain(),[t.x0,t.x1]),i=n.interpolate(e._yScale.domain(),[t.y0,1]),o=n.interpolate(e._yScale.range(),[t.y0?20:0,e.radius]);return function(t){e._xScale.domain(r(t)),e._yScale.domain(i(t)).range(o(t))}}).selectAll("path").attrTween("d",function(t){return function(){return e.arc(t)}})},r}(n.SVGWidget);Pt.prototype._class+=" tree_SunburstPartition",Pt.prototype.implements(e.ITree.prototype),Pt.prototype.publish("paletteID","default","set","Color palette for this widget",Pt.prototype._palette.switch(),{tags:["Basic","Shared"]}),Pt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});Z(".tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{border:1px solid #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}");var At=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.owner=function(t){return arguments.length?(this._owner=t,this):this._owner},e.prototype.valid=function(){return!!this.column()},e}(n.PropertyExt);At.prototype._class+=" tree_Dendrogram.TreemapColumn",At.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});var It=function(t){function r(){var r=t.call(this)||this;return e.ITree.call(r),n.Utility.SimpleSelectionMixin.call(r),r}return i(r,t),r.prototype.getTilingMethod=function(){switch(this.tilingMethod()){case"treemapBinary":return H;case"treemapDice":return A;case"treemapSlice":return V;case"treemapSliceDice":return G;case"treemapResquarify":return U;case"treemapSquarify":default:return F}},r.prototype.treemapData=function(){return this.mappings().filter(function(t){return t.valid()}).length?function t(e){if(e.values instanceof Array){var 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}}({key:"root",values:this._db.aggregateView(this.mappings().map(function(t){return t.column()}),this.aggrType(),this.aggrColumn()).entries()}):this.data()},r.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._d3Treemap=function(){var t=F,e=!1,n=1,r=1,i=[0],o=T,a=T,l=T,s=T,u=T;function h(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(c),i=[0],e&&t.eachBefore(P),t}function c(e){var n=i[e.depth],r=e.x0+n,h=e.y0+n,c=e.x1-n,p=e.y1-n;c<r&&(r=c=(r+c)/2),p<h&&(h=p=(h+p)/2),e.x0=r,e.y0=h,e.x1=c,e.y1=p,e.children&&(n=i[e.depth+1]=o(e)/2,r+=u(e)-n,h+=a(e)-n,(c-=l(e)-n)<r&&(r=c=(r+c)/2),(p-=s(e)-n)<h&&(h=p=(h+p)/2),t(e,r,h,c,p))}return h.round=function(t){return arguments.length?(e=!!t,h):e},h.size=function(t){return arguments.length?(n=+t[0],r=+t[1],h):[n,r]},h.tile=function(e){return arguments.length?(t=w(e),h):t},h.padding=function(t){return arguments.length?h.paddingInner(t).paddingOuter(t):h.paddingInner()},h.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:M(+t),h):o},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?(a="function"==typeof t?t:M(+t),h):a},h.paddingRight=function(t){return arguments.length?(l="function"==typeof t?t:M(+t),h):l},h.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:M(+t),h):s},h.paddingLeft=function(t){return arguments.length?(u="function"==typeof t?t:M(+t),h):u},h}(),this._elementDIV=n.append("div"),this._selection.widgetElement(this._elementDIV)},r.prototype.update=function(e,r){t.prototype.update.call(this,e,r);var i=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var o=h(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);var a=this._elementDIV.selectAll(".node").data(o.descendants());a.enter().append("div").attr("class","node").call(this._selection.enter.bind(this._selection)).on("click",function(t){if(t&&t.origRows){var e="";i.mappings().forEach(function(t){t.column()&&(e=t.column())}),i.click(i.rowToObj(t.origRows[0]),e,i._selection.selected(this))}}).on("dblclick",function(t){if(t&&t.origRows){var e="";i.mappings().forEach(function(t){t.column()&&(e=t.column())}),i.dblclick(i.rowToObj(t.origRows[0]),e,i._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?i.parentFontSize():i.leafFontSize())+"px"}).style("line-height",function(t){return(t.children?i.parentFontSize():i.leafFontSize())+"px"}).attr("title",function(t){if(t.children&&!i.enableParentTooltips())return null;var e=t.data.label+" ("+t.value+")";for(;t.parent&&t.parent.parent;)e=t.parent.data.label+" -> "+e,t=t.parent;return e}).html(function(t){return i.showRoot()||0!==t.depth?t.children?i.enableParentLabels()?i.parentWeightHTML(t):null:i.leafWeightHTML(t):null}).style("background",function(t){if(!i.showRoot()&&0===t.depth)return this.style.color="transparent","transparent";var e,r=i.brighterLeafNodes()?"brighter":"darker";return i.usePaletteOnParentNodes()?e=t.children?i._palette(t.data.label):n.rgb(i._palette(t.parent.data.label))[r](1):(e=t.depth>i.depthColorLimit()?n.rgb(t.parent.color)[r](1):i._palette(t.data.label),t.color=e),this.style.color=n.Palette.textColor(e),e}).transition().duration(this.transitionDuration()).style("pointer-events",function(t){return i.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=i.showRoot()?"":"transparent",this.style.borderColor=i.showRoot()?"":"transparent")}),a.exit().transition().duration(this.transitionDuration()).style("opacity",0).remove()},r.prototype.exit=function(e,n){t.prototype.exit.call(this,e,n)},r.prototype.nodeWeight=function(t){return t.size||1},r.prototype.parentWeightHTML=function(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>"},r.prototype.leafWeightHTML=function(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>"},r}(n.HTMLWidget);It.prototype._class+=" tree_Treemap",It.prototype.implements(e.ITree.prototype),It.prototype.mixin(n.Utility.SimpleSelectionMixin),It.prototype.Column=At,It.prototype.publish("paletteID","default","set","Color palette for this widget",It.prototype._palette.switch(),{tags:["Basic","Shared"]}),It.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),It.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:At}),It.prototype.publish("aggrType",null,"set","Aggregation Type",[null,"mean","median","sum","min","max"],{optional:!0}),It.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:function(t){return!t.aggrType()}}),It.prototype.publish("fontSize",null,"number","Font Size",null,{optional:!0}),It.prototype.publish("paddingInner",18.6,"number","Pixel spacing between each sibling node"),It.prototype.publish("paddingOuter",30,"number","Pixel padding of parent nodes"),It.prototype.publish("paddingTop",41.4,"number","Additional top pixel padding of parent nodes"),It.prototype.publish("showRoot",!1,"boolean","Show root element"),It.prototype.publish("parentFontSize",18,"number","Parent font-size"),It.prototype.publish("leafFontSize",16,"number","Leaf font-size"),It.prototype.publish("usePaletteOnParentNodes",!1,"boolean","Assign a color from the palette to every parent node"),It.prototype.publish("depthColorLimit",1,"number","Assign a color from the palette to node with depth lower than this value",null,{optional:!0,disable:function(t){return t.usePaletteOnParentNodes()}}),It.prototype.publish("squarifyRatio",1,"number","Specifies the desired aspect ratio of the generated rectangles (must be >= 1)",null,{optional:!0,disable:function(t){return-1===["treemapSquarify","treemapResquarify"].indexOf(t.tilingMethod())}}),It.prototype.publish("showParentWeight",!0,"boolean","Show weight of parent nodes"),It.prototype.publish("showLeafWeight",!0,"boolean","Show weight of leaf nodes"),It.prototype.publish("weightSuffix","","string","Weight suffix (ex: 'ms')"),It.prototype.publish("brighterLeafNodes",!1,"boolean","Brighter/darker leaf node color (false = darker)"),It.prototype.publish("enableParentLabels",!0,"boolean","Enable parent labels"),It.prototype.publish("enableParentTooltips",!0,"boolean","Enable parent tooltips"),It.prototype.publish("transitionDuration",250,"number","Transition Duration"),It.prototype.publish("tilingMethod","treemapSquarify","set","Transition Duration",["treemapBinary","treemapDice","treemapResquarify","treemapSlice","treemapSliceDice","treemapSquarify"]),t.BUILD_VERSION="2.7.4",t.CirclePacking=K,t.Dendrogram=J,t.DendrogramColumn=Q,t.Indented=Y,t.IndentedColumn=X,t.PKG_NAME="@hpcc-js/tree",t.PKG_VERSION="2.7.12",t.SunburstPartition=Pt,t.Treemap=It,t.TreemapColumn=At,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map
{
"name": "@hpcc-js/tree",
"version": "2.7.11",
"version": "2.7.12",
"description": "hpcc-js - Viz Tree",

@@ -29,7 +29,7 @@ "main": "dist/index.js",

"dependencies": {
"@hpcc-js/api": "^2.7.11",
"@hpcc-js/common": "^2.17.1"
"@hpcc-js/api": "^2.7.12",
"@hpcc-js/common": "^2.17.2"
},
"devDependencies": {
"@hpcc-js/bundle": "^2.10.2",
"@hpcc-js/bundle": "^2.10.3",
"@types/d3-transition": "1.1.4",

@@ -67,3 +67,3 @@ "d3-hierarchy": "1.1.4",

"homepage": "https://github.com/hpcc-systems/Visualization",
"gitHead": "4caa5e3f9f592996dd4b9094aef1d7adcacbb9cf"
"gitHead": "64014c6e5994e93c91793d9682a1105b0a40aa76"
}
export declare const PKG_NAME = "@hpcc-js/tree";
export declare const PKG_VERSION = "2.7.11";
export declare const BUILD_VERSION = "2.7.2";
export declare const PKG_VERSION = "2.7.12";
export declare const BUILD_VERSION = "2.7.4";
//# sourceMappingURL=__package__.d.ts.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc