d3plus-hierarchy
Advanced tools
Comparing version 0.8.8 to 0.8.9
/* | ||
d3plus-hierarchy v0.8.8 | ||
d3plus-hierarchy v0.8.9 | ||
Nested, hierarchical, and cluster charts built on D3 | ||
@@ -7,2 +7,2 @@ Copyright (c) 2019 D3plus - https://d3plus.org | ||
*/ | ||
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-shape"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3-collection"),require("d3-hierarchy"),require("d3-scale"),require("d3plus-format")):typeof define==="function"&&define.amd?define("d3plus-hierarchy",["exports","d3-array","d3-shape","d3plus-common","d3plus-shape","d3plus-viz","d3-collection","d3-hierarchy","d3-scale","d3plus-format"],e):(t=t||self,e(t.d3plus={},t.d3Array,t.d3Shape,t.d3plusCommon,t.d3plusShape,t.d3plusViz,t.d3Collection,t.d3Hierarchy,t.d3Scale,t.d3plusFormat))})(this,function(t,O,l,k,g,e,p,y,m,_){"use strict";function o(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function r(t,e,r){if(e)n(t.prototype,e);if(r)n(t,r);return t}function b(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function i(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:true,configurable:true}});if(e)a(t,e)}function w(t){w=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return w(t)}function a(t,e){a=Object.setPrototypeOf||function t(e,r){e.__proto__=r;return e};return a(t,e)}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function s(t,e){if(e&&(typeof e==="object"||typeof e==="function")){return e}return u(t)}function c(t,e){while(!Object.prototype.hasOwnProperty.call(t,e)){t=w(t);if(t===null)break}return t}function x(t,e,r){if(typeof Reflect!=="undefined"&&Reflect.get){x=Reflect.get}else{x=function t(e,r,n){var i=c(e,r);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,r);if(a.get){return a.get.call(n)}return a.value}}return x(t,e,r||t)}function f(t){return h(t)||v(t)||d()}function h(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function v(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var P=function(t){i(c,t);function c(){var n;o(this,c);n=s(this,w(c).call(this));n._shapeConfig=k.assign(n._shapeConfig,{ariaLabel:function t(e,r){return n._pieData?"".concat(++n._pieData[r].index,". ").concat(n._drawLabel(e,r),", ").concat(n._value(e,r),"."):""},Path:{labelConfig:{fontResize:true}}});n._innerRadius=0;n._legendSort=function(t,e){return n._value(e)-n._value(t)};n._padPixel=0;n._pie=l.pie();n._sort=function(t,e){return n._value(e)-n._value(t)};n._value=k.accessor("value");return n}r(c,[{key:"_draw",value:function t(e){var r=this;x(w(c.prototype),"_draw",this).call(this,e);var n=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right;var a=O.min([i,n])/2;var o=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/a).sort(this._sort).value(this._value)(this._filteredData);o.forEach(function(t,e){t.__d3plus__=true;t.i=e});var u=l.arc().innerRadius(this._innerRadius).outerRadius(a);var s="translate(".concat(i/2+this._margin.left,", ").concat(n/2+this._margin.top,")");this._shapes.push((new g.Path).data(o).d(u).select(k.elem("g.d3plus-Pie",{parent:this._select,enter:{transform:s},update:{transform:s}}).node()).config({id:function t(e){return r._ids(e).join("-")},x:0,y:0}).label(this._drawLabel).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Path")).render());return this}},{key:"innerRadius",value:function t(e){return arguments.length?(this._innerRadius=e,this):this._innerRadius}},{key:"padAngle",value:function t(e){return arguments.length?(this._padAngle=e,this):this._padAngle}},{key:"padPixel",value:function t(e){return arguments.length?(this._padPixel=e,this):this._padPixel}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"value",value:function t(e){return arguments.length?(this._value=typeof e==="function"?e:k.accessor(e),this):this._value}}]);return c}(e.Viz);var C=function(t){i(e,t);function e(){var t;o(this,e);t=s(this,w(e).call(this));t._innerRadius=function(){return O.min([t._width-t._margin.left-t._margin.right,t._height-t._margin.top-t._margin.bottom])/4};t._padPixel=2;return t}return e}(P);var j=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(t.values){t.values.forEach(function(t){r.push(t);e(t,r)})}else{r.push(t)}return r};var S=function(t){i(l,t);function l(){var a;o(this,l);a=s(this,w(l).call(this));a._layoutPadding=1;a._on.mouseenter=function(){};var e=a._on["mousemove.legend"];a._on["mousemove.legend"]=function(r,t){e(r,t);var n=a._ids(r,t);var i=j(r);a.hover(function(e){var t=Object.keys(e).filter(function(t){return t!=="value"}).every(function(t){return r[t]&&r[t].includes(e[t])});if(t)i.push(e);else if(n.includes(e.key))i.push.apply(i,f(j(e,[e])));return i.includes(e)})};var r=a._on["mousemove.shape"];a._on["mousemove.shape"]=function(e,t){if(e.__d3plusTooltip__)r(e,t);a.hover(function(t){return j(e,[e]).includes(t)})};a._pack=y.pack();a._packOpacity=k.constant(.25);a._shape=k.constant("Circle");a._shapeConfig=k.assign(a._shapeConfig,{Circle:{label:function t(e){return e.parent&&!e.children?e.id:false},labelConfig:{fontResize:true},opacity:function t(e){return e.__d3plusOpacity__}}});a._sort=function(t,e){return e.value-t.value};a._sum=k.accessor("value");return a}r(l,[{key:"_draw",value:function t(e){var r=this;x(w(l.prototype),"_draw",this).call(this,e);var n=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right;var a=Math.min(n,i);var o="translate(".concat((i-a)/2,", ").concat((n-a)/2,")");var u=p.nest();for(var s=0;s<=this._drawDepth;s++){u.key(this._groupBy[s])}u=u.entries(this._filteredData);var c=this._pack.padding(this._layoutPadding).size([a,a])(y.hierarchy({key:u.key,values:u},function(t){return t.values}).sum(this._sum).sort(this._sort)).descendants();c.forEach(function(t,e){t.__d3plus__=true;t.i=e;t.id=t.parent?t.parent.data.key:null;t.data.__d3plusOpacity__=t.height?r._packOpacity(t.data,e):1;t.data.__d3plusTooltip__=!t.height?true:false});this._shapes.push((new g.Circle).data(c).select(k.elem("g.d3plus-Pack",{parent:this._select,enter:{transform:o},update:{transform:o}}).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).render());return this}},{key:"hover",value:function t(e){this._hover=e;this._shapes.forEach(function(t){return t.hover(e)});if(this._legend)this._legendClass.hover(e);return this}},{key:"layoutPadding",value:function t(e){return arguments.length?(this._layoutPadding=e,this):this._layoutPadding}},{key:"packOpacity",value:function t(e){return arguments.length?(this._packOpacity=typeof e==="function"?e:k.constant(e),this):this._packOpacity}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"sum",value:function t(e){return arguments.length?(this._sum=typeof e==="function"?e:k.accessor(e),this):this._sum}}]);return l}(e.Viz);function E(t,e){if(!(e instanceof Array))e=[e];var r=p.nest();for(var n=0;n<e.length;n++){r.key(e[n])}var i=r.entries(t);return A(i)}function A(t){return t.map(function(t){if(t.key&&t.values){if(t.values[0].key==="undefined")return t.values[0].values[0];else t.values=A(t.values)}return t})}var T=function(t){i(_,t);function _(){var n;o(this,_);n=s(this,w(_).call(this));n._orient="vertical";n._separation=function(t,e){return t.parent===e.parent?1:2};n._shape=k.constant("Circle");n._shapeConfig=k.assign(n._shapeConfig,{ariaLabel:function t(e,r){return n._treeData?"".concat(n._treeData[r].depth,". ").concat(n._drawLabel(e,r),"."):""},labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:k.constant(5),width:k.constant(10),height:k.constant(10)});n._tree=y.tree();return n}r(_,[{key:"_draw",value:function t(e){var f=this;x(w(_.prototype),"_draw",this).call(this,e);var r=this._orient==="vertical"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right,o=this._orient==="vertical"?"left":"top",n=this,i="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),u=this._orient==="horizontal"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right;var a=this._treeData=this._tree.separation(this._separation).size([u,r])(y.hierarchy({key:"root",values:E(this._filteredData,this._groupBy.slice(0,this._drawDepth+1))},function(t){return t.key&&t.values?t.values:null}).sort(this._sort)).descendants().filter(function(t){return t.depth<=f._groupBy.length&&t.parent});function s(t){return k.merge(t.values.map(function(t){return t.key&&t.values?s(t):t}),n._aggs)}a.forEach(function(t,e){if(t.data.key&&t.data.values)t.data=s(t.data);t.__d3plus__=true;t.i=e});var c=this._shapeConfig.r;if(typeof c!=="function")c=k.constant(c);var l=O.max(a,function(t){return t.depth===1?c(t.data,t.i):0});var h=O.max(a,function(t){return t.children?0:c(t.data,t.i)});var v=O.extent(a,function(t){return t.y});this._labelHeight=O.min([this._orient==="vertical"?50:100,(v[1]-l-h)/(this._groupBy.length+1)]);this._labelWidths=E(a,function(t){return t.depth}).map(function(a){return a.values.reduce(function(t,e,r){var n=r<a.values.length-1?a.values[r+1].x:u+f._margin[o],i=r?a.values[r-1].x:f._margin[o];return O.min([t,n-e.x,e.x-i])},u)});var d=m.scaleLinear().domain(v).range([l+this._labelHeight,r-h-this._labelHeight]);a.forEach(function(t){var e=d(t.y);if(f._orient==="horizontal"){t.y=t.x;t.x=e}else t.y=e});var p={parent:this._select,enter:{transform:i},update:{transform:i}};this._shapes.push((new g.Path).data(a.filter(function(t){return t.depth>1})).select(k.elem("g.d3plus-Tree-Links",p).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Path")).config({d:function t(e){var r=f._shapeConfig.r;if(typeof r==="function")r=r(e.data,e.i);var n=e.parent.x-e.x+(f._orient==="vertical"?0:r),i=e.parent.y-e.y+(f._orient==="vertical"?r:0),a=f._orient==="vertical"?0:-r,o=f._orient==="vertical"?-r:0;return f._orient==="vertical"?"M".concat(a,",").concat(o,"C").concat(a,",").concat((o+i)/2," ").concat(n,",").concat((o+i)/2," ").concat(n,",").concat(i):"M".concat(a,",").concat(o,"C").concat((a+n)/2,",").concat(o," ").concat((a+n)/2,",").concat(i," ").concat(n,",").concat(i)},id:function t(e,r){return f._ids(e,r).join("-")}}).render());this._shapes.push((new g.Circle).data(a).select(k.elem("g.d3plus-Tree-Shapes",p).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).config({id:function t(e,r){return f._ids(e,r).join("-")},label:function t(e,r){if(f._label)return f._label(e.data,r);var n=f._ids(e,r).slice(0,e.depth);return n[n.length-1]},labelConfig:{textAnchor:function t(e){return f._orient==="vertical"?"middle":e.data.children&&e.data.depth!==f._groupBy.length?"end":"start"},verticalAlign:function t(e){return f._orient==="vertical"?e.data.depth===1?"bottom":"top":"middle"}},hitArea:function t(e,r,n){var i=f._labelHeight,a=f._labelWidths[e.depth-1];return{width:f._orient==="vertical"?a:n.r*2+a,height:f._orient==="horizontal"?i:n.r*2+i,x:f._orient==="vertical"?-a/2:e.children&&e.depth!==f._groupBy.length?-(n.r+a):-n.r,y:f._orient==="horizontal"?-i/2:e.children&&e.depth!==f._groupBy.length?-(n.r+f._labelHeight):-n.r}},labelBounds:function t(e,r,n){var i;var a=f._labelHeight,o=f._orient==="vertical"?"height":"width",u=f._labelWidths[e.depth-1],s=f._orient==="vertical"?"width":"height",c=f._orient==="vertical"?"x":"y",l=f._orient==="vertical"?"y":"x";return i={},b(i,s,u),b(i,o,a),b(i,c,-u/2),b(i,l,e.children&&e.depth!==f._groupBy.length?-(n.r+a):n.r),i}}).render());return this}},{key:"orient",value:function t(e){return arguments.length?(this._orient=e,this):this._orient}},{key:"separation",value:function t(e){return arguments.length?(this._separation=e,this):this._separation}}]);return _}(e.Viz);var D=function(t){i(d,t);function d(){var i;o(this,d);i=s(this,w(d).call(this));i._layoutPadding=1;i._legendSort=function(t,e){return i._sum(e)-i._sum(t)};i._legendTooltip=k.assign({},i._legendTooltip,{tbody:[]});i._shapeConfig=k.assign({},i._shapeConfig,{ariaLabel:function t(e,r){var n=i._rankData?"".concat(i._rankData.indexOf(e)+1,". "):"";return"".concat(n).concat(i._drawLabel(e,r),", ").concat(i._sum(e,r),".")},labelConfig:{fontMax:20,fontMin:8,fontResize:true,padding:5}});i._sort=function(t,e){var r=a(t);var n=a(e);return r&&!n?1:!r&&n?-1:e.value-t.value};i._sum=k.accessor("value");i._thresholdKey=i._sum;i._tile=y.treemapSquarify;i._tooltipConfig=k.assign({},i._tooltipConfig,{tbody:[["Share",function(t,e,r){return"".concat(_.formatAbbreviate(r.share*100,i._locale),"%")}]]});i._treemap=y.treemap().round(true);var a=function t(e){return e.children&&e.children.length===1&&e.children[0].data._isAggregation};return i}r(d,[{key:"_draw",value:function t(e){var r=this;x(w(d.prototype),"_draw",this).call(this,e);var n=p.nest();for(var i=0;i<=this._drawDepth;i++){n.key(this._groupBy[i])}n=n.entries(this._filteredData);var a=this._treemap.padding(this._layoutPadding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(y.hierarchy({values:n},function(t){return t.values}).sum(this._sum).sort(this._sort));var o=[],u=this;function s(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.depth<=u._drawDepth)s(r.children);else{var n=r.data.values.length===1?u._filteredData.indexOf(r.data.values[0]):undefined;r.__d3plus__=true;r.id=r.data.key;r.i=n>-1?n:undefined;r.data=k.merge(r.data.values);r.x=r.x0+(r.x1-r.x0)/2;r.y=r.y0+(r.y1-r.y0)/2;o.push(r)}}}if(a.children)s(a.children);this._rankData=o.sort(this._sort).map(function(t){return t.data});var c=a.value;o.forEach(function(t){t.share=r._sum(t.data,t.i)/c});var l="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");var f=k.configPrep.bind(this)(this._shapeConfig,"shape","Rect");var h=f.labelConfig.fontMin;var v=f.labelConfig.padding;this._shapes.push((new g.Rect).data(o).label(function(t){return[r._drawLabel(t.data,t.i),"".concat(_.formatAbbreviate(t.share*100,r._locale),"%")]}).select(k.elem("g.d3plus-Treemap",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).config({height:function t(e){return e.y1-e.y0},labelBounds:function t(e,r,n){var i=n.height;var a=Math.min(50,(i-v*2)*.5);if(a<h)a=0;return[{width:n.width,height:i-a,x:-n.width/2,y:-i/2},{width:n.width,height:a+v*2,x:-n.width/2,y:i/2-a-v*2}]},labelConfig:{textAnchor:function t(e,r,n){var i,a=n;while(typeof i==="undefined"&&a){if(typeof a.l!=="undefined")i=a.l;a=a.__d3plusParent__}return i?"middle":"start"},verticalAlign:function t(e,r,n){var i,a=n;while(typeof i==="undefined"&&a){if(typeof a.l!=="undefined")i=a.l;a=a.__d3plusParent__}return i?"bottom":"top"}},width:function t(e){return e.x1-e.x0}}).config(f).render());return this}},{key:"_thresholdFunction",value:function t(e,r){var _=this._aggs;var g=this._drawDepth;var y=this._groupBy;var m=this._threshold;var b=this._thresholdKey;if(m&&b){var n=e.slice();var i=O.sum(n,this._thresholdKey);var a=r.length;while(a--){var o=r[a];w(n,i,e,o,0)}return n}function w(t,e,r,n,i){if(i>=g)return;var a=y[i];var o=r.filter(function(t){return a(t)===n.key});if(i+1===g){var u=[];var s=Math.min(1,Math.max(0,m(o)));if(!isFinite(s)||isNaN(s))return;var c=s*e;var l=o.length;while(l--){var f=o[l];if(b(f)<c){var h=t.indexOf(f);t.splice(h,1);u.push(f)}}if(u.length>0){var v=k.merge(u,_);v._isAggregation=true;v._threshold=s;t.push(v)}}else{var d=n.values;var p=d.length;while(p--){w(t,e,o,d[p],i+1)}}}return e}},{key:"layoutPadding",value:function t(e){return arguments.length?(this._layoutPadding=typeof e==="function"?e:k.constant(e),this):this._layoutPadding}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"sum",value:function t(e){if(arguments.length){this._sum=typeof e==="function"?e:k.accessor(e);this._thresholdKey=this._sum;return this}else return this._sum}},{key:"tile",value:function t(e){return arguments.length?(this._tile=e,this):this._tile}}]);return d}(e.Viz);t.Donut=C;t.Pack=S;t.Pie=P;t.Tree=T;t.Treemap=D;Object.defineProperty(t,"__esModule",{value:true})});(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}var r="object";var n=function(t){return t&&t.Math==Math&&t};var f=n(typeof globalThis==r&&globalThis)||n(typeof window==r&&window)||n(typeof self==r&&self)||n(typeof t==r&&t)||Function("return this")();var i=function(t){try{return!!t()}catch(t){return true}};var v=!i(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7});var a={}.propertyIsEnumerable;var o=Object.getOwnPropertyDescriptor;var u=o&&!a.call({1:2},1);var s=u?function t(e){var r=o(this,e);return!!r&&r.enumerable}:a;var d={f:s};var c=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var l={}.toString;var h=function(t){return l.call(t).slice(8,-1)};var p="".split;var b=i(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return h(t)=="String"?p.call(t,""):Object(t)}:Object;var _=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var g=function(t){return b(_(t))};var y=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var m=function(t,e){if(!y(t))return t;var r,n;if(e&&typeof(r=t.toString)=="function"&&!y(n=r.call(t)))return n;if(typeof(r=t.valueOf)=="function"&&!y(n=r.call(t)))return n;if(!e&&typeof(r=t.toString)=="function"&&!y(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var w={}.hasOwnProperty;var O=function(t,e){return w.call(t,e)};var k=f.document;var x=y(k)&&y(k.createElement);var P=function(t){return x?k.createElement(t):{}};var C=!v&&!i(function(){return Object.defineProperty(P("div"),"a",{get:function(){return 7}}).a!=7});var j=Object.getOwnPropertyDescriptor;var S=v?j:function t(e,r){e=g(e);r=m(r,true);if(C)try{return j(e,r)}catch(t){}if(O(e,r))return c(!d.f.call(e,r),e[r])};var E={f:S};var A=function(t){if(!y(t)){throw TypeError(String(t)+" is not an object")}return t};var T=Object.defineProperty;var D=v?T:function t(e,r,n){A(e);r=m(r,true);A(n);if(C)try{return T(e,r,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[r]=n.value;return e};var M={f:D};var z=v?function(t,e,r){return M.f(t,e,c(1,r))}:function(t,e,r){t[e]=r;return t};var R=function(e,r){try{z(f,e,r)}catch(t){f[e]=r}return r};var L=e(function(t){var e="__core-js_shared__";var r=f[e]||R(e,{});(t.exports=function(t,e){return r[t]||(r[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})});var q=L("native-function-to-string",Function.toString);var B=f.WeakMap;var N=typeof B==="function"&&/native code/.test(q.call(B));var F=0;var H=Math.random();var V=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++F+H).toString(36)};var W=L("keys");var I=function(t){return W[t]||(W[t]=V(t))};var G={};var K=f.WeakMap;var Y,J,Q;var U=function(t){return Q(t)?J(t):Y(t,{})};var X=function(r){return function(t){var e;if(!y(t)||(e=J(t)).type!==r){throw TypeError("Incompatible receiver, "+r+" required")}return e}};if(N){var Z=new K;var $=Z.get;var tt=Z.has;var et=Z.set;Y=function(t,e){et.call(Z,t,e);return e};J=function(t){return $.call(Z,t)||{}};Q=function(t){return tt.call(Z,t)}}else{var rt=I("state");G[rt]=true;Y=function(t,e){z(t,rt,e);return e};J=function(t){return O(t,rt)?t[rt]:{}};Q=function(t){return O(t,rt)}}var nt={set:Y,get:J,has:Q,enforce:U,getterFor:X};var it=e(function(t){var e=nt.get;var u=nt.enforce;var s=String(q).split("toString");L("inspectSource",function(t){return q.call(t)});(t.exports=function(t,e,r,n){var i=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof r=="function"){if(typeof e=="string"&&!O(r,"name"))z(r,"name",e);u(r).source=s.join(typeof e=="string"?e:"")}if(t===f){if(a)t[e]=r;else R(e,r);return}else if(!i){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=r;else z(t,e,r)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||q.call(this)})});var at=f;var ot=function(t){return typeof t=="function"?t:undefined};var ut=function(t,e){return arguments.length<2?ot(at[t])||ot(f[t]):at[t]&&at[t][e]||f[t]&&f[t][e]};var st=Math.ceil;var ct=Math.floor;var lt=function(t){return isNaN(t=+t)?0:(t>0?ct:st)(t)};var ft=Math.min;var ht=function(t){return t>0?ft(lt(t),9007199254740991):0};var vt=Math.max;var dt=Math.min;var pt=function(t,e){var r=lt(t);return r<0?vt(r+e,0):dt(r,e)};var _t=function(u){return function(t,e,r){var n=g(t);var i=ht(n.length);var a=pt(r,i);var o;if(u&&e!=e)while(i>a){o=n[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in n)&&n[a]===e)return u||a||0}return!u&&-1}};var gt={includes:_t(true),indexOf:_t(false)};var yt=gt.indexOf;var mt=function(t,e){var r=g(t);var n=0;var i=[];var a;for(a in r)!O(G,a)&&O(r,a)&&i.push(a);while(e.length>n)if(O(r,a=e[n++])){~yt(i,a)||i.push(a)}return i};var bt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var wt=bt.concat("length","prototype");var Ot=Object.getOwnPropertyNames||function t(e){return mt(e,wt)};var kt={f:Ot};var xt=Object.getOwnPropertySymbols;var Pt={f:xt};var Ct=ut("Reflect","ownKeys")||function t(e){var r=kt.f(A(e));var n=Pt.f;return n?r.concat(n(e)):r};var jt=function(t,e){var r=Ct(e);var n=M.f;var i=E.f;for(var a=0;a<r.length;a++){var o=r[a];if(!O(t,o))n(t,o,i(e,o))}};var St=/#|\.prototype\./;var Et=function(t,e){var r=Tt[At(t)];return r==Mt?true:r==Dt?false:typeof e=="function"?i(e):!!e};var At=Et.normalize=function(t){return String(t).replace(St,".").toLowerCase()};var Tt=Et.data={};var Dt=Et.NATIVE="N";var Mt=Et.POLYFILL="P";var zt=Et;var Rt=E.f;var Lt=function(t,e){var r=t.target;var n=t.global;var i=t.stat;var a,o,u,s,c,l;if(n){o=f}else if(i){o=f[r]||R(r,{})}else{o=(f[r]||{}).prototype}if(o)for(u in e){c=e[u];if(t.noTargetGet){l=Rt(o,u);s=l&&l.value}else s=o[u];a=zt(n?u:r+(i?".":"#")+u,t.forced);if(!a&&s!==undefined){if(typeof c===typeof s)continue;jt(c,s)}if(t.sham||s&&s.sham){z(c,"sham",true)}it(o,u,c,t)}};var qt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var Bt=function(n,i,t){qt(n);if(i===undefined)return n;switch(t){case 0:return function(){return n.call(i)};case 1:return function(t){return n.call(i,t)};case 2:return function(t,e){return n.call(i,t,e)};case 3:return function(t,e,r){return n.call(i,t,e,r)}}return function(){return n.apply(i,arguments)}};var Nt=function(t){return Object(_(t))};var Ft=Array.isArray||function t(e){return h(e)=="Array"};var Ht=!!Object.getOwnPropertySymbols&&!i(function(){return!String(Symbol())});var Vt=f.Symbol;var Wt=L("wks");var It=function(t){return Wt[t]||(Wt[t]=Ht&&Vt[t]||(Ht?Vt:V)("Symbol."+t))};var Gt=It("species");var Kt=function(t,e){var r;if(Ft(t)){r=t.constructor;if(typeof r=="function"&&(r===Array||Ft(r.prototype)))r=undefined;else if(y(r)){r=r[Gt];if(r===null)r=undefined}}return new(r===undefined?Array:r)(e===0?0:e)};var Yt=[].push;var Jt=function(v){var d=v==1;var p=v==2;var _=v==3;var g=v==4;var y=v==6;var m=v==5||y;return function(t,e,r,n){var i=Nt(t);var a=b(i);var o=Bt(e,r,3);var u=ht(a.length);var s=0;var c=n||Kt;var l=d?c(t,u):p?c(t,0):undefined;var f,h;for(;u>s;s++)if(m||s in a){f=a[s];h=o(f,s,i);if(v){if(d)l[s]=h;else if(h)switch(v){case 3:return true;case 5:return f;case 6:return s;case 2:Yt.call(l,f)}else if(g)return false}}return y?-1:_||g?g:l}};var Qt={forEach:Jt(0),map:Jt(1),filter:Jt(2),some:Jt(3),every:Jt(4),find:Jt(5),findIndex:Jt(6)};var Ut=Object.keys||function t(e){return mt(e,bt)};var Xt=v?Object.defineProperties:function t(e,r){A(e);var n=Ut(r);var i=n.length;var a=0;var o;while(i>a)M.f(e,o=n[a++],r[o]);return e};var Zt=ut("document","documentElement");var $t=I("IE_PROTO");var te="prototype";var ee=function(){};var re=function(){var t=P("iframe");var e=bt.length;var r="<";var n="script";var i=">";var a="java"+n+":";var o;t.style.display="none";Zt.appendChild(t);t.src=String(a);o=t.contentWindow.document;o.open();o.write(r+n+i+"document.F=Object"+r+"/"+n+i);o.close();re=o.F;while(e--)delete re[te][bt[e]];return re()};var ne=Object.create||function t(e,r){var n;if(e!==null){ee[te]=A(e);n=new ee;ee[te]=null;n[$t]=e}else n=re();return r===undefined?n:Xt(n,r)};G[$t]=true;var ie=It("unscopables");var ae=Array.prototype;if(ae[ie]==undefined){z(ae,ie,ne(null))}var oe=function(t){ae[ie][t]=true};var ue=Qt.find;var se="find";var ce=true;if(se in[])Array(1)[se](function(){ce=false});Lt({target:"Array",proto:true,forced:ce},{find:function t(e){return ue(this,e,arguments.length>1?arguments[1]:undefined)}});oe(se);var le=gt.includes;Lt({target:"Array",proto:true},{includes:function t(e){return le(this,e,arguments.length>1?arguments[1]:undefined)}});oe("includes");var fe=Object.assign;var he=!fe||i(function(){var t={};var e={};var r=Symbol();var n="abcdefghijklmnopqrst";t[r]=7;n.split("").forEach(function(t){e[t]=t});return fe({},t)[r]!=7||Ut(fe({},e)).join("")!=n})?function t(e,r){var n=Nt(e);var i=arguments.length;var a=1;var o=Pt.f;var u=d.f;while(i>a){var s=b(arguments[a++]);var c=o?Ut(s).concat(o(s)):Ut(s);var l=c.length;var f=0;var h;while(l>f){h=c[f++];if(!v||u.call(s,h))n[h]=s[h]}}return n}:fe;Lt({target:"Object",stat:true,forced:Object.assign!==he},{assign:he});var ve=It("match");var de=function(t){var e;return y(t)&&((e=t[ve])!==undefined?!!e:h(t)=="RegExp")};var pe=function(t){if(de(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var _e=It("match");var ge=function(e){var r=/./;try{"/./"[e](r)}catch(t){try{r[_e]=false;return"/./"[e](r)}catch(t){}}return false};Lt({target:"String",proto:true,forced:!ge("includes")},{includes:function t(e){return!!~String(_(this)).indexOf(pe(e),arguments.length>1?arguments[1]:undefined)}});var ye="".startsWith;var me=Math.min;Lt({target:"String",proto:true,forced:!ge("startsWith")},{startsWith:function t(e){var r=String(_(this));pe(e);var n=ht(me(arguments.length>1?arguments[1]:undefined,r.length));var i=String(e);return ye?ye.call(r,i,n):r.slice(n,n+i.length)===i}});if(typeof window!=="undefined"){(function(){var n=function(t,e){var r=t.nodeType;if(r===3){e.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(r===1){e.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){e.push(">");[].forEach.call(t.childNodes,function(t){n(t,e)});e.push("</",t.tagName,">")}else{e.push("/>")}}else if(r==8){e.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var e=this.firstChild;while(e){n(e,t);e=e.nextSibling}return t.join("")},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var e=new DOMParser;e.async=false;var r="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=e.parseFromString(r,"text/xml").documentElement;var i=n.firstChild;while(i){this.appendChild(this.ownerDocument.importNode(i,true));i=i.nextSibling}}catch(t){}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}}); | ||
(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}var r="object";var n=function(t){return t&&t.Math==Math&&t};var f=n(typeof globalThis==r&&globalThis)||n(typeof window==r&&window)||n(typeof self==r&&self)||n(typeof t==r&&t)||Function("return this")();var i=function(t){try{return!!t()}catch(t){return true}};var v=!i(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7});var a={}.propertyIsEnumerable;var o=Object.getOwnPropertyDescriptor;var u=o&&!a.call({1:2},1);var s=u?function t(e){var r=o(this,e);return!!r&&r.enumerable}:a;var d={f:s};var c=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var l={}.toString;var h=function(t){return l.call(t).slice(8,-1)};var p="".split;var b=i(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return h(t)=="String"?p.call(t,""):Object(t)}:Object;var _=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var g=function(t){return b(_(t))};var y=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var m=function(t,e){if(!y(t))return t;var r,n;if(e&&typeof(r=t.toString)=="function"&&!y(n=r.call(t)))return n;if(typeof(r=t.valueOf)=="function"&&!y(n=r.call(t)))return n;if(!e&&typeof(r=t.toString)=="function"&&!y(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var w={}.hasOwnProperty;var O=function(t,e){return w.call(t,e)};var k=f.document;var x=y(k)&&y(k.createElement);var P=function(t){return x?k.createElement(t):{}};var C=!v&&!i(function(){return Object.defineProperty(P("div"),"a",{get:function(){return 7}}).a!=7});var j=Object.getOwnPropertyDescriptor;var S=v?j:function t(e,r){e=g(e);r=m(r,true);if(C)try{return j(e,r)}catch(t){}if(O(e,r))return c(!d.f.call(e,r),e[r])};var E={f:S};var A=function(t){if(!y(t)){throw TypeError(String(t)+" is not an object")}return t};var T=Object.defineProperty;var D=v?T:function t(e,r,n){A(e);r=m(r,true);A(n);if(C)try{return T(e,r,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[r]=n.value;return e};var M={f:D};var z=v?function(t,e,r){return M.f(t,e,c(1,r))}:function(t,e,r){t[e]=r;return t};var R=function(e,r){try{z(f,e,r)}catch(t){f[e]=r}return r};var L=e(function(t){var e="__core-js_shared__";var r=f[e]||R(e,{});(t.exports=function(t,e){return r[t]||(r[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.2.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})});var q=L("native-function-to-string",Function.toString);var B=f.WeakMap;var N=typeof B==="function"&&/native code/.test(q.call(B));var F=0;var H=Math.random();var V=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++F+H).toString(36)};var W=L("keys");var I=function(t){return W[t]||(W[t]=V(t))};var G={};var K=f.WeakMap;var Y,J,Q;var U=function(t){return Q(t)?J(t):Y(t,{})};var X=function(r){return function(t){var e;if(!y(t)||(e=J(t)).type!==r){throw TypeError("Incompatible receiver, "+r+" required")}return e}};if(N){var Z=new K;var $=Z.get;var tt=Z.has;var et=Z.set;Y=function(t,e){et.call(Z,t,e);return e};J=function(t){return $.call(Z,t)||{}};Q=function(t){return tt.call(Z,t)}}else{var rt=I("state");G[rt]=true;Y=function(t,e){z(t,rt,e);return e};J=function(t){return O(t,rt)?t[rt]:{}};Q=function(t){return O(t,rt)}}var nt={set:Y,get:J,has:Q,enforce:U,getterFor:X};var it=e(function(t){var e=nt.get;var u=nt.enforce;var s=String(q).split("toString");L("inspectSource",function(t){return q.call(t)});(t.exports=function(t,e,r,n){var i=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof r=="function"){if(typeof e=="string"&&!O(r,"name"))z(r,"name",e);u(r).source=s.join(typeof e=="string"?e:"")}if(t===f){if(a)t[e]=r;else R(e,r);return}else if(!i){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=r;else z(t,e,r)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||q.call(this)})});var at=f;var ot=function(t){return typeof t=="function"?t:undefined};var ut=function(t,e){return arguments.length<2?ot(at[t])||ot(f[t]):at[t]&&at[t][e]||f[t]&&f[t][e]};var st=Math.ceil;var ct=Math.floor;var lt=function(t){return isNaN(t=+t)?0:(t>0?ct:st)(t)};var ft=Math.min;var ht=function(t){return t>0?ft(lt(t),9007199254740991):0};var vt=Math.max;var dt=Math.min;var pt=function(t,e){var r=lt(t);return r<0?vt(r+e,0):dt(r,e)};var _t=function(u){return function(t,e,r){var n=g(t);var i=ht(n.length);var a=pt(r,i);var o;if(u&&e!=e)while(i>a){o=n[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in n)&&n[a]===e)return u||a||0}return!u&&-1}};var gt={includes:_t(true),indexOf:_t(false)};var yt=gt.indexOf;var mt=function(t,e){var r=g(t);var n=0;var i=[];var a;for(a in r)!O(G,a)&&O(r,a)&&i.push(a);while(e.length>n)if(O(r,a=e[n++])){~yt(i,a)||i.push(a)}return i};var bt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var wt=bt.concat("length","prototype");var Ot=Object.getOwnPropertyNames||function t(e){return mt(e,wt)};var kt={f:Ot};var xt=Object.getOwnPropertySymbols;var Pt={f:xt};var Ct=ut("Reflect","ownKeys")||function t(e){var r=kt.f(A(e));var n=Pt.f;return n?r.concat(n(e)):r};var jt=function(t,e){var r=Ct(e);var n=M.f;var i=E.f;for(var a=0;a<r.length;a++){var o=r[a];if(!O(t,o))n(t,o,i(e,o))}};var St=/#|\.prototype\./;var Et=function(t,e){var r=Tt[At(t)];return r==Mt?true:r==Dt?false:typeof e=="function"?i(e):!!e};var At=Et.normalize=function(t){return String(t).replace(St,".").toLowerCase()};var Tt=Et.data={};var Dt=Et.NATIVE="N";var Mt=Et.POLYFILL="P";var zt=Et;var Rt=E.f;var Lt=function(t,e){var r=t.target;var n=t.global;var i=t.stat;var a,o,u,s,c,l;if(n){o=f}else if(i){o=f[r]||R(r,{})}else{o=(f[r]||{}).prototype}if(o)for(u in e){c=e[u];if(t.noTargetGet){l=Rt(o,u);s=l&&l.value}else s=o[u];a=zt(n?u:r+(i?".":"#")+u,t.forced);if(!a&&s!==undefined){if(typeof c===typeof s)continue;jt(c,s)}if(t.sham||s&&s.sham){z(c,"sham",true)}it(o,u,c,t)}};var qt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var Bt=function(n,i,t){qt(n);if(i===undefined)return n;switch(t){case 0:return function(){return n.call(i)};case 1:return function(t){return n.call(i,t)};case 2:return function(t,e){return n.call(i,t,e)};case 3:return function(t,e,r){return n.call(i,t,e,r)}}return function(){return n.apply(i,arguments)}};var Nt=function(t){return Object(_(t))};var Ft=Array.isArray||function t(e){return h(e)=="Array"};var Ht=!!Object.getOwnPropertySymbols&&!i(function(){return!String(Symbol())});var Vt=f.Symbol;var Wt=L("wks");var It=function(t){return Wt[t]||(Wt[t]=Ht&&Vt[t]||(Ht?Vt:V)("Symbol."+t))};var Gt=It("species");var Kt=function(t,e){var r;if(Ft(t)){r=t.constructor;if(typeof r=="function"&&(r===Array||Ft(r.prototype)))r=undefined;else if(y(r)){r=r[Gt];if(r===null)r=undefined}}return new(r===undefined?Array:r)(e===0?0:e)};var Yt=[].push;var Jt=function(v){var d=v==1;var p=v==2;var _=v==3;var g=v==4;var y=v==6;var m=v==5||y;return function(t,e,r,n){var i=Nt(t);var a=b(i);var o=Bt(e,r,3);var u=ht(a.length);var s=0;var c=n||Kt;var l=d?c(t,u):p?c(t,0):undefined;var f,h;for(;u>s;s++)if(m||s in a){f=a[s];h=o(f,s,i);if(v){if(d)l[s]=h;else if(h)switch(v){case 3:return true;case 5:return f;case 6:return s;case 2:Yt.call(l,f)}else if(g)return false}}return y?-1:_||g?g:l}};var Qt={forEach:Jt(0),map:Jt(1),filter:Jt(2),some:Jt(3),every:Jt(4),find:Jt(5),findIndex:Jt(6)};var Ut=Object.keys||function t(e){return mt(e,bt)};var Xt=v?Object.defineProperties:function t(e,r){A(e);var n=Ut(r);var i=n.length;var a=0;var o;while(i>a)M.f(e,o=n[a++],r[o]);return e};var Zt=ut("document","documentElement");var $t=I("IE_PROTO");var te="prototype";var ee=function(){};var re=function(){var t=P("iframe");var e=bt.length;var r="<";var n="script";var i=">";var a="java"+n+":";var o;t.style.display="none";Zt.appendChild(t);t.src=String(a);o=t.contentWindow.document;o.open();o.write(r+n+i+"document.F=Object"+r+"/"+n+i);o.close();re=o.F;while(e--)delete re[te][bt[e]];return re()};var ne=Object.create||function t(e,r){var n;if(e!==null){ee[te]=A(e);n=new ee;ee[te]=null;n[$t]=e}else n=re();return r===undefined?n:Xt(n,r)};G[$t]=true;var ie=It("unscopables");var ae=Array.prototype;if(ae[ie]==undefined){z(ae,ie,ne(null))}var oe=function(t){ae[ie][t]=true};var ue=Qt.find;var se="find";var ce=true;if(se in[])Array(1)[se](function(){ce=false});Lt({target:"Array",proto:true,forced:ce},{find:function t(e){return ue(this,e,arguments.length>1?arguments[1]:undefined)}});oe(se);var le=gt.includes;Lt({target:"Array",proto:true},{includes:function t(e){return le(this,e,arguments.length>1?arguments[1]:undefined)}});oe("includes");var fe=Object.assign;var he=!fe||i(function(){var t={};var e={};var r=Symbol();var n="abcdefghijklmnopqrst";t[r]=7;n.split("").forEach(function(t){e[t]=t});return fe({},t)[r]!=7||Ut(fe({},e)).join("")!=n})?function t(e,r){var n=Nt(e);var i=arguments.length;var a=1;var o=Pt.f;var u=d.f;while(i>a){var s=b(arguments[a++]);var c=o?Ut(s).concat(o(s)):Ut(s);var l=c.length;var f=0;var h;while(l>f){h=c[f++];if(!v||u.call(s,h))n[h]=s[h]}}return n}:fe;Lt({target:"Object",stat:true,forced:Object.assign!==he},{assign:he});var ve=It("match");var de=function(t){var e;return y(t)&&((e=t[ve])!==undefined?!!e:h(t)=="RegExp")};var pe=function(t){if(de(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var _e=It("match");var ge=function(e){var r=/./;try{"/./"[e](r)}catch(t){try{r[_e]=false;return"/./"[e](r)}catch(t){}}return false};Lt({target:"String",proto:true,forced:!ge("includes")},{includes:function t(e){return!!~String(_(this)).indexOf(pe(e),arguments.length>1?arguments[1]:undefined)}});var ye="".startsWith;var me=Math.min;Lt({target:"String",proto:true,forced:!ge("startsWith")},{startsWith:function t(e){var r=String(_(this));pe(e);var n=ht(me(arguments.length>1?arguments[1]:undefined,r.length));var i=String(e);return ye?ye.call(r,i,n):r.slice(n,n+i.length)===i}});if(typeof window!=="undefined"){(function(){var n=function(t,e){var r=t.nodeType;if(r===3){e.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(r===1){e.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){e.push(">");[].forEach.call(t.childNodes,function(t){n(t,e)});e.push("</",t.tagName,">")}else{e.push("/>")}}else if(r==8){e.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var e=this.firstChild;while(e){n(e,t);e=e.nextSibling}return t.join("")},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var e=new DOMParser;e.async=false;var r="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=e.parseFromString(r,"text/xml").documentElement;var i=n.firstChild;while(i){this.appendChild(this.ownerDocument.importNode(i,true));i=i.nextSibling}}catch(t){}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}});(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-shape"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3-collection"),require("d3-hierarchy"),require("d3-scale"),require("d3plus-format")):typeof define==="function"&&define.amd?define("d3plus-hierarchy",["exports","d3-array","d3-shape","d3plus-common","d3plus-shape","d3plus-viz","d3-collection","d3-hierarchy","d3-scale","d3plus-format"],e):(t=t||self,e(t.d3plus={},t.d3Array,t.d3Shape,t.d3plusCommon,t.d3plusShape,t.d3plusViz,t.d3Collection,t.d3Hierarchy,t.d3Scale,t.d3plusFormat))})(this,function(t,O,l,k,g,e,p,y,m,_){"use strict";function o(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function r(t,e,r){if(e)n(t.prototype,e);if(r)n(t,r);return t}function b(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function i(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:true,configurable:true}});if(e)a(t,e)}function w(t){w=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return w(t)}function a(t,e){a=Object.setPrototypeOf||function t(e,r){e.__proto__=r;return e};return a(t,e)}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function s(t,e){if(e&&(typeof e==="object"||typeof e==="function")){return e}return u(t)}function c(t,e){while(!Object.prototype.hasOwnProperty.call(t,e)){t=w(t);if(t===null)break}return t}function x(t,e,r){if(typeof Reflect!=="undefined"&&Reflect.get){x=Reflect.get}else{x=function t(e,r,n){var i=c(e,r);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,r);if(a.get){return a.get.call(n)}return a.value}}return x(t,e,r||t)}function f(t){return h(t)||v(t)||d()}function h(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function v(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var P=function(t){i(c,t);function c(){var n;o(this,c);n=s(this,w(c).call(this));n._shapeConfig=k.assign(n._shapeConfig,{ariaLabel:function t(e,r){return n._pieData?"".concat(++n._pieData[r].index,". ").concat(n._drawLabel(e,r),", ").concat(n._value(e,r),"."):""},Path:{labelConfig:{fontResize:true}}});n._innerRadius=0;n._legendSort=function(t,e){return n._value(e)-n._value(t)};n._padPixel=0;n._pie=l.pie();n._sort=function(t,e){return n._value(e)-n._value(t)};n._value=k.accessor("value");return n}r(c,[{key:"_draw",value:function t(e){var r=this;x(w(c.prototype),"_draw",this).call(this,e);var n=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right;var a=O.min([i,n])/2;var o=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/a).sort(this._sort).value(this._value)(this._filteredData);o.forEach(function(t,e){t.__d3plus__=true;t.i=e});var u=l.arc().innerRadius(this._innerRadius).outerRadius(a);var s="translate(".concat(i/2+this._margin.left,", ").concat(n/2+this._margin.top,")");this._shapes.push((new g.Path).data(o).d(u).select(k.elem("g.d3plus-Pie",{parent:this._select,enter:{transform:s},update:{transform:s}}).node()).config({id:function t(e){return r._ids(e).join("-")},x:0,y:0}).label(this._drawLabel).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Path")).render());return this}},{key:"innerRadius",value:function t(e){return arguments.length?(this._innerRadius=e,this):this._innerRadius}},{key:"padAngle",value:function t(e){return arguments.length?(this._padAngle=e,this):this._padAngle}},{key:"padPixel",value:function t(e){return arguments.length?(this._padPixel=e,this):this._padPixel}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"value",value:function t(e){return arguments.length?(this._value=typeof e==="function"?e:k.accessor(e),this):this._value}}]);return c}(e.Viz);var C=function(t){i(e,t);function e(){var t;o(this,e);t=s(this,w(e).call(this));t._innerRadius=function(){return O.min([t._width-t._margin.left-t._margin.right,t._height-t._margin.top-t._margin.bottom])/4};t._padPixel=2;return t}return e}(P);var j=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(t.values){t.values.forEach(function(t){r.push(t);e(t,r)})}else{r.push(t)}return r};var S=function(t){i(l,t);function l(){var a;o(this,l);a=s(this,w(l).call(this));a._layoutPadding=1;a._on.mouseenter=function(){};var e=a._on["mousemove.legend"];a._on["mousemove.legend"]=function(r,t){e(r,t);var n=a._ids(r,t);var i=j(r);a.hover(function(e){var t=Object.keys(e).filter(function(t){return t!=="value"}).every(function(t){return r[t]&&r[t].includes(e[t])});if(t)i.push(e);else if(n.includes(e.key))i.push.apply(i,f(j(e,[e])));return i.includes(e)})};var r=a._on["mousemove.shape"];a._on["mousemove.shape"]=function(e,t){if(e.__d3plusTooltip__)r(e,t);a.hover(function(t){return j(e,[e]).includes(t)})};a._pack=y.pack();a._packOpacity=k.constant(.25);a._shape=k.constant("Circle");a._shapeConfig=k.assign(a._shapeConfig,{Circle:{label:function t(e){return e.parent&&!e.children?e.id:false},labelConfig:{fontResize:true},opacity:function t(e){return e.__d3plusOpacity__}}});a._sort=function(t,e){return e.value-t.value};a._sum=k.accessor("value");return a}r(l,[{key:"_draw",value:function t(e){var r=this;x(w(l.prototype),"_draw",this).call(this,e);var n=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right;var a=Math.min(n,i);var o="translate(".concat((i-a)/2,", ").concat((n-a)/2,")");var u=p.nest();for(var s=0;s<=this._drawDepth;s++){u.key(this._groupBy[s])}u=u.entries(this._filteredData);var c=this._pack.padding(this._layoutPadding).size([a,a])(y.hierarchy({key:u.key,values:u},function(t){return t.values}).sum(this._sum).sort(this._sort)).descendants();c.forEach(function(t,e){t.__d3plus__=true;t.i=e;t.id=t.parent?t.parent.data.key:null;t.data.__d3plusOpacity__=t.height?r._packOpacity(t.data,e):1;t.data.__d3plusTooltip__=!t.height?true:false});this._shapes.push((new g.Circle).data(c).select(k.elem("g.d3plus-Pack",{parent:this._select,enter:{transform:o},update:{transform:o}}).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).render());return this}},{key:"hover",value:function t(e){this._hover=e;this._shapes.forEach(function(t){return t.hover(e)});if(this._legend)this._legendClass.hover(e);return this}},{key:"layoutPadding",value:function t(e){return arguments.length?(this._layoutPadding=e,this):this._layoutPadding}},{key:"packOpacity",value:function t(e){return arguments.length?(this._packOpacity=typeof e==="function"?e:k.constant(e),this):this._packOpacity}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"sum",value:function t(e){return arguments.length?(this._sum=typeof e==="function"?e:k.accessor(e),this):this._sum}}]);return l}(e.Viz);function E(t,e){if(!(e instanceof Array))e=[e];var r=p.nest();for(var n=0;n<e.length;n++){r.key(e[n])}var i=r.entries(t);return A(i)}function A(t){return t.map(function(t){if(t.key&&t.values){if(t.values[0].key==="undefined")return t.values[0].values[0];else t.values=A(t.values)}return t})}var T=function(t){i(_,t);function _(){var n;o(this,_);n=s(this,w(_).call(this));n._orient="vertical";n._separation=function(t,e){return t.parent===e.parent?1:2};n._shape=k.constant("Circle");n._shapeConfig=k.assign(n._shapeConfig,{ariaLabel:function t(e,r){return n._treeData?"".concat(n._treeData[r].depth,". ").concat(n._drawLabel(e,r),"."):""},labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:k.constant(5),width:k.constant(10),height:k.constant(10)});n._tree=y.tree();return n}r(_,[{key:"_draw",value:function t(e){var f=this;x(w(_.prototype),"_draw",this).call(this,e);var r=this._orient==="vertical"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right,o=this._orient==="vertical"?"left":"top",n=this,i="translate(".concat(this._margin.left,", ").concat(this._margin.top,")"),u=this._orient==="horizontal"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right;var a=this._treeData=this._tree.separation(this._separation).size([u,r])(y.hierarchy({key:"root",values:E(this._filteredData,this._groupBy.slice(0,this._drawDepth+1))},function(t){return t.key&&t.values?t.values:null}).sort(this._sort)).descendants().filter(function(t){return t.depth<=f._groupBy.length&&t.parent});function s(t){return k.merge(t.values.map(function(t){return t.key&&t.values?s(t):t}),n._aggs)}a.forEach(function(t,e){if(t.data.key&&t.data.values)t.data=s(t.data);t.__d3plus__=true;t.i=e});var c=this._shapeConfig.r;if(typeof c!=="function")c=k.constant(c);var l=O.max(a,function(t){return t.depth===1?c(t.data,t.i):0});var h=O.max(a,function(t){return t.children?0:c(t.data,t.i)});var v=O.extent(a,function(t){return t.y});this._labelHeight=O.min([this._orient==="vertical"?50:100,(v[1]-l-h)/(this._groupBy.length+1)]);this._labelWidths=E(a,function(t){return t.depth}).map(function(a){return a.values.reduce(function(t,e,r){var n=r<a.values.length-1?a.values[r+1].x:u+f._margin[o],i=r?a.values[r-1].x:f._margin[o];return O.min([t,n-e.x,e.x-i])},u)});var d=m.scaleLinear().domain(v).range([l+this._labelHeight,r-h-this._labelHeight]);a.forEach(function(t){var e=d(t.y);if(f._orient==="horizontal"){t.y=t.x;t.x=e}else t.y=e});var p={parent:this._select,enter:{transform:i},update:{transform:i}};this._shapes.push((new g.Path).data(a.filter(function(t){return t.depth>1})).select(k.elem("g.d3plus-Tree-Links",p).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Path")).config({d:function t(e){var r=f._shapeConfig.r;if(typeof r==="function")r=r(e.data,e.i);var n=e.parent.x-e.x+(f._orient==="vertical"?0:r),i=e.parent.y-e.y+(f._orient==="vertical"?r:0),a=f._orient==="vertical"?0:-r,o=f._orient==="vertical"?-r:0;return f._orient==="vertical"?"M".concat(a,",").concat(o,"C").concat(a,",").concat((o+i)/2," ").concat(n,",").concat((o+i)/2," ").concat(n,",").concat(i):"M".concat(a,",").concat(o,"C").concat((a+n)/2,",").concat(o," ").concat((a+n)/2,",").concat(i," ").concat(n,",").concat(i)},id:function t(e,r){return f._ids(e,r).join("-")}}).render());this._shapes.push((new g.Circle).data(a).select(k.elem("g.d3plus-Tree-Shapes",p).node()).config(k.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).config({id:function t(e,r){return f._ids(e,r).join("-")},label:function t(e,r){if(f._label)return f._label(e.data,r);var n=f._ids(e,r).slice(0,e.depth);return n[n.length-1]},labelConfig:{textAnchor:function t(e){return f._orient==="vertical"?"middle":e.data.children&&e.data.depth!==f._groupBy.length?"end":"start"},verticalAlign:function t(e){return f._orient==="vertical"?e.data.depth===1?"bottom":"top":"middle"}},hitArea:function t(e,r,n){var i=f._labelHeight,a=f._labelWidths[e.depth-1];return{width:f._orient==="vertical"?a:n.r*2+a,height:f._orient==="horizontal"?i:n.r*2+i,x:f._orient==="vertical"?-a/2:e.children&&e.depth!==f._groupBy.length?-(n.r+a):-n.r,y:f._orient==="horizontal"?-i/2:e.children&&e.depth!==f._groupBy.length?-(n.r+f._labelHeight):-n.r}},labelBounds:function t(e,r,n){var i;var a=f._labelHeight,o=f._orient==="vertical"?"height":"width",u=f._labelWidths[e.depth-1],s=f._orient==="vertical"?"width":"height",c=f._orient==="vertical"?"x":"y",l=f._orient==="vertical"?"y":"x";return i={},b(i,s,u),b(i,o,a),b(i,c,-u/2),b(i,l,e.children&&e.depth!==f._groupBy.length?-(n.r+a):n.r),i}}).render());return this}},{key:"orient",value:function t(e){return arguments.length?(this._orient=e,this):this._orient}},{key:"separation",value:function t(e){return arguments.length?(this._separation=e,this):this._separation}}]);return _}(e.Viz);var D=function(t){i(d,t);function d(){var i;o(this,d);i=s(this,w(d).call(this));i._layoutPadding=1;i._legendSort=function(t,e){return i._sum(e)-i._sum(t)};i._legendTooltip=k.assign({},i._legendTooltip,{tbody:[]});i._shapeConfig=k.assign({},i._shapeConfig,{ariaLabel:function t(e,r){var n=i._rankData?"".concat(i._rankData.indexOf(e)+1,". "):"";return"".concat(n).concat(i._drawLabel(e,r),", ").concat(i._sum(e,r),".")},labelConfig:{fontMax:20,fontMin:8,fontResize:true,padding:5}});i._sort=function(t,e){var r=a(t);var n=a(e);return r&&!n?1:!r&&n?-1:e.value-t.value};i._sum=k.accessor("value");i._thresholdKey=i._sum;i._tile=y.treemapSquarify;i._tooltipConfig=k.assign({},i._tooltipConfig,{tbody:[[function(){return i._translate("Share")},function(t,e,r){return"".concat(_.formatAbbreviate(r.share*100,i._locale),"%")}]]});i._treemap=y.treemap().round(true);var a=function t(e){return e.children&&e.children.length===1&&e.children[0].data._isAggregation};return i}r(d,[{key:"_draw",value:function t(e){var r=this;x(w(d.prototype),"_draw",this).call(this,e);var n=p.nest();for(var i=0;i<=this._drawDepth;i++){n.key(this._groupBy[i])}n=n.entries(this._filteredData);var a=this._treemap.padding(this._layoutPadding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(y.hierarchy({values:n},function(t){return t.values}).sum(this._sum).sort(this._sort));var o=[],u=this;function s(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.depth<=u._drawDepth)s(r.children);else{var n=r.data.values.length===1?u._filteredData.indexOf(r.data.values[0]):undefined;r.__d3plus__=true;r.id=r.data.key;r.i=n>-1?n:undefined;r.data=k.merge(r.data.values);r.x=r.x0+(r.x1-r.x0)/2;r.y=r.y0+(r.y1-r.y0)/2;o.push(r)}}}if(a.children)s(a.children);this._rankData=o.sort(this._sort).map(function(t){return t.data});var c=a.value;o.forEach(function(t){t.share=r._sum(t.data,t.i)/c});var l="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");var f=k.configPrep.bind(this)(this._shapeConfig,"shape","Rect");var h=f.labelConfig.fontMin;var v=f.labelConfig.padding;this._shapes.push((new g.Rect).data(o).label(function(t){return[r._drawLabel(t.data,t.i),"".concat(_.formatAbbreviate(t.share*100,r._locale),"%")]}).select(k.elem("g.d3plus-Treemap",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).config({height:function t(e){return e.y1-e.y0},labelBounds:function t(e,r,n){var i=n.height;var a=Math.min(50,(i-v*2)*.5);if(a<h)a=0;return[{width:n.width,height:i-a,x:-n.width/2,y:-i/2},{width:n.width,height:a+v*2,x:-n.width/2,y:i/2-a-v*2}]},labelConfig:{textAnchor:function t(e,r,n){var i,a=n;while(typeof i==="undefined"&&a){if(typeof a.l!=="undefined")i=a.l;a=a.__d3plusParent__}return i?"middle":"start"},verticalAlign:function t(e,r,n){var i,a=n;while(typeof i==="undefined"&&a){if(typeof a.l!=="undefined")i=a.l;a=a.__d3plusParent__}return i?"bottom":"top"}},width:function t(e){return e.x1-e.x0}}).config(f).render());return this}},{key:"_thresholdFunction",value:function t(e,r){var _=this._aggs;var g=this._drawDepth;var y=this._groupBy;var m=this._threshold;var b=this._thresholdKey;if(m&&b){var n=e.slice();var i=O.sum(n,this._thresholdKey);var a=r.length;while(a--){var o=r[a];w(n,i,e,o,0)}return n}function w(t,e,r,n,i){if(i>=g)return;var a=y[i];var o=r.filter(function(t){return a(t)===n.key});if(i+1===g){var u=[];var s=Math.min(1,Math.max(0,m(o)));if(!isFinite(s)||isNaN(s))return;var c=s*e;var l=o.length;while(l--){var f=o[l];if(b(f)<c){var h=t.indexOf(f);t.splice(h,1);u.push(f)}}if(u.length>0){var v=k.merge(u,_);v._isAggregation=true;v._threshold=s;t.push(v)}}else{var d=n.values;var p=d.length;while(p--){w(t,e,o,d[p],i+1)}}}return e}},{key:"layoutPadding",value:function t(e){return arguments.length?(this._layoutPadding=typeof e==="function"?e:k.constant(e),this):this._layoutPadding}},{key:"sort",value:function t(e){return arguments.length?(this._sort=e,this):this._sort}},{key:"sum",value:function t(e){if(arguments.length){this._sum=typeof e==="function"?e:k.accessor(e);this._thresholdKey=this._sum;return this}else return this._sum}},{key:"tile",value:function t(e){return arguments.length?(this._tile=e,this):this._tile}}]);return d}(e.Viz);t.Donut=C;t.Pack=S;t.Pie=P;t.Tree=T;t.Treemap=D;Object.defineProperty(t,"__esModule",{value:true})}); |
@@ -84,3 +84,5 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
_this._tooltipConfig = assign({}, _this._tooltipConfig, { | ||
tbody: [["Share", function (d, i, x) { | ||
tbody: [[function () { | ||
return _this._translate("Share"); | ||
}, function (d, i, x) { | ||
return "".concat(formatAbbreviate(x.share * 100, _this._locale), "%"); | ||
@@ -87,0 +89,0 @@ }]] |
{ | ||
"name": "d3plus-hierarchy", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"description": "Nested, hierarchical, and cluster charts built on D3", | ||
@@ -31,5 +31,5 @@ "main": "build/d3plus-hierarchy.js", | ||
"d3-shape": "^1.3.5", | ||
"d3plus-common": "^0.6.52", | ||
"d3plus-shape": "^0.16.10", | ||
"d3plus-viz": "^0.12.36" | ||
"d3plus-common": "^0.6.56", | ||
"d3plus-shape": "^0.16.11", | ||
"d3plus-viz": "^0.12.41" | ||
}, | ||
@@ -46,3 +46,3 @@ "scripts": { | ||
"devDependencies": { | ||
"d3plus-dev": "^0.7.3" | ||
"d3plus-dev": "^0.7.4" | ||
}, | ||
@@ -49,0 +49,0 @@ "module": "es/index", |
@@ -396,2 +396,2 @@ # d3plus-hierarchy | ||
###### <sub>Documentation generated on Thu, 18 Jul 2019 19:35:24 GMT</sub> | ||
###### <sub>Documentation generated on Thu, 22 Aug 2019 14:54:36 GMT</sub> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
228755
2768
Updatedd3plus-common@^0.6.56
Updatedd3plus-shape@^0.16.11
Updatedd3plus-viz@^0.12.41