0x51664b04…8e63sent to0x14578924…b707·#16,723,599·view on Etherscan
zr.prototype.createCell=function(e){var t=this.cellJunkyard.pop();return t?t.init(e):new this.Cell(e)},zr.prototype.Cell.prototype.prepareHalfedges=function(){for(var e,t=this.halfedges,r=t.length;r--;)(e=t[r].edge).vb&&e.va||t.splice(r,1);return t.sort((function(e,t){return t.angle-e.angle})),t.length},zr.prototype.Cell.prototype.getNeighborIds=function(){for(var e,t=[],r=this.halfedges.length;r--;)null!==(e=this.halfedges[r].edge).lSite&&e.lSite.voronoiId!=this.site.voronoiId?t.push(e.lSite.voronoiId):null!==e.rSite&&e.rSite.voronoiId!=this.site.voronoiId&&t.push(e.rSite.voronoiId);return t},zr.prototype.Cell.prototype.getBbox=function(){for(var e,t,r,n=this.halfedges,o=n.length,i=1/0,l=1/0,s=-1/0,a=-1/0;o--;)(t=(e=n[o].getStartpoint()).x)<i&&(i=t),(r=e.y)<l&&(l=r),t>s&&(s=t),r>a&&(a=r);return{x:i,y:l,width:s-i,height:a-l}},zr.prototype.Cell.prototype.pointIntersection=function(e,t){for(var r,n,o,i,l=this.halfedges,s=l.length;s--;){if(n=(r=l[s]).getStartpoint(),o=r.getEndpoint(),!(i=(t-n.y)*(o.x-n.x)-(e-n.x)*(o.y-n.y)))return 0;if(i>0)return-1}return 1},zr.prototype.Vertex=function(e,t){this.x=e,this.y=t},zr.prototype.Edge=function(e,t){this.lSite=e,this.rSite=t,this.va=this.vb=null},zr.prototype.Halfedge=function(e,t,r){if(this.site=t,this.edge=e,r)this.angle=Math.atan2(r.y-t.y,r.x-t.x);else{var n=e.va,o=e.vb;this.angle=e.lSite===t?Math.atan2(o.x-n.x,n.y-o.y):Math.atan2(n.x-o.x,o.y-n.y)}},zr.prototype.createHalfedge=function(e,t,r){return new this.Halfedge(e,t,r)},zr.prototype.Halfedge.prototype.getStartpoint=function(){return this.edge.lSite===this.site?this.edge.va:this.edge.vb},zr.prototype.Halfedge.prototype.getEndpoint=function(){return this.edge.lSite===this.site?this.edge.vb:this.edge.va},zr.prototype.createVertex=function(e,t){var r=this.vertexJunkyard.pop();return r?(r.x=e,r.y=t):r=new this.Vertex(e,t),this.vertices.push(r),r},zr.prototype.createEdge=function(e,t,r,n){var o=this.edgeJunkyard.pop();return o?(o.lSite=e,o.rSite=t,o.va=o.vb=null):o=new this.Edge(e,t),this.edges.push(o),r&&this.setEdgeStartpoint(o,e,t,r),n&&this.setEdgeEndpoint(o,e,t,n),this.cells[e.voronoiId].halfedges.push(this.createHalfedge(o,e,t)),this.cells[t.voronoiId].halfedges.push(this.createHalfedge(o,t,e)),o},zr.prototype.createBorderEdge=function(e,t,r){var n=this.edgeJunkyard.pop();return n?(n.lSite=e,n.rSite=null):n=new this.Edge(e,null),n.va=t,n.vb=r,this.edges.push(n),n},zr.prototype.setEdgeStartpoint=function(e,t,r,n){e.va||e.vb?e.lSite===r?e.vb=n:e.va=n:(e.va=n,e.lSite=t,e.rSite=r)},zr.prototype.setEdgeEndpoint=function(e,t,r,n){this.setEdgeStartpoint(e,r,t,n)},zr.prototype.Beachsection=function(){},zr.prototype.createBeachsection=function(e){var t=this.beachsectionJunkyard.pop();return t||(t=new this.Beachsection),t.site=e,t},zr.prototype.leftBreakPoint=function(e,t){var r=e.site,n=r.x,o=r.y,i=o-t;if(!i)return n;var l=e.rbPrevious;if(!l)return-1/0;var s=(r=l.site).x,a=r.y,h=a-t;if(!h)return s;var u=s-n,c=1/i-1/h,f=u/h;return c?(-f+this.sqrt(f*f-2*c*(u*u/(-2*h)-a+h/2+o-i/2)))/c+n:(n+s)/2},zr.prototype.rightBreakPoint=function(e,t){var r=e.rbNext;if(r)return this.leftBreakPoint(r,t);var n=e.site;return n.y===t?n.x:1/0},zr.prototype.detachBeachsection=function(e){this.detachCircleEvent(e),this.beachline.rbRemoveNode(e),this.beachsectionJunkyard.push(e)},zr.prototype.removeBeachsection=function(e){var t=e.circleEvent,r=t.x,n=t.ycenter,o=this.createVertex(r,n),i=e.rbPrevious,l=e.rbNext,s=[e],a=Math.abs;this.detachBeachsection(e);for(var h=i;h.circleEvent&&a(r-h.circleEvent.x)<1e-9&&a(n-h.circleEvent.ycenter)<1e-9;)i=h.rbPrevious,s.unshift(h),this.detachBeachsection(h),h=i;s.unshift(h),this.detachCircleEvent(h);for(var u=l;u.circleEvent&&a(r-u.circleEvent.x)<1e-9&&a(n-u.circleEvent.ycenter)<1e-9;)l=u.rbNext,s.push(u),this.detachBeachsection(u),u=l;s.push(u),this.detachCircleEvent(u);var c,f=s.length;for(c=1;c<f;c++)u=s[c],h=s[c-1],this.setEdgeStartpoint(u.edge,h.site,u.site,o);h=s[0],(u=s[f-1]).edge=this.createEdge(h.site,u.site,void 0,o),this.attachCircleEvent(h),this.attachCircleEvent(u)},zr.prototype.addBeachsection=function(e){for(var t,r,n,o,i=e.x,l=e.y,s=this.beachline.root;s;)if((n=this.leftBreakPoint(s,l)-i)>1e-9)s=s.rbLeft;else{if(!((o=i-this.rightBreakPoint(s,l))>1e-9)){n>-1e-9?(t=s.rbPrevious,r=s):o>-1e-9?(t=s,r=s.rbNext):t=r=s;break}if(!s.rbRight){t=s;break}s=s.rbRight}var a=this.createBeachsection(e);if(this.beachline.rbInsertSuccessor(t,a),t||r){if(t===r)return this.detachCircleEvent(t),r=this.createBeachsection(t.site),this.beachline.rbInsertSuccessor(a,r),a.edge=r.edge=this.createEdge(t.site,a.site),this.attachCircleEvent(t),void this.attachCircleEvent(r);if(!t||r){if(t!==r){this.detachCircleEvent(t),this.detachCircleEvent(r);var h=t.site,u=h.x,c=h.y,f=e.x-u,d=e.y-c,p=r.site,g=p.x-u,y=p.y-c,v=2*(f*y-d*g),x=f*f+d*d,b=g*g+y*y,m=this.createVertex((y*x-d*b)/v+u,(f*b-g*x)/v+c);return this.setEdgeStartpoint(r.edge,h,p,m),a.edge=this.createEdge(h,e,void 0,m),r.edge=this.createEdge(e,p,void 0,m),this.attachCircleEvent(t),void this.attachCircleEvent(r)}}else a.edge=this.createEdge(t.site,a.site)}},zr.prototype.CircleEvent=function(){this.arc=null,this.rbLeft=null,this.rbNext=null,this.rbParent=null,this.rbPrevious=null,this.rbRed=!1,this.rbRight=null,this.site=null,this.x=this.y=this.ycenter=0},zr.prototype.attachCircleEvent=function(e){var t=e.rbPrevious,r=e.rbNext;if(t&&r){var n=t.site,o=e.site,i=r.site;if(n!==i){var l=o.x,s=o.y,a=n.x-l,h=n.y-s,u=i.x-l,c=i.y-s,f=2*(a*c-h*u);if(!(f>=-2e-12)){var d=a*a+h*h,p=u*u+c*c,g=(c*d-h*p)/f,y=(a*p-u*d)/f,v=y+s,x=this.circleEventJunkyard.pop();x||(x=new this.CircleEvent),x.arc=e,x.site=o,x.x=g+l,x.y=v+this.sqrt(g*g+y*y),x.ycenter=v,e.circleEvent=x;for(var b=null,m=this.circleEvents.root;m;)if(x.y<m.y||x.y===m.y&&x.x<=m.x){if(!m.rbLeft){b=m.rbPrevious;break}m=m.rbLeft}else{if(!m.rbRight){b=m;break}m=m.rbRight}this.circleEvents.rbInsertSuccessor(b,x),b||(this.firstCircleEvent=x)}}}},zr.prototype.detachCircleEvent=function(e){var t=e.circleEvent;t&&(t.rbPrevious||(this.firstCircleEvent=t.rbNext),this.circleEvents.rbRemoveNode(t),this.circleEventJunkyard.push(t),e.circleEvent=null)},zr.prototype.connectEdge=function(e,t){var r=e.vb;if(r)return!0;var n,o,i=e.va,l=t.xl,s=t.xr,a=t.yt,h=t.yb,u=e.lSite,c=e.rSite,f=u.x,d=u.y,p=c.x,g=c.y,y=(f+p)/2,v=(d+g)/2;if(this.cells[u.voronoiId].closeMe=!0,this.cells[c.voronoiId].closeMe=!0,g!==d&&(o=v-(n=(f-p)/(g-d))*y),void 0===n){if(y<l||y>=s)return!1;if(f>p){if(!i||i.y<a)i=this.createVertex(y,a);else if(i.y>=h)return!1;r=this.createVertex(y,h)}else{if(!i||i.y>h)i=this.createVertex(y,h);else if(i.y<a)return!1;r=this.createVertex(y,a)}}else if(n<-1||n>1)if(f>p){if(!i||i.y<a)i=this.createVertex((a-o)/n,a);else if(i.y>=h)return!1;r=this.createVertex((h-o)/n,h)}else{if(!i||i.y>h)i=this.createVertex((h-o)/n,h);else if(i.y<a)return!1;r=this.createVertex((a-o)/n,a)}else if(d<g){if(!i||i.x<l)i=this.createVertex(l,n*l+o);else if(i.x>=s)return!1;r=this.createVertex(s,n*s+o)}else{if(!i||i.x>s)i=this.createVertex(s,n*s+o);else if(i.x<l)return!1;r=this.createVertex(l,n*l+o)}return e.va=i,e.vb=r,!0},zr.prototype.clipEdge=function(e,t){var r=e.va.x,n=e.va.y,o=0,i=1,l=e.vb.x-r,s=e.vb.y-n,a=r-t.xl;if(0===l&&a<0)return!1;var h=-a/l;if(l<0){if(h<o)return!1;h<i&&(i=h)}else if(l>0){if(h>i)return!1;h>o&&(o=h)}if(a=t.xr-r,0===l&&a<0)return!1;if(h=a/l,l<0){if(h>i)return!1;h>o&&(o=h)}else if(l>0){if(h<o)return!1;h<i&&(i=h)}if(a=n-t.yt,0===s&&a<0)return!1;if(h=-a/s,s<0){if(h<o)return!1;h<i&&(i=h)}else if(s>0){if(h>i)return!1;h>o&&(o=h)}if(a=t.yb-n,0===s&&a<0)return!1;if(h=a/s,s<0){if(h>i)return!1;h>o&&(o=h)}else if(s>0){if(h<o)return!1;h<i&&(i=h)}return o>0&&(e.va=this.createVertex(r+o*l,n+o*s)),i<1&&(e.vb=this.createVertex(r+i*l,n+i*s)),(o>0||i<1)&&(this.cells[e.lSite.voronoiId].closeMe=!0,this.cells[e.rSite.voronoiId].closeMe=!0),!0},zr.prototype.clipEdges=function(e){for(var t,r=this.edges,n=r.length,o=Math.abs;n--;)t=r[n],(!this.connectEdge(t,e)||!this.clipEdge(t,e)||o(t.va.x-t.vb.x)<1e-9&&o(t.va.y-t.vb.y)<1e-9)&&(t.va=t.vb=null,r.splice(n,1))},zr.prototype.closeCells=function(e){for(var t,r,n,o,i,l,s,a,h,u=e.xl,c=e.xr,f=e.yt,d=e.yb,p=this.cells,g=p.length,y=Math.abs;g--;)if((t=p[g]).prepareHalfedges()&&t.closeMe){for(o=(n=t.halfedges).length,r=0;r<o;){if(l=n[r].getEndpoint(),a=n[(r+1)%o].getStartpoint(),y(l.x-a.x)>=1e-9||y(l.y-a.y)>=1e-9)switch(!0){case this.equalWithEpsilon(l.x,u)&&this.lessThanWithEpsilon(l.y,d):if(h=this.equalWithEpsilon(a.x,u),s=this.createVertex(u,h?a.y:d),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;l=s;case this.equalWithEpsilon(l.y,d)&&this.lessThanWithEpsilon(l.x,c):if(h=this.equalWithEpsilon(a.y,d),s=this.createVertex(h?a.x:c,d),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;l=s;case this.equalWithEpsilon(l.x,c)&&this.greaterThanWithEpsilon(l.y,f):if(h=this.equalWithEpsilon(a.x,c),s=this.createVertex(c,h?a.y:f),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;l=s;case this.equalWithEpsilon(l.y,f)&&this.greaterThanWithEpsilon(l.x,u):if(h=this.equalWithEpsilon(a.y,f),s=this.createVertex(h?a.x:u,f),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;if(l=s,h=this.equalWithEpsilon(a.x,u),s=this.createVertex(u,h?a.y:d),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;if(l=s,h=this.equalWithEpsilon(a.y,d),s=this.createVertex(h?a.x:c,d),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;if(l=s,h=this.equalWithEpsilon(a.x,c),s=this.createVertex(c,h?a.y:f),i=this.createBorderEdge(t.site,l,s),r++,n.splice(r,0,this.createHalfedge(i,t.site,null)),o++,h)break;default:throw"Voronoi.closeCells() > this makes no sense!"}r++}t.closeMe=!1}},zr.prototype.quantizeSites=function(e){for(var t,r=this.ε,n=e.length;n--;)(t=e[n]).x=Math.floor(t.x/r)*r,t.y=Math.floor(t.y/r)*r},zr.prototype.recycle=function(e){if(e){if(!(e instanceof this.Diagram))throw"Voronoi.recycleDiagram() > Need a Diagram object.";this.toRecycle=e}},zr.prototype.compute=function(e,t){var r=new Date;this.reset(),this.toRecycle&&(this.vertexJunkyard=this.vertexJunkyard.concat(this.toRecycle.vertices),this.edgeJunkyard=this.edgeJunkyard.concat(this.toRecycle.edges),this.cellJunkyard=this.cellJunkyard.concat(this.toRecycle.cells),this.toRecycle=null);var n=e.slice(0);n.sort((function(e,t){var r=t.y-e.y;return r||t.x-e.x}));for(var o,i,l,s=n.pop(),a=0,h=this.cells;;)if(l=this.firstCircleEvent,s&&(!l||s.y<l.y||s.y===l.y&&s.x<l.x))s.x===o&&s.y===i||(h[a]=this.createCell(s),s.voronoiId=a++,this.addBeachsection(s),i=s.y,o=s.x),s=n.pop();else{if(!l)break;this.removeBeachsection(l.arc)}this.clipEdges(t),this.closeCells(t);var u=new Date,c=new this.Diagram;return c.cells=this.cells,c.edges=this.edges,c.vertices=this.vertices,c.execTime=u.getTime()-r.getTime(),this.reset(),c};var jr=Math.PI/3,Ur=[[0,0],[0,-1],[-1,0],[1,0],[0,1],[-1,-1],[1,-1],[-1,1],[1,1],[0,-2],[-2,0],[2,0],[0,2],[-1,-2],[1,-2],[-2,-1],[2,-1],[-2,1],[2,1],[-1,2],[1,2]],Hr=Ur.length;function Xr(e,t){this.width=e.shape[0],this.height=e.shape[1],this.radius=e.radius||e.minDistance,this.maxTries=Math.max(3,Math.ceil(e.tries||30)),this.rng=ar;const r=1e-14*Math.max(1,Math.max(this.width,this.height)/64|0);var n;this.squaredRadius=this.radius*this.radius,this.radiusPlusEpsilon=this.radius+r,this.cellSize=this.radius*Math.SQRT1_2,this.angleIncrement=2*Math.PI/this.maxTries,this.angleIncrementOnSuccess=jr+2e-14,this.triesIncrementOnSuccess=Math.ceil(this.angleIncrementOnSuccess/this.angleIncrement),this.processList=[],this.samplePoints=[],this.gridShape=[Math.ceil(this.width/this.cellSize),Math.ceil(this.height/this.cellSize)],this.grid={strideX:(n=this.gridShape)[1],data:new Uint32Array(n[0]*n[1])}}Xr.prototype.width=null,Xr.prototype.height=null,Xr.prototype.radius=null,Xr.prototype.radiusPlusEpsilon=null,Xr.prototype.squaredRadius=null,Xr.prototype.cellSize=null,Xr.prototype.angleIncrement=null,Xr.prototype.angleIncrementOnSuccess=null,Xr.prototype.triesIncrementOnSuccess=null,Xr.prototype.maxTries=null,Xr.prototype.rng=null,Xr.prototype.processList=null,Xr.prototype.samplePoints=null,Xr.prototype.gridShape=null,Xr.prototype.grid=null,Xr.prototype.addRandomPoint=function(){return this.directAddPoint([this.rng()*this.width,this.rng()*this.height,this.rng()*Math.PI*2,0])},Xr.prototype.addPoint=function(e){return 2===e.length&&e[0]>=0&&e[0]<this.width&&e[1]>=0&&e[1]<this.height?this.directAddPoint([e[0],e[1],this.rng()*Math.PI*2,0]):null},Xr.prototype.directAddPoint=function(e){var t=[e[0],e[1]];this.processList.push(e),this.samplePoints.push(t);var r=(e[0]/this.cellSize|0)*this.grid.strideX+(e[1]/this.cellSize|0);return this.grid.data[r]=this.samplePoints.length,t},Xr.prototype.inNeighbourhood=function(e){var t,r,n,o,i,l=this.grid.strideX,s=this.gridShape[0],a=this.gridShape[1],h=e[0]/this.cellSize|0,u=e[1]/this.cellSize|0;for(t=0;t<Hr;t++)if(n=h+Ur[t][0],o=u+Ur[t][1],-1!==(r=n<0||o<0||n>=s||o>=a?-1:n*l+o)&&0!==this.grid.data[r]&&(i=this.samplePoints[this.grid.data[r]-1],Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2)<this.squaredRadius))return!0;return!1},Xr.prototype.next=function(){for(var e,t,r,n;this.processList.length>0;){var o=this.processList.length*this.rng()|0;for(r=(t=this.processList[o])[2],0===(e=t[3])&&(r+=(this.rng()-.5)*jr*4);e<this.maxTries;e++){if((n=[t[0]+Math.cos(r)*this.radiusPlusEpsilon,t[1]+Math.sin(r)*this.radiusPlusEpsilon,r,0])[0]>=0&&n[0]<this.width&&n[1]>=0&&n[1]<this.height&&!this.inNeighbourhood(n))return t[2]=r+this.angleIncrementOnSuccess+this.rng()*this.angleIncrement,t[3]=e+this.triesIncrementOnSuccess,this.directAddPoint(n);r+=this.angleIncrement}if(e>=this.maxTries){const e=this.processList.pop();o<this.processList.length&&(this.processList[o]=e)}}return null},Xr.prototype.fill=function(){for(0===this.samplePoints.length&&this.addRandomPoint();this.next(););return this.samplePoints},Xr.prototype.getAllPoints=function(){return this.samplePoints},Xr.prototype.reset=function(){var e,t=this.grid.data;for(e=0;e<t.length;e++)t[e]=0;this.samplePoints=[],this.processList.length=0};!function e(t,r,n){function o(l,s){if(!r[l]){if(!t[l]){var a="function"==typeof require&&require;if(!s&&a)return a(l,!0);if(i)return i(l,!0);var h=new Error("Cannot find module '"+l+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[l]={exports:{}};t[l][0].call(u.exports,(function(e){var r=t[l][1][e];return o(r||e)}),u,u.exports,e,t,r,n)}return r[l].exports}for(var i="function"==typeof require&&require,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(e,t,r){var n,o=e("./lib/build-log"),i=e("./lib/epsilon"),l=e("./lib/intersecter"),s=e("./lib/segment-chainer"),a=e("./lib/segment-selector"),h=e("./lib/geojson"),u=!1,c=i();function f(e,t,r){var o=n.segments(e),i=n.segments(t),l=r(n.combine(o,i));return n.polygon(l)}n={buildLog:function(e){return!0===e?u=o():!1===e&&(u=!1),!1!==u&&u.list},epsilon:function(e){return c.epsilon(e)},segments:function(e){var t=l(!0,c,u);return e.regions.forEach(t.addRegion),{segments:t.calculate(e.inverted),inverted:e.inverted}},combine:function(e,t){return{combined:l(!1,c,u).calculate(e.segments,e.inverted,t.segments,t.inverted),inverted1:e.inverted,inverted2:t.inverted}},selectUnion:function(e){return{segments:a.union(e.combined,u),inverted:e.inverted1||e.inverted2}},selectIntersect:function(e){return{segments:a.intersect(e.combined,u),inverted:e.inverted1&&e.inverted2}},selectDifference:function(e){return{segments:a.difference(e.combined,u),inverted:e.inverted1&&!e.inverted2}},selectDifferenceRev:function(e){return{segments:a.differenceRev(e.combined,u),inverted:!e.inverted1&&e.inverted2}},selectXor:function(e){return{segments:a.xor(e.combined,u),inverted:e.inverted1!==e.inverted2}},polygon:function(e){return{regions:s(e.segments,c,u),inverted:e.inverted}},polygonFromGeoJSON:function(e){return h.toPolygon(n,e)},polygonToGeoJSON:function(e){return h.fromPolygon(n,c,e)},union:function(e,t){return f(e,t,n.selectUnion)},intersect:function(e,t){return f(e,t,n.selectIntersect)},difference:function(e,t){return f(e,t,n.selectDifference)},differenceRev:function(e,t){return f(e,t,n.selectDifferenceRev)},xor:function(e,t){return f(e,t,n.selectXor)}},"object"==typeof window&&(window.PolyBool=n),t.exports=n},{"./lib/build-log":2,"./lib/epsilon":3,"./lib/geojson":4,"./lib/intersecter":5,"./lib/segment-chainer":7,"./lib/segment-selector":8}],2:[function(e,t,r){t.exports=function(){var e,t=0,r=!1;function n(t,r){return e.list.push({type:t,data:r?JSON.parse(JSON.stringify(r)):void 0}),e}return e={list:[],segmentId:function(){return t++},checkIntersection:function(e,t){return n("check",{seg1:e,seg2:t})},segmentChop:function(e,t){return n("div_seg",{seg:e,pt:t}),n("chop",{seg:e,pt:t})},statusRemove:function(e){return n("pop_seg",{seg:e})},segmentUpdate:function(e){return n("seg_update",{seg:e})},segmentNew:function(e,t){return n("new_seg",{seg:e,primary:t})},segmentRemove:function(e){return n("rem_seg",{seg:e})},tempStatus:function(e,t,r){return n("temp_status",{seg:e,above:t,below:r})},rewind:function(e){return n("rewind",{seg:e})},status:function(e,t,r){return n("status",{seg:e,above:t,below:r})},vert:function(t){return t===r?e:(r=t,n("vert",{x:t}))},log:function(e){return"string"!=typeof e&&(e=JSON.stringify(e,!1," ")),n("log",{txt:e})},reset:function(){return n("reset")},selected:function(e){return n("selected",{segs:e})},chainStart:function(e){return n("chain_start",{seg:e})},chainRemoveHead:function(e,t){return n("chain_rem_head",{index:e,pt:t})},chainRemoveTail:function(e,t){return n("chain_rem_tail",{index:e,pt:t})},chainNew:function(e,t){return n("chain_new",{pt1:e,pt2:t})},chainMatch:function(e){return n("chain_match",{index:e})},chainClose:function(e){return n("chain_close",{index:e})},chainAddHead:function(e,t){return n("chain_add_head",{index:e,pt:t})},chainAddTail:function(e,t){return n("chain_add_tail",{index:e,pt:t})},chainConnect:function(e,t){return n("chain_con",{index1:e,index2:t})},chainReverse:function(e){return n("chain_rev",{index:e})},chainJoin:function(e,t){return n("chain_join",{index1:e,index2:t})},done:function(){return n("done")}}}},{}],3:[function(e,t,r){t.exports=function(e){"number"!=typeof e&&(e=1e-10);var t={epsilon:function(t){return"number"==typeof t&&(e=t),e},pointAboveOrOnLine:function(t,r,n){var o=r[0],i=r[1],l=n[0],s=n[1],a=t[0];return(l-o)*(t[1]-i)-(s-i)*(a-o)>=-e},pointBetween:function(t,r,n){var o=t[1]-r[1],i=n[0]-r[0],l=t[0]-r[0],s=n[1]-r[1],a=l*i+o*s;return!(a<e)&&!(a-(i*i+s*s)>-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])<e},pointsSameY:function(t,r){return Math.abs(t[1]-r[1])<e},pointsSame:function(e,r){return t.pointsSameX(e,r)&&t.pointsSameY(e,r)},pointsCompare:function(e,r){return t.pointsSameX(e,r)?t.pointsSameY(e,r)?0:e[1]<r[1]?-1:1:e[0]<r[0]?-1:1},pointsCollinear:function(t,r,n){var o=t[0]-r[0],i=t[1]-r[1],l=r[0]-n[0],s=r[1]-n[1];return Math.abs(o*s-l*i)<e},linesIntersect:function(t,r,n,o){var i=r[0]-t[0],l=r[1]-t[1],s=o[0]-n[0],a=o[1]-n[1],h=i*a-l*s;if(Math.abs(h)<e)return!1;var u=t[0]-n[0],c=t[1]-n[1],f=(s*c-a*u)/h,d=(i*c-l*u)/h,p={alongA:0,alongB:0,pt:[t[0]+f*i,t[1]+f*l]};return p.alongA=f<=-e?-2:f<e?-1:f-1<=-e?0:f-1<e?1:2,p.alongB=d<=-e?-2:d<e?-1:d-1<=-e?0:d-1<e?1:2,p},pointInsideRegion:function(t,r){for(var n=t[0],o=t[1],i=r[r.length-1][0],l=r[r.length-1][1],s=!1,a=0;a<r.length;a++){var h=r[a][0],u=r[a][1];u-o>e!=l-o>e&&(i-h)*(o-u)/(l-u)+h-n>e&&(s=!s),i=h,l=u}return s}};return t}},{}],4:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),o=1;o<t.length;o++)n=e.selectDifference(e.combine(n,r(t[o])));return n}if("Polygon"===t.type)return e.polygon(r(t.coordinates));if("MultiPolygon"===t.type){for(var n=e.segments({inverted:!1,regions:[]}),o=0;o<t.coordinates.length;o++)n=e.selectUnion(e.combine(n,r(t.coordinates[o])));return e.polygon(n)}throw new Error("PolyBool: Cannot convert GeoJSON object to PolyBool polygon")},fromPolygon:function(e,t,r){function n(e,r){return t.pointInsideRegion([.5*(e[0][0]+e[1][0]),.5*(e[0][1]+e[1][1])],r)}function o(e){return{region:e,children:[]}}r=e.polygon(e.segments(r));var i=o(null);function l(e,t){for(var r=0;r<e.children.length;r++){if(n(t,(s=e.children[r]).region))return void l(s,t)}var i=o(t);for(r=0;r<e.children.length;r++){var s;n((s=e.children[r]).region,t)&&(i.children.push(s),e.children.splice(r,1),r--)}e.children.push(i)}for(var s=0;s<r.regions.length;s++){var a=r.regions[s];a.length<3||l(i,a)}function h(e,t){for(var r=0,n=e[e.length-1][0],o=e[e.length-1][1],i=[],l=0;l<e.length;l++){var s=e[l][0],a=e[l][1];i.push([s,a]),r+=a*n-s*o,n=s,o=a}return r<0!==t&&i.reverse(),i.push([i[0][0],i[0][1]]),i}var u=[];function c(e){var t=[h(e.region,!1)];u.push(t);for(var r=0;r<e.children.length;r++)t.push(f(e.children[r]))}function f(e){for(var t=0;t<e.children.length;t++)c(e.children[t]);return h(e.region,!0)}for(s=0;s<i.children.length;s++)c(i.children[s]);return u.length<=0?{type:"Polygon",coordinates:[]}:1==u.length?{type:"Polygon",coordinates:u[0]}:{type:"MultiPolygon",coordinates:u}}};t.exports=n},{}],5:[function(e,t,r){var n=e("./linked-list");t.exports=function(e,t,r){function o(e,t,n){return{id:r?r.segmentId():-1,start:e,end:t,myFill:{above:n.myFill.above,below:n.myFill.below},otherFill:null}}var i=n.create();function l(e,r){i.insertBefore(e,(function(n){return function(e,r,n,o,i,l){var s=t.pointsCompare(r,i);return 0!==s?s:t.pointsSame(n,l)?0:e!==o?e?1:-1:t.pointAboveOrOnLine(n,o?i:l,o?l:i)?1:-1}(e.isStart,e.pt,r,n.isStart,n.pt,n.other.pt)<0}))}function s(e,t){var r=function(e,t){var r=n.node({isStart:!0,pt:e.start,seg:e,primary:t,other:null,status:null});return l(r,e.end),r}(e,t);return function(e,t,r){var o=n.node({isStart:!1,pt:t.end,seg:t,primary:r,other:e,status:null});e.other=o,l(o,e.pt)}(r,e,t),r}function a(e,t){var n=o(t,e.seg.end,e.seg);return function(e,t){r&&r.segmentChop(e.seg,t),e.other.remove(),e.seg.end=t,e.other.pt=t,l(e.other,e.pt)}(e,t),s(n,e.primary)}function h(o,l){var s=n.create();function h(e){return s.findTransition((function(r){var n,o,i,l,s,a;return(n=e,o=r.ev,i=n.seg.start,l=n.seg.end,s=o.seg.start,a=o.seg.end,t.pointsCollinear(i,s,a)?t.pointsCollinear(l,s,a)||t.pointAboveOrOnLine(l,s,a)?1:-1:t.pointAboveOrOnLine(i,s,a)?1:-1)>0}))}function u(e,n){var o=e.seg,i=n.seg,l=o.start,s=o.end,h=i.start,u=i.end;r&&r.checkIntersection(o,i);var c=t.linesIntersect(l,s,h,u);if(!1===c){if(!t.pointsCollinear(l,s,h))return!1;if(t.pointsSame(l,u)||t.pointsSame(s,h))return!1;var f=t.pointsSame(l,h),d=t.pointsSame(s,u);if(f&&d)return n;var p=!f&&t.pointBetween(l,h,u),g=!d&&t.pointBetween(s,h,u);if(f)return g?a(n,s):a(e,u),n;p&&(d||(g?a(n,s):a(e,u)),a(n,l))}else 0===c.alongA&&(-1===c.alongB?a(e,h):0===c.alongB?a(e,c.pt):1===c.alongB&&a(e,u)),0===c.alongB&&(-1===c.alongA?a(n,l):0===c.alongA?a(n,c.pt):1===c.alongA&&a(n,s));return!1}for(var c=[];!i.isEmpty();){var f=i.getHead();if(r&&r.vert(f.pt[0]),f.isStart){r&&r.segmentNew(f.seg,f.primary);var d=h(f),p=d.before?d.before.ev:null,g=d.after?d.after.ev:null;function y(){if(p){var e=u(f,p);if(e)return e}return!!g&&u(f,g)}r&&r.tempStatus(f.seg,!!p&&p.seg,!!g&&g.seg);var v,x=y();if(x){var b;if(e)(b=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below)&&(x.seg.myFill.above=!x.seg.myFill.above);else x.seg.otherFill=f.seg.myFill;r&&r.segmentUpdate(x.seg),f.other.remove(),f.remove()}if(i.getHead()!==f){r&&r.rewind(f.seg);continue}if(e)b=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below,f.seg.myFill.below=g?g.seg.myFill.above:o,f.seg.myFill.above=b?!f.seg.myFill.below:f.seg.myFill.below;else if(null===f.seg.otherFill)v=g?f.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:f.primary?l:o,f.seg.otherFill={above:v,below:v};r&&r.status(f.seg,!!p&&p.seg,!!g&&g.seg),f.other.status=d.insert(n.node({ev:f}))}else{var m=f.status;if(null===m)throw new Error("Epsilon Issue");