@loaders.gl/flatgeobuf
Advanced tools
Comparing version 3.0.0-alpha.18 to 3.0.0-alpha.19
@@ -96,3 +96,3 @@ /******/ (function(modules) { // webpackBootstrap | ||
!function(t,e){ true?e(exports):undefined}(this,(function(t){"use strict";var e,i,r={};r.SIZEOF_SHORT=2,r.SIZEOF_INT=4,r.FILE_IDENTIFIER_LENGTH=4,r.SIZE_PREFIX_LENGTH=4,r.Encoding={UTF8_BYTES:1,UTF16_STRING:2},r.int32=new Int32Array(2),r.float32=new Float32Array(r.int32.buffer),r.float64=new Float64Array(r.int32.buffer),r.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],r.Long=function(t,e){this.low=0|t,this.high=0|e},r.Long.create=function(t,e){return 0==t&&0==e?r.Long.ZERO:new r.Long(t,e)},r.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},r.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},r.Long.ZERO=new r.Long(0,0),r.Builder=function(t){if(t)e=t;else var e=1024;this.bb=r.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},r.Builder.prototype.dataBuffer=function(){return this.bb},r.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},r.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var i=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<i+t+e;){var s=this.bb.capacity();this.bb=r.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)},r.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},r.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},r.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},r.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},r.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},r.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},r.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},r.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},r.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},r.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},r.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},r.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},r.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},r.Builder.prototype.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},r.Builder.prototype.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},r.Builder.prototype.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},r.Builder.prototype.addFieldInt64=function(t,e,i){!this.force_defaults&&e.equals(i)||(this.addInt64(e),this.slot(t))},r.Builder.prototype.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},r.Builder.prototype.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},r.Builder.prototype.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},r.Builder.prototype.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},r.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},r.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},r.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},r.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},r.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,s=r.ByteBuffer.allocate(i);return s.setPosition(i-e),s.bytes().set(t.bytes(),i-e),s},r.Builder.prototype.addOffset=function(t){this.prep(r.SIZEOF_INT,0),this.writeInt32(this.offset()-t+r.SIZEOF_INT)},r.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},r.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var s=(i+2)*r.SIZEOF_SHORT;this.addInt16(s);var n=0,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(a)){for(var b=r.SIZEOF_SHORT;b<s;b+=r.SIZEOF_SHORT)if(this.bb.readInt16(o+b)!=this.bb.readInt16(a+b))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},r.Builder.prototype.finish=function(t,e,i){var s=i?r.SIZE_PREFIX_LENGTH:0;if(e){var n=e;if(this.prep(this.minalign,r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH+s),n.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var o=r.FILE_IDENTIFIER_LENGTH-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,r.SIZEOF_INT+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},r.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},r.Builder.prototype.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(0!=this.bb.readInt16(r+e)))throw new Error("FlatBuffers: field "+e+" must be set")},r.Builder.prototype.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(r.SIZEOF_INT,t*e),this.prep(i,t*e)},r.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},r.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var i=0;i<t.length;){var r,s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else r=(s<<10)+t.charCodeAt(i++)+-56613888;r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);i=0;for(var n=this.space,o=this.bb.bytes();i<e.length;i++)o[n++]=e[i];return this.endVector()},r.Builder.prototype.createLong=function(t,e){return r.Long.create(t,e)},r.ByteBuffer=function(t){this.bytes_=t,this.position_=0},r.ByteBuffer.allocate=function(t){return new r.ByteBuffer(new Uint8Array(t))},r.ByteBuffer.prototype.clear=function(){this.position_=0},r.ByteBuffer.prototype.bytes=function(){return this.bytes_},r.ByteBuffer.prototype.position=function(){return this.position_},r.ByteBuffer.prototype.setPosition=function(t){this.position_=t},r.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},r.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},r.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},r.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},r.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},r.ByteBuffer.prototype.readInt64=function(t){return new r.Long(this.readInt32(t),this.readInt32(t+4))},r.ByteBuffer.prototype.readUint64=function(t){return new r.Long(this.readUint32(t),this.readUint32(t+4))},r.ByteBuffer.prototype.readFloat32=function(t){return r.int32[0]=this.readInt32(t),r.float32[0]},r.ByteBuffer.prototype.readFloat64=function(t){return r.int32[r.isLittleEndian?0:1]=this.readInt32(t),r.int32[r.isLittleEndian?1:0]=this.readInt32(t+4),r.float64[0]},r.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},r.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},r.ByteBuffer.prototype.writeFloat32=function(t,e){r.float32[0]=e,this.writeInt32(t,r.int32[0])},r.ByteBuffer.prototype.writeFloat64=function(t,e){r.float64[0]=e,this.writeInt32(t,r.int32[r.isLittleEndian?0:1]),this.writeInt32(t+4,r.int32[r.isLittleEndian?1:0])},r.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<r.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+r.SIZEOF_INT+e));return t},r.ByteBuffer.prototype.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},r.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t),s="",n=0;if(t+=r.SIZEOF_INT,e===r.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;n<i;){var o,a=this.readUint8(t+n++);if(a<192)o=a;else{var b=this.readUint8(t+n++);if(a<224)o=(31&a)<<6|63&b;else{var d=this.readUint8(t+n++);if(a<240)o=(15&a)<<12|(63&b)<<6|63&d;else o=(7&a)<<18|(63&b)<<12|(63&d)<<6|63&this.readUint8(t+n++)}}o<65536?s+=String.fromCharCode(o):(o-=65536,s+=String.fromCharCode(55296+(o>>10),56320+(1023&o)))}return s},r.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},r.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+r.SIZEOF_INT},r.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var e=0;e<r.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+r.SIZEOF_INT+e))return!1;return!0},r.ByteBuffer.prototype.createLong=function(t,e){return r.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(e||(e={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(i||(i={}));class s{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new s).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new s).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):i.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,i.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,n,o,a,b,d,h,u,f){return s.start(t),s.addName(t,e),s.addType(t,i),s.addTitle(t,r),s.addDescription(t,n),s.addWidth(t,o),s.addPrecision(t,a),s.addScale(t,b),s.addNullable(t,d),s.addUnique(t,h),s.addPrimaryKey(t,u),s.addMetadata(t,f),s.end(t)}}class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,i,r,s,o,a){return n.start(t),n.addOrg(t,e),n.addCode(t,i),n.addName(t,r),n.addDescription(t,s),n.addWkt(t,o),n.addCodeString(t,a),n.end(t)}}class o{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new o).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new o).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):e.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new s).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new n).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,i){t.addFieldInt8(2,i,e.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r,s,n,a,b,d,h,u,f,c,l,_){return o.start(t),o.addName(t,e),o.addEnvelope(t,i),o.addGeometryType(t,r),o.addHasZ(t,s),o.addHasM(t,n),o.addHasT(t,a),o.addHasTM(t,b),o.addColumns(t,d),o.addFeaturesCount(t,h),o.addIndexNodeSize(t,u),o.addCrs(t,f),o.addTitle(t,c),o.addDescription(t,l),o.addMetadata(t,_),o.end(t)}}const a={[i.Byte]:Uint8Array,[i.UByte]:Uint8Array,[i.Bool]:Uint8Array,[i.Short]:Uint16Array,[i.UShort]:Uint16Array,[i.Int]:Uint32Array,[i.UInt]:Uint32Array,[i.Long]:BigUint64Array,[i.ULong]:BigUint64Array,[i.Float]:Float64Array,[i.Double]:Float64Array,[i.String]:String,[i.Json]:String,[i.DateTime]:String,[i.Binary]:String};class b{constructor(t,e,i,r,s,n,o,b,d,h){this.name=t,this.type=e,this.title=i,this.description=r,this.width=s,this.precision=n,this.scale=o,this.nullable=b,this.unique=d,this.primary_key=h,this.arrayType=a[e]}}class d{constructor(t,e,i,r,s,n,o,a){this.geometryType=t,this.columns=e,this.featuresCount=i,this.indexNodeSize=r,this.crs=s,this.title=n,this.description=o,this.metadata=a}}var h,u;!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(h||(h={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(u||(u={}));class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):u.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,u.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,a,b,d,h,u){return f.start(t),f.addName(t,e),f.addType(t,i),f.addTitle(t,r),f.addDescription(t,s),f.addWidth(t,n),f.addPrecision(t,o),f.addScale(t,a),f.addNullable(t,b),f.addUnique(t,d),f.addPrimaryKey(t,h),f.addMetadata(t,u),f.end(t)}}class c{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new c).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new c).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):h.Unknown}parts(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new c).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,h.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o,a,b){return c.start(t),c.addEnds(t,e),c.addXy(t,i),c.addZ(t,r),c.addM(t,s),c.addT(t,n),c.addTm(t,o),c.addType(t,a),c.addParts(t,b),c.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new c).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var i=this.bb.__offset(this.bb_pos,8);return i?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r){return l.start(t),l.addGeometry(t,e),l.addProperties(t,i),l.addColumns(t,r),l.end(t)}}function _(t,e){const{xy:i,z:r,ends:s,parts:n,type:o}=e;if(n){const e=n.map((e=>_(t,e))),i=c.createPartsVector(t,e);return c.start(t),c.addParts(t,i),c.end(t)}const a=c.createXyVector(t,i);let b,d;return r&&(b=c.createZVector(t,r)),s&&(d=c.createEndsVector(t,s)),c.start(t),d&&c.addEnds(t,d),c.addXy(t,a),b&&c.addZ(t,b),c.addType(t,o),c.end(t)}function p(t,e,i){if(0!==t.length)if(Array.isArray(t[0]))for(const r of t)p(r,e,i);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),i.push(t[2]))}function y(t,e){const i=[];for(let r=0;r<t.length;r+=2){const s=[t[r],t[r+1]];e&&s.push(e[r>>1]),i.push(s)}return i}function g(t){if(!t)return e.Unknown;return e[t]}function I(t){const e=t.coordinates,i=[],r=[];let s,n;const o=g(t.type);let a=0;switch(t.type){case"Point":p(e,i,r);break;case"MultiPoint":case"LineString":p(e,i,r);break;case"MultiLineString":case"Polygon":{const t=e;p(t,i,r),t.length>1&&(s=t.map((t=>a+=t.length)));break}case"MultiPolygon":n=e.map((t=>({type:"Polygon",coordinates:t}))).map(I);break;case"GeometryCollection":t.geometries&&(n=t.geometries.map(I))}return{xy:i,z:r.length>0?r:void 0,ends:s,type:o,parts:n}}function v(t,e,i){if(!i||0===i.length)return[y(t,e)];let r=0;const s=Array.from(i).map((e=>t.slice(r,r=e<<1)));let n;return e&&(r=0,n=Array.from(i).map((t=>e.slice(r,r=t)))),s.map(((t,e)=>y(t,n?n[e]:void 0)))}function w(t,i){if(i===e.GeometryCollection){const r=[];for(let e=0;e<t.partsLength();e++){const i=t.parts(e),s=i.type();r.push(w(i,s))}return{type:e[i],geometries:r}}if(i===e.MultiPolygon){const r=[];for(let i=0;i<t.partsLength();i++)r.push(w(t.parts(i),e.Polygon));return{type:e[i],coordinates:r.map((t=>t.coordinates))}}const r=function(t,i){const r=t.xyArray(),s=t.zArray();switch(i){case e.Point:{const t=Array.from(r);return s&&t.push(s[0]),t}case e.MultiPoint:case e.LineString:return y(r,s);case e.MultiLineString:case e.Polygon:return v(r,s,t.endsArray())}}(t,i);return{type:e[i],coordinates:r}}const B=new TextEncoder,F=new TextDecoder;function m(t,e,s){const n=s.columns,o=new r.Builder,a=[];if(n)for(let t=0;t<n.length;t++){const r=n[t],s=e[r.name];if(null!==s)switch(a.push(Uint16Array.of(t)),r.type){case i.Bool:case i.Short:case i.UShort:case i.Int:case i.UInt:case i.Long:case i.Double:a.push(r.arrayType.of(s));break;case i.DateTime:case i.String:{const t=B.encode(s);a.push(Uint32Array.of(t.length)),a.push(t);break}default:throw new Error("Unknown type "+r.type)}}let b=null;a.length>0&&(b=l.createPropertiesVector(o,function(t,...e){let i=0;for(const t of e)i+=t.byteLength;const r=new t(i);let s=0;for(const i of e)i instanceof Uint8Array?r.set(i,s):r.set(new t(i.buffer),s),s+=i.byteLength;return r}(Uint8Array,...a)));const d=_(o,t);l.start(o),l.addGeometry(o,d),b&&l.addProperties(o,b);const h=l.end(o);return o.finishSizePrefixed(h),o.asUint8Array()}function S(t,e){const r=e.columns,s={type:"Feature",geometry:w(t.geometry(),e.geometryType)};return r&&r.length>0&&(s.properties=function(t,e){const r={};if(!e||0===e.length)return r;const s=t.propertiesArray();if(!s)return r;const n=new DataView(s.buffer,s.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=n.getUint16(a,!0);a+=2;const o=e[t],b=o.name;switch(o.type){case i.Bool:r[b]=!!n.getUint8(a),a+=1;break;case i.Byte:r[b]=n.getInt8(a),a+=1;break;case i.UByte:r[b]=n.getUint8(a),a+=1;break;case i.Short:r[b]=n.getInt16(a,!0),a+=2;break;case i.UShort:r[b]=n.getUint16(a,!0),a+=2;break;case i.Int:r[b]=n.getInt32(a,!0),a+=4;break;case i.UInt:r[b]=n.getUint32(a,!0),a+=4;break;case i.Long:r[b]=Number(n.getBigInt64(a,!0)),a+=8;break;case i.ULong:r[b]=Number(n.getBigUint64(a,!0)),a+=8;break;case i.Double:r[b]=n.getFloat64(a,!0),a+=8;break;case i.DateTime:case i.String:{const t=n.getUint32(a,!0);a+=4,r[b]=F.decode(s.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return r}(t,r)),s}var E=new Uint8Array(0);function U(t,e){if(!t.length)return e;if(!e.length)return t;var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}function T(t){this._source=t,this._array=E,this._index=0}T.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(i){return t._array=E,t._index=0,i.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:U(e,i.value)}}))},T.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,i=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var r=new Uint8Array(t);return r.set(this._array.subarray(this._index)),function s(){return e._source.read().then((function(n){return n.done?(e._array=E,e._index=0,i>0?r.subarray(0,i):null):i+n.value.length>=t?(e._array=n.value,e._index=t-i,r.set(n.value.subarray(0,t-i),i),r):(r.set(n.value,i),i+=n.value.length,s())}))}()},T.prototype.cancel=function(){return this._source.cancel()};class L{constructor(t,e,i,r,s,n){this.org=t,this.code=e,this.name=i,this.description=r,this.wkt=s,this.code_string=n}}function P(t,e){e=Math.min(Math.max(+e,2),65535);let i=t,r=i;do{i=Math.ceil(i/e),r+=i}while(1!==i);return 40*r}async function*O(t,e,i,r){const{minX:s,minY:n,maxX:o,maxY:a}=i,b=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let i=t,r=i;const s=[i];do{i=Math.ceil(i/e),r+=i,s.push(i)}while(1!==i);const n=[];i=r;for(const t of s)n.push(i-t),i-=t;n.reverse(),s.reverse();const o=[];for(let t=0;t<s.length;t++)o.push([n[t],n[t]+s[t]]);return o.reverse(),o}(t,e),[[d,h]]=b,u=[];for(u.push([0,b.length-1]);0!==u.length;){const[i,f]=u.pop(),c=i>=h-t,[,l]=b[f],_=Math.min(i+e,l),p=_-i,y=await r(40*i,40*p),g=new Float64Array(y),I=new Uint32Array(y);for(let t=i;t<_;t++){const e=5*(t-i);if(o<g[e+0])continue;if(a<g[e+1])continue;if(s>g[e+2])continue;if(n>g[e+3])continue;const r=I[8+(e<<1)];c?yield[r,t-d]:u.push([r,f-1])}u.sort(((t,e)=>e[0]-t[0]))}}const N=new Uint8Array([102,103,98,3,102,103,98,0]);function C(t){const e=o.getRoot(t),i=e.featuresCount().toFloat64(),r=e.indexNodeSize(),s=[];for(let t=0;t<e.columnsLength();t++){const i=e.columns(t);if(!i)throw new Error("Column unexpectedly missing");if(!i.name())throw new Error("Column name unexpectedly missing");s.push(new b(i.name(),i.type(),i.title(),i.description(),i.width(),i.precision(),i.scale(),i.nullable(),i.unique(),i.primaryKey()))}const n=e.crs(),a=n?new L(n.org(),n.code(),n.name(),n.description(),n.wkt(),n.codeString()):null;return new d(e.geometryType(),s,i,r,a,e.title(),e.description(),e.metadata())}function A(t,e,i){const r="function"==typeof(s=t).slice?s:new T("function"==typeof s.read?s:s.getReader());var s;return V(e,(async t=>await r.slice(t)),void 0,void 0,i)}async function*V(t,e,i,s,n){let o=0,a=new Uint8Array(await e(8));if(o+=8,!a.every(((t,e)=>N[e]===t)))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await e(4)),o+=4;let b=new r.ByteBuffer(a);const d=b.readUint32(0);a=new Uint8Array(await e(d)),o+=d,b=new r.ByteBuffer(a);const h=C(b);n&&n(h);const{indexNodeSize:u,featuresCount:f}=h;if(u>0){const r=P(f,u);if(s&&i){const n=async(t,r)=>(await i(o+t),await e(r)),a=[];for await(const[t]of O(f,u,s,n))a.push(t);o+=r;for await(const r of a){await i(o+r);const s=await M(e,h,t);s&&(yield s)}return}i?await i(o+r):await e(r),o+=r}let c;for(;c=await M(e,h,t);)yield c}async function M(t,e,i){let s=new Uint8Array(await t(4));if(0===s.byteLength)return;let n=new r.ByteBuffer(s);const o=n.readUint32(0);s=new Uint8Array(await t(o));const a=new Uint8Array(o+4);a.set(s,4),n=new r.ByteBuffer(a),n.setPosition(4);return i(l.getRoot(n),e)}function x(t){const e=new r.Builder;let i=null;t.columns&&(i=o.createColumnsVector(e,t.columns.map((t=>function(t,e){const i=t.createString(e.name);return s.start(t),s.addName(t,i),s.addType(t,e.type),s.end(t)}(e,t)))));const n=e.createString("L1");o.start(e),o.addFeaturesCount(e,new r.Long(t.featuresCount,0)),o.addGeometryType(e,t.geometryType),o.addIndexNodeSize(e,0),i&&o.addColumns(e,i),o.addName(e,n);const a=o.end(e);return e.finishSizePrefixed(a),e.asUint8Array()}function R(t){const e=function(t){const e=t.features[0],r=e.properties;let s=null;r&&(s=Object.keys(r).map((t=>new b(t,function(t){if("boolean"==typeof t)return i.Bool;if("number"==typeof t)return t%1==0?i.Int:i.Double;if("string"==typeof t)return i.String;if(null===t)return i.String;throw new Error(`Unknown type (value '${t}')`)}(r[t]),null,null,-1,-1,-1,!0,!1,!1))));return new d(g(e.geometry.type),s,t.features.length,0,null,null,null,null)}(t),r=x(e),s=t.features.map((t=>m(I(t.geometry),t.properties,e))),n=s.map((t=>t.length)).reduce(((t,e)=>t+e)),o=new Uint8Array(N.length+r.length+n);o.set(r,N.length);let a=N.length+r.length;for(const t of s)o.set(t,a),a+=t.length;return o.set(N),o}function k(t,e){return{type:"FeatureCollection",features:function(t,e,i){if(!t.subarray(0,7).every(((t,e)=>N[e]===t)))throw new Error("Not a FlatGeobuf file");const s=new r.ByteBuffer(t),n=s.readUint32(N.length);s.setPosition(N.length+4);const o=C(s);i&&i(o);let a=N.length+4+n;const{indexNodeSize:b,featuresCount:d}=o;b>0&&(a+=P(d,b));const h=[];for(;a<s.capacity();){const t=s.readUint32(a);s.setPosition(a+4);const i=l.getRoot(s);h.push(e(i,o)),a+=4+t}return h}(t,S,e)}}function D(t,e,i){return function(t,e,i,r){let s=0;return V(i,(async e=>{const i=await fetch(t,{headers:{Range:`bytes=${s}-${s+e-1}`}});return s+=e,await i.arrayBuffer()}),(async t=>{s=t}),e,r)}(t,e,S,i)}t.deserialize=function(t,e,i){return t instanceof Uint8Array?k(t,i):t instanceof ReadableStream?function(t,e){return A(t,S,e)}(t,i):D(t,e,i)},t.serialize=function(t){return R(t)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){ true?e(exports):undefined}(this,(function(t){"use strict";class e{constructor(t,e,i,r,s,n,o,a,b,d){this.name=t,this.type=e,this.title=i,this.description=r,this.width=s,this.precision=n,this.scale=o,this.nullable=a,this.unique=b,this.primary_key=d}}var i,r,s,n,o={};o.SIZEOF_SHORT=2,o.SIZEOF_INT=4,o.FILE_IDENTIFIER_LENGTH=4,o.SIZE_PREFIX_LENGTH=4,o.Encoding={UTF8_BYTES:1,UTF16_STRING:2},o.int32=new Int32Array(2),o.float32=new Float32Array(o.int32.buffer),o.float64=new Float64Array(o.int32.buffer),o.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],o.Long=function(t,e){this.low=0|t,this.high=0|e},o.Long.create=function(t,e){return 0==t&&0==e?o.Long.ZERO:new o.Long(t,e)},o.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},o.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},o.Long.ZERO=new o.Long(0,0),o.Builder=function(t){if(t)e=t;else var e=1024;this.bb=o.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},o.Builder.prototype.dataBuffer=function(){return this.bb},o.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},o.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var i=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<i+t+e;){var r=this.bb.capacity();this.bb=o.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)},o.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},o.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},o.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},o.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},o.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},o.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},o.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},o.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},o.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},o.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},o.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},o.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},o.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},o.Builder.prototype.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},o.Builder.prototype.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},o.Builder.prototype.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},o.Builder.prototype.addFieldInt64=function(t,e,i){!this.force_defaults&&e.equals(i)||(this.addInt64(e),this.slot(t))},o.Builder.prototype.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},o.Builder.prototype.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},o.Builder.prototype.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},o.Builder.prototype.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},o.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},o.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},o.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},o.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},o.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=o.ByteBuffer.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},o.Builder.prototype.addOffset=function(t){this.prep(o.SIZEOF_INT,0),this.writeInt32(this.offset()-t+o.SIZEOF_INT)},o.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},o.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*o.SIZEOF_SHORT;this.addInt16(r);var s=0,n=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var b=o.SIZEOF_SHORT;b<r;b+=o.SIZEOF_SHORT)if(this.bb.readInt16(n+b)!=this.bb.readInt16(a+b))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},o.Builder.prototype.finish=function(t,e,i){var r=i?o.SIZE_PREFIX_LENGTH:0;if(e){var s=e;if(this.prep(this.minalign,o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH+r),s.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var n=o.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(s.charCodeAt(n))}this.prep(this.minalign,o.SIZEOF_INT+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},o.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},o.Builder.prototype.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(0!=this.bb.readInt16(r+e)))throw new Error("FlatBuffers: field "+e+" must be set")},o.Builder.prototype.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(o.SIZEOF_INT,t*e),this.prep(i,t*e)},o.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},o.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var i=0;i<t.length;){var r,s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else r=(s<<10)+t.charCodeAt(i++)+-56613888;r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);i=0;for(var n=this.space,o=this.bb.bytes();i<e.length;i++)o[n++]=e[i];return this.endVector()},o.Builder.prototype.createLong=function(t,e){return o.Long.create(t,e)},o.ByteBuffer=function(t){this.bytes_=t,this.position_=0},o.ByteBuffer.allocate=function(t){return new o.ByteBuffer(new Uint8Array(t))},o.ByteBuffer.prototype.clear=function(){this.position_=0},o.ByteBuffer.prototype.bytes=function(){return this.bytes_},o.ByteBuffer.prototype.position=function(){return this.position_},o.ByteBuffer.prototype.setPosition=function(t){this.position_=t},o.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},o.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},o.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},o.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},o.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},o.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},o.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},o.ByteBuffer.prototype.readInt64=function(t){return new o.Long(this.readInt32(t),this.readInt32(t+4))},o.ByteBuffer.prototype.readUint64=function(t){return new o.Long(this.readUint32(t),this.readUint32(t+4))},o.ByteBuffer.prototype.readFloat32=function(t){return o.int32[0]=this.readInt32(t),o.float32[0]},o.ByteBuffer.prototype.readFloat64=function(t){return o.int32[o.isLittleEndian?0:1]=this.readInt32(t),o.int32[o.isLittleEndian?1:0]=this.readInt32(t+4),o.float64[0]},o.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},o.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},o.ByteBuffer.prototype.writeFloat32=function(t,e){o.float32[0]=e,this.writeInt32(t,o.int32[0])},o.ByteBuffer.prototype.writeFloat64=function(t,e){o.float64[0]=e,this.writeInt32(t,o.int32[o.isLittleEndian?0:1]),this.writeInt32(t+4,o.int32[o.isLittleEndian?1:0])},o.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+o.SIZEOF_INT+e));return t},o.ByteBuffer.prototype.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},o.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},o.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t),r="",s=0;if(t+=o.SIZEOF_INT,e===o.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){var n,a=this.readUint8(t+s++);if(a<192)n=a;else{var b=this.readUint8(t+s++);if(a<224)n=(31&a)<<6|63&b;else{var d=this.readUint8(t+s++);if(a<240)n=(15&a)<<12|(63&b)<<6|63&d;else n=(7&a)<<18|(63&b)<<12|(63&d)<<6|63&this.readUint8(t+s++)}}n<65536?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return r},o.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},o.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+o.SIZEOF_INT},o.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},o.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+o.SIZEOF_INT+e))return!1;return!0},o.ByteBuffer.prototype.createLong=function(t,e){return o.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(i||(i={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(r||(r={}));class a{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new a).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new a).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):r.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,r.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,b,d,h,u,f){return a.start(t),a.addName(t,e),a.addType(t,i),a.addTitle(t,r),a.addDescription(t,s),a.addWidth(t,n),a.addPrecision(t,o),a.addScale(t,b),a.addNullable(t,d),a.addUnique(t,h),a.addPrimaryKey(t,u),a.addMetadata(t,f),a.end(t)}}class b{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new b).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new b).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o){return b.start(t),b.addOrg(t,e),b.addCode(t,i),b.addName(t,r),b.addDescription(t,s),b.addWkt(t,n),b.addCodeString(t,o),b.end(t)}}class d{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new d).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new d).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):i.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new a).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new b).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,e){t.addFieldInt8(2,e,i.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r,s,n,o,a,b,h,u,f,l,c,_){return d.start(t),d.addName(t,e),d.addEnvelope(t,i),d.addGeometryType(t,r),d.addHasZ(t,s),d.addHasM(t,n),d.addHasT(t,o),d.addHasTM(t,a),d.addColumns(t,b),d.addFeaturesCount(t,h),d.addIndexNodeSize(t,u),d.addCrs(t,f),d.addTitle(t,l),d.addDescription(t,c),d.addMetadata(t,_),d.end(t)}}class h{constructor(t,e,i,r,s,n){this.org=t,this.code=e,this.name=i,this.description=r,this.wkt=s,this.code_string=n}}class u{constructor(t,e,i,r,s,n,o,a){this.geometryType=t,this.columns=e,this.featuresCount=i,this.indexNodeSize=r,this.crs=s,this.title=n,this.description=o,this.metadata=a}static fromByteBuffer(t){const i=d.getRoot(t),r=i.featuresCount().toFloat64(),s=i.indexNodeSize(),n=[];for(let t=0;t<i.columnsLength();t++){const r=i.columns(t);if(!r)throw new Error("Column unexpectedly missing");if(!r.name())throw new Error("Column name unexpectedly missing");n.push(new e(r.name(),r.type(),r.title(),r.description(),r.width(),r.precision(),r.scale(),r.nullable(),r.unique(),r.primaryKey()))}const o=i.crs(),a=o?new h(o.org(),o.code(),o.name(),o.description(),o.wkt(),o.codeString()):null;return new u(i.geometryType(),n,r,s,a,i.title(),i.description(),i.metadata())}}!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(s||(s={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(n||(n={}));class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):n.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,n.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,a,b,d,h,u){return f.start(t),f.addName(t,e),f.addType(t,i),f.addTitle(t,r),f.addDescription(t,s),f.addWidth(t,n),f.addPrecision(t,o),f.addScale(t,a),f.addNullable(t,b),f.addUnique(t,d),f.addPrimaryKey(t,h),f.addMetadata(t,u),f.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):s.Unknown}parts(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new l).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,s.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o,a,b){return l.start(t),l.addEnds(t,e),l.addXy(t,i),l.addZ(t,r),l.addM(t,s),l.addT(t,n),l.addTm(t,o),l.addType(t,a),l.addParts(t,b),l.end(t)}}class c{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new c).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new c).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new l).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var i=this.bb.__offset(this.bb_pos,8);return i?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r){return c.start(t),c.addGeometry(t,e),c.addProperties(t,i),c.addColumns(t,r),c.end(t)}}function _(t,e){const{xy:i,z:r,ends:s,parts:n,type:o}=e;if(n){const e=n.map((e=>_(t,e))),i=l.createPartsVector(t,e);return l.start(t),l.addParts(t,i),l.end(t)}const a=l.createXyVector(t,i);let b,d;return r&&(b=l.createZVector(t,r)),s&&(d=l.createEndsVector(t,s)),l.start(t),d&&l.addEnds(t,d),l.addXy(t,a),b&&l.addZ(t,b),l.addType(t,o),l.end(t)}function p(t,e,i){if(0!==t.length)if(Array.isArray(t[0]))for(const r of t)p(r,e,i);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),i.push(t[2]))}function y(t,e){const i=[];for(let r=0;r<t.length;r+=2){const s=[t[r],t[r+1]];e&&s.push(e[r>>1]),i.push(s)}return i}function g(t){if(!t)return i.Unknown;return i[t]}function v(t){const e=t.coordinates,i=[],r=[];let s,n;const o=g(t.type);let a=0;switch(t.type){case"Point":p(e,i,r);break;case"MultiPoint":case"LineString":p(e,i,r);break;case"MultiLineString":case"Polygon":{const t=e;p(t,i,r),t.length>1&&(s=t.map((t=>a+=t.length)));break}case"MultiPolygon":n=e.map((t=>({type:"Polygon",coordinates:t}))).map(v);break;case"GeometryCollection":t.geometries&&(n=t.geometries.map(v))}return{xy:i,z:r.length>0?r:void 0,ends:s,type:o,parts:n}}function I(t,e,i){if(!i||0===i.length)return[y(t,e)];let r=0;const s=Array.from(i).map((e=>t.slice(r,r=e<<1)));let n;return e&&(r=0,n=Array.from(i).map((t=>e.slice(r,r=t)))),s.map(((t,e)=>y(t,n?n[e]:void 0)))}function w(t,e){if(e===i.GeometryCollection){const r=[];for(let e=0;e<t.partsLength();e++){const i=t.parts(e),s=i.type();r.push(w(i,s))}return{type:i[e],geometries:r}}if(e===i.MultiPolygon){const r=[];for(let e=0;e<t.partsLength();e++)r.push(w(t.parts(e),i.Polygon));return{type:i[e],coordinates:r.map((t=>t.coordinates))}}const r=function(t,e){const r=t.xyArray(),s=t.zArray();switch(e){case i.Point:{const t=Array.from(r);return s&&t.push(s[0]),t}case i.MultiPoint:case i.LineString:return y(r,s);case i.MultiLineString:case i.Polygon:return I(r,s,t.endsArray())}}(t,e);return{type:i[e],coordinates:r}}const B=new TextEncoder,m=new TextDecoder;function F(t,e,i){const s=i.columns,n=new o.Builder;let a=0,b=1024,d=new Uint8Array(b),h=new DataView(d.buffer);const u=function(t){if(a+t<b)return;b*=2;const e=new Uint8Array(b);e.set(d),d=e,h=new DataView(d.buffer,a)};if(s)for(let t=0;t<s.length;t++){const i=s[t],n=e[i.name];if(null!==n)switch(h.setUint16(a,t,!0),a+=2,i.type){case r.Bool:u(1),h.setUint8(a,n),a+=1;break;case r.Short:u(2),h.setInt16(a,n,!0),a+=2;break;case r.UShort:u(2),h.setUint16(a,n,!0),a+=2;break;case r.Int:u(4),h.setInt32(a,n,!0),a+=4;break;case r.UInt:u(4),h.setUint32(a,n,!0),a+=4;break;case r.Long:u(8),h.setBigInt64(a,BigInt(n),!0),a+=8;break;case r.Double:u(8),h.setFloat64(a,n,!0),a+=8;break;case r.DateTime:case r.String:{const t=B.encode(n);u(4),h.setUint32(a,t.length,!0),a+=4,u(t.length),d.set(t,a),a+=t.length;break}default:throw new Error("Unknown type "+i.type)}}let f=null;a>0&&(f=c.createPropertiesVector(n,d.slice(0,a)));const l=_(n,t);c.start(n),c.addGeometry(n,l),f&&c.addProperties(n,f);const p=c.end(n);return n.finishSizePrefixed(p),n.asUint8Array()}function E(t,e){const i=e.columns,s={type:"Feature",geometry:w(t.geometry(),e.geometryType)};return i&&i.length>0&&(s.properties=function(t,e){const i={};if(!e||0===e.length)return i;const s=t.propertiesArray();if(!s)return i;const n=new DataView(s.buffer,s.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=n.getUint16(a,!0);a+=2;const o=e[t],b=o.name;switch(o.type){case r.Bool:i[b]=!!n.getUint8(a),a+=1;break;case r.Byte:i[b]=n.getInt8(a),a+=1;break;case r.UByte:i[b]=n.getUint8(a),a+=1;break;case r.Short:i[b]=n.getInt16(a,!0),a+=2;break;case r.UShort:i[b]=n.getUint16(a,!0),a+=2;break;case r.Int:i[b]=n.getInt32(a,!0),a+=4;break;case r.UInt:i[b]=n.getUint32(a,!0),a+=4;break;case r.Long:i[b]=Number(n.getBigInt64(a,!0)),a+=8;break;case r.ULong:i[b]=Number(n.getBigUint64(a,!0)),a+=8;break;case r.Double:i[b]=n.getFloat64(a,!0),a+=8;break;case r.DateTime:case r.String:{const t=n.getUint32(a,!0);a+=4,i[b]=m.decode(s.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return i}(t,i)),s}var S,U=new Uint8Array(0);function T(t,e){if(!t.length)return e;if(!e.length)return t;var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}function L(t){this._source=t,this._array=U,this._index=0}L.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(i){return t._array=U,t._index=0,i.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:T(e,i.value)}}))},L.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,i=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var r=new Uint8Array(t);return r.set(this._array.subarray(this._index)),function s(){return e._source.read().then((function(n){return n.done?(e._array=U,e._index=0,i>0?r.subarray(0,i):null):i+n.value.length>=t?(e._array=n.value,e._index=t-i,r.set(n.value.subarray(0,t-i),i),r):(r.set(n.value,i),i+=n.value.length,s())}))}()},L.prototype.cancel=function(){return this._source.cancel()},function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error"}(S||(S={}));class N{static debug(...t){this.log(S.Debug,...t)}static info(...t){this.log(S.Info,...t)}static warn(...t){this.log(S.Warn,...t)}static error(...t){this.log(S.Error,...t)}static log(t,...e){if(!(this.logLevel>t))switch(t){case S.Debug:console.debug(...e);break;case S.Info:console.info(...e);break;case S.Warn:console.warn(...e);break;case S.Error:console.error(...e)}}}N.logLevel=S.Info;function O(t,e){e=Math.min(Math.max(+e,2),65535);let i=t,r=i;do{i=Math.ceil(i/e),r+=i}while(1!==i);return 40*r}async function*P(t,e,i,r){class s{constructor(t,e){this._level=e,this.nodes=t}level(){return this._level}startNode(){return this.nodes[0]}endNode(){return this.nodes[1]}extendEndNodeToNewOffset(t){console.assert(t>this.nodes[1]),this.nodes[1]=t}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}const{minX:n,minY:o,maxX:a,maxY:b}=i,d=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let i=t,r=i;const s=[i];do{i=Math.ceil(i/e),r+=i,s.push(i)}while(1!==i);const n=[];i=r;for(const t of s)n.push(i-t),i-=t;n.reverse(),s.reverse();const o=[];for(let t=0;t<s.length;t++)o.push([n[t],n[t]+s[t]]);return o.reverse(),o}(t,e),h=d[0][0],u=[(()=>{const t=d.length-1;return new s([0,1],t)})()];for(N.debug(`starting stream search with queue: ${u}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${d}`);0!=u.length;){const t=u.shift();N.debug(`popped node: ${t}, queueLength: ${u.length}`);let i=t.startNode();const f=i>=h,[,l]=d[t.level()],c=Math.min(t.endNode()+e,l),_=c-i,p=await r(40*i,40*_),y=new Float64Array(p),g=new Uint32Array(p);for(let e=i;e<c;e++){const r=5*(e-i);if(a<y[r+0])continue;if(b<y[r+1])continue;if(n>y[r+2])continue;if(o>y[r+3])continue;const d=g[8+(r<<1)],l=C(g[9+(r<<1)],d);if(f){N.debug("yielding feature"),yield[l,e-h];continue}const c=6553.6,_=u[u.length-1];if(void 0!==_&&_.level()==t.level()-1&&l<_.endNode()+c){N.debug(`Extending existing node: ${_}, newOffset: ${_.endNode()} -> ${l}`),_.extendEndNodeToNewOffset(l);continue}let p=(()=>{let e=t.level()-1;return new s([l,l+1],e)})();void 0!==_&&_.level()==t.level()-1?N.debug(`pushing new node at offset: ${l} rather than merging with distant ${_}`):N.debug(`pushing new level for ${p} onto queue with tail: ${_}`),u.push(p)}}}function C(t,e){if(0!=(4293918720&t))throw Error("integer is too large to be safely represented");return e+t*2**32}const V=new Uint8Array([102,103,98,3,102,103,98,0]);class x{constructor(t,e,i,r){this.headerClient=t,this.header=e,this.headerLength=i,this.indexLength=r}static async open(t){let e=new R(t);const i=(()=>{let t,e=0;for(t=0;t<3;t++){e+=16**t*40}return e})(),r=2024+i;N.debug(`fetching header. minReqLength: ${r} (assumedHeaderLength: 2024, assumedIndexLength: ${i})`);{let t=new Uint8Array(await e.getRange(0,8,r,"header"));if(!t.every(((t,e)=>V[e]===t)))throw N.error(`bytes: ${t} != ${V}`),new Error("Not a FlatGeobuf file");N.debug("magic bytes look good")}let s;{let t=await e.getRange(8,4,r,"header");s=new DataView(t).getUint32(0,!0);if(s>10485760||s<8)throw new Error("Invalid header size");N.debug(`headerLength: ${s}`)}const n=await e.getRange(12,s,r,"header"),a=new o.ByteBuffer(new Uint8Array(n)),b=u.fromByteBuffer(a),d=O(b.featuresCount,b.indexNodeSize);return N.debug("completed: opening http reader"),new x(e,b,s,d)}async*selectBbox(t){const e=this.lengthBeforeTree();let i=this.headerClient;N.debug(`starting: selectBbox, traversing index. lengthBeforeTree: ${e}`),yield*P(this.header.featuresCount,this.header.indexNodeSize,t,(async function(t,r){return i.getRange(e+t,r,0,"index")}))}lengthBeforeTree(){return V.length+4+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}featureClient(){return void 0===this._featureClient&&(this._featureClient=this.headerClient.clone()),this._featureClient}async readFeature(t){const e=131072;let i,r=t+this.lengthBeforeFeatures();{const t=await this.featureClient().getRange(r,4,e,"feature length");i=new DataView(t).getUint32(0,!0)}N.debug(`featureOffset: ${r}, featureLength: ${i}`);let s=await this.featureClient().getRange(r+4,i,e,"feature data"),n=new Uint8Array(s);const a=new Uint8Array(i+4);a.set(n,4);const b=new o.ByteBuffer(a);return b.setPosition(4),c.getRoot(b)}}class R{constructor(t){this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof t?new A(t):t}clone(){let t=new R(this.httpClient);return t.buffer=this.buffer.slice(0),t.head=this.head,t}async getRange(t,e,i,r){N.debug(`need Range: ${t}-${t+e-1}`);const s=t-this.head,n=s+e;if(s>=0&&n<this.buffer.byteLength)return N.debug(`slicing existing Range: ${s}-${n-1}`),this.buffer.slice(s,n);let o=Math.max(e,i);return this.buffer=await this.httpClient.getRange(t,o,r),this.head=t,this.buffer.slice(0,e)}}class A{constructor(t){this.requestsEverMade=0,this.bytesEverRequested=0,this.url=t}async getRange(t,e,i){this.requestsEverMade+=1,this.bytesEverRequested+=e;let r=`bytes=${t}-${t+e-1}`;return N.debug(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${e}, ever: ${this.bytesEverRequested}), Range: ${r}`),(await fetch(this.url,{headers:{Range:r}})).arrayBuffer()}}async function*M(t,e,i){const r="function"==typeof(s=t).slice?s:new L("function"==typeof s.read?s:s.getReader());var s;const n=async t=>await r.slice(t);let a=new Uint8Array(await n(8));if(!a.every(((t,e)=>V[e]===t)))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await n(4));let b=new o.ByteBuffer(a);const d=b.readUint32(0);a=new Uint8Array(await n(d)),b=new o.ByteBuffer(a);const h=u.fromByteBuffer(b);i&&i(h);const{indexNodeSize:f,featuresCount:l}=h;if(f>0){const t=O(l,f);await n(t)}let c;for(;c=await k(n,h,e);)yield c}async function k(t,e,i){let r=new Uint8Array(await t(4,"feature length"));if(0===r.byteLength)return;let s=new o.ByteBuffer(r);const n=s.readUint32(0);r=new Uint8Array(await t(n,"feature data"));const a=new Uint8Array(n+4);a.set(r,4),s=new o.ByteBuffer(a),s.setPosition(4);return i(c.getRoot(s),e)}function D(t){const e=new o.Builder;let i=null;t.columns&&(i=d.createColumnsVector(e,t.columns.map((t=>function(t,e){const i=t.createString(e.name);return a.start(t),a.addName(t,i),a.addType(t,e.type),a.end(t)}(e,t)))));const r=e.createString("L1");d.start(e),d.addFeaturesCount(e,new o.Long(t.featuresCount,0)),d.addGeometryType(e,t.geometryType),d.addIndexNodeSize(e,0),i&&d.addColumns(e,i),d.addName(e,r);const s=d.end(e);return e.finishSizePrefixed(s),e.asUint8Array()}function $(t){const i=function(t){const i=t.features[0],s=i.properties;let n=null;s&&(n=Object.keys(s).map((t=>new e(t,function(t){if("boolean"==typeof t)return r.Bool;if("number"==typeof t)return t%1==0?r.Int:r.Double;if("string"==typeof t)return r.String;if(null===t)return r.String;throw new Error(`Unknown type (value '${t}')`)}(s[t]),null,null,-1,-1,-1,!0,!1,!1))));return new u(g(i.geometry.type),n,t.features.length,0,null,null,null,null)}(t),s=D(i),n=t.features.map((t=>F(v(t.geometry),t.properties,i))),o=n.map((t=>t.length)).reduce(((t,e)=>t+e)),a=new Uint8Array(V.length+s.length+o);a.set(s,V.length);let b=V.length+s.length;for(const t of n)a.set(t,b),b+=t.length;return a.set(V),a}function z(t,e){return{type:"FeatureCollection",features:function(t,e,i){if(!t.subarray(0,7).every(((t,e)=>V[e]===t)))throw new Error("Not a FlatGeobuf file");const r=new o.ByteBuffer(t),s=r.readUint32(V.length);r.setPosition(V.length+4);const n=u.fromByteBuffer(r);i&&i(n);let a=V.length+4+s;const{indexNodeSize:b,featuresCount:d}=n;b>0&&(a+=O(d,b));const h=[];for(;a<r.capacity();){const t=r.readUint32(a);r.setPosition(a+4);const i=c.getRoot(r);h.push(e(i,n)),a+=4+t}return h}(t,E,e)}}function G(t,e,i){return async function*(t,e,i,r){const s=await x.open(t);N.debug("opened reader"),r&&r(s.header);for await(let t of s.selectBbox(e)){let e=await s.readFeature(t[0]);yield i(e,s.header)}}(t,e,E,i)}t.deserialize=function(t,e,i){return t instanceof Uint8Array?z(t,i):t instanceof ReadableStream?function(t,e){return M(t,E,e)}(t,i):G(t,e,i)},t.serialize=function(t){return $(t)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=flatgeobuf-geojson.min.js.map | ||
@@ -141,10 +141,10 @@ | ||
/* WEBPACK VAR INJECTION */(function(global) {/* global window, global */ | ||
const moduleExports = __webpack_require__(/*! ./index */ "./src/index.js"); | ||
const _global = typeof window === 'undefined' ? global : window; | ||
// @ts-ignore | ||
_global.loaders = _global.loaders || {}; | ||
// @ts-ignore | ||
/* WEBPACK VAR INJECTION */(function(global) {const moduleExports = __webpack_require__(/*! ./index */ "./src/index.js"); | ||
const _global = typeof window === 'undefined' ? global : window; // @ts-ignore | ||
_global.loaders = _global.loaders || {}; // @ts-ignore | ||
module.exports = Object.assign(_global.loaders, moduleExports); | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"))) | ||
@@ -167,7 +167,5 @@ | ||
// __VERSION__ is injected by babel-plugin-version-inline | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
const VERSION = true ? "3.0.0-alpha.18" : undefined; | ||
const VERSION = true ? "3.0.0-alpha.19" : undefined; | ||
const FlatGeobufWorkerLoader = { | ||
@@ -185,5 +183,3 @@ id: 'flatgeobuf', | ||
}; | ||
const FlatGeobufLoader = { | ||
...FlatGeobufWorkerLoader, | ||
const FlatGeobufLoader = { ...FlatGeobufWorkerLoader, | ||
parse: async (arrayBuffer, options) => Object(_lib_parse_flatgeobuf__WEBPACK_IMPORTED_MODULE_0__["default"])(arrayBuffer, options), | ||
@@ -195,3 +191,2 @@ parseSync: _lib_parse_flatgeobuf__WEBPACK_IMPORTED_MODULE_0__["default"], | ||
/***/ }), | ||
@@ -213,3 +208,2 @@ | ||
/***/ }), | ||
@@ -232,9 +226,9 @@ | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {arrayBuffer} _ A FlatGeobuf arrayBuffer | ||
* @return {?Object} A GeoJSON geometry object | ||
*/ | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {arrayBuffer} _ A FlatGeobuf arrayBuffer | ||
* @return {?Object} A GeoJSON geometry object | ||
*/ | ||
function parseFlatGeobuf(input, options) { | ||
@@ -246,12 +240,14 @@ if (input.byteLength === 0) { | ||
const arr = new Uint8Array(input); | ||
const {features} = Object(flatgeobuf_dist_flatgeobuf_geojson_min__WEBPACK_IMPORTED_MODULE_0__["deserialize"])(arr); | ||
const { | ||
features | ||
} = Object(flatgeobuf_dist_flatgeobuf_geojson_min__WEBPACK_IMPORTED_MODULE_0__["deserialize"])(arr); | ||
return features; | ||
} | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {ReadableStream} _ A FlatGeobuf arrayBuffer | ||
* @return A GeoJSON geometry object iterator | ||
*/ | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {ReadableStream} _ A FlatGeobuf arrayBuffer | ||
* @return A GeoJSON geometry object iterator | ||
*/ | ||
function parseFlatGeobufInBatches(stream, options) { | ||
@@ -262,5 +258,4 @@ const iterator = Object(flatgeobuf_dist_flatgeobuf_geojson_min__WEBPACK_IMPORTED_MODULE_0__["deserializeStream"])(stream); | ||
/***/ }) | ||
/******/ }); |
@@ -1,1 +0,1 @@ | ||
!function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";(function(e){var i=r(2),n="undefined"==typeof window?e:window;n.loaders=n.loaders||{},t.exports=Object.assign(n.loaders,i)}).call(this,r(1))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"FlatGeobufLoader",{enumerable:!0,get:function(){return i.FlatGeobufLoader}});var i=r(3)},function(t,e,r){"use strict";var i=r(4),n=r(6);Object.defineProperty(e,"__esModule",{value:!0}),e.FlatGeobufLoader=e.FlatGeobufWorkerLoader=void 0;var s=n(r(7)),o=n(r(9)),a=n(r(10)),u=i(r(11));function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){(0,a.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var d={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.0-alpha.18",worker:!0,extensions:["fgb"],category:"geometry",options:{flatgeobuf:{}}};e.FlatGeobufWorkerLoader=d;var h,f=c(c({},d),{},{parse:(h=(0,o.default)(s.default.mark((function t(e,r){return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,u.default)(e,r));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)}),parseSync:u.default,parseInBatchesFromStream:u.parseFlatGeobufInBatches,binary:!0});e.FlatGeobufLoader=f},function(t,e,r){var i=r(5).default;function n(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return n=function(){return t},t}t.exports=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==i(t)&&"function"!=typeof t)return{default:t};var e=n();if(e&&e.has(t))return e.get(t);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var a=s?Object.getOwnPropertyDescriptor(t,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=t[o]}return r.default=t,e&&e.set(t,r),r},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=r=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){t.exports=r(8)},function(t,e,r){var i=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var n=e&&e.prototype instanceof d?e:d,s=Object.create(n.prototype),o=new B(i||[]);return s._invoke=function(t,e,r){var i="suspendedStart";return function(n,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw s;return E()}for(r.method=n,r.arg=s;;){var o=r.delegate;if(o){var a=w(o,r);if(a){if(a===c)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var u=b(t,e,r);if("normal"===u.type){if(i=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i="completed",r.method="throw",r.arg=u.arg)}}}(t,r,o),s}function b(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function d(){}function h(){}function f(){}var l={};l[n]=function(){return this};var p=Object.getPrototypeOf,_=p&&p(p(F([])));_&&_!==e&&r.call(_,n)&&(l=_);var y=f.prototype=d.prototype=Object.create(l);function g(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function v(t,e){var i;this._invoke=function(n,s){function o(){return new e((function(i,o){!function i(n,s,o,a){var u=b(t[n],t,s);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(d).then((function(t){c.value=t,o(c)}),(function(t){return i("throw",t,o,a)}))}a(u.arg)}(n,s,i,o)}))}return i=i?i.then(o,o):o()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=b(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,c;var n=i.arg;return n?n.done?(e[t.resultName]=n.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):n:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function F(t){if(t){var e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return s.next=s}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=y.constructor=f,f.constructor=h,h.displayName=a(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,a(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(v.prototype),v.prototype[s]=function(){return this},t.AsyncIterator=v,t.async=function(e,r,i,n,s){void 0===s&&(s=Promise);var o=new v(u(e,r,i,n),s);return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(y),a(y,o,"Generator"),y[n]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var i=e.pop();if(i in t)return r.value=i,r.done=!1,r}return r.done=!0,r}},t.values=F,B.prototype={constructor:B,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(r,i){return o.type="throw",o.arg=t,e.next=r,i&&(e.method="next",e.arg=void 0),!!i}for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var a=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(a&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var s=n;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),m(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;m(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:F(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=i}catch(t){Function("r","regeneratorRuntime = r")(i)}},function(t,e){function r(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}t.exports=function(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var o=t.apply(e,i);function a(t){r(o,n,s,a,u,"next",t)}function u(t){r(o,n,s,a,u,"throw",t)}a(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(0===t.byteLength)return[];var r=new Uint8Array(t);return(0,i.deserialize)(r).features},e.parseFlatGeobufInBatches=function(t,e){return(0,i.deserializeStream)(t)};var i=r(12)},function(t,e,r){!function(t){"use strict";var e,r,i={SIZEOF_SHORT:2,SIZEOF_INT:4,FILE_IDENTIFIER_LENGTH:4,SIZE_PREFIX_LENGTH:4,Encoding:{UTF8_BYTES:1,UTF16_STRING:2}};i.int32=new Int32Array(2),i.float32=new Float32Array(i.int32.buffer),i.float64=new Float64Array(i.int32.buffer),i.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],i.Long=function(t,e){this.low=0|t,this.high=0|e},i.Long.create=function(t,e){return 0==t&&0==e?i.Long.ZERO:new i.Long(t,e)},i.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},i.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},i.Long.ZERO=new i.Long(0,0),i.Builder=function(t){if(t)e=t;else var e=1024;this.bb=i.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},i.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},i.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},i.Builder.prototype.dataBuffer=function(){return this.bb},i.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},i.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<r+t+e;){var n=this.bb.capacity();this.bb=i.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},i.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},i.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},i.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},i.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},i.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},i.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},i.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},i.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},i.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},i.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},i.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},i.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},i.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},i.Builder.prototype.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},i.Builder.prototype.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},i.Builder.prototype.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},i.Builder.prototype.addFieldInt64=function(t,e,r){!this.force_defaults&&e.equals(r)||(this.addInt64(e),this.slot(t))},i.Builder.prototype.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},i.Builder.prototype.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},i.Builder.prototype.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},i.Builder.prototype.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},i.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},i.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},i.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},i.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},i.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=e<<1,n=i.ByteBuffer.allocate(r);return n.setPosition(r-e),n.bytes().set(t.bytes(),r-e),n},i.Builder.prototype.addOffset=function(t){this.prep(i.SIZEOF_INT,0),this.writeInt32(this.offset()-t+i.SIZEOF_INT)},i.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},i.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var n=(r+2)*i.SIZEOF_SHORT;this.addInt16(n);var s=0,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(n==this.bb.readInt16(a)){for(var u=i.SIZEOF_SHORT;u<n;u+=i.SIZEOF_SHORT)if(this.bb.readInt16(o+u)!=this.bb.readInt16(a+u))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},i.Builder.prototype.finish=function(t,e,r){var n=r?i.SIZE_PREFIX_LENGTH:0;if(e){var s=e;if(this.prep(this.minalign,i.SIZEOF_INT+i.FILE_IDENTIFIER_LENGTH+n),s.length!=i.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+i.FILE_IDENTIFIER_LENGTH);for(var o=i.FILE_IDENTIFIER_LENGTH-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,i.SIZEOF_INT+n),this.addOffset(t),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},i.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},i.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(0==this.bb.readInt16(i+e))throw new Error("FlatBuffers: field "+e+" must be set")},i.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(i.SIZEOF_INT,t*e),this.prep(r,t*e)},i.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},i.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r<t.length;){var i,n=t.charCodeAt(r++);(i=n<55296||n>=56320?n:(n<<10)+t.charCodeAt(r++)+-56613888)<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(63&i|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),r=0;for(var s=this.space,o=this.bb.bytes();r<e.length;r++)o[s++]=e[r];return this.endVector()},i.Builder.prototype.createLong=function(t,e){return i.Long.create(t,e)},i.ByteBuffer=function(t){this.bytes_=t,this.position_=0},i.ByteBuffer.allocate=function(t){return new i.ByteBuffer(new Uint8Array(t))},i.ByteBuffer.prototype.clear=function(){this.position_=0},i.ByteBuffer.prototype.bytes=function(){return this.bytes_},i.ByteBuffer.prototype.position=function(){return this.position_},i.ByteBuffer.prototype.setPosition=function(t){this.position_=t},i.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},i.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},i.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},i.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},i.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},i.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},i.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},i.ByteBuffer.prototype.readInt64=function(t){return new i.Long(this.readInt32(t),this.readInt32(t+4))},i.ByteBuffer.prototype.readUint64=function(t){return new i.Long(this.readUint32(t),this.readUint32(t+4))},i.ByteBuffer.prototype.readFloat32=function(t){return i.int32[0]=this.readInt32(t),i.float32[0]},i.ByteBuffer.prototype.readFloat64=function(t){return i.int32[i.isLittleEndian?0:1]=this.readInt32(t),i.int32[i.isLittleEndian?1:0]=this.readInt32(t+4),i.float64[0]},i.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},i.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},i.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},i.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},i.ByteBuffer.prototype.writeFloat32=function(t,e){i.float32[0]=e,this.writeInt32(t,i.int32[0])},i.ByteBuffer.prototype.writeFloat64=function(t,e){i.float64[0]=e,this.writeInt32(t,i.int32[i.isLittleEndian?0:1]),this.writeInt32(t+4,i.int32[i.isLittleEndian?1:0])},i.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+i.SIZEOF_INT+i.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<i.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+i.SIZEOF_INT+e));return t},i.ByteBuffer.prototype.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},i.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},i.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t),n="",s=0;if(t+=i.SIZEOF_INT,e===i.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+r);for(;s<r;){var o,a=this.readUint8(t+s++);if(a<192)o=a;else{var u=this.readUint8(t+s++);if(a<224)o=(31&a)<<6|63&u;else{var b=this.readUint8(t+s++);o=a<240?(15&a)<<12|(63&u)<<6|63&b:(7&a)<<18|(63&u)<<12|(63&b)<<6|63&this.readUint8(t+s++)}}o<65536?n+=String.fromCharCode(o):(o-=65536,n+=String.fromCharCode(55296+(o>>10),56320+(1023&o)))}return n},i.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},i.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+i.SIZEOF_INT},i.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},i.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=i.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+i.FILE_IDENTIFIER_LENGTH);for(var e=0;e<i.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+i.SIZEOF_INT+e))return!1;return!0},i.ByteBuffer.prototype.createLong=function(t,e){return i.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(e||(e={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(r||(r={}));class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):r.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,r.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r,i,s,o,a,u,b,c,d,h){return n.start(t),n.addName(t,e),n.addType(t,r),n.addTitle(t,i),n.addDescription(t,s),n.addWidth(t,o),n.addPrecision(t,a),n.addScale(t,u),n.addNullable(t,b),n.addUnique(t,c),n.addPrimaryKey(t,d),n.addMetadata(t,h),n.end(t)}}class s{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new s).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new s).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,r,i,n,o,a){return s.start(t),s.addOrg(t,e),s.addCode(t,r),s.addName(t,i),s.addDescription(t,n),s.addWkt(t,o),s.addCodeString(t,a),s.end(t)}}class o{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new o).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new o).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):e.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new n).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new s).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,r){t.addFieldInt8(2,r,e.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,r,i,n,s,a,u,b,c,d,h,f,l,p){return o.start(t),o.addName(t,e),o.addEnvelope(t,r),o.addGeometryType(t,i),o.addHasZ(t,n),o.addHasM(t,s),o.addHasT(t,a),o.addHasTM(t,u),o.addColumns(t,b),o.addFeaturesCount(t,c),o.addIndexNodeSize(t,d),o.addCrs(t,h),o.addTitle(t,f),o.addDescription(t,l),o.addMetadata(t,p),o.end(t)}}const a={[r.Byte]:Uint8Array,[r.UByte]:Uint8Array,[r.Bool]:Uint8Array,[r.Short]:Uint16Array,[r.UShort]:Uint16Array,[r.Int]:Uint32Array,[r.UInt]:Uint32Array,[r.Long]:BigUint64Array,[r.ULong]:BigUint64Array,[r.Float]:Float64Array,[r.Double]:Float64Array,[r.String]:String,[r.Json]:String,[r.DateTime]:String,[r.Binary]:String};class u{constructor(t,e,r,i,n,s,o,u,b,c){this.name=t,this.type=e,this.title=r,this.description=i,this.width=n,this.precision=s,this.scale=o,this.nullable=u,this.unique=b,this.primary_key=c,this.arrayType=a[e]}}class b{constructor(t,e,r,i,n,s,o,a){this.geometryType=t,this.columns=e,this.featuresCount=r,this.indexNodeSize=i,this.crs=n,this.title=s,this.description=o,this.metadata=a}}var c,d;!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(c||(c={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(d||(d={}));class h{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new h).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new h).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):d.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,d.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r,i,n,s,o,a,u,b,c,d){return h.start(t),h.addName(t,e),h.addType(t,r),h.addTitle(t,i),h.addDescription(t,n),h.addWidth(t,s),h.addPrecision(t,o),h.addScale(t,a),h.addNullable(t,u),h.addUnique(t,b),h.addPrimaryKey(t,c),h.addMetadata(t,d),h.end(t)}}class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):c.Unknown}parts(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,c.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,r,i,n,s,o,a,u){return f.start(t),f.addEnds(t,e),f.addXy(t,r),f.addZ(t,i),f.addM(t,n),f.addT(t,s),f.addTm(t,o),f.addType(t,a),f.addParts(t,u),f.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+i.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var r=this.bb.__offset(this.bb_pos,8);return r?(e||new h).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,r,i){return l.start(t),l.addGeometry(t,e),l.addProperties(t,r),l.addColumns(t,i),l.end(t)}}function p(t,e,r){if(0!==t.length)if(Array.isArray(t[0]))for(const i of t)p(i,e,r);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),r.push(t[2]))}function _(t,e){const r=[];for(let i=0;i<t.length;i+=2){const n=[t[i],t[i+1]];e&&n.push(e[i>>1]),r.push(n)}return r}function y(t){return t?e[t]:e.Unknown}function g(t){const e=t.coordinates,r=[],i=[];let n,s;const o=y(t.type);let a=0;switch(t.type){case"Point":p(e,r,i);break;case"MultiPoint":case"LineString":p(e,r,i);break;case"MultiLineString":case"Polygon":{const t=e;p(t,r,i),t.length>1&&(n=t.map(t=>a+=t.length));break}case"MultiPolygon":s=e.map(t=>({type:"Polygon",coordinates:t})).map(g);break;case"GeometryCollection":t.geometries&&(s=t.geometries.map(g))}return{xy:r,z:i.length>0?i:void 0,ends:n,type:o,parts:s}}function v(t,r){if(r===e.GeometryCollection){const i=[];for(let e=0;e<t.partsLength();e++){const r=t.parts(e),n=r.type();i.push(v(r,n))}return{type:e[r],geometries:i}}if(r===e.MultiPolygon){const i=[];for(let r=0;r<t.partsLength();r++)i.push(v(t.parts(r),e.Polygon));return{type:e[r],coordinates:i.map(t=>t.coordinates)}}const i=function(t,r){const i=t.xyArray(),n=t.zArray();switch(r){case e.Point:{const t=Array.from(i);return n&&t.push(n[0]),t}case e.MultiPoint:case e.LineString:return _(i,n);case e.MultiLineString:case e.Polygon:return function(t,e,r){if(!r||0===r.length)return[_(t,e)];let i=0;const n=Array.from(r).map(e=>t.slice(i,i=e<<1));let s;return e&&(i=0,s=Array.from(r).map(t=>e.slice(i,i=t))),n.map((t,e)=>_(t,s?s[e]:void 0))}(i,n,t.endsArray())}}(t,r);return{type:e[r],coordinates:i}}const w=new TextEncoder,I=new TextDecoder;function m(t,e,n){const s=n.columns,o=new i.Builder,a=[];if(s)for(let t=0;t<s.length;t++){const i=s[t],n=e[i.name];if(null!==n)switch(a.push(Uint16Array.of(t)),i.type){case r.Bool:case r.Short:case r.UShort:case r.Int:case r.UInt:case r.Long:case r.Double:a.push(i.arrayType.of(n));break;case r.DateTime:case r.String:{const t=w.encode(n);a.push(Uint32Array.of(t.length)),a.push(t);break}default:throw new Error("Unknown type "+i.type)}}let u=null;a.length>0&&(u=l.createPropertiesVector(o,function(t,...e){let r=0;for(const t of e)r+=t.byteLength;const i=new t(r);let n=0;for(const r of e)r instanceof Uint8Array?i.set(r,n):i.set(new t(r.buffer),n),n+=r.byteLength;return i}(Uint8Array,...a)));const b=function t(e,r){const{xy:i,z:n,ends:s,parts:o,type:a}=r;if(o){const r=o.map(r=>t(e,r)),i=f.createPartsVector(e,r);return f.start(e),f.addParts(e,i),f.end(e)}const u=f.createXyVector(e,i);let b,c;return n&&(b=f.createZVector(e,n)),s&&(c=f.createEndsVector(e,s)),f.start(e),c&&f.addEnds(e,c),f.addXy(e,u),b&&f.addZ(e,b),f.addType(e,a),f.end(e)}(o,t);l.start(o),l.addGeometry(o,b),u&&l.addProperties(o,u);const c=l.end(o);return o.finishSizePrefixed(c),o.asUint8Array()}function B(t,e){const i=e.columns,n={type:"Feature",geometry:v(t.geometry(),e.geometryType)};return i&&i.length>0&&(n.properties=function(t,e){const i={};if(!e||0===e.length)return i;const n=t.propertiesArray();if(!n)return i;const s=new DataView(n.buffer,n.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=s.getUint16(a,!0);a+=2;const o=e[t],u=o.name;switch(o.type){case r.Bool:i[u]=!!s.getUint8(a),a+=1;break;case r.Byte:i[u]=s.getInt8(a),a+=1;break;case r.UByte:i[u]=s.getUint8(a),a+=1;break;case r.Short:i[u]=s.getInt16(a,!0),a+=2;break;case r.UShort:i[u]=s.getUint16(a,!0),a+=2;break;case r.Int:i[u]=s.getInt32(a,!0),a+=4;break;case r.UInt:i[u]=s.getUint32(a,!0),a+=4;break;case r.Long:i[u]=Number(s.getBigInt64(a,!0)),a+=8;break;case r.ULong:i[u]=Number(s.getBigUint64(a,!0)),a+=8;break;case r.Double:i[u]=s.getFloat64(a,!0),a+=8;break;case r.DateTime:case r.String:{const t=s.getUint32(a,!0);a+=4,i[u]=I.decode(n.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return i}(t,i)),n}var F=new Uint8Array(0);function E(t,e){if(!t.length)return e;if(!e.length)return t;var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function S(t){this._source=t,this._array=F,this._index=0}S.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(r){return t._array=F,t._index=0,r.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:E(e,r.value)}}))},S.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,r=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var i=new Uint8Array(t);return i.set(this._array.subarray(this._index)),function n(){return e._source.read().then((function(s){return s.done?(e._array=F,e._index=0,r>0?i.subarray(0,r):null):r+s.value.length>=t?(e._array=s.value,e._index=t-r,i.set(s.value.subarray(0,t-r),r),i):(i.set(s.value,r),r+=s.value.length,n())}))}()},S.prototype.cancel=function(){return this._source.cancel()};class O{constructor(t,e,r,i,n,s){this.org=t,this.code=e,this.name=r,this.description=i,this.wkt=n,this.code_string=s}}function L(t,e){e=Math.min(Math.max(+e,2),65535);let r=t,i=r;do{r=Math.ceil(r/e),i+=r}while(1!==r);return 40*i}const P=new Uint8Array([102,103,98,3,102,103,98,0]);function U(t){const e=o.getRoot(t),r=e.featuresCount().toFloat64(),i=e.indexNodeSize(),n=[];for(let t=0;t<e.columnsLength();t++){const r=e.columns(t);if(!r)throw new Error("Column unexpectedly missing");if(!r.name())throw new Error("Column name unexpectedly missing");n.push(new u(r.name(),r.type(),r.title(),r.description(),r.width(),r.precision(),r.scale(),r.nullable(),r.unique(),r.primaryKey()))}const s=e.crs(),a=s?new O(s.org(),s.code(),s.name(),s.description(),s.wkt(),s.codeString()):null;return new b(e.geometryType(),n,r,i,a,e.title(),e.description(),e.metadata())}async function*T(t,e,r,n,s){let o=0,a=new Uint8Array(await e(8));if(o+=8,!a.every((t,e)=>P[e]===t))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await e(4)),o+=4;let u=new i.ByteBuffer(a);const b=u.readUint32(0);a=new Uint8Array(await e(b)),o+=b,u=new i.ByteBuffer(a);const c=U(u);s&&s(c);const{indexNodeSize:d,featuresCount:h}=c;if(d>0){const i=L(h,d);if(n&&r){const s=async(t,i)=>(await r(o+t),await e(i)),a=[];for await(const[t]of async function*(t,e,r,i){const{minX:n,minY:s,maxX:o,maxY:a}=r,u=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let r=t,i=r;const n=[r];do{r=Math.ceil(r/e),i+=r,n.push(r)}while(1!==r);const s=[];r=i;for(const t of n)s.push(r-t),r-=t;s.reverse(),n.reverse();const o=[];for(let t=0;t<n.length;t++)o.push([s[t],s[t]+n[t]]);return o.reverse(),o}(t,e),[[b,c]]=u,d=[];for(d.push([0,u.length-1]);0!==d.length;){const[r,h]=d.pop(),f=r>=c-t,[,l]=u[h],p=Math.min(r+e,l),_=p-r,y=await i(40*r,40*_),g=new Float64Array(y),v=new Uint32Array(y);for(let t=r;t<p;t++){const e=5*(t-r);if(o<g[e+0])continue;if(a<g[e+1])continue;if(n>g[e+2])continue;if(s>g[e+3])continue;const i=v[8+(e<<1)];f?yield[i,t-b]:d.push([i,h-1])}d.sort((t,e)=>e[0]-t[0])}}(h,d,n,s))a.push(t);o+=i;for await(const i of a){await r(o+i);const n=await x(e,c,t);n&&(yield n)}return}r?await r(o+i):await e(i),o+=i}let f;for(;f=await x(e,c,t);)yield f}async function x(t,e,r){let n=new Uint8Array(await t(4));if(0===n.byteLength)return;let s=new i.ByteBuffer(n);const o=s.readUint32(0);n=new Uint8Array(await t(o));const a=new Uint8Array(o+4);return a.set(n,4),s=new i.ByteBuffer(a),s.setPosition(4),r(l.getRoot(s),e)}function N(t){const e=new i.Builder;let r=null;t.columns&&(r=o.createColumnsVector(e,t.columns.map(t=>function(t,e){const r=t.createString(e.name);return n.start(t),n.addName(t,r),n.addType(t,e.type),n.end(t)}(e,t))));const s=e.createString("L1");o.start(e),o.addFeaturesCount(e,new i.Long(t.featuresCount,0)),o.addGeometryType(e,t.geometryType),o.addIndexNodeSize(e,0),r&&o.addColumns(e,r),o.addName(e,s);const a=o.end(e);return e.finishSizePrefixed(a),e.asUint8Array()}t.deserialize=function(t,e,r){return t instanceof Uint8Array?function(t,e){return{type:"FeatureCollection",features:function(t,e,r){if(!t.subarray(0,7).every((t,e)=>P[e]===t))throw new Error("Not a FlatGeobuf file");const n=new i.ByteBuffer(t),s=n.readUint32(P.length);n.setPosition(P.length+4);const o=U(n);r&&r(o);let a=P.length+4+s;const{indexNodeSize:u,featuresCount:b}=o;u>0&&(a+=L(b,u));const c=[];for(;a<n.capacity();){const t=n.readUint32(a);n.setPosition(a+4);const r=l.getRoot(n);c.push(e(r,o)),a+=4+t}return c}(t,B,e)}}(t,r):t instanceof ReadableStream?function(t,e){return function(t,e,r){const i="function"==typeof(n=t).slice?n:new S("function"==typeof n.read?n:n.getReader());var n;return T(e,async t=>await i.slice(t),void 0,void 0,r)}(t,B,e)}(t,r):function(t,e,r){return function(t,e,r,i){let n=0;return T(r,async e=>{const r=await fetch(t,{headers:{Range:`bytes=${n}-${n+e-1}`}});return n+=e,await r.arrayBuffer()},async t=>{n=t},e,i)}(t,e,B,r)}(t,e,r)},t.serialize=function(t){return function(t){const e=function(t){const e=t.features[0],i=e.properties;let n=null;return i&&(n=Object.keys(i).map(t=>new u(t,function(t){if("boolean"==typeof t)return r.Bool;if("number"==typeof t)return t%1==0?r.Int:r.Double;if("string"==typeof t)return r.String;if(null===t)return r.String;throw new Error(`Unknown type (value '${t}')`)}(i[t]),null,null,-1,-1,-1,!0,!1,!1))),new b(y(e.geometry.type),n,t.features.length,0,null,null,null,null)}(t),i=N(e),n=t.features.map(t=>m(g(t.geometry),t.properties,e)),s=n.map(t=>t.length).reduce((t,e)=>t+e),o=new Uint8Array(P.length+i.length+s);o.set(i,P.length);let a=P.length+i.length;for(const t of n)o.set(t,a),a+=t.length;return o.set(P),o}(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e)}]); | ||
!function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";(function(e){var i=r(2),n="undefined"==typeof window?e:window;n.loaders=n.loaders||{},t.exports=Object.assign(n.loaders,i)}).call(this,r(1))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"FlatGeobufLoader",{enumerable:!0,get:function(){return i.FlatGeobufLoader}});var i=r(3)},function(t,e,r){"use strict";var i=r(4),n=r(5);Object.defineProperty(e,"__esModule",{value:!0}),e.FlatGeobufLoader=e.FlatGeobufWorkerLoader=void 0;var s=i(r(6)),o=i(r(8)),a=i(r(9)),u=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==n(t)&&"function"!=typeof t)return{default:t};var r=h(e);if(r&&r.has(t))return r.get(t);var i={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var a=s?Object.getOwnPropertyDescriptor(t,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=t[o]}i.default=t,r&&r.set(t,i);return i}(r(10));function h(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(h=function(t){return t?r:e})(t)}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){(0,a.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var c={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.0-alpha.19",worker:!0,extensions:["fgb"],category:"geometry",options:{flatgeobuf:{}}};e.FlatGeobufWorkerLoader=c;var f,l=b(b({},c),{},{parse:(f=(0,o.default)(s.default.mark((function t(e,r){return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,u.default)(e,r));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return f.apply(this,arguments)}),parseSync:u.default,parseInBatchesFromStream:u.parseFlatGeobufInBatches,binary:!0});e.FlatGeobufLoader=l},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=r=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){t.exports=r(7)},function(t,e,r){var i=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var n=e&&e.prototype instanceof b?e:b,s=Object.create(n.prototype),o=new B(i||[]);return s._invoke=function(t,e,r){var i="suspendedStart";return function(n,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw s;return E()}for(r.method=n,r.arg=s;;){var o=r.delegate;if(o){var a=w(o,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var u=h(t,e,r);if("normal"===u.type){if(i=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i="completed",r.method="throw",r.arg=u.arg)}}}(t,r,o),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function b(){}function c(){}function f(){}var l={};l[n]=function(){return this};var p=Object.getPrototypeOf,_=p&&p(p(F([])));_&&_!==e&&r.call(_,n)&&(l=_);var y=f.prototype=b.prototype=Object.create(l);function g(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function v(t,e){var i;this._invoke=function(n,s){function o(){return new e((function(i,o){!function i(n,s,o,a){var u=h(t[n],t,s);if("throw"!==u.type){var d=u.arg,b=d.value;return b&&"object"==typeof b&&r.call(b,"__await")?e.resolve(b.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(b).then((function(t){d.value=t,o(d)}),(function(t){return i("throw",t,o,a)}))}a(u.arg)}(n,s,i,o)}))}return i=i?i.then(o,o):o()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=h(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var n=i.arg;return n?n.done?(e[t.resultName]=n.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):n:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function F(t){if(t){var e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return s.next=s}}return{next:E}}function E(){return{value:void 0,done:!0}}return c.prototype=y.constructor=f,f.constructor=c,c.displayName=a(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===c||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,a(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(v.prototype),v.prototype[s]=function(){return this},t.AsyncIterator=v,t.async=function(e,r,i,n,s){void 0===s&&(s=Promise);var o=new v(u(e,r,i,n),s);return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(y),a(y,o,"Generator"),y[n]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var i=e.pop();if(i in t)return r.value=i,r.done=!1,r}return r.done=!0,r}},t.values=F,B.prototype={constructor:B,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(r,i){return o.type="throw",o.arg=t,e.next=r,i&&(e.method="next",e.arg=void 0),!!i}for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var a=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(a&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var s=n;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,d):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),m(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;m(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:F(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}(t.exports);try{regeneratorRuntime=i}catch(t){Function("r","regeneratorRuntime = r")(i)}},function(t,e){function r(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}t.exports=function(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var o=t.apply(e,i);function a(t){r(o,n,s,a,u,"next",t)}function u(t){r(o,n,s,a,u,"throw",t)}a(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(0===t.byteLength)return[];var r=new Uint8Array(t);return(0,i.deserialize)(r).features},e.parseFlatGeobufInBatches=function(t,e){return(0,i.deserializeStream)(t)};var i=r(11)},function(t,e,r){!function(t){"use strict";class e{constructor(t,e,r,i,n,s,o,a,u,h){this.name=t,this.type=e,this.title=r,this.description=i,this.width=n,this.precision=s,this.scale=o,this.nullable=a,this.unique=u,this.primary_key=h}}var r,i,n,s,o={SIZEOF_SHORT:2,SIZEOF_INT:4,FILE_IDENTIFIER_LENGTH:4,SIZE_PREFIX_LENGTH:4,Encoding:{UTF8_BYTES:1,UTF16_STRING:2}};o.int32=new Int32Array(2),o.float32=new Float32Array(o.int32.buffer),o.float64=new Float64Array(o.int32.buffer),o.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],o.Long=function(t,e){this.low=0|t,this.high=0|e},o.Long.create=function(t,e){return 0==t&&0==e?o.Long.ZERO:new o.Long(t,e)},o.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},o.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},o.Long.ZERO=new o.Long(0,0),o.Builder=function(t){if(t)e=t;else var e=1024;this.bb=o.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},o.Builder.prototype.dataBuffer=function(){return this.bb},o.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},o.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<r+t+e;){var i=this.bb.capacity();this.bb=o.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)},o.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},o.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},o.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},o.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},o.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},o.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},o.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},o.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},o.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},o.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},o.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},o.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},o.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},o.Builder.prototype.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},o.Builder.prototype.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},o.Builder.prototype.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},o.Builder.prototype.addFieldInt64=function(t,e,r){!this.force_defaults&&e.equals(r)||(this.addInt64(e),this.slot(t))},o.Builder.prototype.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},o.Builder.prototype.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},o.Builder.prototype.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},o.Builder.prototype.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},o.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},o.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},o.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},o.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},o.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=e<<1,i=o.ByteBuffer.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},o.Builder.prototype.addOffset=function(t){this.prep(o.SIZEOF_INT,0),this.writeInt32(this.offset()-t+o.SIZEOF_INT)},o.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},o.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=(r+2)*o.SIZEOF_SHORT;this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(a)){for(var u=o.SIZEOF_SHORT;u<i;u+=o.SIZEOF_SHORT)if(this.bb.readInt16(s+u)!=this.bb.readInt16(a+u))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},o.Builder.prototype.finish=function(t,e,r){var i=r?o.SIZE_PREFIX_LENGTH:0;if(e){var n=e;if(this.prep(this.minalign,o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH+i),n.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var s=o.FILE_IDENTIFIER_LENGTH-1;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,o.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},o.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},o.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(0==this.bb.readInt16(i+e))throw new Error("FlatBuffers: field "+e+" must be set")},o.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(o.SIZEOF_INT,t*e),this.prep(r,t*e)},o.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},o.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r<t.length;){var i,n=t.charCodeAt(r++);(i=n<55296||n>=56320?n:(n<<10)+t.charCodeAt(r++)+-56613888)<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(63&i|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),r=0;for(var s=this.space,o=this.bb.bytes();r<e.length;r++)o[s++]=e[r];return this.endVector()},o.Builder.prototype.createLong=function(t,e){return o.Long.create(t,e)},o.ByteBuffer=function(t){this.bytes_=t,this.position_=0},o.ByteBuffer.allocate=function(t){return new o.ByteBuffer(new Uint8Array(t))},o.ByteBuffer.prototype.clear=function(){this.position_=0},o.ByteBuffer.prototype.bytes=function(){return this.bytes_},o.ByteBuffer.prototype.position=function(){return this.position_},o.ByteBuffer.prototype.setPosition=function(t){this.position_=t},o.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},o.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},o.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},o.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},o.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},o.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},o.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},o.ByteBuffer.prototype.readInt64=function(t){return new o.Long(this.readInt32(t),this.readInt32(t+4))},o.ByteBuffer.prototype.readUint64=function(t){return new o.Long(this.readUint32(t),this.readUint32(t+4))},o.ByteBuffer.prototype.readFloat32=function(t){return o.int32[0]=this.readInt32(t),o.float32[0]},o.ByteBuffer.prototype.readFloat64=function(t){return o.int32[o.isLittleEndian?0:1]=this.readInt32(t),o.int32[o.isLittleEndian?1:0]=this.readInt32(t+4),o.float64[0]},o.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},o.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},o.ByteBuffer.prototype.writeFloat32=function(t,e){o.float32[0]=e,this.writeInt32(t,o.int32[0])},o.ByteBuffer.prototype.writeFloat64=function(t,e){o.float64[0]=e,this.writeInt32(t,o.int32[o.isLittleEndian?0:1]),this.writeInt32(t+4,o.int32[o.isLittleEndian?1:0])},o.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+o.SIZEOF_INT+e));return t},o.ByteBuffer.prototype.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},o.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},o.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t),i="",n=0;if(t+=o.SIZEOF_INT,e===o.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+r);for(;n<r;){var s,a=this.readUint8(t+n++);if(a<192)s=a;else{var u=this.readUint8(t+n++);if(a<224)s=(31&a)<<6|63&u;else{var h=this.readUint8(t+n++);s=a<240?(15&a)<<12|(63&u)<<6|63&h:(7&a)<<18|(63&u)<<12|(63&h)<<6|63&this.readUint8(t+n++)}}s<65536?i+=String.fromCharCode(s):(s-=65536,i+=String.fromCharCode(55296+(s>>10),56320+(1023&s)))}return i},o.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},o.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+o.SIZEOF_INT},o.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},o.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+o.SIZEOF_INT+e))return!1;return!0},o.ByteBuffer.prototype.createLong=function(t,e){return o.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(r||(r={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(i||(i={}));class a{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new a).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new a).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):i.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,i.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r,i,n,s,o,u,h,d,b,c){return a.start(t),a.addName(t,e),a.addType(t,r),a.addTitle(t,i),a.addDescription(t,n),a.addWidth(t,s),a.addPrecision(t,o),a.addScale(t,u),a.addNullable(t,h),a.addUnique(t,d),a.addPrimaryKey(t,b),a.addMetadata(t,c),a.end(t)}}class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,r,i,n,s,o){return u.start(t),u.addOrg(t,e),u.addCode(t,r),u.addName(t,i),u.addDescription(t,n),u.addWkt(t,s),u.addCodeString(t,o),u.end(t)}}class h{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new h).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new h).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):r.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new a).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new u).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,e){t.addFieldInt8(2,e,r.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,r,i,n,s,o,a,u,d,b,c,f,l,p){return h.start(t),h.addName(t,e),h.addEnvelope(t,r),h.addGeometryType(t,i),h.addHasZ(t,n),h.addHasM(t,s),h.addHasT(t,o),h.addHasTM(t,a),h.addColumns(t,u),h.addFeaturesCount(t,d),h.addIndexNodeSize(t,b),h.addCrs(t,c),h.addTitle(t,f),h.addDescription(t,l),h.addMetadata(t,p),h.end(t)}}class d{constructor(t,e,r,i,n,s){this.org=t,this.code=e,this.name=r,this.description=i,this.wkt=n,this.code_string=s}}class b{constructor(t,e,r,i,n,s,o,a){this.geometryType=t,this.columns=e,this.featuresCount=r,this.indexNodeSize=i,this.crs=n,this.title=s,this.description=o,this.metadata=a}static fromByteBuffer(t){const r=h.getRoot(t),i=r.featuresCount().toFloat64(),n=r.indexNodeSize(),s=[];for(let t=0;t<r.columnsLength();t++){const i=r.columns(t);if(!i)throw new Error("Column unexpectedly missing");if(!i.name())throw new Error("Column name unexpectedly missing");s.push(new e(i.name(),i.type(),i.title(),i.description(),i.width(),i.precision(),i.scale(),i.nullable(),i.unique(),i.primaryKey()))}const o=r.crs(),a=o?new d(o.org(),o.code(),o.name(),o.description(),o.wkt(),o.codeString()):null;return new b(r.geometryType(),s,i,n,a,r.title(),r.description(),r.metadata())}}!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(n||(n={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(s||(s={}));class c{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new c).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new c).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):s.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,s.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r,i,n,s,o,a,u,h,d,b){return c.start(t),c.addName(t,e),c.addType(t,r),c.addTitle(t,i),c.addDescription(t,n),c.addWidth(t,s),c.addPrecision(t,o),c.addScale(t,a),c.addNullable(t,u),c.addUnique(t,h),c.addPrimaryKey(t,d),c.addMetadata(t,b),c.end(t)}}class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):n.Unknown}parts(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,n.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,r,i,n,s,o,a,u){return f.start(t),f.addEnds(t,e),f.addXy(t,r),f.addZ(t,i),f.addM(t,n),f.addT(t,s),f.addTm(t,o),f.addType(t,a),f.addParts(t,u),f.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var r=this.bb.__offset(this.bb_pos,8);return r?(e||new c).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,r,i){return l.start(t),l.addGeometry(t,e),l.addProperties(t,r),l.addColumns(t,i),l.end(t)}}function p(t,e){const{xy:r,z:i,ends:n,parts:s,type:o}=e;if(s){const e=s.map(e=>p(t,e)),r=f.createPartsVector(t,e);return f.start(t),f.addParts(t,r),f.end(t)}const a=f.createXyVector(t,r);let u,h;return i&&(u=f.createZVector(t,i)),n&&(h=f.createEndsVector(t,n)),f.start(t),h&&f.addEnds(t,h),f.addXy(t,a),u&&f.addZ(t,u),f.addType(t,o),f.end(t)}function _(t,e,r){if(0!==t.length)if(Array.isArray(t[0]))for(const i of t)_(i,e,r);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),r.push(t[2]))}function y(t,e){const r=[];for(let i=0;i<t.length;i+=2){const n=[t[i],t[i+1]];e&&n.push(e[i>>1]),r.push(n)}return r}function g(t){return t?r[t]:r.Unknown}function v(t){const e=t.coordinates,r=[],i=[];let n,s;const o=g(t.type);let a=0;switch(t.type){case"Point":_(e,r,i);break;case"MultiPoint":case"LineString":_(e,r,i);break;case"MultiLineString":case"Polygon":{const t=e;_(t,r,i),t.length>1&&(n=t.map(t=>a+=t.length));break}case"MultiPolygon":s=e.map(t=>({type:"Polygon",coordinates:t})).map(v);break;case"GeometryCollection":t.geometries&&(s=t.geometries.map(v))}return{xy:r,z:i.length>0?i:void 0,ends:n,type:o,parts:s}}function w(t,e){if(e===r.GeometryCollection){const i=[];for(let e=0;e<t.partsLength();e++){const r=t.parts(e),n=r.type();i.push(w(r,n))}return{type:r[e],geometries:i}}if(e===r.MultiPolygon){const i=[];for(let e=0;e<t.partsLength();e++)i.push(w(t.parts(e),r.Polygon));return{type:r[e],coordinates:i.map(t=>t.coordinates)}}const i=function(t,e){const i=t.xyArray(),n=t.zArray();switch(e){case r.Point:{const t=Array.from(i);return n&&t.push(n[0]),t}case r.MultiPoint:case r.LineString:return y(i,n);case r.MultiLineString:case r.Polygon:return function(t,e,r){if(!r||0===r.length)return[y(t,e)];let i=0;const n=Array.from(r).map(e=>t.slice(i,i=e<<1));let s;return e&&(i=0,s=Array.from(r).map(t=>e.slice(i,i=t))),n.map((t,e)=>y(t,s?s[e]:void 0))}(i,n,t.endsArray())}}(t,e);return{type:r[e],coordinates:i}}const I=new TextEncoder,m=new TextDecoder;function B(t,e,r){const n=r.columns,s=new o.Builder;let a=0,u=1024,h=new Uint8Array(u),d=new DataView(h.buffer);const b=function(t){if(a+t<u)return;u*=2;const e=new Uint8Array(u);e.set(h),h=e,d=new DataView(h.buffer,a)};if(n)for(let t=0;t<n.length;t++){const r=n[t],s=e[r.name];if(null!==s)switch(d.setUint16(a,t,!0),a+=2,r.type){case i.Bool:b(1),d.setUint8(a,s),a+=1;break;case i.Short:b(2),d.setInt16(a,s,!0),a+=2;break;case i.UShort:b(2),d.setUint16(a,s,!0),a+=2;break;case i.Int:b(4),d.setInt32(a,s,!0),a+=4;break;case i.UInt:b(4),d.setUint32(a,s,!0),a+=4;break;case i.Long:b(8),d.setBigInt64(a,BigInt(s),!0),a+=8;break;case i.Double:b(8),d.setFloat64(a,s,!0),a+=8;break;case i.DateTime:case i.String:{const t=I.encode(s);b(4),d.setUint32(a,t.length,!0),a+=4,b(t.length),h.set(t,a),a+=t.length;break}default:throw new Error("Unknown type "+r.type)}}let c=null;a>0&&(c=l.createPropertiesVector(s,h.slice(0,a)));const f=p(s,t);l.start(s),l.addGeometry(s,f),c&&l.addProperties(s,c);const _=l.end(s);return s.finishSizePrefixed(_),s.asUint8Array()}function F(t,e){const r=e.columns,n={type:"Feature",geometry:w(t.geometry(),e.geometryType)};return r&&r.length>0&&(n.properties=function(t,e){const r={};if(!e||0===e.length)return r;const n=t.propertiesArray();if(!n)return r;const s=new DataView(n.buffer,n.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=s.getUint16(a,!0);a+=2;const o=e[t],u=o.name;switch(o.type){case i.Bool:r[u]=!!s.getUint8(a),a+=1;break;case i.Byte:r[u]=s.getInt8(a),a+=1;break;case i.UByte:r[u]=s.getUint8(a),a+=1;break;case i.Short:r[u]=s.getInt16(a,!0),a+=2;break;case i.UShort:r[u]=s.getUint16(a,!0),a+=2;break;case i.Int:r[u]=s.getInt32(a,!0),a+=4;break;case i.UInt:r[u]=s.getUint32(a,!0),a+=4;break;case i.Long:r[u]=Number(s.getBigInt64(a,!0)),a+=8;break;case i.ULong:r[u]=Number(s.getBigUint64(a,!0)),a+=8;break;case i.Double:r[u]=s.getFloat64(a,!0),a+=8;break;case i.DateTime:case i.String:{const t=s.getUint32(a,!0);a+=4,r[u]=m.decode(n.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return r}(t,r)),n}var E,O=new Uint8Array(0);function L(t,e){if(!t.length)return e;if(!e.length)return t;var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function S(t){this._source=t,this._array=O,this._index=0}S.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(r){return t._array=O,t._index=0,r.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:L(e,r.value)}}))},S.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,r=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var i=new Uint8Array(t);return i.set(this._array.subarray(this._index)),function n(){return e._source.read().then((function(s){return s.done?(e._array=O,e._index=0,r>0?i.subarray(0,r):null):r+s.value.length>=t?(e._array=s.value,e._index=t-r,i.set(s.value.subarray(0,t-r),r),i):(i.set(s.value,r),r+=s.value.length,n())}))}()},S.prototype.cancel=function(){return this._source.cancel()},function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error"}(E||(E={}));class x{static debug(...t){this.log(E.Debug,...t)}static info(...t){this.log(E.Info,...t)}static warn(...t){this.log(E.Warn,...t)}static error(...t){this.log(E.Error,...t)}static log(t,...e){if(!(this.logLevel>t))switch(t){case E.Debug:console.debug(...e);break;case E.Info:console.info(...e);break;case E.Warn:console.warn(...e);break;case E.Error:console.error(...e)}}}function P(t,e){e=Math.min(Math.max(+e,2),65535);let r=t,i=r;do{r=Math.ceil(r/e),i+=r}while(1!==r);return 40*i}function U(t,e){if(0!=(4293918720&t))throw Error("integer is too large to be safely represented");return e+t*2**32}x.logLevel=E.Info;const T=new Uint8Array([102,103,98,3,102,103,98,0]);class N{constructor(t,e,r,i){this.headerClient=t,this.header=e,this.headerLength=r,this.indexLength=i}static async open(t){let e=new C(t);const r=(()=>{let t,e=0;for(t=0;t<3;t++)e+=16**t*40;return e})(),i=2024+r;x.debug(`fetching header. minReqLength: ${i} (assumedHeaderLength: 2024, assumedIndexLength: ${r})`);{let t=new Uint8Array(await e.getRange(0,8,i,"header"));if(!t.every((t,e)=>T[e]===t))throw x.error(`bytes: ${t} != ${T}`),new Error("Not a FlatGeobuf file");x.debug("magic bytes look good")}let n;{let t=await e.getRange(8,4,i,"header");if(n=new DataView(t).getUint32(0,!0),n>10485760||n<8)throw new Error("Invalid header size");x.debug("headerLength: "+n)}const s=await e.getRange(12,n,i,"header"),a=new o.ByteBuffer(new Uint8Array(s)),u=b.fromByteBuffer(a),h=P(u.featuresCount,u.indexNodeSize);return x.debug("completed: opening http reader"),new N(e,u,n,h)}async*selectBbox(t){const e=this.lengthBeforeTree();let r=this.headerClient;x.debug("starting: selectBbox, traversing index. lengthBeforeTree: "+e),yield*async function*(t,e,r,i){class n{constructor(t,e){this._level=e,this.nodes=t}level(){return this._level}startNode(){return this.nodes[0]}endNode(){return this.nodes[1]}extendEndNodeToNewOffset(t){console.assert(t>this.nodes[1]),this.nodes[1]=t}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}const{minX:s,minY:o,maxX:a,maxY:u}=r,h=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let r=t,i=r;const n=[r];do{r=Math.ceil(r/e),i+=r,n.push(r)}while(1!==r);const s=[];r=i;for(const t of n)s.push(r-t),r-=t;s.reverse(),n.reverse();const o=[];for(let t=0;t<n.length;t++)o.push([s[t],s[t]+n[t]]);return o.reverse(),o}(t,e),d=h[0][0],b=[(()=>{const t=h.length-1;return new n([0,1],t)})()];for(x.debug(`starting stream search with queue: ${b}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${h}`);0!=b.length;){const t=b.shift();x.debug(`popped node: ${t}, queueLength: ${b.length}`);let r=t.startNode();const c=r>=d,[,f]=h[t.level()],l=Math.min(t.endNode()+e,f),p=l-r,_=await i(40*r,40*p),y=new Float64Array(_),g=new Uint32Array(_);for(let e=r;e<l;e++){const i=5*(e-r);if(a<y[i+0])continue;if(u<y[i+1])continue;if(s>y[i+2])continue;if(o>y[i+3])continue;const h=g[8+(i<<1)],f=U(g[9+(i<<1)],h);if(c){x.debug("yielding feature"),yield[f,e-d];continue}const l=6553.6,p=b[b.length-1];if(void 0!==p&&p.level()==t.level()-1&&f<p.endNode()+l){x.debug(`Extending existing node: ${p}, newOffset: ${p.endNode()} -> ${f}`),p.extendEndNodeToNewOffset(f);continue}let _=(()=>{let e=t.level()-1;return new n([f,f+1],e)})();void 0!==p&&p.level()==t.level()-1?x.debug(`pushing new node at offset: ${f} rather than merging with distant ${p}`):x.debug(`pushing new level for ${_} onto queue with tail: ${p}`),b.push(_)}}}(this.header.featuresCount,this.header.indexNodeSize,t,(async function(t,i){return r.getRange(e+t,i,0,"index")}))}lengthBeforeTree(){return T.length+4+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}featureClient(){return void 0===this._featureClient&&(this._featureClient=this.headerClient.clone()),this._featureClient}async readFeature(t){const e=131072;let r,i=t+this.lengthBeforeFeatures();{const t=await this.featureClient().getRange(i,4,e,"feature length");r=new DataView(t).getUint32(0,!0)}x.debug(`featureOffset: ${i}, featureLength: ${r}`);let n=await this.featureClient().getRange(i+4,r,e,"feature data"),s=new Uint8Array(n);const a=new Uint8Array(r+4);a.set(s,4);const u=new o.ByteBuffer(a);return u.setPosition(4),l.getRoot(u)}}class C{constructor(t){this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof t?new M(t):t}clone(){let t=new C(this.httpClient);return t.buffer=this.buffer.slice(0),t.head=this.head,t}async getRange(t,e,r,i){x.debug(`need Range: ${t}-${t+e-1}`);const n=t-this.head,s=n+e;if(n>=0&&s<this.buffer.byteLength)return x.debug(`slicing existing Range: ${n}-${s-1}`),this.buffer.slice(n,s);let o=Math.max(e,r);return this.buffer=await this.httpClient.getRange(t,o,i),this.head=t,this.buffer.slice(0,e)}}class M{constructor(t){this.requestsEverMade=0,this.bytesEverRequested=0,this.url=t}async getRange(t,e,r){this.requestsEverMade+=1,this.bytesEverRequested+=e;let i=`bytes=${t}-${t+e-1}`;return x.debug(`request: #${this.requestsEverMade}, purpose: ${r}), bytes: (this_request: ${e}, ever: ${this.bytesEverRequested}), Range: ${i}`),(await fetch(this.url,{headers:{Range:i}})).arrayBuffer()}}async function V(t,e,r){let i=new Uint8Array(await t(4,"feature length"));if(0===i.byteLength)return;let n=new o.ByteBuffer(i);const s=n.readUint32(0);i=new Uint8Array(await t(s,"feature data"));const a=new Uint8Array(s+4);return a.set(i,4),n=new o.ByteBuffer(a),n.setPosition(4),r(l.getRoot(n),e)}function j(t){const e=new o.Builder;let r=null;t.columns&&(r=h.createColumnsVector(e,t.columns.map(t=>function(t,e){const r=t.createString(e.name);return a.start(t),a.addName(t,r),a.addType(t,e.type),a.end(t)}(e,t))));const i=e.createString("L1");h.start(e),h.addFeaturesCount(e,new o.Long(t.featuresCount,0)),h.addGeometryType(e,t.geometryType),h.addIndexNodeSize(e,0),r&&h.addColumns(e,r),h.addName(e,i);const n=h.end(e);return e.finishSizePrefixed(n),e.asUint8Array()}t.deserialize=function(t,e,r){return t instanceof Uint8Array?function(t,e){return{type:"FeatureCollection",features:function(t,e,r){if(!t.subarray(0,7).every((t,e)=>T[e]===t))throw new Error("Not a FlatGeobuf file");const i=new o.ByteBuffer(t),n=i.readUint32(T.length);i.setPosition(T.length+4);const s=b.fromByteBuffer(i);r&&r(s);let a=T.length+4+n;const{indexNodeSize:u,featuresCount:h}=s;u>0&&(a+=P(h,u));const d=[];for(;a<i.capacity();){const t=i.readUint32(a);i.setPosition(a+4);const r=l.getRoot(i);d.push(e(r,s)),a+=4+t}return d}(t,F,e)}}(t,r):t instanceof ReadableStream?function(t,e){return async function*(t,e,r){const i="function"==typeof(n=t).slice?n:new S("function"==typeof n.read?n:n.getReader());var n;const s=async t=>await i.slice(t);let a=new Uint8Array(await s(8));if(!a.every((t,e)=>T[e]===t))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await s(4));let u=new o.ByteBuffer(a);const h=u.readUint32(0);a=new Uint8Array(await s(h)),u=new o.ByteBuffer(a);const d=b.fromByteBuffer(u);r&&r(d);const{indexNodeSize:c,featuresCount:f}=d;if(c>0){const t=P(f,c);await s(t)}let l;for(;l=await V(s,d,e);)yield l}(t,F,e)}(t,r):function(t,e,r){return async function*(t,e,r,i){const n=await N.open(t);x.debug("opened reader"),i&&i(n.header);for await(let t of n.selectBbox(e)){let e=await n.readFeature(t[0]);yield r(e,n.header)}}(t,e,F,r)}(t,e,r)},t.serialize=function(t){return function(t){const r=function(t){const r=t.features[0],n=r.properties;let s=null;return n&&(s=Object.keys(n).map(t=>new e(t,function(t){if("boolean"==typeof t)return i.Bool;if("number"==typeof t)return t%1==0?i.Int:i.Double;if("string"==typeof t)return i.String;if(null===t)return i.String;throw new Error(`Unknown type (value '${t}')`)}(n[t]),null,null,-1,-1,-1,!0,!1,!1))),new b(g(r.geometry.type),s,t.features.length,0,null,null,null,null)}(t),n=j(r),s=t.features.map(t=>B(v(t.geometry),t.properties,r)),o=s.map(t=>t.length).reduce((t,e)=>t+e),a=new Uint8Array(T.length+n.length+o);a.set(n,T.length);let u=T.length+n.length;for(const t of s)a.set(t,u),u+=t.length;return a.set(T),a}(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e)}]); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var r in i)("object"==typeof exports?exports:t)[r]=i[r]}}(window,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e,i){!function(t){"use strict";var e,i,r={SIZEOF_SHORT:2,SIZEOF_INT:4,FILE_IDENTIFIER_LENGTH:4,SIZE_PREFIX_LENGTH:4,Encoding:{UTF8_BYTES:1,UTF16_STRING:2}};r.int32=new Int32Array(2),r.float32=new Float32Array(r.int32.buffer),r.float64=new Float64Array(r.int32.buffer),r.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],r.Long=function(t,e){this.low=0|t,this.high=0|e},r.Long.create=function(t,e){return 0==t&&0==e?r.Long.ZERO:new r.Long(t,e)},r.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},r.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},r.Long.ZERO=new r.Long(0,0),r.Builder=function(t){if(t)e=t;else var e=1024;this.bb=r.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},r.Builder.prototype.dataBuffer=function(){return this.bb},r.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},r.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var i=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<i+t+e;){var s=this.bb.capacity();this.bb=r.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)},r.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},r.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},r.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},r.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},r.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},r.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},r.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},r.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},r.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},r.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},r.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},r.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},r.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},r.Builder.prototype.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},r.Builder.prototype.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},r.Builder.prototype.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},r.Builder.prototype.addFieldInt64=function(t,e,i){!this.force_defaults&&e.equals(i)||(this.addInt64(e),this.slot(t))},r.Builder.prototype.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},r.Builder.prototype.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},r.Builder.prototype.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},r.Builder.prototype.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},r.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},r.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},r.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},r.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},r.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,s=r.ByteBuffer.allocate(i);return s.setPosition(i-e),s.bytes().set(t.bytes(),i-e),s},r.Builder.prototype.addOffset=function(t){this.prep(r.SIZEOF_INT,0),this.writeInt32(this.offset()-t+r.SIZEOF_INT)},r.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},r.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var s=(i+2)*r.SIZEOF_SHORT;this.addInt16(s);var n=0,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(a)){for(var b=r.SIZEOF_SHORT;b<s;b+=r.SIZEOF_SHORT)if(this.bb.readInt16(o+b)!=this.bb.readInt16(a+b))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},r.Builder.prototype.finish=function(t,e,i){var s=i?r.SIZE_PREFIX_LENGTH:0;if(e){var n=e;if(this.prep(this.minalign,r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH+s),n.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var o=r.FILE_IDENTIFIER_LENGTH-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,r.SIZEOF_INT+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},r.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},r.Builder.prototype.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")},r.Builder.prototype.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(r.SIZEOF_INT,t*e),this.prep(i,t*e)},r.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},r.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var i=0;i<t.length;){var r,s=t.charCodeAt(i++);(r=s<55296||s>=56320?s:(s<<10)+t.charCodeAt(i++)+-56613888)<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),i=0;for(var n=this.space,o=this.bb.bytes();i<e.length;i++)o[n++]=e[i];return this.endVector()},r.Builder.prototype.createLong=function(t,e){return r.Long.create(t,e)},r.ByteBuffer=function(t){this.bytes_=t,this.position_=0},r.ByteBuffer.allocate=function(t){return new r.ByteBuffer(new Uint8Array(t))},r.ByteBuffer.prototype.clear=function(){this.position_=0},r.ByteBuffer.prototype.bytes=function(){return this.bytes_},r.ByteBuffer.prototype.position=function(){return this.position_},r.ByteBuffer.prototype.setPosition=function(t){this.position_=t},r.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},r.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},r.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},r.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},r.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},r.ByteBuffer.prototype.readInt64=function(t){return new r.Long(this.readInt32(t),this.readInt32(t+4))},r.ByteBuffer.prototype.readUint64=function(t){return new r.Long(this.readUint32(t),this.readUint32(t+4))},r.ByteBuffer.prototype.readFloat32=function(t){return r.int32[0]=this.readInt32(t),r.float32[0]},r.ByteBuffer.prototype.readFloat64=function(t){return r.int32[r.isLittleEndian?0:1]=this.readInt32(t),r.int32[r.isLittleEndian?1:0]=this.readInt32(t+4),r.float64[0]},r.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},r.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},r.ByteBuffer.prototype.writeFloat32=function(t,e){r.float32[0]=e,this.writeInt32(t,r.int32[0])},r.ByteBuffer.prototype.writeFloat64=function(t,e){r.float64[0]=e,this.writeInt32(t,r.int32[r.isLittleEndian?0:1]),this.writeInt32(t+4,r.int32[r.isLittleEndian?1:0])},r.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<r.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+r.SIZEOF_INT+e));return t},r.ByteBuffer.prototype.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},r.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t),s="",n=0;if(t+=r.SIZEOF_INT,e===r.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;n<i;){var o,a=this.readUint8(t+n++);if(a<192)o=a;else{var b=this.readUint8(t+n++);if(a<224)o=(31&a)<<6|63&b;else{var d=this.readUint8(t+n++);o=a<240?(15&a)<<12|(63&b)<<6|63&d:(7&a)<<18|(63&b)<<12|(63&d)<<6|63&this.readUint8(t+n++)}}o<65536?s+=String.fromCharCode(o):(o-=65536,s+=String.fromCharCode(55296+(o>>10),56320+(1023&o)))}return s},r.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},r.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+r.SIZEOF_INT},r.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var e=0;e<r.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+r.SIZEOF_INT+e))return!1;return!0},r.ByteBuffer.prototype.createLong=function(t,e){return r.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(e||(e={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(i||(i={}));class s{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new s).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new s).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):i.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,i.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,n,o,a,b,d,h,u,f){return s.start(t),s.addName(t,e),s.addType(t,i),s.addTitle(t,r),s.addDescription(t,n),s.addWidth(t,o),s.addPrecision(t,a),s.addScale(t,b),s.addNullable(t,d),s.addUnique(t,h),s.addPrimaryKey(t,u),s.addMetadata(t,f),s.end(t)}}class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,i,r,s,o,a){return n.start(t),n.addOrg(t,e),n.addCode(t,i),n.addName(t,r),n.addDescription(t,s),n.addWkt(t,o),n.addCodeString(t,a),n.end(t)}}class o{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new o).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new o).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):e.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new s).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new n).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,i){t.addFieldInt8(2,i,e.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r,s,n,a,b,d,h,u,f,c,l,_){return o.start(t),o.addName(t,e),o.addEnvelope(t,i),o.addGeometryType(t,r),o.addHasZ(t,s),o.addHasM(t,n),o.addHasT(t,a),o.addHasTM(t,b),o.addColumns(t,d),o.addFeaturesCount(t,h),o.addIndexNodeSize(t,u),o.addCrs(t,f),o.addTitle(t,c),o.addDescription(t,l),o.addMetadata(t,_),o.end(t)}}const a={[i.Byte]:Uint8Array,[i.UByte]:Uint8Array,[i.Bool]:Uint8Array,[i.Short]:Uint16Array,[i.UShort]:Uint16Array,[i.Int]:Uint32Array,[i.UInt]:Uint32Array,[i.Long]:BigUint64Array,[i.ULong]:BigUint64Array,[i.Float]:Float64Array,[i.Double]:Float64Array,[i.String]:String,[i.Json]:String,[i.DateTime]:String,[i.Binary]:String};class b{constructor(t,e,i,r,s,n,o,b,d,h){this.name=t,this.type=e,this.title=i,this.description=r,this.width=s,this.precision=n,this.scale=o,this.nullable=b,this.unique=d,this.primary_key=h,this.arrayType=a[e]}}class d{constructor(t,e,i,r,s,n,o,a){this.geometryType=t,this.columns=e,this.featuresCount=i,this.indexNodeSize=r,this.crs=s,this.title=n,this.description=o,this.metadata=a}}var h,u;!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(h||(h={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(u||(u={}));class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):u.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,u.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,a,b,d,h,u){return f.start(t),f.addName(t,e),f.addType(t,i),f.addTitle(t,r),f.addDescription(t,s),f.addWidth(t,n),f.addPrecision(t,o),f.addScale(t,a),f.addNullable(t,b),f.addUnique(t,d),f.addPrimaryKey(t,h),f.addMetadata(t,u),f.end(t)}}class c{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new c).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new c).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):h.Unknown}parts(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new c).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,h.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o,a,b){return c.start(t),c.addEnds(t,e),c.addXy(t,i),c.addZ(t,r),c.addM(t,s),c.addT(t,n),c.addTm(t,o),c.addType(t,a),c.addParts(t,b),c.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+r.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new c).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var i=this.bb.__offset(this.bb_pos,8);return i?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r){return l.start(t),l.addGeometry(t,e),l.addProperties(t,i),l.addColumns(t,r),l.end(t)}}function _(t,e,i){if(0!==t.length)if(Array.isArray(t[0]))for(const r of t)_(r,e,i);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),i.push(t[2]))}function p(t,e){const i=[];for(let r=0;r<t.length;r+=2){const s=[t[r],t[r+1]];e&&s.push(e[r>>1]),i.push(s)}return i}function y(t){return t?e[t]:e.Unknown}function g(t){const e=t.coordinates,i=[],r=[];let s,n;const o=y(t.type);let a=0;switch(t.type){case"Point":_(e,i,r);break;case"MultiPoint":case"LineString":_(e,i,r);break;case"MultiLineString":case"Polygon":{const t=e;_(t,i,r),t.length>1&&(s=t.map(t=>a+=t.length));break}case"MultiPolygon":n=e.map(t=>({type:"Polygon",coordinates:t})).map(g);break;case"GeometryCollection":t.geometries&&(n=t.geometries.map(g))}return{xy:i,z:r.length>0?r:void 0,ends:s,type:o,parts:n}}function v(t,i){if(i===e.GeometryCollection){const r=[];for(let e=0;e<t.partsLength();e++){const i=t.parts(e),s=i.type();r.push(v(i,s))}return{type:e[i],geometries:r}}if(i===e.MultiPolygon){const r=[];for(let i=0;i<t.partsLength();i++)r.push(v(t.parts(i),e.Polygon));return{type:e[i],coordinates:r.map(t=>t.coordinates)}}const r=function(t,i){const r=t.xyArray(),s=t.zArray();switch(i){case e.Point:{const t=Array.from(r);return s&&t.push(s[0]),t}case e.MultiPoint:case e.LineString:return p(r,s);case e.MultiLineString:case e.Polygon:return function(t,e,i){if(!i||0===i.length)return[p(t,e)];let r=0;const s=Array.from(i).map(e=>t.slice(r,r=e<<1));let n;return e&&(r=0,n=Array.from(i).map(t=>e.slice(r,r=t))),s.map((t,e)=>p(t,n?n[e]:void 0))}(r,s,t.endsArray())}}(t,i);return{type:e[i],coordinates:r}}const I=new TextEncoder,w=new TextDecoder;function B(t,e,s){const n=s.columns,o=new r.Builder,a=[];if(n)for(let t=0;t<n.length;t++){const r=n[t],s=e[r.name];if(null!==s)switch(a.push(Uint16Array.of(t)),r.type){case i.Bool:case i.Short:case i.UShort:case i.Int:case i.UInt:case i.Long:case i.Double:a.push(r.arrayType.of(s));break;case i.DateTime:case i.String:{const t=I.encode(s);a.push(Uint32Array.of(t.length)),a.push(t);break}default:throw new Error("Unknown type "+r.type)}}let b=null;a.length>0&&(b=l.createPropertiesVector(o,function(t,...e){let i=0;for(const t of e)i+=t.byteLength;const r=new t(i);let s=0;for(const i of e)i instanceof Uint8Array?r.set(i,s):r.set(new t(i.buffer),s),s+=i.byteLength;return r}(Uint8Array,...a)));const d=function t(e,i){const{xy:r,z:s,ends:n,parts:o,type:a}=i;if(o){const i=o.map(i=>t(e,i)),r=c.createPartsVector(e,i);return c.start(e),c.addParts(e,r),c.end(e)}const b=c.createXyVector(e,r);let d,h;return s&&(d=c.createZVector(e,s)),n&&(h=c.createEndsVector(e,n)),c.start(e),h&&c.addEnds(e,h),c.addXy(e,b),d&&c.addZ(e,d),c.addType(e,a),c.end(e)}(o,t);l.start(o),l.addGeometry(o,d),b&&l.addProperties(o,b);const h=l.end(o);return o.finishSizePrefixed(h),o.asUint8Array()}function m(t,e){const r=e.columns,s={type:"Feature",geometry:v(t.geometry(),e.geometryType)};return r&&r.length>0&&(s.properties=function(t,e){const r={};if(!e||0===e.length)return r;const s=t.propertiesArray();if(!s)return r;const n=new DataView(s.buffer,s.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=n.getUint16(a,!0);a+=2;const o=e[t],b=o.name;switch(o.type){case i.Bool:r[b]=!!n.getUint8(a),a+=1;break;case i.Byte:r[b]=n.getInt8(a),a+=1;break;case i.UByte:r[b]=n.getUint8(a),a+=1;break;case i.Short:r[b]=n.getInt16(a,!0),a+=2;break;case i.UShort:r[b]=n.getUint16(a,!0),a+=2;break;case i.Int:r[b]=n.getInt32(a,!0),a+=4;break;case i.UInt:r[b]=n.getUint32(a,!0),a+=4;break;case i.Long:r[b]=Number(n.getBigInt64(a,!0)),a+=8;break;case i.ULong:r[b]=Number(n.getBigUint64(a,!0)),a+=8;break;case i.Double:r[b]=n.getFloat64(a,!0),a+=8;break;case i.DateTime:case i.String:{const t=n.getUint32(a,!0);a+=4,r[b]=w.decode(s.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return r}(t,r)),s}var F=new Uint8Array(0);function S(t,e){if(!t.length)return e;if(!e.length)return t;var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}function E(t){this._source=t,this._array=F,this._index=0}E.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(i){return t._array=F,t._index=0,i.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:S(e,i.value)}}))},E.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,i=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var r=new Uint8Array(t);return r.set(this._array.subarray(this._index)),function s(){return e._source.read().then((function(n){return n.done?(e._array=F,e._index=0,i>0?r.subarray(0,i):null):i+n.value.length>=t?(e._array=n.value,e._index=t-i,r.set(n.value.subarray(0,t-i),i),r):(r.set(n.value,i),i+=n.value.length,s())}))}()},E.prototype.cancel=function(){return this._source.cancel()};class U{constructor(t,e,i,r,s,n){this.org=t,this.code=e,this.name=i,this.description=r,this.wkt=s,this.code_string=n}}function T(t,e){e=Math.min(Math.max(+e,2),65535);let i=t,r=i;do{i=Math.ceil(i/e),r+=i}while(1!==i);return 40*r}const L=new Uint8Array([102,103,98,3,102,103,98,0]);function O(t){const e=o.getRoot(t),i=e.featuresCount().toFloat64(),r=e.indexNodeSize(),s=[];for(let t=0;t<e.columnsLength();t++){const i=e.columns(t);if(!i)throw new Error("Column unexpectedly missing");if(!i.name())throw new Error("Column name unexpectedly missing");s.push(new b(i.name(),i.type(),i.title(),i.description(),i.width(),i.precision(),i.scale(),i.nullable(),i.unique(),i.primaryKey()))}const n=e.crs(),a=n?new U(n.org(),n.code(),n.name(),n.description(),n.wkt(),n.codeString()):null;return new d(e.geometryType(),s,i,r,a,e.title(),e.description(),e.metadata())}async function*P(t,e,i,s,n){let o=0,a=new Uint8Array(await e(8));if(o+=8,!a.every((t,e)=>L[e]===t))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await e(4)),o+=4;let b=new r.ByteBuffer(a);const d=b.readUint32(0);a=new Uint8Array(await e(d)),o+=d,b=new r.ByteBuffer(a);const h=O(b);n&&n(h);const{indexNodeSize:u,featuresCount:f}=h;if(u>0){const r=T(f,u);if(s&&i){const n=async(t,r)=>(await i(o+t),await e(r)),a=[];for await(const[t]of async function*(t,e,i,r){const{minX:s,minY:n,maxX:o,maxY:a}=i,b=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let i=t,r=i;const s=[i];do{i=Math.ceil(i/e),r+=i,s.push(i)}while(1!==i);const n=[];i=r;for(const t of s)n.push(i-t),i-=t;n.reverse(),s.reverse();const o=[];for(let t=0;t<s.length;t++)o.push([n[t],n[t]+s[t]]);return o.reverse(),o}(t,e),[[d,h]]=b,u=[];for(u.push([0,b.length-1]);0!==u.length;){const[i,f]=u.pop(),c=i>=h-t,[,l]=b[f],_=Math.min(i+e,l),p=_-i,y=await r(40*i,40*p),g=new Float64Array(y),v=new Uint32Array(y);for(let t=i;t<_;t++){const e=5*(t-i);if(o<g[e+0])continue;if(a<g[e+1])continue;if(s>g[e+2])continue;if(n>g[e+3])continue;const r=v[8+(e<<1)];c?yield[r,t-d]:u.push([r,f-1])}u.sort((t,e)=>e[0]-t[0])}}(f,u,s,n))a.push(t);o+=r;for await(const r of a){await i(o+r);const s=await N(e,h,t);s&&(yield s)}return}i?await i(o+r):await e(r),o+=r}let c;for(;c=await N(e,h,t);)yield c}async function N(t,e,i){let s=new Uint8Array(await t(4));if(0===s.byteLength)return;let n=new r.ByteBuffer(s);const o=n.readUint32(0);s=new Uint8Array(await t(o));const a=new Uint8Array(o+4);return a.set(s,4),n=new r.ByteBuffer(a),n.setPosition(4),i(l.getRoot(n),e)}function C(t){const e=new r.Builder;let i=null;t.columns&&(i=o.createColumnsVector(e,t.columns.map(t=>function(t,e){const i=t.createString(e.name);return s.start(t),s.addName(t,i),s.addType(t,e.type),s.end(t)}(e,t))));const n=e.createString("L1");o.start(e),o.addFeaturesCount(e,new r.Long(t.featuresCount,0)),o.addGeometryType(e,t.geometryType),o.addIndexNodeSize(e,0),i&&o.addColumns(e,i),o.addName(e,n);const a=o.end(e);return e.finishSizePrefixed(a),e.asUint8Array()}t.deserialize=function(t,e,i){return t instanceof Uint8Array?function(t,e){return{type:"FeatureCollection",features:function(t,e,i){if(!t.subarray(0,7).every((t,e)=>L[e]===t))throw new Error("Not a FlatGeobuf file");const s=new r.ByteBuffer(t),n=s.readUint32(L.length);s.setPosition(L.length+4);const o=O(s);i&&i(o);let a=L.length+4+n;const{indexNodeSize:b,featuresCount:d}=o;b>0&&(a+=T(d,b));const h=[];for(;a<s.capacity();){const t=s.readUint32(a);s.setPosition(a+4);const i=l.getRoot(s);h.push(e(i,o)),a+=4+t}return h}(t,m,e)}}(t,i):t instanceof ReadableStream?function(t,e){return function(t,e,i){const r="function"==typeof(s=t).slice?s:new E("function"==typeof s.read?s:s.getReader());var s;return P(e,async t=>await r.slice(t),void 0,void 0,i)}(t,m,e)}(t,i):function(t,e,i){return function(t,e,i,r){let s=0;return P(i,async e=>{const i=await fetch(t,{headers:{Range:`bytes=${s}-${s+e-1}`}});return s+=e,await i.arrayBuffer()},async t=>{s=t},e,r)}(t,e,m,i)}(t,e,i)},t.serialize=function(t){return function(t){const e=function(t){const e=t.features[0],r=e.properties;let s=null;return r&&(s=Object.keys(r).map(t=>new b(t,function(t){if("boolean"==typeof t)return i.Bool;if("number"==typeof t)return t%1==0?i.Int:i.Double;if("string"==typeof t)return i.String;if(null===t)return i.String;throw new Error(`Unknown type (value '${t}')`)}(r[t]),null,null,-1,-1,-1,!0,!1,!1))),new d(y(e.geometry.type),s,t.features.length,0,null,null,null,null)}(t),r=C(e),s=t.features.map(t=>B(g(t.geometry),t.properties,e)),n=s.map(t=>t.length).reduce((t,e)=>t+e),o=new Uint8Array(L.length+r.length+n);o.set(r,L.length);let a=L.length+r.length;for(const t of s)o.set(t,a),a+=t.length;return o.set(L),o}(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,i){(function(e){const r=i(3),s="undefined"==typeof window?e:window;s.loaders=s.loaders||{},t.exports=Object.assign(s.loaders,r)}).call(this,i(2))},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";i.r(e),i.d(e,"FlatGeobufLoader",(function(){return n}));var r=i(0);function s(t,e){if(0===t.byteLength)return[];const i=new Uint8Array(t),{features:s}=Object(r.deserialize)(i);return s}const n={...{id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.0-alpha.18",worker:!0,extensions:["fgb"],category:"geometry",options:{flatgeobuf:{}}},parse:async(t,e)=>s(t),parseSync:s,parseInBatchesFromStream:function(t,e){return Object(r.deserializeStream)(t)},binary:!0}}])})); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var r in i)("object"==typeof exports?exports:t)[r]=i[r]}}(window,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e,i){!function(t){"use strict";class e{constructor(t,e,i,r,s,n,o,a,b,d){this.name=t,this.type=e,this.title=i,this.description=r,this.width=s,this.precision=n,this.scale=o,this.nullable=a,this.unique=b,this.primary_key=d}}var i,r,s,n,o={SIZEOF_SHORT:2,SIZEOF_INT:4,FILE_IDENTIFIER_LENGTH:4,SIZE_PREFIX_LENGTH:4,Encoding:{UTF8_BYTES:1,UTF16_STRING:2}};o.int32=new Int32Array(2),o.float32=new Float32Array(o.int32.buffer),o.float64=new Float64Array(o.int32.buffer),o.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],o.Long=function(t,e){this.low=0|t,this.high=0|e},o.Long.create=function(t,e){return 0==t&&0==e?o.Long.ZERO:new o.Long(t,e)},o.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},o.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},o.Long.ZERO=new o.Long(0,0),o.Builder=function(t){if(t)e=t;else var e=1024;this.bb=o.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},o.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},o.Builder.prototype.dataBuffer=function(){return this.bb},o.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},o.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var i=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<i+t+e;){var r=this.bb.capacity();this.bb=o.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)},o.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},o.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},o.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},o.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},o.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},o.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},o.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},o.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},o.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},o.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},o.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},o.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},o.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},o.Builder.prototype.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},o.Builder.prototype.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},o.Builder.prototype.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},o.Builder.prototype.addFieldInt64=function(t,e,i){!this.force_defaults&&e.equals(i)||(this.addInt64(e),this.slot(t))},o.Builder.prototype.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},o.Builder.prototype.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},o.Builder.prototype.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},o.Builder.prototype.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},o.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},o.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},o.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},o.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},o.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=o.ByteBuffer.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},o.Builder.prototype.addOffset=function(t){this.prep(o.SIZEOF_INT,0),this.writeInt32(this.offset()-t+o.SIZEOF_INT)},o.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},o.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*o.SIZEOF_SHORT;this.addInt16(r);var s=0,n=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var b=o.SIZEOF_SHORT;b<r;b+=o.SIZEOF_SHORT)if(this.bb.readInt16(n+b)!=this.bb.readInt16(a+b))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},o.Builder.prototype.finish=function(t,e,i){var r=i?o.SIZE_PREFIX_LENGTH:0;if(e){var s=e;if(this.prep(this.minalign,o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH+r),s.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var n=o.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(s.charCodeAt(n))}this.prep(this.minalign,o.SIZEOF_INT+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},o.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},o.Builder.prototype.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")},o.Builder.prototype.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(o.SIZEOF_INT,t*e),this.prep(i,t*e)},o.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},o.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var i=0;i<t.length;){var r,s=t.charCodeAt(i++);(r=s<55296||s>=56320?s:(s<<10)+t.charCodeAt(i++)+-56613888)<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),i=0;for(var n=this.space,o=this.bb.bytes();i<e.length;i++)o[n++]=e[i];return this.endVector()},o.Builder.prototype.createLong=function(t,e){return o.Long.create(t,e)},o.ByteBuffer=function(t){this.bytes_=t,this.position_=0},o.ByteBuffer.allocate=function(t){return new o.ByteBuffer(new Uint8Array(t))},o.ByteBuffer.prototype.clear=function(){this.position_=0},o.ByteBuffer.prototype.bytes=function(){return this.bytes_},o.ByteBuffer.prototype.position=function(){return this.position_},o.ByteBuffer.prototype.setPosition=function(t){this.position_=t},o.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},o.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},o.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},o.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},o.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},o.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},o.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},o.ByteBuffer.prototype.readInt64=function(t){return new o.Long(this.readInt32(t),this.readInt32(t+4))},o.ByteBuffer.prototype.readUint64=function(t){return new o.Long(this.readUint32(t),this.readUint32(t+4))},o.ByteBuffer.prototype.readFloat32=function(t){return o.int32[0]=this.readInt32(t),o.float32[0]},o.ByteBuffer.prototype.readFloat64=function(t){return o.int32[o.isLittleEndian?0:1]=this.readInt32(t),o.int32[o.isLittleEndian?1:0]=this.readInt32(t+4),o.float64[0]},o.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},o.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},o.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},o.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},o.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},o.ByteBuffer.prototype.writeFloat32=function(t,e){o.float32[0]=e,this.writeInt32(t,o.int32[0])},o.ByteBuffer.prototype.writeFloat64=function(t,e){o.float64[0]=e,this.writeInt32(t,o.int32[o.isLittleEndian?0:1]),this.writeInt32(t+4,o.int32[o.isLittleEndian?1:0])},o.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+o.SIZEOF_INT+o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+o.SIZEOF_INT+e));return t},o.ByteBuffer.prototype.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},o.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},o.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t),r="",s=0;if(t+=o.SIZEOF_INT,e===o.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){var n,a=this.readUint8(t+s++);if(a<192)n=a;else{var b=this.readUint8(t+s++);if(a<224)n=(31&a)<<6|63&b;else{var d=this.readUint8(t+s++);n=a<240?(15&a)<<12|(63&b)<<6|63&d:(7&a)<<18|(63&b)<<12|(63&d)<<6|63&this.readUint8(t+s++)}}n<65536?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return r},o.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},o.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+o.SIZEOF_INT},o.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},o.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=o.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+o.FILE_IDENTIFIER_LENGTH);for(var e=0;e<o.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+o.SIZEOF_INT+e))return!1;return!0},o.ByteBuffer.prototype.createLong=function(t,e){return o.Long.create(t,e)},function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(i||(i={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(r||(r={}));class a{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new a).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new a).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):r.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,r.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,b,d,h,u,f){return a.start(t),a.addName(t,e),a.addType(t,i),a.addTitle(t,r),a.addDescription(t,s),a.addWidth(t,n),a.addPrecision(t,o),a.addScale(t,b),a.addNullable(t,d),a.addUnique(t,h),a.addPrimaryKey(t,u),a.addMetadata(t,f),a.end(t)}}class b{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new b).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new b).__init(t.readInt32(t.position())+t.position(),t)}org(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o){return b.start(t),b.addOrg(t,e),b.addCode(t,i),b.addName(t,r),b.addDescription(t,s),b.addWkt(t,n),b.addCodeString(t,o),b.end(t)}}class d{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new d).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new d).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):i.Unknown}hasZ(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTM(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new a).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new b).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,e){t.addFieldInt8(2,e,i.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTM(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,t.createLong(0,0))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r,s,n,o,a,b,h,u,f,c,l,_){return d.start(t),d.addName(t,e),d.addEnvelope(t,i),d.addGeometryType(t,r),d.addHasZ(t,s),d.addHasM(t,n),d.addHasT(t,o),d.addHasTM(t,a),d.addColumns(t,b),d.addFeaturesCount(t,h),d.addIndexNodeSize(t,u),d.addCrs(t,f),d.addTitle(t,c),d.addDescription(t,l),d.addMetadata(t,_),d.end(t)}}class h{constructor(t,e,i,r,s,n){this.org=t,this.code=e,this.name=i,this.description=r,this.wkt=s,this.code_string=n}}class u{constructor(t,e,i,r,s,n,o,a){this.geometryType=t,this.columns=e,this.featuresCount=i,this.indexNodeSize=r,this.crs=s,this.title=n,this.description=o,this.metadata=a}static fromByteBuffer(t){const i=d.getRoot(t),r=i.featuresCount().toFloat64(),s=i.indexNodeSize(),n=[];for(let t=0;t<i.columnsLength();t++){const r=i.columns(t);if(!r)throw new Error("Column unexpectedly missing");if(!r.name())throw new Error("Column name unexpectedly missing");n.push(new e(r.name(),r.type(),r.title(),r.description(),r.width(),r.precision(),r.scale(),r.nullable(),r.unique(),r.primaryKey()))}const o=i.crs(),a=o?new h(o.org(),o.code(),o.name(),o.description(),o.wkt(),o.codeString()):null;return new u(i.geometryType(),n,r,s,a,i.title(),i.description(),i.metadata())}}!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(s||(s={})),function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"}(n||(n={}));class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}name(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):n.Byte}title(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){var t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){var t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){var t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static start(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,n.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,i,r,s,n,o,a,b,d,h,u){return f.start(t),f.addName(t,e),f.addType(t,i),f.addTitle(t,r),f.addDescription(t,s),f.addWidth(t,n),f.addPrecision(t,o),f.addScale(t,a),f.addNullable(t,b),f.addUnique(t,d),f.addPrimaryKey(t,h),f.addMetadata(t,u),f.end(t)}}class c{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new c).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new c).__init(t.readInt32(t.position())+t.position(),t)}ends(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}tmLength(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):s.Unknown}parts(t,e){var i=this.bb.__offset(this.bb_pos,18);return i?(e||new c).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}partsLength(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addFloat64(e[i]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(var i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,s.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static create(t,e,i,r,s,n,o,a,b){return c.start(t),c.addEnds(t,e),c.addXy(t,i),c.addZ(t,r),c.addM(t,s),c.addT(t,n),c.addTm(t,o),c.addType(t,a),c.addParts(t,b),c.end(t)}}class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRoot(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new c).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,e){var i=this.bb.__offset(this.bb_pos,8);return i?(e||new f).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}columnsLength(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static start(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static end(t){return t.endObject()}static finishBuffer(t,e){t.finish(e)}static finishSizePrefixedBuffer(t,e){t.finish(e,void 0,!0)}static create(t,e,i,r){return l.start(t),l.addGeometry(t,e),l.addProperties(t,i),l.addColumns(t,r),l.end(t)}}function _(t,e){const{xy:i,z:r,ends:s,parts:n,type:o}=e;if(n){const e=n.map(e=>_(t,e)),i=c.createPartsVector(t,e);return c.start(t),c.addParts(t,i),c.end(t)}const a=c.createXyVector(t,i);let b,d;return r&&(b=c.createZVector(t,r)),s&&(d=c.createEndsVector(t,s)),c.start(t),d&&c.addEnds(t,d),c.addXy(t,a),b&&c.addZ(t,b),c.addType(t,o),c.end(t)}function p(t,e,i){if(0!==t.length)if(Array.isArray(t[0]))for(const r of t)p(r,e,i);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),i.push(t[2]))}function y(t,e){const i=[];for(let r=0;r<t.length;r+=2){const s=[t[r],t[r+1]];e&&s.push(e[r>>1]),i.push(s)}return i}function g(t){return t?i[t]:i.Unknown}function v(t){const e=t.coordinates,i=[],r=[];let s,n;const o=g(t.type);let a=0;switch(t.type){case"Point":p(e,i,r);break;case"MultiPoint":case"LineString":p(e,i,r);break;case"MultiLineString":case"Polygon":{const t=e;p(t,i,r),t.length>1&&(s=t.map(t=>a+=t.length));break}case"MultiPolygon":n=e.map(t=>({type:"Polygon",coordinates:t})).map(v);break;case"GeometryCollection":t.geometries&&(n=t.geometries.map(v))}return{xy:i,z:r.length>0?r:void 0,ends:s,type:o,parts:n}}function w(t,e){if(e===i.GeometryCollection){const r=[];for(let e=0;e<t.partsLength();e++){const i=t.parts(e),s=i.type();r.push(w(i,s))}return{type:i[e],geometries:r}}if(e===i.MultiPolygon){const r=[];for(let e=0;e<t.partsLength();e++)r.push(w(t.parts(e),i.Polygon));return{type:i[e],coordinates:r.map(t=>t.coordinates)}}const r=function(t,e){const r=t.xyArray(),s=t.zArray();switch(e){case i.Point:{const t=Array.from(r);return s&&t.push(s[0]),t}case i.MultiPoint:case i.LineString:return y(r,s);case i.MultiLineString:case i.Polygon:return function(t,e,i){if(!i||0===i.length)return[y(t,e)];let r=0;const s=Array.from(i).map(e=>t.slice(r,r=e<<1));let n;return e&&(r=0,n=Array.from(i).map(t=>e.slice(r,r=t))),s.map((t,e)=>y(t,n?n[e]:void 0))}(r,s,t.endsArray())}}(t,e);return{type:i[e],coordinates:r}}const I=new TextEncoder,B=new TextDecoder;function m(t,e,i){const s=i.columns,n=new o.Builder;let a=0,b=1024,d=new Uint8Array(b),h=new DataView(d.buffer);const u=function(t){if(a+t<b)return;b*=2;const e=new Uint8Array(b);e.set(d),d=e,h=new DataView(d.buffer,a)};if(s)for(let t=0;t<s.length;t++){const i=s[t],n=e[i.name];if(null!==n)switch(h.setUint16(a,t,!0),a+=2,i.type){case r.Bool:u(1),h.setUint8(a,n),a+=1;break;case r.Short:u(2),h.setInt16(a,n,!0),a+=2;break;case r.UShort:u(2),h.setUint16(a,n,!0),a+=2;break;case r.Int:u(4),h.setInt32(a,n,!0),a+=4;break;case r.UInt:u(4),h.setUint32(a,n,!0),a+=4;break;case r.Long:u(8),h.setBigInt64(a,BigInt(n),!0),a+=8;break;case r.Double:u(8),h.setFloat64(a,n,!0),a+=8;break;case r.DateTime:case r.String:{const t=I.encode(n);u(4),h.setUint32(a,t.length,!0),a+=4,u(t.length),d.set(t,a),a+=t.length;break}default:throw new Error("Unknown type "+i.type)}}let f=null;a>0&&(f=l.createPropertiesVector(n,d.slice(0,a)));const c=_(n,t);l.start(n),l.addGeometry(n,c),f&&l.addProperties(n,f);const p=l.end(n);return n.finishSizePrefixed(p),n.asUint8Array()}function F(t,e){const i=e.columns,s={type:"Feature",geometry:w(t.geometry(),e.geometryType)};return i&&i.length>0&&(s.properties=function(t,e){const i={};if(!e||0===e.length)return i;const s=t.propertiesArray();if(!s)return i;const n=new DataView(s.buffer,s.byteOffset),o=t.propertiesLength();let a=0;for(;a<o;){const t=n.getUint16(a,!0);a+=2;const o=e[t],b=o.name;switch(o.type){case r.Bool:i[b]=!!n.getUint8(a),a+=1;break;case r.Byte:i[b]=n.getInt8(a),a+=1;break;case r.UByte:i[b]=n.getUint8(a),a+=1;break;case r.Short:i[b]=n.getInt16(a,!0),a+=2;break;case r.UShort:i[b]=n.getUint16(a,!0),a+=2;break;case r.Int:i[b]=n.getInt32(a,!0),a+=4;break;case r.UInt:i[b]=n.getUint32(a,!0),a+=4;break;case r.Long:i[b]=Number(n.getBigInt64(a,!0)),a+=8;break;case r.ULong:i[b]=Number(n.getBigUint64(a,!0)),a+=8;break;case r.Double:i[b]=n.getFloat64(a,!0),a+=8;break;case r.DateTime:case r.String:{const t=n.getUint32(a,!0);a+=4,i[b]=B.decode(s.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return i}(t,i)),s}var E,S=new Uint8Array(0);function U(t,e){if(!t.length)return e;if(!e.length)return t;var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}function T(t){this._source=t,this._array=S,this._index=0}T.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(i){return t._array=S,t._index=0,i.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:U(e,i.value)}}))},T.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,i=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var r=new Uint8Array(t);return r.set(this._array.subarray(this._index)),function s(){return e._source.read().then((function(n){return n.done?(e._array=S,e._index=0,i>0?r.subarray(0,i):null):i+n.value.length>=t?(e._array=n.value,e._index=t-i,r.set(n.value.subarray(0,t-i),i),r):(r.set(n.value,i),i+=n.value.length,s())}))}()},T.prototype.cancel=function(){return this._source.cancel()},function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error"}(E||(E={}));class L{static debug(...t){this.log(E.Debug,...t)}static info(...t){this.log(E.Info,...t)}static warn(...t){this.log(E.Warn,...t)}static error(...t){this.log(E.Error,...t)}static log(t,...e){if(!(this.logLevel>t))switch(t){case E.Debug:console.debug(...e);break;case E.Info:console.info(...e);break;case E.Warn:console.warn(...e);break;case E.Error:console.error(...e)}}}function O(t,e){e=Math.min(Math.max(+e,2),65535);let i=t,r=i;do{i=Math.ceil(i/e),r+=i}while(1!==i);return 40*r}function N(t,e){if(0!=(4293918720&t))throw Error("integer is too large to be safely represented");return e+t*2**32}L.logLevel=E.Info;const P=new Uint8Array([102,103,98,3,102,103,98,0]);class C{constructor(t,e,i,r){this.headerClient=t,this.header=e,this.headerLength=i,this.indexLength=r}static async open(t){let e=new x(t);const i=(()=>{let t,e=0;for(t=0;t<3;t++)e+=16**t*40;return e})(),r=2024+i;L.debug(`fetching header. minReqLength: ${r} (assumedHeaderLength: 2024, assumedIndexLength: ${i})`);{let t=new Uint8Array(await e.getRange(0,8,r,"header"));if(!t.every((t,e)=>P[e]===t))throw L.error(`bytes: ${t} != ${P}`),new Error("Not a FlatGeobuf file");L.debug("magic bytes look good")}let s;{let t=await e.getRange(8,4,r,"header");if(s=new DataView(t).getUint32(0,!0),s>10485760||s<8)throw new Error("Invalid header size");L.debug("headerLength: "+s)}const n=await e.getRange(12,s,r,"header"),a=new o.ByteBuffer(new Uint8Array(n)),b=u.fromByteBuffer(a),d=O(b.featuresCount,b.indexNodeSize);return L.debug("completed: opening http reader"),new C(e,b,s,d)}async*selectBbox(t){const e=this.lengthBeforeTree();let i=this.headerClient;L.debug("starting: selectBbox, traversing index. lengthBeforeTree: "+e),yield*async function*(t,e,i,r){class s{constructor(t,e){this._level=e,this.nodes=t}level(){return this._level}startNode(){return this.nodes[0]}endNode(){return this.nodes[1]}extendEndNodeToNewOffset(t){console.assert(t>this.nodes[1]),this.nodes[1]=t}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}const{minX:n,minY:o,maxX:a,maxY:b}=i,d=function(t,e){if(e<2)throw new Error("Node size must be at least 2");if(0===t)throw new Error("Number of items must be greater than 0");let i=t,r=i;const s=[i];do{i=Math.ceil(i/e),r+=i,s.push(i)}while(1!==i);const n=[];i=r;for(const t of s)n.push(i-t),i-=t;n.reverse(),s.reverse();const o=[];for(let t=0;t<s.length;t++)o.push([n[t],n[t]+s[t]]);return o.reverse(),o}(t,e),h=d[0][0],u=[(()=>{const t=d.length-1;return new s([0,1],t)})()];for(L.debug(`starting stream search with queue: ${u}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${d}`);0!=u.length;){const t=u.shift();L.debug(`popped node: ${t}, queueLength: ${u.length}`);let i=t.startNode();const f=i>=h,[,c]=d[t.level()],l=Math.min(t.endNode()+e,c),_=l-i,p=await r(40*i,40*_),y=new Float64Array(p),g=new Uint32Array(p);for(let e=i;e<l;e++){const r=5*(e-i);if(a<y[r+0])continue;if(b<y[r+1])continue;if(n>y[r+2])continue;if(o>y[r+3])continue;const d=g[8+(r<<1)],c=N(g[9+(r<<1)],d);if(f){L.debug("yielding feature"),yield[c,e-h];continue}const l=6553.6,_=u[u.length-1];if(void 0!==_&&_.level()==t.level()-1&&c<_.endNode()+l){L.debug(`Extending existing node: ${_}, newOffset: ${_.endNode()} -> ${c}`),_.extendEndNodeToNewOffset(c);continue}let p=(()=>{let e=t.level()-1;return new s([c,c+1],e)})();void 0!==_&&_.level()==t.level()-1?L.debug(`pushing new node at offset: ${c} rather than merging with distant ${_}`):L.debug(`pushing new level for ${p} onto queue with tail: ${_}`),u.push(p)}}}(this.header.featuresCount,this.header.indexNodeSize,t,(async function(t,r){return i.getRange(e+t,r,0,"index")}))}lengthBeforeTree(){return P.length+4+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}featureClient(){return void 0===this._featureClient&&(this._featureClient=this.headerClient.clone()),this._featureClient}async readFeature(t){const e=131072;let i,r=t+this.lengthBeforeFeatures();{const t=await this.featureClient().getRange(r,4,e,"feature length");i=new DataView(t).getUint32(0,!0)}L.debug(`featureOffset: ${r}, featureLength: ${i}`);let s=await this.featureClient().getRange(r+4,i,e,"feature data"),n=new Uint8Array(s);const a=new Uint8Array(i+4);a.set(n,4);const b=new o.ByteBuffer(a);return b.setPosition(4),l.getRoot(b)}}class x{constructor(t){this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof t?new V(t):t}clone(){let t=new x(this.httpClient);return t.buffer=this.buffer.slice(0),t.head=this.head,t}async getRange(t,e,i,r){L.debug(`need Range: ${t}-${t+e-1}`);const s=t-this.head,n=s+e;if(s>=0&&n<this.buffer.byteLength)return L.debug(`slicing existing Range: ${s}-${n-1}`),this.buffer.slice(s,n);let o=Math.max(e,i);return this.buffer=await this.httpClient.getRange(t,o,r),this.head=t,this.buffer.slice(0,e)}}class V{constructor(t){this.requestsEverMade=0,this.bytesEverRequested=0,this.url=t}async getRange(t,e,i){this.requestsEverMade+=1,this.bytesEverRequested+=e;let r=`bytes=${t}-${t+e-1}`;return L.debug(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${e}, ever: ${this.bytesEverRequested}), Range: ${r}`),(await fetch(this.url,{headers:{Range:r}})).arrayBuffer()}}async function R(t,e,i){let r=new Uint8Array(await t(4,"feature length"));if(0===r.byteLength)return;let s=new o.ByteBuffer(r);const n=s.readUint32(0);r=new Uint8Array(await t(n,"feature data"));const a=new Uint8Array(n+4);return a.set(r,4),s=new o.ByteBuffer(a),s.setPosition(4),i(l.getRoot(s),e)}function A(t){const e=new o.Builder;let i=null;t.columns&&(i=d.createColumnsVector(e,t.columns.map(t=>function(t,e){const i=t.createString(e.name);return a.start(t),a.addName(t,i),a.addType(t,e.type),a.end(t)}(e,t))));const r=e.createString("L1");d.start(e),d.addFeaturesCount(e,new o.Long(t.featuresCount,0)),d.addGeometryType(e,t.geometryType),d.addIndexNodeSize(e,0),i&&d.addColumns(e,i),d.addName(e,r);const s=d.end(e);return e.finishSizePrefixed(s),e.asUint8Array()}t.deserialize=function(t,e,i){return t instanceof Uint8Array?function(t,e){return{type:"FeatureCollection",features:function(t,e,i){if(!t.subarray(0,7).every((t,e)=>P[e]===t))throw new Error("Not a FlatGeobuf file");const r=new o.ByteBuffer(t),s=r.readUint32(P.length);r.setPosition(P.length+4);const n=u.fromByteBuffer(r);i&&i(n);let a=P.length+4+s;const{indexNodeSize:b,featuresCount:d}=n;b>0&&(a+=O(d,b));const h=[];for(;a<r.capacity();){const t=r.readUint32(a);r.setPosition(a+4);const i=l.getRoot(r);h.push(e(i,n)),a+=4+t}return h}(t,F,e)}}(t,i):t instanceof ReadableStream?function(t,e){return async function*(t,e,i){const r="function"==typeof(s=t).slice?s:new T("function"==typeof s.read?s:s.getReader());var s;const n=async t=>await r.slice(t);let a=new Uint8Array(await n(8));if(!a.every((t,e)=>P[e]===t))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await n(4));let b=new o.ByteBuffer(a);const d=b.readUint32(0);a=new Uint8Array(await n(d)),b=new o.ByteBuffer(a);const h=u.fromByteBuffer(b);i&&i(h);const{indexNodeSize:f,featuresCount:c}=h;if(f>0){const t=O(c,f);await n(t)}let l;for(;l=await R(n,h,e);)yield l}(t,F,e)}(t,i):function(t,e,i){return async function*(t,e,i,r){const s=await C.open(t);L.debug("opened reader"),r&&r(s.header);for await(let t of s.selectBbox(e)){let e=await s.readFeature(t[0]);yield i(e,s.header)}}(t,e,F,i)}(t,e,i)},t.serialize=function(t){return function(t){const i=function(t){const i=t.features[0],s=i.properties;let n=null;return s&&(n=Object.keys(s).map(t=>new e(t,function(t){if("boolean"==typeof t)return r.Bool;if("number"==typeof t)return t%1==0?r.Int:r.Double;if("string"==typeof t)return r.String;if(null===t)return r.String;throw new Error(`Unknown type (value '${t}')`)}(s[t]),null,null,-1,-1,-1,!0,!1,!1))),new u(g(i.geometry.type),n,t.features.length,0,null,null,null,null)}(t),s=A(i),n=t.features.map(t=>m(v(t.geometry),t.properties,i)),o=n.map(t=>t.length).reduce((t,e)=>t+e),a=new Uint8Array(P.length+s.length+o);a.set(s,P.length);let b=P.length+s.length;for(const t of n)a.set(t,b),b+=t.length;return a.set(P),a}(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,i){(function(e){const r=i(3),s="undefined"==typeof window?e:window;s.loaders=s.loaders||{},t.exports=Object.assign(s.loaders,r)}).call(this,i(2))},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";i.r(e),i.d(e,"FlatGeobufLoader",(function(){return n}));var r=i(0);function s(t,e){if(0===t.byteLength)return[];const i=new Uint8Array(t),{features:s}=Object(r.deserialize)(i);return s}const n={...{id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.0-alpha.19",worker:!0,extensions:["fgb"],category:"geometry",options:{flatgeobuf:{}}},parse:async(t,e)=>s(t),parseSync:s,parseInBatchesFromStream:function(t,e){return Object(r.deserializeStream)(t)},binary:!0}}])})); |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _typeof = require("@babel/runtime/helpers/typeof"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,7 +20,11 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var VERSION = typeof "3.0.0-alpha.18" !== 'undefined' ? "3.0.0-alpha.18" : 'latest'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : 'latest'; | ||
var FlatGeobufWorkerLoader = { | ||
@@ -27,0 +31,0 @@ id: 'flatgeobuf', |
@@ -5,3 +5,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -11,3 +11,3 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import parseFlatGeobuf, { parseFlatGeobufInBatches } from './lib/parse-flatgeobuf'; | ||
var VERSION = typeof "3.0.0-alpha.18" !== 'undefined' ? "3.0.0-alpha.18" : 'latest'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : 'latest'; | ||
export var FlatGeobufWorkerLoader = { | ||
@@ -14,0 +14,0 @@ id: 'flatgeobuf', |
{ | ||
"name": "@loaders.gl/flatgeobuf", | ||
"description": "Loader for FlatGeobuf", | ||
"version": "3.0.0-alpha.18", | ||
"version": "3.0.0-alpha.19", | ||
"license": "MIT", | ||
@@ -34,3 +34,3 @@ "publishConfig": { | ||
"dependencies": { | ||
"@loaders.gl/loader-utils": "3.0.0-alpha.18", | ||
"@loaders.gl/loader-utils": "3.0.0-alpha.19", | ||
"flatgeobuf": "^3.1.0" | ||
@@ -41,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "8cb1ea7be6c51bae6a4c61b8ee4b71586b02a797" | ||
"gitHead": "4e0a11c8f59a3c3b96eab8e5b81469f72d682e96" | ||
} |
@@ -1,2 +0,1 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
@@ -3,0 +2,0 @@ const _global = typeof window === 'undefined' ? global : window; |
@@ -5,7 +5,7 @@ // import {deserialize} from 'flatgeobuf/lib/geojson/featurecollection'; | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {arrayBuffer} _ A FlatGeobuf arrayBuffer | ||
* @return {?Object} A GeoJSON geometry object | ||
*/ | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {arrayBuffer} _ A FlatGeobuf arrayBuffer | ||
* @return {?Object} A GeoJSON geometry object | ||
*/ | ||
export default function parseFlatGeobuf(input, options) { | ||
@@ -22,7 +22,7 @@ if (input.byteLength === 0) { | ||
/* | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {ReadableStream} _ A FlatGeobuf arrayBuffer | ||
* @return A GeoJSON geometry object iterator | ||
*/ | ||
* Parse FlatGeobuf arrayBuffer and return GeoJSON. | ||
* | ||
* @param {ReadableStream} _ A FlatGeobuf arrayBuffer | ||
* @return A GeoJSON geometry object iterator | ||
*/ | ||
export function parseFlatGeobufInBatches(stream, options) { | ||
@@ -29,0 +29,0 @@ const iterator = deserializeStream(stream); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
372697
3903
+ Added@loaders.gl/loader-utils@3.0.0-alpha.19(transitive)
+ Added@loaders.gl/worker-utils@3.0.0-alpha.19(transitive)
- Removed@loaders.gl/loader-utils@3.0.0-alpha.18(transitive)
- Removed@loaders.gl/worker-utils@3.0.0-alpha.18(transitive)