function sha1(){function e(e){return v(u(p(e),e.length*b))}function t(e){return m(u(p(e),e.length*b))}function n(e){return d(u(p(e),e.length*b))}function r(e,t){return v(l(e,t))}function i(e,t){return m(l(e,t))}function s(e,t){return d(l(e,t))}function o(){return e("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d"}function u(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;var n=Array(80),r=1732584193,i=-271733879,s=-1732584194,o=271733878,u=-1009589776;for(var l=0;l16&&(n=u(n,e.length*b));var r=Array(16),i=Array(16);for(var s=0;s<16;s++)r[s]=n[s]^909522486,i[s]=n[s]^1549556828;var o=u(r.concat(p(t)),512+t.length*b);return u(i.concat(o),672)}function c(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function h(e,t){return e<>>32-t}function p(e){var t=Array(),n=(1<>5]|=(e.charCodeAt(r/b)&n)<<32-b-r%32;return t}function d(e){var t="",n=(1<>5]>>>32-b-r%32&n);return t}function v(e){var t=g?"0123456789ABCDEF":"0123456789abcdef",n="";for(var r=0;r>2]>>(3-r%4)*8+4&15)+t.charAt(e[r>>2]>>(3-r%4)*8&15);return n}function m(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="";for(var r=0;r>2]>>8*(3-r%4)&255)<<16|(e[r+1>>2]>>8*(3-(r+1)%4)&255)<<8|e[r+2>>2]>>8*(3-(r+2)%4)&255;for(var s=0;s<4;s++)r*8+s*6>e.length*32?n+=y:n+=t.charAt(i>>6*(3-s)&63)}return n}var g=0,y="=",b=8;return{b64_hmac_sha1:i}}(function(){function e(){return 0}function t(e){return e.target}function n(e){return e.source}function r(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function i(e){var t=-1,n=e.length,r=[];while(++t8?function(e){return e/n}:function(e){return e*n},symbol:e}}function T(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function N(e){return function(t){return 1-e(1-t)}}function C(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function k(e){return e*e}function L(e){return e*e*e}function A(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function O(e){return function(t){return Math.pow(t,e)}}function M(e){return 1-Math.cos(e*xs/2)}function _(e){return Math.pow(2,10*(e-1))}function D(e){return 1-Math.sqrt(1-e*e)}function P(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/(2*xs)*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*xs/t)}}function H(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function B(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function j(){d3.event.stopPropagation(),d3.event.preventDefault()}function F(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function I(e){var t=new b,n=0,r=arguments.length;while(++n360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,J(i(e+120),i(e),i(e-120))}function st(e,t,n){return new ot(e,t,n)}function ot(e,t,n){this.h=e,this.c=t,this.l=n}function ut(e,t,n){return at(n,Math.cos(e*=Cs)*t,Math.sin(e)*t)}function at(e,t,n){return new ft(e,t,n)}function ft(e,t,n){this.l=e,this.a=t,this.b=n}function lt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=ht(i)*Gs,r=ht(r)*Ys,s=ht(s)*Zs,J(dt(3.2404542*i-1.5371385*r-.4985314*s),dt(-0.969266*i+1.8760108*r+.041556*s),dt(.0556434*i-.2040259*r+1.0572252*s))}function ct(e,t,n){return st(Math.atan2(n,t)/xs*180,Math.sqrt(t*t+n*n),e)}function ht(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function pt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function dt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function vt(e){return Os(e,oo),e}function mt(e){return function(){return to(e,this)}}function gt(e){return function(){return no(e,this)}}function yt(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function bt(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function wt(e,t){function n(){var n=-1;while(++n0&&(e=e.substring(0,o)),t?i:r}function Lt(e,t){for(var n=0,r=e.length;nn?f():(i.active=n,h.start.call(e,l,t),s.tween.forEach(function(n,r){(r=r.call(e,l,t))&&v.push(r)}),a(r)||d3.timer(a,0,u),1)}function a(r){if(i.active!==n)return f();var s=(r-p)/d,o=c(s),u=v.length;while(u>0)v[--u].call(e,o);if(s>=1)return f(),h.end.call(e,l,t),1}function f(){return--i.count?delete i[n]:delete e.__transition__,1}var l=e.__data__,c=s.ease,h=s.event,p=s.delay,d=s.duration,v=[];return p<=r?o(r):d3.timer(o,p,u),1},0,u),s}}function _t(e){return e==null&&(e=""),function(){this.textContent=e}}function Dt(e,t,n,r){var i=e.id;return Lt(e,typeof n=="function"?function(e,s,o){e.__transition__[i].tween.set(t,r(n.call(e,e.__data__,s,o)))}:(n=r(n),function(e){e.__transition__[i].tween.set(t,n)}))}function Pt(){var e,t=Date.now(),n=mo;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Ht()-t;r>24?(isFinite(r)&&(clearTimeout(yo),yo=setTimeout(Pt,r)),go=0):(go=1,bo(Pt))}function Ht(){var e=null,t=mo,n=Infinity;while(t)t.flush?(delete vo[t.callback.id],t=e?e.next=t.next:mo=t.next):(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function Bt(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(wo<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();wo=!i.f&&!i.e,n.remove()}return wo?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function jt(){}function Ft(e){var t=e[0],n=e[e.length-1];return t2?Kt:Jt,a=r?V:X;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return Vt(e,t)},s.tickFormat=function(t){return $t(e,t)},s.nice=function(){return qt(e,Wt),i()},s.copy=function(){return Ut(e,t,n,r)},i()}function zt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function Wt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Xt(e,t){var n=Ft(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function Vt(e,t){return d3.range.apply(d3,Xt(e,t))}function $t(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Xt(e,t)[2])/Math.LN10+.01))+"f")}function Jt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Kt(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]0;f--)i.push(r(s)*f)}else{for(;sa;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=Eo);if(!arguments.length)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Yt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return Qt(e.copy(),t)},zt(n,e)}function Gt(e){return Math.log(e<0?0:e)/Math.LN10}function Yt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Zt(e,t){function n(t){return e(r(t))}var r=en(t),i=en(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return Vt(n.domain(),e)},n.tickFormat=function(e){return $t(n.domain(),e)},n.nice=function(){return n.domain(qt(n.domain(),Wt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=en(t=e),i=en(1/t),n.domain(s)},n.copy=function(){return Zt(e.copy(),t)},zt(n,e)}function en(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function tn(e,t){function n(t){return s[((i.get(t)||i.set(t,e.push(t)))-1)%s.length]}function r(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var i,s,u;return n.domain=function(r){if(!arguments.length)return e;e=[],i=new o;var s=-1,u=r.length,a;while(++s1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function _n(e){return e.length<3?dn(e):e[0]+En(e,Mn(e))}function Dn(e){var t,n=-1,r=e.length,i,s;while(++n1){var r=Ft(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++ar&&(n=t,r=i);return n}function ur(e){return e.reduce(ar,0)}function ar(e,t){return e+t[1]}function fr(e,t){return lr(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function lr(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function cr(e){return[d3.min(e),d3.max(e)]}function hr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=mr,e.nodes=function(t){return Uo=!0,(e.nodes=e)(t)},e}function pr(e){return e.children}function dr(e){return e.value}function vr(e,t){return t.value-e.value}function mr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function gr(e,t){return e.value-t.value}function yr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function br(e,t){e._pack_next=t,t._pack_prev=e}function wr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function Er(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(Sr),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Nr(u,a,f),t(f),yr(u,f),u._pack_prev=f,yr(f,a),a=u._pack_next;for(l=3;l0&&(e=r)}return e}function Pr(e,t){return e.x-t.x}function Hr(e,t){return t.x-e.x}function Br(e,t){return e.depth-t.depth}function jr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Ir(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function qr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Rr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ur(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function zr(e,t){function n(e,n){return d3.xhr(e,t,n).response(r)}function r(e){return n.parse(e.responseText)}function i(t){return t.map(s).join(e)}function s(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e){if(t)return t(e);t=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")})},n.parseRows=function(e,t){function n(){if(a>=o)return i;if(c)return c=!1,r;var t=a;if(e.charCodeAt(t)===34){var n=t;while(n++r&&(r=o),ui&&(i=u)},polygon:function(e){this.line(e[0])}});return function(e){return i=r=-(t=n=Infinity),s.object(e),[[t,n],[r,i]]}}function $r(e,t){function n(e){return Math.cos(e[1])*Math.cos(e[0])>o}function r(e,r,s){if(!(c=e.length))return;var o=t(e[0]),u,a=n(o),f=s!=null,l=f&&a,c,h,p;a&&r.moveTo((h=o)[0],o[1]);for(var d=1;dTs||Math.abs(p[1]-u[1])>Ts)h&&(f=!1),r.moveTo((h=u)[0],u[1]);f&&(s+=ui(u,v)),o=u}else p=u=i(o,v),r.lineTo(u[0],u[1]),f&&(Math.abs(h[0]-u[0])>Ts||Math.abs(h[1]-u[1])>Ts?f=!1:s+=ui(o,h)),o=u;f&&(s+=ui(o,v)),m&&r.lineTo(v[0],v[1]),o=v}return l&&m&&r.closePath(),f&&(!h||Math.abs(h[0]-o[0])0?a>i:a0:f<0){var c=!1;ai(r,{lineTo:function(e,n){(c?t.lineTo:(c=!0,t.moveTo))(e,n)}}),t.closePath()}u.forEach(function(e){var t=e[0],n=e[e.length-1],r={point:t,points:e,other:null,visited:!1,entry:!0,subject:!0},u={point:t,angle:i(t),points:[t],other:r,visited:!1,entry:!1,subject:!1};r.other=u,s.push(r),o.push(u),r={point:n,points:[n],other:null,visited:!1,entry:!1,subject:!0},u={point:n,angle:i(n),points:[n],other:r,visited:!1,entry:!0,subject:!1},r.other=u,s.push(r),o.push(u)}),o.sort(Gr),Qr(s),Qr(o);if(!s.length)return;var h=s[0],p,d,v;for(;;){p=h;while(p.visited)if((p=p.next)===h)return;d=p.points,t.moveTo((v=d.shift())[0],v[1]);do{p.visited=p.other.visited=!0;if(p.entry){if(p.subject)for(var m=0;m=0;)t.lineTo((v=d[m])[0],v[1])}else r(p,p.prev,-1,t);p=p.prev}p=p.other,d=p.points}while(!p.visited);t.closePath()}}function Qr(e){for(var t=0,n=e[0],r,i=e.length;t0&&(e[0]-t[0])*e[1]+e[0]*(t[1]-e[1])>0)return 1}else if(t[1]<=0&&(e[0]-t[0])*e[1]+e[0]*(t[1]-e[1])<0)return-1;return 0}function ai(e,t){for(var n=0;n<4;n++)e({angle:-n*xs/2},{angle:-(n+1)*xs/2},1,t)}function fi(e,t){function n(n,r){var i=e(n,r);return t(i[0],i[1])}return e===li?t:t===li?e:(e.invert&&t.invert&&(n.invert=function(n,r){var i=t.invert(n,r);return e.invert(i[0],i[1])}),n)}function li(e,t){return[e,t]}function ci(e,t,n){var r=d3.range(e,t-Ts,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function hi(e,t,n){var r=d3.range(e,t-Ts,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function pi(){function e(e){var t=Math.sin(e*=p)*d,n=Math.sin(p-e)*d,r=n*s+t*c,u=n*o+t*h,a=n*i+t*l;return[Math.atan2(u,r)/Cs,Math.atan2(a,Math.sqrt(r*r+u*u))/Cs]}var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return e.distance=function(){return p==null&&(d=1/Math.sin(p=Math.acos(Math.max(-1,Math.min(1,i*l+r*f*Math.cos(u-t)))))),p},e.source=function(u){var a=Math.cos(t=u[0]*Cs),f=Math.sin(t);return r=Math.cos(n=u[1]*Cs),i=Math.sin(n),s=r*a,o=r*f,p=null,e},e.target=function(t){var n=Math.cos(u=t[0]*Cs),r=Math.sin(u);return f=Math.cos(a=t[1]*Cs),l=Math.sin(a),c=f*n,h=f*r,p=null,e},e}function di(e,t){return[e/(2*xs),Math.max(-0.5,Math.min(.5,Math.log(Math.tan(xs/4+t/2))/(2*xs)))]}function vi(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function mi(e){return function(t){var n=[0,0],r=e(n,t.coordinates,0);return r?(n[0]/=r,n[1]/=r,n):null}}function gi(e){return function(t){for(var n=[0,0],r=0,i=t.coordinates,s=0,o=i.length;s4*T&&h--){var m=r*l+i*c*Math.cos(a-n),g=1/(Math.SQRT2*Math.sqrt(1+m)),y=g*(i*Math.cos(n)+c*Math.cos(a)),b=g*(i*Math.sin(n)+c*Math.sin(a)),w=Math.max(-1,Math.min(1,g*(r+l))),E=Math.asin(w),S=Math.abs(Math.abs(w)-1),x=ST){var _=Math.cos(E);o(e,t,n,r,i,C,L,x,w,_,h),k.lineTo(C,L),o(C,L,x,w,_,s,u,a,l,c,h)}}}function u(){var e=f(L,A);o(D,P,O,M,_,e[0],e[1],L,Math.sin(A),Math.cos(A),H),k.closePath()}function a(e){return h(e[0]*Cs,e[1]*Cs)}function f(e,t){var n=c(e,t);return[n[0]*d+S,x-n[1]*d]}function l(){p=fi(h=Ni(b,w,E),c);var e=c(g,y);return S=v-e[0]*d,x=m+e[1]*d,t}var c,h,p,d=150,v=480,m=250,g=0,y=0,b=0,w=0,E=0,S=v,x=m,T=.5,N=Si(a),C=null,k;t.point=function(e,t){k=t,N.point(e,B),k=null},t.line=function(e,t){k=t,N.line(e,B),k=null},t.polygon=function(e,t){k=t,N.polygon(e,B),k=null},t.clipAngle=function(e){return arguments.length?(N=e==null?(C=e,Si(a)):$r(C=+e,a),t):C};var L,A,O,M,_,D,P,H=16,B={point:r,moveTo:i,lineTo:s,closePath:u};return t.scale=function(e){return arguments.length?(d=+e,l()):d},t.translate=function(e){return arguments.length?(v=+e[0],m=+e[1],l()):[v,m]},t.center=function(e){return arguments.length?(g=e[0]%360*Cs,y=e[1]%360*Cs,l()):[g*ks,y*ks]},t.rotate=function(e){return arguments.length?(b=e[0]%360*Cs,w=e[1]%360*Cs,E=e.length>2?e[2]%360*Cs:0,l()):[b*ks,w*ks,E*ks]},t.precision=function(e){return arguments.length?(H=(T=e*e)>0&&16,t):Math.sqrt(T)},function(){return c=e.apply(this,arguments),t.invert=c.invert&&n,l()}}function Ei(e,t,n,r){var i,s,o=Math.sin(e-n);return Math.abs(o)>Ts?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function Si(e){var t={point:function(t,n){var r=e(t);n.point(r[0],r[1])},line:function(t,n,r){if(!(d=t.length))return;var i=e(t[0]),s=!0,o=i[0],u=i[1],a,f,l=o>0?xs:-xs,c,h,p=0,d;n.moveTo(o,u);while(++p0?xs:-xs,h=Math.abs(a-o),Math.abs(h-xs)0?xs/2:-xs/2),n.lineTo(l,u),n.moveTo(c,u),n.lineTo(a,u),n.lineTo(o=a,u=f),s=!1):l!==c&&h>=xs?(u=Ei(o,u,a,f),Math.abs(o-l)>Ts&&n.lineTo(l,u),Math.abs(a-c)>Ts?(n.moveTo(c,u),n.lineTo(o=a,u=f)):n.moveTo(o=a,u=f),s=!1):n.lineTo(o=a,u=f),l=c;return r!=null&&n.closePath(),s&&r},polygon:function(e,n){Kr(e,n,t.line,Ti,xi)}};return t}function xi(e){return-(e[0]<0?e[1]-xs/2:xs/2-e[1])}function Ti(e,t,n,r){e=e.point,t=t.point;if(Math.abs(e[0]-t[0])>Ts){var i=(e[0]xs?e-2*xs:e<-xs?e+2*xs:e,t]}function ki(e){return function(t,n){return[(t+=e)>xs?t-2*xs:t<-xs?t+2*xs:t,n]}}function Li(e){var t=ki(e);return t.invert=ki(-e),t}function Ai(e,t){function n(e,t){var n=Math.cos(t),u=Math.cos(e)*n,a=Math.sin(e)*n,f=Math.sin(t),l=f*r+u*i;return[Math.atan2(a*s-l*o,u*r-f*i),Math.asin(Math.max(-1,Math.min(1,l*s+a*o)))]}var r=Math.cos(e),i=Math.sin(e),s=Math.cos(t),o=Math.sin(t);return n.invert=function(e,t){var n=Math.cos(t),u=Math.cos(e)*n,a=Math.sin(e)*n,f=Math.sin(t),l=f*s-a*o;return[Math.atan2(a*s+f*o,u*r+l*i),Math.asin(Math.max(-1,Math.min(1,l*r-u*i)))]},n}function Oi(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),s=e(r*i);return[s*i*Math.sin(t),s*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),s=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*s,r*o),Math.asin(r&&n*s/r)]},n}function Mi(e,t,n,r){var i,s,o,u,a,f,l;return i=r[e],s=i[0],o=i[1],i=r[t],u=i[0],a=i[1],i=r[n],f=i[0],l=i[1],(l-o)*(u-s)-(a-o)*(f-s)>0}function _i(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function Di(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Go[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Go[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,Go[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function Hi(){return{leaf:!0,nodes:[],point:null}}function Bi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&Bi(e,a[0],n,r,o,u),a[1]&&Bi(e,a[1],o,r,i,u),a[2]&&Bi(e,a[2],n,u,o,s),a[3]&&Bi(e,a[3],o,u,i,s)}}function ji(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Fi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o=a)return-1;i=t.charCodeAt(o++);if(i===37){s=mu[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function Ii(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function qi(e){var t=new o,n=-1,r=e.length;while(++n68?1900:2e3)}function Yi(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Zi(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function es(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ts(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ns(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function rs(e,t,n){gu.lastIndex=0;var r=gu.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function is(e,t,n){var r=yu.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function ss(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+Ri(r,"0",2)+Ri(i,"0",2)}function os(e){return e.toISOString()}function us(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1)while(ot?1:e>=t?0:NaN},d3.descending=function(e,t){return te?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s1&&(e=e.map(t)),e=e.filter(c),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns&&(i=s)}else{while(++ns&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni&&(i=s)}else{while(++ni&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns&&(i=s),os&&(i=s),o1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n>>1;e.call(t,t[s],s)>>1;n=r.length)return u?u.call(n,t):s?t.sort(s):t;var a=-1,f=t.length,l=r[i++],c,h,p=new o,d,v={};while(++a=r.length)return e;var s=[],o=i[n++],u;for(u in e)s.push({key:u,values:t(e[u],n)});return o&&s.sort(function(e,t){return o(e.key,t.key)}),s}var n={},r=[],i=[],s,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return r.push(e),n},n.sortKeys=function(e){return i[r.length-1]=e,n},n.sortValues=function(e){return s=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++rt)r.push(o/i);else while((o=e+n*++s)=200&&e<300||e===304?i.load.call(r,o.call(r,a)):i.error.call(r,a)}},a.onprogress=function(e){var t=d3.event;d3.event=e;try{i.progress.call(r,a)}finally{d3.event=t}},r.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(t==null?delete s[e]:s[e]=t+"",r)},r.mimeType=function(e){return arguments.length?(t=e==null?null:e+"",r):t},r.response=function(e){return o=e,r},["get","post"].forEach(function(e){r[e]=function(){return r.send.apply(r,[e].concat(Ls(arguments)))}}),r.send=function(n,i,o){arguments.length===2&&typeof i=="function"&&(o=i,i=null),a.open(n,e,!0),t!=null&&!("accept"in s)&&(s.accept=t+",*/*");for(var u in s)a.setRequestHeader(u,s[u]);return t!=null&&a.overrideMimeType&&a.overrideMimeType(t),o!=null&&r.on("error",o).on("load",function(e){o(null,e)}),a.send(i==null?null:i),r},r.abort=function(){return a.abort(),r},d3.rebind(r,i,"on"),arguments.length===2&&typeof t=="function"&&(n=t,t=null),n==null?r:r.get(n)},d3.text=function(){return d3.xhr.apply(d3,arguments).response(v)},d3.json=function(e,t){return d3.xhr(e,"application/json",t).response(m)},d3.html=function(e,t){return d3.xhr(e,"text/html",t).response(g)},d3.xml=function(){return d3.xhr.apply(d3,arguments).response(y)};var Hs={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/"};d3.ns={prefix:Hs,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),Hs.hasOwnProperty(n)?{space:Hs[n],local:e}:e}},d3.dispatch=function(){var e=new b,t=-1,n=arguments.length;while(++t0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=Bs.exec(e),n=t[1]||" ",r=t[2]||">",i=t[3]||"",s=t[4]||"",o=t[5],u=+t[6],a=t[7],f=t[8],l=t[9],c=1,h="",p=!1;f&&(f=+f.substring(1));if(o||n==="0"&&r==="=")o=n="0",r="=",a&&(u-=Math.floor((u-1)/4));switch(l){case"n":a=!0,l="g";break;case"%":c=100,h="%",l="f";break;case"p":c=100,h="%",l="r";break;case"b":case"o":case"x":case"X":s&&(s="0"+l.toLowerCase());case"c":case"d":p=!0,f=0;break;case"s":c=-1,l="r"}s==="#"&&(s=""),l=="r"&&!f&&(l="g"),l=js.get(l)||S;var d=o&&a;return function(e){if(p&&e%1)return"";var t=e<0||e===0&&1/e<0?(e=-e,"-"):i;if(c<0){var v=d3.formatPrefix(e,f);e=v.scale(e),h=v.symbol}else e*=c;e=l(e,f),!o&&a&&(e=Fs(e));var m=s.length+e.length+(d?0:t.length),g=m"?g+t+e:r==="^"?g.substring(0,m>>=1)+t+e+g.substring(m):t+(d?e:g+e))+h}};var Bs=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,js=d3.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=E(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),Fs=u;if(bs){var Is=bs.length;Fs=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=bs[0];while(t>0&&s>0)r.push(e.substring(t-=s,t+s)),s=bs[i=(i+1)%Is];return r.reverse().join(ys||"")+n}}var qs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(x);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,E(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),qs[8+n/3]};var Rs=function(){return u},Us=d3.map({linear:Rs,poly:O,quad:function(){return k},cubic:function(){return L},sin:function(){return M},exp:function(){return _},circle:function(){return D},elastic:P,back:H,bounce:function(){return B}}),zs=d3.map({"in":u,out:N,"in-out":C,"out-in":function(e){return C(N(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=Us.get(n)||Rs,r=zs.get(r)||u,T(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new q(n?n.matrix:Ws)})(e)},q.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Ws={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;Xs.lastIndex=0;for(r=0;n=Xs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=Xs.lastIndex;s180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t180?s-=360:s<-180&&(s+=360),function(e){return it(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return lt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return ut(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},oo.sort=function(e){e=Ct.apply(this,arguments);for(var t=-1,n=this.length;++t=ko?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=un,n=an,r=fn,i=ln;return e.innerRadius=function(n){return arguments.length?(t=f(n),e):t},e.outerRadius=function(t){return arguments.length?(n=f(t),e):n},e.startAngle=function(t){return arguments.length?(r=f(t),e):r},e.endAngle=function(t){return arguments.length?(i=f(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Co;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Co=-xs/2,ko=2*xs-1e-6;d3.svg.line=function(){return cn(u)};var Lo=d3.map({linear:dn,"linear-closed":vn,"step-before":mn,"step-after":gn,basis:xn,"basis-open":Tn,"basis-closed":Nn,bundle:Cn,cardinal:wn,"cardinal-open":yn,"cardinal-closed":bn,monotone:_n});Lo.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Ao=[0,2/3,1/3,0],Oo=[0,1/3,2/3,0],Mo=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=cn(Dn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},mn.reverse=gn,gn.reverse=mn,d3.svg.area=function(){return Pn(u)},d3.svg.area.radial=function(){var e=Pn(Dn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,t){var n=r(this,u,e,t),f=r(this,a,e,t);return"M"+n.p0+s(n.r,n.p1,n.a1-n.a0)+(i(n,f)?o(n.r,n.p1,n.r,n.p0):o(n.r,n.p1,f.r,f.p0)+s(f.r,f.p1,f.a1-f.a0)+o(f.r,f.p1,n.r,n.p0))+"Z"}function r(e,t,n,r){var i=t.call(e,n,r),s=l.call(e,i,r),o=c.call(e,i,r)+Co,u=h.call(e,i,r)+Co;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function i(e,t){return e.a0==t.a0&&e.a1==t.a1}function s(e,t,n){return"A"+e+","+e+" 0 "+ +(n>xs)+",1 "+t}function o(e,t,n,r){return"Q 0,0 "+r}var u=n,a=t,l=Hn,c=fn,h=ln;return e.radius=function(t){return arguments.length?(l=f(t),e):l},e.source=function(t){return arguments.length?(u=f(t),e):u},e.target=function(t){return arguments.length?(a=f(t),e):a},e.startAngle=function(t){return arguments.length?(c=f(t),e):c},e.endAngle=function(t){return arguments.length?(h=f(t),e):h},e},d3.svg.diagonal=function(){function e(e,t){var n=r.call(this,e,t),o=i.call(this,e,t),u=(n.y+o.y)/2,a=[n,{x:n.x,y:u},{x:o.x,y:u},o];return a=a.map(s),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var r=n,i=t,s=Bn;return e.source=function(t){return arguments.length?(r=f(t),e):r},e.target=function(t){return arguments.length?(i=f(t),e):i},e.projection=function(t){return arguments.length?(s=t,e):s},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Bn,n=e.projection;return e.projection=function(e){return arguments.length?n(jn(t=e)):t},e},d3.svg.symbol=function(){function e(e,r){return(_o.get(t.call(this,e,r))||qn)(n.call(this,e,r))}var t=In,n=Fn;return e.type=function(n){return arguments.length?(t=f(n),e):t},e.size=function(t){return arguments.length?(n=f(t),e):n},e};var _o=d3.map({circle:qn,cross:function(e){var t=Math.sqrt(e/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(e){var t=Math.sqrt(e/(2*Po)),n=t*Po;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Do),n=t*Do/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Do),n=t*Do/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=_o.keys();var Do=Math.sqrt(3),Po=Math.tan(30*Cs);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=zn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=It(t),T=e.selectAll(".domain").data([0]),N=d3.transition(T),C=t.copy(),k=this.__chart__||C;this.__chart__=C,T.enter().append("path").attr("class","domain"),b.append("line").attr("class","tick"),b.append("text");var L=b.select("line"),A=E.select("line"),O=y.select("text").text(h),M=b.select("text"),_=E.select("text");switch(n){case"bottom":S=Rn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),L.attr("y2",r),M.attr("y",Math.max(r,0)+o),A.attr("x2",0).attr("y2",r),_.attr("x",0).attr("y",Math.max(r,0)+o),O.attr("dy",".71em").style("text-anchor","middle"),N.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Rn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),L.attr("y2",-r),M.attr("y",-(Math.max(r,0)+o)),A.attr("x2",0).attr("y2",-r),_.attr("x",0).attr("y",-(Math.max(r,0)+o)),O.attr("dy","0em").style("text-anchor","middle"),N.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=Un,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),L.attr("x2",-r),M.attr("x",-(Math.max(r,0)+o)),A.attr("x2",-r).attr("y2",0),_.attr("x",-(Math.max(r,0)+o)).attr("y",0),O.attr("dy",".32em").style("text-anchor","end"),N.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=Un,v.attr("x2",i),g.attr("x2",i).attr("y2",0),L.attr("x2",r),M.attr("x",Math.max(r,0)+o),A.attr("x2",r).attr("y2",0),_.attr("x",Math.max(r,0)+o).attr("y",0),O.attr("dy",".32em").style("text-anchor","start"),N.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,k),E.call(S,C),w.call(S,C),v.call(S,k),g.call(S,C),m.call(S,C);else{var D=C.rangeBand()/2,P=function(e){return C(e)+D};b.call(S,P),E.call(S,P)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n){if(!arguments.length)return r;var o=arguments.length-1;return r=+t,i=o>1?+n:r,s=o>0?+arguments[o]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Ho[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=It(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=It(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),j())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,j())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]0?o=e:o=0:e>0&&(r.start({type:"start",alpha:o=e}),d3.timer(n.tick)),n):o},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++si&&(i=u),r.push(u)}for(o=0;o0){s=-1;while(++s=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=cr,i=fr;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=f(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return lr(e,t)}:f(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=Uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l0){var l=n*f/2;jr(o,function(e){e.r+=l}),jr(o,Er),jr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Tr(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(gr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},hr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;jr(o,function(e){var t=e.children;t&&t.length?(e.x=kr(t),e.y=Cr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var f=Lr(o),l=Ar(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;return jr(o,function(e){e.x=(e.x-c)/(h-c)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=Or,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},hr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h0&&(Ir(qr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!_r(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Mr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];jr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Dr(f,Hr),c=Dr(f,Pr),h=Dr(f,Br),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return jr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=Or,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},hr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n0)u.push(f=a[v-1]),u.area+=f.area,p!=="squarify"||(h=r(u,d))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,d,o,!1),d=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,d,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*d/n,n/(t*s*d)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++in.dx)f=n.dx;while(++i50?r:t<-140?i:o<21?s:n}var n=d3.geo.albers(),r=d3.geo.albers().rotate([160,0]).center([0,60]).parallels([55,65]),i=d3.geo.albers().rotate([160,0]).center([0,20]).parallels([8,18]),s=d3.geo.albers().rotate([60,0]).center([0,10]).parallels([8,18]);return e.point=function(e,n){return t(e).point(e,n)},e.line=function(e,n){return t(e[0]).line(e,n)},e.polygon=function(e,n){return t(e[0][0]).polygon(e,n)},e.scale=function(t){return arguments.length?(n.scale(t),r.scale(t*.6),i.scale(t),s.scale(t*1.5),e.translate(n.translate())):n.scale()},e.translate=function(t){if(!arguments.length)return n.translate();var o=n.scale(),u=t[0],a=t[1];return n.translate(t),r.translate([u-.4*o,a+.17*o]),i.translate([u-.19*o,a+.2*o]),s.translate([u+.58*o,a+.43*o]),e},e.scale(n.scale())},(d3.geo.albers=function(){var e=29.5*Cs,t=45.5*Cs,n=wi(Xr),r=n(e,t);return r.parallels=function(r){return arguments.length?n(e=r[0]*Cs,t=r[1]*Cs):[e*ks,t*ks]},r.rotate([98,0]).center([0,38]).scale(1e3)}).raw=Xr;var Vo=Oi(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(d3.geo.azimuthalEqualArea=function(){return bi(Vo)}).raw=Vo;var $o=Oi(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},u);(d3.geo.azimuthalEquidistant=function(){return bi($o)}).raw=$o,d3.geo.bounds=Vr(u),d3.geo.circle=function(){function e(){var e=typeof t=="function"?t.apply(this,arguments):t;i=Ni(-e[0]*Cs,-e[1]*Cs,0);var n=[];return ai(s,{lineTo:function(e,t){var r=i.invert(e,t);r[0]*=ks,r[1]*=ks,n.push(r)}}),{type:"Polygon",coordinates:[n]}}var t=[0,0],n,r=6,i,s;return e.origin=function(n){return arguments.length?(t=n,e):t},e.angle=function(t){return arguments.length?(s=Jr((n=+t)*Cs,r*Cs),e):n},e.precision=function(t){return arguments.length?(s=Jr(radians,(r=+t)*Cs),e):r},e.angle(90)},(d3.geo.equirectangular=function(){return bi(li).scale(250/xs)}).raw=li.invert=li;var Jo=Oi(function(e){return 1/e},Math.atan);(d3.geo.gnomonic=function(){return bi(Jo)}).raw=Jo,d3.geo.graticule=function(){function e(){return{type:"GeometryCollection",geometries:e.lines()}}var t,n,r,i,s=22.5,o=s,u,a,f=2.5;return e.lines=function(){return d3.range(Math.ceil(n/s)*s,t,s).map(u).concat(d3.range(Math.ceil(i/o)*o,r,o).map(a)).map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[u(n).concat(a(r).slice(1),u(t).reverse().slice(1),a(i).reverse().slice(1))]}},e.extent=function(s){return arguments.length?(n=+s[0][0],t=+s[1][0],i=+s[0][1],r=+s[1][1],n>t&&(s=n,n=t,t=s),i>r&&(s=i,i=r,r=s),e.precision(f)):[[n,i],[t,r]]},e.step=function(t){return arguments.length?(s=+t[0],o=+t[1],e):[s,o]},e.precision=function(s){return arguments.length?(f=+s,u=ci(i,r,f),a=hi(n,t,f),e):f},e.extent([[-180+Ts,-90+Ts],[180-Ts,90-Ts]])},d3.geo.greatArc=function(){function e(){var t=e.distance.apply(this,arguments),n=0,r=u/t,s=[i];while((n+=r)<1)s.push(a(n));return s.push(o),{type:"LineString",coordinates:s}}var r=n,i,s=t,o,u=6*Cs,a=pi();return e.distance=function(){return typeof r=="function"&&a.source(i=r.apply(this,arguments)),typeof s=="function"&&a.target(o=s.apply(this,arguments)),a.distance()},e.source=function(t){return arguments.length?(r=t,typeof r!="function"&&a.source(i=r),e):r},e.target=function(t){return arguments.length?(s=t,typeof s!="function"&&a.target(o=s),e):s},e.precision=function(t){return arguments.length?(u=t*Cs,e):u/Cs},e},di.invert=function(e,t){return[2*xs*e,2*Math.atan(Math.exp(2*xs*t))-xs/2]},(d3.geo.mercator=function(){return bi(di).scale(500)}).raw=di;var Ko=Oi(function(){return 1},Math.asin);(d3.geo.orthographic=function(){return bi(Ko)}).raw=Ko,d3.geo.path=function(){function t(e){var t=null;return e!=t&&(typeof u=="function"&&(a=vi(u.apply(this,arguments))),d.object(e),c.length&&(t=c.join(""),c=[])),t}function n(e){return Math.abs(d3.geom.polygon(e.map(f)).area())}function r(e){return n(e[0])-d3.sum(e.slice(1),n)}function i(e,t){return t=f(t),e[0]+=t[0],e[1]+=t[1],1}function s(e,t){if(!(n=t.length))return 0;var n,r=f(t[0]),i=r[0],s=r[1],o,u,a,l,c=0,h,p=0;while(++c0?-6:6)}var u=4.5,a=vi(u),f=d3.geo.albersUsa(),l,c=[],h={point:function(e,t){c.push("M",e,",",t,a)},moveTo:function(e,t){c.push("M",e,",",t)},lineTo:function(e,t){c.push("L",e,",",t)},closePath:function(){c.push("Z")}},p=h,d=Wr({line:function(e){f.line(e,p)},polygon:function(e){f.polygon(e,p)},point:function(e){f.point(e,p)}}),v=Wr({Feature:function(e){return v.geometry(e.geometry)},FeatureCollection:function(e){return d3.sum(e.features,v.Feature)},GeometryCollection:function(e){return d3.sum(e.geometries,v.geometry)},LineString:e,MultiLineString:e,MultiPoint:e,MultiPolygon:function(e){return d3.sum(e.coordinates,r)},Point:e,Polygon:function(e){return r(e.coordinates)}});t.area=function(e){return v.object(e)};var m=Wr({Feature:function(e){return m.geometry(e.geometry)},LineString:mi(s),MultiLineString:gi(s),MultiPoint:gi(i),MultiPolygon:yi(o),Point:mi(i),Polygon:gi(o)});return t.bounds=function(e){return(l||(l=Vr(f)))(e)},t.centroid=function(e){return m.object(e)},t.projection=function(e){return arguments.length?(f=e,l=null,t):f},t.context=function(e){return arguments.length?(p=e,p==null&&(p=h),t):p===h?null:p},t.pointRadius=function(e){return arguments.length?(typeof e=="function"?u=e:a=vi(u=+e),t):u},t},d3.geo.projection=bi,d3.geo.projectionMutator=wi,Ci.invert=function(e,t){return[e,t]};var Qo=Oi(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(d3.geo.stereographic=function(){return bi(Qo)}).raw=Qo,d3.geom={},d3.geom.hull=function(e){if(e.length<3)return[];var t=e.length,n=t-1,r=[],i=[],s,o,u=0,a,f,l,c,h,p,d,v;for(s=1;s=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o=0?(r=e.ep.r,i=e.ep.l):(r=e.ep.l,i=e.ep.r),e.a===1?(u=r?r.y:-n,s=e.c-e.b*u,a=i?i.y:n,o=e.c-e.b*a):(s=r?r.x:-n,u=e.c-e.a*s,o=i?i.x:n,a=e.c-e.a*o);var f=[s,u],l=[o,a];t[e.region.l.index].push(f,l),t[e.region.r.index].push(f,l)}),t=t.map(function(t,n){var r=e[n][0],i=e[n][1],s=t.map(function(e){return Math.atan2(e[0]-r,e[1]-i)});return d3.range(t.length).sort(function(e,t){return s[e]-s[t]}).filter(function(e,t,n){return!t||s[e]-s[n[t-1]]>Ts}).map(function(e){return t[e]})}),t.forEach(function(t,r){var i=t.length;if(!i)return t.push([-n,-n],[-n,n],[n,n],[n,-n]);if(i>2)return;var s=e[r],o=t[0],u=t[1],a=s[0],f=s[1],l=o[0],c=o[1],h=u[0],p=u[1],d=Math.abs(h-l),v=p-c;if(Math.abs(v)0&&(m*=-1),t.push([-n,m],[n,m]))}}),t};var Go={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return Pi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=Hi()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;if(arguments.length<5)if(arguments.length===3)i=n,r=t,n=t=0;else{t=n=Infinity,r=i=-Infinity;while(++ar&&(r=u.x),u.y>i&&(i=u.y)}var l=r-t,c=i-n;l>c?i=n+l:r=t+c;var h=Hi();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){Bi(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var Yo=Date,Zo=["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(){eu.setUTCDate.apply(this._,arguments)},setDay:function(){eu.setUTCDay.apply(this._,arguments)},setFullYear:function(){eu.setUTCFullYear.apply(this._,arguments)},setHours:function(){eu.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){eu.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){eu.setUTCMinutes.apply(this._,arguments)},setMonth:function(){eu.setUTCMonth.apply(this._,arguments)},setSeconds:function(){eu.setUTCSeconds.apply(this._,arguments)},setTime:function(){eu.setTime.apply(this._,arguments)}};var eu=Date.prototype,tu="%a %b %e %X %Y",nu="%m/%d/%Y",ru="%H:%M:%S",iu=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],su=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ou=["January","February","March","April","May","June","July","August","September","October","November","December"],uu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u,a;while(++i=12?"PM":"AM"},S:function(e,t){return Ri(e.getSeconds(),t,2)},U:function(e,t){return Ri(d3.time.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Ri(d3.time.mondayOfYear(e),t,2)},x:d3.time.format(nu),X:d3.time.format(ru),y:function(e,t){return Ri(e.getFullYear()%100,t,2)},Y:function(e,t){return Ri(e.getFullYear()%1e4,t,4)},Z:ss,"%":function(){return"%"}},mu={a:Ui,A:zi,b:Wi,B:Xi,c:Vi,d:Zi,e:Zi,H:es,I:es,L:rs,m:Yi,M:ts,p:is,S:ns,x:$i,X:Ji,y:Qi,Y:Ki},gu=/^\s*\d+/,yu=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{Yo=ji;var t=new Yo;return t._=e,n(t)}finally{Yo=Date}}var n=d3.time.format(e);return t.parse=function(e){try{Yo=ji;var t=n.parse(e);return t&&t._}finally{Yo=Date}},t.toString=n.toString,t};var bu=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?os:bu,os.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},os.toString=bu.toString,d3.time.second=us(function(e){return new Yo(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=us(function(e){return new Yo(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=us(function(e){var t=e.getTimezoneOffset()/60;return new Yo((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=us(function(e){var t=new Yo(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},Zo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=us(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=us(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=us(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var wu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Eu=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Su=[[d3.time.format("%Y"),a],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],xu=d3.scale.linear(),Tu=hs(Su);Eu.year=function(e,t){return xu.domain(e.map(ds)).ticks(t).map(ps)},d3.time.scale=function(){return fs(d3.scale.linear(),Eu,Tu)};var Nu=Eu.map(function(e){return[e[0].utc,e[1]]}),Cu=[[d3.time.format.utc("%Y"),a],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],ku=hs(Cu);Nu.year=function(e,t){return xu.domain(e.map(ms)).ticks(t).map(vs)},d3.time.scale.utc=function(){return fs(d3.scale.linear(),Nu,ku)}})(),function(e,t){function n(e){if(e&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||tn);if(i){var s={},o=t-1;while(++o-1}return ft(e,n,t)>-1}}function i(e){return e.charCodeAt(0)}function s(e,n){var r=e.index,i=n.index;e=e.criteria,n=n.criteria;if(e!==n){if(e>n||e===t)return 1;if(e-1:tt(e,function(e){return++r>=n&&e===t})}function q(e,t,n){var r={};return t=u(t,n),br(e,function(e,n,i){n=t(e,n,i),xn.call(r,n)?r[n]++:r[n]=1}),r}function R(e,t,n){var r=!0;t=u(t,n);if(mr(e)){var i=-1,s=e.length;while(++ir&&(r=s,a=e)});else while(++sa&&(a=e[s]);return a}function J(e,t,n){var r=Infinity,s=-1,o=e?e.length:0,a=r;if(t||!mr(e))t=!t&&_(e)?i:u(t,n),br(e,function(e,n,i){var s=t(e,n,i);s>>1;n(e[o])74;if(f)var l={};n&&(a=[],n=u(n,r));while(++i2?Ln.call.apply(Ln,arguments):o(e,t,Cn.call(arguments,2))}function Tt(e){var t=arguments,n=t.length>1?0:(t=g(e),-1),r=t.length;while(++n|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,sn=/&(?:amp|lt|gt|quot|#x27);/g,on=/\b__p \+= '';/g,un=/\b(__p \+=) '' \+/g,an=/(__e\(.*?\)|\b__t\)) \+\n'';/g,fn=/\w*$/,ln=/(?:__e|__t = )\(\s*(?![\d\s"']|this\.)/g,cn=RegExp("^"+(Yt.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),hn=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,pn=/<%=([\s\S]+?)%>/g,dn=/($^)/,vn=/[&<>"']/g,mn=/['\n\r\t\u2028\u2029\\]/g,gn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yn=0,bn=Math.ceil,wn=Gt.concat,En=Math.floor,Sn=cn.test(Sn=Object.getPrototypeOf)&&Sn,xn=Yt.hasOwnProperty,Tn=Gt.push,Nn=Yt.propertyIsEnumerable,Cn=Gt.slice,kn=Yt.toString,Ln=cn.test(Ln=Cn.bind)&&Ln,An=cn.test(An=Array.isArray)&&An,On=e.isFinite,Mn=e.isNaN,_n=cn.test(_n=Object.keys)&&_n,Dn=Math.max,Pn=Math.min,Hn=Math.random,Bn="[object Arguments]",jn="[object Array]",Fn="[object Boolean]",In="[object Date]",qn="[object Function]",Rn="[object Number]",Un="[object Object]",zn="[object RegExp]",Wn="[object String]",Xn,Vn,$n=($n={0:1,length:1},Gt.splice.call($n,0,1),$n[0]),Jn=!0;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Jn=!n;Xn=!/valueOf/.test(t),Vn=t[0]!="x"})(1);var Kn=!p(arguments),Qn=Cn.call("x")[0]!="x",Gn="x"[0]+Object("x")[0]!="xx";try{var Yn=({toString:0}+"",kn.call(e.document||0)==Un)}catch(Zn){}var er=Ln&&/\n|Opera/.test(Ln+kn.call(e.opera)),tr=_n&&/^.+$|true/.test(_n+!!e.attachEvent);try{var nr=(Function("//@")(),!e.attachEvent)}catch(Zn){}var rr={};rr[Bn]=rr[qn]=!1,rr[jn]=rr[Fn]=rr[In]=rr[Rn]=rr[Un]=rr[zn]=rr[Wn]=!0;var ir={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},sr={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:pn,variable:""};var or=Rt("<% if (obj.useStrict) { %>'use strict';\n<% } %>var index, value, iteratee = <%= firstArg %>, result = <%= firstArg %>;\nif (!<%= firstArg %>) return result;\n<%= top %>;\n<% if (arrayLoop) { %>var length = iteratee.length; index = -1;\nif (typeof length == 'number') { <% if (noCharByIndex) { %>\n if (isString(iteratee)) {\n iteratee = iteratee.split('')\n } <% } %>\n while (++index < length) {\n value = iteratee[index];\n <%= arrayLoop %>\n }\n}\nelse { <% } else if (noArgsEnum) { %>\n var length = iteratee.length; index = -1;\n if (length && isArguments(iteratee)) {\n while (++index < length) {\n value = iteratee[index += ''];\n <%= objectLoop %>\n }\n } else { <% } %> <% if (!hasDontEnumBug) { %>\n var skipProto = typeof iteratee == 'function' && \n propertyIsEnumerable.call(iteratee, 'prototype');\n <% } %> <% if (isKeysFast && useHas) { %>\n var ownIndex = -1,\n ownProps = objectTypes[typeof iteratee] ? nativeKeys(iteratee) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n <% if (!hasDontEnumBug) { %>if (!(skipProto && index == 'prototype')) {\n <% } %> value = iteratee[index];\n <%= objectLoop %>\n <% if (!hasDontEnumBug) { %>}\n<% } %> } <% } else { %>\n for (index in iteratee) {<% if (!hasDontEnumBug || useHas) { %>\n if (<% if (!hasDontEnumBug) { %>!(skipProto && index == 'prototype')<% } if (!hasDontEnumBug && useHas) { %> && <% } if (useHas) { %>hasOwnProperty.call(iteratee, index)<% } %>) { <% } %>\n value = iteratee[index];\n <%= objectLoop %>; <% if (!hasDontEnumBug || useHas) { %>\n }<% } %>\n } <% } %> <% if (hasDontEnumBug) { %>\n\n var ctor = iteratee.constructor;\n <% for (var k = 0; k < 7; k++) { %>\n index = '<%= shadowed[k] %>';\n if (<% if (shadowed[k] == 'constructor') { %>!(ctor && ctor.prototype === iteratee) && <% } %>hasOwnProperty.call(iteratee, index)) {\n value = iteratee[index];\n <%= objectLoop %>\n } <% } %> <% } %> <% if (arrayLoop || noArgsEnum) { %>\n}<% } %>\n<%= bottom %>;\nreturn result"),ur={args:"collection, callback, thisArg",top:"callback = createCallback(callback, thisArg)",arrayLoop:"if (callback(value, index, collection) === false) return result",objectLoop:"if (callback(value, index, collection) === false) return result"},ar={useHas:!1,args:"object",top:"for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {\n if (iteratee = arguments[argsIndex]) {",objectLoop:"result[index] = value",bottom:" }\n}"},fr={arrayLoop:null};Kn&&(p=function(e){return e?xn.call(e,"callee"):!1});var lr=a(ur,fr,{useHas:!1}),cr=a(ur,fr),hr={"&":"&","<":"<",">":">",'"':""","'":"'"},pr=b(hr),dr=a(ar,{objectLoop:"if (result[index] == null) "+ar.objectLoop}),vr=a(ar),mr=An||function(e){return kn.call(e)==jn};C(/x/)&&(C=function(e){return kn.call(e)==qn});var gr=Sn?function(e){if(!e||typeof e!="object")return!1;var t=e.valueOf,n=typeof t=="function"&&(n=Sn(t))&&Sn(n);return n?e==n||Sn(e)==n&&!p(e):d(e)}:d,yr=_n?function(e){return typeof e=="function"&&Nn.call(e,"prototype")?v(e):k(e)?_n(e):[]}:v,br=a(ur);n.VERSION="0.9.2",n.after=St,n.bind=xt,n.bindAll=Tt,n.chain=Xt,n.clone=m,n.compact=st,n.compose=Nt,n.contains=I,n.countBy=q,n.debounce=Ct,n.defaults=dr,n.defer=Lt,n.delay=kt,n.difference=ot,n.escape=Ht,n.every=R,n.extend=vr,n.filter=U,n.find=z,n.first=ut,n.flatten=at,n.forEach=br,n.forIn=lr,n.forOwn=cr,n.functions=g,n.groupBy=W,n.has=y,n.identity=Bt,n.indexOf=ft,n.initial=lt,n.intersection=ct,n.invert=b,n.invoke=X,n.isArguments=p,n.isArray=mr,n.isBoolean=w,n.isDate=E,n.isElement=S,n.isEmpty=x,n.isEqual=T,n.isFinite=N,n.isFunction=C,n.isNaN=L,n.isNull=A,n.isNumber=O,n.isObject=k,n.isPlainObject=gr,n.isRegExp=M,n.isString=_,n.isUndefined=D,n.keys=yr,n.last=ht,n.lastIndexOf=pt,n.lateBind=At,n.map=V,n.max=$,n.memoize=Ot,n.merge=P,n.min=J,n.mixin=jt,n.noConflict=Ft,n.object=dt,n.omit=H,n.once=Mt,n.pairs=B,n.partial=_t,n.pick=j,n.pluck=K,n.random=It,n.range=vt,n.reduce=Q,n.reduceRight=G,n.reject=Y,n.rest=mt,n.result=qt,n.shuffle=Z,n.size=et,n.some=tt,n.sortBy=nt,n.sortedIndex=gt,n.tap=Vt,n.template=Rt,n.throttle=Dt,n.times=Ut,n.toArray=rt,n.unescape=zt,n.union=yt,n.uniq=bt,n.uniqueId=Wt,n.values=F,n.where=it,n.without=wt,n.wrap=Pt,n.zip=Et,n.all=R,n.any=tt,n.collect=V,n.detect=z,n.drop=mt,n.each=br,n.foldl=Q,n.foldr=G,n.head=ut,n.include=I,n.inject=Q,n.methods=g,n.select=U,n.tail=mt,n.take=ut,n.unique=bt,n._iteratorTemplate=or,jt(n),n.prototype.chain=$t,n.prototype.value=Jt,br(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=Gt[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),$n&&e.length===0&&delete e[0],this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),br(["concat","join","slice"],function(e){var t=Gt[e];n.prototype[e]=function(){var e=this.__wrapped__,r=t.apply(e,arguments);return this.__chain__&&(r=new n(r),r.__chain__=!0),r}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=n,define(function(){return n})):Kt?typeof module=="object"&&module&&module.exports==Kt?(module.exports=n)._=n:Kt._=n:e._=n}(this),function(e){var t={};t.qsString=function(e){return Object.keys(e).sort().map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")},t.sha=sha1(),t.stringQs=function(e){return e.split("&").reduce(function(e,t){var n=t.split("=");return e[n[0]]=null===n[1]?"":decodeURIComponent(n[1]),e},{})},t.xhr=function(e,n,r,i,s,o){var u=new XMLHttpRequest;u.onreadystatechange=function(){4==u.readyState&&0!==u.status&&o(u)};var a=s&&s.header||{"Content-Type":"application/x-www-form-urlencoded"};u.open(e,n,!0),u.setRequestHeader("Authorization","OAuth "+t.authHeader(r));for(var f in a)u.setRequestHeader(f,a[f]);u.send(i)},t.nonce=function(){for(var e="";e.length<6;)e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(Math.random()*61)];return e},t.authHeader=function(e){return Object.keys(e).sort().map(function(t){return encodeURIComponent(t)+'="'+encodeURIComponent(e[t])+'"'}).join(", ")},t.timestamp=function(){return~~(+(new Date)/1e3)},t.percentEncode=function(e){return encodeURIComponent(e).replace(/\!/g,"%21").replace(/\'/g,"%27").replace(/\*/g,"%2A").replace(/\(/g,"%28").replace(/\)/g,"%29")},t.baseString=function(e,n,r){return r.oauth_signature&&delete r.oauth_signature,[e,t.percentEncode(n),t.percentEncode(t.qsString(r))].join("&")},t.signature=function(e,n,r){return t.sha.b64_hmac_sha1(t.percentEncode(e)+"&"+t.percentEncode(n),r)},e.ohauth=t}(this);const JXON=new function(){function e(e){return f.test(e)?null:l.test(e)?e.toLowerCase()==="true":isFinite(e)?parseFloat(e):isFinite(Date.parse(e))?new Date(e):e}function t(){}function n(e){return e===null?new t:e instanceof Object?e:new e.constructor(e)}function r(t,i,f,l){const c=a.length,h=t.hasChildNodes(),p=t.hasAttributes(),d=Boolean(i&2);var v,m,g=0,y="",b=d?{}:!0;if(h)for(var w,E=0;E0)&&y?b[s]=x:!d&&g===0&&y&&(b=x),f&&(d||g>0)&&Object.freeze(b),a.length=c,b}function i(e,t,n){var r,a;n instanceof String||n instanceof Number||n instanceof Boolean?t.appendChild(e.createTextNode(n.toString())):n.constructor===Date&&t.appendChild(e.createTextNode(n.toGMTString()));for(var f in n){r=n[f];if(isFinite(f)||r instanceof Function)continue;if(f===s)r!==null&&r!==!0&&t.appendChild(e.createTextNode(r.constructor===Date?r.toGMTString():String(r)));else if(f===o)for(var l in r)t.setAttribute(l,r[l]);else if(f.charAt(0)===u)t.setAttribute(f.slice(1),r);else if(r.constructor===Array)for(var c=0;c1&&typeof t=="number"?t&3:1;return r(e,s,n||!1,arguments.length>3?i:s===3)},this.unbuild=function(e){const t=document.implementation.createDocument("","",null);return i(t,t,e),t}};var iD=function(e){if(!iD.supported()){e.innerHTML="This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.",e.style.cssText="text-align:center;font-style:italic;";return}e=d3.select(e);var t=e.append("div").attr("id","map"),n=iD.Connection().url("http://api06.dev.openstreetmap.org"),r=iD.Map(t.node(),n),i=iD.Controller(r),s=e.append("div").attr("id","bar"),o=s.selectAll("button.add-button").data([iD.modes.AddPlace,iD.modes.AddRoad,iD.modes.AddArea]).enter().append("button").attr("class","add-button").text(function(e){return e.title}).on("click",function(e){i.enter(e)});i.on("enter",function(e){o.classed("active",function(t){return e===t})}),s.append("button").attr({id:"undo","class":"mini"}).property("disabled",!0).html("←").on("click",r.undo),s.append("button").attr({id:"redo","class":"mini"}).property("disabled",!0).html("→").on("click",r.redo),s.append("input").attr({type:"text",placeholder:"find a place",id:"geocode-location"}).on("keydown",function(){if(d3.event.keyCode!==13)return;d3.event.preventDefault();var e=d3.select("#geocode-location").node().value;d3.select(document.body).append("script").attr("src","http://api.tiles.mapbox.com/v3/mapbox/geocode/"+encodeURIComponent(e)+".jsonp?callback=grid")}),window.grid=function(e){r.setCenter([e.results[0][0].lon,e.results[0][0].lat])},s.append("div").attr("class","messages"),s.append("div").attr("class","user").append("div").attr("class","hello"),s.append("button").attr("class","save").html("Upload").on("click",function(){function e(e){d3.select(".shaded").remove();var t=iD.loading("uploading changes to openstreetmap");n.putChangeset(r.history.changes(),e.comment,function(){t.remove(),r.history=iD.History(),r.flush(),r.update(),r.redraw()})}n.authenticate(function(){shaded=d3.select(document.body).append("div").attr("class","shaded").on("click",function(){d3.event.target==this&&shaded.remove()});var t=shaded.append("div").attr("class","modal commit-pane").datum(r.history.changes());t.call(iD.commit().on("cancel",function(){shaded.remove()}).on("save",e))})});var u=s.append("div").attr("class","zoombuttons").selectAll("button").data([["zoom-in","+",r.zoomIn],["zoom-out","-",r.zoomOut]]).enter().append("button").attr("class",function(e){return e[0]}).text(function(e){return e[1]}).on("click",function(e){return e[2]()});e.append("div").attr("class","inspector-wrap").style("display","none"),e.append("div").attr("id","about").html("

Work in progress: introduction,code,docs.Imagery © 2012 Bing, GeoEye, Getmapping, Intermap, Microsoft.

"),r.on("update",function(){var e=r.history.undoAnnotation(),t=r.history.redoAnnotation();s.select("#undo").property("disabled",!e).select("small").text(e),s.select("#redo").property("disabled",!t).select("small").text(t)}),window.onresize=function(){r.size(t.size())},d3.select(document).on("keydown",function(){d3.event.which===90&&d3.event.metaKey&&r.undo(),d3.event.which===90&&d3.event.metaKey&&d3.event.shiftKey&&r.redo()});var a=iD.Hash().map(r);return a.hadHash||r.setZoom(20).center([-77.02405,38.87952]),d3.select(".user").call(iD.userpanel(n).on("logout",n.logout).on("login",n.authenticate)),r};iD.supported=function(){if(navigator.appName!=="Microsoft Internet Explorer")return!0;var e=navigator.userAgent,t=new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");return t.exec(e)!==null&&(rv=parseFloat(RegExp.$1)),rv&&rv<9?!1:!0},iD.OAuth=function(){function e(e){return e.replace(/\W/g,"")}function t(e){return e.oauth_timestamp=ohauth.timestamp(),e.oauth_nonce=ohauth.nonce(),e}function n(t,n){return arguments.length==2&&(localStorage[e(i)+t]=n),localStorage[e(i)+t]}var r="http://api06.dev.openstreetmap.org",i="http://api06.dev.openstreetmap.org",s="aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p",o={},u={oauth_consumer_key:"zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R",oauth_signature_method:"HMAC-SHA1"};return n("oauth_token")&&(u.oauth_token=n("oauth_token")),o.authenticated=function(){return n("oauth_token")&&n("oauth_token_secret")},o.logout=function(){return n("oauth_token",""),n("oauth_token_secret",""),n("oauth_request_token_secret",""),o},o.xhr=function(e,r){n("oauth_token")&&(u.oauth_token=n("oauth_token")),u=t(u);var o=i+e.path,a=n("oauth_token_secret");u.oauth_signature=ohauth.signature(s,a,ohauth.baseString(e.method,o,u)),ohauth.xhr(e.method,o,u,e.content,e.options,function(e){e.responseXML?r(e.responseXML):r(e.response)})},o.authenticate=function(e){if(o.authenticated())return e();o.logout();var i=d3.select(document.body).append("div").attr("class","shaded").on("click",function(){d3.event.target==this&&i.remove()}),a=i.append("div").attr("class","modal").style("display","none"),f=a.append("iframe").attr({width:640,height:550,frameborder:"no"});u=t(u);var l=r+"/oauth/request_token";u.oauth_signature=ohauth.signature(s,"",ohauth.baseString("POST",l,u));var c=iD.loading("contacting openstreetmap...");ohauth.xhr("POST",l,u,null,{},function(e){c.remove(),a.style("display","block");var t=ohauth.stringQs(e.response);n("oauth_request_token_secret",t.oauth_token_secret);var i=r+"/oauth/authorize?";f.attr("src",i+ohauth.qsString({oauth_token:t.oauth_token,oauth_callback:location.href}))}),f.on("load",function(){if(f.node().contentWindow.location.search){var o=f.node().contentWindow.location.search,a=ohauth.stringQs(o.slice(1)),l=r+"/oauth/access_token";u=t(u),i.remove(),u.oauth_token=a.oauth_token;var c=n("oauth_request_token_secret");u.oauth_signature=ohauth.signature(s,c,ohauth.baseString("POST",l,u));var h=iD.loading("contacting openstreetmap...");ohauth.xhr("POST",l,u,null,{},function(t){h.remove();var r=ohauth.stringQs(t.response);n("oauth_token",r.oauth_token),n("oauth_token_secret",r.oauth_token_secret),e()})}})},o.setAPI=function(e){return i=e,o},o},iD.Connection=function(){function e(e,n){t(h+"/api/0.6/map?bbox="+[e[0][0],e[1][1],e[1][0],e[0][1]],n)}function t(e,t){d3.xml(e,function(e,n){t(o(n))})}function n(e){var t=[],n=e.getElementsByTagName("nd");for(var r=0,i=n.length;r"+e+""),top.win.document.close()},iD.Util.tagText=function(e){return d3.entries(e.tags).map(function(e){return e.key+": "+e.value}).join("\n")},iD.actions={},iD.actions.noop=function(){return function(e){return e}},iD.actions.addNode=function(e){return function(t){return t.replace(e,"added a place")}},iD.actions.startWay=function(e){return function(t){return t.replace(e,"started a road")}},iD.actions.remove=function(e){return function(t){return t.remove(e,"removed a feature")}},iD.actions.addWayNode=function(e,t){return function(n){return n.replace(e.update({nodes:e.nodes.slice()})).replace(t,"added to a road")}},iD.actions.removeWayNode=function(e,t){return function(n){return n.replace(e.update({nodes:e.nodes.slice()})).remove(t,"removed from a road")}},iD.actions.changeWayDirection=function(e){return function(t){return t.replace(e.update({nodes:e.nodes.slice()}),"changed way direction")}},iD.actions.changeTags=function(e,t){return function(n){return n.replace(e.update({tags:t}),"changed tags")}},iD.actions.move=function(e,t){return function(n){return n.replace(e.update({lon:t.lon||t[0],lat:t.lat||t[1]}),"moved an element")}},iD.actions.addTemporary=function(e){return function(t){return t.replace(e)}},iD.actions.removeTemporary=function(e){return function(t){return t.remove(e)}},iD.modes={},iD.modes._node=function(e){return iD.Node({lat:e[1],lon:e[0],tags:{}})},iD.modes.AddPlace={title:"+ Place",enter:function(){var e=this.map.surface,t=e.selectAll("g#temp-g").append("g").attr("id","addplace");t.append("circle").attr({"class":"handle",r:3}),e.on("mousemove.addplace",function(){t.attr("transform",function(){var t=d3.mouse(e.node());return"translate("+t+")"})}),e.on("click.addplace",function(){var t=this.map.projection.invert(d3.mouse(e.node())),n=iD.modes._node(t);n._poi=!0,this.map.perform(iD.actions.addNode(n)),this.map.selectEntity(n),this.exit()}.bind(this)),d3.select(document).on("keydown.addplace",function(){d3.event.keyCode===27&&this.exit()}.bind(this))},exit:function(){this.map.surface.on("mousemove.addplace",null).on("click.addplace",null),d3.select(document).on("keydown.addplace",null),d3.selectAll("#addplace").remove()}},iD.modes.dist=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},iD.modes.chooseIndex=function(e,t,n){var r=iD.modes.dist,i=e.nodes.map(function(e){return n.projection([e.lon,e.lat])});for(var s=0,o=[];s0}},iD.Node=function(e){return iD.Entity(_.extend({},e||{},{type:"node"}))},iD.Way=function(e){return iD.Entity(_.extend({},e||{},{type:"way",nodes:[]}))},iD.Relation=function(e){return iD.Entity(_.extend({},e||{},{type:"relation"}))},iD.Graph=function(e,t){if(!(this instanceof iD.Graph))return new iD.Graph(e,t);this.entities=e||{},this.annotation=t,iD.debug&&(Object.freeze(this),Object.freeze(this.entities))},iD.Graph.prototype={entity:function(e){return this.entities[e]},parents:function(e){return _.filter(this.entities,function(t){return t.type!=="way"?!1:t.nodes.indexOf(e)!==-1})},merge:function(e){var t=_.clone(this.entities);return _.defaults(t,e.entities),iD.Graph(t,this.annotation)},replace:function(e,t){var n=_.clone(this.entities);return n[e.id]=e,iD.Graph(n,t)},remove:function(e,t){var n=_.clone(this.entities);return delete n[e.id],iD.Graph(n,t)},nodeIntersect:function(e,t){return e.lon>t[0][0]&&e.lont[1][1]},wayIntersect:function(e,t){return e._extent[0][0]>t[0][0]&&e._extent[1][0]t[1][1]},indexWay:function(e){if(e.type==="way"&&!e._extent){var t=[[-Infinity,Infinity],[Infinity,-Infinity]],n=e;for(var r=0,i=n.nodes.length;rt[0][0]&&(t[0][0]=n.nodes[r].lon),n.nodes[r].lont[1][1]&&(t[1][1]=n.nodes[r].lat);e._extent=t}return!0},intersects:function(e){var t=[];for(var n in this.entities){var r=this.entities[n];if(r.type==="node"&&this.nodeIntersect(r,e))t.push(r);else if(r.type==="way"){var i=this.fetch(r.id);this.indexWay(i)&&this.wayIntersect(i,e)&&t.push(i)}}return t},fetch:function(e){var t=iD.Entity(this.entities[e]),n=[];if(!t.nodes||!t.nodes.length)return t;for(var r=0,i=t.nodes.length;r0){this.index--;if(this.stack[this.index].annotation)break}},redo:function(){while(this.index=0){if(this.stack[e].annotation)return this.stack[e].annotation;e--}},redoAnnotation:function(){var e=this.index+1;while(e<=this.stack.length-1){if(this.stack[e].annotation)return this.stack[e].annotation;e++}},modify:function(){return this.stack[this.index].modifications()},create:function(){return this.stack[this.index].creations()},"delete":function(){return _.difference(_.pluck(this.stack[0].entities,"id"),_.pluck(this.stack[this.index].entities,"id")).map(function(e){return this.stack[0].fetch(e)}.bind(this))},changes:function(){return{modify:this.modify(),create:this.create(),"delete":this["delete"]()}}},iD.Way.isClosed=function(e){return!e.nodes.length||e.nodes[e.nodes.length-1].id===e.nodes[0].id},iD.Background=function(){function e(e){var t="";for(var r=e[2];r>0;r--){var i=0,s=1<t[0][0]&&e.lont[1][1]}function f(e){return iD.Way.isClosed(e)||e.tags.area&&e.tags.area==="yes"}function l(e){if(lt.style(St)!="none")return;var t=q(),n=[],r=[],i=[],s=[],o=[],u=j(),l=$.history.graph();if(!e)n=l.intersects(u);else for(var v in e)n.push(l.fetch(v));var y=e?function(t){return e[t.id]}:function(){return!0};if(n.length>2e3)return h();for(var b=0;b16?(xt(),l(e)):h()}function D(e){$.history.perform(e),M()}function P(){$.history.undo(),M()}function H(){$.history.redo(),M()}function B(e){return arguments.length?(it=e,$):it}function j(){return[tt.invert([0,0]),tt.invert(J)]}function F(e){var t=tt.translate(),n=tt.scale();return[(e[0]-t[0])/n,(e[1]-t[1])/n]}function I(e){var t=tt.translate(),n=tt.scale();return[e[0]*n+t[0],e[1]*n+t[1]]}function q(e){return Math.max(Math.log(tt.scale())/Math.log(2)-7,0)}function R(){return[J[0]/2,J[0]/2]}function U(e){var t=256*Math.pow(2,e-1),n=R(),r=F(n);tt.scale(t),nt.scale(tt.scale());var i=tt.translate();return r=I(r),i[0]+=n[0]-r[0],i[1]+=n[1]-r[1],tt.translate(i),nt.translate(tt.translate()),M(),$}function z(){return U(Math.ceil(q()+1))}function W(){return U(Math.floor(q()-1))}function X(e){if(!arguments.length)return tt.invert(R());var t=tt.translate(),n=R(),r=tt(e);return tt.translate([t[0]-r[0]+n[0],t[1]-r[1]+n[1]]),nt.translate(tt.translate()),M(),$}function V(){et={}}var $={history:iD.History()},J=[],K=d3.dispatch("move","update"),Q=iD.Inspector(),G=d3.select(e),Y=null,Z,et={},tt=d3.geo.mercator(),nt=d3.behavior.zoom().translate(tt.translate()).scale(tt.scale()).scaleExtent([256,256*Math.pow(2,20)]).on("zoom",A),rt,it=!0,st=d3.behavior.drag().origin(function(e){var t=tt(r(e));return rt=iD.Util.trueObj([e.id].concat(_.pluck($.history.graph().parents(e.id),"id"))),{x:t[0],y:t[1]}}).on("dragstart",function(){$.history.perform(iD.actions.noop()),d3.event.sourceEvent.stopPropagation()}).on("drag",function(e){var t=tt.invert([d3.event.x,d3.event.y]);d3.event.sourceEvent.stopPropagation(),$.history.replace(iD.actions.move(e,t)),M(rt)}).on("dragend",M),ot=function(e){return"M"+e.nodes.map(r).map(tt).map(s).join("L")},ut=function(e){return e._line},at=function(e){return e.id},ft=G.append("div").call(nt),lt=ft.append("svg"),ct=lt.append("defs"),ht=lt.append("g").on("click",N),pt=iD.Background().projection(tt),dt=lt.append("g").on("click",k).on("mouseover",x).on("mouseout",T).attr("clip-path","url(#clip)"),vt=["fill","casing","stroke","text","hit","temp"].reduce(function(e,t){return(e[t]=dt.append("g").attr("class","layer-g"))&&e},{}),mt=iD.Style.styleClasses("stroke"),gt=iD.Style.styleClasses("stroke"),yt=iD.Style.styleClasses("area"),bt=iD.Style.styleClasses("casing"),wt=function(){var e=lt.append("text").text("►"),t=e.node().getComputedTextLength();return e.remove(),t}(),Et=n(["webkit","ms","Moz","O"]),St=Et+"transform";ct.append("clipPath").attr("id","clip").append("rect").attr("id","clip-rect").attr({x:0,y:0});var xt=_.debounce(function(){E().map(S)},1e3);return Q.on("changeTags",function(e,t){var n=$.history.graph().entity(e.id);$.perform(iD.actions.changeTags(n,t))}).on("changeWayDirection",function(e){$.perform(iD.actions.changeWayDirection(e))}).on("remove",function(e){L(e),o()}).on("close",function(){N(),o()}),lt.on("mouseup",O).on("touchend",O),$.download=xt,$.getExtent=j,$.selectEntity=C,$.background=pt,$.center=X,$.centre=X,$.getZoom=q,$.setZoom=U,$.zoomIn=z,$.zoomOut=W,$.projection=tt,$.size=y,$.surface=lt,$.perform=D,$.undo=P,$.redo=H,$.redraw=M,$.flush=V,$.dblclickEnable=B,y(G.size()),o(),M(),d3.rebind($,K,"on","move","update")},iD._markers=[{tags:{aeroway:"helipad"},icon:"helipad"},{tags:{aeroway:"airport"},icon:"airport"},{tags:{aeroway:"aerodrome"},icon:"aerodrome"},{tags:{railway:"level_crossing"},icon:"level_crossing"},{tags:{man_made:"lighthouse"},icon:"lighthouselevel_crossing"},{tags:{natural:"peak"},icon:"peak"},{tags:{natural:"volcano"},icon:"volcano"},{tags:{natural:"cave_entrance"},icon:"poi_cave"},{tags:{natural:"spring"},icon:"spring"},{tags:{natural:"tree"},icon:"tree"},{tags:{power:"generator","generator:source":"wind"},icon:"power_wind"},{tags:{power:"generator",power_source:"wind"},icon:"power_wind"},{tags:{man_made:"power_wind"},icon:"power_wind"},{tags:{man_made:"windmill"},icon:"windmill"},{tags:{man_made:"mast"},icon:"communications"},{tags:{highway:"mini_roundabout"},icon:"mini_roundabout"},{tags:{highway:"gate"},icon:"gate2"},{tags:{barrier:"gate"},icon:"gate2"},{tags:{barrier:"lift_gate"},icon:"liftgate"},{tags:{barrier:"bollard"},icon:"bollard"},{tags:{barrier:"block"},icon:"bollard"},{icon:"alpinehut",tags:{tourism:"alpine_hut"}},{icon:"shelter2",tags:{amenity:"shelter"}},{icon:"atm2",tags:{amenity:"atm"}},{icon:"bank2",tags:{amenity:"bank"}},{icon:"bar",tags:{amenity:"bar"}},{icon:"rental_bicycle",tags:{amenity:"bicycle_rental"}},{icon:"bus_stop_small",tags:{amenity:"bus_stop"}},{icon:"bus_stop",tags:{amenity:"bus_stop"}},{icon:"bus_station",tags:{amenity:"bus_station"}},{icon:"traffic_light",tags:{highway:"traffic_signals"}},{icon:"cafe",tags:{amenity:"cafe"}},{icon:"camping",tags:{tourism:"camp_site"}},{icon:"transport_ford",tags:{highway:"ford"}},{icon:"caravan_park",tags:{tourism:"caravan_site"}},{icon:"car_share",tags:{amenity:"car_sharing"}},{icon:"chalet",tags:{tourism:"chalet"}},{icon:"cinema",tags:{amenity:"cinema"}},{icon:"firestation",tags:{amenity:"fire_station"}},{icon:"fuel",tags:{amenity:"fuel"}},{icon:"guest_house",tags:{tourism:"guest_house"}},{icon:"bandb",tags:{tourism:"bed_and_breakfast"}},{icon:"hospital",tags:{amenity:"hospital"}},{icon:"hostel",tags:{tourism:"hostel"}},{icon:"hotel2",tags:{tourism:"hotel"}},{icon:"motel",tags:{tourism:"motel"}},{icon:"information",tags:{tourism:"information"}},{icon:"embassy",tags:{amenity:"embassy"}},{icon:"library",tags:{amenity:"library"}},{icon:"amenity_court",tags:{amenity:"courthouse"}},{icon:"lock_gate",tags:{waterway:"lock"}},{icon:"communications",tags:{man_made:"mast"}},{icon:"museum",tags:{tourism:"museum"}},{icon:"parking",tags:{amenity:"parking"}},{icon:"parking_private",tags:{amenity:"parking"}},{icon:"pharmacy",tags:{amenity:"pharmacy"}},{icon:"christian3",tags:{amenity:"place_of_worship"}},{icon:"islamic3",tags:{amenity:"place_of_worship"}},{icon:"sikh3",tags:{amenity:"place_of_worship"}},{icon:"jewish3",tags:{amenity:"place_of_worship"}},{icon:"place_of_worship3",tags:{amenity:"place_of_worship"}},{icon:"police",tags:{amenity:"police"}},{icon:"post_box",tags:{amenity:"post_box"}},{icon:"post_office",tags:{amenity:"post_office"}},{icon:"pub",tags:{amenity:"pub"}},{icon:"biergarten",tags:{amenity:"biergarten"}},{icon:"recycling",tags:{amenity:"recycling"}},{icon:"restaurant",tags:{amenity:"restaurant"}},{icon:"fast_food",tags:{amenity:"fast_food"}},{icon:"telephone",tags:{amenity:"telephone"}},{icon:"sosphone",tags:{amenity:"emergency_phone"}},{icon:"theatre",tags:{amenity:"theatre"}},{icon:"toilets",tags:{amenity:"toilets"}},{icon:"food_drinkingtap",tags:{amenity:"drinking_water"}},{icon:"amenity_prison",tags:{amenity:"prison"}},{icon:"view_point",tags:{tourism:"viewpoint"}},{icon:"tower_water",tags:{man_made:"water_tower"}},{icon:"tourist_memorial",tags:{historic:"memorial"}},{icon:"tourist_archaeological2",tags:{historic:"archaeological_site"}},{icon:"shop_supermarket",tags:{shop:"supermarket"}},{icon:"shop_bakery",tags:{shop:"bakery"}},{icon:"shop_butcher",tags:{shop:"butcher"}},{icon:"shop_clothes",tags:{shop:"clothes"}},{icon:"shop_convenience",tags:{shop:"convenience"}},{icon:"department_store",tags:{shop:"department_store"}},{icon:"shop_diy",tags:{shop:"doityourself"}},{icon:"florist",tags:{shop:"florist"}},{icon:"shop_hairdresser",tags:{shop:"hairdresser"}},{icon:"shopping_car",tags:{shop:"car"}},{icon:"shopping_car_repair",tags:{shop:"car_repair"}},{icon:"shopping_bicycle",tags:{shop:"bicycle"}},{icon:"playground",tags:{leisure:"playground"}},{icon:"picnic",tags:{amenity:"picnic_site"}},{icon:"transport_slipway",tags:{leisure:"slipway"}}],iD._markertable=function(e){var t={};for(var n=0;n