wkx.min.js 63.4 KB
require=function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[s]={exports:{}};e[s][0].call(p.exports,function(t){var r=e[s][1][t];return i(r?r:t)},p,p.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){(function(t){function r(t,e){this.buffer=t,this.position=0,this.isBigEndian=e||!1}function n(t,e,r){return function(){var n;return n=this.isBigEndian?e.call(this.buffer,this.position):t.call(this.buffer,this.position),this.position+=r,n}}e.exports=r,r.prototype.readUInt8=n(t.prototype.readUInt8,t.prototype.readUInt8,1),r.prototype.readUInt16=n(t.prototype.readUInt16LE,t.prototype.readUInt16BE,2),r.prototype.readUInt32=n(t.prototype.readUInt32LE,t.prototype.readUInt32BE,4),r.prototype.readInt8=n(t.prototype.readInt8,t.prototype.readInt8,1),r.prototype.readInt16=n(t.prototype.readInt16LE,t.prototype.readInt16BE,2),r.prototype.readInt32=n(t.prototype.readInt32LE,t.prototype.readInt32BE,4),r.prototype.readFloat=n(t.prototype.readFloatLE,t.prototype.readFloatBE,4),r.prototype.readDouble=n(t.prototype.readDoubleLE,t.prototype.readDoubleBE,8),r.prototype.readVarInt=function(){var t,e=0,r=0;do t=this.buffer[this.position+r],e+=(127&t)<<7*r,r++;while(t>=128);return this.position+=r,e}}).call(this,t("buffer").Buffer)},{buffer:"buffer"}],2:[function(t,e,r){(function(t){function r(e,r){this.buffer=new t(e),this.position=0,this.allowResize=r}function n(t,e){return function(r,n){this.ensureSize(e),t.call(this.buffer,r,this.position,n),this.position+=e}}e.exports=r,r.prototype.writeUInt8=n(t.prototype.writeUInt8,1),r.prototype.writeUInt16LE=n(t.prototype.writeUInt16LE,2),r.prototype.writeUInt16BE=n(t.prototype.writeUInt16BE,2),r.prototype.writeUInt32LE=n(t.prototype.writeUInt32LE,4),r.prototype.writeUInt32BE=n(t.prototype.writeUInt32BE,4),r.prototype.writeInt8=n(t.prototype.writeInt8,1),r.prototype.writeInt16LE=n(t.prototype.writeInt16LE,2),r.prototype.writeInt16BE=n(t.prototype.writeInt16BE,2),r.prototype.writeInt32LE=n(t.prototype.writeInt32LE,4),r.prototype.writeInt32BE=n(t.prototype.writeInt32BE,4),r.prototype.writeFloatLE=n(t.prototype.writeFloatLE,4),r.prototype.writeFloatBE=n(t.prototype.writeFloatBE,4),r.prototype.writeDoubleLE=n(t.prototype.writeDoubleLE,8),r.prototype.writeDoubleBE=n(t.prototype.writeDoubleBE,8),r.prototype.writeBuffer=function(t){this.ensureSize(t.length),t.copy(this.buffer,this.position,0,t.length),this.position+=t.length},r.prototype.writeVarInt=function(t){for(var e=1;0!==(4294967168&t);)this.writeUInt8(127&t|128),t>>>=7,e++;return this.writeUInt8(127&t),e},r.prototype.ensureSize=function(e){if(this.buffer.length<this.position+e){if(!this.allowResize)throw new RangeError("index out of range");var r=new t(this.position+e);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}}}).call(this,t("buffer").Buffer)},{buffer:"buffer"}],3:[function(t,e,r){(function(r){function n(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}e.exports=n;var i=t("./types"),o=t("./point"),s=t("./linestring"),a=t("./polygon"),h=t("./multipoint"),u=t("./multilinestring"),p=t("./multipolygon"),f=t("./geometrycollection"),c=t("./binaryreader"),l=t("./binarywriter"),g=t("./wktparser"),y=t("./zigzag.js");n.parse=function(t,e){var i=typeof t;if("string"===i||t instanceof g)return n._parseWkt(t);if(r.isBuffer(t)||t instanceof c)return n._parseWkb(t,e);throw new Error("first argument must be a string or Buffer")},n._parseWkt=function(t){var e,r;e=t instanceof g?t:new g(t);var n=e.matchRegex([/^SRID=(\d+);/]);n&&(r=parseInt(n[1],10));var c=e.matchType(),l=e.matchDimension(),y={srid:r,hasZ:l.hasZ,hasM:l.hasM};switch(c){case i.wkt.Point:return o._parseWkt(e,y);case i.wkt.LineString:return s._parseWkt(e,y);case i.wkt.Polygon:return a._parseWkt(e,y);case i.wkt.MultiPoint:return h._parseWkt(e,y);case i.wkt.MultiLineString:return u._parseWkt(e,y);case i.wkt.MultiPolygon:return p._parseWkt(e,y);case i.wkt.GeometryCollection:return f._parseWkt(e,y)}},n._parseWkb=function(t,e){var r,n,l,g={};switch(r=t instanceof c?t:new c(t),r.isBigEndian=!r.readInt8(),n=r.readUInt32(),g.hasSrid=536870912===(536870912&n),g.isEwkb=536870912&n||1073741824&n||2147483648&n,g.hasSrid&&(g.srid=r.readUInt32()),g.hasZ=!1,g.hasM=!1,g.isEwkb||e&&e.isEwkb?(2147483648&n&&(g.hasZ=!0),1073741824&n&&(g.hasM=!0),l=15&n):n>=1e3&&n<2e3?(g.hasZ=!0,l=n-1e3):n>=2e3&&n<3e3?(g.hasM=!0,l=n-2e3):n>=3e3&&n<4e3?(g.hasZ=!0,g.hasM=!0,l=n-3e3):l=n,l){case i.wkb.Point:return o._parseWkb(r,g);case i.wkb.LineString:return s._parseWkb(r,g);case i.wkb.Polygon:return a._parseWkb(r,g);case i.wkb.MultiPoint:return h._parseWkb(r,g);case i.wkb.MultiLineString:return u._parseWkb(r,g);case i.wkb.MultiPolygon:return p._parseWkb(r,g);case i.wkb.GeometryCollection:return f._parseWkb(r,g);default:throw new Error("GeometryType "+l+" not supported")}},n.parseTwkb=function(t){var e,r={};e=t instanceof c?t:new c(t);var n=e.readUInt8(),l=e.readUInt8(),g=15&n;if(r.precision=y.decode(n>>4),r.precisionFactor=Math.pow(10,r.precision),r.hasBoundingBox=l>>0&1,r.hasSizeAttribute=l>>1&1,r.hasIdList=l>>2&1,r.hasExtendedPrecision=l>>3&1,r.isEmpty=l>>4&1,r.hasExtendedPrecision){var d=e.readUInt8();r.hasZ=1===(1&d),r.hasM=2===(2&d),r.zPrecision=y.decode((28&d)>>2),r.zPrecisionFactor=Math.pow(10,r.zPrecision),r.mPrecision=y.decode((224&d)>>5),r.mPrecisionFactor=Math.pow(10,r.mPrecision)}else r.hasZ=!1,r.hasM=!1;if(r.hasSizeAttribute&&e.readVarInt(),r.hasBoundingBox){var w=2;r.hasZ&&w++,r.hasM&&w++;for(var b=0;b<w;b++)e.readVarInt(),e.readVarInt()}switch(g){case i.wkb.Point:return o._parseTwkb(e,r);case i.wkb.LineString:return s._parseTwkb(e,r);case i.wkb.Polygon:return a._parseTwkb(e,r);case i.wkb.MultiPoint:return h._parseTwkb(e,r);case i.wkb.MultiLineString:return u._parseTwkb(e,r);case i.wkb.MultiPolygon:return p._parseTwkb(e,r);case i.wkb.GeometryCollection:return f._parseTwkb(e,r);default:throw new Error("GeometryType "+g+" not supported")}},n.parseGeoJSON=function(t){var e;switch(t.type){case i.geoJSON.Point:e=o._parseGeoJSON(t);break;case i.geoJSON.LineString:e=s._parseGeoJSON(t);break;case i.geoJSON.Polygon:e=a._parseGeoJSON(t);break;case i.geoJSON.MultiPoint:e=h._parseGeoJSON(t);break;case i.geoJSON.MultiLineString:e=u._parseGeoJSON(t);break;case i.geoJSON.MultiPolygon:e=p._parseGeoJSON(t);break;case i.geoJSON.GeometryCollection:e=f._parseGeoJSON(t);break;default:throw new Error("GeometryType "+t.type+" not supported")}if(t.crs&&t.crs.type&&"name"===t.crs.type&&t.crs.properties&&t.crs.properties.name){var r=t.crs.properties.name;if(0===r.indexOf("EPSG:"))e.srid=parseInt(r.substring(5));else{if(0!==r.indexOf("urn:ogc:def:crs:EPSG::"))throw new Error("Unsupported crs: "+r);e.srid=parseInt(r.substring(22))}}return e},n.prototype.toEwkt=function(){return"SRID="+this.srid+";"+this.toWkt()},n.prototype.toEwkb=function(){var t=new l(this._getWkbSize()+4),e=this.toWkb();return t.writeInt8(1),t.writeUInt32LE(536870912|e.slice(1,5).readUInt32LE(0),!0),t.writeUInt32LE(this.srid),t.writeBuffer(e.slice(5)),t.buffer},n.prototype._getWktType=function(t,e){var r=t;return this.hasZ&&this.hasM?r+=" ZM ":this.hasZ?r+=" Z ":this.hasM&&(r+=" M "),!e||this.hasZ||this.hasM||(r+=" "),e&&(r+="EMPTY"),r},n.prototype._getWktCoordinate=function(t){var e=t.x+" "+t.y;return this.hasZ&&(e+=" "+t.z),this.hasM&&(e+=" "+t.m),e},n.prototype._writeWkbType=function(t,e,r){var n=0;"undefined"!=typeof this.srid||r&&"undefined"!=typeof r.srid?(this.hasZ&&(n|=2147483648),this.hasM&&(n|=1073741824)):this.hasZ&&this.hasM?n+=3e3:this.hasZ?n+=1e3:this.hasM&&(n+=2e3),t.writeUInt32LE(n+e,!0)},n.getTwkbPrecision=function(t,e,r){return{xy:t,z:e,m:r,xyFactor:Math.pow(10,t),zFactor:Math.pow(10,e),mFactor:Math.pow(10,r)}},n.prototype._writeTwkbHeader=function(t,e,r,n){var i=(y.encode(r.xy)<<4)+e,o=(this.hasZ||this.hasM)<<3;if(o+=n<<4,t.writeUInt8(i),t.writeUInt8(o),this.hasZ||this.hasM){var s=0;this.hasZ&&(s|=1),this.hasM&&(s|=2),t.writeUInt8(s)}},n.prototype.toGeoJSON=function(t){var e={};return this.srid&&t&&(t.shortCrs?e.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:t.longCrs&&(e.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),e}}).call(this,{isBuffer:t("../node_modules/is-buffer/index.js")})},{"../node_modules/is-buffer/index.js":16,"./binaryreader":1,"./binarywriter":2,"./geometrycollection":4,"./linestring":5,"./multilinestring":6,"./multipoint":7,"./multipolygon":8,"./point":9,"./polygon":10,"./types":11,"./wktparser":12,"./zigzag.js":13}],4:[function(t,e,r){function n(t){s.call(this),this.geometries=t||[],this.geometries.length>0&&(this.hasZ=this.geometries[0].hasZ,this.hasM=this.geometries[0].hasM)}e.exports=n;var i=t("util"),o=t("./types"),s=t("./geometry"),a=t("./binarywriter");i.inherits(n,s),n.Z=function(t){var e=new n(t);return e.hasZ=!0,e},n.M=function(t){var e=new n(t);return e.hasM=!0,e},n.ZM=function(t){var e=new n(t);return e.hasZ=!0,e.hasM=!0,e},n._parseWkt=function(t,e){var r=new n;if(r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"]))return r;t.expectGroupStart();do r.geometries.push(s.parse(t));while(t.isMatch([","]));return t.expectGroupEnd(),r},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;for(var i=t.readUInt32(),o=0;o<i;o++)r.geometries.push(s.parse(t,e));return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=t.readVarInt(),o=0;o<i;o++)r.geometries.push(s.parseTwkb(t));return r},n._parseGeoJSON=function(t){for(var e=new n,r=0;r<t.geometries.length;r++)e.geometries.push(s.parseGeoJSON(t.geometries[r]));return e.geometries.length>0&&(e.hasZ=e.geometries[0].hasZ),e},n.prototype.toWkt=function(){if(0===this.geometries.length)return this._getWktType(o.wkt.GeometryCollection,!0);for(var t=this._getWktType(o.wkt.GeometryCollection,!1)+"(",e=0;e<this.geometries.length;e++)t+=this.geometries[e].toWkt()+",";return t=t.slice(0,-1),t+=")"},n.prototype.toWkb=function(){var t=new a(this._getWkbSize());t.writeInt8(1),this._writeWkbType(t,o.wkb.GeometryCollection),t.writeUInt32LE(this.geometries.length);for(var e=0;e<this.geometries.length;e++)t.writeBuffer(this.geometries[e].toWkb({srid:this.srid}));return t.buffer},n.prototype.toTwkb=function(){var t=new a(0,!0),e=s.getTwkbPrecision(5,0,0),r=0===this.geometries.length;if(this._writeTwkbHeader(t,o.wkb.GeometryCollection,e,r),this.geometries.length>0){t.writeVarInt(this.geometries.length);for(var n=0;n<this.geometries.length;n++)t.writeBuffer(this.geometries[n].toTwkb())}return t.buffer},n.prototype._getWkbSize=function(){for(var t=9,e=0;e<this.geometries.length;e++)t+=this.geometries[e]._getWkbSize();return t},n.prototype.toGeoJSON=function(t){var e=s.prototype.toGeoJSON.call(this,t);e.type=o.geoJSON.GeometryCollection,e.geometries=[];for(var r=0;r<this.geometries.length;r++)e.geometries.push(this.geometries[r].toGeoJSON());return e}},{"./binarywriter":2,"./geometry":3,"./types":11,util:21}],5:[function(t,e,r){function n(t){o.call(this),this.points=t||[],this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}e.exports=n;var i=t("util"),o=t("./geometry"),s=t("./types"),a=t("./point"),h=t("./binarywriter");i.inherits(n,o),n.Z=function(t){var e=new n(t);return e.hasZ=!0,e},n.M=function(t){var e=new n(t);return e.hasM=!0,e},n.ZM=function(t){var e=new n(t);return e.hasZ=!0,e.hasM=!0,e},n._parseWkt=function(t,e){var r=new n;return r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"])?r:(t.expectGroupStart(),r.points.push.apply(r.points,t.matchCoordinates(e)),t.expectGroupEnd(),r)},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;for(var i=t.readUInt32(),o=0;o<i;o++)r.points.push(a._readWkbPoint(t,e));return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=new a(0,0,e.hasZ?0:void 0,e.hasM?0:void 0),o=t.readVarInt(),s=0;s<o;s++)r.points.push(a._readTwkbPoint(t,e,i));return r},n._parseGeoJSON=function(t){var e=new n;t.coordinates.length>0&&(e.hasZ=t.coordinates[0].length>2);for(var r=0;r<t.coordinates.length;r++)e.points.push(a._readGeoJSONPoint(t.coordinates[r]));return e},n.prototype.toWkt=function(){return 0===this.points.length?this._getWktType(s.wkt.LineString,!0):this._getWktType(s.wkt.LineString,!1)+this._toInnerWkt()},n.prototype._toInnerWkt=function(){for(var t="(",e=0;e<this.points.length;e++)t+=this._getWktCoordinate(this.points[e])+",";return t=t.slice(0,-1),t+=")"},n.prototype.toWkb=function(t){var e=new h(this._getWkbSize());e.writeInt8(1),this._writeWkbType(e,s.wkb.LineString,t),e.writeUInt32LE(this.points.length);for(var r=0;r<this.points.length;r++)this.points[r]._writeWkbPoint(e);return e.buffer},n.prototype.toTwkb=function(){var t=new h(0,!0),e=o.getTwkbPrecision(5,0,0),r=0===this.points.length;if(this._writeTwkbHeader(t,s.wkb.LineString,e,r),this.points.length>0){t.writeVarInt(this.points.length);for(var n=new a(0,0,0,0),i=0;i<this.points.length;i++)this.points[i]._writeTwkbPoint(t,e,n)}return t.buffer},n.prototype._getWkbSize=function(){var t=16;return this.hasZ&&(t+=8),this.hasM&&(t+=8),9+this.points.length*t},n.prototype.toGeoJSON=function(t){var e=o.prototype.toGeoJSON.call(this,t);e.type=s.geoJSON.LineString,e.coordinates=[];for(var r=0;r<this.points.length;r++)this.hasZ?e.coordinates.push([this.points[r].x,this.points[r].y,this.points[r].z]):e.coordinates.push([this.points[r].x,this.points[r].y]);return e}},{"./binarywriter":2,"./geometry":3,"./point":9,"./types":11,util:21}],6:[function(t,e,r){function n(t){s.call(this),this.lineStrings=t||[],this.lineStrings.length>0&&(this.hasZ=this.lineStrings[0].hasZ,this.hasM=this.lineStrings[0].hasM)}e.exports=n;var i=t("util"),o=t("./types"),s=t("./geometry"),a=t("./point"),h=t("./linestring"),u=t("./binarywriter");i.inherits(n,s),n.Z=function(t){var e=new n(t);return e.hasZ=!0,e},n.M=function(t){var e=new n(t);return e.hasM=!0,e},n.ZM=function(t){var e=new n(t);return e.hasZ=!0,e.hasM=!0,e},n._parseWkt=function(t,e){var r=new n;if(r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"]))return r;t.expectGroupStart();do t.expectGroupStart(),r.lineStrings.push(new h(t.matchCoordinates(e))),t.expectGroupEnd();while(t.isMatch([","]));return t.expectGroupEnd(),r},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;for(var i=t.readUInt32(),o=0;o<i;o++)r.lineStrings.push(s.parse(t,e));return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=new a(0,0,e.hasZ?0:void 0,e.hasM?0:void 0),o=t.readVarInt(),s=0;s<o;s++){var u=new h;u.hasZ=e.hasZ,u.hasM=e.hasM;for(var p=t.readVarInt(),f=0;f<p;f++)u.points.push(a._readTwkbPoint(t,e,i));r.lineStrings.push(u)}return r},n._parseGeoJSON=function(t){var e=new n;t.coordinates.length>0&&t.coordinates[0].length>0&&(e.hasZ=t.coordinates[0][0].length>2);for(var r=0;r<t.coordinates.length;r++)e.lineStrings.push(h._parseGeoJSON({coordinates:t.coordinates[r]}));return e},n.prototype.toWkt=function(){if(0===this.lineStrings.length)return this._getWktType(o.wkt.MultiLineString,!0);for(var t=this._getWktType(o.wkt.MultiLineString,!1)+"(",e=0;e<this.lineStrings.length;e++)t+=this.lineStrings[e]._toInnerWkt()+",";return t=t.slice(0,-1),t+=")"},n.prototype.toWkb=function(){var t=new u(this._getWkbSize());t.writeInt8(1),this._writeWkbType(t,o.wkb.MultiLineString),t.writeUInt32LE(this.lineStrings.length);for(var e=0;e<this.lineStrings.length;e++)t.writeBuffer(this.lineStrings[e].toWkb({srid:this.srid}));return t.buffer},n.prototype.toTwkb=function(){var t=new u(0,!0),e=s.getTwkbPrecision(5,0,0),r=0===this.lineStrings.length;if(this._writeTwkbHeader(t,o.wkb.MultiLineString,e,r),this.lineStrings.length>0){t.writeVarInt(this.lineStrings.length);for(var n=new a(0,0,0,0),i=0;i<this.lineStrings.length;i++){t.writeVarInt(this.lineStrings[i].points.length);for(var h=0;h<this.lineStrings[i].points.length;h++)this.lineStrings[i].points[h]._writeTwkbPoint(t,e,n)}}return t.buffer},n.prototype._getWkbSize=function(){for(var t=9,e=0;e<this.lineStrings.length;e++)t+=this.lineStrings[e]._getWkbSize();return t},n.prototype.toGeoJSON=function(t){var e=s.prototype.toGeoJSON.call(this,t);e.type=o.geoJSON.MultiLineString,e.coordinates=[];for(var r=0;r<this.lineStrings.length;r++)e.coordinates.push(this.lineStrings[r].toGeoJSON().coordinates);return e}},{"./binarywriter":2,"./geometry":3,"./linestring":5,"./point":9,"./types":11,util:21}],7:[function(t,e,r){function n(t){s.call(this),this.points=t||[],this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}e.exports=n;var i=t("util"),o=t("./types"),s=t("./geometry"),a=t("./point"),h=t("./binarywriter");i.inherits(n,s),n.Z=function(t){var e=new n(t);return e.hasZ=!0,e},n.M=function(t){var e=new n(t);return e.hasM=!0,e},n.ZM=function(t){var e=new n(t);return e.hasZ=!0,e.hasM=!0,e},n._parseWkt=function(t,e){var r=new n;return r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"])?r:(t.expectGroupStart(),r.points.push.apply(r.points,t.matchCoordinates(e)),t.expectGroupEnd(),r)},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;for(var i=t.readUInt32(),o=0;o<i;o++)r.points.push(s.parse(t,e));return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=new a(0,0,e.hasZ?0:void 0,e.hasM?0:void 0),o=t.readVarInt(),s=0;s<o;s++)r.points.push(a._readTwkbPoint(t,e,i));return r},n._parseGeoJSON=function(t){var e=new n;t.coordinates.length>0&&(e.hasZ=t.coordinates[0].length>2);for(var r=0;r<t.coordinates.length;r++)e.points.push(a._parseGeoJSON({coordinates:t.coordinates[r]}));return e},n.prototype.toWkt=function(){if(0===this.points.length)return this._getWktType(o.wkt.MultiPoint,!0);for(var t=this._getWktType(o.wkt.MultiPoint,!1)+"(",e=0;e<this.points.length;e++)t+=this._getWktCoordinate(this.points[e])+",";return t=t.slice(0,-1),t+=")"},n.prototype.toWkb=function(){var t=new h(this._getWkbSize());t.writeInt8(1),this._writeWkbType(t,o.wkb.MultiPoint),t.writeUInt32LE(this.points.length);for(var e=0;e<this.points.length;e++)t.writeBuffer(this.points[e].toWkb({srid:this.srid}));return t.buffer},n.prototype.toTwkb=function(){var t=new h(0,!0),e=s.getTwkbPrecision(5,0,0),r=0===this.points.length;if(this._writeTwkbHeader(t,o.wkb.MultiPoint,e,r),this.points.length>0){t.writeVarInt(this.points.length);for(var n=new a(0,0,0,0),i=0;i<this.points.length;i++)this.points[i]._writeTwkbPoint(t,e,n)}return t.buffer},n.prototype._getWkbSize=function(){var t=16;return this.hasZ&&(t+=8),this.hasM&&(t+=8),t+=5,9+this.points.length*t},n.prototype.toGeoJSON=function(t){var e=s.prototype.toGeoJSON.call(this,t);e.type=o.geoJSON.MultiPoint,e.coordinates=[];for(var r=0;r<this.points.length;r++)e.coordinates.push(this.points[r].toGeoJSON().coordinates);return e}},{"./binarywriter":2,"./geometry":3,"./point":9,"./types":11,util:21}],8:[function(t,e,r){function n(t){s.call(this),this.polygons=t||[],this.polygons.length>0&&(this.hasZ=this.polygons[0].hasZ,this.hasM=this.polygons[0].hasM)}e.exports=n;var i=t("util"),o=t("./types"),s=t("./geometry"),a=t("./point"),h=t("./polygon"),u=t("./binarywriter");i.inherits(n,s),n.Z=function(t){var e=new n(t);return e.hasZ=!0,e},n.M=function(t){var e=new n(t);return e.hasM=!0,e},n.ZM=function(t){var e=new n(t);return e.hasZ=!0,e.hasM=!0,e},n._parseWkt=function(t,e){var r=new n;if(r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"]))return r;t.expectGroupStart();do{t.expectGroupStart();var i=[],o=[];for(t.expectGroupStart(),i.push.apply(i,t.matchCoordinates(e)),t.expectGroupEnd();t.isMatch([","]);)t.expectGroupStart(),o.push(t.matchCoordinates(e)),t.expectGroupEnd();r.polygons.push(new h(i,o)),t.expectGroupEnd()}while(t.isMatch([","]));return t.expectGroupEnd(),r},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;for(var i=t.readUInt32(),o=0;o<i;o++)r.polygons.push(s.parse(t,e));return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=new a(0,0,e.hasZ?0:void 0,e.hasM?0:void 0),o=t.readVarInt(),s=0;s<o;s++){var u=new h;u.hasZ=e.hasZ,u.hasM=e.hasM;for(var p=t.readVarInt(),f=t.readVarInt(),c=0;c<f;c++)u.exteriorRing.push(a._readTwkbPoint(t,e,i));for(c=1;c<p;c++){for(var l=[],g=t.readVarInt(),y=0;y<g;y++)l.push(a._readTwkbPoint(t,e,i));u.interiorRings.push(l)}r.polygons.push(u)}return r},n._parseGeoJSON=function(t){var e=new n;t.coordinates.length>0&&t.coordinates[0].length>0&&t.coordinates[0][0].length>0&&(e.hasZ=t.coordinates[0][0][0].length>2);for(var r=0;r<t.coordinates.length;r++)e.polygons.push(h._parseGeoJSON({coordinates:t.coordinates[r]}));return e},n.prototype.toWkt=function(){if(0===this.polygons.length)return this._getWktType(o.wkt.MultiPolygon,!0);for(var t=this._getWktType(o.wkt.MultiPolygon,!1)+"(",e=0;e<this.polygons.length;e++)t+=this.polygons[e]._toInnerWkt()+",";return t=t.slice(0,-1),t+=")"},n.prototype.toWkb=function(){var t=new u(this._getWkbSize());t.writeInt8(1),this._writeWkbType(t,o.wkb.MultiPolygon),t.writeUInt32LE(this.polygons.length);for(var e=0;e<this.polygons.length;e++)t.writeBuffer(this.polygons[e].toWkb({srid:this.srid}));return t.buffer},n.prototype.toTwkb=function(){var t=new u(0,!0),e=s.getTwkbPrecision(5,0,0),r=0===this.polygons.length;if(this._writeTwkbHeader(t,o.wkb.MultiPolygon,e,r),this.polygons.length>0){t.writeVarInt(this.polygons.length);for(var n=new a(0,0,0,0),i=0;i<this.polygons.length;i++){t.writeVarInt(1+this.polygons[i].interiorRings.length),t.writeVarInt(this.polygons[i].exteriorRing.length);for(var h=0;h<this.polygons[i].exteriorRing.length;h++)this.polygons[i].exteriorRing[h]._writeTwkbPoint(t,e,n);for(h=0;h<this.polygons[i].interiorRings.length;h++){t.writeVarInt(this.polygons[i].interiorRings[h].length);for(var p=0;p<this.polygons[i].interiorRings[h].length;p++)this.polygons[i].interiorRings[h][p]._writeTwkbPoint(t,e,n)}}}return t.buffer},n.prototype._getWkbSize=function(){for(var t=9,e=0;e<this.polygons.length;e++)t+=this.polygons[e]._getWkbSize();return t},n.prototype.toGeoJSON=function(t){var e=s.prototype.toGeoJSON.call(this,t);e.type=o.geoJSON.MultiPolygon,e.coordinates=[];for(var r=0;r<this.polygons.length;r++)e.coordinates.push(this.polygons[r].toGeoJSON().coordinates);return e}},{"./binarywriter":2,"./geometry":3,"./point":9,"./polygon":10,"./types":11,util:21}],9:[function(t,e,r){function n(t,e,r,n){o.call(this),this.x=t,this.y=e,this.z=r,this.m=n,this.hasZ="undefined"!=typeof this.z,this.hasM="undefined"!=typeof this.m}e.exports=n;var i=t("util"),o=t("./geometry"),s=t("./types"),a=t("./binarywriter"),h=t("./zigzag.js");i.inherits(n,o),n.Z=function(t,e,r){var i=new n(t,e,r);return i.hasZ=!0,i},n.M=function(t,e,r){var i=new n(t,e,void 0,r);return i.hasM=!0,i},n.ZM=function(t,e,r,i){var o=new n(t,e,r,i);return o.hasZ=!0,o.hasM=!0,o},n._parseWkt=function(t,e){var r=new n;if(r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"]))return r;t.expectGroupStart();var i=t.matchCoordinate(e);return r.x=i.x,r.y=i.y,r.z=i.z,r.m=i.m,t.expectGroupEnd(),r},n._parseWkb=function(t,e){var r=n._readWkbPoint(t,e);return r.srid=e.srid,r},n._readWkbPoint=function(t,e){return new n(t.readDouble(),t.readDouble(),e.hasZ?t.readDouble():void 0,e.hasM?t.readDouble():void 0)},n._parseTwkb=function(t,e){var r=new n;return r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty?r:(r.x=h.decode(t.readVarInt())/e.precisionFactor,r.y=h.decode(t.readVarInt())/e.precisionFactor,r.z=e.hasZ?h.decode(t.readVarInt())/e.zPrecisionFactor:void 0,r.m=e.hasM?h.decode(t.readVarInt())/e.mPrecisionFactor:void 0,r)},n._readTwkbPoint=function(t,e,r){return r.x+=h.decode(t.readVarInt())/e.precisionFactor,r.y+=h.decode(t.readVarInt())/e.precisionFactor,e.hasZ&&(r.z+=h.decode(t.readVarInt())/e.zPrecisionFactor),e.hasM&&(r.m+=h.decode(t.readVarInt())/e.mPrecisionFactor),new n(r.x,r.y,r.z,r.m)},n._parseGeoJSON=function(t){return n._readGeoJSONPoint(t.coordinates)},n._readGeoJSONPoint=function(t){return 0===t.length?new n:t.length>2?new n(t[0],t[1],t[2]):new n(t[0],t[1])},n.prototype.toWkt=function(){return"undefined"==typeof this.x&&"undefined"==typeof this.y&&"undefined"==typeof this.z&&"undefined"==typeof this.m?this._getWktType(s.wkt.Point,!0):this._getWktType(s.wkt.Point,!1)+"("+this._getWktCoordinate(this)+")"},n.prototype.toWkb=function(t){var e=new a(this._getWkbSize());return e.writeInt8(1),this._writeWkbType(e,s.wkb.Point,t),"undefined"==typeof this.x&&"undefined"==typeof this.y?(e.writeDoubleLE(NaN),e.writeDoubleLE(NaN),this.hasZ&&e.writeDoubleLE(NaN),this.hasM&&e.writeDoubleLE(NaN)):this._writeWkbPoint(e),e.buffer},n.prototype._writeWkbPoint=function(t){t.writeDoubleLE(this.x),t.writeDoubleLE(this.y),this.hasZ&&t.writeDoubleLE(this.z),this.hasM&&t.writeDoubleLE(this.m)},n.prototype.toTwkb=function(){var t=new a(0,!0),e=o.getTwkbPrecision(5,0,0),r="undefined"==typeof this.x&&"undefined"==typeof this.y;return this._writeTwkbHeader(t,s.wkb.Point,e,r),r||this._writeTwkbPoint(t,e,new n(0,0,0,0)),t.buffer},n.prototype._writeTwkbPoint=function(t,e,r){var n=this.x*e.xyFactor,i=this.y*e.xyFactor,o=this.z*e.zFactor,s=this.m*e.mFactor;t.writeVarInt(h.encode(n-r.x)),t.writeVarInt(h.encode(i-r.y)),this.hasZ&&t.writeVarInt(h.encode(o-r.z)),this.hasM&&t.writeVarInt(h.encode(s-r.m)),r.x=n,r.y=i,r.z=o,r.m=s},n.prototype._getWkbSize=function(){var t=21;return this.hasZ&&(t+=8),this.hasM&&(t+=8),t},n.prototype.toGeoJSON=function(t){var e=o.prototype.toGeoJSON.call(this,t);return e.type=s.geoJSON.Point,"undefined"==typeof this.x&&"undefined"==typeof this.y?e.coordinates=[]:"undefined"!=typeof this.z?e.coordinates=[this.x,this.y,this.z]:e.coordinates=[this.x,this.y],e}},{"./binarywriter":2,"./geometry":3,"./types":11,"./zigzag.js":13,util:21}],10:[function(t,e,r){function n(t,e){o.call(this),this.exteriorRing=t||[],this.interiorRings=e||[],this.exteriorRing.length>0&&(this.hasZ=this.exteriorRing[0].hasZ,this.hasM=this.exteriorRing[0].hasM)}e.exports=n;var i=t("util"),o=t("./geometry"),s=t("./types"),a=t("./point"),h=t("./binarywriter");i.inherits(n,o),n.Z=function(t,e){var r=new n(t,e);return r.hasZ=!0,r},n.M=function(t,e){var r=new n(t,e);return r.hasM=!0,r},n.ZM=function(t,e){var r=new n(t,e);return r.hasZ=!0,r.hasM=!0,r},n._parseWkt=function(t,e){var r=new n;if(r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM,t.isMatch(["EMPTY"]))return r;for(t.expectGroupStart(),t.expectGroupStart(),r.exteriorRing.push.apply(r.exteriorRing,t.matchCoordinates(e)),t.expectGroupEnd();t.isMatch([","]);)t.expectGroupStart(),r.interiorRings.push(t.matchCoordinates(e)),t.expectGroupEnd();return t.expectGroupEnd(),r},n._parseWkb=function(t,e){var r=new n;r.srid=e.srid,r.hasZ=e.hasZ,r.hasM=e.hasM;var i=t.readUInt32();if(i>0){for(var o=t.readUInt32(),s=0;s<o;s++)r.exteriorRing.push(a._readWkbPoint(t,e));for(s=1;s<i;s++){for(var h=[],u=t.readUInt32(),p=0;p<u;p++)h.push(a._readWkbPoint(t,e));r.interiorRings.push(h)}}return r},n._parseTwkb=function(t,e){var r=new n;if(r.hasZ=e.hasZ,r.hasM=e.hasM,e.isEmpty)return r;for(var i=new a(0,0,e.hasZ?0:void 0,e.hasM?0:void 0),o=t.readVarInt(),s=t.readVarInt(),h=0;h<s;h++)r.exteriorRing.push(a._readTwkbPoint(t,e,i));for(h=1;h<o;h++){for(var u=[],p=t.readVarInt(),f=0;f<p;f++)u.push(a._readTwkbPoint(t,e,i));r.interiorRings.push(u)}return r},n._parseGeoJSON=function(t){var e=new n;t.coordinates.length>0&&t.coordinates[0].length>0&&(e.hasZ=t.coordinates[0][0].length>2);for(var r=0;r<t.coordinates.length;r++){r>0&&e.interiorRings.push([]);for(var i=0;i<t.coordinates[r].length;i++)0===r?e.exteriorRing.push(a._readGeoJSONPoint(t.coordinates[r][i])):e.interiorRings[r-1].push(a._readGeoJSONPoint(t.coordinates[r][i]))}return e},n.prototype.toWkt=function(){return 0===this.exteriorRing.length?this._getWktType(s.wkt.Polygon,!0):this._getWktType(s.wkt.Polygon,!1)+this._toInnerWkt()},n.prototype._toInnerWkt=function(){for(var t="((",e=0;e<this.exteriorRing.length;e++)t+=this._getWktCoordinate(this.exteriorRing[e])+",";for(t=t.slice(0,-1),t+=")",e=0;e<this.interiorRings.length;e++){t+=",(";for(var r=0;r<this.interiorRings[e].length;r++)t+=this._getWktCoordinate(this.interiorRings[e][r])+",";t=t.slice(0,-1),t+=")"}return t+=")"},n.prototype.toWkb=function(t){var e=new h(this._getWkbSize());e.writeInt8(1),this._writeWkbType(e,s.wkb.Polygon,t),this.exteriorRing.length>0?(e.writeUInt32LE(1+this.interiorRings.length),e.writeUInt32LE(this.exteriorRing.length)):e.writeUInt32LE(0);for(var r=0;r<this.exteriorRing.length;r++)this.exteriorRing[r]._writeWkbPoint(e);for(r=0;r<this.interiorRings.length;r++){e.writeUInt32LE(this.interiorRings[r].length);for(var n=0;n<this.interiorRings[r].length;n++)this.interiorRings[r][n]._writeWkbPoint(e)}return e.buffer},n.prototype.toTwkb=function(){var t=new h(0,!0),e=o.getTwkbPrecision(5,0,0),r=0===this.exteriorRing.length;if(this._writeTwkbHeader(t,s.wkb.Polygon,e,r),this.exteriorRing.length>0){t.writeVarInt(1+this.interiorRings.length),t.writeVarInt(this.exteriorRing.length);for(var n=new a(0,0,0,0),i=0;i<this.exteriorRing.length;i++)this.exteriorRing[i]._writeTwkbPoint(t,e,n);for(i=0;i<this.interiorRings.length;i++){t.writeVarInt(this.interiorRings[i].length);for(var u=0;u<this.interiorRings[i].length;u++)this.interiorRings[i][u]._writeTwkbPoint(t,e,n)}}return t.buffer},n.prototype._getWkbSize=function(){var t=16;this.hasZ&&(t+=8),this.hasM&&(t+=8);var e=9;this.exteriorRing.length>0&&(e+=4+this.exteriorRing.length*t);for(var r=0;r<this.interiorRings.length;r++)e+=4+this.interiorRings[r].length*t;return e},n.prototype.toGeoJSON=function(t){var e=o.prototype.toGeoJSON.call(this,t);if(e.type=s.geoJSON.Polygon,e.coordinates=[],this.exteriorRing.length>0){for(var r=[],n=0;n<this.exteriorRing.length;n++)this.hasZ?r.push([this.exteriorRing[n].x,this.exteriorRing[n].y,this.exteriorRing[n].z]):r.push([this.exteriorRing[n].x,this.exteriorRing[n].y]);e.coordinates.push(r)}for(var i=0;i<this.interiorRings.length;i++){for(var a=[],h=0;h<this.interiorRings[i].length;h++)this.hasZ?a.push([this.interiorRings[i][h].x,this.interiorRings[i][h].y,this.interiorRings[i][h].z]):a.push([this.interiorRings[i][h].x,this.interiorRings[i][h].y]);e.coordinates.push(a)}return e}},{"./binarywriter":2,"./geometry":3,"./point":9,"./types":11,util:21}],11:[function(t,e,r){e.exports={wkt:{Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION"},wkb:{Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6,GeometryCollection:7},geoJSON:{Point:"Point",LineString:"LineString",Polygon:"Polygon",MultiPoint:"MultiPoint",MultiLineString:"MultiLineString",MultiPolygon:"MultiPolygon",GeometryCollection:"GeometryCollection"}}},{}],12:[function(t,e,r){function n(t){this.value=t,this.position=0}e.exports=n;var i=t("./types"),o=t("./point");n.prototype.match=function(t){this.skipWhitespaces();for(var e=0;e<t.length;e++)if(0===this.value.substring(this.position).indexOf(t[e]))return this.position+=t[e].length,t[e];return null},n.prototype.matchRegex=function(t){this.skipWhitespaces();for(var e=0;e<t.length;e++){var r=this.value.substring(this.position).match(t[e]);if(r)return this.position+=r[0].length,r}return null},n.prototype.isMatch=function(t){this.skipWhitespaces();for(var e=0;e<t.length;e++)if(0===this.value.substring(this.position).indexOf(t[e]))return this.position+=t[e].length,!0;return!1},n.prototype.matchType=function(){var t=this.match([i.wkt.Point,i.wkt.LineString,i.wkt.Polygon,i.wkt.MultiPoint,i.wkt.MultiLineString,i.wkt.MultiPolygon,i.wkt.GeometryCollection]);if(!t)throw new Error("Expected geometry type");return t},n.prototype.matchDimension=function(){var t=this.match(["ZM","Z","M"]);switch(t){case"ZM":return{hasZ:!0,hasM:!0};case"Z":return{hasZ:!0,hasM:!1};case"M":
return{hasZ:!1,hasM:!0};default:return{hasZ:!1,hasM:!1}}},n.prototype.expectGroupStart=function(){if(!this.isMatch(["("]))throw new Error("Expected group start")},n.prototype.expectGroupEnd=function(){if(!this.isMatch([")"]))throw new Error("Expected group end")},n.prototype.matchCoordinate=function(t){var e;if(e=t.hasZ&&t.hasM?this.matchRegex([/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)/]):t.hasZ||t.hasM?this.matchRegex([/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)/]):this.matchRegex([/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)/]),!e)throw new Error("Expected coordinates");return t.hasZ&&t.hasM?new o(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]),parseFloat(e[4])):t.hasZ?new o(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])):t.hasM?new o(parseFloat(e[1]),parseFloat(e[2]),void 0,parseFloat(e[3])):new o(parseFloat(e[1]),parseFloat(e[2]))},n.prototype.matchCoordinates=function(t){var e=[];do{var r=this.isMatch(["("]);e.push(this.matchCoordinate(t)),r&&this.expectGroupEnd()}while(this.isMatch([","]));return e},n.prototype.skipWhitespaces=function(){for(;this.position<this.value.length&&" "===this.value[this.position];)this.position++}},{"./point":9,"./types":11}],13:[function(t,e,r){e.exports={encode:function(t){return t<<1^t>>31},decode:function(t){return t>>1^-(1&t)}}},{}],14:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function o(t){var e,r,i,o,s,a,h=t.length;s=n(t),a=new f(3*h/4-s),i=s>0?h-4:h;var u=0;for(e=0,r=0;e<i;e+=4,r+=3)o=p[t.charCodeAt(e)]<<18|p[t.charCodeAt(e+1)]<<12|p[t.charCodeAt(e+2)]<<6|p[t.charCodeAt(e+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=255&o;return 2===s?(o=p[t.charCodeAt(e)]<<2|p[t.charCodeAt(e+1)]>>4,a[u++]=255&o):1===s&&(o=p[t.charCodeAt(e)]<<10|p[t.charCodeAt(e+1)]<<4|p[t.charCodeAt(e+2)]>>2,a[u++]=o>>8&255,a[u++]=255&o),a}function s(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(s(n));return i.join("")}function h(t){for(var e,r=t.length,n=r%3,i="",o=[],s=16383,h=0,p=r-n;h<p;h+=s)o.push(a(t,h,h+s>p?p:h+s));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=i,r.toByteArray=o,r.fromByteArray=h;for(var u=[],p=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,g=c.length;l<g;++l)u[l]=c[l],p[c.charCodeAt(l)]=l;p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63},{}],15:[function(t,e,r){r.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,h=(1<<a)-1,u=h>>1,p=-7,f=r?i-1:0,c=r?-1:1,l=t[e+f];for(f+=c,o=l&(1<<-p)-1,l>>=-p,p+=a;p>0;o=256*o+t[e+f],f+=c,p-=8);for(s=o&(1<<-p)-1,o>>=-p,p+=n;p>0;s=256*s+t[e+f],f+=c,p-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:(l?-1:1)*(1/0);s+=Math.pow(2,n),o-=u}return(l?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,a,h,u=8*o-i-1,p=(1<<u)-1,f=p>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,g=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),e+=s+f>=1?c/h:c*Math.pow(2,1-f),e*h>=2&&(s++,h/=2),s+f>=p?(a=0,s=p):s+f>=1?(a=(e*h-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+l]=255&a,l+=g,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+l]=255&s,l+=g,s/=256,u-=8);t[r+l-g]|=128*y}},{}],16:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function i(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}e.exports=function(t){return null!=t&&(n(t)||i(t)||!!t._isBuffer)}},{}],17:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],18:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function s(t){if(c===clearTimeout)return clearTimeout(t);if((c===i||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(t);try{return c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}function a(){d&&g&&(d=!1,g.length?y=g.concat(y):w=-1,y.length&&h())}function h(){if(!d){var t=o(a);d=!0;for(var e=y.length;e;){for(g=y,y=[];++w<e;)g&&g[w].run();w=-1,e=y.length}g=null,d=!1,s(t)}}function u(t,e){this.fun=t,this.array=e}function p(){}var f,c,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(t){f=n}try{c="function"==typeof clearTimeout?clearTimeout:i}catch(t){c=i}}();var g,y=[],d=!1,w=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];y.push(new u(t,e)),1!==y.length||d||o(h)},u.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=p,l.addListener=p,l.once=p,l.off=p,l.removeListener=p,l.removeAllListeners=p,l.emit=p,l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],19:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],20:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],21:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(e)?n.showHidden=e:e&&r._extend(n,e),k(n.showHidden)&&(n.showHidden=!1),k(n.depth)&&(n.depth=2),k(n.colors)&&(n.colors=!1),k(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),h(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function s(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function h(t,e,n){if(t.customInspect&&e&&P(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=h(t,i,n)),i}var o=u(t,e);if(o)return o;var s=Object.keys(e),y=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),S(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(e);if(0===s.length){if(P(e)){var d=e.name?": "+e.name:"";return t.stylize("[Function"+d+"]","special")}if(_(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(E(e))return t.stylize(Date.prototype.toString.call(e),"date");if(S(e))return p(e)}var w="",b=!1,m=["{","}"];if(g(e)&&(b=!0,m=["[","]"]),P(e)){var k=e.name?": "+e.name:"";w=" [Function"+k+"]"}if(_(e)&&(w=" "+RegExp.prototype.toString.call(e)),E(e)&&(w=" "+Date.prototype.toUTCString.call(e)),S(e)&&(w=" "+p(e)),0===s.length&&(!b||0==e.length))return m[0]+w+m[1];if(n<0)return _(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=b?f(t,e,n,y,s):s.map(function(r){return c(t,e,n,y,r,b)}),t.seen.pop(),l(M,w,m)}function u(t,e){if(k(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):y(e)?t.stylize(""+e,"boolean"):d(e)?t.stylize("null","null"):void 0}function p(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)Z(e,String(s))?o.push(c(t,e,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(c(t,e,r,n,i,!0))}),o}function c(t,e,r,n,i,o){var s,a,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),Z(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=d(r)?h(t,u.value,null):h(t,u.value,r-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(t){return"  "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return"   "+t}).join("\n"))):a=t.stylize("[Circular]","special")),k(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function l(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n  ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function g(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function d(t){return null===t}function w(t){return null==t}function b(t){return"number"==typeof t}function v(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function k(t){return void 0===t}function _(t){return M(t)&&"[object RegExp]"===T(t)}function M(t){return"object"==typeof t&&null!==t}function E(t){return M(t)&&"[object Date]"===T(t)}function S(t){return M(t)&&("[object Error]"===T(t)||t instanceof Error)}function P(t){return"function"==typeof t}function I(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function T(t){return Object.prototype.toString.call(t)}function x(t){return t<10?"0"+t.toString(10):t.toString(10)}function R(){var t=new Date,e=[x(t.getHours()),x(t.getMinutes()),x(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function Z(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var O=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(i(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(t).replace(O,function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),a=n[r];r<o;a=n[++r])s+=d(a)||!M(a)?" "+a:" "+i(a);return s},r.deprecate=function(t,i){function o(){if(!s){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),s=!0}return t.apply(this,arguments)}if(k(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var s=!1;return o};var W,U={};r.debuglog=function(t){if(k(W)&&(W=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!U[t])if(new RegExp("\\b"+t+"\\b","i").test(W)){var n=e.pid;U[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else U[t]=function(){};return U[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=g,r.isBoolean=y,r.isNull=d,r.isNullOrUndefined=w,r.isNumber=b,r.isString=v,r.isSymbol=m,r.isUndefined=k,r.isRegExp=_,r.isObject=M,r.isDate=E,r.isError=S,r.isFunction=P,r.isPrimitive=I,r.isBuffer=t("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",R(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":20,_process:18,inherits:19}],buffer:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=s.prototype):(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return p(this,t)}return a(this,t,e,r)}function a(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?l(t,e,r,n):"string"==typeof e?f(t,e,r):g(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function u(t,e,r,n){return h(e),e<=0?o(t,e):void 0!==r?"string"==typeof n?o(t,e).fill(r,n):o(t,e).fill(r):o(t,e)}function p(t,e){if(h(e),t=o(t,e<0?0:0|y(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|w(e,r);t=o(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function c(t,e){var r=e.length<0?0:0|y(e.length);t=o(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),s.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=s.prototype):t=c(t,e),t}function g(t,e){if(s.isBuffer(e)){var r=0|y(e.length);return t=o(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||$(e.length)?o(t,0):c(t,e);if("Buffer"===e.type&&Q(e.data))return c(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),s.alloc(+t)}function w(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return W(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return Z(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:k(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):k(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function k(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,h=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}var u;if(i){var p=-1;for(u=r;u<a;u++)if(o(t,u)===o(e,p===-1?0:u-p)){if(p===-1&&(p=u),u-p+1===h)return p*s}else p!==-1&&(u-=u-p),p=-1}else for(r+h>a&&(r=a-h),u=r;u>=0;u--){for(var f=!0,c=0;c<h;c++)if(o(t,u+c)!==o(e,c)){f=!1;break}if(f)return u}return-1}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function M(t,e,r,n){return q(F(e,t.length-r),t,r,n)}function E(t,e,r,n){return q(V(e),t,r,n)}function S(t,e,r,n){return E(t,e,r,n)}function P(t,e,r,n){return q(H(e),t,r,n)}function I(t,e,r,n){return q(j(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var h,u,p,f;switch(a){case 1:o<128&&(s=o);break;case 2:h=t[i+1],128===(192&h)&&(f=(31&o)<<6|63&h,f>127&&(s=f));break;case 3:h=t[i+1],u=t[i+2],128===(192&h)&&128===(192&u)&&(f=(15&o)<<12|(63&h)<<6|63&u,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:h=t[i+1],u=t[i+2],p=t[i+3],128===(192&h)&&128===(192&u)&&128===(192&p)&&(f=(15&o)<<18|(63&h)<<12|(63&u)<<6|63&p,f>65535&&f<1114112&&(s=f))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return R(n)}function R(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return r}function Z(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function W(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Y(t[o]);return i}function U(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function G(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function C(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function J(t){if(t=D(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function D(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function j(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function H(t){return X.toByteArray(J(t))}function q(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function $(t){return t!==t}var X=t("base64-js"),K=t("ieee754"),Q=t("isarray");r.Buffer=s,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return a(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return u(null,t,e,r)},s.allocUnsafe=function(t){return p(null,t)},s.allocUnsafeSlow=function(t){return p(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=w,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):b.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,h=Math.min(o,a),u=this.slice(n,i),p=t.slice(e,r),f=0;f<h;++f)if(u[f]!==p[f]){o=u[f],a=p[f];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},s.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return M(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return P(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var n;if(s.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=s.prototype;else{var i=e-t;n=new s(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},s.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||A(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||A(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||A(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||A(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||A(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},s.prototype.readInt16LE=function(t,e){e||A(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||A(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),K.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),K.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),K.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),K.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;L(this,t,e,r,i,0)}var o=1,s=0;for(this[e]=255&t;++s<r&&(o*=256);)this[e+s]=t/o&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;L(this,t,e,r,i,0)}var o=r-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):G(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):G(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return C(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return C(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");
if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=s.isBuffer(t)?t:F(new s(t,n).toString()),h=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%h]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":14,ieee754:15,isarray:17}],wkx:[function(t,e,r){r.Types=t("./types"),r.Geometry=t("./geometry"),r.Point=t("./point"),r.LineString=t("./linestring"),r.Polygon=t("./polygon"),r.MultiPoint=t("./multipoint"),r.MultiLineString=t("./multilinestring"),r.MultiPolygon=t("./multipolygon"),r.GeometryCollection=t("./geometrycollection")},{"./geometry":3,"./geometrycollection":4,"./linestring":5,"./multilinestring":6,"./multipoint":7,"./multipolygon":8,"./point":9,"./polygon":10,"./types":11}]},{},["wkx"]);