// https://github.com/d3/d3-geo-polygon Version 1.4.2. Copyright 2018 Mike Bostock.
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-geo"),require("d3-geo-projection")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-geo","d3-geo-projection"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,r,e){"use strict";function o(){}var i=1e-6,a=1e-12,u=Math.PI,l=u/2,c=u/4,f=2*u,p=180/u,s=u/180,h=Math.abs,g=Math.atan,v=Math.atan2,d=Math.cos,m=Math.exp,M=Math.log,y=Math.max,P=Math.min,A=Math.pow,E=Math.sin,G=Math.sign||function(n){return n>0?1:n<0?-1:0},x=Math.sqrt,C=Math.tan;function S(n){return n>1?0:n<-1?u:Math.acos(n)}function j(n){return n>1?l:n<-1?-l:Math.asin(n)}function w(n,t,r,e){this.x=n,this.z=t,this.o=r,this.e=e,this.v=!1,this.n=this.p=null}var B=function(n,t,r,e,o){var a,u,l=[],c=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,e=n[0],u=n[t];if(p=u,h((f=e)[0]-p[0])<i&&h(f[1]-p[1])<i){for(o.lineStart(),a=0;a<t;++a)o.point((e=n[a])[0],e[1]);o.lineEnd()}else{var f,p;l.push(r=new w(e,n,null,!0)),c.push(r.o=new w(e,null,r,!1)),l.push(r=new w(u,n,null,!1)),c.push(r.o=new w(u,null,r,!0))}}}),l.length){for(c.sort(t),D(l),D(c),a=0,u=c.length;a<u;++a)c[a].e=r=!r;for(var f,p,s=l[0];;){for(var g=s,v=!0;g.v;)if((g=g.n)===s)return;f=g.z,o.lineStart();do{if(g.v=g.o.v=!0,g.e){if(v)for(a=0,u=f.length;a<u;++a)o.point((p=f[a])[0],p[1]);else e(g.x,g.n.x,1,o);g=g.n}else{if(v)for(f=g.p.z,a=f.length-1;a>=0;--a)o.point((p=f[a])[0],p[1]);else e(g.x,g.p.x,-1,o);g=g.p}f=(g=g.o).z,v=!v}while(!g.v);o.lineEnd()}}};function D(n){if(t=n.length){for(var t,r,e=0,o=n[0];++e<t;)o.n=r=n[e],r.p=o,o=r;o.n=r=n[0],r.p=o}}function F(){this.reset()}F.prototype={constructor:F,reset:function(){this.s=this.t=0},add:function(n){b(R,n,this.t),b(this,R.s,this.s),this.s?this.t+=R.t:this.s=R.t},valueOf:function(){return this.s}};var R=new F;function b(n,t,r){var e=n.s=t+r,o=e-t,i=e-o;n.t=t-i+(r-o)}function N(n){return[v(n[1],n[0]),j(n[2])]}function q(n){var t=N(n);return[t[0]*p,t[1]*p]}function T(n){var t=n[0],r=n[1],e=d(r);return[e*d(t),e*E(t),E(r)]}function I(n){return T([n[0]*s,n[1]*s])}function z(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function L(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 _(n){var t=x(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function K(n,t){var r=t[0]-n[0],e=t[1]-n[1],o=t[2]-n[2];return r*r+e*e+o*o<a*a}var O=new F,Q=function(n,t){var r=t[0],e=t[1],o=[E(r),-d(r),0],a=0,l=0;O.reset();for(var p=0,s=n.length;p<s;++p)if(g=(h=n[p]).length)for(var h,g,m=h[g-1],M=m[0],y=m[1]/2+c,P=E(y),A=d(y),G=0;G<g;++G,M=C,P=w,A=B,m=x){var x=h[G],C=x[0],S=x[1]/2+c,w=E(S),B=d(S),D=C-M,F=D>=0?1:-1,R=F*D,b=R>u,N=P*w;if(O.add(v(N*F*E(R),A*B+N*d(R))),a+=b?D+F*f:D,b^M>=r^C>=r){var q=L(T(m),T(x));_(q);var I=L(o,q);_(I);var z=(b^D>=0?-1:1)*j(I[2]);(e>z||e===z&&(q[0]||q[1]))&&(l+=b^D>=0?1:-1)}}return(a<-i||a<i&&O<-i)^1&l},V=function(n,r,e,i,a){return void 0===a&&(a=k),function(u){var l,c,f,p=r(u),s=function(){var n,t=[];return{point:function(t,r,e,o){var i=[t,r];arguments.length>2&&(i.index=e,i.t=o),n.push(i)},lineStart:function(){t.push(n=[])},lineEnd:o,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}(),h=r(s),g=!1,v={point:d,lineStart:M,lineEnd:y,polygonStart:function(){v.point=P,v.lineStart=A,v.lineEnd=E,c=[],l=[]},polygonEnd:function(){v.point=d,v.lineStart=M,v.lineEnd=y,c=t.merge(c);var n=Q(l,i);c.length?(g||(u.polygonStart(),g=!0),B(c,a,n,e,u)):n&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),c=l=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function d(t,r){n(t,r)&&u.point(t,r)}function m(n,t){p.point(n,t)}function M(){v.point=m,p.lineStart()}function y(){v.point=d,p.lineEnd()}function P(n,t,r){f.push([n,t]),h.point(n,t,r)}function A(){h.lineStart(),f=[]}function E(){P(f[0][0],f[0][1],!0),h.lineEnd();var n,t,r,e,o=h.clean(),i=s.result(),a=i.length;if(f.pop(),l.push(f),f=null,a)if(1&o){if((t=(r=i[0]).length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),n=0;n<t;++n)u.point((e=r[n])[0],e[1]);u.lineEnd()}}else a>1&&2&o&&i.push(i.pop().concat(i.shift())),c.push(i.filter(W))}return v}};function W(n){return n.length>1}function k(n,t){return((n=n.x)[0]<0?n[1]-l-i:l-n[1])-((t=t.x)[0]<0?t[1]-l-i:l-t[1])}function H(n,t){this.from=n,this.to=t,this.normal=L(n,t),this.fromNormal=L(this.normal,n),this.toNormal=L(this.normal,t)}function J(n,t){var r=L(n.normal,t.normal);_(r);var e=z(r,n.fromNormal),o=z(r,n.toNormal),i=z(r,t.fromNormal),a=z(r,t.toNormal);return e>0&&o<0&&i>0&&a<0?r:e<0&&o>0&&i<0&&a>0?(r[0]=-r[0],r[1]=-r[1],r[2]=-r[2],r):void 0}function U(n,t){var r=z(n,t.fromNormal),e=z(n,t.toNormal);return n=z(n,t.normal),h(n)<a&&(r>-a&&e<a||r<a&&e>-a)}var X={},Y=function(n){return n},Z=function(n){var t=[];if("Polygon"!=n.type)return Y;var r=n.coordinates.map(function(n){var r,e;return(n=n.map(function(n,o){return r=T(n=[n[0]*s,n[1]*s]),o&&t.push(new H(e,r)),e=r,n})).pop(),n});function e(n,t){return Q(r,[n,t])}function o(n,t){return G(E(100*n+t))}var i=V(e,function(n){var r,i,a,l,c,f;return{lineStart:function(){r=null,f=1},point:function(p,s,h){-1==d(p)&&(p-=1e-5*G(E(p))),h&&(p=i,s=a);var g,v,m,M,A,x=T([p,s]),C=c;if(r){var S=new H(r,x),j=[];for(v=0,m=100;v<t.length&&m>0;++v)if(g=J(S,M=t[v])){if(g===X||K(g,r)||K(g,x)||K(g,M.from)||K(g,M.to)){A=1e-4,p=(p+3*u+o(v,m)*A)%(2*u)-u,s=P(u/2-1e-4,y(1e-4-u/2,s+o(v,m)*A)),S=new H(r,x=T([p,s])),v=-1,--m,j.length=0;continue}var w=N(g);g.distance=nn(r,g),g.index=v,g.t=nn(M.from,g),g[0]=w[0],g[1]=w[1],g.pop(),j.push(g)}if(j.length)for(f=0,j.sort(function(n,t){return n.distance-t.distance}),v=0;v<j.length;++v)g=j[v],(C=!C)?(n.lineStart(),n.point(g[0],g[1],g.index,g.t)):(n.point(g[0],g[1],g.index,g.t),n.lineEnd());C&&n.point(p,s)}else{for(v=0,m=100;v<t.length&&m>0;++v)U(x,M=t[v])&&(A=1e-4,x=T([p=(p+3*u+o(v,m)*A)%(2*u)-u,s=P(u/2-1e-4,y(1e-4-u/2,s+o(v,m)*A))]),v=-1,--m);l=C=e(i=p,a=s),C&&(n.lineStart(),n.point(p,s))}r=x,c=C},lineEnd:function(){c&&n.lineEnd()},clean:function(){return f|(l&&c)<<1}}},function(n,e,o,i){if(null==n){var a=r.length;r.forEach(function(n,t){n.forEach(function(n){i.point(n[0],n[1])}),t<a-1&&(i.lineEnd(),i.lineStart())})}else if(n.index!==e.index&&null!=n.index&&null!=e.index)for(var u=n.index;u!==e.index;u=(u+o+t.length)%t.length){var l=t[u],c=N(o>0?l.to:l.from);i.point(c[0],c[1])}},r[0][0],$);return i.polygon=function(){return{type:"Polygon",coordinates:r.map(function(n){return n.map(function(n){return[n[0]*p,n[1]*p]})})}},i};function $(n,t){return n=n.x,t=t.x,n.index-t.index||n.t-t.t}function nn(n,t){var r=L(n,t);return v(x(z(r,r)),z(n,t))}var tn=Math.abs,rn=Math.atan,en=Math.atan2,on=Math.cos,an=Math.max,un=Math.min,ln=Math.sin,cn=1e-6,fn=Math.PI,pn=fn/2,sn=Math.SQRT1_2,hn=(vn(2),vn(fn),180/fn),gn=fn/180;function vn(n){return n>0?Math.sqrt(n):0}var dn=function(n,t){var r,e,o=Mn(n[1],n[0]),i=Mn(t[1],t[0]),a=(r=o,e=i,en(r[0]*e[1]-r[1]*e[0],r[0]*e[0]+r[1]*e[1])),u=yn(o)/yn(i);return mn([1,0,n[0][0],0,1,n[0][1]],mn([u,0,0,0,u,0],mn([on(a),ln(a),0,-ln(a),on(a),0],[1,0,-t[0][0],0,1,-t[0][1]])))};function mn(n,t){return[n[0]*t[0]+n[1]*t[3],n[0]*t[1]+n[1]*t[4],n[0]*t[2]+n[1]*t[5]+n[2],n[3]*t[0]+n[4]*t[3],n[3]*t[1]+n[4]*t[4],n[3]*t[2]+n[4]*t[5]+n[5]]}function Mn(n,t){return[n[0]-t[0],n[1]-t[1]]}function yn(n){return vn(n[0]*n[0]+n[1]*n[1])}var Pn=function(n,t){!function n(t,r){t.edges=function(n){for(var t=n.length,r=[],e=n[t-1],o=0;o<t;++o)r.push([e,e=n[o]]);return r}(t.face);if(r.face){var e=t.shared=function(n,t){for(var r,e,o=n.length,i=null,a=0;a<o;++a){r=n[a];for(var u=t.length;--u>=0;)if(e=t[u],r[0]===e[0]&&r[1]===e[1]){if(i)return[i,r];i=r}}}(t.face,r.face),o=dn(e.map(r.project),e.map(t.project));t.transform=r.transform?mn(r.transform,o):o;for(var i=r.edges,a=0,u=i.length;a<u;++a)En(e[0],i[a][1])&&En(e[1],i[a][0])&&(i[a]=t),En(e[0],i[a][0])&&En(e[1],i[a][1])&&(i[a]=t);for(i=t.edges,a=0,u=i.length;a<u;++a)En(e[0],i[a][0])&&En(e[1],i[a][1])&&(i[a]=r),En(e[0],i[a][1])&&En(e[1],i[a][0])&&(i[a]=r)}else t.transform=r.transform;t.children&&t.children.forEach(function(r){n(r,t)});return t}(n,{transform:[1,0,0,0,1,0]});function e(n,r){var e,o=t(n,r),i=o.project([n*hn,r*hn]);return(e=o.transform)?[e[0]*i[0]+e[1]*i[1]+e[2],-(e[3]*i[0]+e[4]*i[1]+e[5])]:(i[1]=-i[1],i)}Gn(n)&&(e.invert=function(r,e){var o=function n(r,e){var o=r.project.invert,i=r.transform,a=e;i&&(i=function(n){var t=1/(n[0]*n[4]-n[1]*n[3]);return[t*n[4],-t*n[1],t*(n[1]*n[5]-n[2]*n[4]),-t*n[3],t*n[0],t*(n[2]*n[3]-n[0]*n[5])]}(i),a=[i[0]*a[0]+i[1]*a[1]+i[2],i[3]*a[0]+i[4]*a[1]+i[5]]);if(o&&r===(u=l=o(a),t(u[0]*gn,u[1]*gn)))return l;var u;var l,c=r.children;for(var f=0,p=c&&c.length;f<p;++f)if(l=n(c[f],e))return l}(n,[r,-e]);return o&&(o[0]*=s,o[1]*=s,o)});var o=r.geoProjection(e),i=o.stream,a=[];An({point:function(n,t){a.push([n,t])}},n),a.push(a[0]),o.preclip(Z({type:"Polygon",coordinates:[a]}));function u(n){return n}return o.stream=function(t){var r=o.rotate(),e=o.preclip(),a=i(t),l=(o.preclip(u).rotate([0,0]),i(t));return o.rotate(r),o.preclip(e),a.sphere=function(){l.polygonStart(),l.lineStart(),An(l,n),l.lineEnd(),l.polygonEnd()},a},o.tree=function(){return n},o};function An(n,t,e){var o,i,a=t.edges,u=a.length,l={type:"MultiPoint",coordinates:t.face},c=t.face.filter(function(n){return 90!==tn(n[1])}),f=r.geoBounds({type:"MultiPoint",coordinates:c}),p=!1,s=-1,h=f[1][0]-f[0][0];if(t.centroid=180===h||360===h?[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]:r.geoCentroid(l),e)for(;++s<u&&a[s]!==e;);++s;for(var g=0;g<u;++g)i=a[(g+s)%u],Array.isArray(i)?(p||(n.point((o=r.geoInterpolate(i[0],t.centroid)(cn))[0],o[1]),p=!0),n.point((o=r.geoInterpolate(i[1],t.centroid)(cn))[0],o[1])):(p=!1,i!==e&&An(n,i,t))}function En(n,t){return n&&t&&n[0]===t[0]&&n[1]===t[1]}function Gn(n){return n.project.invert||n.children&&n.children.some(Gn)}var xn=[[0,90],[-90,0],[0,0],[90,0],[180,0],[0,-90]],Cn=[[0,2,1],[0,3,2],[5,1,2],[5,2,3],[0,1,4],[0,4,3],[5,4,1],[5,3,4]].map(function(n){return n.map(function(n){return xn[n]})}),Sn=2/vn(3);function jn(n,t){var r=e.geoCollignonRaw(n,t);return[r[0]*Sn,r[1]]}jn.invert=function(n,t){return e.geoCollignonRaw.invert(n/Sn,t)};function wn(n,t){for(var r=0,e=n.length,o=0;r<e;++r)o+=n[r]*t[r];return o}function Bn(n){return[en(n[1],n[0])*hn,(t=an(-1,un(1,n[2])),(t>1?pn:t<-1?-pn:Math.asin(t))*hn)];var t}function Dn(n){var t=n[0]*gn,r=n[1]*gn,e=on(r);return[e*on(t),e*ln(t),ln(r)]}var Fn=function(n,t,e){n=n||[],t=t||{features:[]},e=e||function(n){return r.geoGnomonic().scale(1).translate([0,0]).rotate([-n.site[0],-n.site[1]])};var o=[];function i(){o=t.features.map(function(n,t){var o=n.geometry.coordinates[0].slice(0,-1);return o.site=n.properties&&n.properties.sitecoordinates?n.properties.sitecoordinates:r.geoCentroid(n.geometry),{face:o,site:o.site,id:t,project:e(o)}}),n.forEach(function(n,t){var r=o[n];r&&(r.children||(r.children=[])).push(o[t])})}function a(n,t){n*=p,t*=p;for(var e=1/0,i=-1,a=0;a<o.length;a++){var u=r.geoDistance(o[a].site,[n,t]);u<e&&(e=u,i=a)}return o[i]}var u=r.geoGnomonic();return i(),function r(){var l=u.rotate(),c=u.translate(),f=u.center(),p=u.scale(),s=u.angle();return o.length&&(u=Pn(o[0],a)),u.parents=function(t){return arguments.length?(n=t,i(),r()):n},u.polygons=function(n){return arguments.length?(t=n,i(),r()):t},u.faceProjection=function(t){return arguments.length?(e=t,i(),r()):n},u.rotate(l).translate(c).center(f).scale(p).angle(s)}()};function Rn(n,t){return[n[0]*t[0]-n[1]*t[1],n[1]*t[0]+n[0]*t[1]]}function bn(n,t){return[n[0]+t[0],n[1]+t[1]]}function Nn(n,t){return[n[0]-t[0],n[1]-t[1]]}function qn(n){return n[0]*n[0]+n[1]*n[1]}function Tn(n,t){var r,e,o=n[1];if(0===(n=n[0])&&0===o)return[0,0];if("number"==typeof t&&(t=[t,0]),!t[1]){if(0===o&&n>=0)return[A(n,t[0]),0];if(0===n)switch((t[1]%4+4)%4){case 0:return[A(o,t[0]),0];case 1:return[0,A(o,t[0])];case 2:return[-A(o,t[0]),0];case 3:return[0,-A(o,t[0])]}}return r=v(o,n),e=function(n,t){var r=h(n),e=h(t);return 0===n?M(e):0===t?M(r):r<3e3&&e<3e3?.5*M(n*n+t*t):M(n/d(v(t,n)))}(n,o),n=m(t[0]*e-t[1]*r),o=t[1]*e+t[0]*r,[n*d(o),n*E(o)]}var In=[-.5,x(3)/2],zn=[1.7666387502854533,0],Ln=.09;var _n=e.geoLagrangeRaw?e.geoLagrangeRaw(.5):null;function Kn(n,r){var e=_n(n,r),o=function(n){var r=[0,0],e=Tn(In,t.scan([0,1,2].map(function(t){return-Rn(n,Tn(In,[t,0]))[0]}))),o=Rn(e,n);o=[1-o[0],-o[1]];for(var i=[1.44224957030741,.240374928384568,.0686785509670194,.0178055502507087,.00228276285265497,-.00148379585422573,-.00164287728109203,-.00102583417082273,-.000483607537673571,-.000167030822094781,-245024395166263e-19,214092375450951e-19,255897270486771e-19,173086854400834e-19,872756299984649e-20,318304486798473e-20,2.0355504999826998e-8,-5.62970586787826e-7,-3.92135372833465e-7],a=[0,0],u=i.length;u--;)a=bn([i[u],0],Rn(a,o));r=Rn(bn(zn,Rn([-a[0],-a[1]],Tn(o,1-2/3))),Rn(e,e));var l=qn(n);if(l<Ln){var c=[1,1/3,5/27,10/81,22/243],f=Tn(n,[3,0]),p=[0,0];for(u=c.length;u--;)p=bn([c[u],0],Rn(p,f));p=Rn(p,n),r=bn(Rn(r,[l/Ln,0]),Rn(p,[1-l/Ln,0]))}return r}([e[1]/2,e[0]/2]);return[o[1],o[0]]}function On(n,e){var o,i,a=[-.5,x(3)/2],u=[0,0],l=[0,0],c=Rn(r.geoStereographicRaw(n,e),[x(2),0]),f=t.scan([0,1,2].map(function(n){return-Rn(c,Tn(a,[n,0]))[0]})),p=Tn(a,[f,0]),s=(i=c,x(qn(i)));if(s>.3){var h=Nn([1,0],Rn(p,c)),g=[1.15470053837925,.192450089729875,.0481125224324687,.010309826235529,.000334114739114366,-.00150351632601465,-.0012304417796231,-.000675190201960282,-.000284084537293856,-821205120500051e-19,-159257630018706e-20,191691805888369e-19,173095888028726e-19,103865580818367e-19,470614523937179e-20,14413500104181e-19,1.92757960170179e-8,-3.82869799649063e-7,-3.57526015225576e-7,-2.2175964844211e-7],v=[0,0];for(o=g.length;o--;)v=bn([g[o],0],Rn(v,h));u=Rn(u=Rn(u=Nn([1.4021821053254548,0],Rn(Tn(h,.5),v)),p),p)}if(s<.5){var d=[1,1/8,3/56,1/32,35/1664,63/4096,231/19456],m=Tn(c,[3,0]);for(o=d.length;o--;)l=bn([d[o],0],Rn(l,m));l=Rn(l,c)}if(s<.3)return l;if(s>.5)return u;var M=(s-.3)/.2;return bn(Rn(u,[M,0]),Rn(l,[1-M,0]))}var Qn=j(1/3),Vn=[[0,90],[-180,-Qn*p],[-60,-Qn*p],[60,-Qn*p]],Wn=[[1,2,3],[0,2,1],[0,3,2],[0,1,3]].map(function(n){return n.map(function(n){return Vn[n]})});function kn(){var n=x(3),t=x(5+2*x(5))/x(15),e=x(8)/x(5+x(5)),o=x(3+x(5))/x(5+x(5)),a=function(r,i){var a=d(i),u=t/(a*d(r)),l=a*E(r)*u,c=E(i)*u,f=v(2*c/n+e/3-e/2,o),p=v(l-c/n+e/3-e/2,o),s=v(e/3-l-c/n-e/2,o);return[n*(p-s),2*f-p-s]};return a.invert=function(n,t){if(n*n+t*t>5)return[0,3];var e=2.9309936378128416,o=r.geoGnomonicRaw.invert(n/e,t/e),u=0;do{var l=a(o[0],o[1]),c=n-l[0],f=t-l[1];o[0]+=.2*c,o[1]+=.2*f}while(u++<30&&h(c)+h(f)>i);return o},a}var Hn=rn(sn)*hn,Jn=[[0,Hn],[90,Hn],[180,Hn],[-90,Hn],[0,-Hn],[90,-Hn],[180,-Hn],[-90,-Hn]],Un=[[0,3,2,1],[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7],[4,5,6,7]].map(function(n){return n.map(function(n){return Jn[n]})});function Xn(n){var t={lengthMG:n};!function(){var n,i,a,u,l,p,h,M,y,P,A,G=x(3);t.lengthMA=.094*t.lengthMG,t.lengthParallel0to73At0=t.lengthMG/100,t.lengthParallel73to90At0=(t.lengthMG-t.lengthMA-73*t.lengthParallel0to73At0)/17,t.sin60=G/2,t.cos60=.5,t.pointM=[0,0],t.pointG=[t.lengthMG,0],n=[t.lengthMG,t.lengthMG*C(30*s)],t.pointA=[t.lengthMA,0],t.pointB=o(t.pointM,30,t.pointA,45),t.lengthAG=r(t.pointA,t.pointG),t.lengthAB=r(t.pointA,t.pointB),i=r(t.pointM,t.pointB),a=r(t.pointM,n),u=r(n,t.pointG),t.pointD=e(i,a,n,t.pointM),t.pointF=[t.lengthMG,u-i],t.pointE=[n[0]-t.lengthMA*E(30*s),n[1]-t.lengthMA*d(30*s)],t.lengthGF=r(t.pointG,t.pointF),t.lengthBD=r(t.pointB,t.pointD),t.lengthBDE=t.lengthBD+t.lengthAB,t.lengthGFE=t.lengthGF+t.lengthAB,t.deltaMEq=t.lengthGFE/45,t.lengthAP75=15*t.lengthParallel73to90At0,t.lengthAP73=t.lengthMG-t.lengthMA-73*t.lengthParallel0to73At0,l=[t.pointA[0]+t.lengthAP73*d(30*s),t.pointA[1]+t.lengthAP73*E(30*s)],t.pointT=o(l,-60,t.pointB,30),p=m(29),h=p.lengthParallel73,M=g(29),y=v(29),P=15*(M+y+h)/73,A=[0,0],t.pointC=[0,0],t.radius=0,A=e(P-=M,y,c(29),f(29)),t.pointC[1]=(A[0]*A[0]+A[1]*A[1]-t.pointD[0]*t.pointD[0]-t.pointD[1]*t.pointD[1])/(2*(G*A[0]+A[1]-G*t.pointD[0]-t.pointD[1])),t.pointC[0]=G*t.pointC[1],t.radius=r(t.pointC,t.pointD)}();function r(n,t){var r=n[0]-t[0],e=n[1]-t[1];return x(r*r+e*e)}function e(n,t,r,e){return[r[0]+(e[0]-r[0])*n/t,r[1]+(e[1]-r[1])*n/t]}function o(n,t,r,e){var o=C(t*s),i=C(e*s),a=[0,0];return a[0]=(o*n[0]-i*r[0]-n[1]+r[1])/(o-i),a[1]=o*(a[0]-n[0])+n[1],a}function i(n,t,r,e){var o=r[0],i=r[1],a=e[0],u=e[1],l=n[0],c=n[1],f=(a-o)*(a-o)+(u-i)*(u-i),p=2*((a-o)*(o-l)+(u-i)*(i-c)),s=p*p-4*f*(l*l+c*c+o*o+i*i-2*(l*o+c*i)-t*t),h=0,g=0;return 0===f?[0,[0,0]]:s<0?[0,[0,0]]:(h=(-p+x(s))/(2*f),g=(-p-x(s))/(2*f),0<=h&&h<=1?[1,[o+h*(a-o),i+h*(u-i)]]:0<=g&&g<=1?[1,[o+g*(a-o),i+g*(u-i)]]:[0,[0,0]])}function a(n,r){var e=[0,0];return-60===r?(e[0]=n[0]*t.cos60+n[1]*t.sin60,e[1]=-n[0]*t.sin60+n[1]*t.cos60):-120===r?(e[0]=-n[0]*t.cos60+n[1]*t.sin60,e[1]=-n[0]*t.sin60-n[1]*t.cos60):(e[0]=n[0]*d(r*s)-n[1]*E(r*s),e[1]=n[0]*E(r*s)+n[1]*d(r*s)),e}function u(n){var r=t.deltaMEq*n;return r<=t.lengthGF?[t.pointG[0],r]:e(r-=t.lengthGF,t.lengthAB,t.pointF,t.pointE)}function l(n){return u(n)}function c(n){return o(t.pointM,2*n/3,l(n),n/3)}function f(n){if(0===n)return[t.pointA+t.lengthAB,0];return o(t.pointA,n,t.pointM,2*n/3)}function g(n){return r(l(n),c(n))}function v(n){return r(c(n),f(n))}function m(n){var e=[0,0],i=f(n),a=0,u=[0,0];return n<=30?(e[0]=t.pointA[0]+t.lengthAP73*d(n*s),e[1]=t.pointA[1]+t.lengthAP73*E(n*s),a=r(i,e)):(a=r(i,e=o(t.pointT,-60,i,n)),n>44&&(u=o(t.pointT,-60,i,2/3*n))[0]>e[0]&&(a=-r(i,e=u))),{parallel73:e,lengthParallel73:a}}function M(n){return[t.pointA[0]+t.lengthAP75*d(n*s),t.pointA[1]+t.lengthAP75*E(n*s)]}function y(n,t){var r,e=(r=(n+180)/90+1,Math[r>0?"floor":"ceil"](r)),o=(n+720)%90-45,i=G(o);return o=h(o),5===e&&(e=1),t<0&&(e=[0,6,7,8,5][e]),[o,h(t),i,e]}function P(n,o){var a,p,h,y,P,A=[0,0];0===n?o>=75?(x=o,A=[t.pointA[0]+104*(90-x),0]):(G=o,A=[t.pointG[0]-100*G,0]):o>=75?A=function(n,r){var e=104*(90-r);return[t.pointA[0]+e*d(n*s),t.pointA[1]+e*E(n*s)]}(n,o):0===o?A=u(n):o>=73&&n<=30?A=function(n,r){var e=1560+100*(75-r);return[t.pointA[0]+e*d(n*s),t.pointA[1]+e*E(n*s)]}(n,o):45===n?A=o<=15?e(o,15,t.pointE,t.pointD):o<=73?e(o-15,58,t.pointD,t.pointT):function(n,o){var i=M(45),a=m(n).parallel73,u=r(t.pointT,t.pointB),l=r(t.pointB,i),c=(75-o)*(l+u)/2;return c<=l?e(c,l,i,t.pointB):e(c-=l,u,t.pointB,a)}(n,o):n<=29?A=function(n,t){var r=m(n),o=g(n),i=v(n),a=t*(o+i+r.lengthParallel73)/73;return a<=o?e(a,o,l(n),c(n)):a<=o+i?e(a-=o,i,c(n),f(n)):e(a=a-o-i,r.lengthParallel73,f(n),r.parallel73)}(n,o):o>=73?A=function(n,t){var o=M(n),i=r(f(n),o),a=m(n),u=a.parallel73,l=a.lengthParallel73,c=(75-t)*(i-l)/2;return c<=i?e(c,i,o,f(n)):e(c-=i,-l,f(n),u)}(n,o):(y=(p=i(t.pointC,t.radius,c(n),f(n)))[0],h=p[1],a=g(n),1===y?P=a+r(c(n),h):(y=(p=i(t.pointC,t.radius,l(n),c(n)))[0],h=p[1],P=a-r(c(n),h)),A=o<=15?function(n,t,r){var o=t*r/15,i=g(n),a=v(n);return o<=i?e(o,i,l(n),c(n)):e(o-=i,a,c(n),f(n))}(n,o,P):function(n,t,r){var o=m(n),i=o.parallel73,a=g(n),u=v(n),p=o.lengthParallel73,s=r+(t-15)*(a+u+p-r)/58;return s<=a?e(s,a,l(n),f(n)):s<=a+u?e(s-=a,u,c(n),f(n)):e(s=s-a-u,p,f(n),i)}(n,o,P));var G,x;return A}return function(n,r){var e=y(n*p,r*p),o=e[0],i=e[1],u=e[2],l=e[3],c=P(o,i);return function(n,r){var e=[0,0];if(0===r)e=a(n,-60);else if(1===r)(e=a(n,-120))[0]-=t.lengthMG;else if(2===r)(e=a(n,-60))[0]-=t.lengthMG;else if(3===r)(e=a(n,-120))[0]+=t.lengthMG;else if(4===r)(e=a(n,-60))[0]+=t.lengthMG;else if(5===r)(e=a([2*t.lengthMG-n[0],n[1]],-60))[0]+=t.lengthMG;else if(6===r)(e=a([2*t.lengthMG-n[0],n[1]],-120))[0]-=t.lengthMG;else if(7===r)(e=a([2*t.lengthMG-n[0],n[1]],-60))[0]-=t.lengthMG;else{if(8!==r)return e;(e=a([2*t.lengthMG-n[0],n[1]],-120))[0]+=t.lengthMG}return e}([c[0],u*c[1]],l)}}n.geoClipPolygon=Z,n.geoPolyhedral=Pn,n.geoPolyhedralButterfly=function(n){n=n||function(n){var t=r.geoCentroid({type:"MultiPoint",coordinates:n});return r.geoGnomonic().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var t=Cn.map(function(t){return{face:t,project:n(t)}});return[-1,0,0,1,0,1,4,5].forEach(function(n,r){var e=t[n];e&&(e.children||(e.children=[])).push(t[r])}),Pn(t[0],function(n,r){return t[n<-fn/2?r<0?6:4:n<0?r<0?2:0:n<fn/2?r<0?3:1:r<0?7:5]}).angle(-30).scale(101.858).center([0,45])},n.geoPolyhedralCollignon=function(n){n=n||function(n){var t=r.geoCentroid({type:"MultiPoint",coordinates:n});return r.geoProjection(jn).translate([0,0]).scale(1).rotate(t[1]>0?[-t[0],0]:[180-t[0],180])};var t=Cn.map(function(t){return{face:t,project:n(t)}});return[-1,0,0,1,0,1,4,5].forEach(function(n,r){var e=t[n];e&&(e.children||(e.children=[])).push(t[r])}),Pn(t[0],function(n,r){return t[n<-fn/2?r<0?6:4:n<0?r<0?2:0:n<fn/2?r<0?3:1:r<0?7:5]}).angle(-30).scale(121.906).center([0,48.5904])},n.geoPolyhedralWaterman=function(n){n=n||function(n){var t=6===n.length?r.geoCentroid({type:"MultiPoint",coordinates:n}):n[0];return r.geoGnomonic().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var t=Cn.map(function(n){for(var t,r=n.map(Dn),e=r.length,o=r[e-1],i=[],a=0;a<e;++a)t=r[a],i.push(Bn([.9486832980505138*o[0]+.31622776601683794*t[0],.9486832980505138*o[1]+.31622776601683794*t[1],.9486832980505138*o[2]+.31622776601683794*t[2]]),Bn([.9486832980505138*t[0]+.31622776601683794*o[0],.9486832980505138*t[1]+.31622776601683794*o[1],.9486832980505138*t[2]+.31622776601683794*o[2]])),o=t;return i}),e=[],o=[-1,0,0,1,0,1,4,5];t.forEach(function(n,r){for(var i=Cn[r],a=i.length,u=e[r]=[],l=0;l<a;++l)t.push([i[l],n[(2*l+2)%(2*a)],n[(2*l+1)%(2*a)]]),o.push(r),u.push((c=Dn(n[(2*l+2)%(2*a)]),f=Dn(n[(2*l+1)%(2*a)]),[c[1]*f[2]-c[2]*f[1],c[2]*f[0]-c[0]*f[2],c[0]*f[1]-c[1]*f[0]]));var c,f});var i=t.map(function(t){return{project:n(t),face:t}});o.forEach(function(n,t){var r=i[n];r&&(r.children||(r.children=[])).push(i[t])});return Pn(i[0],function(n,t){var r=on(t),o=[r*on(n),r*ln(n),ln(t)],a=n<-fn/2?t<0?6:4:n<0?t<0?2:0:n<fn/2?t<0?3:1:t<0?7:5,u=e[a];return i[wn(u[0],o)<0?8+3*a:wn(u[1],o)<0?8+3*a+1:wn(u[2],o)<0?8+3*a+2:a]}).angle(-30).scale(110.625).center([0,45])},n.geoPolyhedralVoronoi=Fn,n.geoDodecahedral=function(){var n=j(1/x(3))*p,t=S((x(5)-1)/x(3)/2)*p,r=90-t,e=S(-(1+x(5))/x(3)/2)*p,o={type:"FeatureCollection",features:[[[45,n],[0,t],[180,t],[135,n],[90,r]],[[45,n],[r,0],[-r,0],[-45,n],[0,t]],[[45,n],[90,r],[90,-r],[45,-n],[r,0]],[[0,t],[-45,n],[-90,r],[-135,n],[180,t]],[[r,0],[45,-n],[0,-t],[-45,-n],[-r,0]],[[90,r],[135,n],[e,0],[135,-n],[90,-r]],[[45,-n],[90,-r],[135,-n],[180,-t],[0,-t]],[[135,n],[180,t],[-135,n],[-e,0],[e,0]],[[-45,n],[-r,0],[-45,-n],[-90,-r],[-90,r]],[[-45,-n],[0,-t],[180,-t],[-135,-n],[-90,-r]],[[135,-n],[e,0],[-e,0],[-135,-n],[180,-t]],[[-135,n],[-90,r],[-90,-r],[-135,-n],[-e,0]]].map(function(n){return n.push(n[0]),{geometry:{type:"Polygon",coordinates:[n]}}})};return Fn().parents([-1,0,4,8,1,2,2,3,1,8,6,3]).angle(108).polygons(o).scale(99.8).rotate([-8,0,-32])},n.geoCox=function(){var n=r.geoProjection(Kn),t=n.stream;return n.stream=function(e){var o=n.rotate(),a=t(e),u=(n.rotate([0,0]),t(e));return n.rotate(o),a.sphere=function(){r.geoStream(function(){var n=2*j(1/x(5))*p;return{type:"Polygon",coordinates:[[[0,90],[-180,-n+i],[0,-90],[180,-n+i],[0,90]]]}}(),u)},a},n.scale(188.305).translate([480,333.167])},n.geoCoxRaw=Kn,n.geoTetrahedralLee=function(){var n=Wn.map(function(n){return{face:n,project:function(n){var t=r.geoCentroid({type:"MultiPoint",coordinates:n}),e=[-t[0],-t[1],30];return 90==h(t[1])&&(e=[0,-t[1],-30]),r.geoProjection(On).scale(1).translate([0,0]).rotate(e)}(n)}});[-1,0,0,0].forEach(function(t,r){var e=n[t];e&&(e.children||(e.children=[])).push(n[r])});return Pn(n[0],function(t,e){t*=p,e*=p;for(var o=0;o<n.length;o++)if(r.geoContains({type:"Polygon",coordinates:[[Wn[o][0],Wn[o][1],Wn[o][2],Wn[o][0]]]},[t,e]))return n[o]}).rotate([30,180]).angle(30).scale(118.662).translate([480,195.47])},n.geoLeeRaw=On,n.geoGrayFullerRaw=kn,n.geoAirocean=function(){return function(n){var e=g(.5)*p,o=[[0,90],[0,-90]].concat(t.range(10).map(function(n){return[(36*n+180)%360-180,1&n?e:-e]})),i=[[0,3,11],[0,5,3],[0,7,5],[0,9,7],[0,11,9],[2,11,3],[3,4,2],[4,3,5],[5,6,4],[6,5,7],[7,8,6],[8,7,9],[9,10,8],[10,9,11],[11,2,10],[1,2,4],[1,4,6],[1,6,8],[1,8,10],[1,10,2]].map(function(n){return n.map(function(n){return o[n]})});return i.forEach(function(n){n.centroid=r.geoCentroid({type:"MultiPoint",coordinates:n})}),function(){var n,t,e,o;o=(n=i[15]).centroid,t=n.slice(),n[0]=o,(n=[t[0],o,t[2]]).centroid=o,i.push(n),(n=[t[0],t[1],o]).centroid=o,i.push(n),o=(n=i[14]).centroid,t=n.slice();var a=r.geoGnomonic().scale(1).translate([0,0]).rotate([-o[0],-o[1]]),u=a(n[1]),l=a(n[2]);e=a.invert([(u[0]+l[0])/2,(u[1]+l[1])/2]),n[1]=e,(n=[t[0],t[1],e]).centroid=o,i.push(n),o=(n=i[19]).centroid,t=n.slice(),n[1]=e,(n=[e,t[0],t[1]]).centroid=o,i.push(n)}(),function(n){n=n||function(n){var t=n.centroid;return r.geoGnomonic().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var t=i.map(function(t,e){var o=t.slice();return o.push(o[0]),{face:t,site:t.centroid,id:e,contains:function(n,t){return r.geoContains({type:"Polygon",coordinates:[o]},[n*p,t*p])},project:n(t)}});[-1,0,1,11,13,6,7,1,7,8,9,10,11,12,13,6,8,10,17,21,16,15,19,19].forEach(function(n,r){var e=t[n];e&&(e.children||(e.children=[])).push(t[r])});var e=Pn(t[0],function(n,r){for(var e=0;e<t.length;e++)if(t[e].contains(n,r))return t[e]});return e.faces=t,e}(n)}(function(n){var t=n.centroid;return n.direction=Math.abs(t[1]-52.62)<1||Math.abs(t[1]+10.81)<1?0:60,r.geoProjection(kn()).scale(1).translate([0,0]).rotate([-t[0],-t[1],n.direction||0])}).rotate([-83.65929,25.44458,-87.45184]).angle(-60).scale(45.4631).center([126,0])},n.geoIcosahedral=function(){var n=g(.5)*p,t=[[0,90],[0,-90]].concat([0,1,2,3,4,5,6,7,8,9].map(function(t){return[(36*t+180)%360-180,1&t?n:-n]})),r={type:"FeatureCollection",features:[[0,3,11],[0,5,3],[0,7,5],[0,9,7],[0,11,9],[2,11,3],[3,4,2],[4,3,5],[5,6,4],[6,5,7],[7,8,6],[8,7,9],[9,10,8],[10,9,11],[11,2,10],[1,2,4],[1,4,6],[1,6,8],[1,8,10],[1,10,2]].map(function(n){return n.map(function(n){return t[n]})}).map(function(n){return n.push(n[0]),{geometry:{type:"Polygon",coordinates:[n]}}})};return Fn().parents([-1,7,9,11,13,0,5,6,7,8,9,10,11,12,13,6,8,10,12,14]).angle(0).polygons(r).rotate([108,0]).scale(131.777).center([162,0])},n.geoCubic=function(){var n={type:"FeatureCollection",features:Un.map(function(n){return(n=n.slice()).push(n[0]),{geometry:{type:"Polygon",coordinates:[n]}}})};return Fn().polygons(n).parents([-1,0,1,5,3,2]).angle(0).scale(96.8737).center([135,-45]).rotate([120,0])},n.geoCahillKeyes=function(n){n=n||function(){return r.geoProjectionMutator(Xn)(1e4).scale(1)};var t=[[0,90],[-90,0],[0,0],[90,0],[180,0],[0,-90]],e=(t=[[0,2,1],[0,3,2],[5,1,2],[5,2,3],[0,1,4],[0,4,3],[5,4,1],[5,3,4]].map(function(n){return n.map(function(n){return t[n]})})).map(function(n){for(var t,r=n.map(I),e=r.length,o=r[e-1],i=17*s,a=d(i),u=E(i),l=[],c=0;c<e;++c)t=r[c],l.push(q([o[0]*a+t[0]*u,o[1]*a+t[1]*u,o[2]*a+t[2]*u]),q([t[0]*a+o[0]*u,t[1]*a+o[1]*u,t[2]*a+o[2]*u])),o=t;return l}),o=[],i=[-1,3,0,2,0,1,4,5];e.forEach(function(n,r){for(var a=t[r],u=a.length,l=o[r]=[],c=0;c<u;++c)e.push([a[c],n[(2*c+2)%(2*u)],n[(2*c+1)%(2*u)]]),i.push(r),l.push(L(I(n[(2*c+2)%(2*u)]),I(n[(2*c+1)%(2*u)])))});var a=e.map(function(t){return{project:n(t),face:t}});return i.forEach(function(n,t){var r=a[n];r&&(r.children||(r.children=[])).push(a[t])}),Pn(a[0],function(n,t){var r=d(t),e=[r*d(n),r*E(n),E(t)],i=n<-u/2?t<0?6:4:n<0?t<0?2:0:n<u/2?t<0?3:1:t<0?7:5,l=o[i];return a[z(l[0],e)<0?8+3*i:z(l[1],e)<0?8+3*i+1:z(l[2],e)<0?8+3*i+2:i]},0,!0).scale(.023975).rotate([20,0]).center([0,-17])},n.geoCahillKeyesRaw=Xn,Object.defineProperty(n,"__esModule",{value:!0})});