tatami 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ require 'tatami'
2
+ module Tatami
3
+ class Flot
4
+ attr_reader :couch
5
+ def initialize *args
6
+ @couch = Couch.new *args
7
+ end
8
+
9
+ def record_node_prop typ, hash, time = Time.now
10
+ time_i = (time.to_i + 7200)*1000
11
+ couch.doc_new nil, hash.merge(time: time_i,typ: typ)
12
+ end
13
+
14
+ def blank!
15
+ couch.blank!
16
+ couch.design_load
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ require "tatami/version"
2
+
3
+ module Tatami
4
+ # Your code goes here...
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Tatami
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,213 @@
1
+ require 'tatami'
2
+ require 'awesome_print'
3
+ require 'minitest/autorun'
4
+ module Tatami
5
+ describe Couch do
6
+ let(:couch){ Couch.new 'cars' }
7
+ let :couch_one do
8
+ couch.blank!.doc_new :frank, name: 'Frank'
9
+ couch
10
+ end
11
+
12
+ it "setup" do
13
+ couch.version.must_equal '1.3.1'
14
+ couch.db_info[:db_name].must_equal 'cars'
15
+ end
16
+
17
+ it "#load_design" do
18
+ couch.with_fixtures! a: 1
19
+ end
20
+
21
+ describe Couch::View do
22
+
23
+ it '#view' do
24
+ couch_one.view('v1').create('(doc) -> emit "c", 0').keys.must_equal ['c']
25
+ couch_one.view('v2').create('
26
+ (doc) ->
27
+ emit "d", 1
28
+ emit "e", 2','
29
+ (keys, values, rereduce) ->
30
+ sum(values)').reduced.must_equal 3
31
+ end
32
+
33
+ #View options
34
+ it 'string datatypes' do
35
+ v = couch_one.view('v3').create '(doc) ->
36
+ emit "a", 1
37
+ emit "b", 2
38
+ emit "c", 3'
39
+ v.keys.must_equal %w[a b c]
40
+ v.keys(startkey: 'b' ).must_equal %w[ b c]
41
+ v.keys(endkey: 'b' ).must_equal %w[a b ]
42
+ v.keys(key: 'b' ).must_equal %w[ b ]
43
+ v.keys(limit: 2 ).must_equal %w[a b ]
44
+ v.keys(skip: 1 ).must_equal %w[ b c]
45
+ v.keys(descending: true ).must_equal %w[c b a]
46
+ v.keys(keys: %w[a c]).must_equal %w[a c]
47
+ end
48
+
49
+ it "sorts different datatypes" do
50
+ couch_one.view('a').create('(doc) ->
51
+ emit null, 0
52
+ emit 0, 0
53
+ emit "", 0
54
+ emit [], 0
55
+ emit [1], 0
56
+ emit [1,1], 0
57
+ emit {}, 0').keys.must_equal [nil,0,'',[],[1],[1,1],{}]
58
+ end
59
+
60
+ it 'Map Reduce' do
61
+ couch.with_fixtures! %w[make model year],
62
+ ['Audi','A3',2000],
63
+ ['Audi','A4',2009],
64
+ ['VW','Golf',2008],
65
+ ['VW','Golf',2009],
66
+ ['VW','Polo',2010]
67
+
68
+ primitive = couch.view('primitive').create('
69
+ (doc) -> emit doc.make , 1','
70
+ (keys, values, rereduce) -> sum(values)')
71
+
72
+ primitive.data.get(:rows,0) .must_equal "key" => nil, "value" => 5
73
+ primitive.data(group: true)[:rows].must_equal [{"key"=>"Audi", "value"=>2},
74
+ {"key"=>"VW", "value"=>3}]
75
+
76
+ primitive.reduce( group: true).must_equal 'Audi' => 2, 'VW' => 3
77
+ primitive.reduced.must_equal 5
78
+
79
+ array = couch.view('array').create('
80
+ (doc) -> emit [doc.make,doc.model] , 1','
81
+ (keys, values, rereduce) -> sum(values)')
82
+ array.reduced.must_equal 5
83
+ array.reduce( group_level: 1).must_equal ['Audi'] => 2, ['VW'] => 3
84
+ array.reduced( startkey: ['Audi'], endkey: ['Audi',{}]).must_equal 2
85
+ array.reduce( group_level: 1,startkey: ['Audi'], endkey: ['Audi',{}]).must_equal ['Audi'] => 2
86
+ array.reduced( group_level: 1,startkey: ['Audi'], endkey: ['Audi',{}]).must_equal 2
87
+ array.reduced_value('Audi').must_equal 2
88
+ array.reduced_value('VW','Golf').must_equal 2
89
+ end
90
+
91
+ describe "list action" do
92
+
93
+ let(:v1){couch.view(:v1).create('(doc) -> emit doc.model, 1')}
94
+
95
+ it 'show list simple' do
96
+ couch.design_new :list, :zoom, '() -> "zoom!"'
97
+ out, err = capture_io{
98
+ v1.data(list: :zoom, format: :string, log: true).must_equal 'zoom!'
99
+ }
100
+ out.must_equal %Q{GET /cars/_design/cars/_list/zoom/v1?\n}
101
+ end
102
+
103
+ it 'show list iterating' do
104
+ couch.with_fixtures! %w[make model],
105
+ %w[Audi A3 ],
106
+ %w[Audi A4 ]
107
+ v1.keys.must_equal %w[A3 A4]
108
+ couch.design_new :list, :iter , <<-HERE
109
+ (head, req) ->
110
+ start
111
+ "headers":
112
+ "Content-Type": "text/html"
113
+ loop
114
+ return unless r = getRow()
115
+ send r.key
116
+ HERE
117
+ # v1.data(list: :iter, format: :raw).must_equal 'A3A4'
118
+ out, err = capture_io{
119
+ v1.data(list: :iter, format: :string, log: true, keys: ['A3']).must_equal 'A3'
120
+ }
121
+ out.must_equal %Q{POST /cars/_design/cars/_list/iter/v1 {:keys=>["A3"]}\n}
122
+
123
+ end
124
+ end
125
+ end
126
+
127
+ describe Couch::BulkImport do
128
+ it do
129
+ couch.blank!.bulk_import(2) do |bi|
130
+ 5.times{|i| bi.doc_new nr: i}
131
+ end
132
+ couch.db_info[:doc_count].must_equal 5
133
+ end
134
+ end
135
+
136
+ describe "Documents" do
137
+
138
+ it "#doc with no document" do
139
+ couch.doc(:not_existing_id).must_be_nil
140
+ end
141
+
142
+ it "#doc_new create new id" do
143
+ couch.doc_new(nil, name: 'frank')[:ok].must_equal true
144
+ end
145
+
146
+ it "#doc_new get update" do
147
+ doc_n = couch.blank!.doc_new(:frank, name: 'frank')
148
+ doc_n.keys.must_equal %w[ok id rev]
149
+
150
+ doc_g = couch.doc(:frank)
151
+ doc_g.keys.must_equal %w[_id _rev name]
152
+ doc_n[:rev].must_equal doc_g[:_rev]
153
+
154
+ doc_u = couch.doc_update(doc_g, age: 47)
155
+ doc_u.keys.must_equal %w[ok id rev]
156
+ end
157
+
158
+ it "#doc_create_or_update" do
159
+ couch.blank!.doc_create_or_update 'bla', name: 'frank'
160
+ couch.doc('bla')[:name].must_equal 'frank'
161
+ couch.doc_create_or_update 'bla', name: 'dirk'
162
+ couch.doc('bla')[:name].must_equal 'dirk'
163
+ end
164
+
165
+ it '#doc_new_bulk' do
166
+ couch.blank!.doc_new_bulk [{name: :Frank},
167
+ {name: :Dieter}]
168
+ couch.db_info[:doc_count].must_equal 2
169
+ end
170
+
171
+ it "#next_id" do
172
+ (0..19).map{ couch.next_id }.uniq.size.must_equal 20
173
+ end
174
+
175
+ it "#doc_merge" do
176
+ address = Map.new.set :address, :street, 'Seidenstrasse'
177
+ couch_one.doc_merge :frank, address
178
+ couch_one.doc(:frank)[:address][:street].must_equal 'Seidenstrasse'
179
+ end
180
+
181
+ it "#attach" do
182
+ couch.blank!
183
+ couch.doc_attach_app "d3", "test/fixtures/d3"
184
+ end
185
+
186
+ describe '#doc_merge_cached' do
187
+ it "doc_merge_cached" do
188
+ couch.blank!.doc_merge_cached :frank, adr: { street: 'seiden'}
189
+ couch.doc_merge_cached :frank, adr: { plz: 51063 }
190
+ couch.doc(:frank)[:adr].keys.must_equal %w[street plz]
191
+ end
192
+
193
+ it "fetches document when its not on the cache" do
194
+ couch.blank!.doc_new :frank, adr: { street: 'seiden'}
195
+ couch.doc_merge_cached :frank, adr: { plz: 51063 }
196
+ couch.doc(:frank)[:adr].keys.must_equal %w[street plz]
197
+ end
198
+ end
199
+
200
+ describe "show action" do
201
+ it "show without document" do
202
+ couch.blank!.design_new :show,:s1,'(doc, req) -> "hallo welt"'
203
+ couch.show(:s1).must_equal 'hallo welt'
204
+ end
205
+
206
+ it "show document" do
207
+ couch_one.design_new :show,:s2,'(doc, req) -> "hallo #{doc.name}"'
208
+ couch.show(:s2,:frank).must_equal 'hallo Frank'
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1 @@
1
+ .chart div,.chart1 div{font:10px sans-serif;background-color:steelblue;text-align:right;padding:3px;margin:1px;color:#fff}.chart1 div{background:red}.svg rect{stroke:#fff;fill:steelblue}
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>d3e</title>
5
+
6
+ <link rel="stylesheet" type="text/css" href="css/app.css" media="all" />
7
+ </head>
8
+ <body>
9
+ <script type="text/javascript" src="js/app.js"></script>
10
+
11
+ </body>
12
+ </html>
@@ -0,0 +1,6 @@
1
+ /*! An HTML/JS/CSS app - v0.0.1 - 2013-09-05 */
2
+ d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function r(n){for(var t=1;n*t%1;)t*=10;return t}function e(n,t){try{for(var r in t)Object.defineProperty(n.prototype,r,{value:t[r],enumerable:!1})}catch(e){n.prototype=t}}function u(){}function i(){}function a(n,t,r){return function(){var e=r.apply(t,arguments);return e===t?n:e}}function o(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var r=0,e=ja.length;e>r;++r){var u=ja[r]+t;if(u in n)return u}}function c(){}function l(){}function s(n){function t(){for(var t,e=r,u=-1,i=e.length;i>++u;)(t=e[u].on)&&t.apply(this,arguments);return n}var r=[],e=new u;return t.on=function(t,u){var i,a=e.get(t);return 2>arguments.length?a&&a.on:(a&&(a.on=null,r=r.slice(0,i=r.indexOf(a)).concat(r.slice(i+1)),e.remove(t)),u&&r.push(e.set(t,{on:u})),n)},t}function f(){da.event.preventDefault()}function h(){for(var n,t=da.event;n=t.sourceEvent;)t=n;return t}function g(n){for(var t=new l,r=0,e=arguments.length;e>++r;)t[arguments[r]]=s(t);return t.of=function(r,e){return function(u){try{var i=u.sourceEvent=da.event;u.target=n,da.event=u,t[u.type].apply(r,e)}finally{da.event=i}}},t}function p(n){return Ca(n,Ra),n}function d(n){return"function"==typeof n?n:function(){return Da(n,this)}}function v(n){return"function"==typeof n?n:function(){return Oa(n,this)}}function m(n,t){function r(){this.removeAttribute(n)}function e(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function a(){var r=t.apply(this,arguments);null==r?this.removeAttribute(n):this.setAttribute(n,r)}function o(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,r)}return n=da.ns.qualify(n),null==t?n.local?e:r:"function"==typeof t?n.local?o:a:n.local?i:u}function y(n){return n.trim().replace(/\s+/g," ")}function x(n){return RegExp("(?:^|\\s+)"+da.requote(n)+"(?:\\s+|$)","g")}function M(n,t){function r(){for(var r=-1;u>++r;)n[r](this,t)}function e(){for(var r=-1,e=t.apply(this,arguments);u>++r;)n[r](this,e)}n=n.trim().split(/\s+/).map(b);var u=n.length;return"function"==typeof t?e:r}function b(n){var t=x(n);return function(r,e){if(u=r.classList)return e?u.add(n):u.remove(n);var u=r.getAttribute("class")||"";e?(t.lastIndex=0,t.test(u)||r.setAttribute("class",y(u+" "+n))):r.setAttribute("class",y(u.replace(t," ")))}}function _(n,t,r){function e(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,r)}function i(){var e=t.apply(this,arguments);null==e?this.style.removeProperty(n):this.style.setProperty(n,e,r)}return null==t?e:"function"==typeof t?i:u}function w(n,t){function r(){delete this[n]}function e(){this[n]=t}function u(){var r=t.apply(this,arguments);null==r?delete this[n]:this[n]=r}return null==t?r:"function"==typeof t?u:e}function E(n){return"function"==typeof n?n:(n=da.ns.qualify(n)).local?function(){return ya.createElementNS(n.space,n.local)}:function(){return ya.createElementNS(this.namespaceURI,n)}}function S(n){return{__data__:n}}function k(n){return function(){return La(this,n)}}function A(n){return arguments.length||(n=da.ascending),function(t,r){return t&&r?n(t.__data__,r.__data__):!t-!r}}function N(n,t){for(var r=0,e=n.length;e>r;r++)for(var u,i=n[r],a=0,o=i.length;o>a;a++)(u=i[a])&&t(u,a,r);return n}function T(n){return Ca(n,Ia),n}function q(n){var t,r;return function(e,u,i){var a,o=n[i].update,c=o.length;for(i!=r&&(r=i,t=0),u>=t&&(t=u+1);!(a=o[t])&&c>++t;);return a}}function j(){var n=this.__transition__;n&&++n.active}function z(n,t,r){function e(){var t=this[a];t&&(this.removeEventListener(n,t,t.$),delete this[a])}function u(){var u=l(t,ma(arguments));e.call(this),this.addEventListener(n,this[a]=u,u.$=r),u._=t}function i(){var t,r=RegExp("^__on([^.]+)"+da.requote(n)+"$");for(var e in this)if(t=e.match(r)){var u=this[e];this.removeEventListener(t[1],u,u.$),delete this[e]}}var a="__on"+n,o=n.indexOf("."),l=C;o>0&&(n=n.substring(0,o));var s=Ya.get(n);return s&&(n=s,l=D),o?t?u:e:t?c:i}function C(n,t){return function(r){var e=da.event;da.event=r,t[0]=this.__data__;try{n.apply(this,t)}finally{da.event=e}}}function D(n,t){var r=C(n,t);return function(n){var t=this,e=n.relatedTarget;e&&(e===t||8&e.compareDocumentPosition(t))||r.call(t,n)}}function O(){var n=".dragsuppress-"+ ++Ba,t="touchmove"+n,r="selectstart"+n,e="dragstart"+n,u="click"+n,i=da.select(Ma).on(t,f).on(r,f).on(e,f),a=xa.style,o=a[Ua];return a[Ua]="none",function(t){function r(){i.on(u,null)}i.on(n,null),a[Ua]=o,t&&(i.on(u,function(){f(),r()},!0),setTimeout(r,0))}}function F(n,t){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var e=r.createSVGPoint();if(0>Va&&(Ma.scrollX||Ma.scrollY)){r=da.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=r[0][0].getScreenCTM();Va=!(u.f||u.e),r.remove()}return Va?(e.x=t.pageX,e.y=t.pageY):(e.x=t.clientX,e.y=t.clientY),e=e.matrixTransform(n.getScreenCTM().inverse()),[e.x,e.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function L(n){return n>0?1:0>n?-1:0}function R(n){return n>1?0:-1>n?Za:Math.acos(n)}function H(n){return n>1?Za/2:-1>n?-Za/2:Math.asin(n)}function I(n){return(Math.exp(n)-Math.exp(-n))/2}function P(n){return(Math.exp(n)+Math.exp(-n))/2}function Y(n){return I(n)/P(n)}function U(n){return(n=Math.sin(n/2))*n}function B(){}function V(n,t,r){return new Z(n,t,r)}function Z(n,t,r){this.h=n,this.s=t,this.l=r}function X(n,t,r){function e(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(a-i)*n/60:180>n?a:240>n?i+(a-i)*(240-n)/60:i}function u(n){return Math.round(255*e(n))}var i,a;return n=isNaN(n)?0:0>(n%=360)?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+t):r+t-r*t,i=2*r-a,at(u(n+120),u(n),u(n-120))}function $(n,t,r){return new J(n,t,r)}function J(n,t,r){this.h=n,this.c=t,this.l=r}function W(n,t,r){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),G(r,Math.cos(n*=Ja)*t,Math.sin(n)*t)}function G(n,t,r){return new K(n,t,r)}function K(n,t,r){this.l=n,this.a=t,this.b=r}function Q(n,t,r){var e=(n+16)/116,u=e+t/500,i=e-r/200;return u=tt(u)*ao,e=tt(e)*oo,i=tt(i)*co,at(et(3.2404542*u-1.5371385*e-.4985314*i),et(-.969266*u+1.8760108*e+.041556*i),et(.0556434*u-.2040259*e+1.0572252*i))}function nt(n,t,r){return n>0?$(Math.atan2(r,t)*Wa,Math.sqrt(t*t+r*r),n):$(0/0,0/0,n)}function tt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function rt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function et(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function ut(n){return at(n>>16,255&n>>8,255&n)}function it(n){return ut(n)+""}function at(n,t,r){return new ot(n,t,r)}function ot(n,t,r){this.r=n,this.g=t,this.b=r}function ct(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function lt(n,t,r){var e,u,i,a=0,o=0,c=0;if(e=/([a-z]+)\((.*)\)/i.exec(n))switch(u=e[2].split(","),e[1]){case"hsl":return r(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(gt(u[0]),gt(u[1]),gt(u[2]))}return(i=fo.get(n))?t(i.r,i.g,i.b):(null!=n&&"#"===n.charAt(0)&&(4===n.length?(a=n.charAt(1),a+=a,o=n.charAt(2),o+=o,c=n.charAt(3),c+=c):7===n.length&&(a=n.substring(1,3),o=n.substring(3,5),c=n.substring(5,7)),a=parseInt(a,16),o=parseInt(o,16),c=parseInt(c,16)),t(a,o,c))}function st(n,t,r){var e,u,i=Math.min(n/=255,t/=255,r/=255),a=Math.max(n,t,r),o=a-i,c=(a+i)/2;return o?(u=.5>c?o/(a+i):o/(2-a-i),e=n==a?(t-r)/o+(r>t?6:0):t==a?(r-n)/o+2:(n-t)/o+4,e*=60):(e=0/0,u=c>0&&1>c?0:e),V(e,u,c)}function ft(n,t,r){n=ht(n),t=ht(t),r=ht(r);var e=rt((.4124564*n+.3575761*t+.1804375*r)/ao),u=rt((.2126729*n+.7151522*t+.072175*r)/oo),i=rt((.0193339*n+.119192*t+.9503041*r)/co);return G(116*u-16,500*(e-u),200*(u-i))}function ht(n){return.04045>=(n/=255)?n/12.92:Math.pow((n+.055)/1.055,2.4)}function gt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function pt(n){return"function"==typeof n?n:function(){return n}}function dt(n){return n}function vt(n){return function(t,r,e){return 2===arguments.length&&"function"==typeof r&&(e=r,r=null),mt(t,r,n,e)}}function mt(n,t,r,e){function u(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=r.call(i,c)}catch(e){return a.error.call(i,e),void 0}a.load.call(i,n)}else a.error.call(i,c)}var i={},a=da.dispatch("beforesend","progress","load","error"),o={},c=new XMLHttpRequest,l=null;return!Ma.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=da.event;da.event=n;try{a.progress.call(i,c)}finally{da.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),2>arguments.length?o[n]:(null==t?delete o[n]:o[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return r=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ma(arguments)))}}),i.send=function(r,e,u){if(2===arguments.length&&"function"==typeof e&&(u=e,e=null),c.open(r,n,!0),null==t||"accept"in o||(o.accept=t+",*/*"),c.setRequestHeader)for(var s in o)c.setRequestHeader(s,o[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),a.beforesend.call(i,c),c.send(null==e?null:e),i},i.abort=function(){return c.abort(),i},da.rebind(i,a,"on"),null==e?i:i.get(yt(e))}function yt(n){return 1===n.length?function(t,r){n(null==t?r:null)}:n}function xt(){var n=bt(),t=_t()-n;t>24?(isFinite(t)&&(clearTimeout(vo),vo=setTimeout(xt,t)),po=0):(po=1,yo(xt))}function Mt(n,t,r){var e=arguments.length;2>e&&(t=0),3>e&&(r=Date.now()),mo.callback=n,mo.time=r+t}function bt(){var n=Date.now();for(mo=ho;mo;)n>=mo.time&&(mo.flush=mo.callback(n-mo.time)),mo=mo.next;return n}function _t(){for(var n,t=ho,r=1/0;t;)t.flush?t=n?n.next=t.next:ho=t.next:(r>t.time&&(r=t.time),t=(n=t).next);return go=n,r}function wt(n,t){var r=Math.pow(10,3*Math.abs(8-t));return{scale:t>8?function(n){return n/r}:function(n){return n*r},symbol:n}}function Et(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function St(n){return n+""}function kt(){}function At(n,t,r){var e=r.s=n+t,u=e-n,i=e-u;r.t=n-i+(t-u)}function Nt(n,t){n&&qo.hasOwnProperty(n.type)&&qo[n.type](n,t)}function Tt(n,t,r){var e,u=-1,i=n.length-r;for(t.lineStart();i>++u;)e=n[u],t.point(e[0],e[1],e[2]);t.lineEnd()}function qt(n,t){var r=-1,e=n.length;for(t.polygonStart();e>++r;)Tt(n[r],t,1);t.polygonEnd()}function jt(){function n(n,t){n*=Ja,t=t*Ja/2+Za/4;var r=n-e,a=Math.cos(t),o=Math.sin(t),c=i*o,l=u*a+c*Math.cos(r),s=c*Math.sin(r);zo.add(Math.atan2(s,l)),e=n,u=a,i=o}var t,r,e,u,i;Co.point=function(a,o){Co.point=n,e=(t=a)*Ja,u=Math.cos(o=(r=o)*Ja/2+Za/4),i=Math.sin(o)},Co.lineEnd=function(){n(t,r)}}function zt(n){var t=n[0],r=n[1],e=Math.cos(r);return[e*Math.cos(t),e*Math.sin(t),Math.sin(r)]}function Ct(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Dt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Ot(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Ft(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Lt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function Rt(n){return[Math.atan2(n[1],n[0]),H(n[2])]}function Ht(n,t){return Xa>Math.abs(n[0]-t[0])&&Xa>Math.abs(n[1]-t[1])}function It(n,t){n*=Ja;var r=Math.cos(t*=Ja);Pt(r*Math.cos(n),r*Math.sin(n),Math.sin(t))}function Pt(n,t,r){++Do,Fo+=(n-Fo)/Do,Lo+=(t-Lo)/Do,Ro+=(r-Ro)/Do}function Yt(){function n(n,u){n*=Ja;var i=Math.cos(u*=Ja),a=i*Math.cos(n),o=i*Math.sin(n),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=r*c-e*o)*l+(l=e*a-t*c)*l+(l=t*o-r*a)*l),t*a+r*o+e*c);Oo+=l,Ho+=l*(t+(t=a)),Io+=l*(r+(r=o)),Po+=l*(e+(e=c)),Pt(t,r,e)}var t,r,e;Vo.point=function(u,i){u*=Ja;var a=Math.cos(i*=Ja);t=a*Math.cos(u),r=a*Math.sin(u),e=Math.sin(i),Vo.point=n,Pt(t,r,e)}}function Ut(){Vo.point=It}function Bt(){function n(n,t){n*=Ja;var r=Math.cos(t*=Ja),a=r*Math.cos(n),o=r*Math.sin(n),c=Math.sin(t),l=u*c-i*o,s=i*a-e*c,f=e*o-u*a,h=Math.sqrt(l*l+s*s+f*f),g=e*a+u*o+i*c,p=h&&-R(g)/h,d=Math.atan2(h,g);Yo+=p*l,Uo+=p*s,Bo+=p*f,Oo+=d,Ho+=d*(e+(e=a)),Io+=d*(u+(u=o)),Po+=d*(i+(i=c)),Pt(e,u,i)}var t,r,e,u,i;Vo.point=function(a,o){t=a,r=o,Vo.point=n,a*=Ja;var c=Math.cos(o*=Ja);e=c*Math.cos(a),u=c*Math.sin(a),i=Math.sin(o),Pt(e,u,i)},Vo.lineEnd=function(){n(t,r),Vo.lineEnd=Ut,Vo.point=It}}function Vt(){return!0}function Zt(n,t,r,e,u){var i=[],a=[];if(n.forEach(function(n){if(!(0>=(t=n.length-1))){var t,r=n[0],e=n[t];if(Ht(r,e)){u.lineStart();for(var o=0;t>o;++o)u.point((r=n[o])[0],r[1]);return u.lineEnd(),void 0}var c={point:r,points:n,other:null,visited:!1,entry:!0,subject:!0},l={point:r,points:[r],other:c,visited:!1,entry:!1,subject:!1};c.other=l,i.push(c),a.push(l),c={point:e,points:[e],other:null,visited:!1,entry:!1,subject:!0},l={point:e,points:[e],other:c,visited:!1,entry:!0,subject:!1},c.other=l,i.push(c),a.push(l)}}),a.sort(t),Xt(i),Xt(a),i.length){if(r)for(var o=1,c=!r(a[0].point),l=a.length;l>o;++o)a[o].entry=c=!c;for(var s,f,h,g=i[0];;){for(s=g;s.visited;)if((s=s.next)===g)return;f=s.points,u.lineStart();do{if(s.visited=s.other.visited=!0,s.entry){if(s.subject)for(var o=0;f.length>o;o++)u.point((h=f[o])[0],h[1]);else e(s.point,s.next.point,1,u);s=s.next}else{if(s.subject){f=s.prev.points;for(var o=f.length;--o>=0;)u.point((h=f[o])[0],h[1])}else e(s.point,s.prev.point,-1,u);s=s.prev}s=s.other,f=s.points}while(!s.visited);u.lineEnd()}}}function Xt(n){if(t=n.length){for(var t,r,e=0,u=n[0];t>++e;)u.next=r=n[e],r.prev=u,u=r;u.next=r=n[0],r.prev=u}}function $t(n,t,r,e){return function(u){function i(t,r){n(t,r)&&u.point(t,r)}function a(n,t){d.point(n,t)}function o(){v.point=a,d.lineStart()}function c(){v.point=i,d.lineEnd()}function l(n,t){y.point(n,t),p.push([n,t])}function s(){y.lineStart(),p=[]}function f(){l(p[0][0],p[0][1]),y.lineEnd();var n,t=y.clean(),r=m.buffer(),e=r.length;if(p.pop(),g.push(p),p=null,e){if(1&t){n=r[0];var i,e=n.length-1,a=-1;for(u.lineStart();e>++a;)u.point((i=n[a])[0],i[1]);return u.lineEnd(),void 0}e>1&&2&t&&r.push(r.pop().concat(r.shift())),h.push(r.filter(Jt))}}var h,g,p,d=t(u),v={point:i,lineStart:o,lineEnd:c,polygonStart:function(){v.point=l,v.lineStart=s,v.lineEnd=f,h=[],g=[],u.polygonStart()},polygonEnd:function(){v.point=i,v.lineStart=o,v.lineEnd=c,h=da.merge(h),h.length?Zt(h,Gt,null,r,u):e(g)&&(u.lineStart(),r(null,null,1,u),u.lineEnd()),u.polygonEnd(),h=g=null},sphere:function(){u.polygonStart(),u.lineStart(),r(null,null,1,u),u.lineEnd(),u.polygonEnd()}},m=Wt(),y=t(m);return v}}function Jt(n){return n.length>1}function Wt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,r){n.push([t,r])},lineEnd:c,buffer:function(){var r=t;return t=[],n=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Gt(n,t){return(0>(n=n.point)[0]?n[1]-Za/2-Xa:Za/2-n[1])-(0>(t=t.point)[0]?t[1]-Za/2-Xa:Za/2-t[1])}function Kt(n,t){var r=n[0],e=n[1],u=[Math.sin(r),-Math.cos(r),0],i=0,a=!1,o=!1,c=0;zo.reset();for(var l=0,s=t.length;s>l;++l){var f=t[l],h=f.length;if(h){for(var g=f[0],p=g[0],d=g[1]/2+Za/4,v=Math.sin(d),m=Math.cos(d),y=1;;){y===h&&(y=0),n=f[y];var x=n[0],M=n[1]/2+Za/4,b=Math.sin(M),_=Math.cos(M),w=x-p,E=Math.abs(w)>Za,S=v*b;if(zo.add(Math.atan2(S*Math.sin(w),m*_+S*Math.cos(w))),Xa>Math.abs(M)&&(o=!0),i+=E?w+(w>=0?2:-2)*Za:w,E^p>=r^x>=r){var k=Dt(zt(g),zt(n));Lt(k);var A=Dt(u,k);Lt(A);var N=(E^w>=0?-1:1)*H(A[2]);e>N&&(c+=E^w>=0?1:-1)}if(!y++)break;p=x,v=b,m=_,g=n}Math.abs(i)>Xa&&(a=!0)}}return(!o&&!a&&0>zo||-Xa>i)^1&c}function Qt(n){var t,r=0/0,e=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,a){var o=i>0?Za:-Za,c=Math.abs(i-r);Xa>Math.abs(c-Za)?(n.point(r,e=(e+a)/2>0?Za/2:-Za/2),n.point(u,e),n.lineEnd(),n.lineStart(),n.point(o,e),n.point(i,e),t=0):u!==o&&c>=Za&&(Xa>Math.abs(r-u)&&(r-=u*Xa),Xa>Math.abs(i-o)&&(i-=o*Xa),e=nr(r,e,i,a),n.point(u,e),n.lineEnd(),n.lineStart(),n.point(o,e),t=0),n.point(r=i,e=a),u=o},lineEnd:function(){n.lineEnd(),r=e=0/0},clean:function(){return 2-t}}}function nr(n,t,r,e){var u,i,a=Math.sin(n-r);return Math.abs(a)>Xa?Math.atan((Math.sin(t)*(i=Math.cos(e))*Math.sin(r)-Math.sin(e)*(u=Math.cos(t))*Math.sin(n))/(u*i*a)):(t+e)/2}function tr(n,t,r,e){var u;if(null==n)u=r*Za/2,e.point(-Za,u),e.point(0,u),e.point(Za,u),e.point(Za,0),e.point(Za,-u),e.point(0,-u),e.point(-Za,-u),e.point(-Za,0),e.point(-Za,u);else if(Math.abs(n[0]-t[0])>Xa){var i=(n[0]<t[0]?1:-1)*Za;u=r*i/2,e.point(-i,u),e.point(0,u),e.point(i,u)}else e.point(t[0],t[1])}function rr(n){return Kt(Xo,n)}function er(n){function t(n,t){return Math.cos(n)*Math.cos(t)>a}function r(n){var r,i,a,c,s;return{lineStart:function(){c=a=!1,s=1},point:function(f,h){var g,p=[f,h],d=t(f,h),v=o?d?0:u(f,h):d?u(f+(0>f?Za:-Za),h):0;if(!r&&(c=a=d)&&n.lineStart(),d!==a&&(g=e(r,p),(Ht(r,g)||Ht(p,g))&&(p[0]+=Xa,p[1]+=Xa,d=t(p[0],p[1]))),d!==a)s=0,d?(n.lineStart(),g=e(p,r),n.point(g[0],g[1])):(g=e(r,p),n.point(g[0],g[1]),n.lineEnd()),r=g;else if(l&&r&&o^d){var m;v&i||!(m=e(p,r,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!d||r&&Ht(r,p)||n.point(p[0],p[1]),r=p,a=d,i=v},lineEnd:function(){a&&n.lineEnd(),r=null},clean:function(){return s|(c&&a)<<1}}}function e(n,t,r){var e=zt(n),u=zt(t),i=[1,0,0],o=Dt(e,u),c=Ct(o,o),l=o[0],s=c-l*l;if(!s)return!r&&n;var f=a*c/s,h=-a*l/s,g=Dt(i,o),p=Ft(i,f),d=Ft(o,h);Ot(p,d);var v=g,m=Ct(p,v),y=Ct(v,v),x=m*m-y*(Ct(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),b=Ft(v,(-m-M)/y);if(Ot(b,p),b=Rt(b),!r)return b;var _,w=n[0],E=t[0],S=n[1],k=t[1];w>E&&(_=w,w=E,E=_);var A=E-w,N=Xa>Math.abs(A-Za),T=N||Xa>A;if(!N&&S>k&&(_=S,S=k,k=_),T?N?S+k>0^b[1]<(Xa>Math.abs(b[0]-w)?S:k):b[1]>=S&&k>=b[1]:A>Za^(b[0]>=w&&E>=b[0])){var q=Ft(v,(-m+M)/y);return Ot(q,p),[b,Rt(q)]}}}function u(t,r){var e=o?n:Za-n,u=0;return-e>t?u|=1:t>e&&(u|=2),-e>r?u|=4:r>e&&(u|=8),u}function i(n){return Kt(c,n)}var a=Math.cos(n),o=a>0,c=[n,0],l=Math.abs(a)>Xa,s=Tr(n,6*Ja);return $t(t,r,s,i)}function ur(n,t,r,e){function u(e,u){return Xa>Math.abs(e[0]-n)?u>0?0:3:Xa>Math.abs(e[0]-r)?u>0?2:1:Xa>Math.abs(e[1]-t)?u>0?1:0:u>0?3:2}function i(n,t){return a(n.point,t.point)}function a(n,t){var r=u(n,1),e=u(t,1);return r!==e?r-e:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}function o(u,i){var a=i[0]-u[0],o=i[1]-u[1],c=[0,1];return Xa>Math.abs(a)&&Xa>Math.abs(o)?u[0]>=n&&r>=u[0]&&u[1]>=t&&e>=u[1]:ir(n-u[0],a,c)&&ir(u[0]-r,-a,c)&&ir(t-u[1],o,c)&&ir(u[1]-e,-o,c)?(1>c[1]&&(i[0]=u[0]+c[1]*a,i[1]=u[1]+c[1]*o),c[0]>0&&(u[0]+=c[0]*a,u[1]+=c[0]*o),!0):!1}return function(c){function l(i){var a=u(i,-1),o=s([0===a||3===a?n:r,a>1?e:t]);return o}function s(n){for(var t=0,r=x.length,e=n[1],u=0;r>u;++u)for(var i,a=1,o=x[u],c=o.length,l=o[0];c>a;++a)i=o[a],e>=l[1]?i[1]>e&&f(l,i,n)>0&&++t:e>=i[1]&&0>f(l,i,n)&&--t,l=i;return 0!==t}function f(n,t,r){return(t[0]-n[0])*(r[1]-n[1])-(r[0]-n[0])*(t[1]-n[1])}function h(i,o,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(o,c))||0>a(i,o)^c>0){do l.point(0===s||3===s?n:r,s>1?e:t);while((s=(s+c+4)%4)!==f)}else l.point(o[0],o[1])}function g(u,i){return u>=n&&r>=u&&i>=t&&e>=i}function p(n,t){g(n,t)&&c.point(n,t)}function d(){q.point=m,x&&x.push(M=[]),A=!0,k=!1,E=S=0/0}function v(){y&&(m(b,_),w&&k&&T.rejoin(),y.push(T.buffer())),q.point=p,k&&c.lineEnd()}function m(n,t){n=Math.max(-$o,Math.min($o,n)),t=Math.max(-$o,Math.min($o,t));var r=g(n,t);if(x&&M.push([n,t]),A)b=n,_=t,w=r,A=!1,r&&(c.lineStart(),c.point(n,t));else if(r&&k)c.point(n,t);else{var e=[E,S],u=[n,t];o(e,u)?(k||(c.lineStart(),c.point(e[0],e[1])),c.point(u[0],u[1]),r||c.lineEnd()):r&&(c.lineStart(),c.point(n,t))}E=n,S=t,k=r}var y,x,M,b,_,w,E,S,k,A,N=c,T=Wt(),q={point:p,lineStart:d,lineEnd:v,polygonStart:function(){c=T,y=[],x=[]},polygonEnd:function(){c=N,(y=da.merge(y)).length?(c.polygonStart(),Zt(y,i,l,h,c),c.polygonEnd()):s([n,t])&&(c.polygonStart(),c.lineStart(),h(null,null,1,c),c.lineEnd(),c.polygonEnd()),y=x=M=null}};return q}}function ir(n,t,r){if(Xa>Math.abs(t))return 0>=n;var e=n/t;if(t>0){if(e>r[1])return!1;e>r[0]&&(r[0]=e)}else{if(r[0]>e)return!1;r[1]>e&&(r[1]=e)}return!0}function ar(n,t){function r(r,e){return r=n(r,e),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,e){return r=t.invert(r,e),r&&n.invert(r[0],r[1])}),r}function or(n){var t=0,r=Za/3,e=_r(n),u=e(t,r);return u.parallels=function(n){return arguments.length?e(t=n[0]*Za/180,r=n[1]*Za/180):[180*(t/Za),180*(r/Za)]},u}function cr(n,t){function r(n,t){var r=Math.sqrt(i-2*u*Math.sin(t))/u;return[r*Math.sin(n*=u),a-r*Math.cos(n)]}var e=Math.sin(n),u=(e+Math.sin(t))/2,i=1+e*(2*u-e),a=Math.sqrt(i)/u;return r.invert=function(n,t){var r=a-t;return[Math.atan2(n,r)/u,H((i-(n*n+r*r)*u*u)/(2*u))]},r}function lr(){function n(n,t){Wo+=u*n-e*t,e=n,u=t}var t,r,e,u;tc.point=function(i,a){tc.point=n,t=e=i,r=u=a},tc.lineEnd=function(){n(t,r)}}function sr(n,t){Go>n&&(Go=n),n>Qo&&(Qo=n),Ko>t&&(Ko=t),t>nc&&(nc=t)}function fr(){function n(n,t){a.push("M",n,",",t,i)}function t(n,t){a.push("M",n,",",t),o.point=r}function r(n,t){a.push("L",n,",",t)}function e(){o.point=n}function u(){a.push("Z")}var i=hr(4.5),a=[],o={point:n,lineStart:function(){o.point=t},lineEnd:e,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=e,o.point=n},pointRadius:function(n){return i=hr(n),o},result:function(){if(a.length){var n=a.join("");return a=[],n}}};return o}function hr(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function gr(n,t){Fo+=n,Lo+=t,++Ro}function pr(){function n(n,e){var u=n-t,i=e-r,a=Math.sqrt(u*u+i*i);Ho+=a*(t+n)/2,Io+=a*(r+e)/2,Po+=a,gr(t=n,r=e)}var t,r;ec.point=function(e,u){ec.point=n,gr(t=e,r=u)}}function dr(){ec.point=gr}function vr(){function n(n,t){var r=n-e,i=t-u,a=Math.sqrt(r*r+i*i);Ho+=a*(e+n)/2,Io+=a*(u+t)/2,Po+=a,a=u*n-e*t,Yo+=a*(e+n),Uo+=a*(u+t),Bo+=3*a,gr(e=n,u=t)}var t,r,e,u;ec.point=function(i,a){ec.point=n,gr(t=e=i,r=u=a)},ec.lineEnd=function(){n(t,r)}}function mr(n){function t(t,r){n.moveTo(t,r),n.arc(t,r,a,0,2*Za)}function r(t,r){n.moveTo(t,r),o.point=e}function e(t,r){n.lineTo(t,r)}function u(){o.point=t}function i(){n.closePath()}var a=4.5,o={point:t,lineStart:function(){o.point=r},lineEnd:u,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=u,o.point=t},pointRadius:function(n){return a=n,o},result:c};return o}function yr(n){function t(t){function e(r,e){r=n(r,e),t.point(r[0],r[1])}function u(){x=0/0,E.point=a,t.lineStart()}function a(e,u){var a=zt([e,u]),o=n(e,u);r(x,M,y,b,_,w,x=o[0],M=o[1],y=e,b=a[0],_=a[1],w=a[2],i,t),t.point(x,M)}function o(){E.point=e,t.lineEnd()}function c(){u(),E.point=l,E.lineEnd=s}function l(n,t){a(f=n,h=t),g=x,p=M,d=b,v=_,m=w,E.point=a}function s(){r(x,M,y,b,_,w,g,p,f,d,v,m,i,t),E.lineEnd=o,o()}var f,h,g,p,d,v,m,y,x,M,b,_,w,E={point:e,lineStart:u,lineEnd:o,polygonStart:function(){t.polygonStart(),E.lineStart=c},polygonEnd:function(){t.polygonEnd(),E.lineStart=u}};return E}function r(t,i,a,o,c,l,s,f,h,g,p,d,v,m){var y=s-t,x=f-i,M=y*y+x*x;if(M>4*e&&v--){var b=o+g,_=c+p,w=l+d,E=Math.sqrt(b*b+_*_+w*w),S=Math.asin(w/=E),k=Xa>Math.abs(Math.abs(w)-1)?(a+h)/2:Math.atan2(_,b),A=n(k,S),N=A[0],T=A[1],q=N-t,j=T-i,z=x*q-y*j;(z*z/M>e||Math.abs((y*q+x*j)/M-.5)>.3||u>o*g+c*p+l*d)&&(r(t,i,a,o,c,l,N,T,k,b/=E,_/=E,w,v,m),m.point(N,T),r(N,T,k,b,_,w,s,f,h,g,p,d,v,m))}}var e=.5,u=Math.cos(30*Ja),i=16;return t.precision=function(n){return arguments.length?(i=(e=n*n)>0&&16,t):Math.sqrt(e)},t}function xr(n){this.stream=n}function Mr(n){var t=yr(function(t,r){return n([t*Wa,r*Wa])});return function(n){var r=new xr(n=t(n));return r.point=function(t,r){n.point(t*Ja,r*Ja)},r}}function br(n){return _r(function(){return n})()}function _r(n){function t(n){return n=o(n[0]*Ja,n[1]*Ja),[n[0]*h+c,l-n[1]*h]}function r(n){return n=o.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Wa,n[1]*Wa]}function e(){o=ar(a=Sr(m,y,x),i);var n=i(d,v);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,a,o,c,l,s,f=yr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,d=0,v=0,m=0,y=0,x=0,M=Zo,b=dt,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=wr(a,M(f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(M=null==n?(_=n,Zo):er((_=+n)*Ja),u()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?ur(n[0][0],n[0][1],n[1][0],n[1][1]):dt,u()):w},t.scale=function(n){return arguments.length?(h=+n,e()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],e()):[g,p]},t.center=function(n){return arguments.length?(d=n[0]%360*Ja,v=n[1]%360*Ja,e()):[d*Wa,v*Wa]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Ja,y=n[1]%360*Ja,x=n.length>2?n[2]%360*Ja:0,e()):[m*Wa,y*Wa,x*Wa]},da.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&r,e()}}function wr(n,t){var r=new xr(t);return r.point=function(r,e){e=n(r*Ja,e*Ja),r=e[0],t.point(r>Za?r-2*Za:-Za>r?r+2*Za:r,e[1])},r}function Er(n,t){return[n,t]}function Sr(n,t,r){return n?t||r?ar(Ar(n),Nr(t,r)):Ar(n):t||r?Nr(t,r):Er}function kr(n){return function(t,r){return t+=n,[t>Za?t-2*Za:-Za>t?t+2*Za:t,r]}}function Ar(n){var t=kr(n);return t.invert=kr(-n),t}function Nr(n,t){function r(n,t){var r=Math.cos(t),o=Math.cos(n)*r,c=Math.sin(n)*r,l=Math.sin(t),s=l*e+o*u;return[Math.atan2(c*i-s*a,o*e-l*u),H(s*i+c*a)]}var e=Math.cos(n),u=Math.sin(n),i=Math.cos(t),a=Math.sin(t);return r.invert=function(n,t){var r=Math.cos(t),o=Math.cos(n)*r,c=Math.sin(n)*r,l=Math.sin(t),s=l*i-c*a;return[Math.atan2(c*i+l*a,o*e+s*u),H(s*e-o*u)]},r}function Tr(n,t){var r=Math.cos(n),e=Math.sin(n);return function(u,i,a,o){var c=a*t;null!=u?(u=qr(r,u),i=qr(r,i),(a>0?i>u:u>i)&&(u+=2*a*Za)):(u=n+2*a*Za,i=n-.5*c);for(var l,s=u;a>0?s>i:i>s;s-=c)o.point((l=Rt([r,-e*Math.cos(s),-e*Math.sin(s)]))[0],l[1])}}function qr(n,t){var r=zt(t);r[0]-=n,Lt(r);var e=R(-r[1]);return((0>-r[2]?-e:e)+2*Math.PI-Xa)%(2*Math.PI)}function jr(n,t,r){var e=da.range(n,t-Xa,r).concat(t);return function(n){return e.map(function(t){return[n,t]})}}function zr(n,t,r){var e=da.range(n,t-Xa,r).concat(t);return function(n){return e.map(function(t){return[t,n]})}}function Cr(n){return n.source}function Dr(n){return n.target}function Or(n,t,r,e){var u=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e),c=u*Math.cos(n),l=u*Math.sin(n),s=a*Math.cos(r),f=a*Math.sin(r),h=2*Math.asin(Math.sqrt(U(e-t)+u*a*U(r-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,r=Math.sin(h-n)*g,e=r*c+t*s,u=r*l+t*f,a=r*i+t*o;return[Math.atan2(u,e)*Wa,Math.atan2(a,Math.sqrt(e*e+u*u))*Wa]}:function(){return[n*Wa,t*Wa]};return p.distance=h,p}function Fr(){function n(n,u){var i=Math.sin(u*=Ja),a=Math.cos(u),o=Math.abs((n*=Ja)-t),c=Math.cos(o);uc+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=e*i-r*a*c)*o),r*i+e*a*c),t=n,r=i,e=a}var t,r,e;ic.point=function(u,i){t=u*Ja,r=Math.sin(i*=Ja),e=Math.cos(i),ic.point=n},ic.lineEnd=function(){ic.point=ic.lineEnd=c}}function Lr(n,t){function r(t,r){var e=Math.cos(t),u=Math.cos(r),i=n(e*u);return[i*u*Math.sin(t),i*Math.sin(r)]}return r.invert=function(n,r){var e=Math.sqrt(n*n+r*r),u=t(e),i=Math.sin(u),a=Math.cos(u);return[Math.atan2(n*i,e*a),Math.asin(e&&r*i/e)]},r}function Rr(n,t){function r(n,t){var r=Xa>Math.abs(Math.abs(t)-Za/2)?0:a/Math.pow(u(t),i);return[r*Math.sin(i*n),a-r*Math.cos(i*n)]}var e=Math.cos(n),u=function(n){return Math.tan(Za/4+n/2)},i=n===t?Math.sin(n):Math.log(e/Math.cos(t))/Math.log(u(t)/u(n)),a=e*Math.pow(u(n),i)/i;return i?(r.invert=function(n,t){var r=a-t,e=L(i)*Math.sqrt(n*n+r*r);return[Math.atan2(n,r)/i,2*Math.atan(Math.pow(a/e,1/i))-Za/2]},r):Ir}function Hr(n,t){function r(n,t){var r=i-t;return[r*Math.sin(u*n),i-r*Math.cos(u*n)]}var e=Math.cos(n),u=n===t?Math.sin(n):(e-Math.cos(t))/(t-n),i=e/u+n;return Xa>Math.abs(u)?Er:(r.invert=function(n,t){var r=i-t;return[Math.atan2(n,r)/u,i-L(u)*Math.sqrt(n*n+r*r)]},r)}function Ir(n,t){return[n,Math.log(Math.tan(Za/4+t/2))]}function Pr(n){var t,r=br(n),e=r.scale,u=r.translate,i=r.clipExtent;return r.scale=function(){var n=e.apply(r,arguments);return n===r?t?r.clipExtent(null):r:n},r.translate=function(){var n=u.apply(r,arguments);return n===r?t?r.clipExtent(null):r:n},r.clipExtent=function(n){var a=i.apply(r,arguments);if(a===r){if(t=null==n){var o=Za*e(),c=u();i([[c[0]-o,c[1]-o],[c[0]+o,c[1]+o]])}}else t&&(a=null);return a},r.clipExtent(null)}function Yr(n,t){var r=Math.cos(t)*Math.sin(n);return[Math.log((1+r)/(1-r))/2,Math.atan2(Math.tan(t),Math.cos(n))]}function Ur(n){function t(t){function a(){l.push("M",i(n(s),o))}for(var c,l=[],s=[],f=-1,h=t.length,g=pt(r),p=pt(e);h>++f;)u.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(a(),s=[]);return s.length&&a(),l.length?l.join(""):null}var r=Br,e=Vr,u=Vt,i=Zr,a=i.key,o=.7;return t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(e=n,t):e},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(a="function"==typeof n?i=n:(i=fc.get(n)||Zr).key,t):a},t.tension=function(n){return arguments.length?(o=n,t):o},t}function Br(n){return n[0]}function Vr(n){return n[1]}function Zr(n){return n.join("L")}function Xr(n){return Zr(n)+"Z"}function $r(n){for(var t=0,r=n.length,e=n[0],u=[e[0],",",e[1]];r>++t;)u.push("H",(e[0]+(e=n[t])[0])/2,"V",e[1]);return r>1&&u.push("H",e[0]),u.join("")}function Jr(n){for(var t=0,r=n.length,e=n[0],u=[e[0],",",e[1]];r>++t;)u.push("V",(e=n[t])[1],"H",e[0]);return u.join("")}function Wr(n){for(var t=0,r=n.length,e=n[0],u=[e[0],",",e[1]];r>++t;)u.push("H",(e=n[t])[0],"V",e[1]);return u.join("")}function Gr(n,t){return 4>n.length?Zr(n):n[1]+ne(n.slice(1,n.length-1),te(n,t))}function Kr(n,t){return 3>n.length?Zr(n):n[0]+ne((n.push(n[0]),n),te([n[n.length-2]].concat(n,[n[1]]),t))}function Qr(n,t){return 3>n.length?Zr(n):n[0]+ne(n,te(n,t))}function ne(n,t){if(1>t.length||n.length!=t.length&&n.length!=t.length+2)return Zr(n);var r=n.length!=t.length,e="",u=n[0],i=n[1],a=t[0],o=a,c=1;if(r&&(e+="Q"+(i[0]-2*a[0]/3)+","+(i[1]-2*a[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){o=t[1],i=n[c],c++,e+="C"+(u[0]+a[0])+","+(u[1]+a[1])+","+(i[0]-o[0])+","+(i[1]-o[1])+","+i[0]+","+i[1];for(var l=2;t.length>l;l++,c++)i=n[c],o=t[l],e+="S"+(i[0]-o[0])+","+(i[1]-o[1])+","+i[0]+","+i[1]}if(r){var s=n[c];e+="Q"+(i[0]+2*o[0]/3)+","+(i[1]+2*o[1]/3)+","+s[0]+","+s[1]}return e}function te(n,t){for(var r,e=[],u=(1-t)/2,i=n[0],a=n[1],o=1,c=n.length;c>++o;)r=i,i=a,a=n[o],e.push([u*(a[0]-r[0]),u*(a[1]-r[1])]);return e}function re(n){if(3>n.length)return Zr(n);var t=1,r=n.length,e=n[0],u=e[0],i=e[1],a=[u,u,u,(e=n[1])[0]],o=[i,i,i,e[1]],c=[u,",",i,"L",ae(pc,a),",",ae(pc,o)];for(n.push(n[r-1]);r>=++t;)e=n[t],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),oe(c,a,o);return n.pop(),c.push("L",e),c.join("")}function ee(n){if(4>n.length)return Zr(n);for(var t,r=[],e=-1,u=n.length,i=[0],a=[0];3>++e;)t=n[e],i.push(t[0]),a.push(t[1]);for(r.push(ae(pc,i)+","+ae(pc,a)),--e;u>++e;)t=n[e],i.shift(),i.push(t[0]),a.shift(),a.push(t[1]),oe(r,i,a);return r.join("")}function ue(n){for(var t,r,e=-1,u=n.length,i=u+4,a=[],o=[];4>++e;)r=n[e%u],a.push(r[0]),o.push(r[1]);for(t=[ae(pc,a),",",ae(pc,o)],--e;i>++e;)r=n[e%u],a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),oe(t,a,o);return t.join("")}function ie(n,t){var r=n.length-1;if(r)for(var e,u,i=n[0][0],a=n[0][1],o=n[r][0]-i,c=n[r][1]-a,l=-1;r>=++l;)e=n[l],u=l/r,e[0]=t*e[0]+(1-t)*(i+u*o),e[1]=t*e[1]+(1-t)*(a+u*c);return re(n)}function ae(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function oe(n,t,r){n.push("C",ae(hc,t),",",ae(hc,r),",",ae(gc,t),",",ae(gc,r),",",ae(pc,t),",",ae(pc,r))}function ce(n,t){return(t[1]-n[1])/(t[0]-n[0])}function le(n){for(var t=0,r=n.length-1,e=[],u=n[0],i=n[1],a=e[0]=ce(u,i);r>++t;)e[t]=(a+(a=ce(u=i,i=n[t+1])))/2;
3
+ return e[t]=a,e}function se(n){for(var t,r,e,u,i=[],a=le(n),o=-1,c=n.length-1;c>++o;)t=ce(n[o],n[o+1]),1e-6>Math.abs(t)?a[o]=a[o+1]=0:(r=a[o]/t,e=a[o+1]/t,u=r*r+e*e,u>9&&(u=3*t/Math.sqrt(u),a[o]=u*r,a[o+1]=u*e));for(o=-1;c>=++o;)u=(n[Math.min(c,o+1)][0]-n[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),i.push([u||0,a[o]*u||0]);return i}function fe(n){return 3>n.length?Zr(n):n[0]+ne(n,se(n))}function he(n,t,r,e){var u,i,a,o,c,l,s;return u=e[n],i=u[0],a=u[1],u=e[t],o=u[0],c=u[1],u=e[r],l=u[0],s=u[1],(s-a)*(o-i)-(c-a)*(l-i)>0}function ge(n,t,r){return(r[0]-t[0])*(n[1]-t[1])<(r[1]-t[1])*(n[0]-t[0])}function pe(n,t,r,e){var u=n[0],i=r[0],a=t[0]-u,o=e[0]-i,c=n[1],l=r[1],s=t[1]-c,f=e[1]-l,h=(o*(c-l)-f*(u-i))/(f*a-o*s);return[u+h*a,c+h*s]}function de(n){var t=n[0],r=n[n.length-1];return!(t[0]-r[0]||t[1]-r[1])}function ve(n,t){var r={list:n.map(function(n,t){return{index:t,x:n[0],y:n[1]}}).sort(function(n,t){return n.y<t.y?-1:n.y>t.y?1:n.x<t.x?-1:n.x>t.x?1:0}),bottomSite:null},e={list:[],leftEnd:null,rightEnd:null,init:function(){e.leftEnd=e.createHalfEdge(null,"l"),e.rightEnd=e.createHalfEdge(null,"l"),e.leftEnd.r=e.rightEnd,e.rightEnd.l=e.leftEnd,e.list.unshift(e.leftEnd,e.rightEnd)},createHalfEdge:function(n,t){return{edge:n,side:t,vertex:null,l:null,r:null}},insert:function(n,t){t.l=n,t.r=n.r,n.r.l=t,n.r=t},leftBound:function(n){var t=e.leftEnd;do t=t.r;while(t!=e.rightEnd&&u.rightOf(t,n));return t=t.l},del:function(n){n.l.r=n.r,n.r.l=n.l,n.edge=null},right:function(n){return n.r},left:function(n){return n.l},leftRegion:function(n){return null==n.edge?r.bottomSite:n.edge.region[n.side]},rightRegion:function(n){return null==n.edge?r.bottomSite:n.edge.region[vc[n.side]]}},u={bisect:function(n,t){var r={region:{l:n,r:t},ep:{l:null,r:null}},e=t.x-n.x,u=t.y-n.y,i=e>0?e:-e,a=u>0?u:-u;return r.c=n.x*e+n.y*u+.5*(e*e+u*u),i>a?(r.a=1,r.b=u/e,r.c/=e):(r.b=1,r.a=e/u,r.c/=u),r},intersect:function(n,t){var r=n.edge,e=t.edge;if(!r||!e||r.region.r==e.region.r)return null;var u=r.a*e.b-r.b*e.a;if(1e-10>Math.abs(u))return null;var i,a,o=(r.c*e.b-e.c*r.b)/u,c=(e.c*r.a-r.c*e.a)/u,l=r.region.r,s=e.region.r;l.y<s.y||l.y==s.y&&l.x<s.x?(i=n,a=r):(i=t,a=e);var f=o>=a.region.r.x;return f&&"l"===i.side||!f&&"r"===i.side?null:{x:o,y:c}},rightOf:function(n,t){var r=n.edge,e=r.region.r,u=t.x>e.x;if(u&&"l"===n.side)return 1;if(!u&&"r"===n.side)return 0;if(1===r.a){var i=t.y-e.y,a=t.x-e.x,o=0,c=0;if(!u&&0>r.b||u&&r.b>=0?c=o=i>=r.b*a:(c=t.x+t.y*r.b>r.c,0>r.b&&(c=!c),c||(o=1)),!o){var l=e.x-r.region.l.x;c=r.b*(a*a-i*i)<l*i*(1+2*a/l+r.b*r.b),0>r.b&&(c=!c)}}else{var s=r.c-r.a*t.x,f=t.y-s,h=t.x-e.x,g=s-e.y;c=f*f>h*h+g*g}return"l"===n.side?c:!c},endPoint:function(n,r,e){n.ep[r]=e,n.ep[vc[r]]&&t(n)},distance:function(n,t){var r=n.x-t.x,e=n.y-t.y;return Math.sqrt(r*r+e*e)}},i={list:[],insert:function(n,t,r){n.vertex=t,n.ystar=t.y+r;for(var e=0,u=i.list,a=u.length;a>e;e++){var o=u[e];if(!(n.ystar>o.ystar||n.ystar==o.ystar&&t.x>o.vertex.x))break}u.splice(e,0,n)},del:function(n){for(var t=0,r=i.list,e=r.length;e>t&&r[t]!=n;++t);r.splice(t,1)},empty:function(){return 0===i.list.length},nextEvent:function(n){for(var t=0,r=i.list,e=r.length;e>t;++t)if(r[t]==n)return r[t+1];return null},min:function(){var n=i.list[0];return{x:n.vertex.x,y:n.ystar}},extractMin:function(){return i.list.shift()}};e.init(),r.bottomSite=r.list.shift();for(var a,o,c,l,s,f,h,g,p,d,v,m,y,x=r.list.shift();;)if(i.empty()||(a=i.min()),x&&(i.empty()||x.y<a.y||x.y==a.y&&x.x<a.x))o=e.leftBound(x),c=e.right(o),h=e.rightRegion(o),m=u.bisect(h,x),f=e.createHalfEdge(m,"l"),e.insert(o,f),d=u.intersect(o,f),d&&(i.del(o),i.insert(o,d,u.distance(d,x))),o=f,f=e.createHalfEdge(m,"r"),e.insert(o,f),d=u.intersect(f,c),d&&i.insert(f,d,u.distance(d,x)),x=r.list.shift();else{if(i.empty())break;o=i.extractMin(),l=e.left(o),c=e.right(o),s=e.right(c),h=e.leftRegion(o),g=e.rightRegion(c),v=o.vertex,u.endPoint(o.edge,o.side,v),u.endPoint(c.edge,c.side,v),e.del(o),i.del(c),e.del(c),y="l",h.y>g.y&&(p=h,h=g,g=p,y="r"),m=u.bisect(h,g),f=e.createHalfEdge(m,y),e.insert(l,f),u.endPoint(m,vc[y],v),d=u.intersect(l,f),d&&(i.del(l),i.insert(l,d,u.distance(d,h))),d=u.intersect(f,s),d&&i.insert(f,d,u.distance(d,h))}for(o=e.right(e.leftEnd);o!=e.rightEnd;o=e.right(o))t(o.edge)}function me(n){return n.x}function ye(n){return n.y}function xe(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function Me(n,t,r,e,u,i){if(!n(t,r,e,u,i)){var a=.5*(r+u),o=.5*(e+i),c=t.nodes;c[0]&&Me(n,c[0],r,e,a,o),c[1]&&Me(n,c[1],a,e,u,o),c[2]&&Me(n,c[2],r,o,a,i),c[3]&&Me(n,c[3],a,o,u,i)}}function be(n,t){n=da.rgb(n),t=da.rgb(t);var r=n.r,e=n.g,u=n.b,i=t.r-r,a=t.g-e,o=t.b-u;return function(n){return"#"+ct(Math.round(r+i*n))+ct(Math.round(e+a*n))+ct(Math.round(u+o*n))}}function _e(n,t){var r,e={},u={};for(r in n)r in t?e[r]=Se(n[r],t[r]):u[r]=n[r];for(r in t)r in n||(u[r]=t[r]);return function(n){for(r in e)u[r]=e[r](n);return u}}function we(n,t){return t-=n=+n,function(r){return n+t*r}}function Ee(n,t){var r,e,u,i,a,o=0,c=0,l=[],s=[];for(n+="",t+="",mc.lastIndex=0,e=0;r=mc.exec(t);++e)r.index&&l.push(t.substring(o,c=r.index)),s.push({i:l.length,x:r[0]}),l.push(null),o=mc.lastIndex;for(t.length>o&&l.push(t.substring(o)),e=0,i=s.length;(r=mc.exec(n))&&i>e;++e)if(a=s[e],a.x==r[0]){if(a.i)if(null==l[a.i+1])for(l[a.i-1]+=a.x,l.splice(a.i,1),u=e+1;i>u;++u)s[u].i--;else for(l[a.i-1]+=a.x+l[a.i+1],l.splice(a.i,2),u=e+1;i>u;++u)s[u].i-=2;else if(null==l[a.i+1])l[a.i]=a.x;else for(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1),u=e+1;i>u;++u)s[u].i--;s.splice(e,1),i--,e--}else a.x=we(parseFloat(r[0]),parseFloat(a.x));for(;i>e;)a=s.pop(),null==l[a.i+1]?l[a.i]=a.x:(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1)),i--;return 1===l.length?null==l[0]?(a=s[0].x,function(n){return a(n)+""}):function(){return t}:function(n){for(e=0;i>e;++e)l[(a=s[e]).i]=a.x(n);return l.join("")}}function Se(n,t){for(var r,e=da.interpolators.length;--e>=0&&!(r=da.interpolators[e](n,t)););return r}function ke(n,t){var r,e=[],u=[],i=n.length,a=t.length,o=Math.min(n.length,t.length);for(r=0;o>r;++r)e.push(Se(n[r],t[r]));for(;i>r;++r)u[r]=n[r];for(;a>r;++r)u[r]=t[r];return function(n){for(r=0;o>r;++r)u[r]=e[r](n);return u}}function Ae(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function Ne(n){return function(t){return 1-n(1-t)}}function Te(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function qe(n){return n*n}function je(n){return n*n*n}function ze(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,r=t*n;return 4*(.5>n?r:3*(n-t)+r-.75)}function Ce(n){return function(t){return Math.pow(t,n)}}function De(n){return 1-Math.cos(n*Za/2)}function Oe(n){return Math.pow(2,10*(n-1))}function Fe(n){return 1-Math.sqrt(1-n*n)}function Le(n,t){var r;return 2>arguments.length&&(t=.45),arguments.length?r=t/(2*Za)*Math.asin(1/n):(n=1,r=t/4),function(e){return 1+n*Math.pow(2,10*-e)*Math.sin(2*(e-r)*Za/t)}}function Re(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function He(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Ie(n,t){n=da.hcl(n),t=da.hcl(t);var r=n.h,e=n.c,u=n.l,i=t.h-r,a=t.c-e,o=t.l-u;return isNaN(a)&&(a=0,e=isNaN(e)?t.c:e),isNaN(i)?(i=0,r=isNaN(r)?t.h:r):i>180?i-=360:-180>i&&(i+=360),function(n){return W(r+i*n,e+a*n,u+o*n)+""}}function Pe(n,t){n=da.hsl(n),t=da.hsl(t);var r=n.h,e=n.s,u=n.l,i=t.h-r,a=t.s-e,o=t.l-u;return isNaN(a)&&(a=0,e=isNaN(e)?t.s:e),isNaN(i)?(i=0,r=isNaN(r)?t.h:r):i>180?i-=360:-180>i&&(i+=360),function(n){return X(r+i*n,e+a*n,u+o*n)+""}}function Ye(n,t){n=da.lab(n),t=da.lab(t);var r=n.l,e=n.a,u=n.b,i=t.l-r,a=t.a-e,o=t.b-u;return function(n){return Q(r+i*n,e+a*n,u+o*n)+""}}function Ue(n,t){return t-=n,function(r){return Math.round(n+t*r)}}function Be(n){var t=[n.a,n.b],r=[n.c,n.d],e=Ze(t),u=Ve(t,r),i=Ze(Xe(r,t,-u))||0;t[0]*r[1]<r[0]*t[1]&&(t[0]*=-1,t[1]*=-1,e*=-1,u*=-1),this.rotate=(e?Math.atan2(t[1],t[0]):Math.atan2(-r[0],r[1]))*Wa,this.translate=[n.e,n.f],this.scale=[e,i],this.skew=i?Math.atan2(u,i)*Wa:0}function Ve(n,t){return n[0]*t[0]+n[1]*t[1]}function Ze(n){var t=Math.sqrt(Ve(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Xe(n,t,r){return n[0]+=r*t[0],n[1]+=r*t[1],n}function $e(n,t){var r,e=[],u=[],i=da.transform(n),a=da.transform(t),o=i.translate,c=a.translate,l=i.rotate,s=a.rotate,f=i.skew,h=a.skew,g=i.scale,p=a.scale;return o[0]!=c[0]||o[1]!=c[1]?(e.push("translate(",null,",",null,")"),u.push({i:1,x:we(o[0],c[0])},{i:3,x:we(o[1],c[1])})):c[0]||c[1]?e.push("translate("+c+")"):e.push(""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),u.push({i:e.push(e.pop()+"rotate(",null,")")-2,x:we(l,s)})):s&&e.push(e.pop()+"rotate("+s+")"),f!=h?u.push({i:e.push(e.pop()+"skewX(",null,")")-2,x:we(f,h)}):h&&e.push(e.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(r=e.push(e.pop()+"scale(",null,",",null,")"),u.push({i:r-4,x:we(g[0],p[0])},{i:r-2,x:we(g[1],p[1])})):(1!=p[0]||1!=p[1])&&e.push(e.pop()+"scale("+p+")"),r=u.length,function(n){for(var t,i=-1;r>++i;)e[(t=u[i]).i]=t.x(n);return e.join("")}}function Je(n,t){return t=t-(n=+n)?1/(t-n):0,function(r){return(r-n)*t}}function We(n,t){return t=t-(n=+n)?1/(t-n):0,function(r){return Math.max(0,Math.min(1,(r-n)*t))}}function Ge(n){for(var t=n.source,r=n.target,e=Qe(t,r),u=[t];t!==e;)t=t.parent,u.push(t);for(var i=u.length;r!==e;)u.splice(i,0,r),r=r.parent;return u}function Ke(n){for(var t=[],r=n.parent;null!=r;)t.push(n),n=r,r=r.parent;return t.push(n),t}function Qe(n,t){if(n===t)return n;for(var r=Ke(n),e=Ke(t),u=r.pop(),i=e.pop(),a=null;u===i;)a=u,u=r.pop(),i=e.pop();return a}function nu(n){n.fixed|=2}function tu(n){n.fixed&=-7}function ru(n){n.fixed|=4,n.px=n.x,n.py=n.y}function eu(n){n.fixed&=-5}function uu(n,t,r){var e=0,u=0;if(n.charge=0,!n.leaf)for(var i,a=n.nodes,o=a.length,c=-1;o>++c;)i=a[c],null!=i&&(uu(i,t,r),n.charge+=i.charge,e+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*r[n.point.index];n.charge+=n.pointCharge=l,e+=l*n.point.x,u+=l*n.point.y}n.cx=e/n.charge,n.cy=u/n.charge}function iu(n,t){return da.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=lu,n}function au(n){return n.children}function ou(n){return n.value}function cu(n,t){return t.value-n.value}function lu(n){return da.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function su(n){return n.x}function fu(n){return n.y}function hu(n,t,r){n.y0=t,n.y=r}function gu(n){return da.range(n.length)}function pu(n){for(var t=-1,r=n[0].length,e=[];r>++t;)e[t]=0;return e}function du(n){for(var t,r=1,e=0,u=n[0][1],i=n.length;i>r;++r)(t=n[r][1])>u&&(e=r,u=t);return e}function vu(n){return n.reduce(mu,0)}function mu(n,t){return n+t[1]}function yu(n,t){return xu(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xu(n,t){for(var r=-1,e=+n[0],u=(n[1]-e)/t,i=[];t>=++r;)i[r]=u*r+e;return i}function Mu(n){return[da.min(n),da.max(n)]}function bu(n,t){return n.parent==t.parent?1:2}function _u(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function wu(n){var t,r=n.children;return r&&(t=r.length)?r[t-1]:n._tree.thread}function Eu(n,t){var r=n.children;if(r&&(u=r.length))for(var e,u,i=-1;u>++i;)t(e=Eu(r[i],t),n)>0&&(n=e);return n}function Su(n,t){return n.x-t.x}function ku(n,t){return t.x-n.x}function Au(n,t){return n.depth-t.depth}function Nu(n,t){function r(n,e){var u=n.children;if(u&&(a=u.length))for(var i,a,o=null,c=-1;a>++c;)i=u[c],r(i,o),o=i;t(n,e)}r(n,null)}function Tu(n){for(var t,r=0,e=0,u=n.children,i=u.length;--i>=0;)t=u[i]._tree,t.prelim+=r,t.mod+=r,r+=t.shift+(e+=t.change)}function qu(n,t,r){n=n._tree,t=t._tree;var e=r/(t.number-n.number);n.change+=e,t.change-=e,t.shift+=r,t.prelim+=r,t.mod+=r}function ju(n,t,r){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:r}function zu(n,t){return n.value-t.value}function Cu(n,t){var r=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=r,r._pack_prev=t}function Du(n,t){n._pack_next=t,t._pack_prev=n}function Ou(n,t){var r=t.x-n.x,e=t.y-n.y,u=n.r+t.r;return.999*u*u>r*r+e*e}function Fu(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((r=n.children)&&(l=r.length)){var r,e,u,i,a,o,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(r.forEach(Lu),e=r[0],e.x=-e.r,e.y=0,t(e),l>1&&(u=r[1],u.x=u.r,u.y=0,t(u),l>2))for(i=r[2],Iu(e,u,i),t(i),Cu(e,i),e._pack_prev=i,Cu(i,u),u=e._pack_next,a=3;l>a;a++){Iu(e,u,i=r[a]);var p=0,d=1,v=1;for(o=u._pack_next;o!==u;o=o._pack_next,d++)if(Ou(o,i)){p=1;break}if(1==p)for(c=e._pack_prev;c!==o._pack_prev&&!Ou(c,i);c=c._pack_prev,v++);p?(v>d||d==v&&u.r<e.r?Du(e,u=o):Du(e=c,u),a--):(Cu(e,i),u=i,t(i))}var m=(s+f)/2,y=(h+g)/2,x=0;for(a=0;l>a;a++)i=r[a],i.x-=m,i.y-=y,x=Math.max(x,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=x,r.forEach(Ru)}}function Lu(n){n._pack_next=n._pack_prev=n}function Ru(n){delete n._pack_next,delete n._pack_prev}function Hu(n,t,r,e){var u=n.children;if(n.x=t+=e*n.x,n.y=r+=e*n.y,n.r*=e,u)for(var i=-1,a=u.length;a>++i;)Hu(u[i],t,r,e)}function Iu(n,t,r){var e=n.r+r.r,u=t.x-n.x,i=t.y-n.y;if(e&&(u||i)){var a=t.r+r.r,o=u*u+i*i;a*=a,e*=e;var c=.5+(e-a)/(2*o),l=Math.sqrt(Math.max(0,2*a*(e+o)-(e-=o)*e-a*a))/(2*o);r.x=n.x+c*u+l*i,r.y=n.y+c*i-l*u}else r.x=n.x+e,r.y=n.y}function Pu(n){return 1+da.max(n,function(n){return n.y})}function Yu(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Uu(n){var t=n.children;return t&&t.length?Uu(t[0]):n}function Bu(n){var t,r=n.children;return r&&(t=r.length)?Bu(r[t-1]):n}function Vu(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Zu(n,t){var r=n.x+t[3],e=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(r+=u/2,u=0),0>i&&(e+=i/2,i=0),{x:r,y:e,dx:u,dy:i}}function Xu(n){var t=n[0],r=n[n.length-1];return r>t?[t,r]:[r,t]}function $u(n){return n.rangeExtent?n.rangeExtent():Xu(n.range())}function Ju(n,t,r,e){var u=r(n[0],n[1]),i=e(t[0],t[1]);return function(n){return i(u(n))}}function Wu(n,t){var r,e=0,u=n.length-1,i=n[e],a=n[u];return i>a&&(r=e,e=u,u=r,r=i,i=a,a=r),n[e]=t.floor(i),n[u]=t.ceil(a),n}function Gu(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:Ac}function Ku(n,t,r,e){var u=[],i=[],a=0,o=Math.min(n.length,t.length)-1;for(n[o]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());o>=++a;)u.push(r(n[a-1],n[a])),i.push(e(t[a-1],t[a]));return function(t){var r=da.bisect(n,t,1,o)-1;return i[r](u[r](t))}}function Qu(n,t,r,e){function u(){var u=Math.min(n.length,t.length)>2?Ku:Ju,c=e?We:Je;return a=u(n,t,c,r),o=u(t,n,c,Se),i}function i(n){return a(n)}var a,o;return i.invert=function(n){return o(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Ue)},i.clamp=function(n){return arguments.length?(e=n,u()):e},i.interpolate=function(n){return arguments.length?(r=n,u()):r},i.ticks=function(t){return ei(n,t)},i.tickFormat=function(t,r){return ui(n,t,r)},i.nice=function(t){return ti(n,t),u()},i.copy=function(){return Qu(n,t,r,e)},u()}function ni(n,t){return da.rebind(n,t,"range","rangeRound","interpolate","clamp")}function ti(n,t){return Wu(n,Gu(ri(n,t)[2]))}function ri(n,t){null==t&&(t=10);var r=Xu(n),e=r[1]-r[0],u=Math.pow(10,Math.floor(Math.log(e/t)/Math.LN10)),i=t/e*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),r[0]=Math.ceil(r[0]/u)*u,r[1]=Math.floor(r[1]/u)*u+.5*u,r[2]=u,r}function ei(n,t){return da.range.apply(da,ri(n,t))}function ui(n,t,r){var e=-Math.floor(Math.log(ri(n,t)[2])/Math.LN10+.01);return da.format(r?r.replace(Eo,function(n,t,r,u,i,a,o,c,l,s){return[t,r,u,i,a,o,c,l||"."+(e-2*("%"===s)),s].join("")}):",."+e+"f")}function ii(n,t,r,e){function u(n){return(r?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return r?Math.pow(t,n):-Math.pow(t,-n)}function a(t){return n(u(t))}return a.invert=function(t){return i(n.invert(t))},a.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((e=t.map(Number)).map(u)),a):e},a.base=function(r){return arguments.length?(t=+r,n.domain(e.map(u)),a):t},a.nice=function(){var t=Wu(e.map(u),r?Math:Tc);return n.domain(t),e=t.map(i),a},a.ticks=function(){var n=Xu(e),a=[],o=n[0],c=n[1],l=Math.floor(u(o)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(r){for(;s>l;l++)for(var h=1;f>h;h++)a.push(i(l)*h);a.push(i(l))}else for(a.push(i(l));s>l++;)for(var h=f-1;h>0;h--)a.push(i(l)*h);for(l=0;o>a[l];l++);for(s=a.length;a[s-1]>c;s--);a=a.slice(l,s)}return a},a.tickFormat=function(n,t){if(!arguments.length)return Nc;2>arguments.length?t=Nc:"function"!=typeof t&&(t=da.format(t));var e,o=Math.max(.1,n/a.ticks().length),c=r?(e=1e-12,Math.ceil):(e=-1e-12,Math.floor);return function(n){return o>=n/i(c(u(n)+e))?t(n):""}},a.copy=function(){return ii(n.copy(),t,r,e)},ni(a,n)}function ai(n,t,r){function e(t){return n(u(t))}var u=oi(t),i=oi(1/t);return e.invert=function(t){return i(n.invert(t))},e.domain=function(t){return arguments.length?(n.domain((r=t.map(Number)).map(u)),e):r},e.ticks=function(n){return ei(r,n)},e.tickFormat=function(n,t){return ui(r,n,t)},e.nice=function(n){return e.domain(ti(r,n))},e.exponent=function(a){return arguments.length?(u=oi(t=a),i=oi(1/t),n.domain(r.map(u)),e):t},e.copy=function(){return ai(n.copy(),t,r)},ni(e,n)}function oi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ci(n,t){function r(t){return a[((i.get(t)||i.set(t,n.push(t)))-1)%a.length]}function e(t,r){return da.range(n.length).map(function(n){return t+r*n})}var i,a,o;return r.domain=function(e){if(!arguments.length)return n;n=[],i=new u;for(var a,o=-1,c=e.length;c>++o;)i.has(a=e[o])||i.set(a,n.push(a));return r[t.t].apply(r,t.a)},r.range=function(n){return arguments.length?(a=n,o=0,t={t:"range",a:arguments},r):a},r.rangePoints=function(u,i){2>arguments.length&&(i=0);var c=u[0],l=u[1],s=(l-c)/(Math.max(1,n.length-1)+i);return a=e(2>n.length?(c+l)/2:c+s*i/2,s),o=0,t={t:"rangePoints",a:arguments},r},r.rangeBands=function(u,i,c){2>arguments.length&&(i=0),3>arguments.length&&(c=i);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=(f-s)/(n.length-i+2*c);return a=e(s+h*c,h),l&&a.reverse(),o=h*(1-i),t={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(u,i,c){2>arguments.length&&(i=0),3>arguments.length&&(c=i);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=Math.floor((f-s)/(n.length-i+2*c)),g=f-s-(n.length-i)*h;return a=e(s+Math.round(g/2),h),l&&a.reverse(),o=Math.round(h*(1-i)),t={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return o},r.rangeExtent=function(){return Xu(t.a[0])},r.copy=function(){return ci(n,t)},r.domain(n)}function li(n,t){function r(){var r=0,i=t.length;for(u=[];i>++r;)u[r-1]=da.quantile(n,r/i);return e}function e(n){return isNaN(n=+n)?void 0:t[da.bisect(u,n)]}var u;return e.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(da.ascending),r()):n},e.range=function(n){return arguments.length?(t=n,r()):t},e.quantiles=function(){return u},e.invertExtent=function(r){return r=t.indexOf(r),0>r?[0/0,0/0]:[r>0?u[r-1]:n[0],u.length>r?u[r]:n[n.length-1]]},e.copy=function(){return li(n,t)},r()}function si(n,t,r){function e(t){return r[Math.max(0,Math.min(a,Math.floor(i*(t-n))))]}function u(){return i=r.length/(t-n),a=r.length-1,e}var i,a;return e.domain=function(r){return arguments.length?(n=+r[0],t=+r[r.length-1],u()):[n,t]},e.range=function(n){return arguments.length?(r=n,u()):r},e.invertExtent=function(t){return t=r.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},e.copy=function(){return si(n,t,r)},u()}function fi(n,t){function r(r){return r>=r?t[da.bisect(n,r)]:void 0}return r.domain=function(t){return arguments.length?(n=t,r):n},r.range=function(n){return arguments.length?(t=n,r):t},r.invertExtent=function(r){return r=t.indexOf(r),[n[r-1],n[r]]},r.copy=function(){return fi(n,t)},r}function hi(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(r){return arguments.length?(n=r.map(t),t):n},t.ticks=function(t){return ei(n,t)},t.tickFormat=function(t,r){return ui(n,t,r)},t.copy=function(){return hi(n)},t}function gi(n){return n.innerRadius}function pi(n){return n.outerRadius}function di(n){return n.startAngle}function vi(n){return n.endAngle}function mi(n){for(var t,r,e,u=-1,i=n.length;i>++u;)t=n[u],r=t[0],e=t[1]+Dc,t[0]=r*Math.cos(e),t[1]=r*Math.sin(e);return n}function yi(n){function t(t){function c(){d.push("M",o(n(m),f),s,l(n(v.reverse()),f),"Z")}for(var h,g,p,d=[],v=[],m=[],y=-1,x=t.length,M=pt(r),b=pt(u),_=r===e?function(){return g}:pt(e),w=u===i?function(){return p}:pt(i);x>++y;)a.call(this,h=t[y],y)?(v.push([g=+M.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):v.length&&(c(),v=[],m=[]);return v.length&&c(),d.length?d.join(""):null}var r=Br,e=Br,u=0,i=Vr,a=Vt,o=Zr,c=o.key,l=o,s="L",f=.7;return t.x=function(n){return arguments.length?(r=e=n,t):e},t.x0=function(n){return arguments.length?(r=n,t):r},t.x1=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(a=n,t):a},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?o=n:(o=fc.get(n)||Zr).key,l=o.reverse||o,s=o.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function xi(n){return n.radius}function Mi(n){return[n.x,n.y]}function bi(n){return function(){var t=n.apply(this,arguments),r=t[0],e=t[1]+Dc;return[r*Math.cos(e),r*Math.sin(e)]}}function _i(){return 64}function wi(){return"circle"}function Ei(n){var t=Math.sqrt(n/Za);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Si(n,t){return Ca(n,Pc),n.id=t,n}function ki(n,t,r,e){var u=n.id;return N(n,"function"==typeof r?function(n,i,a){n.__transition__[u].tween.set(t,e(r.call(n,n.__data__,i,a)))}:(r=e(r),function(n){n.__transition__[u].tween.set(t,r)}))}function Ai(n){return null==n&&(n=""),function(){this.textContent=n}}function Ni(n,t,r,e){var i=n.__transition__||(n.__transition__={active:0,count:0}),a=i[r];if(!a){var o=e.time;a=i[r]={tween:new u,time:o,ease:e.ease,delay:e.delay,duration:e.duration},++i.count,da.timer(function(e){function u(e){return i.active>r?l():(i.active=r,a.event&&a.event.start.call(n,s,t),a.tween.forEach(function(r,e){(e=e.call(n,s,t))&&p.push(e)}),c(e)?1:(Mt(c,0,o),void 0))}function c(e){if(i.active!==r)return l();for(var u=(e-h)/g,o=f(u),c=p.length;c>0;)p[--c].call(n,o);return u>=1?(a.event&&a.event.end.call(n,s,t),l()):void 0}function l(){return--i.count?delete i[r]:delete n.__transition__,1}var s=n.__data__,f=a.ease,h=a.delay,g=a.duration,p=[];return e>=h?u(e):(Mt(u,h,o),void 0)},0,o)}}function Ti(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function qi(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function ji(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function zi(n,t,r){function e(t){var r=n(t),e=i(r,1);return e-t>t-r?r:e}function u(r){return t(r=n(new $c(r-1)),1),r}function i(n,r){return t(n=new $c(+n),r),n}function a(n,e,i){var a=u(n),o=[];if(i>1)for(;e>a;)r(a)%i||o.push(new Date(+a)),t(a,1);else for(;e>a;)o.push(new Date(+a)),t(a,1);return o}function o(n,t,r){try{$c=ji;var e=new ji;return e._=n,a(e,t,r)}finally{$c=Date}}n.floor=n,n.round=e,n.ceil=u,n.offset=i,n.range=a;var c=n.utc=Ci(n);return c.floor=c,c.round=Ci(e),c.ceil=Ci(u),c.offset=Ci(i),c.range=o,n}function Ci(n){return function(t,r){try{$c=ji;var e=new ji;return e._=t,n(e,r)._}finally{$c=Date}}}function Di(n){function t(t){for(var e,u,i,a=[],o=-1,c=0;r>++o;)37===n.charCodeAt(o)&&(a.push(n.substring(c,o)),null!=(u=gl[e=n.charAt(++o)])&&(e=n.charAt(++o)),(i=pl[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),a.push(e),c=o+1);return a.push(n.substring(c,o)),a.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},e=Oi(r,n,t,0);if(e!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var u=new $c;return"j"in r?u.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(u.setFullYear(r.y,0,1),u.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(u.getDay()+5)%7:r.w+7*r.U-(u.getDay()+6)%7)):u.setFullYear(r.y,r.m,r.d),u.setHours(r.H,r.M,r.S,r.L),u},t.toString=function(){return n},t}function Oi(n,t,r,e){for(var u,i,a,o=0,c=t.length,l=r.length;c>o;){if(e>=l)return-1;if(u=t.charCodeAt(o++),37===u){if(a=t.charAt(o++),i=dl[a in gl?t.charAt(o++):a],!i||0>(e=i(n,r,e)))return-1}else if(u!=r.charCodeAt(e++))return-1}return e}function Fi(n){return RegExp("^(?:"+n.map(da.requote).join("|")+")","i")}function Li(n){for(var t=new u,r=-1,e=n.length;e>++r;)t.set(n[r].toLowerCase(),r);return t}function Ri(n,t,r){var e=0>n?"-":"",u=(e?-n:n)+"",i=u.length;return e+(r>i?Array(r-i+1).join(t)+u:u)}function Hi(n,t,r){al.lastIndex=0;var e=al.exec(t.substring(r));return e?(n.w=ol.get(e[0].toLowerCase()),r+e[0].length):-1}function Ii(n,t,r){ul.lastIndex=0;var e=ul.exec(t.substring(r));return e?(n.w=il.get(e[0].toLowerCase()),r+e[0].length):-1}function Pi(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+1));return e?(n.w=+e[0],r+e[0].length):-1}function Yi(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r));return e?(n.U=+e[0],r+e[0].length):-1}function Ui(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r));return e?(n.W=+e[0],r+e[0].length):-1}function Bi(n,t,r){sl.lastIndex=0;var e=sl.exec(t.substring(r));return e?(n.m=fl.get(e[0].toLowerCase()),r+e[0].length):-1}function Vi(n,t,r){cl.lastIndex=0;var e=cl.exec(t.substring(r));return e?(n.m=ll.get(e[0].toLowerCase()),r+e[0].length):-1}function Zi(n,t,r){return Oi(n,""+pl.c,t,r)}function Xi(n,t,r){return Oi(n,""+pl.x,t,r)}function $i(n,t,r){return Oi(n,""+pl.X,t,r)}function Ji(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+4));return e?(n.y=+e[0],r+e[0].length):-1}function Wi(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.y=Gi(+e[0]),r+e[0].length):-1}function Gi(n){return n+(n>68?1900:2e3)}function Ki(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.m=e[0]-1,r+e[0].length):-1}function Qi(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.d=+e[0],r+e[0].length):-1}function na(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+3));return e?(n.j=+e[0],r+e[0].length):-1}function ta(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.H=+e[0],r+e[0].length):-1}function ra(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.M=+e[0],r+e[0].length):-1}function ea(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+2));return e?(n.S=+e[0],r+e[0].length):-1}function ua(n,t,r){vl.lastIndex=0;var e=vl.exec(t.substring(r,r+3));return e?(n.L=+e[0],r+e[0].length):-1}function ia(n,t,r){var e=ml.get(t.substring(r,r+=2).toLowerCase());return null==e?-1:(n.p=e,r)}function aa(n){var t=n.getTimezoneOffset(),r=t>0?"-":"+",e=~~(Math.abs(t)/60),u=Math.abs(t)%60;return r+Ri(e,"0",2)+Ri(u,"0",2)}function oa(n,t,r){hl.lastIndex=0;var e=hl.exec(t.substring(r,r+1));return e?r+e[0].length:-1}function ca(n){function t(n){try{$c=ji;var t=new $c;return t._=n,r(t)}finally{$c=Date}}var r=Di(n);return t.parse=function(n){try{$c=ji;var t=r.parse(n);return t&&t._}finally{$c=Date}},t.toString=r.toString,t}function la(n){return n.toISOString()}function sa(n,t,r){function e(t){return n(t)}function u(n,r){var e=n[1]-n[0],u=e/r,i=da.bisect(xl,u);return i==xl.length?[t.year,ri(n.map(function(n){return n/31536e6}),r)[2]]:i?t[u/xl[i-1]<xl[i]/u?i-1:i]:[wl,ri(n,r)[2]]}return e.invert=function(t){return fa(n.invert(t))},e.domain=function(t){return arguments.length?(n.domain(t),e):n.domain().map(fa)},e.nice=function(n,t){function r(r){return!isNaN(r)&&!n.range(r,fa(+r+1),t).length}var i=e.domain(),a=Xu(i),o=null==n?u(a,10):"number"==typeof n&&u(a,n);return o&&(n=o[0],t=o[1]),e.domain(Wu(i,t>1?{floor:function(t){for(;r(t=n.floor(t));)t=fa(t-1);return t},ceil:function(t){for(;r(t=n.ceil(t));)t=fa(+t+1);return t}}:n))},e.ticks=function(n,t){var r=Xu(e.domain()),i=null==n?u(r,10):"number"==typeof n?u(r,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(r[0],fa(+r[1]+1),t)},e.tickFormat=function(){return r},e.copy=function(){return sa(n.copy(),t,r)},ni(e,n)}function fa(n){return new Date(n)}function ha(n){return function(t){for(var r=n.length-1,e=n[r];!e[1](t);)e=n[--r];return e[0](t)}}function ga(n){return JSON.parse(n.responseText)}function pa(n){var t=ya.createRange();return t.selectNode(ya.body),t.createContextualFragment(n.responseText)}var da={version:"3.3.2"};Date.now||(Date.now=function(){return+new Date});var va=[].slice,ma=function(n){return va.call(n)},ya=document,xa=ya.documentElement,Ma=window;try{ma(xa.childNodes)[0].nodeType}catch(ba){ma=function(n){for(var t=n.length,r=Array(t);t--;)r[t]=n[t];return r}}try{ya.createElement("div").style.setProperty("opacity",0,"")}catch(_a){var wa=Ma.Element.prototype,Ea=wa.setAttribute,Sa=wa.setAttributeNS,ka=Ma.CSSStyleDeclaration.prototype,Aa=ka.setProperty;wa.setAttribute=function(n,t){Ea.call(this,n,t+"")},wa.setAttributeNS=function(n,t,r){Sa.call(this,n,t,r+"")},ka.setProperty=function(n,t,r){Aa.call(this,n,t+"",r)}}da.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},da.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},da.min=function(n,t){var r,e,u=-1,i=n.length;if(1===arguments.length){for(;i>++u&&!(null!=(r=n[u])&&r>=r);)r=void 0;for(;i>++u;)null!=(e=n[u])&&r>e&&(r=e)}else{for(;i>++u&&!(null!=(r=t.call(n,n[u],u))&&r>=r);)r=void 0;for(;i>++u;)null!=(e=t.call(n,n[u],u))&&r>e&&(r=e)}return r},da.max=function(n,t){var r,e,u=-1,i=n.length;if(1===arguments.length){for(;i>++u&&!(null!=(r=n[u])&&r>=r);)r=void 0;for(;i>++u;)null!=(e=n[u])&&e>r&&(r=e)}else{for(;i>++u&&!(null!=(r=t.call(n,n[u],u))&&r>=r);)r=void 0;for(;i>++u;)null!=(e=t.call(n,n[u],u))&&e>r&&(r=e)}return r},da.extent=function(n,t){var r,e,u,i=-1,a=n.length;if(1===arguments.length){for(;a>++i&&!(null!=(r=u=n[i])&&r>=r);)r=u=void 0;for(;a>++i;)null!=(e=n[i])&&(r>e&&(r=e),e>u&&(u=e))}else{for(;a>++i&&!(null!=(r=u=t.call(n,n[i],i))&&r>=r);)r=void 0;for(;a>++i;)null!=(e=t.call(n,n[i],i))&&(r>e&&(r=e),e>u&&(u=e))}return[r,u]},da.sum=function(n,t){var r,e=0,u=n.length,i=-1;if(1===arguments.length)for(;u>++i;)isNaN(r=+n[i])||(e+=r);else for(;u>++i;)isNaN(r=+t.call(n,n[i],i))||(e+=r);return e},da.mean=function(t,r){var e,u=t.length,i=0,a=-1,o=0;if(1===arguments.length)for(;u>++a;)n(e=t[a])&&(i+=(e-i)/++o);else for(;u>++a;)n(e=r.call(t,t[a],a))&&(i+=(e-i)/++o);return o?i:void 0},da.quantile=function(n,t){var r=(n.length-1)*t+1,e=Math.floor(r),u=+n[e-1],i=r-e;return i?u+i*(n[e]-u):u},da.median=function(t,r){return arguments.length>1&&(t=t.map(r)),t=t.filter(n),t.length?da.quantile(t.sort(da.ascending),.5):void 0},da.bisector=function(n){return{left:function(t,r,e,u){for(3>arguments.length&&(e=0),4>arguments.length&&(u=t.length);u>e;){var i=e+u>>>1;r>n.call(t,t[i],i)?e=i+1:u=i}return e},right:function(t,r,e,u){for(3>arguments.length&&(e=0),4>arguments.length&&(u=t.length);u>e;){var i=e+u>>>1;n.call(t,t[i],i)>r?u=i:e=i+1}return e}}};var Na=da.bisector(function(n){return n});da.bisectLeft=Na.left,da.bisect=da.bisectRight=Na.right,da.shuffle=function(n){for(var t,r,e=n.length;e;)r=0|Math.random()*e--,t=n[e],n[e]=n[r],n[r]=t;return n},da.permute=function(n,t){for(var r=t.length,e=Array(r);r--;)e[r]=n[t[r]];return e},da.pairs=function(n){for(var t,r=0,e=n.length-1,u=n[0],i=Array(0>e?0:e);e>r;)i[r]=[t=u,u=n[++r]];return i},da.zip=function(){if(!(u=arguments.length))return[];for(var n=-1,r=da.min(arguments,t),e=Array(r);r>++n;)for(var u,i=-1,a=e[n]=Array(u);u>++i;)a[i]=arguments[i][n];return e},da.transpose=function(n){return da.zip.apply(da,n)},da.keys=function(n){var t=[];for(var r in n)t.push(r);return t},da.values=function(n){var t=[];for(var r in n)t.push(n[r]);return t},da.entries=function(n){var t=[];for(var r in n)t.push({key:r,value:n[r]});return t},da.merge=function(n){return Array.prototype.concat.apply([],n)},da.range=function(n,t,e){if(3>arguments.length&&(e=1,2>arguments.length&&(t=n,n=0)),1/0===(t-n)/e)throw Error("infinite range");
4
+ var u,i=[],a=r(Math.abs(e)),o=-1;if(n*=a,t*=a,e*=a,0>e)for(;(u=n+e*++o)>t;)i.push(u/a);else for(;t>(u=n+e*++o);)i.push(u/a);return i},da.map=function(n){var t=new u;if(n instanceof u)n.forEach(function(n,r){t.set(n,r)});else for(var r in n)t.set(r,n[r]);return t},e(u,{has:function(n){return Ta+n in this},get:function(n){return this[Ta+n]},set:function(n,t){return this[Ta+n]=t},remove:function(n){return n=Ta+n,n in this&&delete this[n]},keys:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},values:function(){var n=[];return this.forEach(function(t,r){n.push(r)}),n},entries:function(){var n=[];return this.forEach(function(t,r){n.push({key:t,value:r})}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===qa&&n.call(this,t.substring(1),this[t])}});var Ta="\0",qa=Ta.charCodeAt(0);da.nest=function(){function n(t,o,c){if(c>=a.length)return e?e.call(i,o):r?o.sort(r):o;for(var l,s,f,h,g=-1,p=o.length,d=a[c++],v=new u;p>++g;)(h=v.get(l=d(s=o[g])))?h.push(s):v.set(l,[s]);return t?(s=t(),f=function(r,e){s.set(r,n(t,e,c))}):(s={},f=function(r,e){s[r]=n(t,e,c)}),v.forEach(f),s}function t(n,r){if(r>=a.length)return n;var e=[],u=o[r++];return n.forEach(function(n,u){e.push({key:n,values:t(u,r)})}),u?e.sort(function(n,t){return u(n.key,t.key)}):e}var r,e,i={},a=[],o=[];return i.map=function(t,r){return n(r,t,0)},i.entries=function(r){return t(n(da.map,r,0),0)},i.key=function(n){return a.push(n),i},i.sortKeys=function(n){return o[a.length-1]=n,i},i.sortValues=function(n){return r=n,i},i.rollup=function(n){return e=n,i},i},da.set=function(n){var t=new i;if(n)for(var r=0,e=n.length;e>r;++r)t.add(n[r]);return t},e(i,{has:function(n){return Ta+n in this},add:function(n){return this[Ta+n]=!0,n},remove:function(n){return n=Ta+n,n in this&&delete this[n]},values:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===qa&&n.call(this,t.substring(1))}}),da.behavior={},da.rebind=function(n,t){for(var r,e=1,u=arguments.length;u>++e;)n[r=arguments[e]]=a(n,t,t[r]);return n};var ja=["webkit","ms","moz","Moz","o","O"];da.dispatch=function(){for(var n=new l,t=-1,r=arguments.length;r>++t;)n[arguments[t]]=s(n);return n},l.prototype.on=function(n,t){var r=n.indexOf("."),e="";if(r>=0&&(e=n.substring(r+1),n=n.substring(0,r)),n)return 2>arguments.length?this[n].on(e):this[n].on(e,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(e,null);return this}},da.event=null,da.requote=function(n){return n.replace(za,"\\$&")};var za=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ca={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var r in t)n[r]=t[r]},Da=function(n,t){return t.querySelector(n)},Oa=function(n,t){return t.querySelectorAll(n)},Fa=xa[o(xa,"matchesSelector")],La=function(n,t){return Fa.call(n,t)};"function"==typeof Sizzle&&(Da=function(n,t){return Sizzle(n,t)[0]||null},Oa=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},La=Sizzle.matchesSelector),da.selection=function(){return Pa};var Ra=da.selection.prototype=[];Ra.select=function(n){var t,r,e,u,i=[];n=d(n);for(var a=-1,o=this.length;o>++a;){i.push(t=[]),t.parentNode=(e=this[a]).parentNode;for(var c=-1,l=e.length;l>++c;)(u=e[c])?(t.push(r=n.call(u,u.__data__,c,a)),r&&"__data__"in u&&(r.__data__=u.__data__)):t.push(null)}return p(i)},Ra.selectAll=function(n){var t,r,e=[];n=v(n);for(var u=-1,i=this.length;i>++u;)for(var a=this[u],o=-1,c=a.length;c>++o;)(r=a[o])&&(e.push(t=ma(n.call(r,r.__data__,o,u))),t.parentNode=r);return p(e)};var Ha={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};da.ns={prefix:Ha,qualify:function(n){var t=n.indexOf(":"),r=n;return t>=0&&(r=n.substring(0,t),n=n.substring(t+1)),Ha.hasOwnProperty(r)?{space:Ha[r],local:n}:n}},Ra.attr=function(n,t){if(2>arguments.length){if("string"==typeof n){var r=this.node();return n=da.ns.qualify(n),n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}for(t in n)this.each(m(t,n[t]));return this}return this.each(m(n,t))},Ra.classed=function(n,t){if(2>arguments.length){if("string"==typeof n){var r=this.node(),e=(n=n.trim().split(/^|\s+/g)).length,u=-1;if(t=r.classList){for(;e>++u;)if(!t.contains(n[u]))return!1}else for(t=r.getAttribute("class");e>++u;)if(!x(n[u]).test(t))return!1;return!0}for(t in n)this.each(M(t,n[t]));return this}return this.each(M(n,t))},Ra.style=function(n,t,r){var e=arguments.length;if(3>e){if("string"!=typeof n){2>e&&(t="");for(r in n)this.each(_(r,n[r],t));return this}if(2>e)return Ma.getComputedStyle(this.node(),null).getPropertyValue(n);r=""}return this.each(_(n,t,r))},Ra.property=function(n,t){if(2>arguments.length){if("string"==typeof n)return this.node()[n];for(t in n)this.each(w(t,n[t]));return this}return this.each(w(n,t))},Ra.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Ra.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Ra.append=function(n){return n=E(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Ra.insert=function(n,t){return n=E(n),t=d(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments))})},Ra.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},Ra.data=function(n,t){function r(n,r){var e,i,a,o=n.length,f=r.length,h=Math.min(o,f),g=Array(f),p=Array(f),d=Array(o);if(t){var v,m=new u,y=new u,x=[];for(e=-1;o>++e;)v=t.call(i=n[e],i.__data__,e),m.has(v)?d[e]=i:m.set(v,i),x.push(v);for(e=-1;f>++e;)v=t.call(r,a=r[e],e),(i=m.get(v))?(g[e]=i,i.__data__=a):y.has(v)||(p[e]=S(a)),y.set(v,a),m.remove(v);for(e=-1;o>++e;)m.has(x[e])&&(d[e]=n[e])}else{for(e=-1;h>++e;)i=n[e],a=r[e],i?(i.__data__=a,g[e]=i):p[e]=S(a);for(;f>e;++e)p[e]=S(r[e]);for(;o>e;++e)d[e]=n[e]}p.update=g,p.parentNode=g.parentNode=d.parentNode=n.parentNode,c.push(p),l.push(g),s.push(d)}var e,i,a=-1,o=this.length;if(!arguments.length){for(n=Array(o=(e=this[0]).length);o>++a;)(i=e[a])&&(n[a]=i.__data__);return n}var c=T([]),l=p([]),s=p([]);if("function"==typeof n)for(;o>++a;)r(e=this[a],n.call(e,e.parentNode.__data__,a));else for(;o>++a;)r(e=this[a],n);return l.enter=function(){return c},l.exit=function(){return s},l},Ra.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},Ra.filter=function(n){var t,r,e,u=[];"function"!=typeof n&&(n=k(n));for(var i=0,a=this.length;a>i;i++){u.push(t=[]),t.parentNode=(r=this[i]).parentNode;for(var o=0,c=r.length;c>o;o++)(e=r[o])&&n.call(e,e.__data__,o)&&t.push(e)}return p(u)},Ra.order=function(){for(var n=-1,t=this.length;t>++n;)for(var r,e=this[n],u=e.length-1,i=e[u];--u>=0;)(r=e[u])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Ra.sort=function(n){n=A.apply(this,arguments);for(var t=-1,r=this.length;r>++t;)this[t].sort(n);return this.order()},Ra.each=function(n){return N(this,function(t,r,e){n.call(t,t.__data__,r,e)})},Ra.call=function(n){var t=ma(arguments);return n.apply(t[0]=this,t),this},Ra.empty=function(){return!this.node()},Ra.node=function(){for(var n=0,t=this.length;t>n;n++)for(var r=this[n],e=0,u=r.length;u>e;e++){var i=r[e];if(i)return i}return null},Ra.size=function(){var n=0;return this.each(function(){++n}),n};var Ia=[];da.selection.enter=T,da.selection.enter.prototype=Ia,Ia.append=Ra.append,Ia.empty=Ra.empty,Ia.node=Ra.node,Ia.call=Ra.call,Ia.size=Ra.size,Ia.select=function(n){for(var t,r,e,u,i,a=[],o=-1,c=this.length;c>++o;){e=(u=this[o]).update,a.push(t=[]),t.parentNode=u.parentNode;for(var l=-1,s=u.length;s>++l;)(i=u[l])?(t.push(e[l]=r=n.call(u.parentNode,i.__data__,l,o)),r.__data__=i.__data__):t.push(null)}return p(a)},Ia.insert=function(n,t){return 2>arguments.length&&(t=q(this)),Ra.insert.call(this,n,t)},Ra.transition=function(){for(var n,t,r=Lc||++Yc,e=[],u=Rc||{time:Date.now(),ease:ze,delay:0,duration:250},i=-1,a=this.length;a>++i;){e.push(n=[]);for(var o=this[i],c=-1,l=o.length;l>++c;)(t=o[c])&&Ni(t,c,r,u),n.push(t)}return Si(e,r)},Ra.interrupt=function(){return this.each(j)},da.select=function(n){var t=["string"==typeof n?Da(n,ya):n];return t.parentNode=xa,p([t])},da.selectAll=function(n){var t=ma("string"==typeof n?Oa(n,ya):n);return t.parentNode=xa,p([t])};var Pa=da.select(xa);Ra.on=function(n,t,r){var e=arguments.length;if(3>e){if("string"!=typeof n){2>e&&(t=!1);for(r in n)this.each(z(r,n[r],t));return this}if(2>e)return(e=this.node()["__on"+n])&&e._;r=!1}return this.each(z(n,t,r))};var Ya=da.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ya.forEach(function(n){"on"+n in ya&&Ya.remove(n)});var Ua=o(xa.style,"userSelect"),Ba=0;da.mouse=function(n){return F(n,h())};var Va=/WebKit/.test(Ma.navigator.userAgent)?-1:0;da.touches=function(n,t){return 2>arguments.length&&(t=h().touches),t?ma(t).map(function(t){var r=F(n,t);return r.identifier=t.identifier,r}):[]},da.behavior.drag=function(){function n(){this.on("mousedown.drag",a).on("touchstart.drag",o)}function t(){return da.event.changedTouches[0].identifier}function r(n,t){return da.touches(n).filter(function(n){return n.identifier===t})[0]}function e(n,t,r,e){return function(){function a(){if(!s)return o();var n=t(s,g),r=n[0]-d[0],e=n[1]-d[1];v|=r|e,d=n,f({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:r,dy:e})}function o(){m.on(r+"."+p,null).on(e+"."+p,null),y(v&&da.event.target===h),f({type:"dragend"})}var c,l=this,s=l.parentNode,f=u.of(l,arguments),h=da.event.target,g=n(),p=null==g?"drag":"drag-"+g,d=t(s,g),v=0,m=da.select(Ma).on(r+"."+p,a).on(e+"."+p,o),y=O();i?(c=i.apply(l,arguments),c=[c.x-d[0],c.y-d[1]]):c=[0,0],f({type:"dragstart"})}}var u=g(n,"drag","dragstart","dragend"),i=null,a=e(c,da.mouse,"mousemove","mouseup"),o=e(t,r,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},da.rebind(n,u,"on")};var Za=Math.PI,Xa=1e-6,$a=Xa*Xa,Ja=Za/180,Wa=180/Za,Ga=Math.SQRT2,Ka=2,Qa=4;da.interpolateZoom=function(n,t){function r(n){var t=n*y;if(m){var r=P(d),a=i/(Ka*h)*(r*Y(Ga*t+d)-I(d));return[e+a*l,u+a*s,i*r/P(Ga*t+d)]}return[e+n*l,u+n*s,i*Math.exp(Ga*t)]}var e=n[0],u=n[1],i=n[2],a=t[0],o=t[1],c=t[2],l=a-e,s=o-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Qa*f)/(2*i*Ka*h),p=(c*c-i*i-Qa*f)/(2*c*Ka*h),d=Math.log(Math.sqrt(g*g+1)-g),v=Math.log(Math.sqrt(p*p+1)-p),m=v-d,y=(m||Math.log(c/i))/Ga;return r.duration=1e3*y,r},da.behavior.zoom=function(){function n(n){n.on(A,l).on(ro+".zoom",h).on(N,p).on("dblclick.zoom",d).on(q,s)}function t(n){return[(n[0]-E.x)/E.k,(n[1]-E.y)/E.k]}function r(n){return[n[0]*E.k+E.x,n[1]*E.k+E.y]}function e(n){E.k=Math.max(k[0],Math.min(k[1],n))}function u(n,t){t=r(t),E.x+=n[0]-t[0],E.y+=n[1]-t[1]}function i(){b&&b.domain(M.range().map(function(n){return(n-E.x)/E.k}).map(M.invert)),w&&w.domain(_.range().map(function(n){return(n-E.y)/E.k}).map(_.invert))}function a(n){n({type:"zoomstart"})}function o(n){i(),n({type:"zoom",scale:E.k,translate:[E.x,E.y]})}function c(n){n({type:"zoomend"})}function l(){function n(){s=1,u(da.mouse(e),h),o(i)}function r(){f.on(N,Ma===e?p:null).on(T,null),g(s&&da.event.target===l),c(i)}var e=this,i=D.of(e,arguments),l=da.event.target,s=0,f=da.select(Ma).on(N,n).on(T,r),h=t(da.mouse(e)),g=O();j.call(e),a(i)}function s(){function n(){var n=da.touches(d);return p=E.k,g={},n.forEach(function(n){g[n.identifier]=t(n)}),n}function r(){var t=Date.now(),r=n();if(1===r.length){if(500>t-x){var i=r[0],a=g[i.identifier];e(2*E.k),u(i,a),f(),o(v)}x=t}else if(r.length>1){var i=r[0],c=r[1],l=i[0]-c[0],s=i[1]-c[1];m=l*l+s*s}}function i(){var n=da.touches(d),t=n[0],r=g[t.identifier];if(i=n[1]){var i,a=g[i.identifier],c=da.event.scale;if(null==c){var l=(l=i[0]-t[0])*l+(l=i[1]-t[1])*l;c=m&&Math.sqrt(l/m)}t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r=[(r[0]+a[0])/2,(r[1]+a[1])/2],e(c*p)}x=null,u(t,r),o(v)}function h(){da.event.touches.length?n():(y.on(z,null).on(C,null),M.on(A,l).on(q,s),b(),c(v))}var g,p,d=this,v=D.of(d,arguments),m=0,y=da.select(Ma).on(z,i).on(C,h),M=da.select(d).on(A,null).on(q,r),b=O();j.call(d),r(),a(v)}function h(){var n=D.of(this,arguments);y?clearTimeout(y):(j.call(this),a(n)),y=setTimeout(function(){y=null,c(n)},50),f();var r=m||da.mouse(this);v||(v=t(r)),e(Math.pow(2,.002*no())*E.k),u(r,v),o(n)}function p(){v=null}function d(){var n=D.of(this,arguments),r=da.mouse(this),i=t(r),l=Math.log(E.k)/Math.LN2;a(n),e(Math.pow(2,da.event.shiftKey?Math.ceil(l)-1:Math.floor(l)+1)),u(r,i),o(n),c(n)}var v,m,y,x,M,b,_,w,E={x:0,y:0,k:1},S=[960,500],k=to,A="mousedown.zoom",N="mousemove.zoom",T="mouseup.zoom",q="touchstart.zoom",z="touchmove.zoom",C="touchend.zoom",D=g(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=E;Lc?da.select(this).transition().each("start.zoom",function(){E=this.__chart__||{x:0,y:0,k:1},a(n)}).tween("zoom:zoom",function(){var r=S[0],e=S[1],u=r/2,i=e/2,a=da.interpolateZoom([(u-E.x)/E.k,(i-E.y)/E.k,r/E.k],[(u-t.x)/t.k,(i-t.y)/t.k,r/t.k]);return function(t){var e=a(t),c=r/e[2];this.__chart__=E={x:u-e[0]*c,y:i-e[1]*c,k:c},o(n)}}).each("end.zoom",function(){c(n)}):(this.__chart__=E,a(n),o(n),c(n))})},n.translate=function(t){return arguments.length?(E={x:+t[0],y:+t[1],k:E.k},i(),n):[E.x,E.y]},n.scale=function(t){return arguments.length?(E={x:E.x,y:E.y,k:+t},i(),n):E.k},n.scaleExtent=function(t){return arguments.length?(k=null==t?to:[+t[0],+t[1]],n):k},n.center=function(t){return arguments.length?(m=t&&[+t[0],+t[1]],n):m},n.size=function(t){return arguments.length?(S=t&&[+t[0],+t[1]],n):S},n.x=function(t){return arguments.length?(b=t,M=t.copy(),E={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),E={x:0,y:0,k:1},n):w},da.rebind(n,D,"on")};var no,to=[0,1/0],ro="onwheel"in ya?(no=function(){return-da.event.deltaY*(da.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ya?(no=function(){return da.event.wheelDelta},"mousewheel"):(no=function(){return-da.event.detail},"MozMousePixelScroll");B.prototype.toString=function(){return this.rgb()+""},da.hsl=function(n,t,r){return 1===arguments.length?n instanceof Z?V(n.h,n.s,n.l):lt(""+n,st,V):V(+n,+t,+r)};var eo=Z.prototype=new B;eo.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),V(this.h,this.s,this.l/n)},eo.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),V(this.h,this.s,n*this.l)},eo.rgb=function(){return X(this.h,this.s,this.l)},da.hcl=function(n,t,r){return 1===arguments.length?n instanceof J?$(n.h,n.c,n.l):n instanceof K?nt(n.l,n.a,n.b):nt((n=ft((n=da.rgb(n)).r,n.g,n.b)).l,n.a,n.b):$(+n,+t,+r)};var uo=J.prototype=new B;uo.brighter=function(n){return $(this.h,this.c,Math.min(100,this.l+io*(arguments.length?n:1)))},uo.darker=function(n){return $(this.h,this.c,Math.max(0,this.l-io*(arguments.length?n:1)))},uo.rgb=function(){return W(this.h,this.c,this.l).rgb()},da.lab=function(n,t,r){return 1===arguments.length?n instanceof K?G(n.l,n.a,n.b):n instanceof J?W(n.l,n.c,n.h):ft((n=da.rgb(n)).r,n.g,n.b):G(+n,+t,+r)};var io=18,ao=.95047,oo=1,co=1.08883,lo=K.prototype=new B;lo.brighter=function(n){return G(Math.min(100,this.l+io*(arguments.length?n:1)),this.a,this.b)},lo.darker=function(n){return G(Math.max(0,this.l-io*(arguments.length?n:1)),this.a,this.b)},lo.rgb=function(){return Q(this.l,this.a,this.b)},da.rgb=function(n,t,r){return 1===arguments.length?n instanceof ot?at(n.r,n.g,n.b):lt(""+n,at,X):at(~~n,~~t,~~r)};var so=ot.prototype=new B;so.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,r=this.g,e=this.b,u=30;return t||r||e?(t&&u>t&&(t=u),r&&u>r&&(r=u),e&&u>e&&(e=u),at(Math.min(255,~~(t/n)),Math.min(255,~~(r/n)),Math.min(255,~~(e/n)))):at(u,u,u)},so.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),at(~~(n*this.r),~~(n*this.g),~~(n*this.b))},so.hsl=function(){return st(this.r,this.g,this.b)},so.toString=function(){return"#"+ct(this.r)+ct(this.g)+ct(this.b)};var fo=da.map({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,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});fo.forEach(function(n,t){fo.set(n,ut(t))}),da.functor=pt,da.xhr=vt(dt),da.dsv=function(n,t){function r(n,r,i){3>arguments.length&&(i=r,r=null);var a=da.xhr(n,t,i);return a.row=function(n){return arguments.length?a.response(null==(r=n)?e:u(n)):r},a.row(r)}function e(n){return r.parse(n.responseText)}function u(n){return function(t){return r.parse(t.responseText,n)}}function a(t){return t.map(o).join(n)}function o(n){return c.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var c=RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return r.parse=function(n,t){var e;return r.parseRows(n,function(n,r){if(e)return e(n,r-1);var u=Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");e=t?function(n,r){return t(u(n),r)}:u})},r.parseRows=function(n,t){function r(){if(s>=c)return a;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var r=t;c>r++;)if(34===n.charCodeAt(r)){if(34!==n.charCodeAt(r+1))break;++r}s=r+2;var e=n.charCodeAt(r+1);return 13===e?(u=!0,10===n.charCodeAt(r+2)&&++s):10===e&&(u=!0),n.substring(t+1,r).replace(/""/g,'"')}for(;c>s;){var e=n.charCodeAt(s++),o=1;if(10===e)u=!0;else if(13===e)u=!0,10===n.charCodeAt(s)&&(++s,++o);else if(e!==l)continue;return n.substring(t,s-o)}return n.substring(t)}for(var e,u,i={},a={},o=[],c=n.length,s=0,f=0;(e=r())!==a;){for(var h=[];e!==i&&e!==a;)h.push(e),e=r();(!t||(h=t(h,f++)))&&o.push(h)}return o},r.format=function(t){if(Array.isArray(t[0]))return r.formatRows(t);var e=new i,u=[];return t.forEach(function(n){for(var t in n)e.has(t)||u.push(e.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},r.formatRows=function(n){return n.map(a).join("\n")},r},da.csv=da.dsv(",","text/csv"),da.tsv=da.dsv(" ","text/tab-separated-values");var ho,go,po,vo,mo,yo=Ma[o(Ma,"requestAnimationFrame")]||function(n){setTimeout(n,17)};da.timer=function(n,t,r){var e=arguments.length;2>e&&(t=0),3>e&&(r=Date.now());var u=r+t,i={callback:n,time:u,next:null};go?go.next=i:ho=i,go=i,po||(vo=clearTimeout(vo),po=1,yo(xt))},da.timer.flush=function(){bt(),_t()};var xo=".",Mo=",",bo=[3,3],_o="$",wo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(wt);da.formatPrefix=function(n,t){var r=0;return n&&(0>n&&(n*=-1),t&&(n=da.round(n,Et(n,t))),r=1+Math.floor(1e-12+Math.log(n)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((0>=r?r+1:r-1)/3)))),wo[8+r/3]},da.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)},da.format=function(n){var t=Eo.exec(n),r=t[1]||" ",e=t[2]||">",u=t[3]||"",i=t[4]||"",a=t[5],o=+t[6],c=t[7],l=t[8],s=t[9],f=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(a||"0"===r&&"="===e)&&(a=r="0",e="=",c&&(o-=Math.floor((o-1)/4))),s){case"n":c=!0,s="g";break;case"%":f=100,h="%",s="f";break;case"p":f=100,h="%",s="r";break;case"b":case"o":case"x":case"X":"#"===i&&(i="0"+s.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":f=-1,s="r"}"#"===i?i="":"$"===i&&(i=_o),"r"!=s||l||(s="g"),null!=l&&("g"==s?l=Math.max(1,Math.min(21,l)):("e"==s||"f"==s)&&(l=Math.max(0,Math.min(20,l)))),s=So.get(s)||St;var p=a&&c;return function(n){if(g&&n%1)return"";var t=0>n||0===n&&0>1/n?(n=-n,"-"):u;if(0>f){var d=da.formatPrefix(n,l);n=d.scale(n),h=d.symbol}else n*=f;n=s(n,l);var v=n.lastIndexOf("."),m=0>v?n:n.substring(0,v),y=0>v?"":xo+n.substring(v+1);!a&&c&&(m=ko(m));var x=i.length+m.length+y.length+(p?0:t.length),M=o>x?Array(x=o-x+1).join(r):"";return p&&(m=ko(M+m)),t+=i,n=m+y,("<"===e?t+n+M:">"===e?M+t+n:"^"===e?M.substring(0,x>>=1)+t+n+M.substring(x):t+(p?n:M+n))+h}};var Eo=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,So=da.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=da.round(n,Et(n,t))).toFixed(Math.max(0,Math.min(20,Et(n*(1+1e-15),t))))}}),ko=dt;if(bo){var Ao=bo.length;ko=function(n){for(var t=n.length,r=[],e=0,u=bo[0];t>0&&u>0;)r.push(n.substring(t-=u,t+u)),u=bo[e=(e+1)%Ao];return r.reverse().join(Mo)}}da.geo={},kt.prototype={s:0,t:0,add:function(n){At(n,this.t,No),At(No.s,this.s,this),this.s?this.t+=No.t:this.s=No.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var No=new kt;da.geo.stream=function(n,t){n&&To.hasOwnProperty(n.type)?To[n.type](n,t):Nt(n,t)};var To={Feature:function(n,t){Nt(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,e=-1,u=r.length;u>++e;)Nt(r[e].geometry,t)}},qo={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,e=-1,u=r.length;u>++e;)n=r[e],t.point(n[0],n[1],n[2])},LineString:function(n,t){Tt(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,e=-1,u=r.length;u>++e;)Tt(r[e],t,0)},Polygon:function(n,t){qt(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,e=-1,u=r.length;u>++e;)qt(r[e],t)},GeometryCollection:function(n,t){for(var r=n.geometries,e=-1,u=r.length;u>++e;)Nt(r[e],t)}};da.geo.area=function(n){return jo=0,da.geo.stream(n,Co),jo};var jo,zo=new kt,Co={sphere:function(){jo+=4*Za},point:c,lineStart:c,lineEnd:c,polygonStart:function(){zo.reset(),Co.lineStart=jt},polygonEnd:function(){var n=2*zo;jo+=0>n?4*Za+n:n,Co.lineStart=Co.lineEnd=Co.point=c}};da.geo.bounds=function(){function n(n,t){x.push(M=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,r){var e=zt([t*Ja,r*Ja]);if(m){var u=Dt(m,e),i=[u[1],-u[0],0],a=Dt(i,u);Lt(a),a=Rt(a);var c=t-p,l=c>0?1:-1,d=a[0]*Wa*l,v=Math.abs(c)>180;if(v^(d>l*p&&l*t>d)){var y=a[1]*Wa;y>g&&(g=y)}else if(d=(d+360)%360-180,v^(d>l*p&&l*t>d)){var y=-a[1]*Wa;f>y&&(f=y)}else f>r&&(f=r),r>g&&(g=r);v?p>t?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t)}else n(t,r);m=e,p=t}function r(){b.point=t}function e(){M[0]=s,M[1]=h,b.point=n,m=null}function u(n,r){if(m){var e=n-p;y+=Math.abs(e)>180?e+(e>0?360:-360):e}else d=n,v=r;Co.point(n,r),t(n,r)}function i(){Co.lineStart()}function a(){u(d,v),Co.lineEnd(),Math.abs(y)>Xa&&(s=-(h=180)),M[0]=s,M[1]=h,m=null}function o(n,t){return 0>(t-=n)?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?n>=t[0]&&t[1]>=n:t[0]>n||n>t[1]}var s,f,h,g,p,d,v,m,y,x,M,b={point:n,lineStart:r,lineEnd:e,polygonStart:function(){b.point=u,b.lineStart=i,b.lineEnd=a,y=0,Co.polygonStart()},polygonEnd:function(){Co.polygonEnd(),b.point=n,b.lineStart=r,b.lineEnd=e,0>zo?(s=-(h=180),f=-(g=90)):y>Xa?g=90:-Xa>y&&(f=-90),M[0]=s,M[1]=h}};return function(n){g=h=-(s=f=1/0),x=[],da.geo.stream(n,b);var t=x.length;if(t){x.sort(c);for(var r,e=1,u=x[0],i=[u];t>e;++e)r=x[e],l(r[0],u)||l(r[1],u)?(o(u[0],r[1])>o(u[0],u[1])&&(u[1]=r[1]),o(r[0],u[1])>o(u[0],u[1])&&(u[0]=r[0])):i.push(u=r);for(var a,r,p=-1/0,t=i.length-1,e=0,u=i[t];t>=e;u=r,++e)r=i[e],(a=o(u[1],r[0]))>p&&(p=a,s=r[0],h=u[1])}return x=M=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),da.geo.centroid=function(n){Do=Oo=Fo=Lo=Ro=Ho=Io=Po=Yo=Uo=Bo=0,da.geo.stream(n,Vo);var t=Yo,r=Uo,e=Bo,u=t*t+r*r+e*e;return $a>u&&(t=Ho,r=Io,e=Po,Xa>Oo&&(t=Fo,r=Lo,e=Ro),u=t*t+r*r+e*e,$a>u)?[0/0,0/0]:[Math.atan2(r,t)*Wa,H(e/Math.sqrt(u))*Wa]};var Do,Oo,Fo,Lo,Ro,Ho,Io,Po,Yo,Uo,Bo,Vo={sphere:c,point:It,lineStart:Yt,lineEnd:Ut,polygonStart:function(){Vo.lineStart=Bt},polygonEnd:function(){Vo.lineStart=Yt}},Zo=$t(Vt,Qt,tr,rr),Xo=[-Za,0],$o=1e9;da.geo.clipExtent=function(){var n,t,r,e,u,i,a={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(o){return arguments.length?(i=ur(n=+o[0][0],t=+o[0][1],r=+o[1][0],e=+o[1][1]),u&&(u.valid=!1,u=null),a):[[n,t],[r,e]]}};return a.extent([[0,0],[960,500]])},(da.geo.conicEqualArea=function(){return or(cr)}).raw=cr,da.geo.albers=function(){return da.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},da.geo.albersUsa=function(){function n(n){var i=n[0],a=n[1];return t=null,r(i,a),t||(e(i,a),t)||u(i,a),t}var t,r,e,u,i=da.geo.albers(),a=da.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o=da.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,r){t=[n,r]}};return n.invert=function(n){var t=i.scale(),r=i.translate(),e=(n[0]-r[0])/t,u=(n[1]-r[1])/t;return(u>=.12&&.234>u&&e>=-.425&&-.214>e?a:u>=.166&&.234>u&&e>=-.214&&-.115>e?o:i).invert(n)},n.stream=function(n){var t=i.stream(n),r=a.stream(n),e=o.stream(n);return{point:function(n,u){t.point(n,u),r.point(n,u),e.point(n,u)},sphere:function(){t.sphere(),r.sphere(),e.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),e.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),e.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),e.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),e.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),a.precision(t),o.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),a.scale(.35*t),o.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return r=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,e=a.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Xa,f+.12*l+Xa],[s-.214*l-Xa,f+.234*l-Xa]]).stream(c).point,u=o.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Xa,f+.166*l+Xa],[s-.115*l-Xa,f+.234*l-Xa]]).stream(c).point,n},n.scale(1070)};var Jo,Wo,Go,Ko,Qo,nc,tc={point:c,lineStart:c,lineEnd:c,polygonStart:function(){Wo=0,tc.lineStart=lr},polygonEnd:function(){tc.lineStart=tc.lineEnd=tc.point=c,Jo+=Math.abs(Wo/2)}},rc={point:sr,lineStart:c,lineEnd:c,polygonStart:c,polygonEnd:c},ec={point:gr,lineStart:pr,lineEnd:dr,polygonStart:function(){ec.lineStart=vr},polygonEnd:function(){ec.point=gr,ec.lineStart=pr,ec.lineEnd=dr}};da.geo.transform=function(n){return{stream:function(t){var r=new xr(t);for(var e in n)r[e]=n[e];return r}}},xr.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},da.geo.path=function(){function n(n){return n&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),a&&a.valid||(a=u(i)),da.geo.stream(n,a)),i.result()}function t(){return a=null,n}var r,e,u,i,a,o=4.5;return n.area=function(n){return Jo=0,da.geo.stream(n,u(tc)),Jo},n.centroid=function(n){return Fo=Lo=Ro=Ho=Io=Po=Yo=Uo=Bo=0,da.geo.stream(n,u(ec)),Bo?[Yo/Bo,Uo/Bo]:Po?[Ho/Po,Io/Po]:Ro?[Fo/Ro,Lo/Ro]:[0/0,0/0]},n.bounds=function(n){return Qo=nc=-(Go=Ko=1/0),da.geo.stream(n,u(rc)),[[Go,Ko],[Qo,nc]]},n.projection=function(n){return arguments.length?(u=(r=n)?n.stream||Mr(n):dt,t()):r},n.context=function(n){return arguments.length?(i=null==(e=n)?new fr:new mr(n),"function"!=typeof o&&i.pointRadius(o),t()):e},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),n):o},n.projection(da.geo.albersUsa()).context(null)},da.geo.projection=br,da.geo.projectionMutator=_r,(da.geo.equirectangular=function(){return br(Er)}).raw=Er.invert=Er,da.geo.rotation=function(n){function t(t){return t=n(t[0]*Ja,t[1]*Ja),t[0]*=Wa,t[1]*=Wa,t}return n=Sr(n[0]%360*Ja,n[1]*Ja,n.length>2?n[2]*Ja:0),t.invert=function(t){return t=n.invert(t[0]*Ja,t[1]*Ja),t[0]*=Wa,t[1]*=Wa,t},t},da.geo.circle=function(){function n(){var n="function"==typeof e?e.apply(this,arguments):e,t=Sr(-n[0]*Ja,-n[1]*Ja,0).invert,u=[];return r(null,null,1,{point:function(n,r){u.push(n=t(n,r)),n[0]*=Wa,n[1]*=Wa}}),{type:"Polygon",coordinates:[u]}}var t,r,e=[0,0],u=6;return n.origin=function(t){return arguments.length?(e=t,n):e},n.angle=function(e){return arguments.length?(r=Tr((t=+e)*Ja,u*Ja),n):t},n.precision=function(e){return arguments.length?(r=Tr(t*Ja,(u=+e)*Ja),n):u},n.angle(90)},da.geo.distance=function(n,t){var r,e=(t[0]-n[0])*Ja,u=n[1]*Ja,i=t[1]*Ja,a=Math.sin(e),o=Math.cos(e),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*a)*r+(r=l*s-c*f*o)*r),c*s+l*f*o)},da.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return da.range(Math.ceil(i/v)*v,u,v).map(h).concat(da.range(Math.ceil(l/m)*m,c,m).map(g)).concat(da.range(Math.ceil(e/p)*p,r,p).filter(function(n){return Math.abs(n%v)>Xa}).map(s)).concat(da.range(Math.ceil(o/d)*d,a,d).filter(function(n){return Math.abs(n%m)>Xa}).map(f))}var r,e,u,i,a,o,c,l,s,f,h,g,p=10,d=p,v=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()
5
+ },n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(e=+t[0][0],r=+t[1][0],o=+t[0][1],a=+t[1][1],e>r&&(t=e,e=r,r=t),o>a&&(t=o,o=a,a=t),n.precision(y)):[[e,o],[r,a]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(v=+t[0],m=+t[1],n):[v,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],n):[p,d]},n.precision=function(t){return arguments.length?(y=+t,s=jr(o,a,90),f=zr(e,r,y),h=jr(l,c,90),g=zr(i,u,y),n):y},n.majorExtent([[-180,-90+Xa],[180,90-Xa]]).minorExtent([[-180,-80-Xa],[180,80+Xa]])},da.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),r||u.apply(this,arguments)]}}var t,r,e=Cr,u=Dr;return n.distance=function(){return da.geo.distance(t||e.apply(this,arguments),r||u.apply(this,arguments))},n.source=function(r){return arguments.length?(e=r,t="function"==typeof r?null:r,n):e},n.target=function(t){return arguments.length?(u=t,r="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},da.geo.interpolate=function(n,t){return Or(n[0]*Ja,n[1]*Ja,t[0]*Ja,t[1]*Ja)},da.geo.length=function(n){return uc=0,da.geo.stream(n,ic),uc};var uc,ic={sphere:c,point:c,lineStart:Fr,lineEnd:c,polygonStart:c,polygonEnd:c},ac=Lr(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(da.geo.azimuthalEqualArea=function(){return br(ac)}).raw=ac;var oc=Lr(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},dt);(da.geo.azimuthalEquidistant=function(){return br(oc)}).raw=oc,(da.geo.conicConformal=function(){return or(Rr)}).raw=Rr,(da.geo.conicEquidistant=function(){return or(Hr)}).raw=Hr;var cc=Lr(function(n){return 1/n},Math.atan);(da.geo.gnomonic=function(){return br(cc)}).raw=cc,Ir.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Za/2]},(da.geo.mercator=function(){return Pr(Ir)}).raw=Ir;var lc=Lr(function(){return 1},Math.asin);(da.geo.orthographic=function(){return br(lc)}).raw=lc;var sc=Lr(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(da.geo.stereographic=function(){return br(sc)}).raw=sc,Yr.invert=function(n,t){return[Math.atan2(I(n),Math.cos(t)),H(Math.sin(t)/P(n))]},(da.geo.transverseMercator=function(){return Pr(Yr)}).raw=Yr,da.geom={},da.svg={},da.svg.line=function(){return Ur(dt)};var fc=da.map({linear:Zr,"linear-closed":Xr,step:$r,"step-before":Jr,"step-after":Wr,basis:re,"basis-open":ee,"basis-closed":ue,bundle:ie,cardinal:Qr,"cardinal-open":Gr,"cardinal-closed":Kr,monotone:fe});fc.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var hc=[0,2/3,1/3,0],gc=[0,1/3,2/3,0],pc=[0,1/6,2/3,1/6];da.geom.hull=function(n){function t(n){if(3>n.length)return[];var t,u,i,a,o,c,l,s,f,h,g,p,d=pt(r),v=pt(e),m=n.length,y=m-1,x=[],M=[],b=0;if(d===Br&&e===Vr)t=n;else for(i=0,t=[];m>i;++i)t.push([+d.call(this,u=n[i],i),+v.call(this,u,i)]);for(i=1;m>i;++i)(t[i][1]<t[b][1]||t[i][1]==t[b][1]&&t[i][0]<t[b][0])&&(b=i);for(i=0;m>i;++i)i!==b&&(c=t[i][1]-t[b][1],o=t[i][0]-t[b][0],x.push({angle:Math.atan2(c,o),index:i}));for(x.sort(function(n,t){return n.angle-t.angle}),g=x[0].angle,h=x[0].index,f=0,i=1;y>i;++i){if(a=x[i].index,g==x[i].angle){if(o=t[h][0]-t[b][0],c=t[h][1]-t[b][1],l=t[a][0]-t[b][0],s=t[a][1]-t[b][1],o*o+c*c>=l*l+s*s){x[i].index=-1;continue}x[f].index=-1}g=x[i].angle,f=i,h=a}for(M.push(b),i=0,a=0;2>i;++a)x[a].index>-1&&(M.push(x[a].index),i++);for(p=M.length;y>a;++a)if(!(0>x[a].index)){for(;!he(M[p-2],M[p-1],x[a].index,t);)--p;M[p++]=x[a].index}var _=[];for(i=p-1;i>=0;--i)_.push(n[M[i]]);return _}var r=Br,e=Vr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(e=n,t):e},t)},da.geom.polygon=function(n){return Ca(n,dc),n};var dc=da.geom.polygon.prototype=[];dc.area=function(){for(var n,t=-1,r=this.length,e=this[r-1],u=0;r>++t;)n=e,e=this[t],u+=n[1]*e[0]-n[0]*e[1];return.5*u},dc.centroid=function(n){var t,r,e=-1,u=this.length,i=0,a=0,o=this[u-1];for(arguments.length||(n=-1/(6*this.area()));u>++e;)t=o,o=this[e],r=t[0]*o[1]-o[0]*t[1],i+=(t[0]+o[0])*r,a+=(t[1]+o[1])*r;return[i*n,a*n]},dc.clip=function(n){for(var t,r,e,u,i,a,o=de(n),c=-1,l=this.length-de(this),s=this[l-1];l>++c;){for(t=n.slice(),n.length=0,u=this[c],i=t[(e=t.length-o)-1],r=-1;e>++r;)a=t[r],ge(a,s,u)?(ge(i,s,u)||n.push(pe(i,a,s,u)),n.push(a)):ge(i,s,u)&&n.push(pe(i,a,s,u)),i=a;o&&n.push(n[0]),s=u}return n},da.geom.delaunay=function(n){var t=n.map(function(){return[]}),r=[];return ve(n,function(r){t[r.region.l.index].push(n[r.region.r.index])}),t.forEach(function(t,e){var u=n[e],i=u[0],a=u[1];t.forEach(function(n){n.angle=Math.atan2(n[0]-i,n[1]-a)}),t.sort(function(n,t){return n.angle-t.angle});for(var o=0,c=t.length-1;c>o;o++)r.push([u,t[o],t[o+1]])}),r},da.geom.voronoi=function(n){function t(n){var t,i,a,o=n.map(function(){return[]}),c=pt(r),l=pt(e),s=n.length,f=1e6;if(c===Br&&l===Vr)t=n;else for(t=Array(s),a=0;s>a;++a)t[a]=[+c.call(this,i=n[a],a),+l.call(this,i,a)];if(ve(t,function(n){var t,r,e,u,i,a;1===n.a&&n.b>=0?(t=n.ep.r,r=n.ep.l):(t=n.ep.l,r=n.ep.r),1===n.a?(i=t?t.y:-f,e=n.c-n.b*i,a=r?r.y:f,u=n.c-n.b*a):(e=t?t.x:-f,i=n.c-n.a*e,u=r?r.x:f,a=n.c-n.a*u);var c=[e,i],l=[u,a];o[n.region.l.index].push(c,l),o[n.region.r.index].push(c,l)}),o=o.map(function(n,r){var e=t[r][0],u=t[r][1],i=n.map(function(n){return Math.atan2(n[0]-e,n[1]-u)}),a=da.range(n.length).sort(function(n,t){return i[n]-i[t]});return a.filter(function(n,t){return!t||i[n]-i[a[t-1]]>Xa}).map(function(t){return n[t]})}),o.forEach(function(n,r){var e=n.length;if(!e)return n.push([-f,-f],[-f,f],[f,f],[f,-f]);if(!(e>2)){var u=t[r],i=n[0],a=n[1],o=u[0],c=u[1],l=i[0],s=i[1],h=a[0],g=a[1],p=Math.abs(h-l),d=g-s;if(Xa>Math.abs(d)){var v=s>c?-f:f;n.push([-f,v],[f,v])}else if(Xa>p){var m=l>o?-f:f;n.push([m,-f],[m,f])}else{var v=(l-o)*(g-s)>(h-l)*(s-c)?f:-f,y=Math.abs(d)-p;Xa>Math.abs(y)?n.push([0>d?v:-v,v]):(y>0&&(v*=-1),n.push([-f,v],[f,v]))}}}),u)for(a=0;s>a;++a)u.clip(o[a]);for(a=0;s>a;++a)o[a].point=n[a];return o}var r=Br,e=Vr,u=null;return arguments.length?t(n):(t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(e=n,t):e},t.clipExtent=function(n){if(!arguments.length)return u&&[u[0],u[2]];if(null==n)u=null;else{var r=+n[0][0],e=+n[0][1],i=+n[1][0],a=+n[1][1];u=da.geom.polygon([[r,e],[r,a],[i,a],[i,e]])}return t},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):u&&u[2]},t.links=function(n){var t,u,i,a=n.map(function(){return[]}),o=[],c=pt(r),l=pt(e),s=n.length;if(c===Br&&l===Vr)t=n;else for(t=Array(s),i=0;s>i;++i)t[i]=[+c.call(this,u=n[i],i),+l.call(this,u,i)];return ve(t,function(t){var r=t.region.l.index,e=t.region.r.index;a[r][e]||(a[r][e]=a[e][r]=!0,o.push({source:n[r],target:n[e]}))}),o},t.triangles=function(n){if(r===Br&&e===Vr)return da.geom.delaunay(n);for(var t,u=Array(c),i=pt(r),a=pt(e),o=-1,c=n.length;c>++o;)(u[o]=[+i.call(this,t=n[o],o),+a.call(this,t,o)]).data=t;return da.geom.delaunay(u).map(function(n){return n.map(function(n){return n.data})})},t)};var vc={l:"r",r:"l"};da.geom.quadtree=function(n,t,r,e,u){function i(n){function i(n,t,r,e,u,i,a,o){if(!isNaN(r)&&!isNaN(e))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(.01>Math.abs(c-r)+Math.abs(s-e))l(n,t,r,e,u,i,a,o);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,u,i,a,o),l(n,t,r,e,u,i,a,o)}else n.x=r,n.y=e,n.point=t}else l(n,t,r,e,u,i,a,o)}function l(n,t,r,e,u,a,o,c){var l=.5*(u+o),s=.5*(a+c),f=r>=l,h=e>=s,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=xe()),f?u=l:o=l,h?a=s:c=s,i(n,t,r,e,u,a,o,c)}var s,f,h,g,p,d,v,m,y,x=pt(o),M=pt(c);if(null!=t)d=t,v=r,m=e,y=u;else if(m=y=-(d=v=1/0),f=[],h=[],p=n.length,a)for(g=0;p>g;++g)s=n[g],d>s.x&&(d=s.x),v>s.y&&(v=s.y),s.x>m&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+x(s=n[g],g),_=+M(s,g);d>b&&(d=b),v>_&&(v=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-d,E=y-v;w>E?y=v+w:m=d+E;var S=xe();if(S.add=function(n){i(S,n,+x(n,++g),+M(n,g),d,v,m,y)},S.visit=function(n){Me(n,S,d,v,m,y)},g=-1,null==t){for(;p>++g;)i(S,n[g],f[g],h[g],d,v,m,y);--g}else n.forEach(S.add);return f=h=n=s=null,S}var a,o=Br,c=Vr;return(a=arguments.length)?(o=me,c=ye,3===a&&(u=r,e=t,r=t=0),i(n)):(i.x=function(n){return arguments.length?(o=n,i):o},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=r=e=u=null:(t=+n[0][0],r=+n[0][1],e=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,r],[e,u]]},i.size=function(n){return arguments.length?(null==n?t=r=e=u=null:(t=r=0,e=+n[0],u=+n[1]),i):null==t?null:[e-t,u-r]},i)},da.interpolateRgb=be,da.interpolateObject=_e,da.interpolateNumber=we,da.interpolateString=Ee;var mc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;da.interpolate=Se,da.interpolators=[function(n,t){var r=typeof t;return("string"===r?fo.has(t)||/^(#|rgb\(|hsl\()/.test(t)?be:Ee:t instanceof B?be:"object"===r?Array.isArray(t)?ke:_e:we)(n,t)}],da.interpolateArray=ke;var yc=function(){return dt},xc=da.map({linear:yc,poly:Ce,quad:function(){return qe},cubic:function(){return je},sin:function(){return De},exp:function(){return Oe},circle:function(){return Fe},elastic:Le,back:Re,bounce:function(){return He}}),Mc=da.map({"in":dt,out:Ne,"in-out":Te,"out-in":function(n){return Te(Ne(n))}});da.ease=function(n){var t=n.indexOf("-"),r=t>=0?n.substring(0,t):n,e=t>=0?n.substring(t+1):"in";return r=xc.get(r)||yc,e=Mc.get(e)||dt,Ae(e(r.apply(null,Array.prototype.slice.call(arguments,1))))},da.interpolateHcl=Ie,da.interpolateHsl=Pe,da.interpolateLab=Ye,da.interpolateRound=Ue,da.transform=function(n){var t=ya.createElementNS(da.ns.prefix.svg,"g");return(da.transform=function(n){if(null!=n){t.setAttribute("transform",n);var r=t.transform.baseVal.consolidate()}return new Be(r?r.matrix:bc)})(n)},Be.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bc={a:1,b:0,c:0,d:1,e:0,f:0};da.interpolateTransform=$e,da.layout={},da.layout.bundle=function(){return function(n){for(var t=[],r=-1,e=n.length;e>++r;)t.push(Ge(n[r]));return t}},da.layout.chord=function(){function n(){var n,l,f,h,g,p={},d=[],v=da.range(i),m=[];for(r=[],e=[],n=0,h=-1;i>++h;){for(l=0,g=-1;i>++g;)l+=u[h][g];d.push(l),m.push(da.range(i)),n+=l}for(a&&v.sort(function(n,t){return a(d[n],d[t])}),o&&m.forEach(function(n,t){n.sort(function(n,r){return o(u[t][n],u[t][r])})}),n=(2*Za-s*i)/n,l=0,h=-1;i>++h;){for(f=l,g=-1;i>++g;){var y=v[h],x=m[y][g],M=u[y][x],b=l,_=l+=M*n;p[y+"-"+x]={index:y,subindex:x,startAngle:b,endAngle:_,value:M}}e[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;i>++h;)for(g=h-1;i>++g;){var w=p[h+"-"+g],E=p[g+"-"+h];(w.value||E.value)&&r.push(w.value<E.value?{source:E,target:w}:{source:w,target:E})}c&&t()}function t(){r.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var r,e,u,i,a,o,c,l={},s=0;return l.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,r=e=null,l):u},l.padding=function(n){return arguments.length?(s=n,r=e=null,l):s},l.sortGroups=function(n){return arguments.length?(a=n,r=e=null,l):a},l.sortSubgroups=function(n){return arguments.length?(o=n,r=null,l):o},l.sortChords=function(n){return arguments.length?(c=n,r&&t(),l):c},l.chords=function(){return r||n(),r},l.groups=function(){return e||n(),e},l},da.layout.force=function(){function n(n){return function(t,r,e,u){if(t.point!==n){var i=t.cx-n.x,a=t.cy-n.y,o=1/Math.sqrt(i*i+a*a);if(d>(u-r)*o){var c=t.charge*o*o;return n.px-=i*c,n.py-=a*c,!0}if(t.point&&isFinite(o)){var c=t.pointCharge*o*o;n.px-=i*c,n.py-=a*c}}return!t.charge}}function t(n){n.px=da.event.x,n.py=da.event.y,o.resume()}var r,e,u,i,a,o={},c=da.dispatch("start","tick","end"),l=[1,1],s=.9,f=_c,h=wc,g=-30,p=.1,d=.8,v=[],m=[];return o.tick=function(){if(.005>(e*=.99))return c.end({type:"end",alpha:e=0}),!0;var t,r,o,f,h,d,y,x,M,b=v.length,_=m.length;for(r=0;_>r;++r)o=m[r],f=o.source,h=o.target,x=h.x-f.x,M=h.y-f.y,(d=x*x+M*M)&&(d=e*i[r]*((d=Math.sqrt(d))-u[r])/d,x*=d,M*=d,h.x-=x*(y=f.weight/(h.weight+f.weight)),h.y-=M*y,f.x+=x*(y=1-y),f.y+=M*y);if((y=e*p)&&(x=l[0]/2,M=l[1]/2,r=-1,y))for(;b>++r;)o=v[r],o.x+=(x-o.x)*y,o.y+=(M-o.y)*y;if(g)for(uu(t=da.geom.quadtree(v),e,a),r=-1;b>++r;)(o=v[r]).fixed||t.visit(n(o));for(r=-1;b>++r;)o=v[r],o.fixed?(o.x=o.px,o.y=o.py):(o.x-=(o.px-(o.px=o.x))*s,o.y-=(o.py-(o.py=o.y))*s);c.tick({type:"tick",alpha:e})},o.nodes=function(n){return arguments.length?(v=n,o):v},o.links=function(n){return arguments.length?(m=n,o):m},o.size=function(n){return arguments.length?(l=n,o):l},o.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,o):f},o.distance=o.linkDistance,o.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,o):h},o.friction=function(n){return arguments.length?(s=+n,o):s},o.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,o):g},o.gravity=function(n){return arguments.length?(p=+n,o):p},o.theta=function(n){return arguments.length?(d=+n,o):d},o.alpha=function(n){return arguments.length?(n=+n,e?e=n>0?n:0:n>0&&(c.start({type:"start",alpha:e=n}),da.timer(o.tick)),o):e},o.start=function(){function n(n,e){for(var u,i=t(r),a=-1,o=i.length;o>++a;)if(!isNaN(u=i[a][n]))return u;return Math.random()*e}function t(){if(!c){for(c=[],e=0;p>e;++e)c[e]=[];for(e=0;d>e;++e){var n=m[e];c[n.source.index].push(n.target),c[n.target.index].push(n.source)}}return c[r]}var r,e,c,s,p=v.length,d=m.length,y=l[0],x=l[1];for(r=0;p>r;++r)(s=v[r]).index=r,s.weight=0;for(r=0;d>r;++r)s=m[r],"number"==typeof s.source&&(s.source=v[s.source]),"number"==typeof s.target&&(s.target=v[s.target]),++s.source.weight,++s.target.weight;for(r=0;p>r;++r)s=v[r],isNaN(s.x)&&(s.x=n("x",y)),isNaN(s.y)&&(s.y=n("y",x)),isNaN(s.px)&&(s.px=s.x),isNaN(s.py)&&(s.py=s.y);if(u=[],"function"==typeof f)for(r=0;d>r;++r)u[r]=+f.call(this,m[r],r);else for(r=0;d>r;++r)u[r]=f;if(i=[],"function"==typeof h)for(r=0;d>r;++r)i[r]=+h.call(this,m[r],r);else for(r=0;d>r;++r)i[r]=h;if(a=[],"function"==typeof g)for(r=0;p>r;++r)a[r]=+g.call(this,v[r],r);else for(r=0;p>r;++r)a[r]=g;return o.resume()},o.resume=function(){return o.alpha(.1)},o.stop=function(){return o.alpha(0)},o.drag=function(){return r||(r=da.behavior.drag().origin(dt).on("dragstart.force",nu).on("drag.force",t).on("dragend.force",tu)),arguments.length?(this.on("mouseover.force",ru).on("mouseout.force",eu).call(r),void 0):r},da.rebind(o,c,"on")};var _c=20,wc=1;da.layout.hierarchy=function(){function n(t,a,o){var c=u.call(r,t,a);if(t.depth=a,o.push(t),c&&(l=c.length)){for(var l,s,f=-1,h=t.children=[],g=0,p=a+1;l>++f;)s=n(c[f],p,o),s.parent=t,h.push(s),g+=s.value;e&&h.sort(e),i&&(t.value=g)}else i&&(t.value=+i.call(r,t,a)||0);return t}function t(n,e){var u=n.children,a=0;if(u&&(o=u.length))for(var o,c=-1,l=e+1;o>++c;)a+=t(u[c],l);else i&&(a=+i.call(r,n,e)||0);return i&&(n.value=a),a}function r(t){var r=[];return n(t,0,r),r}var e=cu,u=au,i=ou;return r.sort=function(n){return arguments.length?(e=n,r):e},r.children=function(n){return arguments.length?(u=n,r):u},r.value=function(n){return arguments.length?(i=n,r):i},r.revalue=function(n){return t(n,0),n},r},da.layout.partition=function(){function n(t,r,e,u){var i=t.children;if(t.x=r,t.y=t.depth*u,t.dx=e,t.dy=u,i&&(a=i.length)){var a,o,c,l=-1;for(e=t.value?e/t.value:0;a>++l;)n(o=i[l],r,c=o.value*e,u),r+=c}}function t(n){var r=n.children,e=0;if(r&&(u=r.length))for(var u,i=-1;u>++i;)e=Math.max(e,t(r[i]));return 1+e}function r(r,i){var a=e.call(this,r,i);return n(a[0],0,u[0],u[1]/t(a[0])),a}var e=da.layout.hierarchy(),u=[1,1];return r.size=function(n){return arguments.length?(u=n,r):u},iu(r,e)},da.layout.pie=function(){function n(i){var a=i.map(function(r,e){return+t.call(n,r,e)}),o=+("function"==typeof e?e.apply(this,arguments):e),c=(("function"==typeof u?u.apply(this,arguments):u)-o)/da.sum(a),l=da.range(i.length);null!=r&&l.sort(r===Ec?function(n,t){return a[t]-a[n]}:function(n,t){return r(i[n],i[t])});var s=[];return l.forEach(function(n){var t;s[n]={data:i[n],value:t=a[n],startAngle:o,endAngle:o+=t*c}}),s}var t=Number,r=Ec,e=0,u=2*Za;return n.value=function(r){return arguments.length?(t=r,n):t},n.sort=function(t){return arguments.length?(r=t,n):r},n.startAngle=function(t){return arguments.length?(e=t,n):e},n.endAngle=function(t){return arguments.length?(u=t,n):u},n};var Ec={};da.layout.stack=function(){function n(o,c){var l=o.map(function(r,e){return t.call(n,r,e)}),s=l.map(function(t){return t.map(function(t,r){return[i.call(n,t,r),a.call(n,t,r)]})}),f=r.call(n,s,c);l=da.permute(l,f),s=da.permute(s,f);var h,g,p,d=e.call(n,s,c),v=l.length,m=l[0].length;for(g=0;m>g;++g)for(u.call(n,l[0][g],p=d[g],s[0][g][1]),h=1;v>h;++h)u.call(n,l[h][g],p+=s[h-1][g][1],s[h][g][1]);return o}var t=dt,r=gu,e=pu,u=hu,i=su,a=fu;return n.values=function(r){return arguments.length?(t=r,n):t},n.order=function(t){return arguments.length?(r="function"==typeof t?t:Sc.get(t)||gu,n):r},n.offset=function(t){return arguments.length?(e="function"==typeof t?t:kc.get(t)||pu,n):e},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(a=t,n):a},n.out=function(t){return arguments.length?(u=t,n):u},n};var Sc=da.map({"inside-out":function(n){var t,r,e=n.length,u=n.map(du),i=n.map(vu),a=da.range(e).sort(function(n,t){return u[n]-u[t]}),o=0,c=0,l=[],s=[];for(t=0;e>t;++t)r=a[t],c>o?(o+=i[r],l.push(r)):(c+=i[r],s.push(r));return s.reverse().concat(l)},reverse:function(n){return da.range(n.length).reverse()},"default":gu}),kc=da.map({silhouette:function(n){var t,r,e,u=n.length,i=n[0].length,a=[],o=0,c=[];for(r=0;i>r;++r){for(t=0,e=0;u>t;t++)e+=n[t][r][1];e>o&&(o=e),a.push(e)}for(r=0;i>r;++r)c[r]=(o-a[r])/2;return c},wiggle:function(n){var t,r,e,u,i,a,o,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,r=1;h>r;++r){for(t=0,u=0;s>t;++t)u+=n[t][r][1];for(t=0,i=0,o=f[r][0]-f[r-1][0];s>t;++t){for(e=0,a=(n[t][r][1]-n[t][r-1][1])/(2*o);t>e;++e)a+=(n[e][r][1]-n[e][r-1][1])/o;i+=a*n[t][r][1]}g[r]=c-=u?i/u*o:0,l>c&&(l=c)}for(r=0;h>r;++r)g[r]-=l;return g},expand:function(n){var t,r,e,u=n.length,i=n[0].length,a=1/u,o=[];for(r=0;i>r;++r){for(t=0,e=0;u>t;t++)e+=n[t][r][1];if(e)for(t=0;u>t;t++)n[t][r][1]/=e;else for(t=0;u>t;t++)n[t][r][1]=a}for(r=0;i>r;++r)o[r]=0;return o},zero:pu});da.layout.histogram=function(){function n(n,i){for(var a,o,c=[],l=n.map(r,this),s=e.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;g>++i;)a=c[i]=[],a.dx=f[i+1]-(a.x=f[i]),a.y=0;if(g>0)for(i=-1;h>++i;)o=l[i],o>=s[0]&&s[1]>=o&&(a=c[da.bisect(f,o,1,g)-1],a.y+=p,a.push(n[i]));return c}var t=!0,r=Number,e=Mu,u=yu;return n.value=function(t){return arguments.length?(r=t,n):r},n.range=function(t){return arguments.length?(e=pt(t),n):e},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return xu(n,t)}:pt(t),n):u},n.frequency=function(r){return arguments.length?(t=!!r,n):t},n},da.layout.tree=function(){function n(n,i){function a(n,t){var e=n.children,u=n._tree;if(e&&(i=e.length)){for(var i,o,l,s=e[0],f=s,h=-1;i>++h;)l=e[h],a(l,o),f=c(l,o,f),o=l;Tu(n);var g=.5*(s._tree.prelim+l._tree.prelim);t?(u.prelim=t._tree.prelim+r(n,t),u.mod=u.prelim-g):u.prelim=g}else t&&(u.prelim=t._tree.prelim+r(n,t))}function o(n,t){n.x=n._tree.prelim+t;var r=n.children;if(r&&(e=r.length)){var e,u=-1;for(t+=n._tree.mod;e>++u;)o(r[u],t)}}function c(n,t,e){if(t){for(var u,i=n,a=n,o=t,c=n.parent.children[0],l=i._tree.mod,s=a._tree.mod,f=o._tree.mod,h=c._tree.mod;o=wu(o),i=_u(i),o&&i;)c=_u(c),a=wu(a),a._tree.ancestor=n,u=o._tree.prelim+f-i._tree.prelim-l+r(o,i),u>0&&(qu(ju(o,n,e),n,u),l+=u,s+=u),f+=o._tree.mod,l+=i._tree.mod,h+=c._tree.mod,s+=a._tree.mod;o&&!wu(a)&&(a._tree.thread=o,a._tree.mod+=f-s),i&&!_u(c)&&(c._tree.thread=i,c._tree.mod+=l-h,e=n)}return e}var l=t.call(this,n,i),s=l[0];Nu(s,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),a(s),o(s,-s._tree.prelim);var f=Eu(s,ku),h=Eu(s,Su),g=Eu(s,Au),p=f.x-r(f,h)/2,d=h.x+r(h,f)/2,v=g.depth||1;return Nu(s,u?function(n){n.x*=e[0],n.y=n.depth*e[1],delete n._tree}:function(n){n.x=(n.x-p)/(d-p)*e[0],n.y=n.depth/v*e[1],delete n._tree}),l}var t=da.layout.hierarchy().sort(null).value(null),r=bu,e=[1,1],u=!1;return n.separation=function(t){return arguments.length?(r=t,n):r},n.size=function(t){return arguments.length?(u=null==(e=t),n):u?null:e},n.nodeSize=function(t){return arguments.length?(u=null!=(e=t),n):u?e:null},iu(n,t)},da.layout.pack=function(){function n(n,i){var a=r.call(this,n,i),o=a[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(o.x=o.y=0,Nu(o,function(n){n.r=+s(n.value)}),Nu(o,Fu),e){var f=e*(t?1:Math.max(2*o.r/c,2*o.r/l))/2;Nu(o,function(n){n.r+=f}),Nu(o,Fu),Nu(o,function(n){n.r-=f})}return Hu(o,c/2,l/2,t?1:1/Math.max(2*o.r/c,2*o.r/l)),a}var t,r=da.layout.hierarchy().sort(zu),e=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(r){return arguments.length?(t=null==r||"function"==typeof r?r:+r,n):t},n.padding=function(t){return arguments.length?(e=+t,n):e},iu(n,r)},da.layout.cluster=function(){function n(n,i){var a,o=t.call(this,n,i),c=o[0],l=0;Nu(c,function(n){var t=n.children;t&&t.length?(n.x=Yu(t),n.y=Pu(t)):(n.x=a?l+=r(n,a):0,n.y=0,a=n)});var s=Uu(c),f=Bu(c),h=s.x-r(s,f)/2,g=f.x+r(f,s)/2;return Nu(c,u?function(n){n.x=(n.x-c.x)*e[0],n.y=(c.y-n.y)*e[1]}:function(n){n.x=(n.x-h)/(g-h)*e[0],n.y=(1-(c.y?n.y/c.y:1))*e[1]}),o}var t=da.layout.hierarchy().sort(null).value(null),r=bu,e=[1,1],u=!1;return n.separation=function(t){return arguments.length?(r=t,n):r},n.size=function(t){return arguments.length?(u=null==(e=t),n):u?null:e},n.nodeSize=function(t){return arguments.length?(u=null!=(e=t),n):u?e:null},iu(n,t)},da.layout.treemap=function(){function n(n,t){for(var r,e,u=-1,i=n.length;i>++u;)e=(r=n[u]).value*(0>t?0:t),r.area=isNaN(e)||0>=e?0:e}function t(r){var i=r.children;if(i&&i.length){var a,o,c,l=f(r),s=[],h=i.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&r.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/r.value),s.area=0;(c=h.length)>0;)s.push(a=h[c-1]),s.area+=a.area,"squarify"!==g||p>=(o=e(s,d))?(h.pop(),p=o):(s.area-=s.pop().area,u(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,d,l,!0),s.length=s.area=0),i.forEach(t)}}function r(t){var e=t.children;if(e&&e.length){var i,a=f(t),o=e.slice(),c=[];for(n(o,a.dx*a.dy/t.value),c.area=0;i=o.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);e.forEach(r)}}function e(n,t){for(var r,e=n.area,u=0,i=1/0,a=-1,o=n.length;o>++a;)(r=n[a].area)&&(i>r&&(i=r),r>u&&(u=r));return e*=e,t*=t,e?Math.max(t*u*p/e,e/(t*i*p)):1/0}function u(n,t,r,e){var u,i=-1,a=n.length,o=r.x,l=r.y,s=t?c(n.area/t):0;if(t==r.dx){for((e||s>r.dy)&&(s=r.dy);a>++i;)u=n[i],u.x=o,u.y=l,u.dy=s,o+=u.dx=Math.min(r.x+r.dx-o,s?c(u.area/s):0);u.z=!0,u.dx+=r.x+r.dx-o,r.y+=s,r.dy-=s}else{for((e||s>r.dx)&&(s=r.dx);a>++i;)u=n[i],u.x=o,u.y=l,u.dx=s,l+=u.dy=Math.min(r.y+r.dy-l,s?c(u.area/s):0);u.z=!1,u.dy+=r.y+r.dy-l,r.x+=s,r.dx-=s}}function i(e){var u=a||o(e),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],a&&o.revalue(i),n([i],i.dx*i.dy/i.value),(a?r:t)(i),h&&(a=u),u}var a,o=da.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Vu,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(l=n,i):l},i.padding=function(n){function t(t){var r=n.call(i,t,t.depth);return null==r?Vu(t):Zu(t,"number"==typeof r?[r,r,r,r]:r)}function r(t){return Zu(t,n)}if(!arguments.length)return s;var e;return f=null==(s=n)?Vu:"function"==(e=typeof n)?t:"number"===e?(n=[n,n,n,n],r):r,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,a=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},iu(i,o)},da.random={normal:function(n,t){var r=arguments.length;return 2>r&&(t=1),1>r&&(n=0),function(){var r,e,u;do r=2*Math.random()-1,e=2*Math.random()-1,u=r*r+e*e;while(!u||u>1);return n+t*r*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=da.random.normal.apply(da,arguments);return function(){return Math.exp(n())}},irwinHall:function(n){return function(){for(var t=0,r=0;n>r;r++)t+=Math.random();return t/n}}},da.scale={};var Ac={floor:dt,ceil:dt};da.scale.linear=function(){return Qu([0,1],[0,1],Se,!1)},da.scale.log=function(){return ii(da.scale.linear().domain([0,1]),10,!0,[1,10])};var Nc=da.format(".0e"),Tc={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};da.scale.pow=function(){return ai(da.scale.linear(),1,[0,1])},da.scale.sqrt=function(){return da.scale.pow().exponent(.5)},da.scale.ordinal=function(){return ci([],{t:"range",a:[[]]})},da.scale.category10=function(){return da.scale.ordinal().range(qc)},da.scale.category20=function(){return da.scale.ordinal().range(jc)},da.scale.category20b=function(){return da.scale.ordinal().range(zc)},da.scale.category20c=function(){return da.scale.ordinal().range(Cc)};var qc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(it),jc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(it),zc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(it),Cc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(it);da.scale.quantile=function(){return li([],[])},da.scale.quantize=function(){return si(0,1,[0,1])},da.scale.threshold=function(){return fi([.5],[0,1])},da.scale.identity=function(){return hi([0,1])},da.svg.arc=function(){function n(){var n=t.apply(this,arguments),i=r.apply(this,arguments),a=e.apply(this,arguments)+Dc,o=u.apply(this,arguments)+Dc,c=(a>o&&(c=a,a=o,o=c),o-a),l=Za>c?"0":"1",s=Math.cos(a),f=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=Oc?n?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":n?"M"+i*s+","+i*f+"A"+i+","+i+" 0 "+l+",1 "+i*h+","+i*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+l+",0 "+n*s+","+n*f+"Z":"M"+i*s+","+i*f+"A"+i+","+i+" 0 "+l+",1 "+i*h+","+i*g+"L0,0"+"Z"}var t=gi,r=pi,e=di,u=vi;return n.innerRadius=function(r){return arguments.length?(t=pt(r),n):t},n.outerRadius=function(t){return arguments.length?(r=pt(t),n):r},n.startAngle=function(t){return arguments.length?(e=pt(t),n):e},n.endAngle=function(t){return arguments.length?(u=pt(t),n):u},n.centroid=function(){var n=(t.apply(this,arguments)+r.apply(this,arguments))/2,i=(e.apply(this,arguments)+u.apply(this,arguments))/2+Dc;return[Math.cos(i)*n,Math.sin(i)*n]},n};var Dc=-Za/2,Oc=2*Za-1e-6;da.svg.line.radial=function(){var n=Ur(mi);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},Jr.reverse=Wr,Wr.reverse=Jr,da.svg.area=function(){return yi(dt)},da.svg.area.radial=function(){var n=yi(mi);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},da.svg.chord=function(){function n(n,o){var c=t(this,i,n,o),l=t(this,a,n,o);return"M"+c.p0+e(c.r,c.p1,c.a1-c.a0)+(r(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+e(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,r,e){var u=t.call(n,r,e),i=o.call(n,u,e),a=c.call(n,u,e)+Dc,s=l.call(n,u,e)+Dc;return{r:i,a0:a,a1:s,p0:[i*Math.cos(a),i*Math.sin(a)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function r(n,t){return n.a0==t.a0&&n.a1==t.a1}function e(n,t,r){return"A"+n+","+n+" 0 "+ +(r>Za)+",1 "+t}function u(n,t,r,e){return"Q 0,0 "+e}var i=Cr,a=Dr,o=xi,c=di,l=vi;return n.radius=function(t){return arguments.length?(o=pt(t),n):o},n.source=function(t){return arguments.length?(i=pt(t),n):i},n.target=function(t){return arguments.length?(a=pt(t),n):a},n.startAngle=function(t){return arguments.length?(c=pt(t),n):c},n.endAngle=function(t){return arguments.length?(l=pt(t),n):l},n},da.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),a=r.call(this,n,u),o=(i.y+a.y)/2,c=[i,{x:i.x,y:o},{x:a.x,y:o},a];return c=c.map(e),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=Cr,r=Dr,e=Mi;return n.source=function(r){return arguments.length?(t=pt(r),n):t},n.target=function(t){return arguments.length?(r=pt(t),n):r},n.projection=function(t){return arguments.length?(e=t,n):e},n},da.svg.diagonal.radial=function(){var n=da.svg.diagonal(),t=Mi,r=n.projection;return n.projection=function(n){return arguments.length?r(bi(t=n)):t},n},da.svg.symbol=function(){function n(n,e){return(Fc.get(t.call(this,n,e))||Ei)(r.call(this,n,e))}var t=wi,r=_i;return n.type=function(r){return arguments.length?(t=pt(r),n):t},n.size=function(t){return arguments.length?(r=pt(t),n):r},n};var Fc=da.map({circle:Ei,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Ic)),r=t*Ic;return"M0,"+-t+"L"+r+",0"+" 0,"+t+" "+-r+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Hc),r=t*Hc/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Hc),r=t*Hc/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});da.svg.symbolTypes=Fc.keys();var Lc,Rc,Hc=Math.sqrt(3),Ic=Math.tan(30*Ja),Pc=[],Yc=0;Pc.call=Ra.call,Pc.empty=Ra.empty,Pc.node=Ra.node,Pc.size=Ra.size,da.transition=function(n){return arguments.length?Lc?n.transition():n:Pa.transition()},da.transition.prototype=Pc,Pc.select=function(n){var t,r,e,u=this.id,i=[];n=d(n);for(var a=-1,o=this.length;o>++a;){i.push(t=[]);for(var c=this[a],l=-1,s=c.length;s>++l;)(e=c[l])&&(r=n.call(e,e.__data__,l,a))?("__data__"in e&&(r.__data__=e.__data__),Ni(r,l,u,e.__transition__[u]),t.push(r)):t.push(null)}return Si(i,u)},Pc.selectAll=function(n){var t,r,e,u,i,a=this.id,o=[];n=v(n);for(var c=-1,l=this.length;l>++c;)for(var s=this[c],f=-1,h=s.length;h>++f;)if(e=s[f]){i=e.__transition__[a],r=n.call(e,e.__data__,f,c),o.push(t=[]);for(var g=-1,p=r.length;p>++g;)(u=r[g])&&Ni(u,g,a,i),t.push(u)}return Si(o,a)},Pc.filter=function(n){var t,r,e,u=[];"function"!=typeof n&&(n=k(n));for(var i=0,a=this.length;a>i;i++){u.push(t=[]);for(var r=this[i],o=0,c=r.length;c>o;o++)(e=r[o])&&n.call(e,e.__data__,o)&&t.push(e)}return Si(u,this.id)},Pc.tween=function(n,t){var r=this.id;return 2>arguments.length?this.node().__transition__[r].tween.get(n):N(this,null==t?function(t){t.__transition__[r].tween.remove(n)}:function(e){e.__transition__[r].tween.set(n,t)})},Pc.attr=function(n,t){function r(){this.removeAttribute(o)}function e(){this.removeAttributeNS(o.space,o.local)}function u(n){return null==n?r:(n+="",function(){var t,r=this.getAttribute(o);return r!==n&&(t=a(r,n),function(n){this.setAttribute(o,t(n))})})}function i(n){return null==n?e:(n+="",function(){var t,r=this.getAttributeNS(o.space,o.local);return r!==n&&(t=a(r,n),function(n){this.setAttributeNS(o.space,o.local,t(n))})})}if(2>arguments.length){for(t in n)this.attr(t,n[t]);return this}var a="transform"==n?$e:Se,o=da.ns.qualify(n);return ki(this,"attr."+n,t,o.local?i:u)},Pc.attrTween=function(n,t){function r(n,r){var e=t.call(this,n,r,this.getAttribute(u));return e&&function(n){this.setAttribute(u,e(n))}}function e(n,r){var e=t.call(this,n,r,this.getAttributeNS(u.space,u.local));return e&&function(n){this.setAttributeNS(u.space,u.local,e(n))
6
+ }}var u=da.ns.qualify(n);return this.tween("attr."+n,u.local?e:r)},Pc.style=function(n,t,r){function e(){this.style.removeProperty(n)}function u(t){return null==t?e:(t+="",function(){var e,u=Ma.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(e=Se(u,t),function(t){this.style.setProperty(n,e(t),r)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(r in n)this.style(r,n[r],t);return this}r=""}return ki(this,"style."+n,t,u)},Pc.styleTween=function(n,t,r){function e(e,u){var i=t.call(this,e,u,Ma.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),r)}}return 3>arguments.length&&(r=""),this.tween("style."+n,e)},Pc.text=function(n){return ki(this,"text",n,Ai)},Pc.remove=function(){return this.each("end.transition",function(){var n;2>this.__transition__.count&&(n=this.parentNode)&&n.removeChild(this)})},Pc.ease=function(n){var t=this.id;return 1>arguments.length?this.node().__transition__[t].ease:("function"!=typeof n&&(n=da.ease.apply(da,arguments)),N(this,function(r){r.__transition__[t].ease=n}))},Pc.delay=function(n){var t=this.id;return N(this,"function"==typeof n?function(r,e,u){r.__transition__[t].delay=+n.call(r,r.__data__,e,u)}:(n=+n,function(r){r.__transition__[t].delay=n}))},Pc.duration=function(n){var t=this.id;return N(this,"function"==typeof n?function(r,e,u){r.__transition__[t].duration=Math.max(1,n.call(r,r.__data__,e,u))}:(n=Math.max(1,n),function(r){r.__transition__[t].duration=n}))},Pc.each=function(n,t){var r=this.id;if(2>arguments.length){var e=Rc,u=Lc;Lc=r,N(this,function(t,e,u){Rc=t.__transition__[r],n.call(t,t.__data__,e,u)}),Rc=e,Lc=u}else N(this,function(e){var u=e.__transition__[r];(u.event||(u.event=da.dispatch("start","end"))).on(n,t)});return this},Pc.transition=function(){for(var n,t,r,e,u=this.id,i=++Yc,a=[],o=0,c=this.length;c>o;o++){a.push(n=[]);for(var t=this[o],l=0,s=t.length;s>l;l++)(r=t[l])&&(e=Object.create(r.__transition__[u]),e.delay+=e.duration,Ni(r,l,i,e)),n.push(r)}return Si(a,i)},da.svg.axis=function(){function n(n){n.each(function(){var n,l=da.select(this),s=null==c?r.ticks?r.ticks.apply(r,o):r.domain():c,f=null==t?r.tickFormat?r.tickFormat.apply(r,o):dt:t,h=l.selectAll(".tick").data(s,dt),g=h.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),p=da.transition(h.exit()).style("opacity",1e-6).remove(),d=da.transition(h).style("opacity",1),v=$u(r),m=l.selectAll(".domain").data([0]),y=(m.enter().append("path").attr("class","domain"),da.transition(m)),x=r.copy(),M=this.__chart__||x;this.__chart__=x,g.append("line"),g.append("text");var b=g.select("line"),_=d.select("line"),w=h.select("text").text(f),E=g.select("text"),S=d.select("text");switch(e){case"bottom":n=Ti,b.attr("y2",u),E.attr("y",Math.max(u,0)+a),_.attr("x2",0).attr("y2",u),S.attr("x",0).attr("y",Math.max(u,0)+a),w.attr("dy",".71em").style("text-anchor","middle"),y.attr("d","M"+v[0]+","+i+"V0H"+v[1]+"V"+i);break;case"top":n=Ti,b.attr("y2",-u),E.attr("y",-(Math.max(u,0)+a)),_.attr("x2",0).attr("y2",-u),S.attr("x",0).attr("y",-(Math.max(u,0)+a)),w.attr("dy","0em").style("text-anchor","middle"),y.attr("d","M"+v[0]+","+-i+"V0H"+v[1]+"V"+-i);break;case"left":n=qi,b.attr("x2",-u),E.attr("x",-(Math.max(u,0)+a)),_.attr("x2",-u).attr("y2",0),S.attr("x",-(Math.max(u,0)+a)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),y.attr("d","M"+-i+","+v[0]+"H0V"+v[1]+"H"+-i);break;case"right":n=qi,b.attr("x2",u),E.attr("x",Math.max(u,0)+a),_.attr("x2",u).attr("y2",0),S.attr("x",Math.max(u,0)+a).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),y.attr("d","M"+i+","+v[0]+"H0V"+v[1]+"H"+i)}if(r.rangeBand){var k=x.rangeBand()/2,A=function(n){return x(n)+k};g.call(n,A),d.call(n,A)}else g.call(n,M),d.call(n,x),p.call(n,x)})}var t,r=da.scale.linear(),e=Uc,u=6,i=6,a=3,o=[10],c=null;return n.scale=function(t){return arguments.length?(r=t,n):r},n.orient=function(t){return arguments.length?(e=t in Bc?t+"":Uc,n):e},n.ticks=function(){return arguments.length?(o=arguments,n):o},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(r){return arguments.length?(t=r,n):t},n.tickSize=function(t){var r=arguments.length;return r?(u=+t,i=+arguments[r-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(a=+t,n):a},n.tickSubdivide=function(){return arguments.length&&n},n};var Uc="bottom",Bc={top:1,right:1,bottom:1,left:1};da.svg.brush=function(){function n(i){i.each(function(){var i=da.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),a=i.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var o=i.selectAll(".resize").data(v,dt);o.exit().remove(),o.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Vc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),o.style("display",n.empty()?"none":null);var s,f=da.transition(i),h=da.transition(a);c&&(s=$u(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),r(f)),l&&(s=$u(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),e(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function e(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function u(){function u(){var n=da.event.changedTouches;return n?da.touches(_,n)[0]:da.mouse(_)}function g(){32==da.event.keyCode&&(T||(M=null,j[0]-=s[1],j[1]-=h[1],T=2),f())}function v(){32==da.event.keyCode&&2==T&&(j[0]+=s[1],j[1]+=h[1],T=0,f())}function m(){var n=u(),i=!1;b&&(n[0]+=b[0],n[1]+=b[1]),T||(da.event.altKey?(M||(M=[(s[0]+s[1])/2,(h[0]+h[1])/2]),j[0]=s[+(n[0]<M[0])],j[1]=h[+(n[1]<M[1])]):M=null),A&&y(n,c,0)&&(r(S),i=!0),N&&y(n,l,1)&&(e(S),i=!0),i&&(t(S),E({type:"brush",mode:T?"move":"resize"}))}function y(n,t,r){var e,u,o=$u(t),c=o[0],l=o[1],f=j[r],g=r?h:s,v=g[1]-g[0];return T&&(c-=f,l-=v+f),e=(r?d:p)?Math.max(c,Math.min(l,n[r])):n[r],T?u=(e+=f)+v:(M&&(f=Math.max(c,Math.min(l,2*M[r]-e))),e>f?(u=e,e=f):u=f),g[0]!=e||g[1]!=u?(r?a=null:i=null,g[0]=e,g[1]=u,!0):void 0}function x(){m(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),da.select("body").style("cursor",null),z.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),q(),E({type:"brushend"})}var M,b,_=this,w=da.select(da.event.target),E=o.of(_,arguments),S=da.select(_),k=w.datum(),A=!/^(n|s)$/.test(k)&&c,N=!/^(e|w)$/.test(k)&&l,T=w.classed("extent"),q=O(),j=u(),z=da.select(Ma).on("keydown.brush",g).on("keyup.brush",v);if(da.event.changedTouches?z.on("touchmove.brush",m).on("touchend.brush",x):z.on("mousemove.brush",m).on("mouseup.brush",x),S.interrupt().selectAll("*").interrupt(),T)j[0]=s[0]-j[0],j[1]=h[0]-j[1];else if(k){var C=+/w$/.test(k),D=+/^n/.test(k);b=[s[1-C]-j[0],h[1-D]-j[1]],j[0]=s[C],j[1]=h[D]}else da.event.altKey&&(M=j.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),da.select("body").style("cursor",w.style("cursor")),E({type:"brushstart"}),m()}var i,a,o=g(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],h=[0,0],p=!0,d=!0,v=Zc[0];return n.event=function(n){n.each(function(){var n=o.of(this,arguments),t={x:s,y:h,i:i,j:a},r=this.__chart__||t;this.__chart__=t,Lc?da.select(this).transition().each("start.brush",function(){i=r.i,a=r.j,s=r.x,h=r.y,n({type:"brushstart"})}).tween("brush:brush",function(){var r=ke(s,t.x),e=ke(h,t.y);return i=a=null,function(u){s=t.x=r(u),h=t.y=e(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,v=Zc[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,v=Zc[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(p=!!t[0],d=!!t[1]):c?p=!!t:l&&(d=!!t),n):c&&l?[p,d]:c?p:l?d:null},n.extent=function(t){var r,e,u,o,f;return arguments.length?(c&&(r=t[0],e=t[1],l&&(r=r[0],e=e[0]),i=[r,e],c.invert&&(r=c(r),e=c(e)),r>e&&(f=r,r=e,e=f),(r!=s[0]||e!=s[1])&&(s=[r,e])),l&&(u=t[0],o=t[1],c&&(u=u[1],o=o[1]),a=[u,o],l.invert&&(u=l(u),o=l(o)),u>o&&(f=u,u=o,o=f),(u!=h[0]||o!=h[1])&&(h=[u,o])),n):(c&&(i?(r=i[0],e=i[1]):(r=s[0],e=s[1],c.invert&&(r=c.invert(r),e=c.invert(e)),r>e&&(f=r,r=e,e=f))),l&&(a?(u=a[0],o=a[1]):(u=h[0],o=h[1],l.invert&&(u=l.invert(u),o=l.invert(o)),u>o&&(f=u,u=o,o=f))),c&&l?[[r,u],[e,o]]:c?[r,e]:l&&[u,o])},n.clear=function(){return n.empty()||(s=[0,0],h=[0,0],i=a=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!l&&h[0]==h[1]},da.rebind(n,o,"on")};var Vc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Zc=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Xc=da.time={},$c=Date,Jc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];ji.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Wc.setUTCDate.apply(this._,arguments)},setDay:function(){Wc.setUTCDay.apply(this._,arguments)},setFullYear:function(){Wc.setUTCFullYear.apply(this._,arguments)},setHours:function(){Wc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Wc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Wc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Wc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Wc.setUTCSeconds.apply(this._,arguments)},setTime:function(){Wc.setTime.apply(this._,arguments)}};var Wc=Date.prototype,Gc="%a %b %e %X %Y",Kc="%m/%d/%Y",Qc="%H:%M:%S",nl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],tl=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rl=["January","February","March","April","May","June","July","August","September","October","November","December"],el=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Xc.year=zi(function(n){return n=Xc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),Xc.years=Xc.year.range,Xc.years.utc=Xc.year.utc.range,Xc.day=zi(function(n){var t=new $c(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),Xc.days=Xc.day.range,Xc.days.utc=Xc.day.utc.range,Xc.dayOfYear=function(n){var t=Xc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},Jc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var r=Xc[n]=zi(function(n){return(n=Xc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var r=Xc.year(n).getDay();return Math.floor((Xc.dayOfYear(n)+(r+t)%7)/7)-(r!==t)});Xc[n+"s"]=r.range,Xc[n+"s"].utc=r.utc.range,Xc[n+"OfYear"]=function(n){var r=Xc.year(n).getDay();return Math.floor((Xc.dayOfYear(n)+(r+t)%7)/7)}}),Xc.week=Xc.sunday,Xc.weeks=Xc.sunday.range,Xc.weeks.utc=Xc.sunday.utc.range,Xc.weekOfYear=Xc.sundayOfYear,Xc.format=Di;var ul=Fi(nl),il=Li(nl),al=Fi(tl),ol=Li(tl),cl=Fi(rl),ll=Li(rl),sl=Fi(el),fl=Li(el),hl=/^%/,gl={"-":"",_:" ",0:"0"},pl={a:function(n){return tl[n.getDay()]},A:function(n){return nl[n.getDay()]},b:function(n){return el[n.getMonth()]},B:function(n){return rl[n.getMonth()]},c:Di(Gc),d:function(n,t){return Ri(n.getDate(),t,2)},e:function(n,t){return Ri(n.getDate(),t,2)},H:function(n,t){return Ri(n.getHours(),t,2)},I:function(n,t){return Ri(n.getHours()%12||12,t,2)},j:function(n,t){return Ri(1+Xc.dayOfYear(n),t,3)},L:function(n,t){return Ri(n.getMilliseconds(),t,3)},m:function(n,t){return Ri(n.getMonth()+1,t,2)},M:function(n,t){return Ri(n.getMinutes(),t,2)},p:function(n){return n.getHours()>=12?"PM":"AM"},S:function(n,t){return Ri(n.getSeconds(),t,2)},U:function(n,t){return Ri(Xc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Ri(Xc.mondayOfYear(n),t,2)},x:Di(Kc),X:Di(Qc),y:function(n,t){return Ri(n.getFullYear()%100,t,2)},Y:function(n,t){return Ri(n.getFullYear()%1e4,t,4)},Z:aa,"%":function(){return"%"}},dl={a:Hi,A:Ii,b:Bi,B:Vi,c:Zi,d:Qi,e:Qi,H:ta,I:ta,j:na,L:ua,m:Ki,M:ra,p:ia,S:ea,U:Yi,w:Pi,W:Ui,x:Xi,X:$i,y:Wi,Y:Ji,"%":oa},vl=/^\s*\d+/,ml=da.map({am:0,pm:1});Di.utc=ca;var yl=ca("%Y-%m-%dT%H:%M:%S.%LZ");Di.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?la:yl,la.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},la.toString=yl.toString,Xc.second=zi(function(n){return new $c(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),Xc.seconds=Xc.second.range,Xc.seconds.utc=Xc.second.utc.range,Xc.minute=zi(function(n){return new $c(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),Xc.minutes=Xc.minute.range,Xc.minutes.utc=Xc.minute.utc.range,Xc.hour=zi(function(n){var t=n.getTimezoneOffset()/60;return new $c(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),Xc.hours=Xc.hour.range,Xc.hours.utc=Xc.hour.utc.range,Xc.month=zi(function(n){return n=Xc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),Xc.months=Xc.month.range,Xc.months.utc=Xc.month.utc.range;var xl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ml=[[Xc.second,1],[Xc.second,5],[Xc.second,15],[Xc.second,30],[Xc.minute,1],[Xc.minute,5],[Xc.minute,15],[Xc.minute,30],[Xc.hour,1],[Xc.hour,3],[Xc.hour,6],[Xc.hour,12],[Xc.day,1],[Xc.day,2],[Xc.week,1],[Xc.month,1],[Xc.month,3],[Xc.year,1]],bl=[[Di("%Y"),Vt],[Di("%B"),function(n){return n.getMonth()}],[Di("%b %d"),function(n){return 1!=n.getDate()}],[Di("%a %d"),function(n){return n.getDay()&&1!=n.getDate()}],[Di("%I %p"),function(n){return n.getHours()}],[Di("%I:%M"),function(n){return n.getMinutes()}],[Di(":%S"),function(n){return n.getSeconds()}],[Di(".%L"),function(n){return n.getMilliseconds()}]],_l=ha(bl);Ml.year=Xc.year,Xc.scale=function(){return sa(da.scale.linear(),Ml,_l)};var wl={range:function(n,t,r){return da.range(+n,+t,r).map(fa)}},El=Ml.map(function(n){return[n[0].utc,n[1]]}),Sl=[[ca("%Y"),Vt],[ca("%B"),function(n){return n.getUTCMonth()}],[ca("%b %d"),function(n){return 1!=n.getUTCDate()}],[ca("%a %d"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[ca("%I %p"),function(n){return n.getUTCHours()}],[ca("%I:%M"),function(n){return n.getUTCMinutes()}],[ca(":%S"),function(n){return n.getUTCSeconds()}],[ca(".%L"),function(n){return n.getUTCMilliseconds()}]],kl=ha(Sl);return El.year=Xc.year.utc,Xc.scale.utc=function(){return sa(da.scale.linear(),El,kl)},da.text=vt(function(n){return n.responseText}),da.json=function(n,t){return mt(n,"application/json",ga,t)},da.html=function(n,t){return mt(n,"text/html",pa,t)},da.xml=vt(function(n){return n.responseXML}),da}(),function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,s=u.hasOwnProperty,f=e.forEach,h=e.map,g=e.reduce,p=e.reduceRight,d=e.filter,v=e.every,m=e.some,y=e.indexOf,x=e.lastIndexOf,M=Array.isArray,b=Object.keys,_=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var E=w.each=w.forEach=function(n,t,e){if(null!=n)if(f&&n.forEach===f)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:h&&n.map===h?n.map(t,r):(E(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var S="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),g&&n.reduce===g)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(E(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(S);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),p&&n.reduceRight===p)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(E(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(S);return r},w.find=w.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(E(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:v&&n.every===v?n.every(t,e):(E(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(E(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):k(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?null:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return E(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return E(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return E(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var A=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=A(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index<t.index?-1:1}),"value")};var N=function(n,t,r,e){var u={},i=A(t||w.identity);return E(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return N(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return N(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:A(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var T=function(n,t,r){return E(n,function(n){w.isArray(n)?t?a.apply(r,n):T(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return T(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return E(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(x&&n.lastIndexOf===x)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i},w.bind=function(n,t){if(n.bind===_&&_)return _.apply(n,o.call(arguments,1));var r=o.call(arguments,2);return function(){return n.apply(t,r.concat(o.call(arguments)))}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);return 0===t.length&&(t=w.functions(n)),E(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=b||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return E(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return E(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return E(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var q=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=q(n[a],t[a],r,e)););}else{var c=n.constructor,s=t.constructor;if(c!==s&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(s)&&s instanceof s))return!1;for(var f in n)if(w.has(n,f)&&(a++,!(o=w.has(t,f)&&q(n[f],t[f],r,e))))break;if(o){for(f in t)if(w.has(t,f)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return q(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=M||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},E(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),w.isFunction=function(n){return"function"==typeof n},w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return void 0===n},w.has=function(n,t){return s.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var j={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};j.unescape=w.invert(j.escape);var z={escape:RegExp("["+w.keys(j.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(j.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(z[n],function(t){return j[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){E(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),L.call(this,r.apply(w,n))}})};var C=0;w.uniqueId=function(n){var t=++C+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var D=/(.)^/,O={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||D).source,(r.interpolate||D).source,(r.evaluate||D).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(F,function(n){return"\\"+O[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var L=function(n){return this._chain?w(n).chain():n};w.mixin(w),E(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],L.call(this,r)}}),E(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return L.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),this.JST=this.JST||{},this.JST["app/templates/hello.us"]=function(obj){obj||(obj={});var __t,__p="";with(_.escape,obj)__p+='<div class="hello">\n '+(null==(__t=text)?"":__t)+"\n</div>";return __p},function(){window.data=[4,8,15,16,23,42],window.hello1=function(){var n,t;return n=d3.select("body").append("div").attr("class","chart1"),t=d3.scale.linear().domain([0,d3.max(data)]).range(["0px","420px"]),n.selectAll("div").data(data).enter().append("div").style("width",t).text(function(n){return n}),console.log("hello1")},window.hello_svg=function(){var n,t,r;return n=d3.select("body").append("svg").attr("class","svg").attr("width",420).attr("height",20*data.length).append("g").attr("transform","translate(10,15)"),t=d3.scale.linear().domain([0,d3.max(data)]).range([0,420]),n.selectAll("line").data(t.ticks(10)).enter().append("line").attr("x1",t).attr("x2",t).attr("y1",0).attr("y2",120).style("stroke","#ccc"),n.selectAll(".rule").data(t.ticks(10)).enter().append("text").attr("class","rule").attr("x",t).attr("y",0).attr("dy",-3).attr("text-anchor","middle").text(String),n.append("line").attr("y1",0).attr("y2",120).style("stroke","#000"),r=d3.scale.ordinal().domain(data).rangeBands([0,120]),n.selectAll("rect").data(data).enter().append("rect").attr("y",r).attr("width",t).attr("height",20),n.selectAll("text").data(data).enter().append("text").attr("x",t).attr("y",function(n){return r(n)+r.rangeBand()/2}).attr("dx",-3).attr("dy",".35em").attr("text-anchor","end").text(String)},window.addEventListener("DOMContentLoaded",hello_svg,!1)}.call(this),window.hello=function(){var n=d3.select("body").append("div").attr("class","svg");n.selectAll("div").data(data).enter().append("div").style("width",function(n){return 10*n+"px"}).text(function(n){return n})};
@@ -0,0 +1,23 @@
1
+ ---
2
+ 2013-09-02 16:49:35.663358000 +02:00:
3
+ anna:
4
+ MAIL01:
5
+ free: 3
6
+ server:
7
+ MAIL01:
8
+ free: 3
9
+ size: 8
10
+ MAIL02:
11
+ free: 4
12
+ size: 7
13
+ theo:
14
+ MAIL01:
15
+ free: 3
16
+ 2013-09-06 16:49:35.663358000 +02:00:
17
+ server:
18
+ MAIL01:
19
+ free: 2
20
+ size: 8
21
+ MAIL02:
22
+ free: 5
23
+ size: 8
data/test/flot_test.rb ADDED
@@ -0,0 +1,45 @@
1
+ require 'minitest/autorun'
2
+ require 'tatami/flot'
3
+ require 'yaml'
4
+ require 'awesome_print'
5
+
6
+ module Tatami
7
+ class Flot
8
+ def load_fixtures
9
+ YAML.load_file('test/fixtures/flot.yml').each do |time, typ_data|
10
+ typ_data.each do |typ,data|
11
+ record_node_prop typ, data, time
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ describe Flot do
18
+
19
+ let(:flot){ Flot.new 'flot', 'http://localhost:5984' }#,log: true
20
+ let(:typ12) {flot.couch.view('typ12')}
21
+ i_suck_and_my_tests_are_order_dependent!
22
+
23
+ it{
24
+ flot.couch.blank!.load_design
25
+ flot.load_fixtures
26
+ }
27
+
28
+ it 'count' do
29
+ count = flot.couch.view('count')
30
+ count.data.get(:rows,0,:value).must_equal 10
31
+ count.data(group: true)[:rows].count.must_equal 6
32
+ end
33
+
34
+ it "typ12" do
35
+ typ12.data( singlekey: [:server])[:rows].count.must_equal 8
36
+ typ12.data( singlekey: [:server,:MAIL01])[:rows].count.must_equal 4
37
+ typ12.data( singlekey: [:server,:MAIL01,:free])[:rows].count.must_equal 2
38
+ end
39
+
40
+ it 'list' do
41
+ typ12.data(list: 'iter', singlekey: ['server','MAIL01','free'],format: :string).must_match /^(,\[\d+,\d+\])+$/ # ,[12,14]
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,28 @@
1
+ require 'tatami'
2
+ require 'minitest/autorun'
3
+
4
+ module Tatami
5
+ describe "flot_views" do
6
+
7
+ let(:flot){ Couch.new 'flot','http://localhost:5984', env: 'test'}
8
+ #i_suck_and_my_tests_are_order_dependent!
9
+
10
+ it 'count' do
11
+ =begin
12
+ count = flot.view('count')
13
+ p count.test({a: {b: 3} })
14
+ =end
15
+ end
16
+
17
+ # it "typ12" do
18
+ # typ12.data( singlekey: [:server])[:rows].count.must_equal 8
19
+ # typ12.data( singlekey: [:server,:MAIL01])[:rows].count.must_equal 4
20
+ # typ12.data( singlekey: [:server,:MAIL01,:free])[:rows].count.must_equal 2
21
+ # end
22
+
23
+ # it 'list' do
24
+ # typ12.data(list: 'iter', singlekey: ['server','MAIL01','free'],format: :string).must_equal ",[1378486175000,2],[1378140575000,3]"
25
+ # end
26
+
27
+ end
28
+ end
data/test/view_test.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'tatami'
2
+ require 'awesome_print'
3
+ require 'minitest/autorun'
4
+ module Tatami
5
+ describe Couch do
6
+ let(:couch){ Couch.new 'cars' }
7
+
8
+ it '#test' do
9
+ couch.with_documents! a: 1
10
+ simple = couch.view('simple')
11
+ simple.key_values(reduce: false).must_equal [["a", 1], ["b", 1]]
12
+ simple.reduced.must_equal 2
13
+ end
14
+
15
+ it '#first_of_group' do
16
+ couch.with_documents!( {date: "wed",count:2},
17
+ {date: "wed",count:3},
18
+ {date: "fri",count:4})
19
+ first_of_group = couch.view('first_of_group')
20
+ first_of_group.key_values(reduce: false).must_equal \
21
+ [['fri',4], ['wed',2],['wed',3],]
22
+ first_of_group.reduce(group: true).must_equal \
23
+ "fri" => 4, "wed" => 3
24
+ end
25
+
26
+ it "perf" do
27
+ docs = [{}] * 2
28
+ couch.with_documents!( *docs )
29
+ perf = couch.view('perf')
30
+ perf.reduced.must_equal 2
31
+ end
32
+
33
+ describe "erlang views" do
34
+ it "serl" do
35
+ couch.with_documents! a: 42
36
+ serl = couch.view('erlang_desing/simple')
37
+ ap serl.data(reduce: false)
38
+ end
39
+ end
40
+
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tatami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Behrens
@@ -50,9 +50,24 @@ files:
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - Rakefile
53
+ - couches/cars/cars.coffee
54
+ - couches/cars/erlang_design.erl
55
+ - couches/flot/flot.coffee
53
56
  - lib/tatami.rb
57
+ - lib/tatami/app.rb
58
+ - lib/tatami/couch.rb
59
+ - lib/tatami/flot.rb
60
+ - lib/tatami/tatami.rb
54
61
  - lib/tatami/version.rb
55
62
  - tatami.gemspec
63
+ - test/couch_test.rb
64
+ - test/fixtures/d3/css/app.css
65
+ - test/fixtures/d3/index.html
66
+ - test/fixtures/d3/js/app.js
67
+ - test/fixtures/flot.yml
68
+ - test/flot_test.rb
69
+ - test/flot_views.rb
70
+ - test/view_test.rb
56
71
  homepage: ''
57
72
  licenses:
58
73
  - MIT
@@ -77,5 +92,13 @@ rubygems_version: 2.0.7
77
92
  signing_key:
78
93
  specification_version: 4
79
94
  summary: Create View, Test Views, Upload Sites
80
- test_files: []
95
+ test_files:
96
+ - test/couch_test.rb
97
+ - test/fixtures/d3/css/app.css
98
+ - test/fixtures/d3/index.html
99
+ - test/fixtures/d3/js/app.js
100
+ - test/fixtures/flot.yml
101
+ - test/flot_test.rb
102
+ - test/flot_views.rb
103
+ - test/view_test.rb
81
104
  has_rdoc: