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

d3plus-text

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-text - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

src/split.js

4

build/d3plus-text.full.min.js

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define("d3plus-text",["exports"],n):n(t.d3plus_text=t.d3plus_text||{})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tr.hasOwnProperty(n)?{space:tr[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Ze&&n.documentElement.namespaceURI===Ze?n.createElement(t):n.createElementNS(e,t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function o(t,n,e){return t=u(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function u(t,n,e){return function(r){var i=ur;ur=r;try{t.call(this,this.__data__,n,e)}finally{ur=i}}}function a(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function s(t){return function(){var n=this,e=this.__on;if(e){for(var r,i=0,o=-1,u=e.length;u>i;++i)r=e[i],t.type&&r.type!==t.type||r.name!==t.name?e[++o]=r:n.removeEventListener(r.type,r.listener,r.capture);++o?e.length=o:delete this.__on}}}function l(t,n,e){var r=or.hasOwnProperty(t.type)?o:u;return function(i,o,u){var a,s=this,l=this.__on,c=r(n,o,u);if(l)for(var f=0,h=l.length;h>f;++f)if((a=l[f]).type===t.type&&a.name===t.name)return s.removeEventListener(a.type,a.listener,a.capture),s.addEventListener(a.type,a.listener=c,a.capture=e),void(a.value=n);this.addEventListener(t.type,c,e),a={type:t.type,name:t.name,value:n,listener:c,capture:e},l?l.push(a):this.__on=[a]}}function c(t,n,e){var r,i,o=this,u=a(t+""),c=u.length;if(!(arguments.length<2)){for(f=n?l:s,null==e&&(e=!1),r=0;c>r;++r)o.each(f(u[r],n,e));return this}var f=this.node().__on;if(f)for(var h,p=0,d=f.length;d>p;++p)for(r=0,h=f[p];c>r;++r)if((i=u[r]).type===h.type&&i.name===h.name)return h.value}function f(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function h(t){return function(){return this.querySelector(t)}}function p(t){var n=this;"function"!=typeof t&&(t=h(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a,s=e[o],l=s.length,c=i[o]=new Array(l),f=0;l>f;++f)(u=s[f])&&(a=t.call(u,u.__data__,f,s))&&("__data__"in u&&(a.__data__=u.__data__),c[f]=a);return new St(i,this._parents)}function d(t){return function(){return this.querySelectorAll(t)}}function y(t){var n=this;"function"!=typeof t&&(t=d(t));for(var e=n._groups,r=e.length,i=[],o=[],u=0;r>u;++u)for(var a,s=e[u],l=s.length,c=0;l>c;++c)(a=s[c])&&(i.push(t.call(a,a.__data__,c,s)),o.push(a));return new St(i,o)}function v(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new St(i,this._parents)}function g(t){return function(){return t}}function m(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;l>a;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new b(t,o[a]);for(;s>a;++a)(u=n[a])&&(i[a]=u)}function _(t,n,e,r,i,o,u){var a,s,l,c={},f=n.length,h=o.length,p=new Array(f);for(a=0;f>a;++a)(s=n[a])&&(p[a]=l=sr+u.call(s,s.__data__,a,n),c[l]||(c[l]=s));for(a=0;h>a;++a)l=sr+u.call(t,o[a],a,o),(s=c[l])?s!==!0&&(r[a]=s,s.__data__=o[a]):e[a]=new b(t,o[a]),c[l]=!0;for(a=0;f>a;++a)(s=n[a])&&c[p[a]]!==!0&&(i[a]=s)}function w(t,n){if(!t)return p=new Array(this.size()),l=-1,this.each(function(t){p[++l]=t}),p;var e=n?_:m,r=this._parents,i=this._groups;"function"!=typeof t&&(t=g(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),l=0;o>l;++l){var c=r[l],f=i[l],h=f.length,p=t.call(c,c&&c.__data__,l,r),d=p.length,y=a[l]=new Array(d),v=u[l]=new Array(d),w=s[l]=new Array(h);e(c,f,y,v,w,p,n);for(var b,x,M=0,A=0;d>M;++M)if(b=y[M]){for(M>=A&&(A=M+1);!(x=v[A])&&++A<d;);b._next=x||null}}return u=new St(u,r),u._enter=a,u._exit=s,u}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function x(t){return new Array(t.length)}function M(){return new St(this._enter||this._groups.map(x),this._parents)}function A(){return new St(this._exit||this._groups.map(x),this._parents)}function N(t){for(var n=this,e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new St(a,this._parents)}function k(){for(var t=this,n=t._groups,e=-1,r=n.length;++e<r;)for(var i,o=n[e],u=o.length-1,a=o[u];--u>=0;)(i=o[u])&&(a&&a!==i.nextSibling&&a.parentNode.insertBefore(i,a),a=i);return this}function E(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}var e=this;t||(t=S);for(var r=e._groups,i=r.length,o=new Array(i),u=0;i>u;++u){for(var a,s=r[u],l=s.length,c=o[u]=new Array(l),f=0;l>f;++f)(a=s[f])&&(c[f]=a);c.sort(n)}return new St(o,this._parents).order()}function S(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function P(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function C(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this,n=t._groups,e=0,r=n.length;r>e;++e)for(var i=n[e],o=0,u=i.length;u>o;++o){var a=i[o];if(a)return a}return null}function z(){var t=0;return this.each(function(){++t}),t}function T(){return!this.node()}function I(t){for(var n=this,e=n._groups,r=0,i=e.length;i>r;++r)for(var o,u=e[r],a=0,s=u.length;s>a;++a)(o=u[a])&&t.call(o,o.__data__,a,u);return this}function X(t){return function(){this.removeAttribute(t)}}function O(t){return function(){this.removeAttributeNS(t.space,t.local)}}function V(t,n){return function(){this.setAttribute(t,n)}}function j(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function L(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function R(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function D(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?O:X:"function"==typeof e?r.local?R:L:r.local?j:V)(r,e))}function $(t){return function(){this.style.removeProperty(t)}}function Y(t,n,e){return function(){this.style.setProperty(t,n,e)}}function B(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function H(t,n,e){var r;return arguments.length>1?this.each((null==n?$:"function"==typeof n?B:Y)(t,n,null==e?"":e)):f(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function F(t){return function(){delete this[t]}}function U(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function K(t,n){return arguments.length>1?this.each((null==n?F:"function"==typeof n?W:U)(t,n)):this.node()[t]}function G(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function Z(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function tt(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function nt(t){return function(){Z(this,t)}}function et(t){return function(){tt(this,t)}}function rt(t,n){return function(){(n.apply(this,arguments)?Z:tt)(this,t)}}function it(t,n){var e=G(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?rt:n?nt:et)(e,n))}function ot(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function st(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:ut)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ct(t){return function(){this.innerHTML=t}}function ft(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ft:ct)(t)):this.node().innerHTML}function pt(){this.parentNode.appendChild(this)}function dt(){return this.each(pt)}function yt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vt(){return this.each(yt)}function gt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function mt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function _t(){return null}function wt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?gt(e):mt(e,null==n?_t:"function"==typeof n?n:h(n)))}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){return this.each(bt)}function Mt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function At(t,n,e){var r=f(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Nt(t,n){return function(){return At(this,t,n)}}function kt(t,n){return function(){return At(this,t,n.apply(this,arguments))}}function Et(t,n){return this.each(("function"==typeof n?kt:Nt)(t,n))}function St(t,n){this._groups=t,this._parents=n}function Pt(){return new St([[document.documentElement]],lr)}function Ct(t){return"string"==typeof t?new St([[document.querySelector(t)]],[document.documentElement]):new St([[t]],lr)}function qt(){for(var t,n=arguments,e=0,r=n.length,i={};r>e;++e){if(!(t=n[e]+"")||t in i)throw new Error;i[t]=[]}return new zt(i)}function zt(t){this._=t}function Tt(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error;return{type:t,name:e}})}function It(t,n){for(var e,r=0,i=t.length;i>r;++r)if((e=t[r]).name===n)return e.value}function Xt(t,n,e){for(var r=0,i=t.length;i>r;++r)if(t[r].name===n){t[r]=cr,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Ot(){return mr||(br(Vt),mr=wr.now()+_r)}function Vt(){mr=0}function jt(){this._call=this._time=this._next=null}function Lt(t,n,e){var r=new jt;return r.restart(t,n,e),r}function Rt(){Ot(),++pr;for(var t,n=fr;n;)(t=mr-n._time)>=0&&n._call.call(null,t),n=n._next;--pr}function Dt(t){mr=(gr=t||wr.now())+_r,pr=dr=0;try{Rt()}finally{pr=0,Yt(),mr=0}}function $t(){var t=wr.now(),n=t-gr;n>vr&&(_r-=n,gr=t)}function Yt(){for(var t,n=fr,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:fr=n._next;hr=t,Bt(e)}function Bt(t){if(!pr){dr&&(dr=clearTimeout(dr));var n=t-mr;n>24?(1/0>t&&(dr=setTimeout(Dt,n)),yr&&(yr=clearInterval(yr))):(yr||(yr=setInterval($t,vr)),pr=1,br(Dt))}}function Ht(t,n,e){var r=new jt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function Ft(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};Gt(t,e,{name:n,index:r,group:i,on:xr,tween:Mr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ar})}function Ut(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Ar)throw new Error("too late");return e}function Wt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>kr)throw new Error("too late");return e}function Kt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function Gt(t,n,e){function r(t){e.state=Nr,e.delay<=t?i(t-e.delay):e.timer.restart(i,e.delay,e.time)}function i(r){var i,s,l,c;for(i in a)c=a[i],c.name===e.name&&(c.state===Er?(c.state=Pr,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete a[i]):n>+i&&(c.state=Pr,c.timer.stop(),delete a[i]));if(Ht(function(){e.state===Er&&(e.timer.restart(o,e.delay,e.time),o(r))}),e.state=kr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===kr){for(e.state=Er,u=new Array(l=e.tween.length),i=0,s=-1;l>i;++i)(c=e.tween[i].value.call(t,t.__data__,e.index,e.group))&&(u[++s]=c);u.length=s+1}}function o(r){for(var i=r<e.duration?e.ease.call(null,r/e.duration):(e.state=Sr,1),o=-1,s=u.length;++o<s;)u[o].call(null,i);if(e.state===Sr){e.state=Pr,e.timer.stop(),e.on.call("end",t,t.__data__,e.index,e.group);for(o in a)if(+o!==n)return void delete a[n];delete t.__transition}}var u,a=t.__transition;a[n]=e,e.timer=Lt(r,0,e.time)}function Jt(t){return t=null==t?null:t+"",this.each(function(){var n,e,r,i=this.__transition,o=!0;if(i){for(r in i)(n=i[r]).name===t?(e=n.state===Er,n.state=Pr,n.timer.stop(),e&&n.on.call("interrupt",this,this.__data__,n.index,n.group),delete i[r]):o=!1;o&&delete this.__transition}})}function Qt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Zt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function tn(){}function nn(t){var n;return t=(t+"").trim().toLowerCase(),(n=zr.exec(t))?(n=parseInt(n[1],16),new an(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Tr.exec(t))?en(parseInt(n[1],16)):(n=Ir.exec(t))?new an(n[1],n[2],n[3],1):(n=Xr.exec(t))?new an(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Or.exec(t))?rn(n[1],n[2],n[3],n[4]):(n=Vr.exec(t))?rn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=jr.exec(t))?sn(n[1],n[2]/100,n[3]/100,1):(n=Lr.exec(t))?sn(n[1],n[2]/100,n[3]/100,n[4]):Rr.hasOwnProperty(t)?en(Rr[t]):"transparent"===t?new an(NaN,NaN,NaN,0):null}function en(t){return new an(t>>16&255,t>>8&255,255&t,1)}function rn(t,n,e,r){return 0>=r&&(t=n=e=NaN),new an(t,n,e,r)}function on(t){return t instanceof tn||(t=nn(t)),t?(t=t.rgb(),new an(t.r,t.g,t.b,t.opacity)):new an}function un(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}function an(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function sn(t,n,e,r){return 0>=r?t=n=e=NaN:0>=e||e>=1?t=n=NaN:0>=n&&(t=NaN),new fn(t,n,e,r)}function ln(t){if(t instanceof fn)return new fn(t.h,t.s,t.l,t.opacity);if(t instanceof tn||(t=nn(t)),!t)return new fn;if(t instanceof fn)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(r>e):e===o?(r-n)/a+2:(n-e)/a+4,a/=.5>s?o+i:2-o-i,u*=60):a=s>0&&1>s?0:u,new fn(u,a,s,t.opacity)}function cn(t,n,e,r){return 1===arguments.length?ln(t):new fn(t,n,e,null==r?1:r)}function fn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function hn(t,n,e){return 255*(60>t?n+(e-n)*t/60:180>t?e:240>t?n+(e-n)*(240-t)/60:n)}function pn(t){if(t instanceof yn)return new yn(t.l,t.a,t.b,t.opacity);if(t instanceof xn){var n=t.h*Dr;return new yn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof an||(t=on(t));var e=_n(t.r),r=_n(t.g),i=_n(t.b),o=vn((.4124564*e+.3575761*r+.1804375*i)/Br),u=vn((.2126729*e+.7151522*r+.072175*i)/Hr),a=vn((.0193339*e+.119192*r+.9503041*i)/Fr);return new yn(116*u-16,500*(o-u),200*(u-a),t.opacity)}function dn(t,n,e,r){return 1===arguments.length?pn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function vn(t){return t>Gr?Math.pow(t,1/3):t/Kr+Ur}function gn(t){return t>Wr?t*t*t:Kr*(t-Ur)}function mn(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _n(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wn(t){if(t instanceof xn)return new xn(t.h,t.c,t.l,t.opacity);t instanceof yn||(t=pn(t));var n=Math.atan2(t.b,t.a)*$r;return new xn(0>n?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bn(t,n,e,r){return 1===arguments.length?wn(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Mn(t){if(t instanceof Nn)return new Nn(t.h,t.s,t.l,t.opacity);t instanceof an||(t=on(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(ii*r+ei*n-ri*e)/(ii+ei-ri),o=r-i,u=(ni*(e-i)-Zr*o)/ti,a=Math.sqrt(u*u+o*o)/(ni*i*(1-i)),s=a?Math.atan2(u,o)*$r-120:NaN;return new Nn(0>s?s+360:s,a,i,t.opacity)}function An(t,n,e,r){return 1===arguments.length?Mn(t):new Nn(t,n,e,null==r?1:r)}function Nn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function kn(t){return function(){return t}}function En(t,n){return function(e){return t+e*n}}function Sn(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Pn(t,n){var e=n-t;return e?En(t,e>180||-180>e?e-360*Math.round(e/360):e):kn(isNaN(t)?n:t)}function Cn(t){return 1===(t=+t)?qn:function(n,e){return e-n?Sn(n,e,t):kn(isNaN(n)?e:n)}}function qn(t,n){var e=n-t;return e?En(t,e):kn(isNaN(t)?n:t)}function zn(t,n){return t=+t,n-=t,function(e){return t+n*e}}function Tn(t){return function(){return t}}function In(t){return function(n){return t(n)+""}}function Xn(t,n){var e,r,i,o=ci.lastIndex=fi.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=ci.exec(t))&&(r=fi.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,s.push({i:u,x:zn(e,r)})),o=fi.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?In(s[0].x):Tn(n):(n=s.length,function(t){for(var e,r=0;n>r;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})}function On(t,n,e,r,i,o){if(t*r===n*e)return null;var u=Math.sqrt(t*t+n*n);t/=u,n/=u;var a=t*e+n*r;e-=t*a,r-=n*a;var s=Math.sqrt(e*e+r*r);return e/=s,r/=s,a/=s,n*e>t*r&&(t=-t,n=-n,a=-a,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*hi,skewX:Math.atan(a)*hi,scaleX:u,scaleY:s}}function Vn(t){if("none"===t)return pi;oi||(oi=document.createElement("DIV"),ui=document.documentElement,ai=document.defaultView),oi.style.transform=t,t=ai.getComputedStyle(ui.appendChild(oi),null).getPropertyValue("transform"),ui.removeChild(oi);var n=t.slice(7,-1).split(",");return On(+n[0],+n[1],+n[2],+n[3],+n[4],+n[5])}function jn(t){si||(si=document.createElementNS("http://www.w3.org/2000/svg","g")),si.setAttribute("transform",null==t?"":t);var n=si.transform.baseVal.consolidate().matrix;return On(n.a,n.b,n.c,n.d,n.e,n.f)}function Ln(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}function o(t,r,i,o,u,a){if(t!==i||r!==o){var s=u.push("translate(",null,n,null,e);a.push({i:s-4,x:zn(t,i)},{i:s-2,x:zn(r,o)})}else(i||o)&&u.push("translate("+i+n+o+e)}function u(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:zn(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function a(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:zn(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function s(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:zn(t,e)},{i:a-2,x:zn(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),u(n.rotate,e.rotate,r,i),a(n.skewX,e.skewX,r,i),s(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e<o;)r[(n=i[e]).i]=n.x(t);return r.join("")}}}function Rn(t,n){var e,r;return function(){var i=Wt(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;a>u;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function Dn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Wt(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;l>s;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function $n(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Kt(this.node(),e).tween,o=0,u=i.length;u>o;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Rn:Dn)(e,t,n))}function Yn(t,n,e){var r=t._id;return t.each(function(){var t=Wt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Kt(t,r).value[n]}}function Bn(t,n){var e;return("number"==typeof n?zn:n instanceof nn?li:(e=nn(n))?(n=e,li):Xn)(t,n)}function Hn(t){return function(){this.removeAttribute(t)}}function Fn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Un(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function Wn(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function Kn(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttribute(t):(u=this.getAttribute(t),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function Gn(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttributeNS(t.space,t.local):(u=this.getAttributeNS(t.space,t.local),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function Jn(t,e){var r=n(t),i="transform"===r?yi:Bn;return this.attrTween(t,"function"==typeof e?(r.local?Gn:Kn)(r,i,Yn(this,"attr."+t,e)):null==e?(r.local?Fn:Hn)(r):(r.local?Wn:Un)(r,i,e))}function Qn(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function Zn(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}function te(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n(t);return this.tween(r,(i.local?Qn:Zn)(i,e))}function ne(t,n){return function(){Ut(this,t).delay=+n.apply(this,arguments)}}function ee(t,n){return n=+n,function(){Ut(this,t).delay=n}}function re(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ne:ee)(n,t)):Kt(this.node(),n).delay}function ie(t,n){return function(){Wt(this,t).duration=+n.apply(this,arguments)}}function oe(t,n){return n=+n,function(){Wt(this,t).duration=n}}function ue(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ie:oe)(n,t)):Kt(this.node(),n).duration}function ae(t,n){if("function"!=typeof n)throw new Error;return function(){Wt(this,t).ease=n}}function se(t){var n=this._id;return arguments.length?this.each(ae(n,t)):Kt(this.node(),n).ease}function le(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new Ce(i,this._parents,this._name,this._id)}function ce(t){var n=this;if(t._id!==this._id)throw new Error;for(var e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new Ce(a,this._parents,this._name,this._id)}function fe(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}function he(t,n,e){var r,i,o=fe(n)?Ut:Wt;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function pe(t,n){var e=this._id;return arguments.length<2?Kt(this.node(),e).on.on(t):this.each(he(e,t,n))}function de(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function ye(){return this.on("end.remove",de(this._id))}function ve(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=h(t));for(var i=n._groups,o=i.length,u=new Array(o),a=0;o>a;++a)for(var s,l,c=i[a],f=c.length,p=u[a]=new Array(f),d=0;f>d;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),p[d]=l,Ft(p[d],e,r,d,p,Kt(s,r)));return new Ce(u,this._parents,e,r)}function ge(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=d(t));for(var i=n._groups,o=i.length,u=[],a=[],s=0;o>s;++s)for(var l,c=i[s],f=c.length,h=0;f>h;++h)if(l=c[h]){for(var p,y=t.call(l,l.__data__,h,c),v=Kt(l,r),g=0,m=y.length;m>g;++g)(p=y[g])&&Ft(p,e,r,g,y,v);u.push(y),a.push(l)}return new Ce(u,a,e,r)}function me(){return new vi(this._groups,this._parents)}function _e(t,n){var e,r,i;return function(){var o=f(this).getComputedStyle(this,null),u=o.getPropertyValue(t),a=(this.style.removeProperty(t),o.getPropertyValue(t));return u===a?null:u===e&&a===r?i:i=n(e=u,r=a)}}function we(t){return function(){this.style.removeProperty(t)}}function be(t,n,e){var r,i;return function(){var o=f(this).getComputedStyle(this,null).getPropertyValue(t);return o===e?null:o===r?i:i=n(r=o,e)}}function xe(t,n,e){var r,i,o;return function(){var u=f(this).getComputedStyle(this,null),a=u.getPropertyValue(t),s=e(this);return null==s&&(this.style.removeProperty(t),s=u.getPropertyValue(t)),a===s?null:a===r&&s===i?o:o=n(r=a,i=s)}}function Me(t,n,e){var r="transform"==(t+="")?di:Bn;return null==n?this.styleTween(t,_e(t,r)).on("end.style."+t,we(t)):this.styleTween(t,"function"==typeof n?xe(t,r,Yn(this,"style."+t,n)):be(t,r,n),e)}function Ae(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function Ne(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,Ae(t,n,null==e?"":e))}function ke(t){return function(){this.textContent=t}}function Ee(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Se(t){return this.tween("text","function"==typeof t?Ee(Yn(this,"text",t)):ke(null==t?"":t+""))}function Pe(){for(var t=this,n=this._name,e=this._id,r=ze(),i=t._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)if(a=s[c]){var f=Kt(a,e);Ft(a,n,r,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ce(i,this._parents,n,r)}function Ce(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function qe(t){return Pt().transition(t)}function ze(){return++gi}function Te(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Ie(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Ai.time=Ot(),Ai;return e}function Xe(t){var n,e,r=this;t instanceof Ce?(n=t._id,t=t._name):(n=ze(),(e=Ai).time=Ot(),t=null==t?null:t+"");for(var i=r._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)(a=s[c])&&Ft(a,t,n,c,s,e||Ie(a,n));return new Ce(i,this._parents,t,n)}function Oe(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function Ve(t){return 1===t.length&&(t=je(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function je(t){return function(n,e){return Oe(t(n),e)}}function Le(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&r>e&&(e=r)}return e}function Re(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&e>r&&(e=r)}return e}function De(t,n){var e,r=0,i=t.length,o=-1;if(null==n)for(;++o<i;)(e=+t[o])&&(r+=e);else for(;++o<i;)(e=+n(t[o],o,t))&&(r+=e);return r}function $e(t){return function(){return t}}function Ye(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),r=[];if("font-style"in n&&r.push(n["font-style"]),"font-variant"in n&&r.push(n["font-variant"]),"font-weight"in n&&r.push(n["font-weight"]),"font-size"in n){var i=n["font-size"]+"px";"line-height"in n&&(i+="/"+n["line-height"]+"px"),r.push(i)}return"font-family"in n&&r.push(n["font-family"]),e.font=r.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function Be(t){return t.height||200}function He(t,n){return t.id||""+n}function Fe(t){return t.match(Ei)}function Ue(t){return t.text}function We(t){return t.width||200}function Ke(t){return t.x||0}function Ge(t){return t.y||0}function Je(t){function n(t){return t+"..."}function e(n){void 0===a&&e.select(Ni.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===u&&(u=$e(Math.ceil(1.1*o())));var A=a.selectAll(".d3plus-text-box").data(t,y);return A.exit().remove(),A.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+y(t,n)}).merge(A).attr("y",function(t,n){return M(t,n)+"px"}).attr("fill",function(t,n){return r(t,n)}).attr("text-anchor",function(t,n){return _(t,n)}).attr("font-family",function(t,n){return i(t,n)}).each(function(t,n){function e(){if(N=1,k=[""],P>M)return void(k=[]);M>S&&(M=S);var t="",n=0;y&&(A=1.1*M,E["font-size"]=M,E["line-height"]=A),a=Ye(V,E);for(var r=0;r<V.length;r++){var i=V[r],o=T.charAt(t.length+i.length),u=a[V.indexOf(i)];if(" "===o&&(i+=o),n+u>O-M){if(N++,A*N>C||u>O&&!q){if(y){if(M--,P>M){k=[];break}e()}else 2!==N||k[N-2].trimRight().length?k[N-2]=c(k[N-2].trimRight()):k=[];break}n=0,k.push(i)}else k[N-1]+=i;t+=i,n+=u," "===o&&(n+=z)}}function r(e){e.text(function(t){return t.trimRight()}).attr("x",x(t,n)+"px").attr("dx",j+"px").attr("dy",A+"px")}var a,y=p(t,n),M=y?f(t,n):o(t,n),A=y?1.1*M:u(t,n),N=1,k=[""],E={"font-family":i(t,n),"font-size":M,"line-height":A},S=f(t,n),P=h(t,n),C=d(t,n),q=v(t,n),z=Ye(" ",E),T=m(t,n),I=_(t,n),X=w(t,n),O=b(t,n),V=g(T,n),j="start"===I?0:"end"===I?O:O/2;if(C>A||y){if(y){a=Ye(V,E);var L=1.165+O/C*.1,R=O*C,D=Ni.max(a),$=Ni.sum(a,function(t){return t*A})*L;if(D>O||$>R){var Y=Math.sqrt(R/$),B=O/D,H=Ni.min([Y,B]);M=Math.floor(M*H)}var F=Math.floor(.8*C);M>F&&(M=F)}e(),Ni.select(this).attr("font-size",M+"px").style("font-size",M+"px")}var U=N*A,W="top"===X?0:"middle"===X?C/2-U/2:C-U;W-=.2*A,Ni.select(this).transition().duration(l).attr("transform","translate(0,"+W+")");var K=Ni.select(this).selectAll("tspan").data(k);K.transition().duration(l).call(r),K.exit().transition().duration(l).attr("opacity",0).remove(),K.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(r).transition().duration(l).delay(s).attr("opacity",1)}),n&&setTimeout(n,l+100),e}void 0===t&&(t=[]);var r,i,o,u,a,s=0,l=0,c=n,f=$e(50),h=$e(8),p=$e(!1),d=Be,y=He,v=$e(!1),g=Fe,m=Ue,_=$e("start"),w=$e("top"),b=We,x=Ke,M=Ge;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(s=t,e):s},e.duration=function(t){return arguments.length?(l=t,e):l},e.ellipsis=function(t){return arguments.length?(c="function"==typeof t?t:$e(t),e):c},e.fontColor=function(t){return arguments.length?(r="function"==typeof t?t:$e(t),e):r},e.fontFamily=function(t){return arguments.length?(i="function"==typeof t?t:$e(t),e):i},e.fontMax=function(t){return arguments.length?(f="function"==typeof t?t:$e(t),e):f},e.fontMin=function(t){return arguments.length?(h="function"==typeof t?t:$e(t),e):h},e.fontResize=function(t){return arguments.length?(p="function"==typeof t?t:$e(t),e):p},e.fontSize=function(t){return arguments.length?(o="function"==typeof t?t:$e(t),e):o},e.height=function(t){return arguments.length?(d="function"==typeof t?t:$e(t),e):d},e.id=function(t){return arguments.length?(y="function"==typeof t?t:$e(t),e):y},e.lineHeight=function(t){return arguments.length?(u="function"==typeof t?t:$e(t),e):u},e.overflow=function(t){return arguments.length?(v="function"==typeof t?t:$e(t),e):v},e.select=function(t){return arguments.length?(a=Ni.select(t),void 0===r&&e.fontColor(a.style("font-color")),void 0===i&&e.fontFamily(a.style("font-family")),void 0===o&&e.fontSize(parseFloat(a.style("font-size"),10)),e):a},e.split=function(t){return arguments.length?(g=t,e):g},e.text=function(t){return arguments.length?(m="function"==typeof t?t:$e(t),
e):m},e.textAnchor=function(t){return arguments.length?(_="function"==typeof t?t:$e(t),e):_},e.verticalAlign=function(t){return arguments.length?(w="function"==typeof t?t:$e(t),e):w},e.width=function(t){return arguments.length?(b="function"==typeof t?t:$e(t),e):b},e.x=function(t){return arguments.length?(x="function"==typeof t?t:$e(t),e):x},e.y=function(t){return arguments.length?(M="function"==typeof t?t:$e(t),e):M},t.length?e():e}var Qe="0.4.3",Ze="http://www.w3.org/1999/xhtml",tr={svg:"http://www.w3.org/2000/svg",xhtml:Ze,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},nr=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var er=document.documentElement;if(!er.matches){var rr=er.webkitMatchesSelector||er.msMatchesSelector||er.mozMatchesSelector||er.oMatchesSelector;nr=function(t){return function(){return rr.call(this,t)}}}}var ir=nr,or={},ur=null;if("undefined"!=typeof document){var ar=document.documentElement;"onmouseenter"in ar||(or={mouseenter:"mouseover",mouseleave:"mouseout"})}var sr="$";b.prototype={constructor:b,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Q.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lr=[null];St.prototype=Pt.prototype={constructor:St,select:p,selectAll:y,filter:v,data:w,enter:M,exit:A,merge:N,order:k,sort:E,call:P,nodes:C,node:q,size:z,empty:T,each:I,attr:D,style:H,property:K,classed:it,text:st,html:ht,raise:dt,lower:vt,append:wt,remove:xt,datum:Mt,on:c,dispatch:Et};var cr=("undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,{value:function(){}});zt.prototype=qt.prototype={constructor:zt,on:function(t,n){var e,r=this._,i=Tt(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error;for(;++o<u;)if(e=(t=i[o]).type)r[e]=Xt(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Xt(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=It(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new zt(t)},call:function(t,n){var e=arguments;if((r=arguments.length-2)>0)for(var r,i=new Array(r),o=0;r>o;++o)i[o]=e[o+2];this.apply(t,n,i)},apply:function(t,n,e){var r=this;if(!this._.hasOwnProperty(t))throw new Error;for(var i=r._[t],o=0,u=i.length;u>o;++o)i[o].value.apply(n,e)}};var fr,hr,pr=0,dr=0,yr=0,vr=1e3,gr=0,mr=0,_r=0,wr="object"==typeof performance?performance:Date,br="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};jt.prototype=Lt.prototype={constructor:jt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Ot():+e)+(null==n?0:+n),this._call||(hr?hr._next=this:fr=this,hr=this),this._call=t,this._time=e,Bt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bt())}};var xr=qt("start","end","interrupt"),Mr=[],Ar=0,Nr=1,kr=2,Er=3,Sr=4,Pr=5,Cr=.7,qr=1/Cr,zr=/^#([0-9a-f]{3})$/,Tr=/^#([0-9a-f]{6})$/,Ir=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,Xr=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Or=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Vr=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,jr=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Lr=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Rr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Qt(tn,nn,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Qt(an,un,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Qt(fn,cn,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new fn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new fn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(.5>e?e:1-e)*n,i=2*e-r;return new an(hn(t>=240?t-240:t+120,i,r),hn(t,i,r),hn(120>t?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Dr=Math.PI/180,$r=180/Math.PI,Yr=18,Br=.95047,Hr=1,Fr=1.08883,Ur=4/29,Wr=6/29,Kr=3*Wr*Wr,Gr=Wr*Wr*Wr;Qt(yn,dn,Zt(tn,{brighter:function(t){return new yn(this.l+Yr*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yn(this.l-Yr*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=Hr*gn(t),n=Br*gn(n),e=Fr*gn(e),new an(mn(3.2404542*n-1.5371385*t-.4985314*e),mn(-.969266*n+1.8760108*t+.041556*e),mn(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Qt(xn,bn,Zt(tn,{brighter:function(t){return new xn(this.h,this.c,this.l+Yr*(null==t?1:t),this.opacity)},darker:function(t){return new xn(this.h,this.c,this.l-Yr*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var Jr=-.14861,Qr=1.78277,Zr=-.29227,ti=-.90649,ni=1.97294,ei=ni*ti,ri=ni*Qr,ii=Qr*Zr-ti*Jr;Qt(Nn,An,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Dr,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new an(255*(n+e*(Jr*r+Qr*i)),255*(n+e*(Zr*r+ti*i)),255*(n+e*(ni*r)),this.opacity)}}));var oi,ui,ai,si,li=function Si(t){function n(t,n){var r=e((t=un(t)).r,(n=un(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=e(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var e=Cn(t);return n.gamma=Si,n}(1),ci=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fi=new RegExp(ci.source,"g"),hi=180/Math.PI,pi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},di=Ln(Vn,"px, ","px)","deg)"),yi=Ln(jn,", ",")",")");!function Pi(t){function n(n,e){var r=Pn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Pi,n}(1),function Ci(t){function n(n,e){var r=qn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Ci,n}(1);var vi=Pt.prototype.constructor,gi=0,mi=Pt.prototype;Ce.prototype=qe.prototype={constructor:Ce,select:ve,selectAll:ge,filter:le,merge:ce,selection:me,transition:Pe,call:mi.call,nodes:mi.nodes,node:mi.node,size:mi.size,empty:mi.empty,each:mi.each,on:pe,attr:Jn,attrTween:te,style:Me,styleTween:Ne,text:Se,remove:ye,tween:$n,delay:re,duration:ue,ease:se};var _i=3,wi=(function qi(t){function n(n){return Math.pow(n,t)}return t=+t,n.exponent=qi,n}(_i),function zi(t){function n(n){return 1-Math.pow(1-n,t)}return t=+t,n.exponent=zi,n}(_i),function Ti(t){function n(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,n.exponent=Ti,n}(_i),1.70158),bi=(function Ii(t){function n(n){return n*n*((t+1)*n-t)}return t=+t,n.overshoot=Ii,n}(wi),function Xi(t){function n(n){return--n*n*((t+1)*n+t)+1}return t=+t,n.overshoot=Xi,n}(wi),function Oi(t){function n(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return t=+t,n.overshoot=Oi,n}(wi),2*Math.PI),xi=1,Mi=.3,Ai=(function Vi(t,n){function e(e){return t*Math.pow(2,10*--e)*Math.sin((r-e)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Vi(t,n*bi)},e.period=function(n){return Vi(t,n)},e}(xi,Mi),function ji(t,n){function e(e){return 1-t*Math.pow(2,-10*(e=+e))*Math.sin((e+r)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return ji(t,n*bi)},e.period=function(n){return ji(t,n)},e}(xi,Mi),function Li(t,n){function e(e){return((e=2*e-1)<0?t*Math.pow(2,10*e)*Math.sin((r-e)/n):2-t*Math.pow(2,-10*e)*Math.sin((r+e)/n))/2}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Li(t,n*bi)},e.period=function(n){return Li(t,n)},e}(xi,Mi),{time:null,delay:0,duration:250,ease:Te});Pt.prototype.interrupt=Jt,Pt.prototype.transition=Xe;var Ni=(Ve(Oe),{max:Le,min:Re,select:Ct,sum:De,transition:qe}),ki=["-","/",";",":","&"],Ei=new RegExp("[^\\s\\"+ki.join("\\")+"]+\\"+ki.join("?\\")+"?","g");t.version=Qe,t.box=Je,t.width=Ye});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define("d3plus-text",["exports"],n):n(t.d3plus_text=t.d3plus_text||{})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),er.hasOwnProperty(n)?{space:er[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===nr&&n.documentElement.namespaceURI===nr?n.createElement(t):n.createElementNS(e,t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function o(t,n,e){return t=u(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function u(t,n,e){return function(r){var i=sr;sr=r;try{t.call(this,this.__data__,n,e)}finally{sr=i}}}function a(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function s(t){return function(){var n=this,e=this.__on;if(e){for(var r,i=0,o=-1,u=e.length;u>i;++i)r=e[i],t.type&&r.type!==t.type||r.name!==t.name?e[++o]=r:n.removeEventListener(r.type,r.listener,r.capture);++o?e.length=o:delete this.__on}}}function l(t,n,e){var r=ar.hasOwnProperty(t.type)?o:u;return function(i,o,u){var a,s=this,l=this.__on,c=r(n,o,u);if(l)for(var f=0,h=l.length;h>f;++f)if((a=l[f]).type===t.type&&a.name===t.name)return s.removeEventListener(a.type,a.listener,a.capture),s.addEventListener(a.type,a.listener=c,a.capture=e),void(a.value=n);this.addEventListener(t.type,c,e),a={type:t.type,name:t.name,value:n,listener:c,capture:e},l?l.push(a):this.__on=[a]}}function c(t,n,e){var r,i,o=this,u=a(t+""),c=u.length;if(!(arguments.length<2)){for(f=n?l:s,null==e&&(e=!1),r=0;c>r;++r)o.each(f(u[r],n,e));return this}var f=this.node().__on;if(f)for(var h,p=0,d=f.length;d>p;++p)for(r=0,h=f[p];c>r;++r)if((i=u[r]).type===h.type&&i.name===h.name)return h.value}function f(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function h(t){return function(){return this.querySelector(t)}}function p(t){var n=this;"function"!=typeof t&&(t=h(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a,s=e[o],l=s.length,c=i[o]=new Array(l),f=0;l>f;++f)(u=s[f])&&(a=t.call(u,u.__data__,f,s))&&("__data__"in u&&(a.__data__=u.__data__),c[f]=a);return new Et(i,this._parents)}function d(t){return function(){return this.querySelectorAll(t)}}function g(t){var n=this;"function"!=typeof t&&(t=d(t));for(var e=n._groups,r=e.length,i=[],o=[],u=0;r>u;++u)for(var a,s=e[u],l=s.length,c=0;l>c;++c)(a=s[c])&&(i.push(t.call(a,a.__data__,c,s)),o.push(a));return new Et(i,o)}function y(t){var n=this;"function"!=typeof t&&(t=ur(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new Et(i,this._parents)}function v(t){return function(){return t}}function m(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;l>a;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new b(t,o[a]);for(;s>a;++a)(u=n[a])&&(i[a]=u)}function _(t,n,e,r,i,o,u){var a,s,l,c={},f=n.length,h=o.length,p=new Array(f);for(a=0;f>a;++a)(s=n[a])&&(p[a]=l=cr+u.call(s,s.__data__,a,n),c[l]||(c[l]=s));for(a=0;h>a;++a)l=cr+u.call(t,o[a],a,o),(s=c[l])?s!==!0&&(r[a]=s,s.__data__=o[a]):e[a]=new b(t,o[a]),c[l]=!0;for(a=0;f>a;++a)(s=n[a])&&c[p[a]]!==!0&&(i[a]=s)}function w(t,n){if(!t)return p=new Array(this.size()),l=-1,this.each(function(t){p[++l]=t}),p;var e=n?_:m,r=this._parents,i=this._groups;"function"!=typeof t&&(t=v(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),l=0;o>l;++l){var c=r[l],f=i[l],h=f.length,p=t.call(c,c&&c.__data__,l,r),d=p.length,g=a[l]=new Array(d),y=u[l]=new Array(d),w=s[l]=new Array(h);e(c,f,g,y,w,p,n);for(var b,x,M=0,N=0;d>M;++M)if(b=g[M]){for(M>=N&&(N=M+1);!(x=y[N])&&++N<d;);b._next=x||null}}return u=new Et(u,r),u._enter=a,u._exit=s,u}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function x(t){return new Array(t.length)}function M(){return new Et(this._enter||this._groups.map(x),this._parents)}function N(){return new Et(this._exit||this._groups.map(x),this._parents)}function A(t){for(var n=this,e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new Et(a,this._parents)}function k(){for(var t=this,n=t._groups,e=-1,r=n.length;++e<r;)for(var i,o=n[e],u=o.length-1,a=o[u];--u>=0;)(i=o[u])&&(a&&a!==i.nextSibling&&a.parentNode.insertBefore(i,a),a=i);return this}function S(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}var e=this;t||(t=E);for(var r=e._groups,i=r.length,o=new Array(i),u=0;i>u;++u){for(var a,s=r[u],l=s.length,c=o[u]=new Array(l),f=0;l>f;++f)(a=s[f])&&(c[f]=a);c.sort(n)}return new Et(o,this._parents).order()}function E(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function P(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function C(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this,n=t._groups,e=0,r=n.length;r>e;++e)for(var i=n[e],o=0,u=i.length;u>o;++o){var a=i[o];if(a)return a}return null}function z(){var t=0;return this.each(function(){++t}),t}function T(){return!this.node()}function I(t){for(var n=this,e=n._groups,r=0,i=e.length;i>r;++r)for(var o,u=e[r],a=0,s=u.length;s>a;++a)(o=u[a])&&t.call(o,o.__data__,a,u);return this}function O(t){return function(){this.removeAttribute(t)}}function X(t){return function(){this.removeAttributeNS(t.space,t.local)}}function V(t,n){return function(){this.setAttribute(t,n)}}function j(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function L(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function D(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function H(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?X:O:"function"==typeof e?r.local?D:L:r.local?j:V)(r,e))}function R(t){return function(){this.style.removeProperty(t)}}function $(t,n,e){return function(){this.style.setProperty(t,n,e)}}function Y(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function F(t,n,e){var r;return arguments.length>1?this.each((null==n?R:"function"==typeof n?Y:$)(t,n,null==e?"":e)):f(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function B(t){return function(){delete this[t]}}function U(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function J(t,n){return arguments.length>1?this.each((null==n?B:"function"==typeof n?W:U)(t,n)):this.node()[t]}function K(t){return t.trim().split(/^|\s+/)}function G(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=K(t.getAttribute("class")||"")}function Z(t,n){for(var e=G(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function tt(t,n){for(var e=G(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function nt(t){return function(){Z(this,t)}}function et(t){return function(){tt(this,t)}}function rt(t,n){return function(){(n.apply(this,arguments)?Z:tt)(this,t)}}function it(t,n){var e=K(t+"");if(arguments.length<2){for(var r=G(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?rt:n?nt:et)(e,n))}function ot(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function st(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:ut)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ct(t){return function(){this.innerHTML=t}}function ft(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ft:ct)(t)):this.node().innerHTML}function pt(){this.parentNode.appendChild(this)}function dt(){return this.each(pt)}function gt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yt(){return this.each(gt)}function vt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function mt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function _t(){return null}function wt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?vt(e):mt(e,null==n?_t:"function"==typeof n?n:h(n)))}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){return this.each(bt)}function Mt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Nt(t,n,e){var r=f(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function At(t,n){return function(){return Nt(this,t,n)}}function kt(t,n){return function(){return Nt(this,t,n.apply(this,arguments))}}function St(t,n){return this.each(("function"==typeof n?kt:At)(t,n))}function Et(t,n){this._groups=t,this._parents=n}function Pt(){return new Et([[document.documentElement]],fr)}function Ct(t){return"string"==typeof t?new Et([[document.querySelector(t)]],[document.documentElement]):new Et([[t]],fr)}function qt(){for(var t,n=arguments,e=0,r=n.length,i={};r>e;++e){if(!(t=n[e]+"")||t in i)throw new Error;i[t]=[]}return new zt(i)}function zt(t){this._=t}function Tt(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error;return{type:t,name:e}})}function It(t,n){for(var e,r=0,i=t.length;i>r;++r)if((e=t[r]).name===n)return e.value}function Ot(t,n,e){for(var r=0,i=t.length;i>r;++r)if(t[r].name===n){t[r]=hr,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Xt(){return wr||(Mr(Vt),wr=xr.now()+br)}function Vt(){wr=0}function jt(){this._call=this._time=this._next=null}function Lt(t,n,e){var r=new jt;return r.restart(t,n,e),r}function Dt(){Xt(),++gr;for(var t,n=pr;n;)(t=wr-n._time)>=0&&n._call.call(null,t),n=n._next;--gr}function Ht(t){wr=(_r=t||xr.now())+br,gr=yr=0;try{Dt()}finally{gr=0,$t(),wr=0}}function Rt(){var t=xr.now(),n=t-_r;n>mr&&(br-=n,_r=t)}function $t(){for(var t,n=pr,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:pr=n._next;dr=t,Yt(e)}function Yt(t){if(!gr){yr&&(yr=clearTimeout(yr));var n=t-wr;n>24?(1/0>t&&(yr=setTimeout(Ht,n)),vr&&(vr=clearInterval(vr))):(vr||(vr=setInterval(Rt,mr)),gr=1,Mr(Ht))}}function Ft(t,n,e){var r=new jt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function Bt(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};Kt(t,e,{name:n,index:r,group:i,on:Nr,tween:Ar,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:kr})}function Ut(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>kr)throw new Error("too late");return e}function Wt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Er)throw new Error("too late");return e}function Jt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function Kt(t,n,e){function r(t){e.state=Sr,e.delay<=t?i(t-e.delay):e.timer.restart(i,e.delay,e.time)}function i(r){var i,s,l,c;for(i in a)c=a[i],c.name===e.name&&(c.state===Pr?(c.state=qr,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete a[i]):n>+i&&(c.state=qr,c.timer.stop(),delete a[i]));if(Ft(function(){e.state===Pr&&(e.timer.restart(o,e.delay,e.time),o(r))}),e.state=Er,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Er){for(e.state=Pr,u=new Array(l=e.tween.length),i=0,s=-1;l>i;++i)(c=e.tween[i].value.call(t,t.__data__,e.index,e.group))&&(u[++s]=c);u.length=s+1}}function o(r){for(var i=r<e.duration?e.ease.call(null,r/e.duration):(e.state=Cr,1),o=-1,s=u.length;++o<s;)u[o].call(null,i);if(e.state===Cr){e.state=qr,e.timer.stop(),e.on.call("end",t,t.__data__,e.index,e.group);for(o in a)if(+o!==n)return void delete a[n];delete t.__transition}}var u,a=t.__transition;a[n]=e,e.timer=Lt(r,0,e.time)}function Gt(t){return t=null==t?null:t+"",this.each(function(){var n,e,r,i=this.__transition,o=!0;if(i){for(r in i)(n=i[r]).name===t?(e=n.state===Pr,n.state=qr,n.timer.stop(),e&&n.on.call("interrupt",this,this.__data__,n.index,n.group),delete i[r]):o=!1;o&&delete this.__transition}})}function Qt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Zt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function tn(){}function nn(t){var n;return t=(t+"").trim().toLowerCase(),(n=Ir.exec(t))?(n=parseInt(n[1],16),new an(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Or.exec(t))?en(parseInt(n[1],16)):(n=Xr.exec(t))?new an(n[1],n[2],n[3],1):(n=Vr.exec(t))?new an(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=jr.exec(t))?rn(n[1],n[2],n[3],n[4]):(n=Lr.exec(t))?rn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Dr.exec(t))?sn(n[1],n[2]/100,n[3]/100,1):(n=Hr.exec(t))?sn(n[1],n[2]/100,n[3]/100,n[4]):Rr.hasOwnProperty(t)?en(Rr[t]):"transparent"===t?new an(NaN,NaN,NaN,0):null}function en(t){return new an(t>>16&255,t>>8&255,255&t,1)}function rn(t,n,e,r){return 0>=r&&(t=n=e=NaN),new an(t,n,e,r)}function on(t){return t instanceof tn||(t=nn(t)),t?(t=t.rgb(),new an(t.r,t.g,t.b,t.opacity)):new an}function un(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}function an(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function sn(t,n,e,r){return 0>=r?t=n=e=NaN:0>=e||e>=1?t=n=NaN:0>=n&&(t=NaN),new fn(t,n,e,r)}function ln(t){if(t instanceof fn)return new fn(t.h,t.s,t.l,t.opacity);if(t instanceof tn||(t=nn(t)),!t)return new fn;if(t instanceof fn)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(r>e):e===o?(r-n)/a+2:(n-e)/a+4,a/=.5>s?o+i:2-o-i,u*=60):a=s>0&&1>s?0:u,new fn(u,a,s,t.opacity)}function cn(t,n,e,r){return 1===arguments.length?ln(t):new fn(t,n,e,null==r?1:r)}function fn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function hn(t,n,e){return 255*(60>t?n+(e-n)*t/60:180>t?e:240>t?n+(e-n)*(240-t)/60:n)}function pn(t){if(t instanceof gn)return new gn(t.l,t.a,t.b,t.opacity);if(t instanceof xn){var n=t.h*$r;return new gn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof an||(t=on(t));var e=_n(t.r),r=_n(t.g),i=_n(t.b),o=yn((.4124564*e+.3575761*r+.1804375*i)/Br),u=yn((.2126729*e+.7151522*r+.072175*i)/Ur),a=yn((.0193339*e+.119192*r+.9503041*i)/Wr);return new gn(116*u-16,500*(o-u),200*(u-a),t.opacity)}function dn(t,n,e,r){return 1===arguments.length?pn(t):new gn(t,n,e,null==r?1:r)}function gn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function yn(t){return t>Qr?Math.pow(t,1/3):t/Gr+Jr}function vn(t){return t>Kr?t*t*t:Gr*(t-Jr)}function mn(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _n(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wn(t){if(t instanceof xn)return new xn(t.h,t.c,t.l,t.opacity);t instanceof gn||(t=pn(t));var n=Math.atan2(t.b,t.a)*Yr;return new xn(0>n?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bn(t,n,e,r){return 1===arguments.length?wn(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Mn(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);t instanceof an||(t=on(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(ui*r+ii*n-oi*e)/(ui+ii-oi),o=r-i,u=(ri*(e-i)-ni*o)/ei,a=Math.sqrt(u*u+o*o)/(ri*i*(1-i)),s=a?Math.atan2(u,o)*Yr-120:NaN;return new An(0>s?s+360:s,a,i,t.opacity)}function Nn(t,n,e,r){return 1===arguments.length?Mn(t):new An(t,n,e,null==r?1:r)}function An(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function kn(t){return function(){return t}}function Sn(t,n){return function(e){return t+e*n}}function En(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Pn(t,n){var e=n-t;return e?Sn(t,e>180||-180>e?e-360*Math.round(e/360):e):kn(isNaN(t)?n:t)}function Cn(t){return 1===(t=+t)?qn:function(n,e){return e-n?En(n,e,t):kn(isNaN(n)?e:n)}}function qn(t,n){var e=n-t;return e?Sn(t,e):kn(isNaN(t)?n:t)}function zn(t,n){return t=+t,n-=t,function(e){return t+n*e}}function Tn(t){return function(){return t}}function In(t){return function(n){return t(n)+""}}function On(t,n){var e,r,i,o=hi.lastIndex=pi.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=hi.exec(t))&&(r=pi.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,s.push({i:u,x:zn(e,r)})),o=pi.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?In(s[0].x):Tn(n):(n=s.length,function(t){for(var e,r=0;n>r;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})}function Xn(t,n,e,r,i,o){if(t*r===n*e)return null;var u=Math.sqrt(t*t+n*n);t/=u,n/=u;var a=t*e+n*r;e-=t*a,r-=n*a;var s=Math.sqrt(e*e+r*r);return e/=s,r/=s,a/=s,n*e>t*r&&(t=-t,n=-n,a=-a,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*di,skewX:Math.atan(a)*di,scaleX:u,scaleY:s}}function Vn(t){if("none"===t)return gi;ai||(ai=document.createElement("DIV"),si=document.documentElement,li=document.defaultView),ai.style.transform=t,t=li.getComputedStyle(si.appendChild(ai),null).getPropertyValue("transform"),si.removeChild(ai);var n=t.slice(7,-1).split(",");return Xn(+n[0],+n[1],+n[2],+n[3],+n[4],+n[5])}function jn(t){ci||(ci=document.createElementNS("http://www.w3.org/2000/svg","g")),ci.setAttribute("transform",null==t?"":t);var n=ci.transform.baseVal.consolidate().matrix;return Xn(n.a,n.b,n.c,n.d,n.e,n.f)}function Ln(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}function o(t,r,i,o,u,a){if(t!==i||r!==o){var s=u.push("translate(",null,n,null,e);a.push({i:s-4,x:zn(t,i)},{i:s-2,x:zn(r,o)})}else(i||o)&&u.push("translate("+i+n+o+e)}function u(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:zn(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function a(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:zn(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function s(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:zn(t,e)},{i:a-2,x:zn(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),u(n.rotate,e.rotate,r,i),a(n.skewX,e.skewX,r,i),s(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e<o;)r[(n=i[e]).i]=n.x(t);return r.join("")}}}function Dn(t,n){var e,r;return function(){var i=Wt(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;a>u;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function Hn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Wt(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;l>s;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function Rn(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Jt(this.node(),e).tween,o=0,u=i.length;u>o;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Dn:Hn)(e,t,n))}function $n(t,n,e){var r=t._id;return t.each(function(){var t=Wt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Jt(t,r).value[n]}}function Yn(t,n){var e;return("number"==typeof n?zn:n instanceof nn?fi:(e=nn(n))?(n=e,fi):On)(t,n)}function Fn(t){return function(){this.removeAttribute(t)}}function Bn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Un(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function Wn(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function Jn(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttribute(t):(u=this.getAttribute(t),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function Kn(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttributeNS(t.space,t.local):(u=this.getAttributeNS(t.space,t.local),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function Gn(t,e){var r=n(t),i="transform"===r?vi:Yn;return this.attrTween(t,"function"==typeof e?(r.local?Kn:Jn)(r,i,$n(this,"attr."+t,e)):null==e?(r.local?Bn:Fn)(r):(r.local?Wn:Un)(r,i,e))}function Qn(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function Zn(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}function te(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n(t);return this.tween(r,(i.local?Qn:Zn)(i,e))}function ne(t,n){return function(){Ut(this,t).delay=+n.apply(this,arguments)}}function ee(t,n){return n=+n,function(){Ut(this,t).delay=n}}function re(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ne:ee)(n,t)):Jt(this.node(),n).delay}function ie(t,n){return function(){Wt(this,t).duration=+n.apply(this,arguments)}}function oe(t,n){return n=+n,function(){Wt(this,t).duration=n}}function ue(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ie:oe)(n,t)):Jt(this.node(),n).duration}function ae(t,n){if("function"!=typeof n)throw new Error;return function(){Wt(this,t).ease=n}}function se(t){var n=this._id;return arguments.length?this.each(ae(n,t)):Jt(this.node(),n).ease}function le(t){var n=this;"function"!=typeof t&&(t=ur(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new Ce(i,this._parents,this._name,this._id)}function ce(t){var n=this;if(t._id!==this._id)throw new Error;for(var e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new Ce(a,this._parents,this._name,this._id)}function fe(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}function he(t,n,e){var r,i,o=fe(n)?Ut:Wt;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function pe(t,n){var e=this._id;return arguments.length<2?Jt(this.node(),e).on.on(t):this.each(he(e,t,n))}function de(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function ge(){return this.on("end.remove",de(this._id))}function ye(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=h(t));for(var i=n._groups,o=i.length,u=new Array(o),a=0;o>a;++a)for(var s,l,c=i[a],f=c.length,p=u[a]=new Array(f),d=0;f>d;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),p[d]=l,Bt(p[d],e,r,d,p,Jt(s,r)));return new Ce(u,this._parents,e,r)}function ve(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=d(t));for(var i=n._groups,o=i.length,u=[],a=[],s=0;o>s;++s)for(var l,c=i[s],f=c.length,h=0;f>h;++h)if(l=c[h]){for(var p,g=t.call(l,l.__data__,h,c),y=Jt(l,r),v=0,m=g.length;m>v;++v)(p=g[v])&&Bt(p,e,r,v,g,y);u.push(g),a.push(l)}return new Ce(u,a,e,r)}function me(){return new mi(this._groups,this._parents)}function _e(t,n){var e,r,i;return function(){var o=f(this).getComputedStyle(this,null),u=o.getPropertyValue(t),a=(this.style.removeProperty(t),o.getPropertyValue(t));return u===a?null:u===e&&a===r?i:i=n(e=u,r=a)}}function we(t){return function(){this.style.removeProperty(t)}}function be(t,n,e){var r,i;return function(){var o=f(this).getComputedStyle(this,null).getPropertyValue(t);return o===e?null:o===r?i:i=n(r=o,e)}}function xe(t,n,e){var r,i,o;return function(){var u=f(this).getComputedStyle(this,null),a=u.getPropertyValue(t),s=e(this);return null==s&&(this.style.removeProperty(t),s=u.getPropertyValue(t)),a===s?null:a===r&&s===i?o:o=n(r=a,i=s)}}function Me(t,n,e){var r="transform"==(t+="")?yi:Yn;return null==n?this.styleTween(t,_e(t,r)).on("end.style."+t,we(t)):this.styleTween(t,"function"==typeof n?xe(t,r,$n(this,"style."+t,n)):be(t,r,n),e)}function Ne(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function Ae(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,Ne(t,n,null==e?"":e))}function ke(t){return function(){this.textContent=t}}function Se(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Ee(t){return this.tween("text","function"==typeof t?Se($n(this,"text",t)):ke(null==t?"":t+""))}function Pe(){for(var t=this,n=this._name,e=this._id,r=ze(),i=t._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)if(a=s[c]){var f=Jt(a,e);Bt(a,n,r,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ce(i,this._parents,n,r)}function Ce(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function qe(t){return Pt().transition(t)}function ze(){return++_i}function Te(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Ie(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return ki.time=Xt(),ki;return e}function Oe(t){var n,e,r=this;t instanceof Ce?(n=t._id,t=t._name):(n=ze(),(e=ki).time=Xt(),t=null==t?null:t+"");for(var i=r._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)(a=s[c])&&Bt(a,t,n,c,s,e||Ie(a,n));return new Ce(i,this._parents,t,n)}function Xe(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function Ve(t){return 1===t.length&&(t=je(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function je(t){return function(n,e){return Xe(t(n),e)}}function Le(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&r>e&&(e=r)}return e}function De(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&e>r&&(e=r)}return e}function He(t,n){var e,r=0,i=t.length,o=-1;if(null==n)for(;++o<i;)(e=+t[o])&&(r+=e);else for(;++o<i;)(e=+n(t[o],o,t))&&(r+=e);return r}function Re(t){return function(){return t}}function $e(t){return void 0===t?t="undefined":"string"==typeof t||t instanceof String||(t=JSON.stringify(t)),t}function Ye(t){return $e(t).match(Ei)}function Fe(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),r=[];if("font-style"in n&&r.push(n["font-style"]),"font-variant"in n&&r.push(n["font-variant"]),"font-weight"in n&&r.push(n["font-weight"]),"font-size"in n){var i=n["font-size"]+"px";"line-height"in n&&(i+="/"+n["line-height"]+"px"),r.push(i)}return"font-family"in n&&r.push(n["font-family"]),e.font=r.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function Be(){function t(t){t=$e(t),void 0===n&&(n=Math.ceil(1.1*r));for(var s=u(t),l={"font-family":e,"font-size":r,"line-height":n},c=1,f="",h=!1,p=0,d=[""],g=Fe(s,l),y=Fe(" ",l),v=0;v<s.length;v++){var m=s[v],_=t.charAt(f.length+m.length),w=g[s.indexOf(m)];if(" "===_&&(m+=_),p+w>a-r){if(d[c-1]=d[c-1].trimRight(),c++,n*c>i||w>a&&!o){h=!0;break}p=0,d.push(m)}else d[c-1]+=m;f+=m,p+=w," "===_&&(p+=y)}return{lines:d,sentence:t,truncated:h}}var n,e="sans-serif",r=10,i=200,o=!1,u=Ye,a=200;return t.fontFamily=function(n){return arguments.length?(e=n,t):e},t.fontSize=function(n){return arguments.length?(r=n,t):r},t.height=function(n){return arguments.length?(i=n,t):i},t.lineHeight=function(e){return arguments.length?(n=e,t):n},t.overflow=function(n){return arguments.length?(o=n,t):o},t.split=function(n){return arguments.length?(u=n,t):u},t.width=function(n){return arguments.length?(a=n,t):a},t}function Ue(t){return t.height||200}function We(t,n){return t.id||""+n}function Je(t){return t.text}function Ke(t){return t.width||200}function Ge(t){return t.x||0}function Qe(t){return t.y||0}function Ze(t){function n(t){return t+"..."}function e(n){void 0===o&&e.select(Pi.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===i&&(i=Re(Math.ceil(1.1*p())));var N=o.selectAll(".d3plus-text-box").data(t,g);return N.exit().remove(),N.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+g(t,n)}).merge(N).attr("y",function(t,n){return M(t,n)+"px"}).attr("fill",function(t,n){return r(t,n)}).attr("text-anchor",function(t,n){return _(t,n)}).attr("font-family",function(t,n){return l(t,n)}).each(function(t,n){function e(){if(P>M)return void(k=[]);M>E&&(M=E),g&&(N=1.1*M,V.fontSize(M).lineHeight(N),S["font-size"]=M,S["line-height"]=N);var t=V(q);k=t.lines,A=k.length+1,t.truncated&&(g?(M--,P>M?k=[]:e()):2!==A||k[A-2].length?k[A-2]=s(k[A-2]):k=[])}function r(e){e.text(function(t){return t.trimRight()}).attr("x",x(t,n)+"px").attr("dx",X+"px").attr("dy",N+"px")}var o,g=h(t,n),M=g?c(t,n):p(t,n),N=g?1.1*M:i(t,n),A=1,k=[""],S={"font-family":l(t,n),"font-size":M,"line-height":N},E=c(t,n),P=f(t,n),C=d(t,n),q=m(t,n),z=_(t,n),T=w(t,n),I=b(t,n),O=v(q,n),X="start"===z?0:"end"===z?I:I/2,V=Be().fontFamily(S["font-family"]).fontSize(M).lineHeight(N).height(C).overflow(y(t,n)).width(I);if(C>N||g){if(g){o=Fe(O,S);var j=1.165+I/C*.1,L=I*C,D=Pi.max(o),H=Pi.sum(o,function(t){return t*N})*j;if(D>I||H>L){var R=Math.sqrt(L/H),$=I/D,Y=Pi.min([R,$]);M=Math.floor(M*Y)}var F=Math.floor(.8*C);M>F&&(M=F)}e(),Pi.select(this).attr("font-size",M+"px").style("font-size",M+"px")}var B=A*N,U="top"===T?0:"middle"===T?C/2-B/2:C-B;U-=.2*N,Pi.select(this).transition().duration(a).attr("transform","translate(0,"+U+")");var W=Pi.select(this).selectAll("tspan").data(k);W.transition().duration(a).call(r),W.exit().transition().duration(a).attr("opacity",0).remove(),W.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(r).transition().duration(a).delay(u).attr("opacity",1)}),n&&setTimeout(n,a+100),e}void 0===t&&(t=[]);var r,i,o,u=0,a=0,s=n,l=Re("sans-serif"),c=Re(50),f=Re(8),h=Re(!1),p=Re(10),d=Ue,g=We,y=Re(!1),v=Ye,m=Je,_=Re("start"),w=Re("top"),b=Ke,x=Ge,M=Qe;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(u=t,e):u},e.duration=function(t){return arguments.length?(a=t,e):a},e.ellipsis=function(t){return arguments.length?(s="function"==typeof t?t:Re(t),e):s},e.fontColor=function(t){return arguments.length?(r="function"==typeof t?t:Re(t),e):r},e.fontFamily=function(t){return arguments.length?(l="function"==typeof t?t:Re(t),e):l},e.fontMax=function(t){return arguments.length?(c="function"==typeof t?t:Re(t),
e):c},e.fontMin=function(t){return arguments.length?(f="function"==typeof t?t:Re(t),e):f},e.fontResize=function(t){return arguments.length?(h="function"==typeof t?t:Re(t),e):h},e.fontSize=function(t){return arguments.length?(p="function"==typeof t?t:Re(t),e):p},e.height=function(t){return arguments.length?(d="function"==typeof t?t:Re(t),e):d},e.id=function(t){return arguments.length?(g="function"==typeof t?t:Re(t),e):g},e.lineHeight=function(t){return arguments.length?(i="function"==typeof t?t:Re(t),e):i},e.overflow=function(t){return arguments.length?(y="function"==typeof t?t:Re(t),e):y},e.select=function(t){return arguments.length?(o=Pi.select(t),void 0===r&&e.fontColor(o.style("font-color")),void 0===l&&e.fontFamily(o.style("font-family")),void 0===p&&e.fontSize(parseFloat(o.style("font-size"),10)),e):o},e.split=function(t){return arguments.length?(v=t,e):v},e.text=function(t){return arguments.length?(m="function"==typeof t?t:Re(t),e):m},e.textAnchor=function(t){return arguments.length?(_="function"==typeof t?t:Re(t),e):_},e.verticalAlign=function(t){return arguments.length?(w="function"==typeof t?t:Re(t),e):w},e.width=function(t){return arguments.length?(b="function"==typeof t?t:Re(t),e):b},e.x=function(t){return arguments.length?(x="function"==typeof t?t:Re(t),e):x},e.y=function(t){return arguments.length?(M="function"==typeof t?t:Re(t),e):M},t.length?e():e}var tr="0.4.4",nr="http://www.w3.org/1999/xhtml",er={svg:"http://www.w3.org/2000/svg",xhtml:nr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},rr=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var ir=document.documentElement;if(!ir.matches){var or=ir.webkitMatchesSelector||ir.msMatchesSelector||ir.mozMatchesSelector||ir.oMatchesSelector;rr=function(t){return function(){return or.call(this,t)}}}}var ur=rr,ar={},sr=null;if("undefined"!=typeof document){var lr=document.documentElement;"onmouseenter"in lr||(ar={mouseenter:"mouseover",mouseleave:"mouseout"})}var cr="$";b.prototype={constructor:b,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Q.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var fr=[null];Et.prototype=Pt.prototype={constructor:Et,select:p,selectAll:g,filter:y,data:w,enter:M,exit:N,merge:A,order:k,sort:S,call:P,nodes:C,node:q,size:z,empty:T,each:I,attr:H,style:F,property:J,classed:it,text:st,html:ht,raise:dt,lower:yt,append:wt,remove:xt,datum:Mt,on:c,dispatch:St};var hr=("undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,{value:function(){}});zt.prototype=qt.prototype={constructor:zt,on:function(t,n){var e,r=this._,i=Tt(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error;for(;++o<u;)if(e=(t=i[o]).type)r[e]=Ot(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Ot(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=It(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new zt(t)},call:function(t,n){var e=arguments;if((r=arguments.length-2)>0)for(var r,i=new Array(r),o=0;r>o;++o)i[o]=e[o+2];this.apply(t,n,i)},apply:function(t,n,e){var r=this;if(!this._.hasOwnProperty(t))throw new Error;for(var i=r._[t],o=0,u=i.length;u>o;++o)i[o].value.apply(n,e)}};var pr,dr,gr=0,yr=0,vr=0,mr=1e3,_r=0,wr=0,br=0,xr="object"==typeof performance?performance:Date,Mr="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};jt.prototype=Lt.prototype={constructor:jt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Xt():+e)+(null==n?0:+n),this._call||(dr?dr._next=this:pr=this,dr=this),this._call=t,this._time=e,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}};var Nr=qt("start","end","interrupt"),Ar=[],kr=0,Sr=1,Er=2,Pr=3,Cr=4,qr=5,zr=.7,Tr=1/zr,Ir=/^#([0-9a-f]{3})$/,Or=/^#([0-9a-f]{6})$/,Xr=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,Vr=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,jr=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Lr=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Dr=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Hr=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Rr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Qt(tn,nn,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Qt(an,un,Zt(tn,{brighter:function(t){return t=null==t?Tr:Math.pow(Tr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?zr:Math.pow(zr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Qt(fn,cn,Zt(tn,{brighter:function(t){return t=null==t?Tr:Math.pow(Tr,t),new fn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?zr:Math.pow(zr,t),new fn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(.5>e?e:1-e)*n,i=2*e-r;return new an(hn(t>=240?t-240:t+120,i,r),hn(t,i,r),hn(120>t?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var $r=Math.PI/180,Yr=180/Math.PI,Fr=18,Br=.95047,Ur=1,Wr=1.08883,Jr=4/29,Kr=6/29,Gr=3*Kr*Kr,Qr=Kr*Kr*Kr;Qt(gn,dn,Zt(tn,{brighter:function(t){return new gn(this.l+Fr*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new gn(this.l-Fr*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=Ur*vn(t),n=Br*vn(n),e=Wr*vn(e),new an(mn(3.2404542*n-1.5371385*t-.4985314*e),mn(-.969266*n+1.8760108*t+.041556*e),mn(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Qt(xn,bn,Zt(tn,{brighter:function(t){return new xn(this.h,this.c,this.l+Fr*(null==t?1:t),this.opacity)},darker:function(t){return new xn(this.h,this.c,this.l-Fr*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var Zr=-.14861,ti=1.78277,ni=-.29227,ei=-.90649,ri=1.97294,ii=ri*ei,oi=ri*ti,ui=ti*ni-ei*Zr;Qt(An,Nn,Zt(tn,{brighter:function(t){return t=null==t?Tr:Math.pow(Tr,t),new An(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?zr:Math.pow(zr,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*$r,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new an(255*(n+e*(Zr*r+ti*i)),255*(n+e*(ni*r+ei*i)),255*(n+e*(ri*r)),this.opacity)}}));var ai,si,li,ci,fi=function Ci(t){function n(t,n){var r=e((t=un(t)).r,(n=un(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=e(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var e=Cn(t);return n.gamma=Ci,n}(1),hi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pi=new RegExp(hi.source,"g"),di=180/Math.PI,gi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},yi=Ln(Vn,"px, ","px)","deg)"),vi=Ln(jn,", ",")",")");!function qi(t){function n(n,e){var r=Pn((n=Nn(n)).h,(e=Nn(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=qi,n}(1),function zi(t){function n(n,e){var r=qn((n=Nn(n)).h,(e=Nn(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=zi,n}(1);var mi=Pt.prototype.constructor,_i=0,wi=Pt.prototype;Ce.prototype=qe.prototype={constructor:Ce,select:ye,selectAll:ve,filter:le,merge:ce,selection:me,transition:Pe,call:wi.call,nodes:wi.nodes,node:wi.node,size:wi.size,empty:wi.empty,each:wi.each,on:pe,attr:Gn,attrTween:te,style:Me,styleTween:Ae,text:Ee,remove:ge,tween:Rn,delay:re,duration:ue,ease:se};var bi=3,xi=(function Ti(t){function n(n){return Math.pow(n,t)}return t=+t,n.exponent=Ti,n}(bi),function Ii(t){function n(n){return 1-Math.pow(1-n,t)}return t=+t,n.exponent=Ii,n}(bi),function Oi(t){function n(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,n.exponent=Oi,n}(bi),1.70158),Mi=(function Xi(t){function n(n){return n*n*((t+1)*n-t)}return t=+t,n.overshoot=Xi,n}(xi),function Vi(t){function n(n){return--n*n*((t+1)*n+t)+1}return t=+t,n.overshoot=Vi,n}(xi),function ji(t){function n(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return t=+t,n.overshoot=ji,n}(xi),2*Math.PI),Ni=1,Ai=.3,ki=(function Li(t,n){function e(e){return t*Math.pow(2,10*--e)*Math.sin((r-e)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Mi);return e.amplitude=function(t){return Li(t,n*Mi)},e.period=function(n){return Li(t,n)},e}(Ni,Ai),function Di(t,n){function e(e){return 1-t*Math.pow(2,-10*(e=+e))*Math.sin((e+r)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Mi);return e.amplitude=function(t){return Di(t,n*Mi)},e.period=function(n){return Di(t,n)},e}(Ni,Ai),function Hi(t,n){function e(e){return((e=2*e-1)<0?t*Math.pow(2,10*e)*Math.sin((r-e)/n):2-t*Math.pow(2,-10*e)*Math.sin((r+e)/n))/2}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Mi);return e.amplitude=function(t){return Hi(t,n*Mi)},e.period=function(n){return Hi(t,n)},e}(Ni,Ai),{time:null,delay:0,duration:250,ease:Te});Pt.prototype.interrupt=Gt,Pt.prototype.transition=Oe;var Si=(Ve(Xe),["-","/",";",":","&"]),Ei=new RegExp("[^\\s\\"+Si.join("\\")+"]+\\"+Si.join("?\\")+"?","g"),Pi={max:Le,min:De,select:Ct,sum:He,transition:qe};t.version=tr,t.box=Ze,t.split=Ye,t.stringify=$e,t.width=Fe,t.wrap=Be});

@@ -7,3 +7,3 @@ (function (global, factory) {

var version = "0.4.3";
var version = "0.4.4";

@@ -21,3 +21,25 @@ /**

/**
@function stringify
@desc Coerces value into a String.
@param {String} value
*/
function stringify(value) {
if (value === void 0) value = "undefined";
else if (!(typeof value === "string" || value instanceof String)) value = JSON.stringify(value);
return value;
}
var splitChars = ["-", "/", ";", ":", "&"];
var splitRegex = new RegExp(("[^\\s\\" + (splitChars.join("\\")) + "]+\\" + (splitChars.join("?\\")) + "?"), "g");
/**
@function width
@desc Splits a given sentence into an array of words.
@param {String} sentence
*/
function defaultSplit(sentence) {
return stringify(sentence).match(splitRegex);
}
/**
@function width
@desc Given a text string, returns the predicted pixel width of the string when placed into DOM.

@@ -51,2 +73,138 @@ @param {String|Array} text Can be either a single string or an array of strings to analyze.

/**
@function wrap
@desc Based on the defined styles and dimensions, breaks a string into an array of strings for each line of text.
*/
function wrap() {
var fontFamily = "sans-serif",
fontSize = 10,
height = 200,
lineHeight,
overflow = false,
split = defaultSplit,
width = 200;
/**
The inner return object and wraps the text and returns the line data array.
@private
*/
function wrap(sentence) {
sentence = stringify(sentence);
if (lineHeight === void 0) lineHeight = Math.ceil(fontSize * 1.1);
var words = split(sentence);
var style = {
"font-family": fontFamily,
"font-size": fontSize,
"line-height": lineHeight
};
var line = 1,
textProg = "",
truncated = false,
widthProg = 0;
var lineData = [""],
sizes = measure(words, style),
space = measure(" ", style);
for (var i = 0; i < words.length; i++) {
var word = words[i];
var nextChar = sentence.charAt(textProg.length + word.length),
wordWidth = sizes[words.indexOf(word)];
if (nextChar === " ") word += nextChar;
if (widthProg + wordWidth > width - fontSize) {
lineData[line - 1] = lineData[line - 1].trimRight();
line++;
if (lineHeight * line > height || wordWidth > width && !overflow) {
truncated = true;
break;
}
widthProg = 0;
lineData.push(word);
}
else lineData[line - 1] += word;
textProg += word;
widthProg += wordWidth;
if (nextChar === " ") widthProg += space;
}
return {
"lines": lineData,
sentence: sentence, truncated: truncated
};
}
/**
@memberof wrap
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family.
@param {Function|String} [*value*]
*/
wrap.fontFamily = function(_) {
return arguments.length ? (fontFamily = _, wrap) : fontFamily;
};
/**
@memberof wrap
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size.
@param {Function|Number} [*value*]
*/
wrap.fontSize = function(_) {
return arguments.length ? (fontSize = _, wrap) : fontSize;
};
/**
@memberof wrap
@desc If *value* is specified, sets height limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
@param {Number} [*value* = 200]
*/
wrap.height = function(_) {
return arguments.length ? (height = _, wrap) : height;
};
/**
@memberof wrap
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#wrap.fontSize) by default.
@param {Function|Number} [*value*]
*/
wrap.lineHeight = function(_) {
return arguments.length ? (lineHeight = _, wrap) : lineHeight;
};
/**
@memberof wrap
@desc If *value* is specified, sets the overflow to the specified boolean and returns this generator. If *value* is not specified, returns the current overflow value.
@param {Boolean} [*value* = false]
*/
wrap.overflow = function(_) {
return arguments.length ? (overflow = _, wrap) : overflow;
};
/**
@memberof wrap
@desc If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.
@param {Function} [*value*] A function that, when passed a string, is expected to return that string split into an array of words to wrap. The default split function splits strings on the following characters: `-`, `/`, `;`, `:`, `&`
*/
wrap.split = function(_) {
return arguments.length ? (split = _, wrap) : split;
};
/**
@memberof wrap
@desc If *value* is specified, sets width limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
@param {Number} [*value* = 200]
*/
wrap.width = function(_) {
return arguments.length ? (width = _, wrap) : width;
};
return wrap;
}
var d3 = {

@@ -76,13 +234,3 @@ "max": d3Array.max,

var splitChars = ["-", "/", ";", ":", "&"];
var splitRegex = new RegExp(("[^\\s\\" + (splitChars.join("\\")) + "]+\\" + (splitChars.join("?\\")) + "?"), "g");
/**
The default word split function.
@private
*/
function boxSplit(_) {
return _.match(splitRegex);
}
/**
The default text accessor function.

@@ -122,3 +270,3 @@ @private

@function box
@desc Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this box generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.
@desc Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.
@param {Array} [data = []]

@@ -159,7 +307,7 @@ @example <caption>a sample row of data</caption>

fontColor,
fontFamily,
fontFamily = constant("sans-serif"),
fontMax = constant(50),
fontMin = constant(8),
fontResize = constant(false),
fontSize,
fontSize = constant(10),
height = boxHeight,

@@ -170,3 +318,3 @@ id = boxId,

select,
split = boxSplit,
split = defaultSplit,
text = boxText,

@@ -219,4 +367,2 @@ textAnchor = constant("start"),

h = height(d, i),
oF = overflow(d, i),
space = measure(" ", style),
t = text(d, i),

@@ -230,2 +376,10 @@ tA = textAnchor(d, i),

var wrapper = wrap()
.fontFamily(style["font-family"])
.fontSize(fS)
.lineHeight(lH)
.height(h)
.overflow(overflow(d, i))
.width(w);
/**

@@ -237,5 +391,2 @@ Figures out the lineData to be used for wrapping.

line = 1;
lineData = [""];
if (fS < fMin) {

@@ -247,7 +398,7 @@ lineData = [];

var textProg = "",
widthProg = 0;
if (resize) {
lH = fS * 1.1;
wrapper
.fontSize(fS)
.lineHeight(lH);
style["font-size"] = fS;

@@ -257,33 +408,17 @@ style["line-height"] = lH;

sizes = measure(words, style);
var wrapResults = wrapper(t);
lineData = wrapResults.lines;
line = lineData.length + 1;
for (var i = 0; i < words.length; i++) {
var word = words[i];
var nextChar = t.charAt(textProg.length + word.length),
wordWidth = sizes[words.indexOf(word)];
if (nextChar === " ") word += nextChar;
if (widthProg + wordWidth > w - fS) {
line++;
if (lH * line > h || wordWidth > w && !oF) {
if (resize) {
fS--;
if (fS < fMin) {
lineData = [];
break;
}
checkSize();
}
else if (line === 2 && !lineData[line - 2].trimRight().length) lineData = [];
else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight());
break;
}
widthProg = 0;
lineData.push(word);
if (wrapResults.truncated)
if (resize) {
fS--;
if (fS < fMin) lineData = [];
else checkSize();
}
else lineData[line - 1] += word;
textProg += word;
widthProg += wordWidth;
if (nextChar === " ") widthProg += space;
}
else if (line === 2 && !lineData[line - 2].length) lineData = [];
else lineData[line - 2] = ellipsis(lineData[line - 2]);
}

@@ -366,3 +501,3 @@

@memberof box
@desc If *data* is specified, sets the data array to the specified array and returns this box generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.
@desc If *data* is specified, sets the data array to the specified array and returns this generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.
@param {Array} [*data* = []]

@@ -376,3 +511,3 @@ */

@memberof box
@desc If *value* is specified, sets the animation delay to the specified number and returns this box generator. If *value* is not specified, returns the current animation delay.
@desc If *value* is specified, sets the animation delay to the specified number and returns this generator. If *value* is not specified, returns the current animation delay.
@param {Number} [*value* = 0]

@@ -386,3 +521,3 @@ */

@memberof box
@desc If *value* is specified, sets the animation duration to the specified number and returns this box generator. If *value* is not specified, returns the current animation duration.
@desc If *value* is specified, sets the animation duration to the specified number and returns this generator. If *value* is not specified, returns the current animation duration.
@param {Number} [*value* = 0]

@@ -396,3 +531,3 @@ */

@memberof box
@desc If *value* is specified, sets the ellipsis method to the specified function or string and returns this box generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.
@desc If *value* is specified, sets the ellipsis method to the specified function or string and returns this generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.
@param {Function|String} [*value*]

@@ -410,3 +545,3 @@ @example

@memberof box
@desc If *value* is specified, sets the font color accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font color accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|String} [*value*]

@@ -420,3 +555,3 @@ */

@memberof box
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|String} [*value*]

@@ -430,3 +565,3 @@ */

@memberof box
@desc If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.
@desc If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.
@param {Function|Number} [*value* = 50]

@@ -440,3 +575,3 @@ */

@memberof box
@desc If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.
@desc If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.
@param {Function|Number} [*value* = 8]

@@ -450,3 +585,3 @@ */

@memberof box
@desc If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current font resizing accessor.
@desc If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current font resizing accessor.
@param {Function|Boolean} [*value* = false]

@@ -460,11 +595,7 @@ */

@memberof box
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|Number} [*value*]
*/
box.fontSize = function(_) {
if (arguments.length) {
fontSize = typeof _ === "function" ? _ : constant(_);
return box;
}
return fontSize;
return arguments.length ? (fontSize = typeof _ === "function" ? _ : constant(_), box) : fontSize;
};

@@ -474,3 +605,3 @@

@memberof box
@desc If *value* is specified, sets the height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current height accessor.
@desc If *value* is specified, sets the height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current height accessor.
@param {Function|Number} [*value*]

@@ -488,3 +619,3 @@ @example

@memberof box
@desc If *value* is specified, sets the id accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current id accessor.
@desc If *value* is specified, sets the id accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current id accessor.
@param {Function|Number} [*value*]

@@ -502,3 +633,3 @@ @example

@memberof box
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.
@param {Function|Number} [*value*]

@@ -512,3 +643,3 @@ */

@memberof box
@desc If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current overflow accessor.
@desc If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current overflow accessor.
@param {Function|Boolean} [*value* = false]

@@ -522,3 +653,3 @@ */

@memberof box
@desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this box generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.
@desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.
@param {String|HTMLElement} [*selector*]

@@ -539,3 +670,3 @@ */

@memberof box
@desc If *value* is specified, sets the word split function to the specified function and returns this box generator. If *value* is not specified, returns the current word split function.
@desc If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.
@param {Function} [*value*] A function that, when passed a string, is expected to return that string split into an array of words to wrap. The default split function splits strings on the following characters: `-`, `/`, `;`, `:`, `&`

@@ -549,3 +680,3 @@ */

@memberof box
@desc If *value* is specified, sets the text accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current text accessor.
@desc If *value* is specified, sets the text accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current text accessor.
@param {Function|String} [*value*]

@@ -563,3 +694,3 @@ @example

@memberof box
@desc If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current horizontal text anchor accessor.
@desc If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current horizontal text anchor accessor.
@param {Function|String} [*value* = "start"] Analagous to the SVG [text-anchor](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor) property.

@@ -573,3 +704,3 @@ */

@memberof box
@desc If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current vertical alignment accessor.
@desc If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current vertical alignment accessor.
@param {Function|String} [*value* = "top"] Accepts `"top"`, `"middle"`, and `"bottom"`.

@@ -583,3 +714,3 @@ */

@memberof box
@desc If *value* is specified, sets the width accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current width accessor.
@desc If *value* is specified, sets the width accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current width accessor.
@param {Function|Number} [*value*]

@@ -597,3 +728,3 @@ @example

@memberof box
@desc If *value* is specified, sets the x accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.
@desc If *value* is specified, sets the x accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.
@param {Function|Number} [*value*]

@@ -611,3 +742,3 @@ @example

@memberof box
@desc If *value* is specified, sets the y accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.
@desc If *value* is specified, sets the y accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.
@param {Function|Number} [*value*]

@@ -629,4 +760,7 @@ @example

exports.box = box;
exports.split = defaultSplit;
exports.stringify = stringify;
exports.width = measure;
exports.wrap = wrap;
}));

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array")):"function"==typeof define&&define.amd?define("d3plus-text",["exports","d3-selection","d3-transition","d3-array"],n):n(t.d3plus_text=t.d3plus_text||{},t.d3_selection,t.d3_transition,t.d3_array)}(this,function(t,n,e,i){"use strict";function o(t){return function(){return t}}function r(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),i=[];if("font-style"in n&&i.push(n["font-style"]),"font-variant"in n&&i.push(n["font-variant"]),"font-weight"in n&&i.push(n["font-weight"]),"font-size"in n){var o=n["font-size"]+"px";"line-height"in n&&(o+="/"+n["line-height"]+"px"),i.push(o)}return"font-family"in n&&i.push(n["font-family"]),e.font=i.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function f(t){return t.height||200}function u(t,n){return t.id||""+n}function a(t){return t.match(x)}function l(t){return t.text}function c(t){return t.width||200}function s(t){return t.x||0}function h(t){return t.y||0}function d(t){function n(t){return t+"..."}function e(n){void 0===x&&e.select(y.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===g&&(g=o(Math.ceil(1.1*p())));var f=x.selectAll(".d3plus-text-box").data(t,R);return f.exit().remove(),f.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+R(t,n)}).merge(f).attr("y",function(t,n){return E(t,n)+"px"}).attr("fill",function(t,n){return i(t,n)}).attr("text-anchor",function(t,n){return C(t,n)}).attr("font-family",function(t,n){return d(t,n)}).each(function(t,n){function e(){if(l=1,c=[""],x>u)return void(c=[]);u>h&&(u=h);var t="",n=0;f&&(a=1.1*u,s["font-size"]=u,s["line-height"]=a),o=r(D,s);for(var i=0;i<D.length;i++){var d=D[i],p=S.charAt(t.length+d.length),y=o[D.indexOf(d)];if(" "===p&&(d+=p),n+y>B-u){if(l++,a*l>R||y>B&&!E){if(f){if(u--,x>u){c=[];break}e()}else 2!==l||c[l-2].trimRight().length?c[l-2]=w(c[l-2].trimRight()):c=[];break}n=0,c.push(d)}else c[l-1]+=d;t+=d,n+=y," "===p&&(n+=H)}}function i(e){e.text(function(t){return t.trimRight()}).attr("x",k(t,n)+"px").attr("dx",G+"px").attr("dy",a+"px")}var o,f=A(t,n),u=f?b(t,n):p(t,n),a=f?1.1*u:g(t,n),l=1,c=[""],s={"font-family":d(t,n),"font-size":u,"line-height":a},h=b(t,n),x=z(t,n),R=M(t,n),E=_(t,n),H=r(" ",s),S=q(t,n),O=C(t,n),W=F(t,n),B=T(t,n),D=j(S,n),G="start"===O?0:"end"===O?B:B/2;if(R>a||f){if(f){o=r(D,s);var I=1.165+B/R*.1,J=B*R,K=y.max(o),L=y.sum(o,function(t){return t*a})*I;if(K>B||L>J){var N=Math.sqrt(J/L),P=B/K,Q=y.min([N,P]);u=Math.floor(u*Q)}var U=Math.floor(.8*R);u>U&&(u=U)}e(),y.select(this).attr("font-size",u+"px").style("font-size",u+"px")}var V=l*a,X="top"===W?0:"middle"===W?R/2-V/2:R-V;X-=.2*a,y.select(this).transition().duration(v).attr("transform","translate(0,"+X+")");var Y=y.select(this).selectAll("tspan").data(c);Y.transition().duration(v).call(i),Y.exit().transition().duration(v).attr("opacity",0).remove(),Y.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(i).transition().duration(v).delay(m).attr("opacity",1)}),n&&setTimeout(n,v+100),e}void 0===t&&(t=[]);var i,d,p,g,x,m=0,v=0,w=n,b=o(50),z=o(8),A=o(!1),M=f,R=u,_=o(!1),j=a,q=l,C=o("start"),F=o("top"),T=c,k=s,E=h;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(m=t,e):m},e.duration=function(t){return arguments.length?(v=t,e):v},e.ellipsis=function(t){return arguments.length?(w="function"==typeof t?t:o(t),e):w},e.fontColor=function(t){return arguments.length?(i="function"==typeof t?t:o(t),e):i},e.fontFamily=function(t){return arguments.length?(d="function"==typeof t?t:o(t),e):d},e.fontMax=function(t){return arguments.length?(b="function"==typeof t?t:o(t),e):b},e.fontMin=function(t){return arguments.length?(z="function"==typeof t?t:o(t),e):z},e.fontResize=function(t){return arguments.length?(A="function"==typeof t?t:o(t),e):A},e.fontSize=function(t){return arguments.length?(p="function"==typeof t?t:o(t),e):p},e.height=function(t){return arguments.length?(M="function"==typeof t?t:o(t),e):M},e.id=function(t){return arguments.length?(R="function"==typeof t?t:o(t),e):R},e.lineHeight=function(t){return arguments.length?(g="function"==typeof t?t:o(t),e):g},e.overflow=function(t){return arguments.length?(_="function"==typeof t?t:o(t),e):_},e.select=function(t){return arguments.length?(x=y.select(t),void 0===i&&e.fontColor(x.style("font-color")),void 0===d&&e.fontFamily(x.style("font-family")),void 0===p&&e.fontSize(parseFloat(x.style("font-size"),10)),e):x},e.split=function(t){return arguments.length?(j=t,e):j},e.text=function(t){return arguments.length?(q="function"==typeof t?t:o(t),e):q},e.textAnchor=function(t){return arguments.length?(C="function"==typeof t?t:o(t),e):C},e.verticalAlign=function(t){return arguments.length?(F="function"==typeof t?t:o(t),e):F},e.width=function(t){return arguments.length?(T="function"==typeof t?t:o(t),e):T},e.x=function(t){return arguments.length?(k="function"==typeof t?t:o(t),e):k},e.y=function(t){return arguments.length?(E="function"==typeof t?t:o(t),e):E},t.length?e():e}var p="0.4.3",y={max:i.max,min:i.min,select:n.select,sum:i.sum,transition:e.transition},g=["-","/",";",":","&"],x=new RegExp("[^\\s\\"+g.join("\\")+"]+\\"+g.join("?\\")+"?","g");t.version=p,t.box=d,t.width=r});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array")):"function"==typeof define&&define.amd?define("d3plus-text",["exports","d3-selection","d3-transition","d3-array"],n):n(t.d3plus_text=t.d3plus_text||{},t.d3_selection,t.d3_transition,t.d3_array)}(this,function(t,n,e,i){"use strict";function r(t){return function(){return t}}function o(t){return void 0===t?t="undefined":"string"==typeof t||t instanceof String||(t=JSON.stringify(t)),t}function f(t){return o(t).match(m)}function u(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),i=[];if("font-style"in n&&i.push(n["font-style"]),"font-variant"in n&&i.push(n["font-variant"]),"font-weight"in n&&i.push(n["font-weight"]),"font-size"in n){var r=n["font-size"]+"px";"line-height"in n&&(r+="/"+n["line-height"]+"px"),i.push(r)}return"font-family"in n&&i.push(n["font-family"]),e.font=i.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function a(){function t(t){t=o(t),void 0===n&&(n=Math.ceil(1.1*i));for(var f=l(t),s={"font-family":e,"font-size":i,"line-height":n},h=1,d="",p=!1,g=0,y=[""],x=u(f,s),m=u(" ",s),v=0;v<f.length;v++){var w=f[v],z=t.charAt(d.length+w.length),b=x[f.indexOf(w)];if(" "===z&&(w+=z),g+b>c-i){if(y[h-1]=y[h-1].trimRight(),h++,n*h>r||b>c&&!a){p=!0;break}g=0,y.push(w)}else y[h-1]+=w;d+=w,g+=b," "===z&&(g+=m)}return{lines:y,sentence:t,truncated:p}}var n,e="sans-serif",i=10,r=200,a=!1,l=f,c=200;return t.fontFamily=function(n){return arguments.length?(e=n,t):e},t.fontSize=function(n){return arguments.length?(i=n,t):i},t.height=function(n){return arguments.length?(r=n,t):r},t.lineHeight=function(e){return arguments.length?(n=e,t):n},t.overflow=function(n){return arguments.length?(a=n,t):a},t.split=function(n){return arguments.length?(l=n,t):l},t.width=function(n){return arguments.length?(c=n,t):c},t}function l(t){return t.height||200}function c(t,n){return t.id||""+n}function s(t){return t.text}function h(t){return t.width||200}function d(t){return t.x||0}function p(t){return t.y||0}function g(t){function n(t){return t+"..."}function e(n){void 0===g&&e.select(v.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===o&&(o=r(Math.ceil(1.1*S())));var f=g.selectAll(".d3plus-text-box").data(t,F);return f.exit().remove(),f.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+F(t,n)}).merge(f).attr("y",function(t,n){return E(t,n)+"px"}).attr("fill",function(t,n){return i(t,n)}).attr("text-anchor",function(t,n){return q(t,n)}).attr("font-family",function(t,n){return w(t,n)}).each(function(t,n){function e(){if(g>l)return void(h=[]);l>p&&(l=p),f&&(c=1.1*l,B.fontSize(l).lineHeight(c),d["font-size"]=l,d["line-height"]=c);var t=B(E);h=t.lines,s=h.length+1,t.truncated&&(f?(l--,g>l?h=[]:e()):2!==s||h[s-2].length?h[s-2]=m(h[s-2]):h=[])}function i(e){e.text(function(t){return t.trimRight()}).attr("x",T(t,n)+"px").attr("dx",W+"px").attr("dy",c+"px")}var r,f=M(t,n),l=f?z(t,n):S(t,n),c=f?1.1*l:o(t,n),s=1,h=[""],d={"font-family":w(t,n),"font-size":l,"line-height":c},p=z(t,n),g=b(t,n),F=A(t,n),E=j(t,n),O=q(t,n),k=R(t,n),J=C(t,n),N=_(E,n),W="start"===O?0:"end"===O?J:J/2,B=a().fontFamily(d["font-family"]).fontSize(l).lineHeight(c).height(F).overflow(H(t,n)).width(J);if(F>c||f){if(f){r=u(N,d);var D=1.165+J/F*.1,G=J*F,I=v.max(r),K=v.sum(r,function(t){return t*c})*D;if(I>J||K>G){var L=Math.sqrt(G/K),P=J/I,Q=v.min([L,P]);l=Math.floor(l*Q)}var U=Math.floor(.8*F);l>U&&(l=U)}e(),v.select(this).attr("font-size",l+"px").style("font-size",l+"px")}var V=s*c,X="top"===k?0:"middle"===k?F/2-V/2:F-V;X-=.2*c,v.select(this).transition().duration(x).attr("transform","translate(0,"+X+")");var Y=v.select(this).selectAll("tspan").data(h);Y.transition().duration(x).call(i),Y.exit().transition().duration(x).attr("opacity",0).remove(),Y.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(i).transition().duration(x).delay(y).attr("opacity",1)}),n&&setTimeout(n,x+100),e}void 0===t&&(t=[]);var i,o,g,y=0,x=0,m=n,w=r("sans-serif"),z=r(50),b=r(8),M=r(!1),S=r(10),A=l,F=c,H=r(!1),_=f,j=s,q=r("start"),R=r("top"),C=h,T=d,E=p;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(y=t,e):y},e.duration=function(t){return arguments.length?(x=t,e):x},e.ellipsis=function(t){return arguments.length?(m="function"==typeof t?t:r(t),e):m},e.fontColor=function(t){return arguments.length?(i="function"==typeof t?t:r(t),e):i},e.fontFamily=function(t){return arguments.length?(w="function"==typeof t?t:r(t),e):w},e.fontMax=function(t){return arguments.length?(z="function"==typeof t?t:r(t),e):z},e.fontMin=function(t){return arguments.length?(b="function"==typeof t?t:r(t),e):b},e.fontResize=function(t){return arguments.length?(M="function"==typeof t?t:r(t),e):M},e.fontSize=function(t){return arguments.length?(S="function"==typeof t?t:r(t),e):S},e.height=function(t){return arguments.length?(A="function"==typeof t?t:r(t),e):A},e.id=function(t){return arguments.length?(F="function"==typeof t?t:r(t),e):F},e.lineHeight=function(t){return arguments.length?(o="function"==typeof t?t:r(t),e):o},e.overflow=function(t){return arguments.length?(H="function"==typeof t?t:r(t),e):H},e.select=function(t){return arguments.length?(g=v.select(t),void 0===i&&e.fontColor(g.style("font-color")),void 0===w&&e.fontFamily(g.style("font-family")),void 0===S&&e.fontSize(parseFloat(g.style("font-size"),10)),e):g},e.split=function(t){return arguments.length?(_=t,e):_},e.text=function(t){return arguments.length?(j="function"==typeof t?t:r(t),e):j},e.textAnchor=function(t){return arguments.length?(q="function"==typeof t?t:r(t),e):q},e.verticalAlign=function(t){return arguments.length?(R="function"==typeof t?t:r(t),e):R},e.width=function(t){return arguments.length?(C="function"==typeof t?t:r(t),e):C},e.x=function(t){return arguments.length?(T="function"==typeof t?t:r(t),e):T},e.y=function(t){return arguments.length?(E="function"==typeof t?t:r(t),e):E},t.length?e():e}var y="0.4.4",x=["-","/",";",":","&"],m=new RegExp("[^\\s\\"+x.join("\\")+"]+\\"+x.join("?\\")+"?","g"),v={max:i.max,min:i.min,select:n.select,sum:i.sum,transition:e.transition};t.version=y,t.box=g,t.split=f,t.stringify=o,t.width=u,t.wrap=a});
export {version} from "./package.json";
export {default as box} from "./src/box";
export {default as split} from "./src/split";
export {default as stringify} from "./src/stringify";
export {default as width} from "./src/width";
export {default as wrap} from "./src/wrap";
{
"name": "d3plus-text",
"version": "0.4.3",
"version": "0.4.4",
"description": "SVG text functions, including line wrapping with automatic font scaling.",

@@ -5,0 +5,0 @@ "main": "build/d3plus-text.js",

@@ -62,7 +62,16 @@ # d3plus-text

<dt><a href="#box">box([data])</a></dt>
<dd><p>Creates a wrapped text box based on an array of data. If <em>data</em> is specified, immediately wraps the text based on the specified array and returns this box generator. If <em>data</em> is not specified on instantiation, it can be passed/updated after instantiation using the <a href="#box.data">data</a> method.</p>
<dd><p>Creates a wrapped text box based on an array of data. If <em>data</em> is specified, immediately wraps the text based on the specified array and returns this generator. If <em>data</em> is not specified on instantiation, it can be passed/updated after instantiation using the <a href="#box.data">data</a> method.</p>
</dd>
<dt><a href="#width">width(sentence)</a></dt>
<dd><p>Splits a given sentence into an array of words.</p>
</dd>
<dt><a href="#stringify">stringify(value)</a></dt>
<dd><p>Coerces value into a String.</p>
</dd>
<dt><a href="#width">width(text, [style])</a></dt>
<dd><p>Given a text string, returns the predicted pixel width of the string when placed into DOM.</p>
</dd>
<dt><a href="#wrap">wrap()</a></dt>
<dd><p>Based on the defined styles and dimensions, breaks a string into an array of strings for each line of text.</p>
</dd>
</dl>

@@ -73,3 +82,3 @@

## box([data])
Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this box generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.
Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.

@@ -137,3 +146,3 @@ **Kind**: global function

### box.data([*data*])
If *data* is specified, sets the data array to the specified array and returns this box generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.
If *data* is specified, sets the data array to the specified array and returns this generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.

@@ -149,3 +158,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.delay([*value*])
If *value* is specified, sets the animation delay to the specified number and returns this box generator. If *value* is not specified, returns the current animation delay.
If *value* is specified, sets the animation delay to the specified number and returns this generator. If *value* is not specified, returns the current animation delay.

@@ -161,3 +170,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.duration([*value*])
If *value* is specified, sets the animation duration to the specified number and returns this box generator. If *value* is not specified, returns the current animation duration.
If *value* is specified, sets the animation duration to the specified number and returns this generator. If *value* is not specified, returns the current animation duration.

@@ -173,3 +182,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.ellipsis([*value*])
If *value* is specified, sets the ellipsis method to the specified function or string and returns this box generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.
If *value* is specified, sets the ellipsis method to the specified function or string and returns this generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.

@@ -191,3 +200,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontColor([*value*])
If *value* is specified, sets the font color accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.
If *value* is specified, sets the font color accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.

@@ -203,3 +212,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontFamily([*value*])
If *value* is specified, sets the font family accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.
If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.

@@ -215,3 +224,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontMax([*value*])
If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.
If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.

@@ -227,3 +236,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontMin([*value*])
If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.
If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.

@@ -239,3 +248,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontResize([*value*])
If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current font resizing accessor.
If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current font resizing accessor.

@@ -251,3 +260,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.fontSize([*value*])
If *value* is specified, sets the font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.
If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.

@@ -263,3 +272,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.height([*value*])
If *value* is specified, sets the height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current height accessor.
If *value* is specified, sets the height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current height accessor.

@@ -281,3 +290,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.id([*value*])
If *value* is specified, sets the id accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current id accessor.
If *value* is specified, sets the id accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current id accessor.

@@ -299,3 +308,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.lineHeight([*value*])
If *value* is specified, sets the line height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.
If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.

@@ -311,3 +320,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.overflow([*value*])
If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current overflow accessor.
If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current overflow accessor.

@@ -323,3 +332,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.select([*selector*])
If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this box generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.
If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.

@@ -335,3 +344,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.split([*value*])
If *value* is specified, sets the word split function to the specified function and returns this box generator. If *value* is not specified, returns the current word split function.
If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.

@@ -347,3 +356,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.text([*value*])
If *value* is specified, sets the text accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current text accessor.
If *value* is specified, sets the text accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current text accessor.

@@ -365,3 +374,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.textAnchor([*value*])
If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current horizontal text anchor accessor.
If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current horizontal text anchor accessor.

@@ -377,3 +386,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.verticalAlign([*value*])
If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current vertical alignment accessor.
If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current vertical alignment accessor.

@@ -389,3 +398,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.width([*value*])
If *value* is specified, sets the width accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current width accessor.
If *value* is specified, sets the width accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current width accessor.

@@ -407,3 +416,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.x([*value*])
If *value* is specified, sets the x accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.
If *value* is specified, sets the x accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.

@@ -425,3 +434,3 @@ **Kind**: static method of <code>[box](#box)</code>

### box.y([*value*])
If *value* is specified, sets the y accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.
If *value* is specified, sets the y accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.

@@ -442,2 +451,24 @@ **Kind**: static method of <code>[box](#box)</code>

## width(sentence)
Splits a given sentence into an array of words.
**Kind**: global function
| Param | Type |
| --- | --- |
| sentence | <code>String</code> |
<a name="stringify"></a>
## stringify(value)
Coerces value into a String.
**Kind**: global function
| Param | Type |
| --- | --- |
| value | <code>String</code> |
<a name="width"></a>
## width(text, [style])

@@ -453,1 +484,94 @@ Given a text string, returns the predicted pixel width of the string when placed into DOM.

<a name="wrap"></a>
## wrap()
Based on the defined styles and dimensions, breaks a string into an array of strings for each line of text.
**Kind**: global function
* [wrap()](#wrap)
* [.fontFamily([*value*])](#wrap.fontFamily)
* [.fontSize([*value*])](#wrap.fontSize)
* [.height([*value*])](#wrap.height)
* [.lineHeight([*value*])](#wrap.lineHeight)
* [.overflow([*value*])](#wrap.overflow)
* [.split([*value*])](#wrap.split)
* [.width([*value*])](#wrap.width)
<a name="wrap.fontFamily"></a>
### wrap.fontFamily([*value*])
If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type |
| --- | --- |
| [*value*] | <code>function</code> &#124; <code>String</code> |
<a name="wrap.fontSize"></a>
### wrap.fontSize([*value*])
If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type |
| --- | --- |
| [*value*] | <code>function</code> &#124; <code>Number</code> |
<a name="wrap.height"></a>
### wrap.height([*value*])
If *value* is specified, sets height limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type | Default |
| --- | --- | --- |
| [*value*] | <code>Number</code> | <code>200</code> |
<a name="wrap.lineHeight"></a>
### wrap.lineHeight([*value*])
If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#wrap.fontSize) by default.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type |
| --- | --- |
| [*value*] | <code>function</code> &#124; <code>Number</code> |
<a name="wrap.overflow"></a>
### wrap.overflow([*value*])
If *value* is specified, sets the overflow to the specified boolean and returns this generator. If *value* is not specified, returns the current overflow value.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type | Default |
| --- | --- | --- |
| [*value*] | <code>Boolean</code> | <code>false</code> |
<a name="wrap.split"></a>
### wrap.split([*value*])
If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type | Description |
| --- | --- | --- |
| [*value*] | <code>function</code> | A function that, when passed a string, is expected to return that string split into an array of words to wrap. The default split function splits strings on the following characters: `-`, `/`, `;`, `:`, `&` |
<a name="wrap.width"></a>
### wrap.width([*value*])
If *value* is specified, sets width limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
**Kind**: static method of <code>[wrap](#wrap)</code>
| Param | Type | Default |
| --- | --- | --- |
| [*value*] | <code>Number</code> | <code>200</code> |

@@ -13,3 +13,5 @@ import {select as d3Select} from "d3-selection";

import {default as constant} from "./constant";
import {default as boxSplit} from "./split";
import {default as measure} from "./width";
import {default as wrap} from "./wrap";

@@ -32,14 +34,3 @@ /**

const splitChars = ["-", "/", ";", ":", "&"],
splitRegex = new RegExp(`[^\\s\\${splitChars.join("\\")}]+\\${splitChars.join("?\\")}?`, "g");
/**
The default word split function.
@private
*/
function boxSplit(_) {
return _.match(splitRegex);
}
/**
The default text accessor function.

@@ -79,3 +70,3 @@ @private

@function box
@desc Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this box generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.
@desc Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.
@param {Array} [data = []]

@@ -114,7 +105,7 @@ @example <caption>a sample row of data</caption>

fontColor,
fontFamily,
fontFamily = constant("sans-serif"),
fontMax = constant(50),
fontMin = constant(8),
fontResize = constant(false),
fontSize,
fontSize = constant(10),
height = boxHeight,

@@ -173,4 +164,2 @@ id = boxId,

h = height(d, i),
oF = overflow(d, i),
space = measure(" ", style),
t = text(d, i),

@@ -184,2 +173,10 @@ tA = textAnchor(d, i),

const wrapper = wrap()
.fontFamily(style["font-family"])
.fontSize(fS)
.lineHeight(lH)
.height(h)
.overflow(overflow(d, i))
.width(w);
/**

@@ -191,5 +188,2 @@ Figures out the lineData to be used for wrapping.

line = 1;
lineData = [""];
if (fS < fMin) {

@@ -201,7 +195,7 @@ lineData = [];

let textProg = "",
widthProg = 0;
if (resize) {
lH = fS * 1.1;
wrapper
.fontSize(fS)
.lineHeight(lH);
style["font-size"] = fS;

@@ -211,33 +205,17 @@ style["line-height"] = lH;

sizes = measure(words, style);
const wrapResults = wrapper(t);
lineData = wrapResults.lines;
line = lineData.length + 1;
for (let i = 0; i < words.length; i++) {
let word = words[i];
const nextChar = t.charAt(textProg.length + word.length),
wordWidth = sizes[words.indexOf(word)];
if (nextChar === " ") word += nextChar;
if (widthProg + wordWidth > w - fS) {
line++;
if (lH * line > h || wordWidth > w && !oF) {
if (resize) {
fS--;
if (fS < fMin) {
lineData = [];
break;
}
checkSize();
}
else if (line === 2 && !lineData[line - 2].trimRight().length) lineData = [];
else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight());
break;
}
widthProg = 0;
lineData.push(word);
if (wrapResults.truncated)
if (resize) {
fS--;
if (fS < fMin) lineData = [];
else checkSize();
}
else lineData[line - 1] += word;
textProg += word;
widthProg += wordWidth;
if (nextChar === " ") widthProg += space;
}
else if (line === 2 && !lineData[line - 2].length) lineData = [];
else lineData[line - 2] = ellipsis(lineData[line - 2]);
}

@@ -320,3 +298,3 @@

@memberof box
@desc If *data* is specified, sets the data array to the specified array and returns this box generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.
@desc If *data* is specified, sets the data array to the specified array and returns this generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.
@param {Array} [*data* = []]

@@ -330,3 +308,3 @@ */

@memberof box
@desc If *value* is specified, sets the animation delay to the specified number and returns this box generator. If *value* is not specified, returns the current animation delay.
@desc If *value* is specified, sets the animation delay to the specified number and returns this generator. If *value* is not specified, returns the current animation delay.
@param {Number} [*value* = 0]

@@ -340,3 +318,3 @@ */

@memberof box
@desc If *value* is specified, sets the animation duration to the specified number and returns this box generator. If *value* is not specified, returns the current animation duration.
@desc If *value* is specified, sets the animation duration to the specified number and returns this generator. If *value* is not specified, returns the current animation duration.
@param {Number} [*value* = 0]

@@ -350,3 +328,3 @@ */

@memberof box
@desc If *value* is specified, sets the ellipsis method to the specified function or string and returns this box generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.
@desc If *value* is specified, sets the ellipsis method to the specified function or string and returns this generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.
@param {Function|String} [*value*]

@@ -364,3 +342,3 @@ @example

@memberof box
@desc If *value* is specified, sets the font color accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font color accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|String} [*value*]

@@ -374,3 +352,3 @@ */

@memberof box
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|String} [*value*]

@@ -384,3 +362,3 @@ */

@memberof box
@desc If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.
@desc If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.
@param {Function|Number} [*value* = 50]

@@ -394,3 +372,3 @@ */

@memberof box
@desc If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.
@desc If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.
@param {Function|Number} [*value* = 8]

@@ -404,3 +382,3 @@ */

@memberof box
@desc If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current font resizing accessor.
@desc If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current font resizing accessor.
@param {Function|Boolean} [*value* = false]

@@ -414,11 +392,7 @@ */

@memberof box
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.
@param {Function|Number} [*value*]
*/
box.fontSize = function(_) {
if (arguments.length) {
fontSize = typeof _ === "function" ? _ : constant(_);
return box;
}
return fontSize;
return arguments.length ? (fontSize = typeof _ === "function" ? _ : constant(_), box) : fontSize;
};

@@ -428,3 +402,3 @@

@memberof box
@desc If *value* is specified, sets the height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current height accessor.
@desc If *value* is specified, sets the height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current height accessor.
@param {Function|Number} [*value*]

@@ -442,3 +416,3 @@ @example

@memberof box
@desc If *value* is specified, sets the id accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current id accessor.
@desc If *value* is specified, sets the id accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current id accessor.
@param {Function|Number} [*value*]

@@ -456,3 +430,3 @@ @example

@memberof box
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.
@param {Function|Number} [*value*]

@@ -466,3 +440,3 @@ */

@memberof box
@desc If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current overflow accessor.
@desc If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this generator. If *value* is not specified, returns the current overflow accessor.
@param {Function|Boolean} [*value* = false]

@@ -476,3 +450,3 @@ */

@memberof box
@desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this box generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.
@desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.
@param {String|HTMLElement} [*selector*]

@@ -493,3 +467,3 @@ */

@memberof box
@desc If *value* is specified, sets the word split function to the specified function and returns this box generator. If *value* is not specified, returns the current word split function.
@desc If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.
@param {Function} [*value*] A function that, when passed a string, is expected to return that string split into an array of words to wrap. The default split function splits strings on the following characters: `-`, `/`, `;`, `:`, `&`

@@ -503,3 +477,3 @@ */

@memberof box
@desc If *value* is specified, sets the text accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current text accessor.
@desc If *value* is specified, sets the text accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current text accessor.
@param {Function|String} [*value*]

@@ -517,3 +491,3 @@ @example

@memberof box
@desc If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current horizontal text anchor accessor.
@desc If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current horizontal text anchor accessor.
@param {Function|String} [*value* = "start"] Analagous to the SVG [text-anchor](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor) property.

@@ -527,3 +501,3 @@ */

@memberof box
@desc If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current vertical alignment accessor.
@desc If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current vertical alignment accessor.
@param {Function|String} [*value* = "top"] Accepts `"top"`, `"middle"`, and `"bottom"`.

@@ -537,3 +511,3 @@ */

@memberof box
@desc If *value* is specified, sets the width accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current width accessor.
@desc If *value* is specified, sets the width accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current width accessor.
@param {Function|Number} [*value*]

@@ -551,3 +525,3 @@ @example

@memberof box
@desc If *value* is specified, sets the x accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.
@desc If *value* is specified, sets the x accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.
@param {Function|Number} [*value*]

@@ -565,3 +539,3 @@ @example

@memberof box
@desc If *value* is specified, sets the y accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.
@desc If *value* is specified, sets the y accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.
@param {Function|Number} [*value*]

@@ -568,0 +542,0 @@ @example

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

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